@ultimat3/cli 31.26.0 → 31.28.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.
- package/CLAUDE.md +47 -37
- package/README.md +19 -8
- package/package.json +29 -29
- package/src/app-manifest.ts +6 -1
- package/src/app-mcp.ts +17 -3
- package/src/cmd-cache-spec.ts +5 -2
- package/src/cmd-db-spec.ts +2 -3
- package/src/cmd-db.ts +0 -2
- package/src/cmd-deploy-verify-sample.ts +93 -0
- package/src/cmd-deploy-verify.ts +2 -41
- package/src/cmd-dev-spec.ts +15 -1
- package/src/cmd-dev.ts +31 -4
- package/src/cmd-doctor.ts +15 -4
- package/src/cmd-exercise-spec.ts +7 -1
- package/src/cmd-exercise.ts +22 -10
- package/src/cmd-generate.ts +2 -0
- package/src/cmd-jobs-spec.ts +3 -6
- package/src/cmd-jobs.ts +1 -7
- package/src/cmd-logs-spec.ts +2 -1
- package/src/cmd-logs.ts +9 -28
- package/src/cmd-planned.ts +11 -45
- package/src/cmd-profile-frames.ts +99 -0
- package/src/cmd-profile-spec.ts +24 -0
- package/src/cmd-profile.ts +164 -0
- package/src/cmd-repro-spec.ts +13 -1
- package/src/cmd-repro.ts +37 -5
- package/src/cmd-status-sample.ts +57 -0
- package/src/cmd-status-spec.ts +30 -0
- package/src/cmd-status.ts +108 -0
- package/src/cmd-token-spec.ts +5 -2
- package/src/cmd-token.ts +7 -3
- package/src/cmd-upgrade-codemods.ts +71 -0
- package/src/cmd-upgrade-spec.ts +19 -5
- package/src/cmd-upgrade.ts +91 -34
- package/src/codemods/agents-dev-mcp.ts +50 -0
- package/src/codemods/authenticator-session-refusal.ts +214 -0
- package/src/codemods/biome-no-default-export.ts +58 -0
- package/src/codemods/bunfig-island-coverage.ts +33 -0
- package/src/codemods/chart-dashboard.ts +73 -0
- package/src/codemods/ci-e2e-browser-stock.ts +75 -0
- package/src/codemods/ci-e2e-browser.ts +63 -0
- package/src/codemods/codemod.ts +58 -0
- package/src/codemods/define-error-leaf.ts +73 -0
- package/src/codemods/docs-ci-parts.ts +65 -0
- package/src/codemods/docs-gate-prose.ts +53 -0
- package/src/codemods/docs-island-rows.ts +31 -0
- package/src/codemods/docs-shipped-guards.ts +100 -0
- package/src/codemods/docs-test-services.ts +62 -0
- package/src/codemods/engine-diff.ts +104 -0
- package/src/codemods/engine-edits.ts +111 -0
- package/src/codemods/engine-fs.ts +95 -0
- package/src/codemods/engine.ts +191 -0
- package/src/codemods/format-edited-hook-3122.ts +28 -0
- package/src/codemods/format-edited-hook.ts +152 -0
- package/src/codemods/helm-alerts-objective.ts +105 -0
- package/src/codemods/helm-alerts-stock.ts +108 -0
- package/src/codemods/index.ts +56 -0
- package/src/codemods/metrics-probe-healthz.ts +47 -0
- package/src/codemods/pending.ts +36 -0
- package/src/codemods/repro-gitignore.ts +40 -0
- package/src/codemods/runtime-pin-lines.ts +109 -0
- package/src/codemods/runtime-pin.ts +116 -0
- package/src/codemods/solid-floor.ts +63 -0
- package/src/codemods/test-ports.ts +86 -0
- package/src/codemods/test-suites.ts +37 -0
- package/src/codemods/theme-toggle-mount-over.ts +70 -0
- package/src/codemods/vendored-guards.ts +186 -0
- package/src/codemods/verify-floor-skips.ts +88 -0
- package/src/codemods/verify-floor-steps.ts +90 -0
- package/src/coverage-island.ts +121 -0
- package/src/coverage-lcov.ts +49 -5
- package/src/coverage-remap.ts +146 -0
- package/src/db-replay-engine-prepared.ts +66 -0
- package/src/db-replay-engine-template.ts +156 -0
- package/src/db-replay-engine.ts +4 -0
- package/src/db-replay-scratch-reap.ts +54 -0
- package/src/deploy-verify-flags.ts +9 -2
- package/src/deploy-verify-grade.ts +10 -3
- package/src/dev-boot.ts +14 -1
- package/src/dev-dashboard-guard.ts +57 -10
- package/src/dev-host.ts +46 -0
- package/src/dev-tls-cache.ts +103 -0
- package/src/dev-tls-der.ts +69 -0
- package/src/dev-tls.ts +120 -0
- package/src/doctor-advisory-floors.ts +113 -0
- package/src/doctor-browser.ts +60 -0
- package/src/doctor-guards.ts +39 -86
- package/src/doctor-superseded.ts +67 -0
- package/src/error-codes-doctor.ts +12 -4
- package/src/error-codes-verify.ts +47 -0
- package/src/error-codes.ts +20 -23
- package/src/exercise-database.ts +47 -9
- package/src/exercise-push-device.ts +51 -0
- package/src/exercise-route-api.ts +74 -0
- package/src/exercise-routes.ts +14 -5
- package/src/exercise-services.ts +3 -1
- package/src/exercise-shard-flag.ts +47 -0
- package/src/fix-command.ts +2 -2
- package/src/generate-factories.ts +5 -11
- package/src/generate-feature-required.ts +9 -4
- package/src/generate-files.ts +26 -7
- package/src/generate-kinds.ts +5 -1
- package/src/guards-built-in-codes.ts +36 -0
- package/src/guards-built-in-refusal.ts +25 -0
- package/src/guards-built-in.ts +134 -0
- package/src/guards-materialize.ts +42 -0
- package/src/guards-paths.ts +37 -0
- package/src/guards-shipped-names.ts +38 -0
- package/src/guards-vendored.ts +73 -0
- package/src/guards.ts +105 -34
- package/src/index.ts +10 -0
- package/src/island-bundle-options.ts +48 -0
- package/src/island-bundle.ts +18 -46
- package/src/island-link.ts +5 -0
- package/src/island-outputs.ts +5 -0
- package/src/lint-findings.ts +3 -3
- package/src/mcp-errors-verify.ts +35 -0
- package/src/mcp-errors.ts +21 -20
- package/src/mcp-host-logs.ts +121 -0
- package/src/mcp-host.ts +12 -73
- package/src/measure-scope.ts +23 -3
- package/src/messages-floor.ts +19 -0
- package/src/messages-repro.ts +16 -2
- package/src/messages-status.ts +10 -0
- package/src/messages-upgrade.ts +15 -0
- package/src/messages.ts +22 -1
- package/src/registry.ts +4 -0
- package/src/repro-archive-collect.ts +161 -0
- package/src/repro-archive-write.ts +96 -0
- package/src/repro-archive.ts +161 -0
- package/src/repro-bundle.ts +8 -16
- package/src/repro-errors.ts +14 -2
- package/src/repro-framework.ts +53 -0
- package/src/repro-parse.ts +87 -0
- package/src/repro-redact.ts +218 -0
- package/src/repro-scrub.ts +257 -0
- package/src/role-start-types.ts +7 -0
- package/src/role-start.ts +4 -0
- package/src/serve-boot.ts +7 -1
- package/src/serve-env-tls.ts +57 -0
- package/src/solid-loader.ts +27 -10
- package/src/superseded-match.ts +87 -0
- package/src/superseded.ts +84 -0
- package/src/templates/bun-image.ts +48 -0
- package/src/templates/generate-export-rows.ts +136 -0
- package/src/templates/generate-import-rows.ts +186 -0
- package/src/templates/generate-rows-slice.ts +95 -0
- package/src/templates/github/ci.yml.ts +5 -1
- package/src/templates/guard-released-forms.ts +112 -0
- package/src/templates/guard-runtime-pin-test.ts +54 -0
- package/src/templates/guard-runtime-pin.ts +189 -0
- package/src/templates/scaffold-claude-agents.ts +6 -6
- package/src/templates/scaffold-claude-commands.ts +1 -1
- package/src/templates/scaffold-claude-hook.ts +18 -8
- package/src/templates/scaffold-claude.ts +2 -2
- package/src/templates/scaffold-db-package.ts +3 -0
- package/src/templates/scaffold-docs.ts +34 -30
- package/src/templates/scaffold-guards.ts +73 -39
- package/src/templates/scaffold-repo.ts +4 -8
- package/src/templates/scaffold-site.ts +4 -1
- package/src/templates/scaffold-suites.ts +72 -0
- package/src/templates/scaffold-test-services.ts +35 -10
- package/src/templates/scaffold-verify-floor.ts +53 -31
- package/src/templates/shapes/api.ts +4 -0
- package/src/templates/slice-foundation.ts +3 -3
- package/src/unthrown-codes.ts +3 -1
- package/src/upgrade-bun-floor.ts +4 -0
- package/src/upgrade-clean-tree.ts +54 -0
- package/src/upgrade-gate-codemods-install.ts +40 -0
- package/src/upgrade-gate-codemods.ts +151 -0
- package/src/upgrade-gate.ts +44 -7
- package/src/upgrade-guards-baseline.ts +43 -0
- package/src/upgrade-guards.ts +37 -2
- package/src/upgrade-lock.ts +118 -0
- package/src/upgrade-plan.ts +2 -1
- package/src/upgrade-report-codemods.ts +54 -0
- package/src/upgrade-report.ts +55 -27
- package/src/upgrade-signals.ts +91 -0
- package/src/upgrade-unfinished.ts +61 -0
- package/src/verify-coverage-run.ts +42 -11
- package/src/verify-e2e.ts +115 -4
- package/src/verify-floor.ts +27 -0
- package/src/verify-guard-baseline.ts +109 -0
- package/src/verify-live.ts +72 -0
- package/src/verify-merge-skips.ts +51 -0
- package/src/verify-merge.ts +36 -2
- package/src/verify-run.ts +48 -7
- package/src/verify-services.ts +287 -0
- package/src/verify-skip-reason.ts +53 -0
- package/src/verify-strict.ts +108 -0
- package/src/verify-test-command.ts +129 -0
- package/src/verify-tests.ts +39 -126
- package/types/babel-modules.d.ts +2 -0
- package/wiki/CLI-Reference.md +200 -27
- package/wiki/Caching-And-Invalidation.md +1 -1
- package/wiki/Entities-And-Migrations.md +1 -1
- package/wiki/Interface-Rules.md +17 -8
- package/wiki/Jobs-And-Workflows.md +3 -3
- package/wiki/Known-Gaps.md +5 -1
- package/wiki/MCP-And-AI.md +1 -1
- package/wiki/Observability.md +1 -0
- package/wiki/PWA-And-Offline.md +1 -1
- package/wiki/Project-Layout.md +4 -4
- package/wiki/Troubleshooting.md +3 -3
- package/wiki/Tutorial-05-Deploy-Free.md +2 -2
- package/wiki/Upgrading.md +8 -0
package/CLAUDE.md
CHANGED
|
@@ -18,20 +18,20 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
18
18
|
| Registry | `registry.ts`: every declaration static (`cmd-<name>-spec.ts`), every body `await import()`ed when that command runs ‡ |
|
|
19
19
|
| Startup cost | `sass` loads on the first stylesheet compile (`@ultimat3/render`'s `compileStylesheet`), Babel on the first island transform (`solid-loader.ts`); both pinned by `*-lazy.test.ts` in a child process |
|
|
20
20
|
| Module names | `role-*` / `runtime-*` are booted by `serve.ts` in production; `dev-*` is `x dev`'s alone. Derived from the import graph by `module-naming.test.ts`, never listed |
|
|
21
|
-
| stdout / stderr | `write-line.ts`'s `writeLine` / `writeErrorLine
|
|
21
|
+
| stdout / stderr | `write-line.ts`'s `writeLine` / `writeErrorLine`, never `process.stdout.write`; `stream: 'stderr'` → fd 2 ‡ |
|
|
22
22
|
| `--json` | every command; `dispatch.ts` sets core's log stream to stderr under it. Same data as the human render |
|
|
23
23
|
| I/O | only `dispatch.ts` renders or exits; commands return `CommandResult`. `ok()` / `failed()` write `ok` after the `extra` spread — the verdict cannot be overturned |
|
|
24
24
|
| Staying up | a command still listening when `run` resolves returns `hold` (`hold.ts`); the release runs inside the drain's own deadline |
|
|
25
|
-
| Test execution | `test-shards.ts`'s `testArgs` — one `bun test --parallel=N` per pass (`test-passes.ts`); `live`/`e2e` run serially (`SERIAL_TYPES`, `test-workers.ts`) |
|
|
25
|
+
| Test execution | `test-shards.ts`'s `testArgs` — one `bun test --parallel=N` per pass (`test-passes.ts`); `live`/`e2e` run serially (`SERIAL_TYPES`, `test-workers.ts`); a file's type and each step's argv: `verify-test-command.ts` |
|
|
26
26
|
| Numeric flags | `flag-number.ts` — one reader for `--port` / `--workers` / `--shard` |
|
|
27
27
|
| Shell quoting | `shell-quote.ts`'s `quoteArg` for every value pasted into a `fix:` or a reproduce line |
|
|
28
|
-
| Missing input | `MissingPositionalError
|
|
28
|
+
| Missing input | `MissingPositionalError`; a bare subcommand needs a declared `defaultSubcommand` (`MissingSubcommandError`) ‡ |
|
|
29
29
|
| Closed flag values | read through a function that refuses the rest (`readTarget`, `readMethod`, `readSurfaceFilter`, `isTransport`), from the framework's own set where one exists |
|
|
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
33
|
| Planned commands | `PLANNED_COMMANDS` / `PLANNED_SUBCOMMANDS` (`cmd-planned.ts`): in the registry, exit `X_NOT_IMPLEMENTED` with a fix naming a shipped command |
|
|
34
|
-
| Errors | codes + titles in `error-codes.ts`, a runnable line per code in `mcp-errors.ts` (typed over `CliErrorCode`), classes in `errors.ts` or beside their one thrower when `errors.ts` is at its ceiling. Never a bare `Error` |
|
|
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 |
|
|
37
37
|
| Strings | rendered output through `messages.ts` (missing key renders `⟦key⟧`) ‡ |
|
|
@@ -49,21 +49,26 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
49
49
|
| `verify-drift-owner.ts` | `drift`: an `app.config.ts` under `apps/`/`packages/` is `X_APP_ROOT_NESTED` — one repo, one app, one image, one migration owner |
|
|
50
50
|
| `verify-exercise.ts` / `cmd-exercise.ts` / `exercise-*.ts` | `exercise`: `x exercise --json` as a child, red on its findings |
|
|
51
51
|
| `verify-floor.ts` | `x.verify.json`: a floor step that ran zero tests is `X_VERIFY_SUITE_VANISHED` |
|
|
52
|
-
| `
|
|
52
|
+
| `verify-strict.ts` / `verify-skip-reason.ts` / `verify-guard-baseline.ts` / `verify-merge-skips.ts` | `strict` + `skip` (`X_VERIFY_STRICT_UNRUN`), each zero-check step's reason, per-guard `guardBaseline` † |
|
|
53
|
+
| `verify-live.ts` / `verify-services.ts` | `live`: nothing answering → the gate starts `docker/docker-compose.test.yml`; can't → `X_TEST_SERVICES_UNAVAILABLE` warning |
|
|
54
|
+
| `verify-e2e.ts` / `doctor-browser.ts` | `e2e` floored with no Chrome is `X_VERIFY_E2E_BROWSER_MISSING`; `x doctor` reports the browser |
|
|
55
|
+
| `coverage-remap.ts` / `coverage-island.ts` / `island-bundle-options.ts` | under a coverage build, island chunk lines credited to their sources via the chunk's source map |
|
|
56
|
+
| `coverage-{floor,lcov,source,island,remap}.ts` / `verify-coverage-run.ts` | an app's `unit` coverage floor; `coverage-lcov.ts` is the ONE lcov reader † |
|
|
53
57
|
| `verify-deadline.ts` / `verify-stalled.ts` / `verify-progress.ts` | a step past its deadline is `X_VERIFY_STEP_TIMEOUT`; its children are killed by tag † |
|
|
54
|
-
| `load-findings.ts` | a module-load failure is reported once, by `manifest`;
|
|
55
|
-
| `verify-contract-diff.ts` | `contract-diff`: baseline `x.manifest.json` at HEAD
|
|
58
|
+
| `load-findings.ts` | a module-load failure is reported once, by `manifest`; each step that loads the app stands down (`blockedByLoad`) † |
|
|
59
|
+
| `verify-contract-diff.ts` | `contract-diff`: baseline `x.manifest.json` at HEAD, in CI at the merge base † |
|
|
56
60
|
| `verify-factories.ts` | `unit` lints `<app>/packages/db/factories.ts` (`X_TEST_FACTORY_INVALID`) |
|
|
57
|
-
| `verify-seeds.ts` / `verify-seeds-probe.ts` | `unit` runs the seeds in a child on
|
|
61
|
+
| `verify-seeds.ts` / `verify-seeds-probe.ts` | `unit` runs the seeds in a child on `x exercise`'s scratch database; an uncoded throw is `X_SEED_FAILED` † |
|
|
58
62
|
| `boundary-findings.ts` / `app-boundaries.ts` / `boundary-cuts.ts` / `package-boundaries.ts` | surface + layer rules, `X_BOUNDARY_PACKAGE_TO_APP`; a `fix:` is the concrete cut † |
|
|
59
63
|
| `app-boundaries.ts` (workspaces) | `@<scope>/<app>/<rest>` resolves onto `apps/<app>/<rest>` when that is an app source, so the surface rules hold across app workspaces |
|
|
60
|
-
| `app-transport.ts` / `browser-transport.ts` / `transport-calls
|
|
64
|
+
| `app-transport.ts` / `browser-{transport,import-chain,barrel-cut}.ts` / `transport-{calls,values}.ts` / `binding-names.ts` / `import-closure.ts` / `server-barrels.ts` | `boundaries`, built in: one browser transport; a server barrel below an island is cut at its first hop † |
|
|
61
65
|
| `guards.ts` / `guard-sources.ts` | an app's `guards/*.ts`, run on `boundaries`; ONE shared walk (`GuardSources`) † |
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
66
|
+
| `guards-built-in.ts` / `guards-built-in-refusal.ts` | shipped guards run from the installed CLI, never a copy; `guards/shipped.json` is the opt-in and the severities; `x g guard <shipped>` is `X_GUARD_BUILT_IN` |
|
|
67
|
+
| `templates/scaffold-guards.ts` | `SHIPPED`, the one list of shipped guards (`guards-built-in.ts`, `doctor-guards.ts`, `codemods/vendored-guards.ts`) † |
|
|
68
|
+
| `error-contract.ts` / `ts-scan.ts` / `fix-scan.ts` / `fix-imports.ts` / `fix-command.ts` / `fix-path.ts` | the `errors` step: every `fix:` names a runnable command, call or existing file † |
|
|
69
|
+
| `fix-sequence.ts` | `errors`: a deferring, re-run-only or `--force` fix is `X_ERROR_FIX_INVALID`, ratcheted per file † |
|
|
65
70
|
| `workspace-checks.ts` / `test-only-shipped.ts` / `workspace-graph.ts` / `tsconfig-references.ts` / `publish-closure.ts` | `package-shape`, `filesize` ‡ |
|
|
66
|
-
| `workspace-external-deps.ts` · `tsconfig-aliases.ts` · `error-codes-package.ts` | `package-shape`:
|
|
71
|
+
| `workspace-external-deps.ts` · `tsconfig-aliases.ts` · `error-codes-package.ts` | `package-shape`: an undeclared registry import is `X_WORKSPACE_EXTERNAL_DEP_UNDECLARED`; the step family's codes † |
|
|
67
72
|
| `app-permissions*.ts` / `permission-grants.ts` | `policy`: `X_PERMISSION_UNGRANTED`, `X_PERMISSION_BORROWED` † |
|
|
68
73
|
| `job-registration.ts` | `manifest`: no job or task under a positional `anonymous-*` name (`X_JOB_UNREGISTERED`) |
|
|
69
74
|
| `unscanned-admin.ts` | `manifest`: a `defineAdmin()` outside the app scan (`apps/*/src/`) is `X_ADMIN_UNSCANNED` |
|
|
@@ -76,20 +81,20 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
76
81
|
| `db-rolling.ts` / `doctor-rolling.ts` | `drift`'s rolling rail (`X_MIGRATION_ROLLING_UNSAFE`) † |
|
|
77
82
|
| `redundant-indexes.ts` / `doctor-redundant-indexes.ts` | covered indexes: `gen --drop-redundant` drops, `drift` excuses, `x doctor` lists |
|
|
78
83
|
| `schema-dump-drift.ts` | also the dump-vs-newest-snapshot rail, no database (`X_DB_DRIFT`) ‡ |
|
|
79
|
-
| `i18n-registration.ts` / `i18n-audit.ts` / `admin-catalog-keys.ts` | `i18n`; a mounted admin's keys
|
|
80
|
-
| `error-unthrown.ts` / `unthrown-codes.ts` | host check: a registered code nothing throws is listed in `UNTHROWN_CODES
|
|
84
|
+
| `i18n-registration.ts` / `i18n-audit.ts` / `admin-catalog-keys.ts` | `i18n`; a mounted admin's keys come from `AdminApp.catalogKeys()` (`X_CATALOG_MISSING_KEYS`) † |
|
|
85
|
+
| `error-unthrown.ts` / `unthrown-codes.ts` | host check: a registered code nothing throws is listed in `UNTHROWN_CODES`; stale is `X_ERROR_CODE_UNTHROWN_STALE` † |
|
|
81
86
|
| `lint-findings.ts` | `lint`: `biome check --reporter=json` as one finding per diagnostic |
|
|
82
87
|
| `i18n-app-key-shapes.ts` | every shape whose literal is a catalog key; `i18n-app-key-shapes.test.ts` reads `blocks`, so a new block reds until listed |
|
|
83
88
|
| `job-budget.ts` | `X_JOB_OUTLASTS_DRAIN` (`manifest`): `timeout` vs `workerBudgetMs(drain)`, from the registry † |
|
|
84
89
|
| `output-findings.ts` | render layer only: `runnableFix` (`bunx x`, decided by `dispatch.ts`'s `readerFor`) and `collapseFindings`. Throw sites keep `x …` |
|
|
85
90
|
| `app-load-unresolved.ts` | `X_APP_IMPORT_UNRESOLVED`, read by the scan, `findingFrom` and `x doctor`'s `snapshots` probe |
|
|
86
|
-
| `fix-truth.test.ts` / `fix-truth-fixture.ts` / `db-fix-truth.job.test.ts` | a printed fix, executed
|
|
91
|
+
| `fix-truth.test.ts` / `fix-truth-fixture.ts` / `db-fix-truth.job.test.ts` | a printed fix, executed against a broken scaffold † |
|
|
87
92
|
|
|
88
93
|
### Generators (`x g`, `x new`)
|
|
89
94
|
|
|
90
95
|
| File | Job |
|
|
91
96
|
|---|---|
|
|
92
|
-
| `cmd-generate.ts` / `generate-files.ts` / `generate-kinds.ts` / `generate-write.ts` | argv → pure file list →
|
|
97
|
+
| `cmd-generate.ts` / `generate-files.ts` / `generate-kinds.ts` / `generate-write.ts` | argv → pure file list → conflict-checked writes † |
|
|
93
98
|
| `templates/workspace.ts` | `x g app` / `x g package`: a workspace the root globs and the one tsconfig alias (`@<app>/*` → `packages/*/src`, then `apps/*`) already reach |
|
|
94
99
|
| `write-generated.ts` | `x new`'s writer: a `link` file is a relative symlink, a copy only on a refusing win32 |
|
|
95
100
|
| `generate-feature.ts` | a `--feature` naming no slice is `X_FEATURE_UNKNOWN`; nothing invents an entity |
|
|
@@ -97,7 +102,7 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
97
102
|
| `generate-plural.ts` | a planned `entity.ts` in an already-plural slice (`posts` → `postses`) is `X_CLI_BAD_FLAG`; the fix names the singular |
|
|
98
103
|
| `generate-catalog-locales.ts` | `--locales` never starts a catalog; missing locale is `X_CLI_BAD_FLAG` † |
|
|
99
104
|
| `app-name.ts` | `x new`'s slug is asked of core's `defineConfig`, never a copied pattern; refused with a suggested name (`9lives` → `app-9lives`, `a` → `a-app`, cut at 64) |
|
|
100
|
-
| `generate-grants.ts` | a written `policy.ts` grants the set the run wrote
|
|
105
|
+
| `generate-grants.ts` | a written `policy.ts` grants the set the run wrote, never one already in the file ‡ † |
|
|
101
106
|
| `policy-append.ts` | a second `x g policy` appends its set; the same set again is the conflict, fix another set |
|
|
102
107
|
| `scaffold-growth.contract.test.ts` | an entity gaining a defaulted and a nullable column breaks no generated insert (`Insertable`) |
|
|
103
108
|
| `api-registration.ts` | a written job or task is listed in `apps/web/api/index.ts` |
|
|
@@ -112,51 +117,53 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
112
117
|
| `generate-invite*.ts`, `templates/invite*.ts` | `x g invite`: no name; three actions + two pages over `defineMemberInvite` |
|
|
113
118
|
| `generate-format-written.ts` | the app's Biome over the TypeScript a run created, best effort; `lint` judges |
|
|
114
119
|
| `templates/scaffold-mcp-{json,endpoint,admin}.ts` | `.mcp.json` (`bunx @ultimat3/cli mcp serve`, never `bunx x`) and the refusing MCP endpoints ‡ |
|
|
120
|
+
| `templates/scaffold-suites.ts` | the `live` + `e2e` suites every scaffold ships: both steps run from the first commit |
|
|
115
121
|
|
|
116
122
|
### Boot (`x dev`, the container)
|
|
117
123
|
|
|
118
124
|
| File | Job |
|
|
119
125
|
|---|---|
|
|
120
126
|
| `serve.ts` / `serve-boot.ts` / `serve-entry.ts` / `serve-env.ts` | the production entry: `ROLE`, env bindings, `ROLE=migrate`; `X_APP_MODULE_LOAD_FAILED` † |
|
|
121
|
-
| `app-load-batch.ts` / `app-load-register.ts` | one hook module per app module,
|
|
122
|
-
| `app-load-prebuilt.ts` / `build-registry.ts` / `build-registry-background.ts` | every serving role boots from the prebuilt registry (`
|
|
127
|
+
| `app-load-batch.ts` / `app-load-register.ts` | one hook module per app module, registered in order; registration state † |
|
|
128
|
+
| `app-load-prebuilt.ts` / `build-registry.ts` / `build-registry-background.ts` | every serving role boots from the prebuilt registry (`x build`); stale → scan † |
|
|
123
129
|
| `generate-refresh.ts` | `x g` refreshes the manifest only when a written file needs it |
|
|
124
130
|
| `role-load.ts` / `document-graph.ts` / `serve-web.ts` | a role imports what it runs: `ROLE_LOADS` (`X_ROLE_LOAD_INCOMPLETE`) † |
|
|
125
131
|
| `module-imports.ts` | a module's imports, resolved once for both graphs: `referenced` (reload), `evaluated` (document) |
|
|
126
|
-
| `dev-rebuild-remount.ts` / `dev-rebuild-schema.ts` | a save that changes what `x dev` mounted
|
|
132
|
+
| `dev-rebuild-remount.ts` / `dev-rebuild-schema.ts` | a save that changes what `x dev` mounted is a restart; entities ahead of migrations are `X_DB_DRIFT` † |
|
|
127
133
|
| `dev-log.ts` | every logger line to `<stateDir>/dev.log` (`logs.tail`); `dev.log.1` at 16 MiB |
|
|
128
|
-
| `cmd-dev.ts` / `dev-boot.ts` / `dev-rebuild.ts` / `dev-route-table.ts` | `x dev`: every role in one process, `/_x`, the watcher; one save = one generation
|
|
134
|
+
| `cmd-dev.ts` / `dev-boot.ts` / `dev-rebuild.ts` / `dev-route-table.ts` | `x dev`: every role in one process, `/_x`, the watcher; one save = one generation † |
|
|
129
135
|
| `runtime-bindings.ts` | which service each binding points at (embedded or external); events follow `NATS_URL` |
|
|
130
136
|
| `runtime-queue.ts` / `runtime-services.ts` / `runtime-bus.ts` | db + queue; every other accessor; the bus |
|
|
131
137
|
| `framework-schema-apply.ts` / `framework-schema-stamp.ts` | the framework tables, applied in one locked transaction † |
|
|
132
|
-
| `runtime-isr.ts` | the ISR controller both boots serve through,
|
|
133
|
-
| `runtime-mfa-warning.ts` / `runtime-idempotency-scope.ts` | boot warnings: unsealed MFA secrets
|
|
138
|
+
| `runtime-isr.ts` | the ISR controller both boots serve through, attached to `invalidateTags` (`attachedIsr`) † |
|
|
139
|
+
| `runtime-mfa-warning.ts` / `runtime-idempotency-scope.ts` | boot warnings: unsealed MFA secrets, a per-process idempotency store † |
|
|
134
140
|
| `app-config-load.ts` | the ONE reader of `app.config.ts` (`loadAppConfig`) † |
|
|
135
141
|
| `theme-brand.ts` | the ONE reader of an app's theme (`brand` in `apps/web/shared/theme.ts`) † |
|
|
136
142
|
| `runtime-{jobs,realtime,notify-retention,cache,purge,replica}.ts` | the `app.config.ts` sections the boot obeys (`*Of(config)`) † |
|
|
137
|
-
| `runtime-cache-bus.ts` | which bus carries cache/ISR invalidations
|
|
138
|
-
| `runtime-jobs.ts` (queues) | `
|
|
143
|
+
| `runtime-cache-bus.ts` | which bus carries cache/ISR invalidations across replicas; one `cache.broadcast` boot line † |
|
|
144
|
+
| `runtime-jobs.ts` (queues) | `WORKER_QUEUES` = the EXACT set, else `X_WORKER_QUEUE_UNKNOWN`; `-unserved.ts`: what no worker serves † |
|
|
139
145
|
| `serve-retire.ts` / `dev-restart-retire.ts` | the worker retire (SIGUSR2, before an `x dev` restart's drain) † |
|
|
140
146
|
| `role-start*.ts` / `role-realtime.ts` | `--role` selection, start/stop per role, device mounts † |
|
|
141
147
|
| `role-wake.ts` | the worker's LISTEN session (`@ultimat3/jobs`' `startQueueWake`) — worker role only, only over a client that `canListen` — and `queue_wake_live` |
|
|
142
148
|
| `role-sync.ts` / `role-replicator.ts` / `runtime-live-feed.ts` | the sync node, the change feed |
|
|
143
149
|
| `runtime-render*.ts` / `runtime-{isr-outcome,assets,storage,hooks}.ts` / `route-islands.ts` / `api-routes.ts` | the HTTP surface both boots mount † |
|
|
144
|
-
| `asset-route-meta.ts` | the ONE writer of an asset route's `tags: ['assets']` + `rateLimit: 'assets'
|
|
150
|
+
| `asset-route-meta.ts` | the ONE writer of an asset route's `tags: ['assets']` + `rateLimit: 'assets'` † |
|
|
145
151
|
| `client-{errors,vitals}-*.ts` | `clientErrors` (and `.vitals`): the script on `app/` (vitals: listed) documents, its `POST` route, mounted by BOTH boots ‡ |
|
|
146
152
|
| `retained-assets.ts` / `-layout.ts` / `-sweep.ts` / `-read.ts` / `-boot.ts` / `-warned.ts` | `assets.retain`: the web boot publishes this build's hashed files before `/readyz` † |
|
|
147
|
-
| `runtime-overrides.ts` / `runtime-ports.ts` / `runtime-port-bindings.ts` | `runtime.ts`: a field per `ADAPTER_PORTS` row
|
|
153
|
+
| `runtime-overrides.ts` / `runtime-ports.ts` / `runtime-port-bindings.ts` | `runtime.ts`: a field per `ADAPTER_PORTS` row; unbound row = build error † |
|
|
148
154
|
| `plain-routes.ts` | the plain routes both boots mount and `x routes` lists: `runtime.routes`, then every declared `webhookReceiver()`'s, each once |
|
|
149
155
|
| `app-openapi.ts` | `openapi.json` (complete when `defineApi({ openapi })` is declared) and each bearer mount's own document; staleness for all of them |
|
|
150
156
|
| `script-csp.ts` / `style-csp.ts` / `style-bundle.ts` / `page-sync.ts` / `worker-bundle.ts` | CSP hashes, the CSS file, the page's sync target and worker |
|
|
151
|
-
| `page-navigation.ts` | the client router for `navigation.client` surfaces
|
|
152
|
-
| `page-speculation.ts` | Speculation Rules for documents
|
|
157
|
+
| `page-navigation.ts` | the client router for `navigation.client` surfaces, built once for every target † |
|
|
158
|
+
| `page-speculation.ts` | Speculation Rules for documents without the router (`navigation.speculation`) ‡ † |
|
|
153
159
|
| `static-document.ts` | a served `static` page: `304` on `If-None-Match`; container keeps the document (never `x dev`) † |
|
|
154
|
-
| `island-{bundle,groups,outputs,build-pool,group-cache,cache-inputs,store,sources,runtime}.ts` / `island-realtime*.ts` / `solid-loader.ts` | islands, named by their final bytes
|
|
155
|
-
| `local-cli.ts` / `local-cli-handoff.ts` | a global `x` hands over to the app's own CLI
|
|
160
|
+
| `island-{bundle,groups,outputs,build-pool,group-cache,cache-inputs,store,sources,runtime}.ts` / `island-realtime*.ts` / `solid-loader.ts` | islands, named by their final bytes: one `Bun.build` per route group, cached in `.x/cache/islands/` † |
|
|
161
|
+
| `local-cli.ts` / `local-cli-handoff.ts` | a global `x` hands over to the app's own CLI † |
|
|
156
162
|
| `serve-prebuilt.ts` / `serve-prebuilt-paths.ts` | the image's prebuilt store; a boot that built anything logs `X_IMAGE_NOT_PREBUILT` † |
|
|
157
163
|
| `dev-*.ts` | `x dev` only: dashboard sources, traces, the N+1 ledger, watcher, reload, lock, port |
|
|
158
164
|
| `cmd-stop.ts` / `cmd-stop-spec.ts` | `x stop`: the lock's pid only, SIGTERM, wait; `X_DEV_STOP_TIMEOUT` † |
|
|
159
|
-
| `dev-dashboard-guard.ts` / `loopback-host.ts` | `/_x
|
|
165
|
+
| `dev-dashboard-guard.ts` / `loopback-host.ts` | `/_x`: loopback `Host` (`X_DEV_HOST_REFUSED`) and peer (`X_DEV_PEER_REFUSED`) † |
|
|
166
|
+
| `dev-host.ts` / `dev-tls*.ts` | `x dev --host` (loopback default) and `--tls`: a cached self-signed cert in `.x/tls/`, WebCrypto + hand-written DER |
|
|
160
167
|
| `doctor-pooler.ts` / `runtime-statement-bound.ts` | the statement bound and a pooler's refusal, one finding, one boot line † |
|
|
161
168
|
|
|
162
169
|
### Build and data
|
|
@@ -176,18 +183,21 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
176
183
|
|---|---|
|
|
177
184
|
| `cmd-registries.ts` / `cmd-jobs.ts` / `cmd-tasks.ts` / `cmd-policy.ts` / `cmd-i18n.ts` | project a framework registry; each pairs CLI wiring with a facts module |
|
|
178
185
|
| `cmd-auth.ts` / `cmd-auth-spec.ts` / `doctor-auth.ts` | `x auth seal-mfa`: seals plaintext `x_users.mfa_secret` through auth's `sealMfaSecrets` |
|
|
179
|
-
| `cmd-mcp.ts` / `mcp-host
|
|
186
|
+
| `cmd-mcp.ts` / `mcp-host*.ts` / `mcp-errors.ts` / `mcp-db-target.ts` / `mcp-test-{output,run}.ts` | `x mcp serve`: 23 tools, two transports; `tests.run`/`verify.run` ARE `x test`/`x verify` † |
|
|
180
187
|
| `cmd-shot*.ts` / `cdp-shot-*.ts` / `browser-launcher*.ts` / `island-*` | `x shot` over raw CDP; `verdict.json` names its own blind spots. Not a gate step |
|
|
181
|
-
| `
|
|
188
|
+
| `cmd-profile*.ts` | `x profile <route>`: in-process JSC sampling profile of a route, hottest functions |
|
|
189
|
+
| `mcp-host-logs.ts` | `logs.tail` and `x logs tail`'s reader: path rule, end-first bounded read, per-role tail |
|
|
190
|
+
| `shot-route.ts` / `shot-run.ts` / `shot-gpu.ts` | `x shot`'s route argument, one capture, the page's GPU adapter (never gating) † |
|
|
182
191
|
| `cmd-pr.ts` / `cmd-ci.ts` / `ci-runs.ts` / `ci-tested.ts` | GitHub through `gh`, schema-parsed; not gate steps † |
|
|
183
192
|
| `pr-threads.ts` / `pr-activity.ts` | `x pr review`'s ONE GraphQL document: threads, plus every review (verdict, body) and issue comment |
|
|
184
193
|
| `pr-bots.ts` | which review bots posted a "did not review" notice (rate/review limit, skipped); `blocked` = no review of theirs after it |
|
|
185
|
-
| `ci-log.ts` | `x ci`'s log reader:
|
|
194
|
+
| `ci-log.ts` | `x ci`'s log reader: markers and fences undone, provenance `source: 'ci-log'` † |
|
|
186
195
|
| `error-catalog.ts` | imports every `@ultimat3/*` package so `x errors` answers for any code |
|
|
187
196
|
| `cmd-docs.ts` / `docs-sources.ts` / `docs-section.ts` | `x docs`: the app's and the CLI's `@ultimat3` docs; `Page#anchor` prints a section † |
|
|
188
197
|
| `cmd-env-init.ts` / `env-production.ts` / `cmd-deploy-preflight.ts` | the one writer of `.env.production`; compose pre-flight (`X_DEPLOY_ENV_MISSING`) † |
|
|
189
198
|
| `cmd-upgrade.ts` / `upgrade-*.ts` | `x upgrade`: one major per run; no `requiresApp` † |
|
|
190
|
-
| `cmd-
|
|
199
|
+
| `codemods/` / `cmd-upgrade-codemods.ts` / `upgrade-gate-codemods.ts` | a template change an app keeps, carried by a codemod (`codemod.ts`, the ONE list `codemods/index.ts`); the hop's installed CLI applies them before its gate; `scripts/template-codemods.ts` refuses a template change with none |
|
|
200
|
+
| `cmd-deploy-verify.ts` / `deploy-verify-*.ts` / `cmd-status*.ts` | `x deploy verify`: the wait, the verdict, lazy sources † · `x status` |
|
|
191
201
|
|
|
192
202
|
## Adding a command
|
|
193
203
|
|
package/README.md
CHANGED
|
@@ -22,10 +22,10 @@ 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]` | 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 |
|
|
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` |
|
|
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
|
-
| `x db gen\|migrate\|reset\|branch\|backfill` | everything DB | `branch` = copy-on-write clone + preview URL; `backfill` dry-runs unless `--write`.
|
|
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)) |
|
|
29
29
|
| `x mcp serve` | `@ultimat3/mcp`'s 19 dev tools, over stdio or HTTP | one catalog, one scope set, both transports |
|
|
30
30
|
| `x upgrade` | one major per run: exact pins, the Bun floor, `bun install`, the gate; an `AGENTS.md` byte-identical to `CLAUDE.md` becomes a symlink to it, a different one is reported in `data.agentsMd` and left | the `--json` report names the wiki section, the guards that differ and what the gate still says ([fields](../../wiki/CLI-Reference.md#x-upgrade)); `bunx @ultimat3/cli@latest upgrade` in an app that predates it; pins with no `app.config.ts` still hop, and `data.proof` says what checked them |
|
|
31
31
|
| `x doctor` | environment, ports, drift, PWA prerequisites, `APP_URL` | every finding carries a fix command; probes the port `x dev` binds ([which one](../../wiki/CLI-Reference.md#x-doctor)); the framework's deploy secrets only where the machine names `staging`/`production` |
|
|
@@ -43,16 +43,18 @@ Commands and the `x verify` step count, `As of 2026-08`:
|
|
|
43
43
|
| `x i18n check\|add\|sync` | catalogs: gaps, a new locale, key sync | all three of i18n's own error fixes name it |
|
|
44
44
|
| `x errors explain <CODE>` / `list` | the error table, programmatically | refuses an unregistered code instead of inventing one |
|
|
45
45
|
| `x repro <id> [--write] [--verify]` / `--list` / `--from` | a dead job or a captured 5xx as a red test in `repro/` | `--verify` answers `{ reproduced, code, fingerprint }`; a mismatch is `X_REPRO_NOT_REPRODUCED`, never a crash |
|
|
46
|
+
| `x repro <id> --bundle` | the failure as one redacted `repro/bundle-<id>.json` for an issue | secrets masked, env values / hostnames / paths replaced; `bunx create-ultimate repro <file>` opens it |
|
|
46
47
|
| `x docs "<question>"` | the framework docs and the wiki, offline | answered from the installed packages and the `wiki/` this tarball ships (`prepack`: `scripts/pack-cli-wiki.ts`), never the network; `x docs Upgrading#<anchor>` prints one whole section |
|
|
47
48
|
| `x graph [--from a --to b]` / `x impact <file\|primitive\|entity>` | the app as one typed graph (`@ultimat3/manifest`'s `buildGraph` over the loaded app, its module graph and `.x/exercise.json`) · what an edit reaches | every edge `declared`, `import` or `observed`; a miss is `X_GRAPH_NODE_UNKNOWN` with the nearest three; `x affected` in an app root adds `data.tests` by import closure ([details](../../wiki/CLI-Reference.md#x-graph--x-impact)) |
|
|
48
49
|
| `x client vendor <name>` / `x client customer --out <dir>` | one OpenAPI compiler (`openapi-compile.ts`), two emitters: a vendor's document into `apps/web/clients/<name>/` (`outbound()` + `t`), or the app's published document into a client with no framework import | every generated file is stamped with its source and body hash; `drift` raises `X_CLIENT_STALE` / `X_CLIENT_EDITED` ([flags](../../wiki/CLI-Reference.md#x-client)) |
|
|
49
50
|
| `x fix boundary <file>` | the minimal cut for a crossed surface boundary | prints the plan and the `git mv`; never rewrites a file |
|
|
50
51
|
| `x ci [runs]` / `x ci tested` | CI triage through `gh`; `tested`: may this push reuse a green PR run of the same tree | `tested` exits 0 on every answer, `data.tested`; any doubt is `false`, a full run ([conditions](../../wiki/CLI-Reference.md#x-pr--x-ci)) |
|
|
51
|
-
| `x token create\|list\|revoke` | MCP / API tokens in `x_api_keys` | `create --scopes a,b` prints the plaintext once and stores its hash; `list --owner <id>` carries no secret; `grant
|
|
52
|
+
| `x token create\|list\|revoke` | MCP / API tokens in `x_api_keys` | `create --scopes a,b` prints the plaintext once and stores its hash; `list --owner <id>` carries no secret; no `grant`: a wider set is a new key ([details](../../wiki/CLI-Reference.md#x-token)) |
|
|
52
53
|
| `x config show [--section <key>]` | the resolved `app.config.ts` | defaults merged by `defineConfig`; credential keys, `secret()` values and URL passwords redacted |
|
|
53
54
|
| `x logs tail [--lines n] [--role <role>]` | the end of `.x/dev.log` or a role log | the `logs.tail` MCP tool's file and reader |
|
|
54
|
-
| `x cache graph\|bust <tag>\|clear` | the tag graph off the manifest; a bust through the app's own tiers and bus | an in-process bus is said in the summary; a failed tier is `X_CACHE_DRIVER_UNAVAILABLE
|
|
55
|
+
| `x cache graph\|bust <tag>\|clear` | the tag graph off the manifest; a bust through the app's own tiers and bus | an in-process bus is said in the summary; a failed tier is `X_CACHE_DRIVER_UNAVAILABLE` |
|
|
55
56
|
| `x explain <query> [--input <json>] [--org <id>]` | one query's statements, planned on the dev database | the `exercise` step's oracle (`sweepPlans`): an unindexed read is `X_QUERY_UNINDEXED` with the `indexes:` entry as its fix |
|
|
57
|
+
| `x status [--url <origin>] [--samples n]` | the build each live worker runs, and what each origin's `/readyz` answers | a read, exit 0; `data.unrecorded` names the roles no fleet-wide record covers ([details](../../wiki/CLI-Reference.md#x-status)) |
|
|
56
58
|
|
|
57
59
|
Everything in [CLI reference](../../wiki/CLI-Reference.md)'s planned table is also in the registry
|
|
58
60
|
and exits `X_NOT_IMPLEMENTED` with a `fix:` naming the closest shipped command — "not built yet"
|
|
@@ -179,10 +181,17 @@ is held to the same error contract shipped source is (`X_GUARD_INVALID`, `X_GUAR
|
|
|
179
181
|
`X_GUARD_FINDING_INVALID`). A guard that exports `severity: 'warning'` is **report-only** (`As of
|
|
180
182
|
31.22`): its findings ride the step as `warnings` — in `--json` and on the step line, never a
|
|
181
183
|
failure — so a rule ships to every app before the apps are clean of it; a finding that breaks the
|
|
182
|
-
contract fails either way. `repo-await-in-loop`
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
contract fails either way. `repo-await-in-loop` ships that way. `x g guard <name>` scaffolds the
|
|
185
|
+
app's own with its test.
|
|
186
|
+
|
|
187
|
+
The twenty-six shipped guards (`SHIPPED_GUARD_NAMES`) run **built in**, from the installed CLI,
|
|
188
|
+
never from a copy (`guards-built-in.ts`, `As of 2026-11`): `x new` writes only
|
|
189
|
+
`guards/shipped.json`, `{ "severity": { "<guard>": "error" | "warning" | "off" } }`, and its
|
|
190
|
+
presence is the opt-in. Absent (a legacy app), a shipped guard the app holds a copy of runs that
|
|
191
|
+
copy and one it does not reports only; a copy is one `X_GUARD_VENDORED` warning, on `boundaries`
|
|
192
|
+
and in `x doctor`, fix `x upgrade` — whose `vendored-guards` codemod deletes each identical copy and
|
|
193
|
+
keeps an edit as a row or as `guards/app-<name>.ts`. A built-in is held by `guardBaseline` under
|
|
194
|
+
its name like any guard.
|
|
186
195
|
|
|
187
196
|
## Layout
|
|
188
197
|
|
|
@@ -199,6 +208,8 @@ app does not hold (`X_SHIPPED_GUARD_MISSING`, beside the verdict, never in it).
|
|
|
199
208
|
| `generate-kinds.ts` | which generators exist, and how a command line names one |
|
|
200
209
|
| `guards.ts` | the app's own conventions: `guards/` discovered, run, and held to the error contract |
|
|
201
210
|
| `guard-sources.ts` | one walk, one read and one Sass compile per file per gate run, shared by every guard |
|
|
211
|
+
| `guards-built-in.ts` | the shipped guards, run from the installed CLI: `guards/shipped.json`, the plan, the module under `.x/cache/guards/` |
|
|
212
|
+
| `codemods/vendored-guards.ts` | `x upgrade`'s migration off vendored copies: identical deleted, an edit kept as config or an app guard |
|
|
202
213
|
| `cmd-*.ts` | one command group each |
|
|
203
214
|
| `templates/` | scaffolding as typed string modules, not copied fixtures |
|
|
204
215
|
| `app-load.ts` | import an app's modules so the framework registries hold it |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/cli",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.28.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.9",
|
|
56
|
-
"@ultimat3/action": "31.
|
|
57
|
-
"@ultimat3/admin": "31.
|
|
58
|
-
"@ultimat3/ai": "31.
|
|
59
|
-
"@ultimat3/auth": "31.
|
|
60
|
-
"@ultimat3/cache": "31.
|
|
61
|
-
"@ultimat3/core": "31.
|
|
62
|
-
"@ultimat3/db": "31.
|
|
63
|
-
"@ultimat3/entity": "31.
|
|
64
|
-
"@ultimat3/flags": "31.
|
|
65
|
-
"@ultimat3/http": "31.
|
|
66
|
-
"@ultimat3/i18n": "31.
|
|
67
|
-
"@ultimat3/jobs": "31.
|
|
68
|
-
"@ultimat3/mail": "31.
|
|
69
|
-
"@ultimat3/manifest": "31.
|
|
70
|
-
"@ultimat3/mcp": "31.
|
|
71
|
-
"@ultimat3/money": "31.
|
|
72
|
-
"@ultimat3/notify": "31.
|
|
73
|
-
"@ultimat3/policy": "31.
|
|
74
|
-
"@ultimat3/pwa": "31.
|
|
75
|
-
"@ultimat3/query": "31.
|
|
76
|
-
"@ultimat3/realtime": "31.
|
|
77
|
-
"@ultimat3/render": "31.
|
|
78
|
-
"@ultimat3/schema": "31.
|
|
79
|
-
"@ultimat3/scraping": "31.
|
|
80
|
-
"@ultimat3/seo": "31.
|
|
81
|
-
"@ultimat3/storage": "31.
|
|
82
|
-
"@ultimat3/testing": "31.
|
|
83
|
-
"@ultimat3/time": "31.
|
|
56
|
+
"@ultimat3/action": "31.28.0",
|
|
57
|
+
"@ultimat3/admin": "31.28.0",
|
|
58
|
+
"@ultimat3/ai": "31.28.0",
|
|
59
|
+
"@ultimat3/auth": "31.28.0",
|
|
60
|
+
"@ultimat3/cache": "31.28.0",
|
|
61
|
+
"@ultimat3/core": "31.28.0",
|
|
62
|
+
"@ultimat3/db": "31.28.0",
|
|
63
|
+
"@ultimat3/entity": "31.28.0",
|
|
64
|
+
"@ultimat3/flags": "31.28.0",
|
|
65
|
+
"@ultimat3/http": "31.28.0",
|
|
66
|
+
"@ultimat3/i18n": "31.28.0",
|
|
67
|
+
"@ultimat3/jobs": "31.28.0",
|
|
68
|
+
"@ultimat3/mail": "31.28.0",
|
|
69
|
+
"@ultimat3/manifest": "31.28.0",
|
|
70
|
+
"@ultimat3/mcp": "31.28.0",
|
|
71
|
+
"@ultimat3/money": "31.28.0",
|
|
72
|
+
"@ultimat3/notify": "31.28.0",
|
|
73
|
+
"@ultimat3/policy": "31.28.0",
|
|
74
|
+
"@ultimat3/pwa": "31.28.0",
|
|
75
|
+
"@ultimat3/query": "31.28.0",
|
|
76
|
+
"@ultimat3/realtime": "31.28.0",
|
|
77
|
+
"@ultimat3/render": "31.28.0",
|
|
78
|
+
"@ultimat3/schema": "31.28.0",
|
|
79
|
+
"@ultimat3/scraping": "31.28.0",
|
|
80
|
+
"@ultimat3/seo": "31.28.0",
|
|
81
|
+
"@ultimat3/storage": "31.28.0",
|
|
82
|
+
"@ultimat3/testing": "31.28.0",
|
|
83
|
+
"@ultimat3/time": "31.28.0",
|
|
84
84
|
"babel-preset-solid": "^1.9.16"
|
|
85
85
|
}
|
|
86
86
|
}
|
package/src/app-manifest.ts
CHANGED
|
@@ -44,6 +44,9 @@ const RUNTIME_JOBS: Readonly<Record<string, unknown>> = { sendMailJob };
|
|
|
44
44
|
/** Load the app, then describe it. Every command that needs facts goes through here. */
|
|
45
45
|
export async function appManifest(root: string): Promise<AppManifest> {
|
|
46
46
|
const loaded = await loadApp(root);
|
|
47
|
+
// At its point of use: every serving role evaluates this module, and the guard projection is
|
|
48
|
+
// facts for the file, never a boot dependency (`serve-graph.test.ts`' ceilings).
|
|
49
|
+
const { builtInGuardCodes, withBuiltInGuardCodes } = await import('./guards-built-in-codes');
|
|
47
50
|
// Through the registrar `defineApi` uses (`define-api.ts`): the declared name wins, and the
|
|
48
51
|
// same handle seated twice is one registration, so a second build of one tree is unchanged.
|
|
49
52
|
primitiveRegistrar('job')(RUNTIME_JOBS);
|
|
@@ -57,7 +60,9 @@ export async function appManifest(root: string): Promise<AppManifest> {
|
|
|
57
60
|
// imported every app module, so each `defineCatalogs()` has run and registered its locales.
|
|
58
61
|
// Counting catalog files instead would be a second answer, wrong the day the two disagree.
|
|
59
62
|
locales: registeredLocales(),
|
|
60
|
-
|
|
63
|
+
// The shipped guards this app runs built in raise codes its gate emits, as a vendored copy's
|
|
64
|
+
// did: listed, so moving the guard into the framework removes no code from the contract.
|
|
65
|
+
errorCodes: withBuiltInGuardCodes(loaded.errorCodes, await builtInGuardCodes(root)),
|
|
61
66
|
}),
|
|
62
67
|
);
|
|
63
68
|
return { manifest, findings: loaded.findings };
|
package/src/app-mcp.ts
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
import { existsSync } from 'node:fs';
|
|
13
13
|
// why: Bun exposes no path-join primitive; each candidate is joined to root.
|
|
14
14
|
import { join } from 'node:path';
|
|
15
|
-
import { logger } from '@ultimat3/core';
|
|
15
|
+
import { logger, peerAddressClass } from '@ultimat3/core';
|
|
16
16
|
import type { Route } from '@ultimat3/http';
|
|
17
|
-
import { jsonResponse, originListed, selfOrigin } from '@ultimat3/http';
|
|
17
|
+
import { callerLocality, jsonResponse, originListed, selfOrigin } from '@ultimat3/http';
|
|
18
18
|
import {
|
|
19
19
|
type AppMcp,
|
|
20
20
|
assertIncludeCurrent,
|
|
@@ -198,6 +198,20 @@ function mountEndpoints(files: readonly MountFile[]): AppMcpMount {
|
|
|
198
198
|
return { routes, path: paths[0] ?? null, paths, warning };
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Where the endpoint's facts say the caller is. `ctx.ip`, except a RELAYED loopback answer: a LAN
|
|
203
|
+
* socket forging `x-forwarded-for: 127.0.0.1` past a declared hop, or a tunnel on this machine,
|
|
204
|
+
* resolves to 127.0.0.1 — and the scaffold honours its development token from loopback. Those
|
|
205
|
+
* callers are handed `::` (unspecified: never loopback, one shared failure bucket, as they already
|
|
206
|
+
* shared 127.0.0.1's), by http's one rule (`callerLocality`) that `/_x` and the overlay ask too.
|
|
207
|
+
*/
|
|
208
|
+
const RELAYED_LOOPBACK_ADDRESS = '::';
|
|
209
|
+
|
|
210
|
+
export function mcpCallerAddress(ip: string | null, headers: Headers): string | null {
|
|
211
|
+
if (ip === null || peerAddressClass(ip) !== 'loopback') return ip;
|
|
212
|
+
return callerLocality({ ip, headers }) === 'local' ? ip : RELAYED_LOOPBACK_ADDRESS;
|
|
213
|
+
}
|
|
214
|
+
|
|
201
215
|
type Descriptor = NonNullable<AppMcp['route']>;
|
|
202
216
|
|
|
203
217
|
/** One endpoint's `POST` and, when it declared `oauth`, its RFC 9728 metadata `GET`s. */
|
|
@@ -238,7 +252,7 @@ function endpointRoutes(route: Descriptor, path: string, index: number): readonl
|
|
|
238
252
|
handler: (request, ctx) =>
|
|
239
253
|
route.handle(request.raw, {
|
|
240
254
|
origin: selfOrigin(ctx.url, ctx.https),
|
|
241
|
-
address: ctx.ip ?? undefined,
|
|
255
|
+
address: mcpCallerAddress(ctx.ip ?? null, request.raw.headers) ?? undefined,
|
|
242
256
|
// A browser `Origin` is proven the way CSRF proves it: this origin, or one listed exactly.
|
|
243
257
|
listed: (origin) => originListed(ctx.config.cors, origin),
|
|
244
258
|
}),
|
package/src/cmd-cache-spec.ts
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
import type { CommandSpec } from './parse';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* No `stats`: hits and misses are `cache.hit`/`cache.miss` events inside each serving process, and
|
|
8
|
+
* nothing aggregates them for a CLI process to read (`wiki/Known-Gaps.md`).
|
|
9
|
+
*/
|
|
10
|
+
export const CACHE_SUBCOMMANDS = ['graph', 'bust', 'clear'] as const;
|
|
8
11
|
|
|
9
12
|
export const cacheSpec: CommandSpec = {
|
|
10
13
|
name: 'cache',
|
package/src/cmd-db-spec.ts
CHANGED
|
@@ -9,7 +9,6 @@ export const DB_SUBCOMMANDS = [
|
|
|
9
9
|
'migrate',
|
|
10
10
|
'reset',
|
|
11
11
|
'seed',
|
|
12
|
-
'studio',
|
|
13
12
|
'branch',
|
|
14
13
|
'backfill',
|
|
15
14
|
'diagnostics',
|
|
@@ -18,9 +17,9 @@ export const DB_SUBCOMMANDS = [
|
|
|
18
17
|
|
|
19
18
|
export const dbSpec: CommandSpec = {
|
|
20
19
|
name: 'db',
|
|
21
|
-
summary: 'gen, migrate, reset, seed,
|
|
20
|
+
summary: 'gen, migrate, reset, seed, branch, backfill, diagnostics, recount',
|
|
22
21
|
usage:
|
|
23
|
-
'x db gen "add publish_at" [--drop-redundant] | migrate | reset | seed [<name>] [--tier reference|dev] [--dry-run] | seed --generate [--rows n] [--seed n] [--dry-run] |
|
|
22
|
+
'x db gen "add publish_at" [--drop-redundant] | migrate | reset | seed [<name>] [--tier reference|dev] [--dry-run] | seed --generate [--rows n] [--seed n] [--dry-run] | branch list | branch create <name> | branch delete <name> | backfill [<name>|--all] [--write] [--force] | backfill --pending | backfill --list [--name n] [--status s] [--limit n] | diagnostics [--limit n] | recount <entity>.<column> [--write]',
|
|
24
23
|
requiresApp: true,
|
|
25
24
|
subcommands: DB_SUBCOMMANDS,
|
|
26
25
|
// Declared from the constant `runBranchCommand` validates against, never a second literal: it
|
package/src/cmd-db.ts
CHANGED
|
@@ -20,7 +20,6 @@ import { runBackfillCommand } from './cmd-db-backfill';
|
|
|
20
20
|
import { runBranchCommand } from './cmd-db-branch';
|
|
21
21
|
import { runRecountCommand } from './cmd-db-recount';
|
|
22
22
|
import { DB_SUBCOMMANDS, dbSpec } from './cmd-db-spec';
|
|
23
|
-
import { plannedSubcommand } from './cmd-planned';
|
|
24
23
|
import type { CliCommand, CommandContext } from './command';
|
|
25
24
|
import { runDiagnostics } from './db-diagnostics';
|
|
26
25
|
import { stepFinding } from './db-finding';
|
|
@@ -68,7 +67,6 @@ export const dbCommand: CliCommand = {
|
|
|
68
67
|
if (sub === 'migrate') return runMigrate(ctx, root, msg('cli.db.migrate.applied'));
|
|
69
68
|
if (sub === 'reset') return runReset(ctx, root);
|
|
70
69
|
if (sub === 'seed') return runSeed(ctx, root);
|
|
71
|
-
if (sub === 'studio') throw plannedSubcommand('db', 'studio');
|
|
72
70
|
if (sub === 'backfill') return runBackfillCommand(ctx, root);
|
|
73
71
|
if (sub === 'branch') return runBranchCommand(ctx, root);
|
|
74
72
|
if (sub === 'diagnostics') return runDiagnostics(ctx, root);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// One `GET /readyz` against an origin, as `x deploy verify` and `x status` both read it: a fresh
|
|
2
|
+
// connection, uncached, a redirect tallied rather than followed — the status, the build header, the
|
|
3
|
+
// role a health port names. One reader, so the two commands cannot sample the fleet differently.
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
BUILD_ID_HEADER,
|
|
7
|
+
isRole,
|
|
8
|
+
readWithinLimit,
|
|
9
|
+
renderThrowable,
|
|
10
|
+
stringField,
|
|
11
|
+
} from '@ultimat3/core';
|
|
12
|
+
|
|
13
|
+
export interface ReadyzAnswer {
|
|
14
|
+
/** `null`: nothing answered — refused, reset or timed out. */
|
|
15
|
+
readonly status: number | null;
|
|
16
|
+
/** `x-ultimate-build` as answered, on any status. `null`: no header, or an empty one. */
|
|
17
|
+
readonly build: string | null;
|
|
18
|
+
/** Answered from a cache (`Age` > 0): a CDN's copy says nothing about the fleet behind it. */
|
|
19
|
+
readonly cached: boolean;
|
|
20
|
+
/** The body's `role`, when it is one: a role's own health port says it; the web port does not. */
|
|
21
|
+
readonly role: string | null;
|
|
22
|
+
/** The transport's failure, rendered, when nothing answered. */
|
|
23
|
+
readonly failure?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** A `/readyz` body is a few dozen bytes; past this it is not parsed, and the role is unknown. */
|
|
27
|
+
const READYZ_BODY_LIMIT = 4_096;
|
|
28
|
+
|
|
29
|
+
/** The most of a build id a printed line carries; the rest is cut and marked `…`. */
|
|
30
|
+
const PRINTED_BUILD_MAX = 128;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A build id as it may be PRINTED — never as it is MATCHED. The origin is a stranger: a header
|
|
34
|
+
* carrying `\x9b` (CSI) or `\x1b` rewrites the terminal `x status` prints to, and JSON leaves a C1
|
|
35
|
+
* control unescaped. Every character outside visible ASCII and space is written `\uXXXX`, and the
|
|
36
|
+
* result is cut at 128 characters, so a legal id (`release 31.27.0`) prints as itself.
|
|
37
|
+
*/
|
|
38
|
+
export const printableBuild = (value: string): string => {
|
|
39
|
+
const escaped = value.replace(
|
|
40
|
+
/[^\x20-\x7e]/g,
|
|
41
|
+
(char) => `\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`,
|
|
42
|
+
);
|
|
43
|
+
return escaped.length > PRINTED_BUILD_MAX ? `${escaped.slice(0, PRINTED_BUILD_MAX)}…` : escaped;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** A body that is not JSON, or names no role, is an answer with no role — never a failed sample. */
|
|
47
|
+
async function roleOf(response: Response): Promise<string | null> {
|
|
48
|
+
const read = await readWithinLimit(response.body, READYZ_BODY_LIMIT).catch(() => undefined);
|
|
49
|
+
if (read === undefined || !('bytes' in read)) return null;
|
|
50
|
+
let body: unknown;
|
|
51
|
+
try {
|
|
52
|
+
body = JSON.parse(new TextDecoder().decode(read.bytes));
|
|
53
|
+
} catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
// `stringField`, the total read: a parsed stranger's object is never `in`-guarded then read.
|
|
57
|
+
const role = stringField(body, 'role');
|
|
58
|
+
return role !== undefined && isRole(role) ? role : null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* One `GET /readyz` on a connection of its own, so the load balancer chooses again: a kept-alive
|
|
63
|
+
* socket would ask one pod the same question for the whole window. A redirect is an answer to tally,
|
|
64
|
+
* never to follow: another host's `/readyz` says nothing about this origin.
|
|
65
|
+
*/
|
|
66
|
+
export async function takeSample(origin: string, limitMs: number): Promise<ReadyzAnswer> {
|
|
67
|
+
try {
|
|
68
|
+
const response = await fetch(`${origin}/readyz`, {
|
|
69
|
+
keepalive: false,
|
|
70
|
+
redirect: 'manual',
|
|
71
|
+
// Past a CDN or a caching proxy: the question is the fleet, never a stored copy of it.
|
|
72
|
+
headers: { 'cache-control': 'no-cache', pragma: 'no-cache' },
|
|
73
|
+
signal: AbortSignal.timeout(limitMs),
|
|
74
|
+
});
|
|
75
|
+
const header = response.headers.get(BUILD_ID_HEADER);
|
|
76
|
+
const age = Number(response.headers.get('age') ?? '0');
|
|
77
|
+
return {
|
|
78
|
+
status: response.status,
|
|
79
|
+
// As sent: `x deploy verify` matches it against `--build`. Printing screens it, not this.
|
|
80
|
+
build: header === null || header === '' ? null : header,
|
|
81
|
+
cached: Number.isNaN(age) || age > 0,
|
|
82
|
+
role: await roleOf(response),
|
|
83
|
+
};
|
|
84
|
+
} catch (error) {
|
|
85
|
+
return {
|
|
86
|
+
status: null,
|
|
87
|
+
build: null,
|
|
88
|
+
cached: false,
|
|
89
|
+
role: null,
|
|
90
|
+
failure: renderThrowable(error),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|