Commit 47a7854
feat: collapse first-pass scaffold friction (check chain, agent-docs, cn split, prose) (#825)
* chore: start scaffold example-gallery work (#824)
* fix(ui): split registry lib/utils.ts so importing cn() does not pin a page (#819)
The registry util mixed the pure cn()/domId/ensureId with HTMLElement-era
helpers (Base, defineElement, an SSR stub) that the WebComponent migration
left dead, plus onBeforeCache (which references document). Any client global
in the module marks it client-effecting, so importing cn() into a page pinned
it to the browser and then a co-imported .server.ts tripped
no-server-import-in-browser-module. Delete the dead HTMLElement helpers and
move onBeforeCache to a new lib/dom.ts, leaving utils.ts pure. The CLI copies
dom.ts to lib/utils/dom.ts and rewrites the component import alias. Verified:
a page importing cn + a .server.ts no longer trips the check.
* fix(server): print the full import chain in no-server-import message (#804)
The message truncated the chain to `… ->`, so an agent could not tell whether
the broken edge was in the page itself (carrier problem) or a forgotten types
module. BFS the module graph to print every hop, and when the edge enters via a
types-shaped module name the typedef-relocation fix. Collapses the first-pass
iteration loop the agent hit building the todo app.
* docs: add orm, types-and-mutations, component-shadowing agent-docs (#804)
Codify the shapes that caused the first-pass iteration loops building the todo
app: the Drizzle rc.3 query surface (db.query reads, the dropped select({...})
projection overload, no-arg .returning()); where server-derived types live so a
shipping module does not pin db/*.server.ts (import type vs value import, the
carrier rule); and the inherited WebComponent members app code must not shadow
(title, remove, ...) with the exact TS error each produces.
* feat(cli): pre-edit hook warns on server-only import before the file lands (#804)
The scaffolded check-server-imports hook (PreToolUse Edit/Write) statically
peeks the proposed content: if a browser-facing app module adds an import of a
.server.{ts,js} utility with no 'use server' directive, it warns (the import
would throw at load in the browser). A 'use server' action and an import type
are ignored. WARN by default (webjs check is the authoritative gate);
WEBJS_SERVER_IMPORT_GATE=block hard-blocks. Moves the #804 iteration loop from
post-check to pre-edit.
* test(ui): import onBeforeCache from lib/dom.ts after the #819 split
* docs: scaffold guidance for .server distinction, optimistic UI, a11y, prune
Add four topics to all five per-agent rule files in lockstep: the .server.ts vs
'use server' decision heuristic (#820); optimistic UI by default with the
when-not-to guidance (#817); accessible control labeling via <label for> on both
JS and no-JS paths; and keep-what-you-use pruning (#818), scoped as a no-op for
the api template, with the durable knowledge layer always kept.
* fix(cli): ship the check-server-imports hook in scaffolded apps (#804)
* test(ui): assert Base/defineElement removed instead of present (#819)
* fix(ui): mirror lib/dom.ts in the ui-website registry copy (#819)
The website's copy-registry.js mirrored only lib/utils.ts, so after the #819
split the components importing onBeforeCache from ../lib/dom.ts resolved to a
nonexistent path and 500'd SSR on the deployed registry host. Copy dom.ts and
rewrite its import too.
* test: scaffolded cn.ts is pure, onBeforeCache in dom.ts (#819)
* fix(ui): teach webjs ui add/init the lib/dom.ts split (#819)
The #819 split added lib/dom.ts (onBeforeCache), but the external webjs ui
add/init path only handled lib/utils.ts, so adding a dom-importing component
(dialog, sonner, ...) emitted a broken ../lib/dom.ts import. Add a lib-dom
registry item + declare it on the 6 overlay components, generalize the add
rewrite to both utils.ts and dom.ts (and drop the no-utils early return so a
dom-only component like sonner is rewritten), and have init write dom.ts too.
---------
Co-authored-by: t <t@t>1 parent a579b14 commit 47a7854
34 files changed
Lines changed: 1289 additions & 170 deletions
File tree
- agent-docs
- packages
- cli
- lib
- templates
- .agents/rules
- .claude
- hooks
- .github
- server
- src
- test/check
- ui
- packages
- registry
- components
- lib
- website/scripts
- src/commands
- test
- test
- hooks
- scaffolds
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
0 commit comments