audit-tools 0.41.0 → 0.42.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.
- package/dist/audit/cli/args.d.ts +0 -1
- package/dist/audit/cli/args.d.ts.map +1 -1
- package/dist/audit/cli/args.js +0 -7
- package/dist/audit/cli/args.js.map +1 -1
- package/dist/audit/cli/auditStep.d.ts +18 -0
- package/dist/audit/cli/auditStep.d.ts.map +1 -1
- package/dist/audit/cli/auditStep.js +35 -1
- package/dist/audit/cli/auditStep.js.map +1 -1
- package/dist/audit/cli/cleanup.d.ts +1 -0
- package/dist/audit/cli/cleanup.d.ts.map +1 -1
- package/dist/audit/cli/cleanup.js +22 -7
- package/dist/audit/cli/cleanup.js.map +1 -1
- package/dist/audit/cli/confirmIntentStep.d.ts.map +1 -1
- package/dist/audit/cli/confirmIntentStep.js +11 -0
- package/dist/audit/cli/confirmIntentStep.js.map +1 -1
- package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
- package/dist/audit/cli/dispatch/hostHandoff.js +110 -29
- package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
- package/dist/audit/cli/envelope.d.ts +0 -24
- package/dist/audit/cli/envelope.d.ts.map +1 -1
- package/dist/audit/cli/envelope.js +0 -18
- package/dist/audit/cli/envelope.js.map +1 -1
- package/dist/audit/cli/fanoutLanes.d.ts +24 -0
- package/dist/audit/cli/fanoutLanes.d.ts.map +1 -1
- package/dist/audit/cli/fanoutLanes.js +46 -2
- package/dist/audit/cli/fanoutLanes.js.map +1 -1
- package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
- package/dist/audit/cli/nextStepCommand.js +19 -24
- package/dist/audit/cli/nextStepCommand.js.map +1 -1
- package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
- package/dist/audit/cli/nextStepHelpers.js +20 -6
- package/dist/audit/cli/nextStepHelpers.js.map +1 -1
- package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
- package/dist/audit/cli/semanticReviewStep.js +5 -1
- package/dist/audit/cli/semanticReviewStep.js.map +1 -1
- package/dist/audit/cli/workerResult.d.ts +0 -13
- package/dist/audit/cli/workerResult.d.ts.map +1 -1
- package/dist/audit/cli/workerResult.js +0 -15
- package/dist/audit/cli/workerResult.js.map +1 -1
- package/dist/audit/contracts/workerSchemas.d.ts +13 -83
- package/dist/audit/contracts/workerSchemas.d.ts.map +1 -1
- package/dist/audit/contracts/workerSchemas.js +10 -4
- package/dist/audit/contracts/workerSchemas.js.map +1 -1
- package/dist/audit/orchestrator/advance.d.ts +30 -0
- package/dist/audit/orchestrator/advance.d.ts.map +1 -1
- package/dist/audit/orchestrator/advance.js +45 -2
- package/dist/audit/orchestrator/advance.js.map +1 -1
- package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
- package/dist/audit/orchestrator/designReviewPrompt.js +6 -4
- package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
- package/dist/audit/orchestrator/ingestionExecutors.d.ts.map +1 -1
- package/dist/audit/orchestrator/ingestionExecutors.js +13 -16
- package/dist/audit/orchestrator/ingestionExecutors.js.map +1 -1
- package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts +8 -0
- package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts.map +1 -1
- package/dist/audit/orchestrator/intentCheckpointExecutor.js +2 -0
- package/dist/audit/orchestrator/intentCheckpointExecutor.js.map +1 -1
- package/dist/audit/orchestrator/lensSelection.d.ts +19 -0
- package/dist/audit/orchestrator/lensSelection.d.ts.map +1 -1
- package/dist/audit/orchestrator/lensSelection.js +24 -0
- package/dist/audit/orchestrator/lensSelection.js.map +1 -1
- package/dist/audit/orchestrator/planningExecutors.d.ts +1 -12
- package/dist/audit/orchestrator/planningExecutors.d.ts.map +1 -1
- package/dist/audit/orchestrator/planningExecutors.js +14 -64
- package/dist/audit/orchestrator/planningExecutors.js.map +1 -1
- package/dist/audit/orchestrator/requeueFold.d.ts +43 -0
- package/dist/audit/orchestrator/requeueFold.d.ts.map +1 -0
- package/dist/audit/orchestrator/requeueFold.js +50 -0
- package/dist/audit/orchestrator/requeueFold.js.map +1 -0
- package/dist/audit/orchestrator/reviewPacketSizing.d.ts +0 -1
- package/dist/audit/orchestrator/reviewPacketSizing.d.ts.map +1 -1
- package/dist/audit/orchestrator/reviewPacketSizing.js +0 -5
- package/dist/audit/orchestrator/reviewPacketSizing.js.map +1 -1
- package/dist/audit/orchestrator/reviewPackets.d.ts +8 -2
- package/dist/audit/orchestrator/reviewPackets.d.ts.map +1 -1
- package/dist/audit/orchestrator/reviewPackets.js +7 -8
- package/dist/audit/orchestrator/reviewPackets.js.map +1 -1
- package/dist/audit/orchestrator/taskAffinityGraph.d.ts +0 -6
- package/dist/audit/orchestrator/taskAffinityGraph.d.ts.map +1 -1
- package/dist/audit/orchestrator/taskAffinityGraph.js +0 -16
- package/dist/audit/orchestrator/taskAffinityGraph.js.map +1 -1
- package/dist/audit/orchestrator/taskBuilder.d.ts.map +1 -1
- package/dist/audit/orchestrator/taskBuilder.js +1 -2
- package/dist/audit/orchestrator/taskBuilder.js.map +1 -1
- package/dist/audit/reporting/workBlocks.d.ts +0 -1
- package/dist/audit/reporting/workBlocks.d.ts.map +1 -1
- package/dist/audit/reporting/workBlocks.js +0 -3
- package/dist/audit/reporting/workBlocks.js.map +1 -1
- package/dist/audit/systemic/systemicChallengeLoop.d.ts +0 -8
- package/dist/audit/systemic/systemicChallengeLoop.d.ts.map +1 -1
- package/dist/audit/systemic/systemicChallengeLoop.js +0 -9
- package/dist/audit/systemic/systemicChallengeLoop.js.map +1 -1
- package/dist/audit/types.d.ts +4 -4
- package/dist/remediate/contractPipeline/artifactStore.d.ts +19 -23
- package/dist/remediate/contractPipeline/artifactStore.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/artifactStore.js +22 -29
- package/dist/remediate/contractPipeline/artifactStore.js.map +1 -1
- package/dist/remediate/contractPipeline/changeClassification.d.ts +0 -12
- package/dist/remediate/contractPipeline/changeClassification.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/changeClassification.js +0 -101
- package/dist/remediate/contractPipeline/changeClassification.js.map +1 -1
- package/dist/remediate/contractPipeline/derive.d.ts +0 -42
- package/dist/remediate/contractPipeline/derive.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/derive.js +0 -108
- package/dist/remediate/contractPipeline/derive.js.map +1 -1
- package/dist/remediate/index.d.ts +0 -1
- package/dist/remediate/index.d.ts.map +1 -1
- package/dist/remediate/index.js +5 -132
- package/dist/remediate/index.js.map +1 -1
- package/dist/remediate/intake.d.ts +0 -55
- package/dist/remediate/intake.d.ts.map +1 -1
- package/dist/remediate/intake.js +1 -81
- package/dist/remediate/intake.js.map +1 -1
- package/dist/remediate/phases/plan.d.ts +0 -1
- package/dist/remediate/phases/plan.d.ts.map +1 -1
- package/dist/remediate/phases/plan.js +1 -207
- package/dist/remediate/phases/plan.js.map +1 -1
- package/dist/remediate/state/types.d.ts +4 -4
- package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipeline.js +6 -6
- package/dist/remediate/steps/contractPipeline.js.map +1 -1
- package/dist/remediate/steps/contractPipelinePrompts.d.ts +9 -9
- package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipelinePrompts.js +25 -17
- package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
- package/dist/remediate/steps/dispatch/hostHandoff.d.ts +0 -1
- package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
- package/dist/remediate/steps/dispatch/hostHandoff.js +3 -2
- package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
- package/dist/remediate/steps/dispatch.d.ts +0 -8
- package/dist/remediate/steps/dispatch.d.ts.map +1 -1
- package/dist/remediate/steps/dispatch.js +3 -9
- package/dist/remediate/steps/dispatch.js.map +1 -1
- package/dist/remediate/steps/nextStep.d.ts +0 -1
- package/dist/remediate/steps/nextStep.d.ts.map +1 -1
- package/dist/remediate/steps/nextStep.js +0 -1
- package/dist/remediate/steps/nextStep.js.map +1 -1
- package/dist/remediate/utils/fileIntegrity.d.ts +0 -8
- package/dist/remediate/utils/fileIntegrity.d.ts.map +1 -1
- package/dist/remediate/utils/fileIntegrity.js +5 -65
- package/dist/remediate/utils/fileIntegrity.js.map +1 -1
- package/dist/remediate/validation/contractPipelineGates.js +3 -3
- package/dist/remediate/validation/contractPipelineGates.js.map +1 -1
- package/dist/shared/analyzers/candidates.d.ts +6 -6
- package/dist/shared/analyzers/candidates.d.ts.map +1 -1
- package/dist/shared/analyzers/candidates.js +6 -6
- package/dist/shared/analyzers/candidates.js.map +1 -1
- package/dist/shared/chunkByBudget.d.ts +8 -8
- package/dist/shared/decompose/contentCoherence.d.ts +0 -271
- package/dist/shared/decompose/contentCoherence.d.ts.map +1 -1
- package/dist/shared/decompose/contentCoherence.js +12 -59
- package/dist/shared/decompose/contentCoherence.js.map +1 -1
- package/dist/shared/decompose/systemicChallenge.d.ts +4 -4
- package/dist/shared/index.d.ts +5 -5
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +4 -4
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/io/auditToolsPaths.d.ts +0 -20
- package/dist/shared/io/auditToolsPaths.d.ts.map +1 -1
- package/dist/shared/io/auditToolsPaths.js +0 -24
- package/dist/shared/io/auditToolsPaths.js.map +1 -1
- package/dist/shared/loopCorePaths.d.ts.map +1 -1
- package/dist/shared/loopCorePaths.js +15 -9
- package/dist/shared/loopCorePaths.js.map +1 -1
- package/dist/shared/types/finding.d.ts +30 -264
- package/dist/shared/types/finding.d.ts.map +1 -1
- package/dist/shared/types/finding.js +60 -0
- package/dist/shared/types/finding.js.map +1 -1
- package/dist/shared/validation/findingGrounding.d.ts +11 -0
- package/dist/shared/validation/findingGrounding.d.ts.map +1 -1
- package/dist/shared/validation/findingGrounding.js +21 -0
- package/dist/shared/validation/findingGrounding.js.map +1 -1
- package/dist/shared/validation/findingsReport.d.ts.map +1 -1
- package/dist/shared/validation/findingsReport.js +0 -6
- package/dist/shared/validation/findingsReport.js.map +1 -1
- package/docs/audit-pkg/contracts.md +2 -2
- package/docs/audit-pkg/development.md +1 -1
- package/docs/audit-pkg/release.md +20 -114
- package/package.json +6 -2
- package/schemas/audit_result.schema.json +0 -20
- package/schemas/audit_results.schema.json +0 -20
- package/schemas/finding.schema.json +0 -20
- package/skills/audit-code/SKILL.md +3 -7
- package/skills/audit-code/audit-code.prompt.md +5 -9
- package/skills/remediate-code/SKILL.md +0 -1
- package/dist/remediate/steps/dispatch/common.d.ts +0 -126
- package/dist/remediate/steps/dispatch/common.d.ts.map +0 -1
- package/dist/remediate/steps/dispatch/common.js +0 -204
- package/dist/remediate/steps/dispatch/common.js.map +0 -1
- package/dist/remediate/steps/dispatch/dagNodeFields.d.ts +0 -25
- package/dist/remediate/steps/dispatch/dagNodeFields.d.ts.map +0 -1
- package/dist/remediate/steps/dispatch/dagNodeFields.js +0 -5
- package/dist/remediate/steps/dispatch/dagNodeFields.js.map +0 -1
- package/dist/remediate/steps/dispatch/implementPrompt.d.ts +0 -47
- package/dist/remediate/steps/dispatch/implementPrompt.d.ts.map +0 -1
- package/dist/remediate/steps/dispatch/implementPrompt.js +0 -165
- package/dist/remediate/steps/dispatch/implementPrompt.js.map +0 -1
- package/dist/remediate/steps/dispatch/verifyCommands.d.ts +0 -144
- package/dist/remediate/steps/dispatch/verifyCommands.d.ts.map +0 -1
- package/dist/remediate/steps/dispatch/verifyCommands.js +0 -331
- package/dist/remediate/steps/dispatch/verifyCommands.js.map +0 -1
- package/dist/remediate/steps/dispatch/writeScope.d.ts +0 -43
- package/dist/remediate/steps/dispatch/writeScope.d.ts.map +0 -1
- package/dist/remediate/steps/dispatch/writeScope.js +0 -81
- package/dist/remediate/steps/dispatch/writeScope.js.map +0 -1
- package/dist/remediate/utils/hostAssets.d.ts +0 -21
- package/dist/remediate/utils/hostAssets.d.ts.map +0 -1
- package/dist/remediate/utils/hostAssets.js +0 -34
- package/dist/remediate/utils/hostAssets.js.map +0 -1
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { realpathSync } from "node:fs";
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
|
-
import { spawnSyncHidden } from "audit-tools/shared";
|
|
4
|
-
import { AGENT_FEEDBACK_FILENAME, normalizeRepoPath, } from "audit-tools/shared";
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
// Path + set primitives
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
/** Normalize a declared path (absolute, repo-relative, or back-slashed) to a repo-relative forward-slash string. */
|
|
9
|
-
export function toRepoRelative(p, root) {
|
|
10
|
-
const normalizedRoot = root.replace(/\\/g, "/").replace(/\/$/, "");
|
|
11
|
-
let s = p.replace(/\\/g, "/");
|
|
12
|
-
if (s.startsWith(normalizedRoot + "/")) {
|
|
13
|
-
s = s.slice(normalizedRoot.length + 1);
|
|
14
|
-
}
|
|
15
|
-
return s;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Canonical comparison key for a filesystem path. `realpathSync` resolves
|
|
19
|
-
* symlinks and platform short-names so it matches git's `--show-toplevel`
|
|
20
|
-
* output (macOS TMPDIR `/var`→`/private/var`, Windows 8.3 names); falls back to
|
|
21
|
-
* `resolve` for paths that don't exist on disk (e.g. mocked unit tests).
|
|
22
|
-
*/
|
|
23
|
-
export function canonicalPathKey(p) {
|
|
24
|
-
try {
|
|
25
|
-
return normalizeRepoPath(realpathSync(p));
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
return normalizeRepoPath(resolve(p));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
|
-
// Git primitives
|
|
33
|
-
// ---------------------------------------------------------------------------
|
|
34
|
-
/**
|
|
35
|
-
* The git top-level directory containing `cwd`, or `null` when `cwd` is not
|
|
36
|
-
* inside a git working tree (or git is unavailable). `git rev-parse
|
|
37
|
-
* --show-toplevel` emits a forward-slash absolute path on every platform.
|
|
38
|
-
*/
|
|
39
|
-
export function gitTopLevel(cwd) {
|
|
40
|
-
const result = spawnSyncHidden("git", ["rev-parse", "--show-toplevel"], {
|
|
41
|
-
cwd,
|
|
42
|
-
encoding: "utf8",
|
|
43
|
-
shell: false,
|
|
44
|
-
});
|
|
45
|
-
if (result.status !== 0)
|
|
46
|
-
return null;
|
|
47
|
-
const top = (result.stdout ?? "").trim();
|
|
48
|
-
return top.length > 0 ? top : null;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* True when `dir` is ITS OWN git top-level — i.e. a real (registered) worktree
|
|
52
|
-
* or repo root, not an orphan plain directory whose git calls resolve UP to an
|
|
53
|
-
* enclosing checkout. The accept/reverify cluster's defects 4/7/11 all shared
|
|
54
|
-
* one mechanism: a node worktree de-registered mid-recovery leaves a plain dir,
|
|
55
|
-
* and any git call with that cwd silently operates on the MAIN checkout
|
|
56
|
-
* (committing its dirt onto the run branch, or reading its dirty status as the
|
|
57
|
-
* node's un-landed work). Every worktree-cwd git WRITE and every
|
|
58
|
-
* worktree-state READ that feeds a reuse decision must pass this first.
|
|
59
|
-
*/
|
|
60
|
-
export function isOwnGitTopLevel(dir) {
|
|
61
|
-
const top = gitTopLevel(dir);
|
|
62
|
-
return top !== null && canonicalPathKey(top) === canonicalPathKey(dir);
|
|
63
|
-
}
|
|
64
|
-
/** True when `root` is inside a git work tree (the git tool is present and it's a repo). */
|
|
65
|
-
export function isGitWorkTree(root) {
|
|
66
|
-
const probe = spawnSyncHidden("git", ["rev-parse", "--is-inside-work-tree"], { cwd: root, encoding: "utf8", shell: false });
|
|
67
|
-
return !probe.error && probe.status === 0 && /true/.test(probe.stdout ?? "");
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* True when `commitOid` is reachable from `ref` (default HEAD) — the node-identity
|
|
71
|
-
* ancestry probe (INV-WTS-3). `git merge-base --is-ancestor <commit> <ref>` exits 0
|
|
72
|
-
* when the commit IS an ancestor, 1 when it is not, and >1 on a bad object. A
|
|
73
|
-
* landed node's cherry-pick commit stays an ancestor of HEAD as later siblings pile
|
|
74
|
-
* on top; a node whose landing was rolled back / clobbered is NOT an ancestor, so
|
|
75
|
-
* this distinguishes a genuinely-landed node from a false-close (a sibling or
|
|
76
|
-
* pre-existing file at the same path can never make it pass). Fail-closed: a git
|
|
77
|
-
* error / missing object returns false (treated as not-landed → re-block).
|
|
78
|
-
*/
|
|
79
|
-
export function gitCommitIsAncestor(root, commitOid, ref = "HEAD") {
|
|
80
|
-
if (!commitOid)
|
|
81
|
-
return false;
|
|
82
|
-
const probe = spawnSyncHidden("git", ["merge-base", "--is-ancestor", commitOid, ref], { cwd: root, encoding: "utf8", shell: false });
|
|
83
|
-
return !probe.error && probe.status === 0;
|
|
84
|
-
}
|
|
85
|
-
/** True when `branch` resolves to a commit in the repo at `root`. */
|
|
86
|
-
export function gitBranchExists(root, branch) {
|
|
87
|
-
const probe = spawnSyncHidden("git", ["rev-parse", "--verify", "--quiet", `${branch}^{commit}`], { cwd: root, encoding: "utf8", shell: false });
|
|
88
|
-
return !probe.error && probe.status === 0;
|
|
89
|
-
}
|
|
90
|
-
/** Branch name a block's isolated worktree is created on (mirrors `worktreePath`). */
|
|
91
|
-
export function worktreeBranchForBlock(blockId, runId) {
|
|
92
|
-
return `remediate-${blockId}-${runId}`;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* The files a worker's worktree branch changed relative to HEAD — the ground
|
|
96
|
-
* truth for write-scope enforcement. Diffs `HEAD...<branch>` (the branch's own
|
|
97
|
-
* commits). Fail-closed / not-a-repo semantics mirror `gitEditedFiles`.
|
|
98
|
-
*/
|
|
99
|
-
export function gitEditedFilesForBranch(root, branch) {
|
|
100
|
-
if (!isGitWorkTree(root)) {
|
|
101
|
-
return { available: false, reason: "not_a_repo", error: "root is not a git work tree" };
|
|
102
|
-
}
|
|
103
|
-
const diff = spawnSyncHidden("git", ["diff", "--name-only", `HEAD...${branch}`], { cwd: root, encoding: "utf8", shell: false });
|
|
104
|
-
if (diff.error || typeof diff.status !== "number" || diff.status !== 0) {
|
|
105
|
-
const detail = (diff.stderr ?? diff.error?.message ?? "git diff failed").toString().trim();
|
|
106
|
-
return { available: false, reason: "probe_failed", error: detail };
|
|
107
|
-
}
|
|
108
|
-
const files = new Set();
|
|
109
|
-
for (const line of (diff.stdout ?? "").split(/\r?\n/)) {
|
|
110
|
-
const p = line.trim();
|
|
111
|
-
if (p.length > 0)
|
|
112
|
-
files.add(p.replace(/\\/g, "/"));
|
|
113
|
-
}
|
|
114
|
-
return { available: true, files };
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Parse `git diff HEAD...<branch>` into per-hunk NEW-side line ranges — the
|
|
118
|
-
* ground truth for whether two same-file edits actually touch disjoint regions.
|
|
119
|
-
* Mirrors {@link gitEditedFilesForBranch}'s fail-closed / not-a-repo semantics:
|
|
120
|
-
* never throws; on a non-repo / failed probe / malformed diff returns a
|
|
121
|
-
* discriminated result marking hunks unavailable so the caller can fail closed.
|
|
122
|
-
*
|
|
123
|
-
* Paths are normalised to repo-relative forward-slash (the same scheme
|
|
124
|
-
* {@link gitEditedFilesForBranch} emits) so hunk files compare like-for-like
|
|
125
|
-
* with the file set.
|
|
126
|
-
*/
|
|
127
|
-
export function gitHunksForBranch(root, branch) {
|
|
128
|
-
if (!isGitWorkTree(root)) {
|
|
129
|
-
return { available: false, reason: "not_a_repo", error: "root is not a git work tree" };
|
|
130
|
-
}
|
|
131
|
-
const diff = spawnSyncHidden("git",
|
|
132
|
-
// No rename detection / context noise beyond what we parse; a plain unified
|
|
133
|
-
// diff carries the `+++ b/<path>` and `@@ … +start,count @@` headers we need.
|
|
134
|
-
["diff", `HEAD...${branch}`], { cwd: root, encoding: "utf8", shell: false });
|
|
135
|
-
if (diff.error || typeof diff.status !== "number" || diff.status !== 0) {
|
|
136
|
-
const detail = (diff.stderr ?? diff.error?.message ?? "git diff failed").toString().trim();
|
|
137
|
-
return { available: false, reason: "probe_failed", error: detail };
|
|
138
|
-
}
|
|
139
|
-
return parseUnifiedDiffHunks(diff.stdout ?? "");
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Parse a unified-diff body into NEW-side hunk ranges. Extracted for testability
|
|
143
|
-
* (no git spawn). Recognises `+++ b/<path>` file headers and
|
|
144
|
-
* `@@ -a,b +c,d @@` hunk headers; a header we cannot parse fails the whole probe
|
|
145
|
-
* closed (returns `probe_failed`) rather than silently producing partial hunks
|
|
146
|
-
* that would let a real overlap slip through.
|
|
147
|
-
*/
|
|
148
|
-
export function parseUnifiedDiffHunks(diffText) {
|
|
149
|
-
const hunks = [];
|
|
150
|
-
let currentFile = null;
|
|
151
|
-
for (const rawLine of diffText.split(/\r?\n/)) {
|
|
152
|
-
if (rawLine.startsWith("+++ ")) {
|
|
153
|
-
// `+++ b/path` — or `+++ /dev/null` for a pure deletion (no new side).
|
|
154
|
-
const target = rawLine.slice(4).trim();
|
|
155
|
-
if (target === "/dev/null") {
|
|
156
|
-
currentFile = null;
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
// Strip the conventional `b/` prefix; leave already-bare paths intact.
|
|
160
|
-
const bare = target.startsWith("b/") ? target.slice(2) : target;
|
|
161
|
-
currentFile = bare.replace(/\\/g, "/");
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
if (rawLine.startsWith("@@")) {
|
|
165
|
-
const match = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(rawLine);
|
|
166
|
-
if (!match) {
|
|
167
|
-
return {
|
|
168
|
-
available: false,
|
|
169
|
-
reason: "probe_failed",
|
|
170
|
-
error: `unparseable hunk header: ${rawLine}`,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
if (currentFile === null)
|
|
174
|
-
continue; // deletion-only target: no new-side hunk.
|
|
175
|
-
const startLine = Number(match[1]);
|
|
176
|
-
const lineCount = match[2] === undefined ? 1 : Number(match[2]);
|
|
177
|
-
hunks.push({ file: currentFile, startLine, lineCount });
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return { available: true, hunks };
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Files the worker edited (from git) that fall OUTSIDE the block's declared
|
|
184
|
-
* write scope. Result-file artifacts and the agent-feedback file are excluded
|
|
185
|
-
* (they are sanctioned side outputs, never source edits). Returns the offending
|
|
186
|
-
* repo-relative paths (empty when the edits are fully within scope).
|
|
187
|
-
*/
|
|
188
|
-
export function writeScopeViolations(declaredWritePaths, editedFiles, root) {
|
|
189
|
-
const declared = new Set(declaredWritePaths.map((p) => toRepoRelative(p, root)));
|
|
190
|
-
const violations = [];
|
|
191
|
-
for (const edited of editedFiles) {
|
|
192
|
-
const rel = toRepoRelative(edited, root);
|
|
193
|
-
if (declared.has(rel))
|
|
194
|
-
continue;
|
|
195
|
-
// Sanctioned non-source outputs: result JSON files and the reflection file.
|
|
196
|
-
if (rel.endsWith(".result.json"))
|
|
197
|
-
continue;
|
|
198
|
-
if (rel.endsWith(AGENT_FEEDBACK_FILENAME))
|
|
199
|
-
continue;
|
|
200
|
-
violations.push(rel);
|
|
201
|
-
}
|
|
202
|
-
return violations;
|
|
203
|
-
}
|
|
204
|
-
//# sourceMappingURL=common.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/remediate/steps/dispatch/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAO5B,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,oHAAoH;AACpH,MAAM,UAAU,cAA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,CAAC,CAAC,CAAC,CAAC,CAAC;YAChE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,kBAA4B,EAC5B,WAAwB,EACxB,IAAY;IAEZ,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACjF,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,KAAK,MAAM,MAAM,IAAI,WAAW,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACzC,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAChC,4EAA4E;QAC5E,IAAI,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC;YAAE,SAAS;QAC3C,IAAI,GAAG,CAAC,QAAQ,CAAC,uBAAuB,CAAC;YAAE,SAAS;QACpD,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The implementation-DAG node fields `promoteImplementationDagToExtractedPlan`
|
|
3
|
-
* writes onto each Finding (one node ↔ one finding ↔ one block in the contract
|
|
4
|
-
* pipeline). The shared `Finding` type does not declare these overlay fields, so
|
|
5
|
-
* they are read through this structural view rather than added to the shared
|
|
6
|
-
* contract. Every field is optional: a finding sourced from a plain
|
|
7
|
-
* `audit-findings.json` (not the contract pipeline) carries none of them and the
|
|
8
|
-
* seam degrades to the block-level behavior.
|
|
9
|
-
*/
|
|
10
|
-
export interface DagNodeFields {
|
|
11
|
-
/** Upstream contracts' declared outputs this node builds on. */
|
|
12
|
-
preconditions?: string[];
|
|
13
|
-
/** Human-readable description of the concrete changes the node is expected to produce. */
|
|
14
|
-
expected_changes?: string;
|
|
15
|
-
/** Human-readable verification checks beyond `targeted_commands`. */
|
|
16
|
-
verification?: string[];
|
|
17
|
-
/**
|
|
18
|
-
* Reconciliation expectations carried from seam reconciliation: what an
|
|
19
|
-
* upstream/neighbor contract agreed to provide this node, expressed either as
|
|
20
|
-
* a list of strings or, when richer, as the precondition list. Read tolerantly
|
|
21
|
-
* because the promotion shape can vary across pipeline versions.
|
|
22
|
-
*/
|
|
23
|
-
reconciliation_expectations?: string[];
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=dagNodeFields.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dagNodeFields.d.ts","sourceRoot":"","sources":["../../../../src/remediate/steps/dispatch/dagNodeFields.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,0FAA0F;IAC1F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;;;;OAKG;IACH,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC;CACxC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dagNodeFields.js","sourceRoot":"","sources":["../../../../src/remediate/steps/dispatch/dagNodeFields.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Best-effort: repo-relative test files that reference any of `sourceFiles` (by
|
|
3
|
-
* module basename). Pulling them into a block's access lets the worker that
|
|
4
|
-
* changes or removes a symbol also fix the tests that assert it, instead of
|
|
5
|
-
* leaving orphaned test breakage for a separate central mop-up. Matching is
|
|
6
|
-
* deliberately loose (a false positive only grants slightly broader, harmless
|
|
7
|
-
* write access; a false negative is the failure mode we want to avoid).
|
|
8
|
-
*/
|
|
9
|
-
export interface TestFileEntry {
|
|
10
|
-
rel: string;
|
|
11
|
-
content: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Walk the repo ONCE and read every test file's content (bounded). Built once per
|
|
15
|
-
* dispatch and shared across all blocks so the filesystem walk + reads are not
|
|
16
|
-
* repeated per block.
|
|
17
|
-
*/
|
|
18
|
-
export declare function buildTestFileIndex(root: string): TestFileEntry[];
|
|
19
|
-
/**
|
|
20
|
-
* Collect test files from `index` that reference any of `sourceFiles` by
|
|
21
|
-
* module basename. When `packageRoot` is supplied (repo-relative prefix, e.g.
|
|
22
|
-
* `packages/foo`), only test files under that package are considered —
|
|
23
|
-
* otherwise all test files in the index are matched (existing behavior).
|
|
24
|
-
*/
|
|
25
|
-
export declare function collectReferencingTests(index: TestFileEntry[], sourceFiles: string[], packageRoot?: string): string[];
|
|
26
|
-
/**
|
|
27
|
-
* Returns true when any path in `writePaths` is one of the live infra modules.
|
|
28
|
-
* Paths are normalised to forward-slash form (win32 backslash → `/`) and matched
|
|
29
|
-
* by trailing repo-relative segment so absolute/worktree/relative spellings all
|
|
30
|
-
* resolve identically. Used to gate the live-surface verification section in the
|
|
31
|
-
* implement prompt.
|
|
32
|
-
*/
|
|
33
|
-
export declare function isInfraModifyingBlock(writePaths: string[]): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* INV-B3-5: resolve a cited source path to the token the worker should open.
|
|
36
|
-
*
|
|
37
|
-
* A bare basename (`advance.ts`) that uniquely resolves to one tracked path
|
|
38
|
-
* (`src/audit/orchestrator/advance.ts`) is rewritten to that tracked path FIRST,
|
|
39
|
-
* so it never surfaces as a broken `<worktreeRoot>/advance.ts` prefix that
|
|
40
|
-
* misdirects the worker to a non-existent top-level file. Full / dotfile-dir /
|
|
41
|
-
* already-absolute / drive-letter paths pass through unchanged; when a worktree
|
|
42
|
-
* root is present, a relative path is prefixed onto it (unchanged behaviour). An
|
|
43
|
-
* ambiguous or unresolvable basename is left as-is (monotonic — never a
|
|
44
|
-
* regression on paths that already resolved).
|
|
45
|
-
*/
|
|
46
|
-
export declare function resolveCitationPathForPrompt(rel: string, worktreeRoot: string | undefined, trackedPaths: ReadonlySet<string>): string;
|
|
47
|
-
//# sourceMappingURL=implementPrompt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"implementPrompt.d.ts","sourceRoot":"","sources":["../../../../src/remediate/steps/dispatch/implementPrompt.ts"],"names":[],"mappings":"AAyCA;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAYhE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,aAAa,EAAE,EACtB,WAAW,EAAE,MAAM,EAAE,EACrB,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,EAAE,CAsBV;AAsCD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAUnE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAChC,MAAM,CASR"}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { readFileSync, readdirSync } from "node:fs";
|
|
2
|
-
import { join, relative } from "node:path";
|
|
3
|
-
import { toPromptPathToken, isBareBasename, resolveBasenameToTrackedPath, } from "audit-tools/shared";
|
|
4
|
-
const TEST_FILE_RE = /\.(test|spec)\.[cm]?[jt]sx?$/;
|
|
5
|
-
const WALK_SKIP_DIRS = new Set([
|
|
6
|
-
"node_modules", ".git", "dist", "build", "coverage", "out",
|
|
7
|
-
".next", ".turbo", ".audit-tools",
|
|
8
|
-
]);
|
|
9
|
-
/** Bounded recursive scan for test files under `root` (skips vendor/build dirs). */
|
|
10
|
-
function walkTestFiles(root, max = 400) {
|
|
11
|
-
const out = [];
|
|
12
|
-
const stack = [root];
|
|
13
|
-
let visited = 0;
|
|
14
|
-
while (stack.length > 0 && out.length < max) {
|
|
15
|
-
const dir = stack.pop();
|
|
16
|
-
let entries;
|
|
17
|
-
try {
|
|
18
|
-
entries = readdirSync(dir, { withFileTypes: true });
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
for (const entry of entries) {
|
|
24
|
-
if (++visited > 20000)
|
|
25
|
-
return out;
|
|
26
|
-
if (entry.isDirectory()) {
|
|
27
|
-
if (WALK_SKIP_DIRS.has(entry.name) || entry.name.startsWith(".test-"))
|
|
28
|
-
continue;
|
|
29
|
-
stack.push(join(dir, entry.name));
|
|
30
|
-
}
|
|
31
|
-
else if (TEST_FILE_RE.test(entry.name)) {
|
|
32
|
-
out.push(join(dir, entry.name));
|
|
33
|
-
if (out.length >= max)
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return out;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Walk the repo ONCE and read every test file's content (bounded). Built once per
|
|
42
|
-
* dispatch and shared across all blocks so the filesystem walk + reads are not
|
|
43
|
-
* repeated per block.
|
|
44
|
-
*/
|
|
45
|
-
export function buildTestFileIndex(root) {
|
|
46
|
-
const index = [];
|
|
47
|
-
for (const testPath of walkTestFiles(root)) {
|
|
48
|
-
let content;
|
|
49
|
-
try {
|
|
50
|
-
content = readFileSync(testPath, "utf8");
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
index.push({ rel: relative(root, testPath).replace(/\\/g, "/"), content });
|
|
56
|
-
}
|
|
57
|
-
return index;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Collect test files from `index` that reference any of `sourceFiles` by
|
|
61
|
-
* module basename. When `packageRoot` is supplied (repo-relative prefix, e.g.
|
|
62
|
-
* `packages/foo`), only test files under that package are considered —
|
|
63
|
-
* otherwise all test files in the index are matched (existing behavior).
|
|
64
|
-
*/
|
|
65
|
-
export function collectReferencingTests(index, sourceFiles, packageRoot) {
|
|
66
|
-
if (sourceFiles.length === 0 || index.length === 0)
|
|
67
|
-
return [];
|
|
68
|
-
const basenames = sourceFiles
|
|
69
|
-
.map((f) => (f.split(/[/\\]/).pop() ?? f).replace(/\.[cm]?[jt]sx?$/, ""))
|
|
70
|
-
.filter((b) => b.length > 1);
|
|
71
|
-
if (basenames.length === 0)
|
|
72
|
-
return [];
|
|
73
|
-
const needles = basenames.map((b) => new RegExp(`\\b${b.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`));
|
|
74
|
-
const sourceSet = new Set(sourceFiles.map((f) => f.replace(/\\/g, "/")));
|
|
75
|
-
// Normalize packageRoot to forward slashes and ensure it ends without trailing slash
|
|
76
|
-
const pkgPrefix = packageRoot
|
|
77
|
-
? packageRoot.replace(/\\/g, "/").replace(/\/$/, "") + "/"
|
|
78
|
-
: null;
|
|
79
|
-
const result = [];
|
|
80
|
-
for (const { rel, content } of index) {
|
|
81
|
-
if (sourceSet.has(rel))
|
|
82
|
-
continue;
|
|
83
|
-
// If a package scope is set, skip files outside that package
|
|
84
|
-
if (pkgPrefix && !rel.startsWith(pkgPrefix))
|
|
85
|
-
continue;
|
|
86
|
-
if (needles.some((re) => re.test(content)))
|
|
87
|
-
result.push(rel);
|
|
88
|
-
}
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
// ---------------------------------------------------------------------------
|
|
92
|
-
// Infra-modifying block detection
|
|
93
|
-
// ---------------------------------------------------------------------------
|
|
94
|
-
/**
|
|
95
|
-
* The live dispatch/orchestration modules whose modification can break the
|
|
96
|
-
* running engine mid-run. Derived from the REAL post-A12 source layout
|
|
97
|
-
* (`src/remediate/...`) — this module IS one of them (`steps/dispatch.ts`), so
|
|
98
|
-
* the list is anchored to the actual files on disk, not a hand-typed monorepo
|
|
99
|
-
* path that drifts when the tree is reorganised (the pre-A12
|
|
100
|
-
* `packages/remediate-code/...` list silently matched NOTHING after the
|
|
101
|
-
* collapse, so every infra block rendered as non-infra). Each entry is the
|
|
102
|
-
* module's path relative to the `src/remediate` area, forward-slash form.
|
|
103
|
-
*/
|
|
104
|
-
const INFRA_MODULE_SUBPATHS = [
|
|
105
|
-
"steps/nextStep.ts",
|
|
106
|
-
"steps/dispatch.ts",
|
|
107
|
-
"state/store.ts",
|
|
108
|
-
"steps/contractPipeline.ts",
|
|
109
|
-
"steps/stepWriter.ts",
|
|
110
|
-
];
|
|
111
|
-
/**
|
|
112
|
-
* The infra module sub-paths anchored under `src/remediate/` — the canonical
|
|
113
|
-
* repo-relative form for the current (post-A12) single-package layout. A write
|
|
114
|
-
* path matches when its normalised (forward-slash) form ends with one of these
|
|
115
|
-
* segments, so an absolute worktree path
|
|
116
|
-
* (`.../worktrees/foo/src/remediate/steps/dispatch.ts`), a repo-relative path
|
|
117
|
-
* (`src/remediate/steps/dispatch.ts`), or a Windows backslash path all match,
|
|
118
|
-
* while a same-basename file in another area (`src/audit/steps/dispatch.ts`)
|
|
119
|
-
* does not.
|
|
120
|
-
*/
|
|
121
|
-
const INFRA_FILE_SEGMENTS = INFRA_MODULE_SUBPATHS.map((sub) => `src/remediate/${sub}`);
|
|
122
|
-
/**
|
|
123
|
-
* Returns true when any path in `writePaths` is one of the live infra modules.
|
|
124
|
-
* Paths are normalised to forward-slash form (win32 backslash → `/`) and matched
|
|
125
|
-
* by trailing repo-relative segment so absolute/worktree/relative spellings all
|
|
126
|
-
* resolve identically. Used to gate the live-surface verification section in the
|
|
127
|
-
* implement prompt.
|
|
128
|
-
*/
|
|
129
|
-
export function isInfraModifyingBlock(writePaths) {
|
|
130
|
-
for (const p of writePaths) {
|
|
131
|
-
const normalized = p.replace(/\\/g, "/");
|
|
132
|
-
for (const segment of INFRA_FILE_SEGMENTS) {
|
|
133
|
-
if (normalized === segment || normalized.endsWith("/" + segment)) {
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* INV-B3-5: resolve a cited source path to the token the worker should open.
|
|
142
|
-
*
|
|
143
|
-
* A bare basename (`advance.ts`) that uniquely resolves to one tracked path
|
|
144
|
-
* (`src/audit/orchestrator/advance.ts`) is rewritten to that tracked path FIRST,
|
|
145
|
-
* so it never surfaces as a broken `<worktreeRoot>/advance.ts` prefix that
|
|
146
|
-
* misdirects the worker to a non-existent top-level file. Full / dotfile-dir /
|
|
147
|
-
* already-absolute / drive-letter paths pass through unchanged; when a worktree
|
|
148
|
-
* root is present, a relative path is prefixed onto it (unchanged behaviour). An
|
|
149
|
-
* ambiguous or unresolvable basename is left as-is (monotonic — never a
|
|
150
|
-
* regression on paths that already resolved).
|
|
151
|
-
*/
|
|
152
|
-
export function resolveCitationPathForPrompt(rel, worktreeRoot, trackedPaths) {
|
|
153
|
-
let target = rel;
|
|
154
|
-
if (isBareBasename(rel)) {
|
|
155
|
-
const resolved = resolveBasenameToTrackedPath(rel, trackedPaths);
|
|
156
|
-
if (resolved)
|
|
157
|
-
target = resolved;
|
|
158
|
-
}
|
|
159
|
-
if (!worktreeRoot)
|
|
160
|
-
return target;
|
|
161
|
-
if (target.startsWith("/") || /^[A-Za-z]:[/\\]/.test(target))
|
|
162
|
-
return target;
|
|
163
|
-
return toPromptPathToken(join(worktreeRoot, target));
|
|
164
|
-
}
|
|
165
|
-
//# sourceMappingURL=implementPrompt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"implementPrompt.js","sourceRoot":"","sources":["../../../../src/remediate/steps/dispatch/implementPrompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAE5B,MAAM,YAAY,GAAG,8BAA8B,CAAC;AACpD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK;IAC1D,OAAO,EAAE,QAAQ,EAAE,cAAc;CAClC,CAAC,CAAC;AAEH,oFAAoF;AACpF,SAAS,aAAa,CAAC,IAAY,EAAE,GAAG,GAAG,GAAG;IAC5C,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,KAAK,GAAa,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QAC5C,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAG,CAAC;QACzB,IAAI,OAAO,CAAC;QACZ,IAAI,CAAC;YACH,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,EAAE,OAAO,GAAG,KAAK;gBAAE,OAAO,GAAG,CAAC;YAClC,IAAI,KAAK,CAAC,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,MAAM,CAAC;IACjC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC5E,OAAO,iBAAiB,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import type { RemediationState } from "../../state/store.js";
|
|
2
|
-
/**
|
|
3
|
-
* The host manages the build centrally; a per-node verify command that runs
|
|
4
|
-
* `npm run build` (or a `npm test` whose package script prepends a build) races
|
|
5
|
-
* the central build's dist/ and is therefore forbidden. A command is build-free
|
|
6
|
-
* only when it neither builds nor invokes a build-prepending test script.
|
|
7
|
-
*
|
|
8
|
-
* Forbidden (return false):
|
|
9
|
-
* - `npm run build` / `npm run build -w ...` / `tsc` emit (`tsc -b`, `tsc --build`)
|
|
10
|
-
* - bare `npm test` / `npm t` / `npm run test` (the package script prepends build)
|
|
11
|
-
*
|
|
12
|
-
* Allowed (return true):
|
|
13
|
-
* - `npm run check` (no emit)
|
|
14
|
-
* - `npx vitest run <path>` / `vitest run <path>`
|
|
15
|
-
* - `node --test <path>`
|
|
16
|
-
*/
|
|
17
|
-
export declare function isBuildFreeVerifyCommand(cmd: string): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Inject the tsx ESM loader into a bare `node --test <file>` command so the `.mjs`
|
|
20
|
-
* node:test suites (which import `audit-tools/shared` via tsconfig `paths`, honored
|
|
21
|
-
* only by tsx) resolve in a per-node worktree with no built `dist/`. A host- or
|
|
22
|
-
* DAG-authored `node --test tests/audit/x.test.mjs` would otherwise fail module
|
|
23
|
-
* resolution; the tool normalizes it so correctness can't depend on the host
|
|
24
|
-
* remembering to add the loader. Idempotent: a command already carrying
|
|
25
|
-
* `--import tsx/esm` or a `--loader` is left untouched. Mirrors the runner the
|
|
26
|
-
* derived verify uses ({@link verifyCommandsForEdits}), so the displayed per-node
|
|
27
|
-
* command and the in-process verify match.
|
|
28
|
-
*/
|
|
29
|
-
export declare function normalizeNodeTestCommand(cmd: string): string;
|
|
30
|
-
/**
|
|
31
|
-
* True when `cmd` is a test-runner invocation whose target is a whole directory
|
|
32
|
-
* or the entire suite rather than specific test files — e.g. `npx vitest run
|
|
33
|
-
* tests/remediate`, `vitest run` (no path), `node --test tests/audit/`. Such a
|
|
34
|
-
* command, run as an *additional* per-node verify alongside the scoped derive,
|
|
35
|
-
* re-enters the FULL suite inside a per-node worktree. That is the structural
|
|
36
|
-
* deadlock proven 2026-06-30: a source node's whole-suite verify fails on a
|
|
37
|
-
* stale test owned by a DIFFERENT node, and concurrent worktrees race shared
|
|
38
|
-
* test temp dirs. The derived verify already runs this node's OWN touched
|
|
39
|
-
* tests, so a host/DAG-authored whole-suite command adds only risk — the tool
|
|
40
|
-
* drops it rather than relying on the author to scope it (enforce-in-tooling,
|
|
41
|
-
* never host discretion). A command naming at least one concrete `.test.<ext>`
|
|
42
|
-
* file is scoped and kept.
|
|
43
|
-
*/
|
|
44
|
-
export declare function isWholeSuiteTestCommand(cmd: string): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* True when a verify command DEPENDS ON A BUILT `dist/` — either the command
|
|
47
|
-
* string itself references a dist path (spawning the built CLI), or, when
|
|
48
|
-
* `treeRoot` is supplied, a test FILE the command names imports/spawns dist in
|
|
49
|
-
* its content. A per-node worktree has NO dist at all (`dist/` is gitignored
|
|
50
|
-
* and only `node_modules` is junction-linked), so such a command false-reds
|
|
51
|
-
* DETERMINISTICALLY under the by-design build-free accept gate — three accepts
|
|
52
|
-
* in a row failed exactly this way (2026-07-23 dogfood, backlog "build-free
|
|
53
|
-
* accept verify false-reds dist-importing targeted commands"). A central build
|
|
54
|
-
* cannot fix it (it materializes MAIN's dist, not the worktree's), so the
|
|
55
|
-
* remedy is the same as the whole-suite / cross-node families: drop from
|
|
56
|
-
* per-node verify and defer to the central close gate, which runs on the
|
|
57
|
-
* merged tree with a fresh build.
|
|
58
|
-
*
|
|
59
|
-
* Detection is deliberately conservative-toward-deferral: a false positive
|
|
60
|
-
* (e.g. a comment mentioning `dist/`) only moves that command to the close
|
|
61
|
-
* gate — never a lost signal, never a false-red.
|
|
62
|
-
*/
|
|
63
|
-
export declare function isDistDependentVerifyCommand(cmd: string, treeRoot?: string): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* True when a verify command names a test FILE that is WORKTREE-HOSTILE: its
|
|
66
|
-
* content spawns the `audit-code` / `remediate-code` driver CLIs, which the
|
|
67
|
-
* worker-context guard (v0.34.19, cwd-discriminated) mechanically refuses from
|
|
68
|
-
* inside a node worktree — so the test deterministically fails there and the
|
|
69
|
-
* node can NEVER accept (accept/reverify cluster defect 8). Same
|
|
70
|
-
* conservative-toward-deferral contract as the dist probe: a false positive
|
|
71
|
-
* only moves the command to the close gate (root cwd, where it runs fine).
|
|
72
|
-
*/
|
|
73
|
-
export declare function isWorktreeHostileVerifyCommand(cmd: string, treeRoot: string): boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Partition verify commands into the per-node-runnable set and the DEFERRED set
|
|
76
|
-
* (dist-dependent OR worktree-hostile — both deterministically false-red inside
|
|
77
|
-
* a build-free node worktree; the central close gate runs them on the merged
|
|
78
|
-
* tree at the repo root). Content-level detection: `treeRoot` should be the
|
|
79
|
-
* WORKTREE the verify would run in, so the scanned test files are the node's
|
|
80
|
-
* own post-edit versions. The deferred list is DEDUPLICATED — the close gate's
|
|
81
|
-
* replay drains it verbatim, so a doubled entry would run twice there.
|
|
82
|
-
*/
|
|
83
|
-
export declare function partitionDeferredVerifyCommands(commands: string[], treeRoot: string): {
|
|
84
|
-
kept: string[];
|
|
85
|
-
deferred: string[];
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* cg-1: collapse the per-node DEFERRED verify commands into the close gate's
|
|
89
|
-
* single residual run. Exact-duplicate commands collapse to one (first-seen
|
|
90
|
-
* order); when the close phase's own full-suite leg ran green
|
|
91
|
-
* (`fullSuiteCovers`), any command that leg already covers is SUBSUMED and
|
|
92
|
-
* dropped — a whole-suite runner invocation, or a vitest run whose path tokens
|
|
93
|
-
* are all test files (the full vitest sweep runs every test file). Everything
|
|
94
|
-
* else (e.g. `npm run check`, dist-spawning scripts) survives as the residual
|
|
95
|
-
* the close gate must run exactly once. The 2026-08-06 run drained the raw
|
|
96
|
-
* per-node lists verbatim — duplicate full `tests/audit` passes, a 2h close.
|
|
97
|
-
*/
|
|
98
|
-
export declare function dedupeDeferredVerifyCommands(deferred: Iterable<string>, opts: {
|
|
99
|
-
fullSuiteCovers: boolean;
|
|
100
|
-
}): {
|
|
101
|
-
residual: string[];
|
|
102
|
-
subsumed: string[];
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* Repo-relative path-like tokens in a shell command — tokens containing a `/` and a
|
|
106
|
-
* file extension (e.g. `scripts/remediate/verify-hosts.mjs`, `tests/x.test.ts`).
|
|
107
|
-
* Used to decide whether a targeted verify command is self-contained.
|
|
108
|
-
*/
|
|
109
|
-
export declare function pathTokensInCommand(cmd: string): string[];
|
|
110
|
-
/**
|
|
111
|
-
* Keep only the targeted verify commands that are SELF-CONTAINED for this node:
|
|
112
|
-
* every path-like token they reference is either one of the node's own paths (its
|
|
113
|
-
* declared write set ∪ the files it actually edited on its branch) or already
|
|
114
|
-
* present in the tree. A command referencing a path this node doesn't own and that
|
|
115
|
-
* isn't in the tree depends on a SIBLING node's not-yet-created deliverable —
|
|
116
|
-
* running it in per-node verify is a guaranteed-fail deadlock (proven 2026-07-03: a
|
|
117
|
-
* node's `targeted_command` was `node scripts/remediate/verify-hosts.mjs`, another
|
|
118
|
-
* node's pending output). Per-node verify must be self-contained; such a cross-node
|
|
119
|
-
* command is dropped here and deferred to the integration/close gate. A command with
|
|
120
|
-
* no path tokens (e.g. `npm run check`) is always kept.
|
|
121
|
-
*/
|
|
122
|
-
export declare function selfContainedVerifyCommands(commands: string[], ownPaths: Iterable<string>, treeRoot: string): string[];
|
|
123
|
-
/**
|
|
124
|
-
* Derive a node's per-node verify commands from the test files it ACTUALLY touched
|
|
125
|
-
* on its worktree branch (the git ground truth), instead of trusting host-authored
|
|
126
|
-
* `targeted_commands` whose paths/runner can drift from where the worker put the
|
|
127
|
-
* test. Always typechecks (`npm run check`, no emit), then runs ONLY this node's
|
|
128
|
-
* own touched test files with the repo's runners — never the whole suite (which
|
|
129
|
-
* would re-enter worktree-spawning tests inside a nested worktree). Build-free: the
|
|
130
|
-
* host owns the central build; a node's own test imports the source it changed via
|
|
131
|
-
* the tsx loader. Returns `[]` when there is no git ground truth so the caller can
|
|
132
|
-
* skip the gate rather than fabricate a command.
|
|
133
|
-
*/
|
|
134
|
-
/** Pure assembly (git-free) of the verify commands for a set of edited paths —
|
|
135
|
-
* the testable core of {@link deriveVerifyCommandsFromBranch}. */
|
|
136
|
-
export declare function verifyCommandsForEdits(editedFiles: Iterable<string>): string[];
|
|
137
|
-
export declare function deriveVerifyCommandsFromBranch(root: string, branch: string): string[];
|
|
138
|
-
/**
|
|
139
|
-
* A node's own `targeted_commands` for the per-node verify (task_7d35176d) — the union
|
|
140
|
-
* of the block's `targeted_commands` and its findings' `targeted_commands` (the
|
|
141
|
-
* auditor-specified, fix-specific verification) bound into the host workload.
|
|
142
|
-
*/
|
|
143
|
-
export declare function targetedCommandsForBlock(state: RemediationState, blockId: string): string[];
|
|
144
|
-
//# sourceMappingURL=verifyCommands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verifyCommands.d.ts","sourceRoot":"","sources":["../../../../src/remediate/steps/dispatch/verifyCommands.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAO7D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CA4B7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,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