@hublo/sentinel 1.7.0-alpha.3 → 1.7.0-alpha.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/bin/sentinel.js +95 -82
- package/dist/chunk-2DUG6GVU.js +19301 -0
- package/dist/chunk-F5WISUN3.js +17 -0
- package/dist/chunk-F5WISUN3.js.map +1 -0
- package/dist/{chunk-P6KTBQ2Q.js → chunk-FZLUCPST.js} +24 -15
- package/dist/{chunk-ZNANJEMK.js → chunk-KKHKRY7P.js} +40 -16
- package/dist/chunk-KKHKRY7P.js.map +1 -0
- package/dist/chunk-NE3IEJBN.js +59 -0
- package/dist/chunk-NE3IEJBN.js.map +1 -0
- package/dist/chunk-NGLEGAEN.js +190 -0
- package/dist/chunk-NGLEGAEN.js.map +1 -0
- package/dist/chunk-PXTU5MPW.js +9 -0
- package/dist/chunk-PXTU5MPW.js.map +1 -0
- package/dist/{chunk-4YQXLPJ5.js → chunk-QMIJ4ZGJ.js} +2 -2
- package/dist/chunk-TMVKYXZ3.js +18 -0
- package/dist/chunk-TMVKYXZ3.js.map +1 -0
- package/dist/chunk-U7G2Y6YC.js +15 -0
- package/dist/chunk-U7G2Y6YC.js.map +1 -0
- package/dist/chunk-VWASE6NN.js +34 -0
- package/dist/chunk-VWASE6NN.js.map +1 -0
- package/dist/{chunk-THTXP2QU.js → chunk-XMAXE2Q2.js} +10 -7
- package/dist/chunk-XMAXE2Q2.js.map +1 -0
- package/dist/chunk-XYOIXC6A.js +126 -0
- package/dist/chunk-XYOIXC6A.js.map +1 -0
- package/dist/chunk-ZZMYV576.js +297 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -5
- package/dist/{migrate-NWQ3LYER.js → migrate-X7PB2X7R.js} +237 -228
- package/dist/roles/arch/config.d.ts +25 -0
- package/dist/roles/arch/config.js +8 -0
- package/dist/roles/arch/config.js.map +1 -0
- package/dist/roles/build/nest/toolchain.js +3 -3
- package/dist/roles/code-churn/config.d.ts +92 -0
- package/dist/roles/code-churn/config.js +10 -0
- package/dist/roles/code-churn/config.js.map +1 -0
- package/dist/roles/runtime-analysis/config.d.ts +97 -0
- package/dist/roles/runtime-analysis/config.js +10 -0
- package/dist/roles/runtime-analysis/config.js.map +1 -0
- package/dist/roles/runtime-analysis/gateway.d.ts +2 -0
- package/dist/roles/runtime-analysis/gateway.js +89 -0
- package/dist/roles/runtime-analysis/gateway.js.map +1 -0
- package/dist/roles/runtime-analysis/mock-api.d.ts +2 -0
- package/dist/roles/runtime-analysis/mock-api.js +43 -0
- package/dist/roles/runtime-analysis/mock-api.js.map +1 -0
- package/dist/roles/sql/config.d.ts +68 -0
- package/dist/roles/sql/config.js +8 -0
- package/dist/roles/sql/config.js.map +1 -0
- package/dist/roles/static-analysis/config.js +2 -1
- package/dist/roles/test/setup/file-boundary.js +3 -3
- package/dist/roles/test/setup/jest-parity.js +4 -4
- package/dist/roles/test/setup/workspace-entry.js +2 -2
- package/dist/{validate-4V3EGTXN.js → validate-GTBRD2M4.js} +2 -2
- package/docs/arch-adoption.md +201 -0
- package/docs/code-churn-adoption.md +237 -0
- package/docs/runtime-analysis-adoption.md +198 -0
- package/docs/sql-adoption.md +598 -0
- package/docs/static-analysis-adoption.md +1 -1
- package/docs/static-analysis-study.md +49 -10
- package/docs/typescript-adoption.md +47 -6
- package/docs/typescript-traces.md +512 -8
- package/docs/using-sentinel.md +4 -2
- package/package.json +25 -2
- package/runtime-analysis-deps/load.mjs +6 -0
- package/runtime-analysis-deps/package-lock.json +1766 -0
- package/runtime-analysis-deps/package.json +11 -0
- package/dist/chunk-F6ART7RH.js +0 -9555
- package/dist/chunk-THTXP2QU.js.map +0 -1
- package/dist/chunk-ZNANJEMK.js.map +0 -1
- /package/dist/{chunk-4YQXLPJ5.js.map → chunk-QMIJ4ZGJ.js.map} +0 -0
package/README.md
CHANGED
|
@@ -176,7 +176,10 @@ 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 and the `Prisma.raw` calls a branch adds or changes: the two steps, the 52 rules on by default and the 26 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`.
|
|
182
|
+
- [`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.
|
|
180
183
|
- [`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`.
|
|
181
184
|
|
|
182
185
|
## Architecture: `target → runner → preset`
|
|
@@ -255,6 +258,7 @@ The rules live in `sentinel`. Each module keeps a **thin, generated stub** per t
|
|
|
255
258
|
- **Rules in sentinel** — one source of truth, versioned.
|
|
256
259
|
- **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.
|
|
257
260
|
- **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)).
|
|
261
|
+
- **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)).
|
|
258
262
|
- **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.
|
|
259
263
|
- **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.
|
|
260
264
|
|
package/dist/bin/sentinel.js
CHANGED
|
@@ -8,23 +8,30 @@ 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-
|
|
16
|
+
} from "../chunk-2DUG6GVU.js";
|
|
17
|
+
import "../chunk-ZZMYV576.js";
|
|
16
18
|
import {
|
|
17
19
|
resolveContext,
|
|
18
20
|
separateToolArgs
|
|
19
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-FZLUCPST.js";
|
|
20
22
|
import "../chunk-ZFG6P27V.js";
|
|
23
|
+
import "../chunk-NE3IEJBN.js";
|
|
24
|
+
import "../chunk-VWASE6NN.js";
|
|
25
|
+
import "../chunk-O7REVMOC.js";
|
|
26
|
+
import "../chunk-H4HAFJFZ.js";
|
|
27
|
+
import "../chunk-QXFCZON7.js";
|
|
21
28
|
import {
|
|
22
29
|
ensureWorkspacePrep,
|
|
23
30
|
findWorkspaceRoot,
|
|
24
31
|
inspectWorkspacePrep,
|
|
25
32
|
readOwnVersion,
|
|
26
33
|
readProjectPackageJson
|
|
27
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-KKHKRY7P.js";
|
|
28
35
|
import {
|
|
29
36
|
DEFAULT_ENV_LEVEL,
|
|
30
37
|
ENV_LEVELS,
|
|
@@ -32,14 +39,18 @@ import {
|
|
|
32
39
|
OUTPUT_SHAPES,
|
|
33
40
|
PRESET_NAMES,
|
|
34
41
|
REPOSITORY_TARGETS,
|
|
42
|
+
STDOUT_PHASE_TARGETS,
|
|
35
43
|
SWEEPABLE_TARGETS,
|
|
36
44
|
TARGETS,
|
|
37
45
|
VERBS
|
|
38
|
-
} from "../chunk-
|
|
46
|
+
} from "../chunk-XMAXE2Q2.js";
|
|
47
|
+
import "../chunk-TMVKYXZ3.js";
|
|
48
|
+
import "../chunk-NGLEGAEN.js";
|
|
49
|
+
import "../chunk-XYOIXC6A.js";
|
|
50
|
+
import "../chunk-PXTU5MPW.js";
|
|
51
|
+
import "../chunk-U7G2Y6YC.js";
|
|
52
|
+
import "../chunk-F5WISUN3.js";
|
|
39
53
|
import "../chunk-4EIY7TTR.js";
|
|
40
|
-
import "../chunk-O7REVMOC.js";
|
|
41
|
-
import "../chunk-H4HAFJFZ.js";
|
|
42
|
-
import "../chunk-QXFCZON7.js";
|
|
43
54
|
|
|
44
55
|
// bin/sentinel.ts
|
|
45
56
|
import { program } from "commander";
|
|
@@ -484,6 +495,7 @@ async function runInit(ctx) {
|
|
|
484
495
|
outcomes.push(outcome);
|
|
485
496
|
};
|
|
486
497
|
const planned = [];
|
|
498
|
+
const dependenciesBefore = declaredDependencies(module.root);
|
|
487
499
|
let worst = 0;
|
|
488
500
|
for (const type of toRun) {
|
|
489
501
|
try {
|
|
@@ -549,18 +561,21 @@ sentinel (${type}): ${asMessage(error)}
|
|
|
549
561
|
// Only when the FORMAT role actually adopted: a module still formatted by the root
|
|
550
562
|
// must not be excluded from it.
|
|
551
563
|
formattedModule: toRun.includes("format") ? module.root : void 0,
|
|
552
|
-
// Same rule for the report
|
|
553
|
-
|
|
564
|
+
// Same rule for the report directories: only for a role that writes reports and adopted.
|
|
565
|
+
adoptedRoles: toRun
|
|
554
566
|
});
|
|
555
567
|
workspace = changes;
|
|
556
568
|
const prefix = ctx.dryRun ? " dry run: " : " ";
|
|
557
569
|
for (const change of changes) process.stderr.write(`${prefix}${change}
|
|
558
570
|
`);
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
571
|
+
}
|
|
572
|
+
const hint = installHint(
|
|
573
|
+
workspace.length > 0,
|
|
574
|
+
declaredDependencies(module.root) !== dependenciesBefore
|
|
575
|
+
);
|
|
576
|
+
if (hint !== void 0 && !ctx.dryRun) {
|
|
577
|
+
process.stderr.write(palette(process.stderr).dim(` ${hint}
|
|
578
|
+
`));
|
|
564
579
|
}
|
|
565
580
|
}
|
|
566
581
|
if (ctx.json) {
|
|
@@ -574,6 +589,19 @@ sentinel (${type}): ${asMessage(error)}
|
|
|
574
589
|
}
|
|
575
590
|
return worst;
|
|
576
591
|
}
|
|
592
|
+
function declaredDependencies(root) {
|
|
593
|
+
const { dependencies = {}, devDependencies = {} } = readProjectPackageJson(root);
|
|
594
|
+
const sorted = (map) => Object.entries(map).sort(([a], [b]) => a.localeCompare(b));
|
|
595
|
+
return JSON.stringify([sorted(dependencies), sorted(devDependencies)]);
|
|
596
|
+
}
|
|
597
|
+
function installHint(workspaceChanged, dependenciesChanged) {
|
|
598
|
+
if (!workspaceChanged && !dependenciesChanged) return void 0;
|
|
599
|
+
const what = [
|
|
600
|
+
workspaceChanged ? "the workspace changes" : void 0,
|
|
601
|
+
dependenciesChanged ? "this module's new dependencies" : void 0
|
|
602
|
+
].filter((part) => part !== void 0);
|
|
603
|
+
return `run \`pnpm install\` to apply ${what.join(" and ")}, and commit pnpm-lock.yaml if it changed`;
|
|
604
|
+
}
|
|
577
605
|
|
|
578
606
|
// src/cli/run-migrate.ts
|
|
579
607
|
async function runMigrate(ctx) {
|
|
@@ -593,45 +621,42 @@ async function runMigrate(ctx) {
|
|
|
593
621
|
);
|
|
594
622
|
}
|
|
595
623
|
if (!ctx.targets.includes("typescript")) return 1;
|
|
596
|
-
const { migrateModule } = await import("../migrate-
|
|
624
|
+
const { migrateModule } = await import("../migrate-X7PB2X7R.js");
|
|
597
625
|
const migration = migrateModule(module.root, {
|
|
598
626
|
write: !ctx.dryRun,
|
|
599
627
|
workspaceRoot: findWorkspaceRoot(module.root) ?? module.root
|
|
600
628
|
});
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
629
|
+
process.stdout.write(
|
|
630
|
+
ctx.json ? `${JSON.stringify({ module: module.name, target: "typescript", ...migration }, null, 2)}
|
|
631
|
+
` : renderMigration(module.name, migration)
|
|
632
|
+
);
|
|
633
|
+
return migration.outcome === "migrated" || migration.outcome === "proved" || migration.outcome === "skipped" ? 0 : 1;
|
|
634
|
+
}
|
|
635
|
+
var SHOWN_DIFFERENCES = 20;
|
|
636
|
+
function renderMigration(name, migration) {
|
|
637
|
+
const mark = migration.outcome === "migrated" || migration.outcome === "proved" ? "\u2713" : migration.outcome === "skipped" ? "\xB7" : "\u2717";
|
|
638
|
+
const lines = [` ${mark} ${name} \u2014 ${migration.message}`];
|
|
639
|
+
for (const file of migration.files) {
|
|
640
|
+
lines.push(` ${file.kept ? "\u2713" : "\xB7"} ${file.file}${file.reason ? `: ${file.reason}` : ""}`);
|
|
641
|
+
if (file.aliases !== void 0) {
|
|
642
|
+
lines.push(
|
|
643
|
+
` ${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(", ")}` : ""}`
|
|
614
644
|
);
|
|
615
|
-
if (file.aliases !== void 0) {
|
|
616
|
-
process.stdout.write(
|
|
617
|
-
` ${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(", ")}` : ""}
|
|
618
|
-
`
|
|
619
|
-
);
|
|
620
|
-
}
|
|
621
|
-
for (const line of [
|
|
622
|
-
...(file.configDifferences ?? []).map(
|
|
623
|
-
(d) => `${d.key}: ${d.before ?? "unset"} -> ${d.after ?? "unset"}`
|
|
624
|
-
),
|
|
625
|
-
...file.resolutionDifferences ?? []
|
|
626
|
-
].slice(0, 20)) {
|
|
627
|
-
process.stdout.write(` ${line}
|
|
628
|
-
`);
|
|
629
|
-
}
|
|
630
645
|
}
|
|
631
|
-
|
|
632
|
-
|
|
646
|
+
const differences = [
|
|
647
|
+
...(file.configDifferences ?? []).map(
|
|
648
|
+
(difference) => `${difference.key}: ${difference.before ?? "unset"} -> ${difference.after ?? "unset"}`
|
|
649
|
+
),
|
|
650
|
+
...file.resolutionDifferences ?? []
|
|
651
|
+
];
|
|
652
|
+
for (const line of differences.slice(0, SHOWN_DIFFERENCES)) lines.push(` ${line}`);
|
|
653
|
+
if (differences.length > SHOWN_DIFFERENCES) {
|
|
654
|
+
lines.push(` \u2026 ${differences.length - SHOWN_DIFFERENCES} more, all of them under --json`);
|
|
655
|
+
}
|
|
633
656
|
}
|
|
634
|
-
|
|
657
|
+
for (const note of migration.notes) lines.push(` note: ${note}`);
|
|
658
|
+
return `${lines.join("\n")}
|
|
659
|
+
`;
|
|
635
660
|
}
|
|
636
661
|
|
|
637
662
|
// src/cli/run-validate.ts
|
|
@@ -646,7 +671,7 @@ async function runValidate(ctx) {
|
|
|
646
671
|
);
|
|
647
672
|
}
|
|
648
673
|
if (!ctx.targets.includes("test")) return 1;
|
|
649
|
-
const { validateModuleTests } = await import("../validate-
|
|
674
|
+
const { validateModuleTests } = await import("../validate-GTBRD2M4.js");
|
|
650
675
|
const outcomes = modules.flatMap(
|
|
651
676
|
(module) => validateModuleTests(module.name, module.root)
|
|
652
677
|
);
|
|
@@ -686,6 +711,10 @@ var RULE_BLOCKS = [
|
|
|
686
711
|
{ key: "deferred", label: "deferred (phase 1, non-breaking):" },
|
|
687
712
|
{ key: "disabled", label: "not enforced, by decision:" },
|
|
688
713
|
{ key: "downgraded", label: "reported, but not blocking:" },
|
|
714
|
+
// The same two states, decided by a preset override for some files only (the lint role's test
|
|
715
|
+
// files). Each reason names the files, as `added` does.
|
|
716
|
+
{ key: "disabledInFiles", label: "not enforced, by decision, in some files:" },
|
|
717
|
+
{ key: "downgradedInFiles", label: "reported, but not blocking, in some files:" },
|
|
689
718
|
// The format role's equivalent. A rule parked and an option overridden are the same kind of
|
|
690
719
|
// fact: this module deliberately does not do what the standard says, and someone should be
|
|
691
720
|
// able to see every such decision in one place, with the reason beside it.
|
|
@@ -698,7 +727,15 @@ var RULE_BLOCKS = [
|
|
|
698
727
|
// The other direction, and listed for the same reason: a rule a module adds to its lint
|
|
699
728
|
// preset is not drift, so nothing else on the row would ever show it was there.
|
|
700
729
|
{ key: "added", label: "added by the module (kept by --init, not drift):" },
|
|
701
|
-
{ key: "addedConfig", label: "config added by the module (kept by --init, not drift):" }
|
|
730
|
+
{ key: "addedConfig", label: "config added by the module (kept by --init, not drift):" },
|
|
731
|
+
// TypeScript's two: an option the preset took over from the base, set to another value by the
|
|
732
|
+
// module (kept, so `conformant` cannot show it), and the debt a migrated module takes from
|
|
733
|
+
// `legacy`. Both are this module departing from the standard, named.
|
|
734
|
+
{
|
|
735
|
+
key: "standardOverrides",
|
|
736
|
+
label: "differs from the repo standard (kept by --init, not drift):"
|
|
737
|
+
},
|
|
738
|
+
{ key: "legacyCompromises", label: "inherited compromises (debt to remove):" }
|
|
702
739
|
];
|
|
703
740
|
var MAX_INLINE_WIDTH = 60;
|
|
704
741
|
function renderValue(key, value, p) {
|
|
@@ -880,8 +917,9 @@ async function runVerb(ctx) {
|
|
|
880
917
|
for (const item of summary.results) process.stdout.write(renderStatusRow(item, out) + "\n");
|
|
881
918
|
process.stdout.write(renderStatusSummary(summary.results, out) + "\n");
|
|
882
919
|
} else {
|
|
920
|
+
const rows = ctx.toolArgs.length > 0 && ctx.targets.every((target) => STDOUT_PHASE_TARGETS.includes(target)) ? process.stderr : process.stdout;
|
|
883
921
|
for (const item of summary.results) {
|
|
884
|
-
|
|
922
|
+
rows.write(renderSummary(item, rows === process.stdout ? out : palette(rows)) + "\n");
|
|
885
923
|
}
|
|
886
924
|
}
|
|
887
925
|
if (!ctx.json && ctx.verb === "inspect") {
|
|
@@ -916,35 +954,6 @@ async function runVerb(ctx) {
|
|
|
916
954
|
return ctx.verb === "run" || ctx.ci ? worstCode : 0;
|
|
917
955
|
}
|
|
918
956
|
|
|
919
|
-
// src/core/repository-root.ts
|
|
920
|
-
import { execFileSync } from "node:child_process";
|
|
921
|
-
import { realpathSync as realpathSync2 } from "node:fs";
|
|
922
|
-
function findRepositoryRoot(cwd2) {
|
|
923
|
-
try {
|
|
924
|
-
const root = execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
925
|
-
cwd: cwd2,
|
|
926
|
-
encoding: "utf8",
|
|
927
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
928
|
-
}).trim();
|
|
929
|
-
return root === "" ? void 0 : realpathSync2(root);
|
|
930
|
-
} catch {
|
|
931
|
-
return void 0;
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
function isRepositoryRoot(cwd2, root) {
|
|
935
|
-
try {
|
|
936
|
-
return realpathSync2(cwd2) === root;
|
|
937
|
-
} catch {
|
|
938
|
-
return false;
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
function locateRepository(cwd2) {
|
|
942
|
-
const root = findRepositoryRoot(cwd2);
|
|
943
|
-
if (root === void 0) return { ok: false, reason: "not-a-repository" };
|
|
944
|
-
if (!isRepositoryRoot(cwd2, root)) return { ok: false, reason: "not-the-root", root };
|
|
945
|
-
return { ok: true, root };
|
|
946
|
-
}
|
|
947
|
-
|
|
948
957
|
// src/shared/node-version.ts
|
|
949
958
|
var MIN_NODE = "24.15.0";
|
|
950
959
|
function parts(version) {
|
|
@@ -979,6 +988,8 @@ var TARGET_HELP = {
|
|
|
979
988
|
dev: "dev server (long-running: never swept by an unqualified --run)",
|
|
980
989
|
test: "tests",
|
|
981
990
|
"static-analysis": "duplication, dead code, complexity, import graph, file size, bundle weight",
|
|
991
|
+
sql: "migrations and Unsafe raw SQL calls, in the modules that hold them",
|
|
992
|
+
"code-churn": "the share of new lines rewritten or deleted within weeks, read from git history",
|
|
982
993
|
env: "env files, contracts and Dockerfiles, for the whole repository (run from its root)",
|
|
983
994
|
"runtime-analysis": "Lighthouse, web vitals",
|
|
984
995
|
arch: "architecture boundaries"
|
|
@@ -1164,10 +1175,12 @@ function parseEnvLevel(value) {
|
|
|
1164
1175
|
var envLevel = targets.some((target) => REPOSITORY_TARGETS.includes(target)) ? parseEnvLevel(process.env.SENTINEL_ENV_LEVEL) : DEFAULT_ENV_LEVEL;
|
|
1165
1176
|
var githubActions = process.env.GITHUB_ACTIONS === "true";
|
|
1166
1177
|
var targetsExplicit = !(opts.all || namedTargets.length === 0);
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1178
|
+
for (const reporting of ["static-analysis", "sql", "code-churn"]) {
|
|
1179
|
+
if (namedTargets.includes(reporting) && (verb === "report" || verb === "run" && opts.json)) {
|
|
1180
|
+
program.error(
|
|
1181
|
+
`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.`
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1171
1184
|
}
|
|
1172
1185
|
var maxDiagnostics = Number(opts.maxDiagnostics);
|
|
1173
1186
|
if (!Number.isInteger(maxDiagnostics) || maxDiagnostics < 0) {
|