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
@@ -0,0 +1,131 @@
1
+ # Release
2
+
3
+ ## Release gate
4
+
5
+ Run from the repository root:
6
+
7
+ ```bash
8
+ npm ci
9
+ npm run verify:release
10
+ ```
11
+
12
+ `verify:release` covers:
13
+
14
+ - TypeScript typecheck
15
+ - full automated test suite
16
+ - linked-install `audit-code` smoke coverage
17
+ - packaged-install `audit-code` smoke coverage
18
+ - tarball contract verification for shipped assets and runtime entrypoints
19
+ - packaged and linked verification of bootstrap install behavior
20
+
21
+ For live child-process output while debugging smoke tests:
22
+
23
+ ```bash
24
+ AUDIT_CODE_VERBOSE=1 npm run smoke:packaged-audit-code
25
+ AUDIT_CODE_VERBOSE=1 npm run smoke:linked-audit-code
26
+ ```
27
+
28
+ The packaged smoke path strips inherited `npm_config_*`, `NODE_AUTH_TOKEN`, and
29
+ `NPM_TOKEN` values before nested npm operations so dry runs and smoke installs
30
+ do not accidentally inherit publish credentials or suppress tarball generation.
31
+
32
+ ## Publication
33
+
34
+ Publication is operational through GitHub Actions Trusted Publishing.
35
+
36
+ Workflow:
37
+
38
+ ```text
39
+ .github/workflows/publish-package.yml
40
+ ```
41
+
42
+ The workflow:
43
+
44
+ - requests `id-token: write` for npm OIDC exchange
45
+ - pins Node `22.14.0`
46
+ - upgrades npm to `>=11.5.1`
47
+ - runs `npm run verify:release`
48
+ - previews the packed tarball with `npm pack --dry-run`
49
+ - publishes with public access and provenance
50
+ - defaults semver prerelease versions to the `next` dist-tag unless overridden
51
+ - verifies that the published version resolves from the registry
52
+ - uploads `*-npm-logs` artifacts on failure
53
+
54
+ Routine CI exercises Node `20` and Node `22`.
55
+
56
+ ## Version bump helpers
57
+
58
+ Use:
59
+
60
+ ```bash
61
+ npm run release:patch
62
+ ```
63
+
64
+ That bumps the version, updates `package.json` and `package-lock.json`, and
65
+ creates the release commit and annotated tag.
66
+
67
+ Available variants:
68
+
69
+ - `npm run release:minor`
70
+ - `npm run release:major`
71
+
72
+ Full maintainer flow:
73
+
74
+ ```bash
75
+ npm run release:patch:publish
76
+ ```
77
+
78
+ That command checks the worktree, runs the release gate, bumps the version,
79
+ commits, tags, pushes `main` and the tag, creates the GitHub Release, waits for
80
+ `publish-package.yml`, and confirms the new npm version resolves.
81
+
82
+ Minor and major publish variants:
83
+
84
+ - `npm run release:minor:publish`
85
+ - `npm run release:major:publish`
86
+
87
+ ## Manual workflow dispatch
88
+
89
+ Use GitHub Actions `workflow_dispatch` to exercise or run the publish workflow.
90
+
91
+ Dry run:
92
+
93
+ - `dry_run=true`
94
+ - `publish_tag=auto`
95
+
96
+ Live publish:
97
+
98
+ - `dry_run=false`
99
+ - `publish_tag=auto` unless intentionally overriding the dist-tag
100
+
101
+ `publish_tag=auto` resolves stable versions to `latest` and prerelease versions
102
+ to `next`.
103
+
104
+ Publishing a GitHub Release triggers the same workflow.
105
+
106
+ ## Trusted publisher setup
107
+
108
+ npm Trusted Publishing is configured for this repository. If repository,
109
+ workflow, or ownership details change, keep the npm trusted publisher entry
110
+ aligned with:
111
+
112
+ - owner or organization: `OhOkThisIsFine`
113
+ - repository: `auditor-lambda`
114
+ - workflow filename: `publish-package.yml`
115
+
116
+ ## Troubleshooting
117
+
118
+ If a GitHub Actions run fails:
119
+
120
+ 1. download the uploaded `*-npm-logs` artifact
121
+ 2. rerun `npm ci` and `npm run verify:release` locally from the same commit
122
+ 3. for publish failures, rerun `publish-package.yml` with `dry_run=true`
123
+ 4. confirm npm Trusted Publishing still targets `publish-package.yml`
124
+
125
+ Post-publish checks:
126
+
127
+ ```bash
128
+ npm view auditor-lambda version
129
+ npm view auditor-lambda dist-tags --json
130
+ npm audit signatures
131
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auditor-lambda",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "private": false,
5
5
  "description": "Portable hybrid code-auditing framework for arbitrary repositories.",
6
6
  "type": "module",
@@ -0,0 +1,347 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "audit_plan_metrics.schema.json",
4
+ "title": "Audit Plan Metrics",
5
+ "type": "object",
6
+ "required": [
7
+ "generated_at",
8
+ "task_count",
9
+ "packet_count",
10
+ "estimated_agent_reduction",
11
+ "estimated_agent_reduction_ratio",
12
+ "unique_file_count",
13
+ "task_file_reference_count",
14
+ "repeated_file_reference_count",
15
+ "total_task_lines",
16
+ "total_packet_lines",
17
+ "repeated_line_reference_count",
18
+ "min_task_lines",
19
+ "max_task_lines",
20
+ "average_task_lines",
21
+ "lens_task_counts",
22
+ "priority_task_counts",
23
+ "packet_quality",
24
+ "packet_size"
25
+ ],
26
+ "properties": {
27
+ "generated_at": { "type": "string" },
28
+ "task_count": {
29
+ "type": "integer",
30
+ "minimum": 0
31
+ },
32
+ "packet_count": {
33
+ "type": "integer",
34
+ "minimum": 0
35
+ },
36
+ "estimated_agent_reduction": {
37
+ "type": "integer",
38
+ "minimum": 0
39
+ },
40
+ "estimated_agent_reduction_ratio": {
41
+ "type": "number",
42
+ "minimum": 0,
43
+ "maximum": 1
44
+ },
45
+ "unique_file_count": {
46
+ "type": "integer",
47
+ "minimum": 0
48
+ },
49
+ "task_file_reference_count": {
50
+ "type": "integer",
51
+ "minimum": 0
52
+ },
53
+ "repeated_file_reference_count": {
54
+ "type": "integer",
55
+ "minimum": 0
56
+ },
57
+ "total_task_lines": {
58
+ "type": "integer",
59
+ "minimum": 0
60
+ },
61
+ "total_packet_lines": {
62
+ "type": "integer",
63
+ "minimum": 0
64
+ },
65
+ "repeated_line_reference_count": {
66
+ "type": "integer",
67
+ "minimum": 0
68
+ },
69
+ "min_task_lines": {
70
+ "type": "integer",
71
+ "minimum": 0
72
+ },
73
+ "max_task_lines": {
74
+ "type": "integer",
75
+ "minimum": 0
76
+ },
77
+ "average_task_lines": {
78
+ "type": "number",
79
+ "minimum": 0
80
+ },
81
+ "largest_task_id": { "type": "string" },
82
+ "largest_packet_id": { "type": "string" },
83
+ "lens_task_counts": {
84
+ "$ref": "#/$defs/lensCounts"
85
+ },
86
+ "priority_task_counts": {
87
+ "type": "object",
88
+ "required": ["high", "medium", "low"],
89
+ "properties": {
90
+ "high": {
91
+ "type": "integer",
92
+ "minimum": 0
93
+ },
94
+ "medium": {
95
+ "type": "integer",
96
+ "minimum": 0
97
+ },
98
+ "low": {
99
+ "type": "integer",
100
+ "minimum": 0
101
+ }
102
+ },
103
+ "additionalProperties": false
104
+ },
105
+ "packet_quality": {
106
+ "type": "object",
107
+ "required": [
108
+ "average_cohesion_score",
109
+ "boundary_crossing_count",
110
+ "merge_edge_kind_counts",
111
+ "boundary_edge_kind_counts",
112
+ "orphan_task_count",
113
+ "high_fan_in_file_count",
114
+ "high_fan_out_file_count",
115
+ "weakly_explained_gap_counts",
116
+ "weakly_explained_file_extension_counts",
117
+ "weakly_explained_packet_count",
118
+ "weakly_explained_packet_ids",
119
+ "weakly_explained_packet_samples",
120
+ "largest_unexplained_packet_files"
121
+ ],
122
+ "properties": {
123
+ "average_cohesion_score": {
124
+ "type": "number",
125
+ "minimum": 0,
126
+ "maximum": 1
127
+ },
128
+ "boundary_crossing_count": {
129
+ "type": "integer",
130
+ "minimum": 0
131
+ },
132
+ "merge_edge_kind_counts": {
133
+ "$ref": "#/$defs/edgeKindCounts"
134
+ },
135
+ "boundary_edge_kind_counts": {
136
+ "$ref": "#/$defs/edgeKindCounts"
137
+ },
138
+ "orphan_task_count": {
139
+ "type": "integer",
140
+ "minimum": 0
141
+ },
142
+ "high_fan_in_file_count": {
143
+ "type": "integer",
144
+ "minimum": 0
145
+ },
146
+ "high_fan_out_file_count": {
147
+ "type": "integer",
148
+ "minimum": 0
149
+ },
150
+ "weakly_explained_gap_counts": {
151
+ "$ref": "#/$defs/weaklyExplainedGapCounts"
152
+ },
153
+ "weakly_explained_file_extension_counts": {
154
+ "$ref": "#/$defs/countRecord"
155
+ },
156
+ "weakly_explained_packet_count": {
157
+ "type": "integer",
158
+ "minimum": 0
159
+ },
160
+ "weakly_explained_packet_ids": {
161
+ "type": "array",
162
+ "items": { "type": "string" }
163
+ },
164
+ "weakly_explained_packet_samples": {
165
+ "type": "array",
166
+ "maxItems": 12,
167
+ "items": { "$ref": "#/$defs/weaklyExplainedPacketSample" }
168
+ },
169
+ "largest_unexplained_packet_id": { "type": "string" },
170
+ "largest_unexplained_packet_files": {
171
+ "type": "integer",
172
+ "minimum": 0
173
+ }
174
+ },
175
+ "additionalProperties": false
176
+ },
177
+ "packet_size": {
178
+ "type": "object",
179
+ "required": [
180
+ "single_task_packets",
181
+ "multi_task_packets",
182
+ "max_tasks_per_packet",
183
+ "max_files_per_packet"
184
+ ],
185
+ "properties": {
186
+ "single_task_packets": {
187
+ "type": "integer",
188
+ "minimum": 0
189
+ },
190
+ "multi_task_packets": {
191
+ "type": "integer",
192
+ "minimum": 0
193
+ },
194
+ "max_tasks_per_packet": {
195
+ "type": "integer",
196
+ "minimum": 0
197
+ },
198
+ "max_files_per_packet": {
199
+ "type": "integer",
200
+ "minimum": 0
201
+ }
202
+ },
203
+ "additionalProperties": false
204
+ }
205
+ },
206
+ "additionalProperties": false,
207
+ "$defs": {
208
+ "countRecord": {
209
+ "type": "object",
210
+ "additionalProperties": {
211
+ "type": "integer",
212
+ "minimum": 0
213
+ }
214
+ },
215
+ "edgeKindCounts": {
216
+ "type": "object",
217
+ "additionalProperties": {
218
+ "type": "integer",
219
+ "minimum": 0
220
+ }
221
+ },
222
+ "weaklyExplainedPacketSample": {
223
+ "type": "object",
224
+ "required": [
225
+ "packet_id",
226
+ "primary_gap",
227
+ "file_count",
228
+ "sample_file_paths",
229
+ "cohesion_score",
230
+ "internal_edge_count",
231
+ "boundary_edge_count",
232
+ "unexplained_file_count"
233
+ ],
234
+ "properties": {
235
+ "packet_id": { "type": "string" },
236
+ "primary_gap": {
237
+ "type": "string",
238
+ "enum": [
239
+ "missing_internal_edges",
240
+ "unexplained_files",
241
+ "partial_cohesion"
242
+ ]
243
+ },
244
+ "file_count": {
245
+ "type": "integer",
246
+ "minimum": 0
247
+ },
248
+ "sample_file_paths": {
249
+ "type": "array",
250
+ "maxItems": 8,
251
+ "items": { "type": "string" }
252
+ },
253
+ "cohesion_score": {
254
+ "type": "number",
255
+ "minimum": 0,
256
+ "maximum": 1
257
+ },
258
+ "internal_edge_count": {
259
+ "type": "integer",
260
+ "minimum": 0
261
+ },
262
+ "boundary_edge_count": {
263
+ "type": "integer",
264
+ "minimum": 0
265
+ },
266
+ "unexplained_file_count": {
267
+ "type": "integer",
268
+ "minimum": 0
269
+ }
270
+ },
271
+ "additionalProperties": false
272
+ },
273
+ "weaklyExplainedGapCounts": {
274
+ "type": "object",
275
+ "required": [
276
+ "missing_internal_edges",
277
+ "unexplained_files",
278
+ "partial_cohesion"
279
+ ],
280
+ "properties": {
281
+ "missing_internal_edges": {
282
+ "type": "integer",
283
+ "minimum": 0
284
+ },
285
+ "unexplained_files": {
286
+ "type": "integer",
287
+ "minimum": 0
288
+ },
289
+ "partial_cohesion": {
290
+ "type": "integer",
291
+ "minimum": 0
292
+ }
293
+ },
294
+ "additionalProperties": false
295
+ },
296
+ "lensCounts": {
297
+ "type": "object",
298
+ "properties": {
299
+ "correctness": {
300
+ "type": "integer",
301
+ "minimum": 0
302
+ },
303
+ "architecture": {
304
+ "type": "integer",
305
+ "minimum": 0
306
+ },
307
+ "maintainability": {
308
+ "type": "integer",
309
+ "minimum": 0
310
+ },
311
+ "security": {
312
+ "type": "integer",
313
+ "minimum": 0
314
+ },
315
+ "reliability": {
316
+ "type": "integer",
317
+ "minimum": 0
318
+ },
319
+ "performance": {
320
+ "type": "integer",
321
+ "minimum": 0
322
+ },
323
+ "data_integrity": {
324
+ "type": "integer",
325
+ "minimum": 0
326
+ },
327
+ "tests": {
328
+ "type": "integer",
329
+ "minimum": 0
330
+ },
331
+ "operability": {
332
+ "type": "integer",
333
+ "minimum": 0
334
+ },
335
+ "config_deployment": {
336
+ "type": "integer",
337
+ "minimum": 0
338
+ },
339
+ "observability": {
340
+ "type": "integer",
341
+ "minimum": 0
342
+ }
343
+ },
344
+ "additionalProperties": false
345
+ }
346
+ }
347
+ }
@@ -7,6 +7,41 @@
7
7
  "properties": {
8
8
  "tool": { "type": "string" },
9
9
  "generated_at": { "type": "string" },
10
+ "ownership_roots": {
11
+ "type": "array",
12
+ "description": "Optional analyzer-supplied ownership roots. Each root says a bounded set of checked-in paths belongs to the same module or package root and is translated into graph reference edges.",
13
+ "items": {
14
+ "type": "object",
15
+ "required": ["root", "paths"],
16
+ "properties": {
17
+ "root": {
18
+ "type": "string",
19
+ "description": "Repository-relative ownership root directory."
20
+ },
21
+ "paths": {
22
+ "type": "array",
23
+ "minItems": 1,
24
+ "items": { "type": "string" },
25
+ "description": "Repository-relative files known to belong to this root."
26
+ },
27
+ "kind": {
28
+ "type": "string",
29
+ "description": "Optional analyzer-specific ownership kind, such as 'python-package' or 'module'."
30
+ },
31
+ "confidence": {
32
+ "type": "number",
33
+ "minimum": 0,
34
+ "maximum": 1,
35
+ "description": "Analyzer confidence for the ownership hint."
36
+ },
37
+ "reason": {
38
+ "type": "string",
39
+ "description": "Short explanation of why the analyzer emitted this root."
40
+ }
41
+ },
42
+ "additionalProperties": false
43
+ }
44
+ },
10
45
  "results": {
11
46
  "type": "array",
12
47
  "items": {
@@ -18,7 +18,22 @@
18
18
  "to": { "type": "string" },
19
19
  "kind": {
20
20
  "type": "string",
21
- "description": "Import edge kind from the graph extractor (e.g. 'esm', 'commonjs', 'dynamic', 're-export')."
21
+ "description": "Import edge kind from the graph extractor (e.g. 'esm', 'commonjs', 'dynamic', 're-export', 'python-import', 'python-from-import')."
22
+ },
23
+ "direction": {
24
+ "type": "string",
25
+ "enum": ["directed", "undirected"],
26
+ "description": "Whether the edge should be interpreted as directional."
27
+ },
28
+ "confidence": {
29
+ "type": "number",
30
+ "minimum": 0,
31
+ "maximum": 1,
32
+ "description": "Extractor confidence for graph-informed planning."
33
+ },
34
+ "reason": {
35
+ "type": "string",
36
+ "description": "Short explanation of why the edge exists."
22
37
  }
23
38
  },
24
39
  "additionalProperties": false
@@ -35,6 +50,21 @@
35
50
  "kind": {
36
51
  "type": "string",
37
52
  "description": "Call edge kind from the graph extractor (e.g. 'sync', 'async', 'constructor', 'callback')."
53
+ },
54
+ "direction": {
55
+ "type": "string",
56
+ "enum": ["directed", "undirected"],
57
+ "description": "Whether the edge should be interpreted as directional."
58
+ },
59
+ "confidence": {
60
+ "type": "number",
61
+ "minimum": 0,
62
+ "maximum": 1,
63
+ "description": "Extractor confidence for graph-informed planning."
64
+ },
65
+ "reason": {
66
+ "type": "string",
67
+ "description": "Short explanation of why the edge exists."
38
68
  }
39
69
  },
40
70
  "additionalProperties": false
@@ -50,7 +80,22 @@
50
80
  "to": { "type": "string" },
51
81
  "kind": {
52
82
  "type": "string",
53
- "description": "Reference edge kind from literal or path-oriented extraction (e.g. 'relative-string-reference', 'repo-path-reference')."
83
+ "description": "Reference edge kind from literal or path-oriented extraction (e.g. 'relative-string-reference', 'repo-path-reference', 'test-source-link', 'workspace-package-link' from package or workspace manifests, 'typescript-project-reference-link' from TypeScript project references, 'go-workspace-module-link' from Go workspace use directives, 'cargo-workspace-member-link' from Cargo workspace members, 'maven-module-link' from Maven reactor modules, 'analyzer-ownership-root-link' from external analyzer ownership hints)."
84
+ },
85
+ "direction": {
86
+ "type": "string",
87
+ "enum": ["directed", "undirected"],
88
+ "description": "Whether the edge should be interpreted as directional."
89
+ },
90
+ "confidence": {
91
+ "type": "number",
92
+ "minimum": 0,
93
+ "maximum": 1,
94
+ "description": "Extractor confidence for graph-informed planning."
95
+ },
96
+ "reason": {
97
+ "type": "string",
98
+ "description": "Short explanation of why the edge exists."
54
99
  }
55
100
  },
56
101
  "additionalProperties": false