@ultimat3/cli 31.52.0 → 31.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/CLAUDE.md +1 -1
  2. package/package.json +29 -29
  3. package/src/app-kit-disk.ts +39 -0
  4. package/src/app-kit-forms.ts +27 -0
  5. package/src/app-kit.ts +146 -0
  6. package/src/budgets.ts +3 -1
  7. package/src/cdp-shot-driver-screen.ts +72 -0
  8. package/src/cdp-shot-driver.ts +17 -1
  9. package/src/cmd-design-capture.ts +210 -0
  10. package/src/cmd-design-errors.ts +50 -0
  11. package/src/cmd-design-paths.ts +47 -0
  12. package/src/cmd-design-publish.ts +64 -0
  13. package/src/cmd-design-run.ts +229 -0
  14. package/src/cmd-design-spec.ts +47 -0
  15. package/src/cmd-design-theme.ts +107 -0
  16. package/src/cmd-design-url.ts +201 -0
  17. package/src/cmd-design.ts +188 -0
  18. package/src/cmd-doctor.ts +3 -0
  19. package/src/cmd-generate-spec.ts +5 -0
  20. package/src/cmd-generate.ts +3 -1
  21. package/src/cmd-kit-spec.ts +13 -0
  22. package/src/cmd-kit.ts +133 -0
  23. package/src/cmd-shot-against.ts +275 -0
  24. package/src/cmd-shot-spec.ts +9 -1
  25. package/src/cmd-shot.ts +19 -0
  26. package/src/cmd-upgrade.ts +11 -0
  27. package/src/codemods/agent-kit.ts +130 -0
  28. package/src/codemods/agents-md-budget.ts +47 -0
  29. package/src/codemods/docs-visual-quality.ts +198 -0
  30. package/src/codemods/index.ts +8 -0
  31. package/src/codemods/settings-kit-allow.ts +49 -0
  32. package/src/design-extract-script.ts +187 -0
  33. package/src/design-extract.ts +311 -0
  34. package/src/design-map-colors.ts +180 -0
  35. package/src/design-map.ts +288 -0
  36. package/src/doctor-kit.ts +25 -0
  37. package/src/error-catalog.ts +4 -2
  38. package/src/error-codes-kit.ts +24 -0
  39. package/src/error-codes.ts +12 -10
  40. package/src/generate-files.ts +31 -1
  41. package/src/guards-shipped-names.ts +5 -0
  42. package/src/kit/agent-audit.ts +49 -0
  43. package/src/kit/agent-data.ts +32 -0
  44. package/src/kit/agent-server.ts +34 -0
  45. package/src/kit/agent-shape.ts +61 -0
  46. package/src/kit/agent-web.ts +49 -0
  47. package/src/kit/design-map.ts +106 -0
  48. package/src/kit/managed.ts +12 -0
  49. package/src/kit/registry.ts +89 -0
  50. package/src/kit/skill-design-research.ts +119 -0
  51. package/src/kit/skill-feature.ts +159 -0
  52. package/src/kit/skill-planx.ts +139 -0
  53. package/src/kit/skill-upgrade.ts +94 -0
  54. package/src/kit/skill-verify.ts +80 -0
  55. package/src/mcp-errors.ts +5 -0
  56. package/src/mcp-ui-diff.ts +13 -38
  57. package/src/mcp-ui.ts +30 -1
  58. package/src/messages-design.ts +104 -0
  59. package/src/messages-upgrade.ts +9 -0
  60. package/src/messages.ts +2 -0
  61. package/src/registry.ts +4 -0
  62. package/src/shot-diff.ts +96 -0
  63. package/src/shot-gpu.ts +17 -5
  64. package/src/templates/guard-animated-layout-script.ts +173 -0
  65. package/src/templates/guard-effect-without-fallback.ts +117 -0
  66. package/src/templates/guard-motion-adapter.ts +161 -0
  67. package/src/templates/guard-raw-frame-loop.ts +134 -0
  68. package/src/templates/guard-raw-motion-script.ts +132 -0
  69. package/src/templates/guard-raw-motion-ts-scan.ts +95 -0
  70. package/src/templates/guard-released-forms.ts +10 -0
  71. package/src/templates/index.ts +1 -2
  72. package/src/templates/island.ts +55 -8
  73. package/src/templates/kit-released-forms.ts +63 -0
  74. package/src/templates/motion-scale.ts +115 -0
  75. package/src/templates/scaffold-claude.ts +39 -26
  76. package/src/templates/scaffold-design.ts +41 -0
  77. package/src/templates/scaffold-docs.ts +31 -7
  78. package/src/templates/scaffold-guards.ts +31 -2
  79. package/src/templates/scaffold-verify-floor.ts +3 -0
  80. package/src/templates/shapes/blog-site.ts +15 -0
  81. package/src/templates/shapes/blog.ts +2 -0
  82. package/src/templates/shapes/content-site.ts +13 -0
  83. package/src/templates/shapes/content.ts +2 -0
  84. package/src/templates/shapes/dashboard-detail.ts +2 -0
  85. package/src/templates/shapes/dashboard-motion.ts +284 -0
  86. package/src/templates/shapes/dashboard.ts +19 -1
  87. package/src/templates/shapes/landing-motion.ts +67 -0
  88. package/src/templates/shapes/saas.ts +4 -0
  89. package/src/upgrade-gate.ts +14 -2
  90. package/src/upgrade-kit.ts +65 -0
  91. package/src/upgrade-report-kit.ts +28 -0
  92. package/src/upgrade-report.ts +3 -0
  93. package/src/verify-checks.ts +9 -1
  94. package/src/workspace-checks.ts +3 -3
  95. package/wiki/Agents.md +33 -1
  96. package/wiki/CLI-Reference-Tools.md +24 -3
  97. package/wiki/CLI-Reference.md +4 -2
  98. package/wiki/Design-Research.md +96 -0
  99. package/wiki/Effects.md +83 -0
  100. package/wiki/FAQ.md +1 -1
  101. package/wiki/Getting-Started.md +1 -1
  102. package/wiki/Home.md +2 -2
  103. package/wiki/Known-Gaps.md +3 -2
  104. package/wiki/MCP-And-AI.md +4 -0
  105. package/wiki/Motion.md +85 -0
  106. package/wiki/Project-Layout.md +1 -1
  107. package/wiki/Tutorial-02-First-Feature.md +1 -1
  108. package/wiki/UI-Components.md +2 -0
  109. package/wiki/Upgrading.md +4 -2
  110. package/src/templates/scaffold-claude-agents.ts +0 -161
  111. package/src/templates/scaffold-claude-commands.ts +0 -239
@@ -0,0 +1,134 @@
1
+ // The `raw-frame-loop` guard: a per-frame loop is `frameLoop()` from `@ultimat3/ui/motion`, never a
2
+ // bare `requestAnimationFrame(`. A raw loop keeps painting in a hidden tab, offscreen and under
3
+ // reduced motion; `frameLoop` stops for each of those and for a user's pause (WCAG 2.2.2). A
4
+ // `// why:` on the call's line, or the line above it, admits a one-shot that is not a loop —
5
+ //
6
+ // as `raw-interval` admits a tick. REPORT ONLY in an app that predates it.
7
+
8
+ import { guardCode } from './guard';
9
+ import { LOCAL_BINDING_SOURCE } from './guard-local-binding';
10
+ import { TS_BLANK_SOURCE } from './guard-raw-motion-ts-scan';
11
+ import type { GeneratedFile } from './naming';
12
+
13
+ /** Derived from the guard's name, never a literal: an `X_*` literal here is a FRAMEWORK code. */
14
+ const NAME = 'raw-frame-loop';
15
+ const CODE = guardCode(NAME);
16
+
17
+ const source =
18
+ (): string => `// raw-frame-loop: a per-frame loop is frameLoop(), never a bare requestAnimationFrame(.
19
+ // \`x verify\` discovers every file in \`guards/\` and runs its \`guard\` inside the \`boundaries\`
20
+ // step — nothing registers this file, so nothing can forget to. Delete it to drop the rule.
21
+ //
22
+ // Why: a raw loop paints on in a hidden tab, offscreen and under reduced motion, and no user can
23
+ // pause it. \`frameLoop(tick, { el })\` from \`@ultimat3/ui/motion\` stops for each of those. Read: a
24
+ // bare, \`window.\`, \`self.\` or \`globalThis.\` \`requestAnimationFrame(\` in a script outside tests.
25
+ // Admitted: a \`// why:\` on the call's line or the line above it. Not read: a file that binds its
26
+ // own \`requestAnimationFrame\`. REPORT ONLY (\`severity: 'warning'\`) until an app is clean of it.
27
+
28
+ import type { Finding, Guard } from '@ultimat3/cli';
29
+
30
+ /** The app owns the codes its own conventions raise — this one is named for the guard. */
31
+ const CODE = '${CODE}';
32
+
33
+ export interface SourceFile {
34
+ /** App-root-relative POSIX path, so the finding names the file an author opens. */
35
+ readonly path: string;
36
+ readonly source: string;
37
+ }
38
+
39
+ const CALL = /(?<![\\w$.])(?:(?:globalThis|window|self)\\s*\\.\\s*)?requestAnimationFrame\\s*\\(/g;
40
+ const WHY = /\\/\\/\\s*why:/;
41
+
42
+ ${LOCAL_BINDING_SOURCE}
43
+
44
+ ${TS_BLANK_SOURCE}
45
+ /** Pure — the caller does the I/O — so the rule is testable without a filesystem. */
46
+ export function rawFrameLoops(files: readonly SourceFile[]): readonly Finding[] {
47
+ const findings: Finding[] = [];
48
+ for (const file of files) {
49
+ const lines = file.source.split('\\n');
50
+ const text = blankScript(file.source, true);
51
+ const local = bindsLocally(text, 'requestAnimationFrame');
52
+ for (const match of text.matchAll(CALL)) {
53
+ // A bare call to the file's own \`requestAnimationFrame\` is not the browser's; \`window.\` is.
54
+ if (local && match[0].startsWith('requestAnimationFrame')) continue;
55
+ const line = text.slice(0, match.index).split('\\n').length;
56
+ if (WHY.test(lines[line - 1] ?? '') || WHY.test(lines[line - 2] ?? '')) continue;
57
+ const at = \`\${file.path}:\${line}\`;
58
+ findings.push({
59
+ code: CODE,
60
+ cause: \`\${at} runs a frame loop with requestAnimationFrame, which keeps painting in a hidden tab, offscreen and under reduced motion, and which no user can pause\`,
61
+ fix: \`import { frameLoop } from '@ultimat3/ui/motion' and call frameLoop(tick, { el }) at \${at}, disposing it on cleanup — or add a // why: comment on that line naming why this call is not a loop — then: x verify --only boundaries\`,
62
+ at,
63
+ });
64
+ }
65
+ }
66
+ return findings;
67
+ }
68
+
69
+ export const guard: Guard = {
70
+ summary: 'a per-frame loop is frameLoop(), never a bare requestAnimationFrame',
71
+ severity: 'warning',
72
+ async check(_root, sources) {
73
+ const code = await sources.files('{apps,packages}/**/*.{ts,tsx}');
74
+ return rawFrameLoops(
75
+ code
76
+ .filter((file) => !/\\.(?:test|spec|d)\\.tsx?$/.test(file.path))
77
+ .map((file) => ({ path: file.path, source: file.text })),
78
+ );
79
+ },
80
+ };
81
+ `;
82
+
83
+ const test =
84
+ (): string => `// The rule, driven directly. Failure case first: a guard whose rule silently stopped matching is
85
+ // a green gate over the convention it was written to enforce.
86
+
87
+ import { expect, unitTest } from '@ultimat3/testing';
88
+ import { rawFrameLoops } from './raw-frame-loop';
89
+
90
+ const file = (source: string) => [{ path: 'apps/web/app/feed/orb.island.tsx', source }];
91
+
92
+ unitTest('a bare requestAnimationFrame is refused, and the finding names the line', () => {
93
+ const findings = rawFrameLoops(file('const a = 1;\\nrequestAnimationFrame(tick);'));
94
+ expect(findings).toHaveLength(1);
95
+ expect(findings[0]?.code).toBe('${CODE}');
96
+ expect(findings[0]?.at).toBe('apps/web/app/feed/orb.island.tsx:2');
97
+ expect(findings[0]?.fix).toContain('frameLoop');
98
+ });
99
+
100
+ unitTest('window., self. and globalThis. are the same rule', () => {
101
+ expect(rawFrameLoops(file('window.requestAnimationFrame(tick);'))).toHaveLength(1);
102
+ expect(rawFrameLoops(file('self.requestAnimationFrame(tick);'))).toHaveLength(1);
103
+ expect(rawFrameLoops(file('globalThis.requestAnimationFrame(tick);'))).toHaveLength(1);
104
+ });
105
+
106
+ unitTest('a why: on the line or the line above admits it', () => {
107
+ const same = file('requestAnimationFrame(focus); // why: one frame');
108
+ expect(rawFrameLoops(same)).toEqual([]);
109
+ const above = file('// why: one frame\\nrequestAnimationFrame(focus);');
110
+ expect(rawFrameLoops(above)).toEqual([]);
111
+ });
112
+
113
+ unitTest('a comment-like string hides nothing: the call after it is still refused', () => {
114
+ expect(rawFrameLoops(file("const u = '//cdn'; requestAnimationFrame(tick);"))).toHaveLength(1);
115
+ const doc = file("const g = 'dist/*'; requestAnimationFrame(t); /** d */");
116
+ expect(rawFrameLoops(doc)).toHaveLength(1);
117
+ });
118
+
119
+ unitTest('frameLoop, another object, a comment, a string and a local binding are not calls', () => {
120
+ expect(rawFrameLoops(file('frameLoop(tick, { el });'))).toEqual([]);
121
+ expect(rawFrameLoops(file('clock.requestAnimationFrame(tick);'))).toEqual([]);
122
+ expect(rawFrameLoops(file('// requestAnimationFrame(tick);'))).toEqual([]);
123
+ expect(rawFrameLoops(file("const s = 'requestAnimationFrame(tick)';"))).toEqual([]);
124
+ expect(
125
+ rawFrameLoops(file('const requestAnimationFrame = fake;\\nrequestAnimationFrame(tick);')),
126
+ ).toEqual([]);
127
+ });
128
+ `;
129
+
130
+ /** `guards/raw-frame-loop.ts` and its test. No index, no registry — the directory registers it. */
131
+ export const rawFrameLoopGuardFiles = (): readonly GeneratedFile[] => [
132
+ { path: `guards/${NAME}.ts`, contents: source() },
133
+ { path: `guards/${NAME}.test.ts`, contents: test() },
134
+ ];
@@ -0,0 +1,132 @@
1
+ // The `raw-motion-script` guard: `raw-motion`'s rule for TypeScript. A duration or delay handed to
2
+ // `.animate(` and a `cubic-bezier(` string come off the motion scale (`motionTiming()` from
3
+ // `@ultimat3/ui/motion`), so a script moves at the tempo the stylesheets do. A guard of its own,
4
+ // REPORT ONLY (`severity: 'warning'`), because `raw-motion` gates and a stricter rule on `main`
5
+ //
6
+ // is a break; `x new` writes the `"error"` row.
7
+
8
+ import { guardCode } from './guard';
9
+ import { TS_ANIMATE_SCAN_SOURCE } from './guard-raw-motion-ts-scan';
10
+ import { MOTION_SCALE_SOURCE } from './motion-scale';
11
+ import type { GeneratedFile } from './naming';
12
+
13
+ /** Derived from the guard's name, never a literal: an `X_*` literal here is a FRAMEWORK code. */
14
+ const NAME = 'raw-motion-script';
15
+ const CODE = guardCode(NAME);
16
+
17
+ const source =
18
+ (): string => `// raw-motion-script: a script's durations and curves come off the motion scale, never a literal.
19
+ // \`x verify\` discovers every file in \`guards/\` and runs its \`guard\` inside the \`boundaries\`
20
+ // step — nothing registers this file, so nothing can forget to. Delete it to drop the rule.
21
+ //
22
+ // Read: a nonzero number written as \`duration\`, \`delay\` or \`endDelay\` inside a \`.animate(\` call,
23
+ // and any \`cubic-bezier(\` string, in a script outside tests. REPORT ONLY (\`severity: 'warning'\`).
24
+
25
+ import type { Finding, Guard } from '@ultimat3/cli';
26
+
27
+ /** The app owns the codes its own conventions raise — this one is named for the guard. */
28
+ const CODE = '${CODE}';
29
+
30
+ ${MOTION_SCALE_SOURCE}
31
+ ${TS_ANIMATE_SCAN_SOURCE}
32
+ const NUMBER_OPTION = /(?<![\\w$.])(duration|delay|endDelay)\\s*:\\s*(\\d*\\.?\\d+)(?![\\w.])/g;
33
+
34
+ /** Pure — the caller does the I/O — so the rule is testable without a filesystem. */
35
+ export function rawMotionScripts(files: readonly ScriptFile[]): readonly Finding[] {
36
+ const findings: Finding[] = [];
37
+ for (const file of files) {
38
+ if (!isAppScript(file.path)) continue;
39
+ const text = blankScriptComments(file.source);
40
+ for (const call of animateCalls(text)) {
41
+ for (const match of call.body.matchAll(NUMBER_OPTION)) {
42
+ const ms = Number(match[2]);
43
+ if (ms === 0) continue;
44
+ const at = \`\${file.path}:\${scriptLineOf(text, call.start + match.index)}\`;
45
+ findings.push({
46
+ code: CODE,
47
+ cause: \`\${at} animates with \\\`\${match[1]}: \${match[2]}\\\` — a time of this call's own, off the motion scale\`,
48
+ fix: \`\${match[1]}: motionTiming('\${durationFor(ms)}').duration — import { motionTiming } from '@ultimat3/ui/motion' at \${at} (durations: \${DURATIONS.map(([name]) => name).join(' ')}), then: x verify --only boundaries\`,
49
+ at,
50
+ });
51
+ }
52
+ }
53
+ for (const match of text.matchAll(/cubic-bezier\\(([^)]*)\\)/g)) {
54
+ const at = \`\${file.path}:\${scriptLineOf(text, match.index)}\`;
55
+ findings.push({
56
+ code: CODE,
57
+ cause: \`\${at} writes \\\`\${match[0]}\\\` — an easing curve of this file's own, off the motion scale\`,
58
+ fix: \`easing: motionTiming('base', '\${easingFor(match[1] ?? '')}').easing — import { motionTiming } from '@ultimat3/ui/motion' at \${at} (easings: \${Object.values(EASINGS).join(' ')}), then: x verify --only boundaries\`,
59
+ at,
60
+ });
61
+ }
62
+ }
63
+ return findings;
64
+ }
65
+
66
+ export const guard: Guard = {
67
+ summary: 'script durations and easing curves come off the motion scale, never a literal',
68
+ severity: 'warning',
69
+ async check(_root, sources) {
70
+ const scripts = await sources.files('{apps,packages}/**/*.{ts,tsx}');
71
+ return rawMotionScripts(scripts.map((file) => ({ path: file.path, source: file.text })));
72
+ },
73
+ };
74
+ `;
75
+
76
+ const test =
77
+ (): string => `// The rule, driven directly. Failure case first: a guard whose rule silently stopped matching is
78
+ // a green gate over the convention it was written to enforce.
79
+
80
+ import { expect, unitTest } from '@ultimat3/testing';
81
+ import { rawMotionScripts } from './raw-motion-script';
82
+
83
+ const script = (source: string) => [{ path: 'apps/web/app/feed/card.island.tsx', source }];
84
+
85
+ unitTest('a number as duration or delay in .animate( is refused, with the token', () => {
86
+ const findings = rawMotionScripts(
87
+ script('el.animate({ opacity: [0, 1] }, { duration: 300, easing: "ease" });'),
88
+ );
89
+ expect(findings).toHaveLength(1);
90
+ expect(findings[0]?.code).toBe('${CODE}');
91
+ expect(findings[0]?.fix).toStartWith("duration: motionTiming('base').duration — ");
92
+ expect(rawMotionScripts(script('\\nel.animate(k, {\\n delay: 130,\\n});'))[0]?.at).toBe(
93
+ 'apps/web/app/feed/card.island.tsx:3',
94
+ );
95
+ });
96
+
97
+ unitTest('a cubic-bezier string in a script is refused, and the nearest token named', () => {
98
+ const findings = rawMotionScripts(script("const e = 'cubic-bezier(0.2, 0.9, 0.3, 1)';"));
99
+ expect(findings).toHaveLength(1);
100
+ expect(findings[0]?.fix).toStartWith("easing: motionTiming('base', 'out').easing — ");
101
+ });
102
+
103
+ unitTest('a comment-like string hides nothing: the call after it is still read', () => {
104
+ const source = "const g = 'dist/*'; el.animate(k, { duration: 300 }); /** doc */";
105
+ expect(rawMotionScripts(script(source))).toHaveLength(1);
106
+ const cdn = script("const u = '//cdn'; el.animate(k, { delay: 90 });");
107
+ expect(rawMotionScripts(cdn)).toHaveLength(1);
108
+ });
109
+
110
+ unitTest('a token read, a zero, another call, a comment and a test are silent', () => {
111
+ const silent = [
112
+ 'el.animate(k, { duration: timing.duration, delay: 0 });',
113
+ 'el.animate(k, { duration: motionTiming("fast").duration });',
114
+ 'setTimeout(run, { duration: 300 });',
115
+ 'run({ duration: 300 });',
116
+ '// el.animate(k, { duration: 300 });',
117
+ "el.animate({ transform: 'translate(0)' }, { duration: t }); run({ duration: 300 });",
118
+ ];
119
+ for (const source of silent) expect(rawMotionScripts(script(source))).toEqual([]);
120
+ expect(
121
+ rawMotionScripts([
122
+ { path: 'apps/web/app/card.test.ts', source: 'el.animate(k, { duration: 300 });' },
123
+ ]),
124
+ ).toEqual([]);
125
+ });
126
+ `;
127
+
128
+ /** `guards/raw-motion-script.ts` and its test. The directory registers it. */
129
+ export const rawMotionScriptGuardFiles = (): readonly GeneratedFile[] => [
130
+ { path: `guards/${NAME}.ts`, contents: source() },
131
+ { path: `guards/${NAME}.test.ts`, contents: test() },
132
+ ];
@@ -0,0 +1,95 @@
1
+ // The TypeScript scanning helpers of the script motion guards, as source text a guard file carries
2
+ // (a guard imports nothing but types, so a helper is embedded, as `LOCAL_BINDING_SOURCE` is).
3
+ // `TS_BLANK_SOURCE` is the string-aware comment blanker every script guard embeds;
4
+ // `TS_ANIMATE_SCAN_SOURCE` adds the `.animate(` call reader `raw-motion-script` and
5
+ //
6
+ // `animated-layout-script` share.
7
+
8
+ /**
9
+ * Comments blanked IN PLACE (a reported line number still points at the source) by a scan that
10
+ * knows where a string is: `'dist/*'` opens no comment and `'//cdn'` is no line comment.
11
+ * `strings` blanks the string bodies too. A regex literal holding a quote is the one thing it
12
+ * misreads; a quote ends at its line, so the misreading never outlives it.
13
+ */
14
+ export const TS_BLANK_SOURCE = `/** Comments blanked in place; string bodies too when \`strings\` — a string is never a comment. */
15
+ export const blankScript = (text: string, strings = false): string => {
16
+ const pad = (chunk: string): string => chunk.replaceAll(/[^\\n]/g, ' ');
17
+ const parts: string[] = [];
18
+ let kept = 0;
19
+ let i = 0;
20
+ /** Everything since the last cut is code and is copied as one run, never per character. */
21
+ const cut = (from: number, to: number, replacement: string): void => {
22
+ parts.push(text.slice(kept, from), replacement);
23
+ kept = to;
24
+ i = to;
25
+ };
26
+ while (i < text.length) {
27
+ const ch = text[i] ?? '';
28
+ const next = text[i + 1];
29
+ if (ch === '/' && (next === '/' || next === '*')) {
30
+ const close = next === '/' ? text.indexOf('\\n', i) : text.indexOf('*/', i + 2);
31
+ const end = close === -1 ? text.length : next === '/' ? close : close + 2;
32
+ cut(i, end, pad(text.slice(i, end)));
33
+ } else if (ch === "'" || ch === '"' || ch === '\`') {
34
+ let j = i + 1;
35
+ while (j < text.length && text[j] !== ch) {
36
+ if (text[j] === '\\\\') j += 1;
37
+ else if (ch !== '\`' && text[j] === '\\n') break;
38
+ j += 1;
39
+ }
40
+ const end = Math.min(j + 1, text.length);
41
+ if (strings) cut(i, end, pad(text.slice(i, end)));
42
+ else i = end;
43
+ } else i += 1;
44
+ }
45
+ parts.push(text.slice(kept));
46
+ return parts.join('');
47
+ };
48
+ `;
49
+
50
+ export const TS_ANIMATE_SCAN_SOURCE = `${TS_BLANK_SOURCE}
51
+ export interface ScriptFile {
52
+ /** App-root-relative POSIX path, so the finding names the file an author opens. */
53
+ readonly path: string;
54
+ readonly source: string;
55
+ }
56
+
57
+ /** A script an author did not write for the app: a test, a story, a declaration. */
58
+ export const isAppScript = (path: string): boolean =>
59
+ /\\.(?:ts|tsx)$/.test(path) && !/\\.(?:test|spec|d)\\.tsx?$/.test(path);
60
+
61
+ /** Comments blanked, strings kept: a curve is written in one. */
62
+ export const blankScriptComments = (text: string): string => blankScript(text);
63
+
64
+ export const scriptLineOf = (text: string, index: number): number =>
65
+ text.slice(0, index).split('\\n').length;
66
+
67
+ export interface AnimateCall {
68
+ /** Offset of the first argument character in the file. */
69
+ readonly start: number;
70
+ /** The argument text, up to the call's own closing paren; a paren in a string never counts. */
71
+ readonly body: string;
72
+ }
73
+
74
+ /** Every \`.animate(\` call, balanced to its closing paren. */
75
+ export function animateCalls(text: string): readonly AnimateCall[] {
76
+ const calls: AnimateCall[] = [];
77
+ for (const match of text.matchAll(/\\.animate\\s*\\(/g)) {
78
+ const start = match.index + match[0].length;
79
+ let depth = 1;
80
+ let quote = '';
81
+ let i = start;
82
+ for (; i < text.length && depth > 0; i += 1) {
83
+ const ch = text[i] ?? '';
84
+ if (quote !== '') {
85
+ if (ch === '\\\\') i += 1;
86
+ else if (ch === quote) quote = '';
87
+ } else if (ch === "'" || ch === '"' || ch === '\`') quote = ch;
88
+ else if (ch === '(') depth += 1;
89
+ else if (ch === ')') depth -= 1;
90
+ }
91
+ calls.push({ start, body: text.slice(start, i - 1) });
92
+ }
93
+ return calls;
94
+ }
95
+ `;
@@ -10,6 +10,7 @@ export const RELEASED_GUARD_FORMS: Readonly<
10
10
  ['2hqr04589t23q', 'error'],
11
11
  ['2z9j3sd8e7lgl', 'error'],
12
12
  ],
13
+ 'animated-layout-script': [['imwzfn6wtwa6', 'warning']],
13
14
  'bare-error': [
14
15
  ['1m3eimglwzrdq', 'error'],
15
16
  ['1njzso3r6drnd', 'error'],
@@ -18,6 +19,7 @@ export const RELEASED_GUARD_FORMS: Readonly<
18
19
  ['2s43pcjqyhmfi', 'error'],
19
20
  ['n9w3ww2famyi', 'error'],
20
21
  ],
22
+ 'effect-without-fallback': [['1klsn88horset', 'warning']],
21
23
  'error-declared': [
22
24
  ['1rlzex7nalpiw', 'error'],
23
25
  ['2tfw2hq80msju', 'error'],
@@ -43,6 +45,7 @@ export const RELEASED_GUARD_FORMS: Readonly<
43
45
  ['2os1f5fb6aass', 'error'],
44
46
  ['31gjhz3nyf0gz', 'error'],
45
47
  ],
48
+ 'motion-adapter': [['1xwu8j0vup1kd', 'warning']],
46
49
  'native-confirm': [
47
50
  ['1f7eh34hj085a', 'error'],
48
51
  ['2b134wpkoaqso', 'error'],
@@ -66,6 +69,7 @@ export const RELEASED_GUARD_FORMS: Readonly<
66
69
  ['21v2jbczhqz8k', 'error'],
67
70
  ['mazudnz7t6iy', 'error'],
68
71
  ],
72
+ 'raw-frame-loop': [['k41idqxhbwp6', 'warning']],
69
73
  'raw-interval': [
70
74
  ['1o6p0fmjhzdhw', 'error'],
71
75
  ['2xrqszz066coc', 'error'],
@@ -85,6 +89,7 @@ export const RELEASED_GUARD_FORMS: Readonly<
85
89
  ['u6julhh0et2k', 'error'],
86
90
  ['w8aw0q20tfsz', 'error'],
87
91
  ],
92
+ 'raw-motion-script': [['1af8jx69uczx0', 'warning']],
88
93
  'raw-shadow': [
89
94
  ['13t0n8kesciv6', 'error'],
90
95
  ['1vhy6xulc5cs5', 'error'],
@@ -168,19 +173,24 @@ export const RELEASED_GUARD_FORMS: Readonly<
168
173
  /** Every hash each shipped guard's TEST file was released as: an unedited test goes without a note. */
169
174
  export const RELEASED_GUARD_TEST_FORMS: Readonly<Record<string, readonly string[]>> = {
170
175
  'animated-layout-property': ['191zjn08f13h4'],
176
+ 'animated-layout-script': ['dw348y39b0ve'],
171
177
  'bare-error': ['17uv4zrzcuwbk', '1epwa72g9sk4u', '1w7vwbtypxdwe'],
178
+ 'effect-without-fallback': ['1yjzzgpg03gey'],
172
179
  'error-declared': ['2hj2bs2czhxnw', 'qe8afpq7pzf1'],
173
180
  'focus-visible': ['12c0rk3ljkx6q'],
174
181
  'image-dimensions': ['3p4hkambgpb4j'],
175
182
  'island-mount-clears': ['2jkeu60fnvtdg'],
176
183
  'island-without-states': ['vls0ujdd16gw'],
184
+ 'motion-adapter': ['2y1k1zjt99ndz'],
177
185
  'native-confirm': ['1c7vps5wn37uv', 'qwyn1mzn9ace'],
178
186
  'raw-breakpoint': ['w356i8dreh7j'],
179
187
  'raw-colour': ['1nhoblzxa9kp1', '1tc7cambk8byr', '319l3wictp9lf'],
180
188
  'raw-fetch': ['2lips924uo00f'],
189
+ 'raw-frame-loop': ['1feko87is1n1i'],
181
190
  'raw-interval': ['1z55givy4sst0'],
182
191
  'raw-length': ['1hpgz9jowk5qu'],
183
192
  'raw-motion': ['2kg7ezhf8u7a9', '6420344uhv97', 'g6cs0de9jmr7', 'xes72msaf3a3'],
193
+ 'raw-motion-script': ['2bmyfrg3hwi7r'],
184
194
  'raw-shadow': ['3kg8ft6y3ia0y'],
185
195
  'raw-z-index': ['3fb40f6bwp8kq'],
186
196
  'repo-await-in-loop': ['2axgbb82wldt4'],
@@ -36,10 +36,9 @@ export type { RouteOptions, Surface } from './route';
36
36
  export { routeFiles } from './route';
37
37
  export { appFiles } from './scaffold-app';
38
38
  export { claudeFiles } from './scaffold-claude';
39
- export { claudeAgentFiles } from './scaffold-claude-agents';
40
- export { claudeCommandFiles } from './scaffold-claude-commands';
41
39
  export { containerFiles } from './scaffold-container';
42
40
  export { dashboardFiles } from './scaffold-dashboard';
41
+ export { DESIGN_PATH, designFiles } from './scaffold-design';
43
42
  export { docsFiles } from './scaffold-docs';
44
43
  export { entryFiles } from './scaffold-entries';
45
44
  export { errorPageFiles, PWA_COLORS } from './scaffold-errors';
@@ -7,12 +7,37 @@
7
7
  // and mounts it.
8
8
 
9
9
  import { trimTrailingSlashes } from '@ultimat3/core';
10
+ import { BadFlagError } from '../errors';
11
+ import { loadVersion } from '../version-loader';
10
12
  import type { GeneratedFile } from './naming';
11
13
  import { camel, kebab, pascal } from './naming';
12
14
 
15
+ /**
16
+ * The `@ultimat3/effects` entries `--effect` wraps the island's panel in: each takes children and
17
+ * nothing else it must be given, so the scaffold is the smallest honest use. The rest (`EffectCanvas`
18
+ * wants a `draw` and a `fallback`; `Marquee`, `TextReveal` and `CountUp` take no children) are
19
+ * written by hand against `wiki/Effects.md`.
20
+ */
21
+ export const EFFECT_ENTRIES = {
22
+ aurora: 'Aurora',
23
+ 'gradient-orbs': 'GradientOrbs',
24
+ 'mosaic-grid': 'MosaicGrid',
25
+ 'grid-glow': 'GridGlow',
26
+ noise: 'Noise',
27
+ 'shader-background': 'ShaderBackground',
28
+ 'spotlight-card': 'SpotlightCard',
29
+ tilt: 'Tilt',
30
+ 'glass-surface': 'GlassSurface',
31
+ shimmer: 'Shimmer',
32
+ } as const;
33
+
34
+ export type EffectEntry = keyof typeof EFFECT_ENTRIES;
35
+
13
36
  export interface IslandOptions {
14
37
  /** Directory the entry lands in, app-root-relative and POSIX — normally a route's own folder. */
15
38
  readonly dir: string;
39
+ /** Wrap the panel in this `@ultimat3/effects` entry (`x g island <name> --effect aurora`). */
40
+ readonly effect?: EffectEntry | undefined;
16
41
  }
17
42
 
18
43
  /**
@@ -27,8 +52,9 @@ export const upToAppRoot = (dir: string): string =>
27
52
  .map(() => "'..'")
28
53
  .join(', ');
29
54
 
30
- const islandSource = (name: string): string => {
55
+ const islandSource = (name: string, effect?: EffectEntry): string => {
31
56
  const Name = pascal(name);
57
+ const Effect = effect === undefined ? undefined : EFFECT_ENTRIES[effect];
32
58
  return `// ${Name}: the interactive half of an otherwise static page, and the only module on this
33
59
  // route the browser downloads.
34
60
  //
@@ -37,9 +63,9 @@ const islandSource = (name: string): string => {
37
63
  // A string has no import edge, so nothing follows one into this file and the page's bundle graph
38
64
  // stays the page's (axiom 6). WHEN it wakes is the route's \`hydrate\`, never a declaration here.
39
65
 
40
- import { mountOver } from '@ultimat3/render/client';
41
- import type { JSX } from 'solid-js';
42
- import { createSignal } from 'solid-js';
66
+ ${Effect === undefined ? '' : 'import { ' + Effect + " } from '@ultimat3/effects';\n"}import { mountOver } from '@ultimat3/render/client';
67
+ ${Effect === undefined ? '' : "import { setSolidRuntime } from '@ultimat3/ui';\n"}import type { JSX } from 'solid-js';
68
+ ${Effect === undefined ? "import { createSignal } from 'solid-js';" : "import {\n createContext,\n createEffect,\n createMemo,\n createRoot,\n createSignal,\n onCleanup,\n useContext,\n} from 'solid-js';"}
43
69
  import { render } from 'solid-js/web';
44
70
  import styles from './${name}.module.scss';
45
71
 
@@ -57,14 +83,14 @@ export interface ${Name}Props {
57
83
  */
58
84
  function ${Name}(props: ${Name}Props): JSX.Element {
59
85
  const [count, setCount] = createSignal(0);
60
- return (
86
+ ${Effect === undefined ? 'return (' : 'const panel = ('}
61
87
  <p class={styles.panel}>
62
88
  <button type="button" class={styles.trigger} onClick={() => setCount(count() + 1)}>
63
89
  {props.label}
64
90
  </button>
65
91
  <output data-role="count">{count()}</output>
66
92
  </p>
67
- );
93
+ );${Effect === undefined ? '' : '\n return <' + Effect + '>{panel}</' + Effect + '>;'}
68
94
  }
69
95
 
70
96
  /**
@@ -77,7 +103,7 @@ function ${Name}(props: ${Name}Props): JSX.Element {
77
103
  * which marks the root \`data-x-failed\` for the error reporter.
78
104
  */
79
105
  export function mount(el: HTMLElement, props: ${Name}Props): () => void {
80
- // Solid's \`render\` answers its disposer; returning it is what lets the client router and
106
+ ${Effect === undefined ? '' : ' // The effect reaches the reactive graph through the runtime an entry registers.\n setSolidRuntime({\n createContext,\n useContext,\n createSignal,\n createMemo,\n createEffect,\n onCleanup,\n createRoot,\n });\n'} // Solid's \`render\` answers its disposer; returning it is what lets the client router and
81
107
  // \`@ultimat3/testing\` stop this island — its timers included — when they are done with it.
82
108
  return mountOver(el, (root) => render(() => <${Name} {...props} />, root));
83
109
  }
@@ -199,13 +225,34 @@ export const ${camel(name)}States = defineIslandStates({
199
225
  `;
200
226
  };
201
227
 
228
+ /**
229
+ * The island imports `@ultimat3/effects`, so the app declares it: a `merge: 'json'` entry on the
230
+ * root manifest, which adds the one key where the file keeps it sorted and leaves a held one alone.
231
+ * Exact-pinned like every `@ultimat3/*` (`shapes/landing-motion.ts`'s `effectsDependency`).
232
+ */
233
+ const effectsDependency = (): GeneratedFile => ({
234
+ path: 'package.json',
235
+ contents: `${JSON.stringify({ dependencies: { '@ultimat3/effects': loadVersion() } })}\n`,
236
+ merge: 'json',
237
+ });
238
+
202
239
  export function islandFiles(rawName: string, options: IslandOptions): readonly GeneratedFile[] {
203
240
  const name = kebab(rawName);
241
+ if (options.effect !== undefined && !Object.hasOwn(EFFECT_ENTRIES, options.effect)) {
242
+ const entries = Object.keys(EFFECT_ENTRIES);
243
+ throw new BadFlagError({
244
+ flag: 'effect',
245
+ command: 'g island',
246
+ reason: `"${options.effect}" is no entry that wraps a panel — one of: ${entries.join(', ')}`,
247
+ fix: `x g island ${name} --effect ${entries[0]}`,
248
+ });
249
+ }
204
250
  const dir = trimTrailingSlashes(options.dir);
205
251
  return [
206
- { path: `${dir}/${name}.island.tsx`, contents: islandSource(name) },
252
+ { path: `${dir}/${name}.island.tsx`, contents: islandSource(name, options.effect) },
207
253
  { path: `${dir}/${name}.module.scss`, contents: islandStyle() },
208
254
  { path: `${dir}/${name}.island.states.ts`, contents: islandStates(name, dir) },
209
255
  { path: `${dir}/${name}.island.test.ts`, contents: islandTest(name, dir) },
256
+ ...(options.effect === undefined ? [] : [effectsDependency()]),
210
257
  ];
211
258
  }
@@ -0,0 +1,63 @@
1
+ // GENERATED by `bun run scripts/lib/kit-refresh-forms.ts --write` — never hand-edited. Every
2
+ // text a release wrote as a `.claude/commands/<n>.md`, `.claude/agents/<n>.md` or `.claude/README.md` (`kitFormHash`,
3
+ // the app's name normalised), so the `agent-kit` codemod deletes an unedited old file and renames an edit.
4
+
5
+ export const RELEASED_KIT_FORMS: Readonly<Record<string, readonly string[]>> = {
6
+ '.claude/README.md': [
7
+ '1c60k0bshnd6h',
8
+ '1qjotyc5zkgqa',
9
+ '20tbhhd696nuw',
10
+ '2sg7x0nniu0e3',
11
+ '3t27j7bgulyqt',
12
+ '3vot7ec2foty5',
13
+ ],
14
+ '.claude/agents/data.md': [
15
+ '1dpmsd1vbs3w4',
16
+ '2ir9i17wzghiy',
17
+ '3af5df936nhuv',
18
+ '3oqzm22izyqwd',
19
+ 'nyqgvkbotzrd',
20
+ 'pg0jsys8bjkk',
21
+ ],
22
+ '.claude/agents/server.md': [
23
+ '20mlgm4a2cajp',
24
+ '27v0hra7d3wo4',
25
+ '2qvsibnoo2r6g',
26
+ '2zfwiqpxi546g',
27
+ '323ea7npeasxj',
28
+ '35adffpru7gua',
29
+ '38izgk5ptj0n7',
30
+ ],
31
+ '.claude/agents/shape.md': ['21aw2weazaao1', '2697inatyxh7c', '2mowwmm2ac000', '3scf1q8xlh0qp'],
32
+ '.claude/agents/web.md': [
33
+ '22kd9gswfezn5',
34
+ '26mtk30b3o3s',
35
+ '2dhsf8q730uad',
36
+ '2tahjadro1w7r',
37
+ '36tuv2b6fcunt',
38
+ '3jotce8905nc7',
39
+ 'eyqeccnhzspg',
40
+ ],
41
+ '.claude/commands/feature.md': [
42
+ '1b92xxvogr854',
43
+ '1dbaptf36chnu',
44
+ '1he2ofadchh1i',
45
+ '1nv6gm0begmj7',
46
+ '272b3fwsxawg1',
47
+ '3aruwh67fa6ai',
48
+ '3ec07orq6vz31',
49
+ '7832w47vagla',
50
+ 'c2w1bscmzvx0',
51
+ 'o6os4hxczr1e',
52
+ 'zbase8etm9db',
53
+ ],
54
+ '.claude/commands/planx.md': ['104o4alspr8ih', '10o9aqzvxma1f', '323tosiodhcra', '33mre289jxf7k'],
55
+ '.claude/commands/verify.md': [
56
+ '11qa15dl0l1ek',
57
+ '1jojfb2g7byfe',
58
+ '1ucwusmp7iwh0',
59
+ '2a3yh5w10v6pb',
60
+ '2m41ibudxzui8',
61
+ '3hxs7gmjh41hy',
62
+ ],
63
+ };