audit-tools 0.51.10 → 0.52.0

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 (83) hide show
  1. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  2. package/dist/audit/orchestrator/executorRunners.js +14 -3
  3. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  4. package/dist/audit/orchestrator/resultBaseline.d.ts +1 -1
  5. package/dist/audit/orchestrator/synthesisExecutors.d.ts +10 -3
  6. package/dist/audit/orchestrator/synthesisExecutors.d.ts.map +1 -1
  7. package/dist/audit/orchestrator/synthesisExecutors.js +5 -4
  8. package/dist/audit/orchestrator/synthesisExecutors.js.map +1 -1
  9. package/dist/audit/reporting/synthesis.d.ts +7 -3
  10. package/dist/audit/reporting/synthesis.d.ts.map +1 -1
  11. package/dist/audit/reporting/synthesis.js +13 -2
  12. package/dist/audit/reporting/synthesis.js.map +1 -1
  13. package/dist/remediate/phases/close.d.ts +11 -4
  14. package/dist/remediate/phases/close.d.ts.map +1 -1
  15. package/dist/remediate/phases/close.js +78 -14
  16. package/dist/remediate/phases/close.js.map +1 -1
  17. package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts +19 -35
  18. package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts.map +1 -1
  19. package/dist/remediate/phases/closeVerifyHeadEvidence.js +38 -12
  20. package/dist/remediate/phases/closeVerifyHeadEvidence.js.map +1 -1
  21. package/dist/remediate/phases/closeVerifyLandingGates.d.ts +85 -0
  22. package/dist/remediate/phases/closeVerifyLandingGates.d.ts.map +1 -0
  23. package/dist/remediate/phases/closeVerifyLandingGates.js +48 -0
  24. package/dist/remediate/phases/closeVerifyLandingGates.js.map +1 -0
  25. package/dist/remediate/state/types.d.ts +31 -4
  26. package/dist/remediate/state/types.d.ts.map +1 -1
  27. package/dist/remediate/state/types.js +12 -1
  28. package/dist/remediate/state/types.js.map +1 -1
  29. package/dist/remediate/steps/contractPipeline.d.ts +23 -1
  30. package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
  31. package/dist/remediate/steps/contractPipeline.js +122 -10
  32. package/dist/remediate/steps/contractPipeline.js.map +1 -1
  33. package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
  34. package/dist/remediate/steps/contractPipelinePrompts.js +11 -7
  35. package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
  36. package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
  37. package/dist/remediate/steps/dispatch/hostHandoff.js +41 -5
  38. package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
  39. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  40. package/dist/remediate/steps/nextStep.js +23 -7
  41. package/dist/remediate/steps/nextStep.js.map +1 -1
  42. package/dist/remediate/types/options.d.ts +6 -0
  43. package/dist/remediate/types/options.d.ts.map +1 -1
  44. package/dist/shared/contentKey.d.ts +4 -4
  45. package/dist/shared/contentKey.js +3 -3
  46. package/dist/shared/git.d.ts +31 -0
  47. package/dist/shared/git.d.ts.map +1 -1
  48. package/dist/shared/git.js +105 -0
  49. package/dist/shared/git.js.map +1 -1
  50. package/dist/shared/index.d.ts +7 -5
  51. package/dist/shared/index.d.ts.map +1 -1
  52. package/dist/shared/index.js +5 -4
  53. package/dist/shared/index.js.map +1 -1
  54. package/dist/shared/prompts.d.ts +14 -3
  55. package/dist/shared/prompts.d.ts.map +1 -1
  56. package/dist/shared/prompts.js +17 -4
  57. package/dist/shared/prompts.js.map +1 -1
  58. package/dist/shared/reporting/auditDeliverable.d.ts +8 -3
  59. package/dist/shared/reporting/auditDeliverable.d.ts.map +1 -1
  60. package/dist/shared/reporting/auditDeliverable.js +10 -3
  61. package/dist/shared/reporting/auditDeliverable.js.map +1 -1
  62. package/dist/shared/tooling/landingGates.d.ts +118 -0
  63. package/dist/shared/tooling/landingGates.d.ts.map +1 -0
  64. package/dist/shared/tooling/landingGates.js +314 -0
  65. package/dist/shared/tooling/landingGates.js.map +1 -0
  66. package/dist/shared/tooling/projectTestAdmission.d.ts +16 -0
  67. package/dist/shared/tooling/projectTestAdmission.d.ts.map +1 -1
  68. package/dist/shared/tooling/projectTestAdmission.js +73 -10
  69. package/dist/shared/tooling/projectTestAdmission.js.map +1 -1
  70. package/dist/shared/tooling/testCommand.d.ts.map +1 -1
  71. package/dist/shared/tooling/testCommand.js +10 -0
  72. package/dist/shared/tooling/testCommand.js.map +1 -1
  73. package/dist/shared/types/finding.d.ts +56 -0
  74. package/dist/shared/types/finding.d.ts.map +1 -1
  75. package/dist/shared/types/finding.js +27 -0
  76. package/dist/shared/types/finding.js.map +1 -1
  77. package/dist/shared/types/intentCheckpoint.d.ts +2 -2
  78. package/dist/shared/validation/findingsReport.d.ts +13 -2
  79. package/dist/shared/validation/findingsReport.d.ts.map +1 -1
  80. package/dist/shared/validation/findingsReport.js +19 -2
  81. package/dist/shared/validation/findingsReport.js.map +1 -1
  82. package/docs/audit-pkg/product.md +2 -4
  83. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ // sites-pinned: tests/remediate/remediate-state-invariants.test.ts, tests/remediate/audit-read-plan-stamp.test.ts
1
2
  // Shared audit-deliverable emitter: build the canonical `audit-findings.json`
2
3
  // machine contract + its `audit-report.md` human render from a Finding[] set.
3
4
  //
@@ -39,8 +40,13 @@ function lensBreakdown(findings) {
39
40
  * deliverable is a flat, re-consumable finding set). Stamped with the same
40
41
  * `contract_version` the auditor emits, so `validateAuditFindingsReport` accepts
41
42
  * it and the remediator's structured fast-path consumes it losslessly.
43
+ *
44
+ * `auditRead` is REQUIRED and is never computed here: this emitter re-states
45
+ * findings somebody else read, so the only honest value is the one the source
46
+ * report carried (or `null` when there was none). Stamping the commit current at
47
+ * re-emit time would hand the next run a remediation-side commit as `B`.
42
48
  */
43
- export function buildAuditFindingsDeliverable(findings) {
49
+ export function buildAuditFindingsDeliverable(findings, auditRead) {
44
50
  const coherenceTrace = buildContentCoherenceTrace({
45
51
  items: findings.map((finding) => ({
46
52
  id: finding.id,
@@ -84,6 +90,7 @@ export function buildAuditFindingsDeliverable(findings) {
84
90
  };
85
91
  return {
86
92
  contract_version: AUDIT_FINDINGS_CONTRACT_VERSION,
93
+ audit_read: auditRead,
87
94
  summary,
88
95
  findings: [...findings],
89
96
  coherence_trace: coherenceTrace,
@@ -122,9 +129,9 @@ export function renderAuditDeliverableMarkdown(findings, options = {}) {
122
129
  * `findings_report` to `audit-findings.json` and `report_markdown` to
123
130
  * `audit-report.md`.
124
131
  */
125
- export function buildAuditDeliverablePair(findings, options = {}) {
132
+ export function buildAuditDeliverablePair(findings, auditRead, options = {}) {
126
133
  return {
127
- findings_report: buildAuditFindingsDeliverable(findings),
134
+ findings_report: buildAuditFindingsDeliverable(findings, auditRead),
128
135
  report_markdown: renderAuditDeliverableMarkdown(findings, options),
129
136
  };
130
137
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auditDeliverable.js","sourceRoot":"","sources":["../../../src/shared/reporting/auditDeliverable.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,2BAA2B;AAS3B,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,GACjC,MAAM,cAAc,CAAC;AAEtB,MAAM,aAAa,GAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAEvF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+ /**
2
+ * One landing-gate ROLE, with the npm script names that declare it in
3
+ * preference order — the same ordering rule `testCommand.ts` states: generic /
4
+ * widely-adopted names first, framework- or repo-specific aliases last, and
5
+ * `pickScript` returns the FIRST match.
6
+ */
7
+ export interface LandingGateRole {
8
+ /**
9
+ * The gate's role. Named so a report, a test and a prompt can all say WHICH
10
+ * gate a repo contributes without parsing its script name.
11
+ */
12
+ readonly role: "guard" | "deadcode" | "depgraph" | "glossary" | "lint";
13
+ /**
14
+ * One line, rendered wherever the landing gate is described to a host — the
15
+ * gate's own statement of what it refuses, never restated at the call site.
16
+ */
17
+ readonly refuses: string;
18
+ /** npm script names declaring this role, most generic first. */
19
+ readonly scripts: readonly string[];
20
+ }
21
+ /**
22
+ * The declared landing-gate vocabulary.
23
+ *
24
+ * ORDER IS THE EMITTED ORDER, and the four roles are independent: a repo
25
+ * declaring only `check:lint` contributes exactly one command. Sorted by role
26
+ * name (deadcode, depgraph, guard, lint) as the array literal, so the emitted
27
+ * list is content-stable and a re-derivation cannot churn the workload digest
28
+ * (CLAUDE.md, "Extractors emit stable, content-derived array order").
29
+ *
30
+ * `guard` is separate from the three cheap gates because it is the EXPENSIVE
31
+ * one: the repository's own cross-cutting test suite. It is here because a
32
+ * guard suite is precisely the gate a module-scoped `targeted_commands` entry
33
+ * cannot stand in for — `tests/shared/audit-tools-path-guard.test.ts` is the
34
+ * live example.
35
+ */
36
+ export declare const LANDING_GATE_SCRIPT_NAMES: readonly LandingGateRole[];
37
+ /**
38
+ * The repository's landing gates, as runnable command strings, in the
39
+ * vocabulary's declared role order.
40
+ *
41
+ * Pure over `(root)` and deterministic: reads one manifest, emits a
42
+ * content-stable sorted-by-role list, spawns nothing.
43
+ */
44
+ export declare function discoverLandingGates(root: string): string[];
45
+ /**
46
+ * Every invariant id a value DECLARES anywhere it can be nested — a module
47
+ * contract's `invariants`, an obligation slug, or any other string a producer
48
+ * hangs an id on. Walks objects and arrays rather than reading one named field,
49
+ * because a contract's shape is the producer's, not this predicate's.
50
+ *
51
+ * Returns the SET of ids, not a boolean, because the caller has to subtract the
52
+ * ids the glossary already documents: mentioning an existing id is not coining
53
+ * one (see {@link withGlossaryScope}).
54
+ */
55
+ export declare function declaredInvariantIds(value: unknown): Set<string>;
56
+ /**
57
+ * Whether a value declares ANY invariant id — the boolean form of
58
+ * {@link declaredInvariantIds}, for a caller that only needs the predicate.
59
+ */
60
+ export declare function declaresInvariantId(value: unknown): boolean;
61
+ /**
62
+ * The one-line statement of what a landing gate command REFUSES, or `null` when
63
+ * the command was not declared as one.
64
+ *
65
+ * Rendered wherever a host is told what its required tests cover, so the
66
+ * sentence stating a gate's authority is written once, beside the vocabulary
67
+ * that declares the gate. `null` for an item's own `targeted_commands`, which
68
+ * are not landing gates and carry no vocabulary entry.
69
+ */
70
+ export declare function landingGateRefusal(command: string): string | null;
71
+ /**
72
+ * The glossary document a scope must be able to write when it coins an
73
+ * invariant id. Repo-relative, so it composes with `allowed_files` unchanged.
74
+ *
75
+ * ⚠ This is THIS repository's convention, and it is only ever consulted as a
76
+ * CANDIDATE. `remediate-code` runs against arbitrary repositories, so the path
77
+ * being a constant is not a claim that the document exists — a target root that
78
+ * has no such file gets NO widening at all (a content fact, checked by
79
+ * {@link withGlossaryScope}). A tool that widened on the NAME alone would hand
80
+ * an item write scope over a file its repository does not have.
81
+ */
82
+ export declare const GLOSSARY_DOCUMENT_PATH = "docs/glossary-ids.md";
83
+ /**
84
+ * Widen a work item's write scope so an item that COINS an invariant id can
85
+ * actually satisfy the id-glossary gate.
86
+ *
87
+ * ── THE FRICTION THIS CLOSES ─────────────────────────────────────────────────
88
+ *
89
+ * The glossary document is outside every module's `file_scope`; the glossary
90
+ * gate scans `src/` for `INV-*` ids and fails on one with no glossary row. So
91
+ * an item that coins an id in `src/` is STRUCTURALLY UNABLE to satisfy the
92
+ * gate: the fix is a glossary edit its write scope forbids, and the red lands
93
+ * silently, discovered by the NEXT item's worker. It happened twice in one
94
+ * session (`INV-SSP-DEFERRED-SET-REPORTED` at CP-NODE-10, and the id the
95
+ * charter-delta parser coined at CP-NODE-18, since retired with that parser) —
96
+ * the "tool_should_decide" friction in `docs/backlog/open-bugs.md`.
97
+ *
98
+ * ── THREE CONDITIONS, EACH NARROWING ─────────────────────────────────────────
99
+ *
100
+ * 1. The document must EXIST in the target root. The path is this
101
+ * repository's convention; an arbitrary target repo may keep none, and
102
+ * widening for a document that is not there grants scope over nothing.
103
+ * 2. The contract must declare at least one id the document does NOT already
104
+ * carry. A contract that merely MENTIONS `INV-COVERAGE` — a seam adjustment
105
+ * citing an existing invariant, a prose reference — coins nothing, and
106
+ * widening for it hands the item a document it has no business editing.
107
+ * Only an id with no row yet is a COIN, because only that id needs one.
108
+ * 3. The scope must not already carry the path (idempotence).
109
+ *
110
+ * The gate itself is bound separately, at the CLOSE — scope without the gate
111
+ * would leave the red silent; the gate without scope would turn it into a
112
+ * dead-end refusal. Both halves are the one decision.
113
+ *
114
+ * Deterministic, stable-ordered and idempotent: a scope that already carries
115
+ * the path is returned unchanged.
116
+ */
117
+ export declare function withGlossaryScope(root: string, allowedFiles: readonly string[], declaredIds: ReadonlySet<string>): string[];
118
+ //# sourceMappingURL=landingGates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"landingGates.d.ts","sourceRoot":"","sources":["../../../src/shared/tooling/landingGates.ts"],"names":[],"mappings":"AAuEA;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;IACvE;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,eAAe,EAkC/D,CAAC;AAyBF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAc3D;AAeD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAkBhE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOjE;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAyB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAC/B,MAAM,EAAE,CAQV"}
@@ -0,0 +1,314 @@
1
+ // sites-pinned: tests/shared/landing-gates.test.ts, tests/remediate/host-handoff.test.ts
2
+ // The discovery/vocabulary/scope rules are pinned by the shared suite; the
3
+ // per-item wiring that remains (the glossary write scope) is pinned by the
4
+ // host-handoff suite's "landing gates" block, and the close leg by
5
+ // tests/remediate/landing-gates-close.test.ts.
6
+ //
7
+ // The repository's LANDING GATES: the tree-wide guard suites and the cheap
8
+ // release gates a LANDING must run, discovered from the target repository's own
9
+ // declared command surface.
10
+ //
11
+ // ── WHY THIS EXISTS ──────────────────────────────────────────────────────────
12
+ //
13
+ // The per-item required tests were the block's `targeted_commands`, which are
14
+ // MODULE-SCOPED: a block that edits one module declares the command that
15
+ // exercises that module. Three remediation landings reddened CI after green
16
+ // per-item runs, each on a gate no per-item command covers —
17
+ //
18
+ // • a hand-restated `.audit-tools` literal caught only by the tree-wide
19
+ // `tests/shared/audit-tools-path-guard.test.ts` (`1e7a4a54` fixed it),
20
+ // • a case-folding assertion true only on a case-insensitive volume
21
+ // (`011c6ae0`), and
22
+ // • an intra-`src/shared` import cycle a reviewer graded minor that
23
+ // `check:depgraph` refuses (`b5963957`).
24
+ //
25
+ // ── WHERE THE GATES RUN: THE CLOSE, NOT THE ITEM ─────────────────────────────
26
+ //
27
+ // The first attempt folded these gates into EVERY work item's `required_tests`.
28
+ // That was wrong, and the way it was wrong is worth keeping: these gates state
29
+ // facts about the WHOLE tree, so an item that adds an export whose only consumer
30
+ // lands in a LATER item could not pass, and no edit inside its own scope could
31
+ // make it pass; another item's fault could refuse this one too. A gate that
32
+ // GUESSES at a boundary owned by something else is moved to the boundary that
33
+ // owns it (CLAUDE.md, *A gate states the boundary it OWNS*) — and the merged tree
34
+ // exists only at the CLOSE. So the loop is: this module DISCOVERS the gates, and
35
+ // `verifyLandingGates` (`src/remediate/phases/closeVerifyLandingGates.ts`) runs
36
+ // them once each at close and folds the result into `fullyGreen`.
37
+ //
38
+ // What stays per-item is the one scope fact a prepare owns: a block that coins
39
+ // an invariant id needs the glossary document in its write scope, or the gate is
40
+ // unsatisfiable for the item that coins it (`withGlossaryScope` below).
41
+ //
42
+ // ── WHY IT IS DISCOVERED, NOT BAKED IN ───────────────────────────────────────
43
+ //
44
+ // `remediate-code` runs against ARBITRARY repositories. `check:depgraph`,
45
+ // `check:deadcode` and `check:lint` are THIS repository's script names; a
46
+ // language-neutral tool that hardcoded them would demand a target repo declare
47
+ // audit-tools' own private vocabulary, and would run the wrong thing (or
48
+ // nothing) everywhere else. So the gates are read from the target repo's
49
+ // `package.json` scripts through a DECLARED, preference-ordered vocabulary —
50
+ // exactly the shape `discoverProjectCommands` (./testCommand.ts) already uses
51
+ // for test/e2e/build/lint, so a "discover a project command by role" question
52
+ // has one answer in this codebase rather than two.
53
+ //
54
+ // Degrade-to-empty is the contract: a repo with no `package.json`, a malformed
55
+ // one, or one declaring none of these roles contributes NO landing gate. A
56
+ // missing gate narrows the landing command set; it never throws and never
57
+ // invents a command the repository did not declare.
58
+ //
59
+ // ⚠ WHAT "NO GATE DISCOVERED" DOES AND DOES NOT MEAN. Discovery reads the target
60
+ // repository's `package.json` `scripts` map and NOTHING ELSE — there is no
61
+ // `Makefile`, `Cargo.toml`, `build.gradle` or shell-script arm, and none is
62
+ // planned, because no portable way exists to read another build system's target
63
+ // names and a guessed target would run the wrong thing. So "no landing gate" is
64
+ // a fact about the manifest, never a claim that the repository has no tree-wide
65
+ // check: a repository with another build system gets NO landing gate at all, and
66
+ // the close report says so in one line rather than silently reporting a green
67
+ // gate set. A gate is only ever ADDED by the target declaring it.
68
+ import { existsSync, readFileSync } from "node:fs";
69
+ import { join } from "node:path";
70
+ import { compareCodeUnits } from "../compareCodeUnits.js";
71
+ /**
72
+ * The declared landing-gate vocabulary.
73
+ *
74
+ * ORDER IS THE EMITTED ORDER, and the four roles are independent: a repo
75
+ * declaring only `check:lint` contributes exactly one command. Sorted by role
76
+ * name (deadcode, depgraph, guard, lint) as the array literal, so the emitted
77
+ * list is content-stable and a re-derivation cannot churn the workload digest
78
+ * (CLAUDE.md, "Extractors emit stable, content-derived array order").
79
+ *
80
+ * `guard` is separate from the three cheap gates because it is the EXPENSIVE
81
+ * one: the repository's own cross-cutting test suite. It is here because a
82
+ * guard suite is precisely the gate a module-scoped `targeted_commands` entry
83
+ * cannot stand in for — `tests/shared/audit-tools-path-guard.test.ts` is the
84
+ * live example.
85
+ */
86
+ export const LANDING_GATE_SCRIPT_NAMES = [
87
+ {
88
+ role: "deadcode",
89
+ refuses: "an exported symbol with zero consumers anywhere, including tests",
90
+ scripts: ["check:deadcode", "check:dead-code", "deadcode", "knip"],
91
+ },
92
+ {
93
+ role: "depgraph",
94
+ refuses: "a module-graph violation — an import cycle, or an upward import out of the shared base layer",
95
+ scripts: ["check:depgraph", "check:dep-graph", "depgraph", "depcruise"],
96
+ },
97
+ {
98
+ role: "glossary",
99
+ refuses: "an opaque identifier used in the source tree that no glossary row documents — the id-glossary gate",
100
+ scripts: [
101
+ "check:invariant-glossary",
102
+ "check:glossary",
103
+ "check:glossary-ids",
104
+ "glossary:check",
105
+ ],
106
+ },
107
+ {
108
+ role: "guard",
109
+ refuses: "a tree-wide invariant the repository's cross-cutting suites assert and no module-scoped command covers",
110
+ scripts: ["verify:guards", "test:guards", "guards", "test:guard"],
111
+ },
112
+ {
113
+ role: "lint",
114
+ refuses: "a lint violation anywhere in the tree",
115
+ scripts: ["check:lint", "lint", "lint:check"],
116
+ },
117
+ ];
118
+ function readPackageScripts(root) {
119
+ const packageJsonPath = join(root, "package.json");
120
+ if (!existsSync(packageJsonPath))
121
+ return null;
122
+ try {
123
+ const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8"));
124
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
125
+ return null;
126
+ const scripts = parsed.scripts;
127
+ return scripts !== null && typeof scripts === "object" && !Array.isArray(scripts)
128
+ ? scripts
129
+ : null;
130
+ }
131
+ catch {
132
+ // Unreadable / malformed package.json: no landing gates. A prepare must not
133
+ // fail because a manifest it does not own is malformed — the same
134
+ // degrade-to-empty rule `discoverProjectCommands` follows.
135
+ return null;
136
+ }
137
+ }
138
+ /** The `npm run <script>` command for a declared script name. */
139
+ function npmRun(script) {
140
+ return `npm run ${script}`;
141
+ }
142
+ /**
143
+ * The repository's landing gates, as runnable command strings, in the
144
+ * vocabulary's declared role order.
145
+ *
146
+ * Pure over `(root)` and deterministic: reads one manifest, emits a
147
+ * content-stable sorted-by-role list, spawns nothing.
148
+ */
149
+ export function discoverLandingGates(root) {
150
+ const scripts = readPackageScripts(root);
151
+ if (scripts === null)
152
+ return [];
153
+ const commands = [];
154
+ for (const gate of LANDING_GATE_SCRIPT_NAMES) {
155
+ for (const name of gate.scripts) {
156
+ const body = scripts[name];
157
+ if (typeof body === "string" && body.trim().length > 0) {
158
+ commands.push(npmRun(name));
159
+ break;
160
+ }
161
+ }
162
+ }
163
+ return commands.sort(compareCodeUnits);
164
+ }
165
+ /**
166
+ * The opaque-identifier family the id-glossary gate scans the source tree for.
167
+ * Anchored to a word boundary at the end too, so a short namespace does not
168
+ * match inside a longer token; and to `INV-` + an uppercase letter start, so a
169
+ * lowercase test-family id (`INV-remediate-state-01`) is not read as a
170
+ * production namespace — the same split `scripts/check-invariant-glossary.mjs`
171
+ * draws.
172
+ *
173
+ * GLOBAL on purpose: {@link declaredInvariantIds} collects EVERY id in a value,
174
+ * so the lastIndex state a `/g` regex carries is reset before each use there.
175
+ */
176
+ const INVARIANT_ID = /\bINV-[A-Z][A-Z0-9]*(?:-[A-Z][A-Z0-9]*)*\b/gu;
177
+ /**
178
+ * Every invariant id a value DECLARES anywhere it can be nested — a module
179
+ * contract's `invariants`, an obligation slug, or any other string a producer
180
+ * hangs an id on. Walks objects and arrays rather than reading one named field,
181
+ * because a contract's shape is the producer's, not this predicate's.
182
+ *
183
+ * Returns the SET of ids, not a boolean, because the caller has to subtract the
184
+ * ids the glossary already documents: mentioning an existing id is not coining
185
+ * one (see {@link withGlossaryScope}).
186
+ */
187
+ export function declaredInvariantIds(value) {
188
+ const found = new Set();
189
+ const walk = (node) => {
190
+ if (typeof node === "string") {
191
+ INVARIANT_ID.lastIndex = 0;
192
+ for (const match of node.matchAll(INVARIANT_ID))
193
+ found.add(match[0]);
194
+ return;
195
+ }
196
+ if (Array.isArray(node)) {
197
+ for (const entry of node)
198
+ walk(entry);
199
+ return;
200
+ }
201
+ if (node !== null && typeof node === "object") {
202
+ for (const entry of Object.values(node))
203
+ walk(entry);
204
+ }
205
+ };
206
+ walk(value);
207
+ return found;
208
+ }
209
+ /**
210
+ * Whether a value declares ANY invariant id — the boolean form of
211
+ * {@link declaredInvariantIds}, for a caller that only needs the predicate.
212
+ */
213
+ export function declaresInvariantId(value) {
214
+ return declaredInvariantIds(value).size > 0;
215
+ }
216
+ /**
217
+ * The one-line statement of what a landing gate command REFUSES, or `null` when
218
+ * the command was not declared as one.
219
+ *
220
+ * Rendered wherever a host is told what its required tests cover, so the
221
+ * sentence stating a gate's authority is written once, beside the vocabulary
222
+ * that declares the gate. `null` for an item's own `targeted_commands`, which
223
+ * are not landing gates and carry no vocabulary entry.
224
+ */
225
+ export function landingGateRefusal(command) {
226
+ for (const gate of LANDING_GATE_SCRIPT_NAMES) {
227
+ if (gate.scripts.some((name) => npmRun(name) === command)) {
228
+ return `\`${command}\` — refuses ${gate.refuses}`;
229
+ }
230
+ }
231
+ return null;
232
+ }
233
+ /**
234
+ * The glossary document a scope must be able to write when it coins an
235
+ * invariant id. Repo-relative, so it composes with `allowed_files` unchanged.
236
+ *
237
+ * ⚠ This is THIS repository's convention, and it is only ever consulted as a
238
+ * CANDIDATE. `remediate-code` runs against arbitrary repositories, so the path
239
+ * being a constant is not a claim that the document exists — a target root that
240
+ * has no such file gets NO widening at all (a content fact, checked by
241
+ * {@link withGlossaryScope}). A tool that widened on the NAME alone would hand
242
+ * an item write scope over a file its repository does not have.
243
+ */
244
+ export const GLOSSARY_DOCUMENT_PATH = "docs/glossary-ids.md";
245
+ /**
246
+ * The invariant ids the glossary document at `root` already carries, or `null`
247
+ * when the document does not exist there.
248
+ *
249
+ * `null` and an empty set are DIFFERENT answers, and collapsing them is the bug
250
+ * this return type exists to prevent: absent means this repository keeps no
251
+ * glossary document, so nothing can be coined against it and no scope widens;
252
+ * present-and-empty means every id in the contract is new.
253
+ */
254
+ function documentedInvariantIds(root) {
255
+ const documentPath = join(root, ...GLOSSARY_DOCUMENT_PATH.split("/"));
256
+ if (!existsSync(documentPath))
257
+ return null;
258
+ try {
259
+ return declaredInvariantIds(readFileSync(documentPath, "utf8"));
260
+ }
261
+ catch {
262
+ // Unreadable glossary: "cannot tell which ids are documented". The EMPTY
263
+ // set is the conservative answer — it widens for any declared id, granting
264
+ // only a scope an item's own contract asked for, whereas returning `null`
265
+ // turns a read error into the silent dead-end this function removes.
266
+ return new Set();
267
+ }
268
+ }
269
+ /**
270
+ * Widen a work item's write scope so an item that COINS an invariant id can
271
+ * actually satisfy the id-glossary gate.
272
+ *
273
+ * ── THE FRICTION THIS CLOSES ─────────────────────────────────────────────────
274
+ *
275
+ * The glossary document is outside every module's `file_scope`; the glossary
276
+ * gate scans `src/` for `INV-*` ids and fails on one with no glossary row. So
277
+ * an item that coins an id in `src/` is STRUCTURALLY UNABLE to satisfy the
278
+ * gate: the fix is a glossary edit its write scope forbids, and the red lands
279
+ * silently, discovered by the NEXT item's worker. It happened twice in one
280
+ * session (`INV-SSP-DEFERRED-SET-REPORTED` at CP-NODE-10, and the id the
281
+ * charter-delta parser coined at CP-NODE-18, since retired with that parser) —
282
+ * the "tool_should_decide" friction in `docs/backlog/open-bugs.md`.
283
+ *
284
+ * ── THREE CONDITIONS, EACH NARROWING ─────────────────────────────────────────
285
+ *
286
+ * 1. The document must EXIST in the target root. The path is this
287
+ * repository's convention; an arbitrary target repo may keep none, and
288
+ * widening for a document that is not there grants scope over nothing.
289
+ * 2. The contract must declare at least one id the document does NOT already
290
+ * carry. A contract that merely MENTIONS `INV-COVERAGE` — a seam adjustment
291
+ * citing an existing invariant, a prose reference — coins nothing, and
292
+ * widening for it hands the item a document it has no business editing.
293
+ * Only an id with no row yet is a COIN, because only that id needs one.
294
+ * 3. The scope must not already carry the path (idempotence).
295
+ *
296
+ * The gate itself is bound separately, at the CLOSE — scope without the gate
297
+ * would leave the red silent; the gate without scope would turn it into a
298
+ * dead-end refusal. Both halves are the one decision.
299
+ *
300
+ * Deterministic, stable-ordered and idempotent: a scope that already carries
301
+ * the path is returned unchanged.
302
+ */
303
+ export function withGlossaryScope(root, allowedFiles, declaredIds) {
304
+ if (declaredIds.size === 0 || allowedFiles.includes(GLOSSARY_DOCUMENT_PATH)) {
305
+ return [...allowedFiles];
306
+ }
307
+ const documented = documentedInvariantIds(root);
308
+ if (documented === null)
309
+ return [...allowedFiles];
310
+ if (![...declaredIds].some((id) => !documented.has(id)))
311
+ return [...allowedFiles];
312
+ return [...allowedFiles, GLOSSARY_DOCUMENT_PATH].sort(compareCodeUnits);
313
+ }
314
+ //# sourceMappingURL=landingGates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"landingGates.js","sourceRoot":"","sources":["../../../src/shared/tooling/landingGates.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,6EAA6E;AAC7E,6EAA6E;AAC7E,qEAAqE;AACrE,iDAAiD;AACjD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;AAChF,4BAA4B;AAC5B,EAAE;AACF,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AACzE,4EAA4E;AAC5E,6DAA6D;AAC7D,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,sEAAsE;AACtE,wBAAwB;AACxB,sEAAsE;AACtE,6CAA6C;AAC7C,EAAE;AACF,gFAAgF;AAChF,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,iFAAiF;AACjF,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,kFAAkF;AAClF,iFAAiF;AACjF,gFAAgF;AAChF,kEAAkE;AAClE,EAAE;AACF,+EAA+E;AAC/E,iFAAiF;AACjF,wEAAwE;AACxE,EAAE;AACF,gFAAgF;AAChF,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,+EAA+E;AAC/E,yEAAyE;AACzE,yEAAyE;AACzE,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,mDAAmD;AACnD,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,0EAA0E;AAC1E,oDAAoD;AACpD,EAAE;AACF,iFAAiF;AACjF,2EAA2E;AAC3E,4EAA4E;AAC5E,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,8EAA8E;AAC9E,kEAAkE;AAClE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAuB1D;;;;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
74
74
  sigkillGraceMs?: number;
75
75
  }): Promise<ProjectTestAdmissionOutcome>;
76
+ /**
77
+ * Run one of the repository's discovered LANDING GATES under the same gate.
78
+ *
79
+ * The landing-gate leg runs at the CLOSE, on the merged tree — see
80
+ * `verifyLandingGates` in `src/remediate/phases/closeVerifyLandingGates.ts`. It
81
+ * is a different role from test/e2e only in what discovery emits: one vector
82
+ * for those, a set of up to five gate commands for this. The admission rule and
83
+ * every spawn bound are the SAME, which is the point — a gate is a discovered
84
+ * project command like any other, and adding a second spawn path for it would
85
+ * be a second place for the shell-safety and output-cap rules to drift.
86
+ */
87
+ export declare function runAdmittedProjectLandingGateCommand(command: string[], root: string, options?: {
88
+ timeoutMs?: number;
89
+ maxCapturedOutput?: number;
90
+ sigkillGraceMs?: number;
91
+ }): Promise<ProjectTestAdmissionOutcome>;
76
92
  //# sourceMappingURL=projectTestAdmission.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"projectTestAdmission.d.ts","sourceRoot":"","sources":["../../../src/shared/tooling/projectTestAdmission.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,QAAc,CAAC;AAEnD,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,OAAQ,CAAC;AAEnD;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,QAAkB,CAAC;AAEhE,MAAM,WAAW,2BAA2B;IAC1C,qGAAqG;IACrG,QAAQ,EAAE,OAAO,CAAC;IAClB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;CAChB;AAmBD,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAErF;AAwFD,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IACP,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACpB,GACL,OAAO,CAAC,2BAA2B,CAAC,CAEtC;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IACP,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACpB,GACL,OAAO,CAAC,2BAA2B,CAAC,CAEtC"}
1
+ {"version":3,"file":"projectTestAdmission.d.ts","sourceRoot":"","sources":["../../../src/shared/tooling/projectTestAdmission.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,QAAc,CAAC;AAEnD,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,OAAQ,CAAC;AAEnD;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,QAAkB,CAAC;AAEhE,MAAM,WAAW,2BAA2B;IAC1C,qGAAqG;IACrG,QAAQ,EAAE,OAAO,CAAC;IAClB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;CAChB;AA6BD,wBAAgB,4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