auditor-lambda 0.1.0 → 0.2.2

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 (87) hide show
  1. package/README.md +2 -1
  2. package/audit-code-wrapper-lib.mjs +205 -187
  3. package/dist/adapters/eslint.js +4 -2
  4. package/dist/adapters/npmAudit.js +1 -1
  5. package/dist/cli.js +296 -12
  6. package/dist/coverage.d.ts +0 -1
  7. package/dist/coverage.js +3 -34
  8. package/dist/extractors/bucketing.js +14 -35
  9. package/dist/extractors/disposition.js +8 -9
  10. package/dist/extractors/flows.js +14 -23
  11. package/dist/extractors/pathPatterns.d.ts +19 -0
  12. package/dist/extractors/pathPatterns.js +87 -0
  13. package/dist/extractors/surfaces.js +2 -7
  14. package/dist/io/artifacts.d.ts +23 -1
  15. package/dist/io/artifacts.js +3 -1
  16. package/dist/io/runArtifacts.js +1 -1
  17. package/dist/orchestrator/advance.js +1 -1
  18. package/dist/orchestrator/flowPlanning.d.ts +1 -1
  19. package/dist/orchestrator/flowPlanning.js +21 -28
  20. package/dist/orchestrator/internalExecutors.js +4 -7
  21. package/dist/orchestrator/planning.js +12 -20
  22. package/dist/orchestrator/resultIngestion.js +3 -2
  23. package/dist/orchestrator/runtimeValidation.js +5 -0
  24. package/dist/orchestrator/syntaxResolutionExecutor.js +10 -2
  25. package/dist/orchestrator/taskBuilder.d.ts +7 -2
  26. package/dist/orchestrator/taskBuilder.js +47 -52
  27. package/dist/prompts/renderWorkerPrompt.js +33 -0
  28. package/dist/providers/claudeCodeProvider.js +5 -0
  29. package/dist/providers/constants.d.ts +1 -0
  30. package/dist/providers/constants.js +1 -0
  31. package/dist/providers/index.js +9 -2
  32. package/dist/providers/spawnLoggedCommand.js +4 -0
  33. package/dist/reporting/mergeFindings.js +0 -7
  34. package/dist/reporting/rootCause.d.ts +0 -1
  35. package/dist/reporting/rootCause.js +0 -6
  36. package/dist/reporting/synthesis.js +18 -0
  37. package/dist/supervisor/operatorHandoff.d.ts +2 -0
  38. package/dist/supervisor/operatorHandoff.js +21 -9
  39. package/dist/supervisor/runLedger.js +6 -3
  40. package/dist/supervisor/sessionConfig.js +1 -0
  41. package/dist/types/flowCoverage.d.ts +1 -1
  42. package/dist/types/runLedger.d.ts +1 -1
  43. package/dist/types/runtimeValidation.d.ts +2 -1
  44. package/dist/types/sessionConfig.d.ts +2 -0
  45. package/dist/types/surfaces.d.ts +2 -1
  46. package/dist/types/workerSession.d.ts +4 -0
  47. package/dist/types.d.ts +0 -2
  48. package/dist/validation/auditResults.d.ts +11 -0
  49. package/dist/validation/auditResults.js +118 -0
  50. package/docs/agent-integrations.md +61 -56
  51. package/docs/agent-roles.md +69 -69
  52. package/docs/architecture.md +90 -90
  53. package/docs/artifacts.md +69 -69
  54. package/docs/bootstrap-install.md +1 -1
  55. package/docs/model-selection.md +86 -86
  56. package/docs/next-steps.md +11 -9
  57. package/docs/packaging.md +3 -3
  58. package/docs/pipeline.md +152 -152
  59. package/docs/production-readiness.md +6 -5
  60. package/docs/repo-layout.md +18 -18
  61. package/docs/run-flow.md +5 -5
  62. package/docs/session-config.md +216 -210
  63. package/docs/supervisor.md +70 -70
  64. package/docs/windows-setup.md +139 -139
  65. package/package.json +56 -56
  66. package/schemas/audit-code-v1alpha1.schema.json +80 -76
  67. package/schemas/audit_result.schema.json +54 -48
  68. package/schemas/audit_state.schema.json +2 -2
  69. package/schemas/audit_task.schema.json +60 -49
  70. package/schemas/blind_spot_register.schema.json +13 -3
  71. package/schemas/coverage_matrix.schema.json +14 -17
  72. package/schemas/critical_flows.schema.json +6 -3
  73. package/schemas/external_analyzer_results.schema.json +10 -4
  74. package/schemas/file_disposition.schema.json +33 -33
  75. package/schemas/finding.schema.json +86 -62
  76. package/schemas/flow_coverage.schema.json +53 -44
  77. package/schemas/graph_bundle.schema.json +12 -6
  78. package/schemas/merged_findings.schema.json +7 -2
  79. package/schemas/risk_register.schema.json +5 -1
  80. package/schemas/root_cause_clusters.schema.json +2 -5
  81. package/schemas/runtime_validation_report.schema.json +34 -34
  82. package/schemas/runtime_validation_tasks.schema.json +4 -1
  83. package/schemas/surface_manifest.schema.json +4 -1
  84. package/schemas/synthesis_report.schema.json +61 -61
  85. package/schemas/unit_manifest.schema.json +10 -3
  86. package/skills/audit-code/SKILL.md +37 -37
  87. package/skills/audit-code/audit-code.prompt.md +54 -54
@@ -16,11 +16,8 @@
16
16
  "summary": { "type": "string" },
17
17
  "finding_ids": {
18
18
  "type": "array",
19
- "items": { "type": "string" }
20
- },
21
- "recommended_actions": {
22
- "type": "array",
23
- "items": { "type": "string" }
19
+ "items": { "type": "string" },
20
+ "minItems": 1
24
21
  }
25
22
  },
26
23
  "additionalProperties": true
@@ -1,34 +1,34 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "runtime_validation_report.schema.json",
4
- "title": "Runtime Validation Report",
5
- "type": "object",
6
- "required": ["results"],
7
- "properties": {
8
- "results": {
9
- "type": "array",
10
- "items": {
11
- "type": "object",
12
- "required": ["task_id", "status", "summary"],
13
- "properties": {
14
- "task_id": { "type": "string" },
15
- "status": {
16
- "type": "string",
17
- "enum": ["pending", "confirmed", "not_confirmed", "inconclusive"]
18
- },
19
- "summary": { "type": "string" },
20
- "evidence": {
21
- "type": "array",
22
- "items": { "type": "string" }
23
- },
24
- "notes": {
25
- "type": "array",
26
- "items": { "type": "string" }
27
- }
28
- },
29
- "additionalProperties": true
30
- }
31
- }
32
- },
33
- "additionalProperties": true
34
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "runtime_validation_report.schema.json",
4
+ "title": "Runtime Validation Report",
5
+ "type": "object",
6
+ "required": ["results"],
7
+ "properties": {
8
+ "results": {
9
+ "type": "array",
10
+ "items": {
11
+ "type": "object",
12
+ "required": ["task_id", "status", "summary"],
13
+ "properties": {
14
+ "task_id": { "type": "string" },
15
+ "status": {
16
+ "type": "string",
17
+ "enum": ["pending", "confirmed", "not_confirmed", "inconclusive"]
18
+ },
19
+ "summary": { "type": "string" },
20
+ "evidence": {
21
+ "type": "array",
22
+ "items": { "type": "string" }
23
+ },
24
+ "notes": {
25
+ "type": "array",
26
+ "items": { "type": "string" }
27
+ }
28
+ },
29
+ "additionalProperties": true
30
+ }
31
+ }
32
+ },
33
+ "additionalProperties": true
34
+ }
@@ -12,7 +12,10 @@
12
12
  "required": ["id", "kind", "target_paths", "reason", "priority"],
13
13
  "properties": {
14
14
  "id": { "type": "string" },
15
- "kind": { "type": "string" },
15
+ "kind": {
16
+ "type": "string",
17
+ "enum": ["unit-risk-check", "critical-flow-check"]
18
+ },
16
19
  "target_paths": {
17
20
  "type": "array",
18
21
  "items": { "type": "string" }
@@ -12,7 +12,10 @@
12
12
  "required": ["id", "kind", "entrypoint"],
13
13
  "properties": {
14
14
  "id": { "type": "string" },
15
- "kind": { "type": "string" },
15
+ "kind": {
16
+ "type": "string",
17
+ "enum": ["interface", "background"]
18
+ },
16
19
  "entrypoint": { "type": "string" },
17
20
  "exposure": { "type": "string" },
18
21
  "methods": {
@@ -1,61 +1,61 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "synthesis_report.schema.json",
4
- "title": "Synthesis Report",
5
- "type": "object",
6
- "required": ["summary", "merged_findings", "root_cause_clusters"],
7
- "properties": {
8
- "summary": {
9
- "type": "object",
10
- "required": [
11
- "finding_count",
12
- "cluster_count",
13
- "runtime_validation_status_breakdown"
14
- ],
15
- "properties": {
16
- "finding_count": { "type": "integer" },
17
- "cluster_count": { "type": "integer" },
18
- "runtime_validation_status_breakdown": {
19
- "type": "object",
20
- "additionalProperties": { "type": "integer" }
21
- },
22
- "notes": {
23
- "type": "array",
24
- "items": { "type": "string" }
25
- }
26
- },
27
- "additionalProperties": true
28
- },
29
- "merged_findings": {
30
- "type": "array",
31
- "items": { "$ref": "finding.schema.json" }
32
- },
33
- "root_cause_clusters": {
34
- "type": "array",
35
- "items": {
36
- "$ref": "root_cause_clusters.schema.json#/$defs/cluster"
37
- }
38
- }
39
- },
40
- "$defs": {
41
- "cluster": {
42
- "type": "object",
43
- "required": ["id", "title", "finding_ids"],
44
- "properties": {
45
- "id": { "type": "string" },
46
- "title": { "type": "string" },
47
- "summary": { "type": "string" },
48
- "finding_ids": {
49
- "type": "array",
50
- "items": { "type": "string" }
51
- },
52
- "recommended_actions": {
53
- "type": "array",
54
- "items": { "type": "string" }
55
- }
56
- },
57
- "additionalProperties": true
58
- }
59
- },
60
- "additionalProperties": true
61
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "synthesis_report.schema.json",
4
+ "title": "Synthesis Report",
5
+ "type": "object",
6
+ "required": ["summary", "merged_findings", "root_cause_clusters"],
7
+ "properties": {
8
+ "summary": {
9
+ "type": "object",
10
+ "required": [
11
+ "finding_count",
12
+ "cluster_count",
13
+ "runtime_validation_status_breakdown"
14
+ ],
15
+ "properties": {
16
+ "finding_count": { "type": "integer" },
17
+ "cluster_count": { "type": "integer" },
18
+ "runtime_validation_status_breakdown": {
19
+ "type": "object",
20
+ "additionalProperties": { "type": "integer" }
21
+ },
22
+ "notes": {
23
+ "type": "array",
24
+ "items": { "type": "string" }
25
+ }
26
+ },
27
+ "additionalProperties": true
28
+ },
29
+ "merged_findings": {
30
+ "type": "array",
31
+ "items": { "$ref": "finding.schema.json" }
32
+ },
33
+ "root_cause_clusters": {
34
+ "type": "array",
35
+ "items": {
36
+ "$ref": "#/$defs/cluster"
37
+ }
38
+ }
39
+ },
40
+ "$defs": {
41
+ "cluster": {
42
+ "type": "object",
43
+ "required": ["id", "title", "finding_ids"],
44
+ "properties": {
45
+ "id": { "type": "string" },
46
+ "title": { "type": "string" },
47
+ "summary": { "type": "string" },
48
+ "finding_ids": {
49
+ "type": "array",
50
+ "items": { "type": "string" }
51
+ },
52
+ "recommended_actions": {
53
+ "type": "array",
54
+ "items": { "type": "string" }
55
+ }
56
+ },
57
+ "additionalProperties": true
58
+ }
59
+ },
60
+ "additionalProperties": true
61
+ }
@@ -16,12 +16,19 @@
16
16
  "kind": { "type": "string" },
17
17
  "files": {
18
18
  "type": "array",
19
- "items": { "type": "string" }
19
+ "items": { "type": "string" },
20
+ "minItems": 1
21
+ },
22
+ "risk_score": {
23
+ "type": "number",
24
+ "minimum": 0
20
25
  },
21
- "risk_score": { "type": "number" },
22
26
  "required_lenses": {
23
27
  "type": "array",
24
- "items": { "type": "string" }
28
+ "items": {
29
+ "type": "string",
30
+ "enum": ["correctness", "architecture", "maintainability", "security", "reliability", "performance", "data_integrity", "tests", "operability", "config_deployment"]
31
+ }
25
32
  },
26
33
  "critical_flows": {
27
34
  "type": "array",
@@ -4,51 +4,51 @@ description: Conversation-first autonomous code auditing workflow for the /audit
4
4
  ---
5
5
 
6
6
  # audit-code skill
7
-
8
- The canonical entrypoint is `/audit-code` in conversation.
9
-
10
- This skill should be treated as a conversational product surface first.
11
-
12
- ## Primary contract
13
-
7
+
8
+ The canonical entrypoint is `/audit-code` in conversation.
9
+
10
+ This skill should be treated as a conversational product surface first.
11
+
12
+ ## Primary contract
13
+
14
14
  Normal usage should:
15
15
 
16
16
  - run from conversation, not from manual shell arguments
17
17
  - avoid manual paths, provider flags, and model-selection arguments
18
18
  - advance the audit automatically until it completes or no further automatic progress is possible
19
-
20
- Bounded steps are a backend implementation detail, not the intended user experience.
21
-
22
- ## Embedded Prompt Payload
23
-
24
- For IDE-based LLMs (Antigravity, Copilot, Cursor), you can initialize the skill natively by importing the prompt payload defined in `audit-code.prompt.md`.
25
- This provides the LLM an exact instruction set required to natively intercept the state machine blocking phases securely and assume the responsibilities of the execution "worker".
26
-
27
- ## Repo-local fallback
28
-
29
- The repository still exposes a backend CLI wrapper:
30
-
31
- ```bash
32
- audit-code
33
- ```
34
-
35
- from the target repository root.
36
-
37
- Debug one-step mode:
38
-
39
- ```bash
40
- audit-code --single-step
41
- ```
42
-
43
- ## Backend mode note
44
-
19
+
20
+ Bounded steps are a backend implementation detail, not the intended user experience.
21
+
22
+ ## Embedded Prompt Payload
23
+
24
+ For IDE-based LLMs (Antigravity, Copilot, Cursor), you can initialize the skill natively by importing the prompt payload defined in `audit-code.prompt.md`.
25
+ This provides the LLM an exact instruction set required to natively intercept the state machine blocking phases securely and assume the responsibilities of the execution "worker".
26
+
27
+ ## Repo-local fallback
28
+
29
+ The repository still exposes a backend CLI wrapper:
30
+
31
+ ```bash
32
+ audit-code
33
+ ```
34
+
35
+ from the target repository root.
36
+
37
+ Debug one-step mode:
38
+
39
+ ```bash
40
+ audit-code --single-step
41
+ ```
42
+
43
+ ## Backend mode note
44
+
45
45
  For repo-local backend usage:
46
46
 
47
47
  - omitted provider remains `local-subprocess`
48
48
  - `local-subprocess` should stop cleanly once only manual or provider-assisted review remains
49
49
  - `provider: "auto"` is the explicit opt-in best-effort routing mode
50
50
  - explicit provider names remain available when an operator wants a specific backend
51
-
52
- ## Development rule
53
-
54
- Prefer the skill-first conversational contract over the CLI-first backend shape.
51
+
52
+ ## Development rule
53
+
54
+ Prefer the skill-first conversational contract over the CLI-first backend shape.
@@ -1,17 +1,17 @@
1
- ---
2
- name: Code Auditing Skill
3
- command: /audit-code
4
- description: Autonomous local loop code auditing
5
- ---
6
-
7
- # `/audit-code` Execution Directive
8
-
9
- **SYSTEM DIRECTIVE:** When the user enters `/audit-code` in the chat, you are to assume the role of an autonomous code auditor. You are no longer just a conversational assistant; you must use your local terminal and file-editing tools to act as the "LLM Thinking Worker" for the `auditor-lambda` framework.
10
-
11
- Follow this execution loop rigidly:
12
-
13
- ## Step 1: Step the Orchestrator
14
-
1
+ ---
2
+ name: Code Auditing Skill
3
+ command: /audit-code
4
+ description: Autonomous local loop code auditing
5
+ ---
6
+
7
+ # `/audit-code` Execution Directive
8
+
9
+ **SYSTEM DIRECTIVE:** When the user enters `/audit-code` in the chat, you are to assume the role of an autonomous code auditor. You are no longer just a conversational assistant; you must use your local terminal and file-editing tools to act as the "LLM Thinking Worker" for the `auditor-lambda` framework.
10
+
11
+ Follow this execution loop rigidly:
12
+
13
+ ## Step 1: Step the Orchestrator
14
+
15
15
  To move the state machine forward, execute the backend framework using your terminal tool:
16
16
 
17
17
  ```bash
@@ -19,48 +19,48 @@ audit-code
19
19
  ```
20
20
 
21
21
  _(If the wrapper is only available as a package dependency in the current repository, `npx audit-code` is equivalent. If developing locally against this repository, run `node audit-code.mjs`.)_
22
-
23
- ## Step 2: Handle Blockages (The "Thinking" Phase)
24
-
25
- Read the JSON output from the terminal.
26
- If the top-level status is `"blocked"`, it means the orchestrator needs your LLM "thinking" capabilities to evaluate code logic.
27
-
28
- To determine what task you have been assigned, use your file-reading tool to inspect:
29
-
30
- - `.audit-artifacts/dispatch/current-task.json`
31
- - `.audit-artifacts/dispatch/current-prompt.md`
32
-
33
- ## Step 3: Audit the Code natively
34
-
35
- 1. Read the specific goals and coverage rules laid out in `current-prompt.md`.
36
- 2. Use your file-reading tool to examine the specific source code files mentioned.
37
- 3. Critically analyze the codebase. Use your deepest reasoning capabilities (e.g., chain of thought) to discover defects, logic errors, or systemic architectural issues requested in the prompt.
38
-
39
- ## Step 4: Write the Findings
40
-
41
- Produce your findings array matching exactly the `AuditResult` JSON schema described in the prompt.
42
- Do not use `echo` or generic terminal shell strings for large JSON structures to avoid breaking JSON escaping. Instead, use your raw **File Edit Tool** to reliably save your results entirely to:
43
- `.audit-artifacts/worker_results_pending.json`
44
-
45
- ## Step 5: Feed the Loop
46
-
22
+
23
+ ## Step 2: Handle Blockages (The "Thinking" Phase)
24
+
25
+ Read the JSON output from the terminal.
26
+ If the top-level status is `"blocked"`, it means the orchestrator needs your LLM "thinking" capabilities to evaluate code logic.
27
+
28
+ To determine what task you have been assigned, use your file-reading tool to inspect:
29
+
30
+ - `.audit-artifacts/dispatch/current-task.json`
31
+ - `.audit-artifacts/dispatch/current-prompt.md`
32
+
33
+ ## Step 3: Audit the Code natively
34
+
35
+ 1. Read the specific goals and coverage rules laid out in `current-prompt.md`.
36
+ 2. Use your file-reading tool to examine the specific source code files mentioned.
37
+ 3. Critically analyze the codebase. Use your deepest reasoning capabilities (e.g., chain of thought) to discover defects, logic errors, or systemic architectural issues requested in the prompt.
38
+
39
+ ## Step 4: Write the Findings
40
+
41
+ Produce your findings array matching exactly the `AuditResult` JSON schema described in the prompt.
42
+ Do not use `echo` or generic terminal shell strings for large JSON structures to avoid breaking JSON escaping. Instead, use your raw **File Edit Tool** to reliably save your results entirely to:
43
+ `.audit-artifacts/worker_results_pending.json`
44
+
45
+ ## Step 5: Feed the Loop
46
+
47
47
  Return your results to the state machine by running the ingestion command in the terminal:
48
48
 
49
49
  ```bash
50
50
  audit-code --results .audit-artifacts/worker_results_pending.json
51
51
  ```
52
-
53
- ## Step 6: Loop or Terminate
54
-
55
- Continue repeating Steps 1 through 5 as necessary. The state machine will iterate through structuring, planning, and tasking.
56
-
57
- **You must stop the loop when the terminal output has `"status": "complete"`.**
58
-
59
- ## Step 7: Presentation
60
-
61
- Once the audit is officially complete, DO NOT run the orchestrator again.
62
- Instead, use your file reading tool to consume:
63
-
64
- - `.audit-artifacts/synthesis_report.json`
65
-
66
- Finally, read these synthesis findings and present them back to the user in a polished, highly readable **Markdown Summary Table** directly in the chat panel. Wait for the user to ask you to begin resolving or patching the root_cause_clusters you discovered.
52
+
53
+ ## Step 6: Loop or Terminate
54
+
55
+ Continue repeating Steps 1 through 5 as necessary. The state machine will iterate through structuring, planning, and tasking.
56
+
57
+ **You must stop the loop when the terminal output has `"status": "complete"`.**
58
+
59
+ ## Step 7: Presentation
60
+
61
+ Once the audit is officially complete, DO NOT run the orchestrator again.
62
+ Instead, use your file reading tool to consume:
63
+
64
+ - `.audit-artifacts/synthesis_report.json`
65
+
66
+ Finally, read these synthesis findings and present them back to the user in a polished, highly readable **Markdown Summary Table** directly in the chat panel. Wait for the user to ask you to begin resolving or patching the root_cause_clusters you discovered.