@ultimat3/cli 31.31.0 → 31.33.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 (170) hide show
  1. package/package.json +29 -29
  2. package/src/admin-registration.ts +6 -5
  3. package/src/affected.ts +3 -2
  4. package/src/api-registration.ts +7 -5
  5. package/src/app-agents-md.ts +1 -1
  6. package/src/app-boundaries.ts +12 -8
  7. package/src/app-layout.ts +6 -5
  8. package/src/app-load.ts +1 -1
  9. package/src/app-manifest.ts +1 -1
  10. package/src/app-mcp.ts +11 -9
  11. package/src/app-openapi.ts +7 -5
  12. package/src/app-reload-graph.ts +9 -7
  13. package/src/app-runtime.ts +9 -6
  14. package/src/async-pages.ts +6 -5
  15. package/src/browser-launcher.ts +9 -5
  16. package/src/browser-transport.ts +8 -5
  17. package/src/budgets.ts +4 -3
  18. package/src/cdp-shot-driver.ts +21 -5
  19. package/src/cdp-shot-errors.ts +7 -5
  20. package/src/cdp-shot-page.ts +6 -5
  21. package/src/cdp-shot-watch.ts +7 -5
  22. package/src/ci-log.ts +6 -5
  23. package/src/ci-runs.ts +7 -3
  24. package/src/cmd-auth.ts +5 -4
  25. package/src/cmd-build.ts +13 -7
  26. package/src/cmd-ci.ts +9 -6
  27. package/src/cmd-clean.ts +9 -6
  28. package/src/cmd-db-backfill.ts +8 -5
  29. package/src/cmd-db-branch.ts +3 -2
  30. package/src/cmd-db.ts +2 -2
  31. package/src/cmd-deploy-compose.ts +8 -5
  32. package/src/cmd-deploy.ts +2 -1
  33. package/src/cmd-dev.ts +1 -0
  34. package/src/cmd-env.ts +1 -1
  35. package/src/cmd-errors.ts +2 -3
  36. package/src/cmd-generate.ts +2 -0
  37. package/src/cmd-i18n.ts +8 -6
  38. package/src/cmd-jobs.ts +3 -2
  39. package/src/cmd-manifest.ts +1 -0
  40. package/src/cmd-new.ts +2 -0
  41. package/src/cmd-planned.ts +2 -1
  42. package/src/cmd-pr.ts +7 -6
  43. package/src/cmd-registries.ts +5 -4
  44. package/src/cmd-repro.ts +8 -2
  45. package/src/cmd-secrets.ts +1 -1
  46. package/src/cmd-shot-island.ts +4 -2
  47. package/src/cmd-shot.ts +1 -0
  48. package/src/cmd-tasks.ts +7 -5
  49. package/src/cmd-test.ts +13 -8
  50. package/src/db-backfill.ts +4 -3
  51. package/src/db-branch.ts +2 -2
  52. package/src/db-generate.ts +1 -1
  53. package/src/db-schema-refresh.ts +5 -4
  54. package/src/db-seed.ts +3 -2
  55. package/src/dev-child-watch.ts +7 -6
  56. package/src/dev-environment.ts +6 -5
  57. package/src/dev-lock.ts +5 -2
  58. package/src/dev-n-plus-one.ts +7 -5
  59. package/src/dev-reload.ts +7 -5
  60. package/src/dev-restart-retire.ts +7 -5
  61. package/src/dev-supervisor.ts +9 -6
  62. package/src/dev-watch-tree.ts +9 -7
  63. package/src/dev-watch.ts +7 -5
  64. package/src/document-styles.ts +7 -5
  65. package/src/drift.ts +9 -5
  66. package/src/duplicate-packages.ts +12 -6
  67. package/src/error-contract.ts +4 -2
  68. package/src/error-fixes.ts +7 -6
  69. package/src/error-unthrown.ts +7 -5
  70. package/src/errors.ts +11 -10
  71. package/src/fix-imports.ts +1 -1
  72. package/src/flag-number.ts +2 -1
  73. package/src/flag-reads.ts +1 -1
  74. package/src/framework-schema-apply.ts +7 -5
  75. package/src/framework-scope.ts +1 -1
  76. package/src/generate-files.ts +1 -1
  77. package/src/generate-follow-ups.ts +8 -5
  78. package/src/generate-kinds.ts +2 -2
  79. package/src/generate-shadow.ts +6 -4
  80. package/src/generate-sibling.ts +6 -4
  81. package/src/gh-target.ts +3 -2
  82. package/src/guards.ts +4 -3
  83. package/src/handle-registration.ts +4 -3
  84. package/src/i18n-audit.ts +4 -4
  85. package/src/i18n-registration.ts +7 -4
  86. package/src/import-closure.ts +7 -6
  87. package/src/island-bundle.ts +7 -6
  88. package/src/island-cache-inputs.ts +2 -1
  89. package/src/island-capture.ts +5 -4
  90. package/src/island-realtime-state.ts +6 -5
  91. package/src/island-realtime.ts +8 -6
  92. package/src/island-shot-errors.ts +2 -1
  93. package/src/island-shot.ts +6 -5
  94. package/src/load-findings.ts +8 -5
  95. package/src/local-cli.ts +8 -6
  96. package/src/mcp-db-target.ts +2 -2
  97. package/src/mcp-errors.ts +3 -1
  98. package/src/mcp-ui-diff.ts +8 -5
  99. package/src/mcp-ui-inspect.ts +8 -6
  100. package/src/mcp-ui-interact.ts +9 -6
  101. package/src/mcp-ui.ts +11 -9
  102. package/src/measure-database.ts +8 -6
  103. package/src/measure-paths.ts +7 -5
  104. package/src/measure-scope.ts +10 -8
  105. package/src/migrations.ts +2 -0
  106. package/src/page-navigation.ts +9 -7
  107. package/src/page-speculation.ts +8 -6
  108. package/src/parse.ts +3 -3
  109. package/src/path-segments.ts +2 -1
  110. package/src/pr-threads.ts +2 -1
  111. package/src/prerender.ts +4 -4
  112. package/src/role-start.ts +3 -2
  113. package/src/role-sync.ts +2 -1
  114. package/src/runtime-assets.ts +8 -6
  115. package/src/runtime-bindings.ts +2 -0
  116. package/src/runtime-cache.ts +7 -5
  117. package/src/runtime-live-feed.ts +7 -5
  118. package/src/runtime-overrides.ts +7 -5
  119. package/src/runtime-queue.ts +6 -5
  120. package/src/schema-drift.ts +11 -14
  121. package/src/script-csp.ts +4 -2
  122. package/src/secrets-rotation.ts +7 -5
  123. package/src/serve-boot.ts +8 -6
  124. package/src/serve.ts +8 -5
  125. package/src/server-barrels.ts +7 -5
  126. package/src/shell-quote.ts +8 -1
  127. package/src/shot-locale.ts +2 -1
  128. package/src/shot-route.ts +2 -1
  129. package/src/shot-theme.ts +8 -6
  130. package/src/site-config.ts +2 -1
  131. package/src/site-llms-pages.ts +8 -2
  132. package/src/source-list-edit.ts +8 -6
  133. package/src/static-cards.ts +2 -2
  134. package/src/static-report.ts +22 -18
  135. package/src/sync-authenticator.ts +6 -5
  136. package/src/templates/admin-page.ts +8 -5
  137. package/src/templates/admin.ts +6 -5
  138. package/src/templates/guard-animated-layout-property.ts +7 -5
  139. package/src/templates/guard-focus-visible.ts +7 -5
  140. package/src/templates/guard-image-dimensions.ts +8 -5
  141. package/src/templates/guard-island-without-states.ts +5 -3
  142. package/src/templates/guard-semantic-interactive.ts +1 -0
  143. package/src/templates/island.ts +9 -6
  144. package/src/templates/resource-form-island.ts +3 -2
  145. package/src/templates/resource-page.ts +8 -6
  146. package/src/templates/route.ts +1 -0
  147. package/src/templates/scaffold-docs.ts +7 -6
  148. package/src/templates/scaffold-entries.ts +7 -5
  149. package/src/templates/scaffold-errors.ts +8 -6
  150. package/src/templates/scaffold-repo.ts +5 -4
  151. package/src/templates/scaffold-shell.ts +7 -5
  152. package/src/templates/scaffold-site.ts +7 -5
  153. package/src/test-housekeeping.ts +3 -6
  154. package/src/test-select.ts +3 -3
  155. package/src/ts-scan.ts +6 -4
  156. package/src/tsconfig-references.ts +6 -6
  157. package/src/verify-checks.ts +9 -9
  158. package/src/verify-e2e.ts +8 -6
  159. package/src/verify-floor.ts +8 -8
  160. package/src/verify-pace.ts +3 -1
  161. package/src/verify-role-load.ts +8 -5
  162. package/src/verify-services.ts +2 -1
  163. package/src/verify-tests.ts +2 -2
  164. package/src/verify-typecheck.ts +7 -5
  165. package/src/version-loader.ts +1 -1
  166. package/src/worker-bundle.ts +7 -5
  167. package/src/workspace-checks.ts +6 -3
  168. package/src/workspace-external-deps.ts +4 -2
  169. package/src/workspace-graph.ts +4 -3
  170. package/src/write-line.ts +1 -1
package/src/dev-reload.ts CHANGED
@@ -1,8 +1,10 @@
1
- // One rebuild at a time. A reload is a full `appManifest()` plus a `buildIslands()` over every
2
- // island, and the watcher had no in-flight guard: a 45ms drip of writes — a slow `git checkout`, a
3
- // formatter walking the tree, `x db gen` — started one per file, 40 for 40 files, each assigning
4
- // the same two state slots in COMPLETION order. So a slower earlier rebuild could land on top of a
5
- // newer one, and the dev server then served a manifest built from source that had already changed.
1
+ // One rebuild at a time: the in-flight guard over the dev loop's reloads.
2
+ //
3
+ // A reload is a full `appManifest()` plus a `buildIslands()` over every island, and the watcher had
4
+ // no in-flight guard: a 45ms drip of writes — a slow `git checkout`, a formatter walking the tree,
5
+ // `x db gen` — started one per file, 40 for 40 files, each assigning the same two state slots in
6
+ // COMPLETION order. So a slower earlier rebuild could land on top of a newer one, and the dev
7
+ // server then served a manifest built from source that had already changed.
6
8
 
7
9
  /** What a tick does while a rebuild is already running: nothing, except become the next one. */
8
10
  export type ReloadTrigger = (file: string) => void;
@@ -1,8 +1,10 @@
1
- // `x dev`'s restart, worker first (issue #677). A save that reaches a primitive-defining module
2
- // restarts the child, and the drain that ends it used to be the FIRST thing it did: a job that ran
3
- // past the drain budget was aborted `X_DRAINING` and requeued, so a non-idempotent one (a bank
4
- // login) ran twice. The worker is retired first — `stop()` claims nothing and aborts nothing — and
5
- // only then is the drain asked to release the port, the lock and the embedded database.
1
+ // `x dev`'s restart, worker first (issue #677): retire the worker, then drain.
2
+ //
3
+ // A save that reaches a primitive-defining module restarts the child, and the drain that ends it
4
+ // used to be the FIRST thing it did: a job that ran past the drain budget was aborted `X_DRAINING`
5
+ // and requeued, so a non-idempotent one (a bank login) ran twice. The worker is retired first —
6
+ // `stop()` claims nothing and aborts nothing — and only then is the drain asked to release the
7
+ // port, the lock and the embedded database.
6
8
 
7
9
  import { drain, logger, markRetiring, renderThrowable } from '@ultimat3/core';
8
10
  import type { Worker } from '@ultimat3/jobs';
@@ -1,9 +1,12 @@
1
- // `x dev` as two processes: this one supervises, a child serves. A save that reaches a module which
2
- // DEFINES a primitive (`app-reload-graph.ts`'s pinned modules — a query over a slice's service, an
3
- // admin page's view under `defineAdmin`) cannot be served by re-importing: the registries and the
4
- // route table hold that module's first instance. The child exits `DEV_RESTART_EXIT_CODE` instead
5
- // of logging "reloaded" over stale code, and this loop boots a fresh one on the same port. Every
6
- // other save stays the in-process reload it was — a restart is paid only where nothing else works.
1
+ // `x dev` as two processes: this one supervises, a child serves — and a fresh child boots on
2
+ // the same port when a save reaches a module that defines a primitive.
3
+ //
4
+ // A save that reaches a module which DEFINES a primitive (`app-reload-graph.ts`'s pinned modules —
5
+ // a query over a slice's service, an admin page's view under `defineAdmin`) cannot be served by
6
+ // re-importing: the registries and the route table hold that module's first instance. The child
7
+ // exits `DEV_RESTART_EXIT_CODE` instead of logging "reloaded" over stale code, and this loop boots
8
+ // a fresh one on the same port. Every other save stays the in-process reload it was — a restart is
9
+ // paid only where nothing else works.
7
10
 
8
11
  import type { StalePin } from './app-reload-graph';
9
12
  import { devSpec } from './cmd-dev-spec';
@@ -1,10 +1,12 @@
1
- // The app root watched one directory at a time, because the watch SET is a registration decision
2
- // and not a filter. `watch(root, { recursive: true })` takes an inotify descriptor per directory
3
- // in the tree — including every directory the dev loop then discards events from — so `.git/`,
4
- // `node_modules/` and `.x/` (which this very process writes to, continuously) each cost a
5
- // descriptor, a kernel queue entry and a JS callback per write, against a per-user descriptor
6
- // budget of 8192 on many distributions. Bun 1.4.0's `fs.watch` takes no ignore option, so the
7
- // only place the answer can be given early is at registration.
1
+ // The app root watched one directory at a time, because the watch SET is a registration
2
+ // decision and not a filter.
3
+ //
4
+ // `watch(root, { recursive: true })` takes an inotify descriptor per directory in the tree —
5
+ // including every directory the dev loop then discards events from — so `.git/`, `node_modules/`
6
+ // and `.x/` (which this very process writes to, continuously) each cost a descriptor, a kernel
7
+ // queue entry and a JS callback per write, against a per-user descriptor budget of 8192 on many
8
+ // distributions. Bun 1.4.0's `fs.watch` takes no ignore option, so the only place the answer can be
9
+ // given early is at registration.
8
10
 
9
11
  // why: Bun exposes no filesystem watcher, no directory listing and no synchronous stat —
10
12
  // `Bun.file().exists()` is async and answers false for a DIRECTORY, which is the one thing this
package/src/dev-watch.ts CHANGED
@@ -1,8 +1,10 @@
1
- // Which paths under the app root `x dev` must not watch, and the rule is REGISTRATION rather than
2
- // filtering: `watch(root, { recursive: true })` takes one inotify descriptor per directory before
3
- // any filter runs, so an answer given after the event has already cost the kernel queue, a JS
4
- // callback and a slot out of `max_user_watches`. Measured on a monorepo root: 1901 descriptors,
5
- // 1490 of them under `.git/` and `node_modules/`, and one `git status` delivering 5 events.
1
+ // Which paths under the app root `x dev` must not watch — decided at REGISTRATION, not by
2
+ // filtering events.
3
+ //
4
+ // `watch(root, { recursive: true })` takes one inotify descriptor per directory before any filter
5
+ // runs, so an answer given after the event has already cost the kernel queue, a JS callback and a
6
+ // slot out of `max_user_watches`. Measured on a monorepo root: 1901 descriptors, 1490 of them under
7
+ // `.git/` and `node_modules/`, and one `git status` delivering 5 events.
6
8
  //
7
9
  // The ignore set is the app's own `.gitignore`, read with git's own anchoring (`gitignore.ts`),
8
10
  // plus a floor of directory names an ignore file need not name. It was seven hand-listed names,
@@ -1,8 +1,10 @@
1
- // One question the gate asks of what a render actually emits: does the document carry its global
2
- // style layer? Every rule `@ultimat3/ui` emits reads a custom property — `background:rgb(var(
3
- // --color-bg)/1)`, `padding:var(--space-8)` — so CSS with no `:root` definitions is a document the
4
- // browser drops every one of those declarations from, byte-for-byte identical to a working page
5
- // apart from the styling nobody sees missing. A silent failure is exactly what axiom 3 exists for.
1
+ // One question the gate asks of what a render actually emits: does the document carry its
2
+ // global style layer?
3
+ //
4
+ // Every rule `@ultimat3/ui` emits reads a custom property — `background:rgb(var( --color-bg)/1)`,
5
+ // `padding:var(--space-8)` — so CSS with no `:root` definitions is a document the browser drops
6
+ // every one of those declarations from, byte-for-byte identical to a working page apart from the
7
+ // styling nobody sees missing. A silent failure is exactly what axiom 3 exists for.
6
8
 
7
9
  import { ERROR_DOCS_URL } from '@ultimat3/core';
8
10
  import type { Surface } from '@ultimat3/render';
package/src/drift.ts CHANGED
@@ -1,14 +1,18 @@
1
- // Source drift: the app's schema *source* against what migrations recorded. `x db gen` writes the
2
- // hash of the entity schema next to the migration it produced, so drift here is "the schema hashes
3
- // to something no migration recorded". The hash is committed beside the migration, so a fresh clone
4
- // answers with no local state and CI needs no database. An app with NO migration at all is the one
5
- // case that also asks how many entities are declared — see `checkSourceDrift`.
1
+ // Source drift: the app's schema *source* against what migrations recorded.
2
+ //
3
+ // `x db gen` writes the hash of the entity schema next to the migration it produced, so drift here
4
+ // is "the schema hashes to something no migration recorded". The hash is committed beside the
5
+ // migration, so a fresh clone answers with no local state and CI needs no database. An app with NO
6
+ // migration at all is the one case that also asks how many entities are declared — see
7
+ // `checkSourceDrift`.
6
8
  //
7
9
  // This is not the post-migrate verification and deliberately cannot be: that one is the live
8
10
  // database against the ledger (`checkDrift`, `@ultimat3/db`), asked by `runMigrations` where a
9
11
  // connection is open. Same `X_DB_DRIFT`, two conditions — an entity edited with no migration
10
12
  // generated, versus a database that does not match the migrations it ran.
11
13
 
14
+ // why: the probes are of DIRECTORIES, which `Bun.file().exists()` answers false for; Bun ships no
15
+ // path API, and `join` builds the paths under the app root.
12
16
  import { existsSync } from 'node:fs';
13
17
  import { join } from 'node:path';
14
18
  // `canonicalJson` is core's, the one serializer every content hash in the framework uses. A private
@@ -1,8 +1,10 @@
1
- // Two installed copies of one registry-holding framework package, found before either registry is
2
- // asked anything. `@ultimat3/i18n`, `@ultimat3/policy` and `@ultimat3/entity` each keep their
3
- // registry at MODULE scope, so a second module instance is a second, EMPTY registry: an app whose
4
- // `packages/i18n` workspace pinned `@ultimat3/i18n@19.0.0` while its root had 19.1.0 registered
5
- // every catalog into the workspace's copy, the CLI read the root's, and `x i18n check` answered
1
+ // Two installed copies of one registry-holding framework package, found before either registry
2
+ // is asked anything.
3
+ //
4
+ // `@ultimat3/i18n`, `@ultimat3/policy` and `@ultimat3/entity` each keep their registry at MODULE
5
+ // scope, so a second module instance is a second, EMPTY registry: an app whose `packages/i18n`
6
+ // workspace pinned `@ultimat3/i18n@19.0.0` while its root had 19.1.0 registered every catalog into
7
+ // the workspace's copy, the CLI read the root's, and `x i18n check` answered
6
8
  // `X_CATALOG_UNREGISTERED` with a fix that said to move a `defineCatalogs()` call that was already
7
9
  // exactly where the fix said to put it (one adopter, 2026-09-05). The same split is the one
8
10
  // `local-cli.ts` hands over for — a global `x` is a second copy of `@ultimat3/entity` — except this
@@ -225,7 +227,11 @@ const manifestOf = (from: string): string | undefined =>
225
227
  * app-relative one an agent can open.
226
228
  */
227
229
  export function duplicateCause(root: string, duplicate: DuplicateInstall): string {
228
- const registry = REGISTRY_PACKAGES[duplicate.pkg] ?? 'registry';
230
+ // The package name is data: `constructor` is a published package, and the bare read answered
231
+ // `Object`'s own function into the cause.
232
+ const registry = Object.hasOwn(REGISTRY_PACKAGES, duplicate.pkg)
233
+ ? REGISTRY_PACKAGES[duplicate.pkg]
234
+ : 'registry';
229
235
  const copies = duplicate.copies.map((copy) => renderCopy(root, copy)).join(' and ');
230
236
  return (
231
237
  `${duplicate.copies.length} copies of ${duplicate.pkg} are installed: ${copies} — each is ` +
@@ -1,10 +1,12 @@
1
- // The error contract, enforced (axiom 3: a convention that is not a build error does not exist).
1
+ // The error contract, enforced (axiom 3): every `fix:` executable and every code documented,
2
+ // decided before the code runs.
3
+ //
2
4
  // Axiom 4 says an error is an instruction, so a `fix:` an agent cannot act on is a defect in the
3
5
  // error, not a matter of taste — and a code no reference page documents strands whoever hits it.
4
6
  // Both halves are decidable before the code runs, which is why they are a gate step and not a
5
7
  // runtime assertion nobody sees until the failure they describe has already happened.
6
8
 
7
- // `join` is `node:`-only by necessity: Bun exposes no path-join primitive.
9
+ // why: `join` is `node:`-only by necessity: Bun exposes no path-join primitive.
8
10
  import { join } from 'node:path';
9
11
  import { ERROR_DOCS_URL } from '@ultimat3/core';
10
12
  import { citedCommandProblem, loadCommandCatalog } from './fix-command';
@@ -1,10 +1,11 @@
1
- // Every `X_*` code's REAL `fix:`, read off the throw site that raises it. `x errors explain` used
2
- // to answer `x verify --json` for every code the CLI does not own — 327 of 378 — which is a shrug,
3
- // not an instruction. The framework already writes an executable fix at each throw site and the
4
- // `errors` gate step already proves each one runnable, so the answer is to project that text
5
- // rather than to restate it in a second table nobody keeps current (axiom 2).
1
+ // Every `X_*` code's REAL `fix:`, read off the throw site that raises it.
2
+ //
3
+ // `x errors explain` used to answer `x verify --json` for every code the CLI does not own — 327 of
4
+ // 378 — which is a shrug, not an instruction. The framework already writes an executable fix at
5
+ // each throw site and the `errors` gate step already proves each one runnable, so the answer is to
6
+ // project that text rather than to restate it in a second table nobody keeps current (axiom 2).
6
7
 
7
- // Bun ships no path join: the scan needs an absolute path per globbed, scope-relative entry.
8
+ // why: Bun ships no path join: the scan needs an absolute path per globbed, scope-relative entry.
8
9
  import { join } from 'node:path';
9
10
  import { staticFix } from './error-contract';
10
11
  import { frameworkScopeDir } from './framework-scope';
@@ -1,9 +1,11 @@
1
- // A registered code nothing constructs. The registry and the reference keep a shipped code alive
2
- // forever — which is right — and that is exactly why a code can outlive its last thrower with no
3
- // gate noticing: `X_RPC_FAILED` sat registered and documented as live after the transport change
4
- // took its only throw site away. It has to be LISTED as unthrown (`UNTHROWN_CODES`), or this
5
- // reports it.
1
+ // A registered code nothing constructs, reported unless listed in `UNTHROWN_CODES`.
2
+ //
3
+ // The registry and the reference keep a shipped code alive forever — which is right — and that is
4
+ // exactly why a code can outlive its last thrower with no gate noticing: `X_RPC_FAILED` sat
5
+ // registered and documented as live after the transport change took its only throw site away. It
6
+ // has to be LISTED as unthrown (`UNTHROWN_CODES`), or this reports it.
6
7
 
8
+ // why: Bun ships no path API; `join` builds the absolute path of each scanned file.
7
9
  import { join } from 'node:path';
8
10
  import { ERROR_DOCS_URL, maskLiterals, stripComments } from '@ultimat3/core';
9
11
  import { RESERVED_HEADING } from './error-contract';
package/src/errors.ts CHANGED
@@ -17,7 +17,7 @@ export class UnknownCommandError extends UltimateError {
17
17
  super({
18
18
  code: 'X_CLI_UNKNOWN_COMMAND',
19
19
  cause: `"x ${input.path}" is not a command (known: ${input.known.join(', ')})${input.why === undefined ? '' : ` — ${input.why}`}`,
20
- fix: input.suggestion === undefined ? 'x help' : `x ${input.suggestion}`,
20
+ fix: input.suggestion === undefined ? 'x help' : `x ${quoteArg(input.suggestion.split(' '))}`,
21
21
  });
22
22
  }
23
23
  }
@@ -32,7 +32,7 @@ export class BadFlagError extends UltimateError {
32
32
  super({
33
33
  code: 'X_CLI_BAD_FLAG',
34
34
  cause: `--${input.flag} on "x ${input.command}": ${input.reason}`,
35
- fix: input.fix ?? `x ${input.command} --help`,
35
+ fix: input.fix ?? `x ${quoteArg(input.command.split(' '))} --help`,
36
36
  });
37
37
  }
38
38
  }
@@ -111,7 +111,7 @@ export class MissingSubcommandError extends UltimateError {
111
111
  super({
112
112
  code: 'X_CLI_BAD_FLAG',
113
113
  cause: `"x ${input.command}" takes a subcommand and got none (one of: ${input.known.join(', ')})`,
114
- fix: `x help ${input.command}`,
114
+ fix: `x help ${quoteArg(input.command.split(' '))}`,
115
115
  });
116
116
  }
117
117
  }
@@ -245,7 +245,7 @@ export class CatalogExistsError extends UltimateError {
245
245
  super({
246
246
  code: 'X_GENERATE_CONFLICT',
247
247
  cause: `${input.path} already exists`,
248
- fix: `x i18n sync ${input.locale}`,
248
+ fix: `x i18n sync ${quoteArg(input.locale)}`,
249
249
  });
250
250
  }
251
251
  }
@@ -277,7 +277,7 @@ export class ErrorCodeUnknownError extends UltimateError {
277
277
  fix:
278
278
  input.suggestion === undefined
279
279
  ? 'x errors list --json'
280
- : `x errors explain ${input.suggestion}`,
280
+ : `x errors explain ${quoteArg(input.suggestion)}`,
281
281
  });
282
282
  }
283
283
  }
@@ -302,8 +302,8 @@ export class DeclarationUnknownError extends UltimateError {
302
302
  cause: `no ${input.singular} named "${input.name}" is registered (${input.known.length} known)`,
303
303
  fix:
304
304
  input.suggestion === undefined
305
- ? `x ${input.kind} list --json`
306
- : `x ${input.kind} ${input.verb ?? 'show'} ${input.suggestion}`,
305
+ ? `x ${quoteArg(input.kind)} list --json`
306
+ : `x ${quoteArg(input.kind)} ${quoteArg(input.verb ?? 'show')} ${quoteArg(input.suggestion)}`,
307
307
  });
308
308
  }
309
309
  }
@@ -332,7 +332,7 @@ export class FixTargetUnknownError extends UltimateError {
332
332
  fix:
333
333
  input.suggestion === undefined
334
334
  ? 'x routes --json # every registered route file, app-root-relative'
335
- : `x fix boundary ${input.suggestion}`,
335
+ : `x fix boundary ${quoteArg(input.suggestion)}`,
336
336
  });
337
337
  }
338
338
  }
@@ -347,7 +347,7 @@ export class IslandBuildFailedError extends UltimateError {
347
347
  super({
348
348
  code: 'X_BUILD_FAILED',
349
349
  cause: `${input.file} is an island entry point and would not bundle: ${input.logs}`,
350
- fix: `bun build --target browser ${input.file}`,
350
+ fix: `bun build --target browser ${quoteArg(input.file)}`,
351
351
  });
352
352
  }
353
353
  }
@@ -450,10 +450,11 @@ export class PortInvalidError extends UltimateError {
450
450
  /** `name` so the scrape port reports itself; the code stays one, because the fault is one. */
451
451
  constructor(input: { value: string; name?: string }) {
452
452
  const name = input.name ?? 'PORT';
453
+ const example = quoteArg(`${name}=${name === 'PORT' ? 3000 : 9090}`);
453
454
  super({
454
455
  code: 'X_PORT_INVALID',
455
456
  cause: `${name}="${input.value}" is not a TCP port number between 0 and 65535`,
456
- fix: `docker run -e ${name}=${name === 'PORT' ? 3000 : 9090} my-app:latest`,
457
+ fix: `docker run -e ${example} my-app:latest`,
457
458
  });
458
459
  }
459
460
  }
@@ -2,7 +2,7 @@
2
2
  // `packages/ui/src/errors.ts` and every fix it is handed is written in `icons/build-icons.ts`.
3
3
  // One specifier, one file read, one parameter position — deliberately still not `tsc`.
4
4
 
5
- // `dirname`/`join` are `node:`-only by necessity: Bun exposes no path-join primitive.
5
+ // why: `dirname`/`join` are `node:`-only by necessity: Bun exposes no path-join primitive.
6
6
  import { dirname, join } from 'node:path';
7
7
  import { endOfLiteral, maskLiterals } from '@ultimat3/core';
8
8
  import type { FixHelper } from './fix-scan';
@@ -7,6 +7,7 @@ import { UltimateError } from '@ultimat3/core';
7
7
  import { BadFlagError } from './errors';
8
8
  import type { ParsedArgs } from './parse';
9
9
  import { flagString } from './parse';
10
+ import { quoteArg } from './shell-quote';
10
11
 
11
12
  export interface IntFlag {
12
13
  readonly name: string;
@@ -93,7 +94,7 @@ class SyncPortUnavailableError extends UltimateError {
93
94
  super({
94
95
  code: 'X_PORT_INVALID',
95
96
  cause: `the sync role binds PORT + 1, and PORT=${input.port} is the top of the range — it would ask for ${input.port + 1}, which is not a TCP port`,
96
- fix: `x dev --port ${neighbouringPort(input.port)} # leaves ${PORT_RANGE.max} free for the sync node`,
97
+ fix: `x dev --port ${quoteArg(String(neighbouringPort(input.port)))} # leaves ${PORT_RANGE.max} free for the sync node`,
97
98
  meta: { port: input.port },
98
99
  });
99
100
  }
package/src/flag-reads.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  // plan JSON, where nothing read the field; that flag is deleted rather than wired, and a second
8
8
  // one of its shape would pass here too.
9
9
 
10
- // `join`/`relative` are `node:`-only by necessity: Bun exposes no path-join primitive.
10
+ // why: `join`/`relative` are `node:`-only by necessity: Bun exposes no path-join primitive.
11
11
  import { join, relative } from 'node:path';
12
12
  import { ERROR_DOCS_URL, stripComments } from '@ultimat3/core';
13
13
  import type { Finding } from './output';
@@ -1,8 +1,10 @@
1
- // The three ways a boot meets the framework schema (plan 101, s1-con #5): `applyLockedSchema` runs
2
- // the DDL in ONE transaction behind the migration advisory lock with a bounded `lock_timeout`, then
3
- // stamps the build; `verifySchema` (`framework-schema-verify.ts`) runs none; `ensureSchema` reads
4
- // the stamp and applies only when this build is absent from it. Which boot takes which is
5
- // `runtime-queue.ts`'s `SchemaMode`.
1
+ // The three ways a boot meets the framework schema (plan 101, s1-con #5): locked apply, verify
2
+ // only, or ensure — apply only when this build is absent from the stamp.
3
+ //
4
+ // `applyLockedSchema` runs the DDL in ONE transaction behind the migration advisory lock with a
5
+ // bounded `lock_timeout`, then stamps the build; `verifySchema` (`framework-schema-verify.ts`) runs
6
+ // none; `ensureSchema` reads the stamp and applies only when this build is absent from it. Which
7
+ // boot takes which is `runtime-queue.ts`'s `SchemaMode`.
6
8
 
7
9
  import { frameworkVersion, logger } from '@ultimat3/core';
8
10
  import type { DbClient } from '@ultimat3/db';
@@ -3,7 +3,7 @@
3
3
  // the docs `x docs` quotes and the `fix:` lines `x errors explain` projects come from the same
4
4
  // directory or they describe different builds.
5
5
 
6
- // `node:fs`/`node:path` because Bun ships neither: `dirname` walks a resolved module up to the
6
+ // why: `node:fs`/`node:path` because Bun ships neither: `dirname` walks a resolved module up to the
7
7
  // directory that owns it, `basename` names the two segments the store layout is recognised by,
8
8
  // and `existsSync` is what says which directory is really there.
9
9
  import { existsSync } from 'node:fs';
@@ -335,7 +335,7 @@ export function generate(options: GenerateOptions): readonly GeneratedFile[] {
335
335
  default:
336
336
  throw new NotImplementedError({
337
337
  cause: `generator "${String(options.kind)}" is not implemented in this build`,
338
- fix: `x g ${GENERATORS.join('|')}`,
338
+ fix: `x help g # one of: ${GENERATORS.join(', ')}`,
339
339
  });
340
340
  }
341
341
  }
@@ -1,8 +1,11 @@
1
- // Everything `x g` edits OUTSIDE the files it creates, in the one order they have to happen: a
2
- // declared permission granted to a role, a primitive listed in `defineApi`, an entity added to the
3
- // typed handle, an `--admin` override wired, a contract test's exercise entry declared, each new
4
- // workspace edge declared, and every catalog made selectable. One function over one disk seam, so a real run and a dry run are the same code
5
- // — and the dry run's list of touched files is what the run touches, not a second guess at it.
1
+ // Everything `x g` edits OUTSIDE the files it creates, in the one order they have to happen,
2
+ // over one disk seam so a real run and a dry run are the same code.
3
+ //
4
+ // In order: a declared permission granted to a role, a primitive listed in `defineApi`, an entity
5
+ // added to the typed handle, an `--admin` override wired, a contract test's exercise entry
6
+ // declared, each new workspace edge declared, and every catalog made selectable. One function over
7
+ // one disk seam, so a real run and a dry run are the same code — and the dry run's list of touched
8
+ // files is what the run touches, not a second guess at it.
6
9
 
7
10
  import { registerAdminResources } from './admin-registration';
8
11
  import { registerGeneratedPrimitives } from './api-registration';
@@ -61,7 +61,7 @@ export function assertSurfaceSupported(kind: Generator, surface: Surface, name:
61
61
  reason: 'a resource slice is app-surface — site/ ships 0kb JS and may not import app/',
62
62
  // The caller's own name, not `<name>`: a `fix:` is copied and run verbatim, and `x g resource
63
63
  // <name>` is a shell redirect (`bash: name: No such file or directory`), not a command.
64
- fix: `x g resource ${name} && x g route ${name} --surface site`,
64
+ fix: `x g resource ${quoteArg(name)} && x g route ${quoteArg(name)} --surface site`,
65
65
  });
66
66
  }
67
67
 
@@ -134,7 +134,7 @@ export function readSurface(raw: string | undefined, kind: Generator, name: stri
134
134
  flag: 'surface',
135
135
  command: 'g',
136
136
  reason: `"${raw}" is not a surface (site, app)`,
137
- fix: `x g ${kind} ${name} --surface app`,
137
+ fix: `x g ${quoteArg(kind)} ${quoteArg(name)} --surface app`,
138
138
  });
139
139
  }
140
140
 
@@ -1,8 +1,10 @@
1
- // A generator name whose type spelling the emitted code ALSO uses as a global or a local alias:
2
- // `x g resource promise` imports `type { Promise }` beside `Promise<Row>`, and `row` writes
1
+ // A generator name whose type or value spelling the emitted code ALSO uses as a global or a
2
+ // local alias, decided on the planned files themselves.
3
+ //
4
+ // A type: `x g resource promise` imports `type { Promise }` beside `Promise<Row>`, and `row` writes
3
5
  // `type Row = Row`. Decided on the planned files themselves, so a template that starts using
4
- // another global is covered the day it does — and the names that clash nowhere stay allowed.
5
- // The same for a VALUE: `x g job job` imports `{ job }` from `@ultimat3/jobs` and declares
6
+ // another global is covered the day it does — and the names that clash nowhere stay allowed. The
7
+ // same for a VALUE: `x g job job` imports `{ job }` from `@ultimat3/jobs` and declares
6
8
  // `export const job = job(…)` beside it, which is TS2440 in the module the run just wrote.
7
9
 
8
10
  import { BadFlagError } from './errors';
@@ -1,8 +1,10 @@
1
1
  // Whether a feature's `entity.ts` makes the next `x g entity --feature` a SIBLING
2
- // (`entity-<name>.ts`). Decided on what the file READABLY declares, and conservatively: the
3
- // sibling path skips the conflict on `entity.ts`, so taking the same table for "another one" —
4
- // because it is spelled as a template literal, or held in a constant — wrote a second module for
5
- // one table where the run should have refused.
2
+ // (`entity-<name>.ts`), decided conservatively on what the file READABLY declares.
3
+ //
4
+ // Decided on what the file READABLY declares, and conservatively: the sibling path skips the
5
+ // conflict on `entity.ts`, so taking the same table for "another one" — because it is spelled as a
6
+ // template literal, or held in a constant — wrote a second module for one table where the run
7
+ // should have refused.
6
8
 
7
9
  import { endOfLiteral, maskLiterals, QUOTES } from '@ultimat3/core';
8
10
  import { names } from './templates/naming';
package/src/gh-target.ts CHANGED
@@ -7,6 +7,7 @@ import { t } from '@ultimat3/schema';
7
7
  import { BadFlagError } from './errors';
8
8
  import type { GhHost } from './gh';
9
9
  import { GhFailedError, ghJson } from './gh';
10
+ import { quoteArg } from './shell-quote';
10
11
 
11
12
  /** `owner/name`, split once so a caller never re-splits it and never re-joins it wrong. */
12
13
  export interface GhRepo {
@@ -53,14 +54,14 @@ export async function resolveRepo(
53
54
  flag: 'repo',
54
55
  command,
55
56
  reason: `"${flag}" is not an owner/name repository reference`,
56
- fix: `x ${command} --repo developerz-ai/ultimate --json`,
57
+ fix: `x ${quoteArg(command.split(' '))} --repo developerz-ai/ultimate --json`,
57
58
  });
58
59
  }
59
60
  return repoOf(flag);
60
61
  }
61
62
  const viewed = await ghJson(host, ['repo', 'view', '--json', 'nameWithOwner'], REPO_VIEW, {
62
63
  label: 'gh repo view',
63
- fix: `x ${command} --repo developerz-ai/ultimate --json`,
64
+ fix: `x ${quoteArg(command.split(' '))} --repo developerz-ai/ultimate --json`,
64
65
  });
65
66
  return repoOf(viewed.nameWithOwner);
66
67
  }
package/src/guards.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  // every guard the framework ships (`guards-built-in.ts`). The framework decides what a guard IS —
4
4
  // a function returning findings, held to the error contract — and nothing about what it checks.
5
5
 
6
- // Bun ships no equivalent for either: `join` builds the host-separator path, and `pathToFileURL` is
7
- // the only spelling of an absolute path `import()` accepts on every host.
6
+ // why: Bun ships no equivalent for either: `join` builds the host-separator path, and
7
+ // `pathToFileURL` is the only spelling of an absolute path `import()` accepts on every host.
8
8
  import { join } from 'node:path';
9
9
  import { pathToFileURL } from 'node:url';
10
10
  import { ERROR_DOCS_URL, renderCauseValue, renderThrowable } from '@ultimat3/core';
@@ -25,6 +25,7 @@ export { GUARD_DIR, guardPaths } from './guards-paths';
25
25
 
26
26
  import { vendoredCopy, vendoredFinding } from './guards-vendored';
27
27
  import type { Finding } from './output';
28
+ import { quoteArg } from './shell-quote';
28
29
  import { readVerifyFloor } from './verify-floor';
29
30
  import type { GuardBaseline } from './verify-guard-baseline';
30
31
  import { guardNameOf, judgeGuardBaseline, orphanedBaselineFindings } from './verify-guard-baseline';
@@ -151,7 +152,7 @@ const notAGuard = (path: string, exported: unknown): Finding => {
151
152
  const notADirectory: Finding = {
152
153
  code: 'X_GUARD_INVALID',
153
154
  cause: `${GUARD_DIR} is not a directory, so none of this app's own guards can run beside the shipped ones`,
154
- fix: `mv ${GUARD_DIR} ${GUARD_DIR}.txt && mkdir ${GUARD_DIR} && x verify --only boundaries --json # ${GUARD_DIR}/ is the directory the gate discovers; a rule of yours goes in it as ${GUARD_DIR}/<name>.ts`,
155
+ fix: `mv ${quoteArg(GUARD_DIR)} ${quoteArg(GUARD_DIR)}.txt && mkdir ${quoteArg(GUARD_DIR)} && x verify --only boundaries --json # ${GUARD_DIR}/ is the directory the gate discovers; a rule of yours goes in it as ${GUARD_DIR}/<name>.ts`,
155
156
  docs: ERROR_DOCS_URL,
156
157
  at: GUARD_DIR,
157
158
  };
@@ -1,6 +1,7 @@
1
- // `x g entity` / `x g resource` hand the entity they wrote to the app's typed database handle. The
2
- // generated `repo.ts` reads `db.<table>`, and a table is on the handle only when its entity is in
3
- // the set `packages/db/src/client.ts` passes to `database()` — an edit nothing made, so the repo
1
+ // `x g entity` / `x g resource` hand the entity they wrote to the app's typed database handle.
2
+ //
3
+ // The generated `repo.ts` reads `db.<table>`, and a table is on the handle only when its entity is
4
+ // in the set `packages/db/src/client.ts` passes to `database()` — an edit nothing made, so the repo
4
5
  // did not compile. Performed here; where the file is not the scaffold's shape, the finding names
5
6
  // the two lines.
6
7
 
package/src/i18n-audit.ts CHANGED
@@ -2,10 +2,10 @@
2
2
  // key sets. No CLI shapes and no msg() — an app root in, plain data out, so every path here is
3
3
  // testable without a ParsedArgs or a rendered message.
4
4
 
5
- // `node:` and not Bun: Bun exposes no existence check (`existsSync`, which is how a missing
6
- // `catalogs/` directory reads as "nothing shipped" instead of a throw) and no path API at all —
7
- // `join` builds the absolute path `Bun.file` reads; `posixRelative` turns it back into the
8
- // root-relative POSIX shape every CLI-reported path is keyed by.
5
+ // why: `node:` and not Bun: `Bun.file().exists()` answers false for a directory, and `existsSync`
6
+ // is how a missing `catalogs/` directory reads as "nothing shipped" instead of a throw; Bun has no
7
+ // path API at all — `join` builds the absolute path `Bun.file` reads; `posixRelative` turns it
8
+ // back into the root-relative POSIX shape every CLI-reported path is keyed by.
9
9
  import { existsSync } from 'node:fs';
10
10
  import { join } from 'node:path';
11
11
  import { DEFAULT_LOCALE, renderThrowable } from '@ultimat3/core';
@@ -1,8 +1,10 @@
1
1
  // Every finding about an app's strings, and the one composition `x i18n check` and `x verify`'s
2
2
  // `i18n` step both report — two callers, one answer, so the command and the gate can never
3
- // disagree. The runtime half is here because nothing else could ask it: `i18n-audit.ts` compares
4
- // source against files on disk and was green for every string of a shipped app whose catalog
5
- // module nothing imported (issue #249).
3
+ // disagree.
4
+ //
5
+ // The runtime half is here because nothing else could ask it: `i18n-audit.ts` compares source
6
+ // against files on disk and was green for every string of a shipped app whose catalog module
7
+ // nothing imported (issue #249).
6
8
 
7
9
  // why: Bun ships no path API, so `join` is the only way to reach the app's own i18n module on
8
10
  // the host's separator.
@@ -30,6 +32,7 @@ import { localeParityFindings } from './i18n-locale-parity';
30
32
  import { mailPreviewFindings } from './mail-preview-findings';
31
33
  import type { Finding } from './output';
32
34
  import { findingFrom } from './output';
35
+ import { quoteArg } from './shell-quote';
33
36
  import { CATALOG_ROOT, catalogPath } from './templates/locales';
34
37
 
35
38
  /** The one package this check probes for a duplicate: its registry is the one it reads. */
@@ -212,7 +215,7 @@ export function unregisteredFix(
212
215
  // report a registered locale as unregistered, which is the direction that costs trust.
213
216
  if (index.includes(`${CATALOG_ROOT.split('/').pop() ?? 'catalogs'}/${locale}.json`)) return {};
214
217
  return {
215
- fix: `x i18n sync ${locale} # re-derives ${APP_CATALOGS_PATH} from the catalogs on disk`,
218
+ fix: `x i18n sync ${quoteArg(locale)} # re-derives ${APP_CATALOGS_PATH} from the catalogs on disk`,
216
219
  };
217
220
  }
218
221
 
@@ -1,9 +1,10 @@
1
- // The modules a set of entry files can EXECUTE, followed name by name through barrels. A package
2
- // barrel re-exports its whole surface by name (the house forbids `export *`), so a closure taken
3
- // module by module reaches every server file of every package an island touches — `@ultimat3/action`'s
4
- // barrel reaches `http.ts` — while a bundler with honest `sideEffects` keeps only the modules the
5
- // imported NAMES live in. This follows the names, which is what makes "browser-reachable" a
6
- // question with a useful answer instead of "everything".
1
+ // The modules a set of entry files can EXECUTE, followed name by name through barrels.
2
+ //
3
+ // A package barrel re-exports its whole surface by name (the house forbids `export *`), so a
4
+ // closure taken module by module reaches every server file of every package an island touches —
5
+ // `@ultimat3/action`'s barrel reaches `http.ts` — while a bundler with honest `sideEffects` keeps
6
+ // only the modules the imported NAMES live in. This follows the names, which is what makes
7
+ // "browser-reachable" a question with a useful answer instead of "everything".
7
8
  //
8
9
  // Pure over an injected reader, so a test's fixture tree is a Map rather than files on disk.
9
10