@ultimat3/cli 31.20.0 → 31.22.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 +11 -6
- package/package.json +29 -29
- package/src/cmd-db.ts +5 -18
- package/src/cmd-doctor.ts +8 -3
- package/src/cmd-mcp.ts +6 -1
- package/src/cmd-verify.ts +19 -15
- package/src/db-schema-dump.ts +20 -0
- package/src/dev-lock.ts +26 -5
- package/src/doctor-guards.ts +27 -12
- package/src/drift-store.ts +28 -2
- package/src/error-codes-doctor.ts +9 -5
- package/src/guards.ts +66 -28
- package/src/lint-findings.ts +34 -10
- package/src/mcp-agent-host.ts +107 -0
- package/src/mcp-errors.ts +4 -0
- package/src/mcp-host.ts +23 -1
- package/src/mcp-request-statements.ts +129 -0
- package/src/mcp-ui.ts +1 -2
- package/src/messages.ts +0 -2
- package/src/runtime-cache.ts +12 -3
- package/src/schema-dump-drift.ts +78 -4
- package/src/templates/guard-repo-await-in-loop-test.ts +89 -0
- package/src/templates/guard-repo-await-in-loop.ts +214 -0
- package/src/templates/guard-repo-unbounded-test.ts +56 -0
- package/src/templates/guard-repo-unbounded.ts +197 -0
- package/src/templates/scaffold-claude-agents.ts +4 -4
- package/src/templates/scaffold-claude-hook.ts +40 -0
- package/src/templates/scaffold-claude.ts +22 -6
- package/src/templates/scaffold-docs.ts +2 -7
- package/src/templates/scaffold-guards.ts +6 -0
- package/src/verify-changed.ts +32 -5
- package/src/verify-checks.ts +26 -7
- package/src/verify-progress.ts +32 -1
- package/wiki/CLI-Reference.md +19 -8
- package/wiki/MCP-And-AI.md +7 -3
- package/wiki/Tutorial-02-First-Feature.md +1 -1
- package/wiki/Upgrading.md +7 -0
- package/src/retry-memo.ts +0 -37
|
@@ -8,7 +8,7 @@ import type { GeneratedFile, NameSet } from './naming';
|
|
|
8
8
|
const shape = (app: NameSet): string => `---
|
|
9
9
|
name: shape
|
|
10
10
|
description: Use BEFORE writing any code, at the idea stage — turns a product request into the one decision that governs everything after it: which of the eight primitives each piece is, which slice and surface it lives in, and the exact \`bunx x g\` invocations. Read-only; it decides, it never builds. Also use when a request seems to need something the framework does not have.
|
|
11
|
-
tools: Read, Glob, Grep, Bash
|
|
11
|
+
tools: Read, Glob, Grep, Bash, mcp__${app.kebab}__*
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
You decide **whether and what to build** in ${app.kebab}. You write no code, and you do not edit
|
|
@@ -63,7 +63,7 @@ Refused: <anything that fits no primitive, and why>
|
|
|
63
63
|
const data = (app: NameSet): string => `---
|
|
64
64
|
name: data
|
|
65
65
|
description: Use for anything about what is stored — entity definitions, invariants, indexes, repositories, migrations and seed data in ${app.kebab}. Owns \`packages/db/\` and every \`entity.ts\` and \`repo.ts\`. Not for actions, queries or UI.
|
|
66
|
-
tools: Read, Write, Edit, Glob, Grep, Bash
|
|
66
|
+
tools: Read, Write, Edit, Glob, Grep, Bash, mcp__${app.kebab}__*
|
|
67
67
|
---
|
|
68
68
|
|
|
69
69
|
You own the data boundary of ${app.kebab}: \`packages/db/\` plus every \`entity.ts\` and \`repo.ts\` in a
|
|
@@ -88,7 +88,7 @@ once when you are otherwise done. Never \`bunx x verify\` — that belongs to wh
|
|
|
88
88
|
const server = (app: NameSet): string => `---
|
|
89
89
|
name: server
|
|
90
90
|
description: Use for server-authoritative behaviour in ${app.kebab} — actions, mutators, queries, jobs, tasks and policies, plus the HTTP surface under \`apps/web/api/\`. Not for entities, migrations or anything that renders.
|
|
91
|
-
tools: Read, Write, Edit, Glob, Grep, Bash
|
|
91
|
+
tools: Read, Write, Edit, Glob, Grep, Bash, mcp__${app.kebab}__*
|
|
92
92
|
---
|
|
93
93
|
|
|
94
94
|
You own the server boundary of ${app.kebab}: \`policy.ts\`, actions, mutators, queries, jobs and tasks
|
|
@@ -115,7 +115,7 @@ once when you are otherwise done. Never \`bunx x verify\` — that belongs to wh
|
|
|
115
115
|
const web = (app: NameSet): string => `---
|
|
116
116
|
name: web
|
|
117
117
|
description: Use for anything rendered in ${app.kebab} — pages under \`apps/web/site/\` and \`apps/web/app/\`, islands, components in \`packages/ui/\`, styles, tokens and i18n catalogs. Not for actions, queries, entities or migrations.
|
|
118
|
-
tools: Read, Write, Edit, Glob, Grep, Bash
|
|
118
|
+
tools: Read, Write, Edit, Glob, Grep, Bash, mcp__${app.kebab}__*
|
|
119
119
|
---
|
|
120
120
|
|
|
121
121
|
You own the rendering boundary of ${app.kebab}: \`apps/web/site/\`, the pages and UI of
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// The one hook `x new` writes: `.claude/hooks/format-edited.ts`, run after every Edit/Write. A
|
|
2
|
+
// Bun script rather than a shell one-liner, because the edited path arrives as JSON on stdin
|
|
3
|
+
// (`tool_input.file_path`) — the harness sets no `$CLAUDE_FILE_PATHS` — and `jq` is not a
|
|
4
|
+
// dependency a fresh app (or a Windows machine) can be assumed to have.
|
|
5
|
+
|
|
6
|
+
import type { GeneratedFile } from './naming';
|
|
7
|
+
|
|
8
|
+
export const HOOK_PATH = '.claude/hooks/format-edited.ts';
|
|
9
|
+
|
|
10
|
+
/** The settings.json command line that runs it, from wherever the session's cwd is. */
|
|
11
|
+
export const HOOK_COMMAND = `bun "$CLAUDE_PROJECT_DIR"/${HOOK_PATH}`;
|
|
12
|
+
|
|
13
|
+
const script = `#!/usr/bin/env bun
|
|
14
|
+
// PostToolUse(Edit|Write): \`biome check --write\` on the one file just edited — it formats in place
|
|
15
|
+
// and reports what it cannot fix. The path arrives on stdin as \`tool_input.file_path\`. Exit 2
|
|
16
|
+
// shows the agent the finding (the edit already landed); a file biome does not handle is a no-op.
|
|
17
|
+
|
|
18
|
+
const input: unknown = JSON.parse((await Bun.stdin.text()) || '{}');
|
|
19
|
+
const record = (typeof input === 'object' && input !== null ? input : {}) as {
|
|
20
|
+
tool_input?: { file_path?: unknown };
|
|
21
|
+
};
|
|
22
|
+
const file = record.tool_input?.file_path;
|
|
23
|
+
if (typeof file === 'string' && file !== '') {
|
|
24
|
+
const proc = Bun.spawnSync(
|
|
25
|
+
['bunx', 'biome', 'check', '--write', '--no-errors-on-unmatched', file],
|
|
26
|
+
{ stdout: 'pipe', stderr: 'pipe', timeout: 15_000 },
|
|
27
|
+
);
|
|
28
|
+
if (proc.exitCode !== 0) {
|
|
29
|
+
const out = \`\${proc.stdout.toString()}\${proc.stderr.toString()}\`.trim();
|
|
30
|
+
process.stderr.write(
|
|
31
|
+
\`\${out.split('\\n').slice(-30).join('\\n')}\\nfix what it names, then: bunx biome check --write \${file}\\n\`,
|
|
32
|
+
);
|
|
33
|
+
process.exit(2);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
export function claudeHookFile(): GeneratedFile {
|
|
39
|
+
return { path: HOOK_PATH, contents: script };
|
|
40
|
+
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { GeneratedFile, NameSet } from './naming';
|
|
7
7
|
import { claudeAgentFiles } from './scaffold-claude-agents';
|
|
8
8
|
import { claudeCommandFiles } from './scaffold-claude-commands';
|
|
9
|
+
import { claudeHookFile, HOOK_COMMAND, HOOK_PATH } from './scaffold-claude-hook';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Read-only commands and the two write commands whose blast radius is a file the gate checks.
|
|
@@ -13,6 +14,9 @@ import { claudeCommandFiles } from './scaffold-claude-commands';
|
|
|
13
14
|
* Deliberately absent: `x db reset`, `x db backfill --write`, `x secrets`, `x deploy` — each is
|
|
14
15
|
* destructive or reaches production, and an allowlist that covers them is a prompt nobody reads.
|
|
15
16
|
*
|
|
17
|
+
* The read-only commands the app's own docs tell an agent to run (`x impact` before every edit,
|
|
18
|
+
* `x graph`, `x affected`, `x exercise`, `x mcp tools`) are here too: a prompt on one is a stall.
|
|
19
|
+
*
|
|
16
20
|
* The hook is the one part of the bundle that ACTS: `--write` rewrites the file just edited, in
|
|
17
21
|
* place. JSON takes no comment (the lesson `scaffold-repo.ts`'s `biome.json` already paid for), so
|
|
18
22
|
* the disclosure lives in `.claude/README.md` under "The hook" — and a test pins it there.
|
|
@@ -41,6 +45,13 @@ const settings = (): string => `{
|
|
|
41
45
|
"Bash(bunx x i18n check:*)",
|
|
42
46
|
"Bash(bunx x errors:*)",
|
|
43
47
|
"Bash(bunx x docs:*)",
|
|
48
|
+
"Bash(bunx x impact:*)",
|
|
49
|
+
"Bash(bunx x graph:*)",
|
|
50
|
+
"Bash(bunx x affected:*)",
|
|
51
|
+
"Bash(bunx x exercise:*)",
|
|
52
|
+
"Bash(bunx x i18n sync:*)",
|
|
53
|
+
"Bash(bunx x fix boundary:*)",
|
|
54
|
+
"Bash(bunx x mcp tools:*)",
|
|
44
55
|
"Bash(bunx x env check:*)",
|
|
45
56
|
"Bash(bunx x manifest:*)",
|
|
46
57
|
"Bash(bunx x db gen:*)",
|
|
@@ -54,11 +65,12 @@ const settings = (): string => `{
|
|
|
54
65
|
"hooks": {
|
|
55
66
|
"PostToolUse": [
|
|
56
67
|
{
|
|
57
|
-
"matcher": "Edit|Write",
|
|
68
|
+
"matcher": "Edit|Write|MultiEdit",
|
|
58
69
|
"hooks": [
|
|
59
70
|
{
|
|
60
71
|
"type": "command",
|
|
61
|
-
"command": "
|
|
72
|
+
"command": "${HOOK_COMMAND.replaceAll('"', '\\"')}",
|
|
73
|
+
"timeout": 20
|
|
62
74
|
}
|
|
63
75
|
]
|
|
64
76
|
}
|
|
@@ -80,6 +92,7 @@ own — see [The hook](#the-hook), and delete the \`hooks\` block if you would r
|
|
|
80
92
|
| Path | What it costs | When you pay it |
|
|
81
93
|
|---|---|---|
|
|
82
94
|
| \`settings.json\` | nothing in context | read once per session; the hook runs per edit |
|
|
95
|
+
| \`hooks/format-edited.ts\` | nothing in context | runs after each edit, on that one file |
|
|
83
96
|
| \`commands/*.md\` | nothing until invoked | the file is read when you type \`/<name>\` |
|
|
84
97
|
| \`agents/*.md\` | one \`description\` line each | the body is read only when that agent is dispatched |
|
|
85
98
|
|
|
@@ -111,10 +124,12 @@ framework's.
|
|
|
111
124
|
|
|
112
125
|
## The hook
|
|
113
126
|
|
|
114
|
-
One \`PostToolUse\` hook
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
127
|
+
One \`PostToolUse\` hook, \`${HOOK_PATH}\`: \`bunx biome check --write\` on the file that was just
|
|
128
|
+
edited, named by the JSON the harness sends on stdin. **\`--write\` means it rewrites that file in
|
|
129
|
+
place** — the same safe fixes \`biome check --write .\` would make repo-wide, but your working tree
|
|
130
|
+
does change after every agent edit. Scoped to one file, so it costs milliseconds, and it settles
|
|
131
|
+
formatting arguments before they reach a diff. What biome cannot fix is shown to the agent at once,
|
|
132
|
+
with the command that re-checks the file, instead of surfacing later as a red \`lint\` step.
|
|
118
133
|
|
|
119
134
|
It is not a typecheck, because a *scoped* one does not exist: \`tsc\` needs the project, and even
|
|
120
135
|
\`bunx x verify --only typecheck\` checks the whole tree — and says \`NOT A GATE RUN\`, because green
|
|
@@ -131,6 +146,7 @@ export function claudeFiles(app: NameSet): readonly GeneratedFile[] {
|
|
|
131
146
|
return [
|
|
132
147
|
{ path: '.claude/README.md', contents: readme(app) },
|
|
133
148
|
{ path: '.claude/settings.json', contents: settings() },
|
|
149
|
+
claudeHookFile(),
|
|
134
150
|
...claudeCommandFiles(app),
|
|
135
151
|
...claudeAgentFiles(app),
|
|
136
152
|
];
|
|
@@ -25,8 +25,7 @@ const conventions = (app: NameSet): string => `# ${app.pascal}
|
|
|
25
25
|
Human-authored, short, stable — one file under two names, \`AGENTS.md\` being a symlink to it.
|
|
26
26
|
Facts live in \`x.manifest.json\`; this file holds only what an agent cannot infer from the code.
|
|
27
27
|
|
|
28
|
-
Every row below names what refuses it. A rule with nothing in the last column
|
|
29
|
-
not exist — five of these had an empty column and were each measured green on \`bunx x verify\`.
|
|
28
|
+
Every row below names what refuses it. A rule with nothing in the last column does not exist.
|
|
30
29
|
|
|
31
30
|
There is no global \`x\`: every command here is \`bunx x …\`, the CLI this app installs.
|
|
32
31
|
|
|
@@ -43,7 +42,7 @@ queries, jobs, MCP tools, published operations and tests it touches, each with p
|
|
|
43
42
|
| One way | generators, not hand-rolled files: \`bunx x g resource\`, \`bunx x g action\`, \`bunx x g route\` | review |
|
|
44
43
|
| Surfaces | \`site/\` is 0kb JS and may not import \`app/\`; \`shared/\` is a leaf | \`X_BOUNDARY_SITE_TO_APP\` |
|
|
45
44
|
| Data | routes call actions and queries; only \`repo.ts\` touches the database | \`X_BOUNDARY_ROUTE_TO_DB\` |
|
|
46
|
-
| Repos | a \`repo.ts\` reads through the typed handle, never a \`sql\` literal
|
|
45
|
+
| Repos | a \`repo.ts\` reads through the typed handle, never a \`sql\` literal it can express; reported, not refused: an \`await\` per loop turn outside \`expectedQueryLoop('<why>', fn)\`, a bare \`.all()\` (it stops at 50 rows: say \`.limit(n)\`) | \`guards/repo-raw-sql.ts\`, \`guards/repo-await-in-loop.ts\`, \`guards/repo-unbounded.ts\` |
|
|
47
46
|
| Fan-out | a database call per element of a list runs through \`mapBounded(rows, fn, { width })\` from \`@ultimat3/core\` — never \`Promise.all(rows.map(async …))\`, one statement per row at once; a \`// why:\` on the line admits a list bounded where it is built | \`guards/unbounded-fanout.ts\` |
|
|
48
47
|
| Vendors | a server \`fetch(\` carries a \`signal\` in its own options — better, it is \`outbound()\` from \`@ultimat3/core/outbound\`: a deadline, the caller's signal, safe-only retry | \`guards/raw-fetch.ts\` |
|
|
49
48
|
| Polling | an island re-reads a query on a timer with \`useQuery(ref, input, { poll: pollEvery(ms) })\` (\`@ultimat3/realtime\`), anything else with \`visibleInterval(run, ms)\` from \`@ultimat3/core/page\` — no call while the tab is hidden, none after a lost session — never a bare \`setInterval(\`; a \`// why:\` on the line admits a tick that is not a read | \`guards/raw-interval.ts\` |
|
|
@@ -111,10 +110,6 @@ see, and the type already fires — measured, \`price: 19.99\` in a seed is
|
|
|
111
110
|
\`TS2322: Type 'number' is not assignable to type 'MoneyInput'\`. A guard that pretended to check
|
|
112
111
|
it would be worse than the type that really does.
|
|
113
112
|
|
|
114
|
-
\`bun run verify\` is \`bunx x verify\`, the whole gate: its \`budgets\` step runs
|
|
115
|
-
\`bunx x build --target static\` itself when \`.x/build-stats.json\` is missing or older than the
|
|
116
|
-
source, so nothing has to be built first.
|
|
117
|
-
|
|
118
113
|
Commands: \`bun run setup\`, \`bun run dev\`, \`bun run verify\`, \`bunx x g <primitive>\`,
|
|
119
114
|
\`bunx x g guard <name>\`, \`bunx x db branch create <name>\`, \`bunx x doctor\`. \`setup\` is
|
|
120
115
|
\`bin/setup.ts\`, a file Bun runs, so all three are the same command in PowerShell, cmd and bash.
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
// about the TAB: an island polls with `visibleInterval()`, which a hidden tab and a lost session stop.
|
|
26
26
|
// One is about the QUESTION: a destructive act asks through `ConfirmDialog`, never `confirm(`.
|
|
27
27
|
// One is about the POOL: a database call per row runs through `mapBounded`, never all at once.
|
|
28
|
+
// Two more are about the REPO, REPORT ONLY (`severity: 'warning'`) until the apps are clean of
|
|
29
|
+
// them: an `await` per turn of a loop, and a `.all()` that says no bound.
|
|
28
30
|
|
|
29
31
|
import { animatedLayoutPropertyGuardFiles } from './guard-animated-layout-property';
|
|
30
32
|
import { bareErrorGuardFiles } from './guard-bare-error';
|
|
@@ -42,7 +44,9 @@ import { rawLengthGuardFiles } from './guard-raw-length';
|
|
|
42
44
|
import { rawMotionGuardFiles } from './guard-raw-motion';
|
|
43
45
|
import { rawShadowGuardFiles } from './guard-raw-shadow';
|
|
44
46
|
import { rawZIndexGuardFiles } from './guard-raw-z-index';
|
|
47
|
+
import { repoAwaitInLoopGuardFiles } from './guard-repo-await-in-loop';
|
|
45
48
|
import { repoRawSqlGuardFiles } from './guard-repo-raw-sql';
|
|
49
|
+
import { repoUnboundedGuardFiles } from './guard-repo-unbounded';
|
|
46
50
|
import { semanticInteractiveGuardFiles } from './guard-semantic-interactive';
|
|
47
51
|
import { unboundedFanoutGuardFiles } from './guard-unbounded-fanout';
|
|
48
52
|
import { undeclaredCustomPropertyGuardFiles } from './guard-undeclared-custom-property';
|
|
@@ -74,7 +78,9 @@ const SHIPPED: readonly (readonly [string, () => readonly GeneratedFile[]])[] =
|
|
|
74
78
|
['raw-motion', rawMotionGuardFiles],
|
|
75
79
|
['raw-shadow', rawShadowGuardFiles],
|
|
76
80
|
['raw-z-index', rawZIndexGuardFiles],
|
|
81
|
+
['repo-await-in-loop', repoAwaitInLoopGuardFiles],
|
|
77
82
|
['repo-raw-sql', repoRawSqlGuardFiles],
|
|
83
|
+
['repo-unbounded', repoUnboundedGuardFiles],
|
|
78
84
|
['semantic-interactive', semanticInteractiveGuardFiles],
|
|
79
85
|
['unbounded-fanout', unboundedFanoutGuardFiles],
|
|
80
86
|
['undeclared-custom-property', undeclaredCustomPropertyGuardFiles],
|
package/src/verify-changed.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// `x verify --changed`, the pure half: each changed file (app-root-relative) to
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
1
|
+
// `x verify --changed`, the pure half: each changed file (app-root-relative) to its rule, each rule
|
|
2
|
+
// to the gate steps whose inputs it can move. Fail-open: a path no rule speaks for (a root config,
|
|
3
|
+
// a deleted module, a file outside the app) selects every step. One rule trades proof for the inner
|
|
4
|
+
// loop — a route's `page.tsx` (`PAGE_STEPS`) — and the full `x verify` stays the verdict.
|
|
5
5
|
|
|
6
6
|
import { isTest } from './source-files';
|
|
7
7
|
import type { VerifyStepName } from './verify-step';
|
|
@@ -17,6 +17,7 @@ export type ChangeRule =
|
|
|
17
17
|
| 'test'
|
|
18
18
|
| 'drift-input'
|
|
19
19
|
| 'generated'
|
|
20
|
+
| 'page'
|
|
20
21
|
| 'source';
|
|
21
22
|
|
|
22
23
|
/** What the disk says, read once by `verify-changed-facts.ts`, so this file needs no disk. */
|
|
@@ -48,6 +49,10 @@ const isDriftFile = (path: string): boolean =>
|
|
|
48
49
|
|
|
49
50
|
const isTypeScript = (path: string): boolean => /\.[cm]?tsx?$/.test(path);
|
|
50
51
|
|
|
52
|
+
/** A route file, as `registerRoute()` names one: `page.tsx` under an app's `site/` or `app/`. */
|
|
53
|
+
const isPage = (path: string): boolean =>
|
|
54
|
+
/^apps\/[^/]+\/(?:site|app)\/(?:.+\/)?page\.tsx$/.test(path);
|
|
55
|
+
|
|
51
56
|
/** The one rule a changed file falls under, most specific first. */
|
|
52
57
|
export function classifyChange(path: string, facts: ChangedFacts): ChangeRule {
|
|
53
58
|
if (path.startsWith('../')) return 'outside';
|
|
@@ -64,6 +69,7 @@ export function classifyChange(path: string, facts: ChangedFacts): ChangeRule {
|
|
|
64
69
|
// A module gone from disk took its importers' facts with it, entity declarations included.
|
|
65
70
|
if (isTypeScript(path) && !facts.known.has(path)) return 'deleted';
|
|
66
71
|
if (facts.driftReach === 'everything' || facts.driftReach.has(path)) return 'drift-input';
|
|
72
|
+
if (isPage(path)) return 'page';
|
|
67
73
|
return 'source';
|
|
68
74
|
}
|
|
69
75
|
|
|
@@ -82,6 +88,25 @@ const TEST_STEPS: readonly VerifyStepName[] = [
|
|
|
82
88
|
'errors',
|
|
83
89
|
];
|
|
84
90
|
const GENERATED_STEPS: readonly VerifyStepName[] = ['lint', 'contract-diff', 'manifest'];
|
|
91
|
+
/**
|
|
92
|
+
* A page edit, between edits: what the file itself can break — its types, lint, imports (a page
|
|
93
|
+
* is where `site/` reaches for `app/`), its length and its `t()` keys — and the suites, which
|
|
94
|
+
* `narrowSuites` cuts to that route's tests. NOT proved idle, and said so: `budgets`, `seo`,
|
|
95
|
+
* `exercise`, `manifest` and the rest wait for the full `x verify`, the only verdict. Measured
|
|
96
|
+
* (plan 101 19b Y8): the `source` rule ran 16 of 21 steps for a one-line page edit.
|
|
97
|
+
*/
|
|
98
|
+
const PAGE_STEPS: readonly VerifyStepName[] = [
|
|
99
|
+
'typecheck',
|
|
100
|
+
'lint',
|
|
101
|
+
'boundaries',
|
|
102
|
+
'filesize',
|
|
103
|
+
'unit',
|
|
104
|
+
'contract',
|
|
105
|
+
'live',
|
|
106
|
+
'job',
|
|
107
|
+
'e2e',
|
|
108
|
+
'i18n',
|
|
109
|
+
];
|
|
85
110
|
const NOT_DRIFT = VERIFY_STEP_NAMES.filter((name) => name !== 'drift');
|
|
86
111
|
|
|
87
112
|
/** The steps one file selects under its rule. */
|
|
@@ -93,6 +118,8 @@ export function stepsOfChange(path: string, rule: ChangeRule): readonly VerifySt
|
|
|
93
118
|
return [...TEST_STEPS, ownerOf(path)];
|
|
94
119
|
case 'generated':
|
|
95
120
|
return GENERATED_STEPS;
|
|
121
|
+
case 'page':
|
|
122
|
+
return PAGE_STEPS;
|
|
96
123
|
case 'source':
|
|
97
124
|
return NOT_DRIFT;
|
|
98
125
|
default:
|
|
@@ -139,7 +166,7 @@ const NARROWED_SUITES: ReadonlySet<VerifyStepName> = new Set([
|
|
|
139
166
|
]);
|
|
140
167
|
|
|
141
168
|
/** The rules whose files the import closure speaks for; any other rule's suites run whole. */
|
|
142
|
-
const CLOSURE_RULES: ReadonlySet<ChangeRule> = new Set(['source', 'test', 'drift-input']);
|
|
169
|
+
const CLOSURE_RULES: ReadonlySet<ChangeRule> = new Set(['source', 'page', 'test', 'drift-input']);
|
|
143
170
|
|
|
144
171
|
export interface NarrowedPlan {
|
|
145
172
|
readonly plan: ChangedStepPlan;
|
package/src/verify-checks.ts
CHANGED
|
@@ -25,7 +25,7 @@ import { checkDocumentStyles, documentSurfaces } from './document-styles';
|
|
|
25
25
|
import { driftOutcome } from './drift-store';
|
|
26
26
|
import { checkErrorCodeResolution, checkErrorFixReport } from './error-contract';
|
|
27
27
|
import { withUnprovenFloor } from './exercise-floor-report';
|
|
28
|
-
import {
|
|
28
|
+
import { guardReport, guardWarningLine } from './guards';
|
|
29
29
|
import { catalogFindings } from './i18n-registration';
|
|
30
30
|
import { isrQueryAdvice } from './isr-query-advice';
|
|
31
31
|
import { readJobBudgetFindings } from './job-budget';
|
|
@@ -44,7 +44,11 @@ import { checkLockHeavyMigrations } from './migration-lock-check';
|
|
|
44
44
|
import type { Finding } from './output';
|
|
45
45
|
import { retainUnsweptFindings } from './retain-sweep';
|
|
46
46
|
import { checkMigrationDrift } from './schema-drift';
|
|
47
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
checkSchemaDump,
|
|
49
|
+
undeclaredIndexFindings,
|
|
50
|
+
undeclaredIndexWarnings,
|
|
51
|
+
} from './schema-dump-drift';
|
|
48
52
|
import { cardRouteFindings } from './seo-cards';
|
|
49
53
|
import { scanSiteMeta } from './seo-meta';
|
|
50
54
|
import { quoteArg } from './shell-quote';
|
|
@@ -124,13 +128,21 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
|
|
|
124
128
|
// ONE read of the app's surface files for the whole step: the import rules, the transport
|
|
125
129
|
// rule and every guard are handed the same text. The guards used to walk and read the tree a
|
|
126
130
|
// second time (`guard-sources.ts`).
|
|
131
|
+
//
|
|
132
|
+
// A report-only guard's findings ride as warnings, as the filesize band does: listed, never red.
|
|
127
133
|
async run(ctx) {
|
|
128
134
|
const sources = await readAppSources(ctx.root);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
...(
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
const guards = await guardReport(ctx.root, sources);
|
|
136
|
+
return {
|
|
137
|
+
...fromFindings([
|
|
138
|
+
...(await appBoundaryFindings(ctx.root, sources)),
|
|
139
|
+
...guards.findings,
|
|
140
|
+
...(await hostFindings(ctx, 'boundaries')),
|
|
141
|
+
]),
|
|
142
|
+
...(guards.warnings.length === 0
|
|
143
|
+
? {}
|
|
144
|
+
: { warnings: guards.warnings.map(guardWarningLine) }),
|
|
145
|
+
};
|
|
134
146
|
},
|
|
135
147
|
},
|
|
136
148
|
{
|
|
@@ -238,6 +250,13 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
|
|
|
238
250
|
// registry, migrations and image (`X_APP_ROOT_NESTED`, `verify-drift-owner.ts`).
|
|
239
251
|
...(await nestedAppRootFindings(ctx.root)),
|
|
240
252
|
],
|
|
253
|
+
// Beside the schema rails, advice and not a verdict on `main`: an index the dump holds that
|
|
254
|
+
// no snapshot or entity declares (`X_DB_INDEX_UNDECLARED`). `REFUSE_UNDECLARED_INDEX`
|
|
255
|
+
// in `drift-store.ts` is the `next` switch that makes it a finding.
|
|
256
|
+
advice: {
|
|
257
|
+
findings: () => undeclaredIndexFindings(ctx.root),
|
|
258
|
+
warnings: () => undeclaredIndexWarnings(ctx.root),
|
|
259
|
+
},
|
|
241
260
|
// The seventh: a generated client (`x client`) against its own stamp — a source document that
|
|
242
261
|
// moved (`X_CLIENT_STALE`) or a body edited by hand (`X_CLIENT_EDITED`). No database.
|
|
243
262
|
client: () => checkClientDrift(ctx.root),
|
package/src/verify-progress.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
// What the gate writes to stderr WHILE it runs, in every render mode: a line per finished step and
|
|
2
2
|
// a heartbeat naming the steps still running. Both entries print their verdict only at the end, so
|
|
3
3
|
// a run killed mid-way left nothing (#589), and a harness that kills on SILENCE killed a healthy one.
|
|
4
|
+
// The line is JSON for a `--json` reader and a mark, step and seconds for a person (`render`).
|
|
4
5
|
|
|
5
6
|
import type { Clock } from '@ultimat3/core';
|
|
6
7
|
import { systemClock } from '@ultimat3/core';
|
|
8
|
+
import { TEST_TYPES } from '@ultimat3/testing';
|
|
7
9
|
import { msg } from './messages';
|
|
8
10
|
import type { StepResult } from './output';
|
|
11
|
+
import { quoteArg } from './shell-quote';
|
|
12
|
+
import { isTest } from './source-files';
|
|
9
13
|
import type { VerifyStepName } from './verify-step';
|
|
10
14
|
|
|
11
15
|
/**
|
|
@@ -36,6 +40,28 @@ export const stepLine = (step: StepResult): string =>
|
|
|
36
40
|
...(step.skipped === true ? { skipped: true } : {}),
|
|
37
41
|
});
|
|
38
42
|
|
|
43
|
+
const SUITES: ReadonlySet<string> = new Set(TEST_TYPES);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The narrowest command that runs a red step again: the suite over the test files its findings
|
|
47
|
+
* name, or the step alone. Never the whole gate — a person fixing one step re-runs one step.
|
|
48
|
+
*/
|
|
49
|
+
export function narrowestRerun(step: StepResult): string {
|
|
50
|
+
const files = [
|
|
51
|
+
...new Set(step.findings.flatMap((f) => (f.at !== undefined && isTest(f.at) ? [f.at] : []))),
|
|
52
|
+
];
|
|
53
|
+
return SUITES.has(step.name) && files.length > 0
|
|
54
|
+
? `x test ${step.name} --filter ${quoteArg(files.join(','))} --json`
|
|
55
|
+
: `x verify --only ${step.name} --json`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** `✓ lint 22.0s`, `○ seo 0.0s` (did not apply), `✗ unit 3.1s → x test unit --filter … --json`. */
|
|
59
|
+
export function humanStepLine(step: StepResult): string {
|
|
60
|
+
const mark = step.skipped === true ? '○' : step.ok ? '✓' : '✗';
|
|
61
|
+
const line = `${mark} ${step.name} ${(step.durationMs / 1000).toFixed(1)}s`;
|
|
62
|
+
return step.ok ? line : `${line} → ${narrowestRerun(step)}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
39
65
|
/** `12m 3s`, `45s`: a person reading a CI log, not a parser — the step lines carry exact ms. */
|
|
40
66
|
export const elapsedLabel = (ms: number): string => {
|
|
41
67
|
const seconds = Math.floor(ms / 1000);
|
|
@@ -58,6 +84,11 @@ export interface VerifyProgressHooks {
|
|
|
58
84
|
export interface VerifyProgressOptions {
|
|
59
85
|
readonly clock?: Clock;
|
|
60
86
|
readonly every?: Every;
|
|
87
|
+
/**
|
|
88
|
+
* `json` (the default): `stepLine`, for a reader that parses stderr. `human`: `humanStepLine`,
|
|
89
|
+
* for a person — `x verify` and `scripts/verify.ts` pass it when `--json` is unset.
|
|
90
|
+
*/
|
|
91
|
+
readonly render?: 'json' | 'human';
|
|
61
92
|
}
|
|
62
93
|
|
|
63
94
|
/**
|
|
@@ -89,7 +120,7 @@ export async function withVerifyProgress<T>(
|
|
|
89
120
|
},
|
|
90
121
|
onStep: (step) => {
|
|
91
122
|
running.delete(step.name);
|
|
92
|
-
write(stepLine(step));
|
|
123
|
+
write(options.render === 'human' ? humanStepLine(step) : stepLine(step));
|
|
93
124
|
},
|
|
94
125
|
});
|
|
95
126
|
} finally {
|
package/wiki/CLI-Reference.md
CHANGED
|
@@ -647,6 +647,7 @@ config, a catalog) runs every test.
|
|
|
647
647
|
| `doc` | `*.md`, `docs/`, `wiki/` | package-shape, errors, unit, manifest, roadmap |
|
|
648
648
|
| `test` | `*.test.ts(x)`, `e2e/` | typecheck, lint, filesize, package-shape, errors + the suite that owns the file |
|
|
649
649
|
| `generated` | `x.manifest.json` | lint, contract-diff, manifest |
|
|
650
|
+
| `page` (`As of 31.22`) | `apps/<app>/site/**/page.tsx`, `apps/<app>/app/**/page.tsx` | typecheck, lint, boundaries, filesize, i18n + the suites, cut to that route's tests. An inner-loop answer, not proved idle: `budgets`, `seo`, `exercise`, `manifest` wait for the full `x verify` |
|
|
650
651
|
| `source` | `apps/`, `packages/`, `guards/`, `scripts/`, `types/`, `bin/` | every step but `drift` |
|
|
651
652
|
| `drift-input` | `packages/db/**`, `apps/*/clients/**`, `openapi.json`, any module importing `@ultimat3/entity` and everything it imports | every step |
|
|
652
653
|
| `root-config` · `deleted` · `unknown` · `outside` | a root file, any `app.config.ts`, a vanished module, another directory, a path outside the app | every step |
|
|
@@ -670,8 +671,10 @@ below on `--workers` and batching describe 22.6 and earlier where they differ.
|
|
|
670
671
|
| `exercise` | `{ "unprovenMax"?: <0–1>, "statementsMax"?: <whole ≥ 1> }` — what the `exercise` step's pass may leave unproven, and statements per call (`X_EXERCISE_UNPROVEN_ABOVE_FLOOR`, `X_STATEMENTS_OVER_BUDGET`); absent, each is a warning line → [`x exercise`](#x-exercise), `As of 31.16.0` |
|
|
671
672
|
| `isolate` · `typecheckBin` · `agentsMdMaxBytes` | a fresh global per test file · the `tsc`-compatible binary · the `AGENTS.md` byte budget |
|
|
672
673
|
|
|
673
|
-
Either render prints one line per finished step on **stderr** — `
|
|
674
|
-
|
|
674
|
+
Either render prints one line per finished step on **stderr** as each finishes — under `--json`
|
|
675
|
+
`{"step":"lint","ok":true,"ms":21987}`, otherwise (`As of 31.22`) `✓ lint 22.0s`, `○ seo 0.0s` for a
|
|
676
|
+
step that did not apply, and for a red step its narrowest re-run: `✗ unit 3.1s → x test unit --filter
|
|
677
|
+
<the test files its findings name> --json`, else `x verify --only <step> --json` — and every minute a step is still running a `still running: unit (12m 3s)` line;
|
|
675
678
|
under `--json` stdout stays the single document. A cancelled job's log ends on the last step that
|
|
676
679
|
finished, and a harness that kills a process after N silent minutes never kills a healthy gate.
|
|
677
680
|
|
|
@@ -1182,25 +1185,29 @@ x mcp serve [--transport stdio|http] [--port 9229] [--json]
|
|
|
1182
1185
|
| `--transport` | string | `stdio` | `stdio` for an editor client, `http` for a socket |
|
|
1183
1186
|
| `--port` | string | `9229` | HTTP port when `--transport http`. `9229` is also the inspector's default; a taken port is `X_PORT_IN_USE`, naming the next one |
|
|
1184
1187
|
|
|
1185
|
-
Serves `@ultimat3/mcp`'s dev server —
|
|
1188
|
+
Serves `@ultimat3/mcp`'s dev server — 23 tools (`As of 31.22`), one catalog, the same on both transports. Every
|
|
1186
1189
|
tool declares a scope; the local developer's caller carries all five, and an HTTP caller carries
|
|
1187
1190
|
whatever its bearer token was issued.
|
|
1188
1191
|
|
|
1189
1192
|
| Tool | Does | Scope |
|
|
1190
1193
|
|---|---|---|
|
|
1191
1194
|
| `routes.list` | the `x routes --json` table: pages (render mode, hydrate, offline, budget), then every action, query and `runtime.ts` route | `dev:read` |
|
|
1192
|
-
| `schema.describe` | entities with columns, types and invariants | `dev:read` |
|
|
1195
|
+
| `schema.describe` | entities with columns, types and invariants; `{ entity }` narrows to one, by name or table (`As of 31.22`) | `dev:read` |
|
|
1193
1196
|
| `policies.list` | every policy: permission, subject, where it is enforced | `dev:read` |
|
|
1194
1197
|
| `actions.describe` | actions and queries: schemas, policy, cache tags, MCP exposure | `dev:read` |
|
|
1195
1198
|
| `jobs.inspect` | job definitions, retry policy and steps | `dev:read` |
|
|
1196
1199
|
| `queue.depth` | pending, running and failed counts per queue | `dev:read` |
|
|
1197
1200
|
| `manifest.read` | the generated `x.manifest.json` as text | `dev:read` |
|
|
1198
1201
|
| `errors.explain` | `X_*` → cause, fix, docs | `dev:read` |
|
|
1202
|
+
| `docs.search` | `x docs` as a tool: the installed docs ranked for a question, a topic or a symbol; `limit` 1–20, default 5 (`As of 31.22`) | `dev:read` |
|
|
1203
|
+
| `verify.narrow` | `{ file }` → the steps `x verify --changed` selects for that one file and the narrowest commands that run them; runs nothing (`As of 31.22`) | `dev:read` |
|
|
1199
1204
|
| `db.query` | ONE read-only SQL statement; `limit` defaults to 100 rows, maximum 1000 | `db:read` |
|
|
1205
|
+
| `db.explain` | the plan of ONE `SELECT`/`WITH … SELECT` as `EXPLAIN (FORMAT JSON)`; `analyze: true` executes it inside `db.query`'s SELECT-only role, read-only transaction and 5 s timeout. A production database is refused, as `x explain` refuses it (`As of 31.22`) | `db:read` |
|
|
1200
1206
|
| `db.migrate` | apply pending migrations to a **branch** database | `db:migrate` |
|
|
1201
1207
|
| `tests.run` | `x test [--filter]` itself — the shell's files, batches and environment, so it agrees with `x test`; structured results — an error outside any test (`1 error` beside `0 fail`) or a non-zero exit is a failure, never `failed: 0` | `dev:test` |
|
|
1202
1208
|
| `verify.run` | `x verify` itself, so it agrees with the shell; `only: [steps]` is `--only` (not a gate run); structured per-step result | `dev:test` |
|
|
1203
1209
|
| `logs.tail` | last N log lines, optionally for one role | `dev:logs` |
|
|
1210
|
+
| `requests.statements` | the running `x dev`'s per-request statement ledger: SQL count, repeated statements and N+1 verdicts per recent request, or one `requestId`; `limit` default 10, maximum 50. No `x dev` running: `X_NOT_IMPLEMENTED` naming it (`As of 31.22`) | `dev:logs` |
|
|
1204
1211
|
| `graph.query` | `{ node }`: what a change to a file or primitive reaches (`x impact`); `{ from, to }`: the edges linking two nodes (`x graph --from --to`) | `dev:read` |
|
|
1205
1212
|
| `ui.shot` | photograph one route at a named viewport, light or dark; PNG path plus verdict. Launches a browser | `dev:test` |
|
|
1206
1213
|
| `ui.island` | photograph an island in every state its `*.island.states.ts` declares, as `x shot --island` does | `dev:test` |
|
|
@@ -1210,7 +1217,8 @@ whatever its bearer token was issued.
|
|
|
1210
1217
|
|
|
1211
1218
|
`db.query` and `db.migrate` refuse structurally — multiple statements, a mutating keyword
|
|
1212
1219
|
(a data-modifying CTE included), a locking clause, `EXPLAIN ANALYZE`, a non-branch target —
|
|
1213
|
-
before the host runs anything.
|
|
1220
|
+
before the host runs anything. `db.explain` is where `ANALYZE` is allowed: it writes the `EXPLAIN`
|
|
1221
|
+
itself around a statement the same scan passed.
|
|
1214
1222
|
|
|
1215
1223
|
Never exposed in `ROLE=web`. Errors split by when they fire:
|
|
1216
1224
|
|
|
@@ -1229,16 +1237,16 @@ x doctor [--port 3000] [--json]
|
|
|
1229
1237
|
|
|
1230
1238
|
Checks Bun version, env completeness, source drift, **the newest migration's `.snapshot.json`**, port availability, PWA prerequisites and **embedded-Postgres readiness** — each failing check carries its own fix command.
|
|
1231
1239
|
|
|
1232
|
-
It also lists the shipped guards the app
|
|
1240
|
+
It also lists the shipped guards the app holds that differ from the current template — a copy from an older release, or the app's own edit — and warns `X_SHIPPED_GUARD_MISSING` for each one the app's `guards/` does not hold, its fix `x g guard <name> && x verify --only boundaries --json` (`As of 31.22`: a warning beside the verdict in `data.warnings[]`, so the exit status is unchanged; it was a listing). `As of 2026-10-07` (owner decision 8: shipped guards stay copies the app owns).
|
|
1233
1241
|
|
|
1234
1242
|
| Listing | One line each | `--json` |
|
|
1235
1243
|
|---|---|---|
|
|
1236
|
-
| missing | `
|
|
1244
|
+
| missing | its `X_SHIPPED_GUARD_MISSING` warning line (`As of 31.22`) | `data.guards.missing[]`: `{ name, add }`, and the warning in `data.warnings[]` |
|
|
1237
1245
|
| differs from the template (line endings ignored) | `x g guard <name> --force` — rewrites the guard and its test; review the diff, and restore your edit if it was deliberate | `data.guards.differs[]`: `{ name, refresh }` |
|
|
1238
1246
|
|
|
1239
1247
|
A listing, never a finding: deleting or editing a guard is how an app changes a rule, so the verdict does not move.
|
|
1240
1248
|
|
|
1241
|
-
Four warnings about how the app is held, `As of 31.16.0` — beside the verdict, never in it: the exit status, `findings` and `data.codes` stay as they were, and `--json` carries each as `data.warnings[]` (`{ code, cause, fix, docs, at }`). None is a gate step; on `next` they join the verdict, red:
|
|
1249
|
+
Four warnings about how the app is held, `As of 31.16.0` (a fifth, `X_SHIPPED_GUARD_MISSING`, `As of 31.22`) — beside the verdict, never in it: the exit status, `findings` and `data.codes` stay as they were, and `--json` carries each as `data.warnings[]` (`{ code, cause, fix, docs, at }`). None is a gate step; on `next` they join the verdict, red:
|
|
1242
1250
|
|
|
1243
1251
|
| Code | Asked | Fix |
|
|
1244
1252
|
|---|---|---|
|
|
@@ -1246,6 +1254,7 @@ Four warnings about how the app is held, `As of 31.16.0` — beside the verdict,
|
|
|
1246
1254
|
| `X_VERIFY_STEP_UNFLOORED` | a gate step applies here — its suite files exist, its input is committed — and `x.verify.json` `"steps"` does not hold it, so a deleted suite reads as skipped. `e2e` is never proposed (the scaffold's placeholder skips until a browser driver is registered) | `x verify --only <steps> --json`, then add each step that passed to `"steps"` |
|
|
1247
1255
|
| `X_FRAMEWORK_PIN_RANGE` | an `@ultimat3/*` dependency in any of the app's manifests is anything but an exact version or a `workspace:`/`file:`/`link:` path (`^31.0.0`, `*`, `latest`, `>=31 <32`; an `npm:` alias by its own spec), one finding per manifest | the exact version `bun install` resolved, at the line named; then `bun install` |
|
|
1248
1256
|
| `X_ENV_NAME_RESERVED` | a name the app declares in `envSchema` or seals in `secrets.enc.json` is one `FRAMEWORK_ENV` (`@ultimat3/core`) lists as a `switch` or `internal` name — setting it for the app also switches that package's behaviour. Deploy-contract names (`DATABASE_URL`, `PORT`) and host names are not collisions | rename it `APP_<name>` (or delete it where the value is meant for the framework); then `x env example` |
|
|
1257
|
+
| `X_SHIPPED_GUARD_MISSING` (`As of 31.22`) | a guard `x new` ships is not in the app's `guards/`, so the gate does not hold the app to that rule — one per guard | `x g guard <name> && x verify --only boundaries --json` |
|
|
1249
1258
|
|
|
1250
1259
|
**The chart's monitoring templates**, the same way (`As of 2026-11`): an app with a `docker/helm/Chart.yaml` and no `templates/servicemonitor.yaml` or `templates/alert-rules.yaml` gets one line per missing file, then `x g chart-alerts`, which writes only those (`--json`: `data.chartAlerts`, `{ missing[], add }`). The dashboard is its own row: no `dashboards/ultimate-app.json` or `templates/dashboard-configmap.yaml` lists them, then `x g chart-dashboard` (`data.chartDashboard`, the same shape). A chart that dropped them on purpose keeps a green verdict; an app with no chart is listed nothing.
|
|
1251
1260
|
|
|
@@ -1949,6 +1958,8 @@ x docs "<question|topic|symbol>" [--limit <n>] [--json]
|
|
|
1949
1958
|
|
|
1950
1959
|
A question is ranked; a `Page#anchor` topic (`x docs Upgrading#28x--2900-entry-by-entry`) prints that **whole section**, subsections included, and nothing past it. `x upgrade --json`'s `section.local` is that topic. A search hit carries a capped excerpt.
|
|
1951
1960
|
|
|
1961
|
+
A question is ranked by its task words too (`As of 31.22`): a synonyms table maps a word that names one task to the mechanism that does it — `paginate` → `keyset`, `poll`/`interval` → `pollEvery`/`visibleInterval`, `concurrency` → `mapBounded`, `latest` → `latestBy`, `typing` → `debounce`, `advisory` → `lockKeys`, `denormalize` → `countedIn`, `memoize` → `retryMemo` — and a page that exports the mechanism outranks prose about the task. The dev MCP's `docs.search` is this command.
|
|
1962
|
+
|
|
1952
1963
|
The ranking — which hits, in which order — is **not a stable surface**: a minor may reorder it. The `--json` shape is. An install with no `wiki/` still answers from the packages, with an `X_CLI_UNEXPECTED` finding.
|
|
1953
1964
|
|
|
1954
1965
|
## x fix
|
package/wiki/MCP-And-AI.md
CHANGED
|
@@ -13,19 +13,23 @@ The whole catalog, spelled exactly as each tool must be called; `bunx x mcp tool
|
|
|
13
13
|
| Tool | Introspects / does | Replaces the agent's usual guess |
|
|
14
14
|
|---|---|---|
|
|
15
15
|
| `routes.list` | the `x routes --json` table: pages (render mode, hydrate, offline, budget), then every action, query and `runtime.ts` route | grepping a router directory |
|
|
16
|
-
| `schema.describe` | entities with columns, types and invariants | reading migration files in order |
|
|
16
|
+
| `schema.describe` | entities with columns, types and invariants; `{ entity }` (a name or a table) narrows to one, an unknown name answers the names there are (`As of 31.22`) | reading migration files in order |
|
|
17
17
|
| `policies.list` | every `policy`: permission, subject, where it is enforced | "is this endpoint protected?" |
|
|
18
18
|
| `actions.describe` | every action **and query**: input/output schema, policy, cache tags, MCP exposure | reading `api/` by hand |
|
|
19
19
|
| `jobs.inspect` | job definitions, retry policy and steps; omit `name` for all | reading `jobs.ts` and guessing the retry |
|
|
20
20
|
| `queue.depth` | pending, running and failed counts per queue | tailing a worker to see if it keeps up |
|
|
21
21
|
| `manifest.read` | the whole `x.manifest.json`, as text | ten separate reads |
|
|
22
22
|
| `errors.explain` | `X_*` code → cause, exact fix command, docs URL | web search |
|
|
23
|
+
| `docs.search` | `x docs` as a tool: the installed framework docs (packages and wiki) ranked for a task-phrased question, a topic or a symbol; an `X_*` code is redirected to `errors.explain`. Offline (`As of 31.22`) | a web search for the wrong version |
|
|
24
|
+
| `verify.narrow` | `{ file }` → the `x verify --changed` plan for that one file: its rule, the steps it selects and the narrowest commands (its tests first). Runs nothing (`As of 31.22`) | the whole gate after a one-line edit |
|
|
23
25
|
| `graph.query` | `{ node }` (a file path, a primitive name or a node id) → every route, action, query, job, MCP tool, published operation, test and budget a change to it reaches, each with the provenance of the edges that reached it — `x impact`'s answer. `{ from, to }` → the chain of edges linking two nodes — `x graph --from --to`'s. An unknown name is `X_GRAPH_NODE_UNKNOWN` naming the nearest three; any other combination of arguments is an `isError` naming the two shapes. Rebuilt per call, so it answers for the code as it is now | grepping importers before an edit, and missing the route that reads it through a query |
|
|
24
26
|
| `db.query` | **read-only** SQL, 100-row default and 1000-row maximum, `EXPLAIN` on request | inventing a query and hoping |
|
|
27
|
+
| `db.explain` | the plan of ONE `SELECT`/`WITH … SELECT`, `EXPLAIN (FORMAT JSON)`; `analyze: true` executes it inside `db.query`'s SELECT-only role and read-only transaction, under its timeout. Writes, a second statement and data-modifying CTEs are `X_MCP_QUERY_REJECTED`; a production database is refused (`As of 31.22`) | guessing why a query is slow |
|
|
25
28
|
| `db.migrate` | apply pending migrations **in a branch DB only** | mutating the dev database |
|
|
26
29
|
| `tests.run` | run the suite or a substring filter, structured results | parsing terminal output |
|
|
27
30
|
| `verify.run` | the whole gate; `fix: true` applies safe autofixes | guessing whether the work is shippable |
|
|
28
31
|
| `logs.tail` | last N structured log lines, filterable by runtime role | scrollback archaeology |
|
|
32
|
+
| `requests.statements` | the running `x dev`'s statement ledger: per recent request the SQL count, repeated statements and N+1 verdicts (`X_N_PLUS_ONE_QUERY`/`WRITE`, with the fix); `requestId` for one. Needs `x dev` running (`As of 31.22`) | counting queries in a log |
|
|
29
33
|
| `ui.shot` | photograph one route at a named viewport (`phone`/`tablet`/`desktop`, or `width`+`height`) in `light` or `dark` (`theme`: `prefers-color-scheme` is emulated **and** the scheme is stored as the visitor's choice under `THEME_STORAGE_KEY` before navigation, so an app with `theme.defaultMode: 'dark'` still captures light when asked — `As of 2026-09-19`), against the running `x dev`; returns the PNG **path** and the same verdict `x shot` writes — console, page errors, refused requests, whether every island mounted. Refuses a route with no `budget.js` | a hand-written puppeteer script, and a picture nobody judged |
|
|
30
34
|
| `ui.island` | `x shot --island <name> [--state]` as a tool: every declared state photographed and judged | the same, per component |
|
|
31
35
|
| `ui.inspect` | DOM, computed-style and accessibility facts for up to 20 selectors in **one** navigation of a route: per match the tag, text (≤200 chars), box, visibility, attributes (≤20), the computed `styles` you name (≤32, kebab-case; the rest land in `droppedStyles`) and with `a11y: true` the browser-computed role and name; plus `title`, `data-theme`, the focused element, the island count, console and page errors. ≤25 matches per selector, 64 KB on the wire (matches are dropped from the LAST selectors first, `truncated: true`); an unparsable selector answers `valid: false`. Takes the same PNG and verdict as `ui.shot` under `inspect/`; same budget gate, same `theme` semantics (the reported `data-theme` is the one asked for, on a dark-default app too) | `page.evaluate` scripts written per question, and a browser launched per question |
|
|
@@ -34,8 +38,8 @@ The whole catalog, spelled exactly as each tool must be called; `bunx x mcp tool
|
|
|
34
38
|
|
|
35
39
|
| Class | Tools | Exposure |
|
|
36
40
|
|---|---|---|
|
|
37
|
-
| read | `routes.list`, `schema.describe`, `policies.list`, `actions.describe`, `jobs.inspect`, `queue.depth`, `manifest.read`, `errors.explain`, `graph.query`, `ui.diff` | scope `dev:read`, unrestricted in dev — `ui.diff` reads files, and sits here because it reads only `.x/shot/` (resolve + prefix check, symlinks resolved) and launches nothing |
|
|
38
|
-
| gated read | `db.query`, `logs.tail` | scope `db:read` / `dev:logs` |
|
|
41
|
+
| read | `routes.list`, `schema.describe`, `policies.list`, `actions.describe`, `jobs.inspect`, `queue.depth`, `manifest.read`, `errors.explain`, `graph.query`, `docs.search`, `verify.narrow`, `ui.diff` | scope `dev:read`, unrestricted in dev — `ui.diff` reads files, and sits here because it reads only `.x/shot/` (resolve + prefix check, symlinks resolved) and launches nothing |
|
|
42
|
+
| gated read | `db.query`, `db.explain`, `logs.tail`, `requests.statements` | scope `db:read` / `dev:logs` |
|
|
39
43
|
| executes code | `tests.run`, `verify.run`, `ui.shot`, `ui.island`, `ui.inspect`, `ui.interact` | scope `dev:test`; all six declare `destructive: true`, so none is metered as read chatter — the four `ui.*` tools launch a browser |
|
|
40
44
|
| write | `db.migrate` | scope `db:migrate`, **branch environments only** |
|
|
41
45
|
|
|
@@ -328,7 +328,7 @@ Timings, worker counts and the `slowest:` lines trimmed:
|
|
|
328
328
|
bunx x mcp serve --transport http --port 9229
|
|
329
329
|
```
|
|
330
330
|
|
|
331
|
-
|
|
331
|
+
23 tools, one catalog, the same on `stdio` and `http` — 18 framework tools (`routes.list`, `schema.describe`, `policies.list`, `actions.describe`, `jobs.inspect`, `queue.depth`, `manifest.read`, `errors.explain`, `docs.search`, `db.query`, `db.explain`, `db.migrate`, `tests.run`, `verify.run`, `verify.narrow`, `logs.tail`, `requests.statements`, `graph.query`) and five that look at the UI (`ui.shot`, `ui.island`, `ui.inspect`, `ui.interact`, `ui.diff`). `bunx x mcp tools` prints them with their scopes.
|
|
332
332
|
|
|
333
333
|
`createTodo` reaches an agent's tool list through the app's own surface in `packages/mcp/src/index.ts` (`defineAppMcp({ include: 'exposed' })`), carrying `mcp: { expose: true }` and **the action's own policy** as its authorization. Full model: [MCP and AI](MCP-And-AI).
|
|
334
334
|
|
package/wiki/Upgrading.md
CHANGED
|
@@ -282,6 +282,13 @@ A setter still on a package's `.` barrel is `X_ADAPTER_PORT_INCOMPLETE` on the `
|
|
|
282
282
|
| the chart has six new alert rules (**31.18.0**): `UltimateErrorBudgetFastBurn` / `UltimateErrorBudgetSlowBurn` against `alerts.objective` (default 99.9), plus `UltimateJobFailures`, `UltimatePoolSaturated`, `UltimateEventLoopLag` and `UltimateMemoryNearLimit`. It also has an opt-in Grafana dashboard (`dashboard.enabled: false`). Every process on a memory-limited container now emits `process_memory_limit_bytes` | nothing; an older app chart keeps its rules. To adopt the new rules: `x g chart-alerts --force`. To add the dashboard: `x g chart-dashboard`, then set `dashboard.enabled: true` where a Grafana sidecar runs. `x doctor` lists the dashboard files while the chart lacks them. To disable one rule: `alerts: { rules: { UltimateEventLoopLag: { enabled: false } } }` |
|
|
283
283
|
| the reference app's and the demo's `docker/Dockerfile` (`examples/dummy`, `dummy/social-media-clone`) now match `x new`'s template (**31.19.0**): a `manifests` stage copies every workspace `package.json` and nothing else, the `deps` stage installs from it and `bun.lock`, the runtime stage is built `FROM deps`, and it runs as `USER 1000:1000` where it said `USER bun` | nothing for an app `x new` wrote: its Dockerfile already had this shape. An app that copied either tracked file: copy a fresh scaffold's (`x new <scratch> && cp <scratch>/docker/Dockerfile docker/`). `1000` is the base image's `bun` user, so a volume owned by `bun` still opens |
|
|
284
284
|
| the framework repo's `manifest` step prints `warning: X_PUBLIC_API_BREAK_UNDECLARED …` for an exported symbol whose declaration changed or that is gone with no `BREAKING —` entry naming it, and `X_PUBLIC_API_UNSCANNED` when the lock cannot be read (**31.19.0**). Report-only in 31.x: the step stays green, and only `bun run scripts/public-api.ts --strict` is red | nothing for an app. In this repo: revert the change, or land it on `next` with a `- **BREAKING —** (#N) <name> …` line under [Unreleased]; an addition is recorded with `bun run scripts/public-api.ts --write --json` |
|
|
285
|
+
| `x verify`'s `drift` step prints `X_DB_INDEX_UNDECLARED` as a **warning line** (**31.21.0**) for each index in the committed schema dump (`packages/db/schema/05_indexes/`) that neither the newest migration snapshot nor any entity's `indexes:` declares — typically the old name a rename migration never dropped, which every write still maintains. The step stays green; it is red on the next major, `next` | before the next major: `x verify --only drift --json`, then for each warning either drop it — a hand-written migration of its own in `packages/db/migrations/`, first line `-- transaction: false`, then the warning's `DROP INDEX CONCURRENTLY IF EXISTS "<name>";` — or keep it by declaring it in that entity's `indexes: [...]` and running `x db gen "<change>"` |
|
|
286
|
+
| `x doctor` prints `X_SHIPPED_GUARD_MISSING` **warnings** (**31.22.0**), one per shipped guard the app's `guards/` does not hold — `x new` now ships 25, and a missing one used to be a listing under "no findings — environment is shippable". Beside the verdict, in `--json` as `data.warnings[]`: the exit status is unchanged | `x g guard <name> && x verify --only boundaries --json` for each one you want; a guard you deleted on purpose stays deleted, and its warning says only that the gate does not hold you to it |
|
|
287
|
+
| two new shipped guards, **report-only** (**31.22.0**): `repo-await-in-loop` (`X_REPO_AWAIT_IN_LOOP`) and `repo-unbounded` (`X_REPO_UNBOUNDED`), each `severity: 'warning'` — their findings are warning lines on the `boundaries` step, never red | `x g guard repo-await-in-loop && x g guard repo-unbounded`, then `x verify --only boundaries --json` and read `warnings`: an `.all()` over a list with no bound is usually a silent 50-row cut (`DEFAULT_PAGE_SIZE`) — `.inBatches(size)` reads every row, `.limit(n)` says the bound; a loop that must stay one statement per turn goes inside `expectedQueryLoop('<why>', fn)` |
|
|
288
|
+
| an app scaffolded before **31.22.0** has a `.claude/settings.json` PostToolUse hook that does nothing: it reads `$CLAUDE_FILE_PATHS`, which Claude Code never sets, and ends `\|\| true` | copy the hook `x new` writes now: `bunx @ultimat3/cli new scratch --dir /tmp --no-git && mkdir -p .claude/hooks && cp /tmp/scratch/.claude/hooks/format-edited.ts .claude/hooks/`, then in `.claude/settings.json` set that hook's `matcher` to `Edit\|Write\|MultiEdit` and its `command` to `bun "$CLAUDE_PROJECT_DIR"/.claude/hooks/format-edited.ts` (`"timeout": 20`) |
|
|
289
|
+
| `x verify` without `--json` prints its per-step stderr lines for a person (**31.22.0**): `✓ lint 22.0s`, and for a red step its narrowest re-run — no longer `{"step":…}` JSON | a script that parses those lines passes `--json`, which keeps them JSON |
|
|
290
|
+
| `x verify`'s `lint` step reports every format and import-order miss as one `X_LINT_FAILED` (**31.22.0**), its fix a single `bunx biome check --write <file…>`; a reader counting one finding per file sees fewer | nothing; run the one command |
|
|
291
|
+
| `x verify --changed` gives a route's `page.tsx` its own rule, `page` (**31.22.0**): typecheck, lint, boundaries, filesize, i18n and that route's tests, where it ran every step but `drift` | nothing; `x verify` with no flag is still the verdict |
|
|
285
292
|
|
|
286
293
|
## 29.x → 30.0.0, entry by entry
|
|
287
294
|
|