@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/cli",
3
- "version": "31.31.0",
3
+ "version": "31.33.0",
4
4
  "description": "The `x` binary: new, dev, build, verify, generate, db, mcp, doctor, deploy",
5
5
  "keywords": [
6
6
  "ultimate",
@@ -53,34 +53,34 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@babel/core": "^8.0.10",
56
- "@ultimat3/action": "31.31.0",
57
- "@ultimat3/admin": "31.31.0",
58
- "@ultimat3/ai": "31.31.0",
59
- "@ultimat3/auth": "31.31.0",
60
- "@ultimat3/cache": "31.31.0",
61
- "@ultimat3/core": "31.31.0",
62
- "@ultimat3/db": "31.31.0",
63
- "@ultimat3/entity": "31.31.0",
64
- "@ultimat3/flags": "31.31.0",
65
- "@ultimat3/http": "31.31.0",
66
- "@ultimat3/i18n": "31.31.0",
67
- "@ultimat3/jobs": "31.31.0",
68
- "@ultimat3/mail": "31.31.0",
69
- "@ultimat3/manifest": "31.31.0",
70
- "@ultimat3/mcp": "31.31.0",
71
- "@ultimat3/money": "31.31.0",
72
- "@ultimat3/notify": "31.31.0",
73
- "@ultimat3/policy": "31.31.0",
74
- "@ultimat3/pwa": "31.31.0",
75
- "@ultimat3/query": "31.31.0",
76
- "@ultimat3/realtime": "31.31.0",
77
- "@ultimat3/render": "31.31.0",
78
- "@ultimat3/schema": "31.31.0",
79
- "@ultimat3/scraping": "31.31.0",
80
- "@ultimat3/seo": "31.31.0",
81
- "@ultimat3/storage": "31.31.0",
82
- "@ultimat3/testing": "31.31.0",
83
- "@ultimat3/time": "31.31.0",
56
+ "@ultimat3/action": "31.33.0",
57
+ "@ultimat3/admin": "31.33.0",
58
+ "@ultimat3/ai": "31.33.0",
59
+ "@ultimat3/auth": "31.33.0",
60
+ "@ultimat3/cache": "31.33.0",
61
+ "@ultimat3/core": "31.33.0",
62
+ "@ultimat3/db": "31.33.0",
63
+ "@ultimat3/entity": "31.33.0",
64
+ "@ultimat3/flags": "31.33.0",
65
+ "@ultimat3/http": "31.33.0",
66
+ "@ultimat3/i18n": "31.33.0",
67
+ "@ultimat3/jobs": "31.33.0",
68
+ "@ultimat3/mail": "31.33.0",
69
+ "@ultimat3/manifest": "31.33.0",
70
+ "@ultimat3/mcp": "31.33.0",
71
+ "@ultimat3/money": "31.33.0",
72
+ "@ultimat3/notify": "31.33.0",
73
+ "@ultimat3/policy": "31.33.0",
74
+ "@ultimat3/pwa": "31.33.0",
75
+ "@ultimat3/query": "31.33.0",
76
+ "@ultimat3/realtime": "31.33.0",
77
+ "@ultimat3/render": "31.33.0",
78
+ "@ultimat3/schema": "31.33.0",
79
+ "@ultimat3/scraping": "31.33.0",
80
+ "@ultimat3/seo": "31.33.0",
81
+ "@ultimat3/storage": "31.33.0",
82
+ "@ultimat3/testing": "31.33.0",
83
+ "@ultimat3/time": "31.33.0",
84
84
  "babel-preset-solid": "^1.9.16"
85
85
  }
86
86
  }
@@ -1,8 +1,9 @@
1
- // `x g resource --admin` wires the override it wrote. The entity is already an admin screen — it
2
- // is in the handle `defineAdmin({ entities: adminEntitiesOf(db) })` reads — so the override file is
3
- // the ONLY thing `--admin` adds, and an override nothing lists under `resources:` is a dead file.
4
- // Performed here; where the admin is not a `defineAdmin({ … })` this can add to, the finding names
5
- // the two lines.
1
+ // `x g resource --admin` wires the override it wrote.
2
+ //
3
+ // The entity is already an admin screen — it is in the handle `defineAdmin({ entities:
4
+ // adminEntitiesOf(db) })` reads — so the override file is the ONLY thing `--admin` adds, and an
5
+ // override nothing lists under `resources:` is a dead file. Performed here; where the admin is not
6
+ // a `defineAdmin({ … })` this can add to, the finding names the two lines.
6
7
 
7
8
  import { ERROR_DOCS_URL, maskLiterals, stripComments } from '@ultimat3/core';
8
9
  import type { GenerateDisk } from './generate-disk';
package/src/affected.ts CHANGED
@@ -9,8 +9,9 @@
9
9
  // A ref diff is stable under that concurrency; `--dirty` opts back in, which is right for one
10
10
  // developer iterating alone and wrong as a default here.
11
11
 
12
- // `join`/`relative` are `node:`-only by necessity: Bun exposes no path primitive, and a workspace
13
- // directory is checkout-relative while a caller's scan yields paths relative to its own root.
12
+ // why: `join`/`relative` are `node:`-only by necessity: Bun exposes no path primitive, and a
13
+ // workspace directory is checkout-relative while a caller's scan yields paths relative to its own
14
+ // root.
14
15
  import { join, relative } from 'node:path';
15
16
  import { singleLine, UltimateError } from '@ultimat3/core';
16
17
  import { DEFAULT_BASE, defaultBase, fetchFixFor } from './affected-base';
@@ -1,8 +1,10 @@
1
- // Every generator hands the primitives it wrote to `apps/web/api/index.ts`. The scan registers
2
- // actions and queries by export name on its own and registers NO job: a job module nothing lists
3
- // keeps the positional `anonymous-job-2` that `job()` minted, on the queue row, in
4
- // `x.manifest.json` and in every dead-letter trace — under a green gate (plan 101 slice 11 b).
5
- // Actions and queries are listed for the TYPE: `Api` is what the browser's client is shaped from.
1
+ // Every generator hands the primitives it wrote to `apps/web/api/index.ts`.
2
+ //
3
+ // The scan registers actions and queries by export name on its own and registers NO job: a job
4
+ // module nothing lists keeps the positional `anonymous-job-2` that `job()` minted, on the queue
5
+ // row, in `x.manifest.json` and in every dead-letter trace — under a green gate (plan 101 slice 11
6
+ // b). Actions and queries are listed for the TYPE: `Api` is what the browser's client is shaped
7
+ // from.
6
8
 
7
9
  import { ERROR_DOCS_URL } from '@ultimat3/core';
8
10
  import { API_INDEX } from './app-root';
@@ -3,7 +3,7 @@
3
3
  // express — so the gate runs that package's own check rather than forming a second opinion about
4
4
  // what a context file has to be. Warnings never fail: they are judgement calls a human makes.
5
5
 
6
- // Bun ships no `Bun.*` path API: `join` builds the host-separator path the check reads.
6
+ // why: Bun ships no `Bun.*` path API: `join` builds the host-separator path the check reads.
7
7
  import { join } from 'node:path';
8
8
  import { AGENTS_MD_FILENAME, assertAgentsMd } from '@ultimat3/manifest';
9
9
  import type { Finding } from './output';
@@ -14,7 +14,7 @@
14
14
  // hands the files read here to `app-transport.ts`, so a raw `fetch(` in an island is a finding of
15
15
  // this step with no second walk of the app.
16
16
 
17
- // Bun ships no `Bun.*` path API: `joinPath` reaches a file on disk with the host's separator.
17
+ // why: Bun ships no `Bun.*` path API: `joinPath` reaches a file on disk with the host's separator.
18
18
  import { join as joinPath } from 'node:path';
19
19
  // The POSIX variants resolve specifiers against import-graph keys, which are POSIX on every host.
20
20
  import { dirname, join, normalize, relative } from 'node:path/posix';
@@ -50,13 +50,17 @@ export interface SourceFile {
50
50
  readonly source: string;
51
51
  }
52
52
 
53
- const CODE_OF: Readonly<Record<BoundaryRule, BoundaryCode>> = {
54
- 'site-imports-app': 'X_BOUNDARY_SITE_TO_APP',
55
- 'shared-is-a-leaf': 'X_BOUNDARY_SHARED_LEAF',
56
- 'app-imports-api-at-runtime': 'X_BOUNDARY_APP_TO_API',
57
- // Every other crossing `SURFACE_SPECS` does not allow: the table is the rule (`@ultimat3/render`).
58
- 'surface-imports-surface': 'X_BOUNDARY_SURFACE_IMPORT',
59
- };
53
+ // Null-prototype: a rule that is not one of these reads `undefined`, never an `Object` member.
54
+ const CODE_OF: Readonly<Record<BoundaryRule, BoundaryCode>> = Object.assign(
55
+ Object.create(null) as object,
56
+ {
57
+ 'site-imports-app': 'X_BOUNDARY_SITE_TO_APP',
58
+ 'shared-is-a-leaf': 'X_BOUNDARY_SHARED_LEAF',
59
+ 'app-imports-api-at-runtime': 'X_BOUNDARY_APP_TO_API',
60
+ // Every other crossing `SURFACE_SPECS` does not allow: the table is the rule (`@ultimat3/render`).
61
+ 'surface-imports-surface': 'X_BOUNDARY_SURFACE_IMPORT',
62
+ } satisfies Record<BoundaryRule, BoundaryCode>,
63
+ );
60
64
 
61
65
  /**
62
66
  * The one rule → diagnostic-code mapping. `x verify` reports a surface violation as a finding and
package/src/app-layout.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  // The one feature layout, made a build error: a primitive module `actions.ts` (or `live`,
2
- // `queries`, `jobs`, `tasks`) beside the directory of the same name is refused. `x g` writes the
3
- // directory form — `<slice>/actions/<name>.ts`, one primitive per file — and an app that also keeps
4
- // `actions.ts` has two homes for one kind of thing, where `./actions` resolves to the file and never
5
- // the directory. A component module beside its folder (`ui.tsx` + `ui/`) is not a primitive's home,
6
- // and `x g resource` writes exactly that pair.
2
+ // `queries`, `jobs`, `tasks`) beside the directory of the same name is refused.
3
+ //
4
+ // `x g` writes the directory form — `<slice>/actions/<name>.ts`, one primitive per file — and an
5
+ // app that also keeps `actions.ts` has two homes for one kind of thing, where `./actions` resolves
6
+ // to the file and never the directory. A component module beside its folder (`ui.tsx` + `ui/`) is
7
+ // not a primitive's home, and `x g resource` writes exactly that pair.
7
8
 
8
9
  import { ERROR_DOCS_URL } from '@ultimat3/core';
9
10
  import type { SourceFile } from './app-boundaries';
package/src/app-load.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // `registerQueries` / `registerRoute` name the rest — so `x manifest`, `x routes` and `x verify`
4
4
  // read exactly the tables the running server reads.
5
5
 
6
- // Bun ships no `Bun.*` path API: `join`/`resolve` reach the files a scan imports.
6
+ // why: Bun ships no `Bun.*` path API: `join`/`resolve` reach the files a scan imports.
7
7
  import { join, resolve } from 'node:path';
8
8
  import { listActions } from '@ultimat3/action';
9
9
  import { APP_CONFIG_FILE } from '@ultimat3/core';
@@ -3,7 +3,7 @@
3
3
  // table, which surface enforces each permission, the locales the app registered, and the error
4
4
  // codes its source declares.
5
5
 
6
- // Bun ships no `Bun.*` path API: `join` builds the host-separator path to `x.manifest.json`.
6
+ // why: Bun ships no `Bun.*` path API: `join` builds the host-separator path to `x.manifest.json`.
7
7
  import { join } from 'node:path';
8
8
  import { describeActions } from '@ultimat3/action';
9
9
  import { primitiveRegistrar } from '@ultimat3/core';
package/src/app-mcp.ts CHANGED
@@ -1,12 +1,14 @@
1
- // The app's own MCP endpoint, mounted by the web role. `defineAppMcp` built `mcp.route` — a
2
- // `POST` handler with token auth and per-class rate limits — and `app.config.ts` declared
3
- // `ai: { mcp: { expose: true } }` by DEFAULT, and nothing between the two served it:
4
- // neither `x dev` nor `runRole` mounted the route, so `POST /mcp` answered `X_ROUTE_NOT_FOUND` in
5
- // every app ever scaffolded (measured 2026-09-05). The contract is one file: `apps/<app>/mcp.ts`
6
- // exports `mcp` — one `AppMcp`, or an array of them, one per population (customers, staff,
7
- // affiliates) — this module finds it, and both boots mount what it carries: EVERY endpoint at its
8
- // own `defineAppMcp({ path })`, the one path its RFC 9728 metadata and its 401 also name — and
9
- // every app directory's file mounts, so an admin surface's `apps/admin/mcp.ts` stands beside the web one.
1
+ // The app's own MCP endpoint, mounted by the web role.
2
+ //
3
+ // `defineAppMcp` built `mcp.route` — a `POST` handler with token auth and per-class rate limits —
4
+ // and `app.config.ts` declared `ai: { mcp: { expose: true } }` by DEFAULT, and nothing between the
5
+ // two served it: neither `x dev` nor `runRole` mounted the route, so `POST /mcp` answered
6
+ // `X_ROUTE_NOT_FOUND` in every app ever scaffolded (measured 2026-09-05). The contract is one file:
7
+ // `apps/<app>/mcp.ts` exports `mcp` — one `AppMcp`, or an array of them, one per population
8
+ // (customers, staff, affiliates) — this module finds it, and both boots mount what it carries:
9
+ // EVERY endpoint at its own `defineAppMcp({ path })`, the one path its RFC 9728 metadata and its
10
+ // 401 also name — and every app directory's file mounts, so an admin surface's `apps/admin/mcp.ts`
11
+ // stands beside the web one.
10
12
 
11
13
  // why: a directory's existence — `Bun.file().exists()` answers for files, and `apps/` is a directory.
12
14
  import { existsSync } from 'node:fs';
@@ -1,9 +1,11 @@
1
1
  // `openapi.json`, projected from the two registries: the actions by `@ultimat3/action`'s
2
- // `buildOpenApi`, the queries by `@ultimat3/query`'s `queryOpenApiPaths`. The CLI merges the two
3
- // `paths` maps — those packages are one tier and cannot compose each other — writes the file and
4
- // compares the bytes; it does not know how an operation is shaped, which is why there is no third
5
- // OpenAPI builder to drift from the ones the packages serve. Until 2026-09 only the actions were
6
- // here, and every `GET /_x/query/<name>` the server mounted was a route the spec had never heard of.
2
+ // `buildOpenApi`, the queries by `@ultimat3/query`'s `queryOpenApiPaths`, merged and written.
3
+ //
4
+ // The CLI merges the two `paths` maps — those packages are one tier and cannot compose each other —
5
+ // writes the file and compares the bytes; it does not know how an operation is shaped, which is why
6
+ // there is no third OpenAPI builder to drift from the ones the packages serve. Until 2026-09 only
7
+ // the actions were here, and every `GET /_x/query/<name>` the server mounted was a route the spec
8
+ // had never heard of.
7
9
 
8
10
  // why: Bun ships no path-join primitive.
9
11
  import { join } from 'node:path';
@@ -1,10 +1,12 @@
1
- // Which modules a rescan must evaluate again, and making Bun do it. `import()` caches by path for
2
- // the life of the process, so a re-import sees the edited file only once that path has left Bun's
3
- // module registry (`delete require.cache[path]`, which Bun 1.4 honours for ES modules too). Until
4
- // 2026-09-27 `x dev` re-imported only the edited ROUTE module, under `?x-reload=<hash>`, and every
5
- // module that route imports resolved to the instance already cached: a save to a component, its
6
- // `.module.scss` or a helper logged "reloaded" and rendered the old code until a restart
7
- // (one adopter: the panel's balance card and the home page, observed twice on one day).
1
+ // Which modules a rescan must evaluate again, and making Bun do it.
2
+ //
3
+ // `import()` caches by path for the life of the process, so a re-import sees the edited file only
4
+ // once that path has left Bun's module registry (`delete require.cache[path]`, which Bun 1.4
5
+ // honours for ES modules too). Until 2026-09-27 `x dev` re-imported only the edited ROUTE module,
6
+ // under `?x-reload=<hash>`, and every module that route imports resolved to the instance already
7
+ // cached: a save to a component, its `.module.scss` or a helper logged "reloaded" and rendered the
8
+ // old code until a restart (one adopter: the panel's balance card and the home page, observed twice
9
+ // on one day).
8
10
  //
9
11
  // The rule is a reverse-dependency closure. A rescan hashes every file this graph knows; each
10
12
  // changed file, and every module that imports it transitively, leaves the registry, and the scan's
@@ -1,9 +1,12 @@
1
- // The app's `RuntimeOverrides`, found rather than handed over. `runRole({ runtime })` has taken
2
- // them since the seam existed, and the scaffolded `apps/web/server.ts` passes none — so an app's
3
- // own middleware reached no process the framework boots, and `x dev` had no parameter to reach at
4
- // all (measured 2026-09-05: `x dev` passed only the read-replica override). The contract is one
5
- // file: `apps/<app>/runtime.ts` exports `runtime`, a `RuntimeOverrides`; `x dev` reads it, and
6
- // `runRole` reads it when its caller passed nothing, so the two boots compose the same chain.
1
+ // The app's `RuntimeOverrides`, found rather than handed over: `apps/<app>/runtime.ts` exports
2
+ // `runtime`, read by `x dev` and by `runRole` when its caller passed nothing.
3
+ //
4
+ // `runRole({ runtime })` has taken them since the seam existed, and the scaffolded
5
+ // `apps/web/server.ts` passes none — so an app's own middleware reached no process the framework
6
+ // boots, and `x dev` had no parameter to reach at all (measured 2026-09-05: `x dev` passed only the
7
+ // read-replica override). The contract is one file: `apps/<app>/runtime.ts` exports `runtime`, a
8
+ // `RuntimeOverrides`; `x dev` reads it, and `runRole` reads it when its caller passed nothing, so
9
+ // the two boots compose the same chain.
7
10
 
8
11
  // why: a directory's existence — `Bun.file().exists()` answers for files, and `apps/` is a directory.
9
12
  import { existsSync } from 'node:fs';
@@ -1,8 +1,9 @@
1
- // A route whose `Page` is an `async` function and which declares no `load`. It renders — the
2
- // renderer awaits whatever the component returns — so no suite fails on it, and its data read
3
- // silently skips everything `load` is for: the route's cache, `meta` computed from the data, the
4
- // streaming boundary and the measurement render `x build` weighs. The social demo shipped eleven
5
- // (plan 101 slice 11 l); nothing asked.
1
+ // A route whose `Page` is an `async` function and which declares no `load`, refused.
2
+ //
3
+ // It renders — the renderer awaits whatever the component returns — so no suite fails on it, and
4
+ // its data read silently skips everything `load` is for: the route's cache, `meta` computed from
5
+ // the data, the streaming boundary and the measurement render `x build` weighs. The social demo
6
+ // shipped eleven (plan 101 slice 11 l); nothing asked.
6
7
 
7
8
  import type { RouteEntry } from '@ultimat3/render';
8
9
  import { routeEntries } from '@ultimat3/render';
@@ -1,9 +1,13 @@
1
- // Which browser `x shot` drives, and the raw-CDP driver over it (`cdp-shot-driver.ts`). No browser
2
- // library, in the app or here: Chrome is launched on its debugging pipe by `@ultimat3/testing`'s
3
- // launcher — the one `x verify`'s e2e step already runs on — or ATTACHED to over `--cdp-url`,
4
- // which is what every stealth provider sells. Until 22.0.0 this resolved the APP's `puppeteer-core`,
5
- // so `x shot` needed an install the framework could not make, and two launchers drifted.
1
+ // Which browser `x shot` drives, and the raw-CDP driver over it (`cdp-shot-driver.ts`).
2
+ //
3
+ // No browser library, in the app or here: Chrome is launched on its debugging pipe by
4
+ // `@ultimat3/testing`'s launcher — the one `x verify`'s e2e step already runs on — or ATTACHED to
5
+ // over `--cdp-url`, which is what every stealth provider sells. Until 22.0.0 this resolved the
6
+ // APP's `puppeteer-core`, so `x shot` needed an install the framework could not make, and two
7
+ // launchers drifted.
6
8
 
9
+ // why: `browserBinaryExists` is a synchronous predicate, and Bun's only existence check,
10
+ // `Bun.file().exists()`, is async.
7
11
  import { existsSync } from 'node:fs';
8
12
  import { UltimateError } from '@ultimat3/core';
9
13
  import { CHROME_CANDIDATES } from '@ultimat3/scraping/cdp';
@@ -1,8 +1,11 @@
1
- // The browser has ONE HTTP function and ONE socket, as a rule over a file tree: a raw `fetch(`,
2
- // `new WebSocket(`, `new XMLHttpRequest(` or `new EventSource(` in browser-reachable code skips
3
- // `@ultimat3/core`'s `clientTransport` — credentials, the idempotency header, the record envelope,
4
- // the principal fence — so its rows never reach the page's store and it keeps running for the
5
- // previous principal after a sign-out. A package's SERVER BARREL in that closure is refused too.
1
+ // The browser has ONE HTTP function and ONE socket, as a rule over a file tree: a raw transport
2
+ // or a package's SERVER BARREL in browser-reachable code is refused.
3
+ //
4
+ // A raw `fetch(`, `new WebSocket(`, `new XMLHttpRequest(` or `new EventSource(` in
5
+ // browser-reachable code skips `@ultimat3/core`'s `clientTransport` — credentials, the idempotency
6
+ // header, the record envelope, the principal fence — so its rows never reach the page's store and
7
+ // it keeps running for the previous principal after a sign-out. A package's SERVER BARREL in that
8
+ // closure is refused too.
6
9
  //
7
10
  // BROWSER-REACHABLE is derived, never listed: every `*.island.tsx`, every module that names the
8
11
  // client seam itself, and the import closure of each, followed name by name through barrels
package/src/budgets.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  // routes are declared in. The one thing that lives here is the comparison against MEASURED bytes:
7
7
  // render checks a bundle graph, this checks what the build actually emitted.
8
8
 
9
- import { existsSync } from 'node:fs';
9
+ // why: Bun ships no path API; `join` builds the host-separator path to the build-stats file.
10
10
  import { join } from 'node:path';
11
11
  import { ERROR_DOCS_URL, formatBytes } from '@ultimat3/core';
12
12
  import type { Manifest, RouteFact } from '@ultimat3/manifest';
@@ -236,8 +236,9 @@ export function checkBudgets(
236
236
 
237
237
  export async function readBuildStats(root: string): Promise<BuildStats | undefined> {
238
238
  const path = join(root, BUILD_STATS_FILE);
239
- if (!existsSync(path)) return undefined;
240
- const read = (await Bun.file(path).json()) as BuildStats;
239
+ const file = Bun.file(path);
240
+ if (!(await file.exists())) return undefined;
241
+ const read = (await file.json()) as BuildStats;
241
242
  // A file the current rules did not write carries no numbers this gate may read.
242
243
  return read.measuredBy === BUILD_STATS_RULES ? read : { routes: [], stale: true };
243
244
  }
@@ -3,6 +3,7 @@
3
3
  // else runs over `--cdp-url`. One `open()` is one browser and one page, so a picture's console and
4
4
  // network are its own. The page is `cdp-shot-page.ts`; this file is the session around it.
5
5
 
6
+ import { renderThrowable } from '@ultimat3/core';
6
7
  import type { CdpConnection, LaunchedBrowser } from '@ultimat3/scraping/cdp';
7
8
  import {
8
9
  CdpBrowserMissingError,
@@ -31,7 +32,7 @@ export interface CdpShotDriverOptions {
31
32
  | ((executable: string, timeoutMs: number) => Promise<LaunchedBrowser>)
32
33
  | undefined;
33
34
  readonly connect?: ((endpoint: string, timeoutMs: number) => Promise<CdpConnection>) | undefined;
34
- readonly fetchJson?: ((url: string) => Promise<unknown>) | undefined;
35
+ readonly fetchJson?: ((url: string, timeoutMs: number) => Promise<unknown>) | undefined;
35
36
  }
36
37
 
37
38
  const field = (value: unknown, key: string): string | undefined => {
@@ -46,11 +47,12 @@ const field = (value: unknown, key: string): string | undefined => {
46
47
  */
47
48
  async function socketUrl(
48
49
  cdpUrl: string,
49
- fetchJson: (url: string) => Promise<unknown>,
50
+ timeoutMs: number,
51
+ fetchJson: (url: string, timeoutMs: number) => Promise<unknown>,
50
52
  ): Promise<string> {
51
53
  if (cdpUrl.startsWith('ws://') || cdpUrl.startsWith('wss://')) return cdpUrl;
52
54
  const version = new URL('/json/version', cdpUrl).toString();
53
- const socket = field(await fetchJson(version), 'webSocketDebuggerUrl');
55
+ const socket = field(await fetchJson(version, timeoutMs), 'webSocketDebuggerUrl');
54
56
  if (socket === undefined) {
55
57
  throw new CdpCallFailedError({
56
58
  method: `GET ${version}`,
@@ -60,7 +62,17 @@ async function socketUrl(
60
62
  return socket;
61
63
  }
62
64
 
63
- const defaultFetchJson = async (url: string): Promise<unknown> => (await fetch(url)).json();
65
+ /**
66
+ * Under the session's own deadline: a sidecar that accepts the socket and never answers held
67
+ * `x shot` for as long as it liked, because nothing else bounds this one request.
68
+ */
69
+ const defaultFetchJson = async (url: string, timeoutMs: number): Promise<unknown> => {
70
+ try {
71
+ return await (await fetch(url, { signal: AbortSignal.timeout(timeoutMs) })).json();
72
+ } catch (error) {
73
+ throw new CdpCallFailedError({ method: `GET ${url}`, detail: renderThrowable(error) });
74
+ }
75
+ };
64
76
 
65
77
  export function cdpShotDriver(options: CdpShotDriverOptions): ShotDriver {
66
78
  const viewport = options.viewport ?? DEFAULT_SHOT_VIEWPORT;
@@ -76,7 +88,11 @@ export function cdpShotDriver(options: CdpShotDriverOptions): ShotDriver {
76
88
  timeoutMs: number,
77
89
  ): Promise<{ connection: CdpConnection; end: () => Promise<void> }> => {
78
90
  if (options.cdpUrl !== undefined) {
79
- const endpoint = await socketUrl(options.cdpUrl, options.fetchJson ?? defaultFetchJson);
91
+ const endpoint = await socketUrl(
92
+ options.cdpUrl,
93
+ timeoutMs,
94
+ options.fetchJson ?? defaultFetchJson,
95
+ );
80
96
  const connection = await connect(endpoint, timeoutMs);
81
97
  return {
82
98
  connection,
@@ -1,8 +1,10 @@
1
- // The four ways `x shot`'s raw-CDP page refuses a verb. A browser that is
2
- // missing, dies or never answers is `@ultimat3/testing`'s `X_CDP_*` — the wire is the same one the
3
- // e2e driver runs on. These four are what only a shot can be wrong about: which host it may open,
4
- // which element it was pointed at, and which key it was asked to press. Their codes and titles are
5
- // registered with every other CLI code, in `error-codes.ts` — never a second registration here.
1
+ // The four ways `x shot`'s raw-CDP page refuses a verb.
2
+ //
3
+ // A browser that is missing, dies or never answers is `@ultimat3/testing`'s `X_CDP_*` — the wire is
4
+ // the same one the e2e driver runs on. These four are what only a shot can be wrong about: which
5
+ // host it may open, which element it was pointed at, and which key it was asked to press. Their
6
+ // codes and titles are registered with every other CLI code, in `error-codes.ts` — never a second
7
+ // registration here.
6
8
  import { renderCauseValue, UltimateError } from '@ultimat3/core';
7
9
 
8
10
  /** A navigation to a host the run did not allow. Refused before a byte leaves. */
@@ -1,8 +1,9 @@
1
- // One `ShotPage` over one attached CDP session: navigate, read, act, photograph. The session is
2
- // the driver's (`cdp-shot-driver.ts`), the rings and the allow list are `cdp-shot-watch.ts`'s, and
3
- // what "ready to act on" means is `cdp-shot-element.ts`'s. Acts are real input — a click is a
4
- // mouse press at the element's centre, a keystroke is a key event — because an in-page `.click()`
5
- // skips `pointerdown`, which is what a dialog's backdrop listens to.
1
+ // One `ShotPage` over one attached CDP session: navigate, read, act, photograph.
2
+ //
3
+ // The session is the driver's (`cdp-shot-driver.ts`), the rings and the allow list are
4
+ // `cdp-shot-watch.ts`'s, and what "ready to act on" means is `cdp-shot-element.ts`'s. Acts are real
5
+ // input — a click is a mouse press at the element's centre, a keystroke is a key event — because an
6
+ // in-page `.click()` skips `pointerdown`, which is what a dialog's backdrop listens to.
6
7
  import { assert, finiteCount, hostDecision } from '@ultimat3/core';
7
8
  import type { CdpConnection } from '@ultimat3/scraping/cdp';
8
9
  import { CdpCallFailedError, CdpTimeoutError } from '@ultimat3/scraping/cdp';
@@ -1,8 +1,10 @@
1
- // What one shot page saw: its console, its uncaught exceptions and its requests, each in a BOUNDED
2
- // tail with a count of what the bound threw away. And the allow list, enforced in the browser:
3
- // every request is paused (`Fetch.requestPaused`) and refused unless its host is allowed, so an
4
- // injected `<img src="http://169.254.169.254/…">` never leaves — it is recorded as `refused`.
5
- // Paused at the BROWSER too, so a popup the page opens is decided by the same `hostDecision`.
1
+ // What one shot page saw — its console, uncaught exceptions and requests, each in a BOUNDED
2
+ // tail — and the host allow list, enforced in the browser on every paused request.
3
+ //
4
+ // Each tail carries a count of what the bound threw away. Every request is paused
5
+ // (`Fetch.requestPaused`) and refused unless its host is allowed, so an injected
6
+ // `<img src="http://169.254.169.254/…">` never leaves — it is recorded as `refused`. Paused at the
7
+ // BROWSER too, so a popup the page opens is decided by the same `hostDecision`.
6
8
 
7
9
  import type { SleepClock } from '@ultimat3/core';
8
10
  import { hostDecision } from '@ultimat3/core';
package/src/ci-log.ts CHANGED
@@ -1,8 +1,9 @@
1
- // A GitHub Actions log, read back into the findings that produced it. `gh run view --log-failed`
2
- // prints `<job>\t<step>\t<timestamp> <text>` with a BOM, ANSI colour and `##[group]` markers in
3
- // it — and underneath all of that, for a `verify` job, is `renderFinding`'s own three lines. So
4
- // this file undoes the transport and reconstructs the `Finding`, rather than printing a wall of
5
- // text and asking the reader to spot the code in it.
1
+ // A GitHub Actions log, read back into the findings that produced it.
2
+ //
3
+ // `gh run view --log-failed` prints `<job>\t<step>\t<timestamp> <text>` with a BOM, ANSI colour and
4
+ // `##[group]` markers in it — and underneath all of that, for a `verify` job, is `renderFinding`'s
5
+ // own three lines. So this file undoes the transport and reconstructs the `Finding`, rather than
6
+ // printing a wall of text and asking the reader to spot the code in it.
6
7
 
7
8
  import type { Finding, JsonValue } from './output';
8
9
 
package/src/ci-runs.ts CHANGED
@@ -6,6 +6,7 @@ import { t } from '@ultimat3/schema';
6
6
  import type { GhHost } from './gh';
7
7
  import { ghJson, runGh } from './gh';
8
8
  import type { GhRepo } from './gh-target';
9
+ import { quoteArg } from './shell-quote';
9
10
 
10
11
  /** The fields both `gh run list` and `gh run view` accept, named once so the two agree. */
11
12
  export const RUN_FIELDS =
@@ -162,7 +163,7 @@ export async function listRuns(
162
163
  RUN_LIST,
163
164
  {
164
165
  label: `gh run list --branch ${branch}`,
165
- fix: `x ci --branch ${branch} --repo ${repo.slug} --json`,
166
+ fix: `x ci --branch ${quoteArg(branch)} --repo ${quoteArg(repo.slug)} --json`,
166
167
  },
167
168
  );
168
169
  return rows.map(runOf);
@@ -178,7 +179,10 @@ export async function viewRun(
178
179
  host,
179
180
  ['run', 'view', String(id), '--repo', repo.slug, '--json', `${RUN_FIELDS},jobs`],
180
181
  RUN_VIEW,
181
- { label: `gh run view ${id}`, fix: `x ci --run ${id} --repo ${repo.slug} --json` },
182
+ {
183
+ label: `gh run view ${id}`,
184
+ fix: `x ci --run ${quoteArg(String(id))} --repo ${quoteArg(repo.slug)} --json`,
185
+ },
182
186
  );
183
187
  const jobs = viewed.jobs.map((job) => ({
184
188
  ...job,
@@ -199,7 +203,7 @@ export async function failedLog(host: GhHost, repo: GhRepo, id: number): Promise
199
203
  ['run', 'view', String(id), '--repo', repo.slug, '--log-failed'],
200
204
  {
201
205
  label: `gh run view ${id} --log-failed`,
202
- fix: `gh run view ${id} --repo ${repo.slug} --log # the whole log, when the failed steps carry none`,
206
+ fix: `gh run view ${quoteArg(String(id))} --repo ${quoteArg(repo.slug)} --log # the whole log, when the failed steps carry none`,
203
207
  },
204
208
  );
205
209
  return result.stdout;
package/src/cmd-auth.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  // `x auth seal-mfa` — seal every `x_users.mfa_secret` still stored in the clear, in place, under
2
- // the app's master key. The one-shot an upgrade onto sealed second-factor secrets owes: readers
3
- // refuse a plaintext value (`X_MFA_SECRET_UNSEALED`), and this is the command that refusal names.
4
- // Idempotent — a sealed value is counted and left alone — so an interrupted run is finished by
5
- // running it again.
2
+ // the app's master key.
3
+ //
4
+ // The one-shot an upgrade onto sealed second-factor secrets owes: readers refuse a plaintext value
5
+ // (`X_MFA_SECRET_UNSEALED`), and this is the command that refusal names. Idempotent — a sealed
6
+ // value is counted and left alone — so an interrupted run is finished by running it again.
6
7
 
7
8
  import type { MfaSecretStore } from '@ultimat3/auth';
8
9
  import { postgresAuthAdapter, sealMfaSecrets } from '@ultimat3/auth';
package/src/cmd-build.ts CHANGED
@@ -2,6 +2,8 @@
2
2
  // "anywhere that runs a container or a binary"; nothing here knows the name of a cloud. `prebuilt`
3
3
  // is the docker target's other half: the line the Dockerfile runs INSIDE the image build.
4
4
 
5
+ // why: `requireEntry` is synchronous and Bun's `Bun.file().exists()` is async; Bun ships no
6
+ // path API, and `join`/`resolve` build the entry and `--out` paths.
5
7
  import { existsSync } from 'node:fs';
6
8
  import { join, resolve } from 'node:path';
7
9
  import { ERROR_DOCS_URL, frameworkVersion, UltimateError, VERSION_DEFINE } from '@ultimat3/core';
@@ -69,13 +71,17 @@ export function readTarget(raw: string | undefined): BuildTarget {
69
71
  * has to refuse a missing entry by name before it spawns anything, and the spawned command has to
70
72
  * name the same file — a second copy is how `binary` came to compile a path `x new` never wrote.
71
73
  */
72
- export const BUILD_ENTRY: Readonly<Record<BuildTarget, string>> = {
73
- docker: 'docker/Dockerfile',
74
- binary: 'apps/web/server.ts',
75
- static: 'apps/web/prerender.ts',
76
- // What boots from the store: an image with no server entry has nothing to prebuild for.
77
- prebuilt: 'apps/web/server.ts',
78
- };
74
+ // Null-prototype: a target that is not one of these reads `undefined`, never an `Object` member.
75
+ export const BUILD_ENTRY: Readonly<Record<BuildTarget, string>> = Object.assign(
76
+ Object.create(null) as object,
77
+ {
78
+ docker: 'docker/Dockerfile',
79
+ binary: 'apps/web/server.ts',
80
+ static: 'apps/web/prerender.ts',
81
+ // What boots from the store: an image with no server entry has nothing to prebuild for.
82
+ prebuilt: 'apps/web/server.ts',
83
+ } satisfies Record<BuildTarget, string>,
84
+ );
79
85
 
80
86
  /** Absolute path of the target's entry, or the error that names the file and what writes it. */
81
87
  export function requireEntry(root: string, target: BuildTarget): string {