auditor-lambda 0.10.3 → 0.10.7
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/audit-code-wrapper-build.mjs +198 -0
- package/audit-code-wrapper-install-hosts.mjs +1140 -0
- package/audit-code-wrapper-io.mjs +155 -0
- package/audit-code-wrapper-legacy.mjs +125 -0
- package/audit-code-wrapper-lib.mjs +17 -1801
- package/audit-code-wrapper-opencode.mjs +256 -0
- package/dispatch/merge-results.mjs +5 -3
- package/dispatch/validate-result.mjs +2 -2
- package/dist/adapters/coverageSummary.js +6 -2
- package/dist/adapters/normalizeExternal.js +16 -1
- package/dist/adapters/npmAudit.js +20 -9
- package/dist/adapters/semgrep.js +26 -1
- package/dist/cli/advanceAuditCommand.d.ts +1 -0
- package/dist/cli/advanceAuditCommand.js +95 -0
- package/dist/cli/args.js +1 -2
- package/dist/cli/auditStep.js +2 -2
- package/dist/cli/cleanup.d.ts +11 -1
- package/dist/cli/cleanup.js +25 -5
- package/dist/cli/cleanupCommand.d.ts +1 -0
- package/dist/cli/cleanupCommand.js +24 -0
- package/dist/cli/dispatch.d.ts +55 -31
- package/dist/cli/dispatch.js +298 -241
- package/dist/cli/dispatchStatusCommand.d.ts +1 -0
- package/dist/cli/dispatchStatusCommand.js +68 -0
- package/dist/cli/explainTaskCommand.d.ts +1 -0
- package/dist/cli/explainTaskCommand.js +33 -0
- package/dist/cli/importExternalAnalyzerCommand.d.ts +1 -0
- package/dist/cli/importExternalAnalyzerCommand.js +20 -0
- package/dist/cli/ingestResultsCommand.d.ts +1 -0
- package/dist/cli/ingestResultsCommand.js +34 -0
- package/dist/cli/intakeCommand.d.ts +1 -0
- package/dist/cli/intakeCommand.js +17 -0
- package/dist/cli/lineIndex.js +19 -12
- package/dist/cli/nextStepCommand.d.ts +139 -0
- package/dist/cli/nextStepCommand.js +281 -232
- package/dist/cli/planCommand.d.ts +1 -0
- package/dist/cli/planCommand.js +16 -0
- package/dist/cli/prepareDispatchCommand.d.ts +1 -0
- package/dist/cli/prepareDispatchCommand.js +25 -0
- package/dist/cli/quotaCommand.d.ts +1 -0
- package/dist/cli/quotaCommand.js +56 -0
- package/dist/cli/requeueCommand.d.ts +1 -0
- package/dist/cli/requeueCommand.js +10 -0
- package/dist/cli/runToCompletion.js +451 -412
- package/dist/cli/sampleRunCommand.d.ts +1 -0
- package/dist/cli/sampleRunCommand.js +93 -0
- package/dist/cli/statusCommand.js +1 -1
- package/dist/cli/steps.js +4 -1
- package/dist/cli/submitPacketCommand.js +16 -15
- package/dist/cli/synthesizeCommand.d.ts +1 -0
- package/dist/cli/synthesizeCommand.js +15 -0
- package/dist/cli/updateRuntimeValidationCommand.d.ts +1 -0
- package/dist/cli/updateRuntimeValidationCommand.js +16 -0
- package/dist/cli/validateCommand.d.ts +1 -0
- package/dist/cli/validateCommand.js +41 -0
- package/dist/cli/validateResultCommand.d.ts +1 -0
- package/dist/cli/validateResultCommand.js +63 -0
- package/dist/cli/validateResultsCommand.d.ts +1 -0
- package/dist/cli/validateResultsCommand.js +31 -0
- package/dist/cli/workerRunCommand.d.ts +15 -1
- package/dist/cli/workerRunCommand.js +40 -4
- package/dist/cli.d.ts +3 -2
- package/dist/cli.js +21 -628
- package/dist/coverage.js +7 -3
- package/dist/extractors/analyzers/css.js +2 -2
- package/dist/extractors/analyzers/html.js +2 -2
- package/dist/extractors/analyzers/python.js +2 -2
- package/dist/extractors/analyzers/registry.js +17 -36
- package/dist/extractors/analyzers/treeSitter.d.ts +10 -1
- package/dist/extractors/analyzers/treeSitter.js +28 -6
- package/dist/extractors/analyzers/typescript.js +104 -85
- package/dist/extractors/browserExtension.js +4 -1
- package/dist/extractors/designAssessment.js +21 -21
- package/dist/extractors/fsIntake.js +34 -10
- package/dist/extractors/graph.js +17 -7
- package/dist/extractors/graphManifestEdges/cargo.d.ts +4 -0
- package/dist/extractors/graphManifestEdges/cargo.js +107 -0
- package/dist/extractors/graphManifestEdges/go.d.ts +5 -0
- package/dist/extractors/graphManifestEdges/go.js +151 -0
- package/dist/extractors/graphManifestEdges/index.d.ts +8 -0
- package/dist/extractors/graphManifestEdges/index.js +11 -0
- package/dist/extractors/graphManifestEdges/jsonc.d.ts +3 -0
- package/dist/extractors/graphManifestEdges/jsonc.js +97 -0
- package/dist/extractors/graphManifestEdges/maven.d.ts +3 -0
- package/dist/extractors/graphManifestEdges/maven.js +73 -0
- package/dist/extractors/graphManifestEdges/packageJson.d.ts +19 -0
- package/dist/extractors/graphManifestEdges/packageJson.js +204 -0
- package/dist/extractors/graphManifestEdges/pnpm.d.ts +2 -0
- package/dist/extractors/graphManifestEdges/pnpm.js +42 -0
- package/dist/extractors/graphManifestEdges/pyproject.d.ts +3 -0
- package/dist/extractors/graphManifestEdges/pyproject.js +83 -0
- package/dist/extractors/graphManifestEdges/toml.d.ts +4 -0
- package/dist/extractors/graphManifestEdges/toml.js +68 -0
- package/dist/extractors/graphManifestEdges/typescript.d.ts +3 -0
- package/dist/extractors/graphManifestEdges/typescript.js +56 -0
- package/dist/extractors/graphManifestEdges/workspace.d.ts +10 -0
- package/dist/extractors/graphManifestEdges/workspace.js +72 -0
- package/dist/extractors/graphManifestEdges/yaml.d.ts +3 -0
- package/dist/extractors/graphManifestEdges/yaml.js +59 -0
- package/dist/extractors/graphManifestEdges/yamlPaths.d.ts +4 -0
- package/dist/extractors/graphManifestEdges/yamlPaths.js +89 -0
- package/dist/extractors/graphPythonImports.js +4 -20
- package/dist/extractors/pathPatterns.js +3 -13
- package/dist/io/artifacts.d.ts +1 -1
- package/dist/io/artifacts.js +4 -1
- package/dist/io/runArtifacts.d.ts +8 -2
- package/dist/io/runArtifacts.js +103 -69
- package/dist/io/toolingManifest.js +2 -1
- package/dist/orchestrator/advance.js +36 -0
- package/dist/orchestrator/artifactFreshness.d.ts +1 -1
- package/dist/orchestrator/artifactFreshness.js +1 -1
- package/dist/orchestrator/artifactMetadata.js +5 -5
- package/dist/orchestrator/auditTaskUtils.d.ts +4 -0
- package/dist/orchestrator/auditTaskUtils.js +8 -12
- package/dist/orchestrator/autoFixExecutor.js +40 -26
- package/dist/orchestrator/dependencyMap.js +1 -1
- package/dist/orchestrator/executorResult.d.ts +33 -0
- package/dist/orchestrator/executors.d.ts +7 -0
- package/dist/orchestrator/executors.js +24 -0
- package/dist/orchestrator/fileAnchors.js +42 -29
- package/dist/orchestrator/fileIntegrity.js +6 -1
- package/dist/orchestrator/flowCoverage.js +1 -2
- package/dist/orchestrator/flowPlanning.js +8 -4
- package/dist/orchestrator/graphEnrichmentExecutor.js +67 -45
- package/dist/orchestrator/ingestionExecutors.js +9 -1
- package/dist/orchestrator/intakeExecutors.d.ts +0 -4
- package/dist/orchestrator/intakeExecutors.js +24 -14
- package/dist/orchestrator/localCommands.d.ts +1 -0
- package/dist/orchestrator/localCommands.js +10 -17
- package/dist/orchestrator/nextStep.js +3 -1
- package/dist/orchestrator/requeueCommand.js +4 -0
- package/dist/orchestrator/reviewPacketGraph.js +50 -18
- package/dist/orchestrator/reviewPackets.js +10 -8
- package/dist/orchestrator/runtimeCommand.js +35 -7
- package/dist/orchestrator/runtimeValidationUpdate.js +6 -0
- package/dist/orchestrator/selectiveDeepening/highRiskClean.js +3 -2
- package/dist/orchestrator/selectiveDeepening/lensVerification.js +44 -18
- package/dist/orchestrator/staleness.js +3 -3
- package/dist/orchestrator/state.js +1 -1
- package/dist/orchestrator/syntaxResolutionExecutor.js +17 -24
- package/dist/orchestrator/synthesisExecutors.js +1 -0
- package/dist/orchestrator/taskBuilder.js +5 -4
- package/dist/providers/claudeCodeProvider.js +4 -1
- package/dist/providers/opencodeProvider.js +4 -1
- package/dist/quota/discoveredLimits.js +3 -3
- package/dist/quota/headerExtraction.js +5 -2
- package/dist/quota/headerExtractors/claudeCodeHeaderExtractor.js +3 -0
- package/dist/quota/headerExtractors/index.js +3 -3
- package/dist/quota/index.d.ts +3 -1
- package/dist/quota/index.js +3 -0
- package/dist/reporting/findingRanks.d.ts +3 -0
- package/dist/reporting/findingRanks.js +24 -0
- package/dist/reporting/mergeFindings.js +1 -24
- package/dist/reporting/synthesis.d.ts +3 -1
- package/dist/reporting/synthesis.js +30 -6
- package/dist/reporting/synthesisNarrativePrompt.js +3 -0
- package/dist/reporting/workBlocks.js +1 -14
- package/dist/supervisor/operatorHandoff.js +2 -6
- package/dist/supervisor/runLedger.js +30 -41
- package/dist/types/activeDispatch.d.ts +31 -0
- package/dist/types/activeDispatch.js +2 -0
- package/dist/types.d.ts +21 -4
- package/dist/types.js +24 -16
- package/dist/validation/artifacts.js +3 -0
- package/dist/validation/auditResults.js +8 -2
- package/package.json +2 -2
- package/schemas/audit_findings.schema.json +5 -1
- package/schemas/audit_plan_metrics.schema.json +1 -1
- package/schemas/audit_result.schema.json +5 -6
- package/schemas/audit_task.schema.json +1 -4
- package/schemas/blind_spot_register.schema.json +1 -1
- package/schemas/coverage_matrix.schema.json +2 -8
- package/schemas/finding.schema.json +1 -16
- package/schemas/flow_coverage.schema.json +2 -8
- package/schemas/graph_bundle.schema.json +31 -0
- package/schemas/lens.schema.json +7 -0
- package/schemas/review_packets.schema.json +6 -17
- package/schemas/step_contract.schema.json +8 -2
- package/schemas/unit_manifest.schema.json +1 -4
- package/scripts/postinstall.mjs +3 -1
- package/skills/audit-code/audit-code.prompt.md +2 -3
- package/dist/extractors/graphManifestEdges.d.ts +0 -12
- package/dist/extractors/graphManifestEdges.js +0 -1135
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { access, mkdir, readFile, readdir, stat, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { constants } from 'node:fs';
|
|
3
|
+
import { dirname } from 'node:path';
|
|
4
|
+
|
|
5
|
+
export async function fileExists(path) {
|
|
6
|
+
try {
|
|
7
|
+
await access(path, constants.F_OK);
|
|
8
|
+
return true;
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function newestMtimeMs(path) {
|
|
15
|
+
const stats = await stat(path);
|
|
16
|
+
if (!stats.isDirectory()) {
|
|
17
|
+
return stats.mtimeMs;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let newest = stats.mtimeMs;
|
|
21
|
+
const entries = await readdir(path, { withFileTypes: true });
|
|
22
|
+
for (const entry of entries) {
|
|
23
|
+
const childPath = `${path}/${entry.name}`;
|
|
24
|
+
if (entry.isDirectory()) {
|
|
25
|
+
newest = Math.max(newest, await newestMtimeMs(childPath));
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (entry.isFile()) {
|
|
29
|
+
newest = Math.max(newest, (await stat(childPath)).mtimeMs);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return newest;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function readTextIfExists(path) {
|
|
36
|
+
try {
|
|
37
|
+
return await readFile(path, 'utf8');
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export async function readJson(path, description) {
|
|
44
|
+
const content = await readFile(path, 'utf8');
|
|
45
|
+
try {
|
|
46
|
+
return JSON.parse(content);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
`${description} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function writeGeneratedMarkdown(targetPath, content) {
|
|
55
|
+
const existed = await fileExists(targetPath);
|
|
56
|
+
await mkdir(dirname(targetPath), { recursive: true });
|
|
57
|
+
await writeFile(targetPath, content, 'utf8');
|
|
58
|
+
return {
|
|
59
|
+
path: targetPath,
|
|
60
|
+
mode: existed ? 'updated' : 'created',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function writeGeneratedJson(targetPath, value) {
|
|
65
|
+
const existed = await fileExists(targetPath);
|
|
66
|
+
await mkdir(dirname(targetPath), { recursive: true });
|
|
67
|
+
await writeFile(targetPath, JSON.stringify(value, null, 2) + '\n', 'utf8');
|
|
68
|
+
return {
|
|
69
|
+
path: targetPath,
|
|
70
|
+
mode: existed ? 'updated' : 'created',
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function readJsonObjectIfExists(targetPath, description) {
|
|
75
|
+
if (!(await fileExists(targetPath))) {
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let parsed;
|
|
80
|
+
try {
|
|
81
|
+
parsed = JSON.parse(await readFile(targetPath, 'utf8'));
|
|
82
|
+
} catch (error) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
`${description} exists but is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
89
|
+
throw new Error(`${description} must be a JSON object when it already exists.`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return parsed;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export async function writeMergedGeneratedJson(targetPath, description, buildValue) {
|
|
96
|
+
const existed = await fileExists(targetPath);
|
|
97
|
+
const existing = await readJsonObjectIfExists(targetPath, description);
|
|
98
|
+
await mkdir(dirname(targetPath), { recursive: true });
|
|
99
|
+
await writeFile(
|
|
100
|
+
targetPath,
|
|
101
|
+
JSON.stringify(buildValue(existing), null, 2) + '\n',
|
|
102
|
+
'utf8',
|
|
103
|
+
);
|
|
104
|
+
return {
|
|
105
|
+
path: targetPath,
|
|
106
|
+
mode: existed ? 'updated' : 'created',
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export async function writeGeneratedBinary(targetPath, content) {
|
|
111
|
+
const existed = await fileExists(targetPath);
|
|
112
|
+
await mkdir(dirname(targetPath), { recursive: true });
|
|
113
|
+
await writeFile(targetPath, content);
|
|
114
|
+
return {
|
|
115
|
+
path: targetPath,
|
|
116
|
+
mode: existed ? 'updated' : 'created',
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const INSTALL_MARKER_START = '<!-- audit-code:begin -->';
|
|
121
|
+
const INSTALL_MARKER_END = '<!-- audit-code:end -->';
|
|
122
|
+
|
|
123
|
+
function normalizeNewlines(value) {
|
|
124
|
+
return value.replace(/\r\n/g, '\n');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function upsertManagedBlock(existingContent, blockContent) {
|
|
128
|
+
const normalized = normalizeNewlines(existingContent);
|
|
129
|
+
const blockPattern = new RegExp(
|
|
130
|
+
`${INSTALL_MARKER_START}[\\s\\S]*?${INSTALL_MARKER_END}`,
|
|
131
|
+
'u',
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
if (blockPattern.test(normalized)) {
|
|
135
|
+
return normalized.replace(blockPattern, blockContent);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (normalized.trim().length === 0) {
|
|
139
|
+
return `${blockContent}\n`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return `${normalized.replace(/\s+$/u, '')}\n\n${blockContent}\n`;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export async function writeManagedMarkdown(targetPath, blockContent) {
|
|
146
|
+
const existed = await fileExists(targetPath);
|
|
147
|
+
const existingContent = existed ? await readFile(targetPath, 'utf8') : '';
|
|
148
|
+
const nextContent = upsertManagedBlock(existingContent, blockContent);
|
|
149
|
+
await mkdir(dirname(targetPath), { recursive: true });
|
|
150
|
+
await writeFile(targetPath, nextContent, 'utf8');
|
|
151
|
+
return {
|
|
152
|
+
path: targetPath,
|
|
153
|
+
mode: existed ? 'updated' : 'created',
|
|
154
|
+
};
|
|
155
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { readdir, unlink } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { readTextIfExists } from './audit-code-wrapper-io.mjs';
|
|
4
|
+
|
|
5
|
+
function normalizeNewlines(value) {
|
|
6
|
+
return value.replace(/\r\n/g, '\n');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function looksLikeAuditCodeSkill(content) {
|
|
10
|
+
const normalized = normalizeNewlines(content);
|
|
11
|
+
return (
|
|
12
|
+
/^name:\s*audit-code\b/mu.test(normalized)
|
|
13
|
+
|| normalized.includes('Conversation-first autonomous code auditing workflow for the /audit-code command.')
|
|
14
|
+
|| normalized.includes('The canonical entrypoint is `/audit-code` in conversation.')
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function looksLikeAuditCodePrompt(content) {
|
|
19
|
+
const normalized = normalizeNewlines(content);
|
|
20
|
+
return (
|
|
21
|
+
normalized.includes('# `/audit-code`')
|
|
22
|
+
&& (
|
|
23
|
+
normalized.includes('audit-code orchestrator')
|
|
24
|
+
|| normalized.includes('Autonomous local loop code auditing')
|
|
25
|
+
|| normalized.includes('Conversation-first autonomous code auditing workflow')
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function looksLikeAuditCodeInterfaceMetadata(content) {
|
|
31
|
+
const normalized = normalizeNewlines(content);
|
|
32
|
+
return (
|
|
33
|
+
normalized.includes('audit-code')
|
|
34
|
+
&& (
|
|
35
|
+
normalized.includes('display_name:')
|
|
36
|
+
|| normalized.includes('short_description:')
|
|
37
|
+
|| normalized.includes('default_prompt:')
|
|
38
|
+
)
|
|
39
|
+
&& (
|
|
40
|
+
normalized.includes('/audit-code')
|
|
41
|
+
|| normalized.includes('Start /audit-code')
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function buildLegacyAuditCodeSurfaceTargets(root) {
|
|
47
|
+
const targets = [
|
|
48
|
+
{
|
|
49
|
+
host: 'codex',
|
|
50
|
+
surface: 'skill',
|
|
51
|
+
path: join(root, '.codex', 'skills', 'audit-code', 'SKILL.md'),
|
|
52
|
+
matches: looksLikeAuditCodeSkill,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
host: 'codex',
|
|
56
|
+
surface: 'prompt',
|
|
57
|
+
path: join(root, '.codex', 'skills', 'audit-code', 'audit-code.prompt.md'),
|
|
58
|
+
matches: looksLikeAuditCodePrompt,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
host: 'opencode',
|
|
62
|
+
surface: 'command',
|
|
63
|
+
path: join(root, '.opencode', 'commands', 'audit-code.md'),
|
|
64
|
+
matches: looksLikeAuditCodePrompt,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
host: 'opencode',
|
|
68
|
+
surface: 'skill',
|
|
69
|
+
path: join(root, '.opencode', 'skills', 'audit-code', 'SKILL.md'),
|
|
70
|
+
matches: looksLikeAuditCodeSkill,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
host: 'opencode',
|
|
74
|
+
surface: 'prompt',
|
|
75
|
+
path: join(root, '.opencode', 'skills', 'audit-code', 'audit-code.prompt.md'),
|
|
76
|
+
matches: looksLikeAuditCodePrompt,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
host: 'claude',
|
|
80
|
+
surface: 'command',
|
|
81
|
+
path: join(root, '.claude', 'commands', 'audit-code.md'),
|
|
82
|
+
matches: looksLikeAuditCodePrompt,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
const codexAgentDir = join(root, '.codex', 'skills', 'audit-code', 'agents');
|
|
87
|
+
const codexAgentEntries = await readdir(codexAgentDir).catch(() => []);
|
|
88
|
+
for (const entry of codexAgentEntries) {
|
|
89
|
+
targets.push({
|
|
90
|
+
host: 'codex',
|
|
91
|
+
surface: 'interface-metadata',
|
|
92
|
+
path: join(codexAgentDir, entry),
|
|
93
|
+
matches: looksLikeAuditCodeInterfaceMetadata,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return targets;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function findLegacyAuditCodeSurfaceFiles(root) {
|
|
101
|
+
const matches = [];
|
|
102
|
+
for (const target of await buildLegacyAuditCodeSurfaceTargets(root)) {
|
|
103
|
+
const existing = await readTextIfExists(target.path);
|
|
104
|
+
if (existing !== null && target.matches(existing)) {
|
|
105
|
+
matches.push(target.path);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return matches;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export async function removeLegacyAuditCodeSurfaceFiles(root) {
|
|
112
|
+
const removed = [];
|
|
113
|
+
for (const target of await buildLegacyAuditCodeSurfaceTargets(root)) {
|
|
114
|
+
const existing = await readTextIfExists(target.path);
|
|
115
|
+
if (existing === null || !target.matches(existing)) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
await unlink(target.path);
|
|
119
|
+
removed.push({
|
|
120
|
+
path: target.path,
|
|
121
|
+
mode: 'removed',
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return removed;
|
|
125
|
+
}
|