@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
@@ -3,8 +3,9 @@
3
3
  // is not a smaller version of this — the island glob never discovers it, and a server render drops
4
4
  // every `on*` prop (`packages/render/src/html.ts`) and reads each signal exactly once.
5
5
 
6
- // Bun ships no path API, and the one arithmetic this file does is a specifier: the island's path
7
- // seen from the page's directory, which `island-bundle.ts` resolves the same way at build time.
6
+ // why: Bun ships no path API, and the one arithmetic this file does is a specifier: the island's
7
+ // path seen from the page's directory, which `island-bundle.ts` resolves the same way at build
8
+ // time.
8
9
  import { posix } from 'node:path';
9
10
  import { upToAppRoot } from './island';
10
11
  import type { GeneratedFile, NameSet } from './naming';
@@ -1,9 +1,11 @@
1
- // `x g resource <name>`'s page: the plural route a slice is reached at. It READS — a `<Hole>` calls
2
- // the slice's own query a page at a time as the request's actor, after the shell left — renders the
3
- // rows in a link-mode `DataTable` (loading, failed, empty, ready; paged by URL, no script), and
4
- // mounts the slice's form island. `x g route`
5
- // writes a page with a heading and nothing to read; a resource has rows and a form, and a page
6
- // that showed neither was a slice nobody could reach without wiring it by hand.
1
+ // `x g resource <name>`'s page: the plural route a slice is reached at — its rows in a
2
+ // `DataTable`, read a page at a time, and the slice's form island.
3
+ //
4
+ // It READS — a `<Hole>` calls the slice's own query a page at a time as the request's actor, after
5
+ // the shell left — renders the rows in a link-mode `DataTable` (loading, failed, empty, ready;
6
+ // paged by URL, no script), and mounts the slice's form island. `x g route` writes a page with a
7
+ // heading and nothing to read; a resource has rows and a form, and a page that showed neither was a
8
+ // slice nobody could reach without wiring it by hand.
7
9
 
8
10
  import { sortedImports } from './imports';
9
11
  import type { GeneratedFile, NameSet } from './naming';
@@ -1,4 +1,5 @@
1
1
  // `x g route <path>` — a URL, its render mode, its metadata, its offline strategy and its budget.
2
+ //
2
3
  // Two generated tests, because the gate types a test by its filename: `page.test.ts` pins metadata
3
4
  // presence and the budget declaration on the `unit` step, `page.e2e.test.ts` pins the offline
4
5
  // fallback on the `e2e` step. A route with no title is an SEO regression and a route with no
@@ -1,9 +1,10 @@
1
- // The human-authored half of what `x new` writes: the READMEs, the agent-facing convention files,
2
- // the bin/ scripts and the optional dev compose. Separated from the config half so neither file has
3
- // to be scrolled to find the other — one file, one job applies to templates too. The image, its
4
- // ignore file, the production topology and the deploy page are `scaffold-container.ts`; the
5
- // `.claude/` harness that reads CLAUDE.md is `scaffold-claude.ts`; the one workflow is
6
- // `github/ci.yml.ts`.
1
+ // The human-authored half of what `x new` writes: the READMEs, the agent-facing convention
2
+ // files, the bin/ scripts and the optional dev compose.
3
+ //
4
+ // Separated from the config half so neither file has to be scrolled to find the other — one file,
5
+ // one job applies to templates too. The image, its ignore file, the production topology and the
6
+ // deploy page are `scaffold-container.ts`; the `.claude/` harness that reads CLAUDE.md is
7
+ // `scaffold-claude.ts`; the one workflow is `github/ci.yml.ts`.
7
8
 
8
9
  import { LINE_CEILING } from '../workspace-checks';
9
10
  import { githubFiles } from './github/ci.yml';
@@ -1,8 +1,10 @@
1
- // The two entry files a deploy needs — `apps/web/server.ts` and `apps/web/prerender.ts`. Split out
2
- // of `scaffold-app.ts` because that file is the three SURFACES and these are neither: they are what
3
- // a container starts and what a CDN is handed. Both are deliberately thin — which role a container
4
- // is, which port it binds, how it drains and what a static build enumerates are the framework's
5
- // answers, so an upgrade moves them without a codemod in every app that ever shipped.
1
+ // The two entry files a deploy needs — `apps/web/server.ts` and `apps/web/prerender.ts`.
2
+ //
3
+ // Split out of `scaffold-app.ts` because that file is the three SURFACES and these are neither:
4
+ // they are what a container starts and what a CDN is handed. Both are deliberately thin — which
5
+ // role a container is, which port it binds, how it drains and what a static build enumerates are
6
+ // the framework's answers, so an upgrade moves them without a codemod in every app that ever
7
+ // shipped.
6
8
 
7
9
  import type { GeneratedFile } from './naming';
8
10
  import { baseRuntimeFiles } from './scaffold-runtime-ports';
@@ -1,9 +1,11 @@
1
- // The two error pages `x new` writes — `apps/web/site/errors/404.html` and `500.html`, the files
2
- // `packages/cli/src/error-pages.ts` serves verbatim for those statuses and the static export
3
- // carries as `404.html`. Self-contained documents by construction: a 500 is answered when the app's
4
- // own stylesheet may be the thing that failed, so nothing here links a bundle, loads a font or runs
5
- // a script. The `<style>` body is hashed into `style-src` at boot (`error-page-csp.ts`), which is
6
- // what lets the enforced policy a container sends admit it.
1
+ // The two error pages `x new` writes — `apps/web/site/errors/404.html` and `500.html` —
2
+ // self-contained documents by construction.
3
+ //
4
+ // `packages/cli/src/error-pages.ts` serves them verbatim for those statuses, and the static export
5
+ // carries `404.html`. A 500 is answered when the app's own stylesheet may be the thing that failed,
6
+ // so nothing here links a bundle, loads a font or runs a script. The `<style>` body is hashed into
7
+ // `style-src` at boot (`error-page-csp.ts`), which is what lets the enforced policy a container
8
+ // sends admit it.
7
9
 
8
10
  import type { GeneratedFile, NameSet } from './naming';
9
11
  import { titleCase } from './naming';
@@ -1,8 +1,9 @@
1
1
  // The REPO ROOT half of what `x new` writes: `app.config.ts`, the tooling configs, the committed
2
- // env files — and the one list that names every other scaffold module in write order. Committed
3
- // defaults only, so a fresh clone boots with `x dev` and no env scavenger hunt. Each workspace
4
- // package owns its own files (`scaffold-<name>-package.ts`); docs and shims are scaffold-docs.ts,
5
- // container files scaffold-container.ts.
2
+ // env files — and the one list that names every other scaffold module in write order.
3
+ //
4
+ // Committed defaults only, so a fresh clone boots with `x dev` and no env scavenger hunt. Each
5
+ // workspace package owns its own files (`scaffold-<name>-package.ts`); docs and shims are
6
+ // scaffold-docs.ts, container files scaffold-container.ts.
6
7
 
7
8
  import { ENV_EXAMPLE_PATH } from '@ultimat3/core';
8
9
  import { REQUIRED_BUN } from '../app-root';
@@ -1,8 +1,10 @@
1
- // The generated app's frame — `apps/web/shared/shell.tsx` over the catalog's `AppShell` — and the
2
- // one island the scaffold ships, the theme toggle. Split out of `scaffold-app.ts` because that file
3
- // is the three surfaces and this is the chrome every `app/` page sits inside. Before this the
4
- // dashboard was an `<h1>` in a panel and the scaffold imported nothing from `@ultimat3/ui`; an app
5
- // that starts from it now starts from a designed product, and deletes what it does not want.
1
+ // The generated app's frame — `apps/web/shared/shell.tsx` over the catalog's `AppShell` — and
2
+ // the one island the scaffold ships, the theme toggle.
3
+ //
4
+ // Split out of `scaffold-app.ts` because that file is the three surfaces and this is the chrome
5
+ // every `app/` page sits inside. Before this the dashboard was an `<h1>` in a panel and the
6
+ // scaffold imported nothing from `@ultimat3/ui`; an app that starts from it now starts from a
7
+ // designed product, and deletes what it does not want.
6
8
 
7
9
  import { sortedImports } from './imports';
8
10
  import { upToAppRoot } from './island';
@@ -1,8 +1,10 @@
1
- // The generated landing page — `apps/web/site/page.tsx` and its stylesheet and test. Split out of
2
- // `scaffold-app.ts` when it grew from an `<h1>` and a link into a hero: a dot-grid ground, an
3
- // eyebrow, a balanced headline, a lede, two calls to action and three feature cards, every string
4
- // a catalog key and every colour a token. Still 0kb: `render: 'static'`, `hydrate: 'never'`, no
5
- // island, and it does not wear the app shell — see the page's own header comment.
1
+ // The generated landing page — `apps/web/site/page.tsx` and its stylesheet and test.
2
+ //
3
+ // Split out of `scaffold-app.ts` when it grew from an `<h1>` and a link into a hero: a dot-grid
4
+ // ground, an eyebrow, a balanced headline, a lede, two calls to action and three feature cards,
5
+ // every string a catalog key and every colour a token. Still 0kb: `render: 'static'`,
6
+ // `hydrate: 'never'`, no island, and it does not wear the app shell — see the page's own header
7
+ // comment.
6
8
 
7
9
  import { sortedImports } from './imports';
8
10
  import type { GeneratedFile, NameSet } from './naming';
@@ -78,12 +78,9 @@ const defaultConnect = async (url: string): Promise<ProbeServer> => {
78
78
  async function strayStateDirs(root: string): Promise<readonly string[]> {
79
79
  const found: string[] = [];
80
80
  const walk = async (dir: string, top: boolean): Promise<void> => {
81
- let entries: import('node:fs').Dirent[];
82
- try {
83
- entries = await readdir(dir, { withFileTypes: true });
84
- } catch {
85
- return;
86
- }
81
+ // A directory that cannot be listed holds nothing this sweep may touch: skipped, not fatal.
82
+ const entries = await readdir(dir, { withFileTypes: true }).catch(() => undefined);
83
+ if (entries === undefined) return;
87
84
  if (!top && entries.some((entry) => entry.isFile() && entry.name === APP_CONFIG_FILE)) return;
88
85
  for (const entry of entries) {
89
86
  if (!entry.isDirectory()) continue;
@@ -2,9 +2,9 @@
2
2
  // validation behind the type positional and `--sample`. Selection only — nothing here splits a
3
3
  // shard or spawns a process, so a wrong file list is always this file's bug and never a race.
4
4
 
5
- import { join } from 'node:path';
6
- // Bun ships no equivalent: `join` builds the host-separator path from the scan root to a hit.
5
+ // why: Bun ships no path API: `join` builds the host-separator path from the scan root to a hit.
7
6
  // Sizing is Bun's own (`Bun.file().size`), so nothing here reaches for `node:fs`.
7
+ import { join } from 'node:path';
8
8
  import { nearestName, renderFixShellArg } from '@ultimat3/core';
9
9
  import { TEST_TYPES } from '@ultimat3/testing';
10
10
  import { BadFlagError } from './errors';
@@ -108,7 +108,7 @@ export function readType(raw: string | undefined): TestType | undefined {
108
108
  flag: 'type',
109
109
  command: 'test',
110
110
  reason: `"${raw}" is not a test type (known: ${TEST_TYPES.join(', ')})`,
111
- fix: suggestion === undefined ? `x test ${TEST_TYPES[0]}` : `x test ${suggestion}`,
111
+ fix: `x test ${renderFixShellArg(suggestion ?? TEST_TYPES[0], '<type>')}`,
112
112
  });
113
113
  }
114
114
 
package/src/ts-scan.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  // Reading TypeScript source without a parser: the masking every scan here shares, and the `X_*`
2
- // codes a package declares. Deliberately not `tsc` — a regex over a masked file is the whole job.
3
- // Masking is the load-bearing part: the contract's own 3-line rendering appears verbatim in doc
4
- // blocks and template literals, and a scanner that reads it as code invents work. What a `fix:`
5
- // can evaluate to is `fix-scan.ts`, which reads these primitives and is the only file that grew.
2
+ // codes a package declares.
3
+ //
4
+ // Deliberately not `tsc` — a regex over a masked file is the whole job. Masking is the load-bearing
5
+ // part: the contract's own 3-line rendering appears verbatim in doc blocks and template literals,
6
+ // and a scanner that reads it as code invents work. What a `fix:` can evaluate to is `fix-scan.ts`,
7
+ // which reads these primitives and is the only file that grew.
6
8
 
7
9
  export interface SourceSite {
8
10
  /** Repo-relative file the site was read from. */
@@ -2,12 +2,12 @@
2
2
  // which compiles referenced projects and nothing else — so a package no reference names is a
3
3
  // package the gate's `typecheck` step reports green over without having read a line of it.
4
4
 
5
- // Bun ships no equivalent: `join` builds the host-separator path from the scan root to the config.
6
- // Nothing else here is `node:` — the read is `Bun.file`, and its rejection is also the answer for a
7
- // root that has no `tsconfig.json` at all, so an `existsSync` ahead of it was a second question
8
- // with one answer.
5
+ // why: Bun ships no equivalent: `join` builds the host-separator path from the scan root to the
6
+ // config. Nothing else here is `node:` — the read is `Bun.file`, and its rejection is also the
7
+ // answer for a root that has no `tsconfig.json` at all, so an `existsSync` ahead of it was a second
8
+ // question with one answer.
9
9
  import { join } from 'node:path';
10
- import { ERROR_DOCS_URL, maskLiterals, stripComments } from '@ultimat3/core';
10
+ import { ERROR_DOCS_URL, maskLiterals, stripComments, trimTrailingSlashes } from '@ultimat3/core';
11
11
  import type { Finding } from './output';
12
12
 
13
13
  const ROOT_TSCONFIG = 'tsconfig.json';
@@ -20,7 +20,7 @@ const ROOT_TSCONFIG = 'tsconfig.json';
20
20
  * scaffolder appends a duplicate entry the check already considered present.
21
21
  */
22
22
  export const normalizeReferencePath = (path: string): string =>
23
- path.replace(/^\.\//, '').replace(/\/+$/, '');
23
+ trimTrailingSlashes(path.replace(/^\.\//, ''));
24
24
 
25
25
  /**
26
26
  * A tsconfig is JSONC and `JSON.parse` is not, so the comments and trailing commas `tsc` accepts —
@@ -2,7 +2,7 @@
2
2
  // now the `x verify` command surface alone: the list is the definition of shippable and grows with
3
3
  // the framework, while the command that runs it does not.
4
4
 
5
- import { existsSync } from 'node:fs';
5
+ // why: Bun ships no path API; `join` builds the host-separator path each step's `applies` probes.
6
6
  import { join } from 'node:path';
7
7
  import { APP_CONFIG_FILE, ERROR_DOCS_URL } from '@ultimat3/core';
8
8
  import { AGENTS_MD_FILENAME } from '@ultimat3/manifest';
@@ -222,7 +222,7 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
222
222
  // The destructive rail rides here rather than becoming a step of its own because it asks this
223
223
  // step's own question — do the committed migrations still describe what the app is doing to its
224
224
  // schema? — off the same directory, in the same pass, with no database either.
225
- applies: async (ctx) => existsSync(join(ctx.root, APP_CONFIG_FILE)),
225
+ applies: async (ctx) => Bun.file(join(ctx.root, APP_CONFIG_FILE)).exists(),
226
226
  run: async (ctx) => {
227
227
  // Loaded first: the drivers the app's modules construct are what decide (`drift-store.ts`).
228
228
  await loadApp(ctx.root);
@@ -275,7 +275,7 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
275
275
  //
276
276
  // A repo with no `app.config.ts` is the framework monorepo, which renders no documents and has
277
277
  // no stylesheet registry to read; there is nothing for either half to weigh.
278
- applies: async (ctx) => existsSync(join(ctx.root, APP_CONFIG_FILE)),
278
+ applies: async (ctx) => Bun.file(join(ctx.root, APP_CONFIG_FILE)).exists(),
279
279
  async run(ctx) {
280
280
  // No stats file is NOT "nothing to weigh" — it is every declared budget unmeasured. So the
281
281
  // step MEASURES first, whenever the stats are missing, of an earlier rule, or older than the
@@ -334,7 +334,7 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
334
334
  // this one asks what it SAYS, and a missing `<title>` reported under `budgets` would hand the
335
335
  // reader a fix for the wrong question (axiom 4). It costs no second app load — `loadApp`
336
336
  // imports each module once per process, so this runs on the registries `budgets` just filled.
337
- applies: async (ctx) => existsSync(join(ctx.root, APP_CONFIG_FILE)),
337
+ applies: async (ctx) => Bun.file(join(ctx.root, APP_CONFIG_FILE)).exists(),
338
338
  async run(ctx) {
339
339
  const scan = await scanSiteMeta(ctx.root);
340
340
  // No `baseUrl`: an app declares no base URL anywhere (`packages/core/src/config.ts` has no
@@ -376,7 +376,7 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
376
376
  // second load. A repo with no `app.config.ts` is the framework monorepo, which registers no
377
377
  // app catalogs — SKIPPED there, never passed, because a step that answers `ok` about nothing
378
378
  // is the vacuous green this check exists to refuse.
379
- applies: async (ctx) => existsSync(join(ctx.root, APP_CONFIG_FILE)),
379
+ applies: async (ctx) => Bun.file(join(ctx.root, APP_CONFIG_FILE)).exists(),
380
380
  run: async (ctx) => fromFindings(await catalogFindings(ctx.root)),
381
381
  }),
382
382
  blockedByLoad({
@@ -385,7 +385,7 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
385
385
  // A repo with no `app.config.ts` is the framework monorepo, which declares no roles and
386
386
  // registers no routes — SKIPPED there, never passed, for the reason `i18n` gives: a step that
387
387
  // answers `ok` about nothing is the vacuous green these checks exist to refuse.
388
- applies: async (ctx) => existsSync(join(ctx.root, APP_CONFIG_FILE)),
388
+ applies: async (ctx) => Bun.file(join(ctx.root, APP_CONFIG_FILE)).exists(),
389
389
  run: async (ctx) => fromFindings(await policyFindings(ctx.root)),
390
390
  }),
391
391
  {
@@ -409,7 +409,7 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
409
409
  const floor = await readVerifyFloor(ctx.root);
410
410
  const agents = await checkAgentsMd(ctx.root, floor?.agentsMdMaxBytes);
411
411
  // The app's load failures, once, here — every other step that loaded it points at this one.
412
- const app = existsSync(join(ctx.root, APP_CONFIG_FILE));
412
+ const app = await Bun.file(join(ctx.root, APP_CONFIG_FILE)).exists();
413
413
  // Started first and awaited last: it is a child process, and it runs beside the rest.
414
414
  const roleLoad = app ? roleLoadFindings(ctx.root, ctx.runner) : Promise.resolve([]);
415
415
  const drift = await driftFindings(ctx.root);
@@ -418,7 +418,7 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
418
418
  const findings = [
419
419
  ...(app ? await withLoadFindings(ctx.root, drift) : drift),
420
420
  // An app only: the framework monorepo declares no `defineApi`, so it has no list to be in.
421
- ...(existsSync(join(ctx.root, APP_CONFIG_FILE))
421
+ ...(app
422
422
  ? [
423
423
  ...(await unregisteredJobFindings(ctx.root)),
424
424
  ...(await retainUnsweptFindings(ctx.root)),
@@ -462,7 +462,7 @@ export const VERIFY_STEPS: readonly VerifyStep[] = [
462
462
  // is a fact about the CALL: a caller of the exported `runVerify(VERIFY_STEPS, ctx)` passing no
463
463
  // `hostChecks`, in a repo whose committed `x.verify.json` names `roadmap`, got
464
464
  // `X_VERIFY_SUITE_VANISHED` — whose `fix:` is the command that had just failed.
465
- applies: async (ctx) => existsSync(join(ctx.root, ROADMAP_FILE)),
465
+ applies: async (ctx) => Bun.file(join(ctx.root, ROADMAP_FILE)).exists(),
466
466
  run: async (ctx) => fromFindings(await hostFindings(ctx, 'roadmap')),
467
467
  },
468
468
  ];
package/src/verify-e2e.ts CHANGED
@@ -1,9 +1,11 @@
1
- // What the gate's `e2e` step does around the suite in an APP: when this machine has a browser, it
2
- // runs the suite with the e2e preload and names the app root, and the PRELOAD spawns the app — so
3
- // the app lives in the test process, where `deploy.newBuild()` can restart it. No browser, or not an
4
- // app: the suite runs as before and its browser-backed cases skip — or refuse under
5
- // `E2E_BROWSER_REQUIRED=1`. An app whose `x.verify.json` requires `e2e` and ran nothing for want of
6
- // a browser is red by `judgeE2eBrowser`, with the command that installs one.
1
+ // What the gate's `e2e` step does around the suite in an APP: with a browser, it runs the suite
2
+ // under the e2e preload, which spawns the app in the test process.
3
+ //
4
+ // The step names the app root to the preload, so the app lives in the test process, where
5
+ // `deploy.newBuild()` can restart it. No browser, or not an app: the suite runs as before and its
6
+ // browser-backed cases skip — or refuse under `E2E_BROWSER_REQUIRED=1`. An app whose
7
+ // `x.verify.json` requires `e2e` and ran nothing for want of a browser is red by `judgeE2eBrowser`,
8
+ // with the command that installs one.
7
9
 
8
10
  import { ERROR_DOCS_URL } from '@ultimat3/core';
9
11
  import { CHROME_PATH_ENV, chromeCandidates, findChrome } from '@ultimat3/scraping/cdp';
@@ -3,9 +3,7 @@
3
3
  // reads as a skip and keeps the gate green. The floor turns that skip back into a failure. Read
4
4
  // here and written by nothing: a gate that edits its own floor ratchets both ways, which is none.
5
5
 
6
- // Bun ships no equivalent for either: `existsSync` answers whether this root committed a floor at
7
- // all, and `join` builds the host-separator path to it.
8
- import { existsSync } from 'node:fs';
6
+ // why: Bun ships no path API; `join` builds the host-separator path to the floor file.
9
7
  import { join } from 'node:path';
10
8
  import { ERROR_DOCS_URL, renderThrowable } from '@ultimat3/core';
11
9
  import { AGENTS_MD_MAX_BYTES } from '@ultimat3/manifest';
@@ -14,6 +12,7 @@ import { COVERAGE_FIELD, readCoverageFloor } from './coverage-floor';
14
12
  import type { ExerciseFloor } from './exercise-floor';
15
13
  import { EXERCISE_FIELD, readExerciseFloor } from './exercise-floor';
16
14
  import type { Finding } from './output';
15
+ import { quoteArg } from './shell-quote';
17
16
  import type { StepTimeouts } from './verify-deadline';
18
17
  import { readStepTimeouts, STEP_TIMEOUT_FIELD } from './verify-deadline';
19
18
  import type { GuardBaseline } from './verify-guard-baseline';
@@ -276,10 +275,11 @@ export function parseVerifyFloor(
276
275
  /** No file is no floor: a repo that never committed one is not ratcheted, and reports nothing. */
277
276
  export async function readVerifyFloor(root: string): Promise<VerifyFloor | undefined> {
278
277
  const path = join(root, VERIFY_FLOOR_FILE);
279
- if (!existsSync(path)) return undefined;
280
- const text = await Bun.file(path)
281
- .text()
282
- .catch(() => undefined);
278
+ const file = Bun.file(path);
279
+ // `stat`, never `exists()`: that answers false for a directory, which would read as no floor and
280
+ // skip the ratchet silently. Only a path that is not there at all is no floor.
281
+ if ((await file.stat().catch(() => undefined)) === undefined) return undefined;
282
+ const text = await file.text().catch(() => undefined);
283
283
  if (text === undefined) return { steps: [], problems: ['it could not be read as a file'] };
284
284
  return parseVerifyFloor(text);
285
285
  }
@@ -320,7 +320,7 @@ export const vanishedSuiteFinding = (step: string, command: string = GATE_COMMAN
320
320
  export const skippedSuiteFinding = (step: string, skipped: number): Finding => ({
321
321
  code: 'X_VERIFY_SUITE_VANISHED',
322
322
  cause: `${VERIFY_FLOOR_FILE} requires the ${step} step and all ${skipped} test(s) it found skipped themselves, so nothing ran`,
323
- fix: `x test ${step} --json # then set what the suite skips without, or drop "${step}" from ${VERIFY_FLOOR_FILE} in the commit that says why`,
323
+ fix: `x test ${quoteArg(step)} --json # then set what the suite skips without, or drop "${step}" from ${VERIFY_FLOOR_FILE} in the commit that says why`,
324
324
  docs: ERROR_DOCS_URL,
325
325
  at: VERIFY_FLOOR_FILE,
326
326
  });
@@ -1,4 +1,6 @@
1
- // How much slower this machine runs the gate than the one its declared numbers were measured on.
1
+ // How much slower this machine runs the gate than the one its declared numbers were measured
2
+ // on, measured once per gate and applied to every declared deadline.
3
+ //
2
4
  // Every deadline the gate declares — a step's (`verify-deadline.ts`), Bun's 5 s per test, a test's
3
5
  // own — was set against a 4-core CI runner, and on a 2-core 1.8 GHz box the same honest work runs
4
6
  // five to seven times longer: the gate failed there on the deadlines, never on the code. Measured
@@ -1,8 +1,11 @@
1
- // The gate's half of per-role loading (`manifest` step): a worker and a scheduler import the API
2
- // index and every module that reaches no component or stylesheet (`role-load.ts`). A registration
3
- // made in a module that DOES reach one, and that the index does not import, exists in the web role
4
- // and in every tool — and not in a worker. At boot only jobs and tasks are checked, against the
5
- // manifest; this is the build error for everything else a job reads by name.
1
+ // The gate's half of per-role loading (`manifest` step): a registration a worker's import set
2
+ // never reaches is a build error.
3
+ //
4
+ // A worker and a scheduler import the API index and every module that reaches no component or
5
+ // stylesheet (`role-load.ts`). A registration made in a module that DOES reach one, and that the
6
+ // index does not import, exists in the web role and in every tool — and not in a worker. At boot
7
+ // only jobs and tasks are checked, against the manifest; this is the build error for everything
8
+ // else a job reads by name.
6
9
 
7
10
  // why: Bun ships no path API; the fix names the import relative to the API index.
8
11
  import { dirname, join } from 'node:path';
@@ -10,6 +10,7 @@ import { renderThrowable } from '@ultimat3/core';
10
10
  import type { Runner } from './exec';
11
11
  import { execOutput } from './exec';
12
12
  import type { Finding } from './output';
13
+ import { quoteArg } from './shell-quote';
13
14
  import { TEST_COMPOSE_PATH, TEST_ENV_PATH } from './templates/scaffold-test-services';
14
15
  import { parseDotenvValues } from './test-dotenv';
15
16
 
@@ -140,7 +141,7 @@ const hostOf = (url: string): string => {
140
141
  const foreignFinding = (url: string): Finding => ({
141
142
  code: 'X_TEST_SERVICES_UNAVAILABLE',
142
143
  cause: `a Postgres answers at ${hostOf(url)} (${TEST_ENV_PATH}'s ${TEST_DATABASE_KEY}) and refuses this app's credentials — another app's test stack holds the port, so the live suites are not run against it`,
143
- fix: `docker ps --filter publish=${portOf(url)} # stop that stack (docker compose -p <project> down), or give this app another port in ${TEST_COMPOSE_PATH} and ${TEST_ENV_PATH}`,
144
+ fix: `docker ps --filter publish=${quoteArg(portOf(url))} # stop that stack (docker compose -p <project> down), or give this app another port in ${TEST_COMPOSE_PATH} and ${TEST_ENV_PATH}`,
144
145
  at: TEST_ENV_PATH,
145
146
  });
146
147
 
@@ -6,8 +6,8 @@
6
6
  // `eval` carries one rule beyond its suite — every prompt must have an eval — so it is the only
7
7
  // step here that can fail with no test file of its own.
8
8
 
9
- // Bun ships no `Bun.*` equivalent for either: `existsSync` answers whether this root is an app,
10
- // and `join` builds the host-separator path to its config file.
9
+ // why: Bun ships no synchronous existence check (`Bun.file().exists()` is async, and `isApp` is
10
+ // read inside sync object literals) and no path API — `join` builds the path to the config file.
11
11
  import { existsSync } from 'node:fs';
12
12
  import { join } from 'node:path';
13
13
  import { APP_CONFIG_FILE } from '@ultimat3/core';
@@ -1,8 +1,10 @@
1
- // Which `tsc` invocation the `typecheck` step runs. `tsc -b` decides "up to date" by mtime, and Bun
2
- // installs a package as HARDLINKS out of its cache, carrying the cache's old mtimes — so upgrading
3
- // a dependency to a version already in the cache left every input older than the buildinfo, `-b`
4
- // skipped the program and reported green while a cold CI went red (#450). `-p` with `incremental`
5
- // re-reads every input and compares content hashes, so it cannot be fooled by a date.
1
+ // Which `tsc` invocation the `typecheck` step runs: `-p` with `incremental`, never `-b`.
2
+ //
3
+ // `tsc -b` decides "up to date" by mtime, and Bun installs a package as HARDLINKS out of its cache,
4
+ // carrying the cache's old mtimes — so upgrading a dependency to a version already in the cache
5
+ // left every input older than the buildinfo, `-b` skipped the program and reported green while a
6
+ // cold CI went red (#450). `-p` with `incremental` re-reads every input and compares content
7
+ // hashes, so it cannot be fooled by a date.
6
8
 
7
9
  import { checkRootReferences } from './tsconfig-references';
8
10
 
@@ -2,7 +2,7 @@
2
2
  // at import, and a top-level cross-package import from there is what broke module initialisation
3
3
  // order before — so the value is fetched at the call, not at module scope.
4
4
 
5
- // Bun has no path-join primitive; `import.meta.dir` is this module's directory in both the
5
+ // why: Bun has no path-join primitive; `import.meta.dir` is this module's directory in both the
6
6
  // checked-out `src/` layout and the published `dist/` one, each one level below the package root.
7
7
  import { resolve } from 'node:path';
8
8
  import { resolveVersion } from '@ultimat3/core';
@@ -1,8 +1,10 @@
1
- // The page's framework scripts (plan 101), each built as its own classic-script browser bundle,
2
- // named by a hash of its bytes, served `immutable` by the same route in `x dev` and the
3
- // container: the ONE sync worker (`@ultimat3/realtime/sync-worker`, slice 11) and the ONE page boot
4
- // (`@ultimat3/realtime/boot` — the disk restore and the outbox, once per page instead of once per
5
- // island). A new deploy is a new URL, so an old tab keeps what it started with.
1
+ // The page's framework scripts (plan 101) — the ONE sync worker and the ONE page boot — each
2
+ // built as a classic-script browser bundle, named by a hash of its bytes, served `immutable`.
3
+ //
4
+ // One route serves them in `x dev` and the container. The sync worker is
5
+ // `@ultimat3/realtime/sync-worker` (slice 11); the page boot is `@ultimat3/realtime/boot` — the
6
+ // disk restore and the outbox, once per page instead of once per island. A new deploy is a new URL,
7
+ // so an old tab keeps what it started with.
6
8
 
7
9
  // why: Bun ships no path API; the entry is resolved to a file and named in the cause.
8
10
  import { dirname, join, relative } from 'node:path';
@@ -10,6 +10,8 @@
10
10
  // public subject. `isReExportManifest` is the whole carve-out — one statement of logic in such a
11
11
  // file re-arms the ceiling on the same save, which is what keeps it from being a hole.
12
12
 
13
+ // why: a published `files` entry is often a DIRECTORY, which `Bun.file().exists()` answers false
14
+ // for; `readFileSync` fills a sources map inside one glob walk. Bun ships no path API either.
13
15
  import { existsSync, readFileSync } from 'node:fs';
14
16
  import { join } from 'node:path';
15
17
  import { ERROR_DOCS_URL, renderCauseValue } from '@ultimat3/core';
@@ -24,6 +26,7 @@ import {
24
26
  mayReachFixture,
25
27
  } from './publish-closure';
26
28
  import { isReExportManifest } from './reexport-manifest';
29
+ import { quoteArg } from './shell-quote';
27
30
  import { eachSourceFile, isGenerated } from './source-files';
28
31
  import type { ShippedPackage } from './test-only-shipped';
29
32
  import { checkTestOnlyShipped, entryPatternsOf } from './test-only-shipped';
@@ -98,7 +101,7 @@ export const missingFileFinding = (dir: string, file: string, scaffolder: boolea
98
101
  code: 'X_PACKAGE_SHAPE',
99
102
  cause: `packages/${dir} has no ${file}`,
100
103
  fix: scaffolder
101
- ? `bun run scripts/new-package.ts ${dir} --only ${file}`
104
+ ? `bun run scripts/new-package.ts ${quoteArg(dir)} --only ${quoteArg(file)}`
102
105
  : `add packages/${dir}/${file}, shaped like the one in a sibling package`,
103
106
  docs: ERROR_DOCS_URL,
104
107
  at: `packages/${dir}/${file}`,
@@ -153,7 +156,7 @@ export const PUBLISHED_DEP_FIELDS = [
153
156
  export const versionSkewFinding = (dir: string, found: string, expected: string): Finding => ({
154
157
  code: 'X_RELEASE_VERSION_SKEW',
155
158
  cause: `packages/${dir} is at ${found}, not the lockstep version ${expected}`,
156
- fix: `bun run scripts/release.ts --version ${expected}`,
159
+ fix: `bun run scripts/release.ts --version ${quoteArg(expected)}`,
157
160
  docs: ERROR_DOCS_URL,
158
161
  at: `packages/${dir}/package.json`,
159
162
  });
@@ -166,7 +169,7 @@ export const pinSkewFinding = (
166
169
  ): Finding => ({
167
170
  code: 'X_RELEASE_VERSION_SKEW',
168
171
  cause: `packages/${dir} pins ${dep} at ${range}, not the lockstep version ${expected}`,
169
- fix: `bun run scripts/release.ts --version ${expected}`,
172
+ fix: `bun run scripts/release.ts --version ${quoteArg(expected)}`,
170
173
  docs: ERROR_DOCS_URL,
171
174
  at: `packages/${dir}/package.json`,
172
175
  });
@@ -97,11 +97,13 @@ export const undeclaredExternalDepFinding = (
97
97
  // package across the app, rather than whatever the registry calls latest today.
98
98
  const pinned = range === undefined ? dependency : `${dependency}@${range}`;
99
99
  const spec = renderFixShellArg(pinned, '') === '' ? dependency : pinned;
100
- const dev = at.endsWith(FIXTURE_SUFFIX) ? ' --dev' : '';
100
+ const dev = at.endsWith(FIXTURE_SUFFIX);
101
+ const added = renderFixShellArg(spec, '<the package>');
102
+ const cwd = renderFixShellArg(owner.dir, '<the workspace directory>');
101
103
  return {
102
104
  code: 'X_WORKSPACE_EXTERNAL_DEP_UNDECLARED',
103
105
  cause: `${at} imports ${dependency}, which neither ${owner.dir}/package.json nor the root package.json declares — it resolves only while another workspace's copy is hoisted`,
104
- fix: `bun add ${renderFixShellArg(spec, '<the package>')}${dev} --cwd ${renderFixShellArg(owner.dir, '<the workspace directory>')}`,
106
+ fix: dev ? `bun add ${added} --dev --cwd ${cwd}` : `bun add ${added} --cwd ${cwd}`,
105
107
  docs: ERROR_DOCS_URL,
106
108
  at: `${owner.dir}/package.json`,
107
109
  };
@@ -3,8 +3,9 @@
3
3
  // second is covered by the first, with no unused framework sibling declarations. A tsconfig-only
4
4
  // edge resolves for `tsc` but is invisible to bun, `--filter` ordering and change-detection tools.
5
5
 
6
+ // why: Bun ships no path API; `join` builds the host-separator path to each workspace manifest.
6
7
  import { join } from 'node:path';
7
- import { ERROR_DOCS_URL, maskLiterals } from '@ultimat3/core';
8
+ import { ERROR_DOCS_URL, maskLiterals, trimTrailingSlashes } from '@ultimat3/core';
8
9
  import { CATALOG_PACKAGES } from './error-catalog';
9
10
  import { scanAllImports } from './import-scan';
10
11
  import type { Finding } from './output';
@@ -78,10 +79,10 @@ export async function workspaceManifestPaths(
78
79
  ): Promise<readonly string[]> {
79
80
  const excluded = globs
80
81
  .filter((glob) => glob.startsWith('!'))
81
- .map((glob) => new Bun.Glob(glob.slice(1).replace(/\/+$/, '')));
82
+ .map((glob) => new Bun.Glob(trimTrailingSlashes(glob.slice(1))));
82
83
  const found = new Set<string>();
83
84
  for (const glob of globs.filter((candidate) => !candidate.startsWith('!'))) {
84
- const manifests = new Bun.Glob(`${glob.replace(/\/+$/, '')}/package.json`);
85
+ const manifests = new Bun.Glob(`${trimTrailingSlashes(glob)}/package.json`);
85
86
  for await (const path of manifests.scan({ cwd: root, absolute: false })) {
86
87
  const manifest = path.replaceAll('\\', '/');
87
88
  const dir = manifest.slice(0, -'/package.json'.length);
package/src/write-line.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // pair the note below rules out. fd 2 exists because fd 1 is not always a log: under
4
4
  // `x mcp serve --transport stdio` it is the protocol, under `--json` one document a caller parses.
5
5
 
6
- // `node:fs`, and unavoidable: Bun has no synchronous stdout write of its own.
6
+ // why: `node:fs`, and unavoidable: Bun has no synchronous stdout write of its own.
7
7
  import { writeSync } from 'node:fs';
8
8
  // The one import beyond `node:fs`, and it costs nothing here: `create-ultimate` reaches this
9
9
  // module through `@ultimat3/cli`'s barrel, which has already evaluated core.