@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.
Files changed (169) hide show
  1. package/CLAUDE.md +1 -1
  2. package/README.md +9 -9
  3. package/package.json +29 -29
  4. package/src/app-kit-disk.ts +39 -0
  5. package/src/app-kit-forms.ts +27 -0
  6. package/src/app-kit.ts +146 -0
  7. package/src/budgets.ts +3 -1
  8. package/src/catalog-layout.ts +194 -0
  9. package/src/cdp-shot-driver-screen.ts +72 -0
  10. package/src/cdp-shot-driver.ts +17 -1
  11. package/src/cmd-design-capture.ts +210 -0
  12. package/src/cmd-design-errors.ts +50 -0
  13. package/src/cmd-design-paths.ts +47 -0
  14. package/src/cmd-design-publish.ts +64 -0
  15. package/src/cmd-design-run.ts +229 -0
  16. package/src/cmd-design-spec.ts +47 -0
  17. package/src/cmd-design-theme.ts +107 -0
  18. package/src/cmd-design-url.ts +201 -0
  19. package/src/cmd-design.ts +188 -0
  20. package/src/cmd-doctor.ts +3 -0
  21. package/src/cmd-generate-spec.ts +5 -0
  22. package/src/cmd-generate.ts +3 -1
  23. package/src/cmd-i18n-spec.ts +4 -4
  24. package/src/cmd-i18n-split.ts +133 -0
  25. package/src/cmd-i18n.ts +46 -66
  26. package/src/cmd-kit-spec.ts +13 -0
  27. package/src/cmd-kit.ts +133 -0
  28. package/src/cmd-shot-against.ts +275 -0
  29. package/src/cmd-shot-spec.ts +9 -1
  30. package/src/cmd-shot.ts +19 -0
  31. package/src/cmd-upgrade.ts +11 -0
  32. package/src/codemods/agent-kit.ts +130 -0
  33. package/src/codemods/agents-md-budget.ts +47 -0
  34. package/src/codemods/docs-visual-quality.ts +198 -0
  35. package/src/codemods/index.ts +8 -0
  36. package/src/codemods/settings-kit-allow.ts +49 -0
  37. package/src/config-redact.ts +20 -4
  38. package/src/db-rollback-pass.ts +4 -1
  39. package/src/design-extract-script.ts +187 -0
  40. package/src/design-extract.ts +311 -0
  41. package/src/design-map-colors.ts +180 -0
  42. package/src/design-map.ts +288 -0
  43. package/src/dev-child-watch.ts +16 -0
  44. package/src/dev-db-migrate.ts +27 -46
  45. package/src/dev-db-migrator-hold.ts +131 -0
  46. package/src/dev-db-rollback.ts +11 -2
  47. package/src/dev-rebuild-schema.ts +7 -24
  48. package/src/doctor-kit.ts +25 -0
  49. package/src/error-catalog.ts +4 -2
  50. package/src/error-codes-kit.ts +24 -0
  51. package/src/error-codes.ts +12 -10
  52. package/src/generate-catalog-locales.ts +25 -2
  53. package/src/generate-files.ts +31 -1
  54. package/src/generate-follow-ups.ts +8 -3
  55. package/src/guards-shipped-names.ts +5 -0
  56. package/src/i18n-audit.ts +17 -33
  57. package/src/i18n-index.ts +108 -31
  58. package/src/i18n-locale-parity.ts +14 -6
  59. package/src/i18n-new-locale.ts +75 -0
  60. package/src/i18n-registration.ts +52 -27
  61. package/src/island-capture.ts +36 -7
  62. package/src/kit/agent-audit.ts +49 -0
  63. package/src/kit/agent-data.ts +32 -0
  64. package/src/kit/agent-server.ts +34 -0
  65. package/src/kit/agent-shape.ts +61 -0
  66. package/src/kit/agent-web.ts +49 -0
  67. package/src/kit/design-map.ts +106 -0
  68. package/src/kit/managed.ts +12 -0
  69. package/src/kit/registry.ts +89 -0
  70. package/src/kit/skill-design-research.ts +119 -0
  71. package/src/kit/skill-feature.ts +159 -0
  72. package/src/kit/skill-planx.ts +139 -0
  73. package/src/kit/skill-upgrade.ts +94 -0
  74. package/src/kit/skill-verify.ts +80 -0
  75. package/src/mcp-errors.ts +5 -0
  76. package/src/mcp-ui-diff.ts +13 -38
  77. package/src/mcp-ui.ts +30 -1
  78. package/src/merge-state.ts +3 -2
  79. package/src/messages-design.ts +104 -0
  80. package/src/messages-floor.ts +2 -0
  81. package/src/messages-upgrade.ts +9 -0
  82. package/src/messages.ts +4 -0
  83. package/src/registry.ts +4 -0
  84. package/src/serve-boot-telemetry.ts +106 -0
  85. package/src/serve-boot.ts +23 -4
  86. package/src/shot-blank.ts +70 -0
  87. package/src/shot-diff.ts +96 -0
  88. package/src/shot-gpu.ts +17 -5
  89. package/src/templates/catalog-barrel.ts +84 -0
  90. package/src/templates/guard-animated-layout-script.ts +173 -0
  91. package/src/templates/guard-effect-without-fallback.ts +117 -0
  92. package/src/templates/guard-motion-adapter.ts +161 -0
  93. package/src/templates/guard-raw-frame-loop.ts +134 -0
  94. package/src/templates/guard-raw-motion-script.ts +132 -0
  95. package/src/templates/guard-raw-motion-ts-scan.ts +95 -0
  96. package/src/templates/guard-released-forms.ts +12 -1
  97. package/src/templates/guard-untranslated-string.ts +27 -6
  98. package/src/templates/index.ts +1 -2
  99. package/src/templates/island.ts +55 -8
  100. package/src/templates/kit-released-forms.ts +63 -0
  101. package/src/templates/locales.ts +6 -0
  102. package/src/templates/motion-scale.ts +115 -0
  103. package/src/templates/scaffold-claude.ts +39 -26
  104. package/src/templates/scaffold-design.ts +41 -0
  105. package/src/templates/scaffold-docs.ts +31 -7
  106. package/src/templates/scaffold-gitattributes.ts +9 -2
  107. package/src/templates/scaffold-guards.ts +31 -2
  108. package/src/templates/scaffold-i18n.ts +10 -6
  109. package/src/templates/scaffold-verify-floor.ts +3 -0
  110. package/src/templates/shapes/blog-site.ts +15 -0
  111. package/src/templates/shapes/blog.ts +2 -0
  112. package/src/templates/shapes/content-site.ts +13 -0
  113. package/src/templates/shapes/content.ts +2 -0
  114. package/src/templates/shapes/dashboard-detail.ts +2 -0
  115. package/src/templates/shapes/dashboard-motion.ts +284 -0
  116. package/src/templates/shapes/dashboard.ts +19 -1
  117. package/src/templates/shapes/landing-motion.ts +67 -0
  118. package/src/templates/shapes/offline.ts +5 -2
  119. package/src/templates/shapes/saas.ts +4 -0
  120. package/src/test-ignores.ts +3 -2
  121. package/src/upgrade-gate.ts +14 -2
  122. package/src/upgrade-kit.ts +65 -0
  123. package/src/upgrade-report-kit.ts +28 -0
  124. package/src/upgrade-report.ts +3 -0
  125. package/src/verify-checks.ts +9 -1
  126. package/src/verify-floor.ts +9 -1
  127. package/src/verify-local-only.ts +66 -0
  128. package/src/verify-run.ts +17 -2
  129. package/src/workspace-checks.ts +3 -3
  130. package/wiki/Actions.md +1 -1
  131. package/wiki/Agents.md +33 -1
  132. package/wiki/Auth.md +3 -3
  133. package/wiki/Batching-And-Preloading.md +1 -0
  134. package/wiki/CLI-Reference-Data.md +241 -0
  135. package/wiki/CLI-Reference-Gate.md +572 -0
  136. package/wiki/CLI-Reference-Project.md +414 -0
  137. package/wiki/CLI-Reference-Ship.md +348 -0
  138. package/wiki/CLI-Reference-Tools.md +687 -0
  139. package/wiki/CLI-Reference.md +18 -2227
  140. package/wiki/Compared.md +8 -8
  141. package/wiki/Configuration.md +26 -2
  142. package/wiki/Deployment.md +1 -1
  143. package/wiki/Design-Research.md +96 -0
  144. package/wiki/Effects.md +83 -0
  145. package/wiki/Entities-And-Migrations.md +3 -2
  146. package/wiki/FAQ.md +1 -1
  147. package/wiki/Getting-Started.md +1 -1
  148. package/wiki/Home.md +2 -2
  149. package/wiki/I18n.md +39 -5
  150. package/wiki/Installation.md +1 -1
  151. package/wiki/Jobs-And-Workflows.md +29 -1
  152. package/wiki/Known-Gaps.md +6 -2
  153. package/wiki/MCP-And-AI.md +4 -0
  154. package/wiki/Motion.md +85 -0
  155. package/wiki/Observability.md +15 -1
  156. package/wiki/Outbound-HTTP.md +62 -2
  157. package/wiki/PWA-And-Offline.md +1 -1
  158. package/wiki/Policies-And-Authz.md +10 -0
  159. package/wiki/Project-Layout.md +1 -1
  160. package/wiki/Realtime.md +29 -2
  161. package/wiki/Static-Assets.md +1 -1
  162. package/wiki/Testing.md +33 -0
  163. package/wiki/Theming.md +31 -8
  164. package/wiki/Troubleshooting.md +1 -1
  165. package/wiki/Tutorial-02-First-Feature.md +1 -1
  166. package/wiki/UI-Components.md +2 -0
  167. package/wiki/Upgrading.md +9 -3
  168. package/src/templates/scaffold-claude-agents.ts +0 -161
  169. package/src/templates/scaffold-claude-commands.ts +0 -239
@@ -0,0 +1,687 @@
1
+ # CLI reference: inspect, diagnose and upgrade
2
+
3
+ Part of the [CLI reference](CLI-Reference): every other command. Conventions, global flags and the command index are on the index page.
4
+
5
+ ## x manifest
6
+
7
+ ```bash
8
+ x manifest [--check] [--no-openapi] [--json]
9
+ ```
10
+
11
+ | Flag | Type | Default | Meaning |
12
+ |---|---|---|---|
13
+ | `--check` | boolean | `false` | fail if the committed files are stale instead of rewriting them |
14
+ | `--openapi` / `--no-openapi` | boolean | `true` | also write `openapi.json` |
15
+
16
+ Regenerates the generated facts: routes, entities, actions, mutators, queries, jobs, tasks, policies, cache tags, MCP tools, budgets, build ID. Never hand-edit the output. Errors: `X_MANIFEST_STALE`, `X_MANIFEST_DRIFT`, `X_MANIFEST_BREAKING`.
17
+
18
+ ## x routes
19
+
20
+ ```bash
21
+ x routes [--surface site|app|api|shared] [--json]
22
+ ```
23
+
24
+ No positional: `x routes list` (the retired spelling) or `x routes app` is `X_CLI_UNKNOWN_COMMAND`
25
+ with fix `x routes --json` — the filter is `--surface`.
26
+
27
+ **Every URL the app serves through a primitive, in one table** (`As of 2026-10-07`, owner decision 2):
28
+ the pages from `describePages()`, then — sorted by path — the action and query routes from
29
+ `apiRoutes()` (the builder `x dev` and the container mount) and the plain `routes` of
30
+ `apps/<app>/runtime.ts`. The MCP dev tool `routes.list` answers the same rows.
31
+
32
+ | Row | Surface | Last column (`declared by`) | `--json` keys |
33
+ |---|---|---|---|
34
+ | a page | `site` / `app` | its file | `method` (`GET`), `path`, `surface`, `file`, `render`, `hydrate`, `offline`, `budget` |
35
+ | a mounted page — every screen `defineAdmin()` serves | `site` / `app` | the call and the permissions that gate it: `defineAdmin() · admin:read + widgets:read` | the page keys plus `mount: { by, permissions }`; a file route has no `mount` key |
36
+ | an action or query projection | `api` | the primitive, its name and its policy: `action publishPost · posts:publish` | `method`, `path`, `surface`, `primitive`, `name`, `auth`, `policy` |
37
+ | a plain route — a `runtime.ts` one (an OAuth endpoint) or a declared `webhookReceiver()`'s (`webhook.<name>`, public) | `api` | `runtime.ts routes <name>`, then its policy | the same keys, `primitive: null` |
38
+
39
+ ```bash
40
+ $ x routes --surface api --json
41
+ {"ok":true,"command":"routes","summary":"2 routes","findings":[],"data":{"routes":[
42
+ {"method":"GET","path":"/_x/query/org-feed","surface":"api","primitive":"query","name":"orgFeed","auth":"public","policy":"allow"},
43
+ {"method":"POST","path":"/api/posts/publish","surface":"api","primitive":"action","name":"publishPost","auth":"required","policy":"posts:publish"}]}}
44
+ ```
45
+
46
+ Not listed: a bearer mount's copies of the API (`defineApi({ http: { mounts } })`), a page's
47
+ `post:` binding, and the framework's own asset, island and `/_x` routes.
48
+
49
+ Errors: `X_ROUTE_CONFLICT`, `X_ROUTE_META_MISSING`.
50
+
51
+ ## x mcp
52
+
53
+ ```bash
54
+ x mcp tools [--json]
55
+ x mcp serve [--transport stdio|http] [--port 9229] [--json]
56
+ ```
57
+
58
+ | Flag | Type | Default | Meaning |
59
+ |---|---|---|---|
60
+ | `--transport` | string | `stdio` | `stdio` for an editor client, `http` for a socket |
61
+ | `--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 |
62
+
63
+ Serves `@ultimat3/mcp`'s dev server — 24 tools (`As of 31.53`), one catalog, the same on both transports. Every
64
+ tool declares a scope; the local developer's caller carries all five, and an HTTP caller carries
65
+ whatever its bearer token was issued.
66
+
67
+ | Tool | Does | Scope |
68
+ |---|---|---|
69
+ | `routes.list` | the `x routes --json` table: pages (render mode, hydrate, offline, budget), then every action, query and `runtime.ts` route | `dev:read` |
70
+ | `schema.describe` | entities with columns, types and invariants; `{ entity }` narrows to one, by name or table (`As of 31.22`) | `dev:read` |
71
+ | `policies.list` | every policy: permission, subject, where it is enforced | `dev:read` |
72
+ | `actions.describe` | actions and queries: schemas, policy, cache tags, MCP exposure | `dev:read` |
73
+ | `jobs.inspect` | job definitions, retry policy and steps | `dev:read` |
74
+ | `queue.depth` | pending, running and failed counts per queue | `dev:read` |
75
+ | `manifest.read` | the generated `x.manifest.json` as text | `dev:read` |
76
+ | `errors.explain` | `X_*` → cause, fix, docs | `dev:read` |
77
+ | `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` |
78
+ | `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` |
79
+ | `db.query` | ONE read-only SQL statement; `limit` defaults to 100 rows, maximum 1000 | `db:read` |
80
+ | `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` |
81
+ | `db.migrate` | apply pending migrations to a **branch** database | `db:migrate` |
82
+ | `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` |
83
+ | `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` |
84
+ | `logs.tail` | last N log lines, optionally for one role: its `.x/logs/<role>.log` when one was written, else the `.x/dev.log` lines whose `role` field names it (`As of 2026-11-15`; a line written outside any request or job names none) | `dev:logs` |
85
+ | `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` |
86
+ | `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` |
87
+ | `ui.shot` | photograph one route at a named viewport, light or dark; PNG path plus verdict. Launches a browser | `dev:test` |
88
+ | `ui.island` | photograph an island in every state its `*.island.states.ts` declares, as `x shot --island` does | `dev:test` |
89
+ | `ui.inspect` | DOM, computed-style and accessibility facts for a bounded set of selectors, in one navigation | `dev:test` |
90
+ | `ui.interact` | drive one route through a bounded step list, then photograph it; refuses a password field and any step that leaves the origin | `dev:test` |
91
+ | `ui.diff` | pixel-compare two PNGs the other `ui.*` tools wrote under `.x/shot/`; launches no browser | `dev:read` |
92
+ | `ui.research` | `x design research` as a tool: `{ urls: 1..5, follow?: 0..20 }` → `reference.json`, `tokens.proposal.json`, `motion-map.json`, `sources.json` under `.x/design/<slug>/`; every request to a private, loopback or link-local address refused | `dev:test` |
93
+
94
+ `db.query` and `db.migrate` refuse structurally — multiple statements, a mutating keyword
95
+ (a data-modifying CTE included), a locking clause, `EXPLAIN ANALYZE` (or `ANALYSE`), a banned
96
+ function family (`pg_read_*`, `pg_copy_*`, `pg_backup_*`, `pg_restore_*`, … — [MCP and AI](MCP-And-AI)),
97
+ a non-branch target —
98
+ before the host runs anything. `db.explain` is where `ANALYZE` is allowed: it writes the `EXPLAIN`
99
+ itself around a statement the same scan passed.
100
+
101
+ Never exposed in `ROLE=web`. Errors split by when they fire:
102
+
103
+ | When | Codes | Effect |
104
+ |---|---|---|
105
+ | boot — configuring an MCP surface with `defineAppMcp` | `X_MCP_TOOL_UNDECLARED`, `X_MCP_TOOL_UNSAFE`, `X_MCP_TOOL_DUPLICATE` | the call throws; no server starts |
106
+ | runtime — one request | `X_MCP_TOOL_UNKNOWN`, `X_INPUT_INVALID` (an `isError` result), `X_MCP_SCOPE_DENIED`, `X_MCP_QUERY_REJECTED`, `X_MCP_NOT_BRANCH_DB`, `X_MCP_PROTOCOL` | that call is refused; the server keeps serving |
107
+
108
+ A tool this caller may not see is absent from `tools/list` and answers ToolNotFound, never Forbidden. A wider token — `x token create --scopes <a>,<b> --json`, then `x token revoke <old-id>` — takes effect on the next connection: scopes are fixed for the life of one. Full model: [MCP and AI](MCP-And-AI).
109
+
110
+ ## x doctor
111
+
112
+ ```bash
113
+ x doctor [--port 3000] [--json]
114
+ ```
115
+
116
+ A taken port is judged by who holds it (`As of 2026-11-18`): from this checkout, or by a process the OS will not name, it is an `X_PORT_IN_USE` finding; from another checkout it is the same code as a warning in `data.warnings[]`, naming that directory, and the exit stays 0. Either way the fix names a port pair that is free when asked.
117
+
118
+ 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.
119
+
120
+ It also lists the copies of shipped guards the app's `guards/` still holds, each with `X_GUARD_VENDORED` beside the verdict in `data.warnings[]`: shipped guards run from the installed framework, so a copy runs in place of the shipped one and never receives a fix. `As of 31.28`. No shipped guard is ever missing, so `data.guards.missing` is always `[]`.
121
+
122
+ | Listing | One line each | `--json` |
123
+ |---|---|---|
124
+ | a copy, identical or edited | the edit that resolves it: `rm -f` for an identical copy; for an edited one, `mv` to `guards/app-<name>.ts` and `"<name>": "off"` in `guards/shipped.json` | `data.guards.vendored[]`: every copy's name |
125
+ | an edited copy | the same line | `data.guards.differs[]`: `{ name, refresh, diff }` — `refresh` is that edit |
126
+
127
+ A listing, never a finding: the verdict does not move. `x upgrade` applies the same migration (`vendored-guards` codemod); how a shipped guard reports is a row in `guards/shipped.json`.
128
+
129
+ Warnings about how the app is held — 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:
130
+
131
+ | Code | Asked | Fix |
132
+ |---|---|---|
133
+ | `X_DB_ROW_SECURITY_OFF` | `database.rowSecurity` is off and a raw `` sql`…` `` (or `` Bun.sql`…` ``, `` tx.sql`…` ``, `raw('…')`, `identifier('…')`) outside migrations, seeds and tests names a tenant table — up to five sites listed. Off with no raw tenant SQL is not reported | `database: { rowSecurity: true }` in `app.config.ts`, then `x db gen "row security" && x db migrate` |
134
+ | `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"` |
135
+ | `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` |
136
+ | `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` |
137
+ | `X_GUARD_VENDORED` (`As of 31.28`) | the app's `guards/` holds a copy of a shipped guard, which runs in place of the built-in one and never receives a fix — one per copy. `boundaries` lists it too | the resolving edit above |
138
+ | `X_ACTION_UNREGISTERED` · `X_QUERY_UNREGISTERED` (`As of 2026-11-19`) | the app's API index lists actions or queries in `defineApi()`, and a loaded module exports one whose name no list carries — served by the module scan, missing from the typed `Api`. An app that lists none (scan only) is told nothing; a failed load is silent | the import line, as `X_JOB_UNREGISTERED` prints it: `import * as refundTicket from '../app/ticket/actions/refund-ticket';` in `apps/web/api/index.ts`, `refundTicket` added to `actions: [...]` there — then `x manifest` |
139
+
140
+ **Processes per container**, the same way (`As of 2026-11-19`): one line per role — the count a production container of it runs on this host under `ULTIMATE_PROCESSES` and the clamp that bound it, its pool plus LISTEN sessions as connections per container — then, when an external database answered, one container of each role against `max_connections`. `--json`: `data.processes` = `{ environment, cores, cpuBudget, migrateReq, roles: [{ role, count, binding, pool, listen, connections } | { role, refused }], connectionsOneOfEach, maxConnections }` (`cpuBudget`, `migrateReq`, `maxConnections` are `null` when unknown; `binding` is one of `environment`, `platform`, `role`, `cpu`, `memory`, `pool`, `shared-state`, `image`, `requested`; `refused` is the code an explicit count met). On a production or staging host only, two warnings join `data.warnings[]`: `X_PROCESSES_CPU_UNDECLARED` (no CPU quota on a multi-core host, so `auto` runs one process; fix `cpus:` on the service) and `X_PROCESSES_MIGRATE_REQ_OFF` (N > 1 with `net.ipv4.tcp_migrate_req` at 0, only where the knob exists — Linux ≥ 5.14; a kernel without it is told nothing; fix: uncomment the `sysctls:` line). A listing, never a finding ([Deployment](Deployment#processes-per-container)).
141
+
142
+ **Redundant indexes**, the same way (`As of 2026-11-14`): each implicit index the entities describe that another index, the primary key or a unique invariant already leads with, still in the newest migration's snapshot, is one line — `<table>.<index> (<columns>) — <covering index>` — under a header naming `x db gen "drop redundant indexes" --drop-redundant`; `--json`: `data.redundantIndexes[]` = `{ table, name, columns, coveredBy }`, `[]` when none, absent when the app would not load or has no snapshot. A listing, never a finding: every write pays for each twice, and dropping it is a migration the app opts into.
143
+
144
+ **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.
145
+
146
+ The embedded half is the bare-VM case: the external-database probe answers nothing the moment `DATABASE_URL` is unset, and that silence *is* the configuration a fresh box has. So `x doctor` also asks whether `@electric-sql/pglite` resolves from the app root — a resolve, never an import, because loading it boots the WASM build and takes the single-writer lock the next command needs. Red only where both hold: `DATABASE_URL` unset **and** the peer unresolvable, reported as `X_DB_UNAVAILABLE` with `@ultimat3/db`'s own sentence and its own runnable fix ([Bare VM](Bare-VM)). The snapshot half is `As of 2026-08` and separate from drift on purpose: they are two questions with two remedies, and `x db gen`'s own `X_MIGRATION_SNAPSHOT_MISSING` was a condition this diagnostic could not see at all, so `x doctor --json` — the `fix:` of the `X_CLI_UNEXPECTED` an author reaches it through — ran clean over a broken app.
147
+
148
+ **It probes BOTH ports `x dev` binds** — `PORT` for the web role and `PORT + 1` for the sync node —
149
+ and the suggestion moves both: `x doctor --port 3000` with 3001 taken answers `x dev --port 3002`,
150
+ never `3001`, which is the port it has just reported as taken (`As of 2026-09`; the same repair
151
+ `X_PORT_IN_USE`'s own `fix:` took in `x dev`). A `--port` at the top of the range has no room for
152
+ the sync node at all, so it reports the boot's own `X_PORT_INVALID` rather than probing a port
153
+ below it that `x dev` would never bind. The port is `x dev`'s own: `--port`, then `PORT`, then
154
+ 3000 — under `PORT=4000` it probes 4000 and 4001, never 3000.
155
+
156
+ **`APP_URL`, when set**, must be an `http://` or `https://` origin (`X_CONFIG_INVALID`, the sync
157
+ boot's own refusal), and a loopback one must name that same port — `APP_URL=http://localhost:3000`
158
+ beside `PORT=4000` is `X_APP_URL_PORT_MISMATCH`, whose fix is the `export` line with the port `x dev`
159
+ serves on. Unset is no finding; a public origin is the deploy's and is not judged here.
160
+
161
+ **Sealed columns against the key ring.** An app that declares `.sealed()` columns is checked for
162
+ two conditions; an app with none is never judged.
163
+
164
+ | Finding | Condition | Fix |
165
+ |---|---|---|
166
+ | `X_SEAL_KEY_MISSING` | sealed columns, and no usable master key in this environment | `x secrets init`, or export `ULTIMATE_SECRETS_KEY` |
167
+ | `X_SEAL_RESEAL_PENDING` | sealed columns, and a retired key still in `ULTIMATE_SECRETS_RETIRED_KEYS` — a rotation whose re-seal is not finished | a `backfill()` rewriting each row, then `x secrets rotate --drop <keyId>` |
168
+
169
+ The ring is read as a booted process would see it — the real environment first, then the
170
+ committed `secrets.enc.json`.
171
+
172
+ **What an upgrade left in the auth tables** (`As of 2026-10`). Asked of an external
173
+ `DATABASE_URL` only — the embedded database is never opened by a diagnostic.
174
+
175
+ | Finding | Condition | Fix |
176
+ |---|---|---|
177
+ | `X_MFA_SECRET_UNSEALED` | `x_users` rows hold a second-factor secret that is not sealed; each is refused at the second factor until it is | `x auth seal-mfa --json` |
178
+ | `X_FRAMEWORK_TABLE_ORPHANED` | `x_auth_failures` is still present: no release reads it, and the boot does not drop a table a replica on the previous release may still be using | `psql "$DATABASE_URL" -c 'drop table if exists x_auth_failures'`, once every replica runs this release |
179
+
180
+ The output is a `CommandResult` like every other command's: `findings`, not a `checks` array.
181
+
182
+ ```bash
183
+ $ x doctor --json
184
+ {"ok":false,"command":"doctor","summary":"1 finding(s)","findings":[{"code":"X_DB_DRIFT",
185
+ "cause":"packages/db has a schema but no migration recorded it",
186
+ "fix":"x db gen \"initial\"","docs":"https://github.com/developerz-ai/ultimate/wiki/Error-Codes",
187
+ "at":"packages/db/migrations"}],"data":{"count":1,"codes":["X_DB_DRIFT"]}}
188
+ ```
189
+
190
+ ## x actions · x queries · x entities
191
+
192
+ ```bash
193
+ x actions [list|show <name>] [--json]
194
+ x queries [list|show <name>] [--json]
195
+ x entities [list|show <name>] [--json]
196
+ ```
197
+
198
+ The declaration registries, projected. `list` is the default subcommand; `show <name>` is one declaration (it was `describe` until 26.0.0). Same rows the manifest and the MCP `actions.describe` tool are built from — the CLI keeps no second table.
199
+
200
+ ```bash
201
+ $ x actions list
202
+ name verb resource path capability mcp
203
+ createPost create posts /api/posts/create post:create yes
204
+ publishPost publish posts /api/posts/publish post:publish yes
205
+
206
+ $ x entities show posts --json
207
+ {"ok":true,"command":"entities","summary":"entity posts","data":{"name":"posts","table":"posts",
208
+ "primaryKey":["id"],"columns":[…],"invariants":[…],"softDelete":true,"orgScoped":true}}
209
+ ```
210
+
211
+ A name nothing registered is `X_DECLARATION_UNKNOWN`, whose `fix` names the nearest real one. A module that would not import is reported as a finding — the listing describes what loaded, and never pretends the rest is absent.
212
+
213
+ ## x mail
214
+
215
+ ```bash
216
+ x mail preview <id> [--locale <tag>] [--tz <zone>] [--out <dir>] [--json]
217
+ ```
218
+
219
+ `As of 2026-11-06`. Renders the mail's `defineMail({ preview })` data through `renderMessage`'s own
220
+ path, with nothing sent. No `--locale`: every locale the app routes.
221
+
222
+ | Flag | Type | Default | Meaning |
223
+ |---|---|---|---|
224
+ | *(positional)* | mail id | — | the `defineMail({ id })` to render |
225
+ | `--locale` | string | every routed locale | one locale |
226
+ | `--tz` | IANA zone | `UTC` | every date in the body; never the machine's zone (`X_TIMEZONE_INVALID`) |
227
+ | `--out` | string | — | write `<id>.<locale>.html` and `<id>.<locale>.txt` there |
228
+
229
+ `--json`: `data.tz` is the zone rendered in; `data.previews[]` is `{ locale, subject, missing, files }`; `missing` names every catalog
230
+ key the locale cannot resolve, and any is a non-zero exit. `x verify`'s `i18n` step renders every
231
+ declared preview in every locale the same way, so a preview is a test too.
232
+
233
+ Errors: `X_MAIL_PREVIEW_MISSING`, `X_MAIL_PREVIEW_INVALID`, `X_MAIL_TEMPLATE_UNKNOWN`, `X_CLI_BAD_FLAG`.
234
+
235
+ ## x upgrade
236
+
237
+ ```bash
238
+ x upgrade [--to <version>] [--only <step>[,<step>…]] [--dry-run] [--json]
239
+ x upgrade codemods --from <version> [--to <version>] [--dry-run] [--json]
240
+ ```
241
+
242
+ One major per run, so each hop's gate attributes its red to that hop. `As of 30.0.0`.
243
+
244
+ **An app with no `x upgrade` yet** (below 30.0.0) runs the newest CLI: `bunx @ultimat3/cli@latest upgrade --json`. The only command that does not hand over to an older app CLI ([why](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/README.md#which-x-runs)); the gate still runs from the CLI the hop installs. Needs Bun at the newest release's floor: below it, `X_BUN_VERSION`, `fix: bun upgrade`.
245
+
246
+ | Step | What | Refused with |
247
+ |---|---|---|
248
+ | 1 | clean tree, git is the only state between runs | `X_UPGRADE_DIRTY_TREE` |
249
+ | 2 | read every workspace's `@ultimat3/*` pins, `overrides` and `resolutions` included | `X_UPGRADE_PIN_UNREADABLE`, `X_UPGRADE_MIXED_PINS` |
250
+ | 3 | `bun pm view @ultimat3/cli versions`: the next major's newest; the last major's newest when no later major exists | `X_UPGRADE_REGISTRY_UNREACHABLE`, `X_UPGRADE_HOP_TOO_WIDE`, `X_UPGRADE_VERSION_UNPUBLISHED`, `X_BUN_VERSION` |
251
+ | 4 | write exact pins, raise the Bun floor | — |
252
+ | 5 | `bun install`, then `bun update <names>` for each transitive package `bun.lock` holds under an advisory floor (`X_ADVISORY_FLOOR_UNMET`) | `X_UPGRADE_INSTALL_FAILED`, `fix:` carries the undo |
253
+ | 6 | the installed CLI: `x upgrade codemods --from <from> --to <to>` (below), then `x manifest`, `x doctor --json`, each guard that doctor reports missing (only a hop landing before 31.28: `x g guard <name>`, kept when `x verify --only boundaries` finds nothing more), a Bun-floor hop's `x verify --only unit` coverage rebaseline, `x kit --json` (the managed agent kit refreshed, `As of 31.53`), `x exercise --json` and its `exercise` floor figures, `x verify --json` | `X_UPGRADE_GATE_UNREADABLE`, as a finding on a red hop |
254
+
255
+ A dry run refuses exactly what the real run would, then stops before step 4 — after previewing this CLI's codemods for the span, written nowhere. It never commits; `git diff` is the hop. Under `--json` fd 1 is one document, fd 2 a `{"upgrade":"<stage>"}` line per stage and a heartbeat a minute.
256
+
257
+ `--only <step>[,<step>…]` (`As of 2026-11-19`): the last stage runs `x verify --only <steps> --json` in place of `x verify --json` — the list `x verify --only` takes, in the gate's order, refused the same way (`X_CLI_BAD_FLAG`, `fix:` the corrected `x upgrade --only …`), and refused with no `app.config.ts`, where no `x verify` runs. **Not the full gate**: `proof` is `verify-only`, `verify.notRun[]` names every step left out — of the installed CLI's gate, read off its `x verify plan --parts 1 --json` (this CLI's list when it has no plan), the summary says `NOT THE FULL GATE` and `then` names `x verify --only <notRun> --json` for CI. Every step named — of this CLI's gate, or of the installed one's — is the full gate, run and reported as one. Default: the full gate. The stages before it (codemods, manifest, doctor, guards, a Bun-floor hop's coverage rebaseline, exercise) run either way: each writes what the hop leaves.
258
+
259
+ `--to`: an exact release in the next major. Over a mixed set a run moves the LOWEST pins one major: `^19` beside `^29` is told `--to 20.x.y`, that hop rewrites only the pins at or below it (a pin above is never moved backwards) and names its walkthrough, `next` names the following hop, and the last one levels the set. A straggler jump straight to the highest major is `X_UPGRADE_HOP_TOO_WIDE`: it skipped every walkthrough between.
260
+
261
+ | `data` field | Meaning |
262
+ |---|---|
263
+ | `from`, `to` | the lowest version pinned; this hop's target |
264
+ | `next` | what a bare `x upgrade` takes after this hop; `null` when the walk is over |
265
+ | `done` | verify's verdict, and the exit code follows it. `true` when already there, `false` on a dry run |
266
+ | `dryRun` | nothing written, no gate run |
267
+ | `app` | whether the root holds `app.config.ts` |
268
+ | `proof` | what `done` rests on: `verify` (the full gate), `verify-only` (`--only`: some steps, the rest in `verify.notRun`), `scripts` or `none` |
269
+ | `section` | `{ title, url, local }` in [Upgrading](Upgrading); `local` is the same section as an `x docs` topic, printed whole offline; `null` when no major is crossed |
270
+ | `pins[]` | `{ file, name, from, to }` |
271
+ | `bun` | `{ from, to, edited[], manual[] }`. `manual[]`: `{ path, line, text, why }`, a site only you can move, listed on every run |
272
+ | `agentsMd` | `link`: `AGENTS.md` was byte-identical to `CLAUDE.md` and the hop makes it a relative symlink to it · `linked`: already one · `differs`: two different files, left alone; merge what only `AGENTS.md` says into `CLAUDE.md`, then `ln -sf CLAUDE.md AGENTS.md` · `none`: one of the two is missing · `null`: no hop planned |
273
+ | `guards` | `{ reported, missing[], differs[], installed[], withheld[], baselined[]? }` from the hop's own `x doctor`. A hop landing on 31.28 or later has `missing[]`, `installed[]` and `withheld[]` empty: shipped guards run built in. Landing earlier (`As of 31.16.0`), each missing shipped guard is written from the installed release's template and kept when `boundaries` finds nothing more with it on disk: `installed[]` names it; one the tree already breaks is taken back out: `withheld[]` is `{ name, add, findings }` (`findings: null` when the count could not be measured) and `missing[]` still lists it. `differs[]` is `{ name, refresh }`: an edited copy the hop's `vendored-guards` codemod left, never overwritten, `refresh` the edit that resolves it. `reported: false` is a CLI too old to list them, which is not the same as none |
274
+ | `guards.baselined` | `[{ name, findings }]`, absent when empty, `As of 2026-11-15`: a guard the tree breaks, kept anyway — its measured count merged into `x.verify.json` as `"guardBaseline": { "<name>": n }` (beside the app's keys; a baseline the app already wrote for it, or a floor that is not a JSON object, is never touched) and kept only when the installed CLI's `boundaries` then finds no more than before. Also in `installed[]`. `findings: null` stays withheld |
275
+ | `coverage` | a hop that moved the Bun floor re-measures unit coverage (`x verify --only unit`); only when that measurement is `X_COVERAGE_BELOW_FLOOR` is the `x.verify.json` `coverage` floor moved to it, the number that fell alone, with a dated `why`: `{ file, measured, from, to, why }`. `null` when nothing moved |
276
+ | `exerciseFloor` | `{ file, written }`: the `exercise` keys (`unprovenMax`, `statementsMax` ≥ 100) the hop's own `x exercise` measured, written into an `x.verify.json` that stated none, so the hop stays green and the floor only falls. A key the app already wrote is never touched; `null` when nothing was written |
277
+ | `coverageRaised` | `As of 2026-11-20`: `{ file, measured, from, to }` when the gate's `unit` step said `X_COVERAGE_FLOOR_STALE` (the tree covers more than its floor, a codemod's new test among the causes): each `x.verify.json` `coverage` number is set to the larger of the stated floor and the whole percent that run measured, never lowered (a floor reaching 95 drops its `why`), then `x verify --only unit` re-runs and `verify` is the verdict with `unit` replaced by that run. `null` when nothing rose |
278
+ | `manifest` | `{ ok, findings[] }`. A failure does not stop the gate |
279
+ | `exercise` | `{ reported, ok, findings[] }` from the hop's own `x exercise --json`, listed (and printed) before the gate's findings; each `fix` pastes as written. `reported: false`: the hop's CLI answered no exercise document — unknown, never a finding |
280
+ | `verify` | `{ ok, summary, failed[], findings[], only?, notRun? }`, each finding `{ step?, code, cause, fix, at? }`. `only[]` and `notRun[]` only under `--only`: the steps run, and the gate's steps this hop did not run |
281
+ | `codemods` | `As of 2026-11-15`: `{ from, to, dryRun, source, applied[] }`, each `applied[]` a codemod that ran: `{ id, since, summary, changed[], skipped[] }`; a `skipped[]` entry is `{ path, reason, diff? }`, a file the codemod would not overwrite (the app edited it), with the template's change as a unified diff to make by hand. `source: installed` — the hop's own CLI applied its list; `driver` — that CLI predates codemods, so this one applied its own. `reinstalled: true` — a `package.json` differs after the codemods (read byte for byte, never off a codemod's report), so the hop ran `bun install` again before any gate stage; `x upgrade codemods` does the same by hand. `failure: { code, cause, fix }` — the installed CLI's codemods run failed for a reason other than lacking the subcommand: nothing applied, this CLI does not stand in, and the hop is not done. `null`: no app, or already at the target, where no codemod runs (`As of 2026-11-18`; `x upgrade codemods --from 0.0.0 --json` carries an app still holding an old template's copy) |
282
+ | `superseded[]` | `As of 2026-11-15`: a workaround the hop's framework made unnecessary, read after the codemods — `{ code: X_SUPERSEDED_WORKAROUND, cause, fix, at }`. A warning, never the verdict |
283
+ | `kit` | `As of 31.53`: `{ reported, written[{ path, action }], unchanged, findings[] }` from the installed CLI's `x kit --json`; `reported: false` when that CLI predates `x kit` |
284
+ | `then` | the next thing to do, in a sentence naming the commands |
285
+
286
+ **Codemods.** A file `x new` wrote is the app's; when a release changes the template, a codemod (`packages/cli/src/codemods/<id>.ts`, `since` = the release whose template change it carries) moves the app's copy. The hop runs every codemod whose `since` lies after `from` and at or before `to`, in version then id order, before any gate stage, and leaves the edits uncommitted beside the pins. Mechanical or nothing: a file the app edited is listed in `skipped[]` with its diff and never overwritten. `x upgrade codemods --from <version>` runs the same list by hand — for a hop an older CLI drove, which applied none:
287
+
288
+ | Flag | Type | Default | Meaning |
289
+ |---|---|---|---|
290
+ | `--from` | string | required | the release the app came from (its old `@ultimat3/cli` pin); `X_CLI_BAD_FLAG` when absent or not `major.minor.patch` |
291
+ | `--to` | string | this CLI's version | the last release whose codemods run |
292
+ | `--dry-run` | boolean | off | report what would change; write nothing |
293
+
294
+ `data.codemods` is the same shape as the hop's, without `source`. A second run changes nothing.
295
+
296
+ `null` for `guards`, `manifest`, `exercise` and `verify` means no gate ran: a dry run, already there, or no app.
297
+
298
+ **Pins and no `app.config.ts`.** Needs no app: the root is the app at or above the cwd, else the nearest manifest holding `@ultimat3/*` pins, or the workspace root claiming it. No such manifest is `X_UPGRADE_PIN_UNREADABLE`; an app below that root is `X_NOT_IN_APP`, with the `cd`. With no app, `x manifest`, `x doctor` and `x verify` cannot run, so the hop runs the `typecheck` and `test` scripts the root declares: `data.scripts[]` is `{ name, ok, code, output }`, `proof` is `scripts`, and the summary says no `x verify` ran. Neither script declared: `proof: none`, `done: false`, red. It checked nothing, so it never claims otherwise.
299
+
300
+ | Bun site | Edit |
301
+ |---|---|
302
+ | `engines.bun`, `packageManager`, `.bun-version` | raised to the release's `engines.bun`, never lowered. A spelling a text edit would falsify (`1.3.x`, `>=1.3.0 <1.4.0`, `bun@1.3.6+sha512…`, `v1.3.0`) is listed in `manual` |
303
+ | `bun-version:` in YAML | same, quotes kept. An expression (`${{ env.BUN_VERSION }}`) or an x-range is listed in `manual` |
304
+ | `oven/bun:` tag | keeps its suffix and precision: `1.3-alpine` → `1.4-alpine`. A `$VARIABLE` is listed in `manual`, as is a digest whose tag is below the floor or does not state the patch (`1.4-alpine@sha256:…` at a 1.4.4 floor). `1.4.4-alpine@sha256:…` is not |
305
+
306
+ A hop below 30.0.0 reports `X_BUDGET_UNMEASURED` until `x build --target static --json` has run, as that release's `x verify` does.
307
+
308
+ ## x graph · x impact
309
+
310
+ ```bash
311
+ x graph [--from <node> --to <node>] [--json]
312
+ x impact <file|primitive|entity> [--json]
313
+ ```
314
+
315
+ The app as one graph, rebuilt per call from the loaded app (`As of 2026-11`). Nodes: `route`,
316
+ `action`, `mutator`, `query`, `job`, `task`, `entity`, `permission`, `channel`, `tag`, `mcpTool`,
317
+ `operation`, `file`, `test`, each id `<kind>:<name>`. An edge is `from` depends on `to`, with its
318
+ provenance:
319
+
320
+ | Provenance | Source | Edges |
321
+ |---|---|---|
322
+ | `declared` | `x.manifest.json`'s facts, from the registries | `requires` (permission), `invalidates` / `reads-tag` / `revalidates` (cache tag), `exposes` (MCP tool), `publishes` (OpenAPI operation), `references` (entity), `enqueues` (task → job), `reads` (channel → entity) |
323
+ | `import` | the module graph: every app file's imports, type-only included; the test preload is an import of every test | `imports`, `declared-in` (primitive → its file, matched by identity against the registries) |
324
+ | `observed` | `.x/exercise.json`, when newer than `x.manifest.json` | `writes` / `reads` (entity), `enqueues` (job) |
325
+
326
+ `x impact` answers `{ routes, actions, queries, jobs, mcpTools, publishedOperations, tests, budgets,
327
+ opaque, provenance }`, each entry with the provenances of the path that reached it. A non-empty
328
+ `publishedOperations` means `contract-diff` will have an opinion. A file with a computed `import()`
329
+ is `opaque`: it and its dependents are in every answer. `x graph --from a --to b` prints the
330
+ shortest chain of edges, or none known and the provenances searched. A name, id or path that is
331
+ no node is `X_GRAPH_NODE_UNKNOWN` with the nearest three. Queries carry no MCP fact in the
332
+ manifest, so a query's `mcpTools` is reached only through an action that imports it.
333
+
334
+ **`x affected` in an app root** adds `data.tests`: the test files whose import closure meets the
335
+ diff (`all: true` with `forcing` when a changed file is read rather than imported — `app.config.ts`,
336
+ `package.json`, a catalog, anything outside the app).
337
+
338
+ ## x client
339
+
340
+ ```bash
341
+ x client vendor <name> [--from <file|url>] [--only <tag,…>] [--json]
342
+ x client customer --out <dir> [--mount <prefix>] [--only <tag,…>] [--package <name>] [--json]
343
+ ```
344
+
345
+ One compiler (`$ref`, objects, arrays, enums, `const`, `oneOf`/`anyOf`, `allOf`, nullable), two emitters. `As of 2026-11`.
346
+
347
+ | Subcommand | Reads | Writes | The client |
348
+ |---|---|---|---|
349
+ | `vendor <name>` | `--from` (a file, or an https URL read through `outbound({ dial: 'public' })`); omitted, the committed `source.json` | `apps/web/clients/<name>/{source.json,schemas.ts,client.ts}` | `create<Name>Client({ baseUrl, dial, deadlineMs, headers?, deps? })`: one `outbound()` call per operation, input parsed with `t` before a byte leaves, the answer through `answer.json(schema)` |
350
+ | `customer` | the committed `openapi.json`, or the file a bearer mount declares (`--mount /v1` needs `openapi:` on that mount) | `<dir>/{index.ts,types.ts}`, plus `package.json` with `--package` | `createClient({ baseUrl, headers?, fetch? })`: plain `fetch`, no import beyond `./types`; a non-2xx is `ProblemError`, `refusalOf(error, 'op')` narrows it to the codes the operation declares; a `Retry-After` on 429/503 is waited out once (at most 60 s) |
351
+
352
+ | Flag | Meaning |
353
+ |---|---|
354
+ | `--from` | `vendor` only. A path from the current directory or an https URL. Written to `source.json` as two-space JSON, so the next regeneration is offline |
355
+ | `--only` | keep operations carrying one of these tags; a construct the compiler refuses outside them is never read. A regeneration with no `--only` keeps the tags the stamp records. Matching nothing is `X_CLI_BAD_FLAG` |
356
+ | `--out` | `customer` only, required |
357
+ | `--mount` | `customer` only: a declared bearer mount's prefix |
358
+ | `--package` | `customer` only: a `package.json` named so; publishing is yours |
359
+
360
+ | Failure | Code |
361
+ |---|---|
362
+ | a construct it does not read (`not`, `if`/`then`/`else`, `patternProperties`, a non-JSON body, a cookie parameter, a typed `additionalProperties` beside `properties`) | `X_CLIENT_SPEC_UNSUPPORTED`, the JSON pointer in the cause |
363
+ | not OpenAPI 3.0 or 3.1 | `X_CLIENT_SPEC_INVALID` |
364
+ | a vendor answer that fails its declared shape | `X_OUTBOUND_BODY_INVALID` (core's), the field in `meta.issues` |
365
+ | a documented vendor non-2xx | `X_OUTBOUND_REFUSED`, `meta.status` |
366
+
367
+ **The stamp is the build error.** Every generated `.ts` opens with `// @x-client {command, source, sourceHash, bodyHash}`. The gate's `drift` step reads it back under `apps/*/clients/` and the source globs: the source document's parsed content moved is `X_CLIENT_STALE` (fix: the stamp's own command), the body's bytes moved is `X_CLIENT_EDITED`. Reformatting `source.json` changes nothing; the `.ts` files carry `biome-ignore-all format`. Names come from `operationId`, so a `contract-diff` red is a customer's client breaking. `rpc` stays the client inside the app's own repo.
368
+
369
+ ## x design research
370
+
371
+ ```bash
372
+ x design research <url…> [--follow <n>] [--out .x/design] [--viewport 390x844,1440x900]
373
+ [--allow-hosts <h,…>] [--timeout 30000] [--json]
374
+ x design research --list [--json]
375
+ ```
376
+
377
+ Measures a public reference page in Chrome over raw CDP into five artefacts per URL — shots at each viewport in light and dark, `reference.json`, a `tokens.proposal.json` that `defineTheme` accepts, `motion-map.json` (observed animation → `@ultimat3/ui/motion` call or `@ultimat3/effects` entry) and `sources.json` (licence posture). Every navigation, redirect and subresource to a private, loopback or link-local address is refused browser-wide (`X_DESIGN_URL_REFUSED`); a navigation that fails or times out is `X_DESIGN_REFERENCE_UNREACHABLE`. A cancelled `ui.research` call ends with `X_ABORTED` and publishes nothing half-written; a followed link that fails is listed in `data.skipped`, by code. Needs no app. Flags, artefacts and the ideas-only rule: [Design research](Design-Research).
378
+
379
+ ## x kit
380
+
381
+ ```bash
382
+ x kit [--json]
383
+ ```
384
+
385
+ Writes the managed agent kit — `.claude/skills/{feature,planx,verify,upgrade,design-research}/SKILL.md`, `.claude/agents/{shape,data,server,web,audit}.md` and the `.claude/kit.json` marker — from the installed framework. Never touches an `app-*` file, `apps/web/DESIGN.md`, or an entry named in `kit.json`'s `"off"`. Needs an app root. `--json` answers `data: { written[{ path, action }], unchanged, off }`. `x verify`'s `manifest` step judges the kit: with the marker, a missing or edited managed file is `X_KIT_DRIFT` and an app file under a managed name is `X_KIT_SHADOWED`; without it, one warning naming `bunx x kit`. `x upgrade` runs it after the guards. → [Agents](Agents)
386
+
387
+ ## x shot
388
+
389
+ ```bash
390
+ x shot <route> [--port 0] [--out <dir>] [--no-full] [--settle 2000] [--against <png|.x/design/<slug>>]
391
+ [--timeout 30000] [--browser <path>] [--cdp-url <ws://…>]
392
+ [--allow-hosts a.com,b.com] [--theme light|dark] [--locale <l>]
393
+ [--cookie name=value[,name=value]] [--expect-status 404]
394
+ [--viewport 390x844,1440x900] [--json]
395
+ x shot --matrix [<route>] [--locale <l>] [--theme light|dark] [--viewport …] [--cookie …] [--json]
396
+ x shot --island <name> [--state <id>] [--json]
397
+ x shot --all-islands [--json]
398
+ ```
399
+
400
+ **The framework's stated primary developer is an agent, and an agent cannot look at anything.** It can read a file and run a command that prints. `x shot` turns a rendered route into both.
401
+
402
+ | Flag | Default | Meaning |
403
+ |---|---|---|
404
+ | `<route>` | required | a path on the app. An absolute URL is `X_CLI_BAD_FLAG` — pointing a headless browser inside your network at someone else's site is not a screenshot tool's job |
405
+ | `--port` | `0` | the kernel picks a free one. **Never 3000**, which another project usually holds |
406
+ | `--out` | `<root>/.x/shot/<slug>/` | `.x/` is already gitignored in every scaffold. A relative `--out` resolves against the cwd, as `x build --out` does |
407
+ | `--full` | on (`--no-full` for the fold) | a fold-sized viewport crops nearly every route |
408
+ | `--settle` | `2000` | matches the hydration runtime's own `requestIdleCallback` timeout |
409
+ | `--timeout` | `30000` | one navigation |
410
+ | `--browser` | `PUPPETEER_EXECUTABLE_PATH`, then `CHROME_PATH` | refused before anything boots if the path does not exist |
411
+ | `--cdp-url` | `SCRAPE_CDP_URL` | **attach** to a browser somebody else is running instead of launching one here. `ws:`/`wss:`/`http:`/`https:`; anything else is refused before the attach |
412
+ | `--allow-hosts` | the app's host only | extra hosts the page may request |
413
+ | `--cookie` | none | `name=value[,name=value]`, `As of 2026-09-29`: set in the browser for the app's own origin before the first navigation, so a page is photographed with a cookie-held choice already made — `x shot --matrix --cookie consent=granted` shoots every cell with the consent banner answered. Applies to `--matrix` cells and `--island` states too. A name that is not an RFC 6265 token, or a value holding a space, `;`, `,`, a quote or a backslash, is `X_CLI_BAD_FLAG` before anything boots |
414
+ | `--expect-status` | absent — any 2xx | the document status this shot is ok with, `As of 2026-09-26`: `x shot /nope --expect-status 404` photographs the not-found page on purpose. Absent, a non-2xx document fails the verdict and the summary names the status. With `--matrix` it applies to every cell |
415
+ | `--locale` | the app's `defaultLocale`, **always pinned** | one of the app's `locales`, `As of 2026-09-25`. Sent as `Accept-Language` on every request the page makes, and for a non-default locale the path is prefixed (`x shot /precios --locale en` opens `/en/precios`). Absent, `Accept-Language` is still pinned to the default locale, so a picture never depends on the language of the machine's Chrome. An undeclared locale is `X_CLI_BAD_FLAG` before anything boots; refused beside `--island` |
416
+ | `--matrix` | off | every static `site/` route × every locale × `light`/`dark` × `390x844` and `1440x900` — or the `--viewport` list instead (laid out at exactly that width: scrollbars are hidden, `As of 2026-09-29` — a classic scrollbar made every capture 15 px narrow), into `.x/shot/matrix/<route>/<locale>/<theme>-<width>x<height>/` (`<theme>-<width>/` before 2026-10: two sizes sharing a width wrote one directory), plus `.x/shot/matrix/index.html`, a contact sheet of every picture with failures marked. One dev server for the whole run. A `<route>` narrows it to that route, `--locale` and `--theme` to one value of their axis; `ok` only when every cell's verdict is. Refused beside `--island`/`--all-islands` |
417
+ | `--against` | none | a PNG or a `x design research` directory: each picture compared with the reference shot of its width and scheme — `diff-<w>-<scheme>.png` and `against.{similarity,changedPercent,changedBox}` in `verdict.json`; recorded, never gating. A missing pair is `X_SHOT_AGAINST_MISSING`. Refused beside `--matrix`/`--island`/`--all-islands` → [Design research](Design-Research) |
418
+ | `--viewport` | absent — the driver's default size | `<w>x<h>[,<w>x<h>…]` in CSS pixels, `As of 2026-10` (#444): the route photographed **once per size** over one dev server, each into `<out>/<w>x<h>/` with its own `shot.png` and `verdict.json`; `ok` only when every size's verdict is, and the summary is the first failing size's. `x shot /pricing --viewport 390x844,820x1180,1440x900` replaces a hand-written browser script. With `--matrix` the list replaces the default pair. One flag holding a list, never repeated — the parser keeps a repeated flag's last value. A side outside `1..16384`, anything but digits around an `x` (`0x10`, `1e3`, `390.5`), an empty entry or the same size twice is `X_CLI_BAD_FLAG` before anything boots; refused beside `--island`/`--all-islands`, whose states declare their own `viewport` |
419
+ | `--theme` | absent — the box's own preference and the app's own `theme.defaultMode` | `light` or `dark`, `As of 2026-09-19`. Both `prefers-color-scheme` is emulated **and** the scheme is stored as the visitor's choice under `THEME_STORAGE_KEY` before navigation — the boot script since 20.2.0 answers `defaultMode` before the OS, so emulation alone photographs a dark-default app dark whatever was asked (#489). The `ui.shot`/`ui.inspect`/`ui.interact` tools' `theme` is this flag. Refused beside `--island`, which photographs both themes |
420
+
421
+ **`verdict.json` is the half that gates**, and the more important of the two files: a picture cannot tell you the island threw or logged. It carries the console lines, the island counts, the canvas size, the network tallies, `gpu` — `{ api, available, adapter, fallback }` from the page's `navigator.gpu.requestAdapter()`, recorded and never gating, `null` when the page answered no probe (`As of 31.1`) — and `blind`, which names what this capture could **not** observe. A tool that silently omits what it cannot see is worse than one that says so.
422
+
423
+ `ok` is decided by `buildVerdict` in `packages/cli/src/shot-verdict.ts` — read it there rather than trusting a count here: **nothing logged an error**, **nothing threw**, **no island failed to mount**, **the document photographed is the route asked for**, and **the document answered 2xx** (or exactly `--expect-status`; `status` and `expectedStatus` ride `verdict.json`, `null` when no response was seen — unseen never gates). A failed subresource — a missing favicon — is counted under `network.failed` and never gates. The island condition is new in 8.0.0: before it, every island's `mount()` could reject and the run still reported `ok: true`, "clean". The last matters most: a route behind `auth: 'required'` photographs the sign-in page and reports every island missing, which reads as a bug in the app when it is a bug in the capture.
424
+
425
+ **It drives `x dev`, never the static build.** `x build --target static` prerenders `site/` only, so an `app/` route would photograph the landing page. If an `x dev` is already running on the checkout it is **reused** rather than booted over — embedded Postgres is single-writer, so a second boot is `X_DEV_ALREADY_RUNNING` and no picture is ever taken. The verdict says which happened.
426
+
427
+ **`x shot` launches Chrome itself**, over raw CDP — no browser library in the app. It takes `--browser`, else `CHROME_PATH`, else the first of the probed paths (`/usr/bin/google-chrome` and its siblings), or attaches with `--cdp-url`. With none of them it answers `X_SHOT_BROWSER_MISSING`, whose fix is `export CHROME_PATH=/usr/bin/google-chrome`.
428
+
429
+ **`--cdp-url` is how a run gets a browser this box could not have started**, `As of 2026-08-24`. Every stealth provider — Browser Use Cloud, Scrapfly, Browserless, Remote Browser and the CAPTCHA-solving services — sells the same shape: create a session over their API, get a `wss://` CDP endpoint back, connect to a real un-fingerprintable Chromium behind it. `@ultimat3/scraping`'s `remoteBrowser({ cdpUrl })` has called that its **primary production path** since it shipped, and until now no CLI command could reach it: `x shot` only ever called `localBrowser()`, so a CI runner or a container with no Chrome could take no picture at all.
430
+
431
+ ```bash
432
+ # A provider session — the API call is theirs, the endpoint is what x shot needs
433
+ CDP=$(curl -s -X POST https://api.example.com/v3/browsers -H "Authorization: Bearer $KEY" | jq -r .cdpUrl)
434
+ x shot /pricing --cdp-url "$CDP" --json
435
+
436
+ # A sidecar in the same compose network
437
+ x shot /pricing --cdp-url http://chrome:9222 --json
438
+ ```
439
+
440
+ Three rules decide which browser a run gets, and the third is the one worth knowing: **both flags together is refused** rather than ranked (one names a Chrome to *start*, the other says the browser is somebody else's); an exported `SCRAPE_CDP_URL` is a shell-wide default, so `--browser` beside it **wins** and launches locally; and `--browser` is not read at all on an attach, so a correct remote run is never refused for a binary it will never execute. The variable is `SCRAPE_CDP_URL` and not a name of the CLI's own because `@ultimat3/scraping`'s own refusal already tells its reader `remoteBrowser({ cdpUrl: env.SCRAPE_CDP_URL })`.
441
+
442
+ **Closing an attached browser ends the remote session too** — `remoteBrowser()` calls `close()` and not `disconnect()`, deliberately: a disconnect leaves a browser somebody is billing for running until its provider times it out, and nobody attributes that bill to the run that caused it.
443
+
444
+ **Never a step of `x verify`.** A gate that needs a browser goes red for reasons unrelated to the change, and CI does not install one.
445
+
446
+ ### x shot --island
447
+
448
+ ```bash
449
+ x shot --island <name> [--state <id>] [--settle 2000] [--json]
450
+ x shot --all-islands [--settle 2000] [--json]
451
+ ```
452
+
453
+ One **component**, in the states it declares, photographed one address at a time. A route shot answers "what does this page look like"; this answers "what does this component look like in the state a reviewer cannot click their way to" — an empty result set, a save the server refused, a quota banner.
454
+
455
+ The states come from a sibling `<name>.island.states.ts` beside the island, and that file is **pure data**: no JSX, no `solid-js`, one erased `import type`. It has to be, because the complete expected picture list is computed from it **before a browser exists**, which is what lets the run diff what it owed against what landed and refuse `X_SHOT_ISLAND_MISSING` rather than reporting a clean run with no pictures in it. An import of the component itself is `X_TEST_ISLAND_STATES_NOT_PURE`.
456
+
457
+ | Flag | Default | Meaning |
458
+ |---|---|---|
459
+ | `--island <name>` | required | the manifest's own `name`. A route positional beside it is refused — they are two different subjects, not two spellings of one |
460
+ | `--state <id>` | every declared state | one state. An id the manifest does not declare is refused by name, with the known ids |
461
+ | `--settle` | `2000` | the readiness window. Ready is **quiet**, not idle: fonts, then N consecutive frames with an unchanged network-activity counter — never "nothing in flight", which never comes for a fixture declared `pending` |
462
+ | `--all-islands` | off | **every** island in the app, in every state each declares. Its own spelling and never `--island` with no value: the parser refuses a bare `--island` ("expects a value"), so "every island" had no form a reader could type that could not be read as a mistyped name. Naming it beside `--island`, beside `--state` or beside a route positional is refused by name |
463
+
464
+ Everything else — `--out`, `--timeout`, `--browser`, `--cdp-url`, `--allow-hosts` — is the route shot's, unchanged. Pictures land at `.x/shot/island/<name>/<state>-<theme>.png`, one per state per theme, beside a `verdict.json` of the same shape and an `index.md` one level up.
465
+
466
+ **`x shot --all-islands` is the one command that answers "what does this app look like".** It expands every `*.island.states.ts` in the app through the same plan the one-island form uses, boots one dev server, and keeps **one browser per declared viewport across every island** — forty states at one size is still one launch. A state that cannot be photographed does not stop the run, and not the next *island* either: every picture the app can produce is taken, every verdict and the index are written, and only then does the missing-picture gate turn the refusals into a non-zero exit. An app that declares no states at all is refused by name rather than answered with an empty gallery — "produced nothing and exited 0" is the one outcome a reader cannot tell from success.
467
+
468
+ ### .x/shot/island/index.md
469
+
470
+ The file an agent opens instead of guessing at forty PNGs. Markdown, written by **both** forms — a single-island run gets one too, because the file that says what a picture *is* cannot be a property of how many islands were asked for.
471
+
472
+ | It carries | Why |
473
+ |---|---|
474
+ | the counts, and the commands that re-run everything / one island / one state | an artifact that cannot be regenerated is one nobody trusts twice |
475
+ | what the capture could **not** see | the verdict's own `blind` list, handed in rather than reworded — two wordings would drift |
476
+ | per island: the app-relative path of the `.island.tsx` | so a reader can open the component the pictures are of |
477
+ | per state: the `id`, the `title` and the `note` | the note is the *"you cannot reach this by clicking, because …"* line, and it is the whole reason a reviewer knows what they are looking at |
478
+ | per state: one path per theme, and the state's own verdict | `ok`, or every reason it is not — a missing picture, a mount that never happened, a request no stub answers, a console error |
479
+ | per state: console **warnings** and whether the content overflows its box | **recorded, and gating nothing.** A signal that fails a run is a signal an author switches off, and a box its content spills out of is the commonest ugly-UI symptom a pixel-tight PNG cannot show. `stateShotOk` reads neither |
480
+
481
+ **One session per picture**, and it costs a browser launch each: `page.console()` and `page.pageErrors()` are bounded rings over the whole *session*, so a shared one files state A's console errors under state B — and per-state attribution is the half of the artifact that gates.
482
+
483
+ **An unstubbed HTTP request fails the run.** The page's seal replaces `fetch` and `XMLHttpRequest` before the island's chunk is imported, answers the state's `routes`, and publishes everything else; the capture refuses with `X_SHOT_ISLAND_UNSTUBBED_REQUEST` naming each method and path. A component whose fetch quietly hangs paints its own loading branch, and the picture then shows a fixture gap dressed up as a real component state.
484
+
485
+ **A socket needs no stub, `As of 2026-09-17`.** `WebSocket` and `EventSource` are replaced with an INERT stand-in rather than a refusal: no real dial, no network, no message and no error ever delivered; `close()`/`send()` are no-ops. A snapshot of an island does not need a *live* socket — every state's fixture already rides `props`/`routes` — so a component whose `mount()` unconditionally dials `@ultimat3/realtime`'s `LiveClient.connect()` used to fail **every** state of **every** such island with `X_SHOT_ISLAND_UNSTUBBED_REQUEST`, and the error's own `fix:` told the author to declare a stub whose `match` the harness's `"<METHOD> <pathname>"` grammar can never accept — `WS ws://…` matches no `isStubMatch`, so the printed remedy could never be run. `readyState` DOES leave `CONNECTING` once, on a zero-delay timer that fires `onopen`/an `'open'` listener and nothing else — a component whose `mount()` awaits the socket's own open event before rendering anything (not true of this app's `LiveClient`, whose `connect()` registers callbacks and returns, but not a fact this harness may assume of every app) would otherwise hang the mount forever, trading one impossible `--settle` deadline for the unsatisfiable stub fix this defect was about. Each socket a component constructs is recorded on its own `sockets` list instead — in the readiness probe, on `IslandStateShot.sockets`, and in `--json` — never on `unstubbed`, and `stateShotOk` reads neither: a component legitimately holding an open, silent channel is not the same fact as a request nobody stubbed, and this list gates nothing. Not a candidate for the blind-spot list below, either — that list is for a fact a *picture* cannot show, and both `sockets` fields ride `--json` plainly. A real unstubbed `fetch`/XHR is unaffected and still fails the run exactly as above.
486
+
487
+ **Open popups are in the frame** (`As of 2026-09-29`). The crop is the union of the target's box and every visible `[role=listbox]`, `[role=menu]`, `[role=dialog]`, `[role=alertdialog]`, `[role=tooltip]`, `dialog[open]` and `:popover-open` in the harness — portalled or not — so a combobox state declared `open` photographs its listbox instead of a closed input. `verdict.json`'s `box` stays the target's own box.
488
+
489
+ **The picture is the crop target plus a small margin.** The rectangle is the state's declared selector, or the island's host element, translated out of viewport coordinates into the page's — `As of 2026-08-26`; measured before that, 720×560 for a component whose own box the same verdict reported as 688×104. The margin came later, because a pixel-tight crop shaves off everything a component paints *outside* its border box — a `box-shadow`, an outline, a focus ring, a hairline border on a subpixel — and a reviewer then reads a component with no elevation as flat, which is a change the component never made. It is clamped to the document at both ends, so the frame never starts in negative space and never runs past the page, and it may only ever make the frame **bigger** than the component's own box.
490
+
491
+ **Both themes are photographed by emulating `prefers-color-scheme`**, not by setting an attribute — `As of 2026-08-26`. An attribute on the document is the *outcome* of a theme decision and the component owns it: one that resolves `'system'` itself deletes or overwrites it on mount, so the harness is silently overruled and both pictures converge. Measured on the reference app, `<state>-light.png` and `<state>-dark.png` came back byte-identical, same md5, from two addresses that really did serve different documents. The attribute is still set, because it is right for a component that *reads* a theme it does not own.
492
+
493
+ ## x pr · x ci
494
+
495
+ ```bash
496
+ x pr review [--pr <n>] [--repo owner/name] [--all] [--full] [--json]
497
+ x pr resolve <thread-id> [--json]
498
+ x pr reply <thread-id> --body "…" [--json]
499
+ x ci [runs] [--branch <name>] [--run <id>] [--repo owner/name] [--tail <n>] [--full] [--workflow <name>] [--event <push|pull_request|workflow_dispatch>] [--json]
500
+ x ci tested [--max-age 24h] [--repo owner/name] [--workflow ci.yml] [--json]
501
+ ```
502
+
503
+ **`gh pr view --comments` does not show inline review threads.** It shows *issue* comments; the actionable findings are anchored to lines and reachable only through GraphQL, and the thread id needed to resolve one exists nowhere else. That is the whole reason `x pr` exists — otherwise every team on Ultimate rediscovers the same query.
504
+
505
+ Two hazards it encodes, both of which have bitten in this repo:
506
+
507
+ | Hazard | What `x pr review` does |
508
+ |---|---|
509
+ | **A review decision goes stale.** It survives later pushes, so `CHANGES_REQUESTED` can predate the commits that addressed it | compares the deciding review's **commit oid** against `headRefOid` and says `stale` outright. Not timestamps — two reviews seconds apart can straddle a push, and the timestamp then calls one of them current |
510
+ | **An outdated thread has `line: null`** | selects `originalLine` too, so a thread whose diff moved still has a locator instead of arriving anchorless |
511
+
512
+ It reads `latestOpinionatedReviews`, not `reviews(last: n)`: the most recent reviews are often all `COMMENTED` at the current head, so dating the decision from "the newest review" reports a stale `CHANGES_REQUESTED` as current — the hazard, inverted.
513
+
514
+ **`--json` carries the whole conversation, additively** (as of 2026-11, 31.1.0): beside `threads`, `reviews` (every review: `state` — `APPROVED`, `CHANGES_REQUESTED`, `COMMENTED`, … — `author`, `isBot`, `commit`, `stale`, `body`), `comments` (the PR's issue comments, `updatedAt` included), `reviewsTruncated`/`commentsTruncated` (newest 50 each), and `bots` — one row per review bot: `{ login, reviews, comments, lastReviewAt, notice, blocked }`. `notice` is the newest "did not review" notice the bot posted as a PR comment — recognised by CodeRabbit's `<!-- … by coderabbit.ai -->` tag or a heading that begins with the notice's title, never by a phrase in prose; a submitted review is never one (`kind: 'rate-limited'` — CodeRabbit's rate or review limit; `kind: 'skipped'` — review skipped, too many files), and `blocked: true` means no review of its came after it: no new threads is a review that never happened, not a clean one. Bodies are clamped like thread bodies; `--full` lifts it. Same one GraphQL round trip. The human render adds one count line and, per bot with a notice, one line: `<bot> did not review: …` when blocked, else `<bot> posted a … notice at …, then reviewed at …`.
515
+
516
+ **Resolving closes a conversation, not a finding.** Whether the code is fixed is a fact no GitHub mutation observes, and `x pr resolve` says so rather than implying otherwise.
517
+
518
+ `x ci` exists because *"`gh run view` prints a tree of ticks and one cross, and the error is inside a per-job log that is mostly setup noise."* For a `verify` job the log tail **is** the findings block — this repo's gate already prints `X_*` codes and executable `fix:` lines — so `x ci` reads them back out into `findings[]` in the standard shape. `cause` and `fix` are the text the gate wrote, with every transport wrapper undone — `##[group]`, `##[error]`/`##[warning]` prefixes, an echoed `::error …::` command (its `%0A` decoded), and a `<comment id=…>` fence a nested `x ci` printed; the log's foreign origin is `source: 'ci-log'` and the job `meta.job` — printed on the finding's head as `[from=ci-log <job>]` — never markup inside `fix`. `ok: false` iff a run failed; `ok: true` means *no failed run* — an in-flight or queued run still completes with `ok: true` and is reported through the `running > 0` line and a per-run `headSha`, not as a green verdict. `x pr review` always exits 0, because unresolved threads are the work to do, not a failure of the command that listed them. The two flags narrow the `gh run list` server-side — `--workflow` takes the workflow name or filename (`ci.yml`), `--event` takes `push|pull_request|workflow_dispatch` — so `x ci --workflow ci.yml --event push --branch main` answers *"is main's push CI green"* instead of folding every main-branch workflow into one verdict.
519
+
520
+ **`x ci tested` answers whether a push may reuse a green pull-request run** — `{ tested, condition, reason, pr?, run? }`, for `GITHUB_SHA` or `HEAD`. `tested: true` needs all of: the subject ends `(#N)`; PR N merged as this very commit; its head is in this repository (a fork's run is never reused); its head tree is this tree; the newest same-repository run of `--workflow` (default `ci.yml`) on that head concluded `success`, under `--max-age` old (default `24h`: the runner image and the registry move). Any doubt — a condition unmet, `gh` absent, an API that did not answer — is `tested: false` and a full run. Exit 0 on every answer, so a workflow reads `data.tested`; only an unreadable `--max-age` refuses (`X_CLI_BAD_FLAG`). The workflow shape that consumes it: [CI-Parallel-Gate](CI-Parallel-Gate.md#a-push-a-green-pr-run-already-tested). As of 2026-11.
521
+
522
+ **Neither is a step of `x verify`.** A gate that needs network and a GitHub token goes red for reasons unrelated to the change.
523
+
524
+ ## x errors
525
+
526
+ ```bash
527
+ x errors [explain <CODE> [--recent]|list] [--json]
528
+ ```
529
+
530
+ `--recent` (in an app) adds what THIS app has seen of the code: its groups in `x_error_groups`
531
+ (count, first and last seen) and the bundles `x_failures` holds, each with its `x repro` line.
532
+
533
+ The [Error codes](Error-Codes) table, programmatically. Runs outside an app: triaging a code must not need an app root.
534
+
535
+ ```bash
536
+ $ x errors explain X_CURSOR_INVALID --json
537
+ {"ok":true,"command":"errors","summary":"X_CURSOR_INVALID — pagination cursor is malformed…",
538
+ "data":{"code":"X_CURSOR_INVALID","cause":"pagination cursor is malformed, tampered with or from
539
+ another query","fix":"after: null // drop the cursor and request the first page again",
540
+ "docs":"https://github.com/developerz-ai/ultimate/wiki/Error-Codes",
541
+ "site":{"at":"@ultimat3/core/src/cursor.ts","line":28}}}
542
+ ```
543
+
544
+ `site` is the CLI locating a throw site in the tree — it is **not** a field the thrown error
545
+ carries. A code raised at more than one site gets one of them, named in the `fix` line; run the
546
+ command rather than quoting the line. `docs` is `ERROR_DOCS_URL`, the same URL for every code.
547
+
548
+ `list` enumerates every registered code, and names under `data.unavailable` any package this process could not import — a list silently missing codes is worse than one that says which. An unregistered code is `X_ERROR_CODE_UNKNOWN` with the nearest real code as its fix; the command never invents an explanation.
549
+
550
+ **An app's own codes answer inside the app** (`As of 2026-11-19`, `packages/cli/src/cmd-errors-app.ts`). A code the framework does not know is looked up after `loadApp` registers the app's `defineError()` declarations: the answer is the registered title, the `cause:` / `fix:` read off the declaration's text (never by constructing the error), `status`, and the declaring `file:line` as `site`; `--json` carries `{ code, title, cause, fix, docs, status, site }`. Framework codes pay no load. A near miss of a framework code keeps its suggestion. Otherwise `X_ERROR_CODE_UNKNOWN`, its fix inside an app `grep -rn <CODE> apps packages`, outside one `x errors list --json` naming the `--cwd` form.
551
+
552
+ ## x repro
553
+
554
+ ```bash
555
+ x repro <jobId|requestId|traceId|fingerprint> [--write] [--verify] [--json]
556
+ x repro --list [--code X_…] [--json]
557
+ x repro --from <file> [--write] [--verify] [--json]
558
+ x repro <id> --bundle [--include-rows] [--json] | x repro --from <file> --bundle [--include-rows] [--json]
559
+ ```
560
+
561
+ A production failure becomes a failing test. `As of 2026-11`.
562
+
563
+ | Subject | Read from | Written as |
564
+ |---|---|---|
565
+ | a dead job (`x_jobs` id) | its row and its steps — capture off or on | `repro/repro-<id>.job.test.ts`: `reproJob(runJobs, …)` replays the completed steps from their stored output and runs once more |
566
+ | a captured 5xx (request id, trace id, bundle id, or a fingerprint's newest) | `x_failures`, written when `failureCapture.enabled` (`x dev`: always) | `repro/repro-<id>.contract.test.ts`: `reproduce(bundle, { driver })` seeds the rows the call read, freezes the clock at the failure, invokes as the actor |
567
+
568
+ The written test is RED until the fault is fixed. `--verify` runs it: `data.reproduced` is true
569
+ when it failed with the captured code; otherwise the answer is `X_REPRO_NOT_REPRODUCED`, naming
570
+ the masked fields and the captured build — a fault in the database or a different build replays
571
+ green. Masked input (`.sensitive()`, secret-named keys) and masked columns are stood in for from
572
+ the schema. `--list` reads the bundles with each group's count and last sighting. An id nothing
573
+ holds is `X_REPRO_UNKNOWN`; a request id with capture off is `X_REPRO_CAPTURE_OFF`.
574
+
575
+ **`--bundle` carries the failure to an issue** (`As of 2026-11`): one JSON file,
576
+ `repro/bundle-<id>.json` (the scaffold's `.gitignore` keeps it out of a commit), deterministic
577
+ bytes, meant to be read before it is attached — its `readFirst` lines say what is in it and what
578
+ is not found. Never with `--write`/`--verify`; `--include-rows` without `--bundle` is refused
579
+ (`X_CLI_BAD_FLAG`).
580
+
581
+ | Section | Holds |
582
+ |---|---|
583
+ | `framework` | every installed `@ultimat3/*` package and the versions found of it, the CLI's, Bun's, the platform |
584
+ | `error` | the code, the cause, the stack's `at …` frames — from the job row, a `--from` file's `error`, or the error group's sample only when that sample is this request's own |
585
+ | `schema.entities` | the declarations of the entities whose rows the call read — never the whole app |
586
+ | `subject` | the failure, as `x repro --from` reads it back. Always: input masked by the primitive's `.sensitive()` schema and core's `captureValue`, rows minus sealed columns, a row of an undeclared entity dropped (`dropped`, `truncated: true`). By default also: every value that is not a key — input leaves, row columns other than the primary key, a declared reference or an `…Id`, step outputs — is `[redacted]` (a step's number `0`), listed as masked so the replay stands it in from the schema; the actor's org is a placeholder uuid everywhere it appears |
587
+ | `masked` / `scrubbed` | the masked paths; the env var NAMES whose values were found, the count of hostnames |
588
+ | `reproducer` | the test, rendered from `subject` alone, against the scaffold's `apps/web/api` and the `@app/db` placeholder |
589
+
590
+ | Flag | Does |
591
+ |---|---|
592
+ | `--include-rows` | real values for those non-key fields, and the real org — read them before sending. Secrets, `.sensitive()` fields and sealed columns stay masked |
593
+
594
+ Replaced everywhere (never in the primitive's name, the code or the reproducer's imports): the app
595
+ root (`.`), the home directory (`~`), an env value that is secret-named, a URL or from the app's
596
+ `.env*` files (`[env:NAME]`; 6+ characters, any length under a secret name) — and an env URL's
597
+ user and password raw, URL-decoded and base64 (a Basic header) —, every hostname in
598
+ `app.config.ts` or an env URL (`[host]`), any URL's userinfo (`[cred]@`) and query values
599
+ (`?k=[redacted]`), emails (`[email]`), IPv4/IPv6 addresses (`[ip]`); in a cause or frame, any other
600
+ absolute file path (`<abs>/<file>`). **Not found**: a value this machine never knew — a
601
+ production-only secret, a customer's name in a cause.
602
+
603
+ **A bundle is untrusted input.** `bunx create-ultimate repro <bundle.json>` reads only its
604
+ `subject`, checked field by field (`X_REPRO_BUNDLE_INVALID` otherwise, control characters
605
+ included), and renders the test from it; the bundle's own `reproducer` text never reaches disk.
606
+ It opens into a scratch app (`repro-<id>/`), the test under `repro/`, linked to the framework
607
+ checkout the command runs in (or `--framework <checkout>`) through `file:` overrides.
608
+
609
+ ## x docs
610
+
611
+ ```bash
612
+ x docs "<question|topic|symbol>" [--limit <n>] [--json]
613
+ ```
614
+
615
+ **The first lookup**, before stating or working around a framework limit. Offline, no app needed. `As of 30.0.0`.
616
+
617
+ | Reads | Topic |
618
+ |---|---|
619
+ | every installed `@ultimat3/*` package's `README.md`, `CLAUDE.md` and source headers — the app's direct dependencies and the CLI's own | `<pkg>.<module>`, `<pkg>.README#<anchor>` |
620
+ | this wiki, shipped in the `@ultimat3/cli` tarball (`wiki/`) — every page but Error codes | `wiki.<Page>`, `wiki.<Page>#<anchor>`, the anchor GitHub renders |
621
+ | an `X_*` code | redirected to `x errors explain <CODE>`, the one way to a code |
622
+
623
+ 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 docs <topic-id>`** (`As of 2026-11-19`) prints one topic's body: the id is what every search line starts with — `jobs.retry` (a module: its header comment, its exports, its file), `jobs.README#one-job-per-org-from-a-schedule` (a package guide: that whole section, subsections included), `wiki.Upgrading#<anchor>` (a wiki section). Quote an id that carries `#`. A search's last line is the command for its first hit (`x docs jobs.retry # any topic id above prints that section whole`); a query that is exactly a topic id answers that topic alone, not a ranked search. `x upgrade --json`'s `section.local` is that topic. A search hit carries a capped excerpt.
624
+
625
+ 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.
626
+
627
+ 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.
628
+
629
+ ## x fix
630
+
631
+ ```bash
632
+ x fix boundary <file> [--json]
633
+ ```
634
+
635
+ The minimal cut for an import that crossed a surface boundary — the command every `X_SURFACE_BOUNDARY` finding names in its `fix:` line. It prints a plan and **writes nothing**; there is no `--write`.
636
+
637
+ `site-imports-app` (`X_BOUNDARY_SITE_TO_APP`) is one finding per crossing edge — the first import in the chain that lands on `app/` — reported at the file that writes it, with the chain from the `site/` entry in `cause`. Imports below the crossing are `app/ → app/` and are never reported, by the gate or here: one illegal import is one finding and one edit (`As of 2026-11-19`; `classify()`, `packages/render/src/surfaces.ts`).
638
+
639
+ For each violation involving the file it reports the offending edge, the full chain that makes it one, and the edit to make. For the `shared/` fattening case it generates the split: when exactly one surface reaches the module **and the module lands on the same surface as the file it imports**, the plan carries the `git mv` plus every import specifier that move invalidates — the move alone is not a repair, it just relocates the break. When two surfaces reach it, or when relocating would leave the forbidden edge exactly where it was, the module has to be cut by hand and the plan says so rather than guessing.
640
+
641
+ `<file>` is app-root-relative, or any suffix that matches exactly one source file — the short form a `fix:` line emits. Errors: `X_FIX_TARGET_UNKNOWN` (with the nearest real path as its fix), `X_CLI_BAD_FLAG` on an ambiguous suffix.
642
+
643
+ ## x token
644
+
645
+ `As of 2026-11`. The app's machine credentials — the keys an MCP endpoint's `apiKeyResolver` and the `/v1` mount accept — in the framework's `x_api_keys`, through `@ultimat3/auth`'s `issueApiKey` / `describeApiKey` / `revokeApiKey`. No default subcommand: `create` writes a credential.
646
+
647
+ | Subcommand | Does |
648
+ |---|---|
649
+ | `create --scopes <a,b> [--user <id>] [--org <id>] [--env dev\|stage\|prod] [--days n]` | issues one key carrying exactly those scopes (a wildcard is `X_CONFIG_INVALID`). `--env` unsaid is the environment's label: `ULTIMATE_ENV` (else `NODE_ENV`) production → `prod`, staging → `stage`, else `dev`; an unreadable `ULTIMATE_ENV` reads as `prod`. `--user` cuts its scopes to what that user may do and stops it when the user is disabled. The plaintext is printed **once** — in the human lines, or `data.token` under `--json` — and never in the summary; only its SHA-256 is stored |
650
+ | `list --owner <id>` | the keys of a user or org, as `describeApiKey` answers them: no hash, no secret. A key issued with neither is listed by nobody and revoked by its id |
651
+ | `revoke <id>` | revokes it; an unknown or already-revoked id answers `revoked: false`, exit 0 — neither is a key that works |
652
+
653
+ Every flag is read before the database opens: a refusal costs no boot.
654
+
655
+ ## x merge-driver
656
+
657
+ `As of 2026-11-19`. `x merge-driver install [--json]` · `x merge-driver run <base> <ours> <theirs> <path>` — how two branches that each generated a feature merge with no hand edit. The rules and what stays a conflict: [Merging two features](Many-Agents#merging-two-features).
658
+
659
+ | Form | Does |
660
+ |---|---|
661
+ | `x merge-driver install` | writes `merge.x-registry.*` and `merge.x-generated.*` into `.git/config`; `data.installed: false` outside a git checkout. `bun run setup` runs it; `x doctor` warns `X_MERGE_DRIVER_UNSET` where it never ran |
662
+ | `x merge-driver run` | what git invokes, with its temporary files. Exit 0 merged; exit 1 left the markers in the file and reports `X_MERGE_UNRESOLVED` |
663
+
664
+ ## x logs
665
+
666
+ `As of 2026-11`. `x logs tail [--lines n] [--role <role>]` — the last `n` lines (default 100, at most 10,000) of `.x/dev.log`, which `x dev` tees; with `--role`, that role's `.x/logs/<role>.log` when one was written, else the dev log's lines whose `role` field names it (`As of 2026-11-15`). The `logs.tail` MCP tool's reader (`mcp-host-logs.ts`), so both answer the same lines. A `--role` that is not a runtime role is `X_CLI_BAD_FLAG` before any path is built; no dev log yet is `X_DEV_LOG_ABSENT`, fix `x dev`.
667
+
668
+ ## x explain
669
+
670
+ `As of 2026-11`. `x explain <query> [--input '<json>'] [--org <id>]` — the query run once on the app's dev database (rows discarded; its policy is not asked, as `explainQuery`'s is not), every statement it **sent** captured off `db.statement` and planned by `sweepPlans`: the oracle the `exercise` step judges with. A read no declared index serves is `X_QUERY_UNINDEXED` / `X_QUERY_SORT_UNSERVED` with the `indexes:` entry as its fix, exit 1. A query over a tenant-scoped entity needs `--org`, else `X_CLI_BAD_FLAG`. Tables the dev database lacks are listed as not planned — run `x db migrate` first. An external `DATABASE_URL` where `ULTIMATE_ENV` (else `NODE_ENV`) resolves production — or `ULTIMATE_ENV` is unreadable — is refused before anything opens, `X_EXPLAIN_PRODUCTION_DATABASE`: the query would be sent for real with its policy skipped. Plan on the embedded database, or on a staging restore under `ULTIMATE_ENV=staging`.
671
+
672
+ ## x profile
673
+
674
+ `As of 2026-11`. `x profile <route> [--runs 20] [--top 10] [--json]` — the app booted in this
675
+ process (`x dev`'s boot, web role, an ephemeral port, the same `.x/dev.lock` claim — so a running
676
+ `x dev` on the checkout is `X_DEV_ALREADY_RUNNING`), the route requested once to warm it, then
677
+ `--runs` more through the pipeline's in-process dispatch under JavaScriptCore's sampling profiler
678
+ (`bun:jsc`, 100 µs). Reports the `--top` hottest functions by self samples:
679
+
680
+ | `--json` field | Meaning |
681
+ |---|---|
682
+ | `route`, `status`, `runs` | what was rendered, the warm-up's status, how many requests were sampled |
683
+ | `samples`, `intervalMicros` | samples taken and the sampling interval |
684
+ | `hottest[]` | `{ name, file, line, self, total, selfPercent }` — `file` root-relative for the app's own, `native` for a frame with no source; `total` counts samples with the function anywhere on the stack |
685
+
686
+ A route answering `>= 400` is profiled and reported red, `X_PROFILE_ROUTE_FAILED` (fix: `x routes
687
+ --json`). An absolute URL, a missing route or a `--runs` outside 1–10000 is `X_CLI_BAD_FLAG`.