@ultimat3/cli 31.51.0 → 31.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/package.json +29 -29
- package/src/catalog-layout.ts +194 -0
- package/src/cmd-i18n-spec.ts +4 -4
- package/src/cmd-i18n-split.ts +133 -0
- package/src/cmd-i18n.ts +46 -66
- package/src/config-redact.ts +20 -4
- package/src/db-rollback-pass.ts +4 -1
- package/src/dev-child-watch.ts +16 -0
- package/src/dev-db-migrate.ts +27 -46
- package/src/dev-db-migrator-hold.ts +131 -0
- package/src/dev-db-rollback.ts +11 -2
- package/src/dev-rebuild-schema.ts +7 -24
- package/src/generate-catalog-locales.ts +25 -2
- package/src/generate-follow-ups.ts +8 -3
- package/src/i18n-audit.ts +17 -33
- package/src/i18n-index.ts +108 -31
- package/src/i18n-locale-parity.ts +14 -6
- package/src/i18n-new-locale.ts +75 -0
- package/src/i18n-registration.ts +52 -27
- package/src/island-capture.ts +36 -7
- package/src/merge-state.ts +3 -2
- package/src/messages-floor.ts +2 -0
- package/src/messages.ts +2 -0
- package/src/serve-boot-telemetry.ts +106 -0
- package/src/serve-boot.ts +23 -4
- package/src/shot-blank.ts +70 -0
- package/src/templates/catalog-barrel.ts +84 -0
- package/src/templates/guard-released-forms.ts +2 -1
- package/src/templates/guard-untranslated-string.ts +27 -6
- package/src/templates/locales.ts +6 -0
- package/src/templates/scaffold-gitattributes.ts +9 -2
- package/src/templates/scaffold-i18n.ts +10 -6
- package/src/templates/shapes/offline.ts +5 -2
- package/src/test-ignores.ts +3 -2
- package/src/verify-floor.ts +9 -1
- package/src/verify-local-only.ts +66 -0
- package/src/verify-run.ts +17 -2
- package/wiki/Actions.md +1 -1
- package/wiki/Auth.md +3 -3
- package/wiki/Batching-And-Preloading.md +1 -0
- package/wiki/CLI-Reference-Data.md +241 -0
- package/wiki/CLI-Reference-Gate.md +572 -0
- package/wiki/CLI-Reference-Project.md +414 -0
- package/wiki/CLI-Reference-Ship.md +348 -0
- package/wiki/CLI-Reference-Tools.md +666 -0
- package/wiki/CLI-Reference.md +14 -2225
- package/wiki/Compared.md +8 -8
- package/wiki/Configuration.md +26 -2
- package/wiki/Deployment.md +1 -1
- package/wiki/Entities-And-Migrations.md +3 -2
- package/wiki/I18n.md +39 -5
- package/wiki/Installation.md +1 -1
- package/wiki/Jobs-And-Workflows.md +29 -1
- package/wiki/Known-Gaps.md +3 -0
- package/wiki/Observability.md +15 -1
- package/wiki/Outbound-HTTP.md +62 -2
- package/wiki/PWA-And-Offline.md +1 -1
- package/wiki/Policies-And-Authz.md +10 -0
- package/wiki/Realtime.md +29 -2
- package/wiki/Static-Assets.md +1 -1
- package/wiki/Testing.md +33 -0
- package/wiki/Theming.md +31 -8
- package/wiki/Troubleshooting.md +1 -1
- package/wiki/Upgrading.md +5 -1
package/wiki/CLI-Reference.md
CHANGED
|
@@ -22,6 +22,19 @@ x version # CLI version
|
|
|
22
22
|
| Telemetry | none written. The gate proves one thing: every host a string literal in a non-test `packages/cli/src` file spells is reserved or a reasoned row in `scripts/cli-outbound.ts`, else `X_CLI_OUTBOUND_UNDECLARED`. A host built at run time, and every other package, is outside it ([FAQ](FAQ#does-ultimate-collect-anything)) |
|
|
23
23
|
| `--json` shape | `{ ok, command, summary, steps?, findings?, data? }`. Findings are `{ code, cause, fix, docs?, at?, meta? }` |
|
|
24
24
|
|
|
25
|
+
## Pages
|
|
26
|
+
|
|
27
|
+
The reference is split by family; every command heading keeps its anchor on the page that holds it.
|
|
28
|
+
|
|
29
|
+
| Page | Commands |
|
|
30
|
+
|---|---|
|
|
31
|
+
| this page | conventions, global flags, the command index, planned commands, names that moved |
|
|
32
|
+
| [Project](CLI-Reference-Project) | `x new`, `x dev`, `x stop`, `x g` |
|
|
33
|
+
| [Data](CLI-Reference-Data) | `x db`, `x jobs`, `x tasks`, `x cache` |
|
|
34
|
+
| [The gate and tests](CLI-Reference-Gate) | `x verify`, `x exercise`, `x drill`, `x test`, `x clean`, `x affected`, `x policy`, `x i18n` |
|
|
35
|
+
| [Build, deploy and run](CLI-Reference-Ship) | `x build`, `x deploy`, production roles, `x secrets`, `x auth`, `x vapid`, `x status`, `x heavy`, `x config` |
|
|
36
|
+
| [Inspect, diagnose and upgrade](CLI-Reference-Tools) | every other command |
|
|
37
|
+
|
|
25
38
|
## Command index
|
|
26
39
|
|
|
27
40
|
`As of 2026-10`. **shipped** = implemented in `packages/cli`; **planned** = specified, not yet built — calling it exits with `X_NOT_IMPLEMENTED` and a `fix:` line pointing at the closest shipped command.
|
|
@@ -52,7 +65,7 @@ x version # CLI version
|
|
|
52
65
|
| `x policy` | which clause decided a permission, and why | shipped |
|
|
53
66
|
| `x exercise [<name>] [--seed n\|random] [--shard i/n]` | run every action, query, job and route `load` once on generated rows, with no test written; the gate's `exercise` step | shipped |
|
|
54
67
|
| `x drill [<name>] [--list] [--budget-ms n]` | the app's roles as real processes on real Postgres, Redis and NATS, each dependency faulted through a proxy, each role signalled, or every role started before `ROLE=migrate`, red on any framework contract that does not hold. Not a gate step: it needs the services | shipped |
|
|
55
|
-
| `x i18n` | add, sync, check catalogs | shipped |
|
|
68
|
+
| `x i18n` | add, sync, check, split catalogs | shipped |
|
|
56
69
|
| `x mail preview <id>` | render a mail's declared `preview` in every locale, nothing sent | shipped |
|
|
57
70
|
| `x test <type>` | run one of the six test types, or the whole suite | shipped |
|
|
58
71
|
| `x clean [--dry-run] [--services]` | remove what test runs leave behind: migrated test templates, `.x/cache`, stray `.x` folders, stale probe databases; `--services` stops this checkout's test stack and lists the machine's others | shipped |
|
|
@@ -76,2230 +89,6 @@ x version # CLI version
|
|
|
76
89
|
| `x heavy [status]` · `x heavy run [--label s] [--mb n] [--max-wait s] -- <command…>` | the machine's shared memory ledger: who runs, who is queued, load and memory; any command run inside one reservation, its exit code passed through | shipped |
|
|
77
90
|
| `x status [--url <origin>] [--samples n]` | the build each live worker runs (`x_job_workers`), and the build, status and role each sampled origin's `/readyz` answers | shipped |
|
|
78
91
|
|
|
79
|
-
## x new
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
x new <name> [--dir path] [--shape api|blog|dashboard] [--no-example] [--no-git] [--dry-run] [--force] [--json]
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
| Flag | Type | Default | Meaning |
|
|
86
|
-
|---|---|---|---|
|
|
87
|
-
| `--dir` | string | cwd | parent directory to create the app in |
|
|
88
|
-
| `--example` / `--no-example` | boolean | `true` | include the example feature slice (default: on; `--no-example` for an empty `app/`) |
|
|
89
|
-
| `--shape` | string | none | start from an app shape — `api`, `blog` or `dashboard`, each an overlay over this scaffold ([Shapes](Shapes)). An unknown name is `X_NEW_SHAPE_UNKNOWN`; with `--no-example`, `X_NEW_SHAPE_CONFLICT` (a shape is its own example). Both refuse before a file is written. `dashboard` then runs `x g sign-in --password` in the new app (listed under `data.generate` by `--dry-run`); a refusal there is `X_NEW_SHAPE_GENERATE_FAILED` |
|
|
90
|
-
| `--git` / `--no-git` | boolean | `true` | `git init`, then one commit named `x new`. On by default because three surfaces assume a repository — `x affected`, `x ci` and `x pr`. A git that is absent or fails never fails `x new`: the tree is the verdict, and `data.git` carries `{ initialized, committed, problem }` |
|
|
91
|
-
| `--dry-run` | boolean | `false` | print the file list, write nothing |
|
|
92
|
-
| `--force` | boolean | `false` | write into a directory that already exists and holds no `app.config.ts`, only into free paths: one path the scaffold would write already on disk (`README.md`, `package.json`, `.gitignore`, …) refuses the run before a byte is written — `X_GENERATE_CONFLICT`, the first five taken paths and a count in `cause`, the same free-directory fix. Never an overwrite. A fresh clone holding `.git` and a `LICENSE` scaffolds. Over an app it is refused, `--force` included (`X_GENERATE_CONFLICT`), and the fix names a free directory (`<name>-2`), never `--force`. `As of 2026-11` |
|
|
93
|
-
|
|
94
|
-
**The name must be one `app.config.ts` accepts.** `x new` asks core's own `defineConfig` about the slug before anything is planned (`appNameIssue`, `packages/cli/src/app-name.ts`) — it is written verbatim as `name:`. Refused with `X_CLI_BAD_FLAG` and a corrected name in the `fix:`, the rest of your flags kept:
|
|
95
|
-
|
|
96
|
-
| You type | Why it is refused | `fix:` |
|
|
97
|
-
|---|---|---|
|
|
98
|
-
| `x new 9lives` | starts with a digit — core's pattern is `^[a-z][a-z0-9-]{1,63}$` | `x new app-9lives` |
|
|
99
|
-
| `x new a` | one character | `x new a-app` |
|
|
100
|
-
| a slug over 64 characters | past the pattern's bound | the slug cut at 64, trailing `-` dropped |
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
$ x new myapp --dry-run --json
|
|
104
|
-
{"ok":true,"command":"new","summary":"…","data":{"dir":"/home/me/myapp","files":["README.md","AGENTS.md",…],"dryRun":true}}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**This page states no file count, deliberately** — one template added moves it, and a number hand-copied onto four pages goes stale on three of them. `scripts/generator-counts.ts` is the single source: it re-derives both shapes from the CLI's own generators and, as a step of `x verify`'s `manifest` check, turns any page quoting a stale one red on the same commit. Two moves worth knowing about rather than counting: the scaffold gained `apps/web/app/auth/dev-actor.ts` and its test, because `hooks.authenticate` is the only place an actor can come from and a generated app configured none — so every route declaring a `policy:` refused every request and the boot warned `X_CONFIG_INVALID` on every start; and it gained `.github/workflows/ci.yml`, which runs `bun run setup && bun run verify` on every push and pull request. Derive the number:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
x new myapp --dry-run --json | jq '.data.files | length'
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
`--dry-run --json` lists every file, which is also how you check what a build target expects to find.
|
|
114
|
-
|
|
115
|
-
Deployment artifacts are part of the scaffold — an app is deployable the moment it is generated:
|
|
116
|
-
|
|
117
|
-
| Path | Why |
|
|
118
|
-
|---|---|
|
|
119
|
-
| `apps/web/server.ts` | the production entry: `runRole({ root, env: Bun.env })`. Also `--target binary`'s entry |
|
|
120
|
-
| `apps/web/prerender.ts` | `--target static`'s entry |
|
|
121
|
-
| `docker/Dockerfile` | `--target docker`'s entry. Defaults `ROLE=web`, `PORT=3000`, health-checks `/readyz` |
|
|
122
|
-
| `docker/Dockerfile.dockerignore` | **this exact name** — not a root `.dockerignore`. Drops `*.test.ts`, `*.test.tsx` and the root `docs/`; an app serving a file from `docs/` re-includes it with `!docs/<path>` |
|
|
123
|
-
| `docker/docker-compose.prod.yml` | one service per role: migrate, web, sync, worker, scheduler |
|
|
124
|
-
| `docker/docker-compose.dev.yml` | parity checks only; `x dev` needs none of it |
|
|
125
|
-
| `docker/helm/` | the chart, 12 files — `Chart.yaml`, `values.yaml` and 10 templates (`_helpers.tpl`, `_volumes.tpl`, `deployments`, `service`, `migrate-job`, `ingress`, `hpa`, `networkpolicy`, `servicemonitor`, `alert-rules`). Written `As of 2026-08-19`, which is what makes `x deploy --method helm` work in a scaffold; the last two render only where the cluster serves the Prometheus operator's kinds (`auto`) |
|
|
126
|
-
| `docker/README.md` | how the two compose files differ |
|
|
127
|
-
| `.github/workflows/ci.yml` | the generated app's own CI: `bun run setup` then `bun run verify`, on push and pull request — the same two commands its `README.md` opens with |
|
|
128
|
-
| `bin/setup.ts` | TypeScript Bun runs, never shell — `package.json`'s `setup` script (`bun bin/setup.ts`), so `bun run setup` is the same command in PowerShell, cmd and bash; `bun run dev` is `x dev` and `bun run verify` is `x verify`, and neither needs a file. There is no `bin/check.ts` `As of 30.0`: `x verify`'s `budgets` step builds when the stats are missing or stale, so a wrapper that built first would be a second name for the gate |
|
|
129
|
-
|
|
130
|
-
The framework repo's own `docker/helm` carries one template the scaffold does not — `pdb.yaml`, cluster policy rather than app topology. It ships in no npm tarball, so copying it is a `git clone` of this repo, not an install. An app chart from before the monitoring pair gets it from `x g chart-alerts`.
|
|
131
|
-
|
|
132
|
-
`bunx create-ultimate myapp` is the same generator without a global install — and it says so in its own refusals, `As of 2026-08-23`: a `fix:` line is a command the reader is meant to RUN, and `x new myapp` named a binary they have not installed yet. Errors: `X_GENERATE_CONFLICT` (the directory exists — `fix` is the same command with a free name, `<name>-2`; never `--force`), `X_CLI_BAD_FLAG` (no name given, or a path where a name goes), `X_BUN_VERSION`.
|
|
133
|
-
|
|
134
|
-
## x dev
|
|
135
|
-
|
|
136
|
-
**The ready line names the live feed, `As of 2026-09-05`:** `live=in-process` under the embedded
|
|
137
|
-
database (repository writes in this process reach subscribers — the bridge PGlite's missing
|
|
138
|
-
walsender needed), `live=replication` with a real `DATABASE_URL` (the WAL decoder, `--role
|
|
139
|
-
replicator` here or elsewhere), `live=none` without the `sync` role. `--json` carries it as
|
|
140
|
-
`liveFeed`. The app's MCP endpoint, when `apps/<app>/mcp.ts` exports one, prints as `mcp POST /mcp`
|
|
141
|
-
in the summary and `mcp` in `--json`; an app exporting several prints one line per endpoint, and
|
|
142
|
-
`--json` lists them all in `mcpPaths`, endpoint #0 first.
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
x dev [--port 3000] [--host 0.0.0.0] [--tls] [--role web,worker] [--once] [--json]
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
| Flag | Type | Default | Meaning |
|
|
149
|
-
|---|---|---|---|
|
|
150
|
-
| `--port` | string | `3000` | HTTP port. The `sync` role listens on `--port + 1` |
|
|
151
|
-
| `--host` | string | `localhost` | the interface every socket binds — web, `sync`, metrics: one decision. `localhost` or an IP literal (`0.0.0.0`, `::`, `192.168.1.5`, `[::1]`); a hostname or a typo is `X_CLI_BAD_FLAG`. `HOST` is not read here (the container's variable must not widen a dev shell). A wildcard is reported as `http://localhost:<port>`; `--json` carries `host` |
|
|
152
|
-
| `--tls` | boolean | `false` | the web listener serves https with a generated self-signed ECDSA certificate (no openssl, no dependency), cached in `.x/tls/` — `cert.pem`, `key.pem` (0600) — and regenerated when its names change or within 7 days of its 90-day end. It carries `localhost`, `127.0.0.1`, `::1` and a specific `--host` address. The summary prints the path; `--json` carries `tls.certPath` (`null` without the flag). Trust it once: `curl --cacert .x/tls/cert.pem`, or the OS keychain. No HSTS in dev — a browser pins it per host, every localhost port at once. The `sync` port and the metrics endpoint stay plaintext |
|
|
153
|
-
| `--role` | string | `web,sync,worker,scheduler` | comma-separated roles to run in this process |
|
|
154
|
-
| `--once` | boolean | `false` | boot, report, exit — for smoke tests and CI |
|
|
155
|
-
|
|
156
|
-
Boots the app: embedded Postgres (PGlite under `.x/pgdata`), the in-process event bus, a local
|
|
157
|
-
directory for S3, then every module under `apps/*/{site,app,api,shared}` and `packages/*/src` —
|
|
158
|
-
importing them IS the registration. What those modules registered is then served:
|
|
159
|
-
|
|
160
|
-
| Registered | Served as |
|
|
161
|
-
|---|---|
|
|
162
|
-
| `action` / `mutator` | `POST /api/<resource>/<verb>`, policy enforced by the pipeline |
|
|
163
|
-
| `route` | its URL, in its declared render mode, with that mode's cache headers |
|
|
164
|
-
| `job` | claimed off the real Postgres queue by the `worker` role |
|
|
165
|
-
| `task` | dispatched by the `scheduler` role |
|
|
166
|
-
| — | `/_x`, the dev dashboard from `@ultimat3/admin` |
|
|
167
|
-
|
|
168
|
-
A module that will not import becomes a finding on the result rather than a dead process, so the
|
|
169
|
-
dev loop stays reachable while something is broken.
|
|
170
|
-
|
|
171
|
-
**`/_x` stays loopback-only whatever `--host` binds, `As of 2026-11`:** a non-loopback `Host` is
|
|
172
|
-
`X_DEV_HOST_REFUSED` (421), and a non-loopback peer naming a loopback `Host` is
|
|
173
|
-
`X_DEV_PEER_REFUSED` (403) — the peer as the pipeline resolves it (`TRUSTED_PROXY_HOPS` honoured,
|
|
174
|
-
so a terminator in front forwards the real client's address). Bound to one specific non-loopback
|
|
175
|
-
address, nothing loopback listens: the summary prints `introspect none` and `--json`'s
|
|
176
|
-
`introspect` is `null`. Over `--tls` the same two checks hold.
|
|
177
|
-
|
|
178
|
-
**What it watches is decided before a descriptor is taken, and the ignore set is your own
|
|
179
|
-
`.gitignore`, `As of 2026-09-06`.** `x dev` walks the app root and opens one non-recursive watcher
|
|
180
|
-
per directory it admits, skipping an ignored one at descent rather than filtering its events
|
|
181
|
-
afterwards — a recursive watch on the root took an inotify descriptor per directory in the tree,
|
|
182
|
-
including `.git/`, `node_modules/` and the `.x/` this same process writes to continuously (measured:
|
|
183
|
-
110 descriptors on the reference app, 39 of them noise; 1901 on a monorepo root, 1490 of them
|
|
184
|
-
`.git/` and `node_modules/`, against a per-user budget of 8192 on many distributions). The rules are
|
|
185
|
-
git's own — an unanchored `coverage/` matches at any depth, a leading `/` or an inner slash pins the
|
|
186
|
-
pattern where it is written, `!` re-includes, a trailing `/` matches a directory and never a file —
|
|
187
|
-
and ignore files in ancestor directories up to the repository root count, so an app inside a
|
|
188
|
-
monorepo inherits it. Editing `.gitignore` re-reads it and re-walks the tree in place; no restart,
|
|
189
|
-
and nothing ever runs `git check-ignore`. Five directory names are ignored whatever your file says,
|
|
190
|
-
because it cannot be relied on to name them: `.git`, `.x`, `node_modules`, `.personal`, `.claude`.
|
|
191
|
-
**`dist` and `coverage` are not among them** — root-anchor them in your `.gitignore` (`x new` now
|
|
192
|
-
scaffolds `/dist/` and `/coverage/`) or an `apps/web/site/coverage/page.tsx` route is a directory
|
|
193
|
-
git will not commit and the dev loop will not reload. A save that touches five files is one reload,
|
|
194
|
-
and a save arriving while a reload is still building is one more reload after it, never a second one
|
|
195
|
-
racing it.
|
|
196
|
-
|
|
197
|
-
**What a reload changes, `As of 2026-09-27`.** Every file the process loaded is hashed on each
|
|
198
|
-
reload; a changed one — a component, a helper, a `.module.scss`, a Sass partial a sheet `@use`s, a
|
|
199
|
-
JSON catalog — leaves Bun's module registry together with every module that imports it, up to the
|
|
200
|
-
route modules, and the scan imports that chain again. A route module that comes back as a new
|
|
201
|
-
instance has its entry replaced, so the next request serves what is on disk; its islands are
|
|
202
|
-
re-bundled on the same tick, so the two are one generation; the `isr` store is emptied, so a page's
|
|
203
|
-
first render does not answer for its whole ttl. A save that will not import is a finding on `/_x`
|
|
204
|
-
and the last page that did import stays up. The replaced instances are collected — nothing is kept
|
|
205
|
-
per save ([`app-reload-graph.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/app-reload-graph.ts)).
|
|
206
|
-
|
|
207
|
-
A module that **defines a primitive** — it exports an entity, an action, a query, a mutator, a job
|
|
208
|
-
or a task, or it is `apps/web/api/index.ts` — is pinned: never re-evaluated, and the invalidation
|
|
209
|
-
stops at it: its exports are held by every importer and by a registry that refuses a second
|
|
210
|
-
definition of one name. **A save that reaches one restarts `x dev`, `As of 22.12`** — the pinned
|
|
211
|
-
module itself, or anything it imports: a slice's `service.ts` under its query, an admin page's view
|
|
212
|
-
under `defineAdmin`. `x dev` is a supervisor and a child: the child prints
|
|
213
|
-
`restarting: <saved file> under <pinned module> — …` on stderr, **retires its worker first** — it
|
|
214
|
-
stops claiming and waits for every running job to finish, aborting none (`As of 25.0.0`; before, the
|
|
215
|
-
drain cut off a job running past `drain.deadlineMs` with `X_DRAINING` and the next child ran it
|
|
216
|
-
again), printing `restart waits for <n> running job(s) to finish — …` while it waits, `Ctrl-C`
|
|
217
|
-
cutting the wait short at the drain deadline — then drains, releases the port, the lock
|
|
218
|
-
and the embedded Postgres, and exits `75`; the supervisor boots a fresh child on the same port
|
|
219
|
-
(`--port 0` is pinned to one free port before the first boot). Every other save stays the in-process
|
|
220
|
-
reload above, and `Ctrl-C` stops both. `--once` and an embedded `startDev()` are unsupervised: there
|
|
221
|
-
the save is `X_DEV_RESTART_REQUIRED` on `/_x` (or `startDev({ onRestart })` is called). With
|
|
222
|
-
`--json`, each child prints its own ready document. Until 22.12 such a save logged `reloaded` and
|
|
223
|
-
served the old code until a manual restart. The route's guard (`policy`) is read by the HTTP
|
|
224
|
-
pipeline at boot, so adding one is a restart too, and so is an edited site asset under an unchanged
|
|
225
|
-
stylesheet that names it with Sass `asset()`. Until 2026-09-27 only the edited route module itself
|
|
226
|
-
was re-imported (`?x-reload=<hash>`), and every component it imported stayed the cached one: `x dev`
|
|
227
|
-
logged `reloaded` and rendered the old component until a restart.
|
|
228
|
-
|
|
229
|
-
**The database is part of the verdict, `As of 2026-11-19`.** While the migrations on disk are ahead
|
|
230
|
-
of the database `x dev` serves, or an applied one was edited since, its banner is `✗ dev ready`
|
|
231
|
-
(`ok: false` under `--json --once`) with `X_APP_MIGRATIONS_UNAPPLIED` (fix `x db migrate`; `x stop --json && x db migrate && x dev`
|
|
232
|
-
where this server cannot apply it) or `X_MIGRATION_CONFLICT`, on
|
|
233
|
-
`/_x` too; it still serves. `x db migrate` or `x db rollback` beside it is
|
|
234
|
-
applied by this dev server, and the finding clears with no restart. A schema finding appearing or
|
|
235
|
-
clearing (`X_DB_DRIFT` after `x db gen`) no longer restarts the child — an entity edit still does,
|
|
236
|
-
as a pinned module — so `x db gen "…" && x db migrate` runs against a server that is up; after it
|
|
237
|
-
the terminal prints an `hmr` line, not a fresh banner, and `/_x` holds the verdict.
|
|
238
|
-
|
|
239
|
-
Without `--once` the process stays up until it is signalled. `Ctrl-C` runs the same three-phase
|
|
240
|
-
drain a production `SIGTERM` runs — stop accepting, finish in-flight, close — and only then
|
|
241
|
-
releases the embedded Postgres, the worker and the file watcher, so `.x/pgdata` is never left
|
|
242
|
-
locked by a process that has gone. `x mcp serve --transport http` behaves identically.
|
|
243
|
-
|
|
244
|
-
`/_x/<panel>` is one tab per panel; `?json=1` (or `accept: application/json`) returns exactly what
|
|
245
|
-
the tab draws. Eleven panels — the nine `@ultimat3/admin` ships plus the two only the CLI can
|
|
246
|
-
answer:
|
|
247
|
-
|
|
248
|
-
| Panel | Kills the question |
|
|
249
|
-
|---|---|
|
|
250
|
-
| `routes` | which URL renders how, with which budget |
|
|
251
|
-
| `timeline` | where did this request spend its milliseconds, and did it loop |
|
|
252
|
-
| `live` | why did this subscriber not get the row |
|
|
253
|
-
| `jobs` | which step failed, and what is queued |
|
|
254
|
-
| `db` | what is in the table, and does the schema match the migrations (read-only SQL) |
|
|
255
|
-
| `mail` | what did that email look like, in that locale |
|
|
256
|
-
| `cache` | which tags would this invalidation bust |
|
|
257
|
-
| `policy` | which clause decided, for which actor |
|
|
258
|
-
| `manifest` | is the committed `x.manifest.json` current |
|
|
259
|
-
| `services` | which database/events/storage this process is talking to, and its reload count |
|
|
260
|
-
| `boundaries` | which import crosses a surface or a layer |
|
|
261
|
-
|
|
262
|
-
`/_x` answers a loopback `Host` only — `localhost`, `*.localhost`, `127.0.0.1`, `[::1]` — and
|
|
263
|
-
refuses any other with `421` `X_DEV_HOST_REFUSED` (a DNS-rebound name is how a page reads a
|
|
264
|
-
loopback server). The `db` panel runs a statement on a same-origin `POST` only, inside a
|
|
265
|
-
`BEGIN READ ONLY` transaction that always rolls back:
|
|
266
|
-
`curl -sS -H 'accept: application/json' --data-urlencode 'sql=select 1' http://localhost:3000/_x/db`.
|
|
267
|
-
A `GET /_x/db?sql=…` is `X_METHOD_NOT_ALLOWED`; a cross-site `POST` is `X_CSRF_BLOCKED`.
|
|
268
|
-
|
|
269
|
-
Every one of the eleven answers in a `x dev` process. Three of them read facts only this process
|
|
270
|
-
holds, so nothing else can serve them: `timeline` is core's own spans, recorded by the exporter
|
|
271
|
-
`x dev` installs at boot (tracing is always on and free until one is configured); `cache` is the
|
|
272
|
-
report `invalidateTags()` already built, kept by `@ultimat3/cache`; `policy` is
|
|
273
|
-
`@ultimat3/policy`'s own `policyMatrix()` run over every capability an action or query gates,
|
|
274
|
-
against one actor per role the app declared with `defineRoles` plus the anonymous caller — never
|
|
275
|
-
a second reading of the actor. The matrix is evaluated with no row, and each cell's trace says so:
|
|
276
|
-
a row-level rule decides again on the real request.
|
|
277
|
-
|
|
278
|
-
`timeline` carries two SQL facts and they are not the same fact. `repeatedSql` is a **measurement**
|
|
279
|
-
over the trace: every statement text that appeared twice. `nPlusOne` is the **verdict** — one entry
|
|
280
|
-
per statement shape this request repeated past five, each carrying `X_N_PLUS_ONE_QUERY` or
|
|
281
|
-
`X_N_PLUS_ONE_WRITE` with the runnable `fix:`, counted with attribution applied and
|
|
282
|
-
`expectedQueryLoop` honoured. Only `x dev` installs the ledger behind it; a host that did not
|
|
283
|
-
answers `nPlusOne: null`, which is "nobody counted" and not "this request was clean". The same
|
|
284
|
-
verdicts reach three more places, never re-counted: `x dev`'s own findings (text and `--json`), the
|
|
285
|
-
browser error overlay for the request that looped, and one `logger.warn` per request per code.
|
|
286
|
-
|
|
287
|
-
`live` lists the registered live queries and notes that no subscriber list is attached —
|
|
288
|
-
`@ultimat3/realtime` does not retain a subscriber's matcher trace, which is the rest of that
|
|
289
|
-
panel's question. A panel whose source a host has not wired answers `ok: false` with the exact
|
|
290
|
-
wiring line rather than an empty tab, and a panel that can degrade says which half is missing
|
|
291
|
-
rather than rendering an empty one as an answer.
|
|
292
|
-
|
|
293
|
-
| Env | Unset means | Set means |
|
|
294
|
-
|---|---|---|
|
|
295
|
-
| `DATABASE_URL` | PGlite in this process | that Postgres |
|
|
296
|
-
| `NATS_URL` | in-process fanout | that NATS server — set, it is the bus for every role; a bus of the app's own is `transport` in `export const runtime = { … }` in `apps/<app>/runtime.ts` instead |
|
|
297
|
-
| `NATS_KV_BUCKET` | the KV bucket `x_presence` | that bucket — one per app on a shared cluster |
|
|
298
|
-
| `S3_ENDPOINT` | `.x/storage` on disk | that S3 |
|
|
299
|
-
|
|
300
|
-
`realtime.enabled: false` in `app.config.ts` drops the `sync` and `replicator` roles from the set `x dev` starts, and a container's `ROLE=sync` answers the same way — no node, so no live feed.
|
|
301
|
-
|
|
302
|
-
`migrate` is a real role but not a dev role: it runs once, as `x db migrate`; naming it under
|
|
303
|
-
`--role` is `X_CLI_BAD_FLAG`. `replicator` does run under `x dev --role replicator`, but stays out
|
|
304
|
-
of the default set — `x dev` with no `--role` still runs `web,sync,worker,scheduler`, because the
|
|
305
|
-
replicator takes a slot on a shared database. With `DATABASE_URL` unset the embedded PGlite still
|
|
306
|
-
serves no logical replication, so the role is refused, but `X_CLI_BAD_FLAG` now names the fix: set
|
|
307
|
-
`DATABASE_URL` to a Postgres with `wal_level=logical`. With `DATABASE_URL` set, the role starts for
|
|
308
|
-
real: advisory lock → `postgresChangeFeed()` → `changeFeedReplicator` → publish to the transport.
|
|
309
|
-
Errors: `X_CLI_BAD_FLAG`, `X_PORT_IN_USE` (names the holder's pid and directory; its fix names a port pair that is free when asked), `X_ENV_MISSING`, `X_DB_DRIFT`.
|
|
310
|
-
|
|
311
|
-
## x stop
|
|
312
|
-
|
|
313
|
-
```bash
|
|
314
|
-
x stop [--timeout 30s] [--json]
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
Ends **this checkout's** `x dev` and returns only once the next `x dev` there can boot. `As of 30.0`.
|
|
318
|
-
|
|
319
|
-
| Case | What happens | `--json` `data` |
|
|
320
|
-
|---|---|---|
|
|
321
|
-
| a live `x dev` holds `.x/dev.lock` | SIGTERM to the pid the lock names, then wait for the pid to exit and the lock to clear | `{ stopped: true, pid, port, waitedMs, drained: true }` |
|
|
322
|
-
| Windows | `kill` is TerminateProcess, so no drain runs; `x stop` clears the lock itself | `{ …, drained: false }` |
|
|
323
|
-
| no lock, or a lock naming a dead pid | nothing is signalled, exit 0. A stale lock is left for the next `x dev`'s preflight to clear | `{ stopped: false }` |
|
|
324
|
-
| a lock naming a live pid that is not the `x dev` that wrote it (a reused pid) | nothing is signalled, exit 0; the lock is cleared, under the boot's own guard and only while it still holds the bytes judged. `x db reset`/`status`/`diagnostics`/`recount` treat such a lock as no holder anyway (`liveDevLockChecked`, `packages/cli/src/dev-lock-live.ts`). `As of 2026-11` | `{ stopped: false, stale: true }` |
|
|
325
|
-
| the pid outlives `--timeout` | `X_DEV_STOP_TIMEOUT`, naming the pid; the lock stays | — |
|
|
326
|
-
|
|
327
|
-
| Flag | Type | Default | Does |
|
|
328
|
-
|---|---|---|---|
|
|
329
|
-
| `--timeout` | duration (`30s`, `2m`, `PT1M`) | core's default drain deadline (25 s) + the 5 s release floor + 5 s | how long to wait for the drain. An app that configured a longer drain passes it here: `x stop` loads no app |
|
|
330
|
-
|
|
331
|
-
**The lock is the only authority.** No `--all`, no port lookup, no process-name match: on a box shared by several agents, `pkill` ends someone else's server and `x stop` never does. Dev services an app runs beside `x dev` (its own compose file) are the app's to stop. `X_DEV_ALREADY_RUNNING`'s `fix:` is this command.
|
|
332
|
-
|
|
333
|
-
Errors: `X_DEV_STOP_TIMEOUT`, `X_CLI_BAD_FLAG` (a `--timeout` that is not a positive duration).
|
|
334
|
-
|
|
335
|
-
## x g
|
|
336
|
-
|
|
337
|
-
```bash
|
|
338
|
-
x g resource|action|mutator|backfill|job|route|policy|entity|query|task <name> [--feature f]
|
|
339
|
-
x g cron-job|purge|webhook-receiver <name> [--feature f] # a primitive factory's one call + tests
|
|
340
|
-
x g export-rows|import-rows <name> --feature f # the slice's table through storage + tests
|
|
341
|
-
x g island <name> [--at <dir>] # a client component on an otherwise static page
|
|
342
|
-
x g admin:page <name> --permission <perm> [--at <dir>] # a custom admin screen, guarded by construction
|
|
343
|
-
x g guard <name> # a convention this app enforces, as a build error
|
|
344
|
-
x g sign-in --password | --oidc <provider> # the app's one sign-in: pages, actions, boot guard
|
|
345
|
-
x g invite # the member invite: three actions and two pages over defineMemberInvite
|
|
346
|
-
x g chart-alerts [--print] # the chart's ServiceMonitor + alert rules, backfilled
|
|
347
|
-
x g chart-dashboard [--print] # the chart's Grafana dashboard + its ConfigMap, backfilled
|
|
348
|
-
x g app <name> # one more app workspace: apps/<name>/
|
|
349
|
-
x g package <name> # one more shared package: packages/<name>/
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
**`x g app <name>` / `x g package <name>`** (`As of 2026-11`) add a workspace to the monorepo: `apps/<name>/` (`package.json` + `tsconfig.json`) or `packages/<name>/` (manifest, README, `src/index.ts` and its test), named `@<scope>/<name>` with the scope read off the root `package.json` (`@acme/root` → `acme`). Nothing outside the new directory is edited: the root `workspaces` globs and tsconfig alias already reach it. A name the other kind already holds is `X_WORKSPACE_NAME_TAKEN` (both would install as `@<scope>/<name>`); one the same kind holds is `X_GENERATE_CONFLICT`. The run prints `bun install` then `bunx x verify --changed --dirty` (`data.next`). A workspace is no slice: it reads `--force` and `--dry-run` only, and any other `x g` flag (`--feature`, `--surface`, `--live`, `--admin`, `--locales`, `--at`, `--app`, `--permission`) is `X_CLI_BAD_FLAG`, fix the same run without it.
|
|
353
|
-
|
|
354
|
-
**`x g sign-in`** (`As of 2026-11`) is what a deployed scaffold needs to issue a session: before it, a production `web` role answered every policy-protected route `401` (`packages/cli/e2e/sign-in.e2e.test.ts` proves the after). Exactly one of the two flags, and no `<name>` — an app has one sign-in; anything else is `X_CLI_BAD_FLAG`, and so is any other `x g` flag it would ignore (`--feature`, `--surface`, `--at`, `--permission`, `--live`, `--admin`), and either flag on another generator. Its keys land in every catalog the app ships, or the ones `--locales` names, as every other generator's do. The auth slice lands under `apps/web/app/auth/` beside `x new`'s `auth.ts`, plus `apps/web/runtime.ts` and the edits in the last column. A dry run lists the deletions in `data.removed`, apart from `data.files`; a real run reports them under the same key:
|
|
355
|
-
|
|
356
|
-
| Shape | Writes | Also edits |
|
|
357
|
-
|---|---|---|
|
|
358
|
-
| `--password` | `sign-in/page.tsx` (a native form, 0 kB) posting to `createSession` over `login()`; `sign-in/second-factor/page.tsx` posting to `confirmSession` over `completeMfa()` (the sealed challenge travels in an HttpOnly cookie); `destroySession` over `logout()` + `signOutHeaders()`; `sign-in-guard.ts`; `apps/web/runtime.ts` — 22 files on a dry run in the default scaffold, 24 after setup | `apps/web/api/index.ts` (the three actions), `app.config.ts` (`auth: { signInPath: '/auth/sign-in' }`), the catalogs |
|
|
359
|
-
| `--oidc <provider>` | `oidc.ts` — `discoverOAuthProvider` on the FIRST sign-in, never at import — and `sign-in-routes.ts`, the `oauthLogin` legs on `runtime.routes`; the sign-in page (one link to `/auth/sso/<provider>`); `destroySession`; the guard — 20 files on a dry run (plus the two in `data.removed`), 22 after setup | as above, plus `<PROVIDER>_ISSUER`, `_CLIENT_ID`, `_CLIENT_SECRET` in `envSchema`; and **the authenticator swap**: `authenticator.ts` loses the development fallback and `dev-actor.ts` is deleted, only while all four files are byte-for-byte what `x new` wrote — an edited one is an `X_GENERATE_CONFLICT` finding naming the line to delete by hand |
|
|
360
|
-
|
|
361
|
-
The boot guard is generated, app-owned: `apps/web/runtime.ts` calls `assertSignInConfigured(process.env)` before the boot binds a port, and outside `development`/`test` a `web` or `sync` role with a sign-in key unset refuses to start — `X_AUTH_SIGN_IN_UNCONFIGURED`, fix `export <KEY>="<value>"` in the role's deployed environment, then restart it (`x env example` lists the keys). The keys: `ULTIMATE_SECRETS_KEY` for `--password` (it seals the second-factor challenge); the provider's three plus `SESSION_SECRET` and `APP_URL` for `--oidc`. A second `x g sign-in` is `X_GENERATE_CONFLICT` and writes nothing. `--password` keeps the development viewer: it ships no sign-up page, so the first user is `register(appAuth(), { email, password, orgId, roles })`. An app that already has an `apps/web/runtime.ts` is that conflict too — merge the two `runtime` objects by hand.
|
|
362
|
-
|
|
363
|
-
**`x g invite`** (`As of 2026-11-14`) is the member invite, as the app's own actions over `@ultimat3/auth`'s `defineMemberInvite` ([Auth](Auth#member-invites)) — the shape `x g sign-in` writes for `login()`. No `<name>` (an app has one), and any `x g` flag but `--force`, `--dry-run` and `--locales` is `X_CLI_BAD_FLAG`, fix `x g invite`. Under `apps/web/app/auth/`: `invite.ts` (the flow, its `defineMail` and the link to `/auth/invites/accept?orgId=…&token=…`, built on `APP_URL` — never the request's `Host`, which the caller writes; unset, `inviteMember` is `X_ENV_MISSING`, fix `export APP_URL=…`), `policy.ts` (`member:invite`, the actor's own org), `inviteMember` and `revokeInvite` behind it (revoke removes only an address that joined through an invite; owner protection is the app's rule in `policy.ts`), `acceptInvite` (public by declaration; refuses an anonymous caller, rotates the session), `invites/page.tsx` and `invites/accept/page.tsx` (native forms, 0 kB), a test beside each. Also edits: `apps/web/shared/roles.ts` (`member:invite` to `admin`), `apps/web/api/index.ts` (the three actions), `apps/web/exercise.ts` (each action `off`, with its reason — the pass holds no mailed token), the root `package.json` of an app scaffolded before `x new` declared `@ultimat3/mail` (at the range `@ultimat3/auth` has; run `bun install`), the catalogs. Who may invite, seat limits and the roles a joiner gets are those files', to edit. A second run is `X_GENERATE_CONFLICT`, and so is an API index already binding `inviteMember`. Proof: `bun test ./packages/cli/src/generate-invite.contract.test.ts` — a fresh scaffold, the run, `tsc`, Biome and the generated tests.
|
|
364
|
-
|
|
365
|
-
**`x g chart-alerts`** (`As of 2026-11`) writes the two monitoring templates `x new`'s chart carries into an app chart that predates them — `docker/helm/templates/servicemonitor.yaml` and `alert-rules.yaml`, named after `Chart.yaml`'s `name` — and appends the `serviceMonitor:` / `alerts:` blocks `values.yaml` lacks. Only what is missing: a template already there is kept (`--force` rewrites both), and a values key already there — `enabled: false` included — is never touched; both templates read a missing block as `auto`, rendering only where the cluster serves the Prometheus operator's kinds. A second run writes nothing. No `<name>`, and any other `x g` flag but `--force`/`--dry-run` is `X_CLI_BAD_FLAG`. **`--print`** writes nothing and needs no chart: the same rules as plain Prometheus rule groups, defaults in place, for a loader outside Kubernetes (`--json`: `data.rules`, the YAML text). No `docker/helm/Chart.yaml` is `X_CHART_MISSING`, fix `x g chart-alerts --print --json`. `x doctor` lists the missing templates. The rules: [Observability](Observability).
|
|
366
|
-
|
|
367
|
-
**`x g chart-dashboard`** (`As of 2026-11`) is the same backfill for the chart's Grafana dashboard: `docker/helm/dashboards/ultimate-app.json` (one column of panels over the series the framework declares — requests, latency by route, statements, pool, jobs, realtime, the process) and `templates/dashboard-configmap.yaml`, which ships it as a ConfigMap a Grafana sidecar provisions by label — plus the `dashboard:` block `values.yaml` lacks, `enabled: false` (`x new`'s chart writes the same three). The same rules as `chart-alerts`: only what is missing, `--force` rewrites, no `<name>`, `X_CHART_MISSING` with no chart. **`--print`** writes nothing and needs no chart: the dashboard JSON, to import into a Grafana outside Kubernetes (`--json`: `data.dashboard`).
|
|
368
|
-
|
|
369
|
-
`x g guard <name>` writes `guards/<name>.ts` and its test: the app's own convention, from the blank template. Every name in `SHIPPED_GUARD_NAMES` (`packages/cli/src/templates/scaffold-guards.ts`) already runs on `boundaries` from the installed framework; how one reports is a row in `guards/shipped.json` (`"error"`, `"warning"`, `"off"`). `x doctor` lists the copies of shipped guards an app still holds (`.data.guards.vendored`), and `x upgrade` migrates them ([Interface rules](Interface-Rules)).
|
|
370
|
-
|
|
371
|
-
**`x g cron-job` · `x g purge` · `x g webhook-receiver`** (`As of 31.17.0`) scaffold a primitive *factory*'s one declaration — each a factory over `job()`, never a ninth primitive — with its tests, into the feature's slice, listed in `apps/web/api/index.ts`'s `jobs:`. None reads a table, so a slice with no `entity.ts` is fine.
|
|
372
|
-
|
|
373
|
-
| Generator | Writes | What the declaration holds |
|
|
374
|
-
|---|---|---|
|
|
375
|
-
| `x g cron-job <name>` | `jobs/<name>.ts`, `<name>.job.test.ts`, `<name>.test.ts` | `cronJob({ name, cron: '0 3 * * *', tz: 'UTC', tenant: 'none' })` — the job and its `.schedule` task from one call, an explicit IANA zone, the org stripped so a tenant read fails closed |
|
|
376
|
-
| `x g purge <name>` | `jobs/<name>.ts`, `<name>.job.test.ts`, `<name>.test.ts`, `tasks/<name>-hourly.ts` | `purge({ name, entities: 'declared' })` — the sweep for every `retain` the schema declares (`X_ENTITY_RETAIN_UNSWEPT` without one), fired on `DEFAULT_PURGE_CRON` |
|
|
377
|
-
| `x g webhook-receiver <name>` | `jobs/<name>.ts`, `<name>.test.ts`, and the job's entry in `apps/web/exercise.ts` (a draw cannot sign an event, so `x exercise` queues a verified-shape one) | `webhookReceiver()` at `/hooks/<name>`: the exact bytes `verifyBodyHmac`-checked under `<NAME>_WEBHOOK_SECRET` (comma-separated, so a rotation keeps the old one live), the event read out of the signed body, queued, then acknowledged; an unreadable event is the app's own `X_<NAME>_UNREADABLE` |
|
|
378
|
-
|
|
379
|
-
**`x g export-rows` · `x g import-rows`** (`As of 2026-11`) are the two factory generators that DO read a table: the slice's own scaffolded one (`db.<plural>`, `title`, `price`), read off its `entity.ts` like `x g backfill`. A `--feature` with no `entity.ts` is `X_FEATURE_REQUIRED`; one whose entity is shaped otherwise is `X_ROWS_SLICE_ENTITY`, fix a `x g job` to declare the call in by hand. Both write `jobs/<name>.ts`, `<name>.job.test.ts` and `<name>.test.ts` (the pass run in process against a memory disk), and read storage through `disk()` — `@ultimat3/storage`, in a new app's dependencies.
|
|
380
|
-
|
|
381
|
-
| Generator | What the declaration holds |
|
|
382
|
-
|---|---|
|
|
383
|
-
| `x g export-rows <name> --feature f` | `exportRows({ input: { orgId, exportId }, tenant: ({ orgId }) => orgId, source: db.<plural>.where({ orgId }), format: 'csv', columns, row, sink: () => disk() })` — one org's rows, Money as minor units + currency, dates as UTC instants, parts under `exports/<name>/<orgId>/<exportId>/` |
|
|
384
|
-
| `x g import-rows <name> --feature f` | `importRows({ input: { orgId, key }, tenant, source: () => disk(), schema, handle })` — the input refines `key` onto `imports/<name>/<orgId>/` (`key-in-own-org`, no `..`), so an import never reads another org's upload and the run's dedupe key is per org; `handle` is `upsertAll(…, { onConflict: ['id'], onMatch: 'nothing' })`, so a replayed page writes nothing twice and never another org's row; refused rows by line under `imports/<name>/<orgId>/errors` |
|
|
385
|
-
|
|
386
|
-
Every other factory, and why no generator writes it (`rollup`, `webhook`, `llm`, `agentJob`, …): `FACTORY_GENERATORS` in `packages/cli/src/generate-factories.ts`, held complete against `PRIMITIVE_FACTORIES` by its test.
|
|
387
|
-
|
|
388
|
-
Alias: `x generate`.
|
|
389
|
-
|
|
390
|
-
`<name>` is one directory segment for every generator but `route`, whose name is its URL:
|
|
391
|
-
`x g route casos/[id]/notificar` writes `apps/web/app/casos/[id]/notificar/page.tsx`. Each segment
|
|
392
|
-
is a word (`a-z`, `0-9`, `-`, `_`) or `[param]` / `[...rest]`; `..`, `.` and empty segments are
|
|
393
|
-
`X_CLI_BAD_FLAG`.
|
|
394
|
-
|
|
395
|
-
| Flag | Type | Default | Meaning |
|
|
396
|
-
|---|---|---|---|
|
|
397
|
-
| `--feature` | string | derived from the name | feature slice to write into. Not for `resource`: its name IS the slice (`app/<name>/`, page at `app/<names>/`), and a `--feature` naming anything else is `X_CLI_BAD_FLAG` |
|
|
398
|
-
| `--surface` | string | `app` | `site` or `app` |
|
|
399
|
-
| `--app` | string | `web` | `route`, `island`, `query` only: the app workspace under `apps/` the files land in (`x g route reports --app admin` → `apps/admin/app/reports/page.tsx`). An app that is not there is `X_CLI_BAD_FLAG`, fix `x g app <app>`; any other generator registers in files only `apps/web` holds (API index, roles, exercise file, db handle) and refuses it, fix the same run without the flag |
|
|
400
|
-
| `--permission` | string | `<name>:read` | `admin:page` only: the permission the page's own work needs, on top of the frame's `admin:read`. A `<resource>:<verb>`, or namespaced with more segments (`admin:blog:write`, `As of 27.6.2` — one colon exactly was required, which refused every `admin:<area>:<verb>` a staff console declares); an empty segment, a space or a quote is `X_CLI_BAD_FLAG` before a file is written — the value reaches the emitted source three times and `Permission` is `${string}:${string}` |
|
|
401
|
-
| `--live` | boolean | `false` | `query` only: make it subscribable. On any other generator it is `X_CLI_BAD_FLAG` naming the `x g query … --live` to run instead |
|
|
402
|
-
| `--admin` | boolean | `false` | `resource` only: also emit the per-entity admin override **and list it** under `resources:` in `apps/admin/app/admin/admin.ts`. The screen itself needs no flag — an entity in the handle is an admin screen |
|
|
403
|
-
| `--locales` | string | every locale with a catalog in `packages/i18n/catalogs/`, else `en` | comma-separated locales; lands each generator's catalog entry in every one. **Never starts a catalog** in an app that has any: a non-default locale with no `packages/i18n/catalogs/<locale>.json` is `X_CLI_BAD_FLAG`, `fix: x i18n add <locale>`, before a file is planned — a catalog a generator started would hold only its own keys. A non-default locale's new keys land marked `⟦…⟧`, as `x i18n add` seeds them, so `x i18n check` reports them until translated. In an app with no catalogs yet, a first `--locales en,es` writes `en` bare and `es` marked. `As of 2026-10-06` (`localiseCatalogs`, `packages/cli/src/generate-catalog-locales.ts`) |
|
|
404
|
-
| `--password` | boolean | `false` | `sign-in` only: an address and a password over `login()` |
|
|
405
|
-
| `--oidc` | string | — | `sign-in` only: an OpenID Connect provider id (`corp-sso`; lowercase, digits, hyphens, not a built-in), discovered from `<PROVIDER>_ISSUER` |
|
|
406
|
-
| `--print` | boolean | `false` | `chart-alerts` and `chart-dashboard` only: print the alert rules as plain Prometheus rule groups, or the dashboard as Grafana JSON, write nothing. On any other generator it is `X_CLI_BAD_FLAG` |
|
|
407
|
-
| `--force` | boolean | `false` | overwrite existing files |
|
|
408
|
-
| `--dry-run` | boolean | `false` | the write plan, nothing written: **every file the run would touch** — the ones it creates (a slice module already on disk is skipped, not listed) and, `As of 27.6.2`, the ones it EDITS outside the slice (role map, typed handle, API index, manifests, catalogs, the i18n index), in the order the run lists them. `--json`: `data.files` is that list, `data.edits` the subset that already exists, `data.refreshes` the committed contracts (`x.manifest.json`, `openapi.json`) a real run re-projects. `ok: false` with every finding the real run would report — an existing file, an API-index binding already held, a grant or a handle entry it cannot place |
|
|
409
|
-
|
|
410
|
-
`resource` emits the whole slice — `entity`, `repo`, `policy`, `errors`, `service`, `actions`, `live`, `jobs`, `ui`, the form island, the plural route and a test beside each declaration — **38 files** on a dry run in an app scaffolded with its example slice, 40 on the real run after `bun run setup` (`x.manifest.json` and `openapi.json` re-projected; 41 dry with `--admin`) — and `x g resource` in a `--no-example` app, which also gains two `package.json` edits, writes 40 and 42 files (43 and 45 with `--admin`; `--live` is refused — a resource already ships a live query, and the flag belongs to `x g query`: `X_CLI_BAD_FLAG`, fix `x g query <name>-feed --feature <name> --live`), and **no migration**: `x db gen` is the only writer of `packages/db/migrations`, so a new slice is `x g resource <name>`, then `x db gen "create <table>"`, then `x db migrate`, then `x build --target static && x verify --only budgets` — the four commands the run prints, in that order (`data.next` under `--json`). **The plural route is reachable as written**, `As of 2026-10-01`: its `load` reads the list through the slice's query as the request's actor (no org in the URL), `AsyncRegion` renders ready, empty and refused, the form island is mounted, and the route declares `policy: { permission: '<name>:read' }`. Its `budget.js` is MEASURED on `x new`'s app (58,522 B, Bun 1.4.0) and carries the `measured:` / `why:` comment `bun run budget-raises` reads; an app that charges more to every document — `navigation: { client: [...] }` adds its router — is over it on the printed build, and the raise is that edit. The page sits in `apps/web/shared/shell.tsx` when the app has one. `backfill` emits a `backfill()` declaration with its `source()` and `handle()` to fill in — see [Migrations and backfills](Migrations-And-Backfills). **`x g query` and `x g backfill` read a table and never create one**, `As of 2026-11-02`: both name a slice holding an `entity.ts`, by `--feature <slice>` or by a name that is one, and neither finding it is `X_FEATURE_REQUIRED`, zero files written, its fix the closest slice's `--feature` line or `x g resource <name>`. `x g resource` and `x g entity` are what create a table. Every generator produces code that passes `x verify` unmodified, and writes it through the app's own Biome when the app has one: `node_modules/.bin/biome` over the TypeScript files that run created, best effort, never a failed `x g`. A slice whose `entity.ts` declares another table under its name gets no foundation from `x g action`/`x g mutator`, and `x g query` there is `X_QUERY_SLICE_ENTITY`. A written contract test reads its exercise from `apps/web/exercise.ts` (`target.contract({ exercise })`), and the same run inserts its entry there — once, the file created from `x new`'s when absent, `As of 2026-11-08`; a file that is not one `export const exercise = defineExercise({ … })` is `X_EXERCISE_FILE_UNEDITABLE`, the entry to paste in its `fix:`. Errors: `X_GENERATE_CONFLICT`, `X_DB_HANDLE_UNREGISTERED`, `X_FEATURE_UNKNOWN`, `X_FEATURE_REQUIRED`, `X_QUERY_SLICE_ENTITY`, `X_EXERCISE_FILE_UNEDITABLE`.
|
|
411
|
-
|
|
412
|
-
**A generated read answers the slice's `<Feature>View`, not the whole row** (`As of 2026-11-19`): `x g query` and `x g resource` project each row through `viewOf` in the query's `sql:` provider (`from<XView>(…)`), so no tenant column reaches the wire and a column added to the entity is published only by an edit to the view, live patches included. That holds when the run writes the scaffold entity or the slice's `entity.ts` declares `XView = x.$view([...])` over `id`, `title` and `createdAt` (the columns the read orders by); otherwise the read answers the row as before. Files generated earlier are untouched.
|
|
413
|
-
|
|
414
|
-
**A name the templates would mangle is `X_CLI_BAD_FLAG` before anything is planned**, each with a `fix:` that runs: a reserved word or a leading digit; a letter outside ASCII (`Über` → `x g entity uber` — it was dropped to `ber`); an already-plural `resource`/`entity` name (`posts` → `x g resource post` — it became `entity('postses')`); and a name whose type spelling an emitted file also uses as a global or local type (`promise`, `omit`, `partial`, `row` → `x g resource promise-resource`).
|
|
415
|
-
|
|
416
|
-
**`entity` and `resource` write a repo over the typed handle, and register the entity in it**, `As of 2026-10`. The generated `repo.ts` holds no `sql` literal, no row decoding and no tenant predicate of any kind — `byId(id)`, `list(limit)` and `insert(row)` read `db.<table>`, and the handle scopes each to the actor's org ([Entities and migrations](Entities-And-Migrations#the-repo)) — and a table is on the handle only when its entity is in the set `packages/db/src/client.ts` passes to `database()`. The generator makes that edit, and four more:
|
|
417
|
-
|
|
418
|
-
| Edited | What lands | When it cannot |
|
|
419
|
-
|---|---|---|
|
|
420
|
-
| `packages/db/src/client.ts` | the entity's import, and `<table>: <entity>,` in `const entities = { … }`, in key order. Created whole only where the db package would export it: its `index.ts` names `./client`, or it has no index. **Never created in a db package of the app's own** (`As of 27.6.2`: an `index.ts` that exports no handle — a schema and a seed over `@ultimat3/db`'s client) | `X_DB_HANDLE_UNREGISTERED`, exit 1, the two lines in the `fix:` — the files are written, the handle is not. In an app with its own db package the finding sits on `index.ts` and says the generated repo expects `database()`'s handle |
|
|
421
|
-
| `packages/db/src/index.ts` | nothing — it is checked: it must export from `./client` | `X_DB_HANDLE_UNREGISTERED` naming the export line |
|
|
422
|
-
| `packages/db/package.json`, `apps/web/package.json` | the workspace dependency each new import needs: `@<app>/db` in the app, and `@<app>/web` in the db package only when the handle this run leaves imports an entity from it. Planned with the handle edit and written together — a handle that refuses the entry leaves both manifests untouched | left to `package-shape` (`X_WORKSPACE_DEP_UNDECLARED`), whose `fix:` is the same line |
|
|
423
|
-
| `packages/i18n/catalogs/<locale>.json` | the labels the admin reads for the new screen — `admin.<table>.title` and one `admin.<table>.field.<column>` per column — merged in the file's OWN key order (a sorted level stays sorted, a hand-ordered one gains its keys at the end), in every locale the run writes to | — |
|
|
424
|
-
| `apps/web/shared/roles.ts` | a written `policy.ts`'s grants (`<feature>:read` to `member`, `<feature>:write` to `admin`) and the admin's three per-table permissions, declared and granted. A permission is declared only where its grant can be placed, and one any `definePermissions([…])` call already declares is not declared again | `X_PERMISSION_UNGRANTED`, exit 1, naming each role and the permissions its `grants` owes — an app whose role map lives elsewhere, has no such role, or holds a list that cannot be edited safely is told, and the file is left byte-identical |
|
|
425
|
-
| `apps/web/api/index.ts` | every action, query, job and task module the run wrote, imported and listed under `actions` / `queries` / `jobs` / `tasks` — the lists `Api`, the typed client's shape, is read from | left alone when the file is not `defineApi({ actions: [...] })`; `X_JOB_UNREGISTERED` on the `manifest` step names a job nothing lists. A module whose binding (its file name, camelCased) the index already holds — another feature's `reindex-post`, or `api` / `defineApi` / `health` — is `X_GENERATE_CONFLICT` **before anything is written**, fix: the same run with the feature as a prefix |
|
|
426
|
-
| `apps/admin/app/admin/admin.ts` (`--admin` only) | the override's import, and `<table>: <name>AdminResource,` under `resources:` — the block is created, last in the call, when there is none | `X_ADMIN_RESOURCE_UNWIRED`, exit 1, the two lines in the `fix:` |
|
|
427
|
-
|
|
428
|
-
The summary line ends with what the new table owes, as commands that run as printed, and `--json` carries them as `data.next`:
|
|
429
|
-
|
|
430
|
-
```
|
|
431
|
-
✓ wrote 7 file(s) for entity widget — next: bunx x db gen "create widgets" && bunx x db migrate
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
`bun install` leads the list when a manifest gained a dependency. `--dry-run` runs the same edits against the plan held in memory, so it lists every file above that the run would change (`As of 27.6.2`; it listed the generator's own files only).
|
|
435
|
-
|
|
436
|
-
**An edit to a file the app owns is syntax-aware, and refused rather than guessed**, `As of 27.6.2`. Every list a generator grows — a role's `grants`, `definePermissions([…])`, a `defineApi` list, the handle's entity set — is located on the source with comments and literal contents masked (`packages/cli/src/source-list-edit.ts`), so an apostrophe, a bracket or a comma inside a comment is never code. A list holding a comment gains rows and no existing byte moves; a comment-free one is re-wrapped the way Biome prints it. The result is read back before it is written — the same entries plus the new ones, the text around it untouched — and an edit that does not read back that way is the finding in the table above, never a write. (`x g entity` read each apostrophe in a role map's comments as a string delimiter and rewrote the comments between two of them into permissions.)
|
|
437
|
-
|
|
438
|
-
**A feature's second entity is a sibling file**, `As of 27.6.2`. `x g entity <name> --feature <feature>` in a slice whose `entity.ts` declares another table writes `entity-<name>.ts`, `entity-<name>.test.ts`, `repo-<name>.ts` and `repo-<name>.test.ts` beside it — one file per table, nothing the author wrote edited — and registers it exactly as a first entity: handle, role map, admin labels, `data.next` naming its own table. It was `X_GENERATE_CONFLICT` on the first entity's four files, with a `--force` that would have written the second table over the first. The same entity again is still that conflict, on its own files. `x db gen` reads the entity registry, so a sibling is in the next migration because it is declared. The other generators (`action`, `query`, `job`, …) keep reading the slice's `entity.ts` and `repo.ts`: a primitive over a sibling's table imports `./repo-<name>` by hand.
|
|
439
|
-
|
|
440
|
-
**Catalog writes are the labels the admin reads**: `x g entity`, `x g resource` and `x g admin:page` merge their keys (`admin.<table>.title`, `admin.<table>.field.<column>`; `admin.<name>.title` for a page) into every locale the app has a catalog for — the default locale bare, each other locale marked `⟦…⟧` exactly as `x i18n add` seeds it, so `x i18n check` reports them as owed rather than rendering a raw key. Existing keys always win. `--dry-run` lists each catalog it would change; `--locales <one>` narrows the run to the catalogs named.
|
|
441
|
-
|
|
442
|
-
**`x g admin:page` DECLARES the permission it requires**, `As of 2026-09`. It emitted
|
|
443
|
-
`permissions: ['ops:read']` and nothing anywhere declared `ops:read`, so `assertPermission` threw
|
|
444
|
-
`X_PERMISSION_UNKNOWN` on the first request that reached the page — a screen the generator built
|
|
445
|
-
and no actor could open, under a green gate: the `policy` step reads `roleDefinitions()` and
|
|
446
|
-
`routeEntries()`, and an admin page is neither a role nor a route. The page file now carries the
|
|
447
|
-
`definePermissions([...])` call and the `PermissionRegistry` augmentation beside its
|
|
448
|
-
`AdminCustomPage`, and its emitted test fails if either is dropped. Registration is a side effect
|
|
449
|
-
of import and `pages:` already imports that module, which is why the declaration is in the page and
|
|
450
|
-
not in a `policy.ts` beside it. Since 27.2.0 a `policyAuthz()` map that omits the permission decides it by the role map, so
|
|
451
|
-
the role grant is the one declaration; a map entry only refines it. The page
|
|
452
|
-
lands in `apps/admin/app/admin/pages/` without `--at` — beside the declaration, inside the app scan
|
|
453
|
-
(`DEFAULT_ADMIN_PAGE_DIR`); `apps/admin/src/pages`, the old default, was never imported.
|
|
454
|
-
|
|
455
|
-
**A narrower generator plants the slice modules its own source imports**, `As of 2026-08` — they used to be `x g resource`'s alone, so `x g job` into a hand-written slice emitted `import * as repo from '../repo'` against a file nobody had written. Which modules differ per generator, on purpose: a job has no request behind it and evaluates no policy, so `x g job` plants no `policy.ts`.
|
|
456
|
-
|
|
457
|
-
| Generator | Files into a **bare** slice | Its own | Slice modules it plants |
|
|
458
|
-
|---|---|---|---|
|
|
459
|
-
| `x g action` · `x g mutator` | 5 | 3 — the declaration, a unit test and a `.contract.test.ts` | `policy.ts` + `policy.test.ts`; `errors.ts` only when its body reads a row: a slice with an entity whose repo exports `byId` |
|
|
460
|
-
| `x g query --feature <slice>` (± `--live`) | refused: no `entity.ts` is `X_FEATURE_REQUIRED` | 2 | what the slice lacks of `repo.ts` + `repo.test.ts`, `policy.ts` + `policy.test.ts`; never `entity.ts` |
|
|
461
|
-
| `x g job` | 2 | 2 | none — a slice with no entity gets the neutral body, never an invented table |
|
|
462
|
-
| `x g backfill --feature <slice>` | refused: no `entity.ts` is `X_FEATURE_REQUIRED` | 2 | what the slice lacks of `repo.ts` + `repo.test.ts`; never `entity.ts` |
|
|
463
|
-
| `x g task` | 4 | 4 — the task **and** the job it enqueues | none |
|
|
464
|
-
| `x g entity` · `x g policy` | 5 · 2 | all of them — `x g entity` counts the catalog it merges its admin labels into | it *is* the slice module |
|
|
465
|
-
|
|
466
|
-
`repo.ts` is never planted alone: it imports `./entity` for its row type, so the pair goes in together or the unresolved import has only moved — and `repo.test.ts` rides with it, running the repo against the in-memory driver. An entity planted this way is registered in the handle exactly as `x g entity`'s is. Counts re-derive with `--dry-run --json` (`data.files`), `As of 2026-10`.
|
|
467
|
-
|
|
468
|
-
**A module the slice already has is skipped — never a conflict, never overwritten, `--force` included.** A foundation module belongs to the slice, not to the generator that needed it, and `--force` is about the primitive you named: clobbering `policy.ts` to regenerate one action would delete every rule in it. Regenerating a slice module is its own generator — `x g entity`, `x g policy`. So a second `x g action` into a finished slice writes exactly its own 3 files, and one into a half-built slice writes only what is missing.
|
|
469
|
-
|
|
470
|
-
**`x g action` and `x g mutator` complete nothing a slice's author wrote.** A module already on disk gets no companion from them — no `entity.test.ts`, `repo.test.ts` or `policy.test.ts`, no admin catalog labels — because those assert the shape `x g resource` writes, not the one that is there. A `repo.ts` with no `byId` gets the lookup-free body. And a hand-written `policy.ts` that does not export what the generated file imports (`can<Feature>Write`; for an action also `<feature>Tag`) is refused before anything is written: `X_SLICE_POLICY_INCOMPLETE`, naming the file and the missing exports. A destructured export counts, one level of relative `export * from` is followed, and a barrel that cannot be followed (a package) is never refused. Into such a slice the generated unit test grants what the policy grants — the one permission of a literal `can('<perm>')` — and when that cannot be read it makes no handler assertion and says so in a comment; the contract test makes no foreign-org assertion against a policy it did not write. `As of 2026-10`.
|
|
471
|
-
|
|
472
|
-
**Every generated entity is tenant-scoped, and there is no `--no-tenant` flag**, `As of 2026-09-05` — decided rather than omitted. `orgId` is not one generator's: `x g action`, `x g query`, `x g policy` and `x g job` all decide on it too, so a flag on `x g entity` alone would leave `x g resource` emitting an action over a column its entity no longer has. A single-tenant app makes the edit per slice, and the emitted `entity.ts` names it in the comment above `tenant: 'orgId'`: delete that line and the `orgId: uuid()` column, drop `'orgId'` from `indexes`, let `entity.test.ts` expect `$tenantColumn` null and `orgScoped` false, and drop `orgId` from `repo.test.ts`'s draft along with its last two tests, and let `policy.ts`'s write rule stop reading `input.orgId`. `repo.ts` needs no edit: it names no org. From then on `x g action` and `x g mutator` read the slice as `x g job` does, `As of 2026-11-02`: no `orgId` in the input, either test or a policy they plant. A `policy.ts` still deciding on `input.orgId` keeps it in the input, because the action compiles against the rule it imports and that file is the author's.
|
|
473
|
-
|
|
474
|
-
**The filename carries the test's type**, `As of 2026-08-19` — `x verify` selects a suite by it, so a generated test that landed in a plain `*.test.ts` ran under `unit` and `x test contract` answered `X_TEST_NO_FILES`:
|
|
475
|
-
|
|
476
|
-
| Generator | Test filename it writes | Step that runs it |
|
|
477
|
-
|---|---|---|
|
|
478
|
-
| `x g action` · `x g mutator` | `<name>.test.ts` **and** `<name>.contract.test.ts` | `unit`, `contract` |
|
|
479
|
-
| `x g query --live` | `<name>.live.test.ts` | `live` |
|
|
480
|
-
| `x g job` · `x g task` · `x g backfill` | `<name>.job.test.ts` | `job` |
|
|
481
|
-
| `x g cron-job` · `x g purge` | `<name>.job.test.ts` **and** `<name>.test.ts` | `job`, `unit` |
|
|
482
|
-
| `x g webhook-receiver` | `<name>.test.ts` | `unit` |
|
|
483
|
-
| `x g export-rows` · `x g import-rows` | `<name>.job.test.ts` **and** `<name>.test.ts` | `job`, `unit` |
|
|
484
|
-
| `x g query` (not live) · `x g entity` · `x g policy` · `x g route` | `<name>.test.ts` | `unit` |
|
|
485
|
-
|
|
486
|
-
`--force` writes the new name and does not touch a file under the old one, because the old name is not in its output list. Delete the orphan by hand.
|
|
487
|
-
|
|
488
|
-
The synopsis above is `GENERATORS` in `packages/cli/src/cmd-generate.ts`, which `x g --help` prints verbatim — run it if this list and the CLI ever disagree.
|
|
489
|
-
|
|
490
|
-
## x db
|
|
491
|
-
|
|
492
|
-
```bash
|
|
493
|
-
x db gen "add publish_at" [--merge-fork] | migrate | rollback [--steps n] | reset
|
|
494
|
-
| seed [<name>] [--tier reference|dev] [--dry-run] [--json]
|
|
495
|
-
| branch list | branch create <name> | branch delete <name>
|
|
496
|
-
| backfill --list [--name n] [--status s] [--limit n] [--json]
|
|
497
|
-
| backfill --pending [--json]
|
|
498
|
-
| backfill <name>|--all [--write] [--force] [--json]
|
|
499
|
-
| diagnostics [--limit n] [--json]
|
|
500
|
-
| status [--json]
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
| Subcommand | Does | Notes |
|
|
504
|
-
|---|---|---|
|
|
505
|
-
| `gen ["<name>"]` | diff the app's entities against what the migrations declare, write the next migration, then rewrite the schema dump | One run at a time per checkout, `As of 2026-11`. The summary names the tables the migration touches (`data.tables`); a run with nothing to write names the newest migration (`data.newest`), which a concurrent run may have written. A forked chain is refused first (`X_MIGRATION_FORKED`). the message becomes the id's slug; left out it is `change`. **Writes to no database of yours** — the diff reads the previous migration's snapshot, and the dump is replayed on a scratch database it boots and discards: the embedded one, restored from a snapshot under `.x/cache` after its first boot, or a real Postgres when a migration creates an extension PGlite cannot link ([the engine rule](Migrations-And-Backfills#extensions-and-the-scratch-database)). **Exit 1 with a migration written** is possible: the dump failed after the migration was generated, the summary and the finding both say so, and the next move is a bare `x db gen`, never the same message again. A bare `x db gen` with nothing to generate rewrites `packages/db/schema/` alone, which makes it `X_SCHEMA_DUMP_DRIFT`'s whole fix. On the **embedded** database it first reads the ledger once (through a running `x dev`, else a read-only open of `.x/pgdata` when it exists; `As of 2026-11-19`): an applied migration whose SQL was edited since is `X_MIGRATION_CONFLICT`, exit 1, nothing written — the dump is never rewritten to match an edit. A ledger it cannot read is a printed line, never a refusal; an external `DATABASE_URL` is never dialled. A change that needs a step outside the transaction is written as two migrations, `<id>` and `<id>_concurrently`, and the summary names both. When the app does not load, nothing is compared and the summary says so — *nothing was compared — the app did not load (N finding(s)); fix them, then run x db gen again* — never "no migration needed". `--json`: `data.schemaDump` = `{ directory, status, files, written, removed }`, `status` one of `written`, `unchanged`, `skipped` (no migration yet), `failed`. `--allow-destructive` lets it emit a drop whose `down` cannot restore the rows; `--rolling-unsafe` lets it drop a column never retired, for an app that stops before it starts → [A column drop takes two releases](Migrations-And-Backfills#a-column-drop-takes-two-releases) |
|
|
506
|
-
| `migrate` | apply pending migrations, verify the result, then rewrite the schema dump | literally `ROLE=migrate`'s own `runMigrations` — which ends by diffing the live schema against the ledger it just wrote, on the connection it already holds. A difference is `X_DB_DRIFT` and a non-zero exit. Beside a live `x dev` holding the embedded database it is **applied by that dev server** (`POST /_x/db/migrate`, loopback and same-origin only), never by a second process: PGlite takes no lock of its own, and a second writer's tables are dropped by the holder's next write. The report, drift and dump are the same either way. The request sends `Sec-Fetch-Site: same-origin`, so an app's CSRF check admits it, and a holder still booting is waited for (up to 120 s; only a refused connection is retried, so a sent request is never sent twice). Applied that way, `x dev` serves the new schema without restarting. A holder that cannot answer (older server, dead port) or runs `database.rowSecurity` (it serves as `x_app`, which cannot migrate) is `X_DEV_ALREADY_RUNNING`, fix `x stop --json && x db migrate && x dev` (`As of 2026-11-19`; against an external `DATABASE_URL` it runs as always). Then, `x db migrate` only: the dump is regenerated as `gen` does, and the database is reopened to report any trigger, function, view, type or sequence no migration creates (`unexpected-object`, also `X_DB_DRIFT`). `--json` carries the same `data.schemaDump` |
|
|
507
|
-
| `rollback [--steps n]` | reverse the most recently applied migration(s), most recently applied first (`applied_at`, not id), by running each file's `-- down` half | default 1 (`--steps` is an integer ≥ 1, read before anything opens). The files stay, so each is pending again: `x db migrate` re-applies it, deleting its `.sql` / `.snapshot.json` / `.hash` drops the change. No `-- down` marker in the file: `X_MIGRATION_IRREVERSIBLE` (an empty `down` under the marker reverses with no statement). A ledger row whose file is gone: `X_MIGRATION_CONFLICT`. On a named deploy (staging or production, `NODE_ENV=production` included), an `ULTIMATE_ENV` that names no environment, or — whatever the environment — an external `DATABASE_URL` whose host is not this machine (loopback or a local socket): `X_MIGRATION_ROLLBACK_DESTRUCTIVE` until `ROLLBACK_ALLOW_DESTRUCTIVE` names every id it would reverse — judged under the migrate lock against the rows it is about to reverse. Beside a live embedded `x dev` it is run by that server (`POST /_x/db/rollback`), as `migrate` is; a request that reached it and lost its answer may have run, so its `X_DEV_ALREADY_RUNNING` fix is `x stop --json && x db status && x dev` — read the ledger, never the rollback again (only a refused connection repeats it). A change `gen` wrote as `<id>` + `<id>_concurrently` takes `--steps 2`; one step reverses the second half and names `<id>` as still applied. An index-only change is one non-transactional migration under the plain id, whole: no such line. `--json`: `data` = `{ reverted, steps, files }`. `As of 2026-11-19` |
|
|
508
|
-
| `reset` | delete the embedded data directory, then migrate | **embedded database only** — against an external Postgres it exits `X_NOT_IMPLEMENTED` and tells you to drop and recreate it yourself |
|
|
509
|
-
| `seed [<name>]` | apply the app's seeds — every one this environment takes, or the one named | **replayable**: a second run writes nothing and raises nothing, on Postgres as well as in memory. One transaction per seed, so one bad fixture graph cannot roll back the seeds that already landed. `--dry-run` reports what each would write and writes nothing. Beside a live `x dev` holding the embedded database, `seed` (`--dry-run` and `--generate` included) is refused `X_DEV_ALREADY_RUNNING`, its fix `x stop --json && x db seed … && x dev` (`As of 2026-11-19`); `backfill --write` is refused the same way, `backfill` listing and dry runs are not |
|
|
510
|
-
| `branch list` | every **managed** branch of this database: name, location, created-at, size | managed means this framework made it — external, a database carrying `createBranch()`'s `comment on database` marker; embedded, a `pgdata-<name>` directory. A branch cloned by the pre-1.2.x `psql` shell-out carries no marker, so it is absent here and `delete` refuses it → [Known gaps](Known-Gaps). `size` reads `unknown` on the embedded database — measuring it is a full directory walk. The delete path only touches what this lists |
|
|
511
|
-
| `branch create <name>` | `CREATE DATABASE … TEMPLATE` copy-on-write clone (PGlite: a copied data directory) | the isolation an agent should use before migrating. An existing name is `X_BRANCH_EXISTS`, never an overwrite |
|
|
512
|
-
| `branch delete <name>` | delete that branch database (PGlite: its `pgdata-<name>` directory) | a name `list` does not show is refused with `X_DB_BRANCH_FAILED` naming what it *would* have touched — that is the whole guard, and it is why there is no `--force` |
|
|
513
|
-
| `backfill --list` | print the `x_backfills` ledger — one row per `backfill()` pass, newest first | what has already been swept |
|
|
514
|
-
| `backfill --pending` | every backfill the app **declared**, minus the ones that completed | the alarm: a sweep merged and never enqueued had no ledger row and was invisible everywhere. **Non-zero exit** when anything is unswept, so a cron reads the code and not the table |
|
|
515
|
-
| `backfill <name>` / `backfill --all` | gate one sweep (or every pending one) and enqueue it | **dry run by default** — `--write` is never implied. `--write` enqueues; the workers perform the pass, because the queue is a job's execution surface. `--all` isolates per name and continues past a failure, exiting non-zero naming each |
|
|
516
|
-
| `diagnostics` | what the database is doing now: `blockers` (each waiting `pid` and the `blockedBy` pid holding it, at `data.blockers.rows[]`), `activity`, `slowQueries`, `unusedIndexes`, `invalidIndexes`, `notValidConstraints`, `deadTuples` | **facts, never a verdict: exit 0** whatever they say. The one failure is a connection that never opens, `X_DB_UNAVAILABLE`. Every section is one catalog read in its own `BEGIN READ ONLY` with a 2 s `statement_timeout`, capped at `--limit` rows (default 20, at most 1000). A section that fails is `{ available: false, code, reason, fix }` in place and the other six still answer; `slowQueries` is unavailable until an operator installs `pg_stat_statements` (never on the embedded database). No user table is read; session SQL is printed with every literal as `?`; a credential in a reason is masked. **Whoever runs it sees the redacted SQL of every session on the app's database role** (every role, when it holds `pg_read_all_stats`): statement shape and identifiers, never values. `unusedIndexes` skips unique and primary indexes and carries `statsAgeSeconds` and `replica`. Opens the database without applying the framework tables; an embedded one `x dev` holds is refused (`X_DEV_ALREADY_RUNNING`). `--json`: `data.<section>`. Arbitrary read-only SQL is `db.query` over [`x mcp serve`](MCP-And-AI) |
|
|
517
|
-
| `recount <entity>.<column>` | compare a `countedIn` counter with the true count of its child rows | **dry run by default**: lists the drifted rows (at most 50, the count whole) and exits non-zero with `X_LIFECYCLE_TRIGGER_MISSING` when any drifted. The parent is walked in windows of 1,000 keys, in key order, each window one cross-tenant transaction (`As of 31.23`). `--write` repairs each window's drift inside its transaction and exits 0. An unknown `<entity>.<column>` is `X_CLI_BAD_FLAG`. `--json`: `data` = `{ target, write, drifted, batches, rows }` |
|
|
518
|
-
| `status` | is this database at this build? The app migrations this build ships against the `x_migrations` ledger (`pending`: shipped, not applied; `ahead`: applied, not shipped; `edited`: applied, the file now hashes otherwise), and the framework stamp (`framework.applied`, the newest build it records, a major skew) | **one read, no writes**, `As of 2026-11-15`: the stamp comment and the ledger rows, judged by the rules a serving role's boot applies (`appMigrationsVerdict`, `stampVerdict`). No DDL, no ledger created, no migrate lock; an embedded database never created is reported as nothing applied without being initialised, one `x dev` holds is refused (`X_DEV_ALREADY_RUNNING`). **Non-zero exit** with the boot's own findings when behind — `X_FRAMEWORK_SCHEMA_UNAPPLIED`, `X_APP_MIGRATIONS_UNAPPLIED` (fix `x db migrate`) — and the ledger judged as `x db migrate` judges it (`ledgerAheadOfBuild`, then `auditLedger`): an edited migration, or an `ahead` row that is not exactly a rollback — one sorting before the newest migration this build ships, or beside a pending one — is `X_MIGRATION_CONFLICT`; a rollback over a row recorded destructive is `X_MIGRATION_ROLLBACK_DESTRUCTIVE` unless `ROLLBACK_ALLOW_DESTRUCTIVE` names it. An `ahead` that is exactly a rollback exits 0: `x db migrate` accepts it and a serving role serves it with a warning (a rollback, or a rollout's old pods). `--json`: `data` = `{ shipped, applied, pending, ahead, edited, framework: { version, schema, applied, newest, skew, aheadByMajor } }`, `applied` `null` when no ledger exists |
|
|
519
|
-
|
|
520
|
-
A bare `x db backfill` is `X_CLI_BAD_FLAG` naming a shape that works: the four answer four different questions, and defaulting to one of them is the ambiguity axiom 1 refuses.
|
|
521
|
-
|
|
522
|
-
**Seeds have TIERS, and production takes one of them**, `As of 2026-08`. A seed declares
|
|
523
|
-
`tier: 'reference'` — data the app is wrong without, which ships to production through this same
|
|
524
|
-
command — or `tier: 'dev'`, the default, which is fixture data. A bare `x db seed` runs every tier
|
|
525
|
-
the resolved environment takes: `reference` and `dev` everywhere, `reference` alone under
|
|
526
|
-
`ULTIMATE_ENV=production`.
|
|
527
|
-
|
|
528
|
-
| To do this | Run |
|
|
529
|
-
|---|---|
|
|
530
|
-
| every seed this environment takes | `x db seed --json` |
|
|
531
|
-
| one named seed | `x db seed dev --json` |
|
|
532
|
-
| the reference data only, anywhere | `x db seed --tier reference --json` |
|
|
533
|
-
| dev fixtures on a box whose `ULTIMATE_ENV` says production | `x db seed dev --tier dev --json` |
|
|
534
|
-
| the same, with no argv to change (a release-phase container) | `ULTIMATE_SEED_TIER=dev x db seed --json` |
|
|
535
|
-
| rows for every entity with no seed written, parents first, same-tenant keys | `x db seed --generate --rows 3 --seed 1 --json` |
|
|
536
|
-
|
|
537
|
-
Naming the tier is both the selection and the consent, and that is why it is one word rather than
|
|
538
|
-
two flags: a cluster that sets `ULTIMATE_ENV=production` on every box — staging included — would
|
|
539
|
-
otherwise have to lie about the environment to load its own fixtures. A `dev` seed reached under
|
|
540
|
-
`production` with neither the flag nor the variable is `X_CLI_BAD_FLAG` and a non-zero exit; the
|
|
541
|
-
cause names both spellings and the `fix:` is the runnable one.
|
|
542
|
-
|
|
543
|
-
`--generate` draws rows off the entity declarations alone — the seed graph `x exercise` runs on: `--rows` per table (per tenant when tenant-scoped, default 3), `--seed` the integer it is drawn from, so the same seed writes the same rows. Generated rows are `dev` fixtures with no natural key to replay against, so production refuses them **whatever tier is named** (`X_SEED_ENVIRONMENT`); `--dry-run` counts the plan and writes nothing. The pass reports as one row named `(generated)`.
|
|
544
|
-
|
|
545
|
-
`--json` carries a row per seed — `{ file, name, tier, status, ms, inserted, updated, skipped }`,
|
|
546
|
-
**slowest first** — plus the totals, because a seed run that got slow is diagnosed by which file
|
|
547
|
-
took the time. `skipped` is the replay: a row already stored, with no statement sent for it.
|
|
548
|
-
|
|
549
|
-
**`branch` requires a verb, and the verb set is closed.** The first argument *was* the branch name, so `x db branch` with the word `ls` cloned a database called `ls` instead of listing anything — and every verb is itself a legal branch name, which is why verb-first is the only shape where a name cannot be read as a subcommand. `As of 2026-08` a bare name is refused: a word outside `list`, `create` and `delete` is `X_CLI_UNKNOWN_COMMAND` and its `fix:` hands the caller's own word back inside the command that still creates it (`x db branch create <word>`). The two retired verbs are refused too since 26.0.0, one verb each with no alias, but their `fix:` names the replacement instead — `ls` gets `x db branch list --json`, `drop <name>` gets `x db branch delete <name>` — because `create drop` would clone a database for a caller who asked to delete one.
|
|
550
|
-
|
|
551
|
-
Two more facts about the set, both `As of 2026-08`:
|
|
552
|
-
|
|
553
|
-
| Fact | Why |
|
|
554
|
-
|---|---|
|
|
555
|
-
| an external `create` runs through `@ultimat3/db`, not `psql` | `createBranch()` writes the marker comment `list` finds branches by. The `psql` shell-out wrote the database and no marker, so every branch the CLI made was invisible to the only lister the framework has |
|
|
556
|
-
| the marker records the **base**, not just the date | `ultimate:branch:<base>:<iso>` `As of 2026-08-19`, and `BranchInfo` carries `base` alongside `createdAt`. `listBranches()` walks `pg_database` for the whole **server**, so two Ultimate apps sharing one Postgres plus one nightly `reapBranches` was the other app's branches dropped — a `DROP DATABASE` nobody asked for and nothing recovers from. The reaper skips any branch whose base is not this database, **and skips a pre-3.x marker that records no base rather than dropping it**: a branch of nothing is not a branch of this database. Self-healing with no migration — the next `createBranch` writes the base down. The payload is split on the ISO tail, not on the first `:`, because a database name may contain one |
|
|
557
|
-
| there is no `reap` verb | `reapBranches()` is a `task` — a nightly sweep with an app-chosen max age. A CLI verb would be a second path to one job, and no default max age is defensible |
|
|
558
|
-
|
|
559
|
-
| Flag | Type | Default | Meaning |
|
|
560
|
-
|---|---|---|---|
|
|
561
|
-
| `--name` | string | — | migration or branch name, or the backfill to filter the ledger by. Under `backfill --list` it is the **only** spelling of that filter: a positional there is a pass target in every other shape and is refused with `X_CLI_BAD_FLAG` rather than silently dropped |
|
|
562
|
-
| `--allow-destructive` | boolean | `false` | let `gen` emit a DROP whose `down` cannot restore the rows. `X_MIGRATION_IRREVERSIBLE`'s own `fix:` line names it |
|
|
563
|
-
| `--drop-redundant` | boolean | `false` | `gen`: leave out of the diff each implicit index (a column's own, from `.references()` or `.index()`) that another index, the primary key or a unique invariant already leads with, so the migration drops it `concurrently` in a non-transactional step you review. Never a default; once dropped, a plain `x db gen` does not rebuild it. A table with no migration yet keeps every index. `x doctor` lists what it would drop (`data.redundantIndexes`), `As of 2026-11-14` |
|
|
564
|
-
| `--merge-fork` | boolean | `false` | `gen`: the fix `X_MIGRATION_FORKED` prints. Rewrites the newest `.snapshot.json` to what the merged chain builds, then continues as any `gen`. Changes no SQL and deletes no migration. `--json`: `data.outcome` is `fork-merged` when no migration was needed, `data.forkRepairs` the objects corrected. Two migrations creating one object are still refused ([Two branches, one chain](Migrations-And-Backfills#two-branches-one-chain--x_migration_forked)) |
|
|
565
|
-
| `--steps` | integer ≥ 1 | `1` | `rollback` only: how many applied migrations to reverse, most recently applied first. `0`, a fraction or a word is `X_CLI_BAD_FLAG` before anything opens |
|
|
566
|
-
| `--list` | boolean | `false` | `backfill`: print the ledger |
|
|
567
|
-
| `--pending` | boolean | `false` | `backfill`: declared minus completed, judged in this `ULTIMATE_ENV`. Non-zero exit when anything is unswept |
|
|
568
|
-
| `--all` | boolean | `false` | `backfill`: every pending sweep, isolated per name |
|
|
569
|
-
| `--write` | boolean | `false` | `backfill`: enqueue the pass. Without it the command is a dry run and writes nothing |
|
|
570
|
-
| `--force` | boolean | `false` | `backfill`: sweep a name the ledger records as completed, into a **new** ledger row |
|
|
571
|
-
| `--status` | string | — | `backfill`: `running`, `completed` or `failed`. Anything else is `X_CLI_BAD_FLAG` naming the three |
|
|
572
|
-
| `--limit` | string | `100` | `backfill`: max ledger rows |
|
|
573
|
-
|
|
574
|
-
**The backfill ledger is what has already been SWEPT.** One row per pass — name, status, rows
|
|
575
|
-
processed, last cursor, the app version that started it, started/completed — keyed by run rather
|
|
576
|
-
than by name, so `enqueue({ force: true })` writes a *new* row instead of editing the one it
|
|
577
|
-
reruns. A completed row is what makes the next **pass** a no-op — not the next enqueue: the
|
|
578
|
-
one-live-run index covers `ready`/`delayed`/`running`/`suspended`, and a completed job is in none
|
|
579
|
-
of them, so a second `enqueue()` creates a real job row whose pass then reports `skipped: true`.
|
|
580
|
-
|
|
581
|
-
```bash
|
|
582
|
-
$ x db backfill --list
|
|
583
|
-
name status rows cursor started-at duration-ms run-id
|
|
584
|
-
reindex-posts completed 84000 - 2026-08-14T09:00:00.000Z 240000 9c1e…
|
|
585
|
-
recount-likes running 12500 post_12500 2026-08-14T09:31:12.004Z - 7f3a…
|
|
586
|
-
✓ 2 backfill pass(es)
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
`started-at` is the ledger's own ISO string, printed verbatim — this repo formats no date without
|
|
590
|
-
an explicit IANA `timeZone`, and not formatting is the one rendering with no zone to get wrong.
|
|
591
|
-
An empty ledger exits **0**: "nothing has swept this database yet" is an answer. `--json` carries
|
|
592
|
-
the same rows plus the definition checksum. The live half of the same ledger is on `x jobs list`,
|
|
593
|
-
and `/_x`'s jobs panel carries the whole of it.
|
|
594
|
-
|
|
595
|
-
**One migration engine, everywhere.** `gen` calls `@ultimat3/db`'s `generateMigration()`;
|
|
596
|
-
`migrate` and `reset` call `migrate()` — the same `x_migrations` ledger, the same per-migration
|
|
597
|
-
checksum, the same session-pinned advisory lock a `ROLE=migrate` container runs. A laptop, CI,
|
|
598
|
-
staging and production therefore share one answer to "what has been applied". Before 1.2.0 these
|
|
599
|
-
shelled out to `bunx drizzle-kit`, a second engine with a second journal that no `package.json`
|
|
600
|
-
declared and `bunx` fetched unpinned at run time. Nothing in the request path goes through an ORM
|
|
601
|
-
either: reads and writes run on `@ultimat3/entity`'s hand-written `postgresDriver()`.
|
|
602
|
-
|
|
603
|
-
**One migration is one file.** `x db gen` writes three, all committed:
|
|
604
|
-
|
|
605
|
-
| File | Holds |
|
|
606
|
-
|---|---|
|
|
607
|
-
| `packages/db/migrations/<id>.sql` | the `up`, then a lone `-- down` line, then the reverse |
|
|
608
|
-
| `packages/db/migrations/<id>.snapshot.json` | the schema this migration leaves behind — what the *next* `x db gen` diffs against |
|
|
609
|
-
| `packages/db/migrations/<id>.hash` | the hash `x verify`'s `drift` step checks: the loaded entity **registry** plus every non-test file under `packages/db/src` — the registry half sees what `describe()` means, the source half sees a seed or helper edit |
|
|
610
|
-
|
|
611
|
-
**Plus the schema dump** — `packages/db/schema/`, the whole schema as SQL, one file per table, rewritten on every `x db gen` and `x db migrate` and held by the `drift` step (`X_SCHEMA_DUMP_DRIFT`). Layout, limits and what it is not: [Migrations and backfills → The schema dump](Migrations-And-Backfills#the-schema-dump).
|
|
612
|
-
|
|
613
|
-
**And `x db gen` is that directory's only writer**, `As of 2026-08`. `x new` scaffolds no migration:
|
|
614
|
-
a hand-written first file carried no `.snapshot.json` — the one artifact only the generator produces
|
|
615
|
-
— so the app's first `x db migrate` and first `x db gen` refused each other. A pristine scaffold's
|
|
616
|
-
first two commands are `x db gen "initial"` then `x db migrate` (`bun run setup` runs both), and until
|
|
617
|
-
the first has run, `x verify`'s `drift` step is red naming exactly that — **for an app that declares
|
|
618
|
-
an entity**, since zero declared against zero recorded is agreement and `--no-example` is therefore
|
|
619
|
-
green. A foreign key is
|
|
620
|
-
emitted as `alter table … add constraint` **after** every table statement, never as a `references`
|
|
621
|
-
clause inside `create table`, so the order entities happen to register in cannot make a migration
|
|
622
|
-
unappliable.
|
|
623
|
-
|
|
624
|
-
**A rendered `fix:` names `bunx x` where `node_modules/.bin/x` exists** (`As of 2026-11-02`, both renderers, after `&&` too; a `#` tail and quoted text stay as written). `x` need not be on `PATH`. Identical findings collapse to one, with `meta.count` and `meta.reportedAt`.
|
|
625
|
-
|
|
626
|
-
**`x env init --production`** (`As of 30.0.0`) writes `.env.production`, the file `x deploy --method compose` reads: `ULTIMATE_ENV=production`, `IMAGE=ultimate-app:dev` (the tag `x build --target docker` makes), `POSTGRES_PASSWORD` and a `DATABASE_URL` naming the compose `db` service with it, `APP_URL` and `SYNC_URL` on localhost, and every secret the app declares or the framework refuses to boot without, 32 random bytes as hex each. Secrets are never printed: `--json` lists the key names (`data.written`). `.gitignore` gains `.env.production` first, the file is mode 600, and a second run refuses (`X_ENV_FILE_EXISTS`): the password is the one the database volume was initialised with. A required key nothing can derive is written empty, named in `data.unfilled`, and exits 1.
|
|
627
|
-
|
|
628
|
-
**`x env check` answers for one environment and says which** (`As of 2026-11-19`). Named — `ULTIMATE_ENV`, else `NODE_ENV` — it is checked as named, always. With neither set it is checked as **development**, the environment `x dev` in the same directory declares, and the summary ends `checked as development, as x dev runs here: no ULTIMATE_ENV named — a deploy: ULTIMATE_ENV=production x env check`. With neither set under `CI` it is checked as production, because the boot fails closed (`checked as production: no ULTIMATE_ENV named`). `--json` carries `data.environment`. For a deploy's answer, name it: `ULTIMATE_ENV=production x env check` — the scaffold's image sets `NODE_ENV=production`, and `x deploy`'s pre-flight fix is `NODE_ENV=production x env check --json`. A missing key's `X_ENV_MISSING` fix is the line to add, in the file that environment loads (`.env.development.local`, `.env.test.local`, `.env.production`).
|
|
629
|
-
|
|
630
|
-
**The schema dump against the newest snapshot** (`As of 2026-11-02`, `drift`, no database) is `X_DB_DRIFT`: a column in `packages/db/schema/04_tables/<t>.sql` no snapshot records means an applied migration was edited and regenerated. A table hand-written SQL names is exempt.
|
|
631
|
-
|
|
632
|
-
**`X_DB_DRIFT` has two detectors, and each answers what the other cannot.** `x verify`'s `drift`
|
|
633
|
-
step hashes the loaded entity **registry** plus the bytes of every non-test file under
|
|
634
|
-
`packages/db/src` against the `.hash` sidecars — no database, so it runs in a CI with nothing
|
|
635
|
-
listening, and it catches "you edited an entity and never generated". The registry half sees an
|
|
636
|
-
entity declared under `apps/`; the source half sees a seed or helper edit. Bytes, not meaning: a
|
|
637
|
-
formatter pass over `packages/db/src` after `x db gen` moves the hash too, and `x db gen` answers
|
|
638
|
-
"no migration needed" and re-records it. `x db migrate` diffs
|
|
639
|
-
the live catalog against the `x_migrations` ledger — a database, so it runs only where one is open,
|
|
640
|
-
and it catches "someone changed the schema by hand". A table in the `x_` namespace is framework
|
|
641
|
-
bookkeeping (the ledger, the queue, the outbox, the auth tables) and is never counted as drift.
|
|
642
|
-
The `drift` step's dump rail is the one part of it that boots a database — a scratch embedded one,
|
|
643
|
-
its own — so CI still needs nothing listening.
|
|
644
|
-
|
|
645
|
-
A separate `<id>.down.sql` is not a migration and is never applied — that was a hand-written
|
|
646
|
-
pre-1.2.0 layout, and reading it as one would drop every table the pair exists to reverse.
|
|
647
|
-
|
|
648
|
-
Errors, seed: `X_DECLARATION_UNKNOWN` (no seed of that name — the cause lists the ones there are), `X_CLI_BAD_FLAG` (an unknown `--tier`, one name declared twice, or a `dev` seed reached under `production` with no consent), and whatever the seed itself threw, reported per seed with the file it came from.
|
|
649
|
-
|
|
650
|
-
Errors, schema: `X_DB_DRIFT`, `X_SCHEMA_DUMP_DRIFT`, `X_DB_GEN_FAILED`, `X_DB_MIGRATE_FAILED`, `X_DB_BRANCH_FAILED`, `X_MIGRATION_CONFLICT`, `X_MIGRATION_FORKED`, `X_MIGRATION_IRREVERSIBLE`, `X_MIGRATION_VIEW_DEPENDS`, `X_MIGRATE_CONCURRENT`, `X_NOT_IMPLEMENTED`. `X_DB_STUDIO_FAILED` is reserved and no longer thrown — `studio` left `x db` `As of 2026-11-15` ([Known gaps](Known-Gaps#open-by-decision)).
|
|
651
|
-
|
|
652
|
-
Errors, backfill: `X_BACKFILL_PENDING` (`--pending`, and the only one that is not a refusal — the sweep simply has not run), `X_BACKFILL_UNKNOWN`, `X_BACKFILL_ENVIRONMENT`, `X_BACKFILL_MIGRATION_PENDING`, `X_BACKFILL_APPLIED`, `X_BACKFILL_RUNNING`. All six are `@ultimat3/jobs`', carry a one-line runnable `fix:`, and are what a non-zero exit from these shapes means — full wording in [Error codes → `@ultimat3/jobs`](Error-Codes-jobs). `X_BACKFILL_STALLED` is the seventh and never reaches this command: it is raised by the pass, on a worker, so it surfaces through `x jobs show <id>`.
|
|
653
|
-
|
|
654
|
-
## x verify
|
|
655
|
-
|
|
656
|
-
```bash
|
|
657
|
-
x verify [--only <step>[,<step>…] [--shard i/n [--timings file]] | --changed [--base <ref>] [--dirty]] [--workers N] [--isolate] [--json]
|
|
658
|
-
x verify merge <part.json…> [--json]
|
|
659
|
-
x verify plan [--parts n] [--json]
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
**`x verify plan`** (`As of 31.17.0`) — the gate cut into CI parts, as data: each part an `x verify
|
|
663
|
-
--only <steps> [--shard i/n]` for one runner, and `data.matrix` a GitHub `strategy.matrix`
|
|
664
|
-
(`{ include: [{ part, only, shard?, needs }] }`) a workflow reads with `fromJSON`. `--parts`: `1`
|
|
665
|
-
(the whole gate on one runner) or `4`–`64`, default `4` — a `static` part (every step that is not a
|
|
666
|
-
suite), an `e2e` part (`typecheck` + `e2e`), and the rest split between shards of `unit,contract,job`
|
|
667
|
-
and of `live`, the unit group taking the odd one. `needs` says what the runner starts first:
|
|
668
|
-
`none`, `database` (the test Postgres) or `services` (every test service). Derived from
|
|
669
|
-
`VERIFY_STEP_NAMES`, so a new gate step lands in a part with no workflow edit, and every step sits in
|
|
670
|
-
exactly one part or every shard of one split — the rule `x verify merge` refuses a run by. `x new`'s
|
|
671
|
-
`.github/workflows/ci.yml` is three jobs: `plan` → one `gate` per part → `verify` (the merge) →
|
|
672
|
-
[CI: the gate across parallel jobs](CI-Parallel-Gate). Pure: it reads no file and starts nothing.
|
|
673
|
-
|
|
674
|
-
**`--changed`**, `As of 31.0` — the steps whose inputs the diff touches, NOT A GATE RUN like `--only`
|
|
675
|
-
and never beside it (`X_CLI_BAD_FLAG`). The diff is `x affected`'s: `<base>...HEAD`, `--base` default
|
|
676
|
-
the remote-tracking default branch (`origin/HEAD`, else `origin/main`, else local `main`; `As of 31.1`), `--dirty` adds uncommitted and untracked work. Each file gets one rule, each rule selects
|
|
677
|
-
steps; `data.changed` carries `{ base, dirty, files: [{ path, rule }], steps: [{ name, files }] }` and
|
|
678
|
-
the human render one `step ← files` line per step. Fail-open: a path no rule speaks for runs the gate.
|
|
679
|
-
Each suite but `eval` then runs only the test files the diff's import closure reaches — `x test
|
|
680
|
-
--affected`'s selection, `data.changed.tests` — a suite none of them belongs to is dropped, and the
|
|
681
|
-
`unit` coverage floor is not judged on the subset; a file the import graph cannot speak for (a root
|
|
682
|
-
config, a catalog) runs every test.
|
|
683
|
-
|
|
684
|
-
| rule | files | steps |
|
|
685
|
-
|---|---|---|
|
|
686
|
-
| `doc` | `*.md`, `docs/`, `wiki/` | package-shape, errors, unit, manifest, roadmap |
|
|
687
|
-
| `test` | `*.test.ts(x)`, `e2e/` | typecheck, lint, filesize, package-shape, errors + the suite that owns the file |
|
|
688
|
-
| `generated` | `x.manifest.json` | lint, contract-diff, manifest |
|
|
689
|
-
| `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` |
|
|
690
|
-
| `source` | `apps/`, `packages/`, `guards/`, `scripts/`, `types/`, `bin/` | every step but `drift` |
|
|
691
|
-
| `drift-input` | `packages/db/**`, `apps/*/clients/**`, `openapi.json`, any module importing `@ultimat3/entity` and everything it imports | every step |
|
|
692
|
-
| `root-config` · `deleted` · `unknown` · `outside` | a root file, any `app.config.ts`, a vanished module, another directory, a path outside the app | every step |
|
|
693
|
-
|
|
694
|
-
**`As of 22.7`** — the width is a memory budget (`max(2.75 GiB, 25% of RAM)` at 1.25 GiB a worker — no fixed 4 GiB cap since 2026-11-07,
|
|
695
|
-
at most one per core, printed on the step line; `ULTIMATE_TEST_MEMORY_BUDGET` /
|
|
696
|
-
`ULTIMATE_TEST_MAX_WORKERS` override, `--workers` wins), shared machine-wide across concurrent runs,
|
|
697
|
-
and test files are NOT isolated unless `--isolate` or `x.verify.json` `"isolate": true` says so →
|
|
698
|
-
[Testing](Testing#memory-width-and-isolation). `--shard i/n` (with `--only unit|contract|live|job|e2e`)
|
|
699
|
-
runs one CI job's deterministic slice — round-robin over the sorted files, or with `--timings
|
|
700
|
-
<file>` (`{ "path": ms }`, committed so every job reads one) heaviest-first to the lightest shard,
|
|
701
|
-
an unknown file at the median; `live` and `e2e` stay one process inside it, a slice per
|
|
702
|
-
runner, each runner with its own services (`As of 2026-11-07`) — and `x verify merge` folds every job's `--json` part back
|
|
703
|
-
into the gate verdict (`X_VERIFY_SHARD_INVALID`, `X_VERIFY_MERGE_INCOMPLETE`,
|
|
704
|
-
`X_VERIFY_MERGE_INPUT`) → [CI: the gate across parallel jobs](CI-Parallel-Gate). The paragraphs
|
|
705
|
-
below on `--workers` and batching describe 22.6 and earlier where they differ.
|
|
706
|
-
|
|
707
|
-
| `x.verify.json` key | What it sets |
|
|
708
|
-
|---|---|
|
|
709
|
-
| `steps` | steps this repo may never report as skipped (`X_VERIFY_SUITE_VANISHED`) |
|
|
710
|
-
| `coverage` | `{ "lines", "funcs", "why"?, "exclude"?: [{ "glob", "why" }] }` — the floor the `unit` step holds an app's whole source tree to (`X_COVERAGE_BELOW_FLOOR`, `X_COVERAGE_FLOOR_UNSTATED`, `X_COVERAGE_FLOOR_STALE`) → [Testing](Testing#coverage). `x doctor` prints every `exclude` |
|
|
711
|
-
| `stepTimeoutMs` | `{ "<step>": milliseconds }` — a step's own deadline. Default 8 minutes for the six suites, 5 for every other step; past it the step is `X_VERIFY_STEP_TIMEOUT` and its processes are killed |
|
|
712
|
-
| `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` |
|
|
713
|
-
| `isolate` · `typecheckBin` · `agentsMdMaxBytes` | a fresh global per test file · the `tsc`-compatible binary · the `AGENTS.md` byte budget |
|
|
714
|
-
| `strict` | `true`: every one of the 21 steps runs a check or carries a `skip` why — an unexcused one is red, `X_VERIFY_STRICT_UNRUN`. Absent or `false`: a warning line and `data.unwaived` name the steps that ran none. `As of 2026-11-15`; the default flips to `true` on `next` |
|
|
715
|
-
| `skip` | `{ "<step>": "<why>" }` — the written reason a step runs no check in this repo: a step the gate runs, not one `steps` lists, a non-empty reason. A why over a step that ran is a warning on that step (`drop its entry`) |
|
|
716
|
-
| `guardBaseline` | `{ "<guard>": n }` — a `guards/<guard>.ts` may still report `n` findings: up to `n` they are notices on `boundaries`, above it red (`X_GUARD_OVER_BASELINE`), under it red too, naming the lower number (`X_GUARD_BASELINE_STALE`) — the baseline only falls. A baseline for a guard the app no longer has is stale; a report-only guard (`severity: 'warning'`) is never judged |
|
|
717
|
-
|
|
718
|
-
Either render prints one line per finished step on **stderr** as each finishes — under `--json`
|
|
719
|
-
`{"step":"lint","ok":true,"ms":21987}`, otherwise (`As of 31.22`) `✓ lint 22.0s`, `○ seo 0.0s` for a
|
|
720
|
-
step that did not apply, and for a red step its narrowest re-run: `✗ unit 3.1s → x test unit --filter
|
|
721
|
-
<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;
|
|
722
|
-
under `--json` stdout stays the single document. A cancelled job's log ends on the last step that
|
|
723
|
-
finished, and a harness that kills a process after N silent minutes never kills a healthy gate.
|
|
724
|
-
|
|
725
|
-
The single gate. Green means shippable; CI runs exactly this. One step list, in cost order, shared
|
|
726
|
-
with the framework repo's own `bun run verify` — and **the gate is this command with no flag**,
|
|
727
|
-
because "green" has to mean the same thing for everyone. `--only <step>` runs one step for an
|
|
728
|
-
iteration loop, and `--only typecheck,lint,boundaries` runs several in ONE process — one CLI boot
|
|
729
|
-
and one app load instead of one per step — always in the gate's declared order, whatever order they
|
|
730
|
-
were typed in. Neither is a gate run: it announces `NOT A GATE RUN` in the summary and in `--json`
|
|
731
|
-
(`data.notAGateRun`, and `data.only` as the list of steps — a list of one for a single name), exits
|
|
732
|
-
with the steps' own status, and writes no floor file — even a list naming every step. An unknown or
|
|
733
|
-
empty item is refused (`X_CLI_BAD_FLAG`) naming every valid step, with a fix that corrects the typo
|
|
734
|
-
and keeps the rest of the list. There is no `--skip`. A step with nothing to check in this project
|
|
735
|
-
reports as skipped (`-`), never as passed — and the summary counts skips apart from passes and
|
|
736
|
-
names them, so a gate that is green because a suite does not exist has to say so on the one line
|
|
737
|
-
every reader sees:
|
|
738
|
-
|
|
739
|
-
```text
|
|
740
|
-
✓ 20 of 21 steps passed in …ms — 1 skipped: roadmap
|
|
741
|
-
```
|
|
742
|
-
|
|
743
|
-
`--json` carries the same fact twice: `steps[].skipped` per step, and `data.skipped` as the list of
|
|
744
|
-
names beside `data.failed`. `all {n} steps passed` is printed only when nothing was skipped.
|
|
745
|
-
|
|
746
|
-
Every step that ran no check — a skip, a vanished suite, a strict refusal — is printed under the
|
|
747
|
-
table as `skipped: <step> — <reason>` (`no *.e2e.test.ts file in this tree`, `found 3 test(s) and
|
|
748
|
-
every one skipped itself`) and carried in `data.skipReasons` as `{ "<step>": "<reason>" }`,
|
|
749
|
-
`As of 2026-11-15`.
|
|
750
|
-
|
|
751
|
-
`x.verify.json` ratchets those skips. Hand-written, committed at the repo root, read by the gate
|
|
752
|
-
and written by nothing:
|
|
753
|
-
|
|
754
|
-
```json
|
|
755
|
-
{ "steps": ["typecheck", "lint", "boundaries", "unit", "contract", "live", "e2e", "manifest"] }
|
|
756
|
-
```
|
|
757
|
-
|
|
758
|
-
Every name in it is a step this repo has already run, so a step in the list with nothing left to
|
|
759
|
-
check is a deleted suite — reported as **failed**, not skipped, with `X_VERIFY_SUITE_VANISHED` and
|
|
760
|
-
the two edits that resolve it. A repo with no such file is not ratcheted, and a name the gate does
|
|
761
|
-
not run is refused by the `manifest` step (`X_CONFIG_INVALID`) rather than silently covering
|
|
762
|
-
nothing. Removing a line is allowed; it just has to be a diff somebody reviews.
|
|
763
|
-
|
|
764
|
-
**`live` starts its own test database, `As of 2026-11-15`.** When `x.verify.json` holds `live`
|
|
765
|
-
(or `--only` names it), the step runs the idempotent `docker compose -f
|
|
766
|
-
docker/docker-compose.test.yml up -d --wait --wait-timeout 120` — the stack `x new` wrote — and
|
|
767
|
-
hands that env file's values to the suites, for every key the shell left unset. It runs even when
|
|
768
|
-
`TEST_DATABASE_URL` already answers: a Postgres still starting is waited for, and Redis, NATS and S3
|
|
769
|
-
come up beside it. If `up` fails while the database answers our login (a concurrent run's container
|
|
770
|
-
conflict, say), only the keys whose service answers are handed over — a suite with no URL skips; one
|
|
771
|
-
with a dead URL would fail. A Postgres on that port that refuses this app's login is another app's
|
|
772
|
-
stack: `X_TEST_SERVICES_UNAVAILABLE`, and nothing is handed over. A `TEST_DATABASE_URL` that is not
|
|
773
|
-
the env file's is your own server, and is never probed or second-guessed. The stack is **left
|
|
774
|
-
running** (RAM only; the next run reuses it) and the step's warning says so, with the stop line,
|
|
775
|
-
`docker compose -f docker/docker-compose.test.yml down`. No Docker, or a start that fails with no
|
|
776
|
-
database answering: a warning carrying `X_TEST_SERVICES_UNAVAILABLE` and the start command as its
|
|
777
|
-
fix, and the suites run exactly as before. When the floor holds `live` and that run executed no
|
|
778
|
-
test, `X_TEST_SERVICES_UNAVAILABLE` is the step's **finding**, first and red, with its working fix —
|
|
779
|
-
not `X_VERIFY_SUITE_VANISHED`, which is no longer added when the step already says why
|
|
780
|
-
(`As of 2026-11-19`). `--only live` with no floor, or a live run where some tests ran, keeps the
|
|
781
|
-
warning.
|
|
782
|
-
One stderr line names the stack: `services: started|reused <project>`, or `services: shared <project>
|
|
783
|
-
with <dir>` for another checkout of this app (same first commit or `origin`). A stack under this
|
|
784
|
-
project name started by a different app is refused before compose runs:
|
|
785
|
-
`X_TEST_SERVICES_UNAVAILABLE`, unless `ULTIMATE_TEST_SERVICES_SHARED=1` says the share is intended.
|
|
786
|
-
A **stopped** one is called stopped, never "already running", and its fix removes it by name:
|
|
787
|
-
`docker compose -p <project> down --volumes` (its data was in RAM), then `x verify --only live`. It
|
|
788
|
-
is reported, never taken over. `x new` (`As of 2026-11-19`) writes the compose `name:` as
|
|
789
|
-
`<app>-test-<8 hex of the scaffold directory's hash>` and picks the ports from name and directory,
|
|
790
|
-
so two scaffolds with one name on one machine get two stacks; an existing app keeps the `name:` its
|
|
791
|
-
compose file states, and a moved checkout keeps its scaffold-time name.
|
|
792
|
-
`x clean --services` stops the stack.
|
|
793
|
-
`packages/cli/src/verify-live.ts` decides when; `verify-services.ts` probes and starts;
|
|
794
|
-
`verify-services-stack.ts` reads whose stack it is.
|
|
795
|
-
|
|
796
|
-
`--workers` widens the test steps only. `unit`, `contract`, `job` and `eval` run as
|
|
797
|
-
`bun test --parallel=N`, each worker with its own database; `live` and `e2e` are serial by
|
|
798
|
-
declaration and say so in the output. **`x test live` and `x test e2e` obey the same declaration,
|
|
799
|
-
`As of 2026-08-27`** — they did not, so `x test live --workers 8` ran eight processes over the very
|
|
800
|
-
files `x verify` ran one over. `--workers` is accepted there and clamps to 1. That clamp read the
|
|
801
|
-
POSITIONAL, so the bare `x test --workers 8` still widened over the same files until 2026-09; the
|
|
802
|
-
selection is now partitioned by each file's own type. `x test`'s e2e pass also LAUNCHES as the
|
|
803
|
-
gate's `e2e` step does, `As of 2026-11`: in an app root with a browser (`CHROME_PATH`, or one
|
|
804
|
-
`x doctor` finds) it runs under `@ultimat3/testing`'s e2e preload, which spawns the app, with the
|
|
805
|
-
device zone `America/Los_Angeles` — before, `x test e2e` never opened a browser and every
|
|
806
|
-
browser-backed case skipped. With no browser both skip those cases alike, and under
|
|
807
|
-
`E2E_BROWSER_REQUIRED=1` those cases refuse instead of skipping, in both. The default width is
|
|
808
|
-
a memory budget, `As of 2026-11-07`: `max(2.75 GiB, 25% of RAM)` (`BUDGET_RULE`) at 1.25 GiB a worker
|
|
809
|
-
(`WORKER_BYTES`, `GATE_BUDGET_FLOOR` and `GATE_BUDGET_SHARE` in
|
|
810
|
-
`packages/cli/src/test-workers.ts`), at most one per core — the paragraph under `x verify` above.
|
|
811
|
-
**No fixed ceiling of 8**: it held a 12-core box with 30 GB free to 8. `--workers` accepts 1 to
|
|
812
|
-
64 on both `x verify` and `x test`; an explicit width is the caller's call and is not held to memory.
|
|
813
|
-
|
|
814
|
-
**A large selection runs in batches, `As of 22.6.2`.** A `--parallel` worker's heap grows with
|
|
815
|
-
every file it runs and is returned only when its `bun test` exits, so one process over the whole
|
|
816
|
-
corpus peaked higher with every test an app added — and the default of 22.6.1 (18 workers on a
|
|
817
|
-
12-core box with 35 GB free, 1 GiB budgeted a worker) took a 45 GB machine with no swap down.
|
|
818
|
-
A pass now runs as `ceil(files / (workers x 24))` `bun test --parallel=N` processes in sequence,
|
|
819
|
-
the files dealt round-robin over the sorted list, so the peak depends on the width and not on the
|
|
820
|
-
corpus. One adopter's `x test unit`, 768 files, 12 cores: 22.6.1's default (18 workers, one
|
|
821
|
-
process) peaked at 17.1-18.2 GB of process tree in 132-167s; 22.6.2's default (13-14 workers,
|
|
822
|
-
3 batches) at 11.3-12.2 GB in 152-163s, on a box shared at load 30-40. At the same width the split
|
|
823
|
-
costs no wall time within noise (12 workers: 150-158s unbatched, 147s in three batches). The split is a pure function of the file list and the width,
|
|
824
|
-
so the `fix:` a failure prints (`x test unit --workers N`) reruns the same batches; a `-- --watch`
|
|
825
|
-
run is never split; a forwarded `-- --bail` starts no batch after a red one. `x test --json` carries `batches`
|
|
826
|
-
when a pass was split, and each batch's output is kept under a line naming it.
|
|
827
|
-
|
|
828
|
-
**Bun owns the pool, `As of 2026-08-27`.** The CLI used to pack the files into N bins itself
|
|
829
|
-
(largest-first greedy over file SIZE) and spawn one `bun test` per bin; `--parallel=N` hands each
|
|
830
|
-
free worker the next file instead. **Expect no speed-up** — the two forms measure the same. Four
|
|
831
|
-
interleaved runs each on this repo's 1296-file unit corpus, 8 workers: 58.2/60.0/65.0/66.5s
|
|
832
|
-
hand-packed against 54.5/57.8/61.7/64.5s under `--parallel=8`. Both are work-bound — the corpus is
|
|
833
|
-
436.7s of file time, so eight workers cannot beat 54.6s however the files are dealt, and the
|
|
834
|
-
slowest single file is 20.5s. The packer is gone because it was 233 lines buying nothing, not
|
|
835
|
-
because it was slow ([#342](https://github.com/developerz-ai/ultimate/issues/342)).
|
|
836
|
-
|
|
837
|
-
| Step | Checks |
|
|
838
|
-
|---|---|
|
|
839
|
-
| `typecheck` | `tsc` across every workspace |
|
|
840
|
-
| `lint` | Biome: no `any`, no default exports, no bare `Error`, no raw colours, no hardcoded user-facing strings |
|
|
841
|
-
| `boundaries` | surface and layer imports, resolved transitively; package tiers in a monorepo; an app's `guards/*.ts`. A guard may spawn a process (`check` is any async function): it runs under this step's deadline, so a slow one sets `stepTimeoutMs.boundaries` in `x.verify.json` |
|
|
842
|
-
| `filesize` | a source file over 500 lines |
|
|
843
|
-
| `package-shape` | a workspace package missing `README.md`, `CLAUDE.md`, `tsconfig.json`, `src/index.ts`; a workspace importing a sibling workspace it does not declare (`X_WORKSPACE_DEP_UNDECLARED`); a workspace's shipped source importing a registry package — `@ultimat3/*` included, type-only imports too — that neither its own `package.json` nor the root's declares (`X_WORKSPACE_EXTERNAL_DEP_UNDECLARED`, fix `bun add <pkg> --cwd <workspace>`). Builtins (`node:*`, `bun`, `bun:*`), workspaces and tsconfig `paths` aliases are exempt. `As of 31.1` |
|
|
844
|
-
| `errors` | every `X_*` code has a runnable fix and a docs page |
|
|
845
|
-
| `unit` | pure logic — services, money, policy predicates, matchers |
|
|
846
|
-
| `contract` | action/query schemas, policy denials, emitted OpenAPI and MCP shapes |
|
|
847
|
-
| `live` | live-query snapshot, incremental patches, reconnect delta, policy-filtered rows |
|
|
848
|
-
| `job` | step replay, idempotency dedupe, retry/backoff, concurrency, outbox atomicity |
|
|
849
|
-
| `e2e` | a real browser (raw CDP) against the app, spawned on a throwaway database when Chrome is present, including offline and SW update |
|
|
850
|
-
| `eval` | prompt scores vs. their recorded baselines, and a prompt with no eval at all |
|
|
851
|
-
| `drift` | schema vs migrations |
|
|
852
|
-
| `contract-diff` | the code vs the **committed** `x.manifest.json`: a breaking change without a major bump |
|
|
853
|
-
| `budgets` | per-route JS bytes, the global style layer every document carries (`X_STYLES_GLOBAL_MISSING`), and every route that reads live rows with no island to receive them (`X_LIVE_ROUTE_NO_ISLAND`). **Builds first** when `.x/build-stats.json` is missing, of an earlier measurement rule, or older than the newest app source: `x build --target static --no-preflight --no-capture --out .x/verify-static`, under this step's deadline (`stepTimeoutMs.budgets`), never over a deployable `.x/static`. A failed build is the step's verdict, with the build's own findings. `As of 30.0` |
|
|
854
|
-
| `manifest` | the files an agent reads: `x.manifest.json` **and `openapi.json`** freshness — the one check `x manifest --check` runs (`X_MANIFEST_MISSING` / `X_MANIFEST_DRIFT` / `X_MANIFEST_STALE`) — `.env.example`, a hand-written `AGENTS.md` that exists and is under 12kB, and `x.verify.json` naming only steps the gate runs |
|
|
855
|
-
| `roadmap` | framework repo only — every `docs/idea/14-roadmap.md` milestone carries a status marker, and a milestone marked shipped still has the artifacts its own row names |
|
|
856
|
-
|
|
857
|
-
A test's type is its filename suffix — `*.contract.test.ts`, `*.live.test.ts`, `*.job.test.ts`,
|
|
858
|
-
`*.e2e.test.ts` (or any test under `e2e/`), `*.eval.test.ts`. Everything else is a unit test, so no
|
|
859
|
-
test can fall between two steps.
|
|
860
|
-
|
|
861
|
-
`eval` is the one step that applies with no suite of its own: a prompt no `defineEval` names is
|
|
862
|
-
`X_EVAL_MISSING`, and an eval whose baseline was never recorded is `X_EVAL_BASELINE_MISSING`,
|
|
863
|
-
because a skipped step — or one gating against nothing — would read as a green gate over untested
|
|
864
|
-
code. It gates on the drop from each eval's committed baseline, never on an absolute score —
|
|
865
|
-
`ULTIMATE_EVAL_RECORD=1 x test eval` re-records those baselines so accepting a new number is a
|
|
866
|
-
reviewable diff. `0`, `false`, `no`, `off` and empty (any case, trimmed) are off and gate; any
|
|
867
|
-
other value records (`As of 2026-11-19`, `packages/ai/src/eval-baseline.ts`).
|
|
868
|
-
|
|
869
|
-
That flag and this step are mutually exclusive. `x verify` with `ULTIMATE_EVAL_RECORD` set is
|
|
870
|
-
`X_EVAL_RECORDING` and the suite does not run: recording makes every eval write the numbers it
|
|
871
|
-
just measured and pass, so a gate that inherited the flag reports green over scores nothing
|
|
872
|
-
compared — and rewrites the committed baselines on its way through.
|
|
873
|
-
|
|
874
|
-
```bash
|
|
875
|
-
$ x verify --json
|
|
876
|
-
{"ok":false,"command":"verify",
|
|
877
|
-
"summary":"1 of 21 steps failed — 3 skipped: e2e, contract-diff, roadmap","steps":[
|
|
878
|
-
{"name":"budgets","ok":false,"durationMs":812,"skipped":false,"findings":[
|
|
879
|
-
{"code":"X_BUDGET_EXCEEDED","cause":"/pricing ships 61.2kb of JS (minified, uncompressed) over a 40kb budget via site/pricing/page.tsx -> islands/post-form-04f75f18.js; charged: /islands/post-form-04f75f18.js 50123 B, inline scripts 855 B",
|
|
880
|
-
"fix":"edit apps/web/site/pricing/page.tsx — set budget: { js: '62kb' } with // measured: 62682 B (x build --target static) — why: <the function it buys> directly above it, then x manifest (x.manifest.json carries the budget); or x routes --json for the chain and move the heavy import behind hydrate: 'interaction'",
|
|
881
|
-
"docs":"https://github.com/developerz-ai/ultimate/wiki/Error-Codes",
|
|
882
|
-
"at":"apps/web/site/pricing/page.tsx",
|
|
883
|
-
"meta":{"jsBytes":62682,"charged":[{"url":"/islands/post-form-04f75f18.js","bytes":50123}],"inlineJsBytes":855}}]}],
|
|
884
|
-
"data":{"failed":["budgets"],"skipped":["e2e","contract-diff","roadmap"],"durationMs":11153}}
|
|
885
|
-
```
|
|
886
|
-
|
|
887
|
-
A finding is `code`, `cause`, `fix`, and optionally `docs`, `at` and `meta`. `at` is the
|
|
888
|
-
path an agent opens — a file, or the stuck test file for a timed-out step — and is absent
|
|
889
|
-
when there is no such path. `meta` is structured facts behind `cause`, never the only home of
|
|
890
|
-
one: an unmeasured budget carries its route in `meta.route` (`X_BUDGET_UNMEASURED` — `at` names
|
|
891
|
-
the file that declares it), while `X_BUDGET_EXCEEDED` carries what the bytes were charged as
|
|
892
|
-
(`meta.jsBytes`, `meta.charged`, `meta.inlineJsBytes`) and spells the route in `cause`.
|
|
893
|
-
`X_VERIFY_STEP_TIMEOUT`
|
|
894
|
-
carries `meta.step`, `meta.deadlineMs`, `meta.killed: [{pid, command}]` and
|
|
895
|
-
`meta.inFlight: [{command, files, workers, stuck}]`; `at` is the stuck test file when
|
|
896
|
-
one could be named, and the failed step's `output` is the tail of what the killed run had printed.
|
|
897
|
-
|
|
898
|
-
Errors: `X_VERIFY_FAILED` (with the failing step names), plus each step's own code.
|
|
899
|
-
|
|
900
|
-
## x build
|
|
901
|
-
|
|
902
|
-
```bash
|
|
903
|
-
x build --target docker|binary|static|prebuilt [--tag name] [--out path] [--platform bun-target] [--no-preflight] [--no-capture] [--json]
|
|
904
|
-
```
|
|
905
|
-
|
|
906
|
-
| Flag | Type | Default | Meaning |
|
|
907
|
-
|---|---|---|---|
|
|
908
|
-
| `--target` | string | `docker` | `docker` (one image, all roles), `binary` (`bun build --compile`), `static` (prerendered `site/`), `prebuilt` (the island store and compiled stylesheets, written to `node_modules/.cache/ultimate` — the app image's own `RUN` line; no gate, no subprocess, refuses `--tag` and `--out`). The list is `BUILD_TARGETS` in `packages/cli/src/cmd-build.ts` |
|
|
909
|
-
| `--tag` | string | `ultimate-app:dev` | image tag, docker target only |
|
|
910
|
-
| `--out` | string | `.x/app` (`.x/static` for `static`) | output path, binary and static targets only; relative to the cwd |
|
|
911
|
-
| `--platform` | string | the host | binary target only: `bun-linux-x64`, `bun-linux-arm64`, `bun-windows-x64` or `bun-darwin-arm64`, passed to Bun as `--target` (the list is `BINARY_PLATFORMS` in `packages/cli/src/cmd-build.ts`). A Windows executable — `--platform bun-windows-x64`, or no `--platform` on a Windows host — is written as `<out>.exe`, and `data.artifact` names that file; `data.platform` echoes the flag. Any other value is `X_CLI_BAD_FLAG` before the gate runs, `fix: x build --target binary --platform bun-linux-x64`. For local runs and CI cross-compiles: a Windows host deploys the Linux image under Docker Desktop ([Deployment](Deployment)). `As of 2026-10-05` |
|
|
912
|
-
| `--no-preflight` | boolean | off | skip the six static gate steps the build runs first (typecheck, lint, boundaries, filesize, package-shape, errors) — only when `x verify` has run them, as its `budgets` step does when it builds. Not on `prebuilt`. `As of 22.7` |
|
|
913
|
-
| `--no-capture` | boolean | off | `static` only: stamp every `og.capture` card's `og:image` tags and photograph none, so no browser is needed (`X_SEO_CARD_BROWSER_MISSING` otherwise). `x verify`'s own build and `scripts/reference-app-gate.ts` pass it, and only they do — a deployable build takes the pictures. Reaches the app's `prerender.ts` as `ULTIMATE_BUILD_CAPTURE=off`. `As of 2026-11` |
|
|
914
|
-
|
|
915
|
-
A flag the chosen target never reads — `--tag` on `binary`/`static`, `--out` on `docker`, `--platform` on anything but `binary`, any of them on `prebuilt` — is `X_CLI_BAD_FLAG` before the gate runs, with `fix: x build --target <target>`.
|
|
916
|
-
|
|
917
|
-
**`--out` for `static` is emptied before every build**, so it must be provably the build's: absent, empty, the default `.x/static`, or a directory holding the `.x-export` marker every static build writes. The app root, an ancestor of it, or any other non-empty directory (`apps`, `.x`, `.x/pgdata`, a home directory) is `X_BUILD_OUT_UNSAFE` and nothing is removed. A module that will not import fails the static build with `X_BUILD_FAILED` (`fix: x verify --only manifest --json`) before the export is touched — its page would otherwise vanish from the artifact under a green build.
|
|
918
|
-
|
|
919
|
-
### Every target has one entry file
|
|
920
|
-
|
|
921
|
-
`BUILD_ENTRY` is the whole mapping. The entry is checked **before** the verify gate runs and before the builder is spawned, because `bun build`'s own "module not found" names no owner.
|
|
922
|
-
|
|
923
|
-
| `--target` | Entry file | Command it execs | Output |
|
|
924
|
-
|---|---|---|---|
|
|
925
|
-
| `docker` | `docker/Dockerfile` | `docker build -f <root>/docker/Dockerfile -t <tag> <root>` | one OCI image, `ROLE` selects behaviour |
|
|
926
|
-
| `binary` | `apps/web/server.ts` | `bun build --compile --minify [--target <platform>] --define ULTIMATE_FRAMEWORK_VERSION="<version>" <root>/apps/web/server.ts --outfile <out>[.exe]` | a single executable |
|
|
927
|
-
| `static` | `apps/web/prerender.ts` | `bun run <root>/apps/web/prerender.ts --out <out>` | prerendered `site/` |
|
|
928
|
-
|
|
929
|
-
All three are written by `x new`. A missing one is `X_BUILD_ENTRY_MISSING`, whose `fix` names the file and points at a fresh scaffold — the usual cause is an app scaffolded before 1.1.0 wrote `server.ts` and `prerender.ts`, or a deleted `docker/Dockerfile`.
|
|
930
|
-
|
|
931
|
-
Runs the static verify steps first (`typecheck`, `lint`, `boundaries`, `filesize`, `package-shape`, `errors`); if any fail, exits non-zero without building. The content-hash build ID every target shares is `x.manifest.json`'s, written by `x manifest`, not computed here. Errors: `X_BUILD_ENTRY_MISSING`, `X_BUILD_FAILED`, `X_BUILD_OUT_UNSAFE`, `X_CLI_BAD_FLAG`; an unknown `--target` is `X_CLI_UNKNOWN_COMMAND` with `build --target docker` as the suggestion.
|
|
932
|
-
|
|
933
|
-
### `--target static` names every route it emitted, and every one it did not
|
|
934
|
-
|
|
935
|
-
`.x/static/` is a **partial site**: `site/` routes declaring `render: 'static'` become files, and everything else is served by the app. Both renderers say so — `data.emitted` and `data.skipped` under `--json`, the same rows as a table in the terminal. A screenshot tool pointed at the directory used to photograph the landing page and file "the island did not mount" against a route that had never been in the artifact.
|
|
936
|
-
|
|
937
|
-
| Field | Row | Meaning |
|
|
938
|
-
|---|---|---|
|
|
939
|
-
| `emitted` | `{ route, path, file }` | one **file**, and the declared route that produced it — `/blog/:slug` writes one row per prerendered path |
|
|
940
|
-
| `skipped` | `{ route, surface, render, reason, why }` | one declared route that wrote nothing, and the cause |
|
|
941
|
-
|
|
942
|
-
**Every declared route is in exactly one of the two.** A route in neither is the defect this exists to close.
|
|
943
|
-
|
|
944
|
-
`reason` is a closed set, and the four are not one cause wearing four names — the surface is asked **first**, because `app/` allows only `stream | ssr` and no `render:` edit can put an `app/` route in the artifact:
|
|
945
|
-
|
|
946
|
-
| `reason` | Cause | Is there an edit? |
|
|
947
|
-
|---|---|---|
|
|
948
|
-
| `surface-forbids-static` | the surface cannot declare `render: 'static'` at all (`app/`) | no — move the route to `site/`, or serve it |
|
|
949
|
-
| `mode-revalidates` | `render: 'isr'` regenerates on a tag or ttl, which a published file cannot | yes — `render: 'static'` |
|
|
950
|
-
| `mode-per-request` | `render: 'ssr'` / `'stream'` on a surface that *does* allow static | yes — `render: 'static'` |
|
|
951
|
-
| `no-prerender-paths` | `render: 'static'` with dynamic params and no `prerender()`, so nothing enumerated | yes — add `prerender()` |
|
|
952
|
-
|
|
953
|
-
Both lists come from `prerenderSite`, which writes `.x/static-report.json` beside `.x/build-stats.json`; `x build` deletes any previous copy before it spawns the builder, so a stale inventory can never be reported as this run's. An app whose `apps/web/prerender.ts` does not call `prerenderSite` writes neither file, and `x verify`'s `budgets` step, which ran this build itself, reds it with `X_BUDGET_UNMEASURED`.
|
|
954
|
-
|
|
955
|
-
Budgets are unchanged and still measured in **real bytes on disk** — `measureDocumentJs` weighs every `<script src>` and every `data-x-entry` island chunk in the emitted document against the files in `out`, which is what catches one engine imported twice. A route that is skipped here is still weighed: it is rendered in memory and thrown away, so a `budget:` on an `ssr` or `isr` route has a number.
|
|
956
|
-
|
|
957
|
-
> `--target binary` compiles `apps/web/server.ts` as a **launcher** for the app tree it is started in: `--compile-autoload-package-json` and `--compile-autoload-tsconfig`, so the app's packages and `paths` aliases resolve at run time, and `--external '@ultimat3/*'`, so the framework is ONE instance — loaded from the app's `node_modules`, the same copy the app's own modules register into. It bundles neither the app nor the framework: run it from the app root, with `node_modules` installed beside it; it needs no Bun. It still passes `--define ULTIMATE_FRAMEWORK_VERSION="<version>"`, which only bundled framework code reads — none, in this graph; the framework's self-contained `x` image (`docker/Dockerfile`) is where the define is load-bearing. What is still unmeasured is the target end to end on a bare VM ([Known gaps](Known-Gaps)). `As of 2026-10-06`
|
|
958
|
-
|
|
959
|
-
## x deploy
|
|
960
|
-
|
|
961
|
-
```bash
|
|
962
|
-
x deploy --image repo/app:tag [--method compose|helm] [--release name] [--namespace ns] [--timeout 15m] [--dry-run] [--json]
|
|
963
|
-
```
|
|
964
|
-
|
|
965
|
-
| Flag | Type | Default | Meaning |
|
|
966
|
-
|---|---|---|---|
|
|
967
|
-
| `--image` | string | `ultimate-app:dev` | image reference to deploy |
|
|
968
|
-
| `--method` | string | `compose` | `compose` or `helm` |
|
|
969
|
-
| `--release` | string | `app.config.ts`'s `name` | helm release name; `helm` only |
|
|
970
|
-
| `--namespace` | string | the kube context's | helm namespace; `helm` only |
|
|
971
|
-
| `--timeout` | string | `15m` | how long helm waits for the migrate hook and the rollout; `helm` only |
|
|
972
|
-
| `--dry-run` | boolean | `false` | print the plan, run nothing |
|
|
973
|
-
|
|
974
|
-
`compose` is six ordered steps against `docker/docker-compose.prod.yml` — `run --rm migrate` to
|
|
975
|
-
completion, then `up -d` for `web`, `sync`, `worker`, `scheduler`, then `run --rm backfill` last.
|
|
976
|
-
**`migrate` gates and `backfill` triggers**: a slow `UPDATE` inside a release gate holds the deploy
|
|
977
|
-
open against a database still serving the previous release, so data sweeps are enqueued after the
|
|
978
|
-
new pods serve and the workers already draining the queue perform them. The `backfill` service runs
|
|
979
|
-
`x db backfill --all --write --json` and exits. Steps run sequentially and stop
|
|
980
|
-
at the first non-zero exit; the `fix` is that step's command, so you can rerun it directly for full
|
|
981
|
-
output. `helm` is one `helm upgrade --install <release> docker/helm [--namespace <ns>] --wait
|
|
982
|
-
--timeout <timeout> --output json --set-string image.repository=… --set-string image.tag=…` against the chart
|
|
983
|
-
**`x new` writes**. **It waits**, `As of 2026-09-23`: without `--wait` the command exited 0 the
|
|
984
|
-
moment the API server accepted the objects, and helm's own 5m default failed an upgrade whose
|
|
985
|
-
migrate hook was still applying a long migration. `--json` reports helm's own verdict as
|
|
986
|
-
`data.rollout` — `{ release, namespace, revision, status }`, `status` being helm's word
|
|
987
|
-
(`deployed`, `failed`) or `unknown` when helm printed no record. The release was the literal `app`
|
|
988
|
-
for every app; it is now `app.config.ts`'s `name`, and `--release app` addresses a release an
|
|
989
|
-
earlier version created. `--release`, `--namespace` and `--timeout` on `--method compose` are
|
|
990
|
-
refused (`X_CLI_BAD_FLAG`), never ignored. There is no `X_NOT_IMPLEMENTED` branch: the command implements helm
|
|
991
|
-
completely, so an app that deleted its chart gets helm's own error and an app with no `helm` on
|
|
992
|
-
`PATH` gets `X_CLI_UNEXPECTED` naming the binary to install. An image pinned by digest is refused
|
|
993
|
-
before the upgrade starts — the chart renders `repository:tag` with no digest branch.
|
|
994
|
-
|
|
995
|
-
**An unknown `--method` is refused, never defaulted.** `x deploy --method helmm` is
|
|
996
|
-
`X_CLI_UNKNOWN_COMMAND` listing `compose, helm`; it used to run the six-step Compose plan and report
|
|
997
|
-
`method: "compose"` back to an operator who asked for a Helm upgrade.
|
|
998
|
-
|
|
999
|
-
**There is no `--critical` flag**, `As of 2026-08-23`. It was deleted; the parser answers
|
|
1000
|
-
`X_CLI_BAD_FLAG` and lists the flags `deploy` does declare. It parsed, it was echoed into the
|
|
1001
|
-
plan JSON as `critical: <bool>`, and no file in `packages/` read that field — so it changed nothing
|
|
1002
|
-
about what the command did, on either method
|
|
1003
|
-
([`packages/cli/src/cmd-deploy.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/cli/src/cmd-deploy.ts)
|
|
1004
|
-
says so where it used to be declared). It is not coming back: the framework force-reloads nothing
|
|
1005
|
-
and no longer pretends to →
|
|
1006
|
-
[`docs/architecture/13-topology-runtime.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/architecture/13-topology-runtime.md).
|
|
1007
|
-
The flag list this build ships is `x help --json`, never this page.
|
|
1008
|
-
|
|
1009
|
-
Errors: `X_DEPLOY_FAILED` (a step exited non-zero — its `fix:` is that step's exact command),
|
|
1010
|
-
`X_CLI_BAD_FLAG` (a digest-pinned `--image` under `--method helm`, a helm-only flag under
|
|
1011
|
-
`--method compose`, a `--timeout` helm would reject, a `--release`/`--namespace` that is not a
|
|
1012
|
-
DNS-1123 label, or a flag `deploy` does not declare), `X_CONFIG_INVALID` (`--method helm` with no
|
|
1013
|
-
`--release` and an `app.config.ts` whose `name` is not a helm release name),
|
|
1014
|
-
`X_CLI_UNKNOWN_COMMAND`, `X_CLI_UNEXPECTED`.
|
|
1015
|
-
|
|
1016
|
-
**`--method compose` reads `.env.production` before its first step** (`As of 30.0.0`): no file, or a
|
|
1017
|
-
`${VAR:?}` of `docker/docker-compose.prod.yml` it leaves empty (and the shell does not set), is
|
|
1018
|
-
`X_DEPLOY_ENV_MISSING` naming the variables, and nothing runs; `x env init --production` writes the
|
|
1019
|
-
file. A failed step's `X_DEPLOY_FAILED` cause carries the container's own line — the last rendered
|
|
1020
|
-
`X_*` refusal, read from the one-shot's output or the serving role's `docker compose logs`.
|
|
1021
|
-
|
|
1022
|
-
### x deploy verify
|
|
1023
|
-
|
|
1024
|
-
Does production serve this build, does it hold, and does a worker of this build claim every queue. A GitOps roll never runs `x deploy`; this runs in either case. HTTP and Postgres only. `As of 30.0.0`
|
|
1025
|
-
|
|
1026
|
-
```bash
|
|
1027
|
-
x deploy verify --url <origin> [--build <id>] [--window 60s] [--interval 5s] [--timeout 10m] [--idle-ok <queue,…>] [--json]
|
|
1028
|
-
```
|
|
1029
|
-
|
|
1030
|
-
| Flag | Type | Default | Meaning |
|
|
1031
|
-
|---|---|---|---|
|
|
1032
|
-
| `--url` | string | required | a bare `http(s)` origin; a path, query or credentials are refused |
|
|
1033
|
-
| `--build` | string | `x.manifest.json`'s `buildId` | the id that must answer: `BUILD_ID`, or whatever CI stamped |
|
|
1034
|
-
| `--window` | string | `60s` | how long consecutive good samples must span. `0`: answered once |
|
|
1035
|
-
| `--interval` | string | `5s` | the gap between samples |
|
|
1036
|
-
| `--timeout` | string | `10m` | the whole wait, window and queues together |
|
|
1037
|
-
| `--idle-ok` | string | none | queues exempt while their depth (due + running) is 0: a scale-to-zero pool |
|
|
1038
|
-
|
|
1039
|
-
| Stage | Rule |
|
|
1040
|
-
|---|---|
|
|
1041
|
-
| sample | `GET <origin>/readyz` on a new connection each, `cache-control: no-cache`, redirects refused. Good: 2xx, `x-ultimate-build` equals the build, and no `Age` above 0 (a CDN copy is not the fleet) |
|
|
1042
|
-
| window | wait for the first good sample, then `--window` of consecutive good ones. A bad sample restarts it, and since the first good one fewer than one sample in `ceil(window / interval)` may be bad: a fleet stuck with old pods stays red |
|
|
1043
|
-
| coverage | samples through the load balancer, reported as samples. **Never a claim about each pod** |
|
|
1044
|
-
| queues | after the window, when `DATABASE_URL` is set. Expected: `jobs.queues` plus every registered job's queue. Served: a row not draining, of this build. Re-read until served or `--timeout`; a failed read keeps the last grade, and none landing is `X_DB_UNAVAILABLE` |
|
|
1045
|
-
| no `DATABASE_URL` | `queues.graded: false` and the summary says so. Never the embedded database, never counted as a pass |
|
|
1046
|
-
|
|
1047
|
-
`--json` `data`: `{ build, samples: { total, good, byBuild, byStatus, share, cached }, windowMs, queues: { graded, served, unserved: [{ queue, builds, depth }], idle, containers? } }`. `byStatus` counts a sample nothing answered as `unreachable`. `builds` names what the workers claiming that queue run (`unknown` for a row from before 30.0.0), so a stalled roll reads as one. `containers` (`As of 2026-11-19`, present when the registry was read): `[{ host, processes, slots }]`, this build's serving worker rows grouped by `host`, sorted — a container running `ULTIMATE_PROCESSES=N` is one `host` with `processes: N`, and `slots` is its `jobs.concurrency` total however the children split it ([Deployment](Deployment#processes-per-container)).
|
|
1048
|
-
|
|
1049
|
-
Errors: `X_DEPLOY_BUILD_MISMATCH` (no sample carried the build), `X_DEPLOY_BUILD_UNSTAMPED` (2xx with no header, and no build ever named), `X_DEPLOY_UNSTABLE` (the build answered, the window never closed), `X_DEPLOY_QUEUE_UNSERVED` (one finding per queue), `X_CLI_BAD_FLAG`.
|
|
1050
|
-
|
|
1051
|
-
`X_MIGRATE_CONCURRENT` **is thrown**, `As of 2026-08`. `ROLE=migrate` takes the migration lock by a
|
|
1052
|
-
**bounded** `pg_try_advisory_lock` poll on one pinned session — one try per 500ms against a 60s
|
|
1053
|
-
budget (`MIGRATION_LOCK_WAIT_MS`) — and holds it for the whole run. Two overlapping deploys
|
|
1054
|
-
therefore serialise while the first is merely slow: the second waits, then applies. A lock still
|
|
1055
|
-
held when the budget runs out is `X_MIGRATE_CONCURRENT` and a non-zero exit, because blocking
|
|
1056
|
-
`pg_advisory_lock` has no timeout and a wedged predecessor sat inside one statement with nothing in
|
|
1057
|
-
the logs — that is what 1.2.0 does → [Known gaps](Known-Gaps).
|
|
1058
|
-
|
|
1059
|
-
## Serving in production — `ROLE`, `PORT` and `HOST`
|
|
1060
|
-
|
|
1061
|
-
There is no `x serve` command. A container runs the scaffolded `apps/web/server.ts`, which calls
|
|
1062
|
-
`runRole({ root, env: Bun.env })` — the production boot path, with no dev watcher, no `/_x`, and
|
|
1063
|
-
`dev: false`. It binds `0.0.0.0` unless `HOST` says otherwise, because a process bound to
|
|
1064
|
-
loopback inside a container is unreachable from the port mapping, the load balancer and every
|
|
1065
|
-
health probe at once.
|
|
1066
|
-
|
|
1067
|
-
| Env | Default | Meaning |
|
|
1068
|
-
|---|---|---|
|
|
1069
|
-
| `ROLE` | `web` | one of `web`, `sync`, `worker`, `scheduler`, `migrate`, `replicator`. **There is no `all`** |
|
|
1070
|
-
| `PORT` | `3000` | empty or whitespace falls back to the default; anything else must be an integer in 0–65535 (`0` is legal — an ephemeral port) |
|
|
1071
|
-
| `HOST` | `0.0.0.0` | the interface the `web` and `sync` roles bind, and the metrics endpoint with them — one decision. Empty or whitespace falls back to the default. `HOST=127.0.0.1` inside a container is **unreachable through `docker run -p`** — the proxy connects to the container's bridge address, never its loopback — and reachable only where the container shares the host's network namespace (`--network host`) or through a sidecar and `ssh -L` inside it. That is the exposure an app which admits one implicit actor without a login wants, and until 2026-09-07 such an app could not run in a container at all. `runRole({ …, hostname: '127.0.0.1' })` overrides the variable, the way `port` overrides `PORT`, for an app that must never trust the deployment to set it |
|
|
1072
|
-
| `TLS_CERT` / `TLS_KEY` | unset | paths of a PEM certificate and its PEM private key, read once at boot by the `web` role, whose listener then serves TLS (a direct TLS socket counts as https: HSTS goes out with no proxy header). Both or neither, `X_CONFIG_INVALID` otherwise: one alone or a path that reads nothing is refused before any service starts, a file that is not PEM of the right kind when the listener is built. Unset — the default — the ingress terminates TLS. `sync` and the metrics endpoint stay plaintext |
|
|
1073
|
-
|
|
1074
|
-
| Failure | Code | Fix as printed |
|
|
1075
|
-
|---|---|---|
|
|
1076
|
-
| `ROLE` names something else | `X_ROLE_UNKNOWN` | `docker run -e ROLE=web <image>` |
|
|
1077
|
-
| `PORT` is not a TCP port | `X_PORT_INVALID` | `docker run -e PORT=3000 <image>` |
|
|
1078
|
-
|
|
1079
|
-
**`ROLE=migrate` is the release phase.** It starts only the db/queue pair, applies the app's
|
|
1080
|
-
migrations through the ledger — carrying `APP_VERSION` when set — logs `{ applied, available,
|
|
1081
|
-
appVersion }`, and **exits**. It never holds a port and never serves. Every other role loads the
|
|
1082
|
-
app's modules (importing them *is* registration), resolves the build id from `BUILD_ID` or the
|
|
1083
|
-
manifest, assembles its routes, and holds until SIGTERM → [Deployment](Deployment).
|
|
1084
|
-
|
|
1085
|
-
The scaffolded `docker/Dockerfile` defaults `NODE_ENV=production ROLE=web PORT=3000`, exposes 3000,
|
|
1086
|
-
and health-checks `/readyz`.
|
|
1087
|
-
|
|
1088
|
-
## x secrets
|
|
1089
|
-
|
|
1090
|
-
```bash
|
|
1091
|
-
x secrets [show|init|edit|set <NAME>|rotate [--drop <keyId>]] [--json]
|
|
1092
|
-
```
|
|
1093
|
-
|
|
1094
|
-
Two files, one committed and one never:
|
|
1095
|
-
|
|
1096
|
-
| File | Committed | Holds |
|
|
1097
|
-
|---|---|---|
|
|
1098
|
-
| `secrets.enc.json` | yes | the sealed envelope: `v`, `alg`, the master key's id, the IV, the ciphertext |
|
|
1099
|
-
| `.secrets.key` | **no** — `x secrets init` writes the `.gitignore` rule before it writes the key | 64 hex characters, mode `0600`; on Windows, an ACL granting the current account alone |
|
|
1100
|
-
|
|
1101
|
-
`ULTIMATE_SECRETS_KEY` is read first and the key file second, so a container is handed its key by the platform and ships no key file at all.
|
|
1102
|
-
|
|
1103
|
-
**On Windows the mode keeps no one out** — every file reports `0666` and inherits the profile directory's ACL. So every key write (`init`, `rotate`, the staged `.secrets.key.next`) runs `icacls <temp> /inheritance:r /grant:r "<DOMAIN>\<user>:F"` on the temp file **before** the rename makes it live: one explicit entry, nothing inherited. Read it back with `icacls .secrets.key`. An `icacls` that fails writes no key at all: `X_SECRETS_KEY_ACL_FAILED`, fix `where.exe icacls`, or keep no key file and set `ULTIMATE_SECRETS_KEY`. A rename over a key another process holds open (an editor, an indexer, a virus scan) is retried 5 times over ~150 ms on `EPERM`/`EBUSY` before it fails. `As of 2026-10-05`.
|
|
1104
|
-
|
|
1105
|
-
**A secret is an environment variable.** The decrypted payload is a flat map of `ENV_NAME` to value, and `installSecrets()` writes each one into the process environment where nothing has already set it — the real environment always wins, so one image runs in Compose and on K8s with the same committed file. Everything downstream is what already existed:
|
|
1106
|
-
|
|
1107
|
-
```ts
|
|
1108
|
-
// app.config.ts
|
|
1109
|
-
import { defineEnv, type EnvSchema, installSecrets } from '@ultimat3/core';
|
|
1110
|
-
|
|
1111
|
-
await installSecrets();
|
|
1112
|
-
export const envSchema = {
|
|
1113
|
-
SESSION_SECRET: { type: 'string', secret: true, description: 'Cookie signing key' },
|
|
1114
|
-
} satisfies EnvSchema;
|
|
1115
|
-
export const env = defineEnv(envSchema);
|
|
1116
|
-
```
|
|
1117
|
-
|
|
1118
|
-
One declaration, one row in `.env.example`, one mask (`maskedEnvValues`), one redaction entry, one reader (`env.SESSION_SECRET`). There is no `secrets.get()` — a second accessor would be values with no declaration, no type and no mask.
|
|
1119
|
-
|
|
1120
|
-
| Subcommand | Does |
|
|
1121
|
-
|---|---|
|
|
1122
|
-
| `show` (default) | names, lengths, and whether `envSchema` declares each one; retired master keys by id (`retiredKeyIds`). **Never a value**, in either renderer |
|
|
1123
|
-
| `init` | a fresh master key, the `.gitignore` rule, and an empty sealed file. Refuses to overwrite either file |
|
|
1124
|
-
| `edit` | decrypt into a temp buffer outside the repo, open `$VISUAL`/`$EDITOR`, reseal on save. The buffer is deleted in a `finally` and by a `SIGINT`/`SIGTERM` handler; an unchanged buffer writes nothing |
|
|
1125
|
-
| `set <NAME>` | one value, read from **stdin** — never argv, which lands in shell history and in `ps` |
|
|
1126
|
-
| `rotate` | reseal the same values under a new master key. The committed file is written first and the key last: only the committed one can be restored from git. The key it replaces joins the ring — see below |
|
|
1127
|
-
| `rotate --drop <keyId>` | remove one retired key from the ring, by id. Generates no new key and leaves `.secrets.key` alone |
|
|
1128
|
-
|
|
1129
|
-
**The key ring.** `seal()` writes under the current key; `open()` picks the key a value names. So a
|
|
1130
|
-
rotation must keep the old key readable until every sealed value is re-sealed:
|
|
1131
|
-
|
|
1132
|
-
| Step | Command | State |
|
|
1133
|
-
|---|---|---|
|
|
1134
|
-
| 1 | `x secrets rotate` | new key live; the old one is in `secrets.enc.json` as `ULTIMATE_SECRETS_RETIRED_KEYS`, sealed under the new key. A deploy is still handed one key |
|
|
1135
|
-
| 2 | the app's re-seal `backfill()` | every value whose `sealedKeyId()` is a retired id is opened and sealed again |
|
|
1136
|
-
| 3 | `x secrets rotate --drop <keyId>` | the retired key is gone; a value still naming it is `X_SEAL_KEY_UNKNOWN` |
|
|
1137
|
-
|
|
1138
|
-
`ULTIMATE_SECRETS_RETIRED_KEYS` is comma-separated, 64 hex characters each, and reaches the
|
|
1139
|
-
process through `installSecrets()` like any secret — the real environment wins. It is kept by
|
|
1140
|
-
default and never behind a flag: `rotate` overwrites the only copy of the old key on disk, so
|
|
1141
|
-
dropping it then would leave every sealed value unreadable. `show` reports it by key id, not as
|
|
1142
|
-
an app secret.
|
|
1143
|
-
|
|
1144
|
-
```bash
|
|
1145
|
-
$ x secrets init --json
|
|
1146
|
-
{"ok":true,"command":"secrets","summary":"sealed secrets.enc.json — master key 4f2a…",
|
|
1147
|
-
"data":{"path":"secrets.enc.json","keyPath":".secrets.key","keyId":"4f2a…","gitignore":"added"}}
|
|
1148
|
-
|
|
1149
|
-
$ printf %s "$STRIPE_KEY" | x secrets set STRIPE_KEY --json
|
|
1150
|
-
$ x secrets show
|
|
1151
|
-
name value length envSchema
|
|
1152
|
-
SESSION_SECRET [redacted] 44 chars yes
|
|
1153
|
-
STRIPE_KEY [redacted] 32 chars no
|
|
1154
|
-
```
|
|
1155
|
-
|
|
1156
|
-
`--json` carries exactly what the terminal does, which is why no subcommand has a `--reveal` flag: the one way to see a value is `x secrets edit`, and the one way to read one is the app reading `env.<NAME>`.
|
|
1157
|
-
|
|
1158
|
-
Errors: `X_SECRETS_KEY_MISSING`, `X_SECRETS_KEY_INVALID`, `X_SECRETS_KEY_MISMATCH`, `X_SECRETS_FILE_MISSING`, `X_SECRETS_FILE_INVALID`, `X_SECRETS_TAMPERED`, `X_SECRETS_PLAINTEXT_INVALID`, `X_SECRETS_EDITOR_MISSING`, `X_SECRETS_EDIT_FAILED`, `X_GENERATE_CONFLICT` (`init` over an existing file), `X_CLI_BAD_FLAG` (`--drop` naming an id the ring does not hold).
|
|
1159
|
-
|
|
1160
|
-
## x auth
|
|
1161
|
-
|
|
1162
|
-
```bash
|
|
1163
|
-
x auth seal-mfa [--json]
|
|
1164
|
-
```
|
|
1165
|
-
|
|
1166
|
-
One subcommand, and no default: a bare `x auth` is refused (`X_CLI_BAD_FLAG` names the subcommand), as `x db`, `x mcp` and `x pr` are — the one subcommand rewrites credential rows, and the read-only answer (how many are unsealed) is `x doctor`'s. `seal-mfa` seals every `x_users.mfa_secret` still stored
|
|
1167
|
-
in the clear, in place, under the app's master key (`As of 2026-10`). It is the one-shot an upgrade
|
|
1168
|
-
onto sealed second-factor secrets owes — `completeMfa` refuses a plaintext value with
|
|
1169
|
-
`X_MFA_SECRET_UNSEALED`, whose fix is this command, and `x doctor` reports how many rows are left. Beside a live `x dev` holding the embedded database it is refused `X_DEV_ALREADY_RUNNING`, fix `x stop --json && x auth seal-mfa && x dev` (`As of 2026-11-19`).
|
|
1170
|
-
|
|
1171
|
-
| | |
|
|
1172
|
-
|---|---|
|
|
1173
|
-
| Opens | the app's database, as every other command does (`DATABASE_URL`, or the embedded one) — the framework's tables are applied first |
|
|
1174
|
-
| Needs | the master key: `ULTIMATE_SECRETS_KEY` or `.secrets.key`. With neither it is `X_SEAL_KEY_MISSING` and no row is written |
|
|
1175
|
-
| Idempotent | a sealed value is counted and never rewritten, so an interrupted run is finished by running it again |
|
|
1176
|
-
| Safe under traffic | each write is a compare-and-set on the value read: a user who re-enrolled mid-run keeps the new secret, and the row is counted `skipped` |
|
|
1177
|
-
| Reaches | `PostgresAuthAdapter`'s `x_users`. An app on its own `AuthAdapter` calls `sealMfaSecrets({ adapter })` from `@ultimat3/auth` |
|
|
1178
|
-
|
|
1179
|
-
```bash
|
|
1180
|
-
$ x auth seal-mfa --json
|
|
1181
|
-
{"ok":true,"command":"auth","summary":"sealed 2 second-factor secret(s); 0 already sealed, 0 changed mid-run and left alone",
|
|
1182
|
-
"data":{"sealed":2,"alreadySealed":0,"skipped":0}}
|
|
1183
|
-
```
|
|
1184
|
-
|
|
1185
|
-
Errors: `X_SEAL_KEY_MISSING`, `X_NOT_IN_APP`, `X_DB_UNAVAILABLE`, `X_AUTH_WRITE_FAILED`.
|
|
1186
|
-
|
|
1187
|
-
## x vapid
|
|
1188
|
-
|
|
1189
|
-
```bash
|
|
1190
|
-
x vapid [show|create] [--json]
|
|
1191
|
-
```
|
|
1192
|
-
|
|
1193
|
-
The Web Push key pair `pwa.push` signs with (RFC 8292), `As of 26.1.0`. Both halves are environment
|
|
1194
|
-
variables — `ULTIMATE_VAPID_PUBLIC_KEY` and `ULTIMATE_VAPID_PRIVATE_KEY` — and never config, so they
|
|
1195
|
-
cannot come from different pairs. [PWA and offline](PWA-And-Offline#push).
|
|
1196
|
-
|
|
1197
|
-
| Subcommand | Does |
|
|
1198
|
-
|---|---|
|
|
1199
|
-
| `show` (default) | names the pair the boot would sign with — `environment`, `sealed` (`secrets.enc.json`) or `development` (the published pair a local process falls back to, which a deployed boot refuses) — and its public key. **Never the private key**, in either renderer |
|
|
1200
|
-
| `create` | mints a P-256 pair on WebCrypto and seals BOTH halves into `secrets.enc.json` in one write. Refuses (`X_GENERATE_CONFLICT`) when either is already sealed: a new pair unsubscribes every browser that subscribed with the old one, so rotating is `x secrets edit` (delete both lines) and then `create` — a decision, never a re-run |
|
|
1201
|
-
|
|
1202
|
-
```bash
|
|
1203
|
-
$ x vapid create --json
|
|
1204
|
-
{"ok":true,"command":"vapid","summary":"sealed a new Web Push key pair into secrets.enc.json — ULTIMATE_VAPID_PUBLIC_KEY and ULTIMATE_VAPID_PRIVATE_KEY",
|
|
1205
|
-
"data":{"path":"secrets.enc.json","publicKey":"BBwN…","sealed":["ULTIMATE_VAPID_PUBLIC_KEY","ULTIMATE_VAPID_PRIVATE_KEY"]}}
|
|
1206
|
-
```
|
|
1207
|
-
|
|
1208
|
-
A key pair minted elsewhere (`web-push generate-vapid-keys`) is the same format: set the two variables
|
|
1209
|
-
directly. `x env example` lists both in the Framework section once `pwa.push` is wired (`pwa.vapid`
|
|
1210
|
-
set), and `x env check` reports a deployed table that lacks them (`X_PWA_VAPID_KEY_MISSING`).
|
|
1211
|
-
|
|
1212
|
-
`show` reads `development` only when there is nothing sealed to read — no `secrets.enc.json`, or no
|
|
1213
|
-
master key for it. A sealed file it cannot open is that refusal, with its own fix
|
|
1214
|
-
(`X_SECRETS_TAMPERED`, `X_SECRETS_KEY_MISMATCH`, `X_SECRETS_FILE_INVALID`): the pair is there, and
|
|
1215
|
-
`create` would refuse it.
|
|
1216
|
-
|
|
1217
|
-
Errors: `X_SECRETS_KEY_MISSING` (`create` with no `x secrets init`), `X_GENERATE_CONFLICT`, `X_NOT_IN_APP`,
|
|
1218
|
-
and the `X_SECRETS_*` refusals above.
|
|
1219
|
-
|
|
1220
|
-
## x manifest
|
|
1221
|
-
|
|
1222
|
-
```bash
|
|
1223
|
-
x manifest [--check] [--no-openapi] [--json]
|
|
1224
|
-
```
|
|
1225
|
-
|
|
1226
|
-
| Flag | Type | Default | Meaning |
|
|
1227
|
-
|---|---|---|---|
|
|
1228
|
-
| `--check` | boolean | `false` | fail if the committed files are stale instead of rewriting them |
|
|
1229
|
-
| `--openapi` / `--no-openapi` | boolean | `true` | also write `openapi.json` |
|
|
1230
|
-
|
|
1231
|
-
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`.
|
|
1232
|
-
|
|
1233
|
-
## x routes
|
|
1234
|
-
|
|
1235
|
-
```bash
|
|
1236
|
-
x routes [--surface site|app|api|shared] [--json]
|
|
1237
|
-
```
|
|
1238
|
-
|
|
1239
|
-
No positional: `x routes list` (the retired spelling) or `x routes app` is `X_CLI_UNKNOWN_COMMAND`
|
|
1240
|
-
with fix `x routes --json` — the filter is `--surface`.
|
|
1241
|
-
|
|
1242
|
-
**Every URL the app serves through a primitive, in one table** (`As of 2026-10-07`, owner decision 2):
|
|
1243
|
-
the pages from `describePages()`, then — sorted by path — the action and query routes from
|
|
1244
|
-
`apiRoutes()` (the builder `x dev` and the container mount) and the plain `routes` of
|
|
1245
|
-
`apps/<app>/runtime.ts`. The MCP dev tool `routes.list` answers the same rows.
|
|
1246
|
-
|
|
1247
|
-
| Row | Surface | Last column (`declared by`) | `--json` keys |
|
|
1248
|
-
|---|---|---|---|
|
|
1249
|
-
| a page | `site` / `app` | its file | `method` (`GET`), `path`, `surface`, `file`, `render`, `hydrate`, `offline`, `budget` |
|
|
1250
|
-
| 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 |
|
|
1251
|
-
| an action or query projection | `api` | the primitive, its name and its policy: `action publishPost · posts:publish` | `method`, `path`, `surface`, `primitive`, `name`, `auth`, `policy` |
|
|
1252
|
-
| 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` |
|
|
1253
|
-
|
|
1254
|
-
```bash
|
|
1255
|
-
$ x routes --surface api --json
|
|
1256
|
-
{"ok":true,"command":"routes","summary":"2 routes","findings":[],"data":{"routes":[
|
|
1257
|
-
{"method":"GET","path":"/_x/query/org-feed","surface":"api","primitive":"query","name":"orgFeed","auth":"public","policy":"allow"},
|
|
1258
|
-
{"method":"POST","path":"/api/posts/publish","surface":"api","primitive":"action","name":"publishPost","auth":"required","policy":"posts:publish"}]}}
|
|
1259
|
-
```
|
|
1260
|
-
|
|
1261
|
-
Not listed: a bearer mount's copies of the API (`defineApi({ http: { mounts } })`), a page's
|
|
1262
|
-
`post:` binding, and the framework's own asset, island and `/_x` routes.
|
|
1263
|
-
|
|
1264
|
-
Errors: `X_ROUTE_CONFLICT`, `X_ROUTE_META_MISSING`.
|
|
1265
|
-
|
|
1266
|
-
## x mcp
|
|
1267
|
-
|
|
1268
|
-
```bash
|
|
1269
|
-
x mcp tools [--json]
|
|
1270
|
-
x mcp serve [--transport stdio|http] [--port 9229] [--json]
|
|
1271
|
-
```
|
|
1272
|
-
|
|
1273
|
-
| Flag | Type | Default | Meaning |
|
|
1274
|
-
|---|---|---|---|
|
|
1275
|
-
| `--transport` | string | `stdio` | `stdio` for an editor client, `http` for a socket |
|
|
1276
|
-
| `--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 |
|
|
1277
|
-
|
|
1278
|
-
Serves `@ultimat3/mcp`'s dev server — 23 tools (`As of 31.22`), one catalog, the same on both transports. Every
|
|
1279
|
-
tool declares a scope; the local developer's caller carries all five, and an HTTP caller carries
|
|
1280
|
-
whatever its bearer token was issued.
|
|
1281
|
-
|
|
1282
|
-
| Tool | Does | Scope |
|
|
1283
|
-
|---|---|---|
|
|
1284
|
-
| `routes.list` | the `x routes --json` table: pages (render mode, hydrate, offline, budget), then every action, query and `runtime.ts` route | `dev:read` |
|
|
1285
|
-
| `schema.describe` | entities with columns, types and invariants; `{ entity }` narrows to one, by name or table (`As of 31.22`) | `dev:read` |
|
|
1286
|
-
| `policies.list` | every policy: permission, subject, where it is enforced | `dev:read` |
|
|
1287
|
-
| `actions.describe` | actions and queries: schemas, policy, cache tags, MCP exposure | `dev:read` |
|
|
1288
|
-
| `jobs.inspect` | job definitions, retry policy and steps | `dev:read` |
|
|
1289
|
-
| `queue.depth` | pending, running and failed counts per queue | `dev:read` |
|
|
1290
|
-
| `manifest.read` | the generated `x.manifest.json` as text | `dev:read` |
|
|
1291
|
-
| `errors.explain` | `X_*` → cause, fix, docs | `dev:read` |
|
|
1292
|
-
| `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` |
|
|
1293
|
-
| `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` |
|
|
1294
|
-
| `db.query` | ONE read-only SQL statement; `limit` defaults to 100 rows, maximum 1000 | `db:read` |
|
|
1295
|
-
| `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` |
|
|
1296
|
-
| `db.migrate` | apply pending migrations to a **branch** database | `db:migrate` |
|
|
1297
|
-
| `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` |
|
|
1298
|
-
| `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` |
|
|
1299
|
-
| `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` |
|
|
1300
|
-
| `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` |
|
|
1301
|
-
| `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` |
|
|
1302
|
-
| `ui.shot` | photograph one route at a named viewport, light or dark; PNG path plus verdict. Launches a browser | `dev:test` |
|
|
1303
|
-
| `ui.island` | photograph an island in every state its `*.island.states.ts` declares, as `x shot --island` does | `dev:test` |
|
|
1304
|
-
| `ui.inspect` | DOM, computed-style and accessibility facts for a bounded set of selectors, in one navigation | `dev:test` |
|
|
1305
|
-
| `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` |
|
|
1306
|
-
| `ui.diff` | pixel-compare two PNGs the other `ui.*` tools wrote under `.x/shot/`; launches no browser | `dev:read` |
|
|
1307
|
-
|
|
1308
|
-
`db.query` and `db.migrate` refuse structurally — multiple statements, a mutating keyword
|
|
1309
|
-
(a data-modifying CTE included), a locking clause, `EXPLAIN ANALYZE` (or `ANALYSE`), a banned
|
|
1310
|
-
function family (`pg_read_*`, `pg_copy_*`, `pg_backup_*`, `pg_restore_*`, … — [MCP and AI](MCP-And-AI)),
|
|
1311
|
-
a non-branch target —
|
|
1312
|
-
before the host runs anything. `db.explain` is where `ANALYZE` is allowed: it writes the `EXPLAIN`
|
|
1313
|
-
itself around a statement the same scan passed.
|
|
1314
|
-
|
|
1315
|
-
Never exposed in `ROLE=web`. Errors split by when they fire:
|
|
1316
|
-
|
|
1317
|
-
| When | Codes | Effect |
|
|
1318
|
-
|---|---|---|
|
|
1319
|
-
| 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 |
|
|
1320
|
-
| 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 |
|
|
1321
|
-
|
|
1322
|
-
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).
|
|
1323
|
-
|
|
1324
|
-
## x doctor
|
|
1325
|
-
|
|
1326
|
-
```bash
|
|
1327
|
-
x doctor [--port 3000] [--json]
|
|
1328
|
-
```
|
|
1329
|
-
|
|
1330
|
-
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.
|
|
1331
|
-
|
|
1332
|
-
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.
|
|
1333
|
-
|
|
1334
|
-
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 `[]`.
|
|
1335
|
-
|
|
1336
|
-
| Listing | One line each | `--json` |
|
|
1337
|
-
|---|---|---|
|
|
1338
|
-
| 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 |
|
|
1339
|
-
| an edited copy | the same line | `data.guards.differs[]`: `{ name, refresh, diff }` — `refresh` is that edit |
|
|
1340
|
-
|
|
1341
|
-
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`.
|
|
1342
|
-
|
|
1343
|
-
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:
|
|
1344
|
-
|
|
1345
|
-
| Code | Asked | Fix |
|
|
1346
|
-
|---|---|---|
|
|
1347
|
-
| `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` |
|
|
1348
|
-
| `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"` |
|
|
1349
|
-
| `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` |
|
|
1350
|
-
| `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` |
|
|
1351
|
-
| `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 |
|
|
1352
|
-
| `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` |
|
|
1353
|
-
|
|
1354
|
-
**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)).
|
|
1355
|
-
|
|
1356
|
-
**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.
|
|
1357
|
-
|
|
1358
|
-
**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.
|
|
1359
|
-
|
|
1360
|
-
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.
|
|
1361
|
-
|
|
1362
|
-
**It probes BOTH ports `x dev` binds** — `PORT` for the web role and `PORT + 1` for the sync node —
|
|
1363
|
-
and the suggestion moves both: `x doctor --port 3000` with 3001 taken answers `x dev --port 3002`,
|
|
1364
|
-
never `3001`, which is the port it has just reported as taken (`As of 2026-09`; the same repair
|
|
1365
|
-
`X_PORT_IN_USE`'s own `fix:` took in `x dev`). A `--port` at the top of the range has no room for
|
|
1366
|
-
the sync node at all, so it reports the boot's own `X_PORT_INVALID` rather than probing a port
|
|
1367
|
-
below it that `x dev` would never bind. The port is `x dev`'s own: `--port`, then `PORT`, then
|
|
1368
|
-
3000 — under `PORT=4000` it probes 4000 and 4001, never 3000.
|
|
1369
|
-
|
|
1370
|
-
**`APP_URL`, when set**, must be an `http://` or `https://` origin (`X_CONFIG_INVALID`, the sync
|
|
1371
|
-
boot's own refusal), and a loopback one must name that same port — `APP_URL=http://localhost:3000`
|
|
1372
|
-
beside `PORT=4000` is `X_APP_URL_PORT_MISMATCH`, whose fix is the `export` line with the port `x dev`
|
|
1373
|
-
serves on. Unset is no finding; a public origin is the deploy's and is not judged here.
|
|
1374
|
-
|
|
1375
|
-
**Sealed columns against the key ring.** An app that declares `.sealed()` columns is checked for
|
|
1376
|
-
two conditions; an app with none is never judged.
|
|
1377
|
-
|
|
1378
|
-
| Finding | Condition | Fix |
|
|
1379
|
-
|---|---|---|
|
|
1380
|
-
| `X_SEAL_KEY_MISSING` | sealed columns, and no usable master key in this environment | `x secrets init`, or export `ULTIMATE_SECRETS_KEY` |
|
|
1381
|
-
| `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>` |
|
|
1382
|
-
|
|
1383
|
-
The ring is read as a booted process would see it — the real environment first, then the
|
|
1384
|
-
committed `secrets.enc.json`.
|
|
1385
|
-
|
|
1386
|
-
**What an upgrade left in the auth tables** (`As of 2026-10`). Asked of an external
|
|
1387
|
-
`DATABASE_URL` only — the embedded database is never opened by a diagnostic.
|
|
1388
|
-
|
|
1389
|
-
| Finding | Condition | Fix |
|
|
1390
|
-
|---|---|---|
|
|
1391
|
-
| `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` |
|
|
1392
|
-
| `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 |
|
|
1393
|
-
|
|
1394
|
-
The output is a `CommandResult` like every other command's: `findings`, not a `checks` array.
|
|
1395
|
-
|
|
1396
|
-
```bash
|
|
1397
|
-
$ x doctor --json
|
|
1398
|
-
{"ok":false,"command":"doctor","summary":"1 finding(s)","findings":[{"code":"X_DB_DRIFT",
|
|
1399
|
-
"cause":"packages/db has a schema but no migration recorded it",
|
|
1400
|
-
"fix":"x db gen \"initial\"","docs":"https://github.com/developerz-ai/ultimate/wiki/Error-Codes",
|
|
1401
|
-
"at":"packages/db/migrations"}],"data":{"count":1,"codes":["X_DB_DRIFT"]}}
|
|
1402
|
-
```
|
|
1403
|
-
|
|
1404
|
-
## x actions · x queries · x entities
|
|
1405
|
-
|
|
1406
|
-
```bash
|
|
1407
|
-
x actions [list|show <name>] [--json]
|
|
1408
|
-
x queries [list|show <name>] [--json]
|
|
1409
|
-
x entities [list|show <name>] [--json]
|
|
1410
|
-
```
|
|
1411
|
-
|
|
1412
|
-
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.
|
|
1413
|
-
|
|
1414
|
-
```bash
|
|
1415
|
-
$ x actions list
|
|
1416
|
-
name verb resource path capability mcp
|
|
1417
|
-
createPost create posts /api/posts/create post:create yes
|
|
1418
|
-
publishPost publish posts /api/posts/publish post:publish yes
|
|
1419
|
-
|
|
1420
|
-
$ x entities show posts --json
|
|
1421
|
-
{"ok":true,"command":"entities","summary":"entity posts","data":{"name":"posts","table":"posts",
|
|
1422
|
-
"primaryKey":["id"],"columns":[…],"invariants":[…],"softDelete":true,"orgScoped":true}}
|
|
1423
|
-
```
|
|
1424
|
-
|
|
1425
|
-
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.
|
|
1426
|
-
|
|
1427
|
-
## x jobs
|
|
1428
|
-
|
|
1429
|
-
```bash
|
|
1430
|
-
x jobs [list|show <id>|retry <id>|cancel <id>|delete <id>|promote <id>|resolve-step <id> <step>
|
|
1431
|
-
|pause <queue>|resume <queue>|drain] [--queue q] [--state s] [--name n] [--limit n]
|
|
1432
|
-
[--after cursor] [--from-step name] [--reason text] [--ran|--not-ran] [--output json] [--json]
|
|
1433
|
-
```
|
|
1434
|
-
|
|
1435
|
-
| Subcommand | Does |
|
|
1436
|
-
|---|---|
|
|
1437
|
-
| `list` | queue depth (with a `failed` bucket), ONE page of matching rows, the dead-letter list — a dead job is never filtered out of view — the `backfill()` passes **in flight**, the paused queues and the live workers. `--limit` is 1 to 200 (default 100). `--json` answers the framework's one page shape — `data.rows`, `data.nextCursor`, `data.hasMore` — and `nextCursor` is a string **exactly when another row exists**: the command reads one row past the page (at 200, one probe after it), so a full last page is `hasMore: false` with no cursor, never one that fetches an empty page. Pass `nextCursor` as `--after` while `hasMore` is true. Until 25.0.0 it was `data.next`, guessed from the row count |
|
|
1438
|
-
| `show <id>` | state, attempt, every step's result, the payload (`input`, with every key the app declared secret redacted), the failure's `stack`, the last `progress` the body reported, the remaining retry delays, the concurrency key the run counts under (`concurrencyKey` — `concurrency.key(input)`, `null` unless the job declares a keyed cap), and the `x_backfills` row for this run when the job is a backfill (`backfill: null` for every other job) |
|
|
1439
|
-
| `retry <id>` | re-queue a job that has FINISHED; a job still `ready`, `delayed` or running is refused with `X_JOB_NOT_REQUEUEABLE`. `--from-step <name>` drops that step and every step that started after it, so they re-execute while everything before it replays from storage |
|
|
1440
|
-
| `cancel <id>` | stop a job that has not finished — the way to end a runaway `backfill()` sweep. `--reason <text>` is recorded on the job. Re-reads the row after cancelling, so **exit 0 means it is genuinely stopped**: a job that already finished, an id no queue holds, and a driver with no `introspect.cancel` all raise `X_JOB_NOT_CANCELLABLE` rather than reporting success |
|
|
1441
|
-
| `delete <id>` | delete one job and its step records. An unknown id is `X_JOB_UNKNOWN`; a **running** job is refused with `X_JOB_NOT_REMOVABLE`, whose fix is `x jobs cancel <id> --json` — deleting the row under a body does not stop the body |
|
|
1442
|
-
| `promote <id>` | make a job waiting on its run time — delayed at enqueue, or backing off before a retry — due now. Anything else (due, running, finished, suspended in a `step.sleep`) is `X_JOB_NOT_PROMOTABLE`, naming the state |
|
|
1443
|
-
| `resolve-step <id> <step>` | answer a `once` step whose outcome is unknown (`X_STEP_OUTCOME_UNKNOWN`): `--ran --output '<json>'` records it `completed` — a replay returns that JSON, default `null` — and `--not-ran` records it `cleared`, so the next run calls it again. Exactly one of the two. Refused on a running job, or a step that did not start-and-not-complete (`X_STEP_NOT_RESOLVABLE`). Answers the job's trace; then `x jobs retry <id>` |
|
|
1444
|
-
| `pause <queue>` | no worker claims from the queue; enqueues still land. A row every worker's next claim reads, so it holds **fleet-wide within one poll interval**. Idempotent. Answers the paused list as the queue now holds it. A queue outside `jobs.queues` and the registered jobs' queues is `X_CLI_BAD_FLAG`, its fix the nearest name, before any row is written (`As of 2026-11-19`); an app that does not load is never refused on a guess |
|
|
1445
|
-
| `resume <queue>` | undo it; a queue that is paused always resumes, else the same queue check as `pause` |
|
|
1446
|
-
|
|
1447
|
-
`show`, `retry`, `cancel`, `delete` and `promote` each take **one id positional**, `resolve-step` an id and a step name; `pause` and `resume` take **one queue positional**. Beside a live `x dev` holding the embedded database, the writing verbs (`retry`, `cancel`, `delete`, `promote`, `resolve-step`, `pause`, `resume`) are refused `X_DEV_ALREADY_RUNNING`, the fix stopping it, running the verb and starting it again; `list` and `show` still read (`As of 2026-11-19`). There is no bulk verb here — bulk is `requeueMany` / `removeMany` on `JobIntrospection`, which a dashboard calls. `--queue`, `--state`, `--name`, `--limit` and `--after` narrow `list` only. A bare `x jobs` is `list`. One verb each, no alias: `ls` and `rm` are `X_CLI_UNKNOWN_COMMAND` since 26.0.0.
|
|
1448
|
-
|
|
1449
|
-
```bash
|
|
1450
|
-
x jobs cancel 019ff1c5-0000-7000-8000-000000000001 --reason "wrong tenant" --json
|
|
1451
|
-
```
|
|
1452
|
-
|
|
1453
|
-
Runs against the app's own driver — the ambient one when a process already installed it, otherwise the same embedded Postgres queue `x dev` boots. `show`, `retry` and `cancel` load the app first, `As of 2026-10`: a trace is the row read through the job's own declaration, so unloaded every run showed `concurrencyKey: null` and no retry delays. An app that half-loads still answers, with those two fields degraded. An `<id>` that is not a uuid is `X_JOB_UNKNOWN` before any statement is sent — `x jobs show nosuch` used to reach Postgres and come back `X_DB_STATEMENT_FAILED [22P02]`.
|
|
1454
|
-
|
|
1455
|
-
`list` reports only the sweeps still **running**, because it is a live view of the queue; the whole
|
|
1456
|
-
ledger, finished passes included, is `x db backfill --list`. A driver that ships no backfill ledger
|
|
1457
|
-
answers with no passes rather than failing the command — the queue is still the question here.
|
|
1458
|
-
|
|
1459
|
-
Errors: `X_JOB_UNKNOWN`, `X_JOB_NOT_CANCELLABLE`, `X_JOB_NOT_REMOVABLE`, `X_JOB_NOT_PROMOTABLE`, `X_CLI_BAD_FLAG` (a `--limit` over 200 names the walk), and `X_NOT_IMPLEMENTED` from a driver with no introspection.
|
|
1460
|
-
|
|
1461
|
-
A run refused by its concurrency key reads `state: failed` with `X_JOB_KEY_BUSY` in `lastError`; the fix it carries is `x jobs list --name <job> --state running --json` — the runs holding the key.
|
|
1462
|
-
|
|
1463
|
-
## x tasks
|
|
1464
|
-
|
|
1465
|
-
```bash
|
|
1466
|
-
x tasks [list|show <name>|run <name>] [--count n] [--production] [--json]
|
|
1467
|
-
```
|
|
1468
|
-
|
|
1469
|
-
| Subcommand | Does |
|
|
1470
|
-
|---|---|
|
|
1471
|
-
| `list` | every registered `task`: cron, timezone, catch-up policy, the jobs it enqueues, the occurrence it **last** fired and its next one |
|
|
1472
|
-
| `show <name>` | the same plus the cron in words and the next `--count` occurrences (default 5, max 50) |
|
|
1473
|
-
| `run <name>` | fire the task now: each job its occurrence enqueues goes onto the app's queue, through `TaskHandle.enqueue()` (the admin's run-now path). The scheduler's watermark is untouched, so the next scheduled occurrence still fires. Where the environment resolves `production` it fires only when asked by name — `--production`, or `ULTIMATE_TASK_RUN=<name>` for a container whose command line is fixed — as `x db seed --tier` / `ULTIMATE_SEED_TIER` do (`X_TASK_RUN_PRODUCTION` otherwise, nothing queued); beside an `x dev` holding the embedded database it is refused `X_DEV_ALREADY_RUNNING` with the stop–run–restart fix. `--json`: `data` = `{ task, jobs: [{ job, id, runId, deduped }] }`. `x g cron-job <name>` prints `bunx x tasks run <name>.schedule` as its next step. `As of 2026-11-19` |
|
|
1474
|
-
|
|
1475
|
-
| `--json` field | Is |
|
|
1476
|
-
|---|---|
|
|
1477
|
-
| `nextMs` · `next` | the next occurrence: epoch ms, and ISO-8601 in the task's zone |
|
|
1478
|
-
| `lastMs` · `last` | the occurrence the scheduler last **dispatched** — what it was scheduled for, same two renderings. `null` (`-` in the table) for a task that has never fired |
|
|
1479
|
-
| `lastFiredAtMs` | when that dispatch happened, on the queue's clock. `lastFiredAtMs - lastMs` is the scheduler's lag |
|
|
1480
|
-
|
|
1481
|
-
The last fire is read from the app's queue (`JobIntrospection.taskFires()`), so `x tasks` opens it
|
|
1482
|
-
the way `x jobs list` does: the running one inside `x dev`, the app's own otherwise — about 0.6 s on
|
|
1483
|
-
an embedded database already initialised, and nothing in an app that declares no task. It is the last
|
|
1484
|
-
occurrence that enqueued, never the scheduler's watermark — arming and skipping move that.
|
|
1485
|
-
`As of 2026-10`.
|
|
1486
|
-
|
|
1487
|
-
Every instant is rendered in the task's **own** `tz`, never a machine-local default: a `0 3 * * *` in `America/New_York` reads `2026-03-06T03:00:00-05:00` before the spring-forward and `2026-03-09T03:00:00-04:00` after it. Same wall clock, different instant — the ambiguity the required `tz` exists to remove.
|
|
1488
|
-
|
|
1489
|
-
Errors: `X_DECLARATION_UNKNOWN` (with the nearest name as its fix), `X_CLI_BAD_FLAG`.
|
|
1490
|
-
|
|
1491
|
-
## x exercise
|
|
1492
|
-
|
|
1493
|
-
```bash
|
|
1494
|
-
x exercise [<name>] [--seed n|random] [--shard i/n] [--json]
|
|
1495
|
-
```
|
|
1496
|
-
|
|
1497
|
-
Every action, query and job the app registers, run **once** against generated rows, with no test
|
|
1498
|
-
written. The question no written test answers: what does each primitive do when it actually runs?
|
|
1499
|
-
|
|
1500
|
-
| Step | What happens |
|
|
1501
|
-
|---|---|
|
|
1502
|
-
| database | a scratch one — embedded, or a server named by `TEST_DATABASE_URL` when a migration needs an extension the embedded one cannot link — with the framework tables and every migration applied. Never the developer's own: the pass commits |
|
|
1503
|
-
| rows | a fresh pair of tenants per primitive, every table seeded off its declaration (`x db seed --generate`'s graph) |
|
|
1504
|
-
| actor | the first of `x policy explain`'s actors the primitive's policy allows, in its own tenant |
|
|
1505
|
-
| input | the override, then an id field whose stem names a seeded entity (`postId` → `posts`), then the minimal draw of its schema |
|
|
1506
|
-
| room | network sealed, mail captured, job queue in memory, clock frozen. A call out is refused, so the primitive is `unreached`, never sent |
|
|
1507
|
-
|
|
1508
|
-
Each primitive ends `reached`, `refused` (no actor its policy allows — by design), `off` (an
|
|
1509
|
-
override with a reason) or `unreached`. `--json` and `.x/exercise.json` carry the same document:
|
|
1510
|
-
`{ seed, counts, records[] }`, each record `{ kind, name, outcome, code?, reason?, statements,
|
|
1511
|
-
effects, ms, override? }`. A `<name>` runs that one primitive; an unknown name is
|
|
1512
|
-
`X_DECLARATION_UNKNOWN`.
|
|
1513
|
-
|
|
1514
|
-
`unreached` is red: `X_CONTRACT_EXERCISE_UNREACHED`, and its `fix:` is the entry to paste into
|
|
1515
|
-
`apps/web/exercise.ts` — valid TS naming the actor the pass ran as (`testActor(…).actor`, imported
|
|
1516
|
-
from `@ultimat3/policy`) and the seeded row each id field was bound to (`As of 2026-11`). The
|
|
1517
|
-
`exercise` option `.contract()` takes, one shape:
|
|
1518
|
-
|
|
1519
|
-
```ts
|
|
1520
|
-
import type { Actor } from '@ultimat3/core';
|
|
1521
|
-
import { defineExercise } from '@ultimat3/testing';
|
|
1522
|
-
|
|
1523
|
-
declare const author: Actor; // a signed-in actor the policy allows
|
|
1524
|
-
|
|
1525
|
-
export const exercise = defineExercise({
|
|
1526
|
-
publishPost: {
|
|
1527
|
-
actor: author,
|
|
1528
|
-
input: (drawn) => ({ ...(drawn as Record<string, unknown>), postId: '<a real id>' }),
|
|
1529
|
-
},
|
|
1530
|
-
sendInvoice: { off: 'charges a card through the payment provider' },
|
|
1531
|
-
});
|
|
1532
|
-
```
|
|
1533
|
-
|
|
1534
|
-
**The seed** (`As of 31.47.0`). Row ids and tenants are drawn from it, so it is part of the verdict.
|
|
1535
|
-
|
|
1536
|
-
| Run | Seed | For |
|
|
1537
|
-
|---|---|---|
|
|
1538
|
-
| `x exercise`, and the gate's `exercise` step | one constant, `DEFAULT_SEED` from `@ultimat3/testing` | one tree, one verdict |
|
|
1539
|
-
| `x exercise --seed <n>` | `n`, 0 to 2147483647 | replaying a run |
|
|
1540
|
-
| `x exercise --seed random` | a fresh one | looking for a seed-dependent helper; never the gate |
|
|
1541
|
-
|
|
1542
|
-
The first output line and `seed` in `.x/exercise.json` and `--json` name the seed used. Each pass
|
|
1543
|
-
has its own scratch database, so repeating a seed collides with nothing.
|
|
1544
|
-
|
|
1545
|
-
A blank `off` reason is `X_CONTRACT_EXERCISE_UNDECLARED`; so is an `exercise.ts` with no single
|
|
1546
|
-
`defineExercise()` export. The gate's `exercise` step runs this command as a child and is red on
|
|
1547
|
-
exactly its findings, plus the static half of the tenant proof: an entity with no tenant column
|
|
1548
|
-
that references one with a tenant and declares no `shared` reason.
|
|
1549
|
-
|
|
1550
|
-
**The `exercise` floor** (`As of 31.16.0`). `x exercise` and the gate step judge the pass against
|
|
1551
|
-
`x.verify.json`'s `exercise` key ([Configuration](Configuration#the-gates-file--xverifyjson)). Without the key every
|
|
1552
|
-
judgement below is a warning line (`! …`, and `data.warnings[]` under `--json`) naming the figure to
|
|
1553
|
-
write, and the run stays green; with it, above a declared figure is red.
|
|
1554
|
-
|
|
1555
|
-
| Judged | Red, once opted in | Warning otherwise |
|
|
1556
|
-
|---|---|---|
|
|
1557
|
-
| unproven ÷ reached — a tenant, crash or scale proof that could not ask | `X_EXERCISE_UNPROVEN_ABOVE_FLOOR`, naming the first three | the ratio, rounded up, to write as `unprovenMax`; also when it fell under the floor, naming the lower figure |
|
|
1558
|
-
| a sized-seed table the database refused | `X_EXERCISE_SEED_FAILED`, one per table, naming the entity, the driver's words and its readers — red exactly when the unproven ratio is | the same finding as a line |
|
|
1559
|
-
| one call over its statement ceiling — `statementsMax`, or the entry's own `statements: { max, why }` | `X_STATEMENTS_OVER_BUDGET`, the busiest call and its three largest shapes | the same finding as a line, judged at 100 |
|
|
1560
|
-
|
|
1561
|
-
**Route loads** (`As of 31.17.0`). After the primitives, the pass runs every `app/` and `site/`
|
|
1562
|
-
file route that declares a `load` — the route table `x routes` prints — once in its own seeded
|
|
1563
|
-
tenant, as the runtime calls it: in a request, as the first actor the route's permission allows (a
|
|
1564
|
-
signed-in one where it names none), its params a seeded row's id or the route's own `prerender()`
|
|
1565
|
-
sample. Each load gets the primitives' proofs: its statements counted against the ceiling (100), a
|
|
1566
|
-
scale sweep at 2 and 8 rows a table, and the plan oracle over what it sent. The records ride beside
|
|
1567
|
-
`records`, as `routes[]` in `--json` and `.x/exercise.json` (`{ kind: 'route', name, file, outcome,
|
|
1568
|
-
reason?, statements, effects, ms, statementCeiling?, plans?, scale? }`), and every finding is a
|
|
1569
|
-
**warning line** on `main` — `route /messages (apps/web/app/messages/page.tsx) · X_QUERY_SCALES_WITH_ROWS …`,
|
|
1570
|
-
`· X_STATEMENTS_OVER_BUDGET …`, a plan code, or `· load not exercised: <reason>` — never red: no
|
|
1571
|
-
floor key opts a page read in yet.
|
|
1572
|
-
|
|
1573
|
-
**Reached with nothing to prove** (`As of 31.17.0`): a primitive reached that sent no statement and
|
|
1574
|
-
had no effect has vacuous proofs — a sweep of nothing is `flat`. One warning line names the first
|
|
1575
|
-
five, `X_EXERCISE_EMPTY_REACH … — fix: edit exercise.ts: give each an input that reaches its work, or
|
|
1576
|
-
{ off: '<why>' }`. A warning, not red, on a whole-pass run only.
|
|
1577
|
-
|
|
1578
|
-
**Route entries** (`As of 2026-11-15`). What a page needs that a seeded id and a role cannot give it
|
|
1579
|
-
is `defineExercise`'s second argument, keyed by the URL pattern `x routes` prints:
|
|
1580
|
-
|
|
1581
|
-
```ts
|
|
1582
|
-
import type { Actor } from '@ultimat3/core';
|
|
1583
|
-
import { defineExercise } from '@ultimat3/testing';
|
|
1584
|
-
|
|
1585
|
-
declare const author: Actor; // a signed-in actor the policy allows
|
|
1586
|
-
declare function asMember(seated: Actor | null): Promise<Actor | null>;
|
|
1587
|
-
declare function ownThread(): Promise<{ id: string }>;
|
|
1588
|
-
declare function consentQuery(): Promise<string>;
|
|
1589
|
-
|
|
1590
|
-
export const exercise = defineExercise(
|
|
1591
|
-
{ publishPost: { actor: author } },
|
|
1592
|
-
{
|
|
1593
|
-
routes: {
|
|
1594
|
-
'/posts/board': { actor: asMember }, // (seated) => the actor the authenticator resolves: its facts
|
|
1595
|
-
'/messages/:id': { params: ownThread }, // computed in the load's own request, as its actor
|
|
1596
|
-
'/oauth/consent': { search: consentQuery }, // the query string a load reads off `url`
|
|
1597
|
-
'/about': { empty: 'renders a static page: no row' },
|
|
1598
|
-
'/admin': { off: 'measured by its own e2e test' },
|
|
1599
|
-
},
|
|
1600
|
-
},
|
|
1601
|
-
);
|
|
1602
|
-
```
|
|
1603
|
-
|
|
1604
|
-
`params`, `search` and an `actor` function run inside the load's request before the observed call,
|
|
1605
|
-
so their statements are never the load's; a function that throws leaves the load `unreached` with
|
|
1606
|
-
`its exercise.ts <field> threw`. `statements: { max, why }` moves its ceiling. A blank `off`, `empty`
|
|
1607
|
-
or `why` is `X_CONTRACT_EXERCISE_UNDECLARED`; a pattern no route with a `load` has is
|
|
1608
|
-
`X_DECLARATION_UNKNOWN` before a row is written. A load that reads the app's own typed client
|
|
1609
|
-
(`queries.orgPosts(…)` over `APP_URL`) is answered **in process** by the app's API, as the actor the
|
|
1610
|
-
load runs as — `APP_URL` is set to `http://localhost:3000` when the env names none — so its
|
|
1611
|
-
statements are counted and swept like the page's own. A route load reached with no statement and no
|
|
1612
|
-
effect is its own `· X_EXERCISE_EMPTY_REACH` line, its fix the `empty` entry to paste; a primitive's
|
|
1613
|
-
entry takes `empty: '<why>'` too, and a record whose entry gives one carries it as `empty`.
|
|
1614
|
-
|
|
1615
|
-
**Push is an effect** (`As of 2026-11-15`). Every actor holds one stand-in Web Push device in the
|
|
1616
|
-
pass, as the memory mail driver accepts every address, so a notifier's `webPush()` encrypts, signs
|
|
1617
|
-
and sends to the captured push service, and the record carries `{ kind: 'push', host, count }`. A
|
|
1618
|
-
pusher that sends nothing leaves no effect: its job is an empty reach, not a delivered push.
|
|
1619
|
-
|
|
1620
|
-
**A storage write is an effect** (`As of 2026-11-15`). An object the call puts, copies or deletes
|
|
1621
|
-
through a `defineStorage` disk is `{ kind: 'storage', disk, op, count }` on its record, so an upload
|
|
1622
|
-
or export that stores only an object is no empty reach. A read is none, nor is a write the driver
|
|
1623
|
-
refused. A multipart session (`grantMultipart`, `abortUpload`) is not counted yet: its calls are not
|
|
1624
|
-
on the event bus.
|
|
1625
|
-
|
|
1626
|
-
**`--shard i/n`** (`As of 2026-11-15`) runs the i-th of n disjoint slices of the pass — primitives,
|
|
1627
|
-
then routes, by their position in the registry — on its own scratch database, and writes
|
|
1628
|
-
`.x/exercise.<i>-of-<n>.json` (never `.x/exercise.json`). Run the n slices as n processes. Each
|
|
1629
|
-
slice's findings are its own; the static findings and the subject proof are slice 1's; the whole-pass
|
|
1630
|
-
floor (`unprovenMax`, its warning line) is judged only unsharded. Beside a `<name>`, or not i/n,
|
|
1631
|
-
`X_VERIFY_SHARD_INVALID`, fix `x exercise --shard 1/2 --json`.
|
|
1632
|
-
|
|
1633
|
-
Errors: `X_CONTRACT_EXERCISE_UNREACHED`, `X_CONTRACT_EXERCISE_UNDECLARED`, `X_DECLARATION_UNKNOWN`, `X_CLI_BAD_FLAG`, `X_EXERCISE_UNPROVEN_ABOVE_FLOOR`, `X_EXERCISE_SEED_FAILED`, `X_STATEMENTS_OVER_BUDGET`; warning lines only: `X_EXERCISE_EMPTY_REACH`.
|
|
1634
|
-
|
|
1635
|
-
## x drill
|
|
1636
|
-
|
|
1637
|
-
```bash
|
|
1638
|
-
x drill [<name>] [--list] [--budget-ms n] [--json]
|
|
1639
|
-
```
|
|
1640
|
-
|
|
1641
|
-
The app run through its dependencies failing, `As of 2026-11-06`. Each drill boots a fleet on a
|
|
1642
|
-
scratch database made on `TEST_DATABASE_URL` and dropped after: `ROLE=migrate`, then `web` and
|
|
1643
|
-
`worker` as separate processes (`apps/web/server.ts`), each dialling Postgres, and Redis or NATS
|
|
1644
|
-
where the app declares them, through a Bun TCP fault proxy; `nats-down` adds the `sync` role and a
|
|
1645
|
-
sync client that dials it. Load runs before, through and after the fault over the site's
|
|
1646
|
-
parameterless pages and every action an anonymous POST reaches, each request a fresh input drawn
|
|
1647
|
-
as `x exercise` draws one (`apps/web/exercise.ts` honoured; `data.skippedWrites` names every action
|
|
1648
|
-
left out and why) — the writes are how a job reaches the queue for the worker drills. `/readyz` is
|
|
1649
|
-
sampled throughout.
|
|
1650
|
-
|
|
1651
|
-
| Drill | Fault | Must hold |
|
|
1652
|
-
|---|---|---|
|
|
1653
|
-
| `pg-blackhole` | live sockets unanswered, server healthy | `requests-coded`, `requests-bounded`, `recovers`, `jobs-once` |
|
|
1654
|
-
| `pg-slow` | every byte delayed half the deadline | `requests-coded`, `requests-bounded`, `recovers` |
|
|
1655
|
-
| `pg-restart` | `reset`, then `refuse`, then `pass` | `requests-coded`, `readyz-flips`, `recovers`, `jobs-once` |
|
|
1656
|
-
| `redis-down` | the cache tier blackholed | `requests-coded`, `requests-prompt`, `requests-ok`, `recovers` |
|
|
1657
|
-
| `nats-down` | the bus refused | `requests-coded`, `recovers`, `sync-resumes` |
|
|
1658
|
-
| `worker-sigkill` | `SIGKILL` the worker, then a fresh one | `jobs-terminal`, `jobs-once`, `requests-coded` |
|
|
1659
|
-
| `worker-sigterm` | `SIGTERM` the worker, then a fresh one | `role-exits`, `jobs-terminal`, `jobs-once` |
|
|
1660
|
-
| `web-sigterm` | `SIGTERM` the web role under load | `requests-ok`, `role-exits` |
|
|
1661
|
-
| `roll-before-migrate` | the roles started before `ROLE=migrate`, on a schema stamped by an older build | `roles-wait`, `serves-after-migrate`, `one-wait-line` |
|
|
1662
|
-
|
|
1663
|
-
`roll-before-migrate`, `As of 2026-11-15`, is the rollout order a deploy cannot always hold: no
|
|
1664
|
-
fault and no load. The scratch database is migrated, its framework stamp (`x_jobs`' table comment)
|
|
1665
|
-
is rewound to name only an older build, then `web`, `worker` and `scheduler` start on it without
|
|
1666
|
-
waiting for readiness, with `sync` when `TEST_NATS_URL` is set and `replicator` when
|
|
1667
|
-
`TEST_REPLICATION_URL` names a logical server (the scratch database then lives there) and the app
|
|
1668
|
-
has an entity on a table. A role left out is in `data.rolesNotPlayed[]`, `{ drill, role, needs }`. Once each has logged its wait (or exited), they are held 3 s and
|
|
1669
|
-
`ROLE=migrate` runs again. Each must stay up (`roles-wait`: an exit is a crash-loop), log exactly
|
|
1670
|
-
one line naming `X_FRAMEWORK_SCHEMA_UNAPPLIED` (`one-wait-line`), and answer `/readyz` 200 once
|
|
1671
|
-
migrate has run (`serves-after-migrate`). `ULTIMATE_SCHEMA_WAIT_MS` is inherited: `0` — refuse at
|
|
1672
|
-
once — turns it red. Its evidence is `evidence.rollout.roles[]`, each
|
|
1673
|
-
`{ role, exit, ready, waitLines, logTail }`.
|
|
1674
|
-
|
|
1675
|
-
Thresholds come from the app: the request deadline (`@ultimat3/http`'s default, 30 s, because
|
|
1676
|
-
`configureHttp` is runtime code the CLI does not run), `drain.deadlineMs` plus
|
|
1677
|
-
`drain.readinessGraceMs`, and `health.readiness` — under `'process'`, `readyz-flips` expects 200
|
|
1678
|
-
throughout. `--budget-ms` replaces the deadline the verdict judges against, not the app's, and is
|
|
1679
|
-
printed in `data.budgets.override`. An answer may reach the load up to 500 ms past the deadline
|
|
1680
|
-
(`DRILL_ANSWER_SLACK_MS`: the 504 a deadline fires arrives a beat after it). A 5xx with no `X_*`
|
|
1681
|
-
code, or `X_INTERNAL`, is always red. A property with no evidence is red, never passed: a job
|
|
1682
|
-
property is red when no job ran during the drill, `sync-resumes` when no sync client ran.
|
|
1683
|
-
|
|
1684
|
-
A service the app uses must be up for every drill; an unset one is refused, never skipped. A named
|
|
1685
|
-
drill that faults a service the app does not declare is refused; a whole run lists it under
|
|
1686
|
-
`data.notRun`. `--list` prints the table and runs nothing. `--json`: `{ budgets, targets,
|
|
1687
|
-
skippedWrites, drills[], notRun, rolesNotPlayed }`, each drill `{ name, verdict, evidence, budgets, baseline }`.
|
|
1688
|
-
|
|
1689
|
-
Errors: `X_DRILL_FAILED` (one per property that did not hold), `X_DRILL_SERVICE_MISSING`, `X_CLI_UNKNOWN_COMMAND`, `X_CLI_BAD_FLAG`.
|
|
1690
|
-
|
|
1691
|
-
## x policy
|
|
1692
|
-
|
|
1693
|
-
```bash
|
|
1694
|
-
x policy [list|explain <subject> [--input '<json>']] [--json]
|
|
1695
|
-
```
|
|
1696
|
-
|
|
1697
|
-
| Subcommand | Does |
|
|
1698
|
-
|---|---|
|
|
1699
|
-
| `list` | every permission, the roles that grant it, and the actions and queries that enforce it — plus the permissions **nothing** enforces, which are grants that do nothing |
|
|
1700
|
-
| `explain <subject>` | one row per actor per declaration — every declared role plus `anonymous`, for each action or query that enforces the subject — naming the clause that decided and its reason. Verdict `allow`, `deny`, or `needs input` |
|
|
1701
|
-
|
|
1702
|
-
| Flag | Does |
|
|
1703
|
-
|---|---|
|
|
1704
|
-
| `--input '<json>'` | `explain` only: the request's input, as one JSON argument. A predicate that reads input is decided on it. Not JSON is `X_CLI_BAD_FLAG`, reported by length; the value is never echoed back |
|
|
1705
|
-
|
|
1706
|
-
`<subject>` resolves in order against a permission (`post:publish`), an action name (`publishPost`), a query name (`postFeed`), then an action's HTTP path (`/api/posts/publish`) — so the `fix:` line printed by an `X_FORBIDDEN` is runnable whichever of the four the throwing surface had to hand.
|
|
1707
|
-
|
|
1708
|
-
```bash
|
|
1709
|
-
$ x policy explain closeTicket
|
|
1710
|
-
action closeTicket — policy ticket:write
|
|
1711
|
-
actor verdict deciding reason
|
|
1712
|
-
anonymous deny ticket:write no actor for ticket:write
|
|
1713
|
-
admin needs input ticket:write not denied — every actor-only clause passes, and ticket:write has a predicate that reads the request input
|
|
1714
|
-
viewer deny ticket:write actor lacks ticket:write
|
|
1715
|
-
evaluated with no request input and no row — a rule reading either decides again on the real request
|
|
1716
|
-
✓ closeTicket — allowed for 0 of 3 actor evaluation(s); 1 not denied, decided by a predicate that reads the request input — x policy explain closeTicket --input '<the request input as JSON>'
|
|
1717
|
-
|
|
1718
|
-
$ x policy explain closeTicket --input '{"orgId":"0190…","ticketId":"0190…"}'
|
|
1719
|
-
```
|
|
1720
|
-
|
|
1721
|
-
The verdict comes from `@ultimat3/policy`'s own `policyMatrix()` over the app's real `Policy` objects — the same evaluation the request path runs, never a second one. With no `--input` there is no request to read, so a predicate that reads one is **not decided**: the row says `needs input` (`verdict: "needs-input"`, `allowed: null` in `--json`, counted in `data.pending`), never `deny` (`As of 2026-11-19`). Reading is detected, not assumed: the predicate runs over a stand-in input that records being read, so one reading only the actor (`({ actor }) => …`) still decides. `deny` means what it says — no actor, no grant, or an actor-only predicate that refused. A row-level rule is evaluated with no row and decides again on the real request (`row?.ownerId === actor.id` still reads `deny` under that note). The actors carry no `orgId`, so an org-scoped predicate compares against `undefined` even with `--input`. With `--input`, a policy that throws on it (a field the JSON does not carry) reports `decidable: false` and a note in place of the table, never a table of invented denials.
|
|
1722
|
-
|
|
1723
|
-
Errors: `X_DECLARATION_UNKNOWN`, `X_CLI_BAD_FLAG`.
|
|
1724
|
-
|
|
1725
|
-
## x i18n
|
|
1726
|
-
|
|
1727
|
-
```bash
|
|
1728
|
-
x i18n [check|add <locale>|sync <locale>] [--json]
|
|
1729
|
-
```
|
|
1730
|
-
|
|
1731
|
-
| Subcommand | Does |
|
|
1732
|
-
|---|---|
|
|
1733
|
-
| `check` | scan every `t('…')` in the app's source, audit it against every catalog on disk, and **fail** on a missing key |
|
|
1734
|
-
| `add <locale>` | write `packages/i18n/catalogs/<locale>.json` seeded with the default locale's keys and values |
|
|
1735
|
-
| `sync <locale>` | add the keys that locale is missing; a key it already has is never overwritten, translated or not |
|
|
1736
|
-
|
|
1737
|
-
Catalogs are one flat file per locale under `packages/i18n/catalogs/`. `check` reports three things separately: `missing` (a gap, and an exit code), `unused` (defined and never called), and `dynamic` — a `t(`plans.${plan}.name`)` the extractor cannot resolve. A dynamic call contributes its static head as a runtime-key prefix, so a key only ever reached that way is never listed unused; an expression with no static head contributes nothing, because a guessed prefix would suppress real gaps.
|
|
1738
|
-
|
|
1739
|
-
Errors: `X_CATALOG_MISSING_KEYS` (per locale, as a finding), `X_I18N_FAMILY_INCOMPLETE` (a `_select_`/`_ordinal_` family with no `_other`), `X_CATALOG_INVALID`, `X_GENERATE_CONFLICT` (`add` over an existing catalog), `X_CLI_BAD_FLAG`, `X_SCAFFOLD_PATH_ESCAPE`.
|
|
1740
|
-
|
|
1741
|
-
## x mail
|
|
1742
|
-
|
|
1743
|
-
```bash
|
|
1744
|
-
x mail preview <id> [--locale <tag>] [--tz <zone>] [--out <dir>] [--json]
|
|
1745
|
-
```
|
|
1746
|
-
|
|
1747
|
-
`As of 2026-11-06`. Renders the mail's `defineMail({ preview })` data through `renderMessage`'s own
|
|
1748
|
-
path, with nothing sent. No `--locale`: every locale the app routes.
|
|
1749
|
-
|
|
1750
|
-
| Flag | Type | Default | Meaning |
|
|
1751
|
-
|---|---|---|---|
|
|
1752
|
-
| *(positional)* | mail id | — | the `defineMail({ id })` to render |
|
|
1753
|
-
| `--locale` | string | every routed locale | one locale |
|
|
1754
|
-
| `--tz` | IANA zone | `UTC` | every date in the body; never the machine's zone (`X_TIMEZONE_INVALID`) |
|
|
1755
|
-
| `--out` | string | — | write `<id>.<locale>.html` and `<id>.<locale>.txt` there |
|
|
1756
|
-
|
|
1757
|
-
`--json`: `data.tz` is the zone rendered in; `data.previews[]` is `{ locale, subject, missing, files }`; `missing` names every catalog
|
|
1758
|
-
key the locale cannot resolve, and any is a non-zero exit. `x verify`'s `i18n` step renders every
|
|
1759
|
-
declared preview in every locale the same way, so a preview is a test too.
|
|
1760
|
-
|
|
1761
|
-
Errors: `X_MAIL_PREVIEW_MISSING`, `X_MAIL_PREVIEW_INVALID`, `X_MAIL_TEMPLATE_UNKNOWN`, `X_CLI_BAD_FLAG`.
|
|
1762
|
-
|
|
1763
|
-
## x test
|
|
1764
|
-
|
|
1765
|
-
```bash
|
|
1766
|
-
x test [unit|contract|live|job|e2e|eval] [--filter path[,path…]] [--allow-empty] [--sample N]
|
|
1767
|
-
[--affected [--base <ref>] [--dirty]] [--workers N] [--seed N] [--json]
|
|
1768
|
-
[-- <bun test flags>]
|
|
1769
|
-
```
|
|
1770
|
-
|
|
1771
|
-
| Flag | Type | Default | Meaning |
|
|
1772
|
-
|---|---|---|---|
|
|
1773
|
-
| *(positional)* | test type | every type | one of the six; a test's type is its filename suffix |
|
|
1774
|
-
| `--filter` | string | — | only files whose path contains this substring — or ANY of several, comma-separated (`--filter apps/web/app/billing/,apps/web/app/case/`), in one run. An empty item (`a,,b`) is refused: `''` matches every path |
|
|
1775
|
-
| `--allow-empty` | boolean | off | a selection that matches no test file exits **0**, spawns nothing, and says so (`no test file matches … — 0 test file(s) ran`, `data.files: 0`, `data.empty: true`) instead of `X_TEST_NO_FILES`. For a runner that computes the selection; a hand-typed typo stays red without it |
|
|
1776
|
-
| `--sample` | string | — | run at most N files of the selection, deterministically. A fast signal for the eval loop — **never a gate** |
|
|
1777
|
-
| `--workers` | string | one per 1.25 GiB of a `max(2.75 GiB, 25% of RAM)` budget, at most one per core (the gate's width) | worker count, 1 to 64; each worker gets its own template-cloned database |
|
|
1778
|
-
| `--affected` | boolean | off | narrow the selection to the tests the diff can break: in an app root, by import closure (the files `x affected` reports as `data.tests`); elsewhere, the workspaces the diff touches and everything that depends on them. `--base`/`--dirty` without it are refused, not ignored |
|
|
1779
|
-
| `--base` | string | `origin/HEAD`'s branch | the ref to diff against, merge-base (`<base>...HEAD`). Unset: `origin/HEAD`'s target, else `origin/main`, else local `main` — `x affected`'s default. Needs `--affected` |
|
|
1780
|
-
| `--dirty` | boolean | off | union the working tree in — uncommitted and untracked. Needs `--affected` |
|
|
1781
|
-
| `--seed` | string | — | replay one `simulateJobs` seed, the `N` an `X_JOB_SIM_INVARIANT` names: handed to every `bun test` child as `ULTIMATE_JOB_SIM_SEED`, which runs that seed alone. A uint32, else `X_CLI_BAD_FLAG`. The shard reproduce line does not carry it yet |
|
|
1782
|
-
| `-- <args>` | tail | — | handed to `bun test` verbatim, before the file list — `x test unit -- --coverage --bail`. The reproduce line carries it back. **`x test` is the only command that reads a `--` tail**: every other one refuses it (`X_CLI_BAD_FLAG`) rather than dropping it, which is what all of them did until 2026-09 |
|
|
1783
|
-
|
|
1784
|
-
The type rule is `x verify`'s, not a second one — so `x test contract` runs exactly what the gate's `contract` step runs. A selection that matches no files is `X_TEST_NO_FILES` (green with `--allow-empty`); an unknown type is `X_CLI_BAD_FLAG` naming the six and suggesting the nearest.
|
|
1785
|
-
|
|
1786
|
-
**Exit codes, `As of 2026-11-19`.** `0`: at least one test ran and none failed. `1`: a test failed — `X_TEST_FAILED`, its cause naming the failing files (up to 5) and its fix rerunning the first one alone (`x test <type> --filter <file> --workers 1`; the whole reproduce line only when bun named no file; `data.reproduce` unchanged). **`1` too when every test the run selected skipped itself** (`ran 0`, `skipped N`): `bun test` exits 0 there, but nothing was checked. The summary reads `live — 0 test(s) ran: all 1 skipped themselves, so nothing was checked`; the finding is `X_TEST_FAILED`, its cause naming any unset `TEST_DATABASE_URL`, `TEST_REDIS_URL` or `TEST_NATS_URL` and its fix starting the test services, then the same selection — or, with nothing unset, a `grep -nE 'skip|needs:'` over the files. `x verify` is unaffected: its steps do not go through this verdict.
|
|
1787
|
-
|
|
1788
|
-
**In an app root `--affected` narrows by import closure, `As of 2026-11`** — every slice shares the `apps/web` workspace, so the workspace answer ran the whole app. The rule is `x affected`'s `data.tests`, never a second one: a test runs when its imports reach a changed file, transitively; a changed file the import graph cannot speak for (`app.config.ts`, `package.json`, a catalog, anything outside the app) runs every test; a discovered test outside the scanned globs always runs. `data.affected.tests` carries `{ app, all, reason, forcing, files: [{ path, why }] }` — `reason` is `closure: N changed file(s)` or `all: <forcing files>`, `why` is `closure`, `all` or `unmapped`. Outside an app root, `data.affected` has no `tests` and the workspace scope is unchanged.
|
|
1789
|
-
|
|
1790
|
-
`--affected` narrows the FEEDBACK, never the gate. The GATE stays un-narrowable — `x verify` with no flag is the gate, and `x verify --only <step>` announces `NOT A GATE RUN` in both renderers precisely so a narrowed run can never be read as one — because a gate that can be scoped is a gate that can be scoped wrong. Nothing affected is **green with zero spawns**, not a failure: editing a `.md` should not fail a build. A failure's `fix:` carries `--affected --base <ref>` back with it, because `--affected` decides which files exist to run at all and a rerun without it selects the whole corpus.
|
|
1791
|
-
|
|
1792
|
-
**The inner loop in this repository is `bun run test:affected`, `As of 2026-11-07`** — `x test --affected --base origin/main --dirty` from the root: the workspaces the branch and the working tree touch, plus every workspace that depends on one; a changed file no workspace owns (`package.json`, `bun.lock`, `tsconfig*.json`, `biome.json`, `scripts/**`, the test preload) runs everything, and `.md` alone runs nothing. `bun run test` is `x test` over the whole corpus — the same passes and width as the gate's test steps. Neither is the gate: CI and `x verify merge` run full `x verify`.
|
|
1793
|
-
|
|
1794
|
-
**A selection that mixes serial files with the rest is more than one run, `As of 2026-09`.** `--parallel=N` is the width of the WHOLE `bun test`, so the bare `x test --workers 8` — which selects every type — ran `live` and `e2e` eight at a time beside the unit corpus, over the very files `x verify` runs one at a time. The files are partitioned by type: one pass at the requested width for everything that may share a pool, then one pass at `--parallel=1` per serial type, each reproducible on its own (`x test live --workers 1`). `--json` carries a `passes` array when there was more than one.
|
|
1795
|
-
|
|
1796
|
-
## x clean
|
|
1797
|
-
|
|
1798
|
-
```bash
|
|
1799
|
-
x clean [--dry-run] [--services] [--json]
|
|
1800
|
-
```
|
|
1801
|
-
|
|
1802
|
-
Every test leftover the framework knows of, cleared (`As of 27.3.0`): the migrated test-database templates under `.x/test-db`, the whole `.x/cache`, any `.x` folder below the app root, and — with `TEST_DATABASE_URL` set — every probe database whose run is over. `--dry-run` names them and removes nothing; `--json` carries `data.paths` and `data.databases`. Never touched: `.x/pgdata` (the dev database), `.x/storage`, the build output. The test runner sweeps the same set before every run, keeping the newest two of each cache, so `x clean` is for reclaiming the rest by hand. [Testing](Testing#database-state-and-what-a-run-leaves-behind) has the table.
|
|
1803
|
-
|
|
1804
|
-
**`--services`** (`As of 2026-11-18`) also runs `docker compose -f docker/docker-compose.test.yml down --volumes` for this checkout's stack. A stack another existing checkout started is kept, with the line that stops it. Every other test stack on the machine is listed, never touched. `--dry-run` stops nothing. `--json`: `data.services` with `action` (`stopped`, `would-stop`, `kept`, `none`, `failed`), `project`, `services`, `owner`, and `others[]` (`project`, `status`, `root`, `gone`). Docker failing is `X_TEST_SERVICES_UNAVAILABLE`, exit 1.
|
|
1805
|
-
|
|
1806
|
-
## x upgrade
|
|
1807
|
-
|
|
1808
|
-
```bash
|
|
1809
|
-
x upgrade [--to <version>] [--only <step>[,<step>…]] [--dry-run] [--json]
|
|
1810
|
-
x upgrade codemods --from <version> [--to <version>] [--dry-run] [--json]
|
|
1811
|
-
```
|
|
1812
|
-
|
|
1813
|
-
One major per run, so each hop's gate attributes its red to that hop. `As of 30.0.0`.
|
|
1814
|
-
|
|
1815
|
-
**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`.
|
|
1816
|
-
|
|
1817
|
-
| Step | What | Refused with |
|
|
1818
|
-
|---|---|---|
|
|
1819
|
-
| 1 | clean tree, git is the only state between runs | `X_UPGRADE_DIRTY_TREE` |
|
|
1820
|
-
| 2 | read every workspace's `@ultimat3/*` pins, `overrides` and `resolutions` included | `X_UPGRADE_PIN_UNREADABLE`, `X_UPGRADE_MIXED_PINS` |
|
|
1821
|
-
| 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` |
|
|
1822
|
-
| 4 | write exact pins, raise the Bun floor | — |
|
|
1823
|
-
| 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 |
|
|
1824
|
-
| 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 exercise --json` and its `exercise` floor figures, `x verify --json` | `X_UPGRADE_GATE_UNREADABLE`, as a finding on a red hop |
|
|
1825
|
-
|
|
1826
|
-
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.
|
|
1827
|
-
|
|
1828
|
-
`--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.
|
|
1829
|
-
|
|
1830
|
-
`--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.
|
|
1831
|
-
|
|
1832
|
-
| `data` field | Meaning |
|
|
1833
|
-
|---|---|
|
|
1834
|
-
| `from`, `to` | the lowest version pinned; this hop's target |
|
|
1835
|
-
| `next` | what a bare `x upgrade` takes after this hop; `null` when the walk is over |
|
|
1836
|
-
| `done` | verify's verdict, and the exit code follows it. `true` when already there, `false` on a dry run |
|
|
1837
|
-
| `dryRun` | nothing written, no gate run |
|
|
1838
|
-
| `app` | whether the root holds `app.config.ts` |
|
|
1839
|
-
| `proof` | what `done` rests on: `verify` (the full gate), `verify-only` (`--only`: some steps, the rest in `verify.notRun`), `scripts` or `none` |
|
|
1840
|
-
| `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 |
|
|
1841
|
-
| `pins[]` | `{ file, name, from, to }` |
|
|
1842
|
-
| `bun` | `{ from, to, edited[], manual[] }`. `manual[]`: `{ path, line, text, why }`, a site only you can move, listed on every run |
|
|
1843
|
-
| `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 |
|
|
1844
|
-
| `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 |
|
|
1845
|
-
| `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 |
|
|
1846
|
-
| `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 |
|
|
1847
|
-
| `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 |
|
|
1848
|
-
| `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 |
|
|
1849
|
-
| `manifest` | `{ ok, findings[] }`. A failure does not stop the gate |
|
|
1850
|
-
| `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 |
|
|
1851
|
-
| `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 |
|
|
1852
|
-
| `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) |
|
|
1853
|
-
| `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 |
|
|
1854
|
-
| `then` | the next thing to do, in a sentence naming the commands |
|
|
1855
|
-
|
|
1856
|
-
**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:
|
|
1857
|
-
|
|
1858
|
-
| Flag | Type | Default | Meaning |
|
|
1859
|
-
|---|---|---|---|
|
|
1860
|
-
| `--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` |
|
|
1861
|
-
| `--to` | string | this CLI's version | the last release whose codemods run |
|
|
1862
|
-
| `--dry-run` | boolean | off | report what would change; write nothing |
|
|
1863
|
-
|
|
1864
|
-
`data.codemods` is the same shape as the hop's, without `source`. A second run changes nothing.
|
|
1865
|
-
|
|
1866
|
-
`null` for `guards`, `manifest`, `exercise` and `verify` means no gate ran: a dry run, already there, or no app.
|
|
1867
|
-
|
|
1868
|
-
**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.
|
|
1869
|
-
|
|
1870
|
-
| Bun site | Edit |
|
|
1871
|
-
|---|---|
|
|
1872
|
-
| `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` |
|
|
1873
|
-
| `bun-version:` in YAML | same, quotes kept. An expression (`${{ env.BUN_VERSION }}`) or an x-range is listed in `manual` |
|
|
1874
|
-
| `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 |
|
|
1875
|
-
|
|
1876
|
-
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.
|
|
1877
|
-
|
|
1878
|
-
## x affected
|
|
1879
|
-
|
|
1880
|
-
```bash
|
|
1881
|
-
x affected [--base <ref>] [--dirty] [--paths] [--json]
|
|
1882
|
-
```
|
|
1883
|
-
|
|
1884
|
-
| Flag | Type | Default | Meaning |
|
|
1885
|
-
|---|---|---|---|
|
|
1886
|
-
| `--base` | string | `origin/HEAD`'s branch | the ref to diff against. The diff is `<base>...HEAD` — **three dots**, so it is measured from the merge-base and an unrelated commit on `main` does not widen the answer. Unset, the base is the **remote-tracking** default branch, as already fetched (never fetched for you): `origin/HEAD`'s target, else `origin/main`, else local `main` when there is no remote-tracking ref (`origin/HEAD` or `origin/main`) (`As of 31.1`). `data.base` names the ref used |
|
|
1887
|
-
| `--dirty` | boolean | off | union the working tree in: uncommitted changes plus untracked files |
|
|
1888
|
-
| `--paths` | boolean | off | stdout is the directories alone, one per line — `bun test $(x affected --paths)`; notes and the `✓` summary go to stderr (`As of 31.1`). Under `--json` stdout stays the one document, and `data` is byte-identical either way |
|
|
1889
|
-
|
|
1890
|
-
**Transitive, or it is worse than nothing.** `A → B → C` means a change in `C` must reach `A`; a single pass over an unordered list reaches only `B`, and a scoped run that misses a transitive dependent is a green checkmark on a broken repo. The graph it walks is the one every workspace's `package.json` declares — which is why `package-shape` refuses an undeclared cross-workspace import (`X_WORKSPACE_DEP_UNDECLARED`): an edge missing from a manifest is an edge missing from this answer, silently.
|
|
1891
|
-
|
|
1892
|
-
Three rules the set obeys:
|
|
1893
|
-
|
|
1894
|
-
| Change | Affected |
|
|
1895
|
-
|---|---|
|
|
1896
|
-
| any non-doc file no workspace owns — `tsconfig.json`, `tsconfig.base.json`, `biome.json`, `bun.lock`, root `package.json`, `app.config.ts`, `scripts/**`, `guards/**` | **every** workspace, and the root itself: `x test --affected` runs every test file, those under no workspace included. Decided by ownership, never by a list of names |
|
|
1897
|
-
| a workspace's own `package.json` | that workspace only |
|
|
1898
|
-
| a `.md` | nothing. A doc has no compilation unit to re-check |
|
|
1899
|
-
|
|
1900
|
-
**Why the default base is `origin/main`, not `main`.** Local `main` moves only on a pull, so in a checkout nobody pulls — or a worktree — it lags origin, and `main...HEAD` counts every file origin merged since as this branch's work. `origin/main` moves on any `git fetch`. `x verify --changed` and `x test --affected` read the same default.
|
|
1901
|
-
|
|
1902
|
-
**`--base` is the default and `--dirty` is opt-in, which is the reverse of the obvious design.** This repo runs several agents concurrently in **one checkout** (no worktrees), so a working-tree diff returns every agent's uncommitted work at once and the "affected" set quietly expands to nearly the whole monorepo — narrowing nothing while reading as though it did. A ref diff is stable under that. `--dirty` is the right answer for one developer iterating alone.
|
|
1903
|
-
|
|
1904
|
-
**Typecheck is deliberately not scoped.** `bun run typecheck` is `tsc -b`, a project build over a shared `.tsbuildinfo`, so a "scoped" typecheck is either the whole project anyway or a weaker check. The time is in the tests, which is what `x test --affected` narrows.
|
|
1905
|
-
|
|
1906
|
-
## x graph · x impact
|
|
1907
|
-
|
|
1908
|
-
```bash
|
|
1909
|
-
x graph [--from <node> --to <node>] [--json]
|
|
1910
|
-
x impact <file|primitive|entity> [--json]
|
|
1911
|
-
```
|
|
1912
|
-
|
|
1913
|
-
The app as one graph, rebuilt per call from the loaded app (`As of 2026-11`). Nodes: `route`,
|
|
1914
|
-
`action`, `mutator`, `query`, `job`, `task`, `entity`, `permission`, `channel`, `tag`, `mcpTool`,
|
|
1915
|
-
`operation`, `file`, `test`, each id `<kind>:<name>`. An edge is `from` depends on `to`, with its
|
|
1916
|
-
provenance:
|
|
1917
|
-
|
|
1918
|
-
| Provenance | Source | Edges |
|
|
1919
|
-
|---|---|---|
|
|
1920
|
-
| `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) |
|
|
1921
|
-
| `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) |
|
|
1922
|
-
| `observed` | `.x/exercise.json`, when newer than `x.manifest.json` | `writes` / `reads` (entity), `enqueues` (job) |
|
|
1923
|
-
|
|
1924
|
-
`x impact` answers `{ routes, actions, queries, jobs, mcpTools, publishedOperations, tests, budgets,
|
|
1925
|
-
opaque, provenance }`, each entry with the provenances of the path that reached it. A non-empty
|
|
1926
|
-
`publishedOperations` means `contract-diff` will have an opinion. A file with a computed `import()`
|
|
1927
|
-
is `opaque`: it and its dependents are in every answer. `x graph --from a --to b` prints the
|
|
1928
|
-
shortest chain of edges, or none known and the provenances searched. A name, id or path that is
|
|
1929
|
-
no node is `X_GRAPH_NODE_UNKNOWN` with the nearest three. Queries carry no MCP fact in the
|
|
1930
|
-
manifest, so a query's `mcpTools` is reached only through an action that imports it.
|
|
1931
|
-
|
|
1932
|
-
**`x affected` in an app root** adds `data.tests`: the test files whose import closure meets the
|
|
1933
|
-
diff (`all: true` with `forcing` when a changed file is read rather than imported — `app.config.ts`,
|
|
1934
|
-
`package.json`, a catalog, anything outside the app).
|
|
1935
|
-
|
|
1936
|
-
## x client
|
|
1937
|
-
|
|
1938
|
-
```bash
|
|
1939
|
-
x client vendor <name> [--from <file|url>] [--only <tag,…>] [--json]
|
|
1940
|
-
x client customer --out <dir> [--mount <prefix>] [--only <tag,…>] [--package <name>] [--json]
|
|
1941
|
-
```
|
|
1942
|
-
|
|
1943
|
-
One compiler (`$ref`, objects, arrays, enums, `const`, `oneOf`/`anyOf`, `allOf`, nullable), two emitters. `As of 2026-11`.
|
|
1944
|
-
|
|
1945
|
-
| Subcommand | Reads | Writes | The client |
|
|
1946
|
-
|---|---|---|---|
|
|
1947
|
-
| `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)` |
|
|
1948
|
-
| `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) |
|
|
1949
|
-
|
|
1950
|
-
| Flag | Meaning |
|
|
1951
|
-
|---|---|
|
|
1952
|
-
| `--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 |
|
|
1953
|
-
| `--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` |
|
|
1954
|
-
| `--out` | `customer` only, required |
|
|
1955
|
-
| `--mount` | `customer` only: a declared bearer mount's prefix |
|
|
1956
|
-
| `--package` | `customer` only: a `package.json` named so; publishing is yours |
|
|
1957
|
-
|
|
1958
|
-
| Failure | Code |
|
|
1959
|
-
|---|---|
|
|
1960
|
-
| 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 |
|
|
1961
|
-
| not OpenAPI 3.0 or 3.1 | `X_CLIENT_SPEC_INVALID` |
|
|
1962
|
-
| a vendor answer that fails its declared shape | `X_OUTBOUND_BODY_INVALID` (core's), the field in `meta.issues` |
|
|
1963
|
-
| a documented vendor non-2xx | `X_OUTBOUND_REFUSED`, `meta.status` |
|
|
1964
|
-
|
|
1965
|
-
**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.
|
|
1966
|
-
|
|
1967
|
-
## x shot
|
|
1968
|
-
|
|
1969
|
-
```bash
|
|
1970
|
-
x shot <route> [--port 0] [--out <dir>] [--no-full] [--settle 2000]
|
|
1971
|
-
[--timeout 30000] [--browser <path>] [--cdp-url <ws://…>]
|
|
1972
|
-
[--allow-hosts a.com,b.com] [--theme light|dark] [--locale <l>]
|
|
1973
|
-
[--cookie name=value[,name=value]] [--expect-status 404]
|
|
1974
|
-
[--viewport 390x844,1440x900] [--json]
|
|
1975
|
-
x shot --matrix [<route>] [--locale <l>] [--theme light|dark] [--viewport …] [--cookie …] [--json]
|
|
1976
|
-
x shot --island <name> [--state <id>] [--json]
|
|
1977
|
-
x shot --all-islands [--json]
|
|
1978
|
-
```
|
|
1979
|
-
|
|
1980
|
-
**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.
|
|
1981
|
-
|
|
1982
|
-
| Flag | Default | Meaning |
|
|
1983
|
-
|---|---|---|
|
|
1984
|
-
| `<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 |
|
|
1985
|
-
| `--port` | `0` | the kernel picks a free one. **Never 3000**, which another project usually holds |
|
|
1986
|
-
| `--out` | `<root>/.x/shot/<slug>/` | `.x/` is already gitignored in every scaffold. A relative `--out` resolves against the cwd, as `x build --out` does |
|
|
1987
|
-
| `--full` | on (`--no-full` for the fold) | a fold-sized viewport crops nearly every route |
|
|
1988
|
-
| `--settle` | `2000` | matches the hydration runtime's own `requestIdleCallback` timeout |
|
|
1989
|
-
| `--timeout` | `30000` | one navigation |
|
|
1990
|
-
| `--browser` | `PUPPETEER_EXECUTABLE_PATH`, then `CHROME_PATH` | refused before anything boots if the path does not exist |
|
|
1991
|
-
| `--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 |
|
|
1992
|
-
| `--allow-hosts` | the app's host only | extra hosts the page may request |
|
|
1993
|
-
| `--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 |
|
|
1994
|
-
| `--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 |
|
|
1995
|
-
| `--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` |
|
|
1996
|
-
| `--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` |
|
|
1997
|
-
| `--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` |
|
|
1998
|
-
| `--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 |
|
|
1999
|
-
|
|
2000
|
-
**`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.
|
|
2001
|
-
|
|
2002
|
-
`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.
|
|
2003
|
-
|
|
2004
|
-
**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.
|
|
2005
|
-
|
|
2006
|
-
**`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`.
|
|
2007
|
-
|
|
2008
|
-
**`--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.
|
|
2009
|
-
|
|
2010
|
-
```bash
|
|
2011
|
-
# A provider session — the API call is theirs, the endpoint is what x shot needs
|
|
2012
|
-
CDP=$(curl -s -X POST https://api.example.com/v3/browsers -H "Authorization: Bearer $KEY" | jq -r .cdpUrl)
|
|
2013
|
-
x shot /pricing --cdp-url "$CDP" --json
|
|
2014
|
-
|
|
2015
|
-
# A sidecar in the same compose network
|
|
2016
|
-
x shot /pricing --cdp-url http://chrome:9222 --json
|
|
2017
|
-
```
|
|
2018
|
-
|
|
2019
|
-
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 })`.
|
|
2020
|
-
|
|
2021
|
-
**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.
|
|
2022
|
-
|
|
2023
|
-
**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.
|
|
2024
|
-
|
|
2025
|
-
### x shot --island
|
|
2026
|
-
|
|
2027
|
-
```bash
|
|
2028
|
-
x shot --island <name> [--state <id>] [--settle 2000] [--json]
|
|
2029
|
-
x shot --all-islands [--settle 2000] [--json]
|
|
2030
|
-
```
|
|
2031
|
-
|
|
2032
|
-
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.
|
|
2033
|
-
|
|
2034
|
-
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`.
|
|
2035
|
-
|
|
2036
|
-
| Flag | Default | Meaning |
|
|
2037
|
-
|---|---|---|
|
|
2038
|
-
| `--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 |
|
|
2039
|
-
| `--state <id>` | every declared state | one state. An id the manifest does not declare is refused by name, with the known ids |
|
|
2040
|
-
| `--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` |
|
|
2041
|
-
| `--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 |
|
|
2042
|
-
|
|
2043
|
-
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.
|
|
2044
|
-
|
|
2045
|
-
**`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.
|
|
2046
|
-
|
|
2047
|
-
### .x/shot/island/index.md
|
|
2048
|
-
|
|
2049
|
-
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.
|
|
2050
|
-
|
|
2051
|
-
| It carries | Why |
|
|
2052
|
-
|---|---|
|
|
2053
|
-
| the counts, and the commands that re-run everything / one island / one state | an artifact that cannot be regenerated is one nobody trusts twice |
|
|
2054
|
-
| what the capture could **not** see | the verdict's own `blind` list, handed in rather than reworded — two wordings would drift |
|
|
2055
|
-
| per island: the app-relative path of the `.island.tsx` | so a reader can open the component the pictures are of |
|
|
2056
|
-
| 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 |
|
|
2057
|
-
| 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 |
|
|
2058
|
-
| 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 |
|
|
2059
|
-
|
|
2060
|
-
**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.
|
|
2061
|
-
|
|
2062
|
-
**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.
|
|
2063
|
-
|
|
2064
|
-
**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.
|
|
2065
|
-
|
|
2066
|
-
**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.
|
|
2067
|
-
|
|
2068
|
-
**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.
|
|
2069
|
-
|
|
2070
|
-
**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.
|
|
2071
|
-
|
|
2072
|
-
## x pr · x ci
|
|
2073
|
-
|
|
2074
|
-
```bash
|
|
2075
|
-
x pr review [--pr <n>] [--repo owner/name] [--all] [--full] [--json]
|
|
2076
|
-
x pr resolve <thread-id> [--json]
|
|
2077
|
-
x pr reply <thread-id> --body "…" [--json]
|
|
2078
|
-
x ci [runs] [--branch <name>] [--run <id>] [--repo owner/name] [--tail <n>] [--full] [--workflow <name>] [--event <push|pull_request|workflow_dispatch>] [--json]
|
|
2079
|
-
x ci tested [--max-age 24h] [--repo owner/name] [--workflow ci.yml] [--json]
|
|
2080
|
-
```
|
|
2081
|
-
|
|
2082
|
-
**`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.
|
|
2083
|
-
|
|
2084
|
-
Two hazards it encodes, both of which have bitten in this repo:
|
|
2085
|
-
|
|
2086
|
-
| Hazard | What `x pr review` does |
|
|
2087
|
-
|---|---|
|
|
2088
|
-
| **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 |
|
|
2089
|
-
| **An outdated thread has `line: null`** | selects `originalLine` too, so a thread whose diff moved still has a locator instead of arriving anchorless |
|
|
2090
|
-
|
|
2091
|
-
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.
|
|
2092
|
-
|
|
2093
|
-
**`--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 …`.
|
|
2094
|
-
|
|
2095
|
-
**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.
|
|
2096
|
-
|
|
2097
|
-
`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.
|
|
2098
|
-
|
|
2099
|
-
**`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.
|
|
2100
|
-
|
|
2101
|
-
**Neither is a step of `x verify`.** A gate that needs network and a GitHub token goes red for reasons unrelated to the change.
|
|
2102
|
-
|
|
2103
|
-
## x errors
|
|
2104
|
-
|
|
2105
|
-
```bash
|
|
2106
|
-
x errors [explain <CODE> [--recent]|list] [--json]
|
|
2107
|
-
```
|
|
2108
|
-
|
|
2109
|
-
`--recent` (in an app) adds what THIS app has seen of the code: its groups in `x_error_groups`
|
|
2110
|
-
(count, first and last seen) and the bundles `x_failures` holds, each with its `x repro` line.
|
|
2111
|
-
|
|
2112
|
-
The [Error codes](Error-Codes) table, programmatically. Runs outside an app: triaging a code must not need an app root.
|
|
2113
|
-
|
|
2114
|
-
```bash
|
|
2115
|
-
$ x errors explain X_CURSOR_INVALID --json
|
|
2116
|
-
{"ok":true,"command":"errors","summary":"X_CURSOR_INVALID — pagination cursor is malformed…",
|
|
2117
|
-
"data":{"code":"X_CURSOR_INVALID","cause":"pagination cursor is malformed, tampered with or from
|
|
2118
|
-
another query","fix":"after: null // drop the cursor and request the first page again",
|
|
2119
|
-
"docs":"https://github.com/developerz-ai/ultimate/wiki/Error-Codes",
|
|
2120
|
-
"site":{"at":"@ultimat3/core/src/cursor.ts","line":28}}}
|
|
2121
|
-
```
|
|
2122
|
-
|
|
2123
|
-
`site` is the CLI locating a throw site in the tree — it is **not** a field the thrown error
|
|
2124
|
-
carries. A code raised at more than one site gets one of them, named in the `fix` line; run the
|
|
2125
|
-
command rather than quoting the line. `docs` is `ERROR_DOCS_URL`, the same URL for every code.
|
|
2126
|
-
|
|
2127
|
-
`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.
|
|
2128
|
-
|
|
2129
|
-
**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.
|
|
2130
|
-
|
|
2131
|
-
## x repro
|
|
2132
|
-
|
|
2133
|
-
```bash
|
|
2134
|
-
x repro <jobId|requestId|traceId|fingerprint> [--write] [--verify] [--json]
|
|
2135
|
-
x repro --list [--code X_…] [--json]
|
|
2136
|
-
x repro --from <file> [--write] [--verify] [--json]
|
|
2137
|
-
x repro <id> --bundle [--include-rows] [--json] | x repro --from <file> --bundle [--include-rows] [--json]
|
|
2138
|
-
```
|
|
2139
|
-
|
|
2140
|
-
A production failure becomes a failing test. `As of 2026-11`.
|
|
2141
|
-
|
|
2142
|
-
| Subject | Read from | Written as |
|
|
2143
|
-
|---|---|---|
|
|
2144
|
-
| 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 |
|
|
2145
|
-
| 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 |
|
|
2146
|
-
|
|
2147
|
-
The written test is RED until the fault is fixed. `--verify` runs it: `data.reproduced` is true
|
|
2148
|
-
when it failed with the captured code; otherwise the answer is `X_REPRO_NOT_REPRODUCED`, naming
|
|
2149
|
-
the masked fields and the captured build — a fault in the database or a different build replays
|
|
2150
|
-
green. Masked input (`.sensitive()`, secret-named keys) and masked columns are stood in for from
|
|
2151
|
-
the schema. `--list` reads the bundles with each group's count and last sighting. An id nothing
|
|
2152
|
-
holds is `X_REPRO_UNKNOWN`; a request id with capture off is `X_REPRO_CAPTURE_OFF`.
|
|
2153
|
-
|
|
2154
|
-
**`--bundle` carries the failure to an issue** (`As of 2026-11`): one JSON file,
|
|
2155
|
-
`repro/bundle-<id>.json` (the scaffold's `.gitignore` keeps it out of a commit), deterministic
|
|
2156
|
-
bytes, meant to be read before it is attached — its `readFirst` lines say what is in it and what
|
|
2157
|
-
is not found. Never with `--write`/`--verify`; `--include-rows` without `--bundle` is refused
|
|
2158
|
-
(`X_CLI_BAD_FLAG`).
|
|
2159
|
-
|
|
2160
|
-
| Section | Holds |
|
|
2161
|
-
|---|---|
|
|
2162
|
-
| `framework` | every installed `@ultimat3/*` package and the versions found of it, the CLI's, Bun's, the platform |
|
|
2163
|
-
| `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 |
|
|
2164
|
-
| `schema.entities` | the declarations of the entities whose rows the call read — never the whole app |
|
|
2165
|
-
| `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 |
|
|
2166
|
-
| `masked` / `scrubbed` | the masked paths; the env var NAMES whose values were found, the count of hostnames |
|
|
2167
|
-
| `reproducer` | the test, rendered from `subject` alone, against the scaffold's `apps/web/api` and the `@app/db` placeholder |
|
|
2168
|
-
|
|
2169
|
-
| Flag | Does |
|
|
2170
|
-
|---|---|
|
|
2171
|
-
| `--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 |
|
|
2172
|
-
|
|
2173
|
-
Replaced everywhere (never in the primitive's name, the code or the reproducer's imports): the app
|
|
2174
|
-
root (`.`), the home directory (`~`), an env value that is secret-named, a URL or from the app's
|
|
2175
|
-
`.env*` files (`[env:NAME]`; 6+ characters, any length under a secret name) — and an env URL's
|
|
2176
|
-
user and password raw, URL-decoded and base64 (a Basic header) —, every hostname in
|
|
2177
|
-
`app.config.ts` or an env URL (`[host]`), any URL's userinfo (`[cred]@`) and query values
|
|
2178
|
-
(`?k=[redacted]`), emails (`[email]`), IPv4/IPv6 addresses (`[ip]`); in a cause or frame, any other
|
|
2179
|
-
absolute file path (`<abs>/<file>`). **Not found**: a value this machine never knew — a
|
|
2180
|
-
production-only secret, a customer's name in a cause.
|
|
2181
|
-
|
|
2182
|
-
**A bundle is untrusted input.** `bunx create-ultimate repro <bundle.json>` reads only its
|
|
2183
|
-
`subject`, checked field by field (`X_REPRO_BUNDLE_INVALID` otherwise, control characters
|
|
2184
|
-
included), and renders the test from it; the bundle's own `reproducer` text never reaches disk.
|
|
2185
|
-
It opens into a scratch app (`repro-<id>/`), the test under `repro/`, linked to the framework
|
|
2186
|
-
checkout the command runs in (or `--framework <checkout>`) through `file:` overrides.
|
|
2187
|
-
|
|
2188
|
-
## x docs
|
|
2189
|
-
|
|
2190
|
-
```bash
|
|
2191
|
-
x docs "<question|topic|symbol>" [--limit <n>] [--json]
|
|
2192
|
-
```
|
|
2193
|
-
|
|
2194
|
-
**The first lookup**, before stating or working around a framework limit. Offline, no app needed. `As of 30.0.0`.
|
|
2195
|
-
|
|
2196
|
-
| Reads | Topic |
|
|
2197
|
-
|---|---|
|
|
2198
|
-
| 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>` |
|
|
2199
|
-
| this wiki, shipped in the `@ultimat3/cli` tarball (`wiki/`) — every page but Error codes | `wiki.<Page>`, `wiki.<Page>#<anchor>`, the anchor GitHub renders |
|
|
2200
|
-
| an `X_*` code | redirected to `x errors explain <CODE>`, the one way to a code |
|
|
2201
|
-
|
|
2202
|
-
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.
|
|
2203
|
-
|
|
2204
|
-
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.
|
|
2205
|
-
|
|
2206
|
-
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.
|
|
2207
|
-
|
|
2208
|
-
## x fix
|
|
2209
|
-
|
|
2210
|
-
```bash
|
|
2211
|
-
x fix boundary <file> [--json]
|
|
2212
|
-
```
|
|
2213
|
-
|
|
2214
|
-
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`.
|
|
2215
|
-
|
|
2216
|
-
`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`).
|
|
2217
|
-
|
|
2218
|
-
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.
|
|
2219
|
-
|
|
2220
|
-
`<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.
|
|
2221
|
-
|
|
2222
|
-
## x token
|
|
2223
|
-
|
|
2224
|
-
`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.
|
|
2225
|
-
|
|
2226
|
-
| Subcommand | Does |
|
|
2227
|
-
|---|---|
|
|
2228
|
-
| `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 |
|
|
2229
|
-
| `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 |
|
|
2230
|
-
| `revoke <id>` | revokes it; an unknown or already-revoked id answers `revoked: false`, exit 0 — neither is a key that works |
|
|
2231
|
-
|
|
2232
|
-
Every flag is read before the database opens: a refusal costs no boot.
|
|
2233
|
-
|
|
2234
|
-
## x merge-driver
|
|
2235
|
-
|
|
2236
|
-
`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).
|
|
2237
|
-
|
|
2238
|
-
| Form | Does |
|
|
2239
|
-
|---|---|
|
|
2240
|
-
| `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 |
|
|
2241
|
-
| `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` |
|
|
2242
|
-
|
|
2243
|
-
## x heavy
|
|
2244
|
-
|
|
2245
|
-
`As of 2026-11-18`. `x heavy [status] [--json]` · `x heavy run [--label s] [--mb n] [--max-wait s] [--json] -- <command…>` — the machine ledger every heavy run on this machine reserves its measured memory in, from any directory, in any repository. The rules, the weights and what stays outside: [Working with many agents](Many-Agents).
|
|
2246
|
-
|
|
2247
|
-
| Form | Answers |
|
|
2248
|
-
|---|---|
|
|
2249
|
-
| `x heavy` / `x heavy status` | `data.holds` and `data.queue` (label, directory, MB, pid, age; a hold adds `wrapperAlive` and `childPids`, the processes keeping it after its wrapper is gone), `data.capacityMb`, `data.usedMb`, `data.coreCap`, `data.cpuGate` (whether CPU pressure holds new runs back here), `data.machine` (load, runnable tasks, available and usable memory, `cpu`: `source` `psi`/`runnable`, `value`, `limit`, `busy`); `data.enabled: false` with `data.off` naming why (`ci`, `test-run`, `disabled`, `unsupported`) |
|
|
2250
|
-
| `x heavy run -- <command…>` | runs it inside one reservation of `--mb` (default: a monorepo typecheck). Exit code passed through, `128 + n` for a signal, 127 and `X_HEAVY_COMMAND_NOT_FOUND` for no such program. SIGTERM and SIGHUP are forwarded. Its summary goes to stderr, so stdout stays the command's; with `--json` the one document is on stdout and the command's stdout moves to stderr. `--max-wait <seconds>` (`0` to `604800`) bounds the queue: past it the command never starts, `X_HEAVY_WAIT_EXPIRED`, exit 75, `data.started: false` |
|
|
2251
|
-
|
|
2252
|
-
## x status
|
|
2253
|
-
|
|
2254
|
-
`As of 2026-11-15`. `x status [--url <origin>[,<origin>…]] [--samples n] [--json]` — what the running deployment is, from what it already records. A read, exit 0 whatever it finds: whether one build is fully out is [`x deploy verify`](#x-deploy-verify)'s question.
|
|
2255
|
-
|
|
2256
|
-
| Half | Read from | `--json` |
|
|
2257
|
-
|---|---|---|
|
|
2258
|
-
| workers | every live row of `x_job_workers`, through the queue `x jobs list` opens (`DATABASE_URL`, else the embedded database) | `data.workers`: `count`, `draining`, `byBuild` (a row from before the build column is `unknown`), `rows[]` |
|
|
2259
|
-
| origins | `--url`: `--samples` (default 5, 1–50) `GET /readyz` per origin, each on its own connection, so a load balancer chooses again | `data.origins[]`: `origin`, `samples`, `byBuild` (`x-ultimate-build`), `byStatus` (`unreachable` when nothing answered), `unstamped` (a 2xx with no build), `roles` (named by a role's health port) |
|
|
2260
|
-
| unrecorded | — | `data.unrecorded`: `web`, `sync`, `scheduler`, `replicator` — no fleet-wide record holds their build; name each one's health origin in `--url` ([Known gaps](Known-Gaps#open-by-decision)) |
|
|
2261
|
-
|
|
2262
|
-
`--url` takes bare http(s) origins only — a path, query or credentials is `X_CLI_BAD_FLAG`, as is a `--samples` outside 1–50. Both are refused before any request or connection.
|
|
2263
|
-
|
|
2264
|
-
## x config
|
|
2265
|
-
|
|
2266
|
-
`As of 2026-11`. `x config show [--section <key>]` — `app.config.ts` as the boot reads it: through `loadAppConfig` and core's `defineConfig`, every default merged. A credential-named key (the logger's own rule, `isRedactedKey`), a `secret()` value and the password in a URL's userinfo print as `[redacted]`. `--section` takes a top-level key the resolved record owns; any other is `X_CLI_BAD_FLAG` listing them.
|
|
2267
|
-
|
|
2268
|
-
## x logs
|
|
2269
|
-
|
|
2270
|
-
`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`.
|
|
2271
|
-
|
|
2272
|
-
## x cache
|
|
2273
|
-
|
|
2274
|
-
`As of 2026-11`.
|
|
2275
|
-
|
|
2276
|
-
| Subcommand | Does |
|
|
2277
|
-
|---|---|
|
|
2278
|
-
| `graph` (default) | per tag: the actions whose `invalidates` name it, the queries cached under it and the routes revalidated by it, read off the manifest. `data.neverEvicted` lists the tags something reads and no action invalidates — fresh only until their TTL |
|
|
2279
|
-
| `bust <tag>` | boots the app's declared tiers and bus as a role does (`startServices`), then `invalidateTags`: shared tiers dropped, the edge purged, every replica told. With an in-process bus (no `NATS_URL`, no `REDIS_URL`) the summary says no running server heard it. A tier that failed is `X_CACHE_DRIVER_UNAVAILABLE`, exit 1; an undeclared tag is `X_CACHE_TAG_UNKNOWN` |
|
|
2280
|
-
| `clear` | the same bust over every declared tag. An entry cached under no tag waits for its TTL |
|
|
2281
|
-
|
|
2282
|
-
## x explain
|
|
2283
|
-
|
|
2284
|
-
`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`.
|
|
2285
|
-
|
|
2286
|
-
## x profile
|
|
2287
|
-
|
|
2288
|
-
`As of 2026-11`. `x profile <route> [--runs 20] [--top 10] [--json]` — the app booted in this
|
|
2289
|
-
process (`x dev`'s boot, web role, an ephemeral port, the same `.x/dev.lock` claim — so a running
|
|
2290
|
-
`x dev` on the checkout is `X_DEV_ALREADY_RUNNING`), the route requested once to warm it, then
|
|
2291
|
-
`--runs` more through the pipeline's in-process dispatch under JavaScriptCore's sampling profiler
|
|
2292
|
-
(`bun:jsc`, 100 µs). Reports the `--top` hottest functions by self samples:
|
|
2293
|
-
|
|
2294
|
-
| `--json` field | Meaning |
|
|
2295
|
-
|---|---|
|
|
2296
|
-
| `route`, `status`, `runs` | what was rendered, the warm-up's status, how many requests were sampled |
|
|
2297
|
-
| `samples`, `intervalMicros` | samples taken and the sampling interval |
|
|
2298
|
-
| `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 |
|
|
2299
|
-
|
|
2300
|
-
A route answering `>= 400` is profiled and reported red, `X_PROFILE_ROUTE_FAILED` (fix: `x routes
|
|
2301
|
-
--json`). An absolute URL, a missing route or a `--runs` outside 1–10000 is `X_CLI_BAD_FLAG`.
|
|
2302
|
-
|
|
2303
92
|
## Planned commands
|
|
2304
93
|
|
|
2305
94
|
None, `As of 2026-11-16`. The table is `PLANNED_COMMANDS` in `packages/cli/src/cmd-planned.ts`, and it is empty, and the registry builds no command from it: the last three left with plan 101b slice 13. `x branch`, `x ai` and `x money` are each a row in [Known gaps](Known-Gaps) with the decision ("not planned") and the extension point that does the job today, and the parser refuses each with `X_CLI_UNKNOWN_COMMAND`. `PLANNED_SUBCOMMANDS`, the one-level-down version, has been empty since `As of 2026-11-15` (`x db studio`, `x jobs drain`, `x token grant` and `x cache stats` went the same way). `cmd-planned.test.ts` holds both tables empty.
|