@ultimat3/cli 31.27.0 → 31.29.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 +4 -1
- package/README.md +14 -4
- package/package.json +29 -29
- package/src/app-manifest.ts +6 -1
- package/src/app-migrations-verdict.ts +84 -0
- package/src/cmd-doctor.ts +11 -3
- package/src/cmd-drill.ts +23 -9
- package/src/cmd-repro-spec.ts +13 -1
- package/src/cmd-repro.ts +37 -5
- 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-deploy.ts +85 -0
- package/src/codemods/helm-alerts-objective.ts +105 -0
- package/src/codemods/helm-alerts-stock.ts +108 -0
- package/src/codemods/index.ts +60 -0
- package/src/codemods/metrics-probe-healthz.ts +47 -0
- package/src/codemods/migrate-job-ordered.ts +81 -0
- package/src/codemods/migrate-job-stock.ts +41 -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/doctor-advisory-floors.ts +113 -0
- package/src/doctor-guards.ts +39 -86
- package/src/doctor-superseded.ts +67 -0
- package/src/drill-schema-behind.ts +26 -0
- package/src/error-codes-doctor.ts +12 -4
- package/src/error-codes.ts +9 -0
- package/src/exercise-database.ts +7 -2
- package/src/framework-schema-apply.ts +7 -19
- package/src/framework-schema-stamp.ts +38 -3
- package/src/framework-schema-verify.ts +120 -0
- package/src/framework-schema-wait.ts +125 -0
- package/src/generate-files.ts +6 -5
- 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 +90 -34
- package/src/index.ts +10 -0
- package/src/lint-findings.ts +3 -3
- package/src/mcp-errors.ts +12 -1
- package/src/measure-scope.ts +23 -3
- package/src/messages-repro.ts +16 -2
- package/src/messages-upgrade.ts +15 -0
- package/src/messages.ts +1 -1
- 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-pg-stats.ts +21 -0
- package/src/role-start.ts +4 -0
- package/src/runtime-queue.ts +27 -6
- package/src/serve-boot-probe.ts +97 -0
- package/src/serve-boot.ts +26 -1
- package/src/serve-retire.ts +16 -3
- package/src/superseded-match.ts +87 -0
- package/src/superseded.ts +84 -0
- package/src/templates/bun-image.ts +48 -0
- package/src/templates/chart-dashboard-panels.ts +178 -0
- package/src/templates/chart-dashboard.ts +9 -135
- package/src/templates/github/ci.yml.ts +1 -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-container.ts +2 -2
- package/src/templates/scaffold-docs.ts +26 -24
- package/src/templates/scaffold-guards.ts +73 -39
- package/src/templates/scaffold-helm-alert-deploy.ts +105 -0
- package/src/templates/scaffold-helm-alert-rules.ts +7 -1
- package/src/templates/scaffold-helm-alerts.ts +3 -0
- package/src/templates/scaffold-helm-migrate.ts +85 -0
- package/src/templates/scaffold-helm-templates.ts +2 -36
- package/src/templates/scaffold-helm.ts +1 -0
- package/src/templates/scaffold-repo.ts +2 -1
- package/src/unthrown-codes.ts +2 -0
- 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 +38 -6
- 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 +52 -27
- package/src/upgrade-signals.ts +91 -0
- package/src/upgrade-unfinished.ts +61 -0
- package/wiki/CLI-Reference.md +70 -5
- package/wiki/Deployment.md +2 -1
- package/wiki/Interface-Rules.md +17 -8
- package/wiki/Known-Gaps.md +1 -1
- package/wiki/Observability.md +1 -0
- package/wiki/Project-Layout.md +4 -4
- package/wiki/Upgrading.md +6 -0
package/CLAUDE.md
CHANGED
|
@@ -63,7 +63,8 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
63
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 |
|
|
64
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 † |
|
|
65
65
|
| `guards.ts` / `guard-sources.ts` | an app's `guards/*.ts`, run on `boundaries`; ONE shared walk (`GuardSources`) † |
|
|
66
|
-
| `
|
|
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`) † |
|
|
67
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 † |
|
|
68
69
|
| `fix-sequence.ts` | `errors`: a deferring, re-run-only or `--force` fix is `X_ERROR_FIX_INVALID`, ratcheted per file † |
|
|
69
70
|
| `workspace-checks.ts` / `test-only-shipped.ts` / `workspace-graph.ts` / `tsconfig-references.ts` / `publish-closure.ts` | `package-shape`, `filesize` ‡ |
|
|
@@ -134,6 +135,7 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
134
135
|
| `runtime-bindings.ts` | which service each binding points at (embedded or external); events follow `NATS_URL` |
|
|
135
136
|
| `runtime-queue.ts` / `runtime-services.ts` / `runtime-bus.ts` | db + queue; every other accessor; the bus |
|
|
136
137
|
| `framework-schema-apply.ts` / `framework-schema-stamp.ts` | the framework tables, applied in one locked transaction † |
|
|
138
|
+
| `framework-schema-verify.ts` / `-wait.ts` / `app-migrations-verdict.ts` / `serve-boot-probe.ts` | a serving role behind its schema (stamp or app ledger) WAITS, `ULTIMATE_SCHEMA_WAIT_MS`, probe port up; a newer major refuses at once |
|
|
137
139
|
| `runtime-isr.ts` | the ISR controller both boots serve through, attached to `invalidateTags` (`attachedIsr`) † |
|
|
138
140
|
| `runtime-mfa-warning.ts` / `runtime-idempotency-scope.ts` | boot warnings: unsealed MFA secrets, a per-process idempotency store † |
|
|
139
141
|
| `app-config-load.ts` | the ONE reader of `app.config.ts` (`loadAppConfig`) † |
|
|
@@ -195,6 +197,7 @@ Commands: `bun test ./packages/cli/` (repo root: the preload),
|
|
|
195
197
|
| `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 † |
|
|
196
198
|
| `cmd-env-init.ts` / `env-production.ts` / `cmd-deploy-preflight.ts` | the one writer of `.env.production`; compose pre-flight (`X_DEPLOY_ENV_MISSING`) † |
|
|
197
199
|
| `cmd-upgrade.ts` / `upgrade-*.ts` | `x upgrade`: one major per run; no `requiresApp` † |
|
|
200
|
+
| `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 |
|
|
198
201
|
| `cmd-deploy-verify.ts` / `deploy-verify-*.ts` / `cmd-status*.ts` | `x deploy verify`: the wait, the verdict, lazy sources † · `x status` |
|
|
199
202
|
|
|
200
203
|
## Adding a command
|
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ 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)) |
|
|
@@ -180,10 +181,17 @@ is held to the same error contract shipped source is (`X_GUARD_INVALID`, `X_GUAR
|
|
|
180
181
|
`X_GUARD_FINDING_INVALID`). A guard that exports `severity: 'warning'` is **report-only** (`As of
|
|
181
182
|
31.22`): its findings ride the step as `warnings` — in `--json` and on the step line, never a
|
|
182
183
|
failure — so a rule ships to every app before the apps are clean of it; a finding that breaks the
|
|
183
|
-
contract fails either way. `repo-await-in-loop`
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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.
|
|
187
195
|
|
|
188
196
|
## Layout
|
|
189
197
|
|
|
@@ -200,6 +208,8 @@ app does not hold (`X_SHIPPED_GUARD_MISSING`, beside the verdict, never in it).
|
|
|
200
208
|
| `generate-kinds.ts` | which generators exist, and how a command line names one |
|
|
201
209
|
| `guards.ts` | the app's own conventions: `guards/` discovered, run, and held to the error contract |
|
|
202
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 |
|
|
203
213
|
| `cmd-*.ts` | one command group each |
|
|
204
214
|
| `templates/` | scaffolding as typed string modules, not copied fixtures |
|
|
205
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.29.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.29.0",
|
|
57
|
+
"@ultimat3/admin": "31.29.0",
|
|
58
|
+
"@ultimat3/ai": "31.29.0",
|
|
59
|
+
"@ultimat3/auth": "31.29.0",
|
|
60
|
+
"@ultimat3/cache": "31.29.0",
|
|
61
|
+
"@ultimat3/core": "31.29.0",
|
|
62
|
+
"@ultimat3/db": "31.29.0",
|
|
63
|
+
"@ultimat3/entity": "31.29.0",
|
|
64
|
+
"@ultimat3/flags": "31.29.0",
|
|
65
|
+
"@ultimat3/http": "31.29.0",
|
|
66
|
+
"@ultimat3/i18n": "31.29.0",
|
|
67
|
+
"@ultimat3/jobs": "31.29.0",
|
|
68
|
+
"@ultimat3/mail": "31.29.0",
|
|
69
|
+
"@ultimat3/manifest": "31.29.0",
|
|
70
|
+
"@ultimat3/mcp": "31.29.0",
|
|
71
|
+
"@ultimat3/money": "31.29.0",
|
|
72
|
+
"@ultimat3/notify": "31.29.0",
|
|
73
|
+
"@ultimat3/policy": "31.29.0",
|
|
74
|
+
"@ultimat3/pwa": "31.29.0",
|
|
75
|
+
"@ultimat3/query": "31.29.0",
|
|
76
|
+
"@ultimat3/realtime": "31.29.0",
|
|
77
|
+
"@ultimat3/render": "31.29.0",
|
|
78
|
+
"@ultimat3/schema": "31.29.0",
|
|
79
|
+
"@ultimat3/scraping": "31.29.0",
|
|
80
|
+
"@ultimat3/seo": "31.29.0",
|
|
81
|
+
"@ultimat3/storage": "31.29.0",
|
|
82
|
+
"@ultimat3/testing": "31.29.0",
|
|
83
|
+
"@ultimat3/time": "31.29.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 };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// The app's own migrations, as a serving role judges them at boot: which ones this build ships that
|
|
2
|
+
// the `x_migrations` ledger lacks (behind: wait for the migrate step), and which ones the ledger
|
|
3
|
+
// holds that this build does not know (ahead: a rollback, served with one warning). Pure; the read
|
|
4
|
+
// is `framework-schema-apply.ts`'s, one statement beside the framework stamp.
|
|
5
|
+
|
|
6
|
+
import { logger, UltimateError } from '@ultimat3/core';
|
|
7
|
+
import { LEDGER_TABLE } from '@ultimat3/db';
|
|
8
|
+
|
|
9
|
+
export interface AppMigrationsVerdict {
|
|
10
|
+
/** Shipped by this build, absent from the ledger — every one when the ledger does not exist. */
|
|
11
|
+
readonly missing: readonly string[];
|
|
12
|
+
/** In the ledger, unknown to this build: a newer release migrated, and this one rolled back. */
|
|
13
|
+
readonly unknown: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** `applied` is `undefined` when the ledger table does not exist: no migrate step has run at all. */
|
|
17
|
+
export function appMigrationsVerdict(
|
|
18
|
+
shipped: readonly string[],
|
|
19
|
+
applied: readonly string[] | undefined,
|
|
20
|
+
): AppMigrationsVerdict {
|
|
21
|
+
const ledger = new Set(applied ?? []);
|
|
22
|
+
const known = new Set(shipped);
|
|
23
|
+
return {
|
|
24
|
+
missing: shipped.filter((id) => !ledger.has(id)),
|
|
25
|
+
unknown: (applied ?? []).filter((id) => !known.has(id)),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The ledger's ids as the boot read returns them — a JSON array — and nothing it is not. */
|
|
30
|
+
export function parseAppliedIds(value: unknown): readonly string[] {
|
|
31
|
+
if (typeof value !== 'string') return [];
|
|
32
|
+
const parsed: unknown = JSON.parse(value);
|
|
33
|
+
return Array.isArray(parsed) ? parsed.filter((id): id is string => typeof id === 'string') : [];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** At most this many ids in a line: the count says the rest, and a log line is not a listing. */
|
|
37
|
+
const NAMED = 5;
|
|
38
|
+
|
|
39
|
+
const named = (ids: readonly string[]): string =>
|
|
40
|
+
ids.length <= NAMED
|
|
41
|
+
? ids.join(', ')
|
|
42
|
+
: `${ids.slice(0, NAMED).join(', ')} and ${String(ids.length - NAMED)} more`;
|
|
43
|
+
|
|
44
|
+
/** A serving role over a database the migrate step has not yet brought to this build's migrations. */
|
|
45
|
+
export class AppMigrationsUnappliedError extends UltimateError {
|
|
46
|
+
constructor(input: {
|
|
47
|
+
readonly missing: readonly string[];
|
|
48
|
+
/** `false` when `x_migrations` does not exist: no migrate step ever ran against this database. */
|
|
49
|
+
readonly ledger: boolean;
|
|
50
|
+
readonly waitedMs?: number;
|
|
51
|
+
}) {
|
|
52
|
+
const waited =
|
|
53
|
+
input.waitedMs === undefined
|
|
54
|
+
? ''
|
|
55
|
+
: `. This role waited ${String(Math.round(input.waitedMs))}ms (ULTIMATE_SCHEMA_WAIT_MS) for them`;
|
|
56
|
+
super({
|
|
57
|
+
code: 'X_APP_MIGRATIONS_UNAPPLIED',
|
|
58
|
+
cause: `this build ships ${String(input.missing.length)} migration(s) the database has not applied — ${named(input.missing)}${
|
|
59
|
+
input.ledger ? '' : ` (${LEDGER_TABLE} does not exist: no ROLE=migrate has run here)`
|
|
60
|
+
}. Serving would fail on the first statement naming a column they add: the migrate step must run first${waited}`,
|
|
61
|
+
fix: 'x db migrate',
|
|
62
|
+
meta: {
|
|
63
|
+
missing: [...input.missing],
|
|
64
|
+
ledger: input.ledger,
|
|
65
|
+
...(input.waitedMs === undefined ? {} : { waitedMs: Math.round(input.waitedMs) }),
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Served, said once. A ledger ahead of the build is a rollback — or the old pods of a rollout the
|
|
73
|
+
* migrate step already ran for — and the rolling rail (`X_MIGRATION_ROLLING_UNSAFE`) is what makes
|
|
74
|
+
* that schema one the previous release can run on. Refusing it would crash-loop every old pod of
|
|
75
|
+
* every deploy; serving it silently would hide a rollback nobody finished.
|
|
76
|
+
*/
|
|
77
|
+
export function reportAppMigrationsAhead(unknown: readonly string[]): void {
|
|
78
|
+
if (unknown.length === 0) return;
|
|
79
|
+
logger.warn('ultimate app migrations ahead', {
|
|
80
|
+
migrations: unknown.length,
|
|
81
|
+
cause: `the database holds ${String(unknown.length)} migration(s) this build does not ship — ${named(unknown)}: a newer release migrated and this one is mid-rollout or rolled back`,
|
|
82
|
+
fix: 'x db migrate --json',
|
|
83
|
+
});
|
|
84
|
+
}
|
package/src/cmd-doctor.ts
CHANGED
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
import { ENV_EXAMPLE_PATH, ERROR_DOCS_URL } from '@ultimat3/core';
|
|
6
6
|
import { REQUIRED_BUN, versionAtLeast } from './app-root';
|
|
7
7
|
import { doctorSpec } from './cmd-doctor-spec';
|
|
8
|
+
import { pendingCodemodFindings } from './codemods/pending';
|
|
8
9
|
import type { CliCommand, CommandContext } from './command';
|
|
10
|
+
import { advisoryFloorFindings } from './doctor-advisory-floors';
|
|
9
11
|
import { appUrlFindings } from './doctor-app-url';
|
|
10
12
|
import { authStorageFindings } from './doctor-auth';
|
|
11
13
|
import { browserProbe, browserWarnings, withBrowserReport } from './doctor-browser';
|
|
12
14
|
import { chartAlertsProbe, NOTHING_MISSING, withChartAlertsListing } from './doctor-chart-alerts';
|
|
13
15
|
import { coverageExcludesProbe, withCoverageExcludes } from './doctor-coverage';
|
|
14
16
|
import { embeddedDatabaseFinding } from './doctor-database';
|
|
15
|
-
import {
|
|
17
|
+
import { shippedGuardsProbe, vendoredGuardWarnings, withGuardListing } from './doctor-guards';
|
|
16
18
|
import { offlineFallbackFinding } from './doctor-offline';
|
|
17
19
|
import { NO_POOLER_FACT, poolerFindings, withPoolerReport } from './doctor-pooler';
|
|
18
20
|
import { doctorPort, portFindings } from './doctor-port';
|
|
@@ -21,11 +23,13 @@ import { probeFor } from './doctor-probe';
|
|
|
21
23
|
import { redundantIndexesProbe, withRedundantIndexes } from './doctor-redundant-indexes';
|
|
22
24
|
import { rollingSinceProbe, withRollingReminder } from './doctor-rolling';
|
|
23
25
|
import { sealedKeyFindings } from './doctor-sealed';
|
|
26
|
+
import { supersededFindings } from './doctor-superseded';
|
|
24
27
|
import { typescriptFindings } from './doctor-typescript';
|
|
25
28
|
import { doctorWarnings, withDoctorWarnings } from './doctor-warnings';
|
|
26
29
|
import { ICON_SOURCE } from './icon-assets';
|
|
27
30
|
import { msg } from './messages';
|
|
28
31
|
import type { CommandResult, Finding } from './output';
|
|
32
|
+
import { cliVersion } from './registry';
|
|
29
33
|
import { quoteArg } from './shell-quote';
|
|
30
34
|
|
|
31
35
|
// `src/index.ts` publishes the seam from here; its declaration lives in `doctor-probe.ts`.
|
|
@@ -184,12 +188,16 @@ export async function reportDoctor(probe: DoctorProbe): Promise<CommandResult> {
|
|
|
184
188
|
pooler,
|
|
185
189
|
);
|
|
186
190
|
// Last, and beside the verdict on `main`: the 31.16.0 checks (`doctor-warnings.ts`).
|
|
187
|
-
// A
|
|
191
|
+
// A copy of a shipped guard among them (`X_GUARD_VENDORED`): a warning, so exit stays.
|
|
188
192
|
const browser = await browserProbe(probe.root);
|
|
189
193
|
return withDoctorWarnings(withBrowserReport(reminded, browser), [
|
|
190
194
|
...(await doctorWarnings(probe)),
|
|
191
|
-
...
|
|
195
|
+
...vendoredGuardWarnings(guardEntries),
|
|
192
196
|
...browserWarnings(browser),
|
|
197
|
+
...(probe.root === undefined ? [] : await supersededFindings(probe.root)),
|
|
198
|
+
...(probe.root === undefined ? [] : await advisoryFloorFindings(probe.root)),
|
|
199
|
+
// An `x upgrade` driven by a CLI older than the codemod engine left files it owed.
|
|
200
|
+
...(probe.root === undefined ? [] : await pendingCodemodFindings(probe.root, cliVersion())),
|
|
193
201
|
]);
|
|
194
202
|
}
|
|
195
203
|
|
package/src/cmd-drill.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// `x drill [<name>] [--list] [--budget-ms n]` — the app's
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// `x drill [<name>] [--list] [--budget-ms n]` — the app's roles as real processes on real services,
|
|
2
|
+
// each fault in `@ultimat3/testing`'s drill table played through a proxy, a signal or the rollout
|
|
3
|
+
// order, red on any framework contract that does not hold. CLI wiring only: the table, the fleet
|
|
4
4
|
// and the verdict are testing's. Not a gate step: it needs Postgres, and `x verify` needs nothing.
|
|
5
5
|
|
|
6
6
|
import type { AppConfig } from '@ultimat3/core';
|
|
7
|
-
import { DRAIN_DEADLINE_DEFAULT_MS, MAX_TIMER_MS } from '@ultimat3/core';
|
|
7
|
+
import { DRAIN_DEADLINE_DEFAULT_MS, frameworkVersion, MAX_TIMER_MS } from '@ultimat3/core';
|
|
8
8
|
import type {
|
|
9
9
|
Drill,
|
|
10
10
|
DrillConfig,
|
|
@@ -23,12 +23,14 @@ import {
|
|
|
23
23
|
drillRoles,
|
|
24
24
|
drillServices,
|
|
25
25
|
runDrill,
|
|
26
|
+
runRollout,
|
|
26
27
|
startDrillFleet,
|
|
27
28
|
} from '@ultimat3/testing';
|
|
28
29
|
import { loadAppConfig } from './app-config-load';
|
|
29
30
|
import { requireAppRoot } from './app-root';
|
|
30
31
|
import { drillSpec } from './cmd-drill-spec';
|
|
31
32
|
import type { CliCommand, CommandContext } from './command';
|
|
33
|
+
import { behindStampSql } from './drill-schema-behind';
|
|
32
34
|
import { drillSyncLane } from './drill-sync-lane';
|
|
33
35
|
import { drillTargets } from './drill-targets';
|
|
34
36
|
import { UnknownCommandError } from './errors';
|
|
@@ -74,12 +76,15 @@ const drillConfigOf = (config: AppConfig | undefined): DrillConfig =>
|
|
|
74
76
|
readiness: config.health.readiness,
|
|
75
77
|
};
|
|
76
78
|
|
|
79
|
+
const faultJson = (fault: Drill['fault']): JsonValue => {
|
|
80
|
+
if (fault.kind === 'service') return { service: fault.service };
|
|
81
|
+
if (fault.kind === 'signal') return { role: fault.role, signal: fault.signal };
|
|
82
|
+
return { order: 'roles-before-migrate', waitCode: fault.waitCode };
|
|
83
|
+
};
|
|
84
|
+
|
|
77
85
|
const listing = (drill: Drill): JsonValue => ({
|
|
78
86
|
name: drill.name,
|
|
79
|
-
fault:
|
|
80
|
-
drill.fault.kind === 'service'
|
|
81
|
-
? { service: drill.fault.service }
|
|
82
|
-
: { role: drill.fault.role, signal: drill.fault.signal },
|
|
87
|
+
fault: faultJson(drill.fault),
|
|
83
88
|
holds: [...drill.holds],
|
|
84
89
|
});
|
|
85
90
|
|
|
@@ -174,15 +179,24 @@ export const drillCommand: CliCommand = {
|
|
|
174
179
|
const { targets, skipped } = await drillTargets(root);
|
|
175
180
|
const reports: DrillReport[] = [];
|
|
176
181
|
for (const { drill, services } of planned) {
|
|
182
|
+
const { fault } = drill;
|
|
183
|
+
// The rollout order: the stamp is this package's to write, so the rewind is handed in.
|
|
184
|
+
const order =
|
|
185
|
+
fault.kind === 'order'
|
|
186
|
+
? { rewind: behindStampSql(frameworkVersion()), watch: fault.waitCode }
|
|
187
|
+
: undefined;
|
|
177
188
|
const fleet = await startDrillFleet({
|
|
178
189
|
root,
|
|
179
190
|
services,
|
|
180
191
|
roles: drillRoles(drill),
|
|
181
192
|
readyTimeoutMs: READY_TIMEOUT_MS,
|
|
193
|
+
beforeMigrate: order,
|
|
182
194
|
});
|
|
183
195
|
reports.push(
|
|
184
196
|
await withDrillFleet(fleet, bunDrillSql, (sql) =>
|
|
185
|
-
|
|
197
|
+
order === undefined
|
|
198
|
+
? runDrill({ drill, fleet, budgets, targets, sql, sync: drillSyncLane(fleet) })
|
|
199
|
+
: runRollout({ drill, fleet, budgets, readyTimeoutMs: READY_TIMEOUT_MS }),
|
|
186
200
|
),
|
|
187
201
|
);
|
|
188
202
|
}
|
package/src/cmd-repro-spec.ts
CHANGED
|
@@ -7,7 +7,7 @@ export const reproSpec: CommandSpec = {
|
|
|
7
7
|
name: 'repro',
|
|
8
8
|
summary: 'a dead job or a captured 5xx, as a failing test: x repro <id> --write --verify',
|
|
9
9
|
usage:
|
|
10
|
-
'x repro <jobId|requestId|traceId|fingerprint> [--write] [--verify] | x repro --list [--code X_…] | x repro --from <file> [--write] [--verify] [--json]',
|
|
10
|
+
'x repro <jobId|requestId|traceId|fingerprint> [--write] [--verify] | x repro <id> --bundle [--include-rows] | x repro --list [--code X_…] | x repro --from <file> [--write] [--verify] [--bundle [--include-rows]] [--json]',
|
|
11
11
|
requiresApp: true,
|
|
12
12
|
flags: [
|
|
13
13
|
{
|
|
@@ -20,6 +20,18 @@ export const reproSpec: CommandSpec = {
|
|
|
20
20
|
type: 'boolean',
|
|
21
21
|
summary: 'run the written test and answer { reproduced, code, fingerprint }',
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
name: 'bundle',
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
summary:
|
|
27
|
+
'write repro/bundle-<id>.json: the redacted failure, versions, schema and test, for an issue',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'include-rows',
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
summary:
|
|
33
|
+
'bundle: real values for non-key input, row and step fields (default: stand-ins); secrets stay masked',
|
|
34
|
+
},
|
|
23
35
|
{ name: 'list', type: 'boolean', summary: 'the captured bundles, newest first' },
|
|
24
36
|
{ name: 'code', type: 'string', summary: 'list: only bundles of this X_* code' },
|
|
25
37
|
{
|
package/src/cmd-repro.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
// `x repro <id>` — a production failure becomes a failing test. A dead job (its row, its steps) or
|
|
2
2
|
// a captured 5xx (`x_failures`, when `failureCapture` is on) is read, `--write` puts the replay in
|
|
3
|
-
// `repro/`,
|
|
4
|
-
// CLI wiring only:
|
|
3
|
+
// `repro/`, `--verify` runs it, `--list` shows what is held, `--bundle` writes the redacted archive
|
|
4
|
+
// an issue carries. CLI wiring only: reads `repro-bundle.ts`, archive `repro-archive-write.ts`.
|
|
5
5
|
|
|
6
6
|
import { postgresErrorGroupsStore } from '@ultimat3/admin/error-groups';
|
|
7
|
+
import { renderFixShellArg } from '@ultimat3/core';
|
|
7
8
|
import { postgresFailureStore } from '@ultimat3/db';
|
|
8
9
|
import { loadAppConfig } from './app-config-load';
|
|
9
10
|
import { loadApp } from './app-load';
|
|
10
11
|
import { requireAppRoot } from './app-root';
|
|
11
12
|
import { reproSpec } from './cmd-repro-spec';
|
|
12
13
|
import type { CliCommand, CommandContext } from './command';
|
|
13
|
-
import { MissingPositionalError } from './errors';
|
|
14
|
+
import { BadFlagError, MissingPositionalError } from './errors';
|
|
14
15
|
import { withJobDriver } from './jobs-driver';
|
|
15
16
|
import { msg } from './messages';
|
|
16
17
|
import type { CommandResult, JsonValue } from './output';
|
|
17
18
|
import { findingFrom } from './output';
|
|
18
19
|
import { flagBool, flagString } from './parse';
|
|
20
|
+
import { errorFromFile, errorFromStore } from './repro-archive-collect';
|
|
21
|
+
import { writeBundle } from './repro-archive-write';
|
|
19
22
|
import type { ReproSubject } from './repro-bundle';
|
|
20
23
|
import { resolveSubject, subjectFromFile } from './repro-bundle';
|
|
21
24
|
import { ReproNotReproducedError } from './repro-errors';
|
|
@@ -162,13 +165,42 @@ export const reproCommand: CliCommand = {
|
|
|
162
165
|
example: 'x repro --list --json',
|
|
163
166
|
});
|
|
164
167
|
}
|
|
168
|
+
const bundle = flagBool(ctx.args, 'bundle');
|
|
169
|
+
const includeRows = flagBool(ctx.args, 'include-rows');
|
|
170
|
+
if (includeRows && !bundle) {
|
|
171
|
+
throw new BadFlagError({
|
|
172
|
+
flag: 'include-rows',
|
|
173
|
+
command: 'repro',
|
|
174
|
+
reason: 'it chooses what a bundle carries, and no --bundle was asked for',
|
|
175
|
+
fix: `x repro ${id === undefined ? '--from <file>' : renderFixShellArg(id, '<id>')} --bundle --include-rows`,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
if (bundle && (flagBool(ctx.args, 'write') || flagBool(ctx.args, 'verify'))) {
|
|
179
|
+
throw new BadFlagError({
|
|
180
|
+
flag: 'bundle',
|
|
181
|
+
command: 'repro',
|
|
182
|
+
reason: 'a bundle is written for an issue, and --write/--verify run the test in this app',
|
|
183
|
+
fix: `x repro ${id === undefined ? '--from <file>' : renderFixShellArg(id, '<id>')} --bundle`,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
165
186
|
// The app's declarations are what mask a job's input and what a written test replays against.
|
|
166
187
|
await loadApp(root);
|
|
167
|
-
if (from !== undefined)
|
|
188
|
+
if (from !== undefined) {
|
|
189
|
+
const subject = await subjectFromFile(from);
|
|
190
|
+
if (bundle) {
|
|
191
|
+
return writeBundle(root, ctx, subject, await errorFromFile(from), { includeRows });
|
|
192
|
+
}
|
|
193
|
+
return answer(root, ctx, id ?? from, subject);
|
|
194
|
+
}
|
|
168
195
|
const captureOn = (await loadAppConfig(root))?.failureCapture.enabled === true;
|
|
169
196
|
return withJobDriver(root, ctx, async (driver) => {
|
|
170
197
|
if (id === undefined) return list(ctx);
|
|
171
|
-
|
|
198
|
+
const subject = await resolveSubject(driver, id, captureOn);
|
|
199
|
+
if (bundle) {
|
|
200
|
+
const error = await errorFromStore(driver, subject);
|
|
201
|
+
return writeBundle(root, ctx, subject, error, { includeRows });
|
|
202
|
+
}
|
|
203
|
+
return answer(root, ctx, id, subject);
|
|
172
204
|
});
|
|
173
205
|
},
|
|
174
206
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// `x upgrade codemods`: this CLI's codemods whose version lies after `--from`, up to `--to` (its own
|
|
2
|
+
// version by default), over the app. A hop runs it as the CLI it just installed, so the codemods
|
|
3
|
+
// are the target release's; by hand it carries an app whose hop ran under a CLI with none.
|
|
4
|
+
|
|
5
|
+
import { requireAppRoot } from './app-root';
|
|
6
|
+
import { CODEMODS } from './codemods';
|
|
7
|
+
import { runCodemods } from './codemods/engine';
|
|
8
|
+
import { fsCodemodApp } from './codemods/engine-fs';
|
|
9
|
+
import type { CommandContext } from './command';
|
|
10
|
+
import { ok } from './command';
|
|
11
|
+
import { BadFlagError } from './errors';
|
|
12
|
+
import { msg } from './messages';
|
|
13
|
+
import type { CommandResult, JsonValue } from './output';
|
|
14
|
+
import { flagBool, flagString } from './parse';
|
|
15
|
+
import { cliVersion } from './registry';
|
|
16
|
+
import { manifestSnapshot, reinstallIfMoved } from './upgrade-gate-codemods-install';
|
|
17
|
+
import { releaseOf } from './upgrade-plan';
|
|
18
|
+
import { codemodCounts, codemodLines } from './upgrade-report-codemods';
|
|
19
|
+
|
|
20
|
+
const FIX =
|
|
21
|
+
'x upgrade codemods --from 31.20.0 --dry-run --json # --from: the version the app came from, its old @ultimat3/cli pin';
|
|
22
|
+
|
|
23
|
+
const release = (ctx: CommandContext, flag: 'from' | 'to'): string | undefined => {
|
|
24
|
+
const value = flagString(ctx.args, flag);
|
|
25
|
+
if (value === undefined || releaseOf(value) !== undefined) return value;
|
|
26
|
+
throw new BadFlagError({
|
|
27
|
+
flag,
|
|
28
|
+
command: 'upgrade codemods',
|
|
29
|
+
reason: `"${value}" is not an exact release, major.minor.patch`,
|
|
30
|
+
fix: FIX,
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export async function runUpgradeCodemods(ctx: CommandContext): Promise<CommandResult> {
|
|
35
|
+
const root = requireAppRoot('upgrade codemods', ctx.cwd).dir;
|
|
36
|
+
const from = release(ctx, 'from');
|
|
37
|
+
if (from === undefined) {
|
|
38
|
+
throw new BadFlagError({
|
|
39
|
+
flag: 'from',
|
|
40
|
+
command: 'upgrade codemods',
|
|
41
|
+
reason:
|
|
42
|
+
'names no release, and the codemods to run are the ones after the version the app came from',
|
|
43
|
+
fix: FIX,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const to = release(ctx, 'to') ?? cliVersion();
|
|
47
|
+
const dryRun = flagBool(ctx.args, 'dry-run');
|
|
48
|
+
const before = await manifestSnapshot(root);
|
|
49
|
+
const ran = await runCodemods({
|
|
50
|
+
app: fsCodemodApp(root),
|
|
51
|
+
codemods: CODEMODS,
|
|
52
|
+
from,
|
|
53
|
+
to,
|
|
54
|
+
dryRun,
|
|
55
|
+
});
|
|
56
|
+
// A codemod that moved a package.json owes the install, by hand as on a hop.
|
|
57
|
+
const report =
|
|
58
|
+
!dryRun && (await reinstallIfMoved({ runner: ctx.runner, root, to, before }))
|
|
59
|
+
? { ...ran, reinstalled: true as const }
|
|
60
|
+
: ran;
|
|
61
|
+
const counts = codemodCounts(report);
|
|
62
|
+
return ok(
|
|
63
|
+
'upgrade',
|
|
64
|
+
msg(dryRun ? 'cli.upgrade.codemods.dryRun' : 'cli.upgrade.codemods.done', {
|
|
65
|
+
from,
|
|
66
|
+
to,
|
|
67
|
+
...counts,
|
|
68
|
+
}),
|
|
69
|
+
{ data: { codemods: report as unknown as JsonValue }, lines: codemodLines(report) },
|
|
70
|
+
);
|
|
71
|
+
}
|
package/src/cmd-upgrade-spec.ts
CHANGED
|
@@ -3,24 +3,38 @@
|
|
|
3
3
|
|
|
4
4
|
import type { CommandSpec } from './parse';
|
|
5
5
|
|
|
6
|
+
/** `run` is the hop (a bare `x upgrade`); `codemods` applies the installed release's codemods. */
|
|
7
|
+
export const UPGRADE_SUBCOMMANDS = ['run', 'codemods'] as const;
|
|
8
|
+
|
|
6
9
|
export const upgradeSpec: CommandSpec = {
|
|
7
10
|
name: 'upgrade',
|
|
8
11
|
summary:
|
|
9
|
-
'move every @ultimat3/* one major in lockstep, raise the Bun floor, install, gate — and name the section to read',
|
|
10
|
-
usage:
|
|
12
|
+
'move every @ultimat3/* one major in lockstep, raise the Bun floor, install, apply codemods, gate — and name the section to read',
|
|
13
|
+
usage:
|
|
14
|
+
'x upgrade [--to <version>] [--dry-run] [--json] · x upgrade codemods --from <version> [--to <version>] [--dry-run] [--json]',
|
|
11
15
|
// The one command a repository with pins and no `app.config.ts` can still use: `upgrade-root.ts`
|
|
12
|
-
// finds its root, and its report says which check it could run.
|
|
16
|
+
// finds its root, and its report says which check it could run. `codemods` needs the app.
|
|
17
|
+
subcommands: UPGRADE_SUBCOMMANDS,
|
|
18
|
+
defaultSubcommand: 'run',
|
|
13
19
|
flags: [
|
|
14
20
|
{
|
|
15
21
|
name: 'to',
|
|
16
22
|
type: 'string',
|
|
17
23
|
summary:
|
|
18
|
-
'an exact release inside the next major; over a mixed set, inside the lowest pins’ next major, and only those pins move (default: the next major’s newest)',
|
|
24
|
+
'an exact release inside the next major; over a mixed set, inside the lowest pins’ next major, and only those pins move (default: the next major’s newest). With codemods: the last release whose codemods run (default: this CLI’s own)',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'from',
|
|
28
|
+
type: 'string',
|
|
29
|
+
subcommands: ['codemods'],
|
|
30
|
+
summary:
|
|
31
|
+
'the release the app came from: the codemods whose version lies after it, up to --to, run',
|
|
19
32
|
},
|
|
20
33
|
{
|
|
21
34
|
name: 'dry-run',
|
|
22
35
|
type: 'boolean',
|
|
23
|
-
summary:
|
|
36
|
+
summary:
|
|
37
|
+
'report the pins, the Bun floor edits, the codemods and the section; write nothing, run no gate',
|
|
24
38
|
},
|
|
25
39
|
],
|
|
26
40
|
};
|