@hublo/sentinel 1.7.0-alpha.29 → 1.7.0-alpha.30

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 (91) hide show
  1. package/README.md +3 -1
  2. package/dist/bin/sentinel.js +101 -56
  3. package/dist/{chunk-KGZLTDUT.js → chunk-2PRJJRJI.js} +207 -491
  4. package/dist/{chunk-AO526UPR.js → chunk-APBEGLRI.js} +7 -10
  5. package/dist/chunk-APBEGLRI.js.map +1 -0
  6. package/dist/{chunk-EESVRILJ.js → chunk-DLGBRLUU.js} +16 -3
  7. package/dist/chunk-DLGBRLUU.js.map +1 -0
  8. package/dist/chunk-H4HAFJFZ.js +79 -0
  9. package/dist/chunk-H4HAFJFZ.js.map +1 -0
  10. package/dist/{chunk-ZZP4DWQK.js → chunk-HYXFUUF5.js} +14697 -8559
  11. package/dist/{chunk-SWWQ7X7B.js → chunk-LNFGVGLE.js} +23 -11
  12. package/dist/{chunk-SWWQ7X7B.js.map → chunk-LNFGVGLE.js.map} +1 -1
  13. package/dist/{chunk-ZDSSUW6A.js → chunk-LVY5NPOC.js} +2 -2
  14. package/dist/chunk-PXTU5MPW.js +9 -0
  15. package/dist/chunk-PXTU5MPW.js.map +1 -0
  16. package/dist/chunk-SHF46ALB.js +190 -0
  17. package/dist/chunk-SHF46ALB.js.map +1 -0
  18. package/dist/chunk-TMVKYXZ3.js +18 -0
  19. package/dist/chunk-TMVKYXZ3.js.map +1 -0
  20. package/dist/chunk-XYOIXC6A.js +126 -0
  21. package/dist/chunk-XYOIXC6A.js.map +1 -0
  22. package/dist/{chunk-VE37F4A5.js → chunk-YUZB4LRJ.js} +10 -5
  23. package/dist/chunk-YUZB4LRJ.js.map +1 -0
  24. package/dist/chunk-ZFG6P27V.js +313 -0
  25. package/dist/chunk-ZZMYV576.js +297 -0
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +12 -9
  28. package/dist/migrate-X7PB2X7R.js +553 -0
  29. package/dist/roles/arch/config.d.ts +25 -0
  30. package/dist/roles/arch/config.js +8 -0
  31. package/dist/roles/build/nest/toolchain.d.ts +1 -1
  32. package/dist/roles/build/nest/toolchain.js +9 -5
  33. package/dist/roles/build/nest/toolchain.js.map +1 -1
  34. package/dist/roles/code-churn/config.d.ts +92 -0
  35. package/dist/roles/code-churn/config.js +10 -0
  36. package/dist/roles/code-churn/config.js.map +1 -0
  37. package/dist/roles/sql/config.d.ts +68 -0
  38. package/dist/roles/sql/config.js +8 -0
  39. package/dist/roles/sql/config.js.map +1 -0
  40. package/dist/roles/static-analysis/config.js +2 -1
  41. package/dist/roles/test/nest/toolchain.d.ts +1 -1
  42. package/dist/roles/test/nest/toolchain.js +3 -2
  43. package/dist/roles/test/nest/toolchain.js.map +1 -1
  44. package/dist/roles/test/react/toolchain.js +3 -2
  45. package/dist/roles/test/react/toolchain.js.map +1 -1
  46. package/dist/roles/test/setup/file-boundary.js +3 -3
  47. package/dist/roles/test/setup/jest-parity.js +4 -4
  48. package/dist/roles/test/setup/workspace-entry.js +2 -2
  49. package/dist/roles/test/shared-test-config.d.ts +1 -1
  50. package/dist/roles/test/shared-test-config.js +3 -2
  51. package/dist/tsconfig/legacy.json +21 -0
  52. package/dist/tsconfig/nest.json +10 -1
  53. package/dist/tsconfig/node.json +11 -1
  54. package/dist/tsconfig/react.json +3 -0
  55. package/dist/{tsconfig-aliases-Ce6axdJ4.d.ts → tsconfig-aliases-C_PxuZni.d.ts} +17 -2
  56. package/dist/{validate-D7MW2XE6.js → validate-4GMB32V7.js} +4 -2
  57. package/docs/arch-adoption.md +201 -0
  58. package/docs/build-adoption.md +7 -0
  59. package/docs/code-churn-adoption.md +237 -0
  60. package/docs/sql-adoption.md +672 -0
  61. package/docs/static-analysis-study.md +49 -10
  62. package/docs/test-adoption.md +8 -1
  63. package/docs/typescript-adoption.md +96 -13
  64. package/docs/typescript-traces.md +547 -5
  65. package/docs/using-sentinel.md +4 -2
  66. package/package.json +20 -9
  67. package/dist/chunk-AO526UPR.js.map +0 -1
  68. package/dist/chunk-EESVRILJ.js.map +0 -1
  69. package/dist/chunk-F5WISUN3.js +0 -17
  70. package/dist/chunk-F5WISUN3.js.map +0 -1
  71. package/dist/chunk-FY3P5QPH.js +0 -15
  72. package/dist/chunk-FY3P5QPH.js.map +0 -1
  73. package/dist/chunk-NE3IEJBN.js +0 -59
  74. package/dist/chunk-NE3IEJBN.js.map +0 -1
  75. package/dist/chunk-VE37F4A5.js.map +0 -1
  76. package/dist/chunk-VWASE6NN.js +0 -34
  77. package/dist/chunk-VWASE6NN.js.map +0 -1
  78. package/dist/roles/runtime-analysis/config.d.ts +0 -92
  79. package/dist/roles/runtime-analysis/config.js +0 -10
  80. package/dist/roles/runtime-analysis/gateway.d.ts +0 -2
  81. package/dist/roles/runtime-analysis/gateway.js +0 -89
  82. package/dist/roles/runtime-analysis/gateway.js.map +0 -1
  83. package/dist/roles/runtime-analysis/mock-api.d.ts +0 -2
  84. package/dist/roles/runtime-analysis/mock-api.js +0 -43
  85. package/dist/roles/runtime-analysis/mock-api.js.map +0 -1
  86. package/docs/runtime-analysis-adoption.md +0 -197
  87. package/runtime-analysis-deps/load.mjs +0 -6
  88. package/runtime-analysis-deps/package-lock.json +0 -1766
  89. package/runtime-analysis-deps/package.json +0 -11
  90. /package/dist/{chunk-ZDSSUW6A.js.map → chunk-LVY5NPOC.js.map} +0 -0
  91. /package/dist/roles/{runtime-analysis → arch}/config.js.map +0 -0
package/README.md CHANGED
@@ -176,8 +176,9 @@ throwaway run wants. Once a module has adopted, nothing is fetched any more: the
176
176
  - [`docs/typescript-adoption.md`](docs/typescript-adoption.md) — the adoption cheat sheet: the two adoption steps, the command model (verb x type x location), options, reading a report, and troubleshooting.
177
177
  - [`docs/test-adoption.md`](docs/test-adoption.md) — migrating a module from jest to Vitest: the two steps, what the migration rewrites and what it refuses BY NAME, how the baseline gate proves nothing was lost, and the failures worth recognising.
178
178
  - [`docs/static-analysis-adoption.md`](docs/static-analysis-adoption.md) — running the static analysis role on a module: the two steps, the four output shapes, how to read each row and where its threshold comes from, declaring an entry point, and the two limits worth knowing before trusting a number.
179
+ - [`docs/sql-adoption.md`](docs/sql-adoption.md) — checking the migrations, the `Unsafe` calls, the `Prisma.raw` calls and the SQL of `$queryRaw` / `$executeRaw` / `Prisma.sql` templates a branch adds or changes: the two steps, the 60 rules on by default and the 29 opt-in ones, the three levels in `sql.config.mjs` with an example, sentinel's two notes, and what the role does not read yet.
180
+ - [`docs/code-churn-adoption.md`](docs/code-churn-adoption.md) — the code churn role: the share of a module's new lines rewritten or deleted within 21 days, read from main's git history; adopting it, what it reads, how to read the figure, what it does not say, and how it was validated against `git blame`.
179
181
  - [`docs/env-adoption.md`](docs/env-adoption.md) — checking a whole repository's env files, contracts and Dockerfiles from its root: the ten rules and which block, the three levels of `SENTINEL_ENV_LEVEL`, the optional `env.config.mjs`, and what changed from the monorepo's `tools/repo-env`.
180
- - [`docs/runtime-analysis-adoption.md`](docs/runtime-analysis-adoption.md) — measuring a React front's Core Web Vitals on a pull request: the config key by key, the run on a machine, the CI phases, the browser packages installed only where a measure runs, and how the verdict decides what blocks.
181
182
  - [`docs/typescript-traces.md`](docs/typescript-traces.md) — a **generated, versioned** reference of live command + output traces (every verb, option, config result and edge case) against the mock monorepo. Regenerate after CLI changes with `pnpm docs:traces`.
182
183
 
183
184
  ## Architecture: `target → runner → preset`
@@ -256,6 +257,7 @@ The rules live in `sentinel`. Each module keeps a **thin, generated stub** per t
256
257
  - **Rules in sentinel** — one source of truth, versioned.
257
258
  - **Thin stubs per module** — the stub is what keeps the **editor working** (VS Code discovers config by file, real-time lint/type/format stay live) and what **nx** uses to infer targets. Stubs are **generated by `sentinel --init`**, never hand-written; swapping a runner regenerates them.
258
259
  - **Drift guard** — sentinel validates that each stub is _only_ the sanctioned `extends`, with nothing of the preset's overridden. Unsanctioned drift is flagged in CI; a genuine exception must be **declared in an allowlist** (visible, reviewed), never silent. One addition is sanctioned, in lint: what the preset does not govern (a rule it does not name, a plugin, jsPlugin or setting it does not set) is the module's own, kept by `--init`, not drift, and listed by `--inspect`; a rule the preset names, set to another value, or an entry that collides with the preset's, is drift ([lint-adoption.md](docs/lint-adoption.md#what---inspect-calls-drift-and-what-it-lists-as-yours)).
260
+ - **Adopt first, then run the module's own** — every analysis tool starts with an adoption (`--init`: its config file, its scripts, the pinned devDependency); after it, the developer, the CI and an AI run the module's script, so all three use the same version. `static-analysis` and `sql` are the reference implementations ([CONTRIBUTING.md](CONTRIBUTING.md#an-analysis-role-adopt-first-then-everyone-runs-the-modules-own)).
259
261
  - **Per-module install** — `@hublo/sentinel` is added per module, so adoption is **gradual** (migrate lot by lot; a module can adopt sentinel while its neighbour still uses the old config). Root configs are removed only once the **last** module has migrated.
260
262
  - **Runner binaries** (`eslint`, `typescript`, `vite`, `vitest`, …) are **resolved from the adopting module** at run time (sentinel looks for the tool in the module, then falls back to `PATH`), so the editor and nx keep using the exact binary the project already installs. sentinel does **not** declare them as dependencies today, so it does not pin their versions: the module still owns its own `typescript`. Having sentinel dictate those versions (as peer dependencies, so the whole toolchain rides the sentinel version) is the intended end state, and it lands with the tool tickets that actually bundle a runner.
261
263
 
@@ -8,24 +8,28 @@ import {
8
8
  declaredPresetFor,
9
9
  describeFramework,
10
10
  dispatch,
11
+ locateRepository,
11
12
  palette,
12
13
  presetNotInstalledYet,
13
14
  registerAdapters,
14
15
  resolve
15
- } from "../chunk-ZZP4DWQK.js";
16
- import "../chunk-NE3IEJBN.js";
17
- import "../chunk-VWASE6NN.js";
16
+ } from "../chunk-HYXFUUF5.js";
17
+ import "../chunk-ZZMYV576.js";
18
18
  import {
19
19
  resolveContext,
20
20
  separateToolArgs
21
- } from "../chunk-KGZLTDUT.js";
21
+ } from "../chunk-2PRJJRJI.js";
22
+ import "../chunk-ZFG6P27V.js";
23
+ import "../chunk-O7REVMOC.js";
24
+ import "../chunk-H4HAFJFZ.js";
25
+ import "../chunk-QXFCZON7.js";
22
26
  import {
23
27
  ensureWorkspacePrep,
24
28
  findWorkspaceRoot,
25
29
  inspectWorkspacePrep,
26
30
  readOwnVersion,
27
31
  readProjectPackageJson
28
- } from "../chunk-VE37F4A5.js";
32
+ } from "../chunk-YUZB4LRJ.js";
29
33
  import {
30
34
  DEFAULT_ENV_LEVEL,
31
35
  ENV_LEVELS,
@@ -33,16 +37,15 @@ import {
33
37
  OUTPUT_SHAPES,
34
38
  PRESET_NAMES,
35
39
  REPOSITORY_TARGETS,
36
- STDOUT_PHASE_TARGETS,
37
40
  SWEEPABLE_TARGETS,
38
41
  TARGETS,
39
42
  VERBS
40
- } from "../chunk-AO526UPR.js";
41
- import "../chunk-FY3P5QPH.js";
42
- import "../chunk-F5WISUN3.js";
43
+ } from "../chunk-APBEGLRI.js";
44
+ import "../chunk-TMVKYXZ3.js";
45
+ import "../chunk-SHF46ALB.js";
46
+ import "../chunk-XYOIXC6A.js";
47
+ import "../chunk-PXTU5MPW.js";
43
48
  import "../chunk-4EIY7TTR.js";
44
- import "../chunk-O7REVMOC.js";
45
- import "../chunk-QXFCZON7.js";
46
49
 
47
50
  // bin/sentinel.ts
48
51
  import { program } from "commander";
@@ -595,6 +598,62 @@ function installHint(workspaceChanged, dependenciesChanged) {
595
598
  return `run \`pnpm install\` to apply ${what.join(" and ")}, and commit pnpm-lock.yaml if it changed`;
596
599
  }
597
600
 
601
+ // src/cli/run-migrate.ts
602
+ async function runMigrate(ctx) {
603
+ const { modules, scope } = resolveContext(ctx.cwd, { module: ctx.module, ci: false });
604
+ const [module] = modules;
605
+ if (scope === "all" || scope === "affected" || module === void 0) {
606
+ ctx.fail(
607
+ "--migrate writes files: target one module (run from its directory, or pass --module). Migrating every module at once is intentionally not allowed."
608
+ );
609
+ }
610
+ const unsupported = ctx.targets.filter((target) => target !== "typescript");
611
+ if (unsupported.length > 0) {
612
+ const named = unsupported.map((target) => `--${target}`).join(", ");
613
+ process.stdout.write(
614
+ ` \xB7 ${named}: not available yet. \`--migrate\` answers \`--typescript\` today, by detaching the module from tsconfig.base.json. Nothing was migrated for ${named}.
615
+ `
616
+ );
617
+ }
618
+ if (!ctx.targets.includes("typescript")) return 1;
619
+ const { migrateModule } = await import("../migrate-X7PB2X7R.js");
620
+ const migration = migrateModule(module.root, {
621
+ write: !ctx.dryRun,
622
+ workspaceRoot: findWorkspaceRoot(module.root) ?? module.root
623
+ });
624
+ process.stdout.write(
625
+ ctx.json ? `${JSON.stringify({ module: module.name, target: "typescript", ...migration }, null, 2)}
626
+ ` : renderMigration(module.name, migration)
627
+ );
628
+ return migration.outcome === "migrated" || migration.outcome === "proved" || migration.outcome === "skipped" ? 0 : 1;
629
+ }
630
+ var SHOWN_DIFFERENCES = 20;
631
+ function renderMigration(name, migration) {
632
+ const mark = migration.outcome === "migrated" || migration.outcome === "proved" ? "\u2713" : migration.outcome === "skipped" ? "\xB7" : "\u2717";
633
+ const lines = [` ${mark} ${name} \u2014 ${migration.message}`];
634
+ for (const file of migration.files) {
635
+ lines.push(` ${file.kept ? "\u2713" : "\xB7"} ${file.file}${file.reason ? `: ${file.reason}` : ""}`);
636
+ if (file.aliases !== void 0) {
637
+ lines.push(
638
+ ` ${file.legacy ? "extends legacy, " : ""}${file.aliases.kept} of ${file.aliases.of} aliases, ${file.resolutions ?? 0} resolutions compared${file.written && file.written.length > 0 ? `, wrote ${file.written.join(", ")}` : ""}`
639
+ );
640
+ }
641
+ const differences = [
642
+ ...(file.configDifferences ?? []).map(
643
+ (difference) => `${difference.key}: ${difference.before ?? "unset"} -> ${difference.after ?? "unset"}`
644
+ ),
645
+ ...file.resolutionDifferences ?? []
646
+ ];
647
+ for (const line of differences.slice(0, SHOWN_DIFFERENCES)) lines.push(` ${line}`);
648
+ if (differences.length > SHOWN_DIFFERENCES) {
649
+ lines.push(` \u2026 ${differences.length - SHOWN_DIFFERENCES} more, all of them under --json`);
650
+ }
651
+ }
652
+ for (const note of migration.notes) lines.push(` note: ${note}`);
653
+ return `${lines.join("\n")}
654
+ `;
655
+ }
656
+
598
657
  // src/cli/run-validate.ts
599
658
  async function runValidate(ctx) {
600
659
  const { modules } = resolveContext(ctx.cwd, { module: ctx.module, ci: ctx.ci });
@@ -607,7 +666,7 @@ async function runValidate(ctx) {
607
666
  );
608
667
  }
609
668
  if (!ctx.targets.includes("test")) return 1;
610
- const { validateModuleTests } = await import("../validate-D7MW2XE6.js");
669
+ const { validateModuleTests } = await import("../validate-4GMB32V7.js");
611
670
  const outcomes = modules.flatMap(
612
671
  (module) => validateModuleTests(module.name, module.root)
613
672
  );
@@ -647,6 +706,10 @@ var RULE_BLOCKS = [
647
706
  { key: "deferred", label: "deferred (phase 1, non-breaking):" },
648
707
  { key: "disabled", label: "not enforced, by decision:" },
649
708
  { key: "downgraded", label: "reported, but not blocking:" },
709
+ // The same two states, decided by a preset override for some files only (the lint role's test
710
+ // files). Each reason names the files, as `added` does.
711
+ { key: "disabledInFiles", label: "not enforced, by decision, in some files:" },
712
+ { key: "downgradedInFiles", label: "reported, but not blocking, in some files:" },
650
713
  // The format role's equivalent. A rule parked and an option overridden are the same kind of
651
714
  // fact: this module deliberately does not do what the standard says, and someone should be
652
715
  // able to see every such decision in one place, with the reason beside it.
@@ -659,7 +722,15 @@ var RULE_BLOCKS = [
659
722
  // The other direction, and listed for the same reason: a rule a module adds to its lint
660
723
  // preset is not drift, so nothing else on the row would ever show it was there.
661
724
  { key: "added", label: "added by the module (kept by --init, not drift):" },
662
- { key: "addedConfig", label: "config added by the module (kept by --init, not drift):" }
725
+ { key: "addedConfig", label: "config added by the module (kept by --init, not drift):" },
726
+ // TypeScript's two: an option the preset took over from the base, set to another value by the
727
+ // module (kept, so `conformant` cannot show it), and the debt a migrated module takes from
728
+ // `legacy`. Both are this module departing from the standard, named.
729
+ {
730
+ key: "standardOverrides",
731
+ label: "differs from the repo standard (kept by --init, not drift):"
732
+ },
733
+ { key: "legacyCompromises", label: "inherited compromises (debt to remove):" }
663
734
  ];
664
735
  var MAX_INLINE_WIDTH = 60;
665
736
  function renderValue(key, value, p) {
@@ -841,9 +912,8 @@ async function runVerb(ctx) {
841
912
  for (const item of summary.results) process.stdout.write(renderStatusRow(item, out) + "\n");
842
913
  process.stdout.write(renderStatusSummary(summary.results, out) + "\n");
843
914
  } else {
844
- const rows = ctx.toolArgs.length > 0 && ctx.targets.every((target) => STDOUT_PHASE_TARGETS.includes(target)) ? process.stderr : process.stdout;
845
915
  for (const item of summary.results) {
846
- rows.write(renderSummary(item, rows === process.stdout ? out : palette(rows)) + "\n");
916
+ process.stdout.write(renderSummary(item, out) + "\n");
847
917
  }
848
918
  }
849
919
  if (!ctx.json && ctx.verb === "inspect") {
@@ -878,35 +948,6 @@ async function runVerb(ctx) {
878
948
  return ctx.verb === "run" || ctx.ci ? worstCode : 0;
879
949
  }
880
950
 
881
- // src/core/repository-root.ts
882
- import { execFileSync } from "node:child_process";
883
- import { realpathSync as realpathSync2 } from "node:fs";
884
- function findRepositoryRoot(cwd2) {
885
- try {
886
- const root = execFileSync("git", ["rev-parse", "--show-toplevel"], {
887
- cwd: cwd2,
888
- encoding: "utf8",
889
- stdio: ["ignore", "pipe", "ignore"]
890
- }).trim();
891
- return root === "" ? void 0 : realpathSync2(root);
892
- } catch {
893
- return void 0;
894
- }
895
- }
896
- function isRepositoryRoot(cwd2, root) {
897
- try {
898
- return realpathSync2(cwd2) === root;
899
- } catch {
900
- return false;
901
- }
902
- }
903
- function locateRepository(cwd2) {
904
- const root = findRepositoryRoot(cwd2);
905
- if (root === void 0) return { ok: false, reason: "not-a-repository" };
906
- if (!isRepositoryRoot(cwd2, root)) return { ok: false, reason: "not-the-root", root };
907
- return { ok: true, root };
908
- }
909
-
910
951
  // src/shared/node-version.ts
911
952
  var MIN_NODE = "24.15.0";
912
953
  function parts(version) {
@@ -941,6 +982,8 @@ var TARGET_HELP = {
941
982
  dev: "dev server (long-running: never swept by an unqualified --run)",
942
983
  test: "tests",
943
984
  "static-analysis": "duplication, dead code, complexity, import graph, file size, bundle weight",
985
+ sql: "migrations and Unsafe raw SQL calls, in the modules that hold them",
986
+ "code-churn": "the share of new lines rewritten or deleted within weeks, read from git history",
944
987
  env: "env files, contracts and Dockerfiles, for the whole repository (run from its root)",
945
988
  "runtime-analysis": "Lighthouse, web vitals",
946
989
  arch: "architecture boundaries"
@@ -949,13 +992,16 @@ program.name("sentinel").description("One CLI that guards code health: presets,
949
992
  "before",
950
993
  [
951
994
  "A check composes: verb + type + location.",
952
- " verb what to do: --run --inspect --report --status --init --validate (--migrate: planned)",
995
+ " verb what to do: --run --inspect --report --status --init --migrate --validate",
953
996
  " type which check: --lint --typescript ... (omit = all types; or --all)",
954
997
  " where run from a MODULE dir \u2192 that module; from the ROOT \u2192 --module <name>,",
955
998
  " --ci (affected), or all modules. --init targets one module only.",
956
999
  ""
957
1000
  ].join("\n")
958
- ).option("--run", "execute the target tool").option("--inspect", "show the resolved configuration").option("--init", "set up a module: write its config stubs + the workspace prep it needs").option("--migrate", "planned: change an already-initialized setup (not available yet)").option(
1001
+ ).option("--run", "execute the target tool").option("--inspect", "show the resolved configuration").option("--init", "set up a module: write its config stubs + the workspace prep it needs").option(
1002
+ "--migrate",
1003
+ "change an already-initialized setup: --typescript detaches the module from tsconfig.base.json"
1004
+ ).option(
959
1005
  "--validate",
960
1006
  "prove a migration kept the suite: record the reference, then compare against it"
961
1007
  ).option("--report", "deprecated: use --run --json").option("--status", "deprecated: use --inspect").option(
@@ -1123,10 +1169,12 @@ function parseEnvLevel(value) {
1123
1169
  var envLevel = targets.some((target) => REPOSITORY_TARGETS.includes(target)) ? parseEnvLevel(process.env.SENTINEL_ENV_LEVEL) : DEFAULT_ENV_LEVEL;
1124
1170
  var githubActions = process.env.GITHUB_ACTIONS === "true";
1125
1171
  var targetsExplicit = !(opts.all || namedTargets.length === 0);
1126
- if (namedTargets.includes("static-analysis") && (verb === "report" || verb === "run" && opts.json)) {
1127
- program.error(
1128
- `sentinel: --static-analysis writes its own report, so ${verb === "report" ? "--report" : "--json"} has nothing to add to it. Run it bare for the console report, or with --output json|html|markdown for the files.`
1129
- );
1172
+ for (const reporting of ["static-analysis", "sql", "code-churn"]) {
1173
+ if (namedTargets.includes(reporting) && (verb === "report" || verb === "run" && opts.json)) {
1174
+ program.error(
1175
+ `sentinel: --${reporting} writes its own report, so ${verb === "report" ? "--report" : "--json"} has nothing to add to it. Run it bare for the console report, or with --output json|html|markdown for the files.`
1176
+ );
1177
+ }
1130
1178
  }
1131
1179
  var maxDiagnostics = Number(opts.maxDiagnostics);
1132
1180
  if (!Number.isInteger(maxDiagnostics) || maxDiagnostics < 0) {
@@ -1134,8 +1182,8 @@ if (!Number.isInteger(maxDiagnostics) || maxDiagnostics < 0) {
1134
1182
  `--max-diagnostics must be a non-negative integer (0 = no cap); got ${JSON.stringify(opts.maxDiagnostics)}.`
1135
1183
  );
1136
1184
  }
1137
- if (opts.dryRun && verb !== "init") {
1138
- program.error("--dry-run only applies to --init (the read verbs never write).");
1185
+ if (opts.dryRun && verb !== "init" && verb !== "migrate") {
1186
+ program.error("--dry-run only applies to --init and --migrate (the read verbs never write).");
1139
1187
  }
1140
1188
  if (opts.rehearse && !opts.dryRun) {
1141
1189
  program.error(
@@ -1161,9 +1209,6 @@ async function exitWithoutTruncating(code) {
1161
1209
  await new Promise((resolve2) => stream.once("drain", () => resolve2()));
1162
1210
  }
1163
1211
  async function main() {
1164
- if (verb === "migrate") {
1165
- program.error("--migrate is planned and not available yet; use --init to set a module up.");
1166
- }
1167
1212
  const context = {
1168
1213
  verb,
1169
1214
  cwd,
@@ -1188,7 +1233,7 @@ async function main() {
1188
1233
  githubActions,
1189
1234
  fail: (message) => program.error(message)
1190
1235
  };
1191
- const exitCode = verb === "init" ? await runInit(context) : verb === "validate" ? await runValidate(context) : await runVerb(context);
1236
+ const exitCode = verb === "init" ? await runInit(context) : verb === "validate" ? await runValidate(context) : verb === "migrate" ? await runMigrate(context) : await runVerb(context);
1192
1237
  await exitWithoutTruncating(exitCode);
1193
1238
  }
1194
1239
  main().catch((error) => {