@ultimat3/cli 31.48.0 → 31.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/CLAUDE.md +30 -23
  2. package/README.md +96 -4
  3. package/package.json +30 -30
  4. package/src/api-registration.ts +45 -14
  5. package/src/api-routes.ts +1 -0
  6. package/src/app-load.ts +7 -3
  7. package/src/app-openapi.ts +7 -1
  8. package/src/app-root.ts +7 -1
  9. package/src/budgets.ts +2 -1
  10. package/src/clean-services.ts +142 -0
  11. package/src/cmd-auth.ts +3 -0
  12. package/src/cmd-clean-spec.ts +10 -3
  13. package/src/cmd-clean.ts +23 -9
  14. package/src/cmd-db-backfill.ts +6 -0
  15. package/src/cmd-db-branch.ts +10 -4
  16. package/src/cmd-db-recount.ts +5 -12
  17. package/src/cmd-db-rollback.ts +77 -0
  18. package/src/cmd-db-spec.ts +18 -2
  19. package/src/cmd-db-status.ts +5 -10
  20. package/src/cmd-db.ts +105 -33
  21. package/src/cmd-deploy-verify.ts +14 -6
  22. package/src/cmd-docs-topic.ts +94 -0
  23. package/src/cmd-docs.ts +15 -1
  24. package/src/cmd-doctor.ts +109 -41
  25. package/src/cmd-drill.ts +80 -18
  26. package/src/cmd-env.ts +30 -8
  27. package/src/cmd-errors-app.ts +63 -0
  28. package/src/cmd-errors.ts +50 -14
  29. package/src/cmd-generate.ts +17 -4
  30. package/src/cmd-heavy-spec.ts +9 -1
  31. package/src/cmd-heavy.ts +111 -27
  32. package/src/cmd-i18n.ts +33 -1
  33. package/src/cmd-jobs.ts +27 -1
  34. package/src/cmd-merge-driver-spec.ts +12 -0
  35. package/src/cmd-merge-driver.ts +95 -0
  36. package/src/cmd-new.ts +23 -3
  37. package/src/cmd-policy-spec.ts +9 -1
  38. package/src/cmd-policy.ts +72 -17
  39. package/src/cmd-stop.ts +18 -4
  40. package/src/cmd-tasks-run.ts +87 -0
  41. package/src/cmd-tasks-spec.ts +10 -3
  42. package/src/cmd-tasks.ts +8 -5
  43. package/src/cmd-test.ts +2 -1
  44. package/src/cmd-upgrade-spec.ts +8 -1
  45. package/src/cmd-upgrade.ts +15 -1
  46. package/src/cmd-verify.ts +9 -41
  47. package/src/codemods/agents-doc-row.ts +73 -0
  48. package/src/codemods/define-error-leaf.ts +37 -12
  49. package/src/codemods/docs-many-agents.ts +11 -15
  50. package/src/codemods/docs-worker-commands.ts +26 -0
  51. package/src/codemods/engine-fs.ts +9 -2
  52. package/src/codemods/index.ts +4 -0
  53. package/src/codemods/merge-drivers.ts +147 -0
  54. package/src/command.ts +3 -0
  55. package/src/db-applied-edits.ts +117 -0
  56. package/src/db-dev-wire.ts +18 -0
  57. package/src/db-diagnostics.ts +5 -10
  58. package/src/db-generate.ts +82 -7
  59. package/src/db-migrate-pass.ts +51 -0
  60. package/src/db-migrate-through-dev.ts +209 -0
  61. package/src/db-rollback-consent.ts +128 -0
  62. package/src/db-rollback-pass.ts +76 -0
  63. package/src/db-seed-generate.ts +5 -1
  64. package/src/db-seed.ts +7 -1
  65. package/src/deploy-verify-findings.ts +3 -0
  66. package/src/deploy-verify-grade.ts +3 -0
  67. package/src/deploy-verify-processes.ts +32 -0
  68. package/src/dev-boot.ts +3 -0
  69. package/src/dev-db-migrate.ts +155 -0
  70. package/src/dev-db-rollback.ts +33 -0
  71. package/src/dev-db-settled.ts +22 -0
  72. package/src/dev-lock-errors.ts +78 -0
  73. package/src/dev-lock-holder-dir.ts +64 -0
  74. package/src/dev-lock-live.ts +44 -0
  75. package/src/dev-lock.ts +59 -84
  76. package/src/dev-policy.ts +11 -8
  77. package/src/dev-rebuild-schema.ts +116 -13
  78. package/src/dev-rebuild.ts +13 -4
  79. package/src/dev-route-table.ts +7 -0
  80. package/src/dispatch.ts +21 -1
  81. package/src/doctor-api-listing.ts +114 -0
  82. package/src/doctor-guarded.ts +41 -0
  83. package/src/doctor-port.ts +90 -17
  84. package/src/doctor-probe.ts +36 -5
  85. package/src/doctor-processes-probe.ts +127 -0
  86. package/src/doctor-processes.ts +136 -0
  87. package/src/doctor-warnings.ts +17 -0
  88. package/src/error-codes-agents.ts +35 -0
  89. package/src/error-codes-processes.ts +30 -0
  90. package/src/error-codes-tooling.ts +2 -0
  91. package/src/error-codes.ts +12 -13
  92. package/src/errors-suite.ts +27 -0
  93. package/src/errors.ts +18 -22
  94. package/src/exercise-registration.ts +4 -3
  95. package/src/exercise-services.ts +13 -3
  96. package/src/framework-env.ts +7 -3
  97. package/src/framework-schema.ts +15 -5
  98. package/src/generate-files.ts +1 -0
  99. package/src/generate-grant-findings.ts +7 -5
  100. package/src/generate-grants.ts +9 -8
  101. package/src/generate-kinds.ts +30 -6
  102. package/src/generate-roles-file.ts +30 -0
  103. package/src/generate-slice-policy.ts +3 -3
  104. package/src/guard-sources.ts +1 -2
  105. package/src/guards.ts +2 -2
  106. package/src/heavy-env.ts +2 -0
  107. package/src/heavy-errors.ts +18 -0
  108. package/src/heavy-holders.ts +78 -0
  109. package/src/heavy-ledger.ts +56 -14
  110. package/src/heavy-pressure.ts +104 -0
  111. package/src/heavy.ts +31 -13
  112. package/src/i18n-registration.ts +22 -2
  113. package/src/island-harness.ts +2 -2
  114. package/src/job-budget.ts +4 -2
  115. package/src/job-registration.ts +64 -8
  116. package/src/jobs-queue-known.ts +43 -0
  117. package/src/mcp-errors-agents.ts +20 -0
  118. package/src/mcp-errors-doctor.ts +27 -0
  119. package/src/mcp-errors-processes.ts +23 -0
  120. package/src/mcp-errors.ts +15 -29
  121. package/src/mcp-host.ts +2 -2
  122. package/src/merge-driver-catalog.ts +58 -0
  123. package/src/merge-driver-config.ts +43 -0
  124. package/src/merge-driver-lines.ts +140 -0
  125. package/src/merge-state.ts +105 -0
  126. package/src/messages-db.ts +22 -1
  127. package/src/messages-processes.ts +13 -0
  128. package/src/messages-upgrade.ts +10 -0
  129. package/src/messages.ts +54 -4
  130. package/src/output-findings.ts +48 -21
  131. package/src/page-navigation.ts +5 -2
  132. package/src/parse.ts +37 -6
  133. package/src/policy-facts.ts +38 -21
  134. package/src/policy-row.ts +99 -0
  135. package/src/port-pair-free.ts +28 -0
  136. package/src/pwa-artifacts.ts +1 -1
  137. package/src/registry-lines.ts +110 -0
  138. package/src/registry.ts +2 -0
  139. package/src/retain-sweep.ts +1 -1
  140. package/src/retained-assets-boot.ts +1 -1
  141. package/src/role-replicator.ts +4 -1
  142. package/src/role-select.ts +86 -0
  143. package/src/role-start.ts +13 -55
  144. package/src/role-sync.ts +10 -5
  145. package/src/runtime-assets-site.ts +2 -2
  146. package/src/runtime-assets.ts +1 -1
  147. package/src/runtime-cache-frame.ts +46 -0
  148. package/src/runtime-cache-ttl.ts +23 -0
  149. package/src/runtime-cache.ts +33 -16
  150. package/src/runtime-database-ssl.ts +84 -0
  151. package/src/runtime-idempotency-scope.ts +16 -2
  152. package/src/runtime-jobs-share.ts +52 -0
  153. package/src/runtime-jobs.ts +43 -12
  154. package/src/runtime-queue.ts +18 -3
  155. package/src/runtime-render-document.ts +1 -2
  156. package/src/runtime-services.ts +8 -1
  157. package/src/schema-drift.ts +19 -2
  158. package/src/schema-dump-drift.ts +4 -1
  159. package/src/serve-boot-probe.ts +30 -2
  160. package/src/serve-boot.ts +11 -1
  161. package/src/serve-env.ts +39 -3
  162. package/src/serve.ts +61 -10
  163. package/src/site-asset-routes.ts +2 -2
  164. package/src/site-assets.ts +5 -158
  165. package/src/stop-run-start.ts +12 -0
  166. package/src/supervise-boot.ts +61 -0
  167. package/src/supervise-cgroup.ts +84 -0
  168. package/src/supervise-child.ts +206 -0
  169. package/src/supervise-count.ts +244 -0
  170. package/src/supervise-errors.ts +83 -0
  171. package/src/supervise-facts.ts +40 -0
  172. package/src/supervise-messages.ts +84 -0
  173. package/src/supervise-policy.ts +46 -0
  174. package/src/supervise-pool.ts +10 -0
  175. package/src/supervise-probe.ts +158 -0
  176. package/src/supervise-run.ts +54 -0
  177. package/src/supervise.ts +383 -0
  178. package/src/sw-precache-plan.ts +1 -1
  179. package/src/templates/generate-purge.ts +6 -6
  180. package/src/templates/guard-animated-layout-property.ts +2 -2
  181. package/src/templates/guard-bare-error.ts +1 -1
  182. package/src/templates/guard-error-declared.ts +2 -2
  183. package/src/templates/guard-focus-visible.ts +1 -1
  184. package/src/templates/guard-image-dimensions.ts +2 -2
  185. package/src/templates/guard-island-mount-clears.ts +1 -1
  186. package/src/templates/guard-native-confirm.ts +1 -1
  187. package/src/templates/guard-raw-breakpoint.ts +2 -2
  188. package/src/templates/guard-raw-colour.ts +2 -2
  189. package/src/templates/guard-raw-fetch.ts +1 -1
  190. package/src/templates/guard-raw-interval.ts +1 -1
  191. package/src/templates/guard-raw-length.ts +3 -3
  192. package/src/templates/guard-raw-motion.ts +97 -1
  193. package/src/templates/guard-raw-shadow.ts +1 -1
  194. package/src/templates/guard-raw-z-index.ts +1 -1
  195. package/src/templates/guard-released-forms.ts +58 -9
  196. package/src/templates/guard-repo-await-in-loop.ts +1 -1
  197. package/src/templates/guard-repo-raw-sql.ts +4 -4
  198. package/src/templates/guard-repo-unbounded.ts +1 -1
  199. package/src/templates/guard-runtime-pin.ts +1 -1
  200. package/src/templates/guard-semantic-interactive.ts +2 -2
  201. package/src/templates/guard-unbounded-fanout.ts +1 -1
  202. package/src/templates/guard-undeclared-custom-property.ts +3 -3
  203. package/src/templates/guard-undefined-style-class.ts +3 -3
  204. package/src/templates/guard-unzoned-date.ts +3 -3
  205. package/src/templates/query-slice.ts +82 -0
  206. package/src/templates/query.ts +76 -30
  207. package/src/templates/resource-page.ts +3 -2
  208. package/src/templates/scaffold-bin.ts +2 -0
  209. package/src/templates/scaffold-claude-commands.ts +6 -0
  210. package/src/templates/scaffold-claude.ts +4 -4
  211. package/src/templates/scaffold-container-compose.ts +47 -7
  212. package/src/templates/scaffold-docs.ts +7 -3
  213. package/src/templates/scaffold-gitattributes.ts +18 -1
  214. package/src/templates/scaffold-helm-templates.ts +9 -0
  215. package/src/templates/scaffold-repo.ts +5 -2
  216. package/src/templates/scaffold-test-services.ts +33 -11
  217. package/src/templates/shapes/offline.ts +0 -7
  218. package/src/templates/shapes/realtime.ts +2 -6
  219. package/src/templates/sign-in-action-tests.ts +6 -4
  220. package/src/templates/sign-in-challenge.ts +62 -0
  221. package/src/templates/sign-in-oidc-mfa.ts +31 -0
  222. package/src/templates/sign-in-oidc.ts +11 -3
  223. package/src/templates/sign-in-password.ts +18 -56
  224. package/src/test-only-shipped.ts +29 -2
  225. package/src/test-shards.ts +134 -42
  226. package/src/test-verdict.ts +79 -0
  227. package/src/test-workers.ts +15 -0
  228. package/src/upgrade-coverage-ratchet.ts +95 -0
  229. package/src/upgrade-gate-codemods.ts +5 -3
  230. package/src/upgrade-gate.ts +42 -4
  231. package/src/upgrade-merge-drivers.ts +25 -0
  232. package/src/upgrade-report.ts +32 -4
  233. package/src/upgrade-scope.ts +62 -0
  234. package/src/verify-checks.ts +2 -8
  235. package/src/verify-coverage-run.ts +4 -1
  236. package/src/verify-e2e.ts +21 -3
  237. package/src/verify-live.ts +38 -14
  238. package/src/verify-only.ts +67 -0
  239. package/src/verify-progress.ts +7 -3
  240. package/src/verify-run.ts +20 -2
  241. package/src/verify-services-stack.ts +165 -0
  242. package/src/verify-services.ts +84 -2
  243. package/src/verify-test-run.ts +6 -7
  244. package/src/verify-tests.ts +8 -2
  245. package/src/verify-typecheck.ts +25 -2
  246. package/src/workspace-checks.ts +4 -1
  247. package/wiki/Actions.md +66 -3
  248. package/wiki/Admin-Dashboard.md +2 -2
  249. package/wiki/Agents.md +5 -5
  250. package/wiki/Auth.md +20 -6
  251. package/wiki/Bare-VM.md +1 -1
  252. package/wiki/CI-Parallel-Gate.md +2 -1
  253. package/wiki/CLI-Reference.md +115 -42
  254. package/wiki/Caching-And-Invalidation.md +1 -1
  255. package/wiki/Client-Navigation.md +35 -5
  256. package/wiki/Configuration.md +12 -10
  257. package/wiki/Deployment.md +44 -4
  258. package/wiki/Entities-And-Migrations.md +17 -3
  259. package/wiki/FAQ.md +1 -1
  260. package/wiki/Getting-Started.md +2 -2
  261. package/wiki/Home.md +3 -3
  262. package/wiki/I18n.md +6 -4
  263. package/wiki/Installation.md +12 -11
  264. package/wiki/Interface-Rules.md +3 -1
  265. package/wiki/Jobs-And-Workflows.md +24 -4
  266. package/wiki/Known-Gaps.md +2 -2
  267. package/wiki/MCP-And-AI.md +48 -13
  268. package/wiki/Many-Agents.md +69 -2
  269. package/wiki/Migrations-And-Backfills.md +18 -0
  270. package/wiki/Notify.md +5 -3
  271. package/wiki/Observability.md +13 -0
  272. package/wiki/Outbound-HTTP.md +53 -2
  273. package/wiki/Policies-And-Authz.md +1 -1
  274. package/wiki/Queries-And-Live-Queries.md +2 -2
  275. package/wiki/Realtime.md +24 -7
  276. package/wiki/Routes-And-Render-Modes.md +2 -2
  277. package/wiki/Scheduled-Tasks.md +4 -1
  278. package/wiki/Static-Assets.md +5 -3
  279. package/wiki/Testing.md +64 -7
  280. package/wiki/Theming.md +6 -3
  281. package/wiki/Timezones-And-Dates.md +5 -1
  282. package/wiki/Troubleshooting.md +1 -0
  283. package/wiki/Tutorial-01-First-App.md +3 -3
  284. package/wiki/Tutorial-02-First-Feature.md +1 -1
  285. package/wiki/Tutorial-03-Auth-And-Admin.md +7 -6
  286. package/wiki/UI-Components.md +1 -0
  287. package/wiki/Upgrading.md +38 -0
package/CLAUDE.md CHANGED
@@ -16,13 +16,13 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
16
16
  |---|---|
17
17
  | Entry | `src/bin.ts` — argv, stdout, exit code only ‡ |
18
18
  | Registry | `registry.ts`: every declaration static (`cmd-<name>-spec.ts`), every body `await import()`ed when that command runs ‡ |
19
- | Startup cost | `sass` loads on the first stylesheet compile (`@ultimat3/render`'s `compileStylesheet`), Babel on the first island transform (`solid-loader.ts`); both pinned by `*-lazy.test.ts` in a child process |
20
- | Module names | `role-*` / `runtime-*` are booted by `serve.ts` in production; `dev-*` is `x dev`'s alone. Derived from the import graph by `module-naming.test.ts`, never listed |
19
+ | Startup cost | `sass` loads on the first stylesheet compile (`@ultimat3/render`'s `compileStylesheet`), Babel on the first island transform (`solid-loader.ts`); pinned by `*-lazy.test.ts` in a child |
20
+ | Module names | `role-*` / `runtime-*` are booted by `serve.ts` in production; `dev-*` is `x dev`'s alone. Derived by `module-naming.test.ts` from imports, never listed |
21
21
  | stdout / stderr | `write-line.ts`'s `writeLine` / `writeErrorLine`, never `process.stdout.write`; `stream: 'stderr'` → fd 2 ‡ |
22
22
  | `--json` | every command; `dispatch.ts` sets core's log stream to stderr under it. Same data as the human render |
23
- | I/O | only `dispatch.ts` renders or exits; commands return `CommandResult`. `ok()` / `failed()` write `ok` after the `extra` spread — the verdict cannot be overturned |
24
- | Staying up | a command still listening when `run` resolves returns `hold` (`hold.ts`); the release runs inside the drain's own deadline |
25
- | Test execution | `test-shards.ts`'s `testArgs` — one `bun test --parallel=N` per pass (`test-passes.ts`); `live`/`e2e` run serially (`SERIAL_TYPES`, `test-workers.ts`); a file's type and each step's argv: `verify-test-command.ts` |
23
+ | I/O | only `dispatch.ts` renders or exits; commands return `CommandResult`. `ok()` / `failed()` write `ok` after the `extra` spread, so the verdict stands |
24
+ | Staying up | a command still listening when `run` resolves returns `hold` (`hold.ts`); its release runs inside the drain's deadline |
25
+ | Test execution | `test-shards.ts`'s `testArgs` — one `bun test --parallel=N` per pass (`test-passes.ts`); `live`/`e2e` run serially (`SERIAL_TYPES`, `test-workers.ts`); a file's type and each step's argv: `verify-test-command.ts`; failing files, all-skipped: `test-verdict.ts` |
26
26
  | Numeric flags | `flag-number.ts` — one reader for `--port` / `--workers` / `--shard` |
27
27
  | Shell quoting | `shell-quote.ts`'s `quoteArg` for every value pasted into a `fix:` or a reproduce line |
28
28
  | Missing input | `MissingPositionalError`; a bare subcommand needs a declared `defaultSubcommand` (`MissingSubcommandError`) ‡ |
@@ -30,8 +30,8 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
30
30
  | Passthrough | declared per command (`CommandSpec.passthrough`); every other command refuses a `--` tail with `X_CLI_BAD_FLAG` |
31
31
  | App root | `CommandSpec.requiresApp`, enforced by `dispatch.ts` before `run` |
32
32
  | Declared flags | every flag a command declares is read in this package's source — `flag-reads.test.ts` (`X_CLI_FLAG_UNREAD`) |
33
- | Planned commands | none: `PLANNED_COMMANDS` / `PLANNED_SUBCOMMANDS` (`cmd-planned.ts`) stay empty, and the registry builds nothing from them. A command ships, or the parser refuses it `X_CLI_UNKNOWN_COMMAND` with its decision in `wiki/Known-Gaps.md` |
34
- | Errors | codes + titles in `error-codes.ts`, a runnable line per code in `mcp-errors.ts` (typed over `CliErrorCode`); a family at the ceiling moves to `error-codes-<family>.ts` / `mcp-errors-<family>.ts` (`-verify`: the gate's floor, run and split); classes in `errors.ts` or beside their one thrower when `errors.ts` is at its ceiling. Never a bare `Error` |
33
+ | Planned commands | none: `PLANNED_COMMANDS` / `PLANNED_SUBCOMMANDS` (`cmd-planned.ts`) stay empty. A command ships, else the parser refuses it `X_CLI_UNKNOWN_COMMAND` with its decision in `wiki/Known-Gaps.md` |
34
+ | Errors | codes + titles in `error-codes.ts`, a runnable line per code in `mcp-errors.ts` (typed over `CliErrorCode`); a family at the ceiling moves to `error-codes-<family>.ts` / `mcp-errors-<family>.ts` (`-verify`: the gate's floor, run and split); classes in `errors.ts`, else beside their one thrower. Never a bare `Error` |
35
35
  | Subprocesses | only through `exec.ts`'s injectable `Runner`; `gh` through `ctx.runner` with a required `fix` |
36
36
  | Templates | `templates/*.ts` return strings, pre-formatted for Biome (`wrap.ts`'s `wrapList` / `wrapImport` / `sortSpecifiers`); no fixture files on disk |
37
37
  | Strings | rendered output through `messages.ts` (missing key renders `⟦key⟧`) ‡ |
@@ -46,13 +46,13 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
46
46
  |---|---|
47
47
  | `verify-checks.ts` / `verify-step.ts` / `verify-run.ts` / `verify-e2e-lane.ts` | steps, outcome, order (`BESIDE_SERIAL_SUITES`, e2e lane) |
48
48
  | `verify-changed*.ts` | `x verify --changed`: file → rule → steps, fail-open; `drift` only when reached † |
49
- | `verify-drift-owner.ts` | `drift`: an `app.config.ts` under `apps/`/`packages/` is `X_APP_ROOT_NESTED` — one repo, one app, one image, one migration owner |
49
+ | `verify-drift-owner.ts` | `drift`: an `app.config.ts` under `apps/`/`packages/` is `X_APP_ROOT_NESTED`: one app (image, migration owner) per repo |
50
50
  | `verify-exercise.ts` / `cmd-exercise.ts` / `exercise-*.ts` | `exercise`: `x exercise --json` as a child, red on its findings |
51
51
  | `verify-floor.ts` | `x.verify.json`: a floor step that ran zero tests is `X_VERIFY_SUITE_VANISHED` |
52
52
  | `verify-strict.ts` / `verify-skip-reason.ts` / `verify-guard-baseline.ts` / `verify-merge-skips.ts` | `strict` + `skip` (`X_VERIFY_STRICT_UNRUN`), each zero-check step's reason, per-guard `guardBaseline` † |
53
- | `verify-live.ts` / `verify-services.ts` | `live`: nothing answering → the gate starts `docker/docker-compose.test.yml`; can't → `X_TEST_SERVICES_UNAVAILABLE` warning |
53
+ | `verify-live.ts` / `verify-services.ts` | `live`: nothing answering → the gate starts `docker/docker-compose.test.yml`; can't → `X_TEST_SERVICES_UNAVAILABLE`, red if floored and none ran, else a warning |
54
54
  | `verify-e2e.ts` / `doctor-browser.ts` | `e2e` floored with no Chrome is `X_VERIFY_E2E_BROWSER_MISSING`; `x doctor` reports the browser |
55
- | `coverage-remap.ts` / `coverage-island.ts` / `island-bundle-options.ts` | under a coverage build, island chunk lines credited to their sources via the chunk's source map |
55
+ | `coverage-remap.ts` / `coverage-island.ts` / `island-bundle-options.ts` | a coverage build credits island chunk lines to their sources via the chunk's source map |
56
56
  | `coverage-{floor,lcov,source,island,remap}.ts` / `verify-coverage-run.ts` | an app's `unit` coverage floor; `coverage-lcov.ts` is the ONE lcov reader † |
57
57
  | `verify-deadline.ts` / `verify-stalled.ts` / `verify-progress.ts` | a step past its deadline is `X_VERIFY_STEP_TIMEOUT`; its children are killed by tag † |
58
58
  | `load-findings.ts` | a module-load failure is reported once, by `manifest`; each step that loads the app stands down (`blockedByLoad`) † |
@@ -61,7 +61,7 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
61
61
  | `verify-seeds.ts` / `verify-seeds-probe.ts` | `unit` runs the seeds in a child on `x exercise`'s scratch database; an uncoded throw is `X_SEED_FAILED` † |
62
62
  | `boundary-findings.ts` / `app-boundaries.ts` / `boundary-cuts.ts` / `package-boundaries.ts` | surface + layer rules, `X_BOUNDARY_PACKAGE_TO_APP`; a `fix:` is the concrete cut † |
63
63
  | `app-boundaries.ts` (workspaces) | `@<scope>/<app>/<rest>` resolves onto `apps/<app>/<rest>` when that is an app source, so the surface rules hold across app workspaces |
64
- | `app-transport.ts` / `browser-{transport,import-chain,barrel-cut}.ts` / `transport-{calls,values}.ts` / `binding-names.ts` / `import-closure.ts` / `server-barrels.ts` | `boundaries`, built in: one browser transport; a server barrel below an island is cut at its first hop † |
64
+ | `app-transport.ts` / `browser-{transport,import-chain,barrel-cut}.ts` / `transport-*.ts` / `binding-names.ts` / `import-closure.ts` / `server-barrels.ts` | `boundaries`: one browser transport; a server barrel below an island is cut at its first hop † |
65
65
  | `guards.ts` / `guard-sources.ts` | an app's `guards/*.ts`, run on `boundaries`; ONE shared walk (`GuardSources`) † |
66
66
  | `guards-built-in.ts` / `guards-built-in-refusal.ts` | shipped guards run from the installed CLI, never a copy; `guards/shipped.json` is the opt-in and the severities; `x g guard <shipped>` is `X_GUARD_BUILT_IN` |
67
67
  | `templates/scaffold-guards.ts` | `SHIPPED`, the one list of shipped guards (`guards-built-in.ts`, `doctor-guards.ts`, `codemods/vendored-guards.ts`) † |
@@ -113,7 +113,7 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
113
113
  | `app-artifacts.ts` | `x.manifest.json` + `openapi.json`, written together (`x g`, `x manifest`) |
114
114
  | `templates/` | every emitted file; `scaffold-*.ts` for `x new`, one per generator otherwise. See history |
115
115
  | `generate-feature-required.ts` | `x g query`/`backfill` with no slice holding an `entity.ts` is `X_FEATURE_REQUIRED` |
116
- | `generate-sign-in*.ts` | `x g sign-in`: one flag, no name; OIDC swaps only `x new`'s bytes |
116
+ | `generate-sign-in*.ts` | `x g sign-in`: one flag, no name; OIDC swaps only `x new`'s bytes and ships the `mfaPath` leg |
117
117
  | `generate-invite*.ts`, `templates/invite*.ts` | `x g invite`: no name; three actions + two pages over `defineMemberInvite` |
118
118
  | `generate-format-written.ts` | the app's Biome over the TypeScript a run created, best effort; `lint` judges |
119
119
  | `templates/scaffold-mcp-{json,endpoint,admin}.ts` | `.mcp.json` (`bunx @ultimat3/cli mcp serve`, never `bunx x`) and the refusing MCP endpoints ‡ |
@@ -123,29 +123,32 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
123
123
 
124
124
  | File | Job |
125
125
  |---|---|
126
- | `serve.ts` / `serve-boot.ts` / `serve-entry.ts` / `serve-env.ts` | the production entry: `ROLE`, env bindings, `ROLE=migrate`; `X_APP_MODULE_LOAD_FAILED` † |
126
+ | `serve.ts` / `serve-boot.ts` / `serve-entry.ts` / `serve-env.ts` | the production entry: `ROLE` (outside `config.roles`: `X_CONFIG_INVALID`; `migrate` exempt), env bindings, `ROLE=migrate`; `X_APP_MODULE_LOAD_FAILED` † |
127
127
  | `app-load-batch.ts` / `app-load-register.ts` | one hook module per app module, registered in order; registration state † |
128
128
  | `app-load-prebuilt.ts` / `build-registry.ts` / `build-registry-background.ts` | every serving role boots from the prebuilt registry (`x build`); stale → scan † |
129
129
  | `generate-refresh.ts` | `x g` refreshes the manifest only when a written file needs it |
130
130
  | `role-load.ts` / `document-graph.ts` / `serve-web.ts` | a role imports what it runs: `ROLE_LOADS` (`X_ROLE_LOAD_INCOMPLETE`) † |
131
131
  | `module-imports.ts` | a module's imports, resolved once for both graphs: `referenced` (reload), `evaluated` (document) |
132
- | `dev-rebuild-remount.ts` / `dev-rebuild-schema.ts` | a save that changes what `x dev` mounted is a restart; entities ahead of migrations are `X_DB_DRIFT` † |
132
+ | `dev-rebuild-remount.ts` / `dev-rebuild-schema.ts` | a save that changes what `x dev` mounted is a restart; entities ahead of migrations are `X_DB_DRIFT`, the ledger behind them `X_APP_MIGRATIONS_UNAPPLIED` † |
133
133
  | `dev-log.ts` | every logger line to `<stateDir>/dev.log` (`logs.tail`); `dev.log.1` at 16 MiB |
134
134
  | `cmd-dev.ts` / `dev-boot.ts` / `dev-rebuild.ts` / `dev-route-table.ts` | `x dev`: every role in one process, `/_x`, the watcher; one save = one generation † |
135
135
  | `runtime-bindings.ts` | which service each binding points at (embedded or external); events follow `NATS_URL` |
136
136
  | `runtime-queue.ts` / `runtime-services.ts` / `runtime-bus.ts` | db + queue; every other accessor; the bus |
137
137
  | `framework-schema-apply.ts` / `framework-schema-stamp.ts` | the framework tables, applied in one locked transaction † |
138
- | `framework-schema-verify.ts` / `-wait.ts` / `app-migrations-verdict.ts` / `serve-boot-probe.ts` | a serving role behind its schema (stamp or app ledger) WAITS, `ULTIMATE_SCHEMA_WAIT_MS`, probe port up; a newer major refuses at once |
138
+ | `framework-schema-verify.ts` / `-wait.ts` / `app-migrations-verdict.ts` / `serve-boot-probe.ts` | a serving role behind its schema WAITS (`ULTIMATE_SCHEMA_WAIT_MS`); a newer major refuses at once † |
139
139
  | `runtime-isr.ts` | the ISR controller both boots serve through, attached to `invalidateTags` (`attachedIsr`) † |
140
140
  | `runtime-mfa-warning.ts` / `runtime-idempotency-scope.ts` | boot warnings: unsealed MFA secrets, a per-process idempotency store † |
141
141
  | `app-config-load.ts` | the ONE reader of `app.config.ts` (`loadAppConfig`) † |
142
142
  | `theme-brand.ts` | the ONE reader of an app's theme (`brand` in `apps/web/shared/theme.ts`) † |
143
- | `runtime-{jobs,realtime,notify-retention,cache,purge,replica}.ts` | the `app.config.ts` sections the boot obeys (`*Of(config)`) † |
143
+ | `runtime-{jobs,realtime,notify-retention,cache,purge,replica,database-ssl}.ts` | the `app.config.ts` sections the boot obeys (`*Of(config)`) † |
144
144
  | `runtime-cache-bus.ts` | which bus carries cache/ISR invalidations across replicas; one `cache.broadcast` boot line † |
145
+ | `runtime-cache-frame.ts` | the bust frame on `x.cache.invalidate`: tags + optional `{scopes}`; older receivers keep the strings |
145
146
  | `runtime-jobs.ts` (queues) | `WORKER_QUEUES` = the EXACT set, else `X_WORKER_QUEUE_UNKNOWN`; `-unserved.ts`: what no worker serves † |
147
+ | `supervise*.ts` | `ULTIMATE_PROCESSES`: count and clamps, N children on one port, `METRICS_PORT`, IPC † |
148
+ | `runtime-jobs-share.ts` / `doctor-processes*.ts` | a worker child's slot share; `x doctor`'s processes fact † |
146
149
  | `serve-retire.ts` / `dev-restart-retire.ts` | the worker retire (SIGUSR2, before an `x dev` restart's drain) † |
147
- | `role-start*.ts` / `role-realtime.ts` | `--role` selection, start/stop per role, device mounts † |
148
- | `role-wake.ts` | the worker's LISTEN session (`@ultimat3/jobs`' `startQueueWake`) — worker role only, only over a client that `canListen` — and `queue_wake_live` |
150
+ | `role-start*.ts` / `role-select.ts` / `role-realtime.ts` | `--role` selection (`x dev` runs only `config.roles`: `rolesDeclaredForDev`), start/stop per role, device mounts † |
151
+ | `role-wake.ts` | the worker's LISTEN session (one per process) and `queue_wake_live` † |
149
152
  | `role-sync.ts` / `role-replicator.ts` / `runtime-live-feed.ts` | the sync node, the change feed |
150
153
  | `runtime-render*.ts` / `runtime-{isr-outcome,assets,storage,hooks}.ts` / `route-islands.ts` / `api-routes.ts` | the HTTP surface both boots mount † |
151
154
  | `asset-route-meta.ts` | the ONE writer of an asset route's `tags: ['assets']` + `rateLimit: 'assets'` † |
@@ -162,9 +165,10 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
162
165
  | `local-cli.ts` / `local-cli-handoff.ts` | a global `x` hands over to the app's own CLI † |
163
166
  | `serve-prebuilt.ts` / `serve-prebuilt-paths.ts` | the image's prebuilt store; a boot that built anything logs `X_IMAGE_NOT_PREBUILT` † |
164
167
  | `dev-*.ts` | `x dev` only: dashboard sources, traces, the N+1 ledger, watcher, reload, lock, port |
165
- | `cmd-stop.ts` / `cmd-stop-spec.ts` | `x stop`: the lock's pid only, SIGTERM, wait; `X_DEV_STOP_TIMEOUT` † |
168
+ | `cmd-stop.ts` / `cmd-stop-spec.ts` | `x stop`: the lock's pid only, SIGTERM, wait; a reused pid's lock is cleared, unsignalled; `X_DEV_STOP_TIMEOUT` † |
169
+ | `dev-lock-live.ts` / `db-{migrate,rollback}-pass.ts` / `dev-db-*.ts` | beside a live `x dev` on the embedded database, `x db migrate\|rollback` run in it (`POST /_x/db/…`); other writes refuse † |
166
170
  | `dev-dashboard-guard.ts` / `loopback-host.ts` | `/_x`: loopback `Host` (`X_DEV_HOST_REFUSED`) and peer (`X_DEV_PEER_REFUSED`) † |
167
- | `dev-host.ts` / `dev-tls*.ts` | `x dev --host` (loopback default) and `--tls`: a cached self-signed cert in `.x/tls/`, WebCrypto + hand-written DER |
171
+ | `dev-host.ts` / `dev-tls*.ts` | `x dev --host`, `--tls` † |
168
172
  | `doctor-pooler.ts` / `runtime-statement-bound.ts` | the statement bound and a pooler's refusal, one finding, one boot line † |
169
173
 
170
174
  ### Build and data
@@ -175,6 +179,7 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
175
179
  | `prerender.ts` / `measure-scope.ts` / `static-report.ts` / `static-*.ts` | the static export; weigh-only renders as `measurementActor()` † |
176
180
  | `sw-artifacts.ts` / `pwa-artifacts.ts` / `favicon.ts` | the service worker, the web manifest, `/favicon.ico` |
177
181
  | `cmd-db.ts` / `migrations.ts` / `db-*.ts` (generate, branch, seed, backfill, subscribes, accept-created) | one migration engine for `x db` and `ROLE=migrate` † |
182
+ | `cmd-db-rollback.ts` / `db-rollback-consent.ts` / `db-applied-edits.ts` | `x db rollback`: on a named deploy, or an external non-loopback database, every id named in `ROLLBACK_ALLOW_DESTRUCTIVE`; `gen` refuses an edited applied migration |
178
183
  | `db-diagnostics.ts` | `x db diagnostics`: `startDb`, never `startQueue`; exit 0 whatever it says † |
179
184
  | `db-schema-dump.ts` / `db-schema-refresh.ts` / `db-replay-engine.ts` / `migration-extensions.ts` / `db-object-drift.ts` | the schema dump, replayed on a scratch database † |
180
185
 
@@ -183,6 +188,8 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
183
188
  | File | Job |
184
189
  |---|---|
185
190
  | `cmd-registries.ts` / `cmd-jobs.ts` / `cmd-tasks.ts` / `cmd-policy.ts` / `cmd-i18n.ts` | project a framework registry; each pairs CLI wiring with a facts module |
191
+ | `cmd-tasks-run.ts` | `x tasks run`: `TaskHandle.enqueue()`; production needs `--production` or `ULTIMATE_TASK_RUN=<name>` (`X_TASK_RUN_PRODUCTION`) |
192
+ | `doctor-api-listing.ts` | `x doctor` warns: action/query off a `defineApi()` listing others |
186
193
  | `cmd-auth.ts` / `cmd-auth-spec.ts` / `doctor-auth.ts` | `x auth seal-mfa`: seals plaintext `x_users.mfa_secret` through auth's `sealMfaSecrets` |
187
194
  | `cmd-mcp.ts` / `mcp-host*.ts` / `mcp-errors.ts` / `mcp-db-target.ts` / `mcp-test-{output,run}.ts` | `x mcp serve`: 23 tools, two transports; `tests.run`/`verify.run` ARE `x test`/`x verify` † |
188
195
  | `cmd-shot*.ts` / `cdp-shot-*.ts` / `browser-launcher*.ts` / `island-*` | `x shot` over raw CDP; `verdict.json` names its own blind spots. Not a gate step |
@@ -193,12 +200,12 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
193
200
  | `pr-threads.ts` / `pr-activity.ts` | `x pr review`'s ONE GraphQL document: threads, plus every review (verdict, body) and issue comment |
194
201
  | `pr-bots.ts` | which review bots posted a "did not review" notice (rate/review limit, skipped); `blocked` = no review of theirs after it |
195
202
  | `ci-log.ts` | `x ci`'s log reader: markers and fences undone, provenance `source: 'ci-log'` † |
196
- | `error-catalog.ts` | imports every `@ultimat3/*` package so `x errors` answers for any code |
203
+ | `error-catalog.ts` | imports every `@ultimat3/*` package so `x errors` answers for any code; app codes: `cmd-errors-app.ts` |
197
204
  | `cmd-docs.ts` / `docs-sources.ts` / `docs-section.ts` | `x docs`: the app's and the CLI's `@ultimat3` docs; `Page#anchor` prints a section † |
198
205
  | `cmd-env-init.ts` / `env-production.ts` / `cmd-deploy-preflight.ts` | the one writer of `.env.production`; compose pre-flight (`X_DEPLOY_ENV_MISSING`) † |
199
206
  | `cmd-upgrade.ts` / `upgrade-*.ts` | `x upgrade`: one major per run; no `requiresApp` † |
200
- | `codemods/` / `cmd-upgrade-codemods.ts` / `upgrade-gate-codemods.ts` | a template change an app keeps, carried by a codemod (`codemod.ts`, the ONE list `codemods/index.ts`); the hop's installed CLI applies them before its gate; `scripts/template-codemods.ts` refuses a template change with none |
201
- | `cmd-deploy-verify.ts` / `deploy-verify-*.ts` / `cmd-status*.ts` | `x deploy verify`: the wait, the verdict, lazy sources † · `x status` |
207
+ | `codemods/` / `cmd-upgrade-codemods.ts` / `upgrade-gate-codemods.ts` | a kept template change, carried by a codemod (ONE list: `codemods/index.ts`) † |
208
+ | `cmd-deploy-verify.ts` / `deploy-verify-*.ts` / `cmd-status*.ts` | `x deploy verify`: wait, verdict, lazy sources, rows per container † · `x status` |
202
209
 
203
210
  ## Adding a command
204
211
 
package/README.md CHANGED
@@ -25,7 +25,7 @@ Commands and the `x verify` step count, `As of 2026-08`:
25
25
  | `x exercise [<name>] [--seed n\|random] [--shard i/n]` | every action, query, job and route `load` run once on generated rows, no test written | a scratch database; `.x/exercise.json`; an `unreached` primitive is `X_CONTRACT_EXERCISE_UNREACHED` with the override to paste into `apps/web/exercise.ts` — the gate's `exercise` step. `x.verify.json` `exercise: { unprovenMax, statementsMax }` turns unproven proofs and over-ceiling calls red; absent, warning lines. Route loads land in `routes` beside `records`, their loops and seq scans as warning lines; a load's own typed-client reads are answered in process, and `defineExercise(…, { routes })` gives a page its params, query, actor or `empty` reason. A sent push is a `push` effect. `--shard i/n` runs one of n disjoint slices into `.x/exercise.<i>-of-<n>.json` |
26
26
  | `x drill [<name>] [--list] [--budget-ms n]` | the app's roles as real processes on real services, each fault played through a proxy or a signal, judged on framework contracts only | a scratch database per drill; load = anonymous site pages plus every action an anonymous POST reaches (`data.skippedWrites` names the rest and why); `X_DRILL_FAILED` per property that did not hold, `X_DRILL_SERVICE_MISSING` before anything starts. Not a gate step — CI's `fault-drills` job runs three on `examples/dummy` |
27
27
  | `x g <primitive> <name>` | scaffolds a primitive **with a passing test** | never a TODO stub |
28
- | `x db gen\|migrate\|reset\|branch\|backfill` | everything DB | `branch` = copy-on-write clone + preview URL; `backfill` dry-runs unless `--write`. The schema browser is `/_x`'s db panel (`x dev`); `studio` left the registry ([Known gaps](../../wiki/Known-Gaps.md#open-by-decision)) |
28
+ | `x db gen\|migrate\|rollback\|reset\|branch\|backfill` | everything DB | `rollback [--steps n]` (default 1) runs the `-- down` half of the most recently applied migration(s) and leaves the files on disk; `gen` refuses an applied migration edited since (`X_MIGRATION_CONFLICT`) before it writes — checked against the embedded ledger only (asked of a live `x dev` when one holds it): an external `DATABASE_URL` is never dialled, so there `x db migrate`'s own audit is the refusal, and an embedded ledger it cannot read is a warning line naming why, never a refusal; `branch` = copy-on-write clone + preview URL; `backfill` dry-runs unless `--write`. The schema browser is `/_x`'s db panel (`x dev`); `studio` left the registry ([Known gaps](../../wiki/Known-Gaps.md#open-by-decision)) |
29
29
  | `x mcp serve` | `@ultimat3/mcp`'s 19 dev tools, over stdio or HTTP | one catalog, one scope set, both transports |
30
30
  | `x upgrade` | one major per run: exact pins, the Bun floor, `bun install`, the gate; an `AGENTS.md` byte-identical to `CLAUDE.md` becomes a symlink to it, a different one is reported in `data.agentsMd` and left | the `--json` report names the wiki section, the guards that differ and what the gate still says ([fields](../../wiki/CLI-Reference.md#x-upgrade)); `bunx @ultimat3/cli@latest upgrade` in an app that predates it; pins with no `app.config.ts` still hop, and `data.proof` says what checked them |
31
31
  | `x doctor` | environment, ports, drift, PWA prerequisites, `APP_URL` | every finding carries a fix command; probes the port `x dev` binds ([which one](../../wiki/CLI-Reference.md#x-doctor)); the framework's deploy secrets only where the machine names `staging`/`production` |
@@ -34,14 +34,15 @@ Commands and the `x verify` step count, `As of 2026-08`:
34
34
  | `x manifest` / `x routes` | generated facts | `x.manifest.json`, `openapi.json`, route table |
35
35
  | `x actions` / `x queries` / `x entities` | the declaration registries | `list` and `show <name>`, straight off the registries |
36
36
  | `x tasks list\|show` | cron tasks | timezone and next run, off `registeredTasks()` |
37
+ | `x tasks run <name>` | fire a task now | its jobs onto the app's queue (`TaskHandle.enqueue()`); under `ULTIMATE_ENV=production` only with `--production` or `ULTIMATE_TASK_RUN=<name>`, else `X_TASK_RUN_PRODUCTION` |
37
38
  | `x jobs list\|show\|retry\|cancel\|delete\|promote\|pause\|resume` | the queue | depth, dead letters, step traces, `retry --from-step`, `cancel --reason`; `list --json` pages as `rows`/`nextCursor`/`hasMore`; `drain` is planned (`X_NOT_IMPLEMENTED`) |
38
39
  | `x test [type]` | one of the six test types, or all | same type rule as the gate; `--filter`, `--sample N` |
39
- | `x env check\|example\|init` | the typed environment `envSchema` declares; `init --production` writes `.env.production` for a compose deploy, secrets generated, never printed | and the `.env.example` rendered from it, plus the framework's deploy-required secrets (`ULTIMATE_CURSOR_SECRET`, `STORAGE_SIGNING_SECRET` unless `S3_ENDPOINT` is set), which `check` asks for wherever the boot refuses them — outside `development`/`test`, or with no environment named |
40
+ | `x env check\|example\|init` | the typed environment `envSchema` declares; `init --production` writes `.env.production` for a compose deploy, secrets generated, never printed | and the `.env.example` rendered from it, plus the framework's deploy-required secrets (`ULTIMATE_CURSOR_SECRET`, `STORAGE_SIGNING_SECRET` unless `S3_ENDPOINT` is set), which `check` asks for wherever the boot refuses them — outside `development`/`test`. With no `ULTIMATE_ENV`/`NODE_ENV` named, a developer's shell is checked as `development` (as `x dev` runs there) and `CI` as production (the boot fails closed); a deploy's answer is `ULTIMATE_ENV=production x env check` |
40
41
  | `x auth seal-mfa` | one-shot auth maintenance | seals every `x_users.mfa_secret` still in the clear; idempotent, `{ sealed, alreadySealed, skipped }` |
41
42
  | `x secrets show\|init\|edit\|set\|rotate` | the committed encrypted secrets | decrypted into the `envSchema` variables of the same names |
42
43
  | `x policy list\|explain <subject>` | which clause decided a permission, and why | five packages print `x policy explain` as a denial's `fix:` |
43
44
  | `x i18n check\|add\|sync` | catalogs: gaps, a new locale, key sync | all three of i18n's own error fixes name it |
44
- | `x errors explain <CODE>` / `list` | the error table, programmatically | refuses an unregistered code instead of inventing one |
45
+ | `x errors explain <CODE>` / `list` | the error table, programmatically | refuses an unregistered code instead of inventing one. An app's own `defineError()` code answers inside the app from the registry alone: title, HTTP status (`null`: off-socket) and the declaring `file:line` — no `cause`/`fix`, which only a throw has (`As of 2026-11-19`) |
45
46
  | `x repro <id> [--write] [--verify]` / `--list` / `--from` | a dead job or a captured 5xx as a red test in `repro/` | `--verify` answers `{ reproduced, code, fingerprint }`; a mismatch is `X_REPRO_NOT_REPRODUCED`, never a crash |
46
47
  | `x repro <id> --bundle` | the failure as one redacted `repro/bundle-<id>.json` for an issue | secrets masked, env values / hostnames / paths replaced; `bunx create-ultimate repro <file>` opens it |
47
48
  | `x docs "<question>"` | the framework docs and the wiki, offline | answered from the installed packages and the `wiki/` this tarball ships (`prepack`: `scripts/pack-cli-wiki.ts`), never the network; `x docs Upgrading#<anchor>` prints one whole section |
@@ -203,6 +204,8 @@ its name like any guard.
203
204
  | `parse.ts` | flags, subcommands, `--json`, `--help`, suggestions |
204
205
  | `flag-number.ts` | the one integer-flag reader — `--port`, `--workers`, `--shard` |
205
206
  | `shell-quote.ts` | the one POSIX quoter for a value pasted into a `fix:` or a reproduce line |
207
+ | `stop-run-start.ts` | the one `x stop --json && x <command> && x dev` fix line (`stopRunStartFix`); `stop-run-start.test.ts` refuses a hand-built one |
208
+ | `db-dev-wire.ts` | the `/_x/db` paths and the `--steps` rule, import-free, read by the dev routes and the `x db` clients; `db-dev-wire.test.ts` refuses a restated literal |
206
209
  | `output.ts` | one data shape, two renderers, the 3-line error format |
207
210
  | `registry.ts` | the one command list |
208
211
  | `generate-kinds.ts` | which generators exist, and how a command line names one |
@@ -227,6 +230,7 @@ its name like any guard.
227
230
  | `app-transport.ts` / `browser-transport.ts` | one browser transport, on `boundaries` in every app: a raw `fetch(`, `new WebSocket(` or `new XMLHttpRequest(` in an island's closure is `X_BROWSER_TRANSPORT_BYPASS`; a server barrel there is `X_BROWSER_SERVER_BARREL` |
228
231
  | `app-agents-md.ts` | `AGENTS.md` exists and stays short, over `@ultimat3/manifest`'s check |
229
232
  | `serve.ts` | **what a container starts** — `runRole(options)`, the same boot `x dev` runs minus the watcher, `/_x` and `dev: true`. `x new`'s `apps/web/server.ts` is three lines that call it. `ROLE`, `PORT` and `HOST` are read from `env`; `role`, `port` and `hostname` on `ServeOptions` override each. `ROLE=worker` also retires on SIGUSR2 (`serve-retire.ts`, 25.0.0): stop claiming, finish every held job, abort nothing, drain, exit 0 — what the chart's opt-in `roles.worker.retireSeconds` `preStop` sends; core's `isRetiring()` is true from the signal on, and a SIGTERM mid-retire drains on `drain.workerDeadlineMs` when declared (`lifecycleForRole`); a no-op on Windows ([Deployment](../../wiki/Deployment.md#retiring-a-worker-before-sigterm)) |
233
+ | `supervise*.ts` | `ULTIMATE_PROCESSES`: how many processes one production container runs, and the supervisor that runs them on one port — see [Processes per container](#processes-per-container-ultimate_processes) |
230
234
  | `prerender.ts` | `x build --target static`: which `site/` routes qualify, and where the bytes land |
231
235
  | `metrics-endpoint.ts` | the `METRICS_PATH` scrape listener every role opens, on `METRICS_PORT`; opening it starts the `process_*` series, labelled by `startMetricsEndpoint({ role })` |
232
236
  | `runtime-liveness.ts` | `/healthz` on `METRICS_PORT`: core's liveness plus every running loop's heartbeat (`@ultimat3/jobs`' `staleLoops`) — 503 on a wedged worker, scheduler or replicator loop; the loop's name only in the `ultimate.liveness.loop-stale` log line |
@@ -244,7 +248,7 @@ its name like any guard.
244
248
  | `workspace-checks.ts` | file-size ceiling and package contract files |
245
249
  | `drift.ts` `budgets.ts` | the checks `x verify` composes |
246
250
  | `budgets-freshness.ts` `verify-budgets-build.ts` | whether `budgets` may read the stats on disk, and the build it runs when not |
247
- | `cmd-stop.ts` | `x stop`: SIGTERM to the lock's pid, the wait, the Windows lock clear |
251
+ | `cmd-stop.ts` | `x stop`: SIGTERM to the lock's pid, the wait, the Windows lock clear; a lock whose pid the kernel reused is cleared with nothing signalled |
248
252
 
249
253
  The CLI describes an app by **loading** it, never by parsing it: `action()`, `entity()`,
250
254
  `job()` and `defineRoute()` register themselves, and `x manifest`, `x routes` and `x verify`
@@ -284,6 +288,94 @@ generator (a second run is `X_GENERATE_CONFLICT`), then edits `app.config.ts`
284
288
  (`generate-sign-in-config.ts`) and, for OIDC, swaps `x new`'s authenticator only while it is
285
289
  byte-for-byte `x new`'s (`generate-sign-in.ts`). `generate-sign-in.contract.test.ts` compiles,
286
290
  lints and runs what both shapes leave; `e2e/sign-in.e2e.test.ts` signs in to a production boot.
291
+ Both shapes ship the second leg, `As of 2026-11`: `--oidc` hands `oauthLogin` `mfaPath:
292
+ '/auth/sign-in/second-factor'` and writes that page, `actions/confirm-session.ts` and a
293
+ `sign-in-challenge.ts` that reads auth's `__Host-x_mfa` cookie through `readMfaChallenge`.
294
+ One challenge cookie for both shapes, `As of 2026-11-19`: `--password` holds its challenge in the
295
+ same cookie through auth's `mfaChallengeOf` / `mfaChallengeCookie` (`templates/sign-in-challenge.ts`
296
+ writes both shapes' module); no generated file names a cookie. An app generated before keeps its own
297
+ `x_mfa_challenge` code — that file is the app's, and nothing in the framework reads it.
298
+
299
+ ## Processes per container (`ULTIMATE_PROCESSES`)
300
+
301
+ `runRole` decides once, in the process the platform started (`As of 2026-11-19`). Above one, that
302
+ process supervises: it never boots the app, and N children of the same entry point serve one port
303
+ through `reusePort` (`sharedPortOption`, `@ultimat3/core`). Production and staging only: `x dev`,
304
+ `bun test` and every other environment run one process, and a count asked for there is ignored
305
+ with one `ultimate processes ignored` info line.
306
+
307
+ | Value | Count |
308
+ |---|---|
309
+ | unset, blank, `auto` | the minimum of the clamps below |
310
+ | a positive whole number | that number, checked: refused for the conditions marked *refused* |
311
+ | anything else | `X_PROCESSES_INVALID` |
312
+
313
+ | Clamp (auto) | Value | An explicit count |
314
+ |---|---|---|
315
+ | `cpu` | cgroup v2 `cpu.max` quota / period (v1 CFS quota beside it), floored, at least 1, at most `navigator.hardwareConcurrency`. **No quota declared (`max`) is 1** | not read |
316
+ | `memory` | (`memory.max` − 32 MiB) / 256 MiB, floored; none when unlimited | a warning above it, never a refusal |
317
+ | `pool` | `DATABASE_POOL_MAX`, else the role's profile: the children split it, never multiply it | refused, `X_PROCESSES_OVER_POOL` |
318
+ | `role` | 1 for `scheduler`, `replicator`, `migrate` | refused, `X_PROCESSES_ROLE_SINGLETON` |
319
+ | `shared-state` | 1 for: `lru` in `cache.tiers` with neither `NATS_URL` nor `REDIS_URL`/`VALKEY_URL`; a `runtime.ts` rate-limit or idempotency store whose scope is not `'shared'`; no `DATABASE_URL`; `sync` without `NATS_URL` (or a supplied transport) | refused, `X_PROCESSES_UNSHARED_STATE` |
320
+ | `image` | 1 when the image holds no prebuilt store (`x build --target prebuilt`) | not read |
321
+ | `platform` | 1 off Linux, where Bun ignores `reusePort` | refused, `X_PROCESSES_UNBALANCED` |
322
+
323
+ A child whose boot is refused for a reason a restart meets again (`FATAL_BOOT_CODES` in
324
+ `supervise-child.ts`: a missing or malformed variable, `X_CONFIG_INVALID`, a key that does not
325
+ match, an unresolved import, every `X_PROCESSES_*` refusal — among them an idempotency store an app
326
+ module swaps in after boot, seen only by a child) logs `ultimate child refused to boot` with its own
327
+ code and fix and tells the supervisor, which stops (exit 1) rather than restart into the same
328
+ refusal. A database, bus or migration still on its way is restarted with backoff.
329
+
330
+ Every boot logs one line: `ultimate processes` with `role`, `count`, `requested`, `binding` (the
331
+ clamp that set it: `environment`, `platform`, `role`, `cpu`, `memory`, `pool`, `shared-state`,
332
+ `image` or `requested`) and each clamp's number.
333
+
334
+ | Supervisor | Rule |
335
+ |---|---|
336
+ | Children | `[process.execPath, ...process.argv.slice(1)]`, `ipc` with `serialization: 'json'`, env `ULTIMATE_CHILD=<i>/<N>`, `ROLE`, and `DATABASE_POOL_MAX` = `childShare(pool, i, N)` |
337
+ | `METRICS_PORT` | the supervisor's: `/healthz` (alive, not in a crash loop), `/readyz` (200 only when every child not draining said `ready`), `/metrics` (each child's loopback scrape, `child="<i>"` added, HELP/TYPE once per family). A child's own listener is `127.0.0.1:0`; its role port opens no boot probe |
338
+ | Signals | handlers installed before the first spawn; SIGTERM and SIGINT forwarded to every child; SIGUSR2 to a worker container's children only |
339
+ | Drain | a child's bound (`readinessGraceMs + drainDeadlineMs`, as it reports it) starts at its `draining` ack, + 2 s, then SIGKILL; one outer ceiling, the longest bound + 6 s from the signal |
340
+ | Exit | 0 when every child exited 0; 70 when one exited 70 or was killed at a bound; 1 for any other failure, a child's refusal, or `X_PROCESS_CRASH_LOOP` |
341
+ | Restart | never while stopping; backoff 1, 2, 4… s capped at 30 s, reset after 60 s up; 5 unexpected exits of one child in 5 minutes drain the rest and exit 1 (`X_PROCESS_CRASH_LOOP`); 3 failed `/healthz` polls 5 s apart restart a child by drain |
342
+ | A child | sends `ready` (`metricsUrl`, `budgetMs`), `draining` (`budgetMs`), `gone` (`code`), `fatal` (`code`); drains on a signal or a `drain` message; leaves on IPC `disconnect` or when its ppid differs from the one it started with |
343
+
344
+ ## Beside a running `x dev` (embedded database)
345
+
346
+ PGlite takes one writer and no lock: a second process's writes are replaced by the holder's next
347
+ one, silently. `As of 2026-11`:
348
+
349
+ | Command | Beside a live `x dev` holding `.x/pgdata` |
350
+ |---|---|
351
+ | `x db migrate` | applied BY the dev server (`POST /_x/db/migrate`: loopback Host and peer, same-origin — the command sends `Sec-Fetch-Site: same-origin`, so an app's CSRF check lets it through); the report, drift and schema dump are the same. `x dev`'s own `x db gen "…" && x db migrate` fix works as printed. A holder that is still booting (its lock claimed inside the last 120 s, or a new child) is waited for, up to 120 s, on a refused connection only |
352
+ | `x db migrate`, app with `database.rowSecurity` | refused: the dev session serves as `x_app` and cannot migrate as `x_migrator`. Fix: `x stop --json && x db migrate && x dev` (what `x dev` prints for that app) |
353
+ | `x db rollback [--steps n]` | run BY the dev server (`POST /_x/db/rollback`, the same doors); with `database.rowSecurity` refused the same way, fix `x stop --json && x db rollback --steps n && x dev` |
354
+ | `x db gen` | reads the ledger's checksums from the dev server (`POST /_x/db/ledger`) for its edited-migration check; one that does not answer is a printed line, never a refusal |
355
+ | `x db seed`, `x db backfill --write`, `x jobs retry\|cancel\|delete\|promote\|resolve-step\|pause\|resume`, `x auth seal-mfa` | `X_DEV_ALREADY_RUNNING`; the fix stops the holder, runs the command and starts `x dev` again |
356
+ | `x db reset\|status\|diagnostics\|recount` | `X_DEV_ALREADY_RUNNING`, as before |
357
+
358
+ With an external `DATABASE_URL` none of this applies: Postgres takes any number of writers.
359
+
360
+ `x dev` is not green while its database is behind the files (`As of 2026-11-19`): a migration on
361
+ disk the ledger lacks is `X_APP_MIGRATIONS_UNAPPLIED` (fix `x db migrate`) on the banner and `/_x`,
362
+ an applied one edited since is `X_MIGRATION_CONFLICT`. A migrate or rollback applied through the
363
+ dev server ends in a generation, so the finding clears with no save. A schema finding appearing
364
+ or clearing never restarts the dev server: the process that answered the 500 answers the 200.
365
+
366
+ ## `x db rollback`
367
+
368
+ | | |
369
+ |---|---|
370
+ | What runs | `@ultimat3/db`'s `rollback()`: the migrate lock, one transaction per `down`, most recently **applied** first (not highest id). `--json`: `data` = `{ reverted, steps, files }` |
371
+ | Afterwards | the files are still on disk, so each is pending: `x db migrate` re-applies it; delete the `.sql`, `.snapshot.json` and `.hash` to drop the change |
372
+ | No `-- down` half | `X_MIGRATION_IRREVERSIBLE`, nothing reversed — a ledger row is never deleted over SQL that was not undone. An empty down UNDER the marker is a reversal that needs no statement, and is reversed |
373
+ | A change `x db gen` wrote as two migrations (`<id>`, `<id>_concurrently`) | one step reverses the second half only, and the output says the first is still applied; `--steps 2` reverses both |
374
+ | File gone | `X_MIGRATION_CONFLICT`; on the embedded dev database its fix is `x stop --json && x db reset` |
375
+ | Outside `development`/`test` | refused `X_MIGRATION_ROLLBACK_DESTRUCTIVE` until `ROLLBACK_ALLOW_DESTRUCTIVE` names **every** migration it would reverse — the migrate role's own override, checked under the lock against the exact rows. An unreadable `ULTIMATE_ENV` counts as production |
376
+
377
+ `x jobs pause|resume <queue>` refuses a queue the app does not serve (`X_CLI_BAD_FLAG`, the nearest
378
+ name in the fix); `resume` of a queue that IS paused always passes, to clear a retired one.
287
379
 
288
380
  ## Errors
289
381
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/cli",
3
- "version": "31.48.0",
3
+ "version": "31.50.0",
4
4
  "description": "The `x` binary: new, dev, build, verify, generate, db, mcp, doctor, deploy",
5
5
  "keywords": [
6
6
  "ultimate",
@@ -52,35 +52,35 @@
52
52
  "dev": "bun run src/bin.ts dev"
53
53
  },
54
54
  "dependencies": {
55
- "@babel/core": "^8.0.10",
56
- "@ultimat3/action": "31.48.0",
57
- "@ultimat3/admin": "31.48.0",
58
- "@ultimat3/ai": "31.48.0",
59
- "@ultimat3/auth": "31.48.0",
60
- "@ultimat3/cache": "31.48.0",
61
- "@ultimat3/core": "31.48.0",
62
- "@ultimat3/db": "31.48.0",
63
- "@ultimat3/entity": "31.48.0",
64
- "@ultimat3/flags": "31.48.0",
65
- "@ultimat3/http": "31.48.0",
66
- "@ultimat3/i18n": "31.48.0",
67
- "@ultimat3/jobs": "31.48.0",
68
- "@ultimat3/mail": "31.48.0",
69
- "@ultimat3/manifest": "31.48.0",
70
- "@ultimat3/mcp": "31.48.0",
71
- "@ultimat3/money": "31.48.0",
72
- "@ultimat3/notify": "31.48.0",
73
- "@ultimat3/policy": "31.48.0",
74
- "@ultimat3/pwa": "31.48.0",
75
- "@ultimat3/query": "31.48.0",
76
- "@ultimat3/realtime": "31.48.0",
77
- "@ultimat3/render": "31.48.0",
78
- "@ultimat3/schema": "31.48.0",
79
- "@ultimat3/scraping": "31.48.0",
80
- "@ultimat3/seo": "31.48.0",
81
- "@ultimat3/storage": "31.48.0",
82
- "@ultimat3/testing": "31.48.0",
83
- "@ultimat3/time": "31.48.0",
55
+ "@babel/core": "^8.1.0",
56
+ "@ultimat3/action": "31.50.0",
57
+ "@ultimat3/admin": "31.50.0",
58
+ "@ultimat3/ai": "31.50.0",
59
+ "@ultimat3/auth": "31.50.0",
60
+ "@ultimat3/cache": "31.50.0",
61
+ "@ultimat3/core": "31.50.0",
62
+ "@ultimat3/db": "31.50.0",
63
+ "@ultimat3/entity": "31.50.0",
64
+ "@ultimat3/flags": "31.50.0",
65
+ "@ultimat3/http": "31.50.0",
66
+ "@ultimat3/i18n": "31.50.0",
67
+ "@ultimat3/jobs": "31.50.0",
68
+ "@ultimat3/mail": "31.50.0",
69
+ "@ultimat3/manifest": "31.50.0",
70
+ "@ultimat3/mcp": "31.50.0",
71
+ "@ultimat3/money": "31.50.0",
72
+ "@ultimat3/notify": "31.50.0",
73
+ "@ultimat3/policy": "31.50.0",
74
+ "@ultimat3/pwa": "31.50.0",
75
+ "@ultimat3/query": "31.50.0",
76
+ "@ultimat3/realtime": "31.50.0",
77
+ "@ultimat3/render": "31.50.0",
78
+ "@ultimat3/schema": "31.50.0",
79
+ "@ultimat3/scraping": "31.50.0",
80
+ "@ultimat3/seo": "31.50.0",
81
+ "@ultimat3/storage": "31.50.0",
82
+ "@ultimat3/testing": "31.50.0",
83
+ "@ultimat3/time": "31.50.0",
84
84
  "babel-preset-solid": "^1.9.16"
85
85
  }
86
86
  }
@@ -66,7 +66,9 @@ export function apiEntriesFor(written: readonly string[]): readonly ApiEntry[] {
66
66
  * comment between two entries ends nothing. (The list was closed at the first `]` in the raw text
67
67
  * and split at every comma — a commented list was rewritten with its comment as an entry.)
68
68
  */
69
- const listsOf = (source: string): ((key: string) => SourceList | undefined) | undefined => {
69
+ export const apiListsOf = (
70
+ source: string,
71
+ ): ((key: string) => SourceList | undefined) | undefined => {
70
72
  const masked = maskOf(source);
71
73
  const call = /\bdefineApi\(\s*\{/.exec(masked);
72
74
  if (call === null) return undefined;
@@ -79,6 +81,45 @@ const listsOf = (source: string): ((key: string) => SourceList | undefined) | un
79
81
  };
80
82
  };
81
83
 
84
+ /**
85
+ * Whether the `defineApi({ ... })` call names `key` in ANY form — `key: [...]`, `key: value`, the
86
+ * shorthand `key,`. `readProperties` sees only `key:`; a shorthand `queries,` read as absent, and
87
+ * 31.49.0's merge-drivers codemod added `queries: []` beside it: a duplicate key, TS1117.
88
+ */
89
+ function apiDeclares(source: string, key: string): boolean {
90
+ const masked = maskOf(source);
91
+ const call = /\bdefineApi\(\s*\{/.exec(masked);
92
+ if (call === null) return false;
93
+ const object = readList(source, masked, call.index + call[0].length - 1);
94
+ const named = new RegExp(`^(?:${key}|'${key}'|"${key}")\\s*(?::|$)`);
95
+ // The SOURCE text, not the masked: masking blanks a string's contents, so `'jobs':` read as absent.
96
+ return (object?.entries ?? []).some((entry) =>
97
+ named.test(source.slice(entry.start, entry.end).trim()),
98
+ );
99
+ }
100
+
101
+ /**
102
+ * `source` with `key: value,` added as a property, on its own row: in the order `x new` writes —
103
+ * actions, queries, jobs, tasks — so after the nearest list before it the call already holds, which
104
+ * is `actions` at the least. `undefined` when the row would not land inside the call: an earlier
105
+ * list sharing its row with the call's own `});` puts "the row after it" outside.
106
+ */
107
+ export function insertApiList(
108
+ source: string,
109
+ key: ApiEntry['key'],
110
+ value: string,
111
+ ): string | undefined {
112
+ const listOf = apiListsOf(source);
113
+ const actions = listOf?.('actions');
114
+ if (listOf === undefined || actions === undefined || apiDeclares(source, key)) return undefined;
115
+ const earlier = LIST_ORDER.slice(0, LIST_ORDER.indexOf(key))
116
+ .map((name) => listOf(name))
117
+ .findLast((found) => found !== undefined);
118
+ const after = source.indexOf('\n', (earlier ?? actions).close);
119
+ const candidate = `${source.slice(0, after + 1)} ${key}: ${value},\n${source.slice(after + 1)}`;
120
+ return apiListsOf(candidate)?.(key) === undefined ? undefined : candidate;
121
+ }
122
+
82
123
  /**
83
124
  * `source` with each entry imported and listed. The import joins the `import * as` block in sorted
84
125
  * position; the binding joins its list, which is created after `actions: [...]` when the call has
@@ -94,7 +135,7 @@ export function insertApiEntries(
94
135
  const skipped: ApiEntry[] = [];
95
136
  for (const entry of entries) {
96
137
  const importLine = `import * as ${entry.binding} from '${entry.specifier}';`;
97
- const listOf = listsOf(next);
138
+ const listOf = apiListsOf(next);
98
139
  const actions = listOf?.('actions');
99
140
  if (listOf === undefined || actions === undefined) {
100
141
  skipped.push(entry);
@@ -103,18 +144,8 @@ export function insertApiEntries(
103
144
  const list = listOf(entry.key);
104
145
  if (list?.entries.some((one) => one.text === entry.binding) === true) continue;
105
146
  if (list === undefined) {
106
- // In the order `x new` writes — actions, queries, jobs, tasks: after the nearest list
107
- // before it that the call already holds, which is `actions` at the least.
108
- const earlier = LIST_ORDER.slice(0, LIST_ORDER.indexOf(entry.key))
109
- .map((key) => listOf(key))
110
- .findLast((found) => found !== undefined);
111
- const after = next.indexOf('\n', (earlier ?? actions).close);
112
- const line = ` ${entry.key}: [${entry.binding}],`;
113
- const candidate = `${next.slice(0, after + 1)}${line}\n${next.slice(after + 1)}`;
114
- // Read back, as every other edit here is: when the earlier list shares its row with the
115
- // call's own `});`, "the row after it" is OUTSIDE the call — a property of nothing.
116
- const landed = listsOf(candidate)?.(entry.key);
117
- if (landed?.entries.some((one) => one.text === entry.binding) !== true) {
147
+ const candidate = insertApiList(next, entry.key, `[${entry.binding}]`);
148
+ if (candidate === undefined) {
118
149
  skipped.push(entry);
119
150
  continue;
120
151
  }
package/src/api-routes.ts CHANGED
@@ -38,6 +38,7 @@ export function apiMountRoutes(store?: RateLimitStore): readonly Route[] {
38
38
  scopes: mount.scopes,
39
39
  resolveToken: mount.resolveToken,
40
40
  ...(mount.rateLimit === undefined ? {} : { rateLimit: mount.rateLimit }),
41
+ ...(mount.tenant === undefined ? {} : { tenant: mount.tenant }),
41
42
  ...(store === undefined ? {} : { rateLimitStore: store }),
42
43
  }),
43
44
  );
package/src/app-load.ts CHANGED
@@ -21,7 +21,7 @@ import { routeEntries, setAssetResolver } from '@ultimat3/render';
21
21
  // here is six hops through `error-contract` → `fix-command` → the command registry, which is an
22
22
  // accident one refactor away from compiling every app's `.tsx` to `React.createElement`. The named
23
23
  // import is a value import, so the side effect holds without the bare line it replaced.
24
- import { setStylesheetRoot } from '@ultimat3/render/server';
24
+ import { setStylesheetRoot, siteAssetTable } from '@ultimat3/render/server';
25
25
  import { asyncModules } from './app-load-async';
26
26
  import { importInOrder } from './app-load-batch';
27
27
  import { isFirstPass, registeredAny, registerModule } from './app-load-register';
@@ -33,7 +33,6 @@ import type { Finding } from './output';
33
33
  import { findingFrom } from './output';
34
34
  import { hasPathSegment } from './path-segments';
35
35
  import { posixRelative, toPosix } from './posix-path';
36
- import { siteAssetTable } from './site-assets';
37
36
  import { isTest } from './source-files';
38
37
 
39
38
  /** Every place an app keeps code the framework has to see. */
@@ -332,7 +331,12 @@ export async function loadApp(root: string): Promise<LoadedApp> {
332
331
  // reach is a finding here, owned by `manifest` like every other load finding. Imported here, not
333
332
  // at the top: a container boots through `scanAppModules` and never asks (`serve-graph.test.ts`).
334
333
  const { unscannedAdminFindings } = await import('./unscanned-admin');
335
- const findings = [...scan.findings, ...(await unscannedAdminFindings(root))];
334
+ const scanned = [...scan.findings, ...(await unscannedAdminFindings(root))];
335
+ // Only a load that failed asks why: the merge's leftovers explain it better than each importer.
336
+ const findings =
337
+ scanned.length === 0
338
+ ? scanned
339
+ : [...(await (await import('./merge-state')).withMergeCauses(root, scanned))];
336
340
  await trackStylesheets(root);
337
341
  // An app that imported NOTHING and reported nothing is a registry every later step reads as
338
342
  // empty-and-fine. With an `app.config.ts` beside it, that is never what the author meant.
@@ -72,7 +72,13 @@ export const openApiArtifacts = (manifest: Manifest): readonly OpenApiArtifact[]
72
72
  const merged = mergedDocument(manifest);
73
73
  const routes = apiRoutes();
74
74
  for (const mount of mounts) {
75
- bearerMount({ prefix: mount.prefix, routes, scopes: mount.scopes, resolveToken: () => null });
75
+ bearerMount({
76
+ prefix: mount.prefix,
77
+ routes,
78
+ scopes: mount.scopes,
79
+ resolveToken: () => null,
80
+ ...(mount.tenant === undefined ? {} : { tenant: mount.tenant }),
81
+ });
76
82
  artifacts.push({
77
83
  file: mount.openapi ?? OPENAPI_FILE,
78
84
  text: serializeOpenApi(
package/src/app-root.ts CHANGED
@@ -54,7 +54,12 @@ export function findAppRoot(from: string): AppRoot | undefined {
54
54
  : { dir, configPath: join(dir, APP_CONFIG_FILE), manifestPath: join(dir, MANIFEST_FILE) };
55
55
  }
56
56
 
57
- export function requireAppRoot(command: string, from: string): AppRoot {
57
+ export function requireAppRoot(
58
+ command: string,
59
+ from: string,
60
+ /** What was typed after `x`, for the refusal's fix to hand back whole (`dispatch.ts`). */
61
+ typed?: readonly string[],
62
+ ): AppRoot {
58
63
  const root = findAppRoot(from);
59
64
  if (root === undefined) {
60
65
  const dir = resolve(from);
@@ -64,6 +69,7 @@ export function requireAppRoot(command: string, from: string): AppRoot {
64
69
  below: appDirsBelow(dir),
65
70
  adopter: dependsOnFramework(dir),
66
71
  xScript: hasXScript(dir),
72
+ ...(typed === undefined ? {} : { typed }),
67
73
  });
68
74
  }
69
75
  return root;
package/src/budgets.ts CHANGED
@@ -11,6 +11,7 @@ import { join } from 'node:path';
11
11
  import { ERROR_DOCS_URL, formatBytes } from '@ultimat3/core';
12
12
  import type { Manifest, RouteFact } from '@ultimat3/manifest';
13
13
  import { describePages, parseByteBudget, themeScriptBody } from '@ultimat3/render';
14
+ import { MANIFEST_FILE } from './app-root';
14
15
  import type { ChargedFile } from './budgets-charged';
15
16
  import { chargedClause, chargedMeta, heaviestFirst } from './budgets-charged';
16
17
  import type { RouteRequests } from './budgets-requests';
@@ -115,7 +116,7 @@ const KB = 1024;
115
116
  function exceededJsFix(url: string, file: string | undefined, bytes: number): string {
116
117
  const where = file ?? `the file declaring ${url}`;
117
118
  const kb = Math.ceil(bytes / KB);
118
- return `edit ${where} — set budget: { js: '${String(kb)}kb' } with // measured: ${String(bytes)} B (x build --target static) — why: <the function it buys> directly above it; or x routes --json for the chain and move the heavy import behind hydrate: 'interaction'`;
119
+ return `edit ${where} — set budget: { js: '${String(kb)}kb' } with // measured: ${String(bytes)} B (x build --target static) — why: <the function it buys> directly above it, then x manifest (${MANIFEST_FILE} carries the budget); or x routes --json for the chain and move the heavy import behind hydrate: 'interaction'`;
119
120
  }
120
121
 
121
122
  /**