@ultimat3/cli 31.51.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.
- package/CLAUDE.md +1 -1
- package/README.md +9 -9
- package/package.json +29 -29
- package/src/app-kit-disk.ts +39 -0
- package/src/app-kit-forms.ts +27 -0
- package/src/app-kit.ts +146 -0
- package/src/budgets.ts +3 -1
- package/src/catalog-layout.ts +194 -0
- package/src/cdp-shot-driver-screen.ts +72 -0
- package/src/cdp-shot-driver.ts +17 -1
- package/src/cmd-design-capture.ts +210 -0
- package/src/cmd-design-errors.ts +50 -0
- package/src/cmd-design-paths.ts +47 -0
- package/src/cmd-design-publish.ts +64 -0
- package/src/cmd-design-run.ts +229 -0
- package/src/cmd-design-spec.ts +47 -0
- package/src/cmd-design-theme.ts +107 -0
- package/src/cmd-design-url.ts +201 -0
- package/src/cmd-design.ts +188 -0
- package/src/cmd-doctor.ts +3 -0
- package/src/cmd-generate-spec.ts +5 -0
- package/src/cmd-generate.ts +3 -1
- package/src/cmd-i18n-spec.ts +4 -4
- package/src/cmd-i18n-split.ts +133 -0
- package/src/cmd-i18n.ts +46 -66
- package/src/cmd-kit-spec.ts +13 -0
- package/src/cmd-kit.ts +133 -0
- package/src/cmd-shot-against.ts +275 -0
- package/src/cmd-shot-spec.ts +9 -1
- package/src/cmd-shot.ts +19 -0
- package/src/cmd-upgrade.ts +11 -0
- package/src/codemods/agent-kit.ts +130 -0
- package/src/codemods/agents-md-budget.ts +47 -0
- package/src/codemods/docs-visual-quality.ts +198 -0
- package/src/codemods/index.ts +8 -0
- package/src/codemods/settings-kit-allow.ts +49 -0
- package/src/config-redact.ts +20 -4
- package/src/db-rollback-pass.ts +4 -1
- package/src/design-extract-script.ts +187 -0
- package/src/design-extract.ts +311 -0
- package/src/design-map-colors.ts +180 -0
- package/src/design-map.ts +288 -0
- package/src/dev-child-watch.ts +16 -0
- package/src/dev-db-migrate.ts +27 -46
- package/src/dev-db-migrator-hold.ts +131 -0
- package/src/dev-db-rollback.ts +11 -2
- package/src/dev-rebuild-schema.ts +7 -24
- package/src/doctor-kit.ts +25 -0
- package/src/error-catalog.ts +4 -2
- package/src/error-codes-kit.ts +24 -0
- package/src/error-codes.ts +12 -10
- package/src/generate-catalog-locales.ts +25 -2
- package/src/generate-files.ts +31 -1
- package/src/generate-follow-ups.ts +8 -3
- package/src/guards-shipped-names.ts +5 -0
- package/src/i18n-audit.ts +17 -33
- package/src/i18n-index.ts +108 -31
- package/src/i18n-locale-parity.ts +14 -6
- package/src/i18n-new-locale.ts +75 -0
- package/src/i18n-registration.ts +52 -27
- package/src/island-capture.ts +36 -7
- package/src/kit/agent-audit.ts +49 -0
- package/src/kit/agent-data.ts +32 -0
- package/src/kit/agent-server.ts +34 -0
- package/src/kit/agent-shape.ts +61 -0
- package/src/kit/agent-web.ts +49 -0
- package/src/kit/design-map.ts +106 -0
- package/src/kit/managed.ts +12 -0
- package/src/kit/registry.ts +89 -0
- package/src/kit/skill-design-research.ts +119 -0
- package/src/kit/skill-feature.ts +159 -0
- package/src/kit/skill-planx.ts +139 -0
- package/src/kit/skill-upgrade.ts +94 -0
- package/src/kit/skill-verify.ts +80 -0
- package/src/mcp-errors.ts +5 -0
- package/src/mcp-ui-diff.ts +13 -38
- package/src/mcp-ui.ts +30 -1
- package/src/merge-state.ts +3 -2
- package/src/messages-design.ts +104 -0
- package/src/messages-floor.ts +2 -0
- package/src/messages-upgrade.ts +9 -0
- package/src/messages.ts +4 -0
- package/src/registry.ts +4 -0
- package/src/serve-boot-telemetry.ts +106 -0
- package/src/serve-boot.ts +23 -4
- package/src/shot-blank.ts +70 -0
- package/src/shot-diff.ts +96 -0
- package/src/shot-gpu.ts +17 -5
- package/src/templates/catalog-barrel.ts +84 -0
- package/src/templates/guard-animated-layout-script.ts +173 -0
- package/src/templates/guard-effect-without-fallback.ts +117 -0
- package/src/templates/guard-motion-adapter.ts +161 -0
- package/src/templates/guard-raw-frame-loop.ts +134 -0
- package/src/templates/guard-raw-motion-script.ts +132 -0
- package/src/templates/guard-raw-motion-ts-scan.ts +95 -0
- package/src/templates/guard-released-forms.ts +12 -1
- package/src/templates/guard-untranslated-string.ts +27 -6
- package/src/templates/index.ts +1 -2
- package/src/templates/island.ts +55 -8
- package/src/templates/kit-released-forms.ts +63 -0
- package/src/templates/locales.ts +6 -0
- package/src/templates/motion-scale.ts +115 -0
- package/src/templates/scaffold-claude.ts +39 -26
- package/src/templates/scaffold-design.ts +41 -0
- package/src/templates/scaffold-docs.ts +31 -7
- package/src/templates/scaffold-gitattributes.ts +9 -2
- package/src/templates/scaffold-guards.ts +31 -2
- package/src/templates/scaffold-i18n.ts +10 -6
- package/src/templates/scaffold-verify-floor.ts +3 -0
- package/src/templates/shapes/blog-site.ts +15 -0
- package/src/templates/shapes/blog.ts +2 -0
- package/src/templates/shapes/content-site.ts +13 -0
- package/src/templates/shapes/content.ts +2 -0
- package/src/templates/shapes/dashboard-detail.ts +2 -0
- package/src/templates/shapes/dashboard-motion.ts +284 -0
- package/src/templates/shapes/dashboard.ts +19 -1
- package/src/templates/shapes/landing-motion.ts +67 -0
- package/src/templates/shapes/offline.ts +5 -2
- package/src/templates/shapes/saas.ts +4 -0
- package/src/test-ignores.ts +3 -2
- package/src/upgrade-gate.ts +14 -2
- package/src/upgrade-kit.ts +65 -0
- package/src/upgrade-report-kit.ts +28 -0
- package/src/upgrade-report.ts +3 -0
- package/src/verify-checks.ts +9 -1
- package/src/verify-floor.ts +9 -1
- package/src/verify-local-only.ts +66 -0
- package/src/verify-run.ts +17 -2
- package/src/workspace-checks.ts +3 -3
- package/wiki/Actions.md +1 -1
- package/wiki/Agents.md +33 -1
- package/wiki/Auth.md +3 -3
- package/wiki/Batching-And-Preloading.md +1 -0
- package/wiki/CLI-Reference-Data.md +241 -0
- package/wiki/CLI-Reference-Gate.md +572 -0
- package/wiki/CLI-Reference-Project.md +414 -0
- package/wiki/CLI-Reference-Ship.md +348 -0
- package/wiki/CLI-Reference-Tools.md +687 -0
- package/wiki/CLI-Reference.md +18 -2227
- package/wiki/Compared.md +8 -8
- package/wiki/Configuration.md +26 -2
- package/wiki/Deployment.md +1 -1
- package/wiki/Design-Research.md +96 -0
- package/wiki/Effects.md +83 -0
- package/wiki/Entities-And-Migrations.md +3 -2
- package/wiki/FAQ.md +1 -1
- package/wiki/Getting-Started.md +1 -1
- package/wiki/Home.md +2 -2
- package/wiki/I18n.md +39 -5
- package/wiki/Installation.md +1 -1
- package/wiki/Jobs-And-Workflows.md +29 -1
- package/wiki/Known-Gaps.md +6 -2
- package/wiki/MCP-And-AI.md +4 -0
- package/wiki/Motion.md +85 -0
- package/wiki/Observability.md +15 -1
- package/wiki/Outbound-HTTP.md +62 -2
- package/wiki/PWA-And-Offline.md +1 -1
- package/wiki/Policies-And-Authz.md +10 -0
- package/wiki/Project-Layout.md +1 -1
- package/wiki/Realtime.md +29 -2
- package/wiki/Static-Assets.md +1 -1
- package/wiki/Testing.md +33 -0
- package/wiki/Theming.md +31 -8
- package/wiki/Troubleshooting.md +1 -1
- package/wiki/Tutorial-02-First-Feature.md +1 -1
- package/wiki/UI-Components.md +2 -0
- package/wiki/Upgrading.md +9 -3
- package/src/templates/scaffold-claude-agents.ts +0 -161
- package/src/templates/scaffold-claude-commands.ts +0 -239
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
// 31.53.0: CLAUDE.md names the motion and effect guards, the Visual quality section and the agent
|
|
2
|
+
// kit that replaced `.claude/commands`. Prose: each edit lands where the text stands as `x new` wrote
|
|
3
|
+
// it, within the brief's byte budget; one that cannot be placed is reported with the row to add.
|
|
4
|
+
|
|
5
|
+
import { editAgentsDocRow } from './agents-doc-row';
|
|
6
|
+
import type { Codemod, CodemodApp, CodemodResult } from './codemod';
|
|
7
|
+
import { mergeResults } from './engine-edits';
|
|
8
|
+
|
|
9
|
+
const lines = (...text: readonly string[]): string => text.join('\n');
|
|
10
|
+
|
|
11
|
+
const OLD_HARNESS = lines(
|
|
12
|
+
'- `.claude/` holds a harness that reads this file: `/feature`, `/planx`, `/verify` and four',
|
|
13
|
+
' boundary-scoped subagents. `.claude/README.md` says what each costs; every file is deletable.',
|
|
14
|
+
);
|
|
15
|
+
const NEW_HARNESS = lines(
|
|
16
|
+
'- `.claude/` holds the agent kit that reads this file: five skills, five boundary-scoped agents.',
|
|
17
|
+
' Managed: `bunx x kit` rewrites them, an edit in place is `X_KIT_DRIFT`; yours go in `app-*`.',
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const NEW_SKILLS =
|
|
21
|
+
'| `.claude/skills/` | `feature` (hive, one PR, done when merged), `planx`, `verify`, `upgrade`, `design-research` | plain markdown any agent can follow; `bunx x kit` keeps them current |';
|
|
22
|
+
|
|
23
|
+
const OLD_TIMING =
|
|
24
|
+
'| Timing | a duration and an easing curve come off the motion scale, never a literal | `raw-motion` |';
|
|
25
|
+
const NEW_TIMING = lines(
|
|
26
|
+
'| Timing | a duration and an easing curve come off the motion scale — `motionTiming()` from `@ultimat3/ui/motion` in TypeScript — never a literal | `raw-motion`, `raw-motion-script` |',
|
|
27
|
+
'| Motion adapter | animation through `@ultimat3/ui/motion` and `@ultimat3/effects`, never an animation or shader library | `motion-adapter` |',
|
|
28
|
+
'| Frame loops | `frameLoop(tick, { el })` from `@ultimat3/ui/motion`, never a bare `requestAnimationFrame(`; a `// why:` admits one | `raw-frame-loop` |',
|
|
29
|
+
'| Effects | a `<canvas>` or WebGL context only inside `EffectCanvas` (`@ultimat3/effects`), whose `fallback` is required | `effect-without-fallback` |',
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const OLD_MOTION =
|
|
33
|
+
'| Motion | animate `transform` and `opacity` — never a layout property, never `transition: all` | `animated-layout-property` |';
|
|
34
|
+
const NEW_MOTION =
|
|
35
|
+
'| Motion | animate `transform` and `opacity` — never a layout property, never `transition: all`; reorder with `layout()` from `@ultimat3/ui/motion` | `animated-layout-property`, `animated-layout-script` |';
|
|
36
|
+
|
|
37
|
+
const BEFORE_TOOLS = '## Agent tools';
|
|
38
|
+
const VISUAL_QUALITY = lines(
|
|
39
|
+
'## Visual quality',
|
|
40
|
+
'',
|
|
41
|
+
"`apps/web/DESIGN.md` is this app's design — tokens, type, motion, sources — read before rendering.",
|
|
42
|
+
'',
|
|
43
|
+
'| Rule | Refused by |',
|
|
44
|
+
'|---|---|',
|
|
45
|
+
'| every colour pair a theme changes meets WCAG 2.2 AA | `defineTheme`: `X_UI_CONTRAST_INSUFFICIENT` |',
|
|
46
|
+
'| motion is optional: loops and effects stop for reduced motion, a hidden tab and `MotionToggle` | `raw-frame-loop`, `motion-adapter` |',
|
|
47
|
+
"| an effect's static frame renders first, so `site/` stays 0kb JS | `effect-without-fallback`, the `budgets` step |",
|
|
48
|
+
'| a look is matched by measurement: `bunx x shot <route> --against .x/design/<slug>` | recorded, never gating |',
|
|
49
|
+
'',
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const COMMAND_ROW = /^\| `\.claude\/commands\/(?:feature|planx|verify)\.md` \|.*$/;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Every wording `x new` ever shipped for the three rows (read off each release tag's
|
|
56
|
+
* `scaffold-docs.ts`): 31.22.0 to 31.35.x said "plain markdown: any agent can read one and follow it",
|
|
57
|
+
* later ones "plain markdown any agent can follow". A row in neither is the author's.
|
|
58
|
+
*/
|
|
59
|
+
const SHIPPED_COMMAND_ROWS: ReadonlySet<string> = new Set([
|
|
60
|
+
'| `.claude/commands/feature.md` | build or fix one thing end to end, done when `bun run verify` is green | plain markdown: any agent can read one and follow it |',
|
|
61
|
+
'| `.claude/commands/planx.md` | write a plan to `docs/plans/` for another agent to execute | the same |',
|
|
62
|
+
'| `.claude/commands/verify.md` | run the gate and fix what it reports | the same |',
|
|
63
|
+
'| `.claude/commands/feature.md` | build or fix one thing end to end, done when `bun run verify` is green | plain markdown any agent can follow |',
|
|
64
|
+
'| `.claude/commands/planx.md` | write a plan to `docs/plans/` | the same |',
|
|
65
|
+
]);
|
|
66
|
+
|
|
67
|
+
const SECTION = '## Agent tools';
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* `text` from the Agent tools heading to the last row of the FIRST table under it, or `undefined`
|
|
71
|
+
* when it has none: a later table under the same heading is the author's, never this table.
|
|
72
|
+
*/
|
|
73
|
+
function agentToolsSection(text: string): string | undefined {
|
|
74
|
+
const start = text.indexOf(`\n${SECTION}\n`);
|
|
75
|
+
if (start === -1) return undefined;
|
|
76
|
+
const lines = text.slice(start + 1).split('\n');
|
|
77
|
+
const head = lines.findIndex((line) => line.startsWith('|'));
|
|
78
|
+
if (head === -1 || lines.slice(1, head).some((line) => line.startsWith('## '))) return undefined;
|
|
79
|
+
let end = head;
|
|
80
|
+
while ((lines[end + 1] ?? '').startsWith('|')) end += 1;
|
|
81
|
+
return lines.slice(0, end + 1).join('\n');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type CommandRows =
|
|
85
|
+
| { readonly kind: 'swap'; readonly from: string; readonly to: string }
|
|
86
|
+
| { readonly kind: 'customised'; readonly rows: readonly string[] }
|
|
87
|
+
| { readonly kind: 'none' };
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The `.claude/commands/*` rows INSIDE the Agent tools table, never an earlier table's: all shipped
|
|
91
|
+
* wordings are replaced by the one skills row, and any row the author changed (a review step added,
|
|
92
|
+
* say) holds the whole swap back so nothing they wrote is dropped. `from` runs from the heading to
|
|
93
|
+
* the last row, so it names exactly one place in the brief.
|
|
94
|
+
*/
|
|
95
|
+
async function commandRows(app: CodemodApp): Promise<CommandRows> {
|
|
96
|
+
for (const path of ['CLAUDE.md', 'AGENTS.md']) {
|
|
97
|
+
const text = (await app.read(path)) ?? '';
|
|
98
|
+
const section = agentToolsSection(text);
|
|
99
|
+
if (section === undefined) continue;
|
|
100
|
+
const rows = section.split('\n');
|
|
101
|
+
const first = rows.findIndex((row) => COMMAND_ROW.test(row));
|
|
102
|
+
if (first === -1) continue;
|
|
103
|
+
let last = first;
|
|
104
|
+
while (COMMAND_ROW.test(rows[last + 1] ?? '')) last += 1;
|
|
105
|
+
const block = rows.slice(first, last + 1);
|
|
106
|
+
const custom = block.filter((row) => !SHIPPED_COMMAND_ROWS.has(row));
|
|
107
|
+
if (custom.length > 0) return { kind: 'customised', rows: custom };
|
|
108
|
+
const head = rows.slice(0, first).join('\n');
|
|
109
|
+
return {
|
|
110
|
+
kind: 'swap',
|
|
111
|
+
from: `${head}\n${block.join('\n')}`,
|
|
112
|
+
to: `${head}\n${NEW_SKILLS}`,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return { kind: 'none' };
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async function swapCommandRows(app: CodemodApp): Promise<CodemodResult> {
|
|
119
|
+
const found = await commandRows(app);
|
|
120
|
+
if (found.kind === 'customised') {
|
|
121
|
+
return {
|
|
122
|
+
changed: [],
|
|
123
|
+
skipped: [
|
|
124
|
+
{
|
|
125
|
+
path: 'CLAUDE.md',
|
|
126
|
+
reason: `the Agent tools table keeps ${String(found.rows.length)} \`.claude/commands\` row(s) you changed, so none was replaced: move what they say into the skills (or your own app-* ones), then replace the rows with this one by hand: ${NEW_SKILLS}`,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
if (found.kind === 'none') {
|
|
132
|
+
// No legacy row inside the Agent tools table: nothing elsewhere in the brief is this table's.
|
|
133
|
+
for (const path of ['CLAUDE.md', 'AGENTS.md']) {
|
|
134
|
+
if ((await app.read(path))?.includes('`.claude/skills/`') === true) {
|
|
135
|
+
return { changed: [], skipped: [] };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
changed: [],
|
|
140
|
+
skipped: [
|
|
141
|
+
{
|
|
142
|
+
path: 'CLAUDE.md',
|
|
143
|
+
reason: `no .claude/commands rows in the Agent tools table; add this row to the conventions table by hand: ${NEW_SKILLS}`,
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
return editAgentsDocRow(app, {
|
|
149
|
+
from: found.from,
|
|
150
|
+
to: found.to,
|
|
151
|
+
row: NEW_SKILLS,
|
|
152
|
+
said: (text) => text.includes('`.claude/skills/`'),
|
|
153
|
+
missing: 'no .claude/commands rows in the Agent tools table',
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const swap =
|
|
158
|
+
(from: string, to: string, said: string, missing: string) =>
|
|
159
|
+
(app: Parameters<Codemod['run']>[0]) =>
|
|
160
|
+
editAgentsDocRow(app, { from, to, row: to, said: (text) => text.includes(said), missing });
|
|
161
|
+
|
|
162
|
+
export const codemod: Codemod = {
|
|
163
|
+
id: 'docs-visual-quality',
|
|
164
|
+
since: '31.53.0',
|
|
165
|
+
summary:
|
|
166
|
+
"CLAUDE.md names the motion and effect guards, the Visual quality section and the agent kit's skills",
|
|
167
|
+
async run(app): Promise<CodemodResult> {
|
|
168
|
+
// The two that shrink first, so the ones that grow find the room they need.
|
|
169
|
+
const results = [
|
|
170
|
+
await swapCommandRows(app),
|
|
171
|
+
await swap(
|
|
172
|
+
OLD_HARNESS,
|
|
173
|
+
NEW_HARNESS,
|
|
174
|
+
'holds the agent kit',
|
|
175
|
+
'no ".claude/ holds a harness" bullet',
|
|
176
|
+
)(app),
|
|
177
|
+
await swap(
|
|
178
|
+
OLD_TIMING,
|
|
179
|
+
NEW_TIMING,
|
|
180
|
+
'raw-motion-script',
|
|
181
|
+
'no Timing row as x new wrote it',
|
|
182
|
+
)(app),
|
|
183
|
+
await swap(
|
|
184
|
+
OLD_MOTION,
|
|
185
|
+
NEW_MOTION,
|
|
186
|
+
'animated-layout-script',
|
|
187
|
+
'no Motion row as x new wrote it',
|
|
188
|
+
)(app),
|
|
189
|
+
await swap(
|
|
190
|
+
BEFORE_TOOLS,
|
|
191
|
+
`${VISUAL_QUALITY}\n${BEFORE_TOOLS}`,
|
|
192
|
+
'## Visual quality',
|
|
193
|
+
'no "## Agent tools" heading to place the section above',
|
|
194
|
+
)(app),
|
|
195
|
+
];
|
|
196
|
+
return mergeResults(results);
|
|
197
|
+
},
|
|
198
|
+
};
|
package/src/codemods/index.ts
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// module not listed here is refused by `index.test.ts`; `scripts/template-codemods.ts` refuses a
|
|
3
3
|
// scaffold-owned template change with no codemod (or no written reason) for the next release.
|
|
4
4
|
|
|
5
|
+
import { codemod as agentKit } from './agent-kit';
|
|
5
6
|
import { codemod as agentsDevMcp } from './agents-dev-mcp';
|
|
7
|
+
import { codemod as agentsMdBudget } from './agents-md-budget';
|
|
6
8
|
import { codemod as authenticatorSessionRefusal } from './authenticator-session-refusal';
|
|
7
9
|
import { codemod as biomeNoDefaultExport } from './biome-no-default-export';
|
|
8
10
|
import { codemod as bunfigIslandCoverage } from './bunfig-island-coverage';
|
|
@@ -21,6 +23,7 @@ import { codemod as docsIslandRows } from './docs-island-rows';
|
|
|
21
23
|
import { codemod as docsManyAgents } from './docs-many-agents';
|
|
22
24
|
import { codemod as docsShippedGuards } from './docs-shipped-guards';
|
|
23
25
|
import { codemod as docsTestServices } from './docs-test-services';
|
|
26
|
+
import { codemod as docsVisualQuality } from './docs-visual-quality';
|
|
24
27
|
import { codemod as docsWorkerCommands } from './docs-worker-commands';
|
|
25
28
|
import { codemod as e2eSuiteFloor } from './e2e-suite-floor';
|
|
26
29
|
import { codemod as formatEditedHook } from './format-edited-hook';
|
|
@@ -31,6 +34,7 @@ import { codemod as metricsProbeHealthz } from './metrics-probe-healthz';
|
|
|
31
34
|
import { codemod as migrateJobOrdered } from './migrate-job-ordered';
|
|
32
35
|
import { codemod as reproGitignore } from './repro-gitignore';
|
|
33
36
|
import { codemod as runtimePin } from './runtime-pin';
|
|
37
|
+
import { codemod as settingsKitAllow } from './settings-kit-allow';
|
|
34
38
|
import { codemod as solidFloor } from './solid-floor';
|
|
35
39
|
import { codemod as testPorts } from './test-ports';
|
|
36
40
|
import { codemod as testServices } from './test-services';
|
|
@@ -77,4 +81,8 @@ export const CODEMODS: readonly Codemod[] = [
|
|
|
77
81
|
docsManyAgents,
|
|
78
82
|
docsWorkerCommands,
|
|
79
83
|
mergeDrivers,
|
|
84
|
+
agentKit,
|
|
85
|
+
agentsMdBudget,
|
|
86
|
+
docsVisualQuality,
|
|
87
|
+
settingsKitAllow,
|
|
80
88
|
];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// 31.53.0: the agent kit's commands an agent runs without a prompt. `x shot` is what the `web` agent
|
|
2
|
+
// is told to run, `x kit` refreshes the kit, `x upgrade --dry-run` is the upgrade skill's first step.
|
|
3
|
+
// Each missing entry is appended to `permissions.allow`; a file that is not the JSON object this
|
|
4
|
+
// expects is left as it is, reported with the entries to add by hand.
|
|
5
|
+
|
|
6
|
+
import { isJsonObject } from '@ultimat3/core';
|
|
7
|
+
import type { Codemod } from './codemod';
|
|
8
|
+
|
|
9
|
+
export const SETTINGS_FILE = '.claude/settings.json';
|
|
10
|
+
export const KIT_ALLOW: readonly string[] = [
|
|
11
|
+
'Bash(bunx x shot:*)',
|
|
12
|
+
'Bash(bunx x kit:*)',
|
|
13
|
+
'Bash(bunx x upgrade --dry-run:*)',
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export const codemod: Codemod = {
|
|
17
|
+
id: 'settings-kit-allow',
|
|
18
|
+
since: '31.53.0',
|
|
19
|
+
summary: '.claude/settings.json allows bunx x shot, bunx x kit and bunx x upgrade --dry-run',
|
|
20
|
+
async run(app) {
|
|
21
|
+
const source = await app.read(SETTINGS_FILE);
|
|
22
|
+
if (source === undefined) return { changed: [], skipped: [] };
|
|
23
|
+
const bail = (reason: string) => ({
|
|
24
|
+
changed: [],
|
|
25
|
+
skipped: [
|
|
26
|
+
{
|
|
27
|
+
path: SETTINGS_FILE,
|
|
28
|
+
reason: `${reason}: add ${KIT_ALLOW.join(', ')} to permissions.allow by hand`,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
let parsed: unknown;
|
|
33
|
+
try {
|
|
34
|
+
parsed = JSON.parse(source);
|
|
35
|
+
} catch {
|
|
36
|
+
return bail(`${SETTINGS_FILE} is not JSON`);
|
|
37
|
+
}
|
|
38
|
+
const permissions = isJsonObject(parsed) ? parsed['permissions'] : undefined;
|
|
39
|
+
const allow = isJsonObject(permissions) ? permissions['allow'] : undefined;
|
|
40
|
+
if (!isJsonObject(parsed) || !isJsonObject(permissions) || !Array.isArray(allow)) {
|
|
41
|
+
return bail(`${SETTINGS_FILE} has no permissions.allow list`);
|
|
42
|
+
}
|
|
43
|
+
const missing = KIT_ALLOW.filter((entry) => !allow.includes(entry));
|
|
44
|
+
if (missing.length === 0) return { changed: [], skipped: [] };
|
|
45
|
+
const next = { ...parsed, permissions: { ...permissions, allow: [...allow, ...missing] } };
|
|
46
|
+
await app.write(SETTINGS_FILE, `${JSON.stringify(next, null, 2)}\n`);
|
|
47
|
+
return { changed: [SETTINGS_FILE], skipped: [] };
|
|
48
|
+
},
|
|
49
|
+
};
|
package/src/config-redact.ts
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
// The resolved `AppConfig` as JSON an operator may paste into an issue: every credential-named key
|
|
2
|
-
// and every `secret()` value replaced, a URL's password cut out of its userinfo
|
|
3
|
-
//
|
|
2
|
+
// and every `secret()` value replaced, a URL's password cut out of its userinfo — a `proxy` URL's
|
|
3
|
+
// whole userinfo. The rules are core's (`isRedactedKey`, `redactUrlPassword`, `replaceUrlUserinfo`).
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
isRedactedKey,
|
|
7
|
+
isSecret,
|
|
8
|
+
REDACTED,
|
|
9
|
+
redactUrlPassword,
|
|
10
|
+
replaceUrlUserinfo,
|
|
11
|
+
} from '@ultimat3/core';
|
|
6
12
|
import type { JsonValue } from './output';
|
|
7
13
|
|
|
8
14
|
/** Past this depth a config is not data an operator wrote; the walk stops rather than recurse. */
|
|
9
15
|
const MAX_DEPTH = 16;
|
|
10
16
|
|
|
17
|
+
/**
|
|
18
|
+
* A proxy URL carries its credential in the USER as often as the password (`http://sk-token@egress`),
|
|
19
|
+
* so `outbound.proxy` — any `proxy` key — loses the whole userinfo, as core's boot line shows it.
|
|
20
|
+
*/
|
|
21
|
+
const redactedEntry = (key: string, item: unknown, depth: number): JsonValue => {
|
|
22
|
+
if (isRedactedKey(key)) return REDACTED;
|
|
23
|
+
if (key === 'proxy' && typeof item === 'string') return replaceUrlUserinfo(item, () => REDACTED);
|
|
24
|
+
return redactConfigValue(item, depth + 1);
|
|
25
|
+
};
|
|
26
|
+
|
|
11
27
|
export function redactConfigValue(value: unknown, depth = 0): JsonValue {
|
|
12
28
|
if (isSecret(value)) return REDACTED;
|
|
13
29
|
if (value === null || value === undefined) return null;
|
|
@@ -26,7 +42,7 @@ export function redactConfigValue(value: unknown, depth = 0): JsonValue {
|
|
|
26
42
|
// `defineProperty`, never `out[key] =`: a config key is the app's string, and `__proto__`
|
|
27
43
|
// assigned would re-prototype the record instead of adding a field.
|
|
28
44
|
Object.defineProperty(out, key, {
|
|
29
|
-
value:
|
|
45
|
+
value: redactedEntry(key, item, depth),
|
|
30
46
|
enumerable: true,
|
|
31
47
|
writable: true,
|
|
32
48
|
configurable: true,
|
package/src/db-rollback-pass.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// beside a live `x dev` holding the embedded database — that process, asked over `/_x`
|
|
3
3
|
// (`dev-db-rollback.ts`). The rule `db-migrate-pass.ts` states: PGlite takes one opener.
|
|
4
4
|
|
|
5
|
+
import type { DbClient } from '@ultimat3/db';
|
|
5
6
|
import { rollback } from '@ultimat3/db';
|
|
6
7
|
import { t } from '@ultimat3/schema';
|
|
7
8
|
import { DEV_ROLLBACK_PATH } from './db-dev-wire';
|
|
@@ -19,17 +20,19 @@ const REVERTED = t.object({ reverted: t.array(t.string) });
|
|
|
19
20
|
/**
|
|
20
21
|
* `rollback()` over the ambient client, with this command's two questions asked under the lock.
|
|
21
22
|
* Shared by the command and the dev route, so the holder cannot reverse what the command refuses.
|
|
23
|
+
* `on` is the dev route's held session (`dev-db-migrator-hold.ts`): its client, and no second lock.
|
|
22
24
|
*/
|
|
23
25
|
export async function reverseApplied(
|
|
24
26
|
root: string,
|
|
25
27
|
env: Env,
|
|
26
28
|
steps: number,
|
|
29
|
+
on: { readonly client?: DbClient; readonly lock?: boolean } = {},
|
|
27
30
|
): Promise<readonly string[]> {
|
|
28
31
|
const migrations = await readMigrations(root);
|
|
29
32
|
// The binding, so a database on another machine needs the names whatever the environment says.
|
|
30
33
|
const database = resolveServices(root, env).db;
|
|
31
34
|
const confirm = rollbackConfirm(await withoutDown(root, migrations), env, steps, database);
|
|
32
|
-
return rollback({ migrations, steps, confirm });
|
|
35
|
+
return rollback({ migrations, steps, confirm, client: on.client, lock: on.lock });
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
/** The ids reversed, most recently applied first. */
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// The two scripts `x design research` runs INSIDE a reference page, as text: one installed before
|
|
2
|
+
// the document's own scripts, one run after load that scrolls, hovers and reads computed styles.
|
|
3
|
+
//
|
|
4
|
+
// Both answer numbers and CSS keywords only — no page text leaves the page. `design-extract.ts`
|
|
5
|
+
// parses and re-sanitises what they answer anyway: the page can overwrite anything installed here.
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Before the document: no WebSocket (see the comment inside), then every Animation the page starts — `Element.animate`, a CSS animation, a CSS
|
|
9
|
+
* transition — is recorded with the phase it started in (`enter` until the pass moves it on). The
|
|
10
|
+
* recorder is reached through one non-enumerable global the pass reads back.
|
|
11
|
+
*/
|
|
12
|
+
export const DESIGN_PREPARE = `(() => {
|
|
13
|
+
if (window.__xDesign) return;
|
|
14
|
+
// CDP's Fetch domain never pauses a WebSocket handshake, so nothing could screen where one dials:
|
|
15
|
+
// a reference gets none. Installed before the page's scripts, in every frame, and not writable.
|
|
16
|
+
const refuse = function WebSocket() { throw new DOMException('x design research opens no WebSocket', 'SecurityError'); };
|
|
17
|
+
for (const name of ['WebSocket', 'WebSocketStream', 'WebTransport']) {
|
|
18
|
+
try { Object.defineProperty(window, name, { value: refuse, writable: false, configurable: false }); } catch {}
|
|
19
|
+
}
|
|
20
|
+
const records = [];
|
|
21
|
+
const seen = new WeakSet();
|
|
22
|
+
const state = { phase: 'enter' };
|
|
23
|
+
const SKIP = new Set(['offset', 'easing', 'composite', 'computedOffset']);
|
|
24
|
+
const record = (animation) => {
|
|
25
|
+
if (!animation || seen.has(animation) || records.length >= 400) return;
|
|
26
|
+
seen.add(animation);
|
|
27
|
+
const effect = animation.effect;
|
|
28
|
+
if (!effect || typeof effect.getTiming !== 'function') return;
|
|
29
|
+
const timing = effect.getTiming();
|
|
30
|
+
let frames = [];
|
|
31
|
+
try { frames = effect.getKeyframes(); } catch {}
|
|
32
|
+
const properties = new Set();
|
|
33
|
+
for (const frame of frames) for (const key of Object.keys(frame)) if (!SKIP.has(key)) properties.add(key);
|
|
34
|
+
const frameEasing = frames.find((frame) => frame.easing && frame.easing !== 'linear');
|
|
35
|
+
const timeline = animation.timeline && animation.timeline.constructor ? animation.timeline.constructor.name : '';
|
|
36
|
+
const scrollDriven = /Scroll|View/.test(timeline);
|
|
37
|
+
const infinite = timing.iterations === Infinity;
|
|
38
|
+
records.push({
|
|
39
|
+
kind: animation.constructor && animation.constructor.name === 'CSSTransition' ? 'transition' : 'animation',
|
|
40
|
+
trigger: scrollDriven ? 'scroll' : infinite ? 'loop' : state.phase,
|
|
41
|
+
durationMs: typeof timing.duration === 'number' ? timing.duration : 0,
|
|
42
|
+
delayMs: typeof timing.delay === 'number' ? timing.delay : 0,
|
|
43
|
+
easing: String(timing.easing && timing.easing !== 'linear' ? timing.easing : frameEasing ? frameEasing.easing : 'linear'),
|
|
44
|
+
iterations: infinite ? -1 : Number(timing.iterations) || 1,
|
|
45
|
+
properties: [...properties].slice(0, 12),
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
const original = Element.prototype.animate;
|
|
49
|
+
Element.prototype.animate = function (...args) {
|
|
50
|
+
const animation = original.apply(this, args);
|
|
51
|
+
record(animation);
|
|
52
|
+
return animation;
|
|
53
|
+
};
|
|
54
|
+
const sweep = () => { try { for (const animation of document.getAnimations()) record(animation); } catch {} };
|
|
55
|
+
for (const type of ['animationstart', 'transitionrun']) document.addEventListener(type, sweep, true);
|
|
56
|
+
Object.defineProperty(window, '__xDesign', {
|
|
57
|
+
value: { records, state, sweep },
|
|
58
|
+
enumerable: false,
|
|
59
|
+
});
|
|
60
|
+
})()`;
|
|
61
|
+
|
|
62
|
+
/** After load: the scroll and hover passes, then the computed-style census. Answers one object. */
|
|
63
|
+
export const DESIGN_PASS = `(async () => {
|
|
64
|
+
const x = window.__xDesign;
|
|
65
|
+
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
66
|
+
const records = x ? x.records : [];
|
|
67
|
+
const sweep = () => { if (x) x.sweep(); };
|
|
68
|
+
const phase = (name) => { if (x) x.state.phase = name; };
|
|
69
|
+
await wait(400);
|
|
70
|
+
sweep();
|
|
71
|
+
phase('scroll');
|
|
72
|
+
const step = Math.max(200, Math.floor(innerHeight * 0.8));
|
|
73
|
+
const bottom = Math.min(document.documentElement.scrollHeight, 40000);
|
|
74
|
+
for (let y = step, steps = 0; y < bottom + step && steps < 25; y += step, steps += 1) {
|
|
75
|
+
scrollTo({ top: y, behavior: 'instant' });
|
|
76
|
+
await wait(60);
|
|
77
|
+
sweep();
|
|
78
|
+
}
|
|
79
|
+
scrollTo({ top: 0, behavior: 'instant' });
|
|
80
|
+
await wait(60);
|
|
81
|
+
phase('hover');
|
|
82
|
+
const hoverable = [...document.querySelectorAll('a, button, [role="button"], [class*="card" i]')].slice(0, 30);
|
|
83
|
+
for (const el of hoverable) {
|
|
84
|
+
for (const type of ['pointerover', 'pointerenter', 'mouseover', 'mouseenter']) el.dispatchEvent(new MouseEvent(type, { bubbles: type.endsWith('over') }));
|
|
85
|
+
await wait(20);
|
|
86
|
+
sweep();
|
|
87
|
+
for (const type of ['pointerout', 'pointerleave', 'mouseout', 'mouseleave']) el.dispatchEvent(new MouseEvent(type, { bubbles: type.endsWith('out') }));
|
|
88
|
+
}
|
|
89
|
+
phase('state');
|
|
90
|
+
|
|
91
|
+
const canvas = document.createElement('canvas').getContext('2d');
|
|
92
|
+
const rgba = (value) => {
|
|
93
|
+
if (!canvas || !value || value === 'transparent') return null;
|
|
94
|
+
canvas.fillStyle = '#000000';
|
|
95
|
+
canvas.fillStyle = value;
|
|
96
|
+
const norm = String(canvas.fillStyle);
|
|
97
|
+
if (norm.startsWith('#')) return [parseInt(norm.slice(1, 3), 16), parseInt(norm.slice(3, 5), 16), parseInt(norm.slice(5, 7), 16), 1];
|
|
98
|
+
const m = /rgba?\\(([\\d.]+),\\s*([\\d.]+),\\s*([\\d.]+)(?:,\\s*([\\d.]+))?/.exec(norm);
|
|
99
|
+
return m ? [Number(m[1]), Number(m[2]), Number(m[3]), m[4] === undefined ? 1 : Number(m[4])] : null;
|
|
100
|
+
};
|
|
101
|
+
const px = (value) => { const n = parseFloat(value); return Number.isFinite(n) ? n : 0; };
|
|
102
|
+
const bump = (map, key, by, make) => { const held = map.get(key); if (held) held.n += by; else map.set(key, { ...make(), n: by }); };
|
|
103
|
+
|
|
104
|
+
const hoverBases = [];
|
|
105
|
+
for (const sheet of document.styleSheets) {
|
|
106
|
+
let rules = [];
|
|
107
|
+
try { rules = sheet.cssRules; } catch { continue; }
|
|
108
|
+
for (const rule of rules) {
|
|
109
|
+
const text = rule.selectorText;
|
|
110
|
+
if (typeof text === 'string' && text.includes(':hover') && hoverBases.length < 400) {
|
|
111
|
+
for (const part of text.split(',')) { const base = part.replace(/:hover/g, '').trim(); if (base) hoverBases.push(base); }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const hovered = (el) => hoverBases.some((base) => { try { return el.matches(base) || el.matches(base + ' *'); } catch { return false; } });
|
|
116
|
+
|
|
117
|
+
const colors = new Map(); const fonts = new Map(); const spacing = new Map(); const radii = new Map(); const shadows = new Map();
|
|
118
|
+
const backdrop = { count: 0, blurPx: [] };
|
|
119
|
+
let canvases = 0;
|
|
120
|
+
const cap = innerWidth * innerHeight * 4;
|
|
121
|
+
const elements = [document.documentElement, document.body, ...document.querySelectorAll('body *')].filter(Boolean).slice(0, 3000);
|
|
122
|
+
for (const el of elements) {
|
|
123
|
+
const box = el.getBoundingClientRect();
|
|
124
|
+
const area = box.width * box.height;
|
|
125
|
+
if (area <= 0) continue;
|
|
126
|
+
const cs = getComputedStyle(el);
|
|
127
|
+
if (cs.display === 'none' || cs.visibility === 'hidden' || Number(cs.opacity) === 0) continue;
|
|
128
|
+
if (el.tagName === 'CANVAS') canvases += 1;
|
|
129
|
+
const bg = rgba(cs.backgroundColor);
|
|
130
|
+
if (bg && bg[3] > 0.05) bump(colors, 'background ' + bg.join(' '), Math.min(area, cap), () => ({ rgb: bg.slice(0, 3), alpha: bg[3], use: 'background' }));
|
|
131
|
+
let textLength = 0;
|
|
132
|
+
for (const node of el.childNodes) if (node.nodeType === 3) textLength += node.textContent.trim().length;
|
|
133
|
+
if (textLength > 0) {
|
|
134
|
+
const fg = rgba(cs.color);
|
|
135
|
+
if (fg) bump(colors, 'text ' + fg.join(' '), Math.min(textLength, 500), () => ({ rgb: fg.slice(0, 3), alpha: fg[3], use: 'text' }));
|
|
136
|
+
const family = cs.fontFamily.split(',')[0].replace(/["']/g, '').trim();
|
|
137
|
+
const size = Math.round(px(cs.fontSize));
|
|
138
|
+
const weight = Number(cs.fontWeight) || 400;
|
|
139
|
+
bump(fonts, family + '|' + size + '|' + weight, Math.min(textLength, 500), () => ({ family, sizePx: size, weight }));
|
|
140
|
+
}
|
|
141
|
+
if (px(cs.borderTopWidth) > 0 && cs.borderTopStyle !== 'none') {
|
|
142
|
+
const line = rgba(cs.borderTopColor);
|
|
143
|
+
if (line && line[3] > 0.05) bump(colors, 'border ' + line.join(' '), 1, () => ({ rgb: line.slice(0, 3), alpha: line[3], use: 'border' }));
|
|
144
|
+
}
|
|
145
|
+
for (const side of ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'marginTop', 'marginBottom', 'rowGap', 'columnGap']) {
|
|
146
|
+
const value = Math.round(px(cs[side]));
|
|
147
|
+
if (value > 0 && value < 400) bump(spacing, value, 1, () => ({ px: value }));
|
|
148
|
+
}
|
|
149
|
+
const radius = cs.borderTopLeftRadius;
|
|
150
|
+
if (!radius.includes('%')) { const value = Math.round(px(radius)); if (value > 0 && value < 1000) bump(radii, value, 1, () => ({ px: value })); }
|
|
151
|
+
if (cs.boxShadow && cs.boxShadow !== 'none') {
|
|
152
|
+
const first = cs.boxShadow.split(/,(?![^(]*\\))/)[0];
|
|
153
|
+
const color = rgba((/rgba?\\([^)]*\\)|#[0-9a-f]{3,8}/i.exec(first) || ['transparent'])[0]);
|
|
154
|
+
const lengths = (first.replace(/rgba?\\([^)]*\\)|#[0-9a-f]{3,8}/gi, '').match(/-?[\\d.]+px/g) || []).map(px);
|
|
155
|
+
const shadow = { x: lengths[0] || 0, y: lengths[1] || 0, blur: lengths[2] || 0, spread: lengths[3] || 0, inset: first.includes('inset'), rgb: color ? color.slice(0, 3) : [0, 0, 0], alpha: color ? color[3] : 0 };
|
|
156
|
+
bump(shadows, JSON.stringify(shadow), 1, () => shadow);
|
|
157
|
+
}
|
|
158
|
+
if (cs.backdropFilter && cs.backdropFilter !== 'none') {
|
|
159
|
+
backdrop.count += 1;
|
|
160
|
+
const blur = /blur\\(([\\d.]+)px\\)/.exec(cs.backdropFilter);
|
|
161
|
+
if (blur && backdrop.blurPx.length < 20) backdrop.blurPx.push(Number(blur[1]));
|
|
162
|
+
}
|
|
163
|
+
const durations = cs.transitionDuration.split(',').map((d) => px(d) * (d.trim().endsWith('ms') ? 1 : 1000));
|
|
164
|
+
if (durations.some((d) => d > 0) && records.length < 600) {
|
|
165
|
+
const easings = cs.transitionTimingFunction.split(/,(?![^(]*\\))/);
|
|
166
|
+
const delays = cs.transitionDelay.split(',').map((d) => px(d) * (d.trim().endsWith('ms') ? 1 : 1000));
|
|
167
|
+
const properties = cs.transitionProperty.split(',').map((p) => p.trim());
|
|
168
|
+
durations.forEach((duration, i) => {
|
|
169
|
+
if (duration <= 0) return;
|
|
170
|
+
records.push({ kind: 'transition', trigger: hovered(el) ? 'hover' : 'state', durationMs: duration, delayMs: delays[i % delays.length] || 0, easing: (easings[i % easings.length] || 'ease').trim(), iterations: 1, properties: [properties[i % properties.length] || 'all'] });
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const top = (map, n) => [...map.values()].sort((a, b) => b.n - a.n).slice(0, n);
|
|
175
|
+
return {
|
|
176
|
+
viewport: { width: innerWidth, height: innerHeight },
|
|
177
|
+
colors: top(colors, 64).map((c) => ({ rgb: c.rgb, alpha: c.alpha, use: c.use, weight: c.n })),
|
|
178
|
+
fonts: top(fonts, 24).map((f) => ({ family: f.family, sizePx: f.sizePx, weight: f.weight, uses: f.n })),
|
|
179
|
+
spacing: top(spacing, 32).map((s) => ({ px: s.px, count: s.n })),
|
|
180
|
+
radii: top(radii, 16).map((r) => ({ px: r.px, count: r.n })),
|
|
181
|
+
shadows: top(shadows, 12).map((s) => ({ x: s.x, y: s.y, blur: s.blur, spread: s.spread, inset: s.inset, rgb: s.rgb, alpha: s.alpha, count: s.n })),
|
|
182
|
+
backdrop,
|
|
183
|
+
canvases,
|
|
184
|
+
motion: records.slice(0, 600),
|
|
185
|
+
links: [...document.querySelectorAll('a[href]')].slice(0, 300).map((a) => a.href),
|
|
186
|
+
};
|
|
187
|
+
})()`;
|