auditor-lambda 0.3.12 → 0.3.14

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 (61) hide show
  1. package/README.md +20 -24
  2. package/audit-code-wrapper-lib.mjs +52 -53
  3. package/dist/cli.js +43 -6
  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 +189 -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/skills/audit-code/SKILL.md +7 -3
  36. package/skills/audit-code/audit-code.prompt.md +4 -1
  37. package/docs/agent-integrations.md +0 -317
  38. package/docs/agent-roles.md +0 -69
  39. package/docs/architecture.md +0 -90
  40. package/docs/artifacts.md +0 -36
  41. package/docs/bootstrap-install.md +0 -139
  42. package/docs/contract.md +0 -54
  43. package/docs/dispatch-implementation-plan.md +0 -302
  44. package/docs/field-trial-bug-report.md +0 -237
  45. package/docs/github-copilot.md +0 -66
  46. package/docs/model-selection.md +0 -97
  47. package/docs/next-steps.md +0 -202
  48. package/docs/packaging.md +0 -120
  49. package/docs/pipeline.md +0 -152
  50. package/docs/product-direction.md +0 -154
  51. package/docs/production-launch-bar.md +0 -92
  52. package/docs/production-readiness.md +0 -58
  53. package/docs/releasing.md +0 -145
  54. package/docs/remediation-baseline.md +0 -75
  55. package/docs/repo-layout.md +0 -30
  56. package/docs/run-flow.md +0 -56
  57. package/docs/session-config.md +0 -319
  58. package/docs/supervisor.md +0 -100
  59. package/docs/usage.md +0 -215
  60. package/docs/windows-setup.md +0 -146
  61. package/docs/workflow-refactor-brief.md +0 -124
@@ -1,100 +0,0 @@
1
- # supervisor and provider adapters
2
-
3
- This document describes backend infrastructure.
4
-
5
- The primary product contract is `/audit-code` in conversation.
6
-
7
- Everything here is fallback and implementation detail guidance for the repo-local backend surface.
8
-
9
- In the intended workflow, the conversation agent owns orchestration and
10
- ingestion control, but bounded subagents own semantic review whenever the host
11
- can dispatch them. If subagents are unavailable, the conversation agent reviews
12
- one assigned task and stops so `/audit-code` can be rerun from fresh context.
13
-
14
- Provider adapters are compatibility bridges for backend fallback mode, not the
15
- default review owner.
16
-
17
- ## Repo-local backend surface
18
-
19
- From the target repository root:
20
-
21
- ```bash
22
- audit-code
23
- ```
24
-
25
- Debug one-step mode:
26
-
27
- ```bash
28
- audit-code --single-step
29
- ```
30
-
31
- Explicit root override:
32
-
33
- ```bash
34
- audit-code --root /path/to/repo
35
- ```
36
-
37
- ## Provider mode summary
38
-
39
- If provider is omitted entirely, the backend defaults to the safest mode:
40
-
41
- ```json
42
- {
43
- "provider": "local-subprocess"
44
- }
45
- ```
46
-
47
- If you want best-effort routing across available or configured backends, opt into:
48
-
49
- ```json
50
- {
51
- "provider": "auto",
52
- "ui_mode": "visible"
53
- }
54
- ```
55
-
56
- Explicit backend selection remains available:
57
-
58
- ```bash
59
- audit-code --provider local-subprocess
60
- audit-code --provider claude-code
61
- audit-code --provider opencode
62
- audit-code --provider subprocess-template
63
- audit-code --provider vscode-task
64
- ```
65
-
66
- Those `--provider` invocations are an explicit bridge handoff point.
67
- Without an explicit `--provider` flag or a non-local provider in
68
- `.audit-artifacts/session-config.json`, the backend stops at the
69
- semantic-review boundary and exposes scoped task artifacts for the
70
- slash-command orchestrator.
71
-
72
- ## Auto resolution rule
73
-
74
- When `provider` is set to `auto`, the backend resolves in this order:
75
-
76
- 1. `vscode-task` when running under VS Code and a `vscode_task.command_template` is configured
77
- 2. `subprocess-template` when a generic template bridge is configured
78
- 3. `claude-code` when Claude Code is available and preferred by config or when it is the only detected external CLI
79
- 4. `opencode` when OpenCode is available and preferred by config or when it is the only detected external CLI
80
- 5. `local-subprocess` otherwise
81
-
82
- ## Session config
83
-
84
- Optional backend config file:
85
-
86
- `.audit-artifacts/session-config.json`
87
-
88
- See:
89
-
90
- - `docs/session-config.md`
91
- - `docs/agent-integrations.md`
92
- - `docs/model-selection.md`
93
- - `docs/windows-setup.md`
94
-
95
- ## Note
96
-
97
- Provider adapters are backend integrations, not the primary product concept.
98
- Session config defines bridge settings. An explicit `provider: "auto"` or
99
- `--provider` bridge selection is what opts the backend into provider-mediated
100
- review dispatch.
package/docs/usage.md DELETED
@@ -1,215 +0,0 @@
1
- # Backend CLI Usage
2
-
3
- This document covers the backend fallback CLI and low-level development entrypoints.
4
-
5
- The primary product remains `/audit-code` in conversation.
6
-
7
- ## Stable installed helpers
8
-
9
- Install the package once for the current user:
10
-
11
- ```bash
12
- npm install -g auditor-lambda
13
- ```
14
-
15
- Then invoke `/audit-code` in a supported host. The prompt runs this idempotent
16
- bootstrap helper before advancing the audit:
17
-
18
- ```bash
19
- audit-code ensure --quiet
20
- ```
21
-
22
- Run the same helper manually when you want to create or refresh the repo-local
23
- host assets without starting an audit:
24
-
25
- ```bash
26
- audit-code ensure
27
- ```
28
-
29
- Explicitly rewrite the supported repo-local `/audit-code` surfaces for the
30
- current repository:
31
-
32
- ```bash
33
- audit-code install
34
- ```
35
-
36
- Locate the canonical prompt asset shipped with the package:
37
-
38
- ```bash
39
- audit-code prompt-path
40
- ```
41
-
42
- Run the repo-local backend fallback from the target repository root:
43
-
44
- ```bash
45
- audit-code
46
- ```
47
-
48
- Validate the current fallback artifact bundle:
49
-
50
- ```bash
51
- audit-code validate
52
- ```
53
-
54
- This reports artifact issues, `session-config.json` issues, and explicit provider readiness issues in one machine-readable response.
55
-
56
- Pass additional evidence back into the same fallback wrapper when needed:
57
-
58
- ```bash
59
- audit-code --results /path/to/audit_results.json
60
- audit-code --batch-results /path/to/audit-results-dir
61
- audit-code --updates /path/to/runtime_validation_update.json
62
- audit-code --external-analyzer-results /path/to/external_analyzer_results.json
63
- ```
64
-
65
- Inspect the resolved scope of a task id without reverse-engineering `coverage_matrix.json` manually:
66
-
67
- ```bash
68
- audit-code explain-task src-api-auth:security
69
- ```
70
-
71
- Each wrapper run also refreshes:
72
-
73
- - `.audit-artifacts/operator-handoff.json`
74
- - `.audit-artifacts/operator-handoff.md`
75
-
76
- Use those companion files when you want a stable summary of pending obligations, suggested import paths, and session-config guidance for interactive-provider continuation.
77
-
78
- ## Low-level development entrypoints
79
-
80
- These `dist/index.js` commands are backend and development interfaces.
81
-
82
- They are useful for debugging, smoke coverage, and harness-level integration work.
83
-
84
- ## Sample run
85
-
86
- ```bash
87
- npm run build
88
- node dist/index.js sample-run --artifacts-dir .artifacts
89
- ```
90
-
91
- ## Advance the backend state machine
92
-
93
- ```bash
94
- node dist/index.js advance-audit --root /path/to/repo --artifacts-dir .artifacts
95
- ```
96
-
97
- Optional inputs for the same bounded step:
98
-
99
- ```bash
100
- node dist/index.js advance-audit --root /path/to/repo --artifacts-dir .artifacts --results /path/to/audit_results.json
101
- node dist/index.js advance-audit --root /path/to/repo --artifacts-dir .artifacts --batch-results /path/to/audit-results-dir
102
- node dist/index.js advance-audit --root /path/to/repo --artifacts-dir .artifacts --updates /path/to/runtime_validation_update.json
103
- node dist/index.js advance-audit --root /path/to/repo --artifacts-dir .artifacts --external-analyzer-results /path/to/external_analyzer_results.json
104
- ```
105
-
106
- ## Import normalized external analyzer results
107
-
108
- ```bash
109
- node dist/index.js import-external-analyzer --root /path/to/repo --artifacts-dir .artifacts --external-analyzer-results /path/to/external_analyzer_results.json
110
- ```
111
-
112
- This writes:
113
-
114
- - `external_analyzer_results.json`
115
- - refreshed `audit_state.json`
116
-
117
- ## Real repository intake
118
-
119
- ```bash
120
- node dist/index.js intake --root /path/to/repo --artifacts-dir .artifacts
121
- ```
122
-
123
- This writes:
124
-
125
- - `repo_manifest.json`
126
- - `file_disposition.json`
127
-
128
- ## Planning helper
129
-
130
- ```bash
131
- node dist/index.js plan --root /path/to/repo --artifacts-dir .artifacts
132
- ```
133
-
134
- This command is a backend helper, not a stable end-user planning pipeline.
135
-
136
- It invokes the current bounded advance logic and reports the next backend step.
137
-
138
- ## Ingest audit results
139
-
140
- ```bash
141
- node dist/index.js ingest-results --artifacts-dir .artifacts --results /path/to/audit_results.json
142
- node dist/index.js ingest-results --artifacts-dir .artifacts --batch-results /path/to/audit-results-dir
143
- ```
144
-
145
- This updates:
146
-
147
- - `coverage_matrix.json`
148
- - `flow_coverage.json`
149
- - `runtime_validation_tasks.json`
150
- - `runtime_validation_report.json`
151
- - `audit_results.jsonl`
152
- - `audit_tasks.json`
153
- - `requeue_tasks.json`
154
- - `merged_findings.json`
155
- - `root_cause_clusters.json`
156
- - `synthesis_report.json`
157
-
158
- The batch form processes every `*.json` file in the target directory in lexical order.
159
-
160
- ## Explain a task id
161
-
162
- ```bash
163
- node dist/index.js explain-task src-api-auth:security --artifacts-dir .artifacts
164
- ```
165
-
166
- This prints the resolved task payload, matching `coverage_matrix.json` entries, pending coverage by file, and any already-ingested matching findings.
167
-
168
- ## Update runtime validation report with real evidence
169
-
170
- Prepare a JSON file shaped like `examples/runtime_validation_update.example.json`, then run:
171
-
172
- ```bash
173
- node dist/index.js update-runtime-validation --artifacts-dir .artifacts --updates /path/to/runtime_validation_update.json
174
- ```
175
-
176
- This merges the updates into:
177
-
178
- - `runtime_validation_report.json`
179
- - `synthesis_report.json`
180
-
181
- ## Validate artifacts
182
-
183
- ```bash
184
- node dist/index.js validate --artifacts-dir .artifacts
185
- ```
186
-
187
- This checks artifact shape, cross-artifact consistency, backend session-config validity, and explicit provider readiness.
188
-
189
- It is intended for backend operators and automation, not for the normal conversation route.
190
-
191
- ## Requeue helper
192
-
193
- ```bash
194
- node dist/index.js requeue --artifacts-dir .artifacts
195
- ```
196
-
197
- This command currently reports the current requeue task count from the existing artifact bundle.
198
-
199
- Treat it as an inspection helper rather than a stable artifact-building command.
200
-
201
- ## Synthesize findings
202
-
203
- ```bash
204
- node dist/index.js synthesize --artifacts-dir .artifacts --results /path/to/audit_results.json
205
- ```
206
-
207
- This writes:
208
-
209
- - `merged_findings.json`
210
- - `root_cause_clusters.json`
211
- - `synthesis_report.json`
212
-
213
- ## Ignore file
214
-
215
- Create a `.auditorignore` file at repository root to add extra ignored paths, one per line.
@@ -1,146 +0,0 @@
1
- # Windows setup
2
-
3
- This document covers Windows setup for the backend fallback `audit-code` wrapper.
4
-
5
- The canonical product route is still `/audit-code` in conversation.
6
-
7
- ## Simplest path
8
-
9
- From the target repository root in PowerShell:
10
-
11
- ```powershell
12
- audit-code
13
- ```
14
-
15
- This is the lowest-friction path.
16
-
17
- Use it with the default backend:
18
-
19
- ```json
20
- {
21
- "provider": "local-subprocess",
22
- "ui_mode": "visible"
23
- }
24
- ```
25
-
26
- ## Claude Code on Windows
27
-
28
- If `claude` is on `PATH`, use:
29
-
30
- ```json
31
- {
32
- "provider": "claude-code",
33
- "ui_mode": "visible",
34
- "claude_code": {
35
- "command": "claude",
36
- "extra_args": []
37
- }
38
- }
39
- ```
40
-
41
- If you want to force a model:
42
-
43
- ```json
44
- {
45
- "provider": "claude-code",
46
- "ui_mode": "visible",
47
- "claude_code": {
48
- "command": "claude",
49
- "extra_args": ["--model", "sonnet"]
50
- }
51
- }
52
- ```
53
-
54
- ## OpenCode on Windows
55
-
56
- If `opencode` is on `PATH`, use:
57
-
58
- ```json
59
- {
60
- "provider": "opencode",
61
- "ui_mode": "visible",
62
- "opencode": {
63
- "command": "opencode",
64
- "extra_args": []
65
- }
66
- }
67
- ```
68
-
69
- If you want to force a provider/model pair:
70
-
71
- ```json
72
- {
73
- "provider": "opencode",
74
- "ui_mode": "visible",
75
- "opencode": {
76
- "command": "opencode",
77
- "extra_args": ["--model", "anthropic/claude-sonnet-4.5"]
78
- }
79
- }
80
- ```
81
-
82
- ## Generic PowerShell bridge
83
-
84
- When you need a provider-neutral launcher from Windows, use a PowerShell template bridge.
85
-
86
- Example:
87
-
88
- ```json
89
- {
90
- "provider": "subprocess-template",
91
- "ui_mode": "visible",
92
- "subprocess_template": {
93
- "command_template": [
94
- "pwsh",
95
- "-NoProfile",
96
- "-ExecutionPolicy",
97
- "Bypass",
98
- "-Command",
99
- "& { {workerCommandShell} }"
100
- ]
101
- }
102
- }
103
- ```
104
-
105
- If `pwsh` is not installed, replace it with `powershell`.
106
-
107
- ## VS Code on Windows
108
-
109
- The simplest VS Code path is still the integrated terminal.
110
-
111
- Open the target repository in VS Code and run:
112
-
113
- ```powershell
114
- audit-code
115
- ```
116
-
117
- Use a `vscode-task` template only if you specifically need a task-oriented launcher boundary.
118
-
119
- Example:
120
-
121
- ```json
122
- {
123
- "provider": "vscode-task",
124
- "ui_mode": "visible",
125
- "vscode_task": {
126
- "command_template": [
127
- "pwsh",
128
- "-NoProfile",
129
- "-ExecutionPolicy",
130
- "Bypass",
131
- "-Command",
132
- "& { {workerCommandShell} }"
133
- ]
134
- }
135
- }
136
- ```
137
-
138
- ## Antigravity on Windows
139
-
140
- There is no dedicated Antigravity provider adapter in this repository today.
141
-
142
- The recommended practical path is:
143
-
144
- - run `audit-code` from an Antigravity terminal
145
- - use `local-subprocess` first
146
- - move to `subprocess-template` only if a launcher bridge is actually needed
@@ -1,124 +0,0 @@
1
- # Workflow Refactor Status
2
-
3
- This document records the packet-dispatch refactor that replaced the older
4
- one-agent-per-small-task review plan.
5
-
6
- ## Goal
7
-
8
- Reduce token and quota usage for `/audit-code` while preserving deterministic
9
- validation, ingestion, coverage tracking, and report synthesis.
10
-
11
- The implemented design is a compatibility-preserving packet layer:
12
-
13
- - keep `AuditTask` as the backend planning and coverage identity
14
- - keep `AuditResult[]` as the ingestion contract
15
- - group related task records into worker-facing review packets
16
- - make each worker read a coherent file set once and review multiple lenses in
17
- one pass
18
- - submit packet results through the backend so only assigned result files are
19
- written
20
-
21
- ## Current Product Model
22
-
23
- The canonical workflow is still conversation-first:
24
-
25
- 1. The active conversation agent owns orchestration and ingestion control.
26
- 2. Bounded subagents own semantic packet review when the host supports them.
27
- 3. If subagents are unavailable, the conversation agent completes one assigned
28
- fallback review task and stops so `/audit-code` can be rerun from fresh
29
- context.
30
- 4. Backend provider adapters remain explicit compatibility bridges, not the
31
- default semantic-review owner.
32
-
33
- Session config remains backend fallback configuration. It should not be treated
34
- as the normal way to redirect semantic review into a second external LLM.
35
-
36
- ## Implemented Changes
37
-
38
- The refactor now includes:
39
-
40
- - deterministic `review_packets.json` derived from current `AuditTask` records
41
- - `audit_plan_metrics.json` with packet counts, repeated reference estimates,
42
- largest packet details, and estimated agent reduction
43
- - packet-first pending-task ordering for provider-assisted batches
44
- - tiny homogeneous test-file batching before dispatch
45
- - graph-edge expansion from import, call, and reference edges
46
- - packet prompts that assign multiple task results to one worker
47
- - backend-owned packet submission that validates before writing result files
48
- - isolated large-file packet mode with mechanical anchors for targeted review
49
- - validation and merge checks for missing, duplicate, unknown, malformed, or
50
- out-of-scope task results, including swapped result files
51
- - compact `prepare-dispatch` and `merge-and-ingest` JSON envelopes
52
- - terse worker completion convention:
53
- `valid: <packet_id>, findings=<n>`
54
- - selective deepening for high-severity, low-confidence, conflicting,
55
- high-risk clean, and runtime-disagreement cases
56
- - refreshed packet metrics whenever selective deepening adds follow-up tasks
57
-
58
- ## Dispatch Contract
59
-
60
- `prepare-dispatch` writes a small `dispatch-plan.json`. Each entry points to a
61
- packet prompt under the run-scoped `task-results/` directory.
62
-
63
- The conversation orchestrator should:
64
-
65
- - read only `dispatch-plan.json`
66
- - launch one subagent per packet entry
67
- - tell the subagent to read and follow `entry.prompt_path`
68
- - wait for terse success replies
69
- - run `merge-and-ingest`
70
-
71
- The parent should not read source files, prompt bodies, result payloads, or
72
- large task manifests during the normal packet route.
73
-
74
- ## Artifacts
75
-
76
- Packet mode adds or updates these artifacts:
77
-
78
- - `review_packets.json`
79
- - `audit_plan_metrics.json`
80
- - `<artifacts_dir>/runs/<run_id>/dispatch-plan.json`
81
- - `<artifacts_dir>/runs/<run_id>/dispatch-result-map.json`
82
- - `<artifacts_dir>/runs/<run_id>/task-results/*.prompt.md`
83
- - `<artifacts_dir>/runs/<run_id>/task-results/*.anchors.json`, only for
84
- isolated large-file packets
85
- - `<artifacts_dir>/runs/<run_id>/task-results/*.json`
86
- - `<artifacts_dir>/runs/<run_id>/dispatch-warnings.json`, only when needed
87
-
88
- The existing coverage, runtime validation, requeue, and synthesis artifacts
89
- remain backend-owned.
90
-
91
- ## Verification
92
-
93
- Current in-repo verification:
94
-
95
- - `npm test` passes with 148 tests.
96
-
97
- Relevant test coverage:
98
-
99
- - packet construction and metrics
100
- - packet ordering
101
- - graph-connected packet merging
102
- - tiny test-file batching
103
- - packet prompt generation
104
- - packet submission and merge compatibility with the legacy result array
105
- - missing-result blocking
106
- - swapped-result blocking
107
- - collision-proof assigned result paths
108
- - isolated large-file anchor generation
109
- - path-heuristic regressions
110
- - graph extraction from source contents
111
- - selective deepening triggers and packet refresh
112
-
113
- ## Remaining Follow-Up
114
-
115
- The main remaining work is operational, not structural:
116
-
117
- - run `/audit-code` against at least one nontrivial external repository and
118
- compare packet counts, warning counts, worker completion summaries, and
119
- observed token/quota behavior against the legacy baseline
120
- - keep host-specific smoke testing current for Codex, Claude Desktop, OpenCode,
121
- VS Code, and Antigravity guidance
122
-
123
- For the detailed packet dispatch reference, see
124
- `docs/dispatch-implementation-plan.md`.