@ultimat3/cli 31.21.0 → 31.22.1

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.
@@ -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],
@@ -1,7 +1,7 @@
1
- // `x verify --changed`, the pure half: each changed file (app-root-relative) to the rule it falls
2
- // under, each rule to the gate steps whose inputs it can move. Fail-open by construction: a path
3
- // no rule speaks for — a root config, an unknown directory, a deleted module, a file outside the
4
- // app — selects the whole step list, so a narrowing can only ever skip a step it can prove idle.
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;
@@ -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 { guardFindings } from './guards';
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';
@@ -128,13 +128,21 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
128
128
  // ONE read of the app's surface files for the whole step: the import rules, the transport
129
129
  // rule and every guard are handed the same text. The guards used to walk and read the tree a
130
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.
131
133
  async run(ctx) {
132
134
  const sources = await readAppSources(ctx.root);
133
- return fromFindings([
134
- ...(await appBoundaryFindings(ctx.root, sources)),
135
- ...(await guardFindings(ctx.root, sources)),
136
- ...(await hostFindings(ctx, 'boundaries')),
137
- ]);
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
+ };
138
146
  },
139
147
  },
140
148
  {
@@ -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 {
@@ -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** — `{"step":"lint","ok":true,"ms":21987}` —
674
- as each finishes, and every minute a step is still running a `still running: unit (12m 3s)` line;
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 — 19 tools, one catalog, the same on both transports. Every
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's `guards/` does not hold, and the ones it holds that differ from the current template — a copy from an older release, or the app's own edit. `As of 2026-10-07` (owner decision 8: shipped guards stay copies the app owns).
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 | `x g guard <name>` | `data.guards.missing[]`: `{ name, add }` |
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
@@ -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
- 19 tools, one catalog, the same on `stdio` and `http` — 14 framework tools (`routes.list`, `schema.describe`, `policies.list`, `actions.describe`, `jobs.inspect`, `queue.depth`, `manifest.read`, `errors.explain`, `db.query`, `db.migrate`, `tests.run`, `verify.run`, `logs.tail`, `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.
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
@@ -283,6 +283,12 @@ A setter still on a package's `.` barrel is `X_ADAPTER_PORT_INCOMPLETE` on the `
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
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 |
286
292
 
287
293
  ## 29.x → 30.0.0, entry by entry
288
294