audit-tools 0.32.22 → 0.32.27

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 (126) hide show
  1. package/README.md +10 -4
  2. package/dist/audit/cli/conceptualDispatch.d.ts +11 -0
  3. package/dist/audit/cli/conceptualDispatch.d.ts.map +1 -1
  4. package/dist/audit/cli/conceptualDispatch.js +31 -1
  5. package/dist/audit/cli/conceptualDispatch.js.map +1 -1
  6. package/dist/audit/cli/nextStepHelpers.d.ts +46 -0
  7. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  8. package/dist/audit/cli/nextStepHelpers.js +14 -14
  9. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  10. package/dist/audit/contracts/workerSchemas.d.ts +4 -4
  11. package/dist/audit/contracts/wrapperResponse.d.ts +6 -6
  12. package/dist/audit/orchestrator/advance.d.ts +18 -19
  13. package/dist/audit/orchestrator/advance.d.ts.map +1 -1
  14. package/dist/audit/orchestrator/advance.js +32 -40
  15. package/dist/audit/orchestrator/advance.js.map +1 -1
  16. package/dist/audit/orchestrator/advanceTypes.d.ts +0 -17
  17. package/dist/audit/orchestrator/advanceTypes.d.ts.map +1 -1
  18. package/dist/audit/orchestrator/hostInputPause.d.ts +69 -0
  19. package/dist/audit/orchestrator/hostInputPause.d.ts.map +1 -0
  20. package/dist/audit/orchestrator/hostInputPause.js +90 -0
  21. package/dist/audit/orchestrator/hostInputPause.js.map +1 -0
  22. package/dist/audit/quota/index.d.ts +24 -24
  23. package/dist/audit/types.d.ts +2 -2
  24. package/dist/remediate/contractPipeline/artifactStore.d.ts +27 -0
  25. package/dist/remediate/contractPipeline/artifactStore.d.ts.map +1 -1
  26. package/dist/remediate/contractPipeline/artifactStore.js +34 -0
  27. package/dist/remediate/contractPipeline/artifactStore.js.map +1 -1
  28. package/dist/remediate/contractPipeline/changeClassification.d.ts +9 -3
  29. package/dist/remediate/contractPipeline/changeClassification.d.ts.map +1 -1
  30. package/dist/remediate/contractPipeline/changeClassification.js +25 -6
  31. package/dist/remediate/contractPipeline/changeClassification.js.map +1 -1
  32. package/dist/remediate/contractPipeline/derive.d.ts +42 -0
  33. package/dist/remediate/contractPipeline/derive.d.ts.map +1 -1
  34. package/dist/remediate/contractPipeline/derive.js +108 -0
  35. package/dist/remediate/contractPipeline/derive.js.map +1 -1
  36. package/dist/remediate/index.d.ts.map +1 -1
  37. package/dist/remediate/index.js +9 -1
  38. package/dist/remediate/index.js.map +1 -1
  39. package/dist/remediate/intake.d.ts +10 -0
  40. package/dist/remediate/intake.d.ts.map +1 -1
  41. package/dist/remediate/intake.js +20 -1
  42. package/dist/remediate/intake.js.map +1 -1
  43. package/dist/remediate/phases/grounding.d.ts +7 -4
  44. package/dist/remediate/phases/grounding.d.ts.map +1 -1
  45. package/dist/remediate/phases/grounding.js +52 -8
  46. package/dist/remediate/phases/grounding.js.map +1 -1
  47. package/dist/remediate/steps/contractPipelinePrompts.d.ts +1 -0
  48. package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
  49. package/dist/remediate/steps/contractPipelinePrompts.js +2 -2
  50. package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
  51. package/dist/remediate/steps/dispatch/acceptNode.d.ts +25 -0
  52. package/dist/remediate/steps/dispatch/acceptNode.d.ts.map +1 -1
  53. package/dist/remediate/steps/dispatch/acceptNode.js +65 -7
  54. package/dist/remediate/steps/dispatch/acceptNode.js.map +1 -1
  55. package/dist/remediate/steps/dispatch/common.d.ts +11 -0
  56. package/dist/remediate/steps/dispatch/common.d.ts.map +1 -1
  57. package/dist/remediate/steps/dispatch/common.js +16 -0
  58. package/dist/remediate/steps/dispatch/common.js.map +1 -1
  59. package/dist/remediate/steps/dispatch/implementPrompt.d.ts +13 -0
  60. package/dist/remediate/steps/dispatch/implementPrompt.d.ts.map +1 -1
  61. package/dist/remediate/steps/dispatch/implementPrompt.js +33 -7
  62. package/dist/remediate/steps/dispatch/implementPrompt.js.map +1 -1
  63. package/dist/remediate/steps/dispatch/marshal.d.ts.map +1 -1
  64. package/dist/remediate/steps/dispatch/marshal.js +77 -9
  65. package/dist/remediate/steps/dispatch/marshal.js.map +1 -1
  66. package/dist/remediate/steps/dispatch/worktreeLifecycle.d.ts +55 -16
  67. package/dist/remediate/steps/dispatch/worktreeLifecycle.d.ts.map +1 -1
  68. package/dist/remediate/steps/dispatch/worktreeLifecycle.js +119 -16
  69. package/dist/remediate/steps/dispatch/worktreeLifecycle.js.map +1 -1
  70. package/dist/remediate/steps/dispatch.d.ts +2 -2
  71. package/dist/remediate/steps/dispatch.d.ts.map +1 -1
  72. package/dist/remediate/steps/dispatch.js +2 -2
  73. package/dist/remediate/steps/dispatch.js.map +1 -1
  74. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  75. package/dist/remediate/steps/nextStep.js +12 -1
  76. package/dist/remediate/steps/nextStep.js.map +1 -1
  77. package/dist/remediate/validation/artifacts.d.ts.map +1 -1
  78. package/dist/remediate/validation/artifacts.js +38 -1
  79. package/dist/remediate/validation/artifacts.js.map +1 -1
  80. package/dist/remediate/validation/contractPipeline.d.ts +1 -1
  81. package/dist/remediate/validation/contractPipeline.d.ts.map +1 -1
  82. package/dist/remediate/validation/contractPipeline.js +1 -1
  83. package/dist/remediate/validation/contractPipeline.js.map +1 -1
  84. package/dist/remediate/validation/contractPipelineGates.d.ts +15 -0
  85. package/dist/remediate/validation/contractPipelineGates.d.ts.map +1 -1
  86. package/dist/remediate/validation/contractPipelineGates.js +168 -2
  87. package/dist/remediate/validation/contractPipelineGates.js.map +1 -1
  88. package/dist/shared/dispatch/admissionLoop.d.ts +12 -12
  89. package/dist/shared/dispatch/costRank.d.ts +17 -1
  90. package/dist/shared/dispatch/costRank.d.ts.map +1 -1
  91. package/dist/shared/dispatch/costRank.js +8 -4
  92. package/dist/shared/dispatch/costRank.js.map +1 -1
  93. package/dist/shared/friction/captureFrictionEvent.d.ts +13 -0
  94. package/dist/shared/friction/captureFrictionEvent.d.ts.map +1 -1
  95. package/dist/shared/friction/captureFrictionEvent.js.map +1 -1
  96. package/dist/shared/friction/frictionRecord.d.ts +55 -1
  97. package/dist/shared/friction/frictionRecord.d.ts.map +1 -1
  98. package/dist/shared/friction/frictionRecord.js +40 -0
  99. package/dist/shared/friction/frictionRecord.js.map +1 -1
  100. package/dist/shared/friction/stepBoundaryCapture.d.ts +14 -0
  101. package/dist/shared/friction/stepBoundaryCapture.d.ts.map +1 -1
  102. package/dist/shared/friction/stepBoundaryCapture.js +47 -0
  103. package/dist/shared/friction/stepBoundaryCapture.js.map +1 -1
  104. package/dist/shared/friction/triage.d.ts +94 -14
  105. package/dist/shared/friction/triage.d.ts.map +1 -1
  106. package/dist/shared/friction/triage.js +0 -0
  107. package/dist/shared/friction/triage.js.map +1 -1
  108. package/dist/shared/index.d.ts +1 -1
  109. package/dist/shared/index.d.ts.map +1 -1
  110. package/dist/shared/index.js +1 -1
  111. package/dist/shared/index.js.map +1 -1
  112. package/dist/shared/quota/capacity.d.ts +4 -4
  113. package/dist/shared/quota/modelStatics.d.ts +15 -7
  114. package/dist/shared/quota/modelStatics.d.ts.map +1 -1
  115. package/dist/shared/quota/modelStatics.js +60 -13
  116. package/dist/shared/quota/modelStatics.js.map +1 -1
  117. package/dist/shared/quota/quotaSource.d.ts +2 -2
  118. package/dist/shared/validation/designFindingGrounding.d.ts.map +1 -1
  119. package/dist/shared/validation/designFindingGrounding.js +9 -3
  120. package/dist/shared/validation/designFindingGrounding.js.map +1 -1
  121. package/dist/shared/validation/findingGrounding.d.ts +40 -0
  122. package/dist/shared/validation/findingGrounding.d.ts.map +1 -1
  123. package/dist/shared/validation/findingGrounding.js +83 -0
  124. package/dist/shared/validation/findingGrounding.js.map +1 -1
  125. package/docs/audit-pkg/operator-guide.md +84 -0
  126. package/package.json +2 -2
@@ -19,6 +19,7 @@
19
19
  * E3 + P7).
20
20
  */
21
21
  import { readFile } from "node:fs/promises";
22
+ import { spawnSync } from "node:child_process";
22
23
  import { isAbsolute, join } from "node:path";
23
24
  /** Normalize text for content-matching: drop CR, collapse whitespace, trim. */
24
25
  export function normalizeForMatch(text) {
@@ -32,10 +33,92 @@ export function normalizeForMatch(text) {
32
33
  * grounding and any other consumer that matches a cited `affected_files` path
33
34
  * against a repo manifest. (Quote-and-verify resolves a cited path against the
34
35
  * filesystem instead, so it does not lowercase — see `verifyFindingGrounding`.)
36
+ *
37
+ * INV-B3-1: strips a leading `./` ONLY — it must NEVER strip the leading dot of a
38
+ * dotfile-directory segment (`.claude/…`, `.github/…`). The regex is anchored to
39
+ * `./` (dot-SLASH); do not broaden it to `/^\.\/?/` or similar, or every
40
+ * dotfile-dir citation silently un-grounds (it would no longer match its
41
+ * `git ls-files` form by exact membership).
35
42
  */
36
43
  export function normalizeRepoPath(p) {
37
44
  return p.trim().replace(/\\/g, "/").replace(/^\.\//, "").toLowerCase();
38
45
  }
46
+ /**
47
+ * True when `p` is a bare basename — a single path segment with no separator
48
+ * (`advance.ts`), as opposed to a nested repo-relative path (`src/x/advance.ts`)
49
+ * or a dotfile-dir path (`.claude/hooks/x.mjs`). A bare basename is the one shape
50
+ * that cannot be resolved by a naive `root/<name>` join when the real file is
51
+ * nested, so it is the shape {@link resolveBasenameToTrackedPath} rescues.
52
+ */
53
+ export function isBareBasename(p) {
54
+ const t = p.trim();
55
+ return t.length > 0 && !t.includes("/") && !t.includes("\\");
56
+ }
57
+ /**
58
+ * INV-B3-2: resolve a bare basename (`advance.ts`) to its UNIQUE tracked full
59
+ * path in the known-path corpus (`src/audit/orchestrator/advance.ts`). Returns
60
+ * the single matching corpus entry when exactly one tracked path has that
61
+ * basename; `undefined` when zero OR more-than-one path matches — an ambiguous
62
+ * basename stays a checkable signal, never a silent false-pass.
63
+ *
64
+ * Corpus-agnostic and case-insensitive on the basename: it works whether the
65
+ * caller's corpus is `normalizeRepoPath`-lowercased (the M-B3 gate) or
66
+ * case-preserving (the fs-resolving remediate consumers), and returns the corpus
67
+ * entry as-is so a case-preserving caller gets a real on-disk path back. Single
68
+ * source (drift-plan convention) — the gate, both orchestrators, and
69
+ * `groundDesignFinding` all resolve basenames through this one authority.
70
+ */
71
+ export function resolveBasenameToTrackedPath(basename, knownPaths) {
72
+ const target = basename.trim().replace(/\\/g, "/");
73
+ if (target.length === 0 || target.includes("/"))
74
+ return undefined;
75
+ const targetLower = target.toLowerCase();
76
+ let match;
77
+ for (const path of knownPaths) {
78
+ const base = path.slice(path.lastIndexOf("/") + 1);
79
+ if (base.toLowerCase() === targetLower) {
80
+ if (match !== undefined)
81
+ return undefined; // >1 match → ambiguous
82
+ match = path;
83
+ }
84
+ }
85
+ return match;
86
+ }
87
+ /**
88
+ * Case-preserving corpus of the tracked working-tree paths at `root`, via
89
+ * `git ls-files` (forward-slashed, trimmed). This is the sibling of the M-B3
90
+ * gate's `enumerateRepoTreePaths` (which `normalizeRepoPath`-lowercases for
91
+ * membership matching): the remediate consumers that resolve a basename and then
92
+ * read the file off disk (line counting) need the REAL on-disk case, so this one
93
+ * does not lowercase. Degrades to an empty set when git is missing / not a repo
94
+ * (callers then fall back to their existing `existsSync` check — monotonic, never
95
+ * a regression). OS-agnostic: `shell: false`, forward-slash output.
96
+ */
97
+ export function enumerateTrackedFilePaths(root) {
98
+ const known = new Set();
99
+ let result;
100
+ try {
101
+ result = spawnSync("git", ["ls-files"], {
102
+ cwd: root,
103
+ encoding: "utf8",
104
+ shell: false,
105
+ windowsHide: true,
106
+ maxBuffer: 64 * 1024 * 1024,
107
+ });
108
+ }
109
+ catch {
110
+ return known;
111
+ }
112
+ if (!result || result.status !== 0 || typeof result.stdout !== "string") {
113
+ return known;
114
+ }
115
+ for (const line of result.stdout.split("\n")) {
116
+ const path = line.trim().replace(/\\/g, "/");
117
+ if (path.length > 0)
118
+ known.add(path);
119
+ }
120
+ return known;
121
+ }
39
122
  /**
40
123
  * True when the (normalized) quoted span appears anywhere in the (normalized)
41
124
  * file content. An empty quote never matches (an empty quote grounds nothing).
@@ -1 +1 @@
1
- {"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CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAChF,IAAI,OAAe,CAAC;QACpB,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC;QAC3C,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,kCAAkC,CAAC,CAAC;YAC3D,SAAS;QACX,CAAC;QACD,IAAI,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YAC3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;QAChC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,iCAAiC,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC7D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAmC;IACnE,OAAO,OAAO,CAAC,SAAS,EAAE,MAAM,KAAK,UAAU,CAAC;AAClD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iCAAiC,CAC/C,OAAmC;IAEnC,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC"}
@@ -175,6 +175,90 @@ Use `ui_mode: "visible"` when debugging provider stdout/stderr. Use
175
175
  `subprocess-template` or `vscode-task` only when you have a reliable launcher
176
176
  bridge.
177
177
 
178
+ ## Gate-0 provider confirmation
179
+
180
+ The first thing an interactive audit run does — before it reads the repo — is
181
+ pause on a **provider confirmation** step (Gate-0). The tool auto-detects the
182
+ provider pool it can dispatch to, prices each candidate, and proposes a cost
183
+ ordering (cheapest capable first). You confirm, reorder, or amend it. The
184
+ mechanism behind the ordering is documented in
185
+ [`spec/cost-first-routing.md`](../../spec/cost-first-routing.md); this section is
186
+ only how to respond to the step.
187
+
188
+ ### When it fires
189
+
190
+ - On the conversation/CLI path (`audit-code next-step`) it fires on **every** run,
191
+ even when only one — or zero — providers were auto-detected, so you can reorder,
192
+ exclude, self-report your own model roster, or add a provider that discovery missed.
193
+ - Headless (`audit-code advance-audit`, no interactive host) it auto-completes with
194
+ the tool's price-ascending suggestion and never pauses.
195
+
196
+ ### How to respond
197
+
198
+ The step prints the suggested pool as a priced table and asks you to write your
199
+ decision to:
200
+
201
+ ```text
202
+ .audit-tools/audit/provider-confirmation.input.json
203
+ ```
204
+
205
+ **Writing that file is what lets the run proceed** — its presence is the "operator
206
+ has acted" signal. To accept the suggestion verbatim, write just the version:
207
+
208
+ ```json
209
+ { "schema_version": "provider-confirmation-input/v1" }
210
+ ```
211
+
212
+ Every other field is optional:
213
+
214
+ ```json
215
+ {
216
+ "schema_version": "provider-confirmation-input/v1",
217
+ "cost_order": ["<provider-or-model-key>", "..."],
218
+ "exclude": ["<provider-name>"],
219
+ "include": ["<self-spawn-blocked provider to opt back in>"],
220
+ "host_models": [{ "model_id": "<your model id>", "tier": "frontier|capable|fast" }]
221
+ }
222
+ ```
223
+
224
+ - `cost_order` — the confirmed ordering, cheapest first, as a list of keys. A key
225
+ is either a **provider name** (as shown in the table) or a **host `model_id`** you
226
+ report in `host_models`. Keys you omit keep their suggested relative order,
227
+ appended after the ones you name; unrecognized keys are ignored. Omit it to accept
228
+ the suggested order.
229
+ - `exclude` — drops a provider from the dispatchable pool.
230
+ - `include` — opts a self-spawn-blocked provider back in. A CLI provider detected
231
+ while you are already inside a session of that same agent (`claude-code` under
232
+ `CLAUDECODE`, `codex` under `CODEX`) is excluded by default so the run can't
233
+ self-spawn a fresh agent; naming it here overrides that. Advanced — normally leave
234
+ it excluded.
235
+ - `host_models` — reports your own (the host agent's) model roster so those tiers
236
+ are priced from the models.dev dataset and orderable here, not just at dispatch.
237
+
238
+ You supply only ordering intent plus your model roster. The tool owns the prices,
239
+ the capability flags, and the roster snapshot — you never hand-author those. If a
240
+ provider you use isn't listed, it wasn't auto-detected: add its config to
241
+ `session-config.json` (an OpenAI-compatible endpoint via
242
+ `openai_compatible.{base_url,model,api_key_env}`, or a CLI backend via its
243
+ `<name>.command`) and re-run the step.
244
+
245
+ Once the input is written, re-run the continue command the step printed
246
+ (`audit-code next-step`). The tool consumes the input and promotes it into both
247
+ canonical artifacts: the per-tool `provider_confirmation.json` seam and the shared
248
+ `.audit-tools/provider-confirmation.json`.
249
+
250
+ ### The confirmed pool persists — you aren't re-prompted
251
+
252
+ The shared `.audit-tools/provider-confirmation.json` is written once and reused for
253
+ the rest of the audit→remediate session. A later step, and a subsequent
254
+ `remediate-code` run against the same repo, read and honor that pool without
255
+ prompting again — `remediate-code` has no confirmation step of its own; it consumes
256
+ the audit-side pool. You are only re-prompted if the discovered provider roster
257
+ changes (a provider appears or disappears since it was confirmed), which forces a
258
+ fresh confirmation so a vanished provider is never pinned. If the file is absent
259
+ (for example a standalone remediate run with no prior audit), the run resolves its
260
+ provider independently — absence is never an error.
261
+
178
262
  ## Model selection
179
263
 
180
264
  Conversation-level model choice belongs to the host conversation. The backend
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "audit-tools",
3
- "version": "0.32.22",
3
+ "version": "0.32.27",
4
4
  "private": false,
5
5
  "license": "ISC",
6
6
  "description": "Portable hybrid code auditing + remediation orchestrators for arbitrary repositories.",
@@ -42,7 +42,7 @@
42
42
  "test:doc-contract": "vitest run tests/audit/release-contract.test.mjs tests/audit/priority-chain-doc-sync.test.mjs tests/audit/file-lock-doc-sync.test.mjs tests/audit/host-asset-renderer-drift.test.mjs",
43
43
  "test": "npm run build && vitest run",
44
44
  "test:single": "npm run build && vitest run",
45
- "verify:checks": "npm run check && npm run check:deadcode && npm run check:doc-manifest && npm run build && npm run verify:hosts && npm run verify:remediate-hosts && npm run smoke:packaged-audit-code && npm run smoke:packaged-remediate-code",
45
+ "verify:checks": "node scripts/shared/profile-run.mjs verify-checks check:deadcode check:doc-manifest build verify:hosts verify:remediate-hosts smoke:packaged-audit-code smoke:packaged-remediate-code",
46
46
  "verify:release": "npm run verify:checks && vitest run",
47
47
  "check:deadcode": "knip --no-config-hints",
48
48
  "check:doc-manifest": "node scripts/check-doc-manifest.mjs",