@rexezuge/cli 0.0.0-stage → 1.13.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.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +142 -2
  3. package/dist/args.d.ts +22 -0
  4. package/dist/args.d.ts.map +1 -0
  5. package/dist/args.js +1 -0
  6. package/dist/args.js.map +7 -0
  7. package/dist/bin.d.ts +3 -0
  8. package/dist/bin.d.ts.map +1 -0
  9. package/dist/bin.js +2 -0
  10. package/dist/bin.js.map +7 -0
  11. package/dist/cli.d.ts +13 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +18 -0
  14. package/dist/cli.js.map +7 -0
  15. package/dist/commands/doctor.d.ts +8 -0
  16. package/dist/commands/doctor.d.ts.map +1 -0
  17. package/dist/commands/doctor.js +1 -0
  18. package/dist/commands/doctor.js.map +7 -0
  19. package/dist/commands/godFiles.d.ts +7 -0
  20. package/dist/commands/godFiles.d.ts.map +1 -0
  21. package/dist/commands/godFiles.js +1 -0
  22. package/dist/commands/godFiles.js.map +7 -0
  23. package/dist/commands/identity.d.ts +26 -0
  24. package/dist/commands/identity.d.ts.map +1 -0
  25. package/dist/commands/identity.js +4 -0
  26. package/dist/commands/identity.js.map +7 -0
  27. package/dist/commands/locales.d.ts +7 -0
  28. package/dist/commands/locales.d.ts.map +1 -0
  29. package/dist/commands/locales.js +1 -0
  30. package/dist/commands/locales.js.map +7 -0
  31. package/dist/commands/migrations.d.ts +7 -0
  32. package/dist/commands/migrations.d.ts.map +1 -0
  33. package/dist/commands/migrations.js +1 -0
  34. package/dist/commands/migrations.js.map +7 -0
  35. package/dist/commands/scripts.d.ts +25 -0
  36. package/dist/commands/scripts.d.ts.map +1 -0
  37. package/dist/commands/scripts.js +1 -0
  38. package/dist/commands/scripts.js.map +7 -0
  39. package/dist/commands/spaShell.d.ts +7 -0
  40. package/dist/commands/spaShell.d.ts.map +1 -0
  41. package/dist/commands/spaShell.js +1 -0
  42. package/dist/commands/spaShell.js.map +7 -0
  43. package/dist/commands/sync.d.ts +7 -0
  44. package/dist/commands/sync.d.ts.map +1 -0
  45. package/dist/commands/sync.js +1 -0
  46. package/dist/commands/sync.js.map +7 -0
  47. package/dist/doctor/checks/catalog.d.ts +16 -0
  48. package/dist/doctor/checks/catalog.d.ts.map +1 -0
  49. package/dist/doctor/checks/catalog.js +1 -0
  50. package/dist/doctor/checks/catalog.js.map +7 -0
  51. package/dist/doctor/checks/files.d.ts +8 -0
  52. package/dist/doctor/checks/files.d.ts.map +1 -0
  53. package/dist/doctor/checks/files.js +1 -0
  54. package/dist/doctor/checks/files.js.map +7 -0
  55. package/dist/doctor/checks/manifest.d.ts +3 -0
  56. package/dist/doctor/checks/manifest.d.ts.map +1 -0
  57. package/dist/doctor/checks/manifest.js +1 -0
  58. package/dist/doctor/checks/manifest.js.map +7 -0
  59. package/dist/doctor/checks/presets.d.ts +7 -0
  60. package/dist/doctor/checks/presets.d.ts.map +1 -0
  61. package/dist/doctor/checks/presets.js +1 -0
  62. package/dist/doctor/checks/presets.js.map +7 -0
  63. package/dist/doctor/checks/vendored.d.ts +25 -0
  64. package/dist/doctor/checks/vendored.d.ts.map +1 -0
  65. package/dist/doctor/checks/vendored.js +1 -0
  66. package/dist/doctor/checks/vendored.js.map +7 -0
  67. package/dist/doctor/extensions.d.ts +26 -0
  68. package/dist/doctor/extensions.d.ts.map +1 -0
  69. package/dist/doctor/extensions.js +1 -0
  70. package/dist/doctor/extensions.js.map +7 -0
  71. package/dist/doctor/registry.d.ts +7 -0
  72. package/dist/doctor/registry.d.ts.map +1 -0
  73. package/dist/doctor/registry.js +1 -0
  74. package/dist/doctor/registry.js.map +7 -0
  75. package/dist/doctor/run.d.ts +13 -0
  76. package/dist/doctor/run.d.ts.map +1 -0
  77. package/dist/doctor/run.js +1 -0
  78. package/dist/doctor/run.js.map +7 -0
  79. package/dist/doctor/types.d.ts +75 -0
  80. package/dist/doctor/types.d.ts.map +1 -0
  81. package/dist/doctor/types.js +0 -0
  82. package/dist/doctor/types.js.map +7 -0
  83. package/dist/index.d.ts +18 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/index.js +1 -0
  86. package/dist/index.js.map +7 -0
  87. package/dist/io.d.ts +22 -0
  88. package/dist/io.d.ts.map +1 -0
  89. package/dist/io.js +3 -0
  90. package/dist/io.js.map +7 -0
  91. package/dist/repo-json.d.ts +6 -0
  92. package/dist/repo-json.d.ts.map +1 -0
  93. package/dist/repo-json.js +1 -0
  94. package/dist/repo-json.js.map +7 -0
  95. package/dist/repo.d.ts +37 -0
  96. package/dist/repo.d.ts.map +1 -0
  97. package/dist/repo.js +1 -0
  98. package/dist/repo.js.map +7 -0
  99. package/dist/sync/fixes.d.ts +12 -0
  100. package/dist/sync/fixes.d.ts.map +1 -0
  101. package/dist/sync/fixes.js +6 -0
  102. package/dist/sync/fixes.js.map +7 -0
  103. package/dist/sync/plan.d.ts +46 -0
  104. package/dist/sync/plan.d.ts.map +1 -0
  105. package/dist/sync/plan.js +3 -0
  106. package/dist/sync/plan.js.map +7 -0
  107. package/dist/sync/run.d.ts +24 -0
  108. package/dist/sync/run.d.ts.map +1 -0
  109. package/dist/sync/run.js +1 -0
  110. package/dist/sync/run.js.map +7 -0
  111. package/dist/sync/workflows.d.ts +8 -0
  112. package/dist/sync/workflows.d.ts.map +1 -0
  113. package/dist/sync/workflows.js +1 -0
  114. package/dist/sync/workflows.js.map +7 -0
  115. package/dist/version.d.ts +14 -0
  116. package/dist/version.d.ts.map +1 -0
  117. package/dist/version.js +1 -0
  118. package/dist/version.js.map +7 -0
  119. package/dist/workflow-callers.d.ts +26 -0
  120. package/dist/workflow-callers.d.ts.map +1 -0
  121. package/dist/workflow-callers.js +34 -0
  122. package/dist/workflow-callers.js.map +7 -0
  123. package/dist/workspace-yaml.d.ts +28 -0
  124. package/dist/workspace-yaml.d.ts.map +1 -0
  125. package/dist/workspace-yaml.js +12 -0
  126. package/dist/workspace-yaml.js.map +7 -0
  127. package/package.json +47 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rexezuge
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,143 @@
1
- # Temporary Holding Version
1
+ # `@rexezuge/cli`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The `rexezuge` command for the Rexezuge-CloudflareWorkers family: the repo scripts as subcommands, `doctor` (a conformance score) and `sync` (its auto-fixes).
4
+ Dev-only, built on `node:util` `parseArgs`, and run as compiled JavaScript on Node 24 (no `tsx` at runtime).
5
+
6
+ ```bash
7
+ pnpm add -D @rexezuge/cli
8
+ pnpm exec rexezuge doctor
9
+ ```
10
+
11
+ It depends on [`@rexezuge/tooling`](../tooling/README.md) (the scripts and the `.rexezuge.jsonc` manifest) and on `@rexezuge/identity` (its migrations, as SQL text).
12
+ Every command takes `--cwd <dir>` (the repo; default `.`) and `--help`, exits **0** on success and **1** on failure or misuse, and prints a machine-readable report with `--json` where it has one.
13
+
14
+ ## Commands
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 sync [--write] [--json]` | Repairs what doctor found. A dry run unless `--write`. |
20
+ | `rexezuge prepare-wrangler` | Materialize `wrangler.jsonc` from the template and provision the resources it names (env-driven, see tooling). |
21
+ | `rexezuge init-secrets` | Create the Secrets Store entries `wrangler.jsonc` declares, generate-if-absent. |
22
+ | `rexezuge migrations verify [--dir <d>] [--json]` | Names, numbering and digests against `migrations.lock.json`. Read-only: the CI gate. |
23
+ | `rexezuge migrations lock [--dir <d>] [--json]` | Add-only lock write, then a re-check from disk, so an edited applied migration still exits 1. |
24
+ | `rexezuge migrations add-identity [--dir <d>] [--dry-run] [--json]` | Write the next numbered `NNNN_user_identity.sql` from `@rexezuge/identity`. |
25
+ | `rexezuge spa-shell ensure\|verify [--json]` | Write the empty stub when absent, or reject a missing, stubbed or half-refreshed SPA shell. |
26
+ | `rexezuge god-files [--allowlist <f>] [--fail-on-hard] [--json]` | The 300 / 400 line guard; the manifest's `quality.godFiles` may only lower the limits. |
27
+ | `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
+
29
+ `--dir` defaults to the manifest's `features.d1.migrationsDir` (then `migrations`) for `migrations`, and to `apps/web/src/locales` for `locales`.
30
+
31
+ ### `migrations add-identity`
32
+
33
+ The family's hand-written `NNNN_user_identity.sql` files all do what the kit's upgrade migration does for a `users` table that predates the identity columns.
34
+ The command picks by what the migrations directory already holds:
35
+
36
+ - **No `users` table:** writes the fresh canonical schema (`users` and `user_emails`).
37
+ - **A legacy `users` table:** writes the additive upgrade (`id`, `current_email`, the `user_emails` backfill), with a header that reminds you to append one phase per legacy table that references `users(email)`.
38
+ - **Identity tables already present** (`user_emails` created, `current_email` added, or a file named `*user_identity*`): it **refuses** with exit 1 and names the file. Applying it twice is not additive.
39
+
40
+ It never edits an existing file and never runs the lock; run `rexezuge migrations lock` next.
41
+
42
+ ## `rexezuge doctor`
43
+
44
+ A registry of checks, each with an id, a severity (`error` or `warn`), a message, a fix hint and whether `sync` can repair it. The score is
45
+ `floor(earned / total * 100)` with errors weighted 3 and warnings 1; checks that do not apply (no D1, no lockfile) are left out of both sums.
46
+ 100 means every applicable check passed. The CLI's own version is the "current SDK minor", so the comparison is offline.
47
+
48
+ | Group | Checks (ids) |
49
+ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
50
+ | Manifest | `manifest.valid` |
51
+ | Versions | `catalog.present`, `catalog.no-overrides`, `catalog.protocol` (`catalog:` in every package.json), `lockfile.single-version`, `sdk.current` (warn) |
52
+ | 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
+ | 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/*` |
55
+ | Files | `files.license`, `files.agents`, `files.claude-symlink`, `files.migrations-lock` (with D1), `files.editorconfig` (warn), `files.node-version` (warn), `scripts.canonical` (warn) |
56
+
57
+ 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
+ already delegates to the kit (it mentions `@rexezuge/`, or for `CronTasksWorker.ts` extends `CronTasksDurableObject`). The repo's own destination code
59
+ (`s3-prune`, `upload-s3`, ...) is never matched.
60
+
61
+ ### Extending doctor
62
+
63
+ Strict on one side, open on the other. A repo adds checks and disables WARN checks through the manifest's `extensions` namespace:
64
+
65
+ ```jsonc
66
+ {
67
+ "extensions": {
68
+ "doctor": {
69
+ "checks": "./scripts/doctor-checks.mjs",
70
+ "disable": [{ "id": "files.editorconfig", "reason": "this repo formats with biome" }],
71
+ },
72
+ },
73
+ }
74
+ ```
75
+
76
+ ```js
77
+ // scripts/doctor-checks.mjs: an array of checks, or a function (repo) => checks
78
+ export default [
79
+ {
80
+ id: 'acme.readme',
81
+ severity: 'warn',
82
+ title: 'README exists',
83
+ message: 'The repo has no README.',
84
+ fix: 'Add one.',
85
+ run: (repo) => (repo.exists('README.md') ? { ok: true } : { ok: false, details: ['README.md'] }),
86
+ },
87
+ ];
88
+ ```
89
+
90
+ - A custom check may be `error` or `warn`; its id must not collide with a built-in. It counts toward the score like any other.
91
+ - `disable` takes **WARN** checks only, each with a non-empty `reason` that appears in every report. Disabling an ERROR check, an unknown id or a check with no reason does not disable anything:
92
+ it fails the built-in `doctor.config` check. The kit's ERROR checks cannot be switched off.
93
+ - The `repo` argument is read-only: `root`, `files`, `manifest`, `packages`, `workspace`, `read(rel)`, `exists(rel)`, `linkTarget(rel)`.
94
+
95
+ ## `rexezuge sync`
96
+
97
+ 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
+ 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
+
100
+ | Repairs | How |
101
+ | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
102
+ | `tsconfig.json`, `apps/*/tsconfig.json` | Sets `extends` to the `base` / `worker` / `web` preset; every other option the repo wrote stays |
103
+ | Prettier | `"prettier": "@rexezuge/tooling/prettier"`; deletes `.prettierrc` only when it says nothing the preset does not |
104
+ | `@rexezuge/*` versions | Adds the catalog entries (`^<this CLI's version>`), rewrites ranges to `catalog:`, removes `overrides` pins |
105
+ | `CLAUDE.md`, `.nvmrc`, scripts | Symlink to `AGENTS.md` (never over a distinct regular file); `24`; the canonical script names that are missing |
106
+ | `functions/[[path]].ts` | Becomes `export { onRequest } from '@rexezuge/tooling/pages-proxy';`, only when the file is the proxy (it names `API_WORKER`) |
107
+ | `test/mocks/cloudflare-workers.ts` | Becomes `export * from '@rexezuge/testing/cloudflare-workers';` (rewritten, not deleted: suites import it by path) |
108
+ | `.github/workflows/*.yml` | Replaced with the thin caller for the workflow's family name (`continuous-integration` to `worker-ci`, and so on) |
109
+
110
+ `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
+ 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
+ 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
+
114
+ The caller workflows target the SDK's reusable workflows, tagged `v1` (`uses: Rexezuge-CloudflareWorkers/SDK/.github/workflows/worker-ci.yml@v1`). Those land in a later phase;
115
+ the callers are the contract until then.
116
+
117
+ ## Programmatic use
118
+
119
+ ```ts
120
+ import { runDoctor, runSync, run, callersFor } from '@rexezuge/cli';
121
+
122
+ const report = await runDoctor(process.cwd()); // { score, errors, warnings, findings }
123
+ ```
124
+
125
+ `run(argv, io)` is the whole command line as a function (it never calls `process.exit`), which is how the tests drive it.
126
+
127
+ ## Extending
128
+
129
+ | You want | Door |
130
+ | -------------------------------------- | ------------------------------------------------------ |
131
+ | A repo-specific conformance check | `extensions.doctor.checks` in `.rexezuge.jsonc` |
132
+ | To silence a WARN check, with a reason | `extensions.doctor.disable` |
133
+ | A different migrations or locales dir | `--dir`, or the manifest's `features.d1.migrationsDir` |
134
+
135
+ Closed: the ERROR checks, the score's arithmetic, the exit codes, and `sync`'s rule that domain code is never deleted. See the [design charter](../../docs/design-charter.md).
136
+
137
+ ## Verifying this package
138
+
139
+ ```bash
140
+ pnpm --filter @rexezuge/cli build
141
+ pnpm --filter @rexezuge/cli typecheck
142
+ pnpm --filter @rexezuge/cli test:coverage
143
+ ```
package/dist/args.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ type OptionSpec = Readonly<Record<string, {
2
+ readonly type: 'string' | 'boolean';
3
+ readonly short?: string;
4
+ }>>;
5
+ /**
6
+ * Parsed arguments for one command: `--cwd` (resolved to an absolute path) and `--json` are common to all.
7
+ */
8
+ export interface Parsed<S extends OptionSpec> {
9
+ readonly cwd: string;
10
+ readonly json: boolean;
11
+ readonly positionals: readonly string[];
12
+ readonly values: {
13
+ readonly [K in keyof S]?: S[K]['type'] extends 'boolean' ? boolean : string;
14
+ };
15
+ }
16
+ /**
17
+ * `node:util` `parseArgs`, strict, with the options every command shares. Unknown flags are a `UsageError`
18
+ * naming the flag: a mistyped `--write` must not degrade into a read-only run that reports success.
19
+ */
20
+ export declare function parseCommand<S extends OptionSpec>(args: readonly string[], spec: S): Parsed<S>;
21
+ export {};
22
+ //# sourceMappingURL=args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC;AAE7G;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC,SAAS,UAAU;IAC1C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,SAAS,GAAG,OAAO,GAAG,MAAM;KAAE,CAAC;CAClG;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAkB9F"}
package/dist/args.js ADDED
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var e=(o,t)=>p(o,"name",{value:t,configurable:!0});import c from"node:path";import{parseArgs as m}from"node:util";import{UsageError as l}from"./io.js";function d(o,t){try{const{values:r,positionals:n}=m({args:[...o],allowPositionals:!0,strict:!0,options:{cwd:{type:"string"},json:{type:"boolean"},...t}}),{cwd:s,json:a,...i}=r;return{cwd:c.resolve(typeof s=="string"?s:process.cwd()),json:a===!0,positionals:n,values:i}}catch(r){throw new l(r instanceof Error?r.message:String(r))}}e(d,"parseCommand");export{d as parseCommand};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/args.ts"],
4
+ "sourcesContent": ["import path from 'node:path';\nimport { parseArgs } from 'node:util';\nimport { UsageError } from './io.ts';\n\ntype OptionSpec = Readonly<Record<string, { readonly type: 'string' | 'boolean'; readonly short?: string }>>;\n\n/**\n * Parsed arguments for one command: `--cwd` (resolved to an absolute path) and `--json` are common to all.\n */\nexport interface Parsed<S extends OptionSpec> {\n readonly cwd: string;\n readonly json: boolean;\n readonly positionals: readonly string[];\n readonly values: { readonly [K in keyof S]?: S[K]['type'] extends 'boolean' ? boolean : string };\n}\n\n/**\n * `node:util` `parseArgs`, strict, with the options every command shares. Unknown flags are a `UsageError`\n * naming the flag: a mistyped `--write` must not degrade into a read-only run that reports success.\n */\nexport function parseCommand<S extends OptionSpec>(args: readonly string[], spec: S): Parsed<S> {\n try {\n const { values, positionals } = parseArgs({\n args: [...args],\n allowPositionals: true,\n strict: true,\n options: { cwd: { type: 'string' }, json: { type: 'boolean' }, ...spec },\n });\n const { cwd, json, ...rest } = values as Record<string, string | boolean | undefined>;\n return {\n cwd: path.resolve(typeof cwd === 'string' ? cwd : process.cwd()),\n json: json === true,\n positionals,\n values: rest as Parsed<S>['values'],\n };\n } catch (error: unknown) {\n throw new UsageError(error instanceof Error ? error.message : String(error));\n }\n}\n"],
5
+ "mappings": "+EAAA,OAAOA,MAAU,YACjB,OAAS,aAAAC,MAAiB,YAC1B,OAAS,cAAAC,MAAkB,UAkBrB,SAAUC,EAAmCC,EAAyBC,EAAO,CACjF,GAAI,CACF,KAAM,CAAE,OAAAC,EAAQ,YAAAC,CAAW,EAAKN,EAAU,CACxC,KAAM,CAAC,GAAGG,CAAI,EACd,iBAAkB,GAClB,OAAQ,GACR,QAAS,CAAE,IAAK,CAAE,KAAM,QAAQ,EAAI,KAAM,CAAE,KAAM,SAAS,EAAI,GAAGC,CAAI,EACvE,EACK,CAAE,IAAAG,EAAK,KAAAC,EAAM,GAAGC,CAAI,EAAKJ,EAC/B,MAAO,CACL,IAAKN,EAAK,QAAQ,OAAOQ,GAAQ,SAAWA,EAAM,QAAQ,IAAG,CAAE,EAC/D,KAAMC,IAAS,GACf,YAAAF,EACA,OAAQG,EAEZ,OAASC,EAAgB,CACvB,MAAM,IAAIT,EAAWS,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,CAAC,CAC7E,CACF,CAlBgBC,EAAAT,EAAA",
6
+ "names": ["path", "parseArgs", "UsageError", "parseCommand", "args", "spec", "values", "positionals", "cwd", "json", "rest", "error", "__name"]
7
+ }
package/dist/bin.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
package/dist/bin.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{run as r}from"./cli.js";import{processIo as s}from"./io.js";process.stdout.on("error",o=>{if(o.code!=="EPIPE")throw o}),process.exitCode=await r(process.argv.slice(2),s);
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/bin.ts"],
4
+ "sourcesContent": ["#!/usr/bin/env node\nimport { run } from './cli.ts';\nimport { processIo } from './io.ts';\n\n// `rexezuge doctor | head` closes the pipe early; that is the reader's choice, not a failure.\nprocess.stdout.on('error', (error: NodeJS.ErrnoException) => {\n if (error.code !== 'EPIPE') throw error;\n});\n\nprocess.exitCode = await run(process.argv.slice(2), processIo);\n"],
5
+ "mappings": ";AACA,OAAS,OAAAA,MAAW,WACpB,OAAS,aAAAC,MAAiB,UAG1B,QAAQ,OAAO,GAAG,QAAUC,GAAgC,CAC1D,GAAIA,EAAM,OAAS,QAAS,MAAMA,CACpC,CAAC,EAED,QAAQ,SAAW,MAAMF,EAAI,QAAQ,KAAK,MAAM,CAAC,EAAGC,CAAS",
6
+ "names": ["run", "processIo", "error"]
7
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { ScriptLoaders } from './commands/scripts.ts';
2
+ import type { Io } from './io.ts';
3
+ /**
4
+ * Test seams. Everything defaults to the real thing.
5
+ */
6
+ export interface CliDeps {
7
+ readonly loaders?: ScriptLoaders;
8
+ }
9
+ /**
10
+ * Run `rexezuge <argv>` and return the exit code. Nothing here calls `process.exit`, so it is callable from a test.
11
+ */
12
+ export declare function run(argv: readonly string[], io: Io, deps?: CliDeps): Promise<number>;
13
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAsBlC;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;CAClC;AAED;;GAEG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,GAAE,OAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAsD9F"}
package/dist/cli.js ADDED
@@ -0,0 +1,18 @@
1
+ var l=Object.defineProperty;var s=(o,e)=>l(o,"name",{value:e,configurable:!0});import{doctorCommand as u}from"./commands/doctor.js";import{godFilesCommand as f}from"./commands/godFiles.js";import{localesCommand as p}from"./commands/locales.js";import{migrationsCommand as g}from"./commands/migrations.js";import{defaultLoaders as h,initSecretsCommand as w,prepareWranglerCommand as y}from"./commands/scripts.js";import{spaShellCommand as C}from"./commands/spaShell.js";import{syncCommand as x}from"./commands/sync.js";import{UsageError as i}from"./io.js";import{CLI_VERSION as m}from"./version.js";const c=`rexezuge ${m}: the family command line
2
+
3
+ Usage: rexezuge <command> [options]
4
+
5
+ Commands:
6
+ doctor [--json] [--strict] conformance report and score
7
+ sync [--write] [--json] apply doctor's auto-fixes (dry run by default)
8
+ prepare-wrangler materialize wrangler.jsonc and provision resources
9
+ init-secrets create declared Secrets Store entries
10
+ migrations verify|lock [--dir <d>] check or record the migrations lock
11
+ migrations add-identity [--dry-run] write the next @rexezuge/identity migration
12
+ spa-shell ensure|verify write the stub, or verify the built shell
13
+ god-files [--allowlist <f>] [--fail-on-hard]
14
+ locales validate [--dir <d>] [--base <tag>] [--shape <s>] [--call-sites <d>] [--tags <f>]
15
+
16
+ Common options: --cwd <dir> (the repo; default .), --json (a machine-readable report), --help
17
+ Exit codes: 0 success, 1 failure or misuse.
18
+ `;async function R(o,e,d={}){const[r,...t]=o,n=d.loaders??h;try{if(r===void 0||r==="--help"||r==="-h"||r==="help")return e.out(c),r===void 0?1:0;if(r==="--version"||r==="-v")return e.out(m),0;if(t.includes("--help")||t.includes("-h"))return e.out(c),0;switch(r){case"doctor":return await u(t,e);case"sync":return await x(t,e);case"prepare-wrangler":return await y(t,e,n);case"init-secrets":return await w(t,e,n);case"migrations":return g(t,e);case"spa-shell":return C(t,e);case"god-files":return f(t,e);case"locales":return p(t,e);default:throw new i(`unknown command: ${r}`)}}catch(a){return a instanceof i?(e.err(`rexezuge: ${a.message}`),e.err("Run 'rexezuge --help' for usage.")):e.err(`rexezuge ${r??""} failed: ${a instanceof Error?a.message:String(a)}`),1}}s(R,"run");export{R as run};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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;;;;;;;;;;;;;;;;;EA6BpC,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,MAAMhB,EAAciB,EAAMH,CAAE,EAErC,IAAK,OACH,OAAO,MAAMN,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,OAAOb,EAAgBgB,EAAMH,CAAE,EAEjC,IAAK,UACH,OAAOZ,EAAee,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,CAtDsBC,EAAAR,EAAA",
6
+ "names": ["doctorCommand", "godFilesCommand", "localesCommand", "migrationsCommand", "defaultLoaders", "initSecretsCommand", "prepareWranglerCommand", "spaShellCommand", "syncCommand", "UsageError", "CLI_VERSION", "HELP", "run", "argv", "io", "deps", "command", "rest", "loaders", "error", "__name"]
7
+ }
@@ -0,0 +1,8 @@
1
+ import type { DoctorReport } from '../doctor/types.ts';
2
+ import type { Io } from '../io.ts';
3
+ export declare function formatReport(report: DoctorReport): string[];
4
+ /**
5
+ * `rexezuge doctor [--json] [--strict]`. Exit 1 when an ERROR check fails (with `--strict`, a WARN too).
6
+ */
7
+ export declare function doctorCommand(args: readonly string[], io: Io): Promise<number>;
8
+ //# sourceMappingURL=doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,CAmB3D;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAMpF"}
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var r=(e,t)=>f(e,"name",{value:t,configurable:!0});import{parseCommand as c}from"../args.js";import{runDoctor as l}from"../doctor/run.js";function u(e){const t=[`rexezuge doctor: ${e.root} (cli ${e.cliVersion})`,`Score: ${e.score}/100 (${e.errors} error(s), ${e.warnings} warning(s))`,""];for(const s of e.findings)if(s.status==="fail"){t.push(`FAIL ${s.severity.toUpperCase()} ${s.id}: ${s.message}`);for(const i of s.details)t.push(` - ${i}`);t.push(` fix: ${s.fix}${s.autoFixable?" [auto-fixable: rexezuge sync --write]":""}`)}else s.status==="disabled"&&t.push(`OFF ${s.severity.toUpperCase()} ${s.id}: disabled (${s.reason??""})`);const n=e.findings.filter(s=>s.status==="pass").length,o=e.findings.filter(s=>s.status==="skipped").length;return t.push(`${n} passed, ${o} not applicable`),t}r(u,"formatReport");async function g(e,t){const{cwd:n,json:o,values:s}=c(e,{strict:{type:"boolean"}}),i=await l(n);if(o)t.out(JSON.stringify(i,null,2));else for(const a of u(i))t.out(a);return i.errors>0||s.strict===!0&&i.warnings>0?1:0}r(g,"doctorCommand");export{g as doctorCommand,u as formatReport};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/commands/doctor.ts"],
4
+ "sourcesContent": ["import { parseCommand } from '../args.ts';\nimport { runDoctor } from '../doctor/run.ts';\nimport type { DoctorReport } from '../doctor/types.ts';\nimport type { Io } from '../io.ts';\n\nexport function formatReport(report: DoctorReport): string[] {\n const lines = [\n `rexezuge doctor: ${report.root} (cli ${report.cliVersion})`,\n `Score: ${report.score}/100 (${report.errors} error(s), ${report.warnings} warning(s))`,\n '',\n ];\n for (const finding of report.findings) {\n if (finding.status === 'fail') {\n lines.push(`FAIL ${finding.severity.toUpperCase()} ${finding.id}: ${finding.message}`);\n for (const detail of finding.details) lines.push(` - ${detail}`);\n lines.push(` fix: ${finding.fix}${finding.autoFixable ? ' [auto-fixable: rexezuge sync --write]' : ''}`);\n } else if (finding.status === 'disabled') {\n lines.push(`OFF ${finding.severity.toUpperCase()} ${finding.id}: disabled (${finding.reason ?? ''})`);\n }\n }\n const passed = report.findings.filter((finding) => finding.status === 'pass').length;\n const skipped = report.findings.filter((finding) => finding.status === 'skipped').length;\n lines.push(`${passed} passed, ${skipped} not applicable`);\n return lines;\n}\n\n/**\n * `rexezuge doctor [--json] [--strict]`. Exit 1 when an ERROR check fails (with `--strict`, a WARN too).\n */\nexport async function doctorCommand(args: readonly string[], io: Io): Promise<number> {\n const { cwd, json, values } = parseCommand(args, { strict: { type: 'boolean' } } as const);\n const report = await runDoctor(cwd);\n if (json) io.out(JSON.stringify(report, null, 2));\n else for (const line of formatReport(report)) io.out(line);\n return report.errors > 0 || (values.strict === true && report.warnings > 0) ? 1 : 0;\n}\n"],
5
+ "mappings": "+EAAA,OAAS,gBAAAA,MAAoB,aAC7B,OAAS,aAAAC,MAAiB,mBAIpB,SAAUC,EAAaC,EAAoB,CAC/C,MAAMC,EAAQ,CACZ,oBAAoBD,EAAO,IAAI,SAASA,EAAO,UAAU,IACzD,UAAUA,EAAO,KAAK,SAASA,EAAO,MAAM,cAAcA,EAAO,QAAQ,eACzE,IAEF,UAAWE,KAAWF,EAAO,SAC3B,GAAIE,EAAQ,SAAW,OAAQ,CAC7BD,EAAM,KAAK,QAAQC,EAAQ,SAAS,YAAW,CAAE,IAAIA,EAAQ,EAAE,KAAKA,EAAQ,OAAO,EAAE,EACrF,UAAWC,KAAUD,EAAQ,QAASD,EAAM,KAAK,SAASE,CAAM,EAAE,EAClEF,EAAM,KAAK,YAAYC,EAAQ,GAAG,GAAGA,EAAQ,YAAc,yCAA2C,EAAE,EAAE,CAC5G,MAAWA,EAAQ,SAAW,YAC5BD,EAAM,KAAK,QAAQC,EAAQ,SAAS,YAAW,CAAE,IAAIA,EAAQ,EAAE,eAAeA,EAAQ,QAAU,EAAE,GAAG,EAGzG,MAAME,EAASJ,EAAO,SAAS,OAAQE,GAAYA,EAAQ,SAAW,MAAM,EAAE,OACxEG,EAAUL,EAAO,SAAS,OAAQE,GAAYA,EAAQ,SAAW,SAAS,EAAE,OAClF,OAAAD,EAAM,KAAK,GAAGG,CAAM,YAAYC,CAAO,iBAAiB,EACjDJ,CACT,CAnBgBK,EAAAP,EAAA,gBAwBhB,eAAsBQ,EAAcC,EAAyBC,EAAM,CACjE,KAAM,CAAE,IAAAC,EAAK,KAAAC,EAAM,OAAAC,CAAM,EAAKf,EAAaW,EAAM,CAAE,OAAQ,CAAE,KAAM,SAAS,CAAE,CAAW,EACnFR,EAAS,MAAMF,EAAUY,CAAG,EAClC,GAAIC,EAAMF,EAAG,IAAI,KAAK,UAAUT,EAAQ,KAAM,CAAC,CAAC,MAC3C,WAAWa,KAAQd,EAAaC,CAAM,EAAGS,EAAG,IAAII,CAAI,EACzD,OAAOb,EAAO,OAAS,GAAMY,EAAO,SAAW,IAAQZ,EAAO,SAAW,EAAK,EAAI,CACpF,CANsBM,EAAAC,EAAA",
6
+ "names": ["parseCommand", "runDoctor", "formatReport", "report", "lines", "finding", "detail", "passed", "skipped", "__name", "doctorCommand", "args", "io", "cwd", "json", "values", "line"]
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { Io } from '../io.ts';
2
+ /**
3
+ * `rexezuge god-files [--allowlist <file>] [--fail-on-hard] [--json]`: the 300 / 400 line guard,
4
+ * warn-only unless `--fail-on-hard`. The manifest's `quality.godFiles` may only lower the limits.
5
+ */
6
+ export declare function godFilesCommand(args: readonly string[], io: Io): number;
7
+ //# sourceMappingURL=godFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"godFiles.d.ts","sourceRoot":"","sources":["../../src/commands/godFiles.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CAuBvE"}
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var r=(s,l)=>f(s,"name",{value:l,configurable:!0});import p from"node:path";import{checkGodFiles as g,readAllowlist as m}from"@rexezuge/tooling/scripts/check-god-files";import{loadManifest as c}from"@rexezuge/tooling/manifest";import{parseCommand as u}from"../args.js";import{UsageError as w}from"../io.js";function j(s,l){const{cwd:t,json:a,positionals:n,values:e}=u(s,{allowlist:{type:"string"},"fail-on-hard":{type:"boolean"}});if(n.length>0)throw new w(`god-files takes no arguments, got: ${n.join(" ")}`);const d=m(p.resolve(t,e.allowlist??"scripts/god-files.allowlist.json")),o=g({root:t,allowlist:d,...c(t)?.quality?.godFiles,failOnHard:e["fail-on-hard"]===!0});if(a)l.out(JSON.stringify({ok:o.passed,scanned:o.scanned,findings:o.findings,allowlisted:o.allowlisted},null,2));else{l.out(o.reported);for(const i of o.findings)l.out(`${i.level==="critical"?"CRITICAL":"WARN"} ${i.lines} ${i.file}`);for(const i of o.allowlisted)l.out(`ALLOWLISTED ${i.lines} ${i.file}`)}return o.passed?0:1}r(j,"godFilesCommand");export{j as godFilesCommand};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/commands/godFiles.ts"],
4
+ "sourcesContent": ["import path from 'node:path';\nimport { checkGodFiles, readAllowlist } from '@rexezuge/tooling/scripts/check-god-files';\nimport { loadManifest } from '@rexezuge/tooling/manifest';\nimport { parseCommand } from '../args.ts';\nimport { UsageError } from '../io.ts';\nimport type { Io } from '../io.ts';\n\n/**\n * `rexezuge god-files [--allowlist <file>] [--fail-on-hard] [--json]`: the 300 / 400 line guard,\n * warn-only unless `--fail-on-hard`. The manifest's `quality.godFiles` may only lower the limits.\n */\nexport function godFilesCommand(args: readonly string[], io: Io): number {\n const { cwd, json, positionals, values } = parseCommand(args, {\n allowlist: { type: 'string' },\n 'fail-on-hard': { type: 'boolean' },\n } as const);\n if (positionals.length > 0) throw new UsageError(`god-files takes no arguments, got: ${positionals.join(' ')}`);\n const allowlist = readAllowlist(path.resolve(cwd, values.allowlist ?? 'scripts/god-files.allowlist.json'));\n const report = checkGodFiles({\n root: cwd,\n allowlist,\n ...loadManifest(cwd)?.quality?.godFiles,\n failOnHard: values['fail-on-hard'] === true,\n });\n if (json) {\n io.out(\n JSON.stringify({ ok: report.passed, scanned: report.scanned, findings: report.findings, allowlisted: report.allowlisted }, null, 2),\n );\n } else {\n io.out(report.reported);\n for (const finding of report.findings) io.out(`${finding.level === 'critical' ? 'CRITICAL' : 'WARN'} ${finding.lines} ${finding.file}`);\n for (const finding of report.allowlisted) io.out(`ALLOWLISTED ${finding.lines} ${finding.file}`);\n }\n return report.passed ? 0 : 1;\n}\n"],
5
+ "mappings": "+EAAA,OAAOA,MAAU,YACjB,OAAS,iBAAAC,EAAe,iBAAAC,MAAqB,4CAC7C,OAAS,gBAAAC,MAAoB,6BAC7B,OAAS,gBAAAC,MAAoB,aAC7B,OAAS,cAAAC,MAAkB,WAOrB,SAAUC,EAAgBC,EAAyBC,EAAM,CAC7D,KAAM,CAAE,IAAAC,EAAK,KAAAC,EAAM,YAAAC,EAAa,OAAAC,CAAM,EAAKR,EAAaG,EAAM,CAC5D,UAAW,CAAE,KAAM,QAAQ,EAC3B,eAAgB,CAAE,KAAM,SAAS,EACzB,EACV,GAAII,EAAY,OAAS,EAAG,MAAM,IAAIN,EAAW,sCAAsCM,EAAY,KAAK,GAAG,CAAC,EAAE,EAC9G,MAAME,EAAYX,EAAcF,EAAK,QAAQS,EAAKG,EAAO,WAAa,kCAAkC,CAAC,EACnGE,EAASb,EAAc,CAC3B,KAAMQ,EACN,UAAAI,EACA,GAAGV,EAAaM,CAAG,GAAG,SAAS,SAC/B,WAAYG,EAAO,cAAc,IAAM,GACxC,EACD,GAAIF,EACFF,EAAG,IACD,KAAK,UAAU,CAAE,GAAIM,EAAO,OAAQ,QAASA,EAAO,QAAS,SAAUA,EAAO,SAAU,YAAaA,EAAO,WAAW,EAAI,KAAM,CAAC,CAAC,MAEhI,CACLN,EAAG,IAAIM,EAAO,QAAQ,EACtB,UAAWC,KAAWD,EAAO,SAAUN,EAAG,IAAI,GAAGO,EAAQ,QAAU,WAAa,WAAa,MAAM,IAAIA,EAAQ,KAAK,IAAIA,EAAQ,IAAI,EAAE,EACtI,UAAWA,KAAWD,EAAO,YAAaN,EAAG,IAAI,eAAeO,EAAQ,KAAK,IAAIA,EAAQ,IAAI,EAAE,CACjG,CACA,OAAOD,EAAO,OAAS,EAAI,CAC7B,CAvBgBE,EAAAV,EAAA",
6
+ "names": ["path", "checkGodFiles", "readAllowlist", "loadManifest", "parseCommand", "UsageError", "godFilesCommand", "args", "io", "cwd", "json", "positionals", "values", "allowlist", "report", "finding", "__name"]
7
+ }
@@ -0,0 +1,26 @@
1
+ import type { Io } from '../io.ts';
2
+ export interface AddIdentityOptions {
3
+ readonly dir: string;
4
+ readonly dryRun: boolean;
5
+ readonly json: boolean;
6
+ }
7
+ export type IdentityPlan = {
8
+ readonly action: 'write';
9
+ readonly mode: 'fresh' | 'upgrade';
10
+ readonly file: string;
11
+ readonly sql: string;
12
+ } | {
13
+ readonly action: 'refuse';
14
+ readonly reason: string;
15
+ };
16
+ /**
17
+ * Decide what `add-identity` does for a migrations directory.
18
+ *
19
+ * The family's hand-written `NNNN_user_identity.sql` files all do what `IDENTITY_MIGRATIONS[1]` does for a database
20
+ * whose `users` predates the identity columns (add `id`, `current_email`, backfill `user_emails`). A repo that already
21
+ * created `user_emails` (or `users.current_email`) has applied it, in the kit's shape or its own, and a second
22
+ * application is not additive: the command refuses and says which file did it.
23
+ */
24
+ export declare function planIdentity(dir: string): IdentityPlan;
25
+ export declare function addIdentity(options: AddIdentityOptions, io: Io): number;
26
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/commands/identity.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC7G;IAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAK3D;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAkCtD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CAmBvE"}
@@ -0,0 +1,4 @@
1
+ var p=Object.defineProperty;var a=(t,n)=>p(t,"name",{value:n,configurable:!0});import{existsSync as _,mkdirSync as I,readdirSync as S,readFileSync as T,writeFileSync as x}from"node:fs";import l from"node:path";import{IDENTITY_MIGRATIONS as N}from"@rexezuge/identity";const c=a(t=>new RegExp(String.raw`CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?["\`\[]?${t}\b["\`\]]?\s*\(`,"i"),"CREATE");function E(t){const n=_(t)?S(t).filter(e=>e.endsWith(".sql")).sort((e,s)=>e.localeCompare(s)):[],r=n.map(e=>({name:e,sql:T(l.join(t,e),"utf8")}));for(const{name:e,sql:s}of r)if(c("user_emails").test(s)||/ADD\s+COLUMN\s+current_email\b/i.test(s)||/\bcurrent_email\s+TEXT\b/i.test(s))return{action:"refuse",reason:`${e} already creates the identity tables (user_emails / users.current_email); nothing to add`};const i=n.find(e=>/user_identity/i.test(e));if(i!==void 0)return{action:"refuse",reason:`${i} is an identity migration already; nothing to add`};const d=r.some(({sql:e})=>c("users").test(e)),[f,m]=N,u=d?m:f;if(u===void 0)return{action:"refuse",reason:"@rexezuge/identity ships no migrations"};const o=n.map(e=>/^(\d+)_/.exec(e)?.[1]).filter(e=>e!==void 0),y=Math.max(4,...o.map(e=>e.length)),g=Math.max(0,...o.map(Number))+1,h=d?"-- Identity upgrade from @rexezuge/identity (IDENTITY_MIGRATIONS[1]): the legacy `users` table gains id, current_email and the user_emails registry.\n-- Append one additive phase per legacy table that references users(email): a *_user_id column, backfilled through user_emails.\n":`-- Canonical identity schema from @rexezuge/identity (IDENTITY_MIGRATIONS[0]): users and user_emails.
2
+ `;return{action:"write",mode:d?"upgrade":"fresh",file:`${String(g).padStart(y,"0")}_user_identity.sql`,sql:`${h}${u.sql.trimStart()}`}}a(E,"planIdentity");function A(t,n){const r=E(t.dir);if(r.action==="refuse")return t.json?n.out(JSON.stringify({ok:!1,action:"refuse",reason:r.reason},null,2)):n.err(`add-identity refused: ${r.reason}`),1;const i=l.join(t.dir,r.file);return t.dryRun||(I(t.dir,{recursive:!0}),x(i,r.sql.endsWith(`
3
+ `)?r.sql:`${r.sql}
4
+ `,{flag:"wx"})),t.json?n.out(JSON.stringify({ok:!0,action:t.dryRun?"dry-run":"write",mode:r.mode,file:r.file},null,2)):(n.out(`${t.dryRun?"would write":"wrote"} ${i} (${r.mode} identity migration)`),t.dryRun||n.out("Next: rexezuge migrations lock")),0}a(A,"addIdentity");export{A as addIdentity,E as planIdentity};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/commands/identity.ts"],
4
+ "sourcesContent": ["import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport path from 'node:path';\nimport { IDENTITY_MIGRATIONS } from '@rexezuge/identity';\nimport type { Io } from '../io.ts';\n\nexport interface AddIdentityOptions {\n readonly dir: string;\n readonly dryRun: boolean;\n readonly json: boolean;\n}\n\nexport type IdentityPlan =\n | { readonly action: 'write'; readonly mode: 'fresh' | 'upgrade'; readonly file: string; readonly sql: string }\n | { readonly action: 'refuse'; readonly reason: string };\n\nconst CREATE = (table: string): RegExp =>\n new RegExp(String.raw`CREATE\\s+TABLE\\s+(?:IF\\s+NOT\\s+EXISTS\\s+)?[\"\\`\\[]?${table}\\b[\"\\`\\]]?\\s*\\(`, 'i');\n\n/**\n * Decide what `add-identity` does for a migrations directory.\n *\n * The family's hand-written `NNNN_user_identity.sql` files all do what `IDENTITY_MIGRATIONS[1]` does for a database\n * whose `users` predates the identity columns (add `id`, `current_email`, backfill `user_emails`). A repo that already\n * created `user_emails` (or `users.current_email`) has applied it, in the kit's shape or its own, and a second\n * application is not additive: the command refuses and says which file did it.\n */\nexport function planIdentity(dir: string): IdentityPlan {\n const names = existsSync(dir)\n ? readdirSync(dir)\n .filter((name) => name.endsWith('.sql'))\n .sort((a, b) => a.localeCompare(b))\n : [];\n const sources = names.map((name) => ({ name, sql: readFileSync(path.join(dir, name), 'utf8') }));\n for (const { name, sql } of sources) {\n const applied = CREATE('user_emails').test(sql) || /ADD\\s+COLUMN\\s+current_email\\b/i.test(sql) || /\\bcurrent_email\\s+TEXT\\b/i.test(sql);\n if (applied)\n return {\n action: 'refuse',\n reason: `${name} already creates the identity tables (user_emails / users.current_email); nothing to add`,\n };\n }\n const named = names.find((name) => /user_identity/i.test(name));\n if (named !== undefined) return { action: 'refuse', reason: `${named} is an identity migration already; nothing to add` };\n\n const hasUsers = sources.some(({ sql }) => CREATE('users').test(sql));\n const [fresh, upgrade] = IDENTITY_MIGRATIONS;\n const picked = hasUsers ? upgrade : fresh;\n if (picked === undefined) return { action: 'refuse', reason: '@rexezuge/identity ships no migrations' };\n const numbers = names.map((name) => /^(\\d+)_/.exec(name)?.[1]).filter((n): n is string => n !== undefined);\n const width = Math.max(4, ...numbers.map((n) => n.length));\n const next = Math.max(0, ...numbers.map(Number)) + 1;\n const header = hasUsers\n ? '-- Identity upgrade from @rexezuge/identity (IDENTITY_MIGRATIONS[1]): the legacy `users` table gains id, current_email and the user_emails registry.\\n-- Append one additive phase per legacy table that references users(email): a *_user_id column, backfilled through user_emails.\\n'\n : '-- Canonical identity schema from @rexezuge/identity (IDENTITY_MIGRATIONS[0]): users and user_emails.\\n';\n return {\n action: 'write',\n mode: hasUsers ? 'upgrade' : 'fresh',\n file: `${String(next).padStart(width, '0')}_user_identity.sql`,\n sql: `${header}${picked.sql.trimStart()}`,\n };\n}\n\nexport function addIdentity(options: AddIdentityOptions, io: Io): number {\n const plan = planIdentity(options.dir);\n if (plan.action === 'refuse') {\n if (options.json) io.out(JSON.stringify({ ok: false, action: 'refuse', reason: plan.reason }, null, 2));\n else io.err(`add-identity refused: ${plan.reason}`);\n return 1;\n }\n const target = path.join(options.dir, plan.file);\n if (!options.dryRun) {\n mkdirSync(options.dir, { recursive: true });\n writeFileSync(target, plan.sql.endsWith('\\n') ? plan.sql : `${plan.sql}\\n`, { flag: 'wx' });\n }\n if (options.json)\n io.out(JSON.stringify({ ok: true, action: options.dryRun ? 'dry-run' : 'write', mode: plan.mode, file: plan.file }, null, 2));\n else {\n io.out(`${options.dryRun ? 'would write' : 'wrote'} ${target} (${plan.mode} identity migration)`);\n if (!options.dryRun) io.out('Next: rexezuge migrations lock');\n }\n return 0;\n}\n"],
5
+ "mappings": "+EAAA,OAAS,cAAAA,EAAY,aAAAC,EAAW,eAAAC,EAAa,gBAAAC,EAAc,iBAAAC,MAAqB,UAChF,OAAOC,MAAU,YACjB,OAAS,uBAAAC,MAA2B,qBAapC,MAAMC,EAASC,EAACC,GACd,IAAI,OAAO,OAAO,wDAAwDA,CAAK,kBAAmB,GAAG,EADxF,UAWT,SAAUC,EAAaC,EAAW,CACtC,MAAMC,EAAQZ,EAAWW,CAAG,EACxBT,EAAYS,CAAG,EACZ,OAAQE,GAASA,EAAK,SAAS,MAAM,CAAC,EACtC,KAAK,CAACC,EAAGC,IAAMD,EAAE,cAAcC,CAAC,CAAC,EACpC,CAAA,EACEC,EAAUJ,EAAM,IAAKC,IAAU,CAAE,KAAAA,EAAM,IAAKV,EAAaE,EAAK,KAAKM,EAAKE,CAAI,EAAG,MAAM,CAAC,EAAG,EAC/F,SAAW,CAAE,KAAAA,EAAM,IAAAI,CAAG,IAAMD,EAE1B,GADgBT,EAAO,aAAa,EAAE,KAAKU,CAAG,GAAK,kCAAkC,KAAKA,CAAG,GAAK,4BAA4B,KAAKA,CAAG,EAEpI,MAAO,CACL,OAAQ,SACR,OAAQ,GAAGJ,CAAI,4FAGrB,MAAMK,EAAQN,EAAM,KAAMC,GAAS,iBAAiB,KAAKA,CAAI,CAAC,EAC9D,GAAIK,IAAU,OAAW,MAAO,CAAE,OAAQ,SAAU,OAAQ,GAAGA,CAAK,mDAAmD,EAEvH,MAAMC,EAAWH,EAAQ,KAAK,CAAC,CAAE,IAAAC,CAAG,IAAOV,EAAO,OAAO,EAAE,KAAKU,CAAG,CAAC,EAC9D,CAACG,EAAOC,CAAO,EAAIf,EACnBgB,EAASH,EAAWE,EAAUD,EACpC,GAAIE,IAAW,OAAW,MAAO,CAAE,OAAQ,SAAU,OAAQ,wCAAwC,EACrG,MAAMC,EAAUX,EAAM,IAAKC,GAAS,UAAU,KAAKA,CAAI,IAAI,CAAC,CAAC,EAAE,OAAQW,GAAmBA,IAAM,MAAS,EACnGC,EAAQ,KAAK,IAAI,EAAG,GAAGF,EAAQ,IAAKC,GAAMA,EAAE,MAAM,CAAC,EACnDE,EAAO,KAAK,IAAI,EAAG,GAAGH,EAAQ,IAAI,MAAM,CAAC,EAAI,EAC7CI,EAASR,EACX,0RACA;EACJ,MAAO,CACL,OAAQ,QACR,KAAMA,EAAW,UAAY,QAC7B,KAAM,GAAG,OAAOO,CAAI,EAAE,SAASD,EAAO,GAAG,CAAC,qBAC1C,IAAK,GAAGE,CAAM,GAAGL,EAAO,IAAI,UAAS,CAAE,GAE3C,CAlCgBd,EAAAE,EAAA,gBAoCV,SAAUkB,EAAYC,EAA6BC,EAAM,CAC7D,MAAMC,EAAOrB,EAAamB,EAAQ,GAAG,EACrC,GAAIE,EAAK,SAAW,SAClB,OAAIF,EAAQ,KAAMC,EAAG,IAAI,KAAK,UAAU,CAAE,GAAI,GAAO,OAAQ,SAAU,OAAQC,EAAK,MAAM,EAAI,KAAM,CAAC,CAAC,EACjGD,EAAG,IAAI,yBAAyBC,EAAK,MAAM,EAAE,EAC3C,EAET,MAAMC,EAAS3B,EAAK,KAAKwB,EAAQ,IAAKE,EAAK,IAAI,EAC/C,OAAKF,EAAQ,SACX5B,EAAU4B,EAAQ,IAAK,CAAE,UAAW,EAAI,CAAE,EAC1CzB,EAAc4B,EAAQD,EAAK,IAAI,SAAS;CAAI,EAAIA,EAAK,IAAM,GAAGA,EAAK,GAAG;EAAM,CAAE,KAAM,IAAI,CAAE,GAExFF,EAAQ,KACVC,EAAG,IAAI,KAAK,UAAU,CAAE,GAAI,GAAM,OAAQD,EAAQ,OAAS,UAAY,QAAS,KAAME,EAAK,KAAM,KAAMA,EAAK,IAAI,EAAI,KAAM,CAAC,CAAC,GAE5HD,EAAG,IAAI,GAAGD,EAAQ,OAAS,cAAgB,OAAO,IAAIG,CAAM,KAAKD,EAAK,IAAI,sBAAsB,EAC3FF,EAAQ,QAAQC,EAAG,IAAI,gCAAgC,GAEvD,CACT,CAnBgBtB,EAAAoB,EAAA",
6
+ "names": ["existsSync", "mkdirSync", "readdirSync", "readFileSync", "writeFileSync", "path", "IDENTITY_MIGRATIONS", "CREATE", "__name", "table", "planIdentity", "dir", "names", "name", "a", "b", "sources", "sql", "named", "hasUsers", "fresh", "upgrade", "picked", "numbers", "n", "width", "next", "header", "addIdentity", "options", "io", "plan", "target"]
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { Io } from '../io.ts';
2
+ /**
3
+ * `rexezuge locales validate [--dir <locales-dir>] [--base en] [--shape auto|dir|file|module] [--call-sites <src>] [--tags <file>]`:
4
+ * key parity, empty values, `{{placeholder}}` parity; optionally the `t()` call sites and the declared language tags.
5
+ */
6
+ export declare function localesCommand(args: readonly string[], io: Io): number;
7
+ //# sourceMappingURL=locales.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/commands/locales.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CAkCtE"}
@@ -0,0 +1 @@
1
+ var y=Object.defineProperty;var n=(l,o)=>y(l,"name",{value:o,configurable:!0});import m from"node:path";import{collectLocaleProblems as b}from"@rexezuge/tooling/scripts/validate-locales";import{parseCommand as v}from"../args.js";import{UsageError as u}from"../io.js";function C(l,o){const{cwd:c,json:g,positionals:p,values:s}=v(l,{dir:{type:"string"},base:{type:"string"},shape:{type:"string"},"call-sites":{type:"string"},tags:{type:"string"}});if(p.length!==1||p[0]!=="validate")throw new u("usage: rexezuge locales validate");const a=s.shape??"auto";if(!["auto","dir","file","module"].includes(a))throw new u(`--shape must be auto, dir, file or module, got ${a}`);const d=m.resolve(c,s.dir??"apps/web/src/locales"),f=n(e=>e===void 0?void 0:m.resolve(c,e),"resolve"),{report:t,problems:i}=b({dir:d,base:s.base,shape:a,callSiteDir:f(s["call-sites"]),tagsFile:f(s.tags)}),r=i.filter(e=>e.advisory!==!0);if(g)return o.out(JSON.stringify({ok:r.length===0,locales:t.locales,keys:t.keys,problems:i},null,2)),r.length===0?0:1;const h=i.filter(e=>e.advisory===!0);for(const e of h)o.out(`advisory ${e.locale}: ${e.problem}`);if(r.length>0){o.err(`Locale validation failed for ${d} (${r.length} problem(s)):`);for(const e of r)o.err(` - ${e.locale}: ${e.problem}`);return 1}return o.out(`Locale validation passed (${t.locales.length} locales, ${t.keys} keys each).`),0}n(C,"localesCommand");export{C as localesCommand};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/commands/locales.ts"],
4
+ "sourcesContent": ["import path from 'node:path';\nimport { collectLocaleProblems } from '@rexezuge/tooling/scripts/validate-locales';\nimport type { LocaleShape } from '@rexezuge/tooling/scripts/validate-locales';\nimport { parseCommand } from '../args.ts';\nimport { UsageError } from '../io.ts';\nimport type { Io } from '../io.ts';\n\n/**\n * `rexezuge locales validate [--dir <locales-dir>] [--base en] [--shape auto|dir|file|module] [--call-sites <src>] [--tags <file>]`:\n * key parity, empty values, `{{placeholder}}` parity; optionally the `t()` call sites and the declared language tags.\n */\nexport function localesCommand(args: readonly string[], io: Io): number {\n const { cwd, json, positionals, values } = parseCommand(args, {\n dir: { type: 'string' },\n base: { type: 'string' },\n shape: { type: 'string' },\n 'call-sites': { type: 'string' },\n tags: { type: 'string' },\n } as const);\n if (positionals.length !== 1 || positionals[0] !== 'validate') throw new UsageError('usage: rexezuge locales validate');\n const shape = values.shape ?? 'auto';\n if (!['auto', 'dir', 'file', 'module'].includes(shape)) throw new UsageError(`--shape must be auto, dir, file or module, got ${shape}`);\n const dir = path.resolve(cwd, values.dir ?? 'apps/web/src/locales');\n const resolve = (value: string | undefined): string | undefined => (value === undefined ? undefined : path.resolve(cwd, value));\n const { report, problems } = collectLocaleProblems({\n dir,\n base: values.base,\n shape: shape as LocaleShape,\n callSiteDir: resolve(values['call-sites']),\n tagsFile: resolve(values.tags),\n });\n const failures = problems.filter((problem) => problem.advisory !== true);\n if (json) {\n io.out(JSON.stringify({ ok: failures.length === 0, locales: report.locales, keys: report.keys, problems }, null, 2));\n return failures.length === 0 ? 0 : 1;\n }\n const advisories = problems.filter((entry) => entry.advisory === true);\n for (const problem of advisories) io.out(`advisory ${problem.locale}: ${problem.problem}`);\n if (failures.length > 0) {\n io.err(`Locale validation failed for ${dir} (${failures.length} problem(s)):`);\n for (const problem of failures) io.err(` - ${problem.locale}: ${problem.problem}`);\n return 1;\n }\n io.out(`Locale validation passed (${report.locales.length} locales, ${report.keys} keys each).`);\n return 0;\n}\n"],
5
+ "mappings": "+EAAA,OAAOA,MAAU,YACjB,OAAS,yBAAAC,MAA6B,6CAEtC,OAAS,gBAAAC,MAAoB,aAC7B,OAAS,cAAAC,MAAkB,WAOrB,SAAUC,EAAeC,EAAyBC,EAAM,CAC5D,KAAM,CAAE,IAAAC,EAAK,KAAAC,EAAM,YAAAC,EAAa,OAAAC,CAAM,EAAKR,EAAaG,EAAM,CAC5D,IAAK,CAAE,KAAM,QAAQ,EACrB,KAAM,CAAE,KAAM,QAAQ,EACtB,MAAO,CAAE,KAAM,QAAQ,EACvB,aAAc,CAAE,KAAM,QAAQ,EAC9B,KAAM,CAAE,KAAM,QAAQ,EACd,EACV,GAAII,EAAY,SAAW,GAAKA,EAAY,CAAC,IAAM,WAAY,MAAM,IAAIN,EAAW,kCAAkC,EACtH,MAAMQ,EAAQD,EAAO,OAAS,OAC9B,GAAI,CAAC,CAAC,OAAQ,MAAO,OAAQ,QAAQ,EAAE,SAASC,CAAK,EAAG,MAAM,IAAIR,EAAW,kDAAkDQ,CAAK,EAAE,EACtI,MAAMC,EAAMZ,EAAK,QAAQO,EAAKG,EAAO,KAAO,sBAAsB,EAC5DG,EAAUC,EAACC,GAAmDA,IAAU,OAAY,OAAYf,EAAK,QAAQO,EAAKQ,CAAK,EAA7G,WACV,CAAE,OAAAC,EAAQ,SAAAC,CAAQ,EAAKhB,EAAsB,CACjD,IAAAW,EACA,KAAMF,EAAO,KACb,MAAOC,EACP,YAAaE,EAAQH,EAAO,YAAY,CAAC,EACzC,SAAUG,EAAQH,EAAO,IAAI,EAC9B,EACKQ,EAAWD,EAAS,OAAQE,GAAYA,EAAQ,WAAa,EAAI,EACvE,GAAIX,EACF,OAAAF,EAAG,IAAI,KAAK,UAAU,CAAE,GAAIY,EAAS,SAAW,EAAG,QAASF,EAAO,QAAS,KAAMA,EAAO,KAAM,SAAAC,CAAQ,EAAI,KAAM,CAAC,CAAC,EAC5GC,EAAS,SAAW,EAAI,EAAI,EAErC,MAAME,EAAaH,EAAS,OAAQI,GAAUA,EAAM,WAAa,EAAI,EACrE,UAAWF,KAAWC,EAAYd,EAAG,IAAI,YAAYa,EAAQ,MAAM,KAAKA,EAAQ,OAAO,EAAE,EACzF,GAAID,EAAS,OAAS,EAAG,CACvBZ,EAAG,IAAI,gCAAgCM,CAAG,KAAKM,EAAS,MAAM,eAAe,EAC7E,UAAWC,KAAWD,EAAUZ,EAAG,IAAI,OAAOa,EAAQ,MAAM,KAAKA,EAAQ,OAAO,EAAE,EAClF,MAAO,EACT,CACA,OAAAb,EAAG,IAAI,6BAA6BU,EAAO,QAAQ,MAAM,aAAaA,EAAO,IAAI,cAAc,EACxF,CACT,CAlCgBF,EAAAV,EAAA",
6
+ "names": ["path", "collectLocaleProblems", "parseCommand", "UsageError", "localesCommand", "args", "io", "cwd", "json", "positionals", "values", "shape", "dir", "resolve", "__name", "value", "report", "problems", "failures", "problem", "advisories", "entry"]
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { Io } from '../io.ts';
2
+ /**
3
+ * `rexezuge migrations verify|lock|add-identity [--dir <migrations>]`. `verify` is read-only (the CI gate);
4
+ * `lock` is the add-only lock write; `add-identity` writes the next numbered `@rexezuge/identity` migration.
5
+ */
6
+ export declare function migrationsCommand(args: readonly string[], io: Io): number;
7
+ //# sourceMappingURL=migrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/commands/migrations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAInC;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CAiCzE"}
@@ -0,0 +1 @@
1
+ var b=Object.defineProperty;var p=(n,r)=>b(n,"name",{value:r,configurable:!0});import c from"node:path";import{LOCK_NAME as h,verifyMigrations as g}from"@rexezuge/tooling/scripts/verify-migrations";import{parseCommand as v}from"../args.js";import{UsageError as k}from"../io.js";import{addIdentity as w}from"./identity.js";import{migrationsDirFor as $}from"./scripts.js";function z(n,r){const{cwd:m,json:d,positionals:u,values:f}=v(n,{dir:{type:"string"},"dry-run":{type:"boolean"}}),[t,...y]=u;if(t!=="verify"&&t!=="lock"&&t!=="add-identity"||y.length>0)throw new k("usage: rexezuge migrations <verify|lock|add-identity>");const o=$(m,f.dir);if(t==="add-identity")return w({dir:o,dryRun:f["dry-run"]===!0,json:d},r);const i=t==="lock",l=i?g(o,{write:i}):null,e=l!==null&&l.problems.length>0?l:g(o),s=e.problems.length===0;if(d)r.out(JSON.stringify({ok:s,dir:c.relative(m,o),files:e.files,problems:e.problems.map(a=>a.problem)},null,2));else if(s)r.out(i?`wrote ${c.join(o,h)} (${e.files.length} migration(s) recorded)`:`Migration validation passed (${e.files.length} files, lock in sync).`);else{r.err(`Migration ${i?"lock":"validation"} failed for ${o}:`);for(const a of e.problems)r.err(` - ${a.problem}`)}return s?0:1}p(z,"migrationsCommand");export{z as migrationsCommand};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/commands/migrations.ts"],
4
+ "sourcesContent": ["import path from 'node:path';\nimport { LOCK_NAME, verifyMigrations } from '@rexezuge/tooling/scripts/verify-migrations';\nimport { parseCommand } from '../args.ts';\nimport { UsageError } from '../io.ts';\nimport type { Io } from '../io.ts';\nimport { addIdentity } from './identity.ts';\nimport { migrationsDirFor } from './scripts.ts';\n\n/**\n * `rexezuge migrations verify|lock|add-identity [--dir <migrations>]`. `verify` is read-only (the CI gate);\n * `lock` is the add-only lock write; `add-identity` writes the next numbered `@rexezuge/identity` migration.\n */\nexport function migrationsCommand(args: readonly string[], io: Io): number {\n const { cwd, json, positionals, values } = parseCommand(args, {\n dir: { type: 'string' },\n 'dry-run': { type: 'boolean' },\n } as const);\n const [sub, ...extra] = positionals;\n if ((sub !== 'verify' && sub !== 'lock' && sub !== 'add-identity') || extra.length > 0) {\n throw new UsageError('usage: rexezuge migrations <verify|lock|add-identity>');\n }\n const dir = migrationsDirFor(cwd, values.dir);\n if (sub === 'add-identity') return addIdentity({ dir, dryRun: values['dry-run'] === true, json }, io);\n\n const write = sub === 'lock';\n const written = write ? verifyMigrations(dir, { write }) : null;\n // `lock` is add-only, so an edited migration survives the write: re-check from disk, as CI will, so the\n // exit code tells the truth instead of reporting a write that blessed nothing.\n const report = written !== null && written.problems.length > 0 ? written : verifyMigrations(dir);\n const ok = report.problems.length === 0;\n if (json) {\n io.out(\n JSON.stringify({ ok, dir: path.relative(cwd, dir), files: report.files, problems: report.problems.map((p) => p.problem) }, null, 2),\n );\n } else if (ok) {\n io.out(\n write\n ? `wrote ${path.join(dir, LOCK_NAME)} (${report.files.length} migration(s) recorded)`\n : `Migration validation passed (${report.files.length} files, lock in sync).`,\n );\n } else {\n io.err(`Migration ${write ? 'lock' : 'validation'} failed for ${dir}:`);\n for (const problem of report.problems) io.err(` - ${problem.problem}`);\n }\n return ok ? 0 : 1;\n}\n"],
5
+ "mappings": "+EAAA,OAAOA,MAAU,YACjB,OAAS,aAAAC,EAAW,oBAAAC,MAAwB,8CAC5C,OAAS,gBAAAC,MAAoB,aAC7B,OAAS,cAAAC,MAAkB,WAE3B,OAAS,eAAAC,MAAmB,gBAC5B,OAAS,oBAAAC,MAAwB,eAM3B,SAAUC,EAAkBC,EAAyBC,EAAM,CAC/D,KAAM,CAAE,IAAAC,EAAK,KAAAC,EAAM,YAAAC,EAAa,OAAAC,CAAM,EAAKV,EAAaK,EAAM,CAC5D,IAAK,CAAE,KAAM,QAAQ,EACrB,UAAW,CAAE,KAAM,SAAS,EACpB,EACJ,CAACM,EAAK,GAAGC,CAAK,EAAIH,EACxB,GAAKE,IAAQ,UAAYA,IAAQ,QAAUA,IAAQ,gBAAmBC,EAAM,OAAS,EACnF,MAAM,IAAIX,EAAW,uDAAuD,EAE9E,MAAMY,EAAMV,EAAiBI,EAAKG,EAAO,GAAG,EAC5C,GAAIC,IAAQ,eAAgB,OAAOT,EAAY,CAAE,IAAAW,EAAK,OAAQH,EAAO,SAAS,IAAM,GAAM,KAAAF,CAAI,EAAIF,CAAE,EAEpG,MAAMQ,EAAQH,IAAQ,OAChBI,EAAUD,EAAQf,EAAiBc,EAAK,CAAE,MAAAC,CAAK,CAAE,EAAI,KAGrDE,EAASD,IAAY,MAAQA,EAAQ,SAAS,OAAS,EAAIA,EAAUhB,EAAiBc,CAAG,EACzFI,EAAKD,EAAO,SAAS,SAAW,EACtC,GAAIR,EACFF,EAAG,IACD,KAAK,UAAU,CAAE,GAAAW,EAAI,IAAKpB,EAAK,SAASU,EAAKM,CAAG,EAAG,MAAOG,EAAO,MAAO,SAAUA,EAAO,SAAS,IAAKE,GAAMA,EAAE,OAAO,CAAC,EAAI,KAAM,CAAC,CAAC,UAE5HD,EACTX,EAAG,IACDQ,EACI,SAASjB,EAAK,KAAKgB,EAAKf,CAAS,CAAC,KAAKkB,EAAO,MAAM,MAAM,0BAC1D,gCAAgCA,EAAO,MAAM,MAAM,wBAAwB,MAE5E,CACLV,EAAG,IAAI,aAAaQ,EAAQ,OAAS,YAAY,eAAeD,CAAG,GAAG,EACtE,UAAWM,KAAWH,EAAO,SAAUV,EAAG,IAAI,OAAOa,EAAQ,OAAO,EAAE,CACxE,CACA,OAAOF,EAAK,EAAI,CAClB,CAjCgBG,EAAAhB,EAAA",
6
+ "names": ["path", "LOCK_NAME", "verifyMigrations", "parseCommand", "UsageError", "addIdentity", "migrationsDirFor", "migrationsCommand", "args", "io", "cwd", "json", "positionals", "values", "sub", "extra", "dir", "write", "written", "report", "ok", "p", "problem", "__name"]
7
+ }
@@ -0,0 +1,25 @@
1
+ import type { Io } from '../io.ts';
2
+ /**
3
+ * The loaders for the env-driven tooling scripts, injectable so a test does not run wrangler.
4
+ * They are imported lazily: `prepare-wrangler-config` resolves `wrangler.jsonc` from `process.cwd()` when first loaded,
5
+ * so the command changes directory first, then imports.
6
+ */
7
+ export interface ScriptLoaders {
8
+ prepareWrangler(): Promise<() => unknown>;
9
+ initSecrets(): Promise<() => Promise<unknown>>;
10
+ }
11
+ export declare const defaultLoaders: ScriptLoaders;
12
+ /**
13
+ * `rexezuge prepare-wrangler`: materialize `wrangler.jsonc` from the template and provision what it names
14
+ * (env: `WRANGLER_JSONC`, `WRANGLER_PATCH_JSON`, `WRANGLER_VARS_PATCH_JSON`).
15
+ */
16
+ export declare function prepareWranglerCommand(args: readonly string[], io: Io, loaders?: ScriptLoaders): Promise<number>;
17
+ /**
18
+ * `rexezuge init-secrets`: create the Secrets Store entries `wrangler.jsonc` declares, generate-if-absent.
19
+ */
20
+ export declare function initSecretsCommand(args: readonly string[], io: Io, loaders?: ScriptLoaders): Promise<number>;
21
+ /**
22
+ * The D1 migrations directory: `--dir`, else the manifest's `features.d1.migrationsDir`, else `migrations`.
23
+ */
24
+ export declare function migrationsDirFor(cwd: string, dir: string | undefined): string;
25
+ //# sourceMappingURL=scripts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scripts.d.ts","sourceRoot":"","sources":["../../src/commands/scripts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,eAAe,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC;IAC1C,WAAW,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;CAChD;AAED,eAAO,MAAM,cAAc,EAAE,aAG5B,CAAC;AAaF;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,GAAE,aAA8B,GAAG,OAAO,CAAC,MAAM,CAAC,CAItI;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,GAAE,aAA8B,GAAG,OAAO,CAAC,MAAM,CAAC,CAIlI;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAG7E"}
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var t=(r,e)=>f(r,"name",{value:e,configurable:!0});import o from"node:path";import{loadManifest as g}from"@rexezuge/tooling/manifest";import{parseCommand as s}from"../args.js";import{UsageError as p}from"../io.js";const c={prepareWrangler:t(async()=>(await import("@rexezuge/tooling/scripts/prepare-wrangler-config")).main,"prepareWrangler"),initSecrets:t(async()=>(await import("@rexezuge/tooling/scripts/init-secrets")).main,"initSecrets")};async function m(r,e,a,i){process.chdir(r);try{return await i(),0}catch(n){return e.err(`${a} failed: ${n instanceof Error?n.message:String(n)}`),1}}t(m,"inRepo");async function h(r,e,a=c){const{cwd:i,positionals:n}=s(r,{});if(n.length>0)throw new p(`prepare-wrangler takes no arguments, got: ${n.join(" ")}`);return m(i,e,"prepare-wrangler",async()=>(await a.prepareWrangler())())}t(h,"prepareWranglerCommand");async function x(r,e,a=c){const{cwd:i,positionals:n}=s(r,{});if(n.length>0)throw new p(`init-secrets takes no arguments, got: ${n.join(" ")}`);return m(i,e,"init-secrets",async()=>(await a.initSecrets())())}t(x,"initSecretsCommand");function S(r,e){return e!==void 0?o.resolve(r,e):o.resolve(r,g(r)?.features?.d1?.migrationsDir??"migrations")}t(S,"migrationsDirFor");export{c as defaultLoaders,x as initSecretsCommand,S as migrationsDirFor,h as prepareWranglerCommand};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/commands/scripts.ts"],
4
+ "sourcesContent": ["import path from 'node:path';\nimport { loadManifest } from '@rexezuge/tooling/manifest';\nimport { parseCommand } from '../args.ts';\nimport { UsageError } from '../io.ts';\nimport type { Io } from '../io.ts';\n\n/**\n * The loaders for the env-driven tooling scripts, injectable so a test does not run wrangler.\n * They are imported lazily: `prepare-wrangler-config` resolves `wrangler.jsonc` from `process.cwd()` when first loaded,\n * so the command changes directory first, then imports.\n */\nexport interface ScriptLoaders {\n prepareWrangler(): Promise<() => unknown>;\n initSecrets(): Promise<() => Promise<unknown>>;\n}\n\nexport const defaultLoaders: ScriptLoaders = {\n prepareWrangler: async () => (await import('@rexezuge/tooling/scripts/prepare-wrangler-config')).main,\n initSecrets: async () => (await import('@rexezuge/tooling/scripts/init-secrets')).main,\n};\n\nasync function inRepo(cwd: string, io: Io, label: string, work: () => unknown): Promise<number> {\n process.chdir(cwd);\n try {\n await work();\n return 0;\n } catch (error: unknown) {\n io.err(`${label} failed: ${error instanceof Error ? error.message : String(error)}`);\n return 1;\n }\n}\n\n/**\n * `rexezuge prepare-wrangler`: materialize `wrangler.jsonc` from the template and provision what it names\n * (env: `WRANGLER_JSONC`, `WRANGLER_PATCH_JSON`, `WRANGLER_VARS_PATCH_JSON`).\n */\nexport async function prepareWranglerCommand(args: readonly string[], io: Io, loaders: ScriptLoaders = defaultLoaders): Promise<number> {\n const { cwd, positionals } = parseCommand(args, {} as const);\n if (positionals.length > 0) throw new UsageError(`prepare-wrangler takes no arguments, got: ${positionals.join(' ')}`);\n return inRepo(cwd, io, 'prepare-wrangler', async () => (await loaders.prepareWrangler())());\n}\n\n/**\n * `rexezuge init-secrets`: create the Secrets Store entries `wrangler.jsonc` declares, generate-if-absent.\n */\nexport async function initSecretsCommand(args: readonly string[], io: Io, loaders: ScriptLoaders = defaultLoaders): Promise<number> {\n const { cwd, positionals } = parseCommand(args, {} as const);\n if (positionals.length > 0) throw new UsageError(`init-secrets takes no arguments, got: ${positionals.join(' ')}`);\n return inRepo(cwd, io, 'init-secrets', async () => (await loaders.initSecrets())());\n}\n\n/**\n * The D1 migrations directory: `--dir`, else the manifest's `features.d1.migrationsDir`, else `migrations`.\n */\nexport function migrationsDirFor(cwd: string, dir: string | undefined): string {\n if (dir !== undefined) return path.resolve(cwd, dir);\n return path.resolve(cwd, loadManifest(cwd)?.features?.d1?.migrationsDir ?? 'migrations');\n}\n"],
5
+ "mappings": "+EAAA,OAAOA,MAAU,YACjB,OAAS,gBAAAC,MAAoB,6BAC7B,OAAS,gBAAAC,MAAoB,aAC7B,OAAS,cAAAC,MAAkB,WAapB,MAAMC,EAAgC,CAC3C,gBAAiBC,EAAA,UAAa,KAAM,QAAO,mDAAmD,GAAG,KAAhF,mBACjB,YAAaA,EAAA,UAAa,KAAM,QAAO,wCAAwC,GAAG,KAArE,gBAGf,eAAeC,EAAOC,EAAaC,EAAQC,EAAeC,EAAmB,CAC3E,QAAQ,MAAMH,CAAG,EACjB,GAAI,CACF,aAAMG,EAAI,EACH,CACT,OAASC,EAAgB,CACvB,OAAAH,EAAG,IAAI,GAAGC,CAAK,YAAYE,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,CAAC,EAAE,EAC5E,CACT,CACF,CATeN,EAAAC,EAAA,UAef,eAAsBM,EAAuBC,EAAyBL,EAAQM,EAAyBV,EAAc,CACnH,KAAM,CAAE,IAAAG,EAAK,YAAAQ,CAAW,EAAKb,EAAaW,EAAM,CAAA,CAAW,EAC3D,GAAIE,EAAY,OAAS,EAAG,MAAM,IAAIZ,EAAW,6CAA6CY,EAAY,KAAK,GAAG,CAAC,EAAE,EACrH,OAAOT,EAAOC,EAAKC,EAAI,mBAAoB,UAAa,MAAMM,EAAQ,gBAAe,GAAG,CAAE,CAC5F,CAJsBT,EAAAO,EAAA,0BAStB,eAAsBI,EAAmBH,EAAyBL,EAAQM,EAAyBV,EAAc,CAC/G,KAAM,CAAE,IAAAG,EAAK,YAAAQ,CAAW,EAAKb,EAAaW,EAAM,CAAA,CAAW,EAC3D,GAAIE,EAAY,OAAS,EAAG,MAAM,IAAIZ,EAAW,yCAAyCY,EAAY,KAAK,GAAG,CAAC,EAAE,EACjH,OAAOT,EAAOC,EAAKC,EAAI,eAAgB,UAAa,MAAMM,EAAQ,YAAW,GAAG,CAAE,CACpF,CAJsBT,EAAAW,EAAA,sBAShB,SAAUC,EAAiBV,EAAaW,EAAuB,CACnE,OAAIA,IAAQ,OAAkBlB,EAAK,QAAQO,EAAKW,CAAG,EAC5ClB,EAAK,QAAQO,EAAKN,EAAaM,CAAG,GAAG,UAAU,IAAI,eAAiB,YAAY,CACzF,CAHgBF,EAAAY,EAAA",
6
+ "names": ["path", "loadManifest", "parseCommand", "UsageError", "defaultLoaders", "__name", "inRepo", "cwd", "io", "label", "work", "error", "prepareWranglerCommand", "args", "loaders", "positionals", "initSecretsCommand", "migrationsDirFor", "dir"]
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { Io } from '../io.ts';
2
+ /**
3
+ * `rexezuge spa-shell ensure|verify`: write the empty stub when absent, or fail on a missing, stubbed
4
+ * or half-refreshed shell. `verify` needs the build to have run first.
5
+ */
6
+ export declare function spaShellCommand(args: readonly string[], io: Io): number;
7
+ //# sourceMappingURL=spaShell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaShell.d.ts","sourceRoot":"","sources":["../../src/commands/spaShell.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAEnC;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CAmBvE"}
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var u=(o,e)=>c(o,"name",{value:e,configurable:!0});import h from"node:path";import{ensureSpaShellStub as i,verifySpaShell as m}from"@rexezuge/tooling/scripts/spa-shell";import{parseCommand as d}from"../args.js";import{UsageError as S}from"../io.js";function w(o,e){const{cwd:l,json:a,positionals:f}=d(o,{}),[s,...p]=f;if(s!=="ensure"&&s!=="verify"||p.length>0)throw new S("usage: rexezuge spa-shell <ensure|verify>");if(s==="ensure"){const t=i({root:l}),n=h.relative(l,t.path);return a?e.out(JSON.stringify({ok:!0,created:t.created,path:n},null,2)):e.out(t.created?`created stub at ${n}`:`${n} already present, left untouched`),0}const{problems:r}=m({root:l});if(a)e.out(JSON.stringify({ok:r.length===0,problems:r},null,2));else if(r.length===0)e.out("SPA shell check passed.");else{e.err("SPA shell check failed:");for(const t of r)e.err(` - ${t}`)}return r.length===0?0:1}u(w,"spaShellCommand");export{w as spaShellCommand};