auditor-lambda 0.7.0 → 0.9.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.
Files changed (125) hide show
  1. package/README.md +0 -21
  2. package/audit-code-wrapper-lib.mjs +149 -129
  3. package/dist/adapters/normalizeExternal.js +6 -3
  4. package/dist/cli/args.d.ts +0 -1
  5. package/dist/cli/args.js +0 -6
  6. package/dist/cli/auditStep.js +7 -1
  7. package/dist/cli/dispatch.js +3 -2
  8. package/dist/cli/lineIndex.js +4 -1
  9. package/dist/cli/mergeAndIngestCommand.d.ts +1 -0
  10. package/dist/cli/mergeAndIngestCommand.js +219 -0
  11. package/dist/cli/nextStepCommand.js +5 -1
  12. package/dist/cli/runToCompletion.d.ts +9 -0
  13. package/dist/cli/runToCompletion.js +655 -480
  14. package/dist/cli/statusCommand.d.ts +1 -0
  15. package/dist/cli/statusCommand.js +113 -0
  16. package/dist/cli/submitPacketCommand.d.ts +1 -0
  17. package/dist/cli/submitPacketCommand.js +155 -0
  18. package/dist/cli/workerResult.d.ts +1 -1
  19. package/dist/cli/workerRunCommand.d.ts +1 -0
  20. package/dist/cli/workerRunCommand.js +88 -0
  21. package/dist/cli.d.ts +0 -1
  22. package/dist/cli.js +14 -565
  23. package/dist/extractors/analyzers/sql.js +4 -1
  24. package/dist/extractors/analyzers/treeSitter.js +29 -15
  25. package/dist/extractors/analyzers/typescript.js +10 -8
  26. package/dist/extractors/designAssessment.js +43 -24
  27. package/dist/extractors/graph.js +151 -75
  28. package/dist/extractors/pathPatterns.js +17 -5
  29. package/dist/io/artifacts.d.ts +3 -1
  30. package/dist/io/artifacts.js +18 -2
  31. package/dist/io/runArtifactTypes.d.ts +18 -0
  32. package/dist/io/runArtifactTypes.js +1 -0
  33. package/dist/io/runArtifacts.d.ts +2 -18
  34. package/dist/io/runArtifacts.js +14 -3
  35. package/dist/mcp/server.js +9 -0
  36. package/dist/orchestrator/advance.js +38 -22
  37. package/dist/orchestrator/artifactFreshness.js +14 -4
  38. package/dist/orchestrator/autoFixExecutor.d.ts +2 -2
  39. package/dist/orchestrator/autoFixExecutor.js +26 -8
  40. package/dist/orchestrator/dependencyMap.d.ts +1 -1
  41. package/dist/orchestrator/dependencyMap.js +7 -1
  42. package/dist/orchestrator/executorResult.d.ts +12 -0
  43. package/dist/orchestrator/executorResult.js +1 -0
  44. package/dist/orchestrator/fileAnchors.js +14 -3
  45. package/dist/orchestrator/fileIntegrity.d.ts +1 -0
  46. package/dist/orchestrator/fileIntegrity.js +12 -3
  47. package/dist/orchestrator/flowCoverage.js +1 -0
  48. package/dist/orchestrator/flowRequeue.js +4 -1
  49. package/dist/orchestrator/graphEnrichmentExecutor.d.ts +1 -1
  50. package/dist/orchestrator/graphEnrichmentExecutor.js +3 -1
  51. package/dist/orchestrator/ingestionExecutors.d.ts +11 -0
  52. package/dist/orchestrator/ingestionExecutors.js +237 -0
  53. package/dist/orchestrator/intakeExecutors.d.ts +3 -0
  54. package/dist/orchestrator/intakeExecutors.js +25 -0
  55. package/dist/orchestrator/planningExecutors.d.ts +4 -0
  56. package/dist/orchestrator/planningExecutors.js +95 -0
  57. package/dist/orchestrator/reviewPacketGraph.d.ts +31 -0
  58. package/dist/orchestrator/reviewPacketGraph.js +691 -0
  59. package/dist/orchestrator/reviewPackets.d.ts +2 -15
  60. package/dist/orchestrator/reviewPackets.js +3 -685
  61. package/dist/orchestrator/runtimeCommand.d.ts +11 -0
  62. package/dist/orchestrator/runtimeCommand.js +71 -0
  63. package/dist/orchestrator/scope.js +1 -1
  64. package/dist/orchestrator/selectiveDeepening/conflict.d.ts +8 -0
  65. package/dist/orchestrator/selectiveDeepening/conflict.js +71 -0
  66. package/dist/orchestrator/selectiveDeepening/findingFollowup.d.ts +10 -0
  67. package/dist/orchestrator/selectiveDeepening/findingFollowup.js +52 -0
  68. package/dist/orchestrator/selectiveDeepening/highRiskClean.d.ts +7 -0
  69. package/dist/orchestrator/selectiveDeepening/highRiskClean.js +44 -0
  70. package/dist/orchestrator/selectiveDeepening/index.d.ts +18 -0
  71. package/dist/orchestrator/selectiveDeepening/index.js +128 -0
  72. package/dist/orchestrator/selectiveDeepening/lensVerification.d.ts +12 -0
  73. package/dist/orchestrator/selectiveDeepening/lensVerification.js +242 -0
  74. package/dist/orchestrator/selectiveDeepening/runtimeValidation.d.ts +13 -0
  75. package/dist/orchestrator/selectiveDeepening/runtimeValidation.js +57 -0
  76. package/dist/orchestrator/selectiveDeepening/shared.d.ts +45 -0
  77. package/dist/orchestrator/selectiveDeepening/shared.js +128 -0
  78. package/dist/orchestrator/selectiveDeepening/stewardFollowup.d.ts +6 -0
  79. package/dist/orchestrator/selectiveDeepening/stewardFollowup.js +72 -0
  80. package/dist/orchestrator/selectiveDeepening.d.ts +2 -20
  81. package/dist/orchestrator/selectiveDeepening.js +6 -760
  82. package/dist/orchestrator/staleness.js +3 -3
  83. package/dist/orchestrator/structureExecutors.d.ts +5 -0
  84. package/dist/orchestrator/structureExecutors.js +94 -0
  85. package/dist/orchestrator/syntaxResolutionExecutor.d.ts +1 -1
  86. package/dist/orchestrator/synthesisExecutors.d.ts +12 -0
  87. package/dist/orchestrator/synthesisExecutors.js +90 -0
  88. package/dist/orchestrator/taskBuilder.d.ts +2 -2
  89. package/dist/orchestrator/taskBuilder.js +101 -82
  90. package/dist/providers/index.d.ts +7 -0
  91. package/dist/providers/index.js +14 -95
  92. package/dist/quota/discoveredLimits.d.ts +1 -0
  93. package/dist/quota/discoveredLimits.js +7 -1
  94. package/dist/quota/index.d.ts +0 -2
  95. package/dist/quota/index.js +1 -2
  96. package/dist/reporting/workBlocks.js +7 -4
  97. package/dist/types/reviewPlanning.d.ts +23 -16
  98. package/dist/validation/auditResults.js +97 -95
  99. package/dist/validation/sessionConfig.d.ts +2 -2
  100. package/dist/validation/sessionConfig.js +14 -7
  101. package/docs/development.md +35 -139
  102. package/docs/history.md +26 -0
  103. package/docs/product.md +41 -108
  104. package/package.json +3 -2
  105. package/schemas/audit_findings.schema.json +6 -5
  106. package/schemas/critical_flows.schema.json +3 -2
  107. package/schemas/dispatch_quota.schema.json +3 -1
  108. package/schemas/external_analyzer_results.schema.json +2 -2
  109. package/schemas/graph_bundle.schema.json +1 -1
  110. package/schemas/repo_manifest.schema.json +1 -1
  111. package/schemas/review_packets.schema.json +1 -1
  112. package/schemas/step_contract.schema.json +80 -0
  113. package/scripts/postinstall.mjs +19 -2
  114. package/skills/audit-code/opencode-command-template.txt +3 -3
  115. package/dist/orchestrator/internalExecutors.d.ts +0 -34
  116. package/dist/orchestrator/internalExecutors.js +0 -581
  117. package/dist/providers/localSubprocessProvider.d.ts +0 -9
  118. package/dist/providers/localSubprocessProvider.js +0 -18
  119. package/dist/providers/subprocessTemplateProvider.d.ts +0 -8
  120. package/dist/providers/subprocessTemplateProvider.js +0 -59
  121. package/dist/providers/vscodeTaskProvider.d.ts +0 -7
  122. package/dist/providers/vscodeTaskProvider.js +0 -14
  123. package/dist/quota/probe.d.ts +0 -10
  124. package/dist/quota/probe.js +0 -18
  125. package/docs/handoff.md +0 -204
package/docs/product.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Product
2
2
 
3
+ > Normative definition: [`spec/audit-goals.md`](../spec/audit-goals.md) — product
4
+ > identity, invariants, deterministic/LLM boundaries, and completion. This page is
5
+ > the product overview.
6
+
3
7
  ## Canonical surface
4
8
 
5
9
  The primary product is `/audit-code` in conversation.
@@ -12,8 +16,8 @@ Normal product usage should:
12
16
  - keep semantic review with the active conversation agent by default
13
17
  - advance the audit automatically until it completes or no further automatic progress is possible
14
18
 
15
- The CLI is backend infrastructure, a local development harness, and a
16
- repo-local fallback. It is not the preferred end-user mental model.
19
+ The CLI is backend infrastructure, a local development harness, and a repo-local
20
+ fallback. It is not the preferred end-user mental model.
17
21
 
18
22
  ## Supported surfaces
19
23
 
@@ -48,17 +52,14 @@ provider adapters such as `claude-code`, `opencode`, `subprocess-template`, and
48
52
 
49
53
  ## Language strategy
50
54
 
51
- Packet quality should not depend on one language ecosystem. JavaScript,
52
- TypeScript, and Python can receive the richest early support because they are
53
- common in current usage, but every language analyzer must write into the same
54
- language-neutral graph and artifact contracts.
55
+ Packet quality should not depend on one language ecosystem. Every language
56
+ analyzer must write into the same language-neutral graph and artifact contracts;
57
+ JS/TS and Python get the richest early support only because they are common.
55
58
 
56
59
  Do not keep expanding support by adding one bespoke parser per ecosystem unless
57
- there is concrete repository demand or a high-value deterministic signal. The
58
- current breadth of package and workspace manifest hints is enough to validate
59
- the packetization approach. The next product goal is to make graph planning
60
- observable, maintainable, and extensible through generic ownership hints rather
61
- than through an open-ended list of file-format handlers.
60
+ there is concrete repository demand or a high-value deterministic signal. Prefer
61
+ making graph planning observable and extensible through generic ownership hints
62
+ over an open-ended list of file-format handlers.
62
63
 
63
64
  The shared graph should model:
64
65
 
@@ -71,111 +72,43 @@ The shared graph should model:
71
72
  subprocesses
72
73
  - edge confidence, direction, and reason
73
74
 
74
- Graph evidence should be treated in tiers:
75
+ Graph evidence is tiered, strongest first:
75
76
 
76
- - deterministic directed edges, such as imports, entrypoints, route handlers,
77
- test/source links, and resolved analyzer references
78
- - deterministic ownership edges, such as package, module, project, or subsystem
79
- roots
77
+ - deterministic directed edges (imports, entrypoints, route handlers,
78
+ test/source links, resolved analyzer references)
79
+ - deterministic ownership edges (package, module, project, or subsystem roots)
80
80
  - analyzer-supplied ownership roots, normalized into graph reference edges
81
- - language-agnostic semantic affinity, such as shared unusual domain terms,
82
- nearby paths, identifier overlap, or embeddings
83
-
84
- Semantic affinity can help rank `boundary_files`, explain possible context, and
85
- highlight missing deterministic extraction. It should not merge packets on
86
- frequency alone because common tokens like `user`, `request`, `client`,
87
- `config`, and `error` often connect unrelated code.
88
-
89
- Language-specific adapters should enrich the graph without changing packet or
90
- result contracts:
81
+ - language-agnostic semantic affinity (shared unusual domain terms, nearby
82
+ paths, identifier overlap, embeddings)
91
83
 
92
- - JS/TS: TypeScript compiler API, package manifests, import/export edges, route
93
- conventions, test adjacency
94
- - Python: local import statement parsing, package/module resolution,
95
- pytest/unittest adjacency, and future framework route conventions
96
- - Other ecosystems: prefer analyzer-supplied ownership roots, ctags/tree-sitter,
97
- LSP output, or existing external analyzer data before adding new bespoke
98
- manifest parsers
84
+ Semantic affinity can rank `boundary_files`, explain possible context, and
85
+ highlight missing extraction — but it must not merge packets on frequency alone,
86
+ because common tokens (`user`, `request`, `client`, `config`, `error`) connect
87
+ unrelated code.
99
88
 
100
- The fallback should remain useful even when a language has no deep analyzer:
101
- manifest files, path structure, tests, config, and external analyzer output can
102
- still seed a graph with lower-confidence edges.
103
-
104
- Deterministic tool runners should be project-config aware. For example, ESLint
105
- syntax-resolution should run only when the repository has repo-local ESLint
106
- configuration, not merely because an ESLint binary is installed.
89
+ The fallback must stay useful even when a language has no deep analyzer:
90
+ manifests, path structure, tests, config, and external analyzer output can seed a
91
+ graph with lower-confidence edges. Deterministic tool runners should be
92
+ project-config aware — e.g. ESLint syntax-resolution runs only when the repo has
93
+ local ESLint configuration, not merely because the binary is installed.
107
94
 
108
95
  ## Packet planning
109
96
 
110
- `AuditTask` remains the deterministic coverage identity. `ReviewPacket` is the
111
- worker-facing unit of understanding.
112
-
113
- The next packetization phase should:
114
-
115
- - use planner observability to tune which edge kinds change grouping, which
116
- files stay boundary-only, and which extractor gaps leave weakly explained
117
- packets
118
- - extend and exercise the generic ownership-root input so external analyzers
119
- can say "these files belong to module root X" without a new parser for every
120
- ecosystem
121
- - keep graph and manifest parser code modular before broadening it further
122
- - exercise deterministic Python import, package, and test/source graph support
123
- on fixture and real repositories to find the next highest-value gaps
124
- - use language-agnostic semantic affinity only as low-authority context unless
125
- corroborated by deterministic graph evidence
97
+ `AuditTask` is the deterministic coverage identity; `ReviewPacket` is the
98
+ worker-facing unit of understanding. Packetization aims for packets that read as
99
+ coherent code-ownership or execution-flow units, not merely budget-sized bundles:
100
+
126
101
  - build packets around coherent subsystems and execution flows
127
- - keep shared fan-in files visible as context instead of letting them merge too
128
- much of the repository into one packet
129
- - distinguish strong edges from weak or heuristic edges
130
- - group tests with the code they verify when that helps review quality
131
- - include packet rationale, key edges, entrypoints, and boundary files
132
- - track packet-quality metrics such as cohesion, fan-in/fan-out, boundary
133
- crossings, orphan tasks, weak-packet gap and extension counts, risk
134
- concentration, and largest unexplained packet
135
-
136
- The practical success bar is that packets feel like reviewable code ownership
137
- or execution-flow units, not merely budget-sized bundles.
138
-
139
- ## Production readiness
140
-
141
- The package publication path is operational. The release gate, packaged install
142
- smoke tests, and GitHub Actions Trusted Publishing path are routine
143
- maintenance. The remaining production work is product confidence rather than a
144
- new contract shape.
145
-
146
- Readiness should be judged through three checks:
147
-
148
- - field-trial quality: run real repositories through planning, validate
149
- artifacts, and use `audit_plan_metrics.json` to track packet count, weak
150
- packet count, average cohesion, merge edge kinds, and weak-packet samples
151
- - full-loop behavior: prove `next-step` capability routing, packet dispatch,
152
- worker review, `submit-packet`, `merge-and-ingest`, selective deepening,
153
- runtime validation, and final `audit-report.md` promotion in at least one
154
- real host flow
155
- - release hygiene: keep `npm run verify:release`, linked smoke, packaged
156
- smoke, tarball preview, and Trusted Publishing green from a clean checkout
157
-
158
- Extractor work should follow field-trial evidence. Fix deterministic graph gaps
159
- when metrics show them, prefer analyzer-supplied ownership roots before new
160
- manifest parsers, and keep semantic affinity as context unless deterministic
161
- evidence corroborates it.
162
-
163
- The current production-readiness focus is:
164
-
165
- - use the remediator packet-dispatch loop and Polar runtime-confirmed loop as
166
- regression evidence for Windows runtime execution, runtime follow-up, final
167
- synthesis, and report-promotion behavior
168
- - use the remediator contract-link field trial as regression evidence that
169
- small schema, workflow, package script, and type contract suites can become
170
- graph evidence without broad directory merges
171
- - rerun `remediator-lambda` after its Windows `EBUSY` test cleanup issue is
172
- fixed
173
- - keep exercising analyzer ownership roots on real repositories before adding
174
- ecosystem-specific manifest parsers
175
- - keep host setup claims aligned with verified Codex, Claude Desktop, OpenCode,
176
- VS Code, and Antigravity behavior
177
- - split high-concentration implementation files only after the packetization
178
- and schema contracts stay easy to review
102
+ - keep shared fan-in files visible as context rather than merging large parts of
103
+ the repo into one packet
104
+ - distinguish strong (deterministic) edges from weak or heuristic ones
105
+ - group tests with the code they verify when it aids review
106
+ - carry packet rationale, key edges, entrypoints, and boundary files
107
+ - prefer the generic ownership-root contract (analyzers naming module roots) over
108
+ a new parser per ecosystem, and keep graph/manifest parsing modular
109
+
110
+ Planner observability (`audit_plan_metrics.json`: cohesion, fan-in/out, boundary
111
+ crossings, weak-packet gaps) is how extraction gaps are found and prioritized.
179
112
 
180
113
  ## Non-goals
181
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auditor-lambda",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "private": false,
5
5
  "description": "Portable hybrid code-auditing framework for arbitrary repositories.",
6
6
  "type": "module",
@@ -23,7 +23,7 @@
23
23
  "update-languages": "node scripts/update-languages.mjs",
24
24
  "build": "tsc -p tsconfig.json",
25
25
  "check": "tsc -p tsconfig.json --noEmit",
26
- "test": "npm run build && node --test tests/*.test.mjs",
26
+ "test": "npm run build && node --import tsx/esm --test tests/*.test.mjs",
27
27
  "release:patch": "node scripts/release-and-publish.mjs patch --bump-only",
28
28
  "release:minor": "node scripts/release-and-publish.mjs minor --bump-only",
29
29
  "release:major": "node scripts/release-and-publish.mjs major --bump-only",
@@ -73,6 +73,7 @@
73
73
  "ajv": "^8.17.1",
74
74
  "linguist-languages": "^9.3.2",
75
75
  "tree-sitter-wasms": "^0.1.13",
76
+ "tsx": "^4.19.0",
76
77
  "typescript": "^5.9.2",
77
78
  "web-tree-sitter": "^0.25.10"
78
79
  }
@@ -45,7 +45,8 @@
45
45
  "confidence",
46
46
  "lens",
47
47
  "summary",
48
- "affected_files"
48
+ "affected_files",
49
+ "evidence"
49
50
  ],
50
51
  "properties": {
51
52
  "id": { "type": "string" },
@@ -56,7 +57,7 @@
56
57
  "enum": ["critical", "high", "medium", "low", "info"]
57
58
  },
58
59
  "confidence": { "type": "string", "enum": ["high", "medium", "low"] },
59
- "lens": { "type": "string", "minLength": 1 },
60
+ "lens": { "type": "string", "enum": ["correctness", "architecture", "maintainability", "security", "reliability", "performance", "data_integrity", "tests", "operability", "config_deployment", "observability"] },
60
61
  "summary": { "type": "string" },
61
62
  "affected_files": {
62
63
  "type": "array",
@@ -76,10 +77,10 @@
76
77
  },
77
78
  "impact": { "type": "string" },
78
79
  "likelihood": { "type": "string" },
79
- "evidence": { "type": "array", "items": { "type": "string" } },
80
- "reproduction": { "type": "array", "items": { "type": "string" } },
80
+ "evidence": { "type": "array", "minItems": 1, "items": { "type": "string" } },
81
+ "reproduction": { "type": "array", "minItems": 1, "items": { "type": "string" } },
81
82
  "systemic": { "type": "boolean" },
82
- "related_findings": { "type": "array", "items": { "type": "string" } },
83
+ "related_findings": { "type": "array", "minItems": 1, "items": { "type": "string" } },
83
84
  "theme_id": { "type": "string" }
84
85
  },
85
86
  "additionalProperties": false
@@ -33,8 +33,9 @@
33
33
  "items": { "type": "string" }
34
34
  },
35
35
  "confidence": {
36
- "type": "string",
37
- "enum": ["high", "low"]
36
+ "type": "number",
37
+ "minimum": 0,
38
+ "maximum": 1
38
39
  }
39
40
  },
40
41
  "additionalProperties": false
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "audit-code-dispatch-quota/v1alpha2",
4
4
  "title": "DispatchQuota",
5
5
  "description": "Quota schedule for a prepare-dispatch run. Written beside dispatch-plan.json. Hosts must launch at most wave_size packets per wave, then re-read this file before the next wave to pick up any updated limits.",
@@ -101,6 +101,7 @@
101
101
  "quota_source_snapshot": {
102
102
  "type": ["object", "null"],
103
103
  "description": "Real-time usage snapshot from a QuotaSource, if available.",
104
+ "additionalProperties": false,
104
105
  "properties": {
105
106
  "remaining_pct": { "type": ["number", "null"] },
106
107
  "reset_at": { "type": ["string", "null"], "format": "date-time" },
@@ -113,6 +114,7 @@
113
114
  "backoff_state": {
114
115
  "type": ["object", "null"],
115
116
  "description": "Exponential backoff state for repeated rate-limit errors.",
117
+ "additionalProperties": false,
116
118
  "properties": {
117
119
  "consecutive_429_count": { "type": "integer", "minimum": 0 },
118
120
  "current_cooldown_ms": { "type": "integer", "minimum": 0 },
@@ -58,8 +58,8 @@
58
58
  "enum": ["critical", "high", "medium", "low", "info"]
59
59
  },
60
60
  "path": { "type": "string" },
61
- "line_start": { "type": "integer" },
62
- "line_end": { "type": "integer" },
61
+ "line_start": { "type": "integer", "minimum": 1 },
62
+ "line_end": { "type": "integer", "minimum": 1 },
63
63
  "summary": { "type": "string" },
64
64
  "rule": { "type": "string" },
65
65
  "raw": {}
@@ -115,7 +115,7 @@
115
115
  }
116
116
  }
117
117
  },
118
- "additionalProperties": true
118
+ "additionalProperties": false
119
119
  },
120
120
  "analyzers_used": {
121
121
  "type": "array",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "additionalProperties": false
17
17
  },
18
- "generated_at": { "type": "string" },
18
+ "generated_at": { "type": "string", "format": "date-time" },
19
19
  "files": {
20
20
  "type": "array",
21
21
  "items": {
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "graphEdge": {
31
31
  "type": "object",
32
- "required": ["from", "to", "confidence"],
32
+ "required": ["from", "to"],
33
33
  "properties": {
34
34
  "from": { "type": "string" },
35
35
  "to": { "type": "string" },
@@ -0,0 +1,80 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "step_contract.schema.json",
4
+ "title": "Audit Code Step Contract",
5
+ "description": "The step contract written to steps/current-step.json by audit-code. Describes one bounded step for the host agent to execute.",
6
+ "type": "object",
7
+ "required": [
8
+ "contract_version",
9
+ "step_kind",
10
+ "prompt_path",
11
+ "status",
12
+ "run_id",
13
+ "allowed_commands",
14
+ "stop_condition",
15
+ "repo_root",
16
+ "artifacts_dir",
17
+ "artifact_paths"
18
+ ],
19
+ "properties": {
20
+ "contract_version": { "const": "audit-code-step/v1alpha1" },
21
+ "step_kind": {
22
+ "type": "string",
23
+ "enum": [
24
+ "dispatch_review",
25
+ "single_task_fallback",
26
+ "design_review",
27
+ "analyzer_install",
28
+ "edge_reasoning",
29
+ "edge_reasoning_dispatch",
30
+ "synthesis_narrative",
31
+ "present_report",
32
+ "blocked"
33
+ ]
34
+ },
35
+ "status": {
36
+ "type": "string",
37
+ "enum": ["ready", "blocked", "complete"]
38
+ },
39
+ "prompt_path": { "type": "string" },
40
+ "run_id": { "type": ["string", "null"] },
41
+ "progress": {
42
+ "type": "object",
43
+ "required": ["summary"],
44
+ "properties": {
45
+ "summary": { "type": "string" },
46
+ "pending_packets": { "type": "integer" },
47
+ "pending_tasks": { "type": "integer" },
48
+ "completed_tasks": { "type": "integer" },
49
+ "wave_size": { "type": "integer" }
50
+ },
51
+ "additionalProperties": false
52
+ },
53
+ "allowed_commands": {
54
+ "type": "array",
55
+ "items": { "type": "string" }
56
+ },
57
+ "allowed_mcp_tools": {
58
+ "type": "array",
59
+ "items": { "type": "string" }
60
+ },
61
+ "stop_condition": { "type": "string" },
62
+ "repo_root": { "type": "string" },
63
+ "artifacts_dir": { "type": "string" },
64
+ "artifact_paths": {
65
+ "type": "object",
66
+ "additionalProperties": { "type": ["string", "null"] }
67
+ },
68
+ "access": {
69
+ "type": "object",
70
+ "required": ["read_paths", "write_paths"],
71
+ "properties": {
72
+ "read_paths": { "type": "array", "items": { "type": "string" } },
73
+ "write_paths": { "type": "array", "items": { "type": "string" } },
74
+ "forbidden_patterns": { "type": "array", "items": { "type": "string" } }
75
+ },
76
+ "additionalProperties": false
77
+ }
78
+ },
79
+ "additionalProperties": false
80
+ }
@@ -284,7 +284,6 @@ function mergeOpenCodeGlobalConfig(existing) {
284
284
  const parsed = existing ? JSON.parse(existing) : {};
285
285
  const auditPermission = renderOpenCodePermissionConfig();
286
286
  const existingAuditor = objectValue(objectValue(parsed.agent).auditor);
287
- const nodeExecPath = replaceBackslashes(process.execPath);
288
287
  const pkgEntrypoint = replaceBackslashes(join(pkgRoot, 'audit-code.mjs'));
289
288
  return {
290
289
  ...parsed,
@@ -303,7 +302,7 @@ function mergeOpenCodeGlobalConfig(existing) {
303
302
  ...objectValue(parsed.mcp),
304
303
  auditor: {
305
304
  type: 'local',
306
- command: [nodeExecPath, pkgEntrypoint, 'mcp'],
305
+ command: ['node', pkgEntrypoint, 'mcp'],
307
306
  enabled: true,
308
307
  timeout: 10000,
309
308
  },
@@ -380,6 +379,10 @@ if (!promptSource || !skillSource) {
380
379
 
381
380
  const codexOpenAiAgentSource = readOptionalSource(codexOpenAiAgentSourceFile, 'Codex skill UI metadata');
382
381
 
382
+ const postinstallStart = Date.now();
383
+ let succeeded = 0;
384
+ let failed = 0;
385
+
383
386
  const installs = [
384
387
  {
385
388
  label: 'Claude command',
@@ -415,12 +418,14 @@ for (const install of installs) {
415
418
  try {
416
419
  const action = writeGeneratedFile(install.path, install.content);
417
420
  console.log(`audit-code: ${action} global ${install.label} at ${install.path}`);
421
+ succeeded++;
418
422
  } catch (err) {
419
423
  console.warn(`audit-code: could not install global ${install.label} (${err.message})`);
420
424
  console.warn(` To install manually, copy from:`);
421
425
  console.warn(` ${install.sourcePath}`);
422
426
  console.warn(` to:`);
423
427
  console.warn(` ${install.path}`);
428
+ failed++;
424
429
  }
425
430
  }
426
431
 
@@ -429,8 +434,10 @@ const globalMcpLauncherPath = join(homedir(), '.audit-code', 'run-mcp-server.mjs
429
434
  try {
430
435
  const action = writeGeneratedFile(globalMcpLauncherPath, Buffer.from(renderGlobalMcpLauncher(pkgRoot)));
431
436
  console.log(`audit-code: ${action} global MCP launcher at ${globalMcpLauncherPath}`);
437
+ succeeded++;
432
438
  } catch (err) {
433
439
  console.warn(`audit-code: could not install global MCP launcher (${err.message})`);
440
+ failed++;
434
441
  }
435
442
 
436
443
  // Install OpenCode global command and MCP via merged config
@@ -440,10 +447,12 @@ try {
440
447
  mergeOpenCodeGlobalConfig(existing),
441
448
  );
442
449
  console.log(`audit-code: ${action} global OpenCode config in ${opencodeGlobalConfig}`);
450
+ succeeded++;
443
451
  } catch (err) {
444
452
  console.warn(`audit-code: could not install global OpenCode config (${err.message})`);
445
453
  console.warn(` To install manually, add the mcp.auditor and command["audit-code"] entries to:`);
446
454
  console.warn(` ${opencodeGlobalConfig}`);
455
+ failed++;
447
456
  }
448
457
 
449
458
  // Install Antigravity plugin (global skill for Gemini IDE / Antigravity Hub)
@@ -460,8 +469,10 @@ try {
460
469
 
461
470
  const skillAction = writeGeneratedFile(antigravityPluginSkillPath, skillSource);
462
471
  console.log(`audit-code: ${skillAction} Antigravity plugin skill at ${antigravityPluginSkillPath}`);
472
+ succeeded++;
463
473
  } catch (err) {
464
474
  console.warn(`audit-code: could not install Antigravity plugin (${err.message})`);
475
+ failed++;
465
476
  }
466
477
 
467
478
  // Install Claude Desktop plugin so /audit-code appears in the slash-command menu
@@ -497,9 +508,11 @@ try {
497
508
  console.log(`audit-code: ${skillAction} Claude Desktop plugin skill at ${claudePluginSkillPath}`);
498
509
 
499
510
  console.log(`audit-code: restart Claude Desktop for /audit-code to appear in the slash-command menu`);
511
+ succeeded++;
500
512
  } catch (err) {
501
513
  console.warn(`audit-code: could not install Claude Desktop plugin (${err.message})`);
502
514
  console.warn(` Plugin directory: ${claudePluginDir}`);
515
+ failed++;
503
516
  }
504
517
 
505
518
  // Register auditor MCP server with Claude Desktop so /audit-code appears in its slash-command menu
@@ -511,9 +524,13 @@ try {
511
524
  console.log(`audit-code: ${action} Claude Desktop MCP server entry in ${claudeDesktopConfig}`);
512
525
  console.log(`audit-code: restart Claude Desktop for /audit-code to appear`);
513
526
  console.log(`audit-code: to target a specific repo, set AUDIT_CODE_REPO_ROOT in Claude Desktop's MCP env settings`);
527
+ succeeded++;
514
528
  } catch (err) {
515
529
  console.warn(`audit-code: could not update Claude Desktop config (${err.message})`);
516
530
  console.warn(` To register manually, add "mcpServers.auditor" to:`);
517
531
  console.warn(` ${claudeDesktopConfig}`);
518
532
  console.warn(` with command "node" and args ["${replaceBackslashes(globalMcpLauncherPath)}"]`);
533
+ failed++;
519
534
  }
535
+
536
+ console.log(`audit-code: postinstall complete — ${succeeded} succeeded, ${failed} failed (${Date.now() - postinstallStart}ms)`);
@@ -3,11 +3,11 @@
3
3
  Use `audit-code next-step` as the primary interface to the audit workflow.
4
4
 
5
5
  1. Run `audit-code next-step` directly when shell access is available.
6
- 2. If MCP is your only available interface, call `auditor_start_audit` or `auditor_continue_audit`; both return the same one-step contract.
6
+ 2. If MCP is your only available interface, call `start_audit` or `continue_audit`; both return the same one-step contract.
7
7
  3. Read `prompt_content` in the response and follow it.
8
- 4. When a step completes (not blocked), run `audit-code next-step` again or call `auditor_continue_audit` as the compatibility adapter.
8
+ 4. When a step completes (not blocked), run `audit-code next-step` again or call `continue_audit` as the compatibility adapter.
9
9
  5. Stop when the step instructions say to stop.
10
10
 
11
11
  Use the `task` tool or equivalent for subagent dispatch when the step tells you to fan out review work.
12
12
 
13
- If neither shell access nor `auditor_start_audit` is available, stop and report that no next-step interface is connected.
13
+ If neither shell access nor `start_audit` is available, stop and report that no next-step interface is connected.
@@ -1,34 +0,0 @@
1
- import type { ArtifactBundle } from "../io/artifacts.js";
2
- import type { AuditResult } from "../types.js";
3
- import type { RuntimeValidationReport } from "../types/runtimeValidation.js";
4
- import type { ExternalAnalyzerResults } from "../types/externalAnalyzer.js";
5
- import type { AuditScopeManifest } from "../types/auditScope.js";
6
- import type { SynthesisNarrative } from "@audit-tools/shared";
7
- export interface ExecutorRunResult {
8
- updated: ArtifactBundle;
9
- artifacts_written: string[];
10
- progress_summary: string;
11
- }
12
- export declare function resolveRuntimeValidationSpawnCommand(command: string[], platform?: NodeJS.Platform, shellCommand?: string): {
13
- command: string;
14
- args: string[];
15
- };
16
- export declare function runIntakeExecutor(bundle: ArtifactBundle, root: string): Promise<ExecutorRunResult>;
17
- export declare function runStructureExecutor(bundle: ArtifactBundle, root?: string): Promise<ExecutorRunResult>;
18
- export declare function runDesignAssessmentExecutor(bundle: ArtifactBundle): ExecutorRunResult;
19
- export declare function runDesignReviewAutoComplete(bundle: ArtifactBundle): ExecutorRunResult;
20
- export declare function runPlanningExecutor(bundle: ArtifactBundle, root: string, lineIndex?: Record<string, number>, sizeIndex?: Record<string, number>, scope?: AuditScopeManifest): Promise<ExecutorRunResult>;
21
- export declare function runResultIngestionExecutor(bundle: ArtifactBundle, results: AuditResult[]): ExecutorRunResult;
22
- export declare function runRuntimeValidationExecutor(bundle: ArtifactBundle, root: string, options?: {
23
- opentoken?: boolean;
24
- }): Promise<ExecutorRunResult>;
25
- export declare function runRuntimeValidationUpdateExecutor(bundle: ArtifactBundle, updates: RuntimeValidationReport): ExecutorRunResult;
26
- export declare function runSynthesisExecutor(bundle: ArtifactBundle, results?: AuditResult[]): ExecutorRunResult;
27
- /**
28
- * Resolve the optional synthesis-narrative obligation. When a host/provider
29
- * narrative is supplied it is merged into the canonical findings report and the
30
- * human report is re-rendered with themes/executive-summary/top-risks; without
31
- * one the narrative is recorded as omitted and the deterministic report stands.
32
- */
33
- export declare function runSynthesisNarrativeExecutor(bundle: ArtifactBundle, narrative?: SynthesisNarrative): ExecutorRunResult;
34
- export declare function runExternalAnalyzerImportExecutor(bundle: ArtifactBundle, externalResults: ExternalAnalyzerResults): ExecutorRunResult;