@hublo/sentinel 1.4.0-alpha.27 → 1.4.0-alpha.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/sentinel.js +34 -5
- package/dist/chunk-2S7HPRKK.js +4739 -0
- package/dist/{chunk-ABFNJZ6C.js → chunk-KM4A6G2H.js} +231 -4607
- package/dist/index.d.ts +18 -5
- package/dist/index.js +4 -2
- package/dist/validate-OYMXIGHU.js +129 -0
- package/docs/test-adoption.md +85 -0
- package/package.json +1 -1
package/dist/bin/sentinel.js
CHANGED
|
@@ -14,9 +14,11 @@ import {
|
|
|
14
14
|
dispatch,
|
|
15
15
|
palette,
|
|
16
16
|
registerAdapters,
|
|
17
|
-
resolve
|
|
17
|
+
resolve
|
|
18
|
+
} from "../chunk-KM4A6G2H.js";
|
|
19
|
+
import {
|
|
18
20
|
resolveContext
|
|
19
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-2S7HPRKK.js";
|
|
20
22
|
import {
|
|
21
23
|
ensureWorkspacePrep,
|
|
22
24
|
findWorkspaceRoot,
|
|
@@ -129,6 +131,30 @@ sentinel (${type}): ${asMessage(error)}
|
|
|
129
131
|
return worst;
|
|
130
132
|
}
|
|
131
133
|
|
|
134
|
+
// src/cli/run-validate.ts
|
|
135
|
+
async function runValidate(ctx) {
|
|
136
|
+
const { modules } = resolveContext(ctx.cwd, { module: ctx.module, ci: ctx.ci });
|
|
137
|
+
const unsupported = ctx.targets.filter((target) => target !== "test");
|
|
138
|
+
if (ctx.targetsExplicit && unsupported.length > 0) {
|
|
139
|
+
ctx.fail(
|
|
140
|
+
`--validate answers --test today, and nothing else yet. Asked for ${unsupported.map((t) => `--${t}`).join(", ")}.`
|
|
141
|
+
);
|
|
142
|
+
return 1;
|
|
143
|
+
}
|
|
144
|
+
const { validateModuleTests } = await import("../validate-OYMXIGHU.js");
|
|
145
|
+
const outcomes = modules.flatMap(
|
|
146
|
+
(module) => validateModuleTests(module.name, module.root)
|
|
147
|
+
);
|
|
148
|
+
for (const outcome of outcomes) {
|
|
149
|
+
const suite = outcome.suite === "main" ? "" : ` [${outcome.suite}]`;
|
|
150
|
+
process.stdout.write(
|
|
151
|
+
` ${outcome.ok ? "\u2713" : "\u2717"} ${outcome.module}${suite} \u2014 ${outcome.message}
|
|
152
|
+
`
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
return outcomes.every((outcome) => outcome.ok) ? 0 : 1;
|
|
156
|
+
}
|
|
157
|
+
|
|
132
158
|
// src/core/orchestrate.ts
|
|
133
159
|
async function analyse(params) {
|
|
134
160
|
const results = [];
|
|
@@ -556,13 +582,16 @@ program.name("sentinel").description("One CLI that guards code health: presets,
|
|
|
556
582
|
"before",
|
|
557
583
|
[
|
|
558
584
|
"A check composes: verb + type + location.",
|
|
559
|
-
" verb what to do: --run --inspect --report --status --init (--migrate: planned)",
|
|
585
|
+
" verb what to do: --run --inspect --report --status --init --validate (--migrate: planned)",
|
|
560
586
|
" type which check: --lint --typescript ... (omit = all types; or --all)",
|
|
561
587
|
" where run from a MODULE dir \u2192 that module; from the ROOT \u2192 --module <name>,",
|
|
562
588
|
" --ci (affected), or all modules. --init targets one module only.",
|
|
563
589
|
""
|
|
564
590
|
].join("\n")
|
|
565
|
-
).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(
|
|
591
|
+
).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(
|
|
592
|
+
"--validate",
|
|
593
|
+
"prove a migration kept the suite: record the reference, then compare against it"
|
|
594
|
+
).option("--report", "deprecated: use --run --json").option("--status", "deprecated: use --inspect").option(
|
|
566
595
|
"--module <name>",
|
|
567
596
|
"from the workspace root: scope to one module (omit = all; inside a module dir, drop this)"
|
|
568
597
|
).option("--preset <name>", `the stack preset to apply (${PRESET_NAMES.join(", ")})`).option("--flavour <name>", "deprecated: use --preset").option("--runner <tool>", "override the default runner (e.g. eslint, biome)").option("--ci", "CI mode: from the root, only the affected modules; non-zero exit on failure").option("--fix", "auto-fix where applicable").option("--dry-run", "preview the changes without writing (--init)").option("--json", "machine-readable output, for every verb").option(
|
|
@@ -694,7 +723,7 @@ async function main() {
|
|
|
694
723
|
dryRun: Boolean(opts.dryRun),
|
|
695
724
|
fail: (message) => program.error(message)
|
|
696
725
|
};
|
|
697
|
-
const exitCode = verb === "init" ? await runInit(context) : await runVerb(context);
|
|
726
|
+
const exitCode = verb === "init" ? await runInit(context) : verb === "validate" ? await runValidate(context) : await runVerb(context);
|
|
698
727
|
await exitWithoutTruncating(exitCode);
|
|
699
728
|
}
|
|
700
729
|
main().catch((error) => {
|