@ultimat3/cli 31.46.0 → 31.47.1

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 (111) hide show
  1. package/CLAUDE.md +1 -1
  2. package/README.md +1 -1
  3. package/package.json +29 -29
  4. package/src/affected.ts +3 -2
  5. package/src/app-config-load.ts +8 -5
  6. package/src/app-mcp.ts +2 -5
  7. package/src/app-runtime.ts +4 -4
  8. package/src/cmd-cache.ts +8 -4
  9. package/src/cmd-deploy-compose.ts +11 -12
  10. package/src/cmd-deploy-helm.ts +5 -8
  11. package/src/cmd-exercise-spec.ts +2 -2
  12. package/src/cmd-exercise.ts +7 -19
  13. package/src/cmd-new.ts +4 -3
  14. package/src/cmd-planned.ts +11 -76
  15. package/src/cmd-shot-matrix.ts +3 -2
  16. package/src/cmd-token.ts +11 -3
  17. package/src/cmd-upgrade.ts +5 -7
  18. package/src/codemods/ci-weekly-schedule.ts +61 -0
  19. package/src/codemods/e2e-suite-floor.ts +42 -0
  20. package/src/codemods/e2e-suite.ts +71 -0
  21. package/src/codemods/index.ts +4 -0
  22. package/src/codemods/pending.ts +2 -2
  23. package/src/codemods/test-ports.ts +40 -33
  24. package/src/codemods/test-suites.ts +11 -22
  25. package/src/codemods/vendored-guards.ts +3 -5
  26. package/src/codemods/verify-floor-skips.ts +22 -12
  27. package/src/codemods/verify-floor-steps.ts +4 -3
  28. package/src/db-seed.ts +3 -2
  29. package/src/dispatch.ts +2 -11
  30. package/src/duplicate-packages.ts +4 -4
  31. package/src/exercise-findings.ts +4 -3
  32. package/src/exercise-floor.ts +1 -1
  33. package/src/exercise-seed.ts +34 -0
  34. package/src/fix-command.ts +2 -3
  35. package/src/flag-reads.ts +6 -3
  36. package/src/generate-files.ts +10 -6
  37. package/src/gitignore.ts +4 -3
  38. package/src/guards-built-in.ts +3 -6
  39. package/src/guards.ts +5 -8
  40. package/src/island-bundle.ts +3 -2
  41. package/src/island-sources.ts +4 -3
  42. package/src/island-states-load.ts +4 -3
  43. package/src/island-store.ts +3 -2
  44. package/src/json-merge.ts +8 -6
  45. package/src/lint-findings.ts +4 -7
  46. package/src/mcp-errors.ts +2 -2
  47. package/src/messages.ts +1 -0
  48. package/src/prerender-out.ts +4 -3
  49. package/src/publish-closure.ts +4 -6
  50. package/src/pwa-manifest-locales.ts +5 -8
  51. package/src/registry.ts +0 -7
  52. package/src/root-env.ts +3 -2
  53. package/src/runtime-admin.ts +2 -4
  54. package/src/runtime-keys.ts +5 -2
  55. package/src/static-report.ts +5 -8
  56. package/src/templates/github/ci-schedule.ts +86 -0
  57. package/src/templates/github/ci.yml.ts +6 -8
  58. package/src/templates/github/dependabot.yml.ts +6 -1
  59. package/src/templates/guard-released-forms.ts +30 -8
  60. package/src/templates/scaffold-docs.ts +1 -0
  61. package/src/templates/scaffold-suites.ts +22 -0
  62. package/src/templates/shapes/overlay.ts +4 -7
  63. package/src/upgrade-gate-codemods.ts +1 -18
  64. package/src/upgrade-guards-baseline.ts +3 -5
  65. package/src/verify-merge-skips.ts +2 -4
  66. package/src/verify-merge.ts +13 -8
  67. package/src/verify-part-step.ts +5 -7
  68. package/src/worker-bundle.ts +4 -2
  69. package/wiki/Actions.md +69 -5
  70. package/wiki/Agents.md +13 -0
  71. package/wiki/Auth.md +4 -0
  72. package/wiki/Batching-And-Preloading.md +77 -3
  73. package/wiki/CLI-Reference.md +19 -6
  74. package/wiki/Caching-And-Invalidation.md +76 -23
  75. package/wiki/Client-Navigation.md +2 -0
  76. package/wiki/Compared.md +13 -11
  77. package/wiki/Configuration.md +17 -4
  78. package/wiki/Entities-And-Migrations.md +168 -6
  79. package/wiki/FAQ.md +1 -1
  80. package/wiki/Feature-Flags.md +3 -0
  81. package/wiki/Getting-Started.md +27 -1
  82. package/wiki/Jobs-And-Workflows.md +70 -13
  83. package/wiki/Known-Gaps.md +58 -49
  84. package/wiki/MCP-And-AI.md +43 -3
  85. package/wiki/Mail.md +6 -0
  86. package/wiki/Migrations-And-Backfills.md +13 -0
  87. package/wiki/Money.md +20 -1
  88. package/wiki/N-Plus-One-Detection.md +31 -1
  89. package/wiki/Notify.md +13 -2
  90. package/wiki/PWA-And-Offline.md +34 -4
  91. package/wiki/Policies-And-Authz.md +27 -5
  92. package/wiki/Queries-And-Live-Queries.md +41 -4
  93. package/wiki/Realtime.md +22 -0
  94. package/wiki/Resource-Management.md +6 -1
  95. package/wiki/Routes-And-Render-Modes.md +54 -6
  96. package/wiki/SEO.md +24 -2
  97. package/wiki/Scheduled-Tasks.md +29 -11
  98. package/wiki/Scraping.md +33 -2
  99. package/wiki/Stability.md +1 -1
  100. package/wiki/Static-Assets.md +1 -0
  101. package/wiki/Storage-And-Uploads.md +8 -1
  102. package/wiki/Testing.md +120 -13
  103. package/wiki/The-Eight-Primitives.md +125 -6
  104. package/wiki/Timezones-And-Dates.md +13 -5
  105. package/wiki/Troubleshooting.md +1 -1
  106. package/wiki/Tutorial-02-First-Feature.md +6 -0
  107. package/wiki/Tutorial-03-Auth-And-Admin.md +8 -0
  108. package/wiki/Tutorial-04-Jobs-And-Realtime.md +40 -2
  109. package/wiki/Tutorial-06-Growing-Up.md +1 -2
  110. package/wiki/UI-Components.md +14 -5
  111. package/wiki/Upgrading.md +43 -5
package/CLAUDE.md CHANGED
@@ -30,7 +30,7 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
30
30
  | Passthrough | declared per command (`CommandSpec.passthrough`); every other command refuses a `--` tail with `X_CLI_BAD_FLAG` |
31
31
  | App root | `CommandSpec.requiresApp`, enforced by `dispatch.ts` before `run` |
32
32
  | Declared flags | every flag a command declares is read in this package's source — `flag-reads.test.ts` (`X_CLI_FLAG_UNREAD`) |
33
- | Planned commands | `PLANNED_COMMANDS` / `PLANNED_SUBCOMMANDS` (`cmd-planned.ts`): in the registry, exit `X_NOT_IMPLEMENTED` with a fix naming a shipped command |
33
+ | Planned commands | none: `PLANNED_COMMANDS` / `PLANNED_SUBCOMMANDS` (`cmd-planned.ts`) stay empty, and the registry builds nothing from them. A command ships, or the parser refuses it `X_CLI_UNKNOWN_COMMAND` with its decision in `wiki/Known-Gaps.md` |
34
34
  | Errors | codes + titles in `error-codes.ts`, a runnable line per code in `mcp-errors.ts` (typed over `CliErrorCode`); a family at the ceiling moves to `error-codes-<family>.ts` / `mcp-errors-<family>.ts` (`-verify`: the gate's floor, run and split); classes in `errors.ts` or beside their one thrower when `errors.ts` is at its ceiling. Never a bare `Error` |
35
35
  | Subprocesses | only through `exec.ts`'s injectable `Runner`; `gh` through `ctx.runner` with a required `fix` |
36
36
  | Templates | `templates/*.ts` return strings, pre-formatted for Biome (`wrap.ts`'s `wrapList` / `wrapImport` / `sortSpecifiers`); no fixture files on disk |
package/README.md CHANGED
@@ -22,7 +22,7 @@ Commands and the `x verify` step count, `As of 2026-08`:
22
22
  | `x build --target prebuilt` | the store a container boots from: island chunks, compiled stylesheets | a `RUN` line in the image build, never run by hand |
23
23
  | `x verify` | **the gate** | 21 named steps, each with pass/fail + duration; `budgets` runs `x build --target static` first when its stats are missing or older than the source |
24
24
  | `x verify plan [--parts n]` | the gate as CI parts | `data.matrix` is a GitHub `strategy.matrix` of `x verify --only … [--shard i/n]` parts; `x new`'s workflow reads it with `fromJSON`, and `x verify merge` folds the parts back |
25
- | `x exercise [<name>] [--seed n] [--shard i/n]` | every action, query, job and route `load` run once on generated rows, no test written | a scratch database; `.x/exercise.json`; an `unreached` primitive is `X_CONTRACT_EXERCISE_UNREACHED` with the override to paste into `apps/web/exercise.ts` — the gate's `exercise` step. `x.verify.json` `exercise: { unprovenMax, statementsMax }` turns unproven proofs and over-ceiling calls red; absent, warning lines. Route loads land in `routes` beside `records`, their loops and seq scans as warning lines; a load's own typed-client reads are answered in process, and `defineExercise(…, { routes })` gives a page its params, query, actor or `empty` reason. A sent push is a `push` effect. `--shard i/n` runs one of n disjoint slices into `.x/exercise.<i>-of-<n>.json` |
25
+ | `x exercise [<name>] [--seed n\|random] [--shard i/n]` | every action, query, job and route `load` run once on generated rows, no test written | a scratch database; `.x/exercise.json`; an `unreached` primitive is `X_CONTRACT_EXERCISE_UNREACHED` with the override to paste into `apps/web/exercise.ts` — the gate's `exercise` step. `x.verify.json` `exercise: { unprovenMax, statementsMax }` turns unproven proofs and over-ceiling calls red; absent, warning lines. Route loads land in `routes` beside `records`, their loops and seq scans as warning lines; a load's own typed-client reads are answered in process, and `defineExercise(…, { routes })` gives a page its params, query, actor or `empty` reason. A sent push is a `push` effect. `--shard i/n` runs one of n disjoint slices into `.x/exercise.<i>-of-<n>.json` |
26
26
  | `x drill [<name>] [--list] [--budget-ms n]` | the app's roles as real processes on real services, each fault played through a proxy or a signal, judged on framework contracts only | a scratch database per drill; load = anonymous site pages plus every action an anonymous POST reaches (`data.skippedWrites` names the rest and why); `X_DRILL_FAILED` per property that did not hold, `X_DRILL_SERVICE_MISSING` before anything starts. Not a gate step — CI's `fault-drills` job runs three on `examples/dummy` |
27
27
  | `x g <primitive> <name>` | scaffolds a primitive **with a passing test** | never a TODO stub |
28
28
  | `x db gen\|migrate\|reset\|branch\|backfill` | everything DB | `branch` = copy-on-write clone + preview URL; `backfill` dry-runs unless `--write`. The schema browser is `/_x`'s db panel (`x dev`); `studio` left the registry ([Known gaps](../../wiki/Known-Gaps.md#open-by-decision)) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/cli",
3
- "version": "31.46.0",
3
+ "version": "31.47.1",
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.46.0",
57
- "@ultimat3/admin": "31.46.0",
58
- "@ultimat3/ai": "31.46.0",
59
- "@ultimat3/auth": "31.46.0",
60
- "@ultimat3/cache": "31.46.0",
61
- "@ultimat3/core": "31.46.0",
62
- "@ultimat3/db": "31.46.0",
63
- "@ultimat3/entity": "31.46.0",
64
- "@ultimat3/flags": "31.46.0",
65
- "@ultimat3/http": "31.46.0",
66
- "@ultimat3/i18n": "31.46.0",
67
- "@ultimat3/jobs": "31.46.0",
68
- "@ultimat3/mail": "31.46.0",
69
- "@ultimat3/manifest": "31.46.0",
70
- "@ultimat3/mcp": "31.46.0",
71
- "@ultimat3/money": "31.46.0",
72
- "@ultimat3/notify": "31.46.0",
73
- "@ultimat3/policy": "31.46.0",
74
- "@ultimat3/pwa": "31.46.0",
75
- "@ultimat3/query": "31.46.0",
76
- "@ultimat3/realtime": "31.46.0",
77
- "@ultimat3/render": "31.46.0",
78
- "@ultimat3/schema": "31.46.0",
79
- "@ultimat3/scraping": "31.46.0",
80
- "@ultimat3/seo": "31.46.0",
81
- "@ultimat3/storage": "31.46.0",
82
- "@ultimat3/testing": "31.46.0",
83
- "@ultimat3/time": "31.46.0",
56
+ "@ultimat3/action": "31.47.1",
57
+ "@ultimat3/admin": "31.47.1",
58
+ "@ultimat3/ai": "31.47.1",
59
+ "@ultimat3/auth": "31.47.1",
60
+ "@ultimat3/cache": "31.47.1",
61
+ "@ultimat3/core": "31.47.1",
62
+ "@ultimat3/db": "31.47.1",
63
+ "@ultimat3/entity": "31.47.1",
64
+ "@ultimat3/flags": "31.47.1",
65
+ "@ultimat3/http": "31.47.1",
66
+ "@ultimat3/i18n": "31.47.1",
67
+ "@ultimat3/jobs": "31.47.1",
68
+ "@ultimat3/mail": "31.47.1",
69
+ "@ultimat3/manifest": "31.47.1",
70
+ "@ultimat3/mcp": "31.47.1",
71
+ "@ultimat3/money": "31.47.1",
72
+ "@ultimat3/notify": "31.47.1",
73
+ "@ultimat3/policy": "31.47.1",
74
+ "@ultimat3/pwa": "31.47.1",
75
+ "@ultimat3/query": "31.47.1",
76
+ "@ultimat3/realtime": "31.47.1",
77
+ "@ultimat3/render": "31.47.1",
78
+ "@ultimat3/schema": "31.47.1",
79
+ "@ultimat3/scraping": "31.47.1",
80
+ "@ultimat3/seo": "31.47.1",
81
+ "@ultimat3/storage": "31.47.1",
82
+ "@ultimat3/testing": "31.47.1",
83
+ "@ultimat3/time": "31.47.1",
84
84
  "babel-preset-solid": "^1.9.16"
85
85
  }
86
86
  }
package/src/affected.ts CHANGED
@@ -12,7 +12,7 @@
12
12
  // why: `join`/`relative` are `node:`-only by necessity: Bun exposes no path primitive, and a
13
13
  // workspace directory is checkout-relative while a caller's scan yields paths relative to its own
14
14
  // root.
15
- import { join, relative } from 'node:path';
15
+ import { join } from 'node:path';
16
16
  import { singleLine, UltimateError } from '@ultimat3/core';
17
17
  import { DEFAULT_BASE, defaultBase, fetchFixFor } from './affected-base';
18
18
  import { readUnownedDirs } from './affected-unowned';
@@ -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 { posixRelative } from './posix-path';
25
26
  import { quoteArg } from './shell-quote';
26
27
  import type { WorkspaceNode } from './workspace-graph';
27
28
  import { readWorkspaceGraph } from './workspace-graph';
@@ -309,7 +310,7 @@ export const scopePrefixes = (plan: AffectedPlan, root: string, cwd: string): re
309
310
  plan.rootWide.length > 0
310
311
  ? ['']
311
312
  : [...plan.workspaces.map((workspace) => workspace.dir), ...plan.unowned]
312
- .map((dir) => relative(cwd, join(root, dir)).split('\\').join('/'))
313
+ .map((dir) => posixRelative(cwd, join(root, dir)))
313
314
  .filter((path) => !path.startsWith('..'));
314
315
 
315
316
  export const inScope = (path: string, prefixes: readonly string[]): boolean =>
@@ -6,14 +6,17 @@
6
6
  // why: Bun exposes no path-join primitive, and the config path is app-root-relative.
7
7
  import { join } from 'node:path';
8
8
  import type { AppConfig, AppConfigInput } from '@ultimat3/core';
9
- import { APP_CONFIG_FILE, ConfigInvalidError, defineConfig, describeValue } from '@ultimat3/core';
9
+ import {
10
+ APP_CONFIG_FILE,
11
+ ConfigInvalidError,
12
+ defineConfig,
13
+ describeValue,
14
+ isJsonObject,
15
+ } from '@ultimat3/core';
10
16
 
11
17
  /** The export every app declares. Named, never default — the CLI and the runtime both import it. */
12
18
  export const APP_CONFIG_EXPORT = 'config';
13
19
 
14
- const isRecord = (value: unknown): value is Record<string, unknown> =>
15
- typeof value === 'object' && value !== null && !Array.isArray(value);
16
-
17
20
  /**
18
21
  * One named export of `root`'s `app.config.ts`, or `undefined` when the root has no such file or
19
22
  * the module does not export `name`. A module that will not import throws as it did — the callers
@@ -37,7 +40,7 @@ export async function loadAppConfig(root: string): Promise<AppConfig | undefined
37
40
  const path = join(root, APP_CONFIG_FILE);
38
41
  if (!(await Bun.file(path).exists())) return undefined;
39
42
  const exported = await appConfigExport(root, APP_CONFIG_EXPORT);
40
- if (!isRecord(exported)) {
43
+ if (!isJsonObject(exported)) {
41
44
  throw new ConfigInvalidError({
42
45
  cause: `${path} exports no ${APP_CONFIG_EXPORT} object (${describeValue(exported)})`,
43
46
  fix: "export const config = defineConfig({ name: 'my-app' });",
package/src/app-mcp.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  import { existsSync } from 'node:fs';
15
15
  // why: Bun exposes no path-join primitive; each candidate is joined to root.
16
16
  import { join } from 'node:path';
17
- import { logger, peerAddressClass } from '@ultimat3/core';
17
+ import { isJsonObject, logger, peerAddressClass } from '@ultimat3/core';
18
18
  import type { Route } from '@ultimat3/http';
19
19
  import { callerLocality, jsonResponse, originListed, selfOrigin } from '@ultimat3/http';
20
20
  import {
@@ -54,9 +54,6 @@ export interface AppMcpMount {
54
54
  readonly warning: McpAppUnmountedError | undefined;
55
55
  }
56
56
 
57
- const isRecord = (value: unknown): value is Record<string, unknown> =>
58
- typeof value === 'object' && value !== null;
59
-
60
57
  /**
61
58
  * `defineAppMcp`'s own default — `mcp/src/transport-http.ts`, `input.path ?? '/mcp'` — named here
62
59
  * ONLY in a warning about an endpoint that has no route and so no resolved path. It never decides
@@ -70,7 +67,7 @@ async function exposed(root: string): Promise<boolean> {
70
67
  }
71
68
 
72
69
  const isAppMcp = (value: unknown): value is AppMcp =>
73
- isRecord(value) && 'server' in value && 'tools' in value && 'route' in value;
70
+ isJsonObject(value) && 'server' in value && 'tools' in value && 'route' in value;
74
71
 
75
72
  /** The export as a list of endpoints, or `undefined` when it is not one (the "missing" case). */
76
73
  function endpointsOf(exported: unknown): readonly AppMcp[] | undefined {
@@ -12,6 +12,7 @@
12
12
  import { existsSync } from 'node:fs';
13
13
  // why: Bun exposes no path-join primitive; each candidate is joined to the app root.
14
14
  import { join } from 'node:path';
15
+ import { isJsonObject } from '@ultimat3/core';
15
16
  import { assertRuntimeKeys } from './runtime-keys';
16
17
  import type { RuntimeOverrides } from './runtime-overrides';
17
18
 
@@ -20,9 +21,6 @@ export const APP_RUNTIME_GLOB = 'apps/*/runtime.ts';
20
21
  /** The export that file makes — a `RuntimeOverrides`. */
21
22
  export const APP_RUNTIME_EXPORT = 'runtime';
22
23
 
23
- const isRecord = (value: unknown): value is Record<string, unknown> =>
24
- typeof value === 'object' && value !== null;
25
-
26
24
  /**
27
25
  * The first `apps/<app>/runtime.ts` exporting `runtime`, or `undefined` when no app declares one.
28
26
  * Sorted, so two apps answer in one order; the object is handed on as declared, because every key
@@ -44,7 +42,9 @@ export async function loadAppRuntime(root: string): Promise<RuntimeOverrides | u
44
42
  for (const file of files.sort()) {
45
43
  const module = (await import(join(root, file))) as Record<string, unknown>;
46
44
  const exported = module[APP_RUNTIME_EXPORT];
47
- if (isRecord(exported)) {
45
+ // An array is let through on purpose: its index keys reach `assertRuntimeKeys` and are refused
46
+ // by name, where skipping it would read a malformed `runtime` as "no override declared".
47
+ if (Array.isArray(exported) || isJsonObject(exported)) {
48
48
  assertRuntimeKeys(file, exported);
49
49
  return exported as RuntimeOverrides;
50
50
  }
package/src/cmd-cache.ts CHANGED
@@ -19,10 +19,9 @@ import { appManifest } from './app-manifest';
19
19
  import { requireAppRoot } from './app-root';
20
20
  import { loadAppRuntime } from './app-runtime';
21
21
  import { cacheGraph, neverEvicted } from './cache-graph';
22
- import { cacheSpec } from './cmd-cache-spec';
23
- import { plannedSubcommand } from './cmd-planned';
22
+ import { CACHE_SUBCOMMANDS, cacheSpec } from './cmd-cache-spec';
24
23
  import type { CliCommand, CommandContext } from './command';
25
- import { MissingPositionalError } from './errors';
24
+ import { MissingPositionalError, UnknownCommandError } from './errors';
26
25
  import { msg } from './messages';
27
26
  import type { CommandResult, Finding, JsonValue } from './output';
28
27
  import { findingFrom } from './output';
@@ -180,7 +179,12 @@ export const cacheCommandOver = (open: OpenCache): CliCommand => ({
180
179
  // entry cached under no tag is not reached: it waits for its TTL, as it would for any write.
181
180
  return bust(ctx, open, root, knownTags, 'x cache clear --json');
182
181
  }
183
- throw plannedSubcommand('cache', sub);
182
+ // The parser refuses this first; it covers a `ParsedArgs` built by hand.
183
+ throw new UnknownCommandError({
184
+ path: `cache ${sub}`,
185
+ known: CACHE_SUBCOMMANDS,
186
+ suggestion: 'help cache',
187
+ });
184
188
  },
185
189
  });
186
190
 
@@ -7,6 +7,8 @@
7
7
  // recreates, so the role serves nothing between the old container's exit and the new one's
8
8
  // healthcheck.
9
9
 
10
+ import { isJsonObject } from '@ultimat3/core';
11
+
10
12
  /**
11
13
  * How one serving role is rolled. `start-first` is the zero-downtime path; `stop-first` is
12
14
  * compose's own recreate, kept where two containers of the role cannot coexist, with the reason.
@@ -18,9 +20,6 @@ export type ComposeStrategy =
18
20
  /** The roles that stay up serving — the only ones a rollout strategy applies to. */
19
21
  export const SERVING_ROLES = ['web', 'sync', 'worker', 'scheduler'] as const;
20
22
 
21
- const isRecord = (value: unknown): value is Record<string, unknown> =>
22
- typeof value === 'object' && value !== null && !Array.isArray(value);
23
-
24
23
  /**
25
24
  * The host port a `ports:` entry pins, or `undefined` when Docker picks it. Short syntax is
26
25
  * `[[ip:]host:]container[/proto]`: `3000` and `127.0.0.1::3000` leave the host side to Docker, so
@@ -28,7 +27,7 @@ const isRecord = (value: unknown): value is Record<string, unknown> =>
28
27
  * container can hold. Long syntax pins one when `published` is said.
29
28
  */
30
29
  function pinnedHostPort(entry: unknown): string | undefined {
31
- if (isRecord(entry)) {
30
+ if (isJsonObject(entry)) {
32
31
  const published = entry['published'];
33
32
  return published === undefined || published === null || published === ''
34
33
  ? undefined
@@ -43,7 +42,7 @@ function pinnedHostPort(entry: unknown): string | undefined {
43
42
 
44
43
  /** One service's strategy: start-first unless something in its definition forbids a second copy. */
45
44
  function strategyOf(service: unknown): ComposeStrategy {
46
- if (!isRecord(service)) {
45
+ if (!isJsonObject(service)) {
47
46
  return { kind: 'stop-first', why: 'the compose file declares no such service' };
48
47
  }
49
48
  if (service['container_name'] !== undefined) {
@@ -67,7 +66,7 @@ function strategyOf(service: unknown): ComposeStrategy {
67
66
  };
68
67
  }
69
68
  const deploy = service['deploy'];
70
- const declared = isRecord(deploy) ? deploy['replicas'] : undefined;
69
+ const declared = isJsonObject(deploy) ? deploy['replicas'] : undefined;
71
70
  const replicas =
72
71
  typeof declared === 'number' && Number.isSafeInteger(declared) && declared >= 0 ? declared : 1;
73
72
  return { kind: 'start-first', replicas };
@@ -85,8 +84,8 @@ export function composeStrategies(text: string | undefined): ReadonlyMap<string,
85
84
  } catch {
86
85
  parsed = undefined;
87
86
  }
88
- const services = isRecord(parsed) ? parsed['services'] : undefined;
89
- if (!isRecord(services)) return new Map();
87
+ const services = isJsonObject(parsed) ? parsed['services'] : undefined;
88
+ if (!isJsonObject(services)) return new Map();
90
89
  const strategies = new Map<string, ComposeStrategy>(
91
90
  SERVING_ROLES.map((role) => [role, strategyOf(services[role])]),
92
91
  );
@@ -135,7 +134,7 @@ export interface ComposeDatabase {
135
134
 
136
135
  /** One `environment:` entry, from either of compose's two spellings (map or `KEY=value` list). */
137
136
  function environmentValue(environment: unknown, key: string): string | undefined {
138
- if (isRecord(environment)) {
137
+ if (isJsonObject(environment)) {
139
138
  const value = environment[key];
140
139
  return typeof value === 'string' || typeof value === 'number' ? String(value) : undefined;
141
140
  }
@@ -156,9 +155,9 @@ export function composeDatabase(text: string | undefined): ComposeDatabase | und
156
155
  } catch {
157
156
  return undefined;
158
157
  }
159
- const services = isRecord(parsed) ? parsed['services'] : undefined;
160
- const db = isRecord(services) ? services['db'] : undefined;
161
- if (!isRecord(db)) return undefined;
158
+ const services = isJsonObject(parsed) ? parsed['services'] : undefined;
159
+ const db = isJsonObject(services) ? services['db'] : undefined;
160
+ if (!isJsonObject(db)) return undefined;
162
161
  const user = environmentValue(db['environment'], 'POSTGRES_USER') ?? 'postgres';
163
162
  return { user, database: environmentValue(db['environment'], 'POSTGRES_DB') ?? user };
164
163
  }
@@ -7,7 +7,7 @@
7
7
 
8
8
  // why: Bun exposes no path-join primitive; the chart path is handed to helm as one joined string.
9
9
  import { join } from 'node:path';
10
- import { UltimateError } from '@ultimat3/core';
10
+ import { isJsonObject, UltimateError } from '@ultimat3/core';
11
11
  import { loadAppConfig } from './app-config-load';
12
12
  import { BadFlagError } from './errors';
13
13
 
@@ -27,9 +27,6 @@ const DURATION = /^(?:\d+(?:h|m|s|ms))+$/;
27
27
  const LABEL = /^[a-z0-9](?:[-a-z0-9]*[a-z0-9])?$/;
28
28
  const RELEASE_MAX = 53;
29
29
 
30
- const isRecord = (value: unknown): value is Record<string, unknown> =>
31
- typeof value === 'object' && value !== null;
32
-
33
30
  /** `--timeout`, screened: a value helm would reject is refused before anything is spawned. */
34
31
  export function readHelmTimeout(raw: string | undefined): string {
35
32
  if (raw === undefined) return HELM_DEFAULT_TIMEOUT;
@@ -135,10 +132,10 @@ export function readRollout(target: HelmTarget, stdout: string): Rollout {
135
132
  } catch {
136
133
  parsed = undefined;
137
134
  }
138
- const info = isRecord(parsed) ? parsed['info'] : undefined;
139
- const status = isRecord(info) ? info['status'] : undefined;
140
- const revision = isRecord(parsed) ? parsed['version'] : undefined;
141
- const namespace = isRecord(parsed) ? parsed['namespace'] : undefined;
135
+ const info = isJsonObject(parsed) ? parsed['info'] : undefined;
136
+ const status = isJsonObject(info) ? info['status'] : undefined;
137
+ const revision = isJsonObject(parsed) ? parsed['version'] : undefined;
138
+ const namespace = isJsonObject(parsed) ? parsed['namespace'] : undefined;
142
139
  return {
143
140
  release: target.release,
144
141
  namespace: typeof namespace === 'string' ? namespace : (target.namespace ?? null),
@@ -6,14 +6,14 @@ import type { CommandSpec } from './parse';
6
6
  export const exerciseSpec: CommandSpec = {
7
7
  name: 'exercise',
8
8
  summary: 'run every action, query and job once on generated rows, with no test written',
9
- usage: 'x exercise [<name>] [--seed n] [--shard i/n] [--json]',
9
+ usage: 'x exercise [<name>] [--seed n|random] [--shard i/n] [--json]',
10
10
  requiresApp: true,
11
11
  flags: [
12
12
  {
13
13
  name: 'seed',
14
14
  type: 'string',
15
15
  summary:
16
- 'the integer the seed graph and every generated input are drawn from; same seed, same pass',
16
+ 'the integer the seed graph and every generated input are drawn from; same seed, same pass. Default: one constant, so the gate is reproducible; random explores a fresh one and reports it',
17
17
  },
18
18
  {
19
19
  name: 'shard',
@@ -1,4 +1,4 @@
1
- // `x exercise [<name>] [--seed n]` — every action, query, job and route `load` run once on rows
1
+ // `x exercise [<name>] [--seed n|random]` — every action, query, job and route `load` run once on rows
2
2
  // with no test written: load the app, read `apps/web/exercise.ts`, run `@ultimat3/testing`'s pass
3
3
  // on a scratch database, write `.x/exercise.json`. CLI wiring only: the pass is testing's, the
4
4
  // verdict is `exercise-findings.ts`'s, so the gate step and this command read one rule.
@@ -40,10 +40,10 @@ import { exerciseFloorVerdict } from './exercise-floor-verdict';
40
40
  import { readExerciseOverrides } from './exercise-overrides';
41
41
  import { EXERCISE_APP_URL, servedInProcess } from './exercise-route-api';
42
42
  import { emptyReachWarnings, routeLoadWarnings } from './exercise-routes';
43
+ import { readExerciseSeed } from './exercise-seed';
43
44
  import { readExerciseShard, shardReportFile } from './exercise-shard-flag';
44
45
  import { entityTenantFindings } from './exercise-static';
45
46
  import { subjectFindings, subjectProofFindings } from './exercise-subject';
46
- import { readIntFlag } from './flag-number';
47
47
  import { withAppUrl } from './measure-scope';
48
48
  import { msg } from './messages';
49
49
  import { withOfflinePorts } from './offline-ports';
@@ -59,31 +59,18 @@ export const exerciseRoles = (tenant: string): readonly NamedActor[] =>
59
59
  named.actor === null ? named : { ...named, actor: { ...named.actor, orgId: tenant } },
60
60
  );
61
61
 
62
- const readSeed = (ctx: CommandContext): number | undefined =>
63
- readIntFlag(ctx.args, {
64
- name: 'seed',
65
- command: 'exercise',
66
- min: 0,
67
- max: 2_147_483_647,
68
- example: 'x exercise --seed 1 --json',
69
- });
70
-
71
62
  export const exerciseCommand: CliCommand = {
72
63
  spec: exerciseSpec,
73
64
  async run(ctx: CommandContext): Promise<CommandResult> {
74
65
  const root = requireAppRoot('exercise', ctx.cwd).dir;
75
- const seed = readSeed(ctx);
66
+ const seed = readExerciseSeed(ctx.args);
76
67
  // Read before anything loads: a refused split runs nothing.
77
68
  readExerciseShard(ctx.args, ctx.args.positionals[0]);
78
69
  return withExerciseProcess(root, ctx.env, () => exercise(ctx, root, seed));
79
70
  },
80
71
  };
81
72
 
82
- async function exercise(
83
- ctx: CommandContext,
84
- root: string,
85
- seed: number | undefined,
86
- ): Promise<CommandResult> {
73
+ async function exercise(ctx: CommandContext, root: string, seed: number): Promise<CommandResult> {
87
74
  const loaded = await loadApp(root);
88
75
  // `runtime.ts`'s ports, as a boot reads them — an `auditSink` declared there is what lets an
89
76
  // `audit: true` primitive run — through `offline-ports.ts`, so the pass reaches no real backend.
@@ -96,7 +83,7 @@ async function exercise(
96
83
  async function exercisePass(
97
84
  ctx: CommandContext,
98
85
  root: string,
99
- seed: number | undefined,
86
+ seed: number,
100
87
  loaded: Awaited<ReturnType<typeof loadApp>>,
101
88
  ): Promise<CommandResult> {
102
89
  const only = ctx.args.positionals[0];
@@ -118,7 +105,7 @@ async function exercisePass(
118
105
  runExercisePass({
119
106
  entities,
120
107
  writer: entitySeedWriter({ entities: cores, client }),
121
- ...(seed === undefined ? {} : { seed }),
108
+ seed,
122
109
  ...(overrides === undefined ? {} : { overrides }),
123
110
  ...(only === undefined ? {} : { only }),
124
111
  ...(shard === undefined ? {} : { shard }),
@@ -188,6 +175,7 @@ async function exercisePass(
188
175
  ? msg('cli.exercise.none')
189
176
  : msg('cli.exercise.summary', { ...report.counts, file: reportFile }),
190
177
  lines: [
178
+ msg('cli.exercise.seed', { seed }),
191
179
  ...renderExerciseTable(records),
192
180
  ...(phases === undefined ? [] : [exercisePhaseLine(phases)]),
193
181
  ...slowestProofLines(records),
package/src/cmd-new.ts CHANGED
@@ -3,9 +3,9 @@
3
3
  // Interactive-free: every choice is a flag with a default, because an agent cannot answer prompts.
4
4
 
5
5
  // why: the target is a DIRECTORY, which `Bun.file().exists()` answers false for; Bun ships no
6
- // path API, and `isAbsolute`/`join`/`relative`/`resolve` place the new app.
6
+ // path API, and `isAbsolute`/`join`/`resolve` place the new app.
7
7
  import { existsSync } from 'node:fs';
8
- import { isAbsolute, join, relative, resolve } from 'node:path';
8
+ import { isAbsolute, join, resolve } from 'node:path';
9
9
  import { renderThrowable } from '@ultimat3/core';
10
10
  import { AppNameInvalidError, appNameIssue } from './app-name';
11
11
  import { dedupe } from './cmd-generate';
@@ -22,6 +22,7 @@ import { type NewShape, readShape } from './new-shapes';
22
22
  import { runShapeGenerators } from './new-shapes-generate';
23
23
  import type { CommandResult } from './output';
24
24
  import { flagBool, flagString } from './parse';
25
+ import { posixRelative } from './posix-path';
25
26
  import { quoteArg } from './shell-quote';
26
27
  import type { GeneratedFile } from './templates';
27
28
  import { appFiles, names, repoFiles, resourceFiles } from './templates';
@@ -129,7 +130,7 @@ export function repositoryFix(git: RepositoryInit): string {
129
130
 
130
131
  /** `path` relative to `cwd` when it lies under it, else absolute — never a `../../` walk. */
131
132
  const displayPath = (cwd: string, path: string): string => {
132
- const rel = relative(cwd, path);
133
+ const rel = posixRelative(cwd, path);
133
134
  return rel === '' || rel.startsWith('..') || isAbsolute(rel) ? path : rel;
134
135
  };
135
136
 
@@ -1,12 +1,8 @@
1
- // The commands the design docs specify and this build does not yet implement. They are in the
2
- // registry on purpose: `x branch` exiting X_CLI_UNKNOWN_COMMAND says "you typed something that
3
- // does not exist", which is false and sends an agent looking for a typo. X_NOT_IMPLEMENTED plus a
4
- // fix naming the closest shipped command says the true thing, and `x help` lists them honestly.
1
+ // The two tables that say which commands the design specifies and this build does not ship. Both
2
+ // are empty, and `bun run scripts/finished.ts` is red the moment either holds a row: a command
3
+ // either ships or is refused by the parser as unknown, with its decision in wiki/Known-Gaps.md.
5
4
 
6
5
  import { NotImplementedError } from '@ultimat3/core';
7
- import type { CliCommand } from './command';
8
- import type { CommandResult } from './output';
9
- import type { CommandSpec } from './parse';
10
6
  import { quoteArg } from './shell-quote';
11
7
 
12
8
  export interface PlannedCommand {
@@ -19,29 +15,12 @@ export interface PlannedCommand {
19
15
  }
20
16
 
21
17
  /**
22
- * `wiki/CLI-Reference.md`'s planned table, verbatim in shape. Every `fix` names a command this
23
- * build actually ships — a fix line pointing at another unbuilt command is the failure mode this
24
- * table exists to close, and `cmd-planned.test.ts` asserts the whole set against the registry.
18
+ * Empty `As of 2026-11-16` (plan 101b slice 13): `x branch`, `x ai` and `x money` left the registry,
19
+ * each with its decision and extension point in wiki/Known-Gaps.md, and the parser refuses each
20
+ * with `X_CLI_UNKNOWN_COMMAND`. Read by the citation checks (`fix-command.ts`) and the finished row.
25
21
  */
26
- // Empty `As of 2026-11-16` (plan 101b slice 13): `x branch`, `x ai` and `x money` left the
27
- // registry, each with its decision and extension point in wiki/Known-Gaps.md, and the parser now
28
- // refuses each with `X_CLI_UNKNOWN_COMMAND`. Finished means this list is empty, not that every idea
29
- // was built; a row returns only with a plan that builds it.
30
22
  export const PLANNED_COMMANDS: readonly PlannedCommand[] = [];
31
23
 
32
- /**
33
- * The planned command a resolved command NAME belongs to, if any. Exported for `dispatch.ts`'s
34
- * parse-failure branch: the parser refuses an undeclared flag before any `run` is reached, and a
35
- * planned command declares only the four global flags — so `x logs tail --follow` answered
36
- * X_CLI_BAD_FLAG listing "known: json, help, cwd, verbose", a flag set belonging to a command that
37
- * does not exist yet, while `x logs tail` answered the honest X_NOT_IMPLEMENTED one invocation away.
38
- *
39
- * Takes the name `commandFor` resolved, never the raw word: aliases are that function's business
40
- * and a second matcher here would be a second answer to "which command did they type".
41
- */
42
- export const plannedCommandFor = (name: string | undefined): PlannedCommand | undefined =>
43
- PLANNED_COMMANDS.find((planned) => planned.name === name);
44
-
45
24
  export interface PlannedSubcommand {
46
25
  readonly command: string;
47
26
  readonly subcommand: string;
@@ -50,22 +29,15 @@ export interface PlannedSubcommand {
50
29
  }
51
30
 
52
31
  /**
53
- * A subcommand of a shipped command that this build does not implement. Same promise as the table
54
- * above, one level down: the subcommand stays in its command's list, so the parser accepts it and
55
- * `x help <command>` lists it, and it exits X_NOT_IMPLEMENTED naming what to run instead.
56
- *
57
- * Empty, `As of 2026-11-15` (plan 101-finished-and-self-maintained G6). `x token grant`,
58
- * `x cache stats`, `x db studio` and `x jobs drain` left the registry rather than stay planned:
59
- * a key's scopes are never widened, hit rates are aggregated by no process, the `/_x` db panel is
60
- * the one schema browser, and Postgres is the one durable job driver. Each reason is its row in
61
- * `wiki/Known-Gaps.md`; the parser now refuses each, with the same exit code.
32
+ * Empty `As of 2026-11-15` (plan 101-finished-and-self-maintained G6). `x token grant`,
33
+ * `x cache stats`, `x db studio` and `x jobs drain` left the registry rather than stay planned;
34
+ * each reason is its row in `wiki/Known-Gaps.md`.
62
35
  */
63
36
  export const PLANNED_SUBCOMMANDS: readonly PlannedSubcommand[] = [];
64
37
 
65
38
  /**
66
- * Thrown by the owning command, so the subcommand fails exactly where it would have run. Returns
67
- * the error rather than throwing it, because a `run` that throws synchronously escapes the
68
- * promise its signature promises — the caller does `throw plannedSubcommand(...)`.
39
+ * @deprecated No command calls this: a subcommand a command lacks is `X_CLI_UNKNOWN_COMMAND`. It is
40
+ * a public export, so it stays until a major may remove it (`wiki/Stability.md`, Deprecation).
69
41
  */
70
42
  export function plannedSubcommand(command: string, subcommand: string): NotImplementedError {
71
43
  const planned = PLANNED_SUBCOMMANDS.find(
@@ -78,40 +50,3 @@ export function plannedSubcommand(command: string, subcommand: string): NotImple
78
50
  fix: planned?.fix ?? `x help ${quoteArg(command.split(' '))}`,
79
51
  });
80
52
  }
81
-
82
- /**
83
- * What every invocation of a planned command answers — its `run`, and the dispatcher when the
84
- * parser refused a flag before any `run` was reached. One builder, so the two cannot drift.
85
- */
86
- export const plannedCommandError = (planned: PlannedCommand): NotImplementedError =>
87
- new NotImplementedError({
88
- cause: `x ${planned.name} is not implemented in this build`,
89
- fix: planned.fix,
90
- });
91
-
92
- const specFor = (planned: PlannedCommand): CommandSpec => ({
93
- name: planned.name,
94
- summary: `${planned.summary} (planned)`,
95
- usage: planned.usage,
96
- // A planned command answers X_NOT_IMPLEMENTED however it is invoked, so the bare form must
97
- // reach its `run` rather than being refused for a subcommand that does not exist yet.
98
- ...(planned.subcommands === undefined
99
- ? {}
100
- : { subcommands: planned.subcommands, defaultSubcommand: planned.subcommands[0] }),
101
- });
102
-
103
- /**
104
- * Throws rather than returning a failed `CommandResult`: `dispatch` renders a thrown
105
- * `UltimateError` through the same 3-line contract and the same `--json` shape, so a planned
106
- * command reads byte-identically to any other typed failure.
107
- */
108
- const toCommand = (planned: PlannedCommand): CliCommand => ({
109
- spec: specFor(planned),
110
- // `async` is load-bearing: a synchronous throw would escape every caller that awaits the
111
- // promise this signature promises, including the dispatcher's own error path.
112
- async run(): Promise<CommandResult> {
113
- throw plannedCommandError(planned);
114
- },
115
- });
116
-
117
- export const plannedCommands = (): readonly CliCommand[] => PLANNED_COMMANDS.map(toCommand);
@@ -4,13 +4,14 @@
4
4
  // `runShot`, so a cell's `verdict.json` means exactly what a single shot's does.
5
5
 
6
6
  // why: no Bun native joins a path.
7
- import { join, relative } from 'node:path';
7
+ import { join } from 'node:path';
8
8
  import { escapeHtml } from '@ultimat3/core';
9
9
  import { routeEntries } from '@ultimat3/render';
10
10
  import { loadApp } from './app-load';
11
11
  import type { ShotRun } from './cmd-shot';
12
12
  import { BadFlagError } from './errors';
13
13
  import type { CommandResult } from './output';
14
+ import { posixRelative } from './posix-path';
14
15
  import { localizedShotPath } from './shot-locale';
15
16
  import type { ShotServer } from './shot-server';
16
17
  import { SHOT_DIR } from './shot-server';
@@ -185,7 +186,7 @@ export async function runShotMatrix(run: MatrixRun): Promise<CommandResult> {
185
186
  shots.push({
186
187
  cell,
187
188
  ok: artifacts.verdict.ok,
188
- image: relative(run.outDir, artifacts.image).split('\\').join('/'),
189
+ image: posixRelative(run.outDir, artifacts.image),
189
190
  });
190
191
  }
191
192
  } finally {