@hublo/sentinel 1.7.0-alpha.21 → 1.7.0-alpha.22

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 (33) hide show
  1. package/README.md +2 -1
  2. package/dist/bin/sentinel.js +9 -37
  3. package/dist/{chunk-UVXXEAHU.js → chunk-F3Q3JQJ6.js} +6 -4
  4. package/dist/{chunk-XTBHIKFG.js → chunk-JT7ZMH44.js} +5 -5
  5. package/dist/chunk-JT7ZMH44.js.map +1 -0
  6. package/dist/{chunk-BBNABWZ6.js → chunk-LX7EG6PJ.js} +2 -2
  7. package/dist/chunk-LX7EG6PJ.js.map +1 -0
  8. package/dist/chunk-NGLEGAEN.js +190 -0
  9. package/dist/chunk-NGLEGAEN.js.map +1 -0
  10. package/dist/{chunk-J2RMARWP.js → chunk-PMRL4MH6.js} +2 -2
  11. package/dist/{chunk-RI7R3S3T.js → chunk-VSUHHETH.js} +7701 -6601
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.js +5 -5
  14. package/dist/roles/sql/config.d.ts +68 -0
  15. package/dist/roles/sql/config.js +8 -0
  16. package/dist/roles/static-analysis/config.js +1 -1
  17. package/dist/roles/test/setup/jest-parity.js +2 -2
  18. package/dist/roles/test/setup/workspace-entry.js +2 -2
  19. package/dist/{validate-YCTNTNFT.js → validate-IES226NX.js} +2 -2
  20. package/docs/sql-adoption.md +573 -0
  21. package/docs/static-analysis-study.md +10 -49
  22. package/docs/typescript-traces.md +142 -140
  23. package/docs/using-sentinel.md +2 -1
  24. package/package.json +5 -4
  25. package/dist/chunk-BBNABWZ6.js.map +0 -1
  26. package/dist/chunk-XTBHIKFG.js.map +0 -1
  27. package/dist/chunk-XYOIXC6A.js +0 -126
  28. package/dist/chunk-XYOIXC6A.js.map +0 -1
  29. package/dist/roles/code-churn/config.d.ts +0 -92
  30. package/dist/roles/code-churn/config.js +0 -10
  31. package/docs/code-churn-adoption.md +0 -237
  32. /package/dist/{chunk-J2RMARWP.js.map → chunk-PMRL4MH6.js.map} +0 -0
  33. /package/dist/roles/{code-churn → sql}/config.js.map +0 -0
package/dist/index.d.ts CHANGED
@@ -32,7 +32,7 @@ declare function registerAdapters(): void;
32
32
  declare const VERBS: readonly ["run", "inspect", "init", "migrate", "validate", "report", "status"];
33
33
  type Verb = (typeof VERBS)[number];
34
34
  /** Targets: the kind of check. The CLI `--<target>` flags map 1:1 to these. */
35
- declare const TARGETS: readonly ["lint", "format", "typescript", "build", "dev", "test", "static-analysis", "code-churn", "env", "runtime-analysis", "arch"];
35
+ declare const TARGETS: readonly ["lint", "format", "typescript", "build", "dev", "test", "static-analysis", "sql", "env", "runtime-analysis", "arch"];
36
36
  type Target = (typeof TARGETS)[number];
37
37
  /** Presets: the stack preset a project resolves to (strict by default). */
38
38
  declare const PRESET_NAMES: readonly ["react", "nest", "svelte", "node", "tools"];
package/dist/index.js CHANGED
@@ -6,13 +6,13 @@ import {
6
6
  registerAdapters,
7
7
  resolve,
8
8
  setDefaultRunner
9
- } from "./chunk-RI7R3S3T.js";
9
+ } from "./chunk-VSUHHETH.js";
10
10
  import {
11
11
  BaseAdapter
12
- } from "./chunk-UVXXEAHU.js";
13
- import "./chunk-XTBHIKFG.js";
14
- import "./chunk-BBNABWZ6.js";
15
- import "./chunk-XYOIXC6A.js";
12
+ } from "./chunk-F3Q3JQJ6.js";
13
+ import "./chunk-JT7ZMH44.js";
14
+ import "./chunk-LX7EG6PJ.js";
15
+ import "./chunk-NGLEGAEN.js";
16
16
  import "./chunk-PXTU5MPW.js";
17
17
  import "./chunk-4EIY7TTR.js";
18
18
  import "./chunk-O7REVMOC.js";
@@ -0,0 +1,68 @@
1
+ /** A rule's level. `off` is a module's decision, and the report prints it as one. */
2
+ type Severity = 'off' | 'warn' | 'error';
3
+ interface SqlDefaults {
4
+ /** The migration files squawk reads, as globs relative to the module. */
5
+ migrations: {
6
+ /**
7
+ * ⛔ `migration.sql` BY NAME, and that is what keeps the rollback scripts out. Beside the 871
8
+ * migrations sit 385 `down.sql`, 2 `drop.sql` and one `donw.sql`: scripts a human runs by hand,
9
+ * which Prisma never applies. Reading them would report every `DROP` they are made of, for a
10
+ * file that never reaches production through a deploy. Naming the file Prisma applies, rather
11
+ * than excluding the others, also keeps out the misspelling nobody would think to exclude.
12
+ */
13
+ include: string[];
14
+ /** Migrations a module chooses not to read. Empty by default. */
15
+ exclude: string[];
16
+ };
17
+ /** What the `Unsafe` rule reads. */
18
+ unsafe: {
19
+ /**
20
+ * Read the tests too. ON by default: 203 of the 226 `Unsafe` calls are in tests, and a call
21
+ * that is safe today is not safe by construction tomorrow. A module that decides otherwise sets
22
+ * it to false, and the report says so; the decision is the team's.
23
+ */
24
+ includeTests: boolean;
25
+ /**
26
+ * What counts as a test, by PATH. Measured on the monorepo before it was written: the filter
27
+ * `*.spec.*` alone let 149 test calls through as production, because `*.integration-spec.ts`,
28
+ * `*.steps.ts`, `tests/database/` and `*.test-util.ts` are all test code and none of them
29
+ * matches it.
30
+ */
31
+ tests: string[];
32
+ };
33
+ /** Directories never read, whatever the includes say. */
34
+ ignore: string[];
35
+ /**
36
+ * The PostgreSQL version squawk checks against, since some rules depend on it.
37
+ *
38
+ * 16.8 is the version the monorepo pins (`postgres:16.8`, in its integration tests and its
39
+ * database tooling). The role reads what the repository declares and never asks production.
40
+ */
41
+ pgVersion: string;
42
+ /**
43
+ * Each rule's level, by name. Empty means every rule at its default, `warn` in this version: the
44
+ * role refuses nothing while its adoption runs.
45
+ */
46
+ rules: Record<string, Severity>;
47
+ }
48
+
49
+ type DeepPartial<T> = {
50
+ [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
51
+ };
52
+ /** What a module's config file passes. Everything is optional, including the file itself. */
53
+ interface SqlInput {
54
+ /** The module's own directory, normally `import.meta.dirname`. */
55
+ root?: string;
56
+ /** The seam. Replaces whatever it names, and every path it sets lands in `moved`. */
57
+ overrides?: DeepPartial<SqlDefaults>;
58
+ }
59
+ interface ResolvedSqlConfig extends SqlDefaults {
60
+ /** The module's directory, or null when its config file did not say. */
61
+ root: string | null;
62
+ /** Dotted paths the module set through `overrides`, sorted so two runs print the same report. */
63
+ moved: string[];
64
+ }
65
+ /** Resolve a module's declaration against this role's defaults. */
66
+ declare function defineSql(input?: SqlInput): ResolvedSqlConfig;
67
+
68
+ export { type ResolvedSqlConfig, type SqlInput, defineSql };
@@ -0,0 +1,8 @@
1
+ import {
2
+ defineSql
3
+ } from "../../chunk-NGLEGAEN.js";
4
+ import "../../chunk-PXTU5MPW.js";
5
+ export {
6
+ defineSql
7
+ };
8
+ //# sourceMappingURL=config.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineStaticAnalysis
3
- } from "../../chunk-BBNABWZ6.js";
3
+ } from "../../chunk-LX7EG6PJ.js";
4
4
  import "../../chunk-PXTU5MPW.js";
5
5
  export {
6
6
  defineStaticAnalysis
@@ -7,9 +7,9 @@ import {
7
7
  } from "../../../chunk-NUOQXAYR.js";
8
8
  import {
9
9
  installWorkspaceSetup
10
- } from "../../../chunk-J2RMARWP.js";
10
+ } from "../../../chunk-PMRL4MH6.js";
11
11
  import "../../../chunk-ELZHIN6E.js";
12
- import "../../../chunk-XTBHIKFG.js";
12
+ import "../../../chunk-JT7ZMH44.js";
13
13
 
14
14
  // src/roles/test/setup/jest-parity.ts
15
15
  import { expect, vi } from "vitest";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  pinWorkspaceTimezone
3
- } from "../../../chunk-J2RMARWP.js";
3
+ } from "../../../chunk-PMRL4MH6.js";
4
4
  import "../../../chunk-ELZHIN6E.js";
5
- import "../../../chunk-XTBHIKFG.js";
5
+ import "../../../chunk-JT7ZMH44.js";
6
6
 
7
7
  // src/roles/test/setup/workspace-entry.ts
8
8
  await pinWorkspaceTimezone();
@@ -7,8 +7,8 @@ import {
7
7
  readTestAdoption,
8
8
  resolveVitest,
9
9
  suiteOf
10
- } from "./chunk-UVXXEAHU.js";
11
- import "./chunk-XTBHIKFG.js";
10
+ } from "./chunk-F3Q3JQJ6.js";
11
+ import "./chunk-JT7ZMH44.js";
12
12
  import "./chunk-O7REVMOC.js";
13
13
  import "./chunk-QXFCZON7.js";
14
14