@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
@@ -1,8 +1,9 @@
1
- // The island chunk table: every `*.island.tsx` in the app compiled as a bundle entry point,
2
- // named by a hash of its final BYTES (`island-link.ts`; why not its sources: `island-identity.ts`),
3
- // plus the resolver that turns a page's `src` specifier into the URL its
4
- // `data-x-entry` carries. The page's graph never reaches an island, so a `site/` document stays at
5
- // 0kb whatever the island imports — axiom 6 made mechanical.
1
+ // The island chunk table: every `*.island.tsx` compiled as a bundle entry point named by a hash
2
+ // of its final BYTES, plus the resolver from a page's `src` specifier to its URL.
3
+ //
4
+ // The hash is `island-link.ts`'s (why not its sources: `island-identity.ts`), and the URL is the
5
+ // one `data-x-entry` carries. The page's graph never reaches an island, so a `site/` document stays
6
+ // at 0kb whatever the island imports — axiom 6 made mechanical.
6
7
  //
7
8
  // Islands every route renders together are ONE split build, sharing what they import as chunks;
8
9
  // every other island is built alone (`island-groups.ts` has the rule and the measurement).
@@ -17,7 +18,7 @@
17
18
  // `@ultimat3/realtime` (`island-realtime.ts`); the page runtime it awaits is ONE more output,
18
19
  // `page-runtime.<identity>.js` beside the entries (`island-runtime.ts`), never inlined into one (#505).
19
20
 
20
- // Bun ships no path API. `posix` does the specifier arithmetic (an app-relative route file is
21
+ // why: Bun ships no path API. `posix` does the specifier arithmetic (an app-relative route file is
21
22
  // POSIX by construction), `join`/`basename` the filesystem side.
22
23
  import { join, posix, relative, sep } from 'node:path';
23
24
  import type { IslandsConfig } from '@ultimat3/core';
@@ -7,6 +7,7 @@
7
7
  import { readdir } from 'node:fs/promises';
8
8
  // why: Bun ships no path API; the bundler names its inputs relative to the building process's cwd.
9
9
  import { basename, dirname, join, resolve } from 'node:path';
10
+ import { trimTrailingSlashes } from '@ultimat3/core';
10
11
  import { contentHash } from '@ultimat3/render/server';
11
12
  import { hasPathSegment } from './path-segments';
12
13
 
@@ -122,7 +123,7 @@ export async function environmentDigest(root: string): Promise<string> {
122
123
  const manifest = Bun.file(join(dir, 'package.json'));
123
124
  if (!(await manifest.exists())) continue;
124
125
  for (const pattern of workspaceGlobs(await manifest.text())) {
125
- const glob = new Bun.Glob(`${pattern.replace(/\/+$/, '')}/package.json`);
126
+ const glob = new Bun.Glob(`${trimTrailingSlashes(pattern)}/package.json`);
126
127
  for await (const one of glob.scan({ cwd: dir })) {
127
128
  if (!hasPathSegment(one, 'node_modules')) members.add(dirname(join(dir, one)));
128
129
  }
@@ -14,6 +14,7 @@ import { readinessProbe } from './island-harness-script';
14
14
  import { IslandRequestUnstubbedError, IslandUnphotographableError } from './island-shot-errors';
15
15
  import type { IslandReadiness, IslandStateShot } from './island-verdict';
16
16
  import { parseReadiness } from './island-verdict';
17
+ import { quoteArg } from './shell-quote';
17
18
  import { type ShotCookiePair, shotCookies } from './shot-cookie';
18
19
  import type { ShotServer } from './shot-server';
19
20
  import { allowHostsFrom } from './shot-server';
@@ -71,11 +72,11 @@ export function photographFault(
71
72
  target: IslandShotTarget,
72
73
  seen: IslandReadiness | null,
73
74
  ): Refusal | undefined {
74
- const settle = `x shot --island ${target.name} --settle 8000 --json`;
75
+ const settle = `x shot --island ${quoteArg(target.name)} --settle 8000 --json`;
75
76
  if (seen === null) {
76
77
  return {
77
78
  reason: 'answered no readiness probe at all, so nothing about the page can be asserted',
78
- fix: `x shot --island ${target.name} --state ${target.state} --timeout 60000 --json`,
79
+ fix: `x shot --island ${quoteArg(target.name)} --state ${quoteArg(target.state)} --timeout 60000 --json`,
79
80
  };
80
81
  }
81
82
  if (!seen.harness) {
@@ -91,7 +92,7 @@ export function photographFault(
91
92
  if (seen.failed !== null) {
92
93
  return {
93
94
  reason: `mounted and its mount() REJECTED: ${seen.failed}`,
94
- fix: `x shot --island ${target.name} --state ${target.state} --json # the verdict carries the throw and its frame`,
95
+ fix: `x shot --island ${quoteArg(target.name)} --state ${quoteArg(target.state)} --json # the verdict carries the throw and its frame`,
95
96
  };
96
97
  }
97
98
  if (!seen.mounted) {
@@ -265,7 +266,7 @@ export async function captureIslandState(
265
266
  state: target.state,
266
267
  theme: target.theme,
267
268
  reason: `produced ${bytes.byteLength} bytes, under the ${floor}-byte floor — that is not an image`,
268
- fix: `x shot --island ${target.name} --browser /usr/bin/chromium --json # macOS: --browser "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; Windows: --browser "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"`,
269
+ fix: `x shot --island ${quoteArg(target.name)} --browser /usr/bin/chromium --json # macOS: --browser "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; Windows: --browser "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"`,
269
270
  });
270
271
  }
271
272
  await Bun.write(join(options.outDir, target.file), bytes);
@@ -1,8 +1,9 @@
1
- // Which realtime islands have page state to RESTORE, and which only follow the socket. A held
2
- // island (#506, `@ultimat3/render`'s `island-hold.ts`) is hidden until it mounts because its server
3
- // markup can be older than the record store and the outbox the page boot restores. An island whose
4
- // whole realtime use is a channel's events, a roster or the connection reads neither: its server
5
- // markup is as current as any other island's, so hiding it only delayed the page's content.
1
+ // Which realtime islands have page state to RESTORE, and which only follow the socket.
2
+ //
3
+ // A held island (#506, `@ultimat3/render`'s `island-hold.ts`) is hidden until it mounts because its
4
+ // server markup can be older than the record store and the outbox the page boot restores. An island
5
+ // whose whole realtime use is a channel's events, a roster or the connection reads neither: its
6
+ // server markup is as current as any other island's, so hiding it only delayed the page's content.
6
7
 
7
8
  import { registeredEntities } from '@ultimat3/entity';
8
9
  import { firstInGraph } from './live-routes';
@@ -1,9 +1,11 @@
1
- // Realtime installed for the author, on exactly the islands that use it: an island whose own import
2
- // graph reaches `@ultimat3/realtime` is built from a virtual entry that first awaits the page
3
- // runtime (`island-runtime.ts`), then calls `installRealtime({ signal, cleanup })` with THIS
4
- // bundle's solid-js, then re-exports the island whole. Every other island pays nothing. An island
5
- // that reads the record store or the outbox also waits for the page's restore before it mounts
6
- // (#506); one that only follows the socket does not (`island-realtime-state.ts`).
1
+ // Realtime installed for the author, on exactly the islands that use it: each is built from a
2
+ // virtual entry that awaits the page runtime, installs realtime, then re-exports the island.
3
+ //
4
+ // An island qualifies when its own import graph reaches `@ultimat3/realtime`; its entry first
5
+ // awaits the page runtime (`island-runtime.ts`), then calls `installRealtime({ signal, cleanup })`
6
+ // with THIS bundle's solid-js, then re-exports the island whole. Every other island pays nothing.
7
+ // An island that reads the record store or the outbox also waits for the page's restore before it
8
+ // mounts (#506); one that only follows the socket does not (`island-realtime-state.ts`).
7
9
 
8
10
  // why: Bun ships no path API; the entry is joined to the root, the runtime named by its basename,
9
11
  // core's transport found beside the core module importing it.
@@ -3,6 +3,7 @@
3
3
  // call stay in `error-codes.ts`: one owner, one registration, one place a duplicate can surface.
4
4
 
5
5
  import { renderCauseValue, renderFixLiteral, UltimateError } from '@ultimat3/core';
6
+ import { quoteArg } from './shell-quote';
6
7
 
7
8
  // No `docs:` on the subclasses below. `UltimateError` fills it from `describeErrorCode(code).docs`.
8
9
 
@@ -87,7 +88,7 @@ export class IslandShotsMissingError extends UltimateError {
87
88
  super({
88
89
  code: 'X_SHOT_ISLAND_MISSING',
89
90
  cause: `${input.missing.length} of ${input.expected} declared picture(s) are not on disk under ${renderCauseValue(input.dir)}: ${input.missing.join(', ')}`,
90
- fix: `x shot --island ${input.island} --json # the run above names why each one was refused`,
91
+ fix: `x shot --island ${quoteArg(input.island)} --json # the run above names why each one was refused`,
91
92
  meta: { island: input.island, missing: [...input.missing] },
92
93
  });
93
94
  }
@@ -1,8 +1,9 @@
1
- // `x shot --island` — the RUN: which islands, in which order, and which artifacts land. One
2
- // picture at a time is `island-capture.ts`; the order here is the whole design, because the
3
- // complete expected picture list is computed from the states files BEFORE a browser exists and
4
- // what landed on disk is diffed against that list afterwards, so "produced nothing and exited 0"
5
- // is a state this command can refuse.
1
+ // `x shot --island` — the RUN: which islands, in which order, and which artifacts land.
2
+ //
3
+ // One picture at a time is `island-capture.ts`; the order here is the whole design, because the
4
+ // complete expected picture list is computed from the states files BEFORE a browser exists and what
5
+ // landed on disk is diffed against that list afterwards, so "produced nothing and exited 0" is a
6
+ // state this command can refuse.
6
7
  //
7
8
  // A sweep never aborts on a failure: every state the app CAN photograph is captured, every verdict
8
9
  // and the index are written, and only then does the missing-picture gate turn the reasons into a
@@ -1,8 +1,11 @@
1
- // One cause, one finding. A module that will not import leaves every registry half-filled, and each
2
- // step that loaded the app reported what half a registry looks like — a permission typo read as 9
3
- // findings across 7 steps (plan 101 19a FX8). The `manifest` step owns the load's findings: it runs
4
- // in every repo, and "does the projection describe the code?" is the question a broken module
5
- // answers first. Every other step that loads the app stands down while the load is red.
1
+ // One cause, one finding: the `manifest` step owns an app load's findings, and every other step
2
+ // that loads the app stands down while the load is red.
3
+ //
4
+ // A module that will not import leaves every registry half-filled, and each step that loaded the
5
+ // app reported what half a registry looks like — a permission typo read as 9 findings across 7
6
+ // steps (plan 101 19a FX8). The `manifest` step owns the load's findings: it runs in every repo,
7
+ // and "does the projection describe the code?" is the question a broken module answers first. Every
8
+ // other step that loads the app stands down while the load is red.
6
9
 
7
10
  import { loadApp } from './app-load';
8
11
  import { msg } from './messages';
package/src/local-cli.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  // A globally installed `x` defers to the app's own `@ultimat3/cli` when the two are different
2
- // files. Measured 2026-09-05 in an app whose global `x` was a `bun link` of this checkout: the
3
- // global CLI's `@ultimat3/entity` was a second module instance with an EMPTY registry, so `x g`,
4
- // `x db gen` and `x manifest` wrote a manifest with zero entities and proposed dropping every
5
- // table — silently, with a green exit code. The app's entities register into the instance under
6
- // its `node_modules`; only the CLI under that same `node_modules` can see them. So the rule is the
7
- // one `tsc` and `eslint` follow: the project-local binary wins, and the global one only says so.
2
+ // files.
3
+ //
4
+ // Measured 2026-09-05 in an app whose global `x` was a `bun link` of this checkout: the global
5
+ // CLI's `@ultimat3/entity` was a second module instance with an EMPTY registry, so `x g`,
6
+ // `x db gen` and `x manifest` wrote a manifest with zero entities and proposed dropping every table
7
+ // — silently, with a green exit code. The app's entities register into the instance under its
8
+ // `node_modules`; only the CLI under that same `node_modules` can see them. So the rule is the one
9
+ // `tsc` and `eslint` follow: the project-local binary wins, and the global one only says so.
8
10
  //
9
11
  // The same registry split is what turned `x verify` green over that app: `@ultimat3/policy`'s
10
12
  // `isKnownPermission` deliberately checks nothing while no permission is declared, and the global
@@ -3,8 +3,8 @@
3
3
  // wrong `branch` is a migration against a database somebody else is using, and a `production` that
4
4
  // is always false is a refusal that never runs.
5
5
 
6
- // `node:path` for the joiner Bun has no equivalent of — the same reason `db-branch.ts` reaches for
7
- // it, and the state directory it builds a path under is a real one on disk.
6
+ // why: `node:path` for the joiner Bun has no equivalent of — the same reason `db-branch.ts` reaches
7
+ // for it, and the state directory it builds a path under is a real one on disk.
8
8
  import { join } from 'node:path';
9
9
  import { tryResolveEnvironment } from '@ultimat3/core';
10
10
  import { pgliteDataDir } from '@ultimat3/db';
package/src/mcp-errors.ts CHANGED
@@ -475,7 +475,9 @@ export function explainErrorCode(code: string): ErrorExplanation | undefined {
475
475
  return {
476
476
  code,
477
477
  cause: described.title,
478
- fix: cli ? CLI_FIXES[code] : projectedFix(code),
478
+ // `Object.hasOwn`, not `isCliCode` alone: the code is an MCP caller's, and the guard above is a
479
+ // list the table could drift from — `constructor` must never answer `Object`'s function here.
480
+ fix: cli && Object.hasOwn(CLI_FIXES, code) ? CLI_FIXES[code] : projectedFix(code),
479
481
  docs: described.docs,
480
482
  };
481
483
  }
@@ -1,8 +1,11 @@
1
- // `ui.diff` — the one `ui.*` tool with no browser in it. Two PNGs the others wrote, decoded through
2
- // `@ultimat3/core`'s raw-pixel seam, compared by `ui-diff.ts`, and written back as a third PNG
3
- // beside the second. No dependency: the seam already reads and writes 8-bit RGBA, and a capture
4
- // that arrives in another PNG shape (Chrome writes RGB when a page has no transparency) is
5
- // normalised through `transformImageBytes`, whose encoder emits the one shape the seam reads.
1
+ // `ui.diff` — the one `ui.*` tool with no browser in it: two captured PNGs compared, the
2
+ // difference written back as a third.
3
+ //
4
+ // Two PNGs the others wrote, decoded through `@ultimat3/core`'s raw-pixel seam, compared by
5
+ // `ui-diff.ts`, and written back as a third PNG beside the second. No dependency: the seam already
6
+ // reads and writes 8-bit RGBA, and a capture that arrives in another PNG shape (Chrome writes RGB
7
+ // when a page has no transparency) is normalised through `transformImageBytes`, whose encoder emits
8
+ // the one shape the seam reads.
6
9
  //
7
10
  // The path gate is what makes `dev:read` defensible for a tool that opens files: `before`, `after`
8
11
  // and `out` are relative to the app root and must resolve — lexically AND through any symlink —
@@ -1,11 +1,13 @@
1
- // `ui.inspect` — the dev MCP server's third eye, and the one that reads instead of looking. A
2
- // browser is the cost of every `ui.*` call, so this one reads MANY facts per navigation: for each
1
+ // `ui.inspect` — the dev MCP server's third eye, the one that reads instead of looking: many
2
+ // DOM facts per navigation, as `runShot` with an `act` hook.
3
+ //
4
+ // A browser is the cost of every `ui.*` call, so this one reads MANY facts per navigation: for each
3
5
  // selector the tag, text, box, visibility, attributes, named computed styles and (on request) the
4
6
  // browser-computed role and name; for the document its title, `data-theme`, the focused element,
5
- // the island count and both error streams. It is `runShot` with an `act` hook — the same boot,
6
- // the same driver, the same verdict, the same PNG under an `inspect/` subdirectory — so `ok` here
7
- // means exactly what `ui.shot`'s `ok` means, and a page that threw while an agent was reading
8
- // its styles is a finding beside the styles.
7
+ // the island count and both error streams. It is `runShot` with an `act` hook — the same boot, the
8
+ // same driver, the same verdict, the same PNG under an `inspect/` subdirectory — so `ok` here means
9
+ // exactly what `ui.shot`'s `ok` means, and a page that threw while an agent was reading its styles
10
+ // is a finding beside the styles.
9
11
 
10
12
  // why: Bun exposes no path-join primitive, and the directory is a path an agent opens.
11
13
  import { join } from 'node:path';
@@ -1,9 +1,12 @@
1
- // `ui.interact` — the dev MCP server's hand. The three `ui.*` eyes photograph a route as it loads;
2
- // this one drives it first — opens the ⌘K palette, raises a dialog, types into a field — and
3
- // then takes the same picture, the same verdict and (on request) `ui.inspect`'s facts, in ONE
4
- // navigation. It is `runShot` with an `act` hook whose body is the step list: after EVERY step the
5
- // island poll re-runs (a click that mounts something changes the count the verdict reports) and
6
- // one poll interval passes for the CSS transition the click started.
1
+ // `ui.interact` — the dev MCP server's hand: drive a route through a step list, then take the
2
+ // same picture and verdict as the eyes, in ONE navigation.
3
+ //
4
+ // The three `ui.*` eyes photograph a route as it loads; this one drives it first — opens the ⌘K
5
+ // palette, raises a dialog, types into a field — and then takes the same picture, the same verdict
6
+ // and (on request) `ui.inspect`'s facts, in ONE navigation. It is `runShot` with an `act` hook
7
+ // whose body is the step list: after EVERY step the island poll re-runs (a click that mounts
8
+ // something changes the count the verdict reports) and one poll interval passes for the CSS
9
+ // transition the click started.
7
10
  //
8
11
  // Four refusals, and every one refuses WHOLE rather than trims, skips or follows: a dropped step,
9
12
  // a swallowed keystroke or a navigation quietly followed changes what the picture is of, and an
package/src/mcp-ui.ts CHANGED
@@ -1,12 +1,14 @@
1
- // The dev MCP server's eyes and hand: `ui.shot` (a route), `ui.island` (a component's states),
2
- // `ui.inspect` (DOM facts for a set of selectors, in `mcp-ui-inspect.ts`), `ui.interact` (steps
3
- // first, then the picture, in `mcp-ui-interact.ts`) and `ui.diff` (two captures compared, in
4
- // `mcp-ui-diff.ts`), as the `DevCapabilities` half `packages/mcp` declares and cannot satisfy — a
5
- // browser is the CLI's to launch, and the files are the CLI's to read. The four that look
6
- // are `x shot` under another name: the same server lookup (a running `x dev` is
7
- // reused through its lock, otherwise a scratch one boots), the same driver, the same verdict.
8
- // Nothing here is a new capability; it is the existing one made reachable from inside the loop
9
- // an agent already works in, so "does it look right" stops needing a hand-written script.
1
+ // The dev MCP server's eyes and hand — `ui.shot`, `ui.island`, `ui.inspect`, `ui.interact`,
2
+ // `ui.diff` — as the `DevCapabilities` half `packages/mcp` declares and cannot satisfy.
3
+ //
4
+ // `ui.shot` captures a route, `ui.island` a component's states, `ui.inspect` reads DOM facts for a
5
+ // set of selectors (`mcp-ui-inspect.ts`), `ui.interact` takes steps first, then the picture
6
+ // (`mcp-ui-interact.ts`), and `ui.diff` compares two captures (`mcp-ui-diff.ts`). They live here
7
+ // because a browser is the CLI's to launch, and the files are the CLI's to read. The four that look
8
+ // are `x shot` under another name: the same server lookup (a running `x dev` is reused through its
9
+ // lock, otherwise a scratch one boots), the same driver, the same verdict. Nothing here is a new
10
+ // capability; it is the existing one made reachable from inside the loop an agent already works in,
11
+ // so "does it look right" stops needing a hand-written script.
10
12
 
11
13
  // why: Bun exposes no path-join primitive, and the picture's directory is a path an agent opens.
12
14
  import { join } from 'node:path';
@@ -1,9 +1,11 @@
1
- // The database a measurement render reads, when the build has none. A page's `load` reads rows,
2
- // and a build runs with no `DATABASE_URL`, so every data-reading route was `X_DB_UNAVAILABLE` and
3
- // never weighed. The answer is `x dev`'s own embedded PGlite on a THROWAWAY state directory, with
4
- // the app's migrations applied and its `dev`-tier seeds run: `defineSeed` rows are keyed by
5
- // `seedId(label)`, so the database is the same on every machine — and a dynamic route whose
6
- // `prerender()` lists paths from its own rows has paths to be weighed at (plan 101 slice 11 m).
1
+ // The database a measurement render reads, when the build has none.
2
+ //
3
+ // A page's `load` reads rows, and a build runs with no `DATABASE_URL`, so every data-reading route
4
+ // was `X_DB_UNAVAILABLE` and never weighed. The answer is `x dev`'s own embedded PGlite on a
5
+ // THROWAWAY state directory, with the app's migrations applied and its `dev`-tier seeds run:
6
+ // `defineSeed` rows are keyed by `seedId(label)`, so the database is the same on every machine —
7
+ // and a dynamic route whose `prerender()` lists paths from its own rows has paths to be weighed at
8
+ // (plan 101 slice 11 m).
7
9
 
8
10
  // why: Bun has no mkdtemp and no recursive remove; the state directory must not outlive the build.
9
11
  import { mkdtemp, rm } from 'node:fs/promises';
@@ -1,8 +1,10 @@
1
- // Which URLs a route rendered only to WEIGH is rendered at. A route with no params is its own
2
- // path. A route with params is rendered at the paths its own `prerender()` lists — the same list a
3
- // static route writes files for — and one that lists none is not rendered at all: rendering
4
- // `/blog/:slug` with an empty `slug` failed the page's own input schema (`X_INPUT_INVALID`), and
5
- // that was filed as "could not be weighed", a failure of the app dressed as a gap in the build.
1
+ // Which URLs a route rendered only to WEIGH is rendered at.
2
+ //
3
+ // A route with no params is its own path. A route with params is rendered at the paths its own
4
+ // `prerender()` lists — the same list a static route writes files for — and one that lists none is
5
+ // not rendered at all: rendering `/blog/:slug` with an empty `slug` failed the page's own input
6
+ // schema (`X_INPUT_INVALID`), and that was filed as "could not be weighed", a failure of the app
7
+ // dressed as a gap in the build.
6
8
 
7
9
  import type { PrerenderEntry, RouteEntry } from '@ultimat3/render';
8
10
  import { enumeratePrerenderEntries } from '@ultimat3/render/server';
@@ -1,11 +1,13 @@
1
- // The request a measurement render runs inside. `x build` renders every app/ route it cannot
2
- // prerender only to WEIGH it, and that render reads its data the way a real one does: a `load`
3
- // calls the app's typed client, over `APP_URL`, as the request's own member. So it needs a request
4
- // context (`useRequestHeader('cookie')` throws X_NO_REQUEST outside one), an actor the app chose
5
- // (`defineMeasurementActor()` in `app.config.ts`, core's `measurementActor()` otherwise), and a
6
- // server to answer — the app's own API pipeline, dispatched IN PROCESS through core's
7
- // `withInProcessFetch`, because no server is listening during a build (plan 101 slice 11 m) — and
8
- // `runtime.ts`'s ports as `offline-ports.ts` decides them, for every render the build runs.
1
+ // The request a measurement render runs inside.
2
+ //
3
+ // `x build` renders every app/ route it cannot prerender only to WEIGH it, and that render reads
4
+ // its data the way a real one does: a `load` calls the app's typed client, over `APP_URL`, as the
5
+ // request's own member. So it needs a request context (`useRequestHeader('cookie')` throws
6
+ // X_NO_REQUEST outside one), an actor the app chose (`defineMeasurementActor()` in `app.config.ts`,
7
+ // core's `measurementActor()` otherwise), and a server to answer — the app's own API pipeline,
8
+ // dispatched IN PROCESS through core's `withInProcessFetch`, because no server is listening during
9
+ // a build (plan 101 slice 11 m) — and `runtime.ts`'s ports as `offline-ports.ts` decides them, for
10
+ // every render the build runs.
9
11
 
10
12
  import type { Actor, Ctx } from '@ultimat3/core';
11
13
  import { actorLabel, measurementActor, runWithContext, withInProcessFetch } from '@ultimat3/core';
package/src/migrations.ts CHANGED
@@ -2,6 +2,8 @@
2
2
  // because the release phase and the developer must apply the identical list through the identical
3
3
  // ledger — a deploy that migrated by some other route is a schema nobody can reconstruct.
4
4
 
5
+ // why: the migrations folder is a DIRECTORY, which `Bun.file().exists()` answers false for; Bun
6
+ // ships no path API, and `join` builds the paths under it.
5
7
  import { existsSync } from 'node:fs';
6
8
  import { join } from 'node:path';
7
9
  import type { Migration, SchemaDescription } from '@ultimat3/db';
@@ -1,10 +1,12 @@
1
- // The client router a document may carry, composed ONCE for `x dev`, the container and the static
2
- // export: which surfaces opted in (`navigation: { client: [...] }` in `app.config.ts`), the router
3
- // script built from the app's own `@ultimat3/render`, its route, the head a document of an opted-in
4
- // surface carries, and the SERVER's half per page — which router may swap it in, whether it may be
5
- // prefetched (`@ultimat3/http`'s navigation gate reads that off the route meta), and the principal
6
- // check a soft visit gets before `load`. No surface opted in: nothing is built, served or named — a
7
- // `site/` page that did not ask stays 0kb (axiom 6).
1
+ // The client router a document may carry, composed ONCE for `x dev`, the container and the
2
+ // static export. No surface opted in: nothing is built, served or named (axiom 6).
3
+ //
4
+ // It composes which surfaces opted in (`navigation: { client: [...] }` in `app.config.ts`), the
5
+ // router script built from the app's own `@ultimat3/render`, its route, the head a document of an
6
+ // opted-in surface carries, and the SERVER's half per page — which router may swap it in, whether
7
+ // it may be prefetched (`@ultimat3/http`'s navigation gate reads that off the route meta), and the
8
+ // principal check a soft visit gets before `load`. No surface opted in: nothing is built, served or
9
+ // named — a `site/` page that did not ask stays 0kb (axiom 6).
8
10
 
9
11
  import { clientScopeOf } from '@ultimat3/auth';
10
12
  import type { Ctx, NavigationSurface } from '@ultimat3/core';
@@ -1,9 +1,11 @@
1
- // Speculation Rules for the documents that carry NO client router, composed ONCE for `x dev`, the
2
- // container and the static export: `navigation.speculation` from `app.config.ts`, the pages the
3
- // route table knows to be a pure read, the one `<script type="speculationrules">` every such
4
- // document carries, and the `script-src` source that admits exactly that body. A browser fetches
5
- // the next page's document on pointer rest, so a full-page navigation between prerendered pages
6
- // paints from memory — and the page still ships 0kb of JavaScript (axiom 6).
1
+ // Speculation Rules for the documents that carry NO client router, composed ONCE for `x dev`,
2
+ // the container and the static export.
3
+ //
4
+ // It composes `navigation.speculation` from `app.config.ts`, the pages the route table knows to be
5
+ // a pure read, the one `<script type="speculationrules">` every such document carries, and the
6
+ // `script-src` source that admits exactly that body. A browser fetches the next page's document on
7
+ // pointer rest, so a full-page navigation between prerendered pages paints from memory — and the
8
+ // page still ships 0kb of JavaScript (axiom 6).
7
9
 
8
10
  import type { NavigationSurface, SpeculationConfig } from '@ultimat3/core';
9
11
  import { DEFAULT_SPECULATION, localeSegment } from '@ultimat3/core';
package/src/parse.ts CHANGED
@@ -176,7 +176,7 @@ export function parseArgs(argv: readonly string[], specs: readonly CommandSpec[]
176
176
  flag: '',
177
177
  command: spec.name,
178
178
  reason: `hands nothing to another tool, so ${passthrough.join(' ')} would be dropped in silence`,
179
- fix: `x ${spec.name} --help`,
179
+ fix: `x ${quoteArg(spec.name)} --help`,
180
180
  });
181
181
  }
182
182
  const flags = defaults(spec);
@@ -288,12 +288,12 @@ function assertFlagsApply(
288
288
  const only = flag.subcommands;
289
289
  if (only === undefined || only.includes(subcommand) || !given.has(flag.name)) continue;
290
290
  const value = flags.get(flag.name);
291
- const argument = typeof value === 'string' ? ` ${quoteArg(value)}` : '';
291
+ const invocation = `x ${quoteArg(spec.name)} ${quoteArg(only[0] ?? subcommand)} --${quoteArg(flag.name)}`;
292
292
  throw new BadFlagError({
293
293
  flag: flag.name,
294
294
  command: `${spec.name} ${subcommand}`,
295
295
  reason: `read by ${only.map((word) => `x ${spec.name} ${word}`).join(' / ')} only — "${subcommand}" would ignore it`,
296
- fix: `x ${spec.name} ${only[0]} --${flag.name}${argument}`,
296
+ fix: typeof value === 'string' ? `${invocation} ${quoteArg(value)}` : invocation,
297
297
  });
298
298
  }
299
299
  }
@@ -2,6 +2,7 @@
2
2
  // `path.includes('node_modules')`, which is a SUBSTRING match: an app checked out under
3
3
  // `~/dev/node_modules-experiments/myapp` answered true for every file it holds, so `loadApp`
4
4
  // imported none of them and the app registered nothing at all.
5
+ import { trimTrailingSlashes } from '@ultimat3/core';
5
6
 
6
7
  /** Split on either separator: a rule that reads `a/b` and not `a\b` does not exist on Windows. */
7
8
  export function pathSegments(path: string): readonly string[] {
@@ -19,6 +20,6 @@ export function hasPathSegment(path: string, segment: string): boolean {
19
20
  * reload graph recorded no import and no sheet as the app's own, and a save rendered stale code.
20
21
  */
21
22
  export function isPathUnder(root: string, path: string): boolean {
22
- const base = root.replaceAll('\\', '/').replace(/\/+$/, '');
23
+ const base = trimTrailingSlashes(root.replaceAll('\\', '/'));
23
24
  return path.replaceAll('\\', '/').startsWith(`${base}/`);
24
25
  }
package/src/pr-threads.ts CHANGED
@@ -9,6 +9,7 @@ import { GhResponseInvalidError, ghGraphql } from './gh';
9
9
  import type { GhRepo } from './gh-target';
10
10
  import type { PrActivity } from './pr-activity';
11
11
  import { ACTIVITY_FIELDS, ACTIVITY_SCHEMA, activityOf } from './pr-activity';
12
+ import { quoteArg } from './shell-quote';
12
13
 
13
14
  /**
14
15
  * How many threads one page holds. The query is built from it, so the report and the request can
@@ -184,7 +185,7 @@ export async function fetchReviewReport(
184
185
  REVIEW_RESPONSE,
185
186
  {
186
187
  label: `gh api graphql (review threads on ${repo.slug}#${number})`,
187
- fix: `gh pr view ${number} --repo ${repo.slug} --json number # confirm the pull request is visible to this token`,
188
+ fix: `gh pr view ${quoteArg(String(number))} --repo ${quoteArg(repo.slug)} --json number # confirm the pull request is visible to this token`,
188
189
  },
189
190
  );
190
191
  const pull = response.data.repository?.pullRequest;
package/src/prerender.ts CHANGED
@@ -1,8 +1,8 @@
1
- // `x build --target static` — the `site/` surface, rendered once and written as files a CDN or an
2
- // object store can serve with no process behind it. Enumeration, hashing and the output path are
3
- // `@ultimat3/render`'s `renderStatic`; the document is the one `x dev` serves. This file decides
4
- // only which routes qualify and where the bytes land.
1
+ // `x build --target static`: the `site/` surface written once as files a CDN serves with no
2
+ // process behind it. Enumeration, hashing and output paths are `@ultimat3/render`'s `renderStatic`
3
+ // and the document is `x dev`'s; this file decides only which routes qualify and where bytes land.
5
4
 
5
+ // why: Bun ships no path API; `join` builds the host-separator path of each file the export writes.
6
6
  import { join } from 'node:path';
7
7
  import {
8
8
  ctxOf,
package/src/role-start.ts CHANGED
@@ -54,6 +54,7 @@ import { startLiveFeed } from './runtime-live-feed';
54
54
  import { type RunningServices, releaseOrThrow } from './runtime-services';
55
55
  import { inlineScriptSources } from './script-csp';
56
56
  import { bootWarningConcernsAny } from './serve-boot-warnings';
57
+ import { quoteArg } from './shell-quote';
57
58
  import { inlineStyleSources } from './style-csp';
58
59
  import { syncConnectSources } from './sync-url';
59
60
  import { trustedHopsFromEnv } from './trusted-hops';
@@ -93,7 +94,7 @@ export function selectRoles(flag: string | undefined): readonly Role[] {
93
94
  flag: 'role',
94
95
  command: 'dev',
95
96
  reason: `"${name}" is not a role (known: ${ROLES.join(', ')})`,
96
- fix: `x dev --role ${DEV_ROLES.join(',')}`,
97
+ fix: `x dev --role ${quoteArg(DEV_ROLES.join(','))}`,
97
98
  });
98
99
  }
99
100
  if (!SELECTABLE_ROLES.includes(name)) {
@@ -101,7 +102,7 @@ export function selectRoles(flag: string | undefined): readonly Role[] {
101
102
  flag: 'role',
102
103
  command: 'dev',
103
104
  reason: `"${name}" does not run under x dev (it runs once, as \`x db migrate\`)`,
104
- fix: `x dev --role ${DEV_ROLES.join(',')}`,
105
+ fix: `x dev --role ${quoteArg(DEV_ROLES.join(','))}`,
105
106
  });
106
107
  }
107
108
  if (!selected.includes(name)) selected.push(name);
package/src/role-sync.ts CHANGED
@@ -28,6 +28,7 @@ import { portFree } from './port-probe';
28
28
  import type { StartRolesOptions } from './role-start';
29
29
  import { startOrWaitForBus } from './role-sync-bus-wait';
30
30
  import type { Env } from './runtime-bindings';
31
+ import { quoteArg } from './shell-quote';
31
32
  import { syncAuthenticator } from './sync-authenticator';
32
33
  import { syncOriginsFrom } from './sync-url';
33
34
  // A value edge back into `role-start.ts`, read only inside a call: the one parser of
@@ -55,7 +56,7 @@ class SyncPortInUseError extends UltimateError {
55
56
  // web port IS the sync port this refusal is about — the fix said `x dev --port 4000` for a
56
57
  // run that had just died on 4000, and a test named "its fix is a command that ends the
57
58
  // failure" pinned it.
58
- fix: `x dev --port ${portPairAfter(input.webPort)} # or free port ${input.port}: lsof -nP -iTCP:${input.port} -sTCP:LISTEN`,
59
+ fix: `x dev --port ${quoteArg(String(portPairAfter(input.webPort)))} # or free port ${input.port}: lsof -nP -iTCP:${input.port} -sTCP:LISTEN`,
59
60
  meta: { port: input.port, webPort: input.webPort },
60
61
  });
61
62
  }
@@ -1,9 +1,11 @@
1
- // Projecting the framework's one image pipeline onto the routes `x dev` serves. Three packages
2
- // declare what an image is — `@ultimat3/seo` a variant URL, `@ultimat3/storage` a variant key,
3
- // `@ultimat3/pwa` the icons a web manifest promises — and `@ultimat3/core`'s pipeline owns every
4
- // pixel, so this file picks the two base paths they hang off and decides nothing else. The one
5
- // thing it does NOT decide is who may read a stored object: `/media` borrows that whole answer
6
- // from `runtime-storage.ts`, because the same bytes are reachable through both.
1
+ // Projecting the framework's one image pipeline onto the routes `x dev` serves: the two base
2
+ // paths variant URLs, variant keys and manifest icons hang off, and nothing else.
3
+ //
4
+ // Three packages declare what an image is — `@ultimat3/seo` a variant URL, `@ultimat3/storage` a
5
+ // variant key, `@ultimat3/pwa` the icons a web manifest promises — and `@ultimat3/core`'s pipeline
6
+ // owns every pixel, so this file picks the two base paths they hang off and decides nothing else.
7
+ // The one thing it does NOT decide is who may read a stored object: `/media` borrows that whole
8
+ // answer from `runtime-storage.ts`, because the same bytes are reachable through both.
7
9
 
8
10
  import { probeImage } from '@ultimat3/core';
9
11
  import type { ObjectSource, RequestContext, Route, UltimateRequest } from '@ultimat3/http';
@@ -2,6 +2,8 @@
2
2
  // embedded default, and the resolved set is printed at boot so there is never a question about
3
3
  // which database a running process is talking to.
4
4
 
5
+ // why: Bun has no mkdir — `Bun.write` creates parents only on the way to a file, and `.x/` must
6
+ // exist as a directory before a driver opens it. Bun ships no path API either.
5
7
  import { mkdirSync } from 'node:fs';
6
8
  import { join } from 'node:path';
7
9
  import { renderThrowable } from '@ultimat3/core';