@nodetool-ai/cli 0.8.7 → 0.8.9-beta.1

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 (721) hide show
  1. package/README.md +61 -109
  2. package/dist/.nodetool-build-stamp +1 -1
  3. package/dist/chat.d.ts +3 -0
  4. package/dist/chat.d.ts.map +1 -0
  5. package/dist/chat.js +8 -0
  6. package/dist/chat.js.map +1 -0
  7. package/dist/index.d.ts +1 -12
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -231
  10. package/dist/index.js.map +1 -1
  11. package/dist/lean/commandFeatures.d.ts +3 -0
  12. package/dist/lean/commandFeatures.d.ts.map +1 -0
  13. package/dist/lean/commandFeatures.js +21 -0
  14. package/dist/lean/commandFeatures.js.map +1 -0
  15. package/dist/lean/errors.d.ts +19 -0
  16. package/dist/lean/errors.d.ts.map +1 -0
  17. package/dist/lean/errors.js +20 -0
  18. package/dist/lean/errors.js.map +1 -0
  19. package/dist/lean/program.d.ts +12 -0
  20. package/dist/lean/program.d.ts.map +1 -0
  21. package/dist/lean/program.js +398 -0
  22. package/dist/lean/program.js.map +1 -0
  23. package/dist/nodetool.js +6 -29
  24. package/dist/nodetool.js.map +1 -1
  25. package/package.json +14 -67
  26. package/dist/ExecutionTree.d.ts +0 -20
  27. package/dist/ExecutionTree.d.ts.map +0 -1
  28. package/dist/ExecutionTree.js +0 -100
  29. package/dist/ExecutionTree.js.map +0 -1
  30. package/dist/affected/affected.d.ts +0 -48
  31. package/dist/affected/affected.d.ts.map +0 -1
  32. package/dist/affected/affected.js +0 -167
  33. package/dist/affected/affected.js.map +0 -1
  34. package/dist/agent-toolbelt.d.ts +0 -15
  35. package/dist/agent-toolbelt.d.ts.map +0 -1
  36. package/dist/agent-toolbelt.js +0 -28
  37. package/dist/agent-toolbelt.js.map +0 -1
  38. package/dist/api-client.d.ts +0 -12
  39. package/dist/api-client.d.ts.map +0 -1
  40. package/dist/api-client.js +0 -21
  41. package/dist/api-client.js.map +0 -1
  42. package/dist/app-build/bundle.d.ts +0 -15
  43. package/dist/app-build/bundle.d.ts.map +0 -1
  44. package/dist/app-build/bundle.js +0 -45
  45. package/dist/app-build/bundle.js.map +0 -1
  46. package/dist/app-build/watch.d.ts +0 -13
  47. package/dist/app-build/watch.d.ts.map +0 -1
  48. package/dist/app-build/watch.js +0 -25
  49. package/dist/app-build/watch.js.map +0 -1
  50. package/dist/app-debug/app-target.d.ts +0 -14
  51. package/dist/app-debug/app-target.d.ts.map +0 -1
  52. package/dist/app-debug/app-target.js +0 -120
  53. package/dist/app-debug/app-target.js.map +0 -1
  54. package/dist/app-debug/harness.d.ts +0 -29
  55. package/dist/app-debug/harness.d.ts.map +0 -1
  56. package/dist/app-debug/harness.js +0 -116
  57. package/dist/app-debug/harness.js.map +0 -1
  58. package/dist/app-debug/index.d.ts +0 -12
  59. package/dist/app-debug/index.d.ts.map +0 -1
  60. package/dist/app-debug/index.js +0 -9
  61. package/dist/app-debug/index.js.map +0 -1
  62. package/dist/app.d.ts +0 -40
  63. package/dist/app.d.ts.map +0 -1
  64. package/dist/app.js +0 -1070
  65. package/dist/app.js.map +0 -1
  66. package/dist/bash-tool.d.ts +0 -13
  67. package/dist/bash-tool.d.ts.map +0 -1
  68. package/dist/bash-tool.js +0 -85
  69. package/dist/bash-tool.js.map +0 -1
  70. package/dist/chat-codeact.d.ts +0 -93
  71. package/dist/chat-codeact.d.ts.map +0 -1
  72. package/dist/chat-codeact.js +0 -179
  73. package/dist/chat-codeact.js.map +0 -1
  74. package/dist/chat-context.d.ts +0 -18
  75. package/dist/chat-context.d.ts.map +0 -1
  76. package/dist/chat-context.js +0 -32
  77. package/dist/chat-context.js.map +0 -1
  78. package/dist/chat-media.d.ts +0 -3
  79. package/dist/chat-media.d.ts.map +0 -1
  80. package/dist/chat-media.js +0 -46
  81. package/dist/chat-media.js.map +0 -1
  82. package/dist/chat-prompts.d.ts +0 -20
  83. package/dist/chat-prompts.d.ts.map +0 -1
  84. package/dist/chat-prompts.js +0 -42
  85. package/dist/chat-prompts.js.map +0 -1
  86. package/dist/chat-sessions.d.ts +0 -25
  87. package/dist/chat-sessions.d.ts.map +0 -1
  88. package/dist/chat-sessions.js +0 -153
  89. package/dist/chat-sessions.js.map +0 -1
  90. package/dist/child-exit.d.ts +0 -3
  91. package/dist/child-exit.d.ts.map +0 -1
  92. package/dist/child-exit.js +0 -17
  93. package/dist/child-exit.js.map +0 -1
  94. package/dist/command-errors.d.ts +0 -8
  95. package/dist/command-errors.d.ts.map +0 -1
  96. package/dist/command-errors.js +0 -49
  97. package/dist/command-errors.js.map +0 -1
  98. package/dist/commands/__tests__/jtbd.test.d.ts +0 -2
  99. package/dist/commands/__tests__/jtbd.test.d.ts.map +0 -1
  100. package/dist/commands/__tests__/jtbd.test.js +0 -120
  101. package/dist/commands/__tests__/jtbd.test.js.map +0 -1
  102. package/dist/commands/__tests__/runtime.test.d.ts +0 -2
  103. package/dist/commands/__tests__/runtime.test.d.ts.map +0 -1
  104. package/dist/commands/__tests__/runtime.test.js +0 -129
  105. package/dist/commands/__tests__/runtime.test.js.map +0 -1
  106. package/dist/commands/__tests__/timeline-render-audio.test.d.ts +0 -2
  107. package/dist/commands/__tests__/timeline-render-audio.test.d.ts.map +0 -1
  108. package/dist/commands/__tests__/timeline-render-audio.test.js +0 -53
  109. package/dist/commands/__tests__/timeline-render-audio.test.js.map +0 -1
  110. package/dist/commands/__tests__/timeline-render-completeness.test.d.ts +0 -2
  111. package/dist/commands/__tests__/timeline-render-completeness.test.d.ts.map +0 -1
  112. package/dist/commands/__tests__/timeline-render-completeness.test.js +0 -117
  113. package/dist/commands/__tests__/timeline-render-completeness.test.js.map +0 -1
  114. package/dist/commands/__tests__/timeline-render.test.d.ts +0 -2
  115. package/dist/commands/__tests__/timeline-render.test.d.ts.map +0 -1
  116. package/dist/commands/__tests__/timeline-render.test.js +0 -115
  117. package/dist/commands/__tests__/timeline-render.test.js.map +0 -1
  118. package/dist/commands/__tests__/timeline-score.test.d.ts +0 -2
  119. package/dist/commands/__tests__/timeline-score.test.d.ts.map +0 -1
  120. package/dist/commands/__tests__/timeline-score.test.js +0 -100
  121. package/dist/commands/__tests__/timeline-score.test.js.map +0 -1
  122. package/dist/commands/affected.d.ts +0 -9
  123. package/dist/commands/affected.d.ts.map +0 -1
  124. package/dist/commands/affected.js +0 -127
  125. package/dist/commands/affected.js.map +0 -1
  126. package/dist/commands/agent.d.ts +0 -33
  127. package/dist/commands/agent.d.ts.map +0 -1
  128. package/dist/commands/agent.js +0 -514
  129. package/dist/commands/agent.js.map +0 -1
  130. package/dist/commands/app.d.ts +0 -3
  131. package/dist/commands/app.d.ts.map +0 -1
  132. package/dist/commands/app.js +0 -406
  133. package/dist/commands/app.js.map +0 -1
  134. package/dist/commands/apps.d.ts +0 -15
  135. package/dist/commands/apps.d.ts.map +0 -1
  136. package/dist/commands/apps.js +0 -274
  137. package/dist/commands/apps.js.map +0 -1
  138. package/dist/commands/auth.d.ts +0 -12
  139. package/dist/commands/auth.d.ts.map +0 -1
  140. package/dist/commands/auth.js +0 -154
  141. package/dist/commands/auth.js.map +0 -1
  142. package/dist/commands/authorized-pack-install.d.ts +0 -7
  143. package/dist/commands/authorized-pack-install.d.ts.map +0 -1
  144. package/dist/commands/authorized-pack-install.js +0 -20
  145. package/dist/commands/authorized-pack-install.js.map +0 -1
  146. package/dist/commands/collections.d.ts +0 -10
  147. package/dist/commands/collections.d.ts.map +0 -1
  148. package/dist/commands/collections.js +0 -257
  149. package/dist/commands/collections.js.map +0 -1
  150. package/dist/commands/costs.d.ts +0 -15
  151. package/dist/commands/costs.d.ts.map +0 -1
  152. package/dist/commands/costs.js +0 -201
  153. package/dist/commands/costs.js.map +0 -1
  154. package/dist/commands/db.d.ts +0 -3
  155. package/dist/commands/db.d.ts.map +0 -1
  156. package/dist/commands/db.js +0 -176
  157. package/dist/commands/db.js.map +0 -1
  158. package/dist/commands/debug-summary-output.d.ts +0 -22
  159. package/dist/commands/debug-summary-output.d.ts.map +0 -1
  160. package/dist/commands/debug-summary-output.js +0 -28
  161. package/dist/commands/debug-summary-output.js.map +0 -1
  162. package/dist/commands/debug.d.ts +0 -13
  163. package/dist/commands/debug.d.ts.map +0 -1
  164. package/dist/commands/debug.js +0 -150
  165. package/dist/commands/debug.js.map +0 -1
  166. package/dist/commands/deploy-helpers.d.ts +0 -85
  167. package/dist/commands/deploy-helpers.d.ts.map +0 -1
  168. package/dist/commands/deploy-helpers.js +0 -217
  169. package/dist/commands/deploy-helpers.js.map +0 -1
  170. package/dist/commands/deploy.d.ts +0 -7
  171. package/dist/commands/deploy.d.ts.map +0 -1
  172. package/dist/commands/deploy.js +0 -449
  173. package/dist/commands/deploy.js.map +0 -1
  174. package/dist/commands/errors.d.ts +0 -11
  175. package/dist/commands/errors.d.ts.map +0 -1
  176. package/dist/commands/errors.js +0 -177
  177. package/dist/commands/errors.js.map +0 -1
  178. package/dist/commands/eval.d.ts +0 -152
  179. package/dist/commands/eval.d.ts.map +0 -1
  180. package/dist/commands/eval.js +0 -691
  181. package/dist/commands/eval.js.map +0 -1
  182. package/dist/commands/extension.d.ts +0 -12
  183. package/dist/commands/extension.d.ts.map +0 -1
  184. package/dist/commands/extension.js +0 -30
  185. package/dist/commands/extension.js.map +0 -1
  186. package/dist/commands/game-benchmark.d.ts +0 -48
  187. package/dist/commands/game-benchmark.d.ts.map +0 -1
  188. package/dist/commands/game-benchmark.js +0 -108
  189. package/dist/commands/game-benchmark.js.map +0 -1
  190. package/dist/commands/game-smoke.d.ts +0 -3
  191. package/dist/commands/game-smoke.d.ts.map +0 -1
  192. package/dist/commands/game-smoke.js +0 -23
  193. package/dist/commands/game-smoke.js.map +0 -1
  194. package/dist/commands/game.d.ts +0 -4
  195. package/dist/commands/game.d.ts.map +0 -1
  196. package/dist/commands/game.js +0 -856
  197. package/dist/commands/game.js.map +0 -1
  198. package/dist/commands/generate.d.ts +0 -17
  199. package/dist/commands/generate.d.ts.map +0 -1
  200. package/dist/commands/generate.js +0 -326
  201. package/dist/commands/generate.js.map +0 -1
  202. package/dist/commands/generations.d.ts +0 -17
  203. package/dist/commands/generations.d.ts.map +0 -1
  204. package/dist/commands/generations.js +0 -408
  205. package/dist/commands/generations.js.map +0 -1
  206. package/dist/commands/harness.d.ts +0 -90
  207. package/dist/commands/harness.d.ts.map +0 -1
  208. package/dist/commands/harness.js +0 -855
  209. package/dist/commands/harness.js.map +0 -1
  210. package/dist/commands/install-missing-packs.d.ts +0 -21
  211. package/dist/commands/install-missing-packs.d.ts.map +0 -1
  212. package/dist/commands/install-missing-packs.js +0 -48
  213. package/dist/commands/install-missing-packs.js.map +0 -1
  214. package/dist/commands/js-script-validation-output.d.ts +0 -7
  215. package/dist/commands/js-script-validation-output.d.ts.map +0 -1
  216. package/dist/commands/js-script-validation-output.js +0 -5
  217. package/dist/commands/js-script-validation-output.js.map +0 -1
  218. package/dist/commands/js-script-versions.d.ts +0 -53
  219. package/dist/commands/js-script-versions.d.ts.map +0 -1
  220. package/dist/commands/js-script-versions.js +0 -89
  221. package/dist/commands/js-script-versions.js.map +0 -1
  222. package/dist/commands/js-script.d.ts +0 -29
  223. package/dist/commands/js-script.d.ts.map +0 -1
  224. package/dist/commands/js-script.js +0 -240
  225. package/dist/commands/js-script.js.map +0 -1
  226. package/dist/commands/jtbd.d.ts +0 -38
  227. package/dist/commands/jtbd.d.ts.map +0 -1
  228. package/dist/commands/jtbd.js +0 -261
  229. package/dist/commands/jtbd.js.map +0 -1
  230. package/dist/commands/local-db.d.ts +0 -16
  231. package/dist/commands/local-db.d.ts.map +0 -1
  232. package/dist/commands/local-db.js +0 -33
  233. package/dist/commands/local-db.js.map +0 -1
  234. package/dist/commands/mcp.d.ts +0 -21
  235. package/dist/commands/mcp.d.ts.map +0 -1
  236. package/dist/commands/mcp.js +0 -166
  237. package/dist/commands/mcp.js.map +0 -1
  238. package/dist/commands/migrate-code-inputs.d.ts +0 -24
  239. package/dist/commands/migrate-code-inputs.d.ts.map +0 -1
  240. package/dist/commands/migrate-code-inputs.js +0 -120
  241. package/dist/commands/migrate-code-inputs.js.map +0 -1
  242. package/dist/commands/models-hf.d.ts +0 -9
  243. package/dist/commands/models-hf.d.ts.map +0 -1
  244. package/dist/commands/models-hf.js +0 -235
  245. package/dist/commands/models-hf.js.map +0 -1
  246. package/dist/commands/models-recommended.d.ts +0 -10
  247. package/dist/commands/models-recommended.d.ts.map +0 -1
  248. package/dist/commands/models-recommended.js +0 -120
  249. package/dist/commands/models-recommended.js.map +0 -1
  250. package/dist/commands/node.d.ts +0 -10
  251. package/dist/commands/node.d.ts.map +0 -1
  252. package/dist/commands/node.js +0 -130
  253. package/dist/commands/node.js.map +0 -1
  254. package/dist/commands/output.d.ts +0 -32
  255. package/dist/commands/output.d.ts.map +0 -1
  256. package/dist/commands/output.js +0 -150
  257. package/dist/commands/output.js.map +0 -1
  258. package/dist/commands/pack-install-authorization.d.ts +0 -40
  259. package/dist/commands/pack-install-authorization.d.ts.map +0 -1
  260. package/dist/commands/pack-install-authorization.js +0 -131
  261. package/dist/commands/pack-install-authorization.js.map +0 -1
  262. package/dist/commands/pack-management.d.ts +0 -26
  263. package/dist/commands/pack-management.d.ts.map +0 -1
  264. package/dist/commands/pack-management.js +0 -74
  265. package/dist/commands/pack-management.js.map +0 -1
  266. package/dist/commands/package-helpers.d.ts +0 -8
  267. package/dist/commands/package-helpers.d.ts.map +0 -1
  268. package/dist/commands/package-helpers.js +0 -53
  269. package/dist/commands/package-helpers.js.map +0 -1
  270. package/dist/commands/package.d.ts +0 -3
  271. package/dist/commands/package.d.ts.map +0 -1
  272. package/dist/commands/package.js +0 -258
  273. package/dist/commands/package.js.map +0 -1
  274. package/dist/commands/packs.d.ts +0 -14
  275. package/dist/commands/packs.d.ts.map +0 -1
  276. package/dist/commands/packs.js +0 -65
  277. package/dist/commands/packs.js.map +0 -1
  278. package/dist/commands/projects.d.ts +0 -11
  279. package/dist/commands/projects.d.ts.map +0 -1
  280. package/dist/commands/projects.js +0 -145
  281. package/dist/commands/projects.js.map +0 -1
  282. package/dist/commands/reliability.d.ts +0 -14
  283. package/dist/commands/reliability.d.ts.map +0 -1
  284. package/dist/commands/reliability.js +0 -80
  285. package/dist/commands/reliability.js.map +0 -1
  286. package/dist/commands/resource-read.d.ts +0 -28
  287. package/dist/commands/resource-read.d.ts.map +0 -1
  288. package/dist/commands/resource-read.js +0 -314
  289. package/dist/commands/resource-read.js.map +0 -1
  290. package/dist/commands/runs.d.ts +0 -7
  291. package/dist/commands/runs.d.ts.map +0 -1
  292. package/dist/commands/runs.js +0 -302
  293. package/dist/commands/runs.js.map +0 -1
  294. package/dist/commands/runtime.d.ts +0 -3
  295. package/dist/commands/runtime.d.ts.map +0 -1
  296. package/dist/commands/runtime.js +0 -169
  297. package/dist/commands/runtime.js.map +0 -1
  298. package/dist/commands/sketch-render.d.ts +0 -46
  299. package/dist/commands/sketch-render.d.ts.map +0 -1
  300. package/dist/commands/sketch-render.js +0 -131
  301. package/dist/commands/sketch-render.js.map +0 -1
  302. package/dist/commands/sketch-validation-output.d.ts +0 -7
  303. package/dist/commands/sketch-validation-output.d.ts.map +0 -1
  304. package/dist/commands/sketch-validation-output.js +0 -5
  305. package/dist/commands/sketch-validation-output.js.map +0 -1
  306. package/dist/commands/sketch-versions.d.ts +0 -66
  307. package/dist/commands/sketch-versions.d.ts.map +0 -1
  308. package/dist/commands/sketch-versions.js +0 -108
  309. package/dist/commands/sketch-versions.js.map +0 -1
  310. package/dist/commands/sketch.d.ts +0 -22
  311. package/dist/commands/sketch.d.ts.map +0 -1
  312. package/dist/commands/sketch.js +0 -101
  313. package/dist/commands/sketch.js.map +0 -1
  314. package/dist/commands/storage.d.ts +0 -24
  315. package/dist/commands/storage.d.ts.map +0 -1
  316. package/dist/commands/storage.js +0 -112
  317. package/dist/commands/storage.js.map +0 -1
  318. package/dist/commands/telegram.d.ts +0 -11
  319. package/dist/commands/telegram.d.ts.map +0 -1
  320. package/dist/commands/telegram.js +0 -66
  321. package/dist/commands/telegram.js.map +0 -1
  322. package/dist/commands/telemetry.d.ts +0 -24
  323. package/dist/commands/telemetry.d.ts.map +0 -1
  324. package/dist/commands/telemetry.js +0 -116
  325. package/dist/commands/telemetry.js.map +0 -1
  326. package/dist/commands/timeline-render.d.ts +0 -75
  327. package/dist/commands/timeline-render.d.ts.map +0 -1
  328. package/dist/commands/timeline-render.js +0 -465
  329. package/dist/commands/timeline-render.js.map +0 -1
  330. package/dist/commands/timeline-score.d.ts +0 -16
  331. package/dist/commands/timeline-score.d.ts.map +0 -1
  332. package/dist/commands/timeline-score.js +0 -89
  333. package/dist/commands/timeline-score.js.map +0 -1
  334. package/dist/commands/timeline-validation-output.d.ts +0 -7
  335. package/dist/commands/timeline-validation-output.d.ts.map +0 -1
  336. package/dist/commands/timeline-validation-output.js +0 -9
  337. package/dist/commands/timeline-validation-output.js.map +0 -1
  338. package/dist/commands/timeline-versions.d.ts +0 -72
  339. package/dist/commands/timeline-versions.d.ts.map +0 -1
  340. package/dist/commands/timeline-versions.js +0 -108
  341. package/dist/commands/timeline-versions.js.map +0 -1
  342. package/dist/commands/timeline.d.ts +0 -22
  343. package/dist/commands/timeline.d.ts.map +0 -1
  344. package/dist/commands/timeline.js +0 -103
  345. package/dist/commands/timeline.js.map +0 -1
  346. package/dist/commands/tools.d.ts +0 -11
  347. package/dist/commands/tools.d.ts.map +0 -1
  348. package/dist/commands/tools.js +0 -206
  349. package/dist/commands/tools.js.map +0 -1
  350. package/dist/commands/validate.d.ts +0 -24
  351. package/dist/commands/validate.d.ts.map +0 -1
  352. package/dist/commands/validate.js +0 -132
  353. package/dist/commands/validate.js.map +0 -1
  354. package/dist/commands/validation-output.d.ts +0 -25
  355. package/dist/commands/validation-output.d.ts.map +0 -1
  356. package/dist/commands/validation-output.js +0 -29
  357. package/dist/commands/validation-output.js.map +0 -1
  358. package/dist/commands/version-commands.d.ts +0 -91
  359. package/dist/commands/version-commands.d.ts.map +0 -1
  360. package/dist/commands/version-commands.js +0 -222
  361. package/dist/commands/version-commands.js.map +0 -1
  362. package/dist/commands/worker-models.d.ts +0 -13
  363. package/dist/commands/worker-models.d.ts.map +0 -1
  364. package/dist/commands/worker-models.js +0 -207
  365. package/dist/commands/worker-models.js.map +0 -1
  366. package/dist/commands/worker.d.ts +0 -23
  367. package/dist/commands/worker.d.ts.map +0 -1
  368. package/dist/commands/worker.js +0 -374
  369. package/dist/commands/worker.js.map +0 -1
  370. package/dist/debug/browser-runner.d.ts +0 -21
  371. package/dist/debug/browser-runner.d.ts.map +0 -1
  372. package/dist/debug/browser-runner.js +0 -196
  373. package/dist/debug/browser-runner.js.map +0 -1
  374. package/dist/debug/collector.d.ts +0 -9
  375. package/dist/debug/collector.d.ts.map +0 -1
  376. package/dist/debug/collector.js +0 -9
  377. package/dist/debug/collector.js.map +0 -1
  378. package/dist/debug/diff.d.ts +0 -48
  379. package/dist/debug/diff.d.ts.map +0 -1
  380. package/dist/debug/diff.js +0 -68
  381. package/dist/debug/diff.js.map +0 -1
  382. package/dist/debug/harness.d.ts +0 -11
  383. package/dist/debug/harness.d.ts.map +0 -1
  384. package/dist/debug/harness.js +0 -103
  385. package/dist/debug/harness.js.map +0 -1
  386. package/dist/debug/index.d.ts +0 -17
  387. package/dist/debug/index.d.ts.map +0 -1
  388. package/dist/debug/index.js +0 -16
  389. package/dist/debug/index.js.map +0 -1
  390. package/dist/debug/markdown.d.ts +0 -3
  391. package/dist/debug/markdown.d.ts.map +0 -1
  392. package/dist/debug/markdown.js +0 -127
  393. package/dist/debug/markdown.js.map +0 -1
  394. package/dist/debug/server-runner.d.ts +0 -24
  395. package/dist/debug/server-runner.d.ts.map +0 -1
  396. package/dist/debug/server-runner.js +0 -211
  397. package/dist/debug/server-runner.js.map +0 -1
  398. package/dist/debug/target.d.ts +0 -34
  399. package/dist/debug/target.d.ts.map +0 -1
  400. package/dist/debug/target.js +0 -95
  401. package/dist/debug/target.js.map +0 -1
  402. package/dist/debug/trace.d.ts +0 -30
  403. package/dist/debug/trace.d.ts.map +0 -1
  404. package/dist/debug/trace.js +0 -87
  405. package/dist/debug/trace.js.map +0 -1
  406. package/dist/debug/types.d.ts +0 -82
  407. package/dist/debug/types.d.ts.map +0 -1
  408. package/dist/debug/types.js +0 -13
  409. package/dist/debug/types.js.map +0 -1
  410. package/dist/debug/verdict.d.ts +0 -3
  411. package/dist/debug/verdict.d.ts.map +0 -1
  412. package/dist/debug/verdict.js +0 -78
  413. package/dist/debug/verdict.js.map +0 -1
  414. package/dist/debug/watch.d.ts +0 -23
  415. package/dist/debug/watch.d.ts.map +0 -1
  416. package/dist/debug/watch.js +0 -68
  417. package/dist/debug/watch.js.map +0 -1
  418. package/dist/debug-bundle.d.ts +0 -12
  419. package/dist/debug-bundle.d.ts.map +0 -1
  420. package/dist/debug-bundle.js +0 -23
  421. package/dist/debug-bundle.js.map +0 -1
  422. package/dist/diagnose.d.ts +0 -139
  423. package/dist/diagnose.d.ts.map +0 -1
  424. package/dist/diagnose.js +0 -418
  425. package/dist/diagnose.js.map +0 -1
  426. package/dist/document-json.d.ts +0 -11
  427. package/dist/document-json.d.ts.map +0 -1
  428. package/dist/document-json.js +0 -27
  429. package/dist/document-json.js.map +0 -1
  430. package/dist/evals/graph-runner.d.ts +0 -8
  431. package/dist/evals/graph-runner.d.ts.map +0 -1
  432. package/dist/evals/graph-runner.js +0 -136
  433. package/dist/evals/graph-runner.js.map +0 -1
  434. package/dist/harness/capability-coverage.d.ts +0 -161
  435. package/dist/harness/capability-coverage.d.ts.map +0 -1
  436. package/dist/harness/capability-coverage.js +0 -266
  437. package/dist/harness/capability-coverage.js.map +0 -1
  438. package/dist/harness/capability-table.d.ts +0 -17
  439. package/dist/harness/capability-table.d.ts.map +0 -1
  440. package/dist/harness/capability-table.js +0 -3925
  441. package/dist/harness/capability-table.js.map +0 -1
  442. package/dist/harness/changed-files.d.ts +0 -20
  443. package/dist/harness/changed-files.d.ts.map +0 -1
  444. package/dist/harness/changed-files.js +0 -90
  445. package/dist/harness/changed-files.js.map +0 -1
  446. package/dist/harness/declared-capabilities.d.ts +0 -12
  447. package/dist/harness/declared-capabilities.d.ts.map +0 -1
  448. package/dist/harness/declared-capabilities.js +0 -21
  449. package/dist/harness/declared-capabilities.js.map +0 -1
  450. package/dist/harness/registry.d.ts +0 -190
  451. package/dist/harness/registry.d.ts.map +0 -1
  452. package/dist/harness/registry.js +0 -2285
  453. package/dist/harness/registry.js.map +0 -1
  454. package/dist/install-lock.d.ts +0 -12
  455. package/dist/install-lock.d.ts.map +0 -1
  456. package/dist/install-lock.js +0 -139
  457. package/dist/install-lock.js.map +0 -1
  458. package/dist/interaction-script.d.ts +0 -40
  459. package/dist/interaction-script.d.ts.map +0 -1
  460. package/dist/interaction-script.js +0 -104
  461. package/dist/interaction-script.js.map +0 -1
  462. package/dist/js-script-debug/harness.d.ts +0 -146
  463. package/dist/js-script-debug/harness.d.ts.map +0 -1
  464. package/dist/js-script-debug/harness.js +0 -220
  465. package/dist/js-script-debug/harness.js.map +0 -1
  466. package/dist/js-script-debug/index.d.ts +0 -9
  467. package/dist/js-script-debug/index.d.ts.map +0 -1
  468. package/dist/js-script-debug/index.js +0 -9
  469. package/dist/js-script-debug/index.js.map +0 -1
  470. package/dist/js-script-debug/interactions.d.ts +0 -19
  471. package/dist/js-script-debug/interactions.d.ts.map +0 -1
  472. package/dist/js-script-debug/interactions.js +0 -17
  473. package/dist/js-script-debug/interactions.js.map +0 -1
  474. package/dist/js-script-debug/target.d.ts +0 -20
  475. package/dist/js-script-debug/target.d.ts.map +0 -1
  476. package/dist/js-script-debug/target.js +0 -55
  477. package/dist/js-script-debug/target.js.map +0 -1
  478. package/dist/local-model-interfaces.d.ts +0 -20
  479. package/dist/local-model-interfaces.d.ts.map +0 -1
  480. package/dist/local-model-interfaces.js +0 -41
  481. package/dist/local-model-interfaces.js.map +0 -1
  482. package/dist/local-secrets.d.ts +0 -3
  483. package/dist/local-secrets.d.ts.map +0 -1
  484. package/dist/local-secrets.js +0 -16
  485. package/dist/local-secrets.js.map +0 -1
  486. package/dist/markdown.d.ts +0 -9
  487. package/dist/markdown.d.ts.map +0 -1
  488. package/dist/markdown.js +0 -53
  489. package/dist/markdown.js.map +0 -1
  490. package/dist/node/run-node.d.ts +0 -31
  491. package/dist/node/run-node.d.ts.map +0 -1
  492. package/dist/node/run-node.js +0 -92
  493. package/dist/node/run-node.js.map +0 -1
  494. package/dist/node-registry.d.ts +0 -29
  495. package/dist/node-registry.d.ts.map +0 -1
  496. package/dist/node-registry.js +0 -38
  497. package/dist/node-registry.js.map +0 -1
  498. package/dist/nodetool-main.d.ts +0 -15
  499. package/dist/nodetool-main.d.ts.map +0 -1
  500. package/dist/nodetool-main.js +0 -1456
  501. package/dist/nodetool-main.js.map +0 -1
  502. package/dist/npm-runner.d.ts +0 -23
  503. package/dist/npm-runner.d.ts.map +0 -1
  504. package/dist/npm-runner.js +0 -160
  505. package/dist/npm-runner.js.map +0 -1
  506. package/dist/numeric-options.d.ts +0 -22
  507. package/dist/numeric-options.d.ts.map +0 -1
  508. package/dist/numeric-options.js +0 -45
  509. package/dist/numeric-options.js.map +0 -1
  510. package/dist/optional-node-root.d.ts +0 -10
  511. package/dist/optional-node-root.d.ts.map +0 -1
  512. package/dist/optional-node-root.js +0 -26
  513. package/dist/optional-node-root.js.map +0 -1
  514. package/dist/package-assets.d.ts +0 -8
  515. package/dist/package-assets.d.ts.map +0 -1
  516. package/dist/package-assets.js +0 -21
  517. package/dist/package-assets.js.map +0 -1
  518. package/dist/packs/command-service.d.ts +0 -14
  519. package/dist/packs/command-service.d.ts.map +0 -1
  520. package/dist/packs/command-service.js +0 -195
  521. package/dist/packs/command-service.js.map +0 -1
  522. package/dist/packs/doctor-lock.d.ts +0 -8
  523. package/dist/packs/doctor-lock.d.ts.map +0 -1
  524. package/dist/packs/doctor-lock.js +0 -50
  525. package/dist/packs/doctor-lock.js.map +0 -1
  526. package/dist/packs/doctor.d.ts +0 -25
  527. package/dist/packs/doctor.d.ts.map +0 -1
  528. package/dist/packs/doctor.js +0 -12
  529. package/dist/packs/doctor.js.map +0 -1
  530. package/dist/packs/global-bootstrap.d.ts +0 -11
  531. package/dist/packs/global-bootstrap.d.ts.map +0 -1
  532. package/dist/packs/global-bootstrap.js +0 -72
  533. package/dist/packs/global-bootstrap.js.map +0 -1
  534. package/dist/packs/host.d.ts +0 -17
  535. package/dist/packs/host.d.ts.map +0 -1
  536. package/dist/packs/host.js +0 -79
  537. package/dist/packs/host.js.map +0 -1
  538. package/dist/packs/install-manifests.d.ts +0 -2
  539. package/dist/packs/install-manifests.d.ts.map +0 -1
  540. package/dist/packs/install-manifests.js +0 -30
  541. package/dist/packs/install-manifests.js.map +0 -1
  542. package/dist/packs/install-process.d.ts +0 -4
  543. package/dist/packs/install-process.d.ts.map +0 -1
  544. package/dist/packs/install-process.js +0 -11
  545. package/dist/packs/install-process.js.map +0 -1
  546. package/dist/packs/install-selection.d.ts +0 -39
  547. package/dist/packs/install-selection.d.ts.map +0 -1
  548. package/dist/packs/install-selection.js +0 -67
  549. package/dist/packs/install-selection.js.map +0 -1
  550. package/dist/packs/install-state.d.ts +0 -21
  551. package/dist/packs/install-state.d.ts.map +0 -1
  552. package/dist/packs/install-state.js +0 -44
  553. package/dist/packs/install-state.js.map +0 -1
  554. package/dist/packs/install-tree.d.ts +0 -35
  555. package/dist/packs/install-tree.d.ts.map +0 -1
  556. package/dist/packs/install-tree.js +0 -253
  557. package/dist/packs/install-tree.js.map +0 -1
  558. package/dist/packs/install-verification.d.ts +0 -12
  559. package/dist/packs/install-verification.d.ts.map +0 -1
  560. package/dist/packs/install-verification.js +0 -76
  561. package/dist/packs/install-verification.js.map +0 -1
  562. package/dist/packs/installed.d.ts +0 -36
  563. package/dist/packs/installed.d.ts.map +0 -1
  564. package/dist/packs/installed.js +0 -87
  565. package/dist/packs/installed.js.map +0 -1
  566. package/dist/packs/installer-load-check.d.ts +0 -4
  567. package/dist/packs/installer-load-check.d.ts.map +0 -1
  568. package/dist/packs/installer-load-check.js +0 -52
  569. package/dist/packs/installer-load-check.js.map +0 -1
  570. package/dist/packs/installer.d.ts +0 -16
  571. package/dist/packs/installer.d.ts.map +0 -1
  572. package/dist/packs/installer.js +0 -142
  573. package/dist/packs/installer.js.map +0 -1
  574. package/dist/packs/management.d.ts +0 -51
  575. package/dist/packs/management.d.ts.map +0 -1
  576. package/dist/packs/management.js +0 -81
  577. package/dist/packs/management.js.map +0 -1
  578. package/dist/packs/mode.d.ts +0 -42
  579. package/dist/packs/mode.d.ts.map +0 -1
  580. package/dist/packs/mode.js +0 -215
  581. package/dist/packs/mode.js.map +0 -1
  582. package/dist/packs/owned-replay-plan.d.ts +0 -5
  583. package/dist/packs/owned-replay-plan.d.ts.map +0 -1
  584. package/dist/packs/owned-replay-plan.js +0 -68
  585. package/dist/packs/owned-replay-plan.js.map +0 -1
  586. package/dist/packs/removal-selection.d.ts +0 -12
  587. package/dist/packs/removal-selection.d.ts.map +0 -1
  588. package/dist/packs/removal-selection.js +0 -169
  589. package/dist/packs/removal-selection.js.map +0 -1
  590. package/dist/packs/removal.d.ts +0 -12
  591. package/dist/packs/removal.d.ts.map +0 -1
  592. package/dist/packs/removal.js +0 -138
  593. package/dist/packs/removal.js.map +0 -1
  594. package/dist/packs/repair.d.ts +0 -2
  595. package/dist/packs/repair.d.ts.map +0 -1
  596. package/dist/packs/repair.js +0 -2
  597. package/dist/packs/repair.js.map +0 -1
  598. package/dist/packs/serve.d.ts +0 -2
  599. package/dist/packs/serve.d.ts.map +0 -1
  600. package/dist/packs/serve.js +0 -14
  601. package/dist/packs/serve.js.map +0 -1
  602. package/dist/permission-gate.d.ts +0 -55
  603. package/dist/permission-gate.d.ts.map +0 -1
  604. package/dist/permission-gate.js +0 -118
  605. package/dist/permission-gate.js.map +0 -1
  606. package/dist/predicates.d.ts +0 -6
  607. package/dist/predicates.d.ts.map +0 -1
  608. package/dist/predicates.js +0 -6
  609. package/dist/predicates.js.map +0 -1
  610. package/dist/providers.d.ts +0 -117
  611. package/dist/providers.d.ts.map +0 -1
  612. package/dist/providers.js +0 -491
  613. package/dist/providers.js.map +0 -1
  614. package/dist/readline-input.d.ts +0 -23
  615. package/dist/readline-input.d.ts.map +0 -1
  616. package/dist/readline-input.js +0 -210
  617. package/dist/readline-input.js.map +0 -1
  618. package/dist/run-budget.d.ts +0 -40
  619. package/dist/run-budget.d.ts.map +0 -1
  620. package/dist/run-budget.js +0 -119
  621. package/dist/run-budget.js.map +0 -1
  622. package/dist/run-dsl-supervised.d.ts +0 -11
  623. package/dist/run-dsl-supervised.d.ts.map +0 -1
  624. package/dist/run-dsl-supervised.js +0 -89
  625. package/dist/run-dsl-supervised.js.map +0 -1
  626. package/dist/run-dsl.d.ts +0 -40
  627. package/dist/run-dsl.d.ts.map +0 -1
  628. package/dist/run-dsl.js +0 -65
  629. package/dist/run-dsl.js.map +0 -1
  630. package/dist/run-json.d.ts +0 -24
  631. package/dist/run-json.d.ts.map +0 -1
  632. package/dist/run-json.js +0 -132
  633. package/dist/run-json.js.map +0 -1
  634. package/dist/runtime-env.d.ts +0 -4
  635. package/dist/runtime-env.d.ts.map +0 -1
  636. package/dist/runtime-env.js +0 -31
  637. package/dist/runtime-env.js.map +0 -1
  638. package/dist/sandbox-catalog.d.ts +0 -26
  639. package/dist/sandbox-catalog.d.ts.map +0 -1
  640. package/dist/sandbox-catalog.js +0 -83
  641. package/dist/sandbox-catalog.js.map +0 -1
  642. package/dist/settings.d.ts +0 -19
  643. package/dist/settings.d.ts.map +0 -1
  644. package/dist/settings.js +0 -146
  645. package/dist/settings.js.map +0 -1
  646. package/dist/sketch-debug/harness.d.ts +0 -101
  647. package/dist/sketch-debug/harness.d.ts.map +0 -1
  648. package/dist/sketch-debug/harness.js +0 -118
  649. package/dist/sketch-debug/harness.js.map +0 -1
  650. package/dist/sketch-debug/index.d.ts +0 -9
  651. package/dist/sketch-debug/index.d.ts.map +0 -1
  652. package/dist/sketch-debug/index.js +0 -9
  653. package/dist/sketch-debug/index.js.map +0 -1
  654. package/dist/sketch-debug/interactions.d.ts +0 -19
  655. package/dist/sketch-debug/interactions.d.ts.map +0 -1
  656. package/dist/sketch-debug/interactions.js +0 -17
  657. package/dist/sketch-debug/interactions.js.map +0 -1
  658. package/dist/sketch-debug/target.d.ts +0 -48
  659. package/dist/sketch-debug/target.d.ts.map +0 -1
  660. package/dist/sketch-debug/target.js +0 -115
  661. package/dist/sketch-debug/target.js.map +0 -1
  662. package/dist/stdin.d.ts +0 -52
  663. package/dist/stdin.d.ts.map +0 -1
  664. package/dist/stdin.js +0 -363
  665. package/dist/stdin.js.map +0 -1
  666. package/dist/supervisor.d.ts +0 -97
  667. package/dist/supervisor.d.ts.map +0 -1
  668. package/dist/supervisor.js +0 -194
  669. package/dist/supervisor.js.map +0 -1
  670. package/dist/telemetry.d.ts +0 -38
  671. package/dist/telemetry.d.ts.map +0 -1
  672. package/dist/telemetry.js +0 -158
  673. package/dist/telemetry.js.map +0 -1
  674. package/dist/terminal-clipboard.d.ts +0 -3
  675. package/dist/terminal-clipboard.d.ts.map +0 -1
  676. package/dist/terminal-clipboard.js +0 -24
  677. package/dist/terminal-clipboard.js.map +0 -1
  678. package/dist/terminal-mouse.d.ts +0 -24
  679. package/dist/terminal-mouse.d.ts.map +0 -1
  680. package/dist/terminal-mouse.js +0 -84
  681. package/dist/terminal-mouse.js.map +0 -1
  682. package/dist/terminal-screen.d.ts +0 -41
  683. package/dist/terminal-screen.d.ts.map +0 -1
  684. package/dist/terminal-screen.js +0 -228
  685. package/dist/terminal-screen.js.map +0 -1
  686. package/dist/timeline-debug/harness.d.ts +0 -93
  687. package/dist/timeline-debug/harness.d.ts.map +0 -1
  688. package/dist/timeline-debug/harness.js +0 -100
  689. package/dist/timeline-debug/harness.js.map +0 -1
  690. package/dist/timeline-debug/index.d.ts +0 -9
  691. package/dist/timeline-debug/index.d.ts.map +0 -1
  692. package/dist/timeline-debug/index.js +0 -9
  693. package/dist/timeline-debug/index.js.map +0 -1
  694. package/dist/timeline-debug/interactions.d.ts +0 -19
  695. package/dist/timeline-debug/interactions.d.ts.map +0 -1
  696. package/dist/timeline-debug/interactions.js +0 -17
  697. package/dist/timeline-debug/interactions.js.map +0 -1
  698. package/dist/timeline-debug/target.d.ts +0 -34
  699. package/dist/timeline-debug/target.d.ts.map +0 -1
  700. package/dist/timeline-debug/target.js +0 -109
  701. package/dist/timeline-debug/target.js.map +0 -1
  702. package/dist/tool-format.d.ts +0 -54
  703. package/dist/tool-format.d.ts.map +0 -1
  704. package/dist/tool-format.js +0 -360
  705. package/dist/tool-format.js.map +0 -1
  706. package/dist/useExecutionState.d.ts +0 -44
  707. package/dist/useExecutionState.d.ts.map +0 -1
  708. package/dist/useExecutionState.js +0 -285
  709. package/dist/useExecutionState.js.map +0 -1
  710. package/dist/validate/index.d.ts +0 -29
  711. package/dist/validate/index.d.ts.map +0 -1
  712. package/dist/validate/index.js +0 -79
  713. package/dist/validate/index.js.map +0 -1
  714. package/dist/websocket-client.d.ts +0 -163
  715. package/dist/websocket-client.d.ts.map +0 -1
  716. package/dist/websocket-client.js +0 -677
  717. package/dist/websocket-client.js.map +0 -1
  718. package/dist/workflow-file.d.ts +0 -3
  719. package/dist/workflow-file.d.ts.map +0 -1
  720. package/dist/workflow-file.js +0 -176
  721. package/dist/workflow-file.js.map +0 -1
@@ -1,855 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { dirname, join, resolve } from "node:path";
3
- import { printCommandError } from "../command-errors.js";
4
- import { HARNESSES, SURFACES, auditHarnessCoverage, isUnclaimedPath, planGate } from "../harness/registry.js";
5
- import { computeAffected, readWorkspacePackages } from "../affected/affected.js";
6
- import { auditCapabilityCoverage, planCapabilityMappingGate, resolveGateBaseRef } from "../harness/capability-coverage.js";
7
- import { CAPABILITY_COVERAGE } from "../harness/capability-table.js";
8
- import { readChangedFiles, isGateRelevantCodeFile, isGlobalGateFile } from "../harness/changed-files.js";
9
- /** Sentinel exit code for a selfcheck the gate had to kill on timeout. */
10
- const TIMEOUT_EXIT_CODE = 124;
11
- /**
12
- * How much a selfcheck may print before the gate stops buffering it.
13
- *
14
- * `--json` captures each selfcheck's output, and `spawnSync`'s default cap is
15
- * 1 MB: past that Node kills the child and leaves a signal behind, which the
16
- * gate read as a timeout. A jest leg covering a whole component tree prints
17
- * more than that in warnings alone, so a passing suite was reported as
18
- * "exceeded 900s" after three minutes.
19
- */
20
- const SELFCHECK_MAX_BUFFER = 256 * 1024 * 1024;
21
- /** Where the coverage table lives, as git sees it. */
22
- const CAPABILITY_TABLE_PATH = "packages/cli/src/harness/capability-table.ts";
23
- function harnessRequiresCheckout(command) {
24
- return !/^(?:nodetool(?:-chat)?\b|echo .*\| nodetool-chat\b)/.test(command) ||
25
- command.startsWith("nodetool affected");
26
- }
27
- function harnessRepositoryRoot() {
28
- let directory = resolve(process.cwd());
29
- for (;;) {
30
- if (existsSync(join(directory, ".git")) &&
31
- existsSync(join(directory, "packages/cli/src/harness/registry.ts"))) {
32
- return directory;
33
- }
34
- const parent = dirname(directory);
35
- if (parent === directory) {
36
- return null;
37
- }
38
- directory = parent;
39
- }
40
- }
41
- export function registerHarnessCommands(program) {
42
- const harness = program
43
- .command("harness")
44
- .description("Harness-first engineering: inventory and coverage audit");
45
- harness
46
- .command("list")
47
- .description("List CLI commands and repository checks, marking checks that require a NodeTool checkout")
48
- .option("--json", "Print the registry as JSON")
49
- .action((opts) => {
50
- if (opts.json) {
51
- console.log(JSON.stringify(HARNESSES.map((harness) => ({
52
- ...harness,
53
- requiresCheckout: harnessRequiresCheckout(harness.command)
54
- })), null, 2));
55
- return;
56
- }
57
- console.log(`\n${HARNESSES.length} harnesses:\n`);
58
- for (const h of HARNESSES) {
59
- const caps = h.capabilities.length
60
- ? ` [${h.capabilities.join(", ")}]`
61
- : "";
62
- const tool = h.agentTool ? ` (agent tool: ${h.agentTool})` : "";
63
- console.log(` ${h.id.padEnd(18)} ${h.kind.padEnd(9)} ${h.title}`);
64
- const availability = harnessRequiresCheckout(h.command) ? " [NodeTool checkout required]" : " [installed CLI]";
65
- console.log(` ${"".padEnd(18)} ${h.command}${availability}${caps}${tool}`);
66
- console.log("");
67
- }
68
- console.log("Docs: https://github.com/nodetool-ai/nodetool/blob/main/docs/HARNESS_FIRST.md\n");
69
- });
70
- harness
71
- .command("audit")
72
- .description("Audit surface coverage: every surface needs a harness or a documented gap")
73
- .option("--json", "Print the audit result as JSON")
74
- .option("--strict", "Exit non-zero while any surface gap remains")
75
- .action((opts) => {
76
- const result = auditHarnessCoverage();
77
- if (opts.json) {
78
- console.log(JSON.stringify(result, null, 2));
79
- }
80
- else {
81
- console.log(`\nSurface coverage: ${result.coveredCount}/${SURFACES.length} covered, ${result.gapCount} gap(s)\n`);
82
- for (const s of result.surfaces) {
83
- if (s.covered) {
84
- console.log(` ok ${s.id.padEnd(20)} ${s.harnesses.join(", ")}`);
85
- }
86
- else {
87
- console.log(` GAP ${s.id.padEnd(20)} ${s.title}`);
88
- }
89
- }
90
- const gaps = result.surfaces.filter((s) => !s.covered);
91
- if (gaps.length > 0) {
92
- console.log("\nDocumented gaps:");
93
- for (const s of gaps)
94
- console.log(`\n ${s.id}: ${s.gap}`);
95
- }
96
- if (result.undocumentedGaps.length > 0) {
97
- console.log(`\nUNDOCUMENTED gaps (no harness, no gap note): ${result.undocumentedGaps.join(", ")}`);
98
- }
99
- if (result.unknownHarnessRefs.length > 0) {
100
- console.log(`\nUnknown harness references: ${result.unknownHarnessRefs.join(", ")}`);
101
- }
102
- if (result.orphanHarnesses.length > 0) {
103
- console.log(`\nHarnesses no surface claims: ${result.orphanHarnesses.join(", ")}`);
104
- }
105
- console.log("");
106
- }
107
- const broken = result.undocumentedGaps.length > 0 ||
108
- result.unknownHarnessRefs.length > 0;
109
- if (broken || (opts.strict && result.gapCount > 0)) {
110
- process.exit(1);
111
- }
112
- });
113
- harness
114
- .command("capabilities")
115
- .description("Audit capability coverage: every capability needs a suite, an eval case, or a gap note")
116
- .option("--json", "Print the audit result as JSON")
117
- .option("--strict", "Exit non-zero while any capability gap remains")
118
- .action(async (opts) => {
119
- // Lazy: declared-capabilities imports the built agents package.
120
- const { declaredCapabilities } = await import("../harness/declared-capabilities.js");
121
- const result = auditCapabilityCoverage(declaredCapabilities(), CAPABILITY_COVERAGE, HARNESSES);
122
- if (opts.json) {
123
- console.log(JSON.stringify(result, null, 2));
124
- }
125
- else {
126
- console.log(`\nCapability coverage: ${result.coveredCount}/${result.rows.length} covered, ${result.gapCount} gap(s)\n`);
127
- for (const row of result.rows) {
128
- if (!row.covered) {
129
- console.log(` GAP ${row.name.padEnd(32)} ${row.module}`);
130
- }
131
- }
132
- const gaps = result.rows.filter((r) => !r.covered);
133
- if (gaps.length > 0) {
134
- console.log("\nDocumented gaps:");
135
- for (const row of gaps)
136
- console.log(`\n ${row.name}: ${row.gap}`);
137
- }
138
- for (const [label, list] of [
139
- ["Capabilities with no entry", result.unmapped],
140
- ["Entries naming no capability", result.stale],
141
- ["Entries with no coverage and no gap note", result.undocumentedGaps],
142
- ["Entries naming an unknown selfcheck", result.unknownSelfchecks],
143
- ["Entries claiming a selfcheck with no suite", result.selfchecksWithoutSuites],
144
- ["Contract drift", result.contractDrift],
145
- ["Module mismatches", result.moduleMismatches],
146
- ["Duplicate entries", result.duplicates]
147
- ]) {
148
- if (list.length > 0)
149
- console.log(`\n${label}: ${list.join(", ")}`);
150
- }
151
- console.log("");
152
- }
153
- const broken = result.unmapped.length > 0 ||
154
- result.stale.length > 0 ||
155
- result.undocumentedGaps.length > 0 ||
156
- result.unknownSelfchecks.length > 0 ||
157
- result.selfchecksWithoutSuites.length > 0 ||
158
- result.contractDrift.length > 0 ||
159
- result.moduleMismatches.length > 0 ||
160
- result.duplicates.length > 0;
161
- if (broken || (opts.strict && result.gapCount > 0)) {
162
- process.exit(1);
163
- }
164
- });
165
- harness
166
- .command("gate [files...]")
167
- .description("Map a diff to touched surfaces and run their harnesses' selfchecks")
168
- .option("--base <ref>", "Diff against a git ref (e.g. main) instead of the working tree")
169
- .option("--all", "Ignore the diff and run every selfcheck")
170
- .option("--expensive", "Include expensive selfchecks (bundle staging etc.)")
171
- .option("--include-suites", "Also run selfchecks that only re-run suites `npm run test:affected` runs")
172
- .option("--deps", "Also touch surfaces inside workspaces that depend on a changed one")
173
- .option("--dry-run", "Print the plan without running anything")
174
- .option("--json", "Print the plan (and results, unless --dry-run) as JSON")
175
- .option("--strict", "Exit non-zero when the diff touches a surface only a gap note covers")
176
- .option("--timeout <seconds>", "Kill a selfcheck that runs longer than this many seconds (default 900)", "900")
177
- .option("--jobs <n>", "Run up to n cheap selfchecks at once (default 1, serial)", "1")
178
- .action(async (files, opts) => {
179
- const repoRoot = harnessRepositoryRoot();
180
- if (!repoRoot) {
181
- process.exit(printCommandError(new Error("harness gate requires a NodeTool Git checkout with repository test scripts. Run it from the checkout root. For a local document, use nodetool validate, jsscript test, app debug, or timeline debug."), opts.json));
182
- }
183
- const timeoutSeconds = Number(opts.timeout ?? "900");
184
- const timeoutMs = Number.isFinite(timeoutSeconds) && timeoutSeconds > 0
185
- ? timeoutSeconds * 1000
186
- : 900_000;
187
- const jobsRequested = Number(opts.jobs ?? "1");
188
- const jobs = Number.isInteger(jobsRequested) && jobsRequested > 0
189
- ? jobsRequested
190
- : 1;
191
- let changedFiles = files;
192
- if (changedFiles.length === 0 && !opts.all) {
193
- changedFiles = readChangedFiles(repoRoot, opts.base);
194
- }
195
- const mappingViolations = opts.all
196
- ? []
197
- : await capabilityMappingViolations(repoRoot, opts.base ?? "HEAD", changedFiles);
198
- if (!opts.json && mappingViolations.length > 0) {
199
- console.log("\nCapability mapping violations (harness capabilities):");
200
- for (const v of mappingViolations)
201
- console.log(` ${v}`);
202
- }
203
- const plan = opts.all
204
- ? {
205
- changedFiles: [],
206
- globalFiles: [],
207
- surfaces: [],
208
- checks: HARNESSES.filter((h) => h.selfcheck).map((h) => ({
209
- harnessId: h.id,
210
- command: h.selfcheck.command,
211
- cost: h.selfcheck.cost,
212
- suiteOnly: h.selfcheck.suiteOnly ?? false,
213
- surfaces: []
214
- })),
215
- manual: [],
216
- uncoveredSurfaces: [],
217
- unmappedFiles: []
218
- }
219
- : planGate(changedFiles, undefined, undefined, opts.deps ? readWorkspacePackages(repoRoot) : undefined);
220
- const { toRun, skippedExpensive, skippedSuites, prunedSuites } = selectChecks(plan.checks, {
221
- expensive: opts.expensive,
222
- includeSuites: opts.includeSuites,
223
- globalFiles: plan.globalFiles,
224
- changedFiles: plan.changedFiles,
225
- workspaces: readWorkspacePackages(repoRoot)
226
- });
227
- // A directory recorded in UNCLAIMED_PATHS has already been judged: no
228
- // harness reaches it, and the entry says why. `auditPathClaims` honors
229
- // that; the gate did not, so the first diff to touch such a directory
230
- // failed with no way to satisfy it short of inventing a surface.
231
- const unmappedCodeFiles = plan.unmappedFiles
232
- .filter(isGateRelevantCodeFile)
233
- .filter((f) => !isUnclaimedPath(f));
234
- if (!opts.json) {
235
- printGatePlan(plan, toRun.length, skippedExpensive.length, skippedSuites, opts.all);
236
- if (prunedSuites.length > 0) {
237
- console.log("\nSteps left out because `npm run test:affected` runs their whole suite:");
238
- for (const p of prunedSuites) {
239
- for (const c of p.commands)
240
- console.log(` ${p.harnessId}: ${c}`);
241
- }
242
- }
243
- if (unmappedCodeFiles.length > 0) {
244
- console.log("\nCode files no surface claims (the gate fails on these):");
245
- for (const f of unmappedCodeFiles)
246
- console.log(` ${f}`);
247
- }
248
- }
249
- const skippedSuiteIds = skippedSuites.map((c) => c.harnessId);
250
- if (opts.dryRun) {
251
- if (opts.json) {
252
- console.log(JSON.stringify({
253
- plan,
254
- skippedSuites: skippedSuiteIds,
255
- prunedSuites,
256
- mappingViolations,
257
- unmappedCodeFiles
258
- }, null, 2));
259
- }
260
- if (mappingViolations.length > 0 ||
261
- unmappedCodeFiles.length > 0 ||
262
- (opts.strict && plan.uncoveredSurfaces.length > 0)) {
263
- process.exit(1);
264
- }
265
- return;
266
- }
267
- const results = await executeChecks(toRun, {
268
- repoRoot,
269
- json: opts.json === true,
270
- timeoutMs,
271
- timeoutSeconds,
272
- jobs
273
- });
274
- const failed = results.filter((r) => !r.ok);
275
- if (opts.json) {
276
- console.log(JSON.stringify({
277
- plan,
278
- results,
279
- skippedSuites: skippedSuiteIds,
280
- prunedSuites,
281
- mappingViolations,
282
- unmappedCodeFiles
283
- }, null, 2));
284
- }
285
- else if (toRun.length > 0) {
286
- console.log(`\nGate: ${results.length - failed.length}/${results.length} selfchecks passed`);
287
- for (const r of failed) {
288
- const label = r.timedOut
289
- ? "TIMEOUT"
290
- : r.killed
291
- ? "KILLED"
292
- : "FAIL";
293
- console.log(` ${label} ${r.harnessId} (exit ${r.exitCode}): ${r.command}`);
294
- }
295
- console.log("");
296
- }
297
- if (failed.length > 0 ||
298
- mappingViolations.length > 0 ||
299
- unmappedCodeFiles.length > 0 ||
300
- (opts.strict && plan.uncoveredSurfaces.length > 0)) {
301
- process.exit(1);
302
- }
303
- });
304
- }
305
- /**
306
- * Split a plan's checks into what runs now and what is deliberately left out.
307
- * A suite-only check is skipped (and named) rather than silently dropped:
308
- * `npm run test:affected` runs the same suites for the same diff, so running
309
- * them here again is pure repetition unless `--include-suites` asks for it.
310
- *
311
- * The same holds for one `npm run test --workspace=<pkg>` step of a chained
312
- * selfcheck when `test:affected` runs that package's whole suite for this
313
- * diff: every backend package `computeAffected` returns for `changedFiles`
314
- * (the CI `test-packages-*` shards run the same set), or every workspace on a
315
- * global diff. Such a step is pruned from the command and listed in
316
- * `prunedSuites`, and a check left with no step is skipped. Web and electron
317
- * steps are kept outside a global diff, because `test:affected` may run only
318
- * the tests related to their own changed files.
319
- */
320
- export function selectChecks(checks, opts) {
321
- const covered = opts.includeSuites
322
- ? new Set()
323
- : coveredWorkspaces(opts);
324
- const skippedSuites = [];
325
- const prunedSuites = [];
326
- const rest = [];
327
- for (const c of checks) {
328
- if (!opts.includeSuites && c.suiteOnly) {
329
- skippedSuites.push(c);
330
- continue;
331
- }
332
- const pruned = pruneCoveredSuites(c.command, covered);
333
- if (pruned.command === null) {
334
- skippedSuites.push(c);
335
- }
336
- else if (pruned.removed.length > 0) {
337
- prunedSuites.push({ harnessId: c.harnessId, commands: pruned.removed });
338
- rest.push({ ...c, command: pruned.command });
339
- }
340
- else {
341
- rest.push(c);
342
- }
343
- }
344
- return {
345
- toRun: rest.filter((c) => opts.expensive || c.cost === "cheap"),
346
- skippedExpensive: rest.filter((c) => !opts.expensive && c.cost === "expensive"),
347
- skippedSuites,
348
- prunedSuites
349
- };
350
- }
351
- /**
352
- * Workspaces, by name and directory, whose whole test suite `npm run
353
- * test:affected` runs for this diff. A global gate file selects the full
354
- * pass, so every package plus web and electron. Otherwise the backend
355
- * packages `computeAffected` returns: `test:affected` runs exactly those
356
- * through turbo, and `scripts/ci-plan.mjs` starts the shard of each of them.
357
- */
358
- function coveredWorkspaces(opts) {
359
- const isBackend = (p) => /^(packages|reliability)\/[^/]+$/.test(p.dir);
360
- const workspaces = opts.workspaces ?? [];
361
- if (opts.globalFiles?.some(isGlobalGateFile)) {
362
- return new Set(workspaces
363
- .filter((p) => isBackend(p) || p.dir === "web" || p.dir === "electron")
364
- .flatMap((p) => [p.name, p.dir]));
365
- }
366
- if (!opts.changedFiles?.length)
367
- return new Set();
368
- const affected = new Set(computeAffected(opts.changedFiles, workspaces).affected);
369
- return new Set(workspaces
370
- .filter((p) => isBackend(p) && affected.has(p.name))
371
- .flatMap((p) => [p.name, p.dir]));
372
- }
373
- /**
374
- * Remove the `npm run test --workspace=…` steps whose workspaces are all
375
- * covered from a `&&` chain. Returns `command: null` when no step is left,
376
- * and the command unchanged when it is outside the restricted grammar below.
377
- */
378
- function pruneCoveredSuites(command, covered) {
379
- const steps = covered.size > 0 ? splitAndChain(command) : null;
380
- if (!steps)
381
- return { command, removed: [] };
382
- const removed = steps.filter((s) => isCoveredTestStep(s.tokens, covered));
383
- if (removed.length === 0)
384
- return { command, removed: [] };
385
- const kept = steps.filter((s) => !removed.includes(s));
386
- return {
387
- command: kept.length > 0 ? kept.map((s) => s.text).join(" && ") : null,
388
- removed: removed.map((s) => s.text)
389
- };
390
- }
391
- /**
392
- * Split a command into its `&&` steps, each with its source text and words.
393
- * Quotes may protect filter expressions such as 'one|two'. Shell expansion,
394
- * redirection and every operator other than `&&` reject the whole command.
395
- */
396
- function splitAndChain(command) {
397
- if (/[$`\\\n\r;<>%!^]/.test(command)) {
398
- return null;
399
- }
400
- const steps = [];
401
- let segment = [];
402
- let segmentStart = 0;
403
- let token = "";
404
- let quote = "";
405
- const flush = () => {
406
- if (token) {
407
- segment.push(token);
408
- }
409
- token = "";
410
- };
411
- const close = (end) => {
412
- flush();
413
- if (segment.length === 0)
414
- return false;
415
- steps.push({ text: command.slice(segmentStart, end).trim(), tokens: segment });
416
- segment = [];
417
- return true;
418
- };
419
- for (let i = 0; i < command.length; i++) {
420
- const char = command.charAt(i);
421
- if (quote) {
422
- if (char === quote) {
423
- quote = "";
424
- }
425
- else {
426
- token += char;
427
- }
428
- }
429
- else if (char === "'" || char === '"') {
430
- quote = char;
431
- }
432
- else if (/\s/.test(char)) {
433
- flush();
434
- }
435
- else if (char === "&" && command[i + 1] === "&") {
436
- if (!close(i))
437
- return null;
438
- i++;
439
- segmentStart = i + 1;
440
- }
441
- else if (";&|<>()*?{}[]#".includes(char)) {
442
- return null;
443
- }
444
- else {
445
- token += char;
446
- }
447
- }
448
- if (quote || !close(command.length)) {
449
- return null;
450
- }
451
- return steps;
452
- }
453
- /** `npm [run] test --workspace=<covered>… [-- <file filters>]`. */
454
- function isCoveredTestStep(tokens, covered) {
455
- let i = 0;
456
- if (tokens[i++] !== "npm") {
457
- return false;
458
- }
459
- if (tokens[i] === "run") {
460
- i++;
461
- }
462
- if (tokens[i++] !== "test") {
463
- return false;
464
- }
465
- let count = 0;
466
- while (tokens[i]?.startsWith("--workspace=")) {
467
- const workspace = tokens[i];
468
- if (!workspace || !covered.has(workspace.slice("--workspace=".length))) {
469
- return false;
470
- }
471
- i++;
472
- count++;
473
- }
474
- if (count === 0) {
475
- return false;
476
- }
477
- if (i === tokens.length) {
478
- return true;
479
- }
480
- if (tokens[i++] !== "--") {
481
- return false;
482
- }
483
- return tokens.slice(i).every((arg) => !arg.startsWith("-") ||
484
- arg === "--runInBand" || /^(--testPathPattern|--testNamePattern)=.+/.test(arg));
485
- }
486
- /** Cap on what a failing selfcheck prints into `--json` mode's stderr. */
487
- const FAILURE_OUTPUT_CHARS = 20_000;
488
- /**
489
- * Selfchecks decide their own module resolution: strip the `nodetool-dev`
490
- * conditions this CLI may be running under (set by `npm run dev:nodetool`), or
491
- * dist-mode scripts like reliability:ring0 resolve packages to src/ and fail.
492
- */
493
- function selfcheckEnv() {
494
- const nodeOptions = (process.env["NODE_OPTIONS"] ?? "")
495
- .replace(/--conditions[= ]nodetool-dev/g, "")
496
- .trim();
497
- return {
498
- ...process.env,
499
- ...(nodeOptions ? { NODE_OPTIONS: nodeOptions } : { NODE_OPTIONS: "" })
500
- };
501
- }
502
- /** Run one serial selfcheck, retaining live output and bounded JSON capture. */
503
- async function runCheckSerial(check, o) {
504
- const { spawn } = await import("node:child_process");
505
- return new Promise((resolveOutcome) => {
506
- const stdout = [];
507
- const stderr = [];
508
- let stdoutBytes = 0;
509
- let stderrBytes = 0;
510
- let errorCode;
511
- const child = spawn(check.command, {
512
- cwd: o.repoRoot,
513
- shell: true,
514
- stdio: o.json ? ["ignore", "pipe", "pipe"] : "inherit",
515
- detached: true,
516
- env: selfcheckEnv()
517
- });
518
- let groupKilled = false;
519
- const killGroup = () => {
520
- if (groupKilled) {
521
- return;
522
- }
523
- groupKilled = true;
524
- try {
525
- if (child.pid !== undefined) {
526
- process.kill(-child.pid, "SIGKILL");
527
- }
528
- }
529
- catch {
530
- child.kill("SIGKILL");
531
- }
532
- };
533
- const interrupt = () => {
534
- killGroup();
535
- process.exit(130);
536
- };
537
- const terminate = () => {
538
- killGroup();
539
- process.exit(143);
540
- };
541
- process.once("exit", killGroup);
542
- process.once("SIGINT", interrupt);
543
- process.once("SIGTERM", terminate);
544
- const kill = (reason) => {
545
- if (errorCode !== undefined) {
546
- return;
547
- }
548
- errorCode = reason;
549
- killGroup();
550
- };
551
- const timer = setTimeout(() => kill("ETIMEDOUT"), o.timeoutMs);
552
- const capture = (chunks, chunk, bytes) => {
553
- if (errorCode !== undefined) {
554
- return bytes;
555
- }
556
- const remaining = SELFCHECK_MAX_BUFFER - bytes;
557
- if (remaining > 0) {
558
- chunks.push(chunk.subarray(0, remaining));
559
- }
560
- if (chunk.length > remaining) {
561
- kill("ENOBUFS");
562
- }
563
- return bytes + Math.min(chunk.length, remaining);
564
- };
565
- child.stdout?.on("data", (chunk) => {
566
- stdoutBytes = capture(stdout, chunk, stdoutBytes);
567
- });
568
- child.stderr?.on("data", (chunk) => {
569
- stderrBytes = capture(stderr, chunk, stderrBytes);
570
- });
571
- child.on("error", (error) => {
572
- errorCode ??= error.code ?? "UNKNOWN";
573
- });
574
- child.on("close", (status, signal) => {
575
- clearTimeout(timer);
576
- process.removeListener("exit", killGroup);
577
- process.removeListener("SIGINT", interrupt);
578
- process.removeListener("SIGTERM", terminate);
579
- resolveOutcome({
580
- status,
581
- signal,
582
- errorCode,
583
- hasError: errorCode !== undefined,
584
- stdout: Buffer.concat(stdout, stdoutBytes).toString("utf8"),
585
- stderr: Buffer.concat(stderr, stderrBytes).toString("utf8")
586
- });
587
- });
588
- });
589
- }
590
- /**
591
- * Run one selfcheck without blocking, buffering its output. A stream keeps only
592
- * its tail past the cap instead of killing the child, which is what a full
593
- * pipe did to `spawnSync` (see SELFCHECK_MAX_BUFFER). The child leads its own
594
- * process group so the timeout's SIGKILL reaches what the shell started, and
595
- * the result settles at the kill rather than waiting on pipes a grandchild
596
- * still holds.
597
- */
598
- async function runCheckAsync(check, o) {
599
- const { spawn } = await import("node:child_process");
600
- const cap = o.json ? FAILURE_OUTPUT_CHARS : SELFCHECK_MAX_BUFFER;
601
- return new Promise((resolveOutcome) => {
602
- let stdout = "";
603
- let stderr = "";
604
- let timedOut = false;
605
- let spawnError;
606
- let settled = false;
607
- const child = spawn(check.command, {
608
- cwd: o.repoRoot,
609
- shell: true,
610
- stdio: ["ignore", "pipe", "pipe"],
611
- detached: true,
612
- env: selfcheckEnv()
613
- });
614
- const settle = (status, signal) => {
615
- if (settled)
616
- return;
617
- settled = true;
618
- clearTimeout(timer);
619
- resolveOutcome({
620
- status,
621
- signal,
622
- errorCode: timedOut ? "ETIMEDOUT" : spawnError?.code,
623
- hasError: timedOut || spawnError !== undefined,
624
- stdout,
625
- stderr
626
- });
627
- };
628
- const timer = setTimeout(() => {
629
- timedOut = true;
630
- try {
631
- if (child.pid !== undefined)
632
- process.kill(-child.pid, "SIGKILL");
633
- }
634
- catch {
635
- child.kill("SIGKILL");
636
- }
637
- settle(null, "SIGKILL");
638
- }, o.timeoutMs);
639
- child.stdout?.setEncoding("utf8");
640
- child.stderr?.setEncoding("utf8");
641
- child.stdout?.on("data", (d) => {
642
- stdout += d;
643
- if (stdout.length > cap)
644
- stdout = stdout.slice(-cap);
645
- });
646
- child.stderr?.on("data", (d) => {
647
- stderr += d;
648
- if (stderr.length > cap)
649
- stderr = stderr.slice(-cap);
650
- });
651
- child.on("error", (e) => {
652
- spawnError = e;
653
- settle(null, null);
654
- });
655
- child.on("close", (code, signal) => settle(code, signal));
656
- });
657
- }
658
- /**
659
- * Turn what a selfcheck did into a result and print its report. `emit` receives
660
- * the text so a parallel run can print it as one block.
661
- *
662
- * Fails closed on a kill: a timeout or any other signal leaves `status` null,
663
- * which counts as a failure, never as the "no exit code, assume ok" case. Only
664
- * ETIMEDOUT is reported as a timeout, though — every other signal used to be
665
- * too, and a check killed for some other reason then claimed to have run for
666
- * the full `--timeout` when it had run for three minutes.
667
- */
668
- function interpretOutcome(check, raw, o, durationMs) {
669
- const timedOut = raw.errorCode === "ETIMEDOUT";
670
- const killed = raw.signal != null || raw.hasError;
671
- const exitCode = timedOut ? TIMEOUT_EXIT_CODE : (raw.status ?? 1);
672
- let stderrText = "";
673
- let stdoutText = "";
674
- if (o.json && (timedOut || killed || exitCode !== 0)) {
675
- const output = `${raw.stdout}\n${raw.stderr}`.slice(-FAILURE_OUTPUT_CHARS);
676
- stderrText = `\n${check.harnessId} failed (exit ${exitCode}):\n${output}\n`;
677
- }
678
- if (!o.json && timedOut) {
679
- stdoutText = `\nTIMEOUT ${check.harnessId} exceeded ${o.timeoutSeconds}s: ${check.command}\n`;
680
- }
681
- else if (!o.json && killed) {
682
- stdoutText = `\nKILLED ${check.harnessId} (${raw.signal ?? raw.errorCode}): ${check.command}\n`;
683
- }
684
- return {
685
- result: {
686
- harnessId: check.harnessId,
687
- command: check.command,
688
- ok: !timedOut && !killed && exitCode === 0,
689
- exitCode,
690
- timedOut,
691
- killed,
692
- durationMs
693
- },
694
- stdoutText,
695
- stderrText
696
- };
697
- }
698
- /**
699
- * Run the selected selfchecks and return their results in plan order.
700
- *
701
- * With `jobs` of 1 every check runs serially in plan order with live output.
702
- * With more, the cheap checks run `jobs` at a time with buffered output
703
- * printed per check as a block, then the expensive ones run serially: they
704
- * stage bundles and bind ports, so they cannot share a machine with each other
705
- * or with the cheap pool.
706
- */
707
- export async function executeChecks(checks, o) {
708
- const results = new Array(checks.length);
709
- const runSerial = async (index) => {
710
- const check = checks[index];
711
- process.stderr.write(`START ${check.harnessId}\n`);
712
- const started = performance.now();
713
- if (!o.json)
714
- console.log(`\n── ${check.harnessId}: ${check.command}\n`);
715
- const { result, stdoutText, stderrText } = interpretOutcome(check, await runCheckSerial(check, o), o, Math.round(performance.now() - started));
716
- if (stderrText)
717
- process.stderr.write(stderrText);
718
- if (stdoutText)
719
- process.stdout.write(stdoutText);
720
- results[index] = result;
721
- process.stderr.write(`${result.ok ? "PASS" : "FAIL"} ${check.harnessId} (${result.durationMs}ms)\n`);
722
- };
723
- if (o.jobs <= 1) {
724
- for (let i = 0; i < checks.length; i++)
725
- await runSerial(i);
726
- return results;
727
- }
728
- const cheap = [];
729
- const expensive = [];
730
- checks.forEach((c, i) => (c.cost === "cheap" ? cheap : expensive).push(i));
731
- let next = 0;
732
- const worker = async () => {
733
- while (next < cheap.length) {
734
- const index = cheap[next++];
735
- const check = checks[index];
736
- process.stderr.write(`START ${check.harnessId}\n`);
737
- const started = performance.now();
738
- const raw = await runCheckAsync(check, o);
739
- const { result, stdoutText, stderrText } = interpretOutcome(check, raw, o, Math.round(performance.now() - started));
740
- // One block per check, written without an await in between, so output
741
- // from checks that finish together does not interleave.
742
- if (!o.json) {
743
- process.stdout.write(`\n── ${check.harnessId}: ${check.command}\n\n${raw.stdout}`);
744
- if (raw.stderr)
745
- process.stderr.write(raw.stderr);
746
- }
747
- if (stderrText)
748
- process.stderr.write(stderrText);
749
- if (stdoutText)
750
- process.stdout.write(stdoutText);
751
- results[index] = result;
752
- process.stderr.write(`${result.ok ? "PASS" : "FAIL"} ${check.harnessId} (${result.durationMs}ms)\n`);
753
- }
754
- };
755
- await Promise.all(Array.from({ length: Math.min(o.jobs, cheap.length) }, () => worker()));
756
- for (const index of expensive)
757
- await runSerial(index);
758
- return results;
759
- }
760
- export function printGatePlan(plan, runCount, skippedExpensive, skippedSuites, all) {
761
- const skipNote = [
762
- skippedExpensive > 0
763
- ? `${skippedExpensive} expensive skipped — pass --expensive`
764
- : "",
765
- skippedSuites.length > 0
766
- ? `${skippedSuites.length} suite-only skipped — pass --include-suites`
767
- : ""
768
- ].filter(Boolean);
769
- const suffix = skipNote.length > 0 ? ` (${skipNote.join("; ")})` : "";
770
- const printSkippedSuites = () => {
771
- if (skippedSuites.length === 0)
772
- return;
773
- console.log("\nCovered by `npm run test:affected` (selfcheck only re-runs those suites):");
774
- for (const c of skippedSuites)
775
- console.log(` ${c.harnessId}`);
776
- };
777
- if (all) {
778
- console.log(`\nRunning all ${runCount} selfcheck(s)${suffix}`);
779
- printSkippedSuites();
780
- return;
781
- }
782
- if (plan.changedFiles.length === 0) {
783
- console.log("\nNo changed files — nothing to gate.");
784
- return;
785
- }
786
- if (plan.globalFiles.length > 0) {
787
- console.log(`\n${plan.globalFiles.length} global file(s) force every selfcheck:`);
788
- for (const f of plan.globalFiles.slice(0, 8))
789
- console.log(` ${f}`);
790
- if (plan.globalFiles.length > 8) {
791
- console.log(` …and ${plan.globalFiles.length - 8} more`);
792
- }
793
- }
794
- console.log(`\n${plan.changedFiles.length} changed file(s) touch ${plan.surfaces.length} surface(s):`);
795
- for (const s of plan.surfaces) {
796
- const via = s.viaDependency ? " (via dependency)" : "";
797
- console.log(` ${s.id.padEnd(20)} (${s.files.length} file(s))${via}`);
798
- }
799
- if (plan.unmappedFiles.length > 0) {
800
- console.log(`\n${plan.unmappedFiles.length} file(s) outside any surface:`);
801
- for (const f of plan.unmappedFiles.slice(0, 8))
802
- console.log(` ${f}`);
803
- if (plan.unmappedFiles.length > 8) {
804
- console.log(` …and ${plan.unmappedFiles.length - 8} more`);
805
- }
806
- }
807
- if (plan.uncoveredSurfaces.length > 0) {
808
- console.log(`\nTouched surfaces with NO harness (documented gaps): ${plan.uncoveredSurfaces.join(", ")}`);
809
- }
810
- if (plan.manual.length > 0) {
811
- console.log("\nManual harnesses (need a target/key — run yourself):");
812
- for (const m of plan.manual) {
813
- console.log(` ${m.harnessId.padEnd(18)} ${m.command}`);
814
- }
815
- }
816
- printSkippedSuites();
817
- console.log(`\n${runCount} selfcheck(s) to run${suffix}`);
818
- }
819
- /**
820
- * A capability whose declared contract moved without its coverage mapping
821
- * moving with it. Adding a capability, or changing what one promises, means
822
- * saying which eval case or suite covers the new contract — a refactor that
823
- * leaves the contract alone says nothing and runs the mapped checks as usual.
824
- */
825
- async function capabilityMappingViolations(repoRoot, baseRef, changedFiles) {
826
- const { execFileSync } = await import("node:child_process");
827
- const { readFileSync } = await import("node:fs");
828
- const { join } = await import("node:path");
829
- // argv, never a shell line: `--base` is a git ref, and ref names may carry
830
- // `;`, `$(…)` and backticks.
831
- const git = (args) => execFileSync("git", args, {
832
- cwd: repoRoot,
833
- encoding: "utf8",
834
- stdio: ["ignore", "pipe", "ignore"]
835
- });
836
- const atRef = (ref) => {
837
- try {
838
- return git(["show", `${ref}:${CAPABILITY_TABLE_PATH}`]);
839
- }
840
- catch {
841
- // The table does not exist at that ref — every entry is new.
842
- return null;
843
- }
844
- };
845
- let working;
846
- try {
847
- working = readFileSync(join(repoRoot, CAPABILITY_TABLE_PATH), "utf8");
848
- }
849
- catch {
850
- // Running from a package without the source tree; nothing to compare.
851
- return [];
852
- }
853
- return planCapabilityMappingGate(atRef(resolveGateBaseRef(baseRef, git)), working, changedFiles).violations.map((v) => v.detail);
854
- }
855
- //# sourceMappingURL=harness.js.map