@ultimat3/cli 30.9.0 → 31.1.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 +80 -64
- package/README.md +4 -1
- package/package.json +30 -29
- package/src/admin-registration.ts +1 -1
- package/src/affected-base.ts +51 -0
- package/src/affected.ts +34 -11
- package/src/app-boundaries.ts +88 -9
- package/src/app-load-async.ts +133 -0
- package/src/app-load-batch.ts +203 -0
- package/src/app-load-prebuilt.ts +147 -0
- package/src/app-load-register.ts +175 -0
- package/src/app-load.ts +143 -175
- package/src/app-loader-imports.ts +31 -0
- package/src/app-root.ts +13 -0
- package/src/app-runtime.ts +5 -1
- package/src/boundary-findings.ts +12 -0
- package/src/browser-launcher-port.ts +3 -7
- package/src/browser-launcher.ts +1 -1
- package/src/budgets-scan.ts +8 -0
- package/src/budgets.ts +10 -1
- package/src/build-registry-background.ts +59 -0
- package/src/build-registry.ts +207 -0
- package/src/cdp-shot-clock.ts +3 -11
- package/src/cdp-shot-driver.ts +3 -2
- package/src/cdp-shot-element.ts +3 -2
- package/src/cdp-shot-page.ts +2 -2
- package/src/cdp-shot-watch.ts +4 -3
- package/src/ci-log.ts +76 -13
- package/src/cmd-affected-spec.ts +7 -3
- package/src/cmd-affected.ts +91 -77
- package/src/cmd-auth.ts +3 -3
- package/src/cmd-ci.ts +6 -3
- package/src/cmd-db-recount.ts +15 -0
- package/src/cmd-drill.ts +10 -6
- package/src/cmd-exercise.ts +2 -1
- package/src/cmd-generate-spec.ts +6 -0
- package/src/cmd-generate.ts +22 -4
- package/src/cmd-mail.ts +1 -1
- package/src/cmd-pr-spec.ts +1 -1
- package/src/cmd-pr.ts +72 -1
- package/src/cmd-routes.ts +2 -2
- package/src/cmd-secrets-spec.ts +4 -1
- package/src/cmd-shot.ts +14 -262
- package/src/cmd-test-spec.ts +2 -2
- package/src/cmd-verify-spec.ts +21 -1
- package/src/cmd-verify.ts +16 -4
- package/src/coverage-source.ts +4 -1
- package/src/db-diagnostics.ts +8 -1
- package/src/dev-boot.ts +29 -15
- package/src/dev-dashboard-invalidations.ts +43 -0
- package/src/dev-dashboard.ts +13 -16
- package/src/dev-n-plus-one.ts +7 -3
- package/src/dev-rebuild.ts +2 -1
- package/src/dev-route-table.ts +1 -1
- package/src/dev-traces.ts +16 -15
- package/src/document-options.ts +12 -1
- package/src/drift-store.ts +55 -0
- package/src/error-catalog.ts +8 -3
- package/src/error-codes-boundary.ts +32 -0
- package/src/error-codes-package.ts +38 -0
- package/src/error-codes.ts +28 -40
- package/src/errors.ts +17 -7
- package/src/exercise-database.ts +13 -1
- package/src/exercise-findings.ts +36 -18
- package/src/exercise-services.ts +84 -0
- package/src/exercise-subject.ts +38 -13
- package/src/failure-capture-boot.ts +9 -5
- package/src/framework-schema.ts +5 -5
- package/src/generate-exercise.ts +1 -1
- package/src/generate-files.ts +27 -7
- package/src/generate-kinds.ts +5 -0
- package/src/generate-refresh.ts +53 -0
- package/src/generate-workspace.ts +169 -0
- package/src/generate-write.ts +8 -2
- package/src/hold.ts +19 -8
- package/src/image-prepare.ts +6 -2
- package/src/index.ts +5 -20
- package/src/island-bundle.ts +7 -3
- package/src/island-capture.ts +2 -2
- package/src/island-harness.ts +1 -1
- package/src/job-registration.ts +43 -6
- package/src/jobs-driver.ts +4 -5
- package/src/mcp-errors.ts +20 -4
- package/src/mcp-host.ts +5 -1
- package/src/mcp-ui-interact.ts +3 -0
- package/src/messages-gate.ts +10 -0
- package/src/new-shapes-generate.ts +1 -1
- package/src/otlp-export.ts +94 -29
- package/src/output.ts +24 -10
- package/src/page-sync.ts +3 -1
- package/src/pr-activity.ts +150 -0
- package/src/pr-bots.ts +109 -0
- package/src/pr-threads.ts +7 -2
- package/src/role-load.ts +17 -11
- package/src/role-start.ts +5 -4
- package/src/role-sync.ts +7 -8
- package/src/route-islands-preload.ts +46 -0
- package/src/route-islands.ts +6 -2
- package/src/runtime-admin.ts +5 -1
- package/src/runtime-bindings.ts +25 -19
- package/src/runtime-boot-ports.ts +66 -0
- package/src/runtime-bus.ts +29 -5
- package/src/runtime-cache-bus.ts +53 -0
- package/src/runtime-cache.ts +43 -13
- package/src/runtime-isr-outcome.ts +5 -4
- package/src/runtime-jobs.ts +2 -2
- package/src/runtime-keys.ts +37 -0
- package/src/runtime-overrides.ts +148 -42
- package/src/runtime-port-bindings-queue.ts +36 -0
- package/src/runtime-port-bindings.ts +117 -0
- package/src/runtime-ports.ts +164 -0
- package/src/runtime-purge.ts +41 -28
- package/src/runtime-push.ts +7 -3
- package/src/runtime-queue.ts +70 -55
- package/src/runtime-realtime.ts +5 -5
- package/src/runtime-render-document.ts +4 -1
- package/src/runtime-services.ts +110 -158
- package/src/runtime-storage-boot.ts +111 -0
- package/src/runtime-storage-upload.ts +9 -7
- package/src/runtime-storage.ts +7 -1
- package/src/serve-boot.ts +8 -4
- package/src/serve-entry.ts +3 -0
- package/src/serve-env.ts +47 -14
- package/src/serve-prebuilt-paths.ts +3 -0
- package/src/serve-prebuilt.ts +15 -4
- package/src/serve.ts +2 -2
- package/src/shot-gpu.ts +61 -0
- package/src/shot-route.ts +95 -0
- package/src/shot-run.ts +189 -0
- package/src/shot-verdict.ts +5 -0
- package/src/static-cards.ts +3 -2
- package/src/static-report.ts +2 -2
- package/src/style-bundle.ts +1 -1
- package/src/sync-authenticator.ts +17 -18
- package/src/templates/action-tests.ts +4 -4
- package/src/templates/backfill.ts +5 -8
- package/src/templates/entity.ts +3 -0
- package/src/templates/github/ci.yml.ts +3 -1
- package/src/templates/github/dependabot.yml.ts +73 -0
- package/src/templates/job.ts +13 -22
- package/src/templates/naming.ts +20 -1
- package/src/templates/pinned/docker-compose.yml +1 -1
- package/src/templates/query.ts +7 -8
- package/src/templates/route.ts +5 -3
- package/src/templates/scaffold-api.ts +1 -1
- package/src/templates/scaffold-auth.ts +5 -3
- package/src/templates/scaffold-claude-commands.ts +6 -3
- package/src/templates/scaffold-claude.ts +4 -4
- package/src/templates/scaffold-container-compose.ts +2 -4
- package/src/templates/scaffold-domain-package.ts +1 -1
- package/src/templates/scaffold-entries.ts +6 -1
- package/src/templates/scaffold-helm-fences.ts +3 -2
- package/src/templates/scaffold-helm.ts +35 -6
- package/src/templates/scaffold-repo.ts +47 -135
- package/src/templates/scaffold-runtime-ports.ts +62 -0
- package/src/templates/scaffold-verify-floor.ts +97 -0
- package/src/templates/shapes/overlay.ts +1 -1
- package/src/templates/sign-in-oidc.ts +5 -3
- package/src/templates/sign-in-shared.ts +28 -10
- package/src/templates/workspace.ts +75 -0
- package/src/test-ignores.ts +5 -2
- package/src/test-select.ts +4 -1
- package/src/tsconfig-aliases.ts +85 -0
- package/src/upgrade-gate.ts +30 -5
- package/src/upgrade-report.ts +7 -1
- package/src/verify-changed-facts.ts +53 -0
- package/src/verify-changed-scope.ts +162 -0
- package/src/verify-changed.ts +174 -0
- package/src/verify-checks.ts +33 -19
- package/src/verify-drift-owner.ts +30 -0
- package/src/verify-e2e.ts +2 -1
- package/src/verify-factories.ts +86 -0
- package/src/verify-run.ts +13 -11
- package/src/verify-step.ts +13 -0
- package/src/verify-tests.ts +58 -6
- package/src/workspace-external-deps.ts +164 -0
- package/src/write-line.ts +21 -6
- package/wiki/Actions.md +2 -2
- package/wiki/Adapters.md +400 -0
- package/wiki/Admin-Dashboard.md +1 -1
- package/wiki/Agents.md +9 -9
- package/wiki/Auth.md +78 -2
- package/wiki/Building-Your-Own-Base.md +1 -1
- package/wiki/CLI-Reference.md +45 -14
- package/wiki/Caching-And-Invalidation.md +17 -5
- package/wiki/Compared.md +8 -2
- package/wiki/Configuration.md +14 -14
- package/wiki/Deployment.md +28 -1
- package/wiki/Entities-And-Migrations.md +47 -1
- package/wiki/FAQ.md +8 -2
- package/wiki/Feature-Flags.md +1 -1
- package/wiki/Home.md +3 -2
- package/wiki/Jobs-And-Workflows.md +107 -6
- package/wiki/Known-Gaps.md +4 -3
- package/wiki/MCP-And-AI.md +18 -4
- package/wiki/Mail.md +14 -5
- package/wiki/Migrations-And-Backfills.md +29 -4
- package/wiki/Money.md +2 -0
- package/wiki/N-Plus-One-Detection.md +24 -22
- package/wiki/Notify.md +28 -4
- package/wiki/Observability.md +121 -15
- package/wiki/Queries-And-Live-Queries.md +2 -2
- package/wiki/Realtime.md +9 -4
- package/wiki/Routes-And-Render-Modes.md +5 -0
- package/wiki/Scraping.md +57 -11
- package/wiki/Shapes.md +2 -2
- package/wiki/Stability.md +7 -5
- package/wiki/Storage-And-Uploads.md +56 -4
- package/wiki/Testing.md +65 -52
- package/wiki/Troubleshooting.md +1 -1
- package/wiki/Tutorial-01-First-App.md +1 -1
- package/wiki/Tutorial-04-Jobs-And-Realtime.md +1 -1
- package/wiki/Tutorial-05-Deploy-Free.md +1 -1
- package/wiki/Tutorial-06-Growing-Up.md +8 -8
- package/wiki/Upgrading.md +136 -5
package/CLAUDE.md
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
# @ultimat3/cli — boundary
|
|
2
2
|
|
|
3
3
|
Tier 5. May import tiers 0–4. Declared sideways edges: `cli → admin` (`x dev` mounts the `/_x`
|
|
4
|
-
dashboard), `cli → testing` (islands, the e2e step
|
|
4
|
+
dashboard), `cli → testing` (islands, the e2e step); `x shot` launches via `@ultimat3/scraping/cdp`. Nothing imports
|
|
5
5
|
this except `create-ultimate`. The reasoning behind every rule below, verbatim and dated, is
|
|
6
|
-
[`docs/history/cli.md`](../../docs/history/cli.md)
|
|
6
|
+
[`docs/history/cli.md`](../../docs/history/cli.md) (`‡` marks a row whose rule is there); `†` marks a
|
|
7
|
+
row whose full text is in [`docs/history/cli-file-map.md`](../../docs/history/cli-file-map.md).
|
|
8
|
+
Where they disagree this file wins.
|
|
7
9
|
|
|
8
|
-
Commands: `bun test packages/cli
|
|
10
|
+
Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
9
11
|
`bunx tsc --noEmit -p packages/cli/tsconfig.json`.
|
|
10
12
|
|
|
11
13
|
## Rules
|
|
12
14
|
|
|
13
15
|
| Rule | Detail |
|
|
14
16
|
|---|---|
|
|
15
|
-
| Entry | `src/bin.ts` — argv, stdout, exit code only
|
|
16
|
-
| Registry | `registry.ts`: every declaration static (`cmd-<name>-spec.ts`), every body `await import()`ed when that command runs
|
|
17
|
+
| Entry | `src/bin.ts` — argv, stdout, exit code only ‡ |
|
|
18
|
+
| Registry | `registry.ts`: every declaration static (`cmd-<name>-spec.ts`), every body `await import()`ed when that command runs ‡ |
|
|
17
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 |
|
|
18
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 |
|
|
19
21
|
| stdout / stderr | `write-line.ts`'s `writeLine` / `writeErrorLine` — synchronous fd writes, never `process.stdout.write` (truncates at the pipe buffer before `process.exit`). A `CommandResult` with `stream: 'stderr'` goes to fd 2 (`x mcp serve --transport stdio`) |
|
|
@@ -32,9 +34,9 @@ Commands: `bun test packages/cli` (from the repo root: the preload),
|
|
|
32
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` |
|
|
33
35
|
| Subprocesses | only through `exec.ts`'s injectable `Runner`; `gh` through `ctx.runner` with a required `fix` |
|
|
34
36
|
| Templates | `templates/*.ts` return strings, pre-formatted for Biome (`wrap.ts`'s `wrapList` / `wrapImport` / `sortSpecifiers`); no fixture files on disk |
|
|
35
|
-
| Strings | rendered output through `messages.ts` (missing key renders `⟦key⟧`)
|
|
37
|
+
| Strings | rendered output through `messages.ts` (missing key renders `⟦key⟧`) ‡ |
|
|
36
38
|
| Facts | load the app (`app-load.ts`), then project a framework package's registry — never parse source for primitives, never re-derive a fact another package owns |
|
|
37
|
-
| Public API | `src/index.ts`, explicit re-exports only
|
|
39
|
+
| Public API | `src/index.ts`, explicit re-exports only ‡ |
|
|
38
40
|
|
|
39
41
|
## File map
|
|
40
42
|
|
|
@@ -43,33 +45,38 @@ Commands: `bun test packages/cli` (from the repo root: the preload),
|
|
|
43
45
|
| File | Job |
|
|
44
46
|
|---|---|
|
|
45
47
|
| `verify-checks.ts` / `verify-step.ts` / `verify-run.ts` / `verify-e2e-lane.ts` | steps, outcome, order (`BESIDE_SERIAL_SUITES`, e2e lane) |
|
|
48
|
+
| `verify-changed*.ts` | `x verify --changed`: file → rule → steps, fail-open; `drift` only when reached † |
|
|
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 |
|
|
46
50
|
| `verify-exercise.ts` / `cmd-exercise.ts` / `exercise-*.ts` | `exercise`: `x exercise --json` as a child, red on its findings |
|
|
47
51
|
| `verify-floor.ts` | `x.verify.json`: a floor step that ran zero tests is `X_VERIFY_SUITE_VANISHED` |
|
|
48
|
-
| `coverage-floor
|
|
49
|
-
| `verify-deadline.ts` / `verify-stalled.ts` / `verify-progress.ts` | a step past its deadline is `X_VERIFY_STEP_TIMEOUT
|
|
52
|
+
| `coverage-{floor,lcov,source}.ts` / `verify-coverage-run.ts` | an app's `unit` coverage floor; `coverage-lcov.ts` is the ONE lcov reader † |
|
|
53
|
+
| `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 † |
|
|
50
54
|
| `load-findings.ts` | module-load failures are reported once, by `manifest`; other steps point there |
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
+
| `verify-factories.ts` | `unit` lints `<app>/packages/db/factories.ts` (`X_TEST_FACTORY_INVALID`) |
|
|
56
|
+
| `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 † |
|
|
57
|
+
| `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 |
|
|
58
|
+
| `app-transport.ts` / `browser-transport.ts` / `transport-calls.ts` / `import-closure.ts` / `server-barrels.ts` | `boundaries`, built in: one browser transport; never a `guards/` file † |
|
|
59
|
+
| `guards.ts` / `guard-sources.ts` | an app's `guards/*.ts`, run on `boundaries`; ONE shared walk (`GuardSources`) † |
|
|
60
|
+
| `templates/scaffold-guards.ts` | `SHIPPED`, the one list of shipped guards (`x new`, `x g guard`, `doctor-guards.ts`) † |
|
|
55
61
|
| `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 |
|
|
56
|
-
| `workspace-checks.ts` / `test-only-shipped.ts` / `workspace-graph.ts` / `tsconfig-references.ts` / `publish-closure.ts` | `package-shape`, `filesize
|
|
57
|
-
| `
|
|
62
|
+
| `workspace-checks.ts` / `test-only-shipped.ts` / `workspace-graph.ts` / `tsconfig-references.ts` / `publish-closure.ts` | `package-shape`, `filesize` ‡ |
|
|
63
|
+
| `workspace-external-deps.ts` · `tsconfig-aliases.ts` · `error-codes-package.ts` | `package-shape`: a registry import neither the workspace nor the root declares (`X_WORKSPACE_EXTERNAL_DEP_UNDECLARED`); fix `bun add <pkg> --cwd <workspace>`. The step family's codes and titles, split out of `error-codes.ts` |
|
|
64
|
+
| `app-permissions*.ts` / `permission-grants.ts` | `policy`: `X_PERMISSION_UNGRANTED`, `X_PERMISSION_BORROWED` † |
|
|
58
65
|
| `job-registration.ts` | `manifest`: no job or task under a positional `anonymous-*` name (`X_JOB_UNREGISTERED`) |
|
|
59
66
|
| `unscanned-admin.ts` | `manifest`: a `defineAdmin()` outside the app scan (`apps/*/src/`) is `X_ADMIN_UNSCANNED` |
|
|
60
67
|
| `tool-gate-names.ts` · `verify-mcp-mount.ts` | `manifest`: a gate on no tool · `expose` and no `POST /mcp` |
|
|
61
|
-
| `verify-role-load.ts` / `verify-role-load-probe.ts` | `manifest`:
|
|
62
|
-
| `async-pages.ts` / `live-routes.ts` / `budgets.ts` / `budgets-unmeasured.ts` | `budgets` riders:
|
|
63
|
-
| `budgets-freshness.ts` / `verify-budgets-build.ts` |
|
|
64
|
-
| `app-agents-md.ts` / `app-env.ts` / `app-openapi.ts` / `app-manifest.ts` | `manifest` and `contract-diff
|
|
65
|
-
| `schema-drift.ts` / `drift.ts` / `drift-replica-identity.ts` / `db-destructive.ts` / `db-ungeneratable.ts` | `drift`: snapshot vs declarations, the source hash, the header markers
|
|
66
|
-
| `db-rolling.ts` / `doctor-rolling.ts` | `drift`'s
|
|
67
|
-
| `schema-dump-drift.ts` | also the dump-vs-newest-snapshot rail, no database (`X_DB_DRIFT`)
|
|
68
|
+
| `verify-role-load.ts` / `verify-role-load-probe.ts` | `manifest`: what a worker never registers (`X_ROLE_LOAD_INCOMPLETE`) † |
|
|
69
|
+
| `async-pages.ts` / `live-routes.ts` / `budgets.ts` / `budgets-unmeasured.ts` | `budgets` riders: async `Page` with no `load`, unimported live read, bytes per route, unweighed routes † |
|
|
70
|
+
| `budgets-freshness.ts` / `verify-budgets-build.ts` | stale or missing stats: the step builds first (`x build --target static`) † |
|
|
71
|
+
| `app-agents-md.ts` / `app-env.ts` / `app-openapi.ts` / `app-manifest.ts` | `manifest` and `contract-diff` ‡ |
|
|
72
|
+
| `schema-drift.ts` / `drift.ts` / `drift-replica-identity.ts` / `db-destructive.ts` / `db-ungeneratable.ts` | `drift`: snapshot vs declarations, the source hash, the header markers ‡ |
|
|
73
|
+
| `db-rolling.ts` / `doctor-rolling.ts` | `drift`'s rolling rail (`X_MIGRATION_ROLLING_UNSAFE`) † |
|
|
74
|
+
| `schema-dump-drift.ts` | also the dump-vs-newest-snapshot rail, no database (`X_DB_DRIFT`) ‡ |
|
|
68
75
|
| `i18n-registration.ts` / `i18n-audit.ts` / `admin-catalog-keys.ts` | `i18n`; a mounted admin's keys are `AdminApp.catalogKeys()`, asked of every app catalog — never re-derived here (`X_CATALOG_MISSING_KEYS`) |
|
|
69
76
|
| `error-unthrown.ts` / `unthrown-codes.ts` | host check: a registered code nothing throws is listed in `UNTHROWN_CODES` (a row's wording waives nothing); a listed code thrown again is `X_ERROR_CODE_UNTHROWN_STALE` |
|
|
70
77
|
| `lint-findings.ts` | `lint`: `biome check --reporter=json` as one finding per diagnostic |
|
|
71
78
|
| `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 |
|
|
72
|
-
| `job-budget.ts` | `X_JOB_OUTLASTS_DRAIN
|
|
79
|
+
| `job-budget.ts` | `X_JOB_OUTLASTS_DRAIN` (`manifest`): `timeout` vs `workerBudgetMs(drain)`, from the registry † |
|
|
73
80
|
| `output-findings.ts` | render layer only: `runnableFix` (`bunx x`, decided by `dispatch.ts`'s `readerFor`) and `collapseFindings`. Throw sites keep `x …` |
|
|
74
81
|
| `app-load-unresolved.ts` | `X_APP_IMPORT_UNRESOLVED`, read by the scan, `findingFrom` and `x doctor`'s `snapshots` probe |
|
|
75
82
|
| `fix-truth.test.ts` / `fix-truth-fixture.ts` / `db-fix-truth.job.test.ts` | a printed fix, executed: each row breaks a scaffold, asserts the code and runs the line |
|
|
@@ -79,74 +86,79 @@ Commands: `bun test packages/cli` (from the repo root: the preload),
|
|
|
79
86
|
| File | Job |
|
|
80
87
|
|---|---|
|
|
81
88
|
| `cmd-generate.ts` / `generate-files.ts` / `generate-kinds.ts` / `generate-write.ts` | argv → pure file list → writes (conflict-checked, `merge: 'json'` / `'if-absent'`) |
|
|
89
|
+
| `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 |
|
|
82
90
|
| `write-generated.ts` | `x new`'s writer: a `link` file is a relative symlink, a copy only on a refusing win32 |
|
|
83
91
|
| `generate-feature.ts` | a `--feature` naming no slice is `X_FEATURE_UNKNOWN`; nothing invents an entity |
|
|
84
|
-
| `generate-shadow.ts` | a name
|
|
92
|
+
| `generate-shadow.ts` | a name that shadows a type or value in a planned file is `X_CLI_BAD_FLAG` † |
|
|
85
93
|
| `generate-plural.ts` | a planned `entity.ts` in an already-plural slice (`posts` → `postses`) is `X_CLI_BAD_FLAG`; the fix names the singular |
|
|
86
|
-
| `generate-catalog-locales.ts` | `--locales` never starts a catalog
|
|
94
|
+
| `generate-catalog-locales.ts` | `--locales` never starts a catalog; missing locale is `X_CLI_BAD_FLAG` † |
|
|
87
95
|
| `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) |
|
|
88
|
-
| `generate-grants.ts` | a written `policy.ts` or `entity.ts` declares and grants its permissions in `apps/web/shared/roles.ts
|
|
96
|
+
| `generate-grants.ts` | a written `policy.ts` or `entity.ts` declares and grants its permissions in `apps/web/shared/roles.ts` ‡ |
|
|
89
97
|
| `api-registration.ts` | a written job or task is listed in `apps/web/api/index.ts` |
|
|
90
98
|
| `generate-exercise.ts` | a contract test's entry in `apps/web/exercise.ts` (`exercise-entry-edit.ts`) |
|
|
91
|
-
| `handle-registration.ts` / `workspace-dep-edit.ts` / `templates/scaffold-db-client.ts` | a written entity joins `entities`
|
|
92
|
-
| `generated-imports.ts` |
|
|
93
|
-
| `admin-registration.ts` / `templates/admin-catalog.ts` / `source-edit.ts` | `--admin` wires
|
|
99
|
+
| `handle-registration.ts` / `workspace-dep-edit.ts` / `templates/scaffold-db-client.ts` | a written entity joins `entities` (`X_DB_HANDLE_UNREGISTERED`) † |
|
|
100
|
+
| `generated-imports.ts` | a written file's sibling-workspace imports are declared where it landed (`X_WORKSPACE_DEP_UNDECLARED`) † |
|
|
101
|
+
| `admin-registration.ts` / `templates/admin-catalog.ts` / `source-edit.ts` | `--admin` wires its override (`X_ADMIN_RESOURCE_UNWIRED`) † |
|
|
94
102
|
| `app-artifacts.ts` | `x.manifest.json` + `openapi.json`, written together (`x g`, `x manifest`) |
|
|
95
103
|
| `templates/` | every emitted file; `scaffold-*.ts` for `x new`, one per generator otherwise. See history |
|
|
96
104
|
| `generate-feature-required.ts` | `x g query`/`backfill` with no slice holding an `entity.ts` is `X_FEATURE_REQUIRED` |
|
|
97
105
|
| `generate-sign-in*.ts` | `x g sign-in`: one flag, no name; OIDC swaps only `x new`'s bytes |
|
|
98
106
|
| `generate-format-written.ts` | the app's Biome over the TypeScript a run created, best effort; `lint` judges |
|
|
99
|
-
| `templates/scaffold-mcp-{json,endpoint,admin}.ts` | `.mcp.json` (`bunx @ultimat3/cli mcp serve`, never `bunx x`) and the refusing MCP endpoints
|
|
107
|
+
| `templates/scaffold-mcp-{json,endpoint,admin}.ts` | `.mcp.json` (`bunx @ultimat3/cli mcp serve`, never `bunx x`) and the refusing MCP endpoints ‡ |
|
|
100
108
|
|
|
101
109
|
### Boot (`x dev`, the container)
|
|
102
110
|
|
|
103
111
|
| File | Job |
|
|
104
112
|
|---|---|
|
|
105
|
-
| `serve.ts` / `serve-boot.ts` / `serve-entry.ts` / `serve-env.ts` | the production entry:
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
113
|
+
| `serve.ts` / `serve-boot.ts` / `serve-entry.ts` / `serve-env.ts` | the production entry: `ROLE`, env bindings, `ROLE=migrate`; `X_APP_MODULE_LOAD_FAILED` † |
|
|
114
|
+
| `app-load-batch.ts` / `app-load-register.ts` | one hook module per app module, each registered before the next evaluates: serial order kept, top-level await isolated; registration state |
|
|
115
|
+
| `app-load-prebuilt.ts` / `build-registry.ts` / `build-registry-background.ts` | every serving role boots from the prebuilt registry (`node_modules/.cache/ultimate/registry`, `x build`), format 3: the whole app, and the worker/scheduler subset under a stamp; an older format or `X_PREBUILT_REGISTRY_STALE` → scan |
|
|
116
|
+
| `generate-refresh.ts` | `x g` refreshes the manifest only when a written file needs it |
|
|
117
|
+
| `role-load.ts` / `document-graph.ts` / `serve-web.ts` | a role imports what it runs: `ROLE_LOADS` (`X_ROLE_LOAD_INCOMPLETE`) † |
|
|
118
|
+
| `module-imports.ts` | a module's imports, resolved once for both graphs: `referenced` (reload), `evaluated` (document) |
|
|
119
|
+
| `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 † |
|
|
120
|
+
| `runtime-bindings.ts` | which service each binding points at (embedded or external); events follow `NATS_URL` |
|
|
110
121
|
| `runtime-queue.ts` / `runtime-services.ts` / `runtime-bus.ts` | db + queue; every other accessor; the bus |
|
|
111
|
-
| `framework-schema-apply.ts` / `framework-schema-stamp.ts` | the framework tables
|
|
122
|
+
| `framework-schema-apply.ts` / `framework-schema-stamp.ts` | the framework tables, applied in one locked transaction † |
|
|
112
123
|
| `runtime-isr.ts` | the ISR controller both boots serve through, ATTACHED to `invalidateTags` and released on stop (`attachedIsr`); `appRoutes` without one builds and attaches its own |
|
|
113
|
-
| `runtime-mfa-warning.ts` / `runtime-idempotency-scope.ts` | boot warnings
|
|
114
|
-
| `app-config-load.ts` | the ONE reader of
|
|
115
|
-
| `theme-brand.ts` | the ONE reader of an app's theme
|
|
116
|
-
| `runtime-jobs
|
|
124
|
+
| `runtime-mfa-warning.ts` / `runtime-idempotency-scope.ts` | boot warnings: unsealed MFA secrets (web role, `x auth seal-mfa`), a per-process idempotency store after the app loaded |
|
|
125
|
+
| `app-config-load.ts` | the ONE reader of `app.config.ts` (`loadAppConfig`) † |
|
|
126
|
+
| `theme-brand.ts` | the ONE reader of an app's theme (`brand` in `apps/web/shared/theme.ts`) † |
|
|
127
|
+
| `runtime-{jobs,realtime,notify-retention,cache,purge,replica}.ts` | the `app.config.ts` sections the boot obeys (`*Of(config)`) † |
|
|
128
|
+
| `runtime-cache-bus.ts` | which bus carries cache/ISR invalidations: transport if it crosses processes, else Redis pub/sub on `REDIS_URL`, else in-process; one `cache.broadcast` boot line † |
|
|
117
129
|
| `runtime-jobs.ts` (queues) | `jobs.queues` ∪ registered; `WORKER_QUEUES` = the EXACT set, each in that union or `X_WORKER_QUEUE_UNKNOWN`; `-unserved.ts`: what no live worker serves |
|
|
118
|
-
| `serve-retire.ts` / `dev-restart-retire.ts` | the worker retire
|
|
119
|
-
| `role-start
|
|
130
|
+
| `serve-retire.ts` / `dev-restart-retire.ts` | the worker retire (SIGUSR2, before an `x dev` restart's drain) † |
|
|
131
|
+
| `role-start*.ts` / `role-realtime.ts` | `--role` selection, start/stop per role, device mounts † |
|
|
120
132
|
| `role-wake.ts` | the worker's LISTEN session (`@ultimat3/jobs`' `startQueueWake`) — worker role only, only over a client that `canListen` — and `queue_wake_live` |
|
|
121
133
|
| `role-sync.ts` / `role-replicator.ts` / `runtime-live-feed.ts` | the sync node, the change feed |
|
|
122
|
-
| `runtime-render
|
|
123
|
-
| `client-{errors,vitals}-*.ts` | `clientErrors` (and `.vitals`): the script on `app/` (vitals: listed) documents, its `POST` route, mounted by BOTH boots
|
|
124
|
-
| `retained-assets.ts` / `-layout.ts` / `-sweep.ts` / `-read.ts` / `-boot.ts` | `assets.retain`: the web boot publishes this build's hashed files before `/readyz
|
|
125
|
-
| `runtime-overrides.ts`
|
|
134
|
+
| `runtime-render*.ts` / `runtime-{isr-outcome,assets,storage,hooks}.ts` / `route-islands.ts` / `api-routes.ts` | the HTTP surface both boots mount † |
|
|
135
|
+
| `client-{errors,vitals}-*.ts` | `clientErrors` (and `.vitals`): the script on `app/` (vitals: listed) documents, its `POST` route, mounted by BOTH boots ‡ |
|
|
136
|
+
| `retained-assets.ts` / `-layout.ts` / `-sweep.ts` / `-read.ts` / `-boot.ts` | `assets.retain`: the web boot publishes this build's hashed files before `/readyz` † |
|
|
137
|
+
| `runtime-overrides.ts` / `runtime-ports.ts` / `runtime-port-bindings.ts` | `runtime.ts`: a field per `ADAPTER_PORTS` row, installed by ONE loop or read where used; unbound row = build error. Plus `routes`. `docs/history/cli-adapter-ports.md` |
|
|
126
138
|
| `plain-routes.ts` | the plain routes both boots mount and `x routes` lists: `runtime.routes`, then every declared `webhookReceiver()`'s, each once |
|
|
127
139
|
| `app-openapi.ts` | `openapi.json` (complete when `defineApi({ openapi })` is declared) and each bearer mount's own document; staleness for all of them |
|
|
128
140
|
| `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 |
|
|
129
141
|
| `page-navigation.ts` | the client router for `navigation.client` surfaces — built, routed and named ONCE for `x dev`, the container and the static export; none opted in builds nothing |
|
|
130
|
-
| `page-speculation.ts` | Speculation Rules for documents WITHOUT the router (`navigation.speculation`): an allow-list of pure-read pages
|
|
131
|
-
| `static-document.ts` | a served `static` page: `304` on
|
|
132
|
-
| `island-bundle
|
|
142
|
+
| `page-speculation.ts` | Speculation Rules for documents WITHOUT the router (`navigation.speculation`): an allow-list of pure-read pages ‡ |
|
|
143
|
+
| `static-document.ts` | a served `static` page: `304` on `If-None-Match`; container keeps the document (never `x dev`) † |
|
|
144
|
+
| `island-{bundle,store,sources,runtime}.ts` / `island-realtime*.ts` / `solid-loader.ts` | islands: one `Bun.build` each, source-addressed † |
|
|
133
145
|
| `local-cli.ts` / `local-cli-handoff.ts` | a global `x` hands over to the app's own CLI (`local-cli.ts` decides whether; `x upgrade` alone stays when the app's is strictly older — `upgrade-handover.test.ts`) |
|
|
134
|
-
| `serve-prebuilt.ts` / `serve-prebuilt-paths.ts` | the image's prebuilt store
|
|
146
|
+
| `serve-prebuilt.ts` / `serve-prebuilt-paths.ts` | the image's prebuilt store; a boot that built anything logs `X_IMAGE_NOT_PREBUILT` † |
|
|
135
147
|
| `dev-*.ts` | `x dev` only: dashboard sources, traces, the N+1 ledger, watcher, reload, lock, port |
|
|
136
|
-
| `cmd-stop.ts` / `cmd-stop-spec.ts` | `x stop`: the lock's pid only
|
|
137
|
-
| `dev-dashboard-guard.ts` / `loopback-host.ts` | `/_x`
|
|
138
|
-
| `doctor-pooler.ts` / `runtime-statement-bound.ts` | the
|
|
148
|
+
| `cmd-stop.ts` / `cmd-stop-spec.ts` | `x stop`: the lock's pid only, SIGTERM, wait; `X_DEV_STOP_TIMEOUT` † |
|
|
149
|
+
| `dev-dashboard-guard.ts` / `loopback-host.ts` | `/_x` loopback `Host` only (`X_DEV_HOST_REFUSED`, 421) † |
|
|
150
|
+
| `doctor-pooler.ts` / `runtime-statement-bound.ts` | the statement bound and a pooler's refusal, one finding, one boot line † |
|
|
139
151
|
|
|
140
152
|
### Build and data
|
|
141
153
|
|
|
142
154
|
| File | Job |
|
|
143
155
|
|---|---|
|
|
144
|
-
| `cmd-build.ts` / `image-prepare.ts` | `x build`: static gate first; `
|
|
145
|
-
| `prerender.ts` / `measure-scope.ts` / `static-report.ts` / `static-*.ts` | the static export;
|
|
156
|
+
| `cmd-build.ts` / `image-prepare.ts` | `x build`: static gate first; `prebuilt` is the Dockerfile's own `RUN` † |
|
|
157
|
+
| `prerender.ts` / `measure-scope.ts` / `static-report.ts` / `static-*.ts` | the static export; weigh-only renders as `measurementActor()` † |
|
|
146
158
|
| `sw-artifacts.ts` / `pwa-artifacts.ts` / `favicon.ts` | the service worker, the web manifest, `/favicon.ico` |
|
|
147
|
-
| `cmd-db.ts` / `migrations.ts` / `db
|
|
148
|
-
| `db-diagnostics.ts` | `x db diagnostics`: `startDb
|
|
149
|
-
| `db-schema-dump.ts` / `db-schema-refresh.ts` / `db-replay-engine.ts` / `migration-extensions.ts` / `db-object-drift.ts` | the schema dump
|
|
159
|
+
| `cmd-db.ts` / `migrations.ts` / `db-*.ts` (generate, branch, seed, backfill, subscribes, accept-created) | one migration engine for `x db` and `ROLE=migrate` † |
|
|
160
|
+
| `db-diagnostics.ts` | `x db diagnostics`: `startDb`, never `startQueue`; exit 0 whatever it says † |
|
|
161
|
+
| `db-schema-dump.ts` / `db-schema-refresh.ts` / `db-replay-engine.ts` / `migration-extensions.ts` / `db-object-drift.ts` | the schema dump, replayed on a scratch database † |
|
|
150
162
|
|
|
151
163
|
### Introspection and tools
|
|
152
164
|
|
|
@@ -154,14 +166,18 @@ Commands: `bun test packages/cli` (from the repo root: the preload),
|
|
|
154
166
|
|---|---|
|
|
155
167
|
| `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 |
|
|
156
168
|
| `cmd-auth.ts` / `cmd-auth-spec.ts` / `doctor-auth.ts` | `x auth seal-mfa`: seals plaintext `x_users.mfa_secret` through auth's `sealMfaSecrets` |
|
|
157
|
-
| `cmd-mcp.ts` / `mcp-host.ts` / `mcp-errors.ts` / `mcp-db-target.ts` | `x mcp serve`: 19 tools, two transports
|
|
169
|
+
| `cmd-mcp.ts` / `mcp-host.ts` / `mcp-errors.ts` / `mcp-db-target.ts` | `x mcp serve`: 19 tools, two transports † |
|
|
158
170
|
| `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 |
|
|
159
|
-
| `
|
|
171
|
+
| `shot-route.ts` / `shot-run.ts` / `shot-gpu.ts` | `x shot`'s route argument (`readRoute`, `shotSlug`); one capture (`runShot`); the page's `navigator.gpu` adapter (`verdict.gpu`, never gating). `cmd-shot.ts` re-exports the first two |
|
|
172
|
+
| `cmd-pr.ts` / `cmd-ci.ts` / `ci-runs.ts` / `ci-tested.ts` | GitHub through `gh`, schema-parsed; not gate steps † |
|
|
173
|
+
| `pr-threads.ts` / `pr-activity.ts` | `x pr review`'s ONE GraphQL document: threads, plus every review (verdict, body) and issue comment |
|
|
174
|
+
| `pr-bots.ts` | which review bots posted a "did not review" notice (rate/review limit, skipped); `blocked` = no review of theirs after it |
|
|
175
|
+
| `ci-log.ts` | `x ci`'s log reader: undoes `##[…]` markers, `::error` annotations and `<comment>` fences; `fix` stays clean, provenance is `source: 'ci-log'` + `meta.job` + `output.ts`'s `[from=ci-log …]` head marker |
|
|
160
176
|
| `error-catalog.ts` | imports every `@ultimat3/*` package so `x errors` answers for any code |
|
|
161
|
-
| `cmd-docs.ts` / `docs-sources.ts` / `docs-section.ts` | `x docs`: the app's
|
|
162
|
-
| `cmd-env-init.ts` / `env-production.ts` / `cmd-deploy-preflight.ts` |
|
|
163
|
-
| `cmd-upgrade.ts` / `upgrade-*.ts` | `x upgrade`: one major per run;
|
|
164
|
-
| `cmd-deploy-verify.ts` / `deploy-verify-*.ts` | `x deploy verify`: the wait
|
|
177
|
+
| `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 † |
|
|
178
|
+
| `cmd-env-init.ts` / `env-production.ts` / `cmd-deploy-preflight.ts` | the one writer of `.env.production`; compose pre-flight (`X_DEPLOY_ENV_MISSING`) † |
|
|
179
|
+
| `cmd-upgrade.ts` / `upgrade-*.ts` | `x upgrade`: one major per run; no `requiresApp` † |
|
|
180
|
+
| `cmd-deploy-verify.ts` / `deploy-verify-*.ts` | `x deploy verify`: the wait, the pure verdict, lazy real sources † |
|
|
165
181
|
|
|
166
182
|
## Adding a command
|
|
167
183
|
|
package/README.md
CHANGED
|
@@ -192,6 +192,8 @@ that name where there is one (`x new` writes all twenty), the blank template oth
|
|
|
192
192
|
| `app-load.ts` | import an app's modules so the framework registries hold it |
|
|
193
193
|
| `app-mcp.ts` | the app's own MCP endpoint: `apps/<app>/mcp.ts` exports `mcp`, and both boots mount `POST` at each endpoint's own `defineAppMcp({ path })` through this one call |
|
|
194
194
|
| `app-runtime.ts` | the app's `RuntimeOverrides`: `apps/<app>/runtime.ts` exports `runtime`, read by `x dev` and by `runRole` when its caller passed none |
|
|
195
|
+
| `runtime-overrides.ts` / `runtime-ports.ts` / `runtime-port-bindings.ts` | one `RuntimeOverrides` field per `ADAPTER_PORTS` row (`PortValues`), and where the boot honours each: installed by ONE loop over the table (`boot` → `queue` → `services` phases), or read as a value where used — every row, as of 31.0 (a future row may stand `pending`, naming the package that owes an installer). A row core adds without a binding is a build error (`PortBindings` is a `Record` over `AdapterPortName`). `import type { RuntimeOverrides } from '@ultimat3/cli/serve'` types an app's `runtime.ts` |
|
|
196
|
+
| `verify-factories.ts` | the `unit` step's factory lint: `<app>/packages/db/factories.ts` exporting `factories` is linted in a child from the app root (`X_TEST_FACTORY_INVALID`, naming the factory and trait); no file, no lint |
|
|
195
197
|
| `local-cli.ts` | which `x` runs: a global CLI inside an app hands over to the app's own, because a second module instance is an empty registry |
|
|
196
198
|
| `measurement-actor.ts` | the actor a weigh-and-discard render runs as — every permission, never served |
|
|
197
199
|
| `runtime-live-feed.ts` | what feeds the sync node this process booted: the in-process row observer under the embedded database, the WAL decoder with a real one, nothing without the role — `live=` on the ready line |
|
|
@@ -237,7 +239,8 @@ apps/web/{site,app}/<path>/<name>.island.tsx # x g island <name> --at <dir>
|
|
|
237
239
|
apps/admin/app/admin/pages/<name>.tsx # x g admin:page <name> --permission p
|
|
238
240
|
guards/<name>.ts # x g guard <name>
|
|
239
241
|
apps/web/app/auth/{sign-in,actions,…} # x g sign-in --password | --oidc <provider>
|
|
240
|
-
apps/web/runtime.ts # …and the boot guard it calls
|
|
242
|
+
apps/web/runtime.ts # …and the boot guard it calls (x new writes the
|
|
243
|
+
# port-commented one; replaced only while untouched)
|
|
241
244
|
docker/helm/templates/{servicemonitor,alert-rules}.yaml # x g chart-alerts [--print]
|
|
242
245
|
```
|
|
243
246
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "31.1.0",
|
|
4
4
|
"description": "The `x` binary: new, dev, build, verify, generate, db, mcp, doctor, deploy",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -52,34 +52,35 @@
|
|
|
52
52
|
"dev": "bun run src/bin.ts dev"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@babel/core": "^8.0.
|
|
56
|
-
"@ultimat3/action": "
|
|
57
|
-
"@ultimat3/admin": "
|
|
58
|
-
"@ultimat3/ai": "
|
|
59
|
-
"@ultimat3/auth": "
|
|
60
|
-
"@ultimat3/cache": "
|
|
61
|
-
"@ultimat3/core": "
|
|
62
|
-
"@ultimat3/db": "
|
|
63
|
-
"@ultimat3/entity": "
|
|
64
|
-
"@ultimat3/flags": "
|
|
65
|
-
"@ultimat3/http": "
|
|
66
|
-
"@ultimat3/i18n": "
|
|
67
|
-
"@ultimat3/jobs": "
|
|
68
|
-
"@ultimat3/mail": "
|
|
69
|
-
"@ultimat3/manifest": "
|
|
70
|
-
"@ultimat3/mcp": "
|
|
71
|
-
"@ultimat3/money": "
|
|
72
|
-
"@ultimat3/notify": "
|
|
73
|
-
"@ultimat3/policy": "
|
|
74
|
-
"@ultimat3/pwa": "
|
|
75
|
-
"@ultimat3/query": "
|
|
76
|
-
"@ultimat3/realtime": "
|
|
77
|
-
"@ultimat3/render": "
|
|
78
|
-
"@ultimat3/schema": "
|
|
79
|
-
"@ultimat3/
|
|
80
|
-
"@ultimat3/
|
|
81
|
-
"@ultimat3/
|
|
82
|
-
"@ultimat3/
|
|
55
|
+
"@babel/core": "^8.0.9",
|
|
56
|
+
"@ultimat3/action": "31.1.0",
|
|
57
|
+
"@ultimat3/admin": "31.1.0",
|
|
58
|
+
"@ultimat3/ai": "31.1.0",
|
|
59
|
+
"@ultimat3/auth": "31.1.0",
|
|
60
|
+
"@ultimat3/cache": "31.1.0",
|
|
61
|
+
"@ultimat3/core": "31.1.0",
|
|
62
|
+
"@ultimat3/db": "31.1.0",
|
|
63
|
+
"@ultimat3/entity": "31.1.0",
|
|
64
|
+
"@ultimat3/flags": "31.1.0",
|
|
65
|
+
"@ultimat3/http": "31.1.0",
|
|
66
|
+
"@ultimat3/i18n": "31.1.0",
|
|
67
|
+
"@ultimat3/jobs": "31.1.0",
|
|
68
|
+
"@ultimat3/mail": "31.1.0",
|
|
69
|
+
"@ultimat3/manifest": "31.1.0",
|
|
70
|
+
"@ultimat3/mcp": "31.1.0",
|
|
71
|
+
"@ultimat3/money": "31.1.0",
|
|
72
|
+
"@ultimat3/notify": "31.1.0",
|
|
73
|
+
"@ultimat3/policy": "31.1.0",
|
|
74
|
+
"@ultimat3/pwa": "31.1.0",
|
|
75
|
+
"@ultimat3/query": "31.1.0",
|
|
76
|
+
"@ultimat3/realtime": "31.1.0",
|
|
77
|
+
"@ultimat3/render": "31.1.0",
|
|
78
|
+
"@ultimat3/schema": "31.1.0",
|
|
79
|
+
"@ultimat3/scraping": "31.1.0",
|
|
80
|
+
"@ultimat3/seo": "31.1.0",
|
|
81
|
+
"@ultimat3/storage": "31.1.0",
|
|
82
|
+
"@ultimat3/testing": "31.1.0",
|
|
83
|
+
"@ultimat3/time": "31.1.0",
|
|
83
84
|
"babel-preset-solid": "^1.9.16"
|
|
84
85
|
}
|
|
85
86
|
}
|
|
@@ -41,7 +41,7 @@ export const adminResourceUnwiredFinding = (
|
|
|
41
41
|
): Finding => ({
|
|
42
42
|
code: 'X_ADMIN_RESOURCE_UNWIRED',
|
|
43
43
|
cause: `${ADMIN_FILE} ${reason}, so the override ${entry.binding} is read by nothing and /admin/${entry.table} keeps its derived defaults`,
|
|
44
|
-
fix: `
|
|
44
|
+
fix: `import { ${entry.binding} } from '${entry.specifier}'; # at the top of ${ADMIN_FILE}, then resources: { ${entry.table}: ${entry.binding} } in its defineAdmin() call`,
|
|
45
45
|
docs: ERROR_DOCS_URL,
|
|
46
46
|
at: ADMIN_FILE,
|
|
47
47
|
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// The ref a diff is measured against when `--base` says nothing: the REMOTE-TRACKING default branch
|
|
2
|
+
// (`origin/HEAD` → `origin/main`), never local `main` while a remote-tracking ref exists. Local `main` is
|
|
3
|
+
// whatever was last pulled, and in a checkout nobody pulls (or a worktree) it lags origin: the diff
|
|
4
|
+
// then counts files already merged upstream as this branch's work, and the "affected" set widens.
|
|
5
|
+
|
|
6
|
+
import type { Runner } from './exec';
|
|
7
|
+
|
|
8
|
+
/** The branch a change is measured against when no remote-tracking ref names one. */
|
|
9
|
+
export const DEFAULT_BASE = 'main';
|
|
10
|
+
|
|
11
|
+
/** The remote whose default branch is the base. One name: a second guess is a second answer. */
|
|
12
|
+
export const DEFAULT_REMOTE = 'origin';
|
|
13
|
+
|
|
14
|
+
/** What `--help` says the default is, for every command that reads `--base`. */
|
|
15
|
+
export const DEFAULT_BASE_HELP = `${DEFAULT_REMOTE}/HEAD's branch (e.g. ${DEFAULT_REMOTE}/${DEFAULT_BASE}), else local ${DEFAULT_BASE} when there is no remote-tracking ref (${DEFAULT_REMOTE}/HEAD or ${DEFAULT_REMOTE}/${DEFAULT_BASE})`;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The default base, read from what the checkout already has — never fetched: a command that
|
|
19
|
+
* scopes a test run must not reach the network, and a stale `origin/main` is still nearer the truth
|
|
20
|
+
* than a stale local `main` (`git fetch` moves the first; only a pull moves the second).
|
|
21
|
+
*
|
|
22
|
+
* In order: `origin/HEAD`'s target (a clone sets it), then `origin/main` (a remote added by hand
|
|
23
|
+
* leaves `origin/HEAD` unset), then local `main` — when there is no remote-tracking ref (`origin/HEAD`
|
|
24
|
+
* or `origin/main`): no remote at all, an `origin` never fetched, or one whose branch is not `main`.
|
|
25
|
+
*/
|
|
26
|
+
export async function defaultBase(runner: Runner, cwd: string): Promise<string> {
|
|
27
|
+
const head = await runner(
|
|
28
|
+
['git', 'symbolic-ref', '--quiet', '--short', `refs/remotes/${DEFAULT_REMOTE}/HEAD`],
|
|
29
|
+
{ cwd },
|
|
30
|
+
);
|
|
31
|
+
const target = head.ok ? head.stdout.trim() : '';
|
|
32
|
+
if (target.length > 0) return target;
|
|
33
|
+
const tracking = `${DEFAULT_REMOTE}/${DEFAULT_BASE}`;
|
|
34
|
+
const main = await runner(
|
|
35
|
+
['git', 'rev-parse', '--verify', '--quiet', `refs/remotes/${tracking}^{commit}`],
|
|
36
|
+
{ cwd },
|
|
37
|
+
);
|
|
38
|
+
return main.ok ? tracking : DEFAULT_BASE;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The `git fetch` that makes `base` resolvable: a remote-tracking ref is refreshed by fetching its
|
|
43
|
+
* branch, a local one by fetching into it. `origin/main:origin/main` would create a local branch
|
|
44
|
+
* literally named `origin/main`, which is how the old one-size fix line broke on its own default.
|
|
45
|
+
*/
|
|
46
|
+
export const fetchFixFor = (base: string): string => {
|
|
47
|
+
const prefix = `${DEFAULT_REMOTE}/`;
|
|
48
|
+
return base.startsWith(prefix)
|
|
49
|
+
? `git fetch --no-tags ${DEFAULT_REMOTE} ${base.slice(prefix.length)}`
|
|
50
|
+
: `git fetch --no-tags ${DEFAULT_REMOTE} ${base}:${base}`;
|
|
51
|
+
};
|
package/src/affected.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
// directory is checkout-relative while a caller's scan yields paths relative to its own root.
|
|
14
14
|
import { join, relative } from 'node:path';
|
|
15
15
|
import { singleLine, UltimateError } from '@ultimat3/core';
|
|
16
|
+
import { DEFAULT_BASE, defaultBase, fetchFixFor } from './affected-base';
|
|
16
17
|
import { readUnownedDirs } from './affected-unowned';
|
|
17
18
|
import { BadFlagError } from './errors';
|
|
18
19
|
import type { ExecResult, Runner } from './exec';
|
|
@@ -23,8 +24,7 @@ import { flagBool, flagString } from './parse';
|
|
|
23
24
|
import type { WorkspaceNode } from './workspace-graph';
|
|
24
25
|
import { readWorkspaceGraph } from './workspace-graph';
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
export const DEFAULT_BASE = 'main';
|
|
27
|
+
export { DEFAULT_BASE } from './affected-base';
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* A file with no compilation unit behind it. A doc or a plan re-checks nothing, so it maps to no
|
|
@@ -155,21 +155,33 @@ export function planAffected(
|
|
|
155
155
|
* narrows nothing — so a fix line that dropped it would reproduce its own failure, verbatim.
|
|
156
156
|
*/
|
|
157
157
|
const invocationOf = (command: string): string =>
|
|
158
|
-
command === 'affected'
|
|
158
|
+
command === 'affected'
|
|
159
|
+
? 'x affected'
|
|
160
|
+
: command === 'verify'
|
|
161
|
+
? 'x verify --changed'
|
|
162
|
+
: `x ${command} --affected`;
|
|
159
163
|
|
|
160
164
|
export interface AffectedSelection {
|
|
165
|
+
/** The ref the diff was measured against — `--base`, or the default it resolved to. */
|
|
161
166
|
readonly base: string;
|
|
162
167
|
readonly dirty: boolean;
|
|
163
168
|
}
|
|
164
169
|
|
|
170
|
+
/** What argv asked for: `base` is absent when `--base` was not given. */
|
|
171
|
+
export interface AffectedRequest {
|
|
172
|
+
readonly base: string | undefined;
|
|
173
|
+
readonly dirty: boolean;
|
|
174
|
+
}
|
|
175
|
+
|
|
165
176
|
/**
|
|
166
|
-
* One reader for `--base` and `--dirty`, shared by `x affected
|
|
167
|
-
* readers would be two answers to "what is this diff measured against", and the
|
|
168
|
-
* scoping is only trustworthy if it is the first command's.
|
|
177
|
+
* One reader for `--base` and `--dirty`, shared by `x affected`, `x test --affected` and `x verify
|
|
178
|
+
* --changed`: two readers would be two answers to "what is this diff measured against", and the
|
|
179
|
+
* second command's scoping is only trustworthy if it is the first command's. Pure — a malformed
|
|
180
|
+
* `--base` is refused before git is spawned; `resolveSelection` fills the default in.
|
|
169
181
|
*/
|
|
170
|
-
export function readAffectedSelection(args: ParsedArgs, command: string):
|
|
171
|
-
const base = flagString(args, 'base')
|
|
172
|
-
if (base.trim().length === 0) {
|
|
182
|
+
export function readAffectedSelection(args: ParsedArgs, command: string): AffectedRequest {
|
|
183
|
+
const base = flagString(args, 'base');
|
|
184
|
+
if (base !== undefined && base.trim().length === 0) {
|
|
173
185
|
throw new BadFlagError({
|
|
174
186
|
flag: 'base',
|
|
175
187
|
command,
|
|
@@ -180,6 +192,16 @@ export function readAffectedSelection(args: ParsedArgs, command: string): Affect
|
|
|
180
192
|
return { base, dirty: flagBool(args, 'dirty') };
|
|
181
193
|
}
|
|
182
194
|
|
|
195
|
+
/** `--base` verbatim when given, else the remote-tracking default branch (`affected-base.ts`). */
|
|
196
|
+
export const resolveSelection = async (
|
|
197
|
+
runner: Runner,
|
|
198
|
+
cwd: string,
|
|
199
|
+
request: AffectedRequest,
|
|
200
|
+
): Promise<AffectedSelection> => ({
|
|
201
|
+
base: request.base ?? (await defaultBase(runner, cwd)),
|
|
202
|
+
dirty: request.dirty,
|
|
203
|
+
});
|
|
204
|
+
|
|
183
205
|
const git = (runner: Runner, cwd: string, args: readonly string[]): Promise<ExecResult> =>
|
|
184
206
|
runner(['git', ...args], { cwd });
|
|
185
207
|
|
|
@@ -234,7 +256,7 @@ export async function changedFiles(
|
|
|
234
256
|
flag: 'base',
|
|
235
257
|
command: options.command,
|
|
236
258
|
reason: `git resolves no commit named "${base}" in this checkout`,
|
|
237
|
-
fix:
|
|
259
|
+
fix: `${fetchFixFor(base)}, then re-run: ${invocationOf(options.command)} --base ${base} --json`,
|
|
238
260
|
});
|
|
239
261
|
}
|
|
240
262
|
const runs = [
|
|
@@ -305,8 +327,9 @@ export interface AffectedScopeOptions {
|
|
|
305
327
|
* checkmark on a broken repo, and two implementations is how one of them gets it wrong.
|
|
306
328
|
*/
|
|
307
329
|
export async function affectedScope(options: AffectedScopeOptions): Promise<AffectedScope> {
|
|
308
|
-
const
|
|
330
|
+
const request = readAffectedSelection(options.args, options.command);
|
|
309
331
|
const root = await gitRoot(options.runner, options.cwd, options.command);
|
|
332
|
+
const selection = await resolveSelection(options.runner, root, request);
|
|
310
333
|
const graph = await readWorkspaceGraph(root);
|
|
311
334
|
const plan = planAffected(
|
|
312
335
|
graph,
|