@hublo/sentinel 1.4.0-alpha.27 → 1.4.0-alpha.28
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 +32 -4
- package/dist/{chunk-ABFNJZ6C.js → chunk-J3MDCYSX.js} +315 -676
- package/dist/chunk-WYWE4VIL.js +711 -0
- package/dist/index.d.ts +18 -5
- package/dist/index.js +2 -1
- package/dist/validate-B5MYLIG4.js +127 -0
- package/docs/test-adoption.md +85 -0
- package/package.json +1 -1
package/dist/bin/sentinel.js
CHANGED
|
@@ -16,7 +16,8 @@ import {
|
|
|
16
16
|
registerAdapters,
|
|
17
17
|
resolve,
|
|
18
18
|
resolveContext
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-J3MDCYSX.js";
|
|
20
|
+
import "../chunk-WYWE4VIL.js";
|
|
20
21
|
import {
|
|
21
22
|
ensureWorkspacePrep,
|
|
22
23
|
findWorkspaceRoot,
|
|
@@ -129,6 +130,30 @@ sentinel (${type}): ${asMessage(error)}
|
|
|
129
130
|
return worst;
|
|
130
131
|
}
|
|
131
132
|
|
|
133
|
+
// src/cli/run-validate.ts
|
|
134
|
+
async function runValidate(ctx) {
|
|
135
|
+
const { modules } = resolveContext(ctx.cwd, { module: ctx.module, ci: ctx.ci });
|
|
136
|
+
const unsupported = ctx.targets.filter((target) => target !== "test");
|
|
137
|
+
if (ctx.targetsExplicit && unsupported.length > 0) {
|
|
138
|
+
ctx.fail(
|
|
139
|
+
`--validate answers --test today, and nothing else yet. Asked for ${unsupported.map((t) => `--${t}`).join(", ")}.`
|
|
140
|
+
);
|
|
141
|
+
return 1;
|
|
142
|
+
}
|
|
143
|
+
const { validateModuleTests } = await import("../validate-B5MYLIG4.js");
|
|
144
|
+
const outcomes = modules.flatMap(
|
|
145
|
+
(module) => validateModuleTests(module.name, module.root)
|
|
146
|
+
);
|
|
147
|
+
for (const outcome of outcomes) {
|
|
148
|
+
const suite = outcome.suite === "main" ? "" : ` [${outcome.suite}]`;
|
|
149
|
+
process.stdout.write(
|
|
150
|
+
` ${outcome.ok ? "\u2713" : "\u2717"} ${outcome.module}${suite} \u2014 ${outcome.message}
|
|
151
|
+
`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
return outcomes.every((outcome) => outcome.ok) ? 0 : 1;
|
|
155
|
+
}
|
|
156
|
+
|
|
132
157
|
// src/core/orchestrate.ts
|
|
133
158
|
async function analyse(params) {
|
|
134
159
|
const results = [];
|
|
@@ -556,13 +581,16 @@ program.name("sentinel").description("One CLI that guards code health: presets,
|
|
|
556
581
|
"before",
|
|
557
582
|
[
|
|
558
583
|
"A check composes: verb + type + location.",
|
|
559
|
-
" verb what to do: --run --inspect --report --status --init (--migrate: planned)",
|
|
584
|
+
" verb what to do: --run --inspect --report --status --init --validate (--migrate: planned)",
|
|
560
585
|
" type which check: --lint --typescript ... (omit = all types; or --all)",
|
|
561
586
|
" where run from a MODULE dir \u2192 that module; from the ROOT \u2192 --module <name>,",
|
|
562
587
|
" --ci (affected), or all modules. --init targets one module only.",
|
|
563
588
|
""
|
|
564
589
|
].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(
|
|
590
|
+
).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
|
+
"--validate",
|
|
592
|
+
"prove a migration kept the suite: record the reference, then compare against it"
|
|
593
|
+
).option("--report", "deprecated: use --run --json").option("--status", "deprecated: use --inspect").option(
|
|
566
594
|
"--module <name>",
|
|
567
595
|
"from the workspace root: scope to one module (omit = all; inside a module dir, drop this)"
|
|
568
596
|
).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 +722,7 @@ async function main() {
|
|
|
694
722
|
dryRun: Boolean(opts.dryRun),
|
|
695
723
|
fail: (message) => program.error(message)
|
|
696
724
|
};
|
|
697
|
-
const exitCode = verb === "init" ? await runInit(context) : await runVerb(context);
|
|
725
|
+
const exitCode = verb === "init" ? await runInit(context) : verb === "validate" ? await runValidate(context) : await runVerb(context);
|
|
698
726
|
await exitWithoutTruncating(exitCode);
|
|
699
727
|
}
|
|
700
728
|
main().catch((error) => {
|