audit-tools 0.45.0 → 0.46.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 (227) hide show
  1. package/README.md +15 -2
  2. package/dist/audit/cli/charterExtractionPrompt.d.ts.map +1 -1
  3. package/dist/audit/cli/charterExtractionPrompt.js +11 -1
  4. package/dist/audit/cli/charterExtractionPrompt.js.map +1 -1
  5. package/dist/audit/cli/cleanupCommand.d.ts +25 -0
  6. package/dist/audit/cli/cleanupCommand.d.ts.map +1 -1
  7. package/dist/audit/cli/cleanupCommand.js +69 -0
  8. package/dist/audit/cli/cleanupCommand.js.map +1 -1
  9. package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
  10. package/dist/audit/cli/dispatch/hostHandoff.js +52 -76
  11. package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
  12. package/dist/audit/cli/dispatch/packetFilter.d.ts +1 -1
  13. package/dist/audit/cli/fanoutLanes.d.ts.map +1 -1
  14. package/dist/audit/cli/fanoutLanes.js +6 -1
  15. package/dist/audit/cli/fanoutLanes.js.map +1 -1
  16. package/dist/audit/cli/laneSubmissions.d.ts +13 -0
  17. package/dist/audit/cli/laneSubmissions.d.ts.map +1 -1
  18. package/dist/audit/cli/laneSubmissions.js +38 -27
  19. package/dist/audit/cli/laneSubmissions.js.map +1 -1
  20. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
  21. package/dist/audit/cli/nextStepCommand.js +8 -6
  22. package/dist/audit/cli/nextStepCommand.js.map +1 -1
  23. package/dist/audit/cli/nextStepHelpers.d.ts +3 -2
  24. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  25. package/dist/audit/cli/nextStepHelpers.js +37 -35
  26. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  27. package/dist/audit/cli/reviewRun.d.ts +1 -1
  28. package/dist/audit/cli/reviewRun.d.ts.map +1 -1
  29. package/dist/audit/cli/reviewRun.js +2 -9
  30. package/dist/audit/cli/reviewRun.js.map +1 -1
  31. package/dist/audit/cli/sampleRunCommand.d.ts.map +1 -1
  32. package/dist/audit/cli/sampleRunCommand.js +12 -1
  33. package/dist/audit/cli/sampleRunCommand.js.map +1 -1
  34. package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
  35. package/dist/audit/cli/semanticReviewStep.js +9 -1
  36. package/dist/audit/cli/semanticReviewStep.js.map +1 -1
  37. package/dist/audit/cli/steps.d.ts +6 -6
  38. package/dist/audit/contracts/workerSchemas.d.ts +36 -26
  39. package/dist/audit/contracts/workerSchemas.d.ts.map +1 -1
  40. package/dist/audit/contracts/workerSchemas.js +11 -1
  41. package/dist/audit/contracts/workerSchemas.js.map +1 -1
  42. package/dist/audit/contracts/wrapperResponse.d.ts +52 -28
  43. package/dist/audit/contracts/wrapperResponse.d.ts.map +1 -1
  44. package/dist/audit/contracts/wrapperResponse.js +8 -5
  45. package/dist/audit/contracts/wrapperResponse.js.map +1 -1
  46. package/dist/audit/decompose/sources.d.ts.map +1 -1
  47. package/dist/audit/decompose/sources.js +21 -5
  48. package/dist/audit/decompose/sources.js.map +1 -1
  49. package/dist/audit/extractors/analyzers/registry.d.ts +8 -5
  50. package/dist/audit/extractors/analyzers/registry.d.ts.map +1 -1
  51. package/dist/audit/extractors/analyzers/registry.js +28 -7
  52. package/dist/audit/extractors/analyzers/registry.js.map +1 -1
  53. package/dist/audit/extractors/designAssessment.js +1 -1
  54. package/dist/audit/extractors/gitHistory.d.ts +1 -1
  55. package/dist/audit/extractors/gitHistory.js +1 -1
  56. package/dist/audit/extractors/graph.d.ts +1 -1
  57. package/dist/audit/extractors/graph.js +1 -1
  58. package/dist/audit/extractors/risk.d.ts +1 -1
  59. package/dist/audit/extractors/risk.js +1 -1
  60. package/dist/audit/io/artifacts.d.ts.map +1 -1
  61. package/dist/audit/io/artifacts.js +5 -5
  62. package/dist/audit/io/artifacts.js.map +1 -1
  63. package/dist/audit/orchestrator/acquisitionExecutor.d.ts +11 -6
  64. package/dist/audit/orchestrator/acquisitionExecutor.d.ts.map +1 -1
  65. package/dist/audit/orchestrator/acquisitionExecutor.js +1 -1
  66. package/dist/audit/orchestrator/acquisitionExecutor.js.map +1 -1
  67. package/dist/audit/orchestrator/advance.d.ts +14 -10
  68. package/dist/audit/orchestrator/advance.d.ts.map +1 -1
  69. package/dist/audit/orchestrator/advance.js +49 -24
  70. package/dist/audit/orchestrator/advance.js.map +1 -1
  71. package/dist/audit/orchestrator/advanceTypes.d.ts +14 -0
  72. package/dist/audit/orchestrator/advanceTypes.d.ts.map +1 -1
  73. package/dist/audit/orchestrator/autoFixExecutor.d.ts +20 -1
  74. package/dist/audit/orchestrator/autoFixExecutor.d.ts.map +1 -1
  75. package/dist/audit/orchestrator/autoFixExecutor.js +77 -15
  76. package/dist/audit/orchestrator/autoFixExecutor.js.map +1 -1
  77. package/dist/audit/orchestrator/dependencyMap.js +1 -1
  78. package/dist/audit/orchestrator/dependencyMap.js.map +1 -1
  79. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  80. package/dist/audit/orchestrator/executorRunners.js +18 -4
  81. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  82. package/dist/audit/orchestrator/executors.d.ts +54 -0
  83. package/dist/audit/orchestrator/executors.d.ts.map +1 -1
  84. package/dist/audit/orchestrator/executors.js +352 -0
  85. package/dist/audit/orchestrator/executors.js.map +1 -1
  86. package/dist/audit/orchestrator/hostInputPause.d.ts +20 -11
  87. package/dist/audit/orchestrator/hostInputPause.d.ts.map +1 -1
  88. package/dist/audit/orchestrator/hostInputPause.js +17 -11
  89. package/dist/audit/orchestrator/hostInputPause.js.map +1 -1
  90. package/dist/audit/orchestrator/localCommands.d.ts +24 -1
  91. package/dist/audit/orchestrator/localCommands.d.ts.map +1 -1
  92. package/dist/audit/orchestrator/localCommands.js +44 -9
  93. package/dist/audit/orchestrator/localCommands.js.map +1 -1
  94. package/dist/audit/orchestrator/nextStep.d.ts +13 -0
  95. package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
  96. package/dist/audit/orchestrator/nextStep.js +13 -0
  97. package/dist/audit/orchestrator/nextStep.js.map +1 -1
  98. package/dist/audit/orchestrator/requeueCommand.d.ts +1 -1
  99. package/dist/audit/orchestrator/runtimeCommand.d.ts +32 -1
  100. package/dist/audit/orchestrator/runtimeCommand.d.ts.map +1 -1
  101. package/dist/audit/orchestrator/runtimeCommand.js +90 -3
  102. package/dist/audit/orchestrator/runtimeCommand.js.map +1 -1
  103. package/dist/audit/orchestrator/structureExecutors.js +1 -1
  104. package/dist/audit/orchestrator/structureExecutors.js.map +1 -1
  105. package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts +11 -1
  106. package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts.map +1 -1
  107. package/dist/audit/orchestrator/syntaxResolutionExecutor.js +25 -9
  108. package/dist/audit/orchestrator/syntaxResolutionExecutor.js.map +1 -1
  109. package/dist/audit/supervisor/operatorHandoff.d.ts +0 -1
  110. package/dist/audit/supervisor/operatorHandoff.d.ts.map +1 -1
  111. package/dist/audit/supervisor/operatorHandoff.js +2 -1
  112. package/dist/audit/supervisor/operatorHandoff.js.map +1 -1
  113. package/dist/audit/types.d.ts +18 -18
  114. package/dist/remediate/contractPipeline/derive.d.ts.map +1 -1
  115. package/dist/remediate/contractPipeline/derive.js +1 -0
  116. package/dist/remediate/contractPipeline/derive.js.map +1 -1
  117. package/dist/remediate/contractPipeline/semanticProjection.d.ts +5 -4
  118. package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +1 -1
  119. package/dist/remediate/contractPipeline/semanticProjection.js +34 -19
  120. package/dist/remediate/contractPipeline/semanticProjection.js.map +1 -1
  121. package/dist/remediate/index.d.ts.map +1 -1
  122. package/dist/remediate/index.js +3 -2
  123. package/dist/remediate/index.js.map +1 -1
  124. package/dist/remediate/phases/close.d.ts +37 -2
  125. package/dist/remediate/phases/close.d.ts.map +1 -1
  126. package/dist/remediate/phases/close.js +100 -31
  127. package/dist/remediate/phases/close.js.map +1 -1
  128. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js +2 -2
  129. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js.map +1 -1
  130. package/dist/remediate/phases/triage.d.ts.map +1 -1
  131. package/dist/remediate/phases/triage.js +61 -19
  132. package/dist/remediate/phases/triage.js.map +1 -1
  133. package/dist/remediate/steps/contractPipeline.d.ts +13 -0
  134. package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
  135. package/dist/remediate/steps/contractPipeline.js +82 -3
  136. package/dist/remediate/steps/contractPipeline.js.map +1 -1
  137. package/dist/remediate/steps/dispatch/hostHandoff.d.ts +1 -1
  138. package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
  139. package/dist/remediate/steps/dispatch/hostHandoff.js +297 -139
  140. package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
  141. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  142. package/dist/remediate/steps/nextStep.js +37 -7
  143. package/dist/remediate/steps/nextStep.js.map +1 -1
  144. package/dist/remediate/types/options.d.ts +1 -1
  145. package/dist/shared/analyzers/acquisitionEngine.d.ts +61 -28
  146. package/dist/shared/analyzers/acquisitionEngine.d.ts.map +1 -1
  147. package/dist/shared/analyzers/acquisitionEngine.js +83 -24
  148. package/dist/shared/analyzers/acquisitionEngine.js.map +1 -1
  149. package/dist/shared/analyzers/binaryAcquisition.d.ts +8 -2
  150. package/dist/shared/analyzers/binaryAcquisition.d.ts.map +1 -1
  151. package/dist/shared/analyzers/binaryAcquisition.js +4 -4
  152. package/dist/shared/analyzers/binaryAcquisition.js.map +1 -1
  153. package/dist/shared/constitutionalDocPaths.d.ts.map +1 -1
  154. package/dist/shared/constitutionalDocPaths.js +7 -0
  155. package/dist/shared/constitutionalDocPaths.js.map +1 -1
  156. package/dist/shared/engine/obligationEngine.d.ts +44 -3
  157. package/dist/shared/engine/obligationEngine.d.ts.map +1 -1
  158. package/dist/shared/engine/obligationEngine.js +53 -7
  159. package/dist/shared/engine/obligationEngine.js.map +1 -1
  160. package/dist/shared/findings/dedupe.d.ts.map +1 -1
  161. package/dist/shared/findings/dedupe.js +8 -0
  162. package/dist/shared/findings/dedupe.js.map +1 -1
  163. package/dist/shared/friction/frictionRecord.d.ts +42 -2
  164. package/dist/shared/friction/frictionRecord.d.ts.map +1 -1
  165. package/dist/shared/friction/frictionRecord.js +111 -3
  166. package/dist/shared/friction/frictionRecord.js.map +1 -1
  167. package/dist/shared/friction/triage.d.ts +15 -0
  168. package/dist/shared/friction/triage.d.ts.map +1 -1
  169. package/dist/shared/friction/triage.js +33 -2
  170. package/dist/shared/friction/triage.js.map +1 -1
  171. package/dist/shared/index.d.ts +13 -9
  172. package/dist/shared/index.d.ts.map +1 -1
  173. package/dist/shared/index.js +14 -7
  174. package/dist/shared/index.js.map +1 -1
  175. package/dist/shared/io/fileLock.d.ts.map +1 -1
  176. package/dist/shared/io/fileLock.js +22 -3
  177. package/dist/shared/io/fileLock.js.map +1 -1
  178. package/dist/shared/io/frictionCapture.d.ts +73 -19
  179. package/dist/shared/io/frictionCapture.d.ts.map +1 -1
  180. package/dist/shared/io/frictionCapture.js +21 -30
  181. package/dist/shared/io/frictionCapture.js.map +1 -1
  182. package/dist/shared/io/lockedJsonStore.d.ts +24 -3
  183. package/dist/shared/io/lockedJsonStore.d.ts.map +1 -1
  184. package/dist/shared/io/lockedJsonStore.js +35 -7
  185. package/dist/shared/io/lockedJsonStore.js.map +1 -1
  186. package/dist/shared/io/stepContractWriter.d.ts +3 -3
  187. package/dist/shared/io/stepContractWriter.d.ts.map +1 -1
  188. package/dist/shared/io/stepContractWriter.js +97 -13
  189. package/dist/shared/io/stepContractWriter.js.map +1 -1
  190. package/dist/shared/submission/expectedSubmissions.d.ts +18 -0
  191. package/dist/shared/submission/expectedSubmissions.d.ts.map +1 -1
  192. package/dist/shared/submission/expectedSubmissions.js +17 -0
  193. package/dist/shared/submission/expectedSubmissions.js.map +1 -1
  194. package/dist/shared/submission/handRecovery.d.ts.map +1 -1
  195. package/dist/shared/submission/handRecovery.js +9 -11
  196. package/dist/shared/submission/handRecovery.js.map +1 -1
  197. package/dist/shared/submission/hostHandoffCore.d.ts +155 -0
  198. package/dist/shared/submission/hostHandoffCore.d.ts.map +1 -0
  199. package/dist/shared/submission/hostHandoffCore.js +210 -0
  200. package/dist/shared/submission/hostHandoffCore.js.map +1 -0
  201. package/dist/shared/submission/submissionLedger.d.ts +5 -1
  202. package/dist/shared/submission/submissionLedger.d.ts.map +1 -1
  203. package/dist/shared/submission/submissionLedger.js +33 -3
  204. package/dist/shared/submission/submissionLedger.js.map +1 -1
  205. package/dist/shared/tooling/commandShape.d.ts +29 -0
  206. package/dist/shared/tooling/commandShape.d.ts.map +1 -1
  207. package/dist/shared/tooling/commandShape.js +82 -10
  208. package/dist/shared/tooling/commandShape.js.map +1 -1
  209. package/dist/shared/tooling/exec.d.ts +32 -0
  210. package/dist/shared/tooling/exec.d.ts.map +1 -1
  211. package/dist/shared/tooling/exec.js +189 -0
  212. package/dist/shared/tooling/exec.js.map +1 -1
  213. package/docs/audit-pkg/contracts.md +2 -1
  214. package/docs/audit-pkg/operator-guide.md +5 -2
  215. package/docs/audit-pkg/product.md +22 -6
  216. package/package.json +10 -6
  217. package/schemas/audit-code-v1alpha1.schema.json +297 -0
  218. package/schemas/audit_result.schema.json +4 -0
  219. package/schemas/audit_results.schema.json +4 -0
  220. package/scripts/shared/install-host-assets.mjs +8 -5
  221. package/skills/audit-code/SKILL.md +4 -2
  222. package/skills/audit-code/audit-code.prompt.md +5 -2
  223. package/skills/audit-code/opencode-command-template.txt +1 -1
  224. package/wrapper/audit-code-wrapper-lib.mjs +81 -16
  225. package/wrapper/installer-verb-help.mjs +14 -4
  226. package/docs/audit-pkg/development.md +0 -113
  227. package/docs/audit-pkg/release.md +0 -140
@@ -0,0 +1,297 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "audit-code-v1alpha1.schema.json",
4
+ "title": "Audit Code Response",
5
+ "type": "object",
6
+ "properties": {
7
+ "contract_version": {
8
+ "type": "string",
9
+ "const": "audit-code/v1alpha1"
10
+ },
11
+ "audit_state": {
12
+ "type": "object",
13
+ "properties": {
14
+ "status": {
15
+ "type": "string",
16
+ "enum": [
17
+ "not_started",
18
+ "active",
19
+ "blocked",
20
+ "complete"
21
+ ]
22
+ },
23
+ "last_executor": {
24
+ "type": "string"
25
+ },
26
+ "last_obligation": {
27
+ "type": "string"
28
+ },
29
+ "blockers": {
30
+ "type": "array",
31
+ "items": {
32
+ "type": "string"
33
+ }
34
+ },
35
+ "obligations": {
36
+ "type": "array",
37
+ "items": {
38
+ "type": "object",
39
+ "properties": {
40
+ "id": {
41
+ "type": "string"
42
+ },
43
+ "state": {
44
+ "type": "string",
45
+ "enum": [
46
+ "missing",
47
+ "present",
48
+ "stale",
49
+ "blocked",
50
+ "satisfied"
51
+ ]
52
+ },
53
+ "reason": {
54
+ "type": "string"
55
+ }
56
+ },
57
+ "required": [
58
+ "id",
59
+ "state"
60
+ ],
61
+ "additionalProperties": false
62
+ }
63
+ }
64
+ },
65
+ "required": [
66
+ "status",
67
+ "obligations"
68
+ ],
69
+ "additionalProperties": false
70
+ },
71
+ "selected_obligation": {
72
+ "type": [
73
+ "string",
74
+ "null"
75
+ ]
76
+ },
77
+ "selected_executor": {
78
+ "type": [
79
+ "string",
80
+ "null"
81
+ ]
82
+ },
83
+ "progress_made": {
84
+ "type": "boolean"
85
+ },
86
+ "artifacts_written": {
87
+ "type": "array",
88
+ "items": {
89
+ "type": "string"
90
+ }
91
+ },
92
+ "progress_summary": {
93
+ "type": "string"
94
+ },
95
+ "next_likely_step": {
96
+ "type": [
97
+ "string",
98
+ "null"
99
+ ]
100
+ },
101
+ "handoff": {
102
+ "type": "object",
103
+ "properties": {
104
+ "status": {
105
+ "type": "string",
106
+ "enum": [
107
+ "not_started",
108
+ "active",
109
+ "blocked",
110
+ "complete"
111
+ ]
112
+ },
113
+ "repo_root": {
114
+ "type": "string"
115
+ },
116
+ "artifacts_dir": {
117
+ "type": "string"
118
+ },
119
+ "summary": {
120
+ "type": "string"
121
+ },
122
+ "pending_obligations": {
123
+ "type": "array",
124
+ "items": {
125
+ "type": "string"
126
+ }
127
+ },
128
+ "suggested_inputs": {
129
+ "type": "array",
130
+ "items": {
131
+ "type": "object",
132
+ "properties": {
133
+ "flag": {
134
+ "type": "string",
135
+ "enum": [
136
+ "--results",
137
+ "--batch-results",
138
+ "--updates",
139
+ "--external-analyzer-results"
140
+ ]
141
+ },
142
+ "suggested_path": {
143
+ "type": "string"
144
+ },
145
+ "description": {
146
+ "type": "string"
147
+ }
148
+ },
149
+ "required": [
150
+ "flag",
151
+ "suggested_path",
152
+ "description"
153
+ ],
154
+ "additionalProperties": false
155
+ }
156
+ },
157
+ "suggested_commands": {
158
+ "type": "array",
159
+ "items": {
160
+ "type": "string"
161
+ }
162
+ },
163
+ "active_review_run": {
164
+ "type": "object",
165
+ "properties": {
166
+ "contract_version": {
167
+ "type": "string",
168
+ "const": "audit-review-run/v1alpha1"
169
+ },
170
+ "run_id": {
171
+ "type": "string"
172
+ },
173
+ "review_run_path": {
174
+ "type": "string"
175
+ },
176
+ "pending_audit_tasks_path": {
177
+ "type": "string"
178
+ },
179
+ "host_workload_path": {
180
+ "type": "string"
181
+ },
182
+ "host_result_map_path": {
183
+ "type": "string"
184
+ }
185
+ },
186
+ "required": [
187
+ "contract_version",
188
+ "run_id",
189
+ "review_run_path",
190
+ "pending_audit_tasks_path",
191
+ "host_workload_path",
192
+ "host_result_map_path"
193
+ ],
194
+ "additionalProperties": false
195
+ },
196
+ "artifact_paths": {
197
+ "type": "object",
198
+ "properties": {
199
+ "operator_inputs_dir": {
200
+ "type": "string"
201
+ },
202
+ "operator_handoff_json": {
203
+ "type": "string"
204
+ },
205
+ "operator_handoff_markdown": {
206
+ "type": "string"
207
+ },
208
+ "session_config": {
209
+ "type": "string"
210
+ },
211
+ "run_ledger": {
212
+ "type": "string"
213
+ },
214
+ "current_review_run": {
215
+ "type": [
216
+ "string",
217
+ "null"
218
+ ]
219
+ },
220
+ "current_prompt": {
221
+ "type": [
222
+ "string",
223
+ "null"
224
+ ]
225
+ },
226
+ "current_tasks": {
227
+ "type": [
228
+ "string",
229
+ "null"
230
+ ]
231
+ },
232
+ "audit_tasks": {
233
+ "type": [
234
+ "string",
235
+ "null"
236
+ ]
237
+ },
238
+ "runtime_validation_tasks": {
239
+ "type": [
240
+ "string",
241
+ "null"
242
+ ]
243
+ },
244
+ "friction_record": {
245
+ "type": "string"
246
+ }
247
+ },
248
+ "required": [
249
+ "operator_inputs_dir",
250
+ "operator_handoff_json",
251
+ "operator_handoff_markdown",
252
+ "session_config",
253
+ "run_ledger",
254
+ "current_review_run",
255
+ "current_prompt",
256
+ "current_tasks",
257
+ "audit_tasks",
258
+ "runtime_validation_tasks",
259
+ "friction_record"
260
+ ],
261
+ "additionalProperties": false
262
+ },
263
+ "quick_start": {
264
+ "type": "string"
265
+ },
266
+ "file_map": {
267
+ "type": "object",
268
+ "additionalProperties": {
269
+ "type": "string"
270
+ }
271
+ }
272
+ },
273
+ "required": [
274
+ "status",
275
+ "repo_root",
276
+ "artifacts_dir",
277
+ "summary",
278
+ "pending_obligations",
279
+ "suggested_inputs",
280
+ "suggested_commands",
281
+ "artifact_paths"
282
+ ],
283
+ "additionalProperties": false
284
+ }
285
+ },
286
+ "required": [
287
+ "contract_version",
288
+ "audit_state",
289
+ "selected_obligation",
290
+ "selected_executor",
291
+ "progress_made",
292
+ "artifacts_written",
293
+ "progress_summary",
294
+ "next_likely_step"
295
+ ],
296
+ "additionalProperties": false
297
+ }
@@ -43,6 +43,10 @@
43
43
  "total_lines": {
44
44
  "type": "integer",
45
45
  "minimum": 0
46
+ },
47
+ "reviewed_lines": {
48
+ "type": "integer",
49
+ "minimum": 0
46
50
  }
47
51
  },
48
52
  "required": [
@@ -45,6 +45,10 @@
45
45
  "total_lines": {
46
46
  "type": "integer",
47
47
  "minimum": 0
48
+ },
49
+ "reviewed_lines": {
50
+ "type": "integer",
51
+ "minimum": 0
48
52
  }
49
53
  },
50
54
  "required": [
@@ -14,14 +14,17 @@ import { mkdirSync, existsSync, readFileSync, writeFileSync } from "node:fs";
14
14
 
15
15
  /**
16
16
  * Read a source file that is required for the install to proceed at all
17
- * (e.g. the prompt/skill markdown). Missing source is reported as a skip
18
- * (exitCode reset to 0, not a failure) rather than thrown.
17
+ * (e.g. the prompt/skill markdown the product surface itself). A missing
18
+ * required source is a LOUD failure: it throws so the postinstall exits
19
+ * non-zero and any failure an earlier step already recorded is never masked
20
+ * by an exit-code reset here. Only truly optional sources go through
21
+ * readOptionalSource, which still degrades to a skip.
19
22
  */
20
23
  export function readRequiredSource(path, label, toolName) {
21
24
  if (!existsSync(path)) {
22
- console.warn(`${toolName}: ${label} source not found at ${path} - skipping global command install`);
23
- process.exitCode = 0;
24
- return null;
25
+ throw new Error(
26
+ `${toolName}: ${label} source not found at ${path} - required for the install; not skipping silently`,
27
+ );
25
28
  }
26
29
  return readFileSync(path);
27
30
  }
@@ -43,8 +43,10 @@ node audit-code.mjs ensure --quiet
43
43
  node audit-code.mjs next-step
44
44
  ```
45
45
 
46
- Pass a user-supplied target directory with `--root <path>` on every command. Do
47
- not add provider, model, quota, routing, or launch flags.
46
+ The target-directory rule has one home *Preserve user arguments* in the
47
+ `/audit-code` loader prompt, whose absolute path `audit-code prompt-path` prints.
48
+ Follow it as written there. Do not add provider, model, quota, routing, or launch
49
+ flags.
48
50
 
49
51
  Read the returned JSON only far enough to find `prompt_path`, then read and
50
52
  follow only that prompt. Do not inspect workload, result, schema, or state files
@@ -21,8 +21,11 @@ repository root.
21
21
 
22
22
  Preserve user arguments:
23
23
 
24
- - pass a typed target directory with `--root <path>` on every `audit-code`
25
- command (`ensure` and each `next-step`)
24
+ - pass the user-supplied target directory with `--root <path>` on every
25
+ `audit-code` command (`ensure` and each `next-step`)
26
+
27
+ This is the one full statement of the target-directory rule; the `audit-code`
28
+ skill points here instead of restating it.
26
29
 
27
30
  Ask for exactly one step:
28
31
 
@@ -3,7 +3,7 @@
3
3
  Use `audit-code next-step` as the primary interface to the audit workflow.
4
4
 
5
5
  1. Run `audit-code next-step` directly when shell access is available.
6
- 2. Read `prompt_content` in the response and follow it.
6
+ 2. Read the returned JSON far enough to find `prompt_path`, then read and follow the prompt file it points to.
7
7
  3. When a step completes (not blocked), run `audit-code next-step` again.
8
8
  4. Stop when the step instructions say to stop.
9
9
 
@@ -15,7 +15,11 @@ import {
15
15
  _getInstallProfile,
16
16
  _renderGeminiCommandToml,
17
17
  } from './audit-code-wrapper-install-hosts.mjs';
18
- import { wantsInstallerVerbHelp, installerVerbHelp } from './installer-verb-help.mjs';
18
+ import {
19
+ wantsInstallerVerbHelp,
20
+ installerVerbHelp,
21
+ installerVerbSummaries,
22
+ } from './installer-verb-help.mjs';
19
23
 
20
24
  export { shouldBuildDistForPaths, assertWorkspaceInstalled };
21
25
  export { _INSTALL_HOST_ORDER, _INSTALL_HOST_DEFINITIONS, _getInstallHostKeys, _getInstallProfile, _renderGeminiCommandToml };
@@ -45,24 +49,84 @@ function hasLeadingFlag(argv, name) {
45
49
  return false;
46
50
  }
47
51
 
52
+ // Every occurrence of a flag in an argv, classified by the SAME grammar
53
+ // src/audit/cli/args.ts reads with: an equals token (`--root=/x`) carries its
54
+ // value inline; a bare token (`--root /x`) consumes the FOLLOWING token as its
55
+ // value only when that token exists and is not itself a flag (the mirror of
56
+ // args.ts's isLongFlagToken guard). Reading the dist grammar here is what makes
57
+ // the wrapper's view of "what did the caller pass" agree with what the child
58
+ // will actually act on. Ordered by ascending index; spans never overlap.
59
+ function flagOccurrences(argv, name) {
60
+ const prefix = `${name}=`;
61
+ const occurrences = [];
62
+ for (let index = 0; index < argv.length; index += 1) {
63
+ if (argv[index].startsWith(prefix)) {
64
+ occurrences.push({ index, span: 1, inline: true });
65
+ } else if (argv[index] === name) {
66
+ const consumesValue =
67
+ argv[index + 1] !== undefined && !argv[index + 1].startsWith("--");
68
+ occurrences.push({ index, span: consumesValue ? 2 : 1, inline: false });
69
+ if (consumesValue) index += 1;
70
+ }
71
+ }
72
+ return occurrences;
73
+ }
74
+
75
+ // The caller's LAST occurrence is their final word for the flag.
76
+ function lastFlagEntry(argv, name) {
77
+ const occurrences = flagOccurrences(argv, name);
78
+ return occurrences[occurrences.length - 1];
79
+ }
80
+
48
81
  function getFlag(argv, name) {
49
- const index = argv.indexOf(name);
50
- if (index < 0) return undefined;
51
- return argv[index + 1];
82
+ const entry = lastFlagEntry(argv, name);
83
+ if (!entry) return undefined;
84
+ return entry.inline ? argv[entry.index].slice(name.length + 1) : argv[entry.index + 1];
52
85
  }
53
86
 
54
- // Overwrite an existing flag's value (or append when absent). A fill-only-if-
55
- // missing default would forward a user-supplied RELATIVE --root/--artifacts-dir
56
- // raw, re-resolved against the child's cwd (repoRoot), not the caller's cwd
57
- // e.g. `--root .` pointed at the package dir (CE-001). Normalizing to an
58
- // absolute path here makes the forwarded value cwd-stable.
87
+ // Overwrite an existing flag's value or append when absent, ALWAYS emitting the
88
+ // bare two-token form (`--name value`) the only spelling
89
+ // src/audit/cli/args.ts parses (argv.indexOf, no '=' handling anywhere in
90
+ // src/audit), so forwarding an equals-form token verbatim means dist silently
91
+ // drops it and the CLI default wins — explicit loses, the exact failure class
92
+ // this guards. Every OTHER occurrence (either spelling, including each bare
93
+ // occurrence's consumed value token) is removed, so exactly one canonical
94
+ // occurrence reaches the child and dist's first-match parse cannot land on a
95
+ // stale one. A fill-only-if-missing default would otherwise forward a
96
+ // user-supplied RELATIVE --root/--artifacts-dir raw, re-resolved against the
97
+ // child's cwd (repoRoot), not the caller's cwd — e.g. `--root .` pointed at the
98
+ // package dir (CE-001). Normalizing to an absolute path here makes the
99
+ // forwarded value cwd-stable.
59
100
  function setFlag(argv, name, value) {
60
- const index = argv.indexOf(name);
61
- if (index < 0) {
101
+ const occurrences = flagOccurrences(argv, name);
102
+ const kept = occurrences[occurrences.length - 1];
103
+
104
+ // Drop the superseded occurrences, highest index first, together with the
105
+ // value token each bare one consumed.
106
+ for (let occ = occurrences.length - 2; occ >= 0; occ -= 1) {
107
+ argv.splice(occurrences[occ].index, occurrences[occ].span);
108
+ }
109
+
110
+ if (!kept) {
62
111
  argv.push(name, value);
63
- } else {
112
+ return;
113
+ }
114
+
115
+ // Removed occurrences shifted the kept one left; recompute its index.
116
+ const removedBefore = occurrences.reduce(
117
+ (span, occ) => (occ.index < kept.index ? span + occ.span : span),
118
+ 0,
119
+ );
120
+ const index = kept.index - removedBefore;
121
+ if (kept.span === 2) {
122
+ // Bare with a value slot: overwrite the value in place.
64
123
  argv[index + 1] = value;
124
+ return;
65
125
  }
126
+ // Inline (`--name=x`) or dangling bare: collapse the token to the bare flag
127
+ // and insert the value after it.
128
+ argv[index] = name;
129
+ argv.splice(index + 1, 0, value);
66
130
  }
67
131
 
68
132
  export { hasLeadingFlag, setFlag };
@@ -185,11 +249,12 @@ function printHelp({ usageName, preferredEntrypoint }) {
185
249
  '',
186
250
  'Helper commands:',
187
251
  '- prompt-path prints the absolute path to the canonical /audit-code prompt asset',
188
- '- ensure lazily bootstraps repo-local /audit-code assets when they are missing or stale',
189
- '- install bootstraps /audit-code into supported repo-local host surfaces',
190
- '- verify-install smoke-tests the generated host assets after install',
252
+ // The four wrapper-intercepted installer verbs are RENDERED from the module
253
+ // this file already answers `<verb> --help` from, so the listing and the
254
+ // per-verb help cannot disagree. They were hand-restated here and had
255
+ // already drifted from it on two of the four.
256
+ ...installerVerbSummaries('/audit-code'),
191
257
  '- mcp starts the local stdio MCP server for repo-local IDE integrations',
192
- '- install-host --host copilot keeps the narrower Copilot-focused install path available',
193
258
  '- validate checks the current artifact bundle and canonical session intent and exits non-zero when issues exist',
194
259
  '- validate-results --results FILE validates AuditResult payloads against the active task manifest without ingesting them',
195
260
  '- explain-task <task_id> prints the resolved file coverage and current status for a task id',
@@ -52,6 +52,18 @@ const VERB_DETAIL = Object.freeze({
52
52
  ],
53
53
  });
54
54
 
55
+ /**
56
+ * One verb's one-line summary, with `{product}` bound to the slash-command the
57
+ * bin installs. The accessor exists so the surface can be RENDERED — the docs
58
+ * that list these verbs read this module rather than restating it, which is how
59
+ * `docs/audit-pkg/product.md` came to omit two of the four.
60
+ */
61
+ export function installerVerbSummary(verb, product) {
62
+ const summary = VERB_SUMMARY[verb];
63
+ if (summary === undefined) throw new Error(`unknown installer verb: ${verb}`);
64
+ return summary.replace('{product}', product);
65
+ }
66
+
55
67
  /** True when `verb` is one of the wrapper-intercepted installer verbs. */
56
68
  export function isInstallerVerb(verb) {
57
69
  return typeof verb === 'string' && INSTALLER_VERBS.includes(verb);
@@ -76,7 +88,7 @@ export function wantsInstallerVerbHelp(argv) {
76
88
  * installs (e.g. `/audit-code`); `usageName` is the bin as the caller invoked it.
77
89
  */
78
90
  export function installerVerbHelp(verb, { usageName, product }) {
79
- const summary = VERB_SUMMARY[verb].replace('{product}', product);
91
+ const summary = installerVerbSummary(verb, product);
80
92
  return [
81
93
  `Usage: node ${usageName} ${verb} [--root PATH] [--quiet]`,
82
94
  '',
@@ -92,7 +104,5 @@ export function installerVerbHelp(verb, { usageName, product }) {
92
104
 
93
105
  /** The one-line summaries, for a bin's top-level help listing. */
94
106
  export function installerVerbSummaries(product) {
95
- return INSTALLER_VERBS.map(
96
- (verb) => `- ${verb} ${VERB_SUMMARY[verb].replace('{product}', product)}`,
97
- );
107
+ return INSTALLER_VERBS.map((verb) => `- ${verb} ${installerVerbSummary(verb, product)}`);
98
108
  }
@@ -1,113 +0,0 @@
1
- # Development
2
-
3
- ## Repository layout
4
-
5
- - `src/`: implementation code
6
- - `schemas/`: JSON schemas for public and internal artifacts
7
- - `examples/`: validated artifact examples
8
- - `skills/audit-code/`: canonical prompt and skill-facing instructions
9
- - `dispatch/`: standalone result validation and merge helpers
10
- - `tests/`: vitest-based test suite and regression coverage
11
- - `dist/`: build output (gitignored, not checked in) produced by `npm run build` / the `prepack` script;
12
- shipped only in the packed npm tarball
13
-
14
- ## Agent handoff
15
-
16
- Long-term product direction lives in [`product.md`](product.md). Current state + immediate next steps are in
17
- [`HANDOFF.md`](../HANDOFF.md); open work in [`backlog.md`](../backlog.md). There is no
18
- shipped-sprint archive — that history lives in git + project memory.
19
-
20
- ## Build and test
21
-
22
- ```bash
23
- npm install
24
- npm run check
25
- npm test
26
- npx vitest run tests/audit/host-handoff.test.ts
27
- npm run verify:release
28
- ```
29
-
30
- Run `npm install` from the repository root before running build, check, test, or
31
- package-scoped workflows in a fresh clone or git worktree. Missing
32
- `node_modules` can surface as misleading `audit-tools/shared` export or type
33
- errors because dependents may resolve stale compiled `dist/` output.
34
-
35
- The test suite is intentionally contract-heavy. Update tests when changing
36
- schema shape, prompt contracts, host-handoff behavior, installer output, or release
37
- workflow semantics.
38
-
39
- ## Architecture
40
-
41
- The system separates deterministic extraction from bounded LLM judgment: intake, analysis artifacts,
42
- task planning, provider-neutral host workloads, strict result ingestion, and synthesis into
43
- `audit-report.md`. Backend/model selection, concurrency, retries, and transport belong to the host and
44
- are not audit-tools configuration.
45
-
46
- **The ordering has one home** — the `PRIORITY` array in `src/audit/orchestrator/nextStep.ts`, walked by
47
- `decideNextStep`. `src/audit/README.md` carries the conceptual grouping with the disclaimer that `PRIORITY` is
48
- authoritative; read the array for the real sequence. Copies of it have drifted before, which is why
49
- neither this file nor any other keeps a second one.
50
-
51
- Portability rules:
52
-
53
- - tool-specific collectors write tool-agnostic JSON
54
- - prompts consume artifacts and bounded source context
55
- - review work is attributable to files, lenses, passes, and tasks
56
- - coverage gaps are machine-detectable
57
-
58
- `AuditTask` is the coverage identity; `AuditResult[]` is the ingestion contract.
59
-
60
- ## Adding language analyzers
61
-
62
- Language support should be adapter-based. A new analyzer should enrich shared
63
- artifacts instead of inventing a language-specific planning path.
64
-
65
- Avoid adding another bespoke manifest or project-file parser by default. First
66
- ask whether the signal is common in expected repositories, whether it provides
67
- direction or ownership that path heuristics cannot, and whether the same value
68
- could come from a generic analyzer-supplied ownership hint.
69
-
70
- Preferred outputs:
71
-
72
- - graph edges with kind, direction, confidence, and reason
73
- - entrypoints and surfaces
74
- - test-to-source links
75
- - package/module ownership hints, including analyzer-supplied `ownership_roots`
76
- that become `analyzer-ownership-root-link` graph references
77
- - contract-suite links for small JSON Schema, workflow, package-script, or
78
- TypeScript type suites when planner metrics show otherwise weak packets
79
- - external boundary hints
80
- - line counts and anchor summaries for large files
81
-
82
- Keep deep analyzers optional: a repository should still produce useful packets
83
- from manifests, paths, tests, and external analyzer results when a language has
84
- only fallback support. Command-backed analyzers should prove project intent
85
- before running — prefer repo-local config checks (`eslint.config.*`, `.eslintrc*`,
86
- `package.json` `eslintConfig`) over executing a globally installed tool and
87
- parsing its no-config failure.
88
-
89
- Language-agnostic semantic affinity is useful for ranking adjacent context but
90
- should stay low-authority: don't let shared token frequency alone force packet
91
- merges; use it for `boundary_files` or candidate explanations unless a
92
- deterministic edge corroborates the relationship.
93
-
94
- ## Production readiness
95
-
96
- Drive priorities from field trials, not speculation: run representative
97
- repositories through planning, validate the bundle (`audit-code validate`), and
98
- compare `audit_plan_metrics.json` (packet count, weak-packet count, cohesion,
99
- merge/boundary edge kinds) across runs. Promote an extractor or planner change
100
- when those metrics expose a deterministic gap — and prefer improving shared
101
- graph resolution or generic analyzer ownership roots before adding another
102
- ecosystem-specific parser.
103
-
104
- Before treating a build as production-ready, verify the full review loop in one
105
- real host (`next-step` emits the complete workload → the host writes each bound
106
- result → `next-step` ingests them → `validate`), then run the release gate from a clean
107
- checkout (see [`release.md`](release.md) for what `npm run verify:release`
108
- covers and when to run it). Keep runtime command execution covered when
109
- changing it — including the Windows package-manager-shim path (see the Windows
110
- notes in [`operator-guide.md`](operator-guide.md)). If the
111
- final `audit-report.md` cannot be promoted from `.audit-tools/audit/` to
112
- `.audit-tools/audit-report.md` due to local permissions, completion still succeeds and the
113
- pre-promotion copy under `.audit-tools/audit/` is authoritative.