auditor-lambda 0.3.40 → 0.5.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 (193) hide show
  1. package/audit-code-wrapper-lib.mjs +20 -2
  2. package/dist/cli/args.d.ts +59 -0
  3. package/dist/cli/args.js +244 -0
  4. package/dist/cli/dispatch.d.ts +80 -0
  5. package/dist/cli/dispatch.js +532 -0
  6. package/dist/cli/prompts.d.ts +37 -0
  7. package/dist/cli/prompts.js +225 -0
  8. package/dist/cli/steps.d.ts +29 -0
  9. package/dist/cli/steps.js +30 -0
  10. package/dist/cli/waveManifest.d.ts +40 -0
  11. package/dist/cli/waveManifest.js +41 -0
  12. package/dist/cli/workerResult.d.ts +18 -0
  13. package/dist/cli/workerResult.js +42 -0
  14. package/dist/cli.d.ts +2 -22
  15. package/dist/cli.js +442 -975
  16. package/dist/extractors/analyzers/css.d.ts +2 -0
  17. package/dist/extractors/analyzers/css.js +101 -0
  18. package/dist/extractors/analyzers/html.d.ts +2 -0
  19. package/dist/extractors/analyzers/html.js +92 -0
  20. package/dist/extractors/analyzers/merge.d.ts +14 -0
  21. package/dist/extractors/analyzers/merge.js +85 -0
  22. package/dist/extractors/analyzers/python.d.ts +2 -0
  23. package/dist/extractors/analyzers/python.js +104 -0
  24. package/dist/extractors/analyzers/registry.d.ts +33 -0
  25. package/dist/extractors/analyzers/registry.js +100 -0
  26. package/dist/extractors/analyzers/resourceUrl.d.ts +7 -0
  27. package/dist/extractors/analyzers/resourceUrl.js +25 -0
  28. package/dist/extractors/analyzers/sql.d.ts +2 -0
  29. package/dist/extractors/analyzers/sql.js +19 -0
  30. package/dist/extractors/analyzers/treeSitter.d.ts +34 -0
  31. package/dist/extractors/analyzers/treeSitter.js +111 -0
  32. package/dist/extractors/analyzers/types.d.ts +53 -0
  33. package/dist/extractors/analyzers/typescript.d.ts +2 -0
  34. package/dist/extractors/analyzers/typescript.js +257 -0
  35. package/dist/extractors/browserExtension.d.ts +1 -3
  36. package/dist/extractors/browserExtension.js +2 -2
  37. package/dist/extractors/designAssessment.d.ts +1 -3
  38. package/dist/extractors/disposition.d.ts +2 -1
  39. package/dist/extractors/disposition.js +11 -1
  40. package/dist/extractors/flows.d.ts +1 -3
  41. package/dist/extractors/flows.js +2 -2
  42. package/dist/extractors/graph.d.ts +2 -2
  43. package/dist/extractors/graph.js +171 -327
  44. package/dist/extractors/graphManifestEdges.d.ts +1 -1
  45. package/dist/extractors/graphPathUtils.d.ts +1 -1
  46. package/dist/extractors/graphPythonImports.d.ts +18 -0
  47. package/dist/extractors/graphPythonImports.js +362 -0
  48. package/dist/extractors/pathPatterns.d.ts +6 -0
  49. package/dist/extractors/pathPatterns.js +8 -0
  50. package/dist/extractors/risk.d.ts +1 -2
  51. package/dist/extractors/surfaces.d.ts +1 -3
  52. package/dist/extractors/surfaces.js +2 -2
  53. package/dist/io/artifacts.d.ts +12 -5
  54. package/dist/io/artifacts.js +13 -1
  55. package/dist/io/runArtifacts.js +1 -1
  56. package/dist/mcp/server.js +1 -1
  57. package/dist/orchestrator/advance.d.ts +21 -0
  58. package/dist/orchestrator/advance.js +69 -7
  59. package/dist/orchestrator/auditTaskUtils.d.ts +4 -0
  60. package/dist/orchestrator/auditTaskUtils.js +27 -0
  61. package/dist/orchestrator/dependencyMap.js +27 -0
  62. package/dist/orchestrator/edgeReasoning.d.ts +39 -0
  63. package/dist/orchestrator/edgeReasoning.js +125 -0
  64. package/dist/orchestrator/executors.js +11 -1
  65. package/dist/orchestrator/fileAnchors.d.ts +1 -1
  66. package/dist/orchestrator/fileIntegrity.d.ts +7 -0
  67. package/dist/orchestrator/fileIntegrity.js +41 -0
  68. package/dist/orchestrator/flowCoverage.d.ts +1 -1
  69. package/dist/orchestrator/flowPlanning.d.ts +1 -1
  70. package/dist/orchestrator/flowRequeue.d.ts +1 -1
  71. package/dist/orchestrator/graphEnrichmentExecutor.d.ts +29 -0
  72. package/dist/orchestrator/graphEnrichmentExecutor.js +196 -0
  73. package/dist/orchestrator/internalExecutors.d.ts +13 -2
  74. package/dist/orchestrator/internalExecutors.js +112 -16
  75. package/dist/orchestrator/localCommands.js +6 -25
  76. package/dist/orchestrator/nextStep.d.ts +2 -1
  77. package/dist/orchestrator/nextStep.js +3 -1
  78. package/dist/orchestrator/planning.d.ts +1 -1
  79. package/dist/orchestrator/requeueCommand.d.ts +1 -1
  80. package/dist/orchestrator/reviewPackets.d.ts +37 -4
  81. package/dist/orchestrator/reviewPackets.js +113 -158
  82. package/dist/orchestrator/runtimeValidation.d.ts +1 -1
  83. package/dist/orchestrator/runtimeValidation.js +4 -31
  84. package/dist/orchestrator/scope.d.ts +62 -0
  85. package/dist/orchestrator/scope.js +227 -0
  86. package/dist/orchestrator/state.js +2 -0
  87. package/dist/orchestrator/taskBuilder.d.ts +1 -1
  88. package/dist/orchestrator/taskBuilder.js +1 -12
  89. package/dist/orchestrator/unionFind.d.ts +7 -0
  90. package/dist/orchestrator/unionFind.js +32 -0
  91. package/dist/orchestrator/unitBuilder.d.ts +2 -2
  92. package/dist/orchestrator/unitBuilder.js +4 -18
  93. package/dist/prompts/renderWorkerPrompt.js +18 -1
  94. package/dist/providers/claudeCodeProvider.d.ts +4 -4
  95. package/dist/providers/claudeCodeProvider.js +9 -3
  96. package/dist/providers/constants.d.ts +1 -1
  97. package/dist/providers/constants.js +1 -1
  98. package/dist/providers/index.d.ts +1 -2
  99. package/dist/providers/index.js +5 -4
  100. package/dist/providers/localSubprocessProvider.d.ts +2 -2
  101. package/dist/providers/localSubprocessProvider.js +1 -1
  102. package/dist/providers/opencodeProvider.d.ts +4 -4
  103. package/dist/providers/opencodeProvider.js +7 -2
  104. package/dist/providers/spawnLoggedCommand.d.ts +3 -1
  105. package/dist/providers/spawnLoggedCommand.js +21 -0
  106. package/dist/providers/subprocessTemplateProvider.d.ts +4 -4
  107. package/dist/providers/subprocessTemplateProvider.js +8 -3
  108. package/dist/providers/vscodeTaskProvider.d.ts +3 -4
  109. package/dist/providers/vscodeTaskProvider.js +2 -2
  110. package/dist/quota/discoveredLimits.js +1 -1
  111. package/dist/quota/hostLimits.d.ts +1 -2
  112. package/dist/quota/hostLimits.js +4 -46
  113. package/dist/quota/index.d.ts +18 -15
  114. package/dist/quota/index.js +4 -9
  115. package/dist/quota/scheduler.d.ts +1 -3
  116. package/dist/quota/scheduler.js +1 -2
  117. package/dist/reporting/synthesis.d.ts +37 -3
  118. package/dist/reporting/synthesis.js +97 -16
  119. package/dist/reporting/synthesisNarrativePrompt.d.ts +7 -0
  120. package/dist/reporting/synthesisNarrativePrompt.js +60 -0
  121. package/dist/reporting/workBlocks.d.ts +2 -11
  122. package/dist/supervisor/operatorHandoff.js +1 -1
  123. package/dist/supervisor/runLedger.d.ts +1 -1
  124. package/dist/supervisor/runLedger.js +2 -2
  125. package/dist/supervisor/sessionConfig.d.ts +8 -1
  126. package/dist/supervisor/sessionConfig.js +22 -3
  127. package/dist/types/analyzerCapability.d.ts +16 -0
  128. package/dist/types/auditScope.d.ts +43 -0
  129. package/dist/types/auditScope.js +14 -0
  130. package/dist/types/reviewPlanning.d.ts +1 -1
  131. package/dist/types/synthesisNarrative.d.ts +7 -0
  132. package/dist/types/synthesisNarrative.js +5 -0
  133. package/dist/types/workerSession.d.ts +6 -0
  134. package/dist/types.d.ts +2 -19
  135. package/dist/validation/artifacts.d.ts +1 -1
  136. package/dist/validation/artifacts.js +10 -1
  137. package/dist/validation/auditResults.d.ts +1 -1
  138. package/dist/validation/auditResults.js +1 -1
  139. package/dist/validation/sessionConfig.d.ts +2 -3
  140. package/dist/validation/sessionConfig.js +25 -3
  141. package/package.json +7 -3
  142. package/schemas/analyzer_capability.schema.json +47 -0
  143. package/schemas/audit_findings.schema.json +141 -0
  144. package/schemas/finding.schema.json +2 -1
  145. package/schemas/graph_bundle.schema.json +5 -0
  146. package/schemas/scope.schema.json +46 -0
  147. package/scripts/postinstall.mjs +0 -1
  148. package/dist/io/json.d.ts +0 -10
  149. package/dist/io/json.js +0 -142
  150. package/dist/providers/types.d.ts +0 -33
  151. package/dist/quota/compositeQuotaSource.d.ts +0 -7
  152. package/dist/quota/compositeQuotaSource.js +0 -20
  153. package/dist/quota/errorParsers/claudeCodeErrorParser.d.ts +0 -6
  154. package/dist/quota/errorParsers/claudeCodeErrorParser.js +0 -39
  155. package/dist/quota/errorParsers/genericErrorParser.d.ts +0 -9
  156. package/dist/quota/errorParsers/genericErrorParser.js +0 -7
  157. package/dist/quota/errorParsers/index.d.ts +0 -5
  158. package/dist/quota/errorParsers/index.js +0 -12
  159. package/dist/quota/errorParsing.d.ts +0 -7
  160. package/dist/quota/errorParsing.js +0 -69
  161. package/dist/quota/fileLock.d.ts +0 -6
  162. package/dist/quota/fileLock.js +0 -64
  163. package/dist/quota/learnedQuotaSource.d.ts +0 -7
  164. package/dist/quota/learnedQuotaSource.js +0 -25
  165. package/dist/quota/limits.d.ts +0 -16
  166. package/dist/quota/limits.js +0 -77
  167. package/dist/quota/quotaSource.d.ts +0 -12
  168. package/dist/quota/slidingWindow.d.ts +0 -4
  169. package/dist/quota/slidingWindow.js +0 -28
  170. package/dist/quota/state.d.ts +0 -15
  171. package/dist/quota/state.js +0 -148
  172. package/dist/quota/types.d.ts +0 -67
  173. package/dist/quota/types.js +0 -1
  174. package/dist/reporting/rootCause.d.ts +0 -10
  175. package/dist/reporting/rootCause.js +0 -146
  176. package/dist/types/disposition.d.ts +0 -9
  177. package/dist/types/disposition.js +0 -1
  178. package/dist/types/flows.d.ts +0 -17
  179. package/dist/types/flows.js +0 -1
  180. package/dist/types/graph.d.ts +0 -22
  181. package/dist/types/graph.js +0 -1
  182. package/dist/types/risk.d.ts +0 -9
  183. package/dist/types/risk.js +0 -1
  184. package/dist/types/runLedger.d.ts +0 -17
  185. package/dist/types/runLedger.js +0 -6
  186. package/dist/types/sessionConfig.d.ts +0 -79
  187. package/dist/types/sessionConfig.js +0 -15
  188. package/dist/types/surfaces.d.ts +0 -15
  189. package/dist/types/surfaces.js +0 -1
  190. package/dist/validation/basic.d.ts +0 -13
  191. package/dist/validation/basic.js +0 -46
  192. /package/dist/{providers → extractors/analyzers}/types.js +0 -0
  193. /package/dist/{quota/quotaSource.js → types/analyzerCapability.js} +0 -0
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Phase 3 — `--since` delta scope.
3
+ *
4
+ * `scope.json` records how the audit was scoped for a given run: a full audit
5
+ * (the default), or a delta audit measured against a git ref. In delta mode the
6
+ * orchestrator audits only the changed files (`seed_files`) and their nearest
7
+ * graph neighbours (`expanded_files`); every other auditable file inherits its
8
+ * prior completion or is excluded from this run. The artifact is a deterministic
9
+ * function of the inputs (the ref, the changed files, the graph) so the same
10
+ * inputs always yield the same scope, and it is recorded honestly in the report
11
+ * header and the run log. It sits upstream of `coverage_matrix.json` in the
12
+ * staleness DAG.
13
+ */
14
+ export interface AuditScopeBudget {
15
+ /**
16
+ * Upper bound on the number of in-scope files (seeds + expanded). Seeds are
17
+ * always retained; expansion stops once this cap is reached.
18
+ */
19
+ max_files: number;
20
+ }
21
+ export interface AuditScopeManifest {
22
+ /** `full` audits every auditable file; `delta` scopes to a changed neighbourhood. */
23
+ mode: "full" | "delta";
24
+ /** Git ref/SHA the delta was measured against; `null` in full mode. */
25
+ since: string | null;
26
+ /**
27
+ * Changed auditable files (relative to `since`) that exist in the repo
28
+ * manifest. Empty in full mode. Sorted for determinism.
29
+ */
30
+ seed_files: string[];
31
+ /**
32
+ * Auditable files pulled in by deterministic priority-frontier expansion over
33
+ * the dependency graph (graph neighbours of the seeds). Sorted for determinism.
34
+ */
35
+ expanded_files: string[];
36
+ /** The budget applied during expansion. */
37
+ budget: AuditScopeBudget;
38
+ /**
39
+ * Human-readable note when the scope was truncated by the budget, or when a
40
+ * requested `--since` could not be honoured and the run fell back to full.
41
+ */
42
+ dropped_note?: string;
43
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Phase 3 — `--since` delta scope.
3
+ *
4
+ * `scope.json` records how the audit was scoped for a given run: a full audit
5
+ * (the default), or a delta audit measured against a git ref. In delta mode the
6
+ * orchestrator audits only the changed files (`seed_files`) and their nearest
7
+ * graph neighbours (`expanded_files`); every other auditable file inherits its
8
+ * prior completion or is excluded from this run. The artifact is a deterministic
9
+ * function of the inputs (the ref, the changed files, the graph) so the same
10
+ * inputs always yield the same scope, and it is recorded honestly in the report
11
+ * header and the run log. It sits upstream of `coverage_matrix.json` in the
12
+ * staleness DAG.
13
+ */
14
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { AuditTask, Lens } from "../types.js";
2
- import type { GraphEdge } from "./graph.js";
2
+ import type { GraphEdge } from "@audit-tools/shared";
3
3
  export interface ReviewPacketGraphEdge extends Pick<GraphEdge, "from" | "to" | "kind" | "confidence" | "reason"> {
4
4
  }
5
5
  export interface ReviewPacketQuality {
@@ -0,0 +1,7 @@
1
+ export type SynthesisNarrativeStatus = "applied" | "omitted";
2
+ export interface SynthesisNarrativeRecord {
3
+ status: SynthesisNarrativeStatus;
4
+ theme_count: number;
5
+ executive_summary_present: boolean;
6
+ top_risk_count: number;
7
+ }
@@ -0,0 +1,5 @@
1
+ // Marker artifact recording whether the optional Phase 6 synthesis-narrative
2
+ // pass was applied or deliberately omitted. Its presence (and freshness against
3
+ // `audit-findings.json`) satisfies the `synthesis_narrative_current` obligation;
4
+ // the narrative content itself lives in `audit-findings.json`.
5
+ export {};
@@ -1,5 +1,10 @@
1
1
  export declare const WORKER_COMMAND_MODES: readonly ["run", "deferred"];
2
2
  export type WorkerCommandMode = (typeof WORKER_COMMAND_MODES)[number];
3
+ export interface AccessDeclaration {
4
+ read_paths: string[];
5
+ write_paths: string[];
6
+ forbidden_patterns?: string[];
7
+ }
3
8
  /**
4
9
  * Worker tasks serialize directly to task.json, so their persisted field names
5
10
  * intentionally stay snake_case for consistency across providers and bridges.
@@ -22,5 +27,6 @@ export interface WorkerTask {
22
27
  skip_worker_command?: boolean;
23
28
  timeout_ms?: number;
24
29
  max_retries?: number;
30
+ access?: AccessDeclaration;
25
31
  }
26
32
  export declare function usesDeferredWorkerCommand(task: Pick<WorkerTask, "worker_command_mode" | "skip_worker_command">): boolean;
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Finding as SharedFinding } from "@audit-tools/shared";
1
2
  export type Lens = "correctness" | "architecture" | "maintainability" | "security" | "reliability" | "performance" | "data_integrity" | "tests" | "operability" | "config_deployment" | "observability";
2
3
  export interface FileRecord {
3
4
  path: string;
@@ -67,26 +68,8 @@ export interface AuditTask {
67
68
  completed_at?: string;
68
69
  completion_reason?: string;
69
70
  }
70
- export interface Finding {
71
- id: string;
72
- title: string;
73
- category: string;
74
- severity: "critical" | "high" | "medium" | "low" | "info";
75
- confidence: "high" | "medium" | "low";
71
+ export interface Finding extends Omit<SharedFinding, "lens"> {
76
72
  lens: Lens;
77
- summary: string;
78
- affected_files: Array<{
79
- path: string;
80
- line_start?: number;
81
- line_end?: number;
82
- symbol?: string;
83
- }>;
84
- impact?: string;
85
- likelihood?: string;
86
- evidence?: string[];
87
- reproduction?: string[];
88
- systemic?: boolean;
89
- related_findings?: string[];
90
73
  }
91
74
  export interface AuditVerification {
92
75
  verified: boolean;
@@ -1,3 +1,3 @@
1
1
  import type { ArtifactBundle } from "../io/artifacts.js";
2
- import { type ValidationIssue } from "./basic.js";
2
+ import { type ValidationIssue } from "@audit-tools/shared";
3
3
  export declare function validateArtifactBundle(bundle: ArtifactBundle): ValidationIssue[];
@@ -1,4 +1,4 @@
1
- import { pushValidationIssue, requireKeys, } from "./basic.js";
1
+ import { pushValidationIssue, requireKeys, } from "@audit-tools/shared";
2
2
  function pushIssue(issues, path, message) {
3
3
  pushValidationIssue(issues, path, message);
4
4
  }
@@ -19,6 +19,15 @@ export function validateArtifactBundle(bundle) {
19
19
  if (bundle.coverage_matrix) {
20
20
  issues.push(...requireKeys(bundle.coverage_matrix, "coverage_matrix", ["files"]));
21
21
  }
22
+ if (bundle.scope) {
23
+ issues.push(...requireKeys(bundle.scope, "scope", [
24
+ "mode",
25
+ "since",
26
+ "seed_files",
27
+ "expanded_files",
28
+ "budget",
29
+ ]));
30
+ }
22
31
  if (bundle.graph_bundle) {
23
32
  issues.push(...requireKeys(bundle.graph_bundle, "graph_bundle", ["graphs"]));
24
33
  }
@@ -1,5 +1,5 @@
1
1
  import type { AuditTask } from "../types.js";
2
- import { type ValidationIssue } from "./basic.js";
2
+ import { type ValidationIssue } from "@audit-tools/shared";
3
3
  export type IssueSeverity = "error" | "warning";
4
4
  export declare function normalizeCoveragePath(path: string): string;
5
5
  export interface AuditResultIssue extends ValidationIssue {
@@ -1,4 +1,4 @@
1
- import { describeValue, formatValidationIssues, isRecord, } from "./basic.js";
1
+ import { describeValue, formatValidationIssues, isRecord, } from "@audit-tools/shared";
2
2
  export function normalizeCoveragePath(path) {
3
3
  return path.replace(/\\/g, "/").replace(/^\.\//, "");
4
4
  }
@@ -1,8 +1,7 @@
1
- import { type SessionConfig } from "../types/sessionConfig.js";
2
- import { type ValidationIssue } from "./basic.js";
1
+ import { type SessionConfig, type ValidationIssue } from "@audit-tools/shared";
3
2
  export declare function validateSessionConfig(value: unknown): ValidationIssue[];
4
3
  export declare function validateConfiguredProviderEnvironment(sessionConfig: SessionConfig, options?: {
5
4
  commandExists?: (command: string) => boolean;
6
5
  pathExists?: (commandPath: string) => boolean;
7
6
  }): ValidationIssue[];
8
- export { formatValidationIssues } from "./basic.js";
7
+ export { formatValidationIssues } from "@audit-tools/shared";
@@ -1,9 +1,9 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import { accessSync, constants } from "node:fs";
3
- import { PROVIDER_NAMES, SESSION_UI_MODES, } from "../types/sessionConfig.js";
4
- import { isRecord, pushValidationIssue, } from "./basic.js";
3
+ import { ANALYZER_SETTINGS, PROVIDER_NAMES, SESSION_UI_MODES, isRecord, pushValidationIssue, } from "@audit-tools/shared";
5
4
  const VALID_PROVIDERS = new Set(PROVIDER_NAMES);
6
5
  const VALID_UI_MODES = new Set(SESSION_UI_MODES);
6
+ const VALID_ANALYZER_SETTINGS = new Set(ANALYZER_SETTINGS);
7
7
  function pushIssue(issues, path, message) {
8
8
  pushValidationIssue(issues, path, message);
9
9
  }
@@ -159,6 +159,28 @@ export function validateSessionConfig(value) {
159
159
  validateTemplateProviderSection(value.vscode_task, "vscode_task", issues, provider === "vscode-task");
160
160
  validateAgentProviderSection(value.claude_code, "claude_code", issues);
161
161
  validateAgentProviderSection(value.opencode, "opencode", issues);
162
+ if (value.synthesis !== undefined) {
163
+ if (!isRecord(value.synthesis)) {
164
+ pushIssue(issues, "synthesis", "synthesis must be a JSON object.");
165
+ }
166
+ else if (value.synthesis.narrative !== undefined &&
167
+ typeof value.synthesis.narrative !== "boolean") {
168
+ pushIssue(issues, "synthesis.narrative", "synthesis.narrative must be a boolean when provided.");
169
+ }
170
+ }
171
+ if (value.analyzers !== undefined) {
172
+ if (!isRecord(value.analyzers)) {
173
+ pushIssue(issues, "analyzers", "analyzers must be a JSON object mapping analyzer id to a setting.");
174
+ }
175
+ else {
176
+ for (const [id, setting] of Object.entries(value.analyzers)) {
177
+ if (typeof setting !== "string" ||
178
+ !VALID_ANALYZER_SETTINGS.has(setting)) {
179
+ pushIssue(issues, `analyzers.${id}`, `analyzers.${id} must be one of: ${Array.from(VALID_ANALYZER_SETTINGS).join(", ")}.`);
180
+ }
181
+ }
182
+ }
183
+ }
162
184
  return issues;
163
185
  }
164
186
  export function validateConfiguredProviderEnvironment(sessionConfig, options = {}) {
@@ -192,4 +214,4 @@ export function validateConfiguredProviderEnvironment(sessionConfig, options = {
192
214
  }
193
215
  return issues;
194
216
  }
195
- export { formatValidationIssues } from "./basic.js";
217
+ export { formatValidationIssues } from "@audit-tools/shared";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auditor-lambda",
3
- "version": "0.3.40",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "description": "Portable hybrid code-auditing framework for arbitrary repositories.",
6
6
  "type": "module",
@@ -34,7 +34,6 @@
34
34
  "smoke:linked-audit-code": "node scripts/smoke-linked-audit-code.mjs",
35
35
  "smoke:packaged-audit-code": "node scripts/smoke-packaged-audit-code.mjs",
36
36
  "prepack": "npm run build",
37
- "prepare": "npm run build",
38
37
  "prepublishOnly": "npm run verify:release",
39
38
  "start": "node dist/index.js",
40
39
  "audit-code": "node audit-code.mjs",
@@ -65,10 +64,15 @@
65
64
  "orchestration",
66
65
  "agents"
67
66
  ],
67
+ "dependencies": {
68
+ "@audit-tools/shared": "*"
69
+ },
68
70
  "devDependencies": {
69
71
  "@types/node": "^24.3.0",
70
72
  "ajv": "^8.17.1",
71
73
  "linguist-languages": "^9.3.2",
72
- "typescript": "^5.9.2"
74
+ "tree-sitter-wasms": "^0.1.13",
75
+ "typescript": "^5.9.2",
76
+ "web-tree-sitter": "^0.25.10"
73
77
  }
74
78
  }
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "analyzer_capability.schema.json",
4
+ "title": "Analyzer Capability Record",
5
+ "description": "Marker artifact (analyzer_capability.json) recording the outcome of the optional Phase 5 graph-enrichment pass. Its presence and freshness against graph_bundle.json satisfy the graph_enrichment_current obligation. The merged edges live in graph_bundle.json.",
6
+ "type": "object",
7
+ "required": ["status", "analyzers"],
8
+ "properties": {
9
+ "status": {
10
+ "type": "string",
11
+ "enum": ["applied", "omitted"],
12
+ "description": "'applied' when at least one analyzer contributed edges/routes; 'omitted' otherwise (regex floor unchanged)."
13
+ },
14
+ "analyzers": {
15
+ "type": "array",
16
+ "items": {
17
+ "type": "object",
18
+ "required": ["id", "resolution", "setting", "edges_added", "routes_added"],
19
+ "properties": {
20
+ "id": { "type": "string", "minLength": 1 },
21
+ "resolution": {
22
+ "type": "string",
23
+ "enum": [
24
+ "repo",
25
+ "cache",
26
+ "installed",
27
+ "absent",
28
+ "skip",
29
+ "not_applicable"
30
+ ],
31
+ "description": "How the analyzer's dependency resolved, or why it did not run."
32
+ },
33
+ "setting": {
34
+ "type": "string",
35
+ "enum": ["repo", "ephemeral", "permanent", "skip", "auto"],
36
+ "description": "Resolved analyzers.<id> session-config setting."
37
+ },
38
+ "edges_added": { "type": "integer", "minimum": 0 },
39
+ "routes_added": { "type": "integer", "minimum": 0 },
40
+ "note": { "type": "string" }
41
+ },
42
+ "additionalProperties": false
43
+ }
44
+ }
45
+ },
46
+ "additionalProperties": false
47
+ }
@@ -0,0 +1,141 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "audit_findings.schema.json",
4
+ "title": "Audit Findings Report",
5
+ "description": "The canonical machine contract emitted as audit-findings.json and consumed by the remediator. Deterministic fields are always present; themes/executive_summary/top_risks are added by the optional synthesis-narrative pass.",
6
+ "type": "object",
7
+ "required": ["contract_version", "summary", "findings", "work_blocks"],
8
+ "properties": {
9
+ "contract_version": { "type": "string", "minLength": 1 },
10
+ "summary": {
11
+ "type": "object",
12
+ "required": [
13
+ "finding_count",
14
+ "work_block_count",
15
+ "severity_breakdown",
16
+ "audited_file_count",
17
+ "excluded_file_count",
18
+ "runtime_validation_status_breakdown"
19
+ ],
20
+ "properties": {
21
+ "finding_count": { "type": "integer", "minimum": 0 },
22
+ "work_block_count": { "type": "integer", "minimum": 0 },
23
+ "severity_breakdown": {
24
+ "type": "object",
25
+ "additionalProperties": { "type": "integer", "minimum": 0 }
26
+ },
27
+ "audited_file_count": { "type": "integer", "minimum": 0 },
28
+ "excluded_file_count": { "type": "integer", "minimum": 0 },
29
+ "runtime_validation_status_breakdown": {
30
+ "type": "object",
31
+ "additionalProperties": { "type": "integer", "minimum": 0 }
32
+ }
33
+ },
34
+ "additionalProperties": false
35
+ },
36
+ "findings": {
37
+ "type": "array",
38
+ "items": {
39
+ "type": "object",
40
+ "required": [
41
+ "id",
42
+ "title",
43
+ "category",
44
+ "severity",
45
+ "confidence",
46
+ "lens",
47
+ "summary",
48
+ "affected_files"
49
+ ],
50
+ "properties": {
51
+ "id": { "type": "string" },
52
+ "title": { "type": "string" },
53
+ "category": { "type": "string", "minLength": 1 },
54
+ "severity": {
55
+ "type": "string",
56
+ "enum": ["critical", "high", "medium", "low", "info"]
57
+ },
58
+ "confidence": { "type": "string", "enum": ["high", "medium", "low"] },
59
+ "lens": { "type": "string", "minLength": 1 },
60
+ "summary": { "type": "string" },
61
+ "affected_files": {
62
+ "type": "array",
63
+ "minItems": 1,
64
+ "items": {
65
+ "type": "object",
66
+ "required": ["path"],
67
+ "properties": {
68
+ "path": { "type": "string" },
69
+ "line_start": { "type": "integer", "minimum": 1 },
70
+ "line_end": { "type": "integer", "minimum": 1 },
71
+ "symbol": { "type": "string" },
72
+ "hash_at_plan_time": { "type": "string" }
73
+ },
74
+ "additionalProperties": false
75
+ }
76
+ },
77
+ "impact": { "type": "string" },
78
+ "likelihood": { "type": "string" },
79
+ "evidence": { "type": "array", "items": { "type": "string" } },
80
+ "reproduction": { "type": "array", "items": { "type": "string" } },
81
+ "systemic": { "type": "boolean" },
82
+ "related_findings": { "type": "array", "items": { "type": "string" } },
83
+ "theme_id": { "type": "string" }
84
+ },
85
+ "additionalProperties": false
86
+ }
87
+ },
88
+ "work_blocks": {
89
+ "type": "array",
90
+ "items": {
91
+ "type": "object",
92
+ "required": [
93
+ "id",
94
+ "finding_ids",
95
+ "unit_ids",
96
+ "owned_files",
97
+ "max_severity",
98
+ "rationale",
99
+ "depends_on"
100
+ ],
101
+ "properties": {
102
+ "id": { "type": "string" },
103
+ "finding_ids": { "type": "array", "items": { "type": "string" } },
104
+ "unit_ids": { "type": "array", "items": { "type": "string" } },
105
+ "owned_files": { "type": "array", "items": { "type": "string" } },
106
+ "max_severity": {
107
+ "type": "string",
108
+ "enum": ["critical", "high", "medium", "low", "info"]
109
+ },
110
+ "rationale": { "type": "string" },
111
+ "depends_on": { "type": "array", "items": { "type": "string" } }
112
+ },
113
+ "additionalProperties": false
114
+ }
115
+ },
116
+ "themes": {
117
+ "type": "array",
118
+ "items": {
119
+ "type": "object",
120
+ "required": [
121
+ "theme_id",
122
+ "title",
123
+ "root_cause",
124
+ "finding_ids",
125
+ "suggested_fix_pattern"
126
+ ],
127
+ "properties": {
128
+ "theme_id": { "type": "string" },
129
+ "title": { "type": "string" },
130
+ "root_cause": { "type": "string" },
131
+ "finding_ids": { "type": "array", "items": { "type": "string" } },
132
+ "suggested_fix_pattern": { "type": "string" }
133
+ },
134
+ "additionalProperties": false
135
+ }
136
+ },
137
+ "executive_summary": { "type": "string" },
138
+ "top_risks": { "type": "array", "items": { "type": "string" } }
139
+ },
140
+ "additionalProperties": false
141
+ }
@@ -72,7 +72,8 @@
72
72
  "type": "array",
73
73
  "minItems": 1,
74
74
  "items": { "type": "string" }
75
- }
75
+ },
76
+ "theme_id": { "type": "string" }
76
77
  },
77
78
  "additionalProperties": false
78
79
  }
@@ -116,6 +116,11 @@
116
116
  }
117
117
  },
118
118
  "additionalProperties": true
119
+ },
120
+ "analyzers_used": {
121
+ "type": "array",
122
+ "items": { "type": "string" },
123
+ "description": "Ids of the language analyzers whose edges were merged into this bundle by the optional graph-enrichment pass. Absent/empty when only the regex floor was used."
119
124
  }
120
125
  },
121
126
  "additionalProperties": false
@@ -0,0 +1,46 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "scope.schema.json",
4
+ "title": "Audit Scope Manifest",
5
+ "description": "scope.json — records how a run was scoped (Phase 3 `--since` delta mode). A deterministic function of the git ref, the changed files, and the dependency graph. Sits upstream of coverage_matrix.json in the staleness DAG: in delta mode only seed + expanded files are (re)queued for audit; every other auditable file inherits its prior completion or is excluded from this run.",
6
+ "type": "object",
7
+ "required": ["mode", "since", "seed_files", "expanded_files", "budget"],
8
+ "properties": {
9
+ "mode": {
10
+ "type": "string",
11
+ "enum": ["full", "delta"],
12
+ "description": "'full' audits every auditable file; 'delta' scopes to a changed neighbourhood."
13
+ },
14
+ "since": {
15
+ "type": ["string", "null"],
16
+ "description": "Git ref/SHA the delta was measured against; null in full mode."
17
+ },
18
+ "seed_files": {
19
+ "type": "array",
20
+ "items": { "type": "string" },
21
+ "description": "Changed auditable files (relative to `since`) present in the repo manifest. Sorted."
22
+ },
23
+ "expanded_files": {
24
+ "type": "array",
25
+ "items": { "type": "string" },
26
+ "description": "Auditable graph neighbours pulled in by priority-frontier expansion. Sorted."
27
+ },
28
+ "budget": {
29
+ "type": "object",
30
+ "required": ["max_files"],
31
+ "properties": {
32
+ "max_files": {
33
+ "type": "integer",
34
+ "minimum": 1,
35
+ "description": "Upper bound on in-scope files (seeds + expanded); expansion stops once reached."
36
+ }
37
+ },
38
+ "additionalProperties": false
39
+ },
40
+ "dropped_note": {
41
+ "type": "string",
42
+ "description": "Set when scope was truncated by the budget, or when `--since` could not be honoured and the run fell back to full."
43
+ }
44
+ },
45
+ "additionalProperties": false
46
+ }
@@ -80,7 +80,6 @@ const OPENCODE_AUDIT_BASH_PERMISSION = {
80
80
  'git status*': 'allow',
81
81
  'git diff*': 'allow',
82
82
  'grep *': 'allow',
83
- 'Select-String *': 'allow',
84
83
  'rm *': 'deny',
85
84
  };
86
85
 
package/dist/io/json.d.ts DELETED
@@ -1,10 +0,0 @@
1
- export declare function isFileMissingError(error: unknown): boolean;
2
- export declare function readJsonFile<T>(path: string): Promise<T>;
3
- export declare function writeJsonFile(path: string, value: unknown): Promise<void>;
4
- export declare function appendNdjsonFile(path: string, value: unknown): Promise<void>;
5
- export declare function readNdjsonFile<T>(path: string): Promise<T[]>;
6
- export declare function readOptionalJsonFile<T>(path: string): Promise<T | undefined>;
7
- export declare function readOptionalNdjsonFile<T>(path: string): Promise<T[] | undefined>;
8
- export declare function writeNdjsonFile(path: string, values: unknown[]): Promise<void>;
9
- export declare function readOptionalTextFile(path: string): Promise<string | undefined>;
10
- export declare function writeTextFile(path: string, value: string): Promise<void>;