audit-tools 0.30.60 → 0.31.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 (36) hide show
  1. package/README.md +99 -234
  2. package/dist/audit/adapters/clippy.d.ts +23 -0
  3. package/dist/audit/adapters/clippy.d.ts.map +1 -0
  4. package/dist/audit/adapters/clippy.js +78 -0
  5. package/dist/audit/adapters/clippy.js.map +1 -0
  6. package/dist/audit/adapters/rubocop.d.ts +22 -0
  7. package/dist/audit/adapters/rubocop.d.ts.map +1 -0
  8. package/dist/audit/adapters/rubocop.js +72 -0
  9. package/dist/audit/adapters/rubocop.js.map +1 -0
  10. package/dist/audit/cli/dispatch/packetPrompt.d.ts +2 -1
  11. package/dist/audit/cli/dispatch/packetPrompt.d.ts.map +1 -1
  12. package/dist/audit/cli/dispatch/packetPrompt.js +22 -4
  13. package/dist/audit/cli/dispatch/packetPrompt.js.map +1 -1
  14. package/dist/audit/cli/dispatch.d.ts.map +1 -1
  15. package/dist/audit/cli/dispatch.js +12 -1
  16. package/dist/audit/cli/dispatch.js.map +1 -1
  17. package/dist/audit/extractors/analyzers/acquisitionEngine.d.ts +8 -0
  18. package/dist/audit/extractors/analyzers/acquisitionEngine.d.ts.map +1 -1
  19. package/dist/audit/extractors/analyzers/acquisitionEngine.js +16 -0
  20. package/dist/audit/extractors/analyzers/acquisitionEngine.js.map +1 -1
  21. package/dist/audit/extractors/analyzers/binaryAcquisition.d.ts +16 -2
  22. package/dist/audit/extractors/analyzers/binaryAcquisition.d.ts.map +1 -1
  23. package/dist/audit/extractors/analyzers/binaryAcquisition.js +29 -1
  24. package/dist/audit/extractors/analyzers/binaryAcquisition.js.map +1 -1
  25. package/dist/audit/extractors/analyzers/candidates.d.ts +40 -1
  26. package/dist/audit/extractors/analyzers/candidates.d.ts.map +1 -1
  27. package/dist/audit/extractors/analyzers/candidates.js +387 -2
  28. package/dist/audit/extractors/analyzers/candidates.js.map +1 -1
  29. package/dist/audit/orchestrator/knipGraphCrosscheck.d.ts +65 -0
  30. package/dist/audit/orchestrator/knipGraphCrosscheck.d.ts.map +1 -0
  31. package/dist/audit/orchestrator/knipGraphCrosscheck.js +85 -0
  32. package/dist/audit/orchestrator/knipGraphCrosscheck.js.map +1 -0
  33. package/dist/audit/validation/auditResults.d.ts.map +1 -1
  34. package/dist/audit/validation/auditResults.js +9 -0
  35. package/dist/audit/validation/auditResults.js.map +1 -1
  36. package/package.json +1 -1
package/README.md CHANGED
@@ -1,270 +1,135 @@
1
1
  # audit-tools
2
2
 
3
- Portable, hybrid code **auditing** + **remediation** orchestrators for arbitrary repositories,
4
- shipped as one package exposing two CLIs / slash workflows:
3
+ One npm package shipping two independent code tools over a shared library. Each has its
4
+ own CLI and host slash-command, and each is useful on its own:
5
5
 
6
- - **`audit-code`** (`/audit-code`) — audits a codebase one bounded, backend-rendered step at a time
7
- and produces a findings report (`audit-findings.json` + `audit-report.md`).
8
- - **`remediate-code`** (`/remediate-code`) — consumes that report (or free-form feedback) and applies
9
- fixes step by step, emitting `remediation-outcomes.json` + `remediation-report.md`.
6
+ - **`audit-code`** (`/audit-code`) — audits a repository/project and produces a findings report.
7
+ - **`remediate-code`** (`/remediate-code`) implements changes from findings and/or free-form intent.
10
8
 
11
- Both are **conversation-first**: the product is the slash workflow inside a host agent; the CLI is the
12
- backend/fallback. Each `next-step` call returns one prompt contract (JSON + markdown); the host agent
13
- executes it and calls back for the next. State persists to an artifact directory, so runs are resumable.
9
+ They **compose but don't depend on each other**: audit-code's findings are clean input to
10
+ remediate-code, but you can run either alone. Audit a repo and stop. Or point remediate-code
11
+ at a plain-English request with no audit in sight or hand it audit findings *and* extra
12
+ suggestions at the same time.
14
13
 
15
- ## Install
16
-
17
- ```bash
18
- npm install -g audit-tools
19
- ```
20
-
21
- This installs both the `audit-code` and `remediate-code` bins and deploys the host slash-command assets
22
- (Claude Code, Codex, OpenCode, Antigravity) via the package postinstall.
23
-
24
- ## Usage
25
-
26
- ```bash
27
- audit-code next-step # advance the audit one step
28
- remediate-code next-step # advance a remediation one step
29
- ```
30
-
31
- In a host agent, drive the workflow with `/audit-code` then `/remediate-code`.
32
-
33
- ## Concepts
34
-
35
- One pipeline, two halves: audit → findings contract; remediate → consumes + fixes. The JSON contract is
36
- the source of truth; the markdown is its human render. Neither tool runs to completion in a single call —
37
- each derives state, does one bounded unit of work, persists, and returns. See `CLAUDE.md` for the full
38
- design concepts and standing decisions.
39
-
40
- ---
41
-
42
- ## audit-code
43
-
44
- ### Canonical Product Route
45
-
46
- The primary product is `/audit-code` in conversation.
47
-
48
- Normal product usage should:
49
-
50
- - use the active conversation model by default
51
- - use project files and attached repository context by default
52
- - avoid manual paths, provider flags, and model-selection arguments
53
- - keep semantic review with the active conversation agent by default
54
- - advance the audit automatically until it completes or no further automatic progress is possible
55
-
56
- ### Conversation Setup
57
-
58
- The canonical asset for editor and conversation integrations is:
59
-
60
- `skills/audit-code/audit-code.prompt.md`
14
+ Each tool writes its results to `.audit-tools/` as a machine contract (JSON) plus a
15
+ human-readable render (markdown):
61
16
 
62
- Packaged installs and repository checkouts both ship that prompt asset.
17
+ | Tool | Machine contract | Human render |
18
+ |---|---|---|
19
+ | audit-code | `audit-findings.json` | `audit-report.md` |
20
+ | remediate-code | `remediation-outcomes.json` | `remediation-report.md` |
63
21
 
64
- The intended user install is one global tool install:
22
+ ## Install
65
23
 
66
24
  ```bash
67
25
  npm install -g audit-tools
68
26
  ```
69
27
 
70
- That makes `audit-code` available on `PATH`. During package install, the package
71
- also writes user-level command/skill assets for hosts we can seed safely, including
72
- the Claude command file, the global Codex skill bundle with `audit-code` display
73
- metadata, and the global OpenCode slash command entry in
74
- `~/.config/opencode/opencode.json`.
75
-
76
- After that, invoke `/audit-code` in a supported host. The prompt self-bootstraps
77
- the current repository by running:
78
-
79
- ```bash
80
- audit-code ensure --quiet
81
- ```
82
-
83
- That command writes or refreshes the repo-local assets only when they are missing
84
- or stale, then normal audit execution continues without manual paths, provider
85
- flags, or model-selection arguments.
86
-
87
- The explicit repair and compatibility setup path remains:
88
-
89
- ```bash
90
- audit-code install
91
- ```
92
-
93
- That bootstraps repo-local supporting surfaces for the hosts we can automate today, including:
94
-
95
- - Codex `AGENTS.md` fallback guidance for the global skill surface
96
- - Claude Desktop local MCP bundle artifacts and project template guidance
97
- - OpenCode `opencode.json` with auditor agent and permission wiring; the `/audit-code` command stays in the global npm-installed OpenCode config
98
- - VS Code prompt, custom agent, Copilot instructions, and `.vscode/mcp.json`
99
- - Antigravity planning-mode guidance plus the shared repo-local MCP launcher
28
+ This puts both `audit-code` and `remediate-code` on your `PATH` and, via the package
29
+ postinstall, deploys slash-command assets for supported hosts (Claude Code, Codex,
30
+ OpenCode, VS Code, Antigravity).
100
31
 
101
- `audit-code ensure` refreshes those files automatically when the packaged prompt
102
- or skill changes. Use `audit-code install` or `audit-code ensure --force` when
103
- you intentionally want to rewrite every generated host surface on demand.
104
-
105
- After bootstrap, you can smoke-test the generated host assets and launcher from the repository root:
106
-
107
- ```bash
108
- audit-code verify-install
109
- ```
32
+ ## Usage
110
33
 
111
- After that, open a supported conversation surface in the repository and invoke `/audit-code`.
34
+ The tools are meant to be run as slash-commands inside a host agent. Just invoke the command —
35
+ no manual path, provider, or model flags. The agent works its way through the whole workflow
36
+ on its own, running against your active conversation model, and only stops to ask you when it
37
+ needs a real decision (scope, ambiguous intent, whether to open a PR, and the like).
112
38
 
113
- If a host still needs manual prompt import after bootstrap, open:
39
+ **Audit a code base:**
114
40
 
115
41
  ```text
116
- .audit-code/install/GETTING-STARTED.md
117
- ```
118
-
119
- That repo-local guide now includes dedicated quick-start sections for Codex, Claude Desktop, OpenCode, VS Code, and Antigravity, plus the installed canonical prompt asset path for prompt-import fallback flows.
120
-
121
- For narrower compatibility, `audit-code install-host --host copilot` still exists.
122
-
123
- For hosts that still need manual import after bootstrap, or for environments with no repo-local install surface, after installing the package or checking out the repository, use:
124
-
125
- ```bash
126
- audit-code prompt-path
42
+ /audit-code
127
43
  ```
128
44
 
129
- Import the reported file into your editor or conversation environment's custom prompt configuration, then invoke `/audit-code` in conversation.
45
+ You'll confirm scope and which lenses to apply (security, correctness, reliability,
46
+ data-integrity, etc.), then it runs to completion and leaves `audit-findings.json` +
47
+ `audit-report.md` in `.audit-tools/`.
130
48
 
131
- ### Repo-Local Backend Fallback
132
-
133
- The CLI in this repository is backend infrastructure and a repo-local fallback surface.
134
-
135
- The conversation step engine used by `/audit-code` — the single execution loop —
136
- runs from the target repository root:
137
-
138
- ```bash
139
- audit-code next-step
140
- ```
141
-
142
- Repository-local equivalent:
143
-
144
- ```bash
145
- node /path/to/audit-tools/audit-code.mjs next-step
146
- ```
147
-
148
- This advances deterministic audit state one bounded step, writes
149
- `.audit-tools/audit/steps/current-step.json` and
150
- `.audit-tools/audit/steps/current-prompt.md`, auto-builds `dist/` if it is
151
- missing, and creates the artifacts directory automatically. Hosts follow only
152
- the returned step prompt, then call `next-step` again. A bare `audit-code`
153
- invocation prints usage; there is no implicit batch loop.
154
-
155
- Explicit root override still exists for callers running from outside the target repository:
156
-
157
- ```bash
158
- audit-code next-step --root /path/to/repo
159
- ```
160
-
161
- ### Backend Provider Modes
162
-
163
- If `provider` is omitted, the backend defaults to the safest mode:
164
-
165
- ```json
166
- {
167
- "provider": "local-subprocess"
168
- }
169
- ```
170
-
171
- If you want best-effort cross-editor or provider routing, opt into:
172
-
173
- ```json
174
- {
175
- "provider": "auto",
176
- "ui_mode": "visible"
177
- }
178
- ```
179
-
180
- Optional backend config: `.audit-tools/audit/session-config.json`
181
-
182
- ### Key Docs
183
-
184
- - `docs/audit-pkg/product.md`
185
- - `docs/audit-pkg/operator-guide.md`
186
- - `docs/audit-pkg/contracts.md`
187
- - `docs/audit-pkg/release.md`
188
- - `docs/audit-pkg/development.md`
189
- - `skills/audit-code/SKILL.md`
190
-
191
- ---
192
-
193
- ## remediate-code
194
-
195
- Conversation-first remediation orchestrator. Accepts `audit-findings.json` (the deterministic machine
196
- contract from audit-code), an `audit-report.md` or other feedback document, or conversational feedback —
197
- then advances through one backend-rendered step prompt at a time.
198
-
199
- ### Primary Usage
200
-
201
- ```bash
202
- npm install -g audit-tools
203
- ```
204
-
205
- Then start from a conversation:
49
+ **Remediate issues or implement changes:**
206
50
 
207
51
  ```text
208
52
  /remediate-code path/to/audit-findings.json
209
- ```
210
-
211
- You can also start with free-form feedback:
53
+ /remediate-code split the auth module and make session refresh easier to test
54
+ /remediate-code path/to/audit-findings.json — and prioritize the error-handling issues
55
+ ```
56
+
57
+ It plans the changes, implements and verifies them, and lands the result — a commit by
58
+ default, or a PR / publish if you ask. You confirm scope and the closing action up front and
59
+ review a summary before anything is committed.
60
+
61
+ ### What to expect
62
+
63
+ - **It drives itself.** A single slash-command runs the full workflow; it pauses only for
64
+ clarifications, not to hand each step back to you.
65
+ - **Runs are resumable.** State persists to `.audit-tools/` in the target repo, so an
66
+ interrupted run picks up where it left off.
67
+ - **Work runs in parallel** where it safely can, even allowing for coordination between
68
+ different IDEs, different providers, CLIs, local models, etc.
69
+ - **Effort scales to the work.** Trivial work gets light review; risky or complex work
70
+ gets deeper scrutiny.
71
+
72
+ ### The pipelines, step by step
73
+
74
+ **audit-code:**
75
+
76
+ 1. **Confirm providers** — discovers the LLMs available in your session and confirms which to use.
77
+ 2. **Understand the repo** — deterministically maps files, public surfaces, the dependency
78
+ graph, critical flows, and a risk register; runs available static analyzers and auto-fixes.
79
+ 3. **Confirm intent** — you review the scope and pick the review lenses.
80
+ 4. **Review the design** — two parallel passes: a contract pass (invariants, boundaries,
81
+ obligations) and a conceptual pass (philosophy, alternatives, better directions).
82
+ 5. **Plan** — turns the risk register into bounded, prioritized review tasks.
83
+ 6. **Review in parallel** — dispatches the review tasks to your LLMs, routing riskier work to
84
+ more capable models, and deep-dives selectively.
85
+ 7. **Synthesize** — consolidates everything into `audit-findings.json` + `audit-report.md`,
86
+ then layers on a narrative (themes, executive summary, top risks).
87
+
88
+ **remediate-code:**
89
+
90
+ 1. **Confirm providers** — same session-level provider check as audit-code.
91
+ 2. **Intake** — reads the findings and/or free-form intent, validates the input, and drafts a
92
+ summary with any open questions.
93
+ 3. **Confirm intent** — you confirm scope, answer open questions, and set the closing action
94
+ (commit, push, open PR, publish, or halt).
95
+ 4. **Design the change** — decomposes the work into modules, drafts a contract per module in
96
+ parallel, detects and reconciles seams (where one module's output must match another's
97
+ input), then derives obligations and a test plan. Riskier changes get an independent
98
+ critic-and-judge pass.
99
+ 5. **Preview the risk** — shows the classified risk, file list, and commit message before
100
+ anything runs.
101
+ 6. **Implement in parallel** — executes the changes in isolated worktrees, running tests and
102
+ verifying each unit; failures are triaged and retried or blocked.
103
+ 7. **Close** — runs the closing action and writes `remediation-outcomes.json` +
104
+ `remediation-report.md`.
105
+
106
+ ### CLI (backend / fallback)
107
+
108
+ The slash-commands are the product; the same engines are also directly runnable:
212
109
 
213
- ```text
214
- /remediate-code clean up the auth flow and make the session refresh behavior easier to test
110
+ ```bash
111
+ audit-code next-step # advance an audit one step
112
+ remediate-code next-step # advance a remediation one step
215
113
  ```
216
114
 
217
- The global loader runs `remediate-code ensure --quiet`, then
218
- `remediate-code next-step`, reads only the returned `prompt_path`, and follows
219
- that one prompt. Each prompt carries its own allowed commands and stop condition.
220
-
221
- ### Runtime Artifacts
222
-
223
- Active runs use `.audit-tools/remediation/` in the target repository:
224
-
225
- - `.audit-tools/remediation/state.json`
226
- - `.audit-tools/remediation/steps/current-step.json`
227
- - `.audit-tools/remediation/steps/current-prompt.md`
228
-
229
- After close, durable outputs land at `.audit-tools/`:
230
-
231
- - `remediation-report.md`
232
- - `remediation-outcomes.json`
233
- - `remediation-closing-result.json`
234
-
235
- ### CLI
236
-
237
- | Command | Description |
238
- | --- | --- |
239
- | `remediate-code next-step [--input <path>] [--host-can-dispatch-subagents]` | Decide and render exactly one next action |
240
- | `remediate-code prepare-implement-dispatch --run-id <id>` | Write bounded implementation prompts |
241
- | `remediate-code merge-implement-results --run-id <id>` | Validate implementation results and update item state |
242
- | `remediate-code validate-artifacts` | Validate runtime artifacts |
243
- | `remediate-code ensure [--quiet]` | Repair/check global Claude, Codex, and OpenCode assets |
244
-
245
- ### Auditor Compatibility
246
-
247
- The auditor's canonical `audit-findings.json` is parsed **deterministically** —
248
- findings, work-block assignments, and synthesis themes are adopted verbatim, with
249
- no LLM involved. A Markdown `audit-report.md` (or any other free-form or partial
250
- document) is instead routed through intake synthesis and bounded LLM finding
251
- extraction, so it cannot silently produce a zero-finding plan.
115
+ Add `--root <repo>` when running from outside the target repository.
252
116
 
253
- ---
117
+ ## Develop
254
118
 
255
- ## Build and Test
119
+ TypeScript, Node 20+. From the repo root:
256
120
 
257
121
  ```bash
258
- npm install
259
- npm run build && npm run check
260
- npm test
261
- npm run verify:release
122
+ npm install # always run first in a fresh clone/worktree
123
+ npm run build # tsc dist/
124
+ npm run check # typecheck only
125
+ npm test # build + test
262
126
  ```
263
127
 
264
- When developing from a fresh clone or git worktree, run `npm install` at the repo root
265
- before build, check, or test workflows. Missing `node_modules` can cause misleading type errors.
128
+ Missing `node_modules` makes `audit-tools/shared` resolve a stale `dist/`, producing
129
+ misleading "no exported member" type errors so install before build/check/test.
266
130
 
267
- For GitHub Actions publication and npm Trusted Publishing setup, see `docs/audit-pkg/release.md`.
131
+ See [`CLAUDE.md`](CLAUDE.md) for architecture and design decisions, the specs in
132
+ [`spec/`](spec/), and the product/operator/contract guides in `docs/audit-pkg/`.
268
133
 
269
134
  ## License
270
135
 
@@ -0,0 +1,23 @@
1
+ import type { ExternalAnalyzerResults } from "../types/externalAnalyzer.js";
2
+ /**
3
+ * Parse cargo-clippy's newline-delimited JSON message stream into the generic
4
+ * item shape. Degrades to `[]` on empty/malformed input; individual unparseable
5
+ * lines are skipped rather than throwing the whole parse.
6
+ */
7
+ export declare function parseClippy(stdout: string): Array<{
8
+ id?: string;
9
+ category?: string;
10
+ severity?: string;
11
+ path?: string;
12
+ line_start?: number;
13
+ line_end?: number;
14
+ summary?: string;
15
+ rule?: string;
16
+ }>;
17
+ /**
18
+ * Dedicated severity adapter: route clippy's parsed items through the shared
19
+ * generic normalizer so its output matches the exact ExternalAnalyzerResults
20
+ * contract every other analyzer emits.
21
+ */
22
+ export declare function normalizeClippyJson(stdout: string): ExternalAnalyzerResults;
23
+ //# sourceMappingURL=clippy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clippy.d.ts","sourceRoot":"","sources":["../../../src/audit/adapters/clippy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAoD5E;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IACjD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAoDD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,CAE3E"}
@@ -0,0 +1,78 @@
1
+ import { normalizeGenericExternalResults } from "./normalizeExternal.js";
2
+ function mapClippySeverity(level) {
3
+ switch (level?.toLowerCase()) {
4
+ case "error":
5
+ return "high";
6
+ case "warning":
7
+ return "medium";
8
+ default:
9
+ return "low";
10
+ }
11
+ }
12
+ function primarySpan(spans) {
13
+ if (!Array.isArray(spans) || spans.length === 0)
14
+ return undefined;
15
+ return spans.find((s) => s && s.is_primary) ?? spans[0];
16
+ }
17
+ /**
18
+ * Parse cargo-clippy's newline-delimited JSON message stream into the generic
19
+ * item shape. Degrades to `[]` on empty/malformed input; individual unparseable
20
+ * lines are skipped rather than throwing the whole parse.
21
+ */
22
+ export function parseClippy(stdout) {
23
+ if (!stdout || stdout.trim().length === 0)
24
+ return [];
25
+ const items = [];
26
+ for (const rawLine of stdout.split(/\r?\n/)) {
27
+ const line = rawLine.trim();
28
+ if (line.length === 0)
29
+ continue;
30
+ let parsed;
31
+ try {
32
+ parsed = JSON.parse(line);
33
+ }
34
+ catch {
35
+ continue;
36
+ }
37
+ if (!parsed || parsed.reason !== "compiler-message" || !parsed.message)
38
+ continue;
39
+ const message = parsed.message;
40
+ const level = typeof message.level === "string" ? message.level : undefined;
41
+ // Skip non-diagnostic levels (note/help attached separately have no primary
42
+ // span of interest); only surface error/warning diagnostics.
43
+ if (level !== "error" && level !== "warning")
44
+ continue;
45
+ const span = primarySpan(message.spans);
46
+ const path = typeof span?.file_name === "string" ? span.file_name : "";
47
+ if (!path)
48
+ continue;
49
+ const lineStart = typeof span?.line_start === "number" ? span.line_start : undefined;
50
+ const lineEnd = typeof span?.line_end === "number" ? span.line_end : undefined;
51
+ const rule = message.code && typeof message.code.code === "string" && message.code.code.length > 0
52
+ ? message.code.code
53
+ : "clippy";
54
+ const summary = typeof message.message === "string" && message.message.trim().length > 0
55
+ ? message.message
56
+ : rule;
57
+ items.push({
58
+ id: `clippy:${rule}:${path}:${lineStart ?? 0}`,
59
+ category: "correctness",
60
+ severity: mapClippySeverity(level),
61
+ path,
62
+ line_start: lineStart,
63
+ line_end: lineEnd,
64
+ summary,
65
+ rule,
66
+ });
67
+ }
68
+ return items;
69
+ }
70
+ /**
71
+ * Dedicated severity adapter: route clippy's parsed items through the shared
72
+ * generic normalizer so its output matches the exact ExternalAnalyzerResults
73
+ * contract every other analyzer emits.
74
+ */
75
+ export function normalizeClippyJson(stdout) {
76
+ return normalizeGenericExternalResults("clippy", parseClippy(stdout));
77
+ }
78
+ //# sourceMappingURL=clippy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clippy.js","sourceRoot":"","sources":["../../../src/audit/adapters/clippy.ts"],"names":[],"mappings":"AACA,OAAO,E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AS,IAAI,CAAC,EAAE;YAC9C,QAAQ,EAAE,aAAa;YACvB,QAAQ,EAAE,iBAAiB,CAAC,KAAK,CAAC;YAClC,IAAI;YACJ,UAAU,EAAE,SAAS;YACrB,QAAQ,EAAE,OAAO;YACjB,OAAO;YACP,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,OAAO,+BAA+B,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACxE,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { ExternalAnalyzerResults } from "../types/externalAnalyzer.js";
2
+ /**
3
+ * Parse rubocop's `--format json` stdout into the generic item shape. Degrades
4
+ * to `[]` on empty/malformed input or a missing `files` array.
5
+ */
6
+ export declare function parseRubocop(stdout: string): Array<{
7
+ id?: string;
8
+ category?: string;
9
+ severity?: string;
10
+ path?: string;
11
+ line_start?: number;
12
+ line_end?: number;
13
+ summary?: string;
14
+ rule?: string;
15
+ }>;
16
+ /**
17
+ * Dedicated severity adapter: route rubocop's parsed items through the shared
18
+ * generic normalizer so its output matches the exact ExternalAnalyzerResults
19
+ * contract every other analyzer emits.
20
+ */
21
+ export declare function normalizeRubocopJson(stdout: string): ExternalAnalyzerResults;
22
+ //# sourceMappingURL=rubocop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rubocop.d.ts","sourceRoot":"","sources":["../../../src/audit/adapters/rubocop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAgD5E;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAsDD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,CAE5E"}
@@ -0,0 +1,72 @@
1
+ import { normalizeGenericExternalResults } from "./normalizeExternal.js";
2
+ function mapRubocopSeverity(severity) {
3
+ switch (severity?.toLowerCase()) {
4
+ case "fatal":
5
+ case "error":
6
+ return "high";
7
+ case "warning":
8
+ return "medium";
9
+ default:
10
+ return "low";
11
+ }
12
+ }
13
+ /**
14
+ * Parse rubocop's `--format json` stdout into the generic item shape. Degrades
15
+ * to `[]` on empty/malformed input or a missing `files` array.
16
+ */
17
+ export function parseRubocop(stdout) {
18
+ let payload;
19
+ try {
20
+ payload = JSON.parse(stdout || "{}");
21
+ }
22
+ catch {
23
+ return [];
24
+ }
25
+ const files = Array.isArray(payload.files) ? payload.files : [];
26
+ const items = [];
27
+ for (const file of files) {
28
+ if (!file || typeof file !== "object")
29
+ continue;
30
+ const path = typeof file.path === "string" ? file.path : "";
31
+ if (!path)
32
+ continue;
33
+ const offenses = Array.isArray(file.offenses) ? file.offenses : [];
34
+ for (const offense of offenses) {
35
+ if (!offense || typeof offense !== "object")
36
+ continue;
37
+ const location = offense.location ?? {};
38
+ const lineStart = typeof location.start_line === "number"
39
+ ? location.start_line
40
+ : typeof location.line === "number"
41
+ ? location.line
42
+ : undefined;
43
+ const lineEnd = typeof location.last_line === "number" ? location.last_line : undefined;
44
+ const rule = typeof offense.cop_name === "string" && offense.cop_name.length > 0
45
+ ? offense.cop_name
46
+ : "rubocop";
47
+ const summary = typeof offense.message === "string" && offense.message.trim().length > 0
48
+ ? offense.message
49
+ : rule;
50
+ items.push({
51
+ id: `rubocop:${rule}:${path}:${lineStart ?? 0}`,
52
+ category: "maintainability",
53
+ severity: mapRubocopSeverity(offense.severity),
54
+ path,
55
+ line_start: lineStart,
56
+ line_end: lineEnd,
57
+ summary,
58
+ rule,
59
+ });
60
+ }
61
+ }
62
+ return items;
63
+ }
64
+ /**
65
+ * Dedicated severity adapter: route rubocop's parsed items through the shared
66
+ * generic normalizer so its output matches the exact ExternalAnalyzerResults
67
+ * contract every other analyzer emits.
68
+ */
69
+ export function normalizeRubocopJson(stdout) {
70
+ return normalizeGenericExternalResults("rubocop", parseRubocop(stdout));
71
+ }
72
+ //# sourceMappingURL=rubocop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rubocop.js","sourceRoot":"","sources":["../../../src/audit/adapters/rubocop.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAmCzE,SAAS,kBAAkB,CAAC,QAA4B;IACtD,QAAQ,QAAQ,EAAE,WAAW,EAAE,EAAE,CAAC;QAChC,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACV,OAAO,MAAM,CAAC;QAChB,KAAK,SAAS;YACZ,OAAO,QAAQ,CAAC;QAClB;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IAUzC,IAAI,OAAoB,CAAC;IACzB,IAAI,CAAC;QACH,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAgB,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,MAAM,KAAK,GASN,EAAE,CAAC;IACR,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IA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AO,CAAC,OAAO;gBACjB,CAAC,CAAC,IAAI,CAAC;YACX,KAAK,CAAC,IAAI,CAAC;gBACT,EAAE,EAAE,WAAW,IAAI,IAAI,IAAI,IAAI,SAAS,IAAI,CAAC,EAAE;gBAC/C,QAAQ,EAAE,iBAAiB;gBAC3B,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC;gBAC9C,IAAI;gBACJ,UAAU,EAAE,SAAS;gBACrB,QAAQ,EAAE,OAAO;gBACjB,OAAO;gBACP,IAAI;aACL,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,OAAO,+BAA+B,CAAC,SAAS,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1E,CAAC"}
@@ -3,6 +3,7 @@ import type { ReviewPacket } from "../../types/reviewPlanning.js";
3
3
  import type { ArtifactBundle } from "../../io/artifacts.js";
4
4
  import type { ExternalAnalyzerResults } from "../../types/externalAnalyzer.js";
5
5
  import { type FileAnchorSummary } from "../../orchestrator/fileAnchors.js";
6
+ import { type KnipGraphIndex } from "../../orchestrator/knipGraphCrosscheck.js";
6
7
  /**
7
8
  * Encapsulates large-file anchor extraction for a single packet.
8
9
  * Appends to the provided warnings array on unavailability or failure.
@@ -26,7 +27,7 @@ export declare function extractPacketAnchor(params: {
26
27
  export declare function buildTaskSections(packetTasks: AuditTask[], lensDefs: Record<string, {
27
28
  description: string;
28
29
  do_not_report: string;
29
- }>, lineIndex: Record<string, number>, externalAnalyzerResults?: ExternalAnalyzerResults[]): string[];
30
+ }>, lineIndex: Record<string, number>, externalAnalyzerResults?: ExternalAnalyzerResults[], knipGraphIndex?: KnipGraphIndex): string[];
30
31
  /**
31
32
  * Wraps the array-join block and returns the assembled prompt string.
32
33
  * The worker writes its own AuditResult[] JSON array to `result_path` (the same
@@ -1 +1 @@
1
- {"version":3,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