auditor-lambda 0.3.13 → 0.3.15

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 (60) hide show
  1. package/README.md +21 -24
  2. package/audit-code-wrapper-lib.mjs +62 -104
  3. package/dist/cli.js +41 -4
  4. package/dist/coverage.js +3 -1
  5. package/dist/extractors/disposition.js +8 -1
  6. package/dist/extractors/graph.d.ts +3 -1
  7. package/dist/extractors/graph.js +1147 -67
  8. package/dist/extractors/graphManifestEdges.d.ts +14 -0
  9. package/dist/extractors/graphManifestEdges.js +1158 -0
  10. package/dist/extractors/graphPathUtils.d.ts +5 -0
  11. package/dist/extractors/graphPathUtils.js +75 -0
  12. package/dist/extractors/pathPatterns.d.ts +1 -0
  13. package/dist/extractors/pathPatterns.js +3 -0
  14. package/dist/io/artifacts.d.ts +10 -1
  15. package/dist/io/artifacts.js +23 -3
  16. package/dist/orchestrator/internalExecutors.d.ts +4 -0
  17. package/dist/orchestrator/internalExecutors.js +35 -6
  18. package/dist/orchestrator/reviewPackets.js +1003 -31
  19. package/dist/orchestrator/syntaxResolutionExecutor.js +34 -0
  20. package/dist/types/externalAnalyzer.d.ts +9 -0
  21. package/dist/types/graph.d.ts +3 -0
  22. package/dist/types/reviewPlanning.d.ts +39 -0
  23. package/docs/contracts.md +215 -0
  24. package/docs/development.md +210 -0
  25. package/docs/handoff.md +204 -0
  26. package/docs/history.md +40 -0
  27. package/docs/operator-guide.md +190 -0
  28. package/docs/product.md +185 -0
  29. package/docs/release.md +131 -0
  30. package/package.json +1 -1
  31. package/schemas/audit_plan_metrics.schema.json +347 -0
  32. package/schemas/external_analyzer_results.schema.json +35 -0
  33. package/schemas/graph_bundle.schema.json +47 -2
  34. package/schemas/review_packets.schema.json +160 -0
  35. package/scripts/postinstall.mjs +49 -0
  36. package/docs/agent-integrations.md +0 -318
  37. package/docs/agent-roles.md +0 -69
  38. package/docs/architecture.md +0 -90
  39. package/docs/artifacts.md +0 -36
  40. package/docs/bootstrap-install.md +0 -136
  41. package/docs/contract.md +0 -54
  42. package/docs/dispatch-implementation-plan.md +0 -302
  43. package/docs/field-trial-bug-report.md +0 -237
  44. package/docs/github-copilot.md +0 -66
  45. package/docs/model-selection.md +0 -97
  46. package/docs/next-steps.md +0 -202
  47. package/docs/packaging.md +0 -120
  48. package/docs/pipeline.md +0 -152
  49. package/docs/product-direction.md +0 -154
  50. package/docs/production-launch-bar.md +0 -92
  51. package/docs/production-readiness.md +0 -58
  52. package/docs/releasing.md +0 -145
  53. package/docs/remediation-baseline.md +0 -75
  54. package/docs/repo-layout.md +0 -30
  55. package/docs/run-flow.md +0 -56
  56. package/docs/session-config.md +0 -319
  57. package/docs/supervisor.md +0 -100
  58. package/docs/usage.md +0 -215
  59. package/docs/windows-setup.md +0 -146
  60. package/docs/workflow-refactor-brief.md +0 -124
package/README.md CHANGED
@@ -30,7 +30,8 @@ npm install -g auditor-lambda
30
30
 
31
31
  That makes `audit-code` available on `PATH`. During package install, the package
32
32
  also writes user-level command/skill assets for hosts we can seed safely, including
33
- the Claude command file and global Codex skill bundle.
33
+ the Claude command file, the global Codex skill bundle, and the global OpenCode
34
+ slash command entry in `~/.config/opencode/opencode.json`.
34
35
 
35
36
  After that, invoke `/audit-code` in a supported host. The prompt self-bootstraps
36
37
  the current repository by running:
@@ -53,7 +54,7 @@ That bootstraps repo-local `/audit-code` surfaces for the hosts we can automate
53
54
 
54
55
  - Codex `AGENTS.md` fallback guidance for the global skill surface
55
56
  - Claude Desktop local MCP bundle artifacts and project template guidance
56
- - OpenCode command, skill, and `opencode.json` surfaces
57
+ - OpenCode `opencode.json` with the `/audit-code` slash command and auditor MCP server
57
58
  - VS Code prompt, custom agent, Copilot instructions, and `.vscode/mcp.json`
58
59
  - Antigravity planning-mode guidance plus the shared repo-local MCP launcher
59
60
 
@@ -190,20 +191,25 @@ Optional backend config:
190
191
  - use `provider: "auto"` only when you want best-effort routing across installed backends
191
192
  - treat explicit provider bridges as compatibility fallback, not as the intended owner of semantic review
192
193
 
193
- ## Implementation Next Steps
194
+ ## Current Development Focus
194
195
 
195
196
  The next implementation work is tracked in:
196
197
 
197
- - `docs/next-steps.md`
198
+ - `docs/product.md`
199
+ - `docs/development.md`
200
+ - `docs/handoff.md`
198
201
 
199
202
  The short version is:
200
203
 
201
204
  - keep the packet dispatch workflow verified in real host environments
202
- - benchmark `/audit-code` packet counts and warning counts against nontrivial external repositories
203
- - prove the generated Codex, Claude Desktop, OpenCode, VS Code, and Antigravity guidance in real host flows
205
+ - make graph-informed packetization observable before adding more ecosystem-specific parsers
206
+ - consolidate graph extraction and exercise generic ownership hints for analyzer-supplied module roots
207
+ - add deterministic Python import, package, and test/source graph support as a core language path
208
+ - use semantic/NLP-style affinity only as low-authority context unless deterministic graph evidence supports it
209
+ - keep generated Codex, Claude Desktop, OpenCode, VS Code, and Antigravity guidance aligned with real host behavior
204
210
  - tighten the repo-local MCP-first bootstrap where host smoke tests expose friction
205
211
  - polish provider-assisted continuation and failure guidance
206
- - finish publish and release hardening for packaged installs
212
+ - keep schema contracts and examples easy for workers and host integrations to validate
207
213
 
208
214
  ## Build And Test
209
215
 
@@ -214,24 +220,15 @@ npm run release:patch
214
220
  npm run release:patch:publish
215
221
  ```
216
222
 
217
- For GitHub Actions publication and npm Trusted Publishing setup, see `docs/releasing.md`.
223
+ For GitHub Actions publication and npm Trusted Publishing setup, see `docs/release.md`.
218
224
 
219
225
  ## Key Docs
220
226
 
221
- - `docs/product-direction.md`
222
- - `docs/workflow-refactor-brief.md`
223
- - `docs/remediation-baseline.md`
224
- - `docs/releasing.md`
225
- - `docs/production-readiness.md`
226
- - `docs/production-launch-bar.md`
227
- - `docs/next-steps.md`
227
+ - `docs/product.md`
228
+ - `docs/operator-guide.md`
229
+ - `docs/contracts.md`
230
+ - `docs/release.md`
231
+ - `docs/development.md`
232
+ - `docs/handoff.md`
233
+ - `docs/history.md`
228
234
  - `skills/audit-code/SKILL.md`
229
- - `docs/bootstrap-install.md`
230
- - `docs/agent-integrations.md`
231
- - `docs/github-copilot.md`
232
- - `docs/contract.md`
233
- - `docs/model-selection.md`
234
- - `docs/packaging.md`
235
- - `docs/session-config.md`
236
- - `docs/supervisor.md`
237
- - `docs/windows-setup.md`
@@ -533,10 +533,18 @@ function renderCodexAutomationRecipe() {
533
533
  ].join('\n');
534
534
  }
535
535
 
536
- function renderOpenCodeProjectConfig(root) {
536
+ function renderOpenCodeProjectConfig(root, promptBody) {
537
537
  const launcher = replaceBackslashes(toRepoRelativePath(root, join(root, '.audit-code', 'install', MCP_LAUNCHER_FILENAME)));
538
538
  return {
539
539
  $schema: 'https://opencode.ai/config.json',
540
+ command: {
541
+ 'audit-code': {
542
+ template: promptBody.trimStart(),
543
+ description: 'Autonomous local loop code auditing',
544
+ agent: 'auditor',
545
+ subtask: false,
546
+ },
547
+ },
540
548
  mcp: {
541
549
  auditor: {
542
550
  type: 'local',
@@ -599,11 +607,15 @@ function objectValue(value) {
599
607
  : {};
600
608
  }
601
609
 
602
- function buildMergedOpenCodeProjectConfig(existing, root) {
603
- const generated = renderOpenCodeProjectConfig(root);
610
+ function buildMergedOpenCodeProjectConfig(existing, root, promptBody) {
611
+ const generated = renderOpenCodeProjectConfig(root, promptBody);
604
612
  return {
605
613
  ...existing,
606
614
  $schema: existing.$schema ?? generated.$schema,
615
+ command: {
616
+ ...objectValue(existing.command),
617
+ 'audit-code': generated.command['audit-code'],
618
+ },
607
619
  mcp: {
608
620
  ...objectValue(existing.mcp),
609
621
  auditor: generated.mcp.auditor,
@@ -645,7 +657,7 @@ function renderClaudeDesktopProjectTemplate() {
645
657
  '',
646
658
  '- `.audit-code/install/audit-code.import.md`',
647
659
  '- `.audit-code/install/GETTING-STARTED.md`',
648
- '- `docs/agent-integrations.md` when you want host-specific operator context',
660
+ '- `docs/operator-guide.md` when you want host-specific operator context',
649
661
  '',
650
662
  'Starter prompt:',
651
663
  '',
@@ -1084,17 +1096,15 @@ const INSTALL_HOST_DEFINITIONS = {
1084
1096
  support_level: 'supported',
1085
1097
  setup_kind: 'command+agent+mcp',
1086
1098
  summary:
1087
- 'Use the generated OpenCode command and project config so `/audit-code` and the local auditor MCP server are available together.',
1088
- primary_path_key: 'opencodeCommandPath',
1099
+ 'Use the generated `opencode.json` so the `/audit-code` slash command and the local auditor MCP server are both available.',
1100
+ primary_path_key: 'opencodeConfigPath',
1089
1101
  supporting_path_keys: [
1090
- 'opencodeConfigPath',
1091
- 'opencodeSkillPath',
1092
1102
  'agentsInstructionsPath',
1093
1103
  'mcpLauncherPath',
1094
1104
  ],
1095
1105
  steps: [
1096
1106
  'Open this repository in OpenCode.',
1097
- 'Let OpenCode load the generated `opencode.json` so the auditor MCP server is available.',
1107
+ 'Let OpenCode load the generated `opencode.json` it registers the `/audit-code` slash command and the auditor MCP server.',
1098
1108
  'Invoke `/audit-code` and keep the audit loop on the auditor MCP tools.',
1099
1109
  ],
1100
1110
  profile: {
@@ -1792,63 +1802,28 @@ async function verifyInstalledBootstrap(argv) {
1792
1802
  break;
1793
1803
  }
1794
1804
  case 'opencode':
1795
- await collectVerifyCheck(checks, 'opencode_command', async () => {
1796
- const content = await readFile(assetPaths.opencodeCommandPath, 'utf8');
1797
- if (!content.includes('agent: auditor')) {
1798
- throw new Error(`OpenCode command file is missing the auditor agent frontmatter: ${assetPaths.opencodeCommandPath}`);
1799
- }
1800
- const { body: commandBody } = splitFrontmatter(content);
1801
- const { body: sourceBody } = splitFrontmatter(await readFile(promptAssetPath, 'utf8'));
1802
- if (commandBody !== sourceBody.trimStart()) {
1803
- throw new Error(
1804
- `OpenCode command prompt body is out of sync with the source prompt. Run "audit-code install --host opencode" or "audit-code install".`,
1805
- );
1806
- }
1807
- return {
1808
- summary: 'OpenCode command file is present and uses the source prompt body.',
1809
- path: assetPaths.opencodeCommandPath,
1810
- };
1811
- });
1812
- await collectVerifyCheck(checks, 'opencode_skill', async () => {
1813
- const content = (await readFile(assetPaths.opencodeSkillPath, 'utf8')).replace(/\r\n/g, '\n');
1814
- const sourceSkill = (await readFile(skillAssetPath, 'utf8')).replace(/\r\n/g, '\n');
1815
- if (content !== sourceSkill) {
1816
- throw new Error(
1817
- `OpenCode skill is out of sync with the source skill. Run "audit-code install --host opencode" or "audit-code install".`,
1818
- );
1819
- }
1820
- return {
1821
- summary: 'OpenCode skill is present and matches the source skill.',
1822
- path: assetPaths.opencodeSkillPath,
1823
- };
1824
- });
1825
- await collectVerifyCheck(checks, 'opencode_prompt', async () => {
1826
- const content = await readFile(assetPaths.opencodePromptPath, 'utf8');
1827
- const sourcePrompt = await readFile(promptAssetPath, 'utf8');
1828
- if (content !== sourcePrompt) {
1829
- throw new Error(
1830
- `OpenCode prompt is out of sync with the source prompt. Run "audit-code install --host opencode" or "audit-code install".`,
1831
- );
1832
- }
1833
- return {
1834
- summary: 'OpenCode prompt is present and matches the source prompt.',
1835
- path: assetPaths.opencodePromptPath,
1836
- };
1837
- });
1838
1805
  await collectVerifyCheck(checks, 'opencode_config', async () => {
1839
1806
  const config = await readJson(assetPaths.opencodeConfigPath, 'OpenCode project config');
1840
- const command = config?.mcp?.auditor?.command;
1841
- if (!Array.isArray(command) || command[0] !== 'node') {
1807
+ const mcpCommand = config?.mcp?.auditor?.command;
1808
+ if (!Array.isArray(mcpCommand) || mcpCommand[0] !== 'node') {
1842
1809
  throw new Error('OpenCode config must set mcp.auditor.command as a Node command array.');
1843
1810
  }
1844
- if (command[1] !== '.audit-code/install/run-mcp-server.mjs') {
1845
- throw new Error(`OpenCode config must point at .audit-code/install/${MCP_LAUNCHER_FILENAME}, got ${command[1] ?? 'missing'}.`);
1811
+ if (mcpCommand[1] !== '.audit-code/install/run-mcp-server.mjs') {
1812
+ throw new Error(`OpenCode config must point at .audit-code/install/${MCP_LAUNCHER_FILENAME}, got ${mcpCommand[1] ?? 'missing'}.`);
1846
1813
  }
1847
1814
  if (config?.mcp?.auditor?.type !== 'local') {
1848
1815
  throw new Error(`OpenCode config must set mcp.auditor.type to "local", got ${config?.mcp?.auditor?.type ?? 'missing'}.`);
1849
1816
  }
1817
+ const commandConfig = config?.command?.['audit-code'];
1818
+ if (!commandConfig?.template) {
1819
+ throw new Error('OpenCode config is missing command["audit-code"].template — the /audit-code slash command will not surface. Run "audit-code install".');
1820
+ }
1821
+ const { body: sourceBody } = splitFrontmatter(await readFile(promptAssetPath, 'utf8'));
1822
+ if (commandConfig.template !== sourceBody.trimStart()) {
1823
+ throw new Error('OpenCode config command["audit-code"].template is out of sync with the source prompt. Run "audit-code install".');
1824
+ }
1850
1825
  return {
1851
- summary: 'OpenCode project config parsed successfully.',
1826
+ summary: 'OpenCode project config has MCP server and /audit-code slash command.',
1852
1827
  path: assetPaths.opencodeConfigPath,
1853
1828
  };
1854
1829
  });
@@ -2022,20 +1997,9 @@ async function detectBootstrapRefreshReason(root, host) {
2022
1997
  break;
2023
1998
  }
2024
1999
  case 'opencode': {
2025
- const opencodeSkill = await readTextIfExists(assetPaths.opencodeSkillPath);
2026
- if (opencodeSkill?.replace(/\r\n/g, '\n') !== sourceSkill) {
2027
- return 'stale_host_asset:opencode:skill';
2028
- }
2029
- const opencodePrompt = await readTextIfExists(assetPaths.opencodePromptPath);
2030
- if (opencodePrompt !== sourcePrompt) {
2031
- return 'stale_host_asset:opencode:prompt';
2032
- }
2033
- const opencodeCommand = await readTextIfExists(assetPaths.opencodeCommandPath);
2034
- if (opencodeCommand === null) {
2035
- return 'missing_host_asset:opencode:command';
2036
- }
2037
- if (splitFrontmatter(opencodeCommand).body !== sourcePromptBody.trimStart()) {
2038
- return 'stale_host_asset:opencode:command';
2000
+ const opencodeConfig = await readJson(assetPaths.opencodeConfigPath, 'OpenCode config').catch(() => null);
2001
+ if (opencodeConfig?.command?.['audit-code']?.template !== sourcePromptBody.trimStart()) {
2002
+ return 'stale_host_asset:opencode:config_command';
2039
2003
  }
2040
2004
  break;
2041
2005
  }
@@ -2164,18 +2128,9 @@ async function installBootstrap(argv, options = {}) {
2164
2128
  claudeDesktopMcpbPath: profile.writeClaudeDesktop
2165
2129
  ? join(root, '.audit-code', 'install', 'claude-desktop', 'auditor-lambda.mcpb')
2166
2130
  : null,
2167
- opencodeCommandPath: profile.writeOpenCode
2168
- ? join(root, '.opencode', 'commands', 'audit-code.md')
2169
- : null,
2170
2131
  opencodeConfigPath: profile.writeOpenCode
2171
2132
  ? join(root, 'opencode.json')
2172
2133
  : null,
2173
- opencodeSkillPath: profile.writeOpenCode
2174
- ? join(root, '.opencode', 'skills', 'audit-code', 'SKILL.md')
2175
- : null,
2176
- opencodePromptPath: profile.writeOpenCode
2177
- ? join(root, '.opencode', 'skills', 'audit-code', 'audit-code.prompt.md')
2178
- : null,
2179
2134
  vscodePromptPath: profile.writeVSCode
2180
2135
  ? join(root, '.github', 'prompts', 'audit-code.prompt.md')
2181
2136
  : null,
@@ -2285,36 +2240,39 @@ async function installBootstrap(argv, options = {}) {
2285
2240
  }
2286
2241
 
2287
2242
  if (profile.writeOpenCode) {
2288
- results.push(
2289
- await writeGeneratedMarkdown(
2290
- assetPaths.opencodeCommandPath,
2291
- renderPromptFile(
2292
- {
2293
- description: 'Autonomous local loop code auditing',
2294
- agent: 'auditor',
2295
- subtask: false,
2296
- },
2297
- promptBody,
2298
- ),
2299
- ),
2243
+ // Clean up legacy command/skill/prompt files that were generated by older installs.
2244
+ // The slash command is now registered via the `command` section in opencode.json.
2245
+ const legacyOpenCodeCommandPath = join(root, '.opencode', 'commands', 'audit-code.md');
2246
+ const legacyOpenCodeCommandContent = renderPromptFile(
2247
+ { description: 'Autonomous local loop code auditing', agent: 'auditor', subtask: false },
2248
+ promptBody,
2300
2249
  );
2301
- results.push(
2302
- await writeGeneratedMarkdown(
2303
- assetPaths.opencodeSkillPath,
2304
- skillSource,
2305
- ),
2250
+ const legacyOpenCodeCommandRemoval = await removeGeneratedMarkdownIfMatches(
2251
+ legacyOpenCodeCommandPath,
2252
+ legacyOpenCodeCommandContent,
2306
2253
  );
2307
- results.push(
2308
- await writeGeneratedMarkdown(
2309
- assetPaths.opencodePromptPath,
2310
- promptSource,
2311
- ),
2254
+ if (legacyOpenCodeCommandRemoval) {
2255
+ results.push(legacyOpenCodeCommandRemoval);
2256
+ }
2257
+ const legacyOpenCodeSkillRemoval = await removeGeneratedMarkdownIfMatches(
2258
+ join(root, '.opencode', 'skills', 'audit-code', 'SKILL.md'),
2259
+ skillSource,
2312
2260
  );
2261
+ if (legacyOpenCodeSkillRemoval) {
2262
+ results.push(legacyOpenCodeSkillRemoval);
2263
+ }
2264
+ const legacyOpenCodePromptRemoval = await removeGeneratedMarkdownIfMatches(
2265
+ join(root, '.opencode', 'skills', 'audit-code', 'audit-code.prompt.md'),
2266
+ promptSource,
2267
+ );
2268
+ if (legacyOpenCodePromptRemoval) {
2269
+ results.push(legacyOpenCodePromptRemoval);
2270
+ }
2313
2271
  results.push(
2314
2272
  await writeMergedGeneratedJson(
2315
2273
  assetPaths.opencodeConfigPath,
2316
2274
  'OpenCode project config',
2317
- (existing) => buildMergedOpenCodeProjectConfig(existing, root),
2275
+ (existing) => buildMergedOpenCodeProjectConfig(existing, root, promptBody),
2318
2276
  ),
2319
2277
  );
2320
2278
  }
@@ -2415,7 +2373,7 @@ async function installBootstrap(argv, options = {}) {
2415
2373
  files: results,
2416
2374
  slash_command_surfaces: {
2417
2375
  vscode_prompt: assetPaths.vscodePromptPath,
2418
- opencode_command: assetPaths.opencodeCommandPath,
2376
+ opencode_config: assetPaths.opencodeConfigPath,
2419
2377
  },
2420
2378
  instruction_surfaces: {
2421
2379
  agents: assetPaths.agentsInstructionsPath,
package/dist/cli.js CHANGED
@@ -1559,6 +1559,42 @@ function renderAnchorPreview(summary, anchorPath) {
1559
1559
  "",
1560
1560
  ];
1561
1561
  }
1562
+ function formatPacketConfidence(value) {
1563
+ return typeof value === "number" && Number.isFinite(value)
1564
+ ? value.toFixed(2)
1565
+ : "n/a";
1566
+ }
1567
+ function renderPacketGraphContext(packet) {
1568
+ const hasContext = (packet.entrypoints?.length ?? 0) > 0 ||
1569
+ (packet.key_edges?.length ?? 0) > 0 ||
1570
+ (packet.boundary_files?.length ?? 0) > 0 ||
1571
+ packet.quality !== undefined;
1572
+ if (!hasContext) {
1573
+ return [];
1574
+ }
1575
+ const lines = ["## Packet graph context"];
1576
+ if (packet.entrypoints?.length) {
1577
+ lines.push("Entrypoints:");
1578
+ lines.push(...packet.entrypoints.map((entrypoint) => `- ${entrypoint}`));
1579
+ }
1580
+ if (packet.key_edges?.length) {
1581
+ lines.push("Key internal edges:");
1582
+ lines.push(...packet.key_edges.map((edge) => {
1583
+ const kind = edge.kind ? ` [${edge.kind}]` : "";
1584
+ const reason = edge.reason ? ` - ${edge.reason}` : "";
1585
+ return `- ${edge.from} -> ${edge.to}${kind} confidence=${formatPacketConfidence(edge.confidence)}${reason}`;
1586
+ }));
1587
+ }
1588
+ if (packet.boundary_files?.length) {
1589
+ lines.push("Boundary files to check only when evidence crosses the packet:");
1590
+ lines.push(...packet.boundary_files.map((path) => `- ${path}`));
1591
+ }
1592
+ if (packet.quality) {
1593
+ lines.push(`Quality: cohesion=${packet.quality.cohesion_score}, internal_edges=${packet.quality.internal_edge_count}, boundary_edges=${packet.quality.boundary_edge_count}, unexplained_files=${packet.quality.unexplained_file_count}`);
1594
+ }
1595
+ lines.push("");
1596
+ return lines;
1597
+ }
1562
1598
  async function cmdPrepareDispatch(argv) {
1563
1599
  const runId = getFlag(argv, "--run-id");
1564
1600
  if (!runId)
@@ -1738,6 +1774,7 @@ async function cmdPrepareDispatch(argv) {
1738
1774
  : "Use your Read tool. Paths are repo-relative from the current working directory.",
1739
1775
  fileList,
1740
1776
  "",
1777
+ ...renderPacketGraphContext(packet),
1741
1778
  ...largeFileSection,
1742
1779
  "## Tasks",
1743
1780
  ...taskSections,
@@ -1961,13 +1998,12 @@ async function cmdMergeAndIngest(argv) {
1961
1998
  const passing = [];
1962
1999
  const failing = [];
1963
2000
  const seenTaskIds = new Set();
2001
+ let spuriousFileCount = 0;
1964
2002
  for (const filename of files) {
1965
2003
  const filePath = resolve(join(taskResultsDir, filename));
1966
2004
  if (!expectedPaths.has(filePath)) {
1967
- failing.push({
1968
- task_id: filename,
1969
- errors: ["Unexpected task result file; only backend-assigned result paths may be ingested."],
1970
- });
2005
+ spuriousFileCount++;
2006
+ process.stderr.write(`[merge-and-ingest] Warning: ignoring unexpected file in task-results/: ${filename}\n`);
1971
2007
  }
1972
2008
  }
1973
2009
  for (const task of allTasks) {
@@ -2054,6 +2090,7 @@ async function cmdMergeAndIngest(argv) {
2054
2090
  status: workerResult.status,
2055
2091
  accepted_count: passing.length,
2056
2092
  rejected_count: 0,
2093
+ spurious_file_count: spuriousFileCount,
2057
2094
  finding_count: findingCount,
2058
2095
  audit_results_path: auditResultsPath,
2059
2096
  selected_executor: workerResult.selected_executor,
package/dist/coverage.js CHANGED
@@ -37,7 +37,9 @@ export function applyFileCoverage(matrix, fileCoverage) {
37
37
  const record = matrix.files.find((file) => file.path === coverage.path);
38
38
  if (!record || record.audit_status === "excluded")
39
39
  continue;
40
- if (coverage.lens && !record.completed_lenses.includes(coverage.lens)) {
40
+ if (coverage.lens &&
41
+ record.required_lenses.includes(coverage.lens) &&
42
+ !record.completed_lenses.includes(coverage.lens)) {
41
43
  record.completed_lenses.push(coverage.lens);
42
44
  }
43
45
  }
@@ -1,4 +1,4 @@
1
- import { isNodeModulesOrGit, isBuildOutput, isVendorPath, isBinaryArtifact, isLicensePath, isLockfilePath, isLogPath, isDocPath, isAuditArtifactPath, isGeneratedInstallArtifactPath, isExamplesOrFixturesPath, normalizeExtractorPath, } from "./pathPatterns.js";
1
+ import { isNodeModulesOrGit, isBuildOutput, isVendorPath, isBinaryArtifact, isLicensePath, isLockfilePath, isLogPath, isDocPath, isAuditArtifactPath, isGeneratedTestArtifactPath, isGeneratedInstallArtifactPath, isExamplesOrFixturesPath, normalizeExtractorPath, } from "./pathPatterns.js";
2
2
  function inferDisposition(path) {
3
3
  const normalized = normalizeExtractorPath(path);
4
4
  if (isNodeModulesOrGit(normalized)) {
@@ -33,6 +33,13 @@ function inferDisposition(path) {
33
33
  reason: "Generated audit artifact.",
34
34
  };
35
35
  }
36
+ if (isGeneratedTestArtifactPath(normalized)) {
37
+ return {
38
+ path,
39
+ status: "generated",
40
+ reason: "Generated test artifact.",
41
+ };
42
+ }
36
43
  if (isDocPath(normalized)) {
37
44
  return { path, status: "doc_only", reason: "Documentation artifact." };
38
45
  }
@@ -1,8 +1,10 @@
1
1
  import type { RepoManifest } from "../types.js";
2
2
  import type { FileDisposition } from "../types/disposition.js";
3
+ import type { ExternalAnalyzerResults } from "../types/externalAnalyzer.js";
3
4
  import type { GraphBundle } from "../types/graph.js";
4
5
  export interface BuildGraphBundleOptions {
5
6
  fileContents?: Record<string, string>;
7
+ externalAnalyzerResults?: ExternalAnalyzerResults;
6
8
  }
7
- export declare function buildGraphBundleFromFs(repoManifest: RepoManifest, root: string, disposition?: FileDisposition): Promise<GraphBundle>;
9
+ export declare function buildGraphBundleFromFs(repoManifest: RepoManifest, root: string, disposition?: FileDisposition, options?: Pick<BuildGraphBundleOptions, "externalAnalyzerResults">): Promise<GraphBundle>;
8
10
  export declare function buildGraphBundle(repoManifest: RepoManifest, disposition?: FileDisposition, options?: BuildGraphBundleOptions): GraphBundle;