audit-tools 0.45.0 → 0.48.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 (288) hide show
  1. package/README.md +51 -18
  2. package/dispatch/merge-results.mjs +3 -3
  3. package/dispatch/validate-result.mjs +3 -3
  4. package/dist/audit/cli/charterExtractionPrompt.d.ts.map +1 -1
  5. package/dist/audit/cli/charterExtractionPrompt.js +11 -1
  6. package/dist/audit/cli/charterExtractionPrompt.js.map +1 -1
  7. package/dist/audit/cli/cleanupCommand.d.ts +25 -0
  8. package/dist/audit/cli/cleanupCommand.d.ts.map +1 -1
  9. package/dist/audit/cli/cleanupCommand.js +76 -1
  10. package/dist/audit/cli/cleanupCommand.js.map +1 -1
  11. package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
  12. package/dist/audit/cli/dispatch/hostHandoff.js +52 -76
  13. package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
  14. package/dist/audit/cli/dispatch/packetFilter.d.ts +1 -1
  15. package/dist/audit/cli/fanoutLanes.d.ts.map +1 -1
  16. package/dist/audit/cli/fanoutLanes.js +6 -1
  17. package/dist/audit/cli/fanoutLanes.js.map +1 -1
  18. package/dist/audit/cli/laneSubmissions.d.ts +13 -0
  19. package/dist/audit/cli/laneSubmissions.d.ts.map +1 -1
  20. package/dist/audit/cli/laneSubmissions.js +38 -27
  21. package/dist/audit/cli/laneSubmissions.js.map +1 -1
  22. package/dist/audit/cli/nextStepCommand.d.ts +12 -0
  23. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
  24. package/dist/audit/cli/nextStepCommand.js +23 -12
  25. package/dist/audit/cli/nextStepCommand.js.map +1 -1
  26. package/dist/audit/cli/nextStepHelpers.d.ts +3 -2
  27. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  28. package/dist/audit/cli/nextStepHelpers.js +65 -37
  29. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  30. package/dist/audit/cli/reviewRun.d.ts +1 -1
  31. package/dist/audit/cli/reviewRun.d.ts.map +1 -1
  32. package/dist/audit/cli/reviewRun.js +2 -9
  33. package/dist/audit/cli/reviewRun.js.map +1 -1
  34. package/dist/audit/cli/sampleRunCommand.d.ts +215 -0
  35. package/dist/audit/cli/sampleRunCommand.d.ts.map +1 -1
  36. package/dist/audit/cli/sampleRunCommand.js +60 -3
  37. package/dist/audit/cli/sampleRunCommand.js.map +1 -1
  38. package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
  39. package/dist/audit/cli/semanticReviewStep.js +9 -1
  40. package/dist/audit/cli/semanticReviewStep.js.map +1 -1
  41. package/dist/audit/cli/steps.d.ts +6 -6
  42. package/dist/audit/contracts/workerSchemas.d.ts +36 -26
  43. package/dist/audit/contracts/workerSchemas.d.ts.map +1 -1
  44. package/dist/audit/contracts/workerSchemas.js +11 -1
  45. package/dist/audit/contracts/workerSchemas.js.map +1 -1
  46. package/dist/audit/contracts/wrapperResponse.d.ts +52 -28
  47. package/dist/audit/contracts/wrapperResponse.d.ts.map +1 -1
  48. package/dist/audit/contracts/wrapperResponse.js +8 -5
  49. package/dist/audit/contracts/wrapperResponse.js.map +1 -1
  50. package/dist/audit/decompose/sources.d.ts.map +1 -1
  51. package/dist/audit/decompose/sources.js +21 -5
  52. package/dist/audit/decompose/sources.js.map +1 -1
  53. package/dist/audit/extractors/analyzers/registry.d.ts +8 -5
  54. package/dist/audit/extractors/analyzers/registry.d.ts.map +1 -1
  55. package/dist/audit/extractors/analyzers/registry.js +28 -7
  56. package/dist/audit/extractors/analyzers/registry.js.map +1 -1
  57. package/dist/audit/extractors/designAssessment.js +1 -1
  58. package/dist/audit/extractors/gitHistory.d.ts +1 -1
  59. package/dist/audit/extractors/gitHistory.js +1 -1
  60. package/dist/audit/extractors/graph.d.ts +1 -1
  61. package/dist/audit/extractors/graph.js +1 -1
  62. package/dist/audit/extractors/risk.d.ts +1 -1
  63. package/dist/audit/extractors/risk.js +1 -1
  64. package/dist/audit/io/artifacts.d.ts.map +1 -1
  65. package/dist/audit/io/artifacts.js +5 -5
  66. package/dist/audit/io/artifacts.js.map +1 -1
  67. package/dist/audit/orchestrator/acquisitionExecutor.d.ts +12 -7
  68. package/dist/audit/orchestrator/acquisitionExecutor.d.ts.map +1 -1
  69. package/dist/audit/orchestrator/acquisitionExecutor.js +1 -1
  70. package/dist/audit/orchestrator/acquisitionExecutor.js.map +1 -1
  71. package/dist/audit/orchestrator/advance.d.ts +14 -10
  72. package/dist/audit/orchestrator/advance.d.ts.map +1 -1
  73. package/dist/audit/orchestrator/advance.js +49 -24
  74. package/dist/audit/orchestrator/advance.js.map +1 -1
  75. package/dist/audit/orchestrator/advanceTypes.d.ts +14 -0
  76. package/dist/audit/orchestrator/advanceTypes.d.ts.map +1 -1
  77. package/dist/audit/orchestrator/autoFixExecutor.d.ts +20 -1
  78. package/dist/audit/orchestrator/autoFixExecutor.d.ts.map +1 -1
  79. package/dist/audit/orchestrator/autoFixExecutor.js +77 -15
  80. package/dist/audit/orchestrator/autoFixExecutor.js.map +1 -1
  81. package/dist/audit/orchestrator/dependencyMap.js +1 -1
  82. package/dist/audit/orchestrator/dependencyMap.js.map +1 -1
  83. package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
  84. package/dist/audit/orchestrator/designReviewPrompt.js +7 -0
  85. package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
  86. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  87. package/dist/audit/orchestrator/executorRunners.js +18 -4
  88. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  89. package/dist/audit/orchestrator/executors.d.ts +54 -0
  90. package/dist/audit/orchestrator/executors.d.ts.map +1 -1
  91. package/dist/audit/orchestrator/executors.js +352 -0
  92. package/dist/audit/orchestrator/executors.js.map +1 -1
  93. package/dist/audit/orchestrator/hostInputPause.d.ts +28 -13
  94. package/dist/audit/orchestrator/hostInputPause.d.ts.map +1 -1
  95. package/dist/audit/orchestrator/hostInputPause.js +17 -11
  96. package/dist/audit/orchestrator/hostInputPause.js.map +1 -1
  97. package/dist/audit/orchestrator/intentInterpreter.d.ts +15 -18
  98. package/dist/audit/orchestrator/intentInterpreter.d.ts.map +1 -1
  99. package/dist/audit/orchestrator/intentInterpreter.js +12 -26
  100. package/dist/audit/orchestrator/intentInterpreter.js.map +1 -1
  101. package/dist/audit/orchestrator/localCommands.d.ts +24 -1
  102. package/dist/audit/orchestrator/localCommands.d.ts.map +1 -1
  103. package/dist/audit/orchestrator/localCommands.js +44 -9
  104. package/dist/audit/orchestrator/localCommands.js.map +1 -1
  105. package/dist/audit/orchestrator/nextStep.d.ts +13 -0
  106. package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
  107. package/dist/audit/orchestrator/nextStep.js +13 -0
  108. package/dist/audit/orchestrator/nextStep.js.map +1 -1
  109. package/dist/audit/orchestrator/requeueCommand.d.ts +1 -1
  110. package/dist/audit/orchestrator/runtimeCommand.d.ts +32 -1
  111. package/dist/audit/orchestrator/runtimeCommand.d.ts.map +1 -1
  112. package/dist/audit/orchestrator/runtimeCommand.js +90 -3
  113. package/dist/audit/orchestrator/runtimeCommand.js.map +1 -1
  114. package/dist/audit/orchestrator/structureExecutors.js +1 -1
  115. package/dist/audit/orchestrator/structureExecutors.js.map +1 -1
  116. package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts +11 -1
  117. package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts.map +1 -1
  118. package/dist/audit/orchestrator/syntaxResolutionExecutor.js +25 -9
  119. package/dist/audit/orchestrator/syntaxResolutionExecutor.js.map +1 -1
  120. package/dist/audit/supervisor/operatorHandoff.d.ts +0 -1
  121. package/dist/audit/supervisor/operatorHandoff.d.ts.map +1 -1
  122. package/dist/audit/supervisor/operatorHandoff.js +2 -1
  123. package/dist/audit/supervisor/operatorHandoff.js.map +1 -1
  124. package/dist/audit/types.d.ts +18 -18
  125. package/dist/remediate/contractPipeline/derive.d.ts.map +1 -1
  126. package/dist/remediate/contractPipeline/derive.js +1 -0
  127. package/dist/remediate/contractPipeline/derive.js.map +1 -1
  128. package/dist/remediate/contractPipeline/semanticProjection.d.ts +5 -4
  129. package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +1 -1
  130. package/dist/remediate/contractPipeline/semanticProjection.js +34 -19
  131. package/dist/remediate/contractPipeline/semanticProjection.js.map +1 -1
  132. package/dist/remediate/index.d.ts.map +1 -1
  133. package/dist/remediate/index.js +3 -2
  134. package/dist/remediate/index.js.map +1 -1
  135. package/dist/remediate/intake.js +1 -1
  136. package/dist/remediate/intake.js.map +1 -1
  137. package/dist/remediate/phases/close.d.ts +45 -2
  138. package/dist/remediate/phases/close.d.ts.map +1 -1
  139. package/dist/remediate/phases/close.js +111 -43
  140. package/dist/remediate/phases/close.js.map +1 -1
  141. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js +2 -2
  142. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js.map +1 -1
  143. package/dist/remediate/phases/triage.d.ts.map +1 -1
  144. package/dist/remediate/phases/triage.js +61 -19
  145. package/dist/remediate/phases/triage.js.map +1 -1
  146. package/dist/remediate/review/autonomousGate.d.ts +3 -7
  147. package/dist/remediate/review/autonomousGate.d.ts.map +1 -1
  148. package/dist/remediate/review/autonomousGate.js +10 -24
  149. package/dist/remediate/review/autonomousGate.js.map +1 -1
  150. package/dist/remediate/riskSignal.d.ts +8 -20
  151. package/dist/remediate/riskSignal.d.ts.map +1 -1
  152. package/dist/remediate/riskSignal.js +21 -76
  153. package/dist/remediate/riskSignal.js.map +1 -1
  154. package/dist/remediate/state/accessMemory.d.ts +2 -3
  155. package/dist/remediate/state/accessMemory.d.ts.map +1 -1
  156. package/dist/remediate/state/accessMemory.js +3 -6
  157. package/dist/remediate/state/accessMemory.js.map +1 -1
  158. package/dist/remediate/state/store.d.ts +6 -7
  159. package/dist/remediate/state/store.d.ts.map +1 -1
  160. package/dist/remediate/state/store.js.map +1 -1
  161. package/dist/remediate/state/types.d.ts +2 -84
  162. package/dist/remediate/state/types.d.ts.map +1 -1
  163. package/dist/remediate/state/types.js +1 -39
  164. package/dist/remediate/state/types.js.map +1 -1
  165. package/dist/remediate/steps/contractPipeline.d.ts +13 -19
  166. package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
  167. package/dist/remediate/steps/contractPipeline.js +157 -66
  168. package/dist/remediate/steps/contractPipeline.js.map +1 -1
  169. package/dist/remediate/steps/dispatch/hostHandoff.d.ts +1 -1
  170. package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
  171. package/dist/remediate/steps/dispatch/hostHandoff.js +297 -141
  172. package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
  173. package/dist/remediate/steps/nextStep.d.ts +16 -7
  174. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  175. package/dist/remediate/steps/nextStep.js +207 -216
  176. package/dist/remediate/steps/nextStep.js.map +1 -1
  177. package/dist/remediate/steps/stepUtils.d.ts +10 -2
  178. package/dist/remediate/steps/stepUtils.d.ts.map +1 -1
  179. package/dist/remediate/steps/stepUtils.js +13 -3
  180. package/dist/remediate/steps/stepUtils.js.map +1 -1
  181. package/dist/remediate/steps/types.d.ts +1 -1
  182. package/dist/remediate/steps/types.d.ts.map +1 -1
  183. package/dist/remediate/steps/types.js.map +1 -1
  184. package/dist/remediate/types/options.d.ts +1 -1
  185. package/dist/remediate/validation/artifacts.d.ts.map +1 -1
  186. package/dist/remediate/validation/artifacts.js +1 -16
  187. package/dist/remediate/validation/artifacts.js.map +1 -1
  188. package/dist/remediate/validation/remediationState.d.ts +0 -1
  189. package/dist/remediate/validation/remediationState.d.ts.map +1 -1
  190. package/dist/remediate/validation/remediationState.js +0 -51
  191. package/dist/remediate/validation/remediationState.js.map +1 -1
  192. package/dist/shared/analyzerPolicy.d.ts +18 -6
  193. package/dist/shared/analyzerPolicy.d.ts.map +1 -1
  194. package/dist/shared/analyzerPolicy.js +15 -3
  195. package/dist/shared/analyzerPolicy.js.map +1 -1
  196. package/dist/shared/analyzers/acquisitionEngine.d.ts +71 -32
  197. package/dist/shared/analyzers/acquisitionEngine.d.ts.map +1 -1
  198. package/dist/shared/analyzers/acquisitionEngine.js +86 -28
  199. package/dist/shared/analyzers/acquisitionEngine.js.map +1 -1
  200. package/dist/shared/analyzers/binaryAcquisition.d.ts +8 -2
  201. package/dist/shared/analyzers/binaryAcquisition.d.ts.map +1 -1
  202. package/dist/shared/analyzers/binaryAcquisition.js +4 -4
  203. package/dist/shared/analyzers/binaryAcquisition.js.map +1 -1
  204. package/dist/shared/constitutionalDocPaths.d.ts.map +1 -1
  205. package/dist/shared/constitutionalDocPaths.js +7 -0
  206. package/dist/shared/constitutionalDocPaths.js.map +1 -1
  207. package/dist/shared/engine/obligationEngine.d.ts +44 -3
  208. package/dist/shared/engine/obligationEngine.d.ts.map +1 -1
  209. package/dist/shared/engine/obligationEngine.js +53 -7
  210. package/dist/shared/engine/obligationEngine.js.map +1 -1
  211. package/dist/shared/findings/dedupe.d.ts.map +1 -1
  212. package/dist/shared/findings/dedupe.js +8 -0
  213. package/dist/shared/findings/dedupe.js.map +1 -1
  214. package/dist/shared/friction/frictionRecord.d.ts +42 -2
  215. package/dist/shared/friction/frictionRecord.d.ts.map +1 -1
  216. package/dist/shared/friction/frictionRecord.js +111 -3
  217. package/dist/shared/friction/frictionRecord.js.map +1 -1
  218. package/dist/shared/friction/triage.d.ts +15 -0
  219. package/dist/shared/friction/triage.d.ts.map +1 -1
  220. package/dist/shared/friction/triage.js +33 -2
  221. package/dist/shared/friction/triage.js.map +1 -1
  222. package/dist/shared/index.d.ts +15 -9
  223. package/dist/shared/index.d.ts.map +1 -1
  224. package/dist/shared/index.js +15 -7
  225. package/dist/shared/index.js.map +1 -1
  226. package/dist/shared/intent/constraintClauses.d.ts +31 -0
  227. package/dist/shared/intent/constraintClauses.d.ts.map +1 -0
  228. package/dist/shared/intent/constraintClauses.js +37 -0
  229. package/dist/shared/intent/constraintClauses.js.map +1 -0
  230. package/dist/shared/io/fileLock.d.ts.map +1 -1
  231. package/dist/shared/io/fileLock.js +22 -3
  232. package/dist/shared/io/fileLock.js.map +1 -1
  233. package/dist/shared/io/frictionCapture.d.ts +73 -19
  234. package/dist/shared/io/frictionCapture.d.ts.map +1 -1
  235. package/dist/shared/io/frictionCapture.js +21 -30
  236. package/dist/shared/io/frictionCapture.js.map +1 -1
  237. package/dist/shared/io/lockedJsonStore.d.ts +24 -3
  238. package/dist/shared/io/lockedJsonStore.d.ts.map +1 -1
  239. package/dist/shared/io/lockedJsonStore.js +35 -7
  240. package/dist/shared/io/lockedJsonStore.js.map +1 -1
  241. package/dist/shared/io/stepContractWriter.d.ts +3 -3
  242. package/dist/shared/io/stepContractWriter.d.ts.map +1 -1
  243. package/dist/shared/io/stepContractWriter.js +97 -13
  244. package/dist/shared/io/stepContractWriter.js.map +1 -1
  245. package/dist/shared/submission/expectedSubmissions.d.ts +18 -0
  246. package/dist/shared/submission/expectedSubmissions.d.ts.map +1 -1
  247. package/dist/shared/submission/expectedSubmissions.js +17 -0
  248. package/dist/shared/submission/expectedSubmissions.js.map +1 -1
  249. package/dist/shared/submission/handRecovery.d.ts.map +1 -1
  250. package/dist/shared/submission/handRecovery.js +9 -11
  251. package/dist/shared/submission/handRecovery.js.map +1 -1
  252. package/dist/shared/submission/hostHandoffCore.d.ts +155 -0
  253. package/dist/shared/submission/hostHandoffCore.d.ts.map +1 -0
  254. package/dist/shared/submission/hostHandoffCore.js +210 -0
  255. package/dist/shared/submission/hostHandoffCore.js.map +1 -0
  256. package/dist/shared/submission/submissionLedger.d.ts +5 -1
  257. package/dist/shared/submission/submissionLedger.d.ts.map +1 -1
  258. package/dist/shared/submission/submissionLedger.js +33 -3
  259. package/dist/shared/submission/submissionLedger.js.map +1 -1
  260. package/dist/shared/tooling/commandShape.d.ts +29 -0
  261. package/dist/shared/tooling/commandShape.d.ts.map +1 -1
  262. package/dist/shared/tooling/commandShape.js +82 -10
  263. package/dist/shared/tooling/commandShape.js.map +1 -1
  264. package/dist/shared/tooling/exec.d.ts +32 -0
  265. package/dist/shared/tooling/exec.d.ts.map +1 -1
  266. package/dist/shared/tooling/exec.js +189 -0
  267. package/dist/shared/tooling/exec.js.map +1 -1
  268. package/docs/audit-pkg/contracts.md +2 -1
  269. package/docs/audit-pkg/operator-guide.md +12 -6
  270. package/docs/audit-pkg/product.md +22 -6
  271. package/package.json +13 -6
  272. package/schemas/audit-code-v1alpha1.schema.json +297 -0
  273. package/schemas/audit_result.schema.json +4 -0
  274. package/schemas/audit_results.schema.json +4 -0
  275. package/scripts/audit/postinstall.mjs +4 -2
  276. package/scripts/postinstall.mjs +1 -1
  277. package/scripts/remediate/postinstall.mjs +3 -1
  278. package/scripts/shared/install-host-assets.mjs +15 -8
  279. package/skills/audit-code/SKILL.md +4 -2
  280. package/skills/audit-code/audit-code.prompt.md +5 -2
  281. package/skills/audit-code/opencode-command-template.txt +1 -1
  282. package/wrapper/audit-code-wrapper-build.mjs +3 -3
  283. package/wrapper/audit-code-wrapper-install-hosts.mjs +3 -3
  284. package/wrapper/audit-code-wrapper-lib.mjs +82 -16
  285. package/wrapper/installer-verb-help.mjs +14 -4
  286. package/wrapper/remediate-code-wrapper-install-hosts.mjs +3 -3
  287. package/docs/audit-pkg/development.md +0 -113
  288. 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": [
@@ -63,7 +63,9 @@ const OPENCODE_AUDIT_BASH_PERMISSION = {
63
63
  // Resolved best-effort: on a fresh workspace checkout the shared dist may not
64
64
  // be built yet, in which case the OpenCode config deployment below is
65
65
  // skipped with a warning instead of failing the whole install.
66
- const sharedOpenCodePermissions = await resolveSharedOpenCodePermissions();
66
+ const sharedOpenCodePermissions = /** @type {NonNullable<Awaited<ReturnType<typeof resolveSharedOpenCodePermissions>>>} */ (
67
+ await resolveSharedOpenCodePermissions()
68
+ );
67
69
 
68
70
  // A pre-hardening deploy wrote agent-scope bash['*']='allow' (the historically
69
71
  // managed broad value). Migrate exactly that value away so the generated 'ask'
@@ -312,7 +314,7 @@ try {
312
314
  console.log(`audit-code: restart Claude Desktop for /audit-code to appear in the slash-command menu`);
313
315
  counts.succeeded++;
314
316
  } catch (err) {
315
- console.warn(`audit-code: could not install Claude Desktop plugin (${err.message})`);
317
+ console.warn(`audit-code: could not install Claude Desktop plugin (${/** @type {any} */ (err).message})`);
316
318
  console.warn(` Plugin directory: ${claudePluginDir}`);
317
319
  counts.failed++;
318
320
  }
@@ -63,7 +63,7 @@ async function manageArtifactGitignore() {
63
63
  }
64
64
  } catch (err) {
65
65
  console.warn(
66
- `[audit-tools] postinstall: .gitignore management skipped (${err?.message ?? err}).`,
66
+ `[audit-tools] postinstall: .gitignore management skipped (${/** @type {any} */ (err)?.message ?? err}).`,
67
67
  );
68
68
  }
69
69
  }
@@ -84,7 +84,9 @@ function withoutRetiredRemediateCodeBashRules(rule) {
84
84
  // Resolved best-effort: on a fresh workspace checkout the shared dist may not
85
85
  // be built yet, in which case the OpenCode config deployment below is
86
86
  // skipped with a warning instead of failing the whole install.
87
- const sharedOpenCodePermissions = await resolveSharedOpenCodePermissions();
87
+ const sharedOpenCodePermissions = /** @type {NonNullable<Awaited<ReturnType<typeof resolveSharedOpenCodePermissions>>>} */ (
88
+ await resolveSharedOpenCodePermissions()
89
+ );
88
90
 
89
91
  // A pre-hardening deploy wrote agent-scope bash['*']='allow' (the historically
90
92
  // managed broad value). Migrate exactly that value away so the generated 'ask'
@@ -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
  }
@@ -104,7 +107,7 @@ export function runInstalls(toolName, installs, counts) {
104
107
  console.log(`${toolName}: ${action} global ${install.label} at ${install.path}`);
105
108
  counts.succeeded++;
106
109
  } catch (err) {
107
- console.warn(`${toolName}: could not install global ${install.label} (${err.message})`);
110
+ console.warn(`${toolName}: could not install global ${install.label} (${/** @type {any} */ (err).message})`);
108
111
  console.warn(` To install manually, copy from:`);
109
112
  console.warn(` ${install.sourcePath}`);
110
113
  console.warn(` to:`);
@@ -123,6 +126,10 @@ export function runInstalls(toolName, installs, counts) {
123
126
  * historically worded this differently). `manualInstructions`, if given, is
124
127
  * an array of extra warn lines printed on failure only.
125
128
  */
129
+ /**
130
+ * @param {{toolName: string, path: string, sharedOpenCodePermissions: any, buildMerged: Function, label: string, manualInstructions?: string[]}} options
131
+ * @param {{succeeded: number, failed: number}} counts
132
+ */
126
133
  export function installOpenCodeGlobalConfig(
127
134
  { toolName, path, sharedOpenCodePermissions, buildMerged, label, manualInstructions },
128
135
  counts,
@@ -142,7 +149,7 @@ export function installOpenCodeGlobalConfig(
142
149
  console.log(`${toolName}: ${action} global ${label} in ${path}`);
143
150
  counts.succeeded++;
144
151
  } catch (err) {
145
- console.warn(`${toolName}: could not install global ${label} (${err.message})`);
152
+ console.warn(`${toolName}: could not install global ${label} (${/** @type {any} */ (err).message})`);
146
153
  for (const line of manualInstructions ?? []) console.warn(line);
147
154
  counts.failed++;
148
155
  }
@@ -172,7 +179,7 @@ export function installAntigravityPlugin(
172
179
  console.log(`${toolName}: ${skillAction} Antigravity plugin skill at ${antigravityPluginSkillPath}`);
173
180
  counts.succeeded++;
174
181
  } catch (err) {
175
- console.warn(`${toolName}: could not install Antigravity plugin (${err.message})`);
182
+ console.warn(`${toolName}: could not install Antigravity plugin (${/** @type {any} */ (err).message})`);
176
183
  counts.failed++;
177
184
  }
178
185
  }
@@ -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
 
@@ -32,7 +32,7 @@ function resolveSpawn(command, args) {
32
32
  }
33
33
 
34
34
  function runBuild(command, args) {
35
- return new Promise((resolvePromise, rejectPromise) => {
35
+ return /** @type {Promise<void>} */ (new Promise((resolvePromise, rejectPromise) => {
36
36
  const resolved = resolveSpawn(command, args);
37
37
  const child = spawn(resolved.command, resolved.args, {
38
38
  cwd: repoRoot,
@@ -50,7 +50,7 @@ function runBuild(command, args) {
50
50
  }
51
51
  rejectPromise(new Error(`Command failed with exit code ${code}.`));
52
52
  });
53
- });
53
+ }));
54
54
  }
55
55
 
56
56
  export async function shouldBuildDistForPaths({
@@ -120,7 +120,7 @@ async function acquireBuildLock() {
120
120
  process.stderr.write(JSON.stringify({ event: "build_lock_acquired", pid: process.pid, lock: buildLockPath, acquired_at: acquiredAt }) + '\n');
121
121
  return handle;
122
122
  } catch (error) {
123
- if (error && error.code === 'EEXIST') {
123
+ if (error && /** @type {any} */ (error).code === 'EEXIST') {
124
124
  try {
125
125
  const lockStats = await stat(buildLockPath);
126
126
  if (Date.now() - lockStats.mtimeMs > BUILD_LOCK_MAX_AGE_MS) {
@@ -404,7 +404,7 @@ export function buildHostCatalog({ root, host, assets }) {
404
404
  steps: definition.steps,
405
405
  };
406
406
  })
407
- .filter(Boolean)
407
+ .filter((entry) => entry !== null)
408
408
  .map((entry) => ({
409
409
  ...entry,
410
410
  primary_path: entry.primary_path,
@@ -882,9 +882,9 @@ export async function verifyInstalledBootstrap(argv) {
882
882
  return;
883
883
  }
884
884
 
885
- const assetPaths = installManifest.asset_paths ?? {};
885
+ const assetPaths = /** @type {any} */ (installManifest).asset_paths ?? {};
886
886
  const hostCatalog = new Map(
887
- (installManifest.hosts ?? []).map((entry) => [entry.host, entry]),
887
+ (/** @type {any} */ (installManifest).hosts ?? []).map((entry) => [entry.host, entry]),
888
888
  );
889
889
  const selectedHosts = requestedHost && requestedHost !== 'all'
890
890
  ? getInstallHostKeys(requestedHost)
@@ -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',
@@ -270,6 +335,7 @@ async function runDistCommandInline(commandName, argv, { ensureArtifactsDir = fa
270
335
  await cli.runCli([process.execPath, distCliEntry, commandName, ...commandArgs]);
271
336
  }
272
337
 
338
+ /** @param {{usageName: string, argv?: string[], preferredEntrypoint?: string}} options */
273
339
  export async function runAuditCodeWrapper({
274
340
  usageName,
275
341
  argv = process.argv.slice(2),