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.
- package/README.md +0 -21
- package/audit-code-wrapper-lib.mjs +149 -129
- package/dist/adapters/normalizeExternal.js +6 -3
- package/dist/cli/args.d.ts +0 -1
- package/dist/cli/args.js +0 -6
- package/dist/cli/auditStep.js +7 -1
- package/dist/cli/dispatch.js +3 -2
- package/dist/cli/lineIndex.js +4 -1
- package/dist/cli/mergeAndIngestCommand.d.ts +1 -0
- package/dist/cli/mergeAndIngestCommand.js +219 -0
- package/dist/cli/nextStepCommand.js +5 -1
- package/dist/cli/runToCompletion.d.ts +9 -0
- package/dist/cli/runToCompletion.js +655 -480
- package/dist/cli/statusCommand.d.ts +1 -0
- package/dist/cli/statusCommand.js +113 -0
- package/dist/cli/submitPacketCommand.d.ts +1 -0
- package/dist/cli/submitPacketCommand.js +155 -0
- package/dist/cli/workerResult.d.ts +1 -1
- package/dist/cli/workerRunCommand.d.ts +1 -0
- package/dist/cli/workerRunCommand.js +88 -0
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +14 -565
- package/dist/extractors/analyzers/sql.js +4 -1
- package/dist/extractors/analyzers/treeSitter.js +29 -15
- package/dist/extractors/analyzers/typescript.js +10 -8
- package/dist/extractors/designAssessment.js +43 -24
- package/dist/extractors/graph.js +151 -75
- package/dist/extractors/pathPatterns.js +17 -5
- package/dist/io/artifacts.d.ts +3 -1
- package/dist/io/artifacts.js +18 -2
- package/dist/io/runArtifactTypes.d.ts +18 -0
- package/dist/io/runArtifactTypes.js +1 -0
- package/dist/io/runArtifacts.d.ts +2 -18
- package/dist/io/runArtifacts.js +14 -3
- package/dist/mcp/server.js +9 -0
- package/dist/orchestrator/advance.js +38 -22
- package/dist/orchestrator/artifactFreshness.js +14 -4
- package/dist/orchestrator/autoFixExecutor.d.ts +2 -2
- package/dist/orchestrator/autoFixExecutor.js +26 -8
- package/dist/orchestrator/dependencyMap.d.ts +1 -1
- package/dist/orchestrator/dependencyMap.js +7 -1
- package/dist/orchestrator/executorResult.d.ts +12 -0
- package/dist/orchestrator/executorResult.js +1 -0
- package/dist/orchestrator/fileAnchors.js +14 -3
- package/dist/orchestrator/fileIntegrity.d.ts +1 -0
- package/dist/orchestrator/fileIntegrity.js +12 -3
- package/dist/orchestrator/flowCoverage.js +1 -0
- package/dist/orchestrator/flowRequeue.js +4 -1
- package/dist/orchestrator/graphEnrichmentExecutor.d.ts +1 -1
- package/dist/orchestrator/graphEnrichmentExecutor.js +3 -1
- package/dist/orchestrator/ingestionExecutors.d.ts +11 -0
- package/dist/orchestrator/ingestionExecutors.js +237 -0
- package/dist/orchestrator/intakeExecutors.d.ts +3 -0
- package/dist/orchestrator/intakeExecutors.js +25 -0
- package/dist/orchestrator/planningExecutors.d.ts +4 -0
- package/dist/orchestrator/planningExecutors.js +95 -0
- package/dist/orchestrator/reviewPacketGraph.d.ts +31 -0
- package/dist/orchestrator/reviewPacketGraph.js +691 -0
- package/dist/orchestrator/reviewPackets.d.ts +2 -15
- package/dist/orchestrator/reviewPackets.js +3 -685
- package/dist/orchestrator/runtimeCommand.d.ts +11 -0
- package/dist/orchestrator/runtimeCommand.js +71 -0
- package/dist/orchestrator/scope.js +1 -1
- package/dist/orchestrator/selectiveDeepening/conflict.d.ts +8 -0
- package/dist/orchestrator/selectiveDeepening/conflict.js +71 -0
- package/dist/orchestrator/selectiveDeepening/findingFollowup.d.ts +10 -0
- package/dist/orchestrator/selectiveDeepening/findingFollowup.js +52 -0
- package/dist/orchestrator/selectiveDeepening/highRiskClean.d.ts +7 -0
- package/dist/orchestrator/selectiveDeepening/highRiskClean.js +44 -0
- package/dist/orchestrator/selectiveDeepening/index.d.ts +18 -0
- package/dist/orchestrator/selectiveDeepening/index.js +128 -0
- package/dist/orchestrator/selectiveDeepening/lensVerification.d.ts +12 -0
- package/dist/orchestrator/selectiveDeepening/lensVerification.js +242 -0
- package/dist/orchestrator/selectiveDeepening/runtimeValidation.d.ts +13 -0
- package/dist/orchestrator/selectiveDeepening/runtimeValidation.js +57 -0
- package/dist/orchestrator/selectiveDeepening/shared.d.ts +45 -0
- package/dist/orchestrator/selectiveDeepening/shared.js +128 -0
- package/dist/orchestrator/selectiveDeepening/stewardFollowup.d.ts +6 -0
- package/dist/orchestrator/selectiveDeepening/stewardFollowup.js +72 -0
- package/dist/orchestrator/selectiveDeepening.d.ts +2 -20
- package/dist/orchestrator/selectiveDeepening.js +6 -760
- package/dist/orchestrator/staleness.js +3 -3
- package/dist/orchestrator/structureExecutors.d.ts +5 -0
- package/dist/orchestrator/structureExecutors.js +94 -0
- package/dist/orchestrator/syntaxResolutionExecutor.d.ts +1 -1
- package/dist/orchestrator/synthesisExecutors.d.ts +12 -0
- package/dist/orchestrator/synthesisExecutors.js +90 -0
- package/dist/orchestrator/taskBuilder.d.ts +2 -2
- package/dist/orchestrator/taskBuilder.js +101 -82
- package/dist/providers/index.d.ts +7 -0
- package/dist/providers/index.js +14 -95
- package/dist/quota/discoveredLimits.d.ts +1 -0
- package/dist/quota/discoveredLimits.js +7 -1
- package/dist/quota/index.d.ts +0 -2
- package/dist/quota/index.js +1 -2
- package/dist/reporting/workBlocks.js +7 -4
- package/dist/types/reviewPlanning.d.ts +23 -16
- package/dist/validation/auditResults.js +97 -95
- package/dist/validation/sessionConfig.d.ts +2 -2
- package/dist/validation/sessionConfig.js +14 -7
- package/docs/development.md +35 -139
- package/docs/history.md +26 -0
- package/docs/product.md +41 -108
- package/package.json +3 -2
- package/schemas/audit_findings.schema.json +6 -5
- package/schemas/critical_flows.schema.json +3 -2
- package/schemas/dispatch_quota.schema.json +3 -1
- package/schemas/external_analyzer_results.schema.json +2 -2
- package/schemas/graph_bundle.schema.json +1 -1
- package/schemas/repo_manifest.schema.json +1 -1
- package/schemas/review_packets.schema.json +1 -1
- package/schemas/step_contract.schema.json +80 -0
- package/scripts/postinstall.mjs +19 -2
- package/skills/audit-code/opencode-command-template.txt +3 -3
- package/dist/orchestrator/internalExecutors.d.ts +0 -34
- package/dist/orchestrator/internalExecutors.js +0 -581
- package/dist/providers/localSubprocessProvider.d.ts +0 -9
- package/dist/providers/localSubprocessProvider.js +0 -18
- package/dist/providers/subprocessTemplateProvider.d.ts +0 -8
- package/dist/providers/subprocessTemplateProvider.js +0 -59
- package/dist/providers/vscodeTaskProvider.d.ts +0 -7
- package/dist/providers/vscodeTaskProvider.js +0 -14
- package/dist/quota/probe.d.ts +0 -10
- package/dist/quota/probe.js +0 -18
- 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
|
-
|
|
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.
|
|
52
|
-
|
|
53
|
-
|
|
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.
|
|
58
|
-
|
|
59
|
-
|
|
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
|
|
75
|
+
Graph evidence is tiered, strongest first:
|
|
75
76
|
|
|
76
|
-
- deterministic directed edges
|
|
77
|
-
test/source links,
|
|
78
|
-
- deterministic ownership edges
|
|
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
|
|
82
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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`
|
|
111
|
-
worker-facing unit of understanding.
|
|
112
|
-
|
|
113
|
-
|
|
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
|
|
128
|
-
|
|
129
|
-
- distinguish strong edges from weak or heuristic
|
|
130
|
-
- group tests with the code they verify when
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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.
|
|
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", "
|
|
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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$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": {}
|
|
@@ -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
|
+
}
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -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: [
|
|
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 `
|
|
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 `
|
|
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 `
|
|
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;
|