@rexezuge/cli 1.14.0 → 1.15.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/README.md +51 -27
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -2
- package/dist/cli.js.map +3 -3
- package/dist/commands/backup.d.ts +22 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +3 -0
- package/dist/commands/backup.js.map +7 -0
- package/dist/commands/manifest.d.ts +8 -0
- package/dist/commands/manifest.d.ts.map +1 -0
- package/dist/commands/manifest.js +1 -0
- package/dist/commands/manifest.js.map +7 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +1 -1
- package/dist/commands/sync.js.map +3 -3
- package/dist/doctor/checks/actions.d.ts +17 -0
- package/dist/doctor/checks/actions.d.ts.map +1 -0
- package/dist/doctor/checks/actions.js +1 -0
- package/dist/doctor/checks/actions.js.map +7 -0
- package/dist/doctor/checks/catalog.d.ts.map +1 -1
- package/dist/doctor/checks/catalog.js +1 -1
- package/dist/doctor/checks/catalog.js.map +3 -3
- package/dist/doctor/registry.d.ts.map +1 -1
- package/dist/doctor/registry.js +1 -1
- package/dist/doctor/registry.js.map +3 -3
- package/dist/manifest-plan.d.ts +58 -0
- package/dist/manifest-plan.d.ts.map +1 -0
- package/dist/manifest-plan.js +1 -0
- package/dist/manifest-plan.js.map +7 -0
- package/dist/repo.d.ts +10 -0
- package/dist/repo.d.ts.map +1 -1
- package/dist/repo.js +1 -1
- package/dist/repo.js.map +3 -3
- package/dist/sync/fixes.d.ts.map +1 -1
- package/dist/sync/fixes.js +6 -6
- package/dist/sync/fixes.js.map +3 -3
- package/dist/sync/plan.d.ts +6 -0
- package/dist/sync/plan.d.ts.map +1 -1
- package/dist/sync/plan.js +5 -3
- package/dist/sync/plan.js.map +3 -3
- package/dist/sync/run.d.ts +4 -0
- package/dist/sync/run.d.ts.map +1 -1
- package/dist/sync/run.js +1 -1
- package/dist/sync/run.js.map +2 -2
- package/dist/sync/tsconfig.d.ts +13 -0
- package/dist/sync/tsconfig.d.ts.map +1 -0
- package/dist/sync/tsconfig.js +5 -0
- package/dist/sync/tsconfig.js.map +7 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +3 -3
- package/dist/workflow-callers.d.ts +2 -1
- package/dist/workflow-callers.d.ts.map +1 -1
- package/dist/workflow-callers.js +15 -14
- package/dist/workflow-callers.js.map +3 -3
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -13,18 +13,20 @@ Every command takes `--cwd <dir>` (the repo; default `.`) and `--help`, exits **
|
|
|
13
13
|
|
|
14
14
|
## Commands
|
|
15
15
|
|
|
16
|
-
| Command | What it does
|
|
17
|
-
| ------------------------------------------------------------------------------------------------------------- |
|
|
18
|
-
| `rexezuge doctor [--json] [--strict]` | Family conformance report with a score. Exit 1 when an ERROR check fails (`--strict`: a WARN too).
|
|
19
|
-
| `rexezuge
|
|
20
|
-
| `rexezuge
|
|
21
|
-
| `rexezuge
|
|
22
|
-
| `rexezuge
|
|
23
|
-
| `rexezuge
|
|
24
|
-
| `rexezuge migrations
|
|
25
|
-
| `rexezuge
|
|
26
|
-
| `rexezuge
|
|
27
|
-
| `rexezuge
|
|
16
|
+
| Command | What it does |
|
|
17
|
+
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
18
|
+
| `rexezuge doctor [--json] [--strict]` | Family conformance report with a score. Exit 1 when an ERROR check fails (`--strict`: a WARN too). |
|
|
19
|
+
| `rexezuge manifest [--json]` | The validated manifest and the CI/CD plan derived from it (what the reusable workflows switch on). |
|
|
20
|
+
| `rexezuge sync [--write] [--json]` | Repairs what doctor found. A dry run unless `--write`. |
|
|
21
|
+
| `rexezuge prepare-wrangler` | Materialize `wrangler.jsonc` from the template and provision the resources it names (env-driven, see tooling). KV bindings come from the manifest's `features.kv`: none declared, none added. |
|
|
22
|
+
| `rexezuge init-secrets` | Create the Secrets Store entries `wrangler.jsonc` declares, generate-if-absent. |
|
|
23
|
+
| `rexezuge backup d1 check\|resolve-target\|encrypt\|upload s3\|upload webdav` | The steps of the reusable `backup-d1` workflow: preflight, target, compress and encrypt, upload and prune. |
|
|
24
|
+
| `rexezuge migrations verify [--dir <d>] [--json]` | Names, numbering and digests against `migrations.lock.json`. Read-only: the CI gate. |
|
|
25
|
+
| `rexezuge migrations lock [--dir <d>] [--json]` | Add-only lock write, then a re-check from disk, so an edited applied migration still exits 1. |
|
|
26
|
+
| `rexezuge migrations add-identity [--dir <d>] [--dry-run] [--json]` | Write the next numbered `NNNN_user_identity.sql` from `@rexezuge/identity`. |
|
|
27
|
+
| `rexezuge spa-shell ensure\|verify [--json]` | Write the empty stub when absent, or reject a missing, stubbed or half-refreshed SPA shell. |
|
|
28
|
+
| `rexezuge god-files [--allowlist <f>] [--fail-on-hard] [--json]` | The 300 / 400 line guard; the manifest's `quality.godFiles` may only lower the limits. |
|
|
29
|
+
| `rexezuge locales validate [--dir <d>] [--base <tag>] [--shape <s>] [--call-sites <d>] [--tags <f>] [--json]` | Key parity, empty values and `{{placeholder}}` parity across locale bundles; optionally call sites and tags. |
|
|
28
30
|
|
|
29
31
|
`--dir` defaults to the manifest's `features.d1.migrationsDir` (then `migrations`) for `migrations`, and to `apps/web/src/locales` for `locales`.
|
|
30
32
|
|
|
@@ -48,16 +50,23 @@ A registry of checks, each with an id, a severity (`error` or `warn`), a message
|
|
|
48
50
|
| Group | Checks (ids) |
|
|
49
51
|
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
50
52
|
| Manifest | `manifest.valid` |
|
|
51
|
-
| Versions | `catalog.present`, `catalog.no-overrides`, `catalog.protocol` (`catalog:` in every package.json), `lockfile.single-version`, `sdk.current` (warn)
|
|
53
|
+
| Versions | `catalog.present`, `catalog.no-overrides`, `catalog.protocol` (`catalog:` in every package.json), `catalog.temp-link` (warn), `lockfile.single-version`, `sdk.current` (warn) |
|
|
52
54
|
| Vendored | `vendored.<name>` for `wrangler-config`, `backup`, `verify-migrations`, `god-files`, `init-secrets`, `prepare-wrangler`, `cloudflare-workers-mock`, `pages-function`, `use-current-user`, `use-spa-language`, `spa-i18n`, `base-route`, `cron-worker`, `pruning-task`, `logger`, `http-hardening` |
|
|
53
55
|
| Presets | `presets.eslint`, `presets.vitest`, `presets.tsconfig`, `presets.prettier`, `presets.vite` (warn) |
|
|
54
|
-
| Workflows | `workflows.callers`: every `.github/workflows/*.yml` calls `Rexezuge-CloudflareWorkers/SDK/.github/workflows
|
|
56
|
+
| Workflows | `workflows.callers`: every `.github/workflows/*.yml` calls `Rexezuge-CloudflareWorkers/SDK/.github/workflows/*`; `workflows.stale-actions` (warn): an unreferenced `setup-env` / `retry-step` composite action |
|
|
55
57
|
| Files | `files.license`, `files.agents`, `files.claude-symlink`, `files.migrations-lock` (with D1), `files.editorconfig` (warn), `files.node-version` (warn), `scripts.canonical` (warn) |
|
|
56
58
|
|
|
57
59
|
Vendored detection uses a path pattern plus a content test, not hashes (a copy drifts the moment it is copied): a file at a known path is flagged unless it
|
|
58
60
|
already delegates to the kit (it mentions `@rexezuge/`, or for `CronTasksWorker.ts` extends `CronTasksDurableObject`). The repo's own destination code
|
|
59
61
|
(`s3-prune`, `upload-s3`, ...) is never matched.
|
|
60
62
|
|
|
63
|
+
### Temporary local links
|
|
64
|
+
|
|
65
|
+
pnpm rejects `link:` inside a catalog, so a repo testing an unreleased kit fix links it from the **root** `package.json`
|
|
66
|
+
(`"@rexezuge/tooling": "link:../SDK/packages/tooling"`). Doctor tolerates exactly that: `catalog.temp-link` is a **warning** ("temporary local link; swap to `catalog:` after
|
|
67
|
+
release"), and `catalog.present` / `catalog.protocol` ignore those entries. Everything else stays an error: a `link:` in any other package, a `file:` specifier, or a link to a
|
|
68
|
+
non-`@rexezuge` package. `sync` never rewrites a `link:`, `file:` or `workspace:` specifier.
|
|
69
|
+
|
|
61
70
|
### Extending doctor
|
|
62
71
|
|
|
63
72
|
Strict on one side, open on the other. A repo adds checks and disables WARN checks through the manifest's `extensions` namespace:
|
|
@@ -97,22 +106,37 @@ export default [
|
|
|
97
106
|
Computes a plan for every failing, auto-fixable check, prints a per-file summary (`M` modified with `+added -removed` lines, `L` symlink, `D` delete) and the score
|
|
98
107
|
before and after. **Dry run by default**; `--write` applies it. Fixes compose in memory first, so two repairs to one file (the catalog and the overrides both live in `pnpm-workspace.yaml`) do not overwrite each other.
|
|
99
108
|
|
|
100
|
-
| Repairs
|
|
101
|
-
|
|
|
102
|
-
| `tsconfig.json`, `apps/*/tsconfig.json`
|
|
103
|
-
| Prettier
|
|
104
|
-
| `@rexezuge/*` versions
|
|
105
|
-
| `CLAUDE.md`, `.nvmrc`, scripts
|
|
106
|
-
| `functions/[[path]].ts`
|
|
107
|
-
| `test/mocks/cloudflare-workers.ts`
|
|
108
|
-
| `.github/workflows/*.yml`
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
| Repairs | How |
|
|
110
|
+
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
111
|
+
| `tsconfig.json`, `apps/*/tsconfig.json` | Writes `extends` (the `base` / `worker` / `web` preset) as the first key by text edit, so the rest of the file keeps its formatting; drops a `compilerOptions` entry only when it is exactly what the preset already sets |
|
|
112
|
+
| Prettier | `"prettier": "@rexezuge/tooling/prettier"`; deletes `.prettierrc` only when it says nothing the preset does not |
|
|
113
|
+
| `@rexezuge/*` versions | Adds the catalog entries (the **exact** version of this CLI, not a range), rewrites ranges to `catalog:`, removes `overrides` pins; a `link:`/`file:`/`workspace:` specifier, and a package this SDK does not publish, are left alone and reported |
|
|
114
|
+
| `CLAUDE.md`, `.nvmrc`, scripts | Symlink to `AGENTS.md` (never over a distinct regular file); `24`; the canonical script names that are missing |
|
|
115
|
+
| `functions/[[path]].ts` | Becomes `export { onRequest } from '@rexezuge/tooling/pages-proxy';`, only when the file is the proxy (it names `API_WORKER`) |
|
|
116
|
+
| `test/mocks/cloudflare-workers.ts` | Becomes `export * from '@rexezuge/testing/cloudflare-workers';` (rewritten, not deleted: suites import it by path) |
|
|
117
|
+
| `.github/workflows/*.yml` | Replaced with the thin caller for the workflow's family name (`continuous-integration` to `worker-ci`, and so on) |
|
|
118
|
+
| `.github/actions/{setup-env,retry-step}` | Deleted when no remaining workflow references them (a workflow sync replaces does not count); no other action is ever touched |
|
|
119
|
+
|
|
120
|
+
Every file `sync` writes ends with exactly one newline. `sync` never deletes domain code. A vendored file is rewritten only when the replacement is a pure re-export; every other vendored copy is reported by doctor and left to you,
|
|
111
121
|
because replacing a local hook or base class is a code change, not a config change (the codemods in `codemods/` cover the import rewrites).
|
|
112
122
|
A fix that declines (a Pages function that is not the proxy, a `.prettierrc` with custom options) leaves the check failing and `sync` exits 1.
|
|
113
123
|
|
|
114
|
-
The caller workflows target the SDK's reusable workflows, tagged `v1` (`uses: Rexezuge-CloudflareWorkers/SDK/.github/workflows/worker-ci.yml@v1`)
|
|
115
|
-
the
|
|
124
|
+
The caller workflows target the SDK's reusable workflows, tagged `v1` (`uses: Rexezuge-CloudflareWorkers/SDK/.github/workflows/worker-ci.yml@v1`); see
|
|
125
|
+
[`docs/workflows.md`](../../docs/workflows.md) for the inputs, secrets and the `extra-gates` extension point. A caller is replaced only when the file is not already one,
|
|
126
|
+
so inputs a repo adds under `with:` survive a later `sync`.
|
|
127
|
+
|
|
128
|
+
## `rexezuge manifest`
|
|
129
|
+
|
|
130
|
+
`rexezuge manifest [--json]` prints the validated `.rexezuge.jsonc` and the plan derived from it: `d1`, `d1Binding`, `web`, `pages`, `spaShell`, `background`, `backupD1`,
|
|
131
|
+
plus two facts read from the repo (`locales`: `apps/web/src/locales` has files; `integration` / `webTests`: the root `package.json` defines `test:integration` / `test:web`),
|
|
132
|
+
`webFilter` (`<scope>/web`), `webBuildScript` (`features.web.buildScript`, else empty), `pagesProject` (`features.web.pagesProject`, else empty), `pagesProjectDefault` (`<name>-web`) and the `jobs` list. The reusable workflows' `plan` job runs it and publishes every non-array field as an output.
|
|
133
|
+
It exits 1 when the manifest is missing or invalid.
|
|
134
|
+
|
|
135
|
+
## `rexezuge backup d1`
|
|
136
|
+
|
|
137
|
+
The steps of the reusable `backup-d1` workflow, secrets from the environment: `check` (the manifest's `features.backupD1` and the destination secrets; fail-closed without `BACKUP_ENCRYPTION_KEY`),
|
|
138
|
+
`resolve-target` (the database from `wrangler.jsonc`, refusing one created in the same run), `encrypt` (compress, then AES-GCM, removing the plaintext) and
|
|
139
|
+
`upload s3|webdav` (store under `<manifest name>/production`, then prune by `BACKUP_RETENTION_DAYS`).
|
|
116
140
|
|
|
117
141
|
## Programmatic use
|
|
118
142
|
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BackupDeps } from './commands/backup.ts';
|
|
1
2
|
import type { ScriptLoaders } from './commands/scripts.ts';
|
|
2
3
|
import type { Io } from './io.ts';
|
|
3
4
|
/**
|
|
@@ -5,6 +6,7 @@ import type { Io } from './io.ts';
|
|
|
5
6
|
*/
|
|
6
7
|
export interface CliDeps {
|
|
7
8
|
readonly loaders?: ScriptLoaders;
|
|
9
|
+
readonly backup?: BackupDeps;
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* Run `rexezuge <argv>` and return the exit code. Nothing here calls `process.exit`, so it is callable from a test.
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAOvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAyBlC;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,GAAE,OAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CA4D9F"}
|
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
var l=Object.defineProperty;var
|
|
1
|
+
var l=Object.defineProperty;var i=(n,e)=>l(n,"name",{value:e,configurable:!0});import{backupCommand as u,defaultBackupDeps as p}from"./commands/backup.js";import{doctorCommand as f}from"./commands/doctor.js";import{godFilesCommand as h}from"./commands/godFiles.js";import{localesCommand as g}from"./commands/locales.js";import{manifestCommand as w}from"./commands/manifest.js";import{migrationsCommand as y}from"./commands/migrations.js";import{defaultLoaders as C,initSecretsCommand as b,prepareWranglerCommand as k}from"./commands/scripts.js";import{spaShellCommand as v}from"./commands/spaShell.js";import{syncCommand as x}from"./commands/sync.js";import{UsageError as m}from"./io.js";import{CLI_VERSION as d}from"./version.js";const c=`rexezuge ${d}: the family command line
|
|
2
2
|
|
|
3
3
|
Usage: rexezuge <command> [options]
|
|
4
4
|
|
|
5
5
|
Commands:
|
|
6
6
|
doctor [--json] [--strict] conformance report and score
|
|
7
|
+
manifest [--json] the validated manifest and the CI/CD plan derived from it
|
|
7
8
|
sync [--write] [--json] apply doctor's auto-fixes (dry run by default)
|
|
8
9
|
prepare-wrangler materialize wrangler.jsonc and provision resources
|
|
9
10
|
init-secrets create declared Secrets Store entries
|
|
@@ -11,8 +12,10 @@ Commands:
|
|
|
11
12
|
migrations add-identity [--dry-run] write the next @rexezuge/identity migration
|
|
12
13
|
spa-shell ensure|verify write the stub, or verify the built shell
|
|
13
14
|
god-files [--allowlist <f>] [--fail-on-hard]
|
|
15
|
+
backup d1 check|resolve-target|encrypt steps of the reusable backup-d1 workflow
|
|
16
|
+
backup d1 upload s3|webdav store the encrypted dump and prune by retention
|
|
14
17
|
locales validate [--dir <d>] [--base <tag>] [--shape <s>] [--call-sites <d>] [--tags <f>]
|
|
15
18
|
|
|
16
19
|
Common options: --cwd <dir> (the repo; default .), --json (a machine-readable report), --help
|
|
17
20
|
Exit codes: 0 success, 1 failure or misuse.
|
|
18
|
-
`;async function
|
|
21
|
+
`;async function H(n,e,o={}){const[t,...r]=n,s=o.loaders??C;try{if(t===void 0||t==="--help"||t==="-h"||t==="help")return e.out(c),t===void 0?1:0;if(t==="--version"||t==="-v")return e.out(d),0;if(r.includes("--help")||r.includes("-h"))return e.out(c),0;switch(t){case"doctor":return await f(r,e);case"manifest":return w(r,e);case"backup":return await u(r,e,o.backup??p);case"sync":return await x(r,e);case"prepare-wrangler":return await k(r,e,s);case"init-secrets":return await b(r,e,s);case"migrations":return y(r,e);case"spa-shell":return v(r,e);case"god-files":return h(r,e);case"locales":return g(r,e);default:throw new m(`unknown command: ${t}`)}}catch(a){return a instanceof m?(e.err(`rexezuge: ${a.message}`),e.err("Run 'rexezuge --help' for usage.")):e.err(`rexezuge ${t??""} failed: ${a instanceof Error?a.message:String(a)}`),1}}i(H,"run");export{H as run};
|
package/dist/cli.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/cli.ts"],
|
|
4
|
-
"sourcesContent": ["import { doctorCommand } from './commands/doctor.ts';\nimport { godFilesCommand } from './commands/godFiles.ts';\nimport { localesCommand } from './commands/locales.ts';\nimport { migrationsCommand } from './commands/migrations.ts';\nimport { defaultLoaders, initSecretsCommand, prepareWranglerCommand } from './commands/scripts.ts';\nimport type { ScriptLoaders } from './commands/scripts.ts';\nimport { spaShellCommand } from './commands/spaShell.ts';\nimport { syncCommand } from './commands/sync.ts';\nimport { UsageError } from './io.ts';\nimport type { Io } from './io.ts';\nimport { CLI_VERSION } from './version.ts';\n\nconst HELP = `rexezuge ${CLI_VERSION}: the family command line\n\nUsage: rexezuge <command> [options]\n\nCommands:\n doctor [--json] [--strict] conformance report and score\n sync [--write] [--json] apply doctor's auto-fixes (dry run by default)\n prepare-wrangler materialize wrangler.jsonc and provision resources\n init-secrets create declared Secrets Store entries\n migrations verify|lock [--dir <d>] check or record the migrations lock\n migrations add-identity [--dry-run] write the next @rexezuge/identity migration\n spa-shell ensure|verify write the stub, or verify the built shell\n god-files [--allowlist <f>] [--fail-on-hard]\n locales validate [--dir <d>] [--base <tag>] [--shape <s>] [--call-sites <d>] [--tags <f>]\n\nCommon options: --cwd <dir> (the repo; default .), --json (a machine-readable report), --help\nExit codes: 0 success, 1 failure or misuse.\n`;\n\n/**\n * Test seams. Everything defaults to the real thing.\n */\nexport interface CliDeps {\n readonly loaders?: ScriptLoaders;\n}\n\n/**\n * Run `rexezuge <argv>` and return the exit code. Nothing here calls `process.exit`, so it is callable from a test.\n */\nexport async function run(argv: readonly string[], io: Io, deps: CliDeps = {}): Promise<number> {\n const [command, ...rest] = argv;\n const loaders = deps.loaders ?? defaultLoaders;\n try {\n if (command === undefined || command === '--help' || command === '-h' || command === 'help') {\n io.out(HELP);\n return command === undefined ? 1 : 0;\n }\n if (command === '--version' || command === '-v') {\n io.out(CLI_VERSION);\n return 0;\n }\n if (rest.includes('--help') || rest.includes('-h')) {\n io.out(HELP);\n return 0;\n }\n switch (command) {\n case 'doctor': {\n return await doctorCommand(rest, io);\n }\n case 'sync': {\n return await syncCommand(rest, io);\n }\n case 'prepare-wrangler': {\n return await prepareWranglerCommand(rest, io, loaders);\n }\n case 'init-secrets': {\n return await initSecretsCommand(rest, io, loaders);\n }\n case 'migrations': {\n return migrationsCommand(rest, io);\n }\n case 'spa-shell': {\n return spaShellCommand(rest, io);\n }\n case 'god-files': {\n return godFilesCommand(rest, io);\n }\n case 'locales': {\n return localesCommand(rest, io);\n }\n default: {\n throw new UsageError(`unknown command: ${command}`);\n }\n }\n } catch (error: unknown) {\n if (error instanceof UsageError) {\n io.err(`rexezuge: ${error.message}`);\n io.err(\"Run 'rexezuge --help' for usage.\");\n } else {\n io.err(`rexezuge ${command ?? ''} failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n return 1;\n }\n}\n"],
|
|
5
|
-
"mappings": "+EAAA,OAAS,iBAAAA,MAAqB,uBAC9B,OAAS,mBAAAC,MAAuB,yBAChC,OAAS,kBAAAC,MAAsB,wBAC/B,OAAS,qBAAAC,MAAyB,2BAClC,OAAS,kBAAAC,EAAgB,sBAAAC,EAAoB,0BAAAC,MAA8B,wBAE3E,OAAS,mBAAAC,MAAuB,yBAChC,OAAS,eAAAC,MAAmB,qBAC5B,OAAS,cAAAC,MAAkB,UAE3B,OAAS,eAAAC,MAAmB,eAE5B,MAAMC,EAAO,YAAYD,CAAW
|
|
6
|
-
"names": ["doctorCommand", "godFilesCommand", "localesCommand", "migrationsCommand", "defaultLoaders", "initSecretsCommand", "prepareWranglerCommand", "spaShellCommand", "syncCommand", "UsageError", "CLI_VERSION", "HELP", "run", "argv", "io", "deps", "command", "rest", "loaders", "error", "__name"]
|
|
4
|
+
"sourcesContent": ["import { backupCommand, defaultBackupDeps } from './commands/backup.ts';\nimport type { BackupDeps } from './commands/backup.ts';\nimport { doctorCommand } from './commands/doctor.ts';\nimport { godFilesCommand } from './commands/godFiles.ts';\nimport { localesCommand } from './commands/locales.ts';\nimport { manifestCommand } from './commands/manifest.ts';\nimport { migrationsCommand } from './commands/migrations.ts';\nimport { defaultLoaders, initSecretsCommand, prepareWranglerCommand } from './commands/scripts.ts';\nimport type { ScriptLoaders } from './commands/scripts.ts';\nimport { spaShellCommand } from './commands/spaShell.ts';\nimport { syncCommand } from './commands/sync.ts';\nimport { UsageError } from './io.ts';\nimport type { Io } from './io.ts';\nimport { CLI_VERSION } from './version.ts';\n\nconst HELP = `rexezuge ${CLI_VERSION}: the family command line\n\nUsage: rexezuge <command> [options]\n\nCommands:\n doctor [--json] [--strict] conformance report and score\n manifest [--json] the validated manifest and the CI/CD plan derived from it\n sync [--write] [--json] apply doctor's auto-fixes (dry run by default)\n prepare-wrangler materialize wrangler.jsonc and provision resources\n init-secrets create declared Secrets Store entries\n migrations verify|lock [--dir <d>] check or record the migrations lock\n migrations add-identity [--dry-run] write the next @rexezuge/identity migration\n spa-shell ensure|verify write the stub, or verify the built shell\n god-files [--allowlist <f>] [--fail-on-hard]\n backup d1 check|resolve-target|encrypt steps of the reusable backup-d1 workflow\n backup d1 upload s3|webdav store the encrypted dump and prune by retention\n locales validate [--dir <d>] [--base <tag>] [--shape <s>] [--call-sites <d>] [--tags <f>]\n\nCommon options: --cwd <dir> (the repo; default .), --json (a machine-readable report), --help\nExit codes: 0 success, 1 failure or misuse.\n`;\n\n/**\n * Test seams. Everything defaults to the real thing.\n */\nexport interface CliDeps {\n readonly loaders?: ScriptLoaders;\n readonly backup?: BackupDeps;\n}\n\n/**\n * Run `rexezuge <argv>` and return the exit code. Nothing here calls `process.exit`, so it is callable from a test.\n */\nexport async function run(argv: readonly string[], io: Io, deps: CliDeps = {}): Promise<number> {\n const [command, ...rest] = argv;\n const loaders = deps.loaders ?? defaultLoaders;\n try {\n if (command === undefined || command === '--help' || command === '-h' || command === 'help') {\n io.out(HELP);\n return command === undefined ? 1 : 0;\n }\n if (command === '--version' || command === '-v') {\n io.out(CLI_VERSION);\n return 0;\n }\n if (rest.includes('--help') || rest.includes('-h')) {\n io.out(HELP);\n return 0;\n }\n switch (command) {\n case 'doctor': {\n return await doctorCommand(rest, io);\n }\n case 'manifest': {\n return manifestCommand(rest, io);\n }\n case 'backup': {\n return await backupCommand(rest, io, deps.backup ?? defaultBackupDeps);\n }\n case 'sync': {\n return await syncCommand(rest, io);\n }\n case 'prepare-wrangler': {\n return await prepareWranglerCommand(rest, io, loaders);\n }\n case 'init-secrets': {\n return await initSecretsCommand(rest, io, loaders);\n }\n case 'migrations': {\n return migrationsCommand(rest, io);\n }\n case 'spa-shell': {\n return spaShellCommand(rest, io);\n }\n case 'god-files': {\n return godFilesCommand(rest, io);\n }\n case 'locales': {\n return localesCommand(rest, io);\n }\n default: {\n throw new UsageError(`unknown command: ${command}`);\n }\n }\n } catch (error: unknown) {\n if (error instanceof UsageError) {\n io.err(`rexezuge: ${error.message}`);\n io.err(\"Run 'rexezuge --help' for usage.\");\n } else {\n io.err(`rexezuge ${command ?? ''} failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n return 1;\n }\n}\n"],
|
|
5
|
+
"mappings": "+EAAA,OAAS,iBAAAA,EAAe,qBAAAC,MAAyB,uBAEjD,OAAS,iBAAAC,MAAqB,uBAC9B,OAAS,mBAAAC,MAAuB,yBAChC,OAAS,kBAAAC,MAAsB,wBAC/B,OAAS,mBAAAC,MAAuB,yBAChC,OAAS,qBAAAC,MAAyB,2BAClC,OAAS,kBAAAC,EAAgB,sBAAAC,EAAoB,0BAAAC,MAA8B,wBAE3E,OAAS,mBAAAC,MAAuB,yBAChC,OAAS,eAAAC,MAAmB,qBAC5B,OAAS,cAAAC,MAAkB,UAE3B,OAAS,eAAAC,MAAmB,eAE5B,MAAMC,EAAO,YAAYD,CAAW;;;;;;;;;;;;;;;;;;;;EAiCpC,eAAsBE,EAAIC,EAAyBC,EAAQC,EAAgB,CAAA,EAAE,CAC3E,KAAM,CAACC,EAAS,GAAGC,CAAI,EAAIJ,EACrBK,EAAUH,EAAK,SAAWX,EAChC,GAAI,CACF,GAAIY,IAAY,QAAaA,IAAY,UAAYA,IAAY,MAAQA,IAAY,OACnF,OAAAF,EAAG,IAAIH,CAAI,EACJK,IAAY,OAAY,EAAI,EAErC,GAAIA,IAAY,aAAeA,IAAY,KACzC,OAAAF,EAAG,IAAIJ,CAAW,EACX,EAET,GAAIO,EAAK,SAAS,QAAQ,GAAKA,EAAK,SAAS,IAAI,EAC/C,OAAAH,EAAG,IAAIH,CAAI,EACJ,EAET,OAAQK,EAAS,CACf,IAAK,SACH,OAAO,MAAMjB,EAAckB,EAAMH,CAAE,EAErC,IAAK,WACH,OAAOZ,EAAgBe,EAAMH,CAAE,EAEjC,IAAK,SACH,OAAO,MAAMjB,EAAcoB,EAAMH,EAAIC,EAAK,QAAUjB,CAAiB,EAEvE,IAAK,OACH,OAAO,MAAMU,EAAYS,EAAMH,CAAE,EAEnC,IAAK,mBACH,OAAO,MAAMR,EAAuBW,EAAMH,EAAII,CAAO,EAEvD,IAAK,eACH,OAAO,MAAMb,EAAmBY,EAAMH,EAAII,CAAO,EAEnD,IAAK,aACH,OAAOf,EAAkBc,EAAMH,CAAE,EAEnC,IAAK,YACH,OAAOP,EAAgBU,EAAMH,CAAE,EAEjC,IAAK,YACH,OAAOd,EAAgBiB,EAAMH,CAAE,EAEjC,IAAK,UACH,OAAOb,EAAegB,EAAMH,CAAE,EAEhC,QACE,MAAM,IAAIL,EAAW,oBAAoBO,CAAO,EAAE,CAEtD,CACF,OAASG,EAAgB,CACvB,OAAIA,aAAiBV,GACnBK,EAAG,IAAI,aAAaK,EAAM,OAAO,EAAE,EACnCL,EAAG,IAAI,kCAAkC,GAEzCA,EAAG,IAAI,YAAYE,GAAW,EAAE,YAAYG,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,CAAC,EAAE,EAE/F,CACT,CACF,CA5DsBC,EAAAR,EAAA",
|
|
6
|
+
"names": ["backupCommand", "defaultBackupDeps", "doctorCommand", "godFilesCommand", "localesCommand", "manifestCommand", "migrationsCommand", "defaultLoaders", "initSecretsCommand", "prepareWranglerCommand", "spaShellCommand", "syncCommand", "UsageError", "CLI_VERSION", "HELP", "run", "argv", "io", "deps", "command", "rest", "loaders", "error", "__name"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Io } from '../io.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The side effects of the backup steps, injectable so a test runs no wrangler, aws or rclone.
|
|
4
|
+
*/
|
|
5
|
+
export interface BackupDeps {
|
|
6
|
+
/**
|
|
7
|
+
* Run a program and return its stdout; throws on a non-zero exit.
|
|
8
|
+
*/
|
|
9
|
+
exec(command: string, args: readonly string[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Compress and encrypt `backup.sql` in the working directory (`@rexezuge/tooling`'s encrypt-backup).
|
|
12
|
+
*/
|
|
13
|
+
encrypt(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const defaultBackupDeps: BackupDeps;
|
|
16
|
+
/**
|
|
17
|
+
* `rexezuge backup d1 <step>`: the steps of the reusable `backup-d1` workflow, as commands.
|
|
18
|
+
* `check` gates on the manifest and the secrets, `resolve-target` picks the database, `encrypt` compresses and seals
|
|
19
|
+
* the dump, and `upload s3|webdav` stores it and prunes by `BACKUP_RETENTION_DAYS`. Secrets come from the environment.
|
|
20
|
+
*/
|
|
21
|
+
export declare function backupCommand(args: readonly string[], io: Io, deps?: BackupDeps, env?: NodeJS.ProcessEnv): Promise<number>;
|
|
22
|
+
//# sourceMappingURL=backup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../../src/commands/backup.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;IACvD;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,eAAO,MAAM,iBAAiB,EAAE,UAK/B,CAAC;AAuGF;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,EAAE,EAAE,EACN,IAAI,GAAE,UAA8B,EACpC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC,MAAM,CAAC,CAyBjB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var k=Object.defineProperty;var u=(n,e)=>k(n,"name",{value:e,configurable:!0});import{execFileSync as S}from"node:child_process";import{mkdirSync as B,readFileSync as j,writeFileSync as v}from"node:fs";import{homedir as A}from"node:os";import w from"node:path";import{parse as _}from"jsonc-parser";import{loadManifest as b}from"@rexezuge/tooling/manifest";import{resolveD1Target as R}from"@rexezuge/tooling/scripts/backup/d1-target";import{evaluateConfig as O}from"@rexezuge/tooling/scripts/backup/destination-config";import{backupPrefix as W,parseS3ListRow as C,shouldDeleteBackup as P,WEBDAV_REMOTE as y,webdavTargetDir as U}from"@rexezuge/tooling/scripts/backup/destinations";import{requireRetentionDays as x,retentionCutoff as V}from"@rexezuge/tooling/scripts/backup/naming";import{setOutput as h}from"@rexezuge/tooling/scripts/lib/github-actions";import{parseCommand as N}from"../args.js";import{UsageError as p}from"../io.js";const T={exec:u((n,e)=>S(n,[...e],{encoding:"utf8",stdio:["ignore","pipe","inherit"]}),"exec"),encrypt:u(async()=>(await import("@rexezuge/tooling/scripts/backup/encrypt-backup")).main(),"encrypt")},D="usage: rexezuge backup d1 <check|resolve-target|encrypt|upload s3|upload webdav>";function E(n,...e){const r=e.filter(t=>!n[t]);if(r.length>0)throw new p(`${r.join(", ")} must be set`);return e.map(t=>n[t])}u(E,"requireEnv");function I(n,e,r){if(!(b(n)?.features?.backupD1===!0)){e.out("features.backupD1 is not enabled in .rexezuge.jsonc: nothing to back up.");for(const s of["cloudflare","encryption","s3","webdav"])h(s,"false");return 0}const o=O(r),c={cloudflare:o.cloudflare,encryption:o.encryption,s3:o.s3,webdav:o.webdav};for(const[s,a]of Object.entries(c))e.out(`${a?"enabled ":"disabled"} ${s}`),h(s,String(a));for(const s of o.errors)e.err(`::error::${s}`);return o.errors.length>0?1:0}u(I,"check");function z(n,e,r,t){let o;try{o=_(j(w.join(n,"wrangler.jsonc"),"utf8"))}catch{return e.err("Could not read wrangler.jsonc. Run `rexezuge prepare-wrangler` first."),1}const c=R(o);if((t.PROVISIONED_RESOURCES??"").split(",").map(a=>a.trim()).some(a=>a.startsWith("d1:")))return e.err(`${c.target} was created by the provisioning step in this same run, so it holds no data. Refusing to upload an empty dump as a backup.`),1;try{r.exec("pnpm",["exec","wrangler","d1","info",c.target,"--config","wrangler.jsonc","--json"])}catch{return e.err(`Unable to read D1 database "${c.target}" with the configured credentials.`),1}return e.out(`Exporting D1 database: ${c.target} (${c.databaseId})`),h("target",c.target),0}u(z,"resolveTarget");function F(n,e,r,t){const[o,c]=E(t,"S3_BUCKET","BACKUP_FILE"),s=x(t),a=b(n)?.name;if(a===void 0)throw new p("upload needs .rexezuge.jsonc: its `name` is the remote prefix");const f=t.S3_ENDPOINT?["--endpoint-url",t.S3_ENDPOINT]:[],i=`s3://${o}/${W(a)}/`;r.exec("aws",["s3","cp",c,i,...f]),e.out(`Backup uploaded to S3: ${i}${c}`);const l=V(new Date,s);for(const g of r.exec("aws",["s3","ls",i,...f]).split(`
|
|
2
|
+
`)){const d=C(g);d===void 0||!P(d,l)||(e.out(`Deleting old backup: ${d.fileName}`),r.exec("aws",["s3","rm",`${i}${d.fileName}`,...f]))}return 0}u(F,"uploadS3");function L(n,e,r,t){const[o,c,s,a]=E(t,"WEBDAV_URL","WEBDAV_USER","WEBDAV_PASSWORD","BACKUP_FILE"),f=x(t),i=b(n)?.name;if(i===void 0)throw new p("upload needs .rexezuge.jsonc: its `name` is the remote prefix");const l=w.join(A(),".config","rclone");B(l,{recursive:!0});const g=r.exec("rclone",["obscure",s]).trim(),d=t.WEBDAV_VENDOR||"other";v(w.join(l,"rclone.conf"),[`[${y}]`,"type = webdav",`url = ${o}`,`vendor = ${d}`,`user = ${c}`,`pass = ${g}`,""].join(`
|
|
3
|
+
`));const $=t.WEBDAV_BASE_PATH||i,m=U($,i);return r.exec("rclone",["mkdir",`${y}:${$}`]),r.exec("rclone",["mkdir",m]),r.exec("rclone",["copyto",a,`${m}/${a}`]),e.out(`Backup uploaded to WebDAV: ${m}/${a}`),r.exec("rclone",["delete",`${m}/`,"-v","--min-age",`${f}d`]),0}u(L,"uploadWebdav");async function ne(n,e,r=T,t=process.env){const{cwd:o,positionals:c}=N(n,{}),[s,a,f,...i]=c;if(s!=="d1"||a===void 0||i.length>0)throw new p(D);switch(a){case"check":return I(o,e,t);case"resolve-target":return z(o,e,r,t);case"encrypt":return process.chdir(o),await r.encrypt(),0;case"upload":{if(f==="s3")return F(o,e,r,t);if(f==="webdav")return L(o,e,r,t);throw new p(D)}default:throw new p(D)}}u(ne,"backupCommand");export{ne as backupCommand,T as defaultBackupDeps};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/backup.ts"],
|
|
4
|
+
"sourcesContent": ["import { execFileSync } from 'node:child_process';\nimport { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport path from 'node:path';\nimport { parse as parseJsonc } from 'jsonc-parser';\nimport { loadManifest } from '@rexezuge/tooling/manifest';\nimport { resolveD1Target } from '@rexezuge/tooling/scripts/backup/d1-target';\nimport type { D1DatabaseBinding } from '@rexezuge/tooling/scripts/backup/d1-target';\nimport { evaluateConfig } from '@rexezuge/tooling/scripts/backup/destination-config';\nimport {\n backupPrefix,\n parseS3ListRow,\n shouldDeleteBackup,\n WEBDAV_REMOTE,\n webdavTargetDir,\n} from '@rexezuge/tooling/scripts/backup/destinations';\nimport { requireRetentionDays, retentionCutoff } from '@rexezuge/tooling/scripts/backup/naming';\nimport { setOutput } from '@rexezuge/tooling/scripts/lib/github-actions';\nimport { parseCommand } from '../args.ts';\nimport { UsageError } from '../io.ts';\nimport type { Io } from '../io.ts';\n\n/**\n * The side effects of the backup steps, injectable so a test runs no wrangler, aws or rclone.\n */\nexport interface BackupDeps {\n /**\n * Run a program and return its stdout; throws on a non-zero exit.\n */\n exec(command: string, args: readonly string[]): string;\n /**\n * Compress and encrypt `backup.sql` in the working directory (`@rexezuge/tooling`'s encrypt-backup).\n */\n encrypt(): Promise<void>;\n}\n\nexport const defaultBackupDeps: BackupDeps = {\n // The program name is the point of the call (aws, rclone, pnpm), resolved from PATH on the runner.\n // eslint-disable-next-line sonarjs/no-os-command-from-path\n exec: (command, args) => execFileSync(command, [...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'inherit'] }),\n encrypt: async () => (await import('@rexezuge/tooling/scripts/backup/encrypt-backup')).main(),\n};\n\nconst USAGE = 'usage: rexezuge backup d1 <check|resolve-target|encrypt|upload s3|upload webdav>';\n\nfunction requireEnv(env: NodeJS.ProcessEnv, ...names: string[]): string[] {\n const missing = names.filter((name) => !env[name]);\n if (missing.length > 0) throw new UsageError(`${missing.join(', ')} must be set`);\n return names.map((name) => env[name] as string);\n}\n\nfunction check(cwd: string, io: Io, env: NodeJS.ProcessEnv): number {\n const enabled = loadManifest(cwd)?.features?.backupD1 === true;\n if (!enabled) {\n io.out('features.backupD1 is not enabled in .rexezuge.jsonc: nothing to back up.');\n for (const key of ['cloudflare', 'encryption', 's3', 'webdav']) setOutput(key, 'false');\n return 0;\n }\n const config = evaluateConfig(env);\n const flags = { cloudflare: config.cloudflare, encryption: config.encryption, s3: config.s3, webdav: config.webdav };\n for (const [key, value] of Object.entries(flags)) {\n io.out(`${value ? 'enabled ' : 'disabled'} ${key}`);\n setOutput(key, String(value));\n }\n for (const error of config.errors) io.err(`::error::${error}`);\n return config.errors.length > 0 ? 1 : 0;\n}\n\nfunction resolveTarget(cwd: string, io: Io, deps: BackupDeps, env: NodeJS.ProcessEnv): number {\n let config: { d1_databases?: D1DatabaseBinding[] };\n try {\n config = parseJsonc(readFileSync(path.join(cwd, 'wrangler.jsonc'), 'utf8')) as { d1_databases?: D1DatabaseBinding[] };\n } catch {\n io.err('Could not read wrangler.jsonc. Run `rexezuge prepare-wrangler` first.');\n return 1;\n }\n const target = resolveD1Target(config);\n // `d1 info` always acts on the remote database, and has no --remote flag.\n const provisioned = (env['PROVISIONED_RESOURCES'] ?? '').split(',').map((entry) => entry.trim());\n if (provisioned.some((entry) => entry.startsWith('d1:'))) {\n io.err(\n `${target.target} was created by the provisioning step in this same run, so it holds no data. Refusing to upload an empty dump as a backup.`,\n );\n return 1;\n }\n try {\n deps.exec('pnpm', ['exec', 'wrangler', 'd1', 'info', target.target, '--config', 'wrangler.jsonc', '--json']);\n } catch {\n io.err(`Unable to read D1 database \"${target.target}\" with the configured credentials.`);\n return 1;\n }\n io.out(`Exporting D1 database: ${target.target} (${target.databaseId})`);\n setOutput('target', target.target);\n return 0;\n}\n\nfunction uploadS3(cwd: string, io: Io, deps: BackupDeps, env: NodeJS.ProcessEnv): number {\n const [bucket, file] = requireEnv(env, 'S3_BUCKET', 'BACKUP_FILE') as [string, string];\n const retentionDays = requireRetentionDays(env);\n const name = loadManifest(cwd)?.name;\n if (name === undefined) throw new UsageError('upload needs .rexezuge.jsonc: its `name` is the remote prefix');\n const endpoint = env['S3_ENDPOINT'] ? ['--endpoint-url', env['S3_ENDPOINT']] : [];\n const remoteDir = `s3://${bucket}/${backupPrefix(name)}/`;\n deps.exec('aws', ['s3', 'cp', file, remoteDir, ...endpoint]);\n io.out(`Backup uploaded to S3: ${remoteDir}${file}`);\n const cutoff = retentionCutoff(new Date(), retentionDays);\n for (const line of deps.exec('aws', ['s3', 'ls', remoteDir, ...endpoint]).split('\\n')) {\n const entry = parseS3ListRow(line);\n if (entry === undefined || !shouldDeleteBackup(entry, cutoff)) continue;\n io.out(`Deleting old backup: ${entry.fileName}`);\n deps.exec('aws', ['s3', 'rm', `${remoteDir}${entry.fileName}`, ...endpoint]);\n }\n return 0;\n}\n\nfunction uploadWebdav(cwd: string, io: Io, deps: BackupDeps, env: NodeJS.ProcessEnv): number {\n const [url, user, password, file] = requireEnv(env, 'WEBDAV_URL', 'WEBDAV_USER', 'WEBDAV_PASSWORD', 'BACKUP_FILE') as [\n string,\n string,\n string,\n string,\n ];\n const retentionDays = requireRetentionDays(env);\n const name = loadManifest(cwd)?.name;\n if (name === undefined) throw new UsageError('upload needs .rexezuge.jsonc: its `name` is the remote prefix');\n // rclone stores the password obscured (reversible), which is why the config lives outside the repo and the artifact.\n const configDir = path.join(homedir(), '.config', 'rclone');\n mkdirSync(configDir, { recursive: true });\n const obscured = deps.exec('rclone', ['obscure', password]).trim();\n const vendor = env['WEBDAV_VENDOR'] || 'other';\n writeFileSync(\n path.join(configDir, 'rclone.conf'),\n [`[${WEBDAV_REMOTE}]`, 'type = webdav', `url = ${url}`, `vendor = ${vendor}`, `user = ${user}`, `pass = ${obscured}`, ''].join('\\n'),\n );\n const basePath = env['WEBDAV_BASE_PATH'] || name;\n const targetDir = webdavTargetDir(basePath, name);\n deps.exec('rclone', ['mkdir', `${WEBDAV_REMOTE}:${basePath}`]);\n deps.exec('rclone', ['mkdir', targetDir]);\n deps.exec('rclone', ['copyto', file, `${targetDir}/${file}`]);\n io.out(`Backup uploaded to WebDAV: ${targetDir}/${file}`);\n deps.exec('rclone', ['delete', `${targetDir}/`, '-v', '--min-age', `${retentionDays}d`]);\n return 0;\n}\n\n/**\n * `rexezuge backup d1 <step>`: the steps of the reusable `backup-d1` workflow, as commands.\n * `check` gates on the manifest and the secrets, `resolve-target` picks the database, `encrypt` compresses and seals\n * the dump, and `upload s3|webdav` stores it and prunes by `BACKUP_RETENTION_DAYS`. Secrets come from the environment.\n */\nexport async function backupCommand(\n args: readonly string[],\n io: Io,\n deps: BackupDeps = defaultBackupDeps,\n env: NodeJS.ProcessEnv = process.env,\n): Promise<number> {\n const { cwd, positionals } = parseCommand(args, {} as const);\n const [scope, step, destination, ...extra] = positionals;\n if (scope !== 'd1' || step === undefined || extra.length > 0) throw new UsageError(USAGE);\n switch (step) {\n case 'check': {\n return check(cwd, io, env);\n }\n case 'resolve-target': {\n return resolveTarget(cwd, io, deps, env);\n }\n case 'encrypt': {\n process.chdir(cwd);\n await deps.encrypt();\n return 0;\n }\n case 'upload': {\n if (destination === 's3') return uploadS3(cwd, io, deps, env);\n if (destination === 'webdav') return uploadWebdav(cwd, io, deps, env);\n throw new UsageError(USAGE);\n }\n default: {\n throw new UsageError(USAGE);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "+EAAA,OAAS,gBAAAA,MAAoB,qBAC7B,OAAS,aAAAC,EAAW,gBAAAC,EAAc,iBAAAC,MAAqB,UACvD,OAAS,WAAAC,MAAe,UACxB,OAAOC,MAAU,YACjB,OAAS,SAASC,MAAkB,eACpC,OAAS,gBAAAC,MAAoB,6BAC7B,OAAS,mBAAAC,MAAuB,6CAEhC,OAAS,kBAAAC,MAAsB,sDAC/B,OACE,gBAAAC,EACA,kBAAAC,EACA,sBAAAC,EACA,iBAAAC,EACA,mBAAAC,MACK,gDACP,OAAS,wBAAAC,EAAsB,mBAAAC,MAAuB,0CACtD,OAAS,aAAAC,MAAiB,+CAC1B,OAAS,gBAAAC,MAAoB,aAC7B,OAAS,cAAAC,MAAkB,WAiBpB,MAAMC,EAAgC,CAG3C,KAAMC,EAAA,CAACC,EAASC,IAASvB,EAAasB,EAAS,CAAC,GAAGC,CAAI,EAAG,CAAE,SAAU,OAAQ,MAAO,CAAC,SAAU,OAAQ,SAAS,CAAC,CAAE,EAA9G,QACN,QAASF,EAAA,UAAa,KAAM,QAAO,iDAAiD,GAAG,KAAI,EAAlF,YAGLG,EAAQ,mFAEd,SAASC,EAAWC,KAA2BC,EAAe,CAC5D,MAAMC,EAAUD,EAAM,OAAQE,GAAS,CAACH,EAAIG,CAAI,CAAC,EACjD,GAAID,EAAQ,OAAS,EAAG,MAAM,IAAIT,EAAW,GAAGS,EAAQ,KAAK,IAAI,CAAC,cAAc,EAChF,OAAOD,EAAM,IAAKE,GAASH,EAAIG,CAAI,CAAW,CAChD,CAJSR,EAAAI,EAAA,cAMT,SAASK,EAAMC,EAAaC,EAAQN,EAAsB,CAExD,GAAI,EAD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IJ,EAC7C,GAAIC,IAAU,MAAQC,IAAS,QAAaE,EAAM,OAAS,EAAG,MAAM,IAAI7C,EAAWK,CAAK,EACxF,OAAQsC,EAAM,CACZ,IAAK,QACH,OAAOhC,EAAMC,EAAKC,EAAIN,CAAG,EAE3B,IAAK,iBACH,OAAOY,EAAcP,EAAKC,EAAIO,EAAMb,CAAG,EAEzC,IAAK,UACH,eAAQ,MAAMK,CAAG,EACjB,MAAMQ,EAAK,QAAO,EACX,EAET,IAAK,SAAU,CACb,GAAIwB,IAAgB,KAAM,OAAOrB,EAASX,EAAKC,EAAIO,EAAMb,CAAG,EAC5D,GAAIqC,IAAgB,SAAU,OAAOb,EAAanB,EAAKC,EAAIO,EAAMb,CAAG,EACpE,MAAM,IAAIP,EAAWK,CAAK,CAC5B,CACA,QACE,MAAM,IAAIL,EAAWK,CAAK,CAE9B,CACF,CA9BsBH,EAAAsC,GAAA",
|
|
6
|
+
"names": ["execFileSync", "mkdirSync", "readFileSync", "writeFileSync", "homedir", "path", "parseJsonc", "loadManifest", "resolveD1Target", "evaluateConfig", "backupPrefix", "parseS3ListRow", "shouldDeleteBackup", "WEBDAV_REMOTE", "webdavTargetDir", "requireRetentionDays", "retentionCutoff", "setOutput", "parseCommand", "UsageError", "defaultBackupDeps", "__name", "command", "args", "USAGE", "requireEnv", "env", "names", "missing", "name", "check", "cwd", "io", "key", "config", "flags", "value", "error", "resolveTarget", "deps", "target", "entry", "uploadS3", "bucket", "file", "retentionDays", "endpoint", "remoteDir", "cutoff", "line", "uploadWebdav", "url", "user", "password", "configDir", "obscured", "vendor", "basePath", "targetDir", "backupCommand", "positionals", "scope", "step", "destination", "extra"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Io } from '../io.ts';
|
|
2
|
+
/**
|
|
3
|
+
* `rexezuge manifest [--json]`: the validated `.rexezuge.jsonc` and the plan the reusable workflows derive from it
|
|
4
|
+
* (which jobs run, the D1 binding, the SPA filter). Exit 1 when the manifest is missing or invalid, because a workflow
|
|
5
|
+
* that cannot read its plan must fail instead of guessing.
|
|
6
|
+
*/
|
|
7
|
+
export declare function manifestCommand(args: readonly string[], io: Io): number;
|
|
8
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/commands/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAInC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CA+BvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=Object.defineProperty;var a=(o,r)=>u(o,"name",{value:r,configurable:!0});import{parseCommand as c}from"../args.js";import{UsageError as p}from"../io.js";import{planFor as d}from"../manifest-plan.js";import{loadRepo as g}from"../repo.js";function h(o,r){const{cwd:i,json:f,positionals:s}=c(o,{});if(s.length>0)throw new p(`manifest takes no arguments, got: ${s.join(" ")}`);const n=g(i);if(n.manifestError!==null)return r.err(`manifest is invalid: ${n.manifestError}`),1;if(n.manifest===null)return r.err("no .rexezuge.jsonc found; the reusable workflows read it (rexezuge sync --write, or create-worker, writes one)."),1;const e=d(n.manifest,n);if(f)return r.out(JSON.stringify({manifest:n.manifest,plan:e},null,2)),0;r.out(`${n.manifest.name} (${n.manifest.scope})`);const l=Object.entries({d1:e.d1?`${e.d1Binding} (${e.d1Database})`:!1,web:e.web?e.pages?"pages":"worker":!1,spaShell:e.spaShell,background:e.background,backupD1:e.backupD1,locales:e.locales,integration:e.integration,webTests:e.webTests});for(const[m,t]of l)r.out(` ${m}: ${t===!1?"off":t===!0?"on":t}`);return r.out(`ci jobs: ${e.jobs.join(", ")}`),0}a(h,"manifestCommand");export{h as manifestCommand};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/commands/manifest.ts"],
|
|
4
|
+
"sourcesContent": ["import { parseCommand } from '../args.ts';\nimport { UsageError } from '../io.ts';\nimport type { Io } from '../io.ts';\nimport { planFor } from '../manifest-plan.ts';\nimport { loadRepo } from '../repo.ts';\n\n/**\n * `rexezuge manifest [--json]`: the validated `.rexezuge.jsonc` and the plan the reusable workflows derive from it\n * (which jobs run, the D1 binding, the SPA filter). Exit 1 when the manifest is missing or invalid, because a workflow\n * that cannot read its plan must fail instead of guessing.\n */\nexport function manifestCommand(args: readonly string[], io: Io): number {\n const { cwd, json, positionals } = parseCommand(args, {} as const);\n if (positionals.length > 0) throw new UsageError(`manifest takes no arguments, got: ${positionals.join(' ')}`);\n const repo = loadRepo(cwd);\n if (repo.manifestError !== null) {\n io.err(`manifest is invalid: ${repo.manifestError}`);\n return 1;\n }\n if (repo.manifest === null) {\n io.err('no .rexezuge.jsonc found; the reusable workflows read it (rexezuge sync --write, or create-worker, writes one).');\n return 1;\n }\n const plan = planFor(repo.manifest, repo);\n if (json) {\n io.out(JSON.stringify({ manifest: repo.manifest, plan }, null, 2));\n return 0;\n }\n io.out(`${repo.manifest.name} (${repo.manifest.scope})`);\n const features = Object.entries({\n d1: plan.d1 ? `${plan.d1Binding} (${plan.d1Database})` : false,\n web: plan.web ? (plan.pages ? 'pages' : 'worker') : false,\n spaShell: plan.spaShell,\n background: plan.background,\n backupD1: plan.backupD1,\n locales: plan.locales,\n integration: plan.integration,\n webTests: plan.webTests,\n });\n for (const [key, value] of features) io.out(` ${key}: ${value === false ? 'off' : value === true ? 'on' : value}`);\n io.out(`ci jobs: ${plan.jobs.join(', ')}`);\n return 0;\n}\n"],
|
|
5
|
+
"mappings": "+EAAA,OAAS,gBAAAA,MAAoB,aAC7B,OAAS,cAAAC,MAAkB,WAE3B,OAAS,WAAAC,MAAe,sBACxB,OAAS,YAAAC,MAAgB,aAOnB,SAAUC,EAAgBC,EAAyBC,EAAM,CAC7D,KAAM,CAAE,IAAAC,EAAK,KAAAC,EAAM,YAAAC,CAAW,EAAKT,EAAaK,EAAM,CAAA,CAAW,EACjE,GAAII,EAAY,OAAS,EAAG,MAAM,IAAIR,EAAW,qCAAqCQ,EAAY,KAAK,GAAG,CAAC,EAAE,EAC7G,MAAMC,EAAOP,EAASI,CAAG,EACzB,GAAIG,EAAK,gBAAkB,KACzB,OAAAJ,EAAG,IAAI,wBAAwBI,EAAK,aAAa,EAAE,EAC5C,EAET,GAAIA,EAAK,WAAa,KACpB,OAAAJ,EAAG,IAAI,iHAAiH,EACjH,EAET,MAAMK,EAAOT,EAAQQ,EAAK,SAAUA,CAAI,EACxC,GAAIF,EACF,OAAAF,EAAG,IAAI,KAAK,UAAU,CAAE,SAAUI,EAAK,SAAU,KAAAC,CAAI,EAAI,KAAM,CAAC,CAAC,EAC1D,EAETL,EAAG,IAAI,GAAGI,EAAK,SAAS,IAAI,KAAKA,EAAK,SAAS,KAAK,GAAG,EACvD,MAAME,EAAW,OAAO,QAAQ,CAC9B,GAAID,EAAK,GAAK,GAAGA,EAAK,SAAS,KAAKA,EAAK,UAAU,IAAM,GACzD,IAAKA,EAAK,IAAOA,EAAK,MAAQ,QAAU,SAAY,GACpD,SAAUA,EAAK,SACf,WAAYA,EAAK,WACjB,SAAUA,EAAK,SACf,QAASA,EAAK,QACd,YAAaA,EAAK,YAClB,SAAUA,EAAK,SAChB,EACD,SAAW,CAACE,EAAKC,CAAK,IAAKF,EAAUN,EAAG,IAAI,KAAKO,CAAG,KAAKC,IAAU,GAAQ,MAAQA,IAAU,GAAO,KAAOA,CAAK,EAAE,EAClH,OAAAR,EAAG,IAAI,YAAYK,EAAK,KAAK,KAAK,IAAI,CAAC,EAAE,EAClC,CACT,CA/BgBI,EAAAX,EAAA",
|
|
6
|
+
"names": ["parseCommand", "UsageError", "planFor", "loadRepo", "manifestCommand", "args", "io", "cwd", "json", "positionals", "repo", "plan", "features", "key", "value", "__name"]
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBlF"}
|
package/dist/commands/sync.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var l=Object.defineProperty;var r=(n,o)=>l(n,"name",{value:o,configurable:!0});import{parseCommand as i}from"../args.js";import{runSync as d}from"../sync/run.js";async function h(n,o){const{cwd:s,json:a,values:c}=i(n,{write:{type:"boolean"}}),e=await d(s,c.write===!0);if(a)o.out(JSON.stringify({...e,before:e.before.score,after:e.after?.score??null},null,2));else{o.out(`rexezuge sync ${e.write?"--write":"(dry run; pass --write to apply)"}: ${e.root}`);for(const t of e.changes){const f=t.op==="write"?` (+${t.added??0} -${t.removed??0})`:"",u={write:"M",symlink:"L",delete:"D"}[t.op];o.out(` ${u} ${t.path}${f}: ${t.note}`)}e.changes.length===0&&o.out(" nothing to change");for(const t of e.unfixed)o.out(` ! ${t}: needs a human (the file is repo code, not a safe replacement)`);for(const t of e.notes)o.out(` - ${t}`);o.out(`Score: ${e.before.score}${e.after===null?"":` -> ${e.after.score}`}/100`)}return e.unfixed.length>0?1:0}r(h,"syncCommand");export{h as syncCommand};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/sync.ts"],
|
|
4
|
-
"sourcesContent": ["import { parseCommand } from '../args.ts';\nimport { runSync } from '../sync/run.ts';\nimport type { Io } from '../io.ts';\n\n/**\n * `rexezuge sync [--write] [--json]`: the repairs for what doctor found. A dry run unless `--write`.\n * Exit 0 when nothing failed to apply; 1 when an auto-fixable check was left failing (see `unfixed`).\n */\nexport async function syncCommand(args: readonly string[], io: Io): Promise<number> {\n const { cwd, json, values } = parseCommand(args, { write: { type: 'boolean' } } as const);\n const result = await runSync(cwd, values.write === true);\n if (json) {\n io.out(JSON.stringify({ ...result, before: result.before.score, after: result.after?.score ?? null }, null, 2));\n } else {\n io.out(`rexezuge sync ${result.write ? '--write' : '(dry run; pass --write to apply)'}: ${result.root}`);\n for (const change of result.changes) {\n const stat = change.op === 'write' ? ` (+${change.added ?? 0} -${change.removed ?? 0})` : '';\n const mark = { write: 'M', symlink: 'L', delete: 'D' }[change.op];\n io.out(` ${mark} ${change.path}${stat}: ${change.note}`);\n }\n if (result.changes.length === 0) io.out(' nothing to change');\n for (const id of result.unfixed) io.out(` ! ${id}: needs a human (the file is repo code, not a safe replacement)`);\n io.out(`Score: ${result.before.score}${result.after === null ? '' : ` -> ${result.after.score}`}/100`);\n }\n return result.unfixed.length > 0 ? 1 : 0;\n}\n"],
|
|
5
|
-
"mappings": "+EAAA,OAAS,gBAAAA,MAAoB,aAC7B,OAAS,WAAAC,MAAe,iBAOxB,eAAsBC,EAAYC,EAAyBC,EAAM,CAC/D,KAAM,CAAE,IAAAC,EAAK,KAAAC,EAAM,OAAAC,CAAM,EAAKP,EAAaG,EAAM,CAAE,MAAO,CAAE,KAAM,SAAS,CAAE,CAAW,EAClFK,EAAS,MAAMP,EAAQI,EAAKE,EAAO,QAAU,EAAI,EACvD,GAAID,EACFF,EAAG,IAAI,KAAK,UAAU,CAAE,GAAGI,EAAQ,OAAQA,EAAO,OAAO,MAAO,MAAOA,EAAO,OAAO,OAAS,IAAI,EAAI,KAAM,CAAC,CAAC,MACzG,CACLJ,EAAG,IAAI,iBAAiBI,EAAO,MAAQ,UAAY,kCAAkC,KAAKA,EAAO,IAAI,EAAE,EACvG,UAAWC,KAAUD,EAAO,QAAS,CACnC,MAAME,EAAOD,EAAO,KAAO,QAAU,MAAMA,EAAO,OAAS,CAAC,KAAKA,EAAO,SAAW,CAAC,IAAM,GACpFE,EAAO,CAAE,MAAO,IAAK,QAAS,IAAK,OAAQ,GAAG,EAAGF,EAAO,EAAE,EAChEL,EAAG,IAAI,KAAKO,CAAI,IAAIF,EAAO,IAAI,GAAGC,CAAI,KAAKD,EAAO,IAAI,EAAE,CAC1D,CACID,EAAO,QAAQ,SAAW,GAAGJ,EAAG,IAAI,qBAAqB,EAC7D,UAAWQ,KAAMJ,EAAO,QAASJ,EAAG,IAAI,OAAOQ,CAAE,iEAAiE,
|
|
6
|
-
"names": ["parseCommand", "runSync", "syncCommand", "args", "io", "cwd", "json", "values", "result", "change", "stat", "mark", "id", "__name"]
|
|
4
|
+
"sourcesContent": ["import { parseCommand } from '../args.ts';\nimport { runSync } from '../sync/run.ts';\nimport type { Io } from '../io.ts';\n\n/**\n * `rexezuge sync [--write] [--json]`: the repairs for what doctor found. A dry run unless `--write`.\n * Exit 0 when nothing failed to apply; 1 when an auto-fixable check was left failing (see `unfixed`).\n */\nexport async function syncCommand(args: readonly string[], io: Io): Promise<number> {\n const { cwd, json, values } = parseCommand(args, { write: { type: 'boolean' } } as const);\n const result = await runSync(cwd, values.write === true);\n if (json) {\n io.out(JSON.stringify({ ...result, before: result.before.score, after: result.after?.score ?? null }, null, 2));\n } else {\n io.out(`rexezuge sync ${result.write ? '--write' : '(dry run; pass --write to apply)'}: ${result.root}`);\n for (const change of result.changes) {\n const stat = change.op === 'write' ? ` (+${change.added ?? 0} -${change.removed ?? 0})` : '';\n const mark = { write: 'M', symlink: 'L', delete: 'D' }[change.op];\n io.out(` ${mark} ${change.path}${stat}: ${change.note}`);\n }\n if (result.changes.length === 0) io.out(' nothing to change');\n for (const id of result.unfixed) io.out(` ! ${id}: needs a human (the file is repo code, not a safe replacement)`);\n for (const note of result.notes) io.out(` - ${note}`);\n io.out(`Score: ${result.before.score}${result.after === null ? '' : ` -> ${result.after.score}`}/100`);\n }\n return result.unfixed.length > 0 ? 1 : 0;\n}\n"],
|
|
5
|
+
"mappings": "+EAAA,OAAS,gBAAAA,MAAoB,aAC7B,OAAS,WAAAC,MAAe,iBAOxB,eAAsBC,EAAYC,EAAyBC,EAAM,CAC/D,KAAM,CAAE,IAAAC,EAAK,KAAAC,EAAM,OAAAC,CAAM,EAAKP,EAAaG,EAAM,CAAE,MAAO,CAAE,KAAM,SAAS,CAAE,CAAW,EAClFK,EAAS,MAAMP,EAAQI,EAAKE,EAAO,QAAU,EAAI,EACvD,GAAID,EACFF,EAAG,IAAI,KAAK,UAAU,CAAE,GAAGI,EAAQ,OAAQA,EAAO,OAAO,MAAO,MAAOA,EAAO,OAAO,OAAS,IAAI,EAAI,KAAM,CAAC,CAAC,MACzG,CACLJ,EAAG,IAAI,iBAAiBI,EAAO,MAAQ,UAAY,kCAAkC,KAAKA,EAAO,IAAI,EAAE,EACvG,UAAWC,KAAUD,EAAO,QAAS,CACnC,MAAME,EAAOD,EAAO,KAAO,QAAU,MAAMA,EAAO,OAAS,CAAC,KAAKA,EAAO,SAAW,CAAC,IAAM,GACpFE,EAAO,CAAE,MAAO,IAAK,QAAS,IAAK,OAAQ,GAAG,EAAGF,EAAO,EAAE,EAChEL,EAAG,IAAI,KAAKO,CAAI,IAAIF,EAAO,IAAI,GAAGC,CAAI,KAAKD,EAAO,IAAI,EAAE,CAC1D,CACID,EAAO,QAAQ,SAAW,GAAGJ,EAAG,IAAI,qBAAqB,EAC7D,UAAWQ,KAAMJ,EAAO,QAASJ,EAAG,IAAI,OAAOQ,CAAE,iEAAiE,EAClH,UAAWC,KAAQL,EAAO,MAAOJ,EAAG,IAAI,OAAOS,CAAI,EAAE,EACrDT,EAAG,IAAI,UAAUI,EAAO,OAAO,KAAK,GAAGA,EAAO,QAAU,KAAO,GAAK,OAAOA,EAAO,MAAM,KAAK,EAAE,MAAM,CACvG,CACA,OAAOA,EAAO,QAAQ,OAAS,EAAI,EAAI,CACzC,CAlBsBM,EAAAZ,EAAA",
|
|
6
|
+
"names": ["parseCommand", "runSync", "syncCommand", "args", "io", "cwd", "json", "values", "result", "change", "stat", "mark", "id", "note", "__name"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Repo } from '../../repo.ts';
|
|
2
|
+
import type { Check } from '../types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The composite actions the family used to copy into every repo and the reusable workflows now inline.
|
|
5
|
+
* Only these are ever removed; any other `.github/actions/*` is the repo's own.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FAMILY_ACTIONS: readonly string[];
|
|
8
|
+
/**
|
|
9
|
+
* The family action directories no remaining workflow references (directly, or through another referenced action).
|
|
10
|
+
* A workflow that sync will replace with a caller does not count: its references go with it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function staleActions(repo: Repo): Array<{
|
|
13
|
+
name: string;
|
|
14
|
+
files: string[];
|
|
15
|
+
}>;
|
|
16
|
+
export declare const actionChecks: readonly Check[];
|
|
17
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAAgC,CAAC;AAa7E;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAgBjF;AAED,eAAO,MAAM,YAAY,EAAE,SAAS,KAAK,EAaxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=Object.defineProperty;var i=(e,s)=>u(e,"name",{value:s,configurable:!0});import{callerKindForFile as f,WORKFLOW_REF as h}from"../../workflow-callers.js";const m=["setup-env","retry-step"],w=/^\.github\/workflows\/[^/]+\.ya?ml$/;function d(e,s){return!(e.read(s)??"").includes(`uses: ${h}/`)&&f(s)!==null}i(d,"replaced");const p=i((e,s)=>new RegExp(String.raw`\.github/actions/${s}(?![\w-])`).test(e),"mentions");function g(e){const s=m.filter(t=>e.files.some(n=>n.startsWith(`.github/actions/${t}/`))),o=e.files.filter(t=>w.test(t)&&!d(e,t)).map(t=>e.read(t)??""),c=i(t=>e.files.filter(n=>n.startsWith(`.github/actions/${t}/`)),"filesOf"),r=new Set;let l=[...o];for(;l.length>0;){const t=[];for(const n of s)r.has(n)||l.every(a=>!p(a,n))||(r.add(n),t.push(...c(n).map(a=>e.read(a)??"")));l=t}return s.filter(t=>!r.has(t)).map(t=>({name:t,files:c(t)}))}i(g,"staleActions");const y=[{id:"workflows.stale-actions",severity:"warn",title:"No unreferenced copy of the deleted family composite actions",message:"A `setup-env` / `retry-step` composite action no workflow uses is still in .github/actions.",fix:"Delete it (rexezuge sync --write): the reusable workflows install the toolchain themselves.",autoFixable:!0,run:i(e=>{const s=g(e);return s.length===0?{ok:!0}:{ok:!1,details:s.map(o=>`.github/actions/${o.name}`)}},"run")}];export{m as FAMILY_ACTIONS,y as actionChecks,g as staleActions};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/doctor/checks/actions.ts"],
|
|
4
|
+
"sourcesContent": ["import { callerKindForFile, WORKFLOW_REF } from '../../workflow-callers.ts';\nimport type { Repo } from '../../repo.ts';\nimport type { Check } from '../types.ts';\n\n/**\n * The composite actions the family used to copy into every repo and the reusable workflows now inline.\n * Only these are ever removed; any other `.github/actions/*` is the repo's own.\n */\nexport const FAMILY_ACTIONS: readonly string[] = ['setup-env', 'retry-step'];\n\nconst WORKFLOW_FILE = /^\\.github\\/workflows\\/[^/]+\\.ya?ml$/;\n\n/**\n * Whether sync replaces this workflow with a caller, so what it references is about to disappear.\n */\nfunction replaced(repo: Repo, file: string): boolean {\n return !(repo.read(file) ?? '').includes(`uses: ${WORKFLOW_REF}/`) && callerKindForFile(file) !== null;\n}\n\nconst mentions = (text: string, name: string): boolean => new RegExp(String.raw`\\.github/actions/${name}(?![\\w-])`).test(text);\n\n/**\n * The family action directories no remaining workflow references (directly, or through another referenced action).\n * A workflow that sync will replace with a caller does not count: its references go with it.\n */\nexport function staleActions(repo: Repo): Array<{ name: string; files: string[] }> {\n const present = FAMILY_ACTIONS.filter((name) => repo.files.some((file) => file.startsWith(`.github/actions/${name}/`)));\n const texts = repo.files.filter((file) => WORKFLOW_FILE.test(file) && !replaced(repo, file)).map((file) => repo.read(file) ?? '');\n const filesOf = (name: string): string[] => repo.files.filter((file) => file.startsWith(`.github/actions/${name}/`));\n const used = new Set<string>();\n let queue = [...texts];\n while (queue.length > 0) {\n const next: string[] = [];\n for (const name of present) {\n if (used.has(name) || queue.every((text) => !mentions(text, name))) continue;\n used.add(name);\n next.push(...filesOf(name).map((file) => repo.read(file) ?? ''));\n }\n queue = next;\n }\n return present.filter((name) => !used.has(name)).map((name) => ({ name, files: filesOf(name) }));\n}\n\nexport const actionChecks: readonly Check[] = [\n {\n id: 'workflows.stale-actions',\n severity: 'warn',\n title: 'No unreferenced copy of the deleted family composite actions',\n message: 'A `setup-env` / `retry-step` composite action no workflow uses is still in .github/actions.',\n fix: 'Delete it (rexezuge sync --write): the reusable workflows install the toolchain themselves.',\n autoFixable: true,\n run: (repo) => {\n const stale = staleActions(repo);\n return stale.length === 0 ? { ok: true } : { ok: false, details: stale.map((entry)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L,CAAI,CAAC,EAAE,IAAKA,IAAU,CAAE,KAAAA,EAAM,MAAOI,EAAQJ,CAAI,CAAC,EAAG,CACjG,CAhBgBH,EAAAI,EAAA,gBAkBT,MAAMO,EAAiC,CAC5C,CACE,GAAI,0BACJ,SAAU,OACV,MAAO,+DACP,QAAS,8FACT,IAAK,8FACL,YAAa,GACb,IAAKX,EAACF,GAAQ,CACZ,MAAMc,EAAQR,EAAaN,CAAI,EAC/B,OAAOc,EAAM,SAAW,EAAI,CAAE,GAAI,EAAI,EAAK,CAAE,GAAI,GAAO,QAASA,EAAM,IAAKC,GAAU,mBAAmBA,EAAM,IAAI,EAAE,CAAC,CACxH,EAHK",
|
|
6
|
+
"names": ["callerKindForFile", "WORKFLOW_REF", "FAMILY_ACTIONS", "WORKFLOW_FILE", "replaced", "repo", "file", "__name", "mentions", "text", "name", "staleActions", "present", "texts", "filesOf", "used", "queue", "next", "actionChecks", "stale", "entry"]
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAExF;
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAExF;AAwBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAO3E;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,KAAK,EAoGzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var m=Object.defineProperty;var n=(a,e)=>m(a,"name",{value:e,configurable:!0});import{isTempLink as d,kitDependencies as h}from"../../repo.js";import{atLeastMinor as v,CLI_VERSION as l,parseVersion as k}from"../../version.js";function c(a){return a.packages.flatMap(e=>[...h(e.json)].map(([t,s])=>({file:e.path,name:t,spec:s})))}n(c,"kitEdges");const p=n(a=>d(a.file,a.name,a.spec),"isTempLinkEdge");function x(a){const e=new Set(a.workspace?.catalog.keys());for(const t of a.workspace?.namedCatalogs.values()??[])for(const s of t.keys())e.add(s);return e}n(x,"catalogNames");const u=n(a=>a.startsWith("@rexezuge/"),"isKit");function y(a){const e=[...a.workspace?.overrides.keys()??[]].filter(u).map(t=>`pnpm-workspace.yaml: overrides ${t}`);for(const t of a.packages){const s=t.json?.pnpm?.overrides,o=t.json?.overrides;for(const r of[s,o])for(const i of Object.keys(r??{}))u(i)&&e.push(`${t.path}: overrides ${i}`)}return e}n(y,"overridePins");function w(a){const e=new Map;for(const t of a.matchAll(/^ {2}'?(@rexezuge\/[a-z0-9-]+)@(\d[^':(\s]*)'?:/gm)){const[,s="",o=""]=t;e.set(s,(e.get(s)??new Set).add(o))}return e}n(w,"lockfileVersions");const b=[{id:"catalog.present",severity:"error",title:"pnpm-workspace.yaml has a catalog entry for every @rexezuge/* package",message:"The pnpm catalog does not name every @rexezuge/* dependency, so versions are not held in one place.",fix:"Add the packages under `catalog:` in pnpm-workspace.yaml (rexezuge sync --write).",autoFixable:!0,run:n(a=>{const e=new Set(c(a).filter(o=>!o.spec.startsWith("workspace:")&&!p(o)).map(o=>o.name));if(e.size===0)return{skipped:"no @rexezuge/* dependencies"};if(a.workspace===null)return{ok:!1,details:["pnpm-workspace.yaml not found"]};const t=x(a),s=[...e].filter(o=>!t.has(o)).sort((o,r)=>o.localeCompare(r));return s.length===0?{ok:!0}:{ok:!1,details:s.map(o=>`${o} is not in the catalog`)}},"run")},{id:"catalog.temp-link",severity:"warn",title:"No @rexezuge/* dependency is a temporary local link",message:"The root package.json links a @rexezuge/* package to a local checkout (pnpm rejects `link:` inside a catalog).",fix:"Temporary local link; swap to `catalog:` after release.",autoFixable:!1,run:n(a=>{const e=c(a).filter(p);return e.length===0?{ok:!0}:{ok:!1,details:e.map(t=>`${t.file}: ${t.name} is "${t.spec}"`)}},"run")},{id:"catalog.no-overrides",severity:"error",title:"Nothing pins @rexezuge/* through overrides",message:"An overrides pin hides the real dependency graph and drifts from the catalog.",fix:"Delete the @rexezuge/* entries from `overrides` (pnpm-workspace.yaml, package.json pnpm.overrides).",autoFixable:!0,run:n(a=>{const e=y(a);return e.length===0?{ok:!0}:{ok:!1,details:e}},"run")},{id:"catalog.protocol",severity:"error",title:"Every package.json uses `catalog:` for @rexezuge/*",message:"Some @rexezuge/* dependencies carry their own version range.",fix:"Replace the range with `catalog:` (rexezuge sync --write).",autoFixable:!0,run:n(a=>{const e=c(a).filter(t=>!t.spec.startsWith("catalog:")&&!t.spec.startsWith("workspace:")&&!p(t));return e.length===0?{ok:!0}:{ok:!1,details:e.map(t=>`${t.file}: ${t.name} is "${t.spec}"`)}},"run")},{id:"lockfile.single-version",severity:"error",title:"The lockfile resolves each @rexezuge/* package to a single version",message:"The lockfile holds more than one version of a kit package, or the packages are not in lockstep.",fix:"Align the catalog, then reinstall (pnpm install) so the lockfile collapses to one version.",autoFixable:!1,run:n(a=>{const e=a.read("pnpm-lock.yaml");if(e===null)return{skipped:"no pnpm-lock.yaml"};const t=w(e);if(t.size===0)return{skipped:"no @rexezuge/* in the lockfile"};const s=[...t].filter(([,r])=>r.size>1).map(([r,i])=>`${r}: ${[...i].sort((f,g)=>f.localeCompare(g)).join(", ")}`),o=new Set([...t.values()].flatMap(r=>[...r]));return s.length===0&&o.size>1&&s.push(`packages are not in lockstep: ${[...o].sort((r,i)=>r.localeCompare(i)).join(", ")}`),s.length===0?{ok:!0}:{ok:!1,details:s}},"run")},{id:"sdk.current",severity:"warn",title:"The SDK version is at least the minor this CLI knows",message:`The catalog pins an SDK older than ${l}.`,fix:"Bump the @rexezuge/* catalog entries and run the codemods (pnpm exec rexezuge sync --write).",autoFixable:!1,run:n(a=>{const e=[...a.workspace?.catalog??[]].filter(([o])=>u(o)).map(([o,r])=>({name:o,spec:r})),t=k(l);if(e.length===0||t===null)return{skipped:"no catalog versions"};const s=e.filter(({spec:o})=>{const r=k(o);return r!==null&&!v(r,t)});return s.length===0?{ok:!0}:{ok:!1,details:s.map(({name:o,spec:r})=>`${o} ${r} < ${l}`)}},"run")}];export{b as catalogChecks,c as kitEdges,w as lockfileVersions};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/doctor/checks/catalog.ts"],
|
|
4
|
-
"sourcesContent": ["import { kitDependencies } from '../../repo.ts';\nimport type { Repo } from '../../repo.ts';\nimport { atLeastMinor, CLI_VERSION, parseVersion } from '../../version.ts';\nimport type { Check } from '../types.ts';\n\n/**\n * Every `@rexezuge/*` dependency edge in the repo: package.json path, dependency name, spec.\n */\nexport function kitEdges(repo: Repo): Array<{ file: string; name: string; spec: string }> {\n return repo.packages.flatMap((pkg) => [...kitDependencies(pkg.json)].map(([name, spec]) => ({ file: pkg.path, name, spec })));\n}\n\nfunction catalogNames(repo: Repo): Set<string> {\n const names = new Set(repo.workspace?.catalog.keys());\n for (const named of repo.workspace?.namedCatalogs.values() ?? []) for (const name of named.keys()) names.add(name);\n return names;\n}\n\nconst isKit = (name: string): boolean => name.startsWith('@rexezuge/');\n\nfunction overridePins(repo: Repo): string[] {\n const pins = [...(repo.workspace?.overrides.keys() ?? [])].filter(isKit).map((key) => `pnpm-workspace.yaml: overrides ${key}`);\n for (const pkg of repo.packages) {\n const nested = (pkg.json?.['pnpm'] as { overrides?: Record<string, unknown> } | undefined)?.overrides;\n const flat = pkg.json?.['overrides'] as Record<string, unknown> | undefined;\n for (const block of [nested, flat]) {\n for (const key of Object.keys(block ?? {})) if (isKit(key)) pins.push(`${pkg.path}: overrides ${key}`);\n }\n }\n return pins;\n}\n\n/**\n * The single version the lockfile resolves each kit package to, from the `packages:` section keys.\n */\nexport function lockfileVersions(lockfile: string): Map<string, Set<string>> {\n const found = new Map<string, Set<string>>();\n for (const match of lockfile.matchAll(/^ {2}'?(@rexezuge\\/[a-z0-9-]+)@(\\d[^':(\\s]*)'?:/gm)) {\n const [, name = '', version = ''] = match;\n found.set(name, (found.get(name) ?? new Set()).add(version));\n }\n return found;\n}\n\nexport const catalogChecks: readonly Check[] = [\n {\n id: 'catalog.present',\n severity: 'error',\n title: 'pnpm-workspace.yaml has a catalog entry for every @rexezuge/* package',\n message: 'The pnpm catalog does not name every @rexezuge/* dependency, so versions are not held in one place.',\n fix: 'Add the packages under `catalog:` in pnpm-workspace.yaml (rexezuge sync --write).',\n autoFixable: true,\n run: (repo) => {\n const used = new Set(\n kitEdges(repo)\n .filter((edge) => !edge.spec.startsWith('workspace:'))\n .map((edge) => edge.name),\n );\n if (used.size === 0) return { skipped: 'no @rexezuge/* dependencies' };\n if (repo.workspace === null) return { ok: false, details: ['pnpm-workspace.yaml not found'] };\n const have = catalogNames(repo);\n const missing = [...used].filter((name) => !have.has(name)).sort((a, b) => a.localeCompare(b));\n return missing.length === 0 ? { ok: true } : { ok: false, details: missing.map((name) => `${name} is not in the catalog`) };\n },\n },\n {\n id: 'catalog.no-overrides',\n severity: 'error',\n title: 'Nothing pins @rexezuge/* through overrides',\n message: 'An overrides pin hides the real dependency graph and drifts from the catalog.',\n fix: 'Delete the @rexezuge/* entries from `overrides` (pnpm-workspace.yaml, package.json pnpm.overrides).',\n autoFixable: true,\n run: (repo) => {\n const pins = overridePins(repo);\n return pins.length === 0 ? { ok: true } : { ok: false, details: pins };\n },\n },\n {\n id: 'catalog.protocol',\n severity: 'error',\n title: 'Every package.json uses `catalog:` for @rexezuge/*',\n message: 'Some @rexezuge/* dependencies carry their own version range.',\n fix: 'Replace the range with `catalog:` (rexezuge sync --write).',\n autoFixable: true,\n run: (repo) => {\n const bad = kitEdges(repo).filter((edge) => !edge.spec.startsWith('catalog:') && !edge.spec.startsWith('workspace:'));\n return bad.length === 0 ? { ok: true } : { ok: false, details: bad.map((edge) => `${edge.file}: ${edge.name} is \"${edge.spec}\"`) };\n },\n },\n {\n id: 'lockfile.single-version',\n severity: 'error',\n title: 'The lockfile resolves each @rexezuge/* package to a single version',\n message: 'The lockfile holds more than one version of a kit package, or the packages are not in lockstep.',\n fix: 'Align the catalog, then reinstall (pnpm install) so the lockfile collapses to one version.',\n autoFixable: false,\n run: (repo) => {\n const lockfile = repo.read('pnpm-lock.yaml');\n if (lockfile === null) return { skipped: 'no pnpm-lock.yaml' };\n const versions = lockfileVersions(lockfile);\n if (versions.size === 0) return { skipped: 'no @rexezuge/* in the lockfile' };\n const details = [...versions]\n .filter(([, set]) => set.size > 1)\n .map(([name, set]) => `${name}: ${[...set].sort((a, b) => a.localeCompare(b)).join(', ')}`);\n const all = new Set([...versions.values()].flatMap((set) => [...set]));\n if (details.length === 0 && all.size > 1)\n details.push(`packages are not in lockstep: ${[...all].sort((a, b) => a.localeCompare(b)).join(', ')}`);\n return details.length === 0 ? { ok: true } : { ok: false, details };\n },\n },\n {\n id: 'sdk.current',\n severity: 'warn',\n title: 'The SDK version is at least the minor this CLI knows',\n message: `The catalog pins an SDK older than ${CLI_VERSION}.`,\n fix: 'Bump the @rexezuge/* catalog entries and run the codemods (pnpm exec rexezuge sync --write).',\n autoFixable: false,\n run: (repo) => {\n const specs = [...(repo.workspace?.catalog ?? [])].filter(([name]) => isKit(name)).map(([name, spec]) => ({ name, spec }));\n const known = parseVersion(CLI_VERSION);\n if (specs.length === 0 || known === null) return { skipped: 'no catalog versions' };\n const old = specs.filter(({ spec }) => {\n const version = parseVersion(spec);\n return version !== null && !atLeastMinor(version, known);\n });\n return old.length === 0 ? { ok: true } : { ok: false, details: old.map(({ name, spec }) => `${name} ${spec} < ${CLI_VERSION}`) };\n },\n },\n];\n"],
|
|
5
|
-
"mappings": "+EAAA,OAAS,
|
|
6
|
-
"names": ["kitDependencies", "atLeastMinor", "CLI_VERSION", "parseVersion", "kitEdges", "repo", "pkg", "name", "spec", "__name", "catalogNames", "names", "named", "isKit", "overridePins", "pins", "key", "nested", "flat", "block", "lockfileVersions", "lockfile", "found", "match", "version", "catalogChecks", "used", "
|
|
4
|
+
"sourcesContent": ["import { isTempLink, kitDependencies } from '../../repo.ts';\nimport type { Repo } from '../../repo.ts';\nimport { atLeastMinor, CLI_VERSION, parseVersion } from '../../version.ts';\nimport type { Check } from '../types.ts';\n\n/**\n * Every `@rexezuge/*` dependency edge in the repo: package.json path, dependency name, spec.\n */\nexport function kitEdges(repo: Repo): Array<{ file: string; name: string; spec: string }> {\n return repo.packages.flatMap((pkg) => [...kitDependencies(pkg.json)].map(([name, spec]) => ({ file: pkg.path, name, spec })));\n}\n\nconst isTempLinkEdge = (edge: { file: string; name: string; spec: string }): boolean => isTempLink(edge.file, edge.name, edge.spec);\n\nfunction catalogNames(repo: Repo): Set<string> {\n const names = new Set(repo.workspace?.catalog.keys());\n for (const named of repo.workspace?.namedCatalogs.values() ?? []) for (const name of named.keys()) names.add(name);\n return names;\n}\n\nconst isKit = (name: string): boolean => name.startsWith('@rexezuge/');\n\nfunction overridePins(repo: Repo): string[] {\n const pins = [...(repo.workspace?.overrides.keys() ?? [])].filter(isKit).map((key) => `pnpm-workspace.yaml: overrides ${key}`);\n for (const pkg of repo.packages) {\n const nested = (pkg.json?.['pnpm'] as { overrides?: Record<string, unknown> } | undefined)?.overrides;\n const flat = pkg.json?.['overrides'] as Record<string, unknown> | undefined;\n for (const block of [nested, flat]) {\n for (const key of Object.keys(block ?? {})) if (isKit(key)) pins.push(`${pkg.path}: overrides ${key}`);\n }\n }\n return pins;\n}\n\n/**\n * The single version the lockfile resolves each kit package to, from the `packages:` section keys.\n */\nexport function lockfileVersions(lockfile: string): Map<string, Set<string>> {\n const found = new Map<string, Set<string>>();\n for (const match of lockfile.matchAll(/^ {2}'?(@rexezuge\\/[a-z0-9-]+)@(\\d[^':(\\s]*)'?:/gm)) {\n const [, name = '', version = ''] = match;\n found.set(name, (found.get(name) ?? new Set()).add(version));\n }\n return found;\n}\n\nexport const catalogChecks: readonly Check[] = [\n {\n id: 'catalog.present',\n severity: 'error',\n title: 'pnpm-workspace.yaml has a catalog entry for every @rexezuge/* package',\n message: 'The pnpm catalog does not name every @rexezuge/* dependency, so versions are not held in one place.',\n fix: 'Add the packages under `catalog:` in pnpm-workspace.yaml (rexezuge sync --write).',\n autoFixable: true,\n run: (repo) => {\n const used = new Set(\n kitEdges(repo)\n .filter((edge) => !edge.spec.startsWith('workspace:') && !isTempLinkEdge(edge))\n .map((edge) => edge.name),\n );\n if (used.size === 0) return { skipped: 'no @rexezuge/* dependencies' };\n if (repo.workspace === null) return { ok: false, details: ['pnpm-workspace.yaml not found'] };\n const have = catalogNames(repo);\n const missing = [...used].filter((name) => !have.has(name)).sort((a, b) => a.localeCompare(b));\n return missing.length === 0 ? { ok: true } : { ok: false, details: missing.map((name) => `${name} is not in the catalog`) };\n },\n },\n {\n id: 'catalog.temp-link',\n severity: 'warn',\n title: 'No @rexezuge/* dependency is a temporary local link',\n message: 'The root package.json links a @rexezuge/* package to a local checkout (pnpm rejects `link:` inside a catalog).',\n fix: 'Temporary local link; swap to `catalog:` after release.',\n autoFixable: false,\n run: (repo) => {\n const links = kitEdges(repo).filter(isTempLinkEdge);\n return links.length === 0\n ? { ok: true }\n : { ok: false, details: links.map((edge) => `${edge.file}: ${edge.name} is \"${edge.spec}\"`) };\n },\n },\n {\n id: 'catalog.no-overrides',\n severity: 'error',\n title: 'Nothing pins @rexezuge/* through overrides',\n message: 'An overrides pin hides the real dependency graph and drifts from the catalog.',\n fix: 'Delete the @rexezuge/* entries from `overrides` (pnpm-workspace.yaml, package.json pnpm.overrides).',\n autoFixable: true,\n run: (repo) => {\n const pins = overridePins(repo);\n return pins.length === 0 ? { ok: true } : { ok: false, details: pins };\n },\n },\n {\n id: 'catalog.protocol',\n severity: 'error',\n title: 'Every package.json uses `catalog:` for @rexezuge/*',\n message: 'Some @rexezuge/* dependencies carry their own version range.',\n fix: 'Replace the range with `catalog:` (rexezuge sync --write).',\n autoFixable: true,\n run: (repo) => {\n const bad = kitEdges(repo).filter(\n (edge) => !edge.spec.startsWith('catalog:') && !edge.spec.startsWith('workspace:') && !isTempLinkEdge(edge),\n );\n return bad.length === 0 ? { ok: true } : { ok: false, details: bad.map((edge) => `${edge.file}: ${edge.name} is \"${edge.spec}\"`) };\n },\n },\n {\n id: 'lockfile.single-version',\n severity: 'error',\n title: 'The lockfile resolves each @rexezuge/* package to a single version',\n message: 'The lockfile holds more than one version of a kit package, or the packages are not in lockstep.',\n fix: 'Align the catalog, then reinstall (pnpm install) so the lockfile collapses to one version.',\n autoFixable: false,\n run: (repo) => {\n const lockfile = repo.read('pnpm-lock.yaml');\n if (lockfile === null) return { skipped: 'no pnpm-lock.yaml' };\n const versions = lockfileVersions(lockfile);\n if (versions.size === 0) return { skipped: 'no @rexezuge/* in the lockfile' };\n const details = [...versions]\n .filter(([, set]) => set.size > 1)\n .map(([name, set]) => `${name}: ${[...set].sort((a, b) => a.localeCompare(b)).join(', ')}`);\n const all = new Set([...versions.values()].flatMap((set) => [...set]));\n if (details.length === 0 && all.size > 1)\n details.push(`packages are not in lockstep: ${[...all].sort((a, b) => a.localeCompare(b)).join(', ')}`);\n return details.length === 0 ? { ok: true } : { ok: false, details };\n },\n },\n {\n id: 'sdk.current',\n severity: 'warn',\n title: 'The SDK version is at least the minor this CLI knows',\n message: `The catalog pins an SDK older than ${CLI_VERSION}.`,\n fix: 'Bump the @rexezuge/* catalog entries and run the codemods (pnpm exec rexezuge sync --write).',\n autoFixable: false,\n run: (repo) => {\n const specs = [...(repo.workspace?.catalog ?? [])].filter(([name]) => isKit(name)).map(([name, spec]) => ({ name, spec }));\n const known = parseVersion(CLI_VERSION);\n if (specs.length === 0 || known === null) return { skipped: 'no catalog versions' };\n const old = specs.filter(({ spec }) => {\n const version = parseVersion(spec);\n return version !== null && !atLeastMinor(version, known);\n });\n return old.length === 0 ? { ok: true } : { ok: false, details: old.map(({ name, spec }) => `${name} ${spec} < ${CLI_VERSION}`) };\n },\n },\n];\n"],
|
|
5
|
+
"mappings": "+EAAA,OAAS,cAAAA,EAAY,mBAAAC,MAAuB,gBAE5C,OAAS,gBAAAC,EAAc,eAAAC,EAAa,gBAAAC,MAAoB,mBAMlD,SAAUC,EAASC,EAAU,CACjC,OAAOA,EAAK,SAAS,QAASC,GAAQ,CAAC,GAAGN,EAAgBM,EAAI,IAAI,CAAC,EAAE,IAAI,CAAC,CAACC,EAAMC,CAAI,KAAO,CAAE,KAAMF,EAAI,KAAM,KAAAC,EAAM,KAAAC,CAAI,EAAG,CAAC,CAC9H,CAFgBC,EAAAL,EAAA,YAIhB,MAAMM,EAAiBD,EAACE,GAAgEZ,EAAWY,EAAK,KAAMA,EAAK,KAAMA,EAAK,IAAI,EAA3G,kBAEvB,SAASC,EAAaP,EAAU,CAC9B,MAAMQ,EAAQ,IAAI,IAAIR,EAAK,WAAW,QAAQ,KAAI,CAAE,EACpD,UAAWS,KAAST,EAAK,WAAW,cAAc,OAAM,GAAM,CAAA,EAAI,UAAWE,KAAQO,EAAM,KAAI,EAAID,EAAM,IAAIN,CAAI,EACjH,OAAOM,CACT,CAJSJ,EAAAG,EAAA,gBAMT,MAAMG,EAAQ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AIlC,EAAK,WAAW,SAAW,CAAA,CAAG,EAAE,OAAO,CAAC,CAACE,CAAI,IAAMQ,EAAMR,CAAI,CAAC,EAAE,IAAI,CAAC,CAACA,EAAMC,CAAI,KAAO,CAAE,KAAAD,EAAM,KAAAC,CAAI,EAAG,EACnHgC,EAAQrC,EAAaD,CAAW,EACtC,GAAIqC,EAAM,SAAW,GAAKC,IAAU,KAAM,MAAO,CAAE,QAAS,qBAAqB,EACjF,MAAMC,EAAMF,EAAM,OAAO,CAAC,CAAE,KAAA/B,CAAI,IAAM,CACpC,MAAMkB,EAAUvB,EAAaK,CAAI,EACjC,OAAOkB,IAAY,MAAQ,CAACzB,EAAayB,EAASc,CAAK,CACzD,CAAC,EACD,OAAOC,EAAI,SAAW,EAAI,CAAE,GAAI,EAAI,EAAK,CAAE,GAAI,GAAO,QAASA,EAAI,IAAI,CAAC,CAAE,KAAAlC,EAAM,KAAAC,CAAI,IAAO,GAAGD,CAAI,IAAIC,CAAI,MAAMN,CAAW,EAAE,CAAC,CAChI,EATK",
|
|
6
|
+
"names": ["isTempLink", "kitDependencies", "atLeastMinor", "CLI_VERSION", "parseVersion", "kitEdges", "repo", "pkg", "name", "spec", "__name", "isTempLinkEdge", "edge", "catalogNames", "names", "named", "isKit", "overridePins", "pins", "key", "nested", "flat", "block", "lockfileVersions", "lockfile", "found", "match", "version", "catalogChecks", "used", "have", "missing", "a", "b", "links", "bad", "versions", "details", "set", "all", "specs", "known", "old"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/doctor/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/doctor/registry.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,KAAK,EAO1C,CAAC"}
|
package/dist/doctor/registry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{actionChecks as o}from"./checks/actions.js";import{catalogChecks as r}from"./checks/catalog.js";import{fileChecks as e}from"./checks/files.js";import{manifestChecks as m}from"./checks/manifest.js";import{presetChecks as t}from"./checks/presets.js";import{vendoredChecks as c}from"./checks/vendored.js";const k=[...m,...r,...c,...t,...e,...o];export{k as BUILTIN_CHECKS};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/doctor/registry.ts"],
|
|
4
|
-
"sourcesContent": ["import { catalogChecks } from './checks/catalog.ts';\nimport { fileChecks } from './checks/files.ts';\nimport { manifestChecks } from './checks/manifest.ts';\nimport { presetChecks } from './checks/presets.ts';\nimport { vendoredChecks } from './checks/vendored.ts';\nimport type { Check } from './types.ts';\n\n/**\n * Every check the CLI ships, in report order. A repo adds its own through `extensions.doctor.checks`\n * (see `extensions.ts`); it never edits this list.\n */\nexport const BUILTIN_CHECKS: readonly Check[] = [...manifestChecks
|
|
5
|
-
"mappings": "AAAA,OAAS,
|
|
6
|
-
"names": ["catalogChecks", "fileChecks", "manifestChecks", "presetChecks", "vendoredChecks", "BUILTIN_CHECKS"]
|
|
4
|
+
"sourcesContent": ["import { actionChecks } from './checks/actions.ts';\nimport { catalogChecks } from './checks/catalog.ts';\nimport { fileChecks } from './checks/files.ts';\nimport { manifestChecks } from './checks/manifest.ts';\nimport { presetChecks } from './checks/presets.ts';\nimport { vendoredChecks } from './checks/vendored.ts';\nimport type { Check } from './types.ts';\n\n/**\n * Every check the CLI ships, in report order. A repo adds its own through `extensions.doctor.checks`\n * (see `extensions.ts`); it never edits this list.\n */\nexport const BUILTIN_CHECKS: readonly Check[] = [\n ...manifestChecks,\n ...catalogChecks,\n ...vendoredChecks,\n ...presetChecks,\n ...fileChecks,\n ...actionChecks,\n];\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,sBAC7B,OAAS,iBAAAC,MAAqB,sBAC9B,OAAS,cAAAC,MAAkB,oBAC3B,OAAS,kBAAAC,MAAsB,uBAC/B,OAAS,gBAAAC,MAAoB,sBAC7B,OAAS,kBAAAC,MAAsB,uBAOxB,MAAMC,EAAmC,CAC9C,GAAGH,EACH,GAAGF,EACH,GAAGI,EACH,GAAGD,EACH,GAAGF,EACH,GAAGF",
|
|
6
|
+
"names": ["actionChecks", "catalogChecks", "fileChecks", "manifestChecks", "presetChecks", "vendoredChecks", "BUILTIN_CHECKS"]
|
|
7
7
|
}
|