@ultimat3/cli 31.35.0 → 31.36.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 (49) hide show
  1. package/package.json +29 -29
  2. package/src/affected.ts +3 -1
  3. package/src/async-pages.ts +1 -1
  4. package/src/cdp-shot-errors.ts +4 -4
  5. package/src/cmd-deploy-helm.ts +1 -1
  6. package/src/cmd-env.ts +1 -1
  7. package/src/cmd-mcp.ts +5 -3
  8. package/src/coverage-floor.ts +5 -4
  9. package/src/db-subscribes.ts +2 -3
  10. package/src/db-ungeneratable.ts +3 -3
  11. package/src/dev-lock.ts +1 -1
  12. package/src/dev-supervisor.ts +1 -1
  13. package/src/doctor-database.ts +5 -4
  14. package/src/doctor-offline.ts +5 -2
  15. package/src/document-styles.ts +1 -1
  16. package/src/error-contract.ts +8 -6
  17. package/src/exec.ts +3 -2
  18. package/src/fix-sequence.ts +1 -14
  19. package/src/flag-reads.ts +4 -1
  20. package/src/generate-grant-findings.ts +14 -4
  21. package/src/generate-write.ts +1 -1
  22. package/src/gh.ts +1 -1
  23. package/src/guards.ts +2 -2
  24. package/src/handle-registration.ts +4 -3
  25. package/src/hold.ts +1 -1
  26. package/src/i18n-index.ts +1 -1
  27. package/src/island-capture.ts +1 -1
  28. package/src/island-harness-route.ts +1 -1
  29. package/src/island-routes.ts +1 -1
  30. package/src/island-shot-errors.ts +2 -2
  31. package/src/job-registration.ts +1 -1
  32. package/src/live-routes.ts +8 -7
  33. package/src/mcp-host-shell.ts +1 -1
  34. package/src/mcp-ui.ts +1 -1
  35. package/src/measure-paths.ts +1 -1
  36. package/src/permission-grants.ts +1 -1
  37. package/src/publish-closure.ts +2 -1
  38. package/src/role-load.ts +1 -1
  39. package/src/role-realtime.ts +1 -1
  40. package/src/runtime-cache.ts +2 -2
  41. package/src/runtime-storage-boot.ts +2 -2
  42. package/src/style-routes.ts +1 -1
  43. package/src/tsconfig-references.ts +1 -1
  44. package/src/verify-role-load.ts +1 -1
  45. package/src/worker-bundle.ts +1 -1
  46. package/src/workspace-checks.ts +11 -7
  47. package/src/workspace-graph.ts +2 -2
  48. package/wiki/CLI-Reference.md +2 -2
  49. package/wiki/Queries-And-Live-Queries.md +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/cli",
3
- "version": "31.35.0",
3
+ "version": "31.36.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.35.0",
57
- "@ultimat3/admin": "31.35.0",
58
- "@ultimat3/ai": "31.35.0",
59
- "@ultimat3/auth": "31.35.0",
60
- "@ultimat3/cache": "31.35.0",
61
- "@ultimat3/core": "31.35.0",
62
- "@ultimat3/db": "31.35.0",
63
- "@ultimat3/entity": "31.35.0",
64
- "@ultimat3/flags": "31.35.0",
65
- "@ultimat3/http": "31.35.0",
66
- "@ultimat3/i18n": "31.35.0",
67
- "@ultimat3/jobs": "31.35.0",
68
- "@ultimat3/mail": "31.35.0",
69
- "@ultimat3/manifest": "31.35.0",
70
- "@ultimat3/mcp": "31.35.0",
71
- "@ultimat3/money": "31.35.0",
72
- "@ultimat3/notify": "31.35.0",
73
- "@ultimat3/policy": "31.35.0",
74
- "@ultimat3/pwa": "31.35.0",
75
- "@ultimat3/query": "31.35.0",
76
- "@ultimat3/realtime": "31.35.0",
77
- "@ultimat3/render": "31.35.0",
78
- "@ultimat3/schema": "31.35.0",
79
- "@ultimat3/scraping": "31.35.0",
80
- "@ultimat3/seo": "31.35.0",
81
- "@ultimat3/storage": "31.35.0",
82
- "@ultimat3/testing": "31.35.0",
83
- "@ultimat3/time": "31.35.0",
56
+ "@ultimat3/action": "31.36.0",
57
+ "@ultimat3/admin": "31.36.0",
58
+ "@ultimat3/ai": "31.36.0",
59
+ "@ultimat3/auth": "31.36.0",
60
+ "@ultimat3/cache": "31.36.0",
61
+ "@ultimat3/core": "31.36.0",
62
+ "@ultimat3/db": "31.36.0",
63
+ "@ultimat3/entity": "31.36.0",
64
+ "@ultimat3/flags": "31.36.0",
65
+ "@ultimat3/http": "31.36.0",
66
+ "@ultimat3/i18n": "31.36.0",
67
+ "@ultimat3/jobs": "31.36.0",
68
+ "@ultimat3/mail": "31.36.0",
69
+ "@ultimat3/manifest": "31.36.0",
70
+ "@ultimat3/mcp": "31.36.0",
71
+ "@ultimat3/money": "31.36.0",
72
+ "@ultimat3/notify": "31.36.0",
73
+ "@ultimat3/policy": "31.36.0",
74
+ "@ultimat3/pwa": "31.36.0",
75
+ "@ultimat3/query": "31.36.0",
76
+ "@ultimat3/realtime": "31.36.0",
77
+ "@ultimat3/render": "31.36.0",
78
+ "@ultimat3/schema": "31.36.0",
79
+ "@ultimat3/scraping": "31.36.0",
80
+ "@ultimat3/seo": "31.36.0",
81
+ "@ultimat3/storage": "31.36.0",
82
+ "@ultimat3/testing": "31.36.0",
83
+ "@ultimat3/time": "31.36.0",
84
84
  "babel-preset-solid": "^1.9.16"
85
85
  }
86
86
  }
package/src/affected.ts CHANGED
@@ -22,6 +22,7 @@ import { execOutput } from './exec';
22
22
  import type { JsonValue } from './output';
23
23
  import type { ParsedArgs } from './parse';
24
24
  import { flagBool, flagString } from './parse';
25
+ import { quoteArg } from './shell-quote';
25
26
  import type { WorkspaceNode } from './workspace-graph';
26
27
  import { readWorkspaceGraph } from './workspace-graph';
27
28
 
@@ -274,7 +275,8 @@ export async function changedFiles(
274
275
  throw new UltimateError({
275
276
  code: 'X_CLI_UNEXPECTED',
276
277
  cause: `"${failed.command.join(' ')}" exited ${failed.code} in ${options.cwd}: ${singleLine(execOutput(failed))}`,
277
- fix: `run it yourself to see why: ${failed.command.join(' ')}`,
278
+ // Every run above is `git(…)`, so its head is always `git`: the fix opens with it and quotes the rest.
279
+ fix: `git -C ${quoteArg(options.cwd)} ${quoteArg(failed.command.slice(1))} # run it yourself to see why`,
278
280
  });
279
281
  }
280
282
  return [...new Set(runs.flatMap((run) => paths(run.stdout)))].sort();
@@ -17,7 +17,7 @@ export function asyncPageFinding(file: string): Finding {
17
17
  return {
18
18
  code: 'X_ROUTE_ASYNC_PAGE',
19
19
  cause: `${file} exports an async Page, so its data read bypasses load's caching and meta`,
20
- fix: `in ${file}: move each await in Page into export const load = (ctx) => …, and read it with the page's data prop`,
20
+ fix: `export const load = (ctx) => … // in ${file}: move each await in Page here, and read it with the page's data prop`,
21
21
  at: file,
22
22
  };
23
23
  }
@@ -5,7 +5,7 @@
5
5
  // host it may open, which element it was pointed at, and which key it was asked to press. Their
6
6
  // codes and titles are registered with every other CLI code, in `error-codes.ts` — never a second
7
7
  // registration here.
8
- import { renderCauseValue, UltimateError } from '@ultimat3/core';
8
+ import { renderCauseValue, renderFixLiteral, UltimateError } from '@ultimat3/core';
9
9
 
10
10
  /** A navigation to a host the run did not allow. Refused before a byte leaves. */
11
11
  export class ShotHostRefusedError extends UltimateError {
@@ -29,7 +29,7 @@ export class ShotElementMissingError extends UltimateError {
29
29
  super({
30
30
  code: 'X_SHOT_ELEMENT_MISSING',
31
31
  cause: `nothing on ${renderCauseValue(input.url)} matched ${renderCauseValue(input.selector)} within ${String(input.timeoutMs)}ms`,
32
- fix: 'run ui.inspect on the route first and copy a selector it reports with count >= 1',
32
+ fix: '{ "route": "<the route>", "selectors": ["main", "button"] } // ui.inspect\'s input: copy a selector it reports with count >= 1',
33
33
  meta: { selector: input.selector },
34
34
  });
35
35
  }
@@ -45,7 +45,7 @@ export class ShotElementUnreadyError extends UltimateError {
45
45
  super({
46
46
  code: 'X_SHOT_ELEMENT_UNREADY',
47
47
  cause: `${renderCauseValue(input.selector)} was still ${renderCauseValue(input.problem)} after ${String(input.timeoutMs)}ms`,
48
- fix: 'run ui.inspect with the selector and "a11y": true to see what covers or disables it, then act on that element first',
48
+ fix: `{ "route": "<the route>", "selectors": [${renderFixLiteral(input.selector, '"<selector>"')}], "a11y": true } // ui.inspect's input: see what covers or disables it, then act on that element first`,
49
49
  meta: { selector: input.selector, problem: input.problem },
50
50
  });
51
51
  }
@@ -57,7 +57,7 @@ export class ShotKeyInvalidError extends UltimateError {
57
57
  super({
58
58
  code: 'X_SHOT_KEY_INVALID',
59
59
  cause: `the key chord ${renderCauseValue(input.chord)} ${input.reason}`,
60
- fix: "spell it as modifiers then one key, in the browser's names: 'Meta+K', 'Control+Enter', 'Shift+Tab', 'Escape'",
60
+ fix: "{ press: 'Meta+K' } // modifiers then one key, in the browser's names — or 'Control+Enter', 'Shift+Tab', 'Escape'",
61
61
  meta: { chord: input.chord },
62
62
  });
63
63
  }
@@ -78,7 +78,7 @@ export async function readReleaseName(root: string, flag: string | undefined): P
78
78
  : config === undefined
79
79
  ? `${root} has no app.config.ts, and x deploy --method helm names the release after its config.name`
80
80
  : 'app.config.ts exports no config.name, and x deploy --method helm names the release after it',
81
- fix: 'name the release explicitly: x deploy --method helm --release my-app --json',
81
+ fix: 'x deploy --method helm --release my-app --json # names the release explicitly',
82
82
  });
83
83
  }
84
84
 
package/src/cmd-env.ts CHANGED
@@ -33,7 +33,7 @@ export class EnvSchemaMissingError extends UltimateError {
33
33
  super({
34
34
  code: 'X_CONFIG_INVALID',
35
35
  cause: `x env ${input.subcommand} needs the env declaration, and app.config.ts exports no "envSchema"`,
36
- fix: "add to app.config.ts: export const envSchema = { DATABASE_URL: { type: 'url', description: 'Postgres connection URL' } } satisfies EnvSchema; export const env = defineEnv(envSchema);",
36
+ fix: "export const envSchema = { DATABASE_URL: { type: 'url', description: 'Postgres connection URL' } } satisfies EnvSchema; export const env = defineEnv(envSchema); // in app.config.ts",
37
37
  });
38
38
  }
39
39
  }
package/src/cmd-mcp.ts CHANGED
@@ -27,6 +27,7 @@ import { msg } from './messages';
27
27
  import { isAddressInUse } from './metrics-endpoint';
28
28
  import type { CommandResult } from './output';
29
29
  import { flagString } from './parse';
30
+ import { quoteArg } from './shell-quote';
30
31
 
31
32
  const TRANSPORTS = ['stdio', 'http'] as const;
32
33
  type Transport = (typeof TRANSPORTS)[number];
@@ -61,12 +62,13 @@ async function catalog(host: CliMcpServer): Promise<CommandResult> {
61
62
  };
62
63
  }
63
64
 
64
- const notFound = (path: string): Response =>
65
+ /** `endpoint` is where this server IS reached, as `mcpHostRefused` is handed it. */
66
+ const notFound = (endpoint: string): Response =>
65
67
  new Response(
66
68
  JSON.stringify({
67
69
  code: 'X_MCP_PROTOCOL',
68
70
  cause: 'the MCP server answers exactly one route',
69
- fix: `POST ${path} with an Authorization: Bearer header`,
71
+ fix: `curl -sS -X POST ${quoteArg(endpoint)} -H 'authorization: Bearer <the token x mcp serve printed>' -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'`,
70
72
  }),
71
73
  { status: 404, headers: { 'content-type': 'application/json' } },
72
74
  );
@@ -128,7 +130,7 @@ export async function startMcpHttp(host: CliMcpServer, port: number): Promise<Mc
128
130
  // Before anything else, as `/_x` does: this server serves this machine, and a rebound name
129
131
  // reaches it with a Host and an Origin that agree, which no Origin rule can tell apart.
130
132
  if (!isLoopbackHostname(url.hostname)) return mcpHostRefused(endpoint);
131
- if (url.pathname !== route.path) return notFound(route.path);
133
+ if (url.pathname !== route.path) return notFound(endpoint);
132
134
  // `@ultimat3/http`'s own 405, the one the pipeline answers on an app's mounted `/mcp`.
133
135
  if (request.method !== route.method) {
134
136
  return jsonResponse(toProblem(methodNotAllowed(request.method, route.path, ['POST'])), {
@@ -244,7 +244,7 @@ export function coverageFindings(
244
244
  {
245
245
  code: 'X_COVERAGE_FLOOR_UNSTATED',
246
246
  cause: `${FLOOR_FILE} states no coverage floor; the unit suite covers ${measured} of this app's own source (${String(measure.files)} files, one no test loads counted at 0%)`,
247
- fix: `edit ${FLOOR_FILE} — add ${floorLine(measure)}`,
247
+ fix: `{ ${floorLine(measure)} } // in ${FLOOR_FILE}, beside its other keys`,
248
248
  docs: ERROR_DOCS_URL,
249
249
  at: FLOOR_FILE,
250
250
  },
@@ -257,7 +257,7 @@ export function coverageFindings(
257
257
  findings.push({
258
258
  code: 'X_COVERAGE_FLOOR_UNSTATED',
259
259
  cause: `${FLOOR_FILE} states a coverage floor of ${stated}, under the ${String(COVERAGE_BAR)}% bar, and no reason for it`,
260
- fix: `edit ${FLOOR_FILE} — add "why": "${WHY_PLACEHOLDER}" inside "${COVERAGE_FIELD}", or raise both numbers to ${String(COVERAGE_BAR)}`,
260
+ fix: `{ "${COVERAGE_FIELD}": { "why": "${WHY_PLACEHOLDER}" } } // in ${FLOOR_FILE}, beside its numbers — or raise both numbers to ${String(COVERAGE_BAR)}`,
261
261
  docs: ERROR_DOCS_URL,
262
262
  at: FLOOR_FILE,
263
263
  });
@@ -282,7 +282,8 @@ export function coverageFindings(
282
282
  : options.exists(test)
283
283
  ? // Quoted: a route directory is `[id]`, which a shell reads as a glob.
284
284
  `bun test --coverage ${quoteArg(test)}`
285
- : `edit ${test} — no test sits beside ${first?.file ?? test}; write one that fails when the source is broken, then: bun test --coverage ${quoteArg(test)}`,
285
+ : // Line 1 is real: the file does not exist yet, so the edit starts it.
286
+ `edit ${test}:1 — no test sits beside ${first?.file ?? test}; write one that fails when the source is broken, then: bun test --coverage ${quoteArg(test)}`,
286
287
  docs: ERROR_DOCS_URL,
287
288
  ...(first === undefined ? {} : { at: first.file }),
288
289
  });
@@ -297,7 +298,7 @@ export function coverageFindings(
297
298
  findings.push({
298
299
  code: 'X_COVERAGE_FLOOR_STALE',
299
300
  cause: `the unit suite now covers ${measured}, more than ${String(FLOOR_SLACK)} points over the floor of ${stated} in ${FLOOR_FILE} — the floor only rises`,
300
- fix: `edit ${FLOOR_FILE} — set "lines": ${String(lines)} and "funcs": ${String(funcs)} inside "${COVERAGE_FIELD}"${cleared ? ', and delete its "why"' : ''}`,
301
+ fix: `{ "${COVERAGE_FIELD}": { "lines": ${String(lines)}, "funcs": ${String(funcs)} } } // in ${FLOOR_FILE}, set inside "${COVERAGE_FIELD}"${cleared ? ', and delete its "why"' : ''}`,
301
302
  docs: ERROR_DOCS_URL,
302
303
  at: FLOOR_FILE,
303
304
  });
@@ -45,9 +45,8 @@ export class QuerySubscribesUnknownError extends UltimateError {
45
45
  `the query "${input.query}" declares subscribes: ["${input.table}"] and no entity ` +
46
46
  'declares a table with that name',
47
47
  fix:
48
- `edit subscribes: on the query "${input.query}" to name a table this app declares ` +
49
- `(${offer(input.tables)}), or drop the name, then x db gen "fix subscribes" --json — a ` +
50
- 'name no table has can never match what the read selects from (X_QUERY_SUBSCRIBES_DRIFT)',
48
+ // One literal: the scan reads each piece of a `+` chain as its own fix line.
49
+ `subscribes: ['<table>'] // on the query "${input.query}", a table this app declares (${offer(input.tables)}) — or drop the name, then x db gen "fix subscribes" --json; a name no table has can never match what the read selects from (X_QUERY_SUBSCRIBES_DRIFT)`,
51
50
  meta: { query: input.query, table: input.table },
52
51
  });
53
52
  }
@@ -86,9 +86,9 @@ export class MigrationUngeneratableError extends UltimateError {
86
86
  `${input.file} holds ${found} statement${found === 1 ? '' : 's'} x db gen could not have ` +
87
87
  `written and declares ${input.declared}${first}`,
88
88
  fix:
89
- `add the header line "${ungeneratableMarker(found)}" to ${input.file}, so a squash carries ` +
90
- 'these statements by hand — or re-declare what an entity can express (an enum is a text ' +
91
- 'column plus a check invariant) and regenerate: x db gen "<name>"',
89
+ // Line 1 is real: the header is whatever precedes the first statement, so it may open there.
90
+ // One literal: the scan reads each piece of a `+` chain as its own fix line.
91
+ `edit ${input.file}:1 — add the header line "${ungeneratableMarker(found)}", so a squash carries these statements by hand — or re-declare what an entity can express (an enum is a text column plus a check invariant) and regenerate: x db gen "<name>"`,
92
92
  });
93
93
  }
94
94
  }
package/src/dev-lock.ts CHANGED
@@ -130,7 +130,7 @@ export class DevAlreadyRunningError extends UltimateError {
130
130
  code: 'X_DEV_ALREADY_RUNNING',
131
131
  cause: `pid ${input.lock.pid} is already running x dev on ${input.lock.url} and holds ${input.stateDir}${single}`,
132
132
  // `x stop`, not `kill <pid>`: a kill returns before the drain ends and the next boot refuses.
133
- fix: `use the one already running at ${input.lock.url}, or stop it: x stop --json`,
133
+ fix: `x stop --json # or use the one already running at ${input.lock.url}`,
134
134
  meta: { pid: input.lock.pid, port: input.lock.port, stateDir: input.stateDir },
135
135
  });
136
136
  }
@@ -232,7 +232,7 @@ export function restartFinding(root: string, pins: readonly StalePin[]): Finding
232
232
  return {
233
233
  code: 'X_DEV_RESTART_REQUIRED',
234
234
  cause: `${restartReason(root, pins)} — a module that defines a primitive still holds the code before the save, and re-importing it would register a second definition`,
235
- fix: 'restart x dev (a supervised `x dev` restarts itself; an embedded startDev() passes onRestart)',
235
+ fix: 'x stop --json && x dev # restart it — a supervised `x dev` restarts itself; an embedded startDev() passes onRestart',
236
236
  at: first === undefined ? '' : posixRelative(root, first.pinned),
237
237
  };
238
238
  }
@@ -5,7 +5,7 @@
5
5
  import { existsSync } from 'node:fs';
6
6
  import { dirname, join, resolve, sep } from 'node:path';
7
7
  import { ERROR_DOCS_URL } from '@ultimat3/core';
8
- import { checkDb, PGLITE_FIX, PGLITE_MISSING, postgresClient } from '@ultimat3/db';
8
+ import { checkDb, dbUnavailable, PGLITE_FIX, PGLITE_MISSING, postgresClient } from '@ultimat3/db';
9
9
  import type { Finding } from './output';
10
10
  import { findingFrom } from './output';
11
11
 
@@ -111,9 +111,10 @@ export async function probeDatabase(
111
111
  return finding(
112
112
  'X_DB_UNAVAILABLE',
113
113
  `DATABASE_URL does not answer \`select 1\`: ${report.error ?? 'no reason reported'}`,
114
- // `dbUnavailable`'s own two branches, verbatim: a second wording for one condition is two
115
- // answers to "what do I do", and this one is reached first, before any command opens a pool.
116
- 'set DATABASE_URL to a reachable Postgres url, or run `x dev` to use the embedded PGlite',
114
+ // `dbUnavailable`'s own fix, read off it rather than copied: a second wording for one condition
115
+ // is two answers to "what do I do", and this one is reached first, before any command opens a
116
+ // pool. A copy drifted once already.
117
+ dbUnavailable('').fix,
117
118
  );
118
119
  } finally {
119
120
  await client.close();
@@ -90,7 +90,7 @@ export function offlineFallbackFinding(fact: OfflineFallbackFact): Finding | und
90
90
  if (fallback === null) {
91
91
  return finding(
92
92
  'no pwa.offline.fallback is declared, so no service worker is emitted and an offline navigation falls back to the browser error page',
93
- `set pwa: { offline: { fallback: '/offline' } } in ${APP_CONFIG_FILE}`,
93
+ `pwa: { offline: { fallback: '/offline' } } // in ${APP_CONFIG_FILE}`,
94
94
  );
95
95
  }
96
96
  if (fact.routes.some((route) => route.path === fallback && NAVIGABLE.has(route.surface))) {
@@ -99,7 +99,10 @@ export function offlineFallbackFinding(fact: OfflineFallbackFact): Finding | und
99
99
  const cause = `pwa.offline.fallback is "${fallback}" and no site/ route serves it, so an offline navigation falls back to the browser error page`;
100
100
  const name = GENERATABLE.exec(fallback)?.[1];
101
101
  return name === undefined
102
- ? finding(cause, `set pwa.offline.fallback in ${APP_CONFIG_FILE} to a path a route serves`)
102
+ ? finding(
103
+ cause,
104
+ `pwa: { offline: { fallback: '<a path a site/ route serves>' } } // in ${APP_CONFIG_FILE}`,
105
+ )
103
106
  : finding(cause, `x g route ${quoteArg(name)} --surface site`);
104
107
  }
105
108
 
@@ -49,7 +49,7 @@ export function checkDocumentStyles(documents: readonly SurfaceDocument[]): read
49
49
  .map((document) => ({
50
50
  code: 'X_STYLES_GLOBAL_MISSING',
51
51
  cause: `a ${document.surface}/ document carries ${document.css.length} characters of CSS and defines no :root custom properties, so every var(--color-*) and var(--space-*) in it resolves to nothing`,
52
- fix: `add apps/web/${APP_GLOBAL_STYLESHEET} containing \`@use '@ultimat3/ui/global.scss';\` and apps/web/${APP_GLOBAL_MODULE} containing \`import './global.scss';\``,
52
+ fix: `import './global.scss'; // as apps/web/${APP_GLOBAL_MODULE}, beside apps/web/${APP_GLOBAL_STYLESHEET} holding @use '@ultimat3/ui/global.scss';`,
53
53
  docs: ERROR_DOCS_URL,
54
54
  at: `apps/web/${APP_GLOBAL_STYLESHEET}`,
55
55
  }));
@@ -14,6 +14,7 @@ import { createHelperResolver } from './fix-imports';
14
14
  import { citedPathProblem, FILE_TOKEN_PATTERN } from './fix-path';
15
15
  import { scanFixSites } from './fix-scan';
16
16
  import type { Finding } from './output';
17
+ import { quoteArg } from './shell-quote';
17
18
  import { eachSourceFile, isGenerated, isTest } from './source-files';
18
19
  import type { CodeSite, FixSite, UnresolvedCodeSite } from './ts-scan';
19
20
  import { isCodeRegistry, scanBorrowedCodes, scanCodeDeclarations, scanCodes } from './ts-scan';
@@ -72,7 +73,7 @@ export function fixProblem(raw: string): string | undefined {
72
73
  const fixFinding = (site: FixSite, problem: string): Finding => ({
73
74
  code: 'X_ERROR_FIX_INVALID',
74
75
  cause: problem,
75
- fix: `rewrite the fix at ${site.at}:${site.line} as a command to run, a call to paste, or an edit naming a file`,
76
+ fix: `edit ${site.at}:${site.line} — rewrite the fix as a command to run, a call to paste, or an edit naming a file`,
76
77
  docs: ERROR_DOCS_URL,
77
78
  at: `${site.at}:${site.line}`,
78
79
  });
@@ -85,7 +86,7 @@ const fixFinding = (site: FixSite, problem: string): Finding => ({
85
86
  const pathFinding = (site: FixSite, problem: string): Finding => ({
86
87
  code: 'X_ERROR_FIX_PATH_MISSING',
87
88
  cause: `the fix at ${site.at}:${site.line} ${problem}`,
88
- fix: `correct the path in the fix at ${site.at}:${site.line} to one this repo holds, or create the file it names`,
89
+ fix: `edit ${site.at}:${site.line} — correct the path in the fix to one this repo holds, or create the file it names`,
89
90
  docs: ERROR_DOCS_URL,
90
91
  at: `${site.at}:${site.line}`,
91
92
  });
@@ -258,7 +259,7 @@ export const documentedCodes = (markdown: string): ReadonlySet<string> =>
258
259
  const undocumentedFinding = (code: string, at: string, line: number, page: string): Finding => ({
259
260
  code: 'X_ERROR_CODE_UNDOCUMENTED',
260
261
  cause: `${code} is declared at ${at}:${line} and no error reference page has an entry for it`,
261
- fix: `add a row for ${code} to ${page}, with its cause and the command that fixes it`,
262
+ fix: `x errors explain ${quoteArg(code)} --json # its title and fix: add a row for ${code} to ${page}, with its cause and the command that fixes it`,
262
263
  docs: ERROR_DOCS_URL,
263
264
  at: page,
264
265
  });
@@ -307,7 +308,7 @@ export async function readLegacyPage(
307
308
  const unregisteredFinding = (code: string, page: string, index: string): Finding => ({
308
309
  code: 'X_ERROR_CODE_UNREGISTERED',
309
310
  cause: `${page} documents ${code} as a live code and nothing registers it, so "x errors explain ${code}" refuses a code this page promises`,
310
- fix: `register ${code} through registerErrorCodes() in its package's src/errors.ts, or move its row under "${RESERVED_HEADING}" in ${index}`,
311
+ fix: `registerErrorCodes({ ${code}: { title: '<what it means>' } }) // in its package's src/errors.ts — or move its row under "${RESERVED_HEADING}" in ${index}`,
311
312
  docs: ERROR_DOCS_URL,
312
313
  at: page,
313
314
  });
@@ -400,7 +401,7 @@ export async function collectDeclaredCodes(root: string): Promise<readonly CodeS
400
401
  const unresolvedCodeFinding = (site: UnresolvedCodeSite): Finding => ({
401
402
  code: 'X_ERROR_CODE_UNRESOLVED',
402
403
  cause: `the code at ${site.at}:${site.line} is the name ${site.name}, and no module-scope const in that file gives it a value — so the manifest, the reference page and "x errors explain" are all blind to whatever code it holds`,
403
- fix: `write the X_* code as a string literal at ${site.at}:${site.line}, or declare it as a module-scope const in that same file`,
404
+ fix: `edit ${site.at}:${site.line} — write the X_* code as a string literal, or declare it as a module-scope const in that same file`,
404
405
  docs: ERROR_DOCS_URL,
405
406
  at: `${site.at}:${site.line}`,
406
407
  });
@@ -467,7 +468,8 @@ export async function checkErrorCodeDocs(root: string, page: string): Promise<re
467
468
  {
468
469
  code: 'X_ERROR_CODE_UNDOCUMENTED',
469
470
  cause: `the error reference ${page} does not exist, so no code can be documented`,
470
- fix: `create ${page} with a row per X_* code, or stop naming it as the error reference`,
471
+ // Line 1 is real: the page does not exist, so the edit starts it.
472
+ fix: `edit ${page}:1 — create it with a row per X_* code, or stop naming it as the error reference`,
471
473
  docs: ERROR_DOCS_URL,
472
474
  at: page,
473
475
  },
package/src/exec.ts CHANGED
@@ -99,7 +99,8 @@ function spawnOrRefuse(command: readonly string[], options: ExecOptions) {
99
99
  throw new UltimateError({
100
100
  code: 'X_CLI_UNEXPECTED',
101
101
  cause: `the CLI could not run "${head}" from ${options.cwd}: ${renderThrowable(error)}`,
102
- fix: `install ${quoteArg(head)} and put it on PATH, then re-run — confirm with: command -v ${quoteArg(head)}`,
102
+ // `Bun.which`, not `command -v`: the one lookup this process ran, and a word every shell runs.
103
+ fix: `bun --print ${quoteArg(`Bun.which(${JSON.stringify(head)})`)} # null: install ${quoteArg(head)} and put it on PATH, then re-run`,
103
104
  });
104
105
  }
105
106
  }
@@ -114,7 +115,7 @@ export const exec: Runner = async (command, options) => {
114
115
  throw new UltimateError({
115
116
  code: 'X_CLI_UNEXPECTED',
116
117
  cause: 'exec() was called with an empty command, so there is no program to spawn',
117
- fix: 'pass the program as the first element: exec(["bun", "test"], { cwd })',
118
+ fix: 'exec(["bun", "test"], { cwd }) // the program as the first element',
118
119
  });
119
120
  }
120
121
  const proc = spawnOrRefuse([head, ...rest], options);
@@ -54,6 +54,7 @@ export function generatorForceProblem(fix: string): string | undefined {
54
54
  * `packages/docs-source/src/errors.ts` is the one app entry). A file at or under its count passes;
55
55
  * one past it, or any file not listed — every app's — is a finding at each of its refused lines.
56
56
  * Held EQUAL to the step's counts by `fix-sequence.test.ts`: rewrite a line, lower its entry.
57
+ * 2026-11-16 (sweep 8b-4): 30 lines in 23 files — `scripts/` rewritten edit-first, none left.
57
58
  */
58
59
  export const FIX_SEQUENCE_BASELINE: ReadonlyMap<string, number> = new Map([
59
60
  ['packages/cli/src/cmd-client-customer.ts', 1],
@@ -71,8 +72,6 @@ export const FIX_SEQUENCE_BASELINE: ReadonlyMap<string, number> = new Map([
71
72
  ['packages/db/src/lifecycle-errors.ts', 1],
72
73
  ['packages/db/src/primary-key.ts', 1],
73
74
  ['packages/docs-source/src/errors.ts', 4],
74
- ['packages/entity/src/partition.ts', 1],
75
- ['packages/entity/src/retain.ts', 1],
76
75
  ['packages/jobs/src/subject-errors.ts', 1],
77
76
  ['packages/mail/src/preview-check.ts', 1],
78
77
  ['packages/mcp/src/meta-errors.ts', 1],
@@ -81,16 +80,4 @@ export const FIX_SEQUENCE_BASELINE: ReadonlyMap<string, number> = new Map([
81
80
  ['packages/seo/src/errors.ts', 1],
82
81
  ['packages/testing/src/exercise-override-input.ts', 1],
83
82
  ['packages/testing/src/plan-sweep-report.ts', 4],
84
- ['scripts/adapter-ports.ts', 4],
85
- ['scripts/bench-claims.ts', 1],
86
- ['scripts/budget-raises.ts', 1],
87
- ['scripts/declaration-readers-callers.ts', 2],
88
- ['scripts/factory-names.ts', 2],
89
- ['scripts/instrument-slots.ts', 1],
90
- ['scripts/lib/export-all.ts', 1],
91
- ['scripts/new-error-code.ts', 1],
92
- ['scripts/plan-status.ts', 3],
93
- ['scripts/posix-relative.ts', 1],
94
- ['scripts/set-cookie-literals.ts', 2],
95
- ['scripts/sql-export-readers.ts', 1],
96
83
  ]);
package/src/flag-reads.ts CHANGED
@@ -62,7 +62,10 @@ const declaresFlag = (text: string, name: string): boolean =>
62
62
  const unreadFinding = (declared: DeclaredFlag, at: string): Finding => ({
63
63
  code: 'X_CLI_FLAG_UNREAD',
64
64
  cause: `x ${declared.command} declares --${declared.flag.name} ("${declared.flag.summary}") and no file in the CLI's source reads it, so the flag parses and changes nothing`,
65
- fix: `read it in ${at} with flag${declared.flag.type === 'boolean' ? 'Bool' : 'String'}(ctx.args, '${declared.flag.name}'), or delete it from the spec's flags`,
65
+ fix:
66
+ declared.flag.type === 'boolean'
67
+ ? `flagBool(ctx.args, '${declared.flag.name}') // read it in ${at} — or delete it from the spec's flags`
68
+ : `flagString(ctx.args, '${declared.flag.name}') // read it in ${at} — or delete it from the spec's flags`,
66
69
  docs: ERROR_DOCS_URL,
67
70
  at,
68
71
  });
@@ -16,15 +16,25 @@ import {
16
16
  import type { Finding } from './output';
17
17
  import { ROLES_FILE } from './permission-grants';
18
18
 
19
- /** `member: 'run:read'; admin: 'run:write', 'runs:read'` — each role, and what its `grants` owes. */
20
- const linesFor = (grants: readonly RoleGrant[]): string => {
19
+ /** Each role, and the quoted permissions its `grants` owes, in first-seen order. */
20
+ const byRoleOf = (grants: readonly RoleGrant[]): ReadonlyMap<string, readonly string[]> => {
21
21
  const byRole = new Map<string, string[]>();
22
22
  for (const grant of grants) {
23
23
  byRole.set(grant.role, [...(byRole.get(grant.role) ?? []), `'${grant.permission}'`]);
24
24
  }
25
- return [...byRole].map(([role, permissions]) => `${role}: ${permissions.join(', ')}`).join('; ');
25
+ return byRole;
26
26
  };
27
27
 
28
+ /** `member: 'run:read'; admin: 'run:write', 'runs:read'` — each role, and what its `grants` owes. */
29
+ const linesFor = (grants: readonly RoleGrant[]): string =>
30
+ [...byRoleOf(grants)].map(([role, owed]) => `${role}: ${owed.join(', ')}`).join('; ');
31
+
32
+ /** `member: { grants: [..., 'run:read'] }` — the same, as role-map entries to merge in. */
33
+ const roleEntries = (grants: readonly RoleGrant[]): string =>
34
+ [...byRoleOf(grants)]
35
+ .map(([role, owed]) => `${role}: { grants: [..., ${owed.join(', ')}] }`)
36
+ .join(', ');
37
+
28
38
  /** The grants the role map as it stands still lacks: no such role, no `grants`, or undeclared. */
29
39
  function stillMissing(source: string, grants: readonly RoleGrant[], admin: readonly RoleGrant[]) {
30
40
  const undeclared = insertPermissions(
@@ -71,7 +81,7 @@ export async function ungrantedByGenerator(
71
81
  {
72
82
  code: 'X_PERMISSION_UNGRANTED',
73
83
  cause: `${ROLES_FILE} has no role, no "grants: [...]" list or no definePermissions([...]) these could be safely added to, so nothing granted: ${linesFor(missing)}`,
74
- fix: `edit ${ROLES_FILE} — add to each role's grants (and declare any the map does not know in definePermissions([...])) — ${linesFor(missing)} — then x verify --only policy`,
84
+ fix: `{ ${roleEntries(missing)} } // merge into the role map in ${ROLES_FILE}, declaring any the map does not know in definePermissions([...]) — then x verify --only policy`,
75
85
  at: ROLES_FILE,
76
86
  },
77
87
  ];
@@ -137,7 +137,7 @@ async function planJsonMerge(
137
137
  finding: {
138
138
  code: 'X_GENERATE_CONFLICT',
139
139
  cause: `${file.path} exists but is not a JSON object, so its keys cannot be merged`,
140
- fix: `edit ${file.path} by hand until it parses as a JSON object, or delete it and re-run x g`,
140
+ fix: `bun --print ${quoteArg(`JSON.parse(await Bun.file(${JSON.stringify(file.path)}).text())`)} # its parse error, from the app root: edit it until it is a JSON object, or delete it and re-run x g`,
141
141
  docs: ERROR_DOCS_URL,
142
142
  at: file.path,
143
143
  },
package/src/gh.ts CHANGED
@@ -44,7 +44,7 @@ export class GhUnavailableError extends UltimateError {
44
44
  super({
45
45
  code: 'X_GH_UNAVAILABLE',
46
46
  cause: `the GitHub CLI could not be run from ${input.cwd}: ${input.detail}`,
47
- fix: 'install the GitHub CLI from https://cli.github.com, then run: gh auth login',
47
+ fix: 'bun --print \'Bun.which("gh")\' # null: install the GitHub CLI from https://cli.github.com, then: gh auth login',
48
48
  });
49
49
  }
50
50
  }
package/src/guards.ts CHANGED
@@ -119,7 +119,7 @@ function findingOf(value: Record<string, unknown>, at: string): Finding {
119
119
  const failed = (path: string, cause: string): Finding => ({
120
120
  code: 'X_GUARD_FAILED',
121
121
  cause,
122
- fix: `return a finding from ${path} instead of throwing, then: x verify`,
122
+ fix: `{ code: 'X_<YOURS>', cause: '<what is wrong>', fix: '<a command or a file>' } // what ${path} returns instead of throwing — then: x verify --only boundaries --json`,
123
123
  docs: ERROR_DOCS_URL,
124
124
  at: path,
125
125
  });
@@ -160,7 +160,7 @@ const notADirectory: Finding = {
160
160
  const findingInvalid = (path: string, cause: string): Finding => ({
161
161
  code: 'X_GUARD_FINDING_INVALID',
162
162
  cause: `${path} returned a finding that is not one: ${cause}`,
163
- fix: `rewrite what ${path} returns as a code, a cause and a fix naming a command or a file, then: x verify`,
163
+ fix: `{ code: 'X_<YOURS>', cause: '<what is wrong>', fix: '<a command or a file>' } // what ${path} returns, then: x verify`,
164
164
  docs: ERROR_DOCS_URL,
165
165
  at: path,
166
166
  });
@@ -42,7 +42,8 @@ export const resolveDbModule = async (root: string): Promise<string | undefined>
42
42
  export const handleUnregisteredFinding = (entry: HandleEntry, reason: string): Finding => ({
43
43
  code: 'X_DB_HANDLE_UNREGISTERED',
44
44
  cause: `${HANDLE_FILE} ${reason}, so db.${entry.key} does not exist and the generated repo.ts does not compile`,
45
- fix: `add ${handleImportLine(entry)} and the line "${handleEntryLine(entry).trim()}" to the entity set passed to database() in ${HANDLE_FILE}`,
45
+ // Opened with the import itself: `handleImportLine`'s own text, so the two can never disagree.
46
+ fix: `import ${handleImportLine(entry).slice('import '.length)} // in ${HANDLE_FILE}, with the line "${handleEntryLine(entry).trim()}" in the entity set passed to database()`,
46
47
  docs: ERROR_DOCS_URL,
47
48
  at: HANDLE_FILE,
48
49
  });
@@ -181,7 +182,7 @@ async function indexFindings(disk: GenerateDisk, dbModule: string): Promise<read
181
182
  {
182
183
  code: 'X_DB_HANDLE_UNREGISTERED',
183
184
  cause: `${INDEX_FILE} does not export the typed handle, so "import { db } from '${dbModule}'" in the generated repo.ts is not database()'s`,
184
- fix: `add export { db, driver, selectDriver } from './client'; to ${INDEX_FILE} and drop db from its '@ultimat3/db' re-export`,
185
+ fix: `export { db, driver, selectDriver } from './client'; // in ${INDEX_FILE} — and drop db from its '@ultimat3/db' re-export`,
185
186
  docs: ERROR_DOCS_URL,
186
187
  at: INDEX_FILE,
187
188
  },
@@ -241,7 +242,7 @@ export async function registerGeneratedEntities(
241
242
  findings.push({
242
243
  code: 'X_DB_HANDLE_UNREGISTERED',
243
244
  cause: `${DB_WORKSPACE}/package.json supplies no "name", so the generated repo.ts imports the placeholder ${PLACEHOLDER_DB_MODULE}`,
244
- fix: `add "name": "@<app>/db" to ${DB_WORKSPACE}/package.json, then re-run this command with --force`,
245
+ fix: `{ "name": "@<app>/db" } // in ${DB_WORKSPACE}/package.json, then re-run this command with --force`,
245
246
  docs: ERROR_DOCS_URL,
246
247
  at: `${DB_WORKSPACE}/package.json`,
247
248
  });
package/src/hold.ts CHANGED
@@ -229,7 +229,7 @@ async function releaseWithin(
229
229
  // Rounded: `deadlineAt - monotonic()` is a float, and `4923.185900000001ms` in a shutdown
230
230
  // log reads as a bug in the number rather than as the budget it is.
231
231
  cause: `the "${name}" release was still running ${Math.round(budgetMs)}ms after the drain finished and has been ABANDONED — the process exits without it, so anything it held may not be closed`,
232
- fix: 'raise the budget past the slowest teardown — configureLifecycle({ deadlineMs: 600_000 }) for a 10-minute one — and set terminationGracePeriodSeconds to at least as many seconds',
232
+ fix: 'configureLifecycle({ deadlineMs: 600_000 }) // a budget past the slowest teardown, 10 minutes here — and set terminationGracePeriodSeconds to at least as many seconds',
233
233
  });
234
234
  return false;
235
235
  } finally {
package/src/i18n-index.ts CHANGED
@@ -99,6 +99,6 @@ function withLocales(source: string, locales: readonly string[]): string | undef
99
99
  const refusal = (locales: readonly string[]): Finding => ({
100
100
  code: 'X_CATALOG_UNREGISTERED',
101
101
  cause: `${APP_CATALOGS_PATH} is hand-written in a shape this writer cannot add ${locales.join(', ')} to, so those catalogs are on disk and not selectable`,
102
- fix: `edit ${APP_CATALOGS_PATH} — add ${locales.map(localeImport).join(' ')} and ${locales.map(localeEntry).join(', ')} to the locales passed to defineCatalogs`,
102
+ fix: `defineCatalogs({ default, locales: { …, ${locales.map(localeEntry).join(', ')} } }) // in ${APP_CATALOGS_PATH}, below ${locales.map(localeImport).join(' ')}`,
103
103
  at: APP_CATALOGS_PATH,
104
104
  });
@@ -83,7 +83,7 @@ export function photographFault(
83
83
  return {
84
84
  reason:
85
85
  'was served a document that is not the shot harness — the dev server this run reused was booted against a different set of states files',
86
- fix: 'restart x dev, then run this command again',
86
+ fix: 'x stop --json && x dev # restart it against these states files, then run this command again',
87
87
  };
88
88
  }
89
89
  if (!seen.attached) {
@@ -72,7 +72,7 @@ export function islandHarnessRoutes(input: HarnessRouteInput): readonly Route[]
72
72
  if (manifest === undefined) {
73
73
  return refused(
74
74
  `this dev server declares no island states for ${address.island === '' ? '(no island named)' : address.island} — it knows ${islandStatesNames(all).join(', ') || 'none'}`,
75
- 'restart x dev, then: x shot --island <name> --json',
75
+ 'x stop --json && x dev # restart it, then: x shot --island <name> --json',
76
76
  );
77
77
  }
78
78
  // `wanted`, never a local called `state`: `bun run secret-compare` reads the NAME of a
@@ -43,7 +43,7 @@ export function islandRoutes(source: IslandSource): readonly Route[] {
43
43
  // were built at boot. `x build --target static` — which is what this said — writes
44
44
  // an export directory neither process serves from, so running it changed nothing
45
45
  // for the only two readers this line has ever had.
46
- fix: 'reload the page — this process serves only the chunks it built, and the document holding this URL came from an earlier build',
46
+ fix: 'location.reload() // in the browser — this process serves only the chunks it built, and the document holding this URL came from an earlier build',
47
47
  },
48
48
  },
49
49
  { status: 404 },
@@ -21,7 +21,7 @@ export class IslandStatesFileEmptyError extends UltimateError {
21
21
  super({
22
22
  code: 'X_SHOT_ISLAND_STATES_EMPTY',
23
23
  cause: `${renderCauseValue(input.file)} exports no defineIslandStates() result, so it declares no picture`,
24
- fix: `in ${renderFixLiteral(input.file, STATES_PLACEHOLDER)} write: export const states = defineIslandStates({ island: '…', states: [...] })`,
24
+ fix: `export const states = defineIslandStates({ island: '…', states: [...] }) // in ${renderFixLiteral(input.file, STATES_PLACEHOLDER)}`,
25
25
  });
26
26
  }
27
27
  }
@@ -66,7 +66,7 @@ export class IslandRequestUnstubbedError extends UltimateError {
66
66
  super({
67
67
  code: 'X_SHOT_ISLAND_UNSTUBBED_REQUEST',
68
68
  cause: `${input.island} in state ${renderCauseValue(input.state)} made ${input.requests.length} request(s) no stub answers: ${input.requests.join(', ')}`,
69
- fix: `in ${renderFixLiteral(input.statesFile, STATES_PLACEHOLDER)} add to that state: routes: [{ match: '${input.requests[0] ?? 'GET /api/x'}', respond: { kind: 'json', body: {} } }]`,
69
+ fix: `routes: [{ match: ${renderFixLiteral(input.requests[0], "'GET /api/x'")}, respond: { kind: 'json', body: {} } }] // on that state, in ${renderFixLiteral(input.statesFile, STATES_PLACEHOLDER)}`,
70
70
  meta: { island: input.island, state: input.state, requests: [...input.requests] },
71
71
  });
72
72
  }
@@ -29,7 +29,7 @@ export function unregisteredJobFinding(name: string): Finding {
29
29
  return {
30
30
  code: 'X_JOB_UNREGISTERED',
31
31
  cause: `${name} is a ${kind === 'tasks' ? 'task' : 'job'} no defineApi() call names, so it carries the positional name ${kind === 'tasks' ? 'task()' : 'job()'} minted — on the queue row, in the manifest and in every dead-letter trace, and it moves when the import order does`,
32
- fix: `add import * as <module> from its file and <module> to ${kind}: [...] in apps/web/api/index.ts, then x manifest`,
32
+ fix: `import * as <module> from '<its file>'; // in apps/web/api/index.ts, and <module> added to ${kind}: [...] there — then x manifest`,
33
33
  at: 'apps/web/api/index.ts',
34
34
  };
35
35
  }
@@ -14,6 +14,7 @@ import type { RouteEntry } from '@ultimat3/render';
14
14
  import { ISLAND_EXTENSION, routeEntries } from '@ultimat3/render';
15
15
  import { discoverIslands } from './island-bundle';
16
16
  import type { Finding } from './output';
17
+ import { quoteArg } from './shell-quote';
17
18
 
18
19
  /**
19
20
  * The exports that only work in a booted browser page: each one reads the page's store, its socket
@@ -161,12 +162,6 @@ export interface LiveRouteGap extends LiveReach {
161
162
  readonly islands: readonly string[];
162
163
  }
163
164
 
164
- /** The `x g island` invocation that fixes it, built from this route's own file — never a placeholder. */
165
- const generatorFor = (file: string): string => {
166
- const dir = posix.dirname(file);
167
- return `x g island ${posix.basename(dir)} --at ${dir}`;
168
- };
169
-
170
165
  /**
171
166
  * Every browser-only read a route's SERVER graph holds that no browser will ever run. A page's
172
167
  * imports are server-rendered — an island is reached by a `src` string, never an import — so a
@@ -199,6 +194,12 @@ export async function liveRouteGaps(
199
194
  return gaps;
200
195
  }
201
196
 
197
+ /**
198
+ * The `x g island` invocation that fixes it, built from this route's own file — never a
199
+ * placeholder. Each value quoted where it is spliced, so the shell-arg scan can see it.
200
+ */
201
+ const dirOf = (gap: LiveRouteGap): string => posix.dirname(gap.file);
202
+
202
203
  export const liveRouteFindingFor = (gap: LiveRouteGap): Finding => ({
203
204
  code: 'X_LIVE_ROUTE_NO_ISLAND',
204
205
  cause:
@@ -206,7 +207,7 @@ export const liveRouteFindingFor = (gap: LiveRouteGap): Finding => ({
206
207
  (gap.hydrate === 'never' ? `sits on a route declaring hydrate: 'never'` : 'no island imports') +
207
208
  ' — so it only ever runs on the server, where it answers its server state (nothing, or loading) forever, at 200',
208
209
  fix:
209
- `move it into an island: ${generatorFor(gap.file)}, import ${gap.at} from that island's mount(), and declare it with island({ src: './${posix.basename(posix.dirname(gap.file))}${ISLAND_EXTENSION}' }) in ${gap.file}` +
210
+ `x g island ${quoteArg(posix.basename(dirOf(gap)))} --at ${quoteArg(dirOf(gap))} # moves it into an island: import ${gap.at} from that island's mount(), and declare it with island({ src: './${posix.basename(posix.dirname(gap.file))}${ISLAND_EXTENSION}' }) in ${gap.file}` +
210
211
  (gap.hydrate === 'never' ? `, with a hydrate other than 'never'` : ''),
211
212
  docs: ERROR_DOCS_URL,
212
213
  at: gap.at,
@@ -54,7 +54,7 @@ export function testRunArgs(filter: string | undefined): readonly string[] {
54
54
  flag: 'filter',
55
55
  command: 'mcp serve',
56
56
  reason: `test.run's filter "${filter}" starts with "-", which x test would read as its own flag`,
57
- fix: 'call test.run with a path filter such as packages/cli/src, or with no filter',
57
+ fix: '{ "filter": "packages/cli/src" } // test.run\'s input: a path filter, or no filter at all',
58
58
  });
59
59
  }
60
60
  return ['test', '--filter', filter];
package/src/mcp-ui.ts CHANGED
@@ -73,7 +73,7 @@ export function assertBudgetedRoute(raw: string, declared: readonly DeclaredRout
73
73
  throw new UltimateError({
74
74
  code: 'X_UI_SHOT_ROUTE_UNBUDGETED',
75
75
  cause: `${hit.file} declares no budget.js, so x verify would refuse it as X_BUDGET_UNMEASURED — a picture of it would be a picture of a draft`,
76
- fix: `declare budget: { js: '<n>kb' } in ${hit.file}, then: x build --target static --json && x verify --only budgets --json`,
76
+ fix: `budget: { js: '<n>kb' } // in ${hit.file}, then: x build --target static --json && x verify --only budgets --json`,
77
77
  });
78
78
  }
79
79
  return route;
@@ -44,7 +44,7 @@ export function paramsUndeclared(entry: RouteEntry, listed: boolean): Unmeasured
44
44
  reason: cause,
45
45
  code: 'X_BUDGET_PARAMS_UNDECLARED',
46
46
  cause,
47
- fix: `add prerender: () => [{ ${example} }] to defineRoute in ${quoteArg(entry.file)}, then x build --target static`,
47
+ fix: `prerender: () => [{ ${example} }] // on defineRoute in ${quoteArg(entry.file)}, then x build --target static`,
48
48
  };
49
49
  }
50
50
 
@@ -112,7 +112,7 @@ export function ungrantedFinding(rule: UngrantedRequirement, rolesAt: string | u
112
112
  const finding: Finding = {
113
113
  code: 'X_PERMISSION_UNGRANTED',
114
114
  cause: `${rule.by} requires ${quoteArg(rule.permission)}, and no role in the app's role map grants it — no actor a role mints can ever pass`,
115
- fix: `add '${rule.permission}' to the grants of a role in ${where}, then x verify --only policy`,
115
+ fix: `grants: [..., '${rule.permission}'] // one role's, in ${where} — then x verify --only policy`,
116
116
  };
117
117
  return rolesAt === undefined ? finding : { ...finding, at: rolesAt };
118
118
  }
@@ -7,6 +7,7 @@ import { ERROR_DOCS_URL } from '@ultimat3/core';
7
7
  import type { ClosureHost } from './import-closure';
8
8
  import { importClosure } from './import-closure';
9
9
  import type { Finding } from './output';
10
+ import { quoteArg } from './shell-quote';
10
11
 
11
12
  /** The suffix `FIXTURE_EXCLUSION` removes from a tarball. */
12
13
  export const FIXTURE_SUFFIX = '-fixture.ts';
@@ -95,7 +96,7 @@ export const fixtureReachFinding = (
95
96
  ): Finding => ({
96
97
  code: 'X_PACKAGE_SHAPE',
97
98
  cause: `packages/${dir}/${fixture} is loaded from the package's entry points (${entries.join(', ')}), and "files" leaves every *${FIXTURE_SUFFIX} out of the tarball — the published package would fail on import`,
98
- fix: `rename packages/${dir}/${fixture} so it does not end in ${FIXTURE_SUFFIX} — it is shipped source, not test code — and update the imports that name it`,
99
+ fix: `git mv ${quoteArg(`packages/${dir}/${fixture}`)} ${quoteArg(`packages/${dir}/${fixture.slice(0, -FIXTURE_SUFFIX.length)}-support.ts`)} # any name not ending in ${FIXTURE_SUFFIX}: it is shipped source, not test code — then update the imports that name it`,
99
100
  docs: ERROR_DOCS_URL,
100
101
  at: `packages/${dir}/${fixture}`,
101
102
  });
package/src/role-load.ts CHANGED
@@ -54,7 +54,7 @@ export class RoleLoadIncompleteError extends UltimateError {
54
54
  super({
55
55
  code: 'X_ROLE_LOAD_INCOMPLETE',
56
56
  cause: `the ${input.role} role imported ${API_INDEX} and every module that reaches no component or stylesheet, and ${MANIFEST_FILE} names ${String(input.missing.length)} job(s) or task(s) that load did not register (${input.missing.join(', ')}), so the whole app was imported instead`,
57
- fix: `add import * as <module> from the file that declares it and <module> to jobs: [...] or tasks: [...] in ${API_INDEX}, then x manifest`,
57
+ fix: `import * as <module> from '<the file that declares it>'; // in ${API_INDEX}, with <module> in jobs: [...] or tasks: [...] — then x manifest`,
58
58
  meta: { role: input.role, missing: input.missing },
59
59
  });
60
60
  }
@@ -32,7 +32,7 @@ export function rolesUnderRealtime(
32
32
  throw new ConfigInvalidError({
33
33
  cause: `role ${dropped.join(',')} was asked for and realtime.enabled is false in app.config.ts, so this process would serve nothing`,
34
34
  fix: dev
35
- ? 'set realtime: { enabled: true } in app.config.ts, or run a role that is not realtime: x dev --role web,worker,scheduler'
35
+ ? 'realtime: { enabled: true } // in app.config.ts — or run a role that is not realtime: x dev --role web,worker,scheduler'
36
36
  : 'ROLE=web bun apps/web/server.ts — a role that is not realtime; or set realtime: { enabled: true } in app.config.ts and rebuild the image, or drop the role from the deploy (the chart: roles.<role>.enabled: false in values.yaml)',
37
37
  meta: { key: 'realtime.enabled', roles: dropped },
38
38
  });
@@ -166,7 +166,7 @@ function buildTier(name: CacheTierName, options: CacheTiersOptions): CacheTier {
166
166
  driver: 'redis',
167
167
  cause:
168
168
  'cache.tiers names it and REDIS_URL (or VALKEY_URL) is unset, so this process would read a per-process ladder while the config declares a shared one',
169
- fix: 'set REDIS_URL in .env, or drop the redis tier from cache.tiers in app.config.ts',
169
+ fix: 'REDIS_URL=redis://localhost:6379 # in .env — or drop the redis tier from cache.tiers in app.config.ts',
170
170
  });
171
171
  }
172
172
  return redisTier({ client: lazyRedis(source.url, options.redisClient ?? redisClient) });
@@ -180,7 +180,7 @@ function buildTier(name: CacheTierName, options: CacheTiersOptions): CacheTier {
180
180
  driver: 'cdn',
181
181
  cause:
182
182
  'cache.tiers names it and no CDN credential is set, so every invalidation report would claim keys an edge that does not exist had accepted',
183
- fix: 'set FASTLY_API_TOKEN and FASTLY_SERVICE_ID in .env, or CLOUDFLARE_API_TOKEN and CLOUDFLARE_ZONE_ID, or drop the cdn tier from cache.tiers in app.config.ts',
183
+ fix: "FASTLY_API_TOKEN='<token>' FASTLY_SERVICE_ID='<service id>' # in .env — or CLOUDFLARE_API_TOKEN and CLOUDFLARE_ZONE_ID, or drop the cdn tier from cache.tiers in app.config.ts",
184
184
  });
185
185
  }
186
186
  return cdnTier({ purge: options.purge });
@@ -86,7 +86,7 @@ export function startStorage(services: DevServices, env: Env, override?: Storage
86
86
  if (bucket === '') {
87
87
  throw new StorageUnwritableError(
88
88
  `S3_ENDPOINT is set to ${binding.url} but S3_BUCKET is empty, so there is no disk to write to`,
89
- 'set S3_BUCKET to the bucket name, or unset S3_ENDPOINT to use the embedded disk',
89
+ "S3_BUCKET='<bucket>' # the bucket name, in the env — or unset S3_ENDPOINT to use the embedded disk",
90
90
  );
91
91
  }
92
92
  return bootDefine({
@@ -133,7 +133,7 @@ export function startStorage(services: DevServices, env: Env, override?: Storage
133
133
  const detail = renderThrowable(cause);
134
134
  throw new StorageUnwritableError(
135
135
  `the embedded storage disk needs ${root} and it could not be created: ${detail}`,
136
- `mount a writable volume at ${root}, or set S3_ENDPOINT and S3_BUCKET to use object storage instead`,
136
+ `S3_ENDPOINT='<url>' S3_BUCKET='<bucket>' # object storage instead — or mount a writable volume at ${root}`,
137
137
  );
138
138
  }
139
139
  // The guard three lines up reads `env`; so must the disk it guards. Otherwise the boot's
@@ -41,7 +41,7 @@ export function styleRoutes(source: StyleSource): readonly Route[] {
41
41
  cause: `no surface stylesheet is registered at ${request.pathname} — the document that asked for it was rendered against an older build`,
42
42
  // No `x` citation, for `island-routes.ts`' reason: this route is mounted in
43
43
  // exactly two places (`cmd-dev.ts`, `serve.ts`) and neither reads `.x/static`.
44
- fix: 'reload the page — this process serves only the stylesheet its own modules registered, and the document holding this URL came from an earlier build',
44
+ fix: 'location.reload() // in the browser — this process serves only the stylesheet its own modules registered, and the document holding this URL came from an earlier build',
45
45
  },
46
46
  },
47
47
  { status: 404 },
@@ -80,7 +80,7 @@ async function referencedPaths(root: string): Promise<ReadonlySet<string> | unde
80
80
  export const unreferencedFinding = (dir: string): Finding => ({
81
81
  code: 'X_PACKAGE_UNREFERENCED',
82
82
  cause: `packages/${dir} is a published workspace and ${ROOT_TSCONFIG} has no reference to it, so tsc -b never builds it`,
83
- fix: `add { "path": "./packages/${dir}" } to "references" in ${ROOT_TSCONFIG}, then run bunx tsc -b --pretty false`,
83
+ fix: `{ "path": "./packages/${dir}" } // in "references" of ${ROOT_TSCONFIG}, then: bunx tsc -b --pretty false`,
84
84
  docs: ERROR_DOCS_URL,
85
85
  at: ROOT_TSCONFIG,
86
86
  });
@@ -99,7 +99,7 @@ export function roleLoadFinding(missing: MissingRegistration): Finding {
99
99
  return {
100
100
  code: 'X_ROLE_LOAD_INCOMPLETE',
101
101
  cause: `${missing.kind} ${JSON.stringify(missing.name)} is registered by importing ${missing.module}, which reaches a component or a stylesheet and which ${API_INDEX} does not import — so a worker and a scheduler, which import no document, run without it`,
102
- fix: `edit ${API_INDEX}: add import '${specifierFor(missing.module)}'; — or move the ${missing.kind} out of ${missing.module} into a module that imports no .tsx and no stylesheet`,
102
+ fix: `import '${specifierFor(missing.module)}'; // in ${API_INDEX} — or move the ${missing.kind} out of ${missing.module} into a module that imports no .tsx and no stylesheet`,
103
103
  docs: ERROR_DOCS_URL,
104
104
  at: missing.module,
105
105
  };
@@ -216,7 +216,7 @@ function scriptRoute(
216
216
  error: {
217
217
  code: 'X_ROUTE_NOT_FOUND',
218
218
  cause: `no ${what} is built at ${request.pathname} — the document that named it was rendered against another build`,
219
- fix: `reload the page — this process serves only the ${what} it built`,
219
+ fix: `location.reload() // in the browser — this process serves only the ${what} it built`,
220
220
  },
221
221
  },
222
222
  { status: 404 },
@@ -102,7 +102,7 @@ export const missingFileFinding = (dir: string, file: string, scaffolder: boolea
102
102
  cause: `packages/${dir} has no ${file}`,
103
103
  fix: scaffolder
104
104
  ? `bun run scripts/new-package.ts ${quoteArg(dir)} --only ${quoteArg(file)}`
105
- : `add packages/${dir}/${file}, shaped like the one in a sibling package`,
105
+ : `ls packages/*/${quoteArg(file)} # a sibling's: add packages/${dir}/${file} shaped like it`,
106
106
  docs: ERROR_DOCS_URL,
107
107
  at: `packages/${dir}/${file}`,
108
108
  });
@@ -121,7 +121,7 @@ export const badVersionFinding = (dir: string, found: unknown): Finding => ({
121
121
  // Bare `JSON.stringify` throws on a bigint and a cycle and runs any `toJSON`, which would replace
122
122
  // this finding with a TypeError from inside the gate.
123
123
  cause: `packages/${dir}/package.json has no semver "version" (found ${renderCauseValue(found)})`,
124
- fix: `set a semver "version" in packages/${dir}/package.json, then: bun run verify`,
124
+ fix: `{ "version": "0.0.0" } // a semver one, in packages/${dir}/package.json — then: bun run verify`,
125
125
  docs: ERROR_DOCS_URL,
126
126
  at: `packages/${dir}/package.json`,
127
127
  });
@@ -227,10 +227,14 @@ export const FIXTURE_EXCLUSION = '!src/**/*-fixture.ts';
227
227
  /** Every exclusion a published package's `files` carries, in the order it is written. */
228
228
  export const TEST_CODE_EXCLUSIONS: readonly string[] = [TEST_EXCLUSION, FIXTURE_EXCLUSION];
229
229
 
230
- export const missingPublishedFileFinding = (dir: string, entry: string): Finding => ({
230
+ export const missingPublishedFileFinding = (
231
+ dir: string,
232
+ entry: string,
233
+ files: readonly string[],
234
+ ): Finding => ({
231
235
  code: 'X_PACKAGE_SHAPE',
232
236
  cause: `packages/${dir}/package.json ships "${entry}" in "files", but packages/${dir}/${entry} does not exist`,
233
- fix: `add packages/${dir}/${entry}, or drop "${entry}" from "files" in packages/${dir}/package.json`,
237
+ fix: `{ "files": ${JSON.stringify(files.filter((kept) => kept !== entry))} } // in packages/${dir}/package.json, "${entry}" dropped — or add packages/${dir}/${entry}`,
234
238
  docs: ERROR_DOCS_URL,
235
239
  at: `packages/${dir}/package.json`,
236
240
  });
@@ -238,7 +242,7 @@ export const missingPublishedFileFinding = (dir: string, entry: string): Finding
238
242
  export const publishesTestsFinding = (dir: string, exclusion: string): Finding => ({
239
243
  code: 'X_PACKAGE_SHAPE',
240
244
  cause: `packages/${dir}/package.json does not exclude ${exclusion} from "files"`,
241
- fix: `add "${exclusion}" to "files" in packages/${dir}/package.json, after "src"`,
245
+ fix: `{ "files": ["src", "${exclusion}", …] } // in packages/${dir}/package.json — "${exclusion}" after "src"`,
242
246
  docs: ERROR_DOCS_URL,
243
247
  at: `packages/${dir}/package.json`,
244
248
  });
@@ -272,7 +276,7 @@ export const buildArtifactsFinding = (dir: string, count: number): Finding => ({
272
276
  export const noFilesAllowlistFinding = (dir: string): Finding => ({
273
277
  code: 'X_PACKAGE_SHAPE',
274
278
  cause: `packages/${dir}/package.json publishes with no "files" allowlist, so the tarball carries whatever is in the directory`,
275
- fix: `add "files": ["src", ${TEST_CODE_EXCLUSIONS.map((entry) => `"${entry}"`).join(', ')}, "README.md", "LICENSE"] to packages/${dir}/package.json`,
279
+ fix: `{ "files": ["src", ${TEST_CODE_EXCLUSIONS.map((entry) => `"${entry}"`).join(', ')}, "README.md", "LICENSE"] } // in packages/${dir}/package.json`,
276
280
  docs: ERROR_DOCS_URL,
277
281
  at: `packages/${dir}/package.json`,
278
282
  });
@@ -306,7 +310,7 @@ export function checkPublishShape(root: string, manifests: readonly ManifestFact
306
310
  // A negation removes files; only a positive literal can promise one that is not there.
307
311
  if (entry.startsWith('!') || /[*?[\]]/.test(entry)) continue;
308
312
  if (existsSync(join(root, 'packages', manifest.dir, entry))) continue;
309
- findings.push(missingPublishedFileFinding(manifest.dir, entry));
313
+ findings.push(missingPublishedFileFinding(manifest.dir, entry, manifest.files));
310
314
  }
311
315
  for (const exclusion of TEST_CODE_EXCLUSIONS) {
312
316
  if (!manifest.files.includes(exclusion)) {
@@ -185,7 +185,7 @@ export function importedPackages(source: string, path = 'source.ts'): readonly s
185
185
  export const unreadableWorkspaceFinding = (path: string): Finding => ({
186
186
  code: 'X_APP_PACKAGE_INVALID',
187
187
  cause: `${path} is claimed by the root "workspaces" globs and supplies no readable "name"`,
188
- fix: `repair the JSON and the "name" in ${path}, or drop its directory from "workspaces" in package.json`,
188
+ fix: `bun --print ${quoteArg(`JSON.parse(await Bun.file(${JSON.stringify(path)}).text()).name`)} # must print its name: repair the JSON and the "name" until it does — or drop its directory from "workspaces" in package.json`,
189
189
  docs: ERROR_DOCS_URL,
190
190
  at: path,
191
191
  });
@@ -199,7 +199,7 @@ export const undeclaredWorkspaceDepFinding = (
199
199
  cause: `${at} imports ${to.name}, which ${from.dir}/package.json does not declare`,
200
200
  // The exact line to paste, at the version the target really carries: a `workspace:*` range would
201
201
  // resolve and then fail `checkLockstep`, which compares a sibling pin against the version.
202
- fix: `add "${to.name}": "${to.version ?? '0.0.0'}" to "${at.endsWith(FIXTURE_SUFFIX) ? 'devDependencies' : 'dependencies'}" in ${from.dir}/package.json`,
202
+ fix: `{ "${at.endsWith(FIXTURE_SUFFIX) ? 'devDependencies' : 'dependencies'}": { "${to.name}": "${to.version ?? '0.0.0'}" } } // merge into ${from.dir}/package.json`,
203
203
  docs: ERROR_DOCS_URL,
204
204
  at: `${from.dir}/package.json`,
205
205
  });
@@ -2040,9 +2040,9 @@ The [Error codes](Error-Codes) table, programmatically. Runs outside an app: tri
2040
2040
  $ x errors explain X_CURSOR_INVALID --json
2041
2041
  {"ok":true,"command":"errors","summary":"X_CURSOR_INVALID — pagination cursor is malformed…",
2042
2042
  "data":{"code":"X_CURSOR_INVALID","cause":"pagination cursor is malformed, tampered with or from
2043
- another query","fix":"drop the cursor and request the first page again (after: null)",
2043
+ another query","fix":"after: null // drop the cursor and request the first page again",
2044
2044
  "docs":"https://github.com/developerz-ai/ultimate/wiki/Error-Codes",
2045
- "site":{"at":"@ultimat3/core/src/cursor.ts","line":26}}}
2045
+ "site":{"at":"@ultimat3/core/src/cursor.ts","line":28}}}
2046
2046
  ```
2047
2047
 
2048
2048
  `site` is the CLI locating a throw site in the tree — it is **not** a field the thrown error
@@ -422,7 +422,7 @@ Load shedding is a decision with a typed error, not a fall-over.
422
422
  |---|---|---|
423
423
  | `X_SUBSCRIPTION_LIMIT` | a socket, tenant or node reached a cap; the error names which scope refused, and which knob | `raise maxPerSocket / maxPerTenant / maxEntries on the LiveQueryRegistry (per socket, default 128), or unsubscribe unused live queries` — and a **channel topic** cap answers `maxTopicsPerSocket` / `maxTopicsPerNode` on the `ChannelHub`. All constructor options, none an `app.config.ts` field |
424
424
  | `X_CURSOR_STALE` | resume cursor outside the change buffer and no snapshot path supplied | `pass 'snapshot' to resumeFrom() so the fallback path can re-snapshot instead of failing` |
425
- | `X_TRANSPORT_UNAVAILABLE` | the fanout bus is unreachable | `x doctor transport` |
425
+ | `X_TRANSPORT_UNAVAILABLE` | the fanout bus is unreachable | point `NATS_URL` at a reachable nats-server |
426
426
 
427
427
  Verbatim shapes: [`packages/realtime/src/errors.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/realtime/src/errors.ts). Full index: [Error codes](Error-Codes).
428
428