auditor-lambda 0.3.3 → 0.3.5

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 (47) hide show
  1. package/README.md +6 -1
  2. package/audit-code-wrapper-lib.mjs +87 -7
  3. package/dist/cli.js +517 -91
  4. package/dist/extractors/graph.d.ts +5 -1
  5. package/dist/extractors/graph.js +223 -3
  6. package/dist/extractors/pathPatterns.d.ts +3 -2
  7. package/dist/extractors/pathPatterns.js +97 -24
  8. package/dist/io/artifacts.d.ts +5 -0
  9. package/dist/io/artifacts.js +2 -0
  10. package/dist/orchestrator/advance.js +1 -1
  11. package/dist/orchestrator/dependencyMap.js +18 -0
  12. package/dist/orchestrator/fileAnchors.d.ts +32 -0
  13. package/dist/orchestrator/fileAnchors.js +217 -0
  14. package/dist/orchestrator/internalExecutors.d.ts +1 -1
  15. package/dist/orchestrator/internalExecutors.js +120 -33
  16. package/dist/orchestrator/reviewPackets.d.ts +14 -0
  17. package/dist/orchestrator/reviewPackets.js +310 -0
  18. package/dist/orchestrator/selectiveDeepening.d.ts +14 -0
  19. package/dist/orchestrator/selectiveDeepening.js +392 -0
  20. package/dist/orchestrator/state.js +6 -1
  21. package/dist/orchestrator/taskBuilder.d.ts +16 -0
  22. package/dist/orchestrator/taskBuilder.js +68 -11
  23. package/dist/prompts/renderWorkerPrompt.js +2 -1
  24. package/dist/providers/claudeCodeProvider.js +3 -1
  25. package/dist/providers/index.js +2 -1
  26. package/dist/supervisor/operatorHandoff.js +22 -11
  27. package/dist/types/graph.d.ts +1 -0
  28. package/dist/types/reviewPlanning.d.ts +41 -0
  29. package/dist/types/reviewPlanning.js +1 -0
  30. package/dist/types/sessionConfig.d.ts +1 -0
  31. package/dist/validation/artifacts.js +13 -0
  32. package/dist/validation/auditResults.js +50 -2
  33. package/dist/validation/sessionConfig.js +5 -0
  34. package/docs/agent-integrations.md +4 -1
  35. package/docs/bootstrap-install.md +3 -0
  36. package/docs/contract.md +3 -0
  37. package/docs/dispatch-implementation-plan.md +220 -489
  38. package/docs/next-steps.md +13 -8
  39. package/docs/product-direction.md +5 -3
  40. package/docs/run-flow.md +25 -30
  41. package/docs/session-config.md +15 -4
  42. package/docs/supervisor.md +5 -3
  43. package/docs/workflow-refactor-brief.md +114 -176
  44. package/package.json +1 -1
  45. package/schemas/finding.schema.json +1 -15
  46. package/schemas/graph_bundle.schema.json +16 -0
  47. package/skills/audit-code/audit-code.prompt.md +11 -6
package/README.md CHANGED
@@ -36,6 +36,10 @@ That bootstraps repo-local `/audit-code` surfaces for the hosts we can automate
36
36
  - VS Code prompt, custom agent, Copilot instructions, and `.vscode/mcp.json`
37
37
  - Antigravity planning-mode guidance plus the shared repo-local MCP launcher
38
38
 
39
+ Re-run the same `audit-code install` command whenever the packaged prompt or
40
+ skill changes. It is the single supported refresh path for the shared
41
+ `.audit-code/install/*` assets and every generated host surface.
42
+
39
43
  After bootstrap, you can smoke-test the generated host assets and launcher from the repository root:
40
44
 
41
45
  ```bash
@@ -172,7 +176,8 @@ The next implementation work is tracked in:
172
176
 
173
177
  The short version is:
174
178
 
175
- - realign review dispatch around the conversation-owned, non-overlapping lens-block workflow
179
+ - keep the packet dispatch workflow verified in real host environments
180
+ - benchmark `/audit-code` packet counts and warning counts against nontrivial external repositories
176
181
  - prove the generated Codex, Claude Desktop, OpenCode, VS Code, and Antigravity guidance in real host flows
177
182
  - tighten the repo-local MCP-first bootstrap where host smoke tests expose friction
178
183
  - polish provider-assisted continuation and failure guidance
@@ -260,9 +260,11 @@ function printHelp({ usageName, preferredEntrypoint }) {
260
260
  '- validate checks the current artifact bundle plus session-config/provider readiness and exits non-zero when issues exist',
261
261
  '- validate-results --results FILE validates AuditResult payloads against the active task manifest without ingesting them',
262
262
  '- explain-task <task_id> prints the resolved file coverage and current status for a task id',
263
- '- prepare-dispatch --run-id <id> [--artifacts-dir <dir>] creates per-task prompt files and dispatch-plan.json for parallel subagent dispatch',
264
- '- merge-and-ingest --run-id <id> [--root <dir>] [--artifacts-dir <dir>] merges per-task results and ingests them into the coverage matrix',
263
+ '- prepare-dispatch --run-id <id> [--artifacts-dir <dir>] creates packet prompt files and a slim dispatch-plan.json for parallel subagent dispatch',
264
+ '- submit-packet --run-id <id> --packet-id <id> [--artifacts-dir <dir>] validates AuditResult[] from stdin and writes only backend-assigned result files',
265
+ '- merge-and-ingest --run-id <id> [--root <dir>] [--artifacts-dir <dir>] merges assigned packet results and ingests them into the coverage matrix',
265
266
  '- validate-result --run-id <id> --task-id <id> [--artifacts-dir <dir>] validates a single task result against the schema and line counts',
267
+ ' generated packet prompts may use --run-id-b64, --task-id-b64, and --artifacts-dir-b64 to avoid shell-sensitive raw ids',
266
268
  '',
267
269
  'Primary usage:',
268
270
  '- from the repository root, run the wrapper with no arguments',
@@ -1526,16 +1528,30 @@ async function verifyInstalledBootstrap(argv) {
1526
1528
 
1527
1529
  await collectVerifyCheck(generalChecks, 'installed_prompt', async () => {
1528
1530
  await ensureFile(assetPaths.installedPromptPath, 'Installed prompt asset');
1531
+ const installedPrompt = await readFile(assetPaths.installedPromptPath, 'utf8');
1532
+ const sourcePrompt = await readFile(promptAssetPath, 'utf8');
1533
+ if (installedPrompt !== sourcePrompt) {
1534
+ throw new Error(
1535
+ `Installed prompt is out of sync with the source prompt. Run "audit-code install" from ${root}.`,
1536
+ );
1537
+ }
1529
1538
  return {
1530
- summary: 'Installed prompt asset is present.',
1539
+ summary: 'Installed prompt asset is present and matches the source prompt.',
1531
1540
  path: assetPaths.installedPromptPath,
1532
1541
  };
1533
1542
  });
1534
1543
 
1535
1544
  await collectVerifyCheck(generalChecks, 'installed_skill', async () => {
1536
1545
  await ensureFile(assetPaths.installedSkillPath, 'Installed skill asset');
1546
+ const installedSkill = (await readFile(assetPaths.installedSkillPath, 'utf8')).replace(/\r\n/g, '\n');
1547
+ const sourceSkill = (await readFile(skillAssetPath, 'utf8')).replace(/\r\n/g, '\n');
1548
+ if (installedSkill !== sourceSkill) {
1549
+ throw new Error(
1550
+ `Installed skill is out of sync with the source skill. Run "audit-code install" from ${root}.`,
1551
+ );
1552
+ }
1537
1553
  return {
1538
- summary: 'Installed skill asset is present.',
1554
+ summary: 'Installed skill asset is present and matches the source skill.',
1539
1555
  path: assetPaths.installedSkillPath,
1540
1556
  };
1541
1557
  });
@@ -1599,11 +1615,30 @@ async function verifyInstalledBootstrap(argv) {
1599
1615
  if (!content.includes('# audit-code skill')) {
1600
1616
  throw new Error(`Codex skill file is missing the expected heading: ${assetPaths.codexSkillPath}`);
1601
1617
  }
1618
+ const sourceSkill = (await readFile(skillAssetPath, 'utf8')).replace(/\r\n/g, '\n');
1619
+ if (content.replace(/\r\n/g, '\n') !== sourceSkill) {
1620
+ throw new Error(
1621
+ `Codex skill is out of sync with the source skill. Run "audit-code install --host codex" or "audit-code install".`,
1622
+ );
1623
+ }
1602
1624
  return {
1603
- summary: 'Codex skill bundle is present.',
1625
+ summary: 'Codex skill bundle is present and matches the source skill.',
1604
1626
  path: assetPaths.codexSkillPath,
1605
1627
  };
1606
1628
  });
1629
+ await collectVerifyCheck(checks, 'codex_prompt', async () => {
1630
+ const content = await readFile(assetPaths.codexPromptPath, 'utf8');
1631
+ const sourcePrompt = await readFile(promptAssetPath, 'utf8');
1632
+ if (content !== sourcePrompt) {
1633
+ throw new Error(
1634
+ `Codex prompt is out of sync with the source prompt. Run "audit-code install --host codex" or "audit-code install".`,
1635
+ );
1636
+ }
1637
+ return {
1638
+ summary: 'Codex prompt bundle is present and matches the source prompt.',
1639
+ path: assetPaths.codexPromptPath,
1640
+ };
1641
+ });
1607
1642
  await collectVerifyCheck(checks, 'codex_mcp_setup', async () => {
1608
1643
  const content = await readFile(assetPaths.codexMcpSetupPath, 'utf8');
1609
1644
  if (!content.includes(MCP_LAUNCHER_FILENAME)) {
@@ -1701,11 +1736,44 @@ async function verifyInstalledBootstrap(argv) {
1701
1736
  if (!content.includes('agent: auditor')) {
1702
1737
  throw new Error(`OpenCode command file is missing the auditor agent frontmatter: ${assetPaths.opencodeCommandPath}`);
1703
1738
  }
1739
+ const { body: commandBody } = splitFrontmatter(content);
1740
+ const { body: sourceBody } = splitFrontmatter(await readFile(promptAssetPath, 'utf8'));
1741
+ if (commandBody !== sourceBody.trimStart()) {
1742
+ throw new Error(
1743
+ `OpenCode command prompt body is out of sync with the source prompt. Run "audit-code install --host opencode" or "audit-code install".`,
1744
+ );
1745
+ }
1704
1746
  return {
1705
- summary: 'OpenCode command file is present.',
1747
+ summary: 'OpenCode command file is present and uses the source prompt body.',
1706
1748
  path: assetPaths.opencodeCommandPath,
1707
1749
  };
1708
1750
  });
1751
+ await collectVerifyCheck(checks, 'opencode_skill', async () => {
1752
+ const content = (await readFile(assetPaths.opencodeSkillPath, 'utf8')).replace(/\r\n/g, '\n');
1753
+ const sourceSkill = (await readFile(skillAssetPath, 'utf8')).replace(/\r\n/g, '\n');
1754
+ if (content !== sourceSkill) {
1755
+ throw new Error(
1756
+ `OpenCode skill is out of sync with the source skill. Run "audit-code install --host opencode" or "audit-code install".`,
1757
+ );
1758
+ }
1759
+ return {
1760
+ summary: 'OpenCode skill is present and matches the source skill.',
1761
+ path: assetPaths.opencodeSkillPath,
1762
+ };
1763
+ });
1764
+ await collectVerifyCheck(checks, 'opencode_prompt', async () => {
1765
+ const content = await readFile(assetPaths.opencodePromptPath, 'utf8');
1766
+ const sourcePrompt = await readFile(promptAssetPath, 'utf8');
1767
+ if (content !== sourcePrompt) {
1768
+ throw new Error(
1769
+ `OpenCode prompt is out of sync with the source prompt. Run "audit-code install --host opencode" or "audit-code install".`,
1770
+ );
1771
+ }
1772
+ return {
1773
+ summary: 'OpenCode prompt is present and matches the source prompt.',
1774
+ path: assetPaths.opencodePromptPath,
1775
+ };
1776
+ });
1709
1777
  await collectVerifyCheck(checks, 'opencode_config', async () => {
1710
1778
  const config = await readJson(assetPaths.opencodeConfigPath, 'OpenCode project config');
1711
1779
  const command = config?.mcp?.auditor?.command;
@@ -1730,8 +1798,15 @@ async function verifyInstalledBootstrap(argv) {
1730
1798
  if (!content.includes('name: audit-code')) {
1731
1799
  throw new Error(`VS Code prompt file is missing the expected frontmatter name: ${assetPaths.vscodePromptPath}`);
1732
1800
  }
1801
+ const { body: promptBody } = splitFrontmatter(content);
1802
+ const { body: sourceBody } = splitFrontmatter(await readFile(promptAssetPath, 'utf8'));
1803
+ if (promptBody !== sourceBody.trimStart()) {
1804
+ throw new Error(
1805
+ `VS Code prompt body is out of sync with the source prompt. Run "audit-code install --host vscode" or "audit-code install".`,
1806
+ );
1807
+ }
1733
1808
  return {
1734
- summary: 'VS Code prompt file is present.',
1809
+ summary: 'VS Code prompt file is present and uses the source prompt body.',
1735
1810
  path: assetPaths.vscodePromptPath,
1736
1811
  };
1737
1812
  });
@@ -2208,6 +2283,11 @@ export async function runAuditCodeWrapper({
2208
2283
  return;
2209
2284
  }
2210
2285
 
2286
+ if (argv[0] === 'submit-packet') {
2287
+ await runDistCommand('submit-packet', argv.slice(1));
2288
+ return;
2289
+ }
2290
+
2211
2291
  if (argv[0] === 'merge-and-ingest') {
2212
2292
  await runDistCommand('merge-and-ingest', argv.slice(1), { ensureArtifactsDir: true });
2213
2293
  return;