@apralabs/apra-fleet 0.4.1 → 0.4.3

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 (476) hide show
  1. package/README.md +53 -12
  2. package/dist/agents/backlog-groomer.md +42 -21
  3. package/dist/agents/ci-watcher.md +14 -0
  4. package/dist/agents/deployer.md +59 -46
  5. package/dist/agents/doer.md +157 -134
  6. package/dist/agents/harvester.md +31 -32
  7. package/dist/agents/integ-test-runner.md +92 -113
  8. package/dist/agents/kb-reconciler.md +40 -42
  9. package/dist/agents/plan-reviewer.md +139 -63
  10. package/dist/agents/planner.md +176 -100
  11. package/dist/agents/regression-test-runner.md +77 -81
  12. package/dist/agents/reviewer.md +69 -85
  13. package/dist/agents/schemas/integ-test-runner-output.json +1 -1
  14. package/dist/agents/schemas/plan-reviewer-output.json +37 -0
  15. package/dist/agents/schemas/regression-test-runner-output.json +4 -17
  16. package/dist/cli/agent-transform.d.ts +83 -2
  17. package/dist/cli/agent-transform.d.ts.map +1 -1
  18. package/dist/cli/agent-transform.js +266 -21
  19. package/dist/cli/agent-transform.js.map +1 -1
  20. package/dist/cli/auth.d.ts.map +1 -1
  21. package/dist/cli/auth.js +29 -11
  22. package/dist/cli/auth.js.map +1 -1
  23. package/dist/cli/config.d.ts +7 -5
  24. package/dist/cli/config.d.ts.map +1 -1
  25. package/dist/cli/config.js +44 -43
  26. package/dist/cli/config.js.map +1 -1
  27. package/dist/cli/install.d.ts +33 -0
  28. package/dist/cli/install.d.ts.map +1 -1
  29. package/dist/cli/install.js +294 -61
  30. package/dist/cli/install.js.map +1 -1
  31. package/dist/cli/kb-directives.d.ts.map +1 -1
  32. package/dist/cli/kb-directives.js +2 -1
  33. package/dist/cli/kb-directives.js.map +1 -1
  34. package/dist/cli/register-member.d.ts.map +1 -1
  35. package/dist/cli/register-member.js +7 -3
  36. package/dist/cli/register-member.js.map +1 -1
  37. package/dist/cli/start.d.ts.map +1 -1
  38. package/dist/cli/start.js +7 -0
  39. package/dist/cli/start.js.map +1 -1
  40. package/dist/cli/uninstall.d.ts.map +1 -1
  41. package/dist/cli/uninstall.js +5 -3
  42. package/dist/cli/uninstall.js.map +1 -1
  43. package/dist/cli/watch.d.ts +26 -3
  44. package/dist/cli/watch.d.ts.map +1 -1
  45. package/dist/cli/watch.js +41 -9
  46. package/dist/cli/watch.js.map +1 -1
  47. package/dist/commands/kb-server.d.ts +3 -0
  48. package/dist/commands/kb-server.d.ts.map +1 -1
  49. package/dist/commands/kb-server.js +43 -3
  50. package/dist/commands/kb-server.js.map +1 -1
  51. package/dist/index.js +3 -3
  52. package/dist/os/git-bash-candidates.d.ts +35 -0
  53. package/dist/os/git-bash-candidates.d.ts.map +1 -0
  54. package/dist/os/git-bash-candidates.js +46 -0
  55. package/dist/os/git-bash-candidates.js.map +1 -0
  56. package/dist/os/index.d.ts +13 -4
  57. package/dist/os/index.d.ts.map +1 -1
  58. package/dist/os/index.js +17 -2
  59. package/dist/os/index.js.map +1 -1
  60. package/dist/os/linux.d.ts +6 -0
  61. package/dist/os/linux.d.ts.map +1 -1
  62. package/dist/os/linux.js +36 -3
  63. package/dist/os/linux.js.map +1 -1
  64. package/dist/os/os-commands.d.ts +68 -2
  65. package/dist/os/os-commands.d.ts.map +1 -1
  66. package/dist/os/os-commands.js.map +1 -1
  67. package/dist/os/windows-gitbash.d.ts +98 -0
  68. package/dist/os/windows-gitbash.d.ts.map +1 -0
  69. package/dist/os/windows-gitbash.js +259 -0
  70. package/dist/os/windows-gitbash.js.map +1 -0
  71. package/dist/os/windows.d.ts +6 -0
  72. package/dist/os/windows.d.ts.map +1 -1
  73. package/dist/os/windows.js +73 -8
  74. package/dist/os/windows.js.map +1 -1
  75. package/dist/providers/agy.d.ts +118 -8
  76. package/dist/providers/agy.d.ts.map +1 -1
  77. package/dist/providers/agy.js +580 -55
  78. package/dist/providers/agy.js.map +1 -1
  79. package/dist/providers/claude.d.ts +83 -4
  80. package/dist/providers/claude.d.ts.map +1 -1
  81. package/dist/providers/claude.js +365 -12
  82. package/dist/providers/claude.js.map +1 -1
  83. package/dist/providers/codex.d.ts +7 -4
  84. package/dist/providers/codex.d.ts.map +1 -1
  85. package/dist/providers/codex.js +24 -4
  86. package/dist/providers/codex.js.map +1 -1
  87. package/dist/providers/copilot.d.ts +7 -4
  88. package/dist/providers/copilot.d.ts.map +1 -1
  89. package/dist/providers/copilot.js +27 -4
  90. package/dist/providers/copilot.js.map +1 -1
  91. package/dist/providers/index.d.ts +0 -1
  92. package/dist/providers/index.d.ts.map +1 -1
  93. package/dist/providers/index.js +0 -3
  94. package/dist/providers/index.js.map +1 -1
  95. package/dist/providers/none.d.ts +7 -4
  96. package/dist/providers/none.d.ts.map +1 -1
  97. package/dist/providers/none.js +22 -4
  98. package/dist/providers/none.js.map +1 -1
  99. package/dist/providers/opencode.d.ts +6 -3
  100. package/dist/providers/opencode.d.ts.map +1 -1
  101. package/dist/providers/opencode.js +27 -4
  102. package/dist/providers/opencode.js.map +1 -1
  103. package/dist/providers/provider.d.ts +215 -11
  104. package/dist/providers/provider.d.ts.map +1 -1
  105. package/dist/providers/provider.js +58 -2
  106. package/dist/providers/provider.js.map +1 -1
  107. package/dist/services/agent-provisioner.js +2 -2
  108. package/dist/services/agent-provisioner.js.map +1 -1
  109. package/dist/services/agy-project.d.ts +102 -0
  110. package/dist/services/agy-project.d.ts.map +1 -0
  111. package/dist/services/agy-project.js +356 -0
  112. package/dist/services/agy-project.js.map +1 -0
  113. package/dist/services/auth-socket.js +4 -4
  114. package/dist/services/auth-web.js +1 -1
  115. package/dist/services/cloud/activity.js +2 -2
  116. package/dist/services/cloud/activity.js.map +1 -1
  117. package/dist/services/cloud/lifecycle.d.ts.map +1 -1
  118. package/dist/services/cloud/lifecycle.js +33 -4
  119. package/dist/services/cloud/lifecycle.js.map +1 -1
  120. package/dist/services/context-admission.d.ts.map +1 -1
  121. package/dist/services/context-admission.js +9 -7
  122. package/dist/services/context-admission.js.map +1 -1
  123. package/dist/services/credential-cleanup.d.ts.map +1 -1
  124. package/dist/services/credential-cleanup.js +47 -10
  125. package/dist/services/credential-cleanup.js.map +1 -1
  126. package/dist/services/exit-drain.d.ts +44 -0
  127. package/dist/services/exit-drain.d.ts.map +1 -0
  128. package/dist/services/exit-drain.js +52 -0
  129. package/dist/services/exit-drain.js.map +1 -0
  130. package/dist/services/github-app.d.ts.map +1 -1
  131. package/dist/services/github-app.js +32 -4
  132. package/dist/services/github-app.js.map +1 -1
  133. package/dist/services/http-transport.d.ts +1 -0
  134. package/dist/services/http-transport.d.ts.map +1 -1
  135. package/dist/services/http-transport.js +48 -1
  136. package/dist/services/http-transport.js.map +1 -1
  137. package/dist/services/knowledge/kb-config.d.ts +42 -0
  138. package/dist/services/knowledge/kb-config.d.ts.map +1 -0
  139. package/dist/services/knowledge/kb-config.js +54 -0
  140. package/dist/services/knowledge/kb-config.js.map +1 -0
  141. package/dist/services/knowledge/kb-providers.d.ts +7 -1
  142. package/dist/services/knowledge/kb-providers.d.ts.map +1 -1
  143. package/dist/services/knowledge/kb-providers.js +191 -17
  144. package/dist/services/knowledge/kb-providers.js.map +1 -1
  145. package/dist/services/knowledge/require-sqlite-project.d.ts +32 -0
  146. package/dist/services/knowledge/require-sqlite-project.d.ts.map +1 -0
  147. package/dist/services/knowledge/require-sqlite-project.js +38 -0
  148. package/dist/services/knowledge/require-sqlite-project.js.map +1 -0
  149. package/dist/services/member-home.d.ts +1 -1
  150. package/dist/services/member-home.d.ts.map +1 -1
  151. package/dist/services/member-home.js +15 -12
  152. package/dist/services/member-home.js.map +1 -1
  153. package/dist/services/model-pricing.d.ts.map +1 -1
  154. package/dist/services/model-pricing.js +7 -8
  155. package/dist/services/model-pricing.js.map +1 -1
  156. package/dist/services/orphan-recovery.d.ts +6 -3
  157. package/dist/services/orphan-recovery.d.ts.map +1 -1
  158. package/dist/services/orphan-recovery.js +17 -14
  159. package/dist/services/orphan-recovery.js.map +1 -1
  160. package/dist/services/preflight-check.js +2 -2
  161. package/dist/services/preflight-check.js.map +1 -1
  162. package/dist/services/secret-token.d.ts +38 -0
  163. package/dist/services/secret-token.d.ts.map +1 -0
  164. package/dist/services/secret-token.js +51 -0
  165. package/dist/services/secret-token.js.map +1 -0
  166. package/dist/services/service-manager/types.d.ts +3 -1
  167. package/dist/services/service-manager/types.d.ts.map +1 -1
  168. package/dist/services/service-manager/windows.d.ts +14 -2
  169. package/dist/services/service-manager/windows.d.ts.map +1 -1
  170. package/dist/services/service-manager/windows.js +65 -7
  171. package/dist/services/service-manager/windows.js.map +1 -1
  172. package/dist/services/shell-probe.d.ts +131 -0
  173. package/dist/services/shell-probe.d.ts.map +1 -0
  174. package/dist/services/shell-probe.js +210 -0
  175. package/dist/services/shell-probe.js.map +1 -0
  176. package/dist/services/singleton.d.ts +2 -0
  177. package/dist/services/singleton.d.ts.map +1 -1
  178. package/dist/services/singleton.js +1 -1
  179. package/dist/services/singleton.js.map +1 -1
  180. package/dist/services/ssh.d.ts.map +1 -1
  181. package/dist/services/ssh.js +60 -4
  182. package/dist/services/ssh.js.map +1 -1
  183. package/dist/services/stall/find-log-file.d.ts.map +1 -1
  184. package/dist/services/stall/find-log-file.js +22 -16
  185. package/dist/services/stall/find-log-file.js.map +1 -1
  186. package/dist/services/stall/read-log-tail.d.ts.map +1 -1
  187. package/dist/services/stall/read-log-tail.js +26 -15
  188. package/dist/services/stall/read-log-tail.js.map +1 -1
  189. package/dist/services/stall/stall-detector.d.ts +53 -4
  190. package/dist/services/stall/stall-detector.d.ts.map +1 -1
  191. package/dist/services/stall/stall-detector.js +212 -34
  192. package/dist/services/stall/stall-detector.js.map +1 -1
  193. package/dist/services/stall/stall-poller.d.ts.map +1 -1
  194. package/dist/services/stall/stall-poller.js +35 -42
  195. package/dist/services/stall/stall-poller.js.map +1 -1
  196. package/dist/services/strategy.d.ts +9 -0
  197. package/dist/services/strategy.d.ts.map +1 -1
  198. package/dist/services/strategy.js +119 -8
  199. package/dist/services/strategy.js.map +1 -1
  200. package/dist/services/substitution-engine.js +2 -2
  201. package/dist/services/substitution-engine.js.map +1 -1
  202. package/dist/services/tool-registry.d.ts.map +1 -1
  203. package/dist/services/tool-registry.js +5 -3
  204. package/dist/services/tool-registry.js.map +1 -1
  205. package/dist/services/user-config.js +1 -1
  206. package/dist/services/user-config.js.map +1 -1
  207. package/dist/services/vcs/azure-devops.d.ts +67 -2
  208. package/dist/services/vcs/azure-devops.d.ts.map +1 -1
  209. package/dist/services/vcs/azure-devops.js +281 -15
  210. package/dist/services/vcs/azure-devops.js.map +1 -1
  211. package/dist/services/vcs/bitbucket.d.ts.map +1 -1
  212. package/dist/services/vcs/bitbucket.js +16 -0
  213. package/dist/services/vcs/bitbucket.js.map +1 -1
  214. package/dist/services/vcs/github.d.ts.map +1 -1
  215. package/dist/services/vcs/github.js +24 -0
  216. package/dist/services/vcs/github.js.map +1 -1
  217. package/dist/services/vcs/types.d.ts +123 -2
  218. package/dist/services/vcs/types.d.ts.map +1 -1
  219. package/dist/skills/fleet-sprint-cli/SKILL.md +20 -1
  220. package/dist/skills/pm/SKILL.md +1 -2
  221. package/dist/skills/pm/cost.md +0 -4
  222. package/dist/skills/pm/fleet-addendum.md +2 -3
  223. package/dist/tools/check-status.d.ts +7 -4
  224. package/dist/tools/check-status.d.ts.map +1 -1
  225. package/dist/tools/check-status.js +5 -3
  226. package/dist/tools/check-status.js.map +1 -1
  227. package/dist/tools/cloud-control.js +2 -2
  228. package/dist/tools/cloud-control.js.map +1 -1
  229. package/dist/tools/compose-permissions.d.ts +6 -0
  230. package/dist/tools/compose-permissions.d.ts.map +1 -1
  231. package/dist/tools/compose-permissions.js +211 -50
  232. package/dist/tools/compose-permissions.js.map +1 -1
  233. package/dist/tools/credential-store-set.js +1 -1
  234. package/dist/tools/execute-command.d.ts.map +1 -1
  235. package/dist/tools/execute-command.js +56 -29
  236. package/dist/tools/execute-command.js.map +1 -1
  237. package/dist/tools/execute-prompt.d.ts +15 -2
  238. package/dist/tools/execute-prompt.d.ts.map +1 -1
  239. package/dist/tools/execute-prompt.js +1214 -873
  240. package/dist/tools/execute-prompt.js.map +1 -1
  241. package/dist/tools/kb-capture.d.ts +2 -2
  242. package/dist/tools/kb-capture.d.ts.map +1 -1
  243. package/dist/tools/kb-capture.js +29 -5
  244. package/dist/tools/kb-capture.js.map +1 -1
  245. package/dist/tools/kb-export.d.ts +2 -2
  246. package/dist/tools/kb-export.d.ts.map +1 -1
  247. package/dist/tools/kb-export.js +3 -28
  248. package/dist/tools/kb-export.js.map +1 -1
  249. package/dist/tools/kb-feedback.d.ts.map +1 -1
  250. package/dist/tools/kb-feedback.js +3 -1
  251. package/dist/tools/kb-feedback.js.map +1 -1
  252. package/dist/tools/kb-freshness-sweep.d.ts.map +1 -1
  253. package/dist/tools/kb-freshness-sweep.js +3 -1
  254. package/dist/tools/kb-freshness-sweep.js.map +1 -1
  255. package/dist/tools/kb-import.d.ts.map +1 -1
  256. package/dist/tools/kb-import.js +2 -1
  257. package/dist/tools/kb-import.js.map +1 -1
  258. package/dist/tools/kb-list.d.ts.map +1 -1
  259. package/dist/tools/kb-list.js +3 -1
  260. package/dist/tools/kb-list.js.map +1 -1
  261. package/dist/tools/kb-query.d.ts +2 -2
  262. package/dist/tools/kb-reconcile-prefilter.d.ts.map +1 -1
  263. package/dist/tools/kb-reconcile-prefilter.js +3 -1
  264. package/dist/tools/kb-reconcile-prefilter.js.map +1 -1
  265. package/dist/tools/kb-resolve-contradiction.d.ts.map +1 -1
  266. package/dist/tools/kb-resolve-contradiction.js +3 -1
  267. package/dist/tools/kb-resolve-contradiction.js.map +1 -1
  268. package/dist/tools/kb-setup.d.ts.map +1 -1
  269. package/dist/tools/kb-setup.js +125 -20
  270. package/dist/tools/kb-setup.js.map +1 -1
  271. package/dist/tools/kb-stats.d.ts.map +1 -1
  272. package/dist/tools/kb-stats.js +64 -43
  273. package/dist/tools/kb-stats.js.map +1 -1
  274. package/dist/tools/list-members.d.ts +2 -2
  275. package/dist/tools/list-members.d.ts.map +1 -1
  276. package/dist/tools/list-members.js +7 -2
  277. package/dist/tools/list-members.js.map +1 -1
  278. package/dist/tools/member-detail.d.ts +2 -2
  279. package/dist/tools/member-detail.d.ts.map +1 -1
  280. package/dist/tools/member-detail.js +22 -3
  281. package/dist/tools/member-detail.js.map +1 -1
  282. package/dist/tools/member-reservation.d.ts +58 -1
  283. package/dist/tools/member-reservation.d.ts.map +1 -1
  284. package/dist/tools/member-reservation.js +71 -18
  285. package/dist/tools/member-reservation.js.map +1 -1
  286. package/dist/tools/monitor-task.d.ts.map +1 -1
  287. package/dist/tools/monitor-task.js +17 -2
  288. package/dist/tools/monitor-task.js.map +1 -1
  289. package/dist/tools/provision-auth.d.ts +80 -1
  290. package/dist/tools/provision-auth.d.ts.map +1 -1
  291. package/dist/tools/provision-auth.js +147 -59
  292. package/dist/tools/provision-auth.js.map +1 -1
  293. package/dist/tools/provision-vcs-auth.d.ts +96 -3
  294. package/dist/tools/provision-vcs-auth.d.ts.map +1 -1
  295. package/dist/tools/provision-vcs-auth.js +254 -88
  296. package/dist/tools/provision-vcs-auth.js.map +1 -1
  297. package/dist/tools/register-member.d.ts +21 -12
  298. package/dist/tools/register-member.d.ts.map +1 -1
  299. package/dist/tools/register-member.js +141 -16
  300. package/dist/tools/register-member.js.map +1 -1
  301. package/dist/tools/remove-member.d.ts.map +1 -1
  302. package/dist/tools/remove-member.js +29 -4
  303. package/dist/tools/remove-member.js.map +1 -1
  304. package/dist/tools/revoke-vcs-auth.js +2 -2
  305. package/dist/tools/revoke-vcs-auth.js.map +1 -1
  306. package/dist/tools/send-email.d.ts +2 -2
  307. package/dist/tools/setup-git-app.d.ts.map +1 -1
  308. package/dist/tools/setup-git-app.js +11 -7
  309. package/dist/tools/setup-git-app.js.map +1 -1
  310. package/dist/tools/setup-ssh-key.d.ts.map +1 -1
  311. package/dist/tools/setup-ssh-key.js +2 -1
  312. package/dist/tools/setup-ssh-key.js.map +1 -1
  313. package/dist/tools/shutdown-server.d.ts +2 -0
  314. package/dist/tools/shutdown-server.d.ts.map +1 -1
  315. package/dist/tools/shutdown-server.js +23 -1
  316. package/dist/tools/shutdown-server.js.map +1 -1
  317. package/dist/tools/stop-prompt.js +2 -2
  318. package/dist/tools/stop-prompt.js.map +1 -1
  319. package/dist/tools/update-agent-cli.js +2 -2
  320. package/dist/tools/update-agent-cli.js.map +1 -1
  321. package/dist/tools/update-member.d.ts +21 -12
  322. package/dist/tools/update-member.d.ts.map +1 -1
  323. package/dist/tools/update-member.js +61 -12
  324. package/dist/tools/update-member.js.map +1 -1
  325. package/dist/tools/vcs-credential-exec.d.ts +127 -0
  326. package/dist/tools/vcs-credential-exec.d.ts.map +1 -0
  327. package/dist/tools/vcs-credential-exec.js +197 -0
  328. package/dist/tools/vcs-credential-exec.js.map +1 -0
  329. package/dist/types.d.ts +24 -1
  330. package/dist/types.d.ts.map +1 -1
  331. package/dist/utils/agent-helpers.d.ts +36 -0
  332. package/dist/utils/agent-helpers.d.ts.map +1 -1
  333. package/dist/utils/agent-helpers.js +39 -1
  334. package/dist/utils/agent-helpers.js.map +1 -1
  335. package/dist/utils/log-helpers.d.ts.map +1 -1
  336. package/dist/utils/log-helpers.js +2 -2
  337. package/dist/utils/log-helpers.js.map +1 -1
  338. package/dist/utils/platform.d.ts +7 -0
  339. package/dist/utils/platform.d.ts.map +1 -1
  340. package/dist/utils/platform.js +11 -1
  341. package/dist/utils/platform.js.map +1 -1
  342. package/dist/utils/prompt-errors.d.ts.map +1 -1
  343. package/dist/utils/prompt-errors.js +7 -1
  344. package/dist/utils/prompt-errors.js.map +1 -1
  345. package/dist/utils/shell-escape.d.ts +16 -0
  346. package/dist/utils/shell-escape.d.ts.map +1 -1
  347. package/dist/utils/shell-escape.js +22 -2
  348. package/dist/utils/shell-escape.js.map +1 -1
  349. package/dist/utils/vcs-provider-detect.d.ts +65 -0
  350. package/dist/utils/vcs-provider-detect.d.ts.map +1 -0
  351. package/dist/utils/vcs-provider-detect.js +109 -0
  352. package/dist/utils/vcs-provider-detect.js.map +1 -0
  353. package/dist/utils/workspace-trust.d.ts +20 -17
  354. package/dist/utils/workspace-trust.d.ts.map +1 -1
  355. package/dist/utils/workspace-trust.js +91 -1
  356. package/dist/utils/workspace-trust.js.map +1 -1
  357. package/dist/workflows/auto-sprint.js +180 -32
  358. package/package.json +7 -5
  359. package/packages/apra-fleet-client/src/client/api.mjs +403 -12
  360. package/packages/apra-fleet-client/src/client/errors.mjs +6 -2
  361. package/packages/apra-fleet-se/apra-pm/agents/_shared/GRAPH-SEMANTICS.md +10 -2
  362. package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +42 -21
  363. package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +14 -0
  364. package/packages/apra-fleet-se/apra-pm/agents/deployer.md +59 -46
  365. package/packages/apra-fleet-se/apra-pm/agents/doer.md +157 -134
  366. package/packages/apra-fleet-se/apra-pm/agents/harvester.md +31 -32
  367. package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +92 -113
  368. package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +40 -42
  369. package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +139 -63
  370. package/packages/apra-fleet-se/apra-pm/agents/planner.md +176 -100
  371. package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +77 -81
  372. package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +69 -85
  373. package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-output.json +1 -1
  374. package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
  375. package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +4 -17
  376. package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +1 -2
  377. package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -4
  378. package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -3
  379. package/packages/apra-fleet-se/bin/cli.mjs +280 -3
  380. package/packages/apra-fleet-se/bin/serve.mjs +114 -5
  381. package/packages/apra-fleet-se/fleet-sprint/abort.mjs +481 -0
  382. package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +491 -0
  383. package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +282 -0
  384. package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +208 -0
  385. package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +638 -0
  386. package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +301 -0
  387. package/packages/apra-fleet-se/fleet-sprint/branch-ensure.mjs +96 -0
  388. package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +8 -0
  389. package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +199 -34
  390. package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +516 -0
  391. package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +184 -0
  392. package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +1121 -0
  393. package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +216 -4
  394. package/packages/apra-fleet-se/fleet-sprint/docs/README.md +23 -8
  395. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-manual-recovery-verified.md +10 -8
  396. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +285 -4
  397. package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +3 -3
  398. package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
  399. package/packages/apra-fleet-se/fleet-sprint/docs/shared-orchestrator-reservation-design.md +12 -12
  400. package/packages/apra-fleet-se/fleet-sprint/docs/stabilization-log.md +14 -4
  401. package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
  402. package/packages/apra-fleet-se/fleet-sprint/dolt-settle.mjs +275 -99
  403. package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +1054 -39
  404. package/packages/apra-fleet-se/fleet-sprint/errors.mjs +308 -0
  405. package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +501 -0
  406. package/packages/apra-fleet-se/fleet-sprint/fatal-diagnostics.mjs +134 -0
  407. package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +102 -0
  408. package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +556 -0
  409. package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +495 -0
  410. package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +564 -0
  411. package/packages/apra-fleet-se/fleet-sprint/inline-ladder-guard.mjs +216 -0
  412. package/packages/apra-fleet-se/fleet-sprint/kb.mjs +728 -0
  413. package/packages/apra-fleet-se/fleet-sprint/mcp-result.mjs +75 -0
  414. package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +252 -0
  415. package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +581 -0
  416. package/packages/apra-fleet-se/fleet-sprint/member-target.mjs +93 -0
  417. package/packages/apra-fleet-se/fleet-sprint/newtask-text.mjs +266 -0
  418. package/packages/apra-fleet-se/fleet-sprint/parent-notes-staleness.mjs +201 -0
  419. package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +136 -0
  420. package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +822 -0
  421. package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +294 -0
  422. package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +403 -0
  423. package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +180 -0
  424. package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +358 -0
  425. package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +390 -0
  426. package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +323 -0
  427. package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +232 -0
  428. package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +174 -0
  429. package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +197 -0
  430. package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +305 -0
  431. package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +559 -0
  432. package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +1416 -0
  433. package/packages/apra-fleet-se/fleet-sprint/round-session.mjs +100 -0
  434. package/packages/apra-fleet-se/fleet-sprint/runner.js +1672 -9072
  435. package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +134 -0
  436. package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +159 -0
  437. package/packages/apra-fleet-se/fleet-sprint/se-windows-gitbash.mjs +97 -0
  438. package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +143 -0
  439. package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +304 -0
  440. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +20 -1
  441. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +21 -2
  442. package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +454 -0
  443. package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +239 -0
  444. package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +163 -0
  445. package/packages/apra-fleet-se/fleet-sprint/unbracketed-push-guard.mjs +234 -0
  446. package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +211 -0
  447. package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +1279 -0
  448. package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +204 -19
  449. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +707 -12
  450. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
  451. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/dolt.mjs +33 -4
  452. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +191 -43
  453. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +333 -6
  454. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +165 -0
  455. package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +167 -37
  456. package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +559 -0
  457. package/packages/apra-fleet-se/package.json +1 -1
  458. package/packages/apra-fleet-workflow/src/viewer/index.mjs +178 -1
  459. package/packages/apra-fleet-workflow/src/workflow/index.mjs +478 -32
  460. package/skills/fleet/SKILL.md +27 -16
  461. package/skills/fleet/auth-azdevops.md +57 -7
  462. package/skills/fleet/auth-bitbucket.md +5 -5
  463. package/skills/fleet/auth-github.md +7 -6
  464. package/skills/fleet/beads-conflict-resolution.md +141 -0
  465. package/skills/fleet/beads.md +16 -12
  466. package/skills/fleet/onboarding.md +6 -6
  467. package/skills/fleet/permissions.md +11 -7
  468. package/skills/fleet/profiles/node.json +1 -1
  469. package/skills/fleet/skill-matrix.md +1 -1
  470. package/skills/fleet/troubleshooting.md +4 -3
  471. package/version.json +1 -1
  472. package/dist/providers/gemini.d.ts +0 -52
  473. package/dist/providers/gemini.d.ts.map +0 -1
  474. package/dist/providers/gemini.js +0 -236
  475. package/dist/providers/gemini.js.map +0 -1
  476. package/packages/apra-fleet-se/fleet-sprint/docs/coach-role-design.md +0 -23
@@ -0,0 +1,564 @@
1
+ import path from 'path';
2
+ import { fileURLToPath } from 'url';
3
+
4
+ // =============================================================================
5
+ // SHARED GUARDED-MODULE LIST -- the single place a newly extracted fleet-sprint
6
+ // module is registered for mechanical guard coverage.
7
+ //
8
+ // WHY THIS EXISTS: every mechanical guard in this directory
9
+ // (dispatch-safety-guard.mjs, dolt-literal-guard.mjs, full-db-fetch-guard.mjs,
10
+ // shell-command-guard.mjs, unbracketed-push-guard.mjs) was originally pointed
11
+ // at ONE hard-coded file -- runner.js -- by each of its own tests. runner.js
12
+ // is being decomposed into smaller modules; under the old wiring, the moment
13
+ // a guarded construct moved out of runner.js into a newly extracted module,
14
+ // EVERY guard silently stopped covering it while continuing to report a green
15
+ // baseline. That is the exact failure mode this list prevents: extract a
16
+ // module, add ONE line here, and all five guards pick it up at once.
17
+ //
18
+ // REGISTERING A NEWLY EXTRACTED MODULE: add its filename to GUARDED_MODULES
19
+ // below. Do not add a second list anywhere else, and do not re-point an
20
+ // individual guard at its own private array of paths -- a guard that does not
21
+ // consume this list is a guard whose coverage silently rots.
22
+ //
23
+ // STANDING RULE (from apra-fleet-3swo.8): registering a newly extracted module
24
+ // is part of the extraction bead itself, not a follow-up bead. guarded-modules.mjs
25
+ // and the guard test files that consume it (dispatch-safety-guard.test.mjs,
26
+ // dolt-literal-guard.test.mjs, full-db-fetch-tripwire.test.mjs,
27
+ // guarded-modules-coverage.test.mjs, pause-guard-push-holes.test.mjs) are a
28
+ // single mutex resource; any future bead that adds a line here MUST belong to
29
+ // the same streak as, or run after, whatever else is editing them.
30
+ //
31
+ // NESTED ENTRIES ARE LEGAL (first used by apra-fleet-3swo.6.2's phases/*
32
+ // modules): guardedModulePath() path.joins a 'dir/file.mjs' entry, so it
33
+ // resolves and scans exactly like a flat one. What differs is REPORTING --
34
+ // every guard labels a scanned file by path.basename() -- so a baseline that
35
+ // compares a guard's `files` output must use guardedModuleBasenames(), never
36
+ // GUARDED_MODULES verbatim. Note the COMPLETENESS check in
37
+ // guarded-modules-coverage.test.mjs deliberately compares FULL RELATIVE PATHS
38
+ // instead, so a nested module can never ride on an unrelated entry that
39
+ // merely shares its bare filename.
40
+ //
41
+ // WHAT DOES *NOT* BELONG HERE: the per-shell command builders --
42
+ // se-posix.mjs, se-windows.mjs, se-windows-gitbash.mjs, se-os-commands.mjs and
43
+ // dolt-settle.mjs. They deliberately emit `$HOME`, `$env:USERPROFILE`,
44
+ // `$env:TEMP` and `$( )` because they ARE the OS-branched command surface the
45
+ // shell-command invariant tells everyone else to route through; scanning them
46
+ // would report their entire reason for existing as violations. Likewise
47
+ // dolt-sync.mjs, which legitimately builds the `bd dolt pull`/`bd dolt push`
48
+ // command strings (see DOLT_LITERAL_EXEMPT below and dolt-literal-guard.mjs's
49
+ // own header).
50
+ // =============================================================================
51
+
52
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
53
+
54
+ /**
55
+ * Filenames (relative to this directory) of every fleet-sprint module the
56
+ * mechanical guards must scan. Add a newly extracted module here -- this is
57
+ * the single registration point.
58
+ */
59
+ export const GUARDED_MODULES = [
60
+ 'runner.js',
61
+ 'vcs-auth.mjs',
62
+ 'mcp-result.mjs',
63
+ 'member-target.mjs',
64
+ 'abort.mjs',
65
+ 'branch-ensure.mjs',
66
+ 'prompts.mjs',
67
+ 'worklists.mjs',
68
+ 'sprint-args.mjs',
69
+ 'git-sync.mjs',
70
+ 'coordination.mjs',
71
+ 'kb.mjs',
72
+ 'beads-scope.mjs',
73
+ 'beads-transitions.mjs',
74
+ 'role-policies.mjs',
75
+ 'inline-ladder-guard.mjs',
76
+ // apra-fleet-3swo.5.3: the dispatchRole engine. It hosts the ONE real
77
+ // agent() dispatch every migrated role ladder now runs through, so it
78
+ // must be scanned by dispatch-safety-guard (member_name at the call
79
+ // site) exactly like the runner.js ladders it replaces.
80
+ 'dispatch-role.mjs',
81
+ // apra-fleet-3swo.6.1: the per-sprint resolved state (the sprint-scoped
82
+ // fleet client every settle-shell resolution shares, plus the relocated
83
+ // per-member VCS provider resolver). It builds no member-bound command
84
+ // string today, but it is the module every future phase module asks for
85
+ // the member's resolved shell -- exactly the input the shell-command
86
+ // invariant is about -- so it is registered from the start rather than
87
+ // retrofitted later.
88
+ 'sprint-state.mjs',
89
+ // apra-fleet-3swo.6.2: the first two phase modules sliced out of
90
+ // runSprintCycle. These are the first NESTED entries in this list --
91
+ // guardedModulePath() path.joins them, so they resolve and scan
92
+ // correctly, but every guard labels a scanned file by path.basename(),
93
+ // so they are always REPORTED as 'ensure-sprint-branch.mjs' and
94
+ // 'plan.mjs'. Any baseline assertion must therefore compare against
95
+ // guardedModuleBasenames() rather than GUARDED_MODULES verbatim (see
96
+ // that function's doc comment below).
97
+ //
98
+ // ensure-sprint-branch.mjs took EIGHT member_name-bearing command() call
99
+ // sites out of runner.js (now TEN -- see the POST-EXTRACTION FIX note in
100
+ // that file's header for the two diagnostic-only tip-SHA probes added by
101
+ // apra-fleet-3swo's fleet-mac regression investigation) and plan.mjs took
102
+ // THREE, which is exactly why both are registered as part of the
103
+ // extraction rather than afterwards: guarded dispatch sites would
104
+ // otherwise leave runner.js's scanned surface and land in files no guard
105
+ // reads, with every guard still green.
106
+ 'phases/ensure-sprint-branch.mjs',
107
+ 'phases/plan.mjs',
108
+ // apra-fleet-3swo.6.7: the next two phase modules sliced out of
109
+ // runSprintCycle, both from INSIDE its Develop/Review round loop. Same
110
+ // nested-entry reporting caveat as the pair above (they are always
111
+ // REPORTED as 'replan.mjs' and 'develop.mjs'), so the same rule applies:
112
+ // compare a guard's `files` output against guardedModuleBasenames().
113
+ //
114
+ // Neither took a command() call site out of runner.js -- replan.mjs's only
115
+ // repo-side effect is a shared gitSync bracket, and develop.mjs reaches bd
116
+ // exclusively through runner-exported helpers it is handed -- but each
117
+ // took TWO dispatchRole() call sites (the scoped planner + scoped
118
+ // plan-reviewer, and the streak-assignment + doer ladders). Those are
119
+ // exactly what dispatch-safety-guard and the phase 3 dispatch census read,
120
+ // so registering them as part of the extraction is what keeps the census
121
+ // whole instead of quietly shrinking runner.js's scanned surface.
122
+ 'phases/replan.mjs',
123
+ 'phases/develop.mjs',
124
+ // apra-fleet-3swo.6.5: the per-round Review and the per-cycle Deploy
125
+ // phases. Same nested-entry reporting caveat as the four above (they are
126
+ // always REPORTED as 'review.mjs' and 'deploy.mjs'), so the same rule
127
+ // applies: compare a guard's `files` output against
128
+ // guardedModuleBasenames().
129
+ //
130
+ // review.mjs took ONE member_name-bearing command() call site out of
131
+ // runner.js (the `bd show <ids> --json` acceptance-criteria read) and NO
132
+ // dispatchRole site -- the reviewer ladder runs through runner.js's
133
+ // dispatchReview() helper, which the Review and Re-Review phases share
134
+ // (runner.js:2494 and :2762; Final Review does not receive it -- see the
135
+ // apra-fleet-3swo.65 correction below), so it stayed there. deploy.mjs
136
+ // took no command() site but ONE
137
+ // dispatchRole site (the deployer ladder). Registering both as part of the
138
+ // extraction is what keeps the guarded command census and the phase 3
139
+ // dispatch census whole instead of quietly shrinking runner.js's scanned
140
+ // surface.
141
+ 'phases/review.mjs',
142
+ 'phases/deploy.mjs',
143
+ // apra-fleet-3swo.6.8: the per-cycle Integ Test and the Re-Review that
144
+ // Cycle Evaluation dispatches when the goal-priority count reads 0 but no
145
+ // review ran this cycle. Same nested-entry reporting caveat as the six
146
+ // above (they are always REPORTED as 'integ-test.mjs' and
147
+ // 're-review.mjs'), so the same rule applies: compare a guard's `files`
148
+ // output against guardedModuleBasenames().
149
+ //
150
+ // integ-test.mjs took TWO member_name-bearing command() call sites out of
151
+ // runner.js -- the verify-fail bounce cap's `bd show <bugId> --json` parent
152
+ // lookup and its `bd update <parentId> --status=deferred --append-notes`
153
+ // deferral -- plus ONE dispatchRole site (the integ-test-runner ladder).
154
+ // re-review.mjs took NEITHER: its reopen/newTask writes go through
155
+ // applyGuardedReopens (beads-transitions.mjs) and
156
+ // createChildBeadWithAllocatedId/computeChildFloor, whose command() sites
157
+ // live in the modules that own them, and the reviewer ladder runs through
158
+ // runner.js's shared dispatchReview() helper, which the Review phase
159
+ // (runner.js:2494) also calls -- NOT Final Review, which passes no
160
+ // dispatchReview at all (runner.js:2834; see apra-fleet-3swo.65). A grep
161
+ // for `dispatchReview` across phases/ overcounts: the identifier also
162
+ // appears inside a shared boilerplate comment ("No duplicate log() dump
163
+ // -- see dispatchReview() for why") that SEVEN files carry verbatim --
164
+ // phases/harvest.mjs, phases/plan.mjs, phases/develop.mjs,
165
+ // phases/integ-test.mjs, phases/final-review.mjs, phases/deploy.mjs and
166
+ // phases/regression-test.mjs -- none of which actually receive the
167
+ // helper. Registering both as part of the extraction is what keeps the
168
+ // guarded command census and the phase 3 dispatch census whole instead of
169
+ // quietly shrinking runner.js's scanned surface.
170
+ 'phases/integ-test.mjs',
171
+ 'phases/re-review.mjs',
172
+ // apra-fleet-3swo.6.6: the sprint's closing Final Review and the
173
+ // once-per-sprint Regression Test. Same nested-entry reporting caveat as
174
+ // the eight above (they are always REPORTED as 'final-review.mjs' and
175
+ // 'regression-test.mjs'), so the same rule applies: compare a guard's
176
+ // `files` output against guardedModuleBasenames().
177
+ //
178
+ // NEITHER took a member_name-bearing command() call site out of runner.js
179
+ // -- final-review.mjs reads beads through the injected bdListScoped and
180
+ // writes them through applyGuardedReopens (beads-transitions.mjs) and
181
+ // computeChildFloor/createChildBeadWithAllocatedId, whose command() sites
182
+ // live in the modules that own them, and regression-test.mjs issues no
183
+ // bd/git command at all (its carry-over beads are filed by the DISPATCHED
184
+ // runner inside its own repo). Each took exactly ONE dispatchRole() site
185
+ // (the final-review and regression-test-runner ladders), which is what
186
+ // dispatch-safety-guard and the phase 3 dispatch census read.
187
+ // final-review.mjs additionally owns a real gitSync bracket at each end,
188
+ // including the findings D-push that apra-fleet-3swo.4.1 brought inside a
189
+ // bracket -- registering it here is what keeps unbracketed-push-guard
190
+ // covering that push instead of silently losing it.
191
+ 'phases/final-review.mjs',
192
+ 'phases/regression-test.mjs',
193
+ // apra-fleet-3swo.6.9: the LAST two phase modules -- Harvest and Publish
194
+ // PR -- which complete the runSprintCycle slice. Same nested-entry
195
+ // reporting caveat as the ten above (they are always REPORTED as
196
+ // 'harvest.mjs' and 'publish-pr.mjs'), so the same rule applies: compare a
197
+ // guard's `files` output against guardedModuleBasenames().
198
+ //
199
+ // harvest.mjs took NO member_name-bearing command() call site out of
200
+ // runner.js -- the docs/changelog/sprint-analysis commits are made by the
201
+ // DISPATCHED harvester inside its own repo and published by the 'harvester'
202
+ // policy row's pushCode/pushBeads bracket -- but it took ONE dispatchRole()
203
+ // site (the harvester ladder), which is what dispatch-safety-guard and the
204
+ // phase 3 dispatch census read.
205
+ //
206
+ // publish-pr.mjs is the opposite shape and the more urgent of the two to
207
+ // register: it took TWO member_name-bearing command() call sites out of
208
+ // runner.js (the `git remote get-url origin` capability probe on the
209
+ // git-capable publish member, and the per-target-issue `bd close` on the
210
+ // orchestrator for a remote that can never open a PR) and NO dispatchRole
211
+ // site, AND it owns the sprint branch's own push --
212
+ // gitSync.pushGitAfter(), the bracketed entry point apra-fleet-3swo.4.1
213
+ // put that push behind. Registering it here is what keeps
214
+ // unbracketed-push-guard covering that push instead of silently losing the
215
+ // one site the guard exists for.
216
+ 'phases/harvest.mjs',
217
+ 'phases/publish-pr.mjs',
218
+ // apra-fleet-3swo.6.3: the git-topology layer sliced out of runner.js --
219
+ // the pre-sprint multi-member topology precondition (checkMemberTopology),
220
+ // the ONE git-failure classifier (classifyGitFailure) and the fail-closed
221
+ // provider lookup that feeds it, the retrying git-command primitive every
222
+ // sync bracket issues its commands through (runGitStep), and the
223
+ // exit-code-based soft-git result adapter (commandResultToSoftGit).
224
+ //
225
+ // It took exactly ONE member_name-bearing command() call site out of
226
+ // runner.js -- runGitStep's single `command(cmd, { member_name: member,
227
+ // silent: true, failSoft: true, label })` dispatch, which EVERY bracketed
228
+ // git command in this package funnels through (syncMemberBefore/After/
229
+ // AfterOrdered here, detectAndAbortRebaseConflict in conflict-ladder.mjs,
230
+ // and abort.mjs's three finalize-path git calls). That makes it the single
231
+ // highest-traffic guarded dispatch site in fleet-sprint, so registering it
232
+ // with the extraction is what keeps dispatch-safety-guard covering it
233
+ // instead of silently losing it the moment it left runner.js.
234
+ 'git-topology.mjs',
235
+ // apra-fleet-3swo.6.10: the per-member git sync BRACKETS that sit on top of
236
+ // git-topology.mjs -- syncMemberBefore (G-pull), syncMemberAfter (G-push
237
+ // plus its bounded pull-rebase retry and Tier 2 conflict dispatch),
238
+ // syncMemberAfterOrdered (the ordered G-push-then-D-push post-dispatch
239
+ // step) and resyncReacquiredMember (the resume path's re-reconciliation).
240
+ //
241
+ // It took exactly ONE member_name-bearing command() call site out of
242
+ // runner.js -- syncMemberAfter's `command('git status --porcelain', {
243
+ // member_name: member, ... })` clean-state read, the mechanical re-check
244
+ // that decides whether a Tier 2 conflict-resolution dispatch really
245
+ // resolved anything. The other three brackets issue every git command
246
+ // through git-topology.mjs's runGitStep, and resyncReacquiredMember runs
247
+ // entirely on injected runners, so none of them adds a site here.
248
+ //
249
+ // Registering it with the extraction is load-bearing TWICE over, and the
250
+ // second reason is the subtle one: unbracketed-push-guard.mjs resolves its
251
+ // sanctioned-wrapper ranges (syncMemberAfterOrdered, verifyDoerStreakClosed)
252
+ // BY NAME WITHIN EACH SCANNED FILE. syncMemberAfterOrdered's bare
253
+ // syncMemberAfter() and DoltSync.syncAfter() calls are sanctioned only
254
+ // because the wrapper declaring them travelled here with them -- so this
255
+ // file must be scanned for that sanction to mean anything, and a future
256
+ // bare primitive added here outside that wrapper must still go red.
257
+ 'member-sync.mjs',
258
+ // apra-fleet-3swo.6.12: the member-provisioning helpers sliced out of
259
+ // runner.js -- createMemberSessionGuard (the pre-resume stop_prompt
260
+ // guard), createUnattendedAutoProvisioner, createDeployPermissionsProvisioner
261
+ // and stageCommandBodyMemberSide.
262
+ //
263
+ // It took exactly TWO member_name-bearing command() call sites out of
264
+ // runner.js: createDeployPermissionsProvisioner's `node -e ...` read of
265
+ // deploy.md's Permissions section, and stageCommandBodyMemberSide's
266
+ // `node -e ...` member-side temp-file write. Both are shell-agnostic
267
+ // (base64-encoded argv, no `$`-expansion/backticks/template literals),
268
+ // which is exactly the invariant shell-command-guard.mjs enforces here.
269
+ // resolveSettleShell stayed in runner.js (module-private composition-root
270
+ // wiring anchored there by test/sprint-state.test.mjs) and is not part of
271
+ // this module's surface.
272
+ 'member-provisioning.mjs',
273
+ // apra-fleet-3swo.6.13: the child-bead allocation and batched-claim
274
+ // command surface sliced out of runner.js -- computeChildFloor,
275
+ // createChildBeadWithAllocatedId, verifyDoerStreakClosed and
276
+ // claimBeadsBatched.
277
+ //
278
+ // It took exactly FIVE member_name-bearing command() call sites out of
279
+ // runner.js: computeChildFloor's `bd list --parent` read, createChild-
280
+ // BeadWithAllocatedId's TWO sites (`bd create --body-file` and the
281
+ // explicit-id path's `bd update --parent` link), verifyDoerStreakClosed's
282
+ // `bd show <ids> --json` post-D-pull read, and claimBeadsBatched's `bd
283
+ // update ... --claim --json` batch. Registering it with the extraction is
284
+ // load-bearing TWICE over, same as git-topology.mjs/member-sync.mjs
285
+ // above: verifyDoerStreakClosed is also one of unbracketed-push-guard.mjs's
286
+ // two SANCTIONED_WRAPPER_FUNCTIONS (its DoltSync.syncBefore() call is only
287
+ // sanctioned because that function's OWN declaration -- and therefore its
288
+ // body range -- is found by scanning this file), so this module must be
289
+ // scanned for that sanction to mean anything.
290
+ 'beads-children.mjs',
291
+ // apra-fleet-3swo.6.14: the PR-body/cost-report text surface
292
+ // (sprint-report.mjs: sanitizePrText, buildAnalysisText, buildCostAnalysis,
293
+ // computeBranchSlug) and the verdict/newTask text surface
294
+ // (newtask-text.mjs: extractContestedBeadIds, SAFE_TEXT_RE,
295
+ // normalizeTierToken, trackRejectedNewTaskForResurfacing,
296
+ // clearResubmittedNewTask, reconcilePendingRejectedNewTasks,
297
+ // buildRejectedNewTaskResurfaceLines), both sliced out of runner.js.
298
+ //
299
+ // Neither took a member_name-bearing command() or agent() call site out of
300
+ // runner.js -- every one of these eleven symbols is pure text
301
+ // formatting/validation with no bd/git/dispatch surface of its own -- so
302
+ // both get a ZERO baseline in dispatch-safety-guard.test.mjs. The zero is
303
+ // not a formality: it is what turns a future raw command()/agent() landing
304
+ // in either file into a red test instead of a silently unguarded site.
305
+ 'sprint-report.mjs',
306
+ 'newtask-text.mjs',
307
+ // apra-fleet-fsxg: the parent-NOTES staleness signal. Its pure core is text
308
+ // formatting, but collectParentNotesStalenessNotes carries TWO member_name-
309
+ // bearing command() call sites (`bd list --parent <id> --json` and `bd
310
+ // history <id> --json`), so it must be scanned by dispatch-safety-guard
311
+ // exactly like any other guarded command surface -- see its own explicit
312
+ // baseline (EXPECTED_PARENT_NOTES_STALENESS_COMMAND_COUNT) in
313
+ // dispatch-safety-guard.test.mjs.
314
+ 'parent-notes-staleness.mjs',
315
+ // apra-fleet-3swo.6.15: the round-resume session registry
316
+ // (round-session.mjs: DEFAULT_CONTEXT_CEILING, createRoundSessionRegistry)
317
+ // and the dispatch-outcome classification surface (dispatch-failure.mjs:
318
+ // isTerminalSprintFailure, isNoMutationDispatchFailure,
319
+ // withDispatchWatchdog), both sliced out of runner.js.
320
+ //
321
+ // Neither took a member_name-bearing command() or agent() call site out of
322
+ // runner.js -- round-session.mjs is a pure in-memory session map with no
323
+ // bd/git/dispatch surface, and dispatch-failure.mjs only CLASSIFIES an
324
+ // already-thrown error or races an already-in-flight dispatch PROMISE
325
+ // (dispatch-role.mjs owns the one real agent() call site that promise
326
+ // comes from) -- so both get a ZERO baseline in
327
+ // dispatch-safety-guard.test.mjs. The zero is not a formality: it is what
328
+ // turns a future raw command()/agent() landing in either file into a red
329
+ // test instead of a silently unguarded site.
330
+ 'round-session.mjs',
331
+ 'dispatch-failure.mjs',
332
+ // apra-fleet-3swo.6.16: the fatal-diagnostics guard
333
+ // (installFatalDiagnosticsGuard) and the terminal-state Dolt-conflict
334
+ // classification helpers (findDoltDivergedCause, resolveTerminalReason,
335
+ // captureDoltConflictDump), sliced out of runner.js.
336
+ //
337
+ // None of the four owns a member_name-bearing command() or dispatchRole()
338
+ // call site out of runner.js -- installFatalDiagnosticsGuard only wires
339
+ // process-level event listeners, and the other three purely classify an
340
+ // already-thrown error's `.cause` chain -- so this module gets a ZERO
341
+ // baseline in dispatch-safety-guard.test.mjs, same as sprint-report.mjs/
342
+ // newtask-text.mjs/round-session.mjs/dispatch-failure.mjs above. The zero
343
+ // is not a formality: it is what turns a future raw command()/agent()
344
+ // landing in this file into a red test instead of a silently unguarded
345
+ // site.
346
+ 'fatal-diagnostics.mjs',
347
+ // apra-fleet-3swo.25: the remaining fleet-sprint modules that scan clean
348
+ // (zero violations) across all five guards. Registered together so the
349
+ // completeness test (guarded-modules-coverage.test.mjs) has nothing left
350
+ // unaccounted for besides GUARD_REGISTRATION_EXEMPT below.
351
+ 'conflict-ladder.mjs',
352
+ 'contracts.mjs',
353
+ 'dispatch-safety-guard.mjs',
354
+ 'errors.mjs',
355
+ 'full-db-fetch-guard.mjs',
356
+ 'shell-command-guard.mjs',
357
+ 'sprint-lock.mjs',
358
+ 'sprint-progress.mjs',
359
+ // apra-fleet-hzeb.4.2: the usage-limit pause/resume/re-probe controller.
360
+ // It carries ONE real agent() re-probe dispatch, which names its member
361
+ // explicitly, so it scans clean under dispatch-safety-guard and is
362
+ // registered here (not exempted) to keep that live dispatch site guarded.
363
+ 'usage-limit-controller.mjs',
364
+ 'unbracketed-push-guard.mjs',
365
+ // apra-fleet-btj9.7: the explicit-id-create guard checker. Registered
366
+ // normally (not exempted) like unbracketed-push-guard.mjs above -- it
367
+ // issues no command()/agent() call of its own (its 'bd create' mentions
368
+ // are all prose inside comments/messages, never a dispatched call), so it
369
+ // scans clean under itself and every other guard rather than needing a
370
+ // GUARD_REGISTRATION_EXEMPT carve-out.
371
+ 'explicit-id-create-guard.mjs',
372
+ // The beads identity contract (pure parse/compare helpers, no command()
373
+ // or agent() site -- zero baseline) and the precondition that runs its
374
+ // three read-only probes: beads-identity-check.mjs carries ONE
375
+ // member_name-bearing command() call site (the probe loop), which is
376
+ // exactly what dispatch-safety-guard must keep scanning.
377
+ 'beads-identity.mjs',
378
+ 'beads-identity-check.mjs',
379
+ 'vcs-module.mjs',
380
+ 'viewer-extensions.mjs',
381
+ 'vcs-providers/azure-devops.mjs',
382
+ 'vcs-providers/bitbucket.mjs',
383
+ 'vcs-providers/dolt.mjs',
384
+ 'vcs-providers/generic-git.mjs',
385
+ 'vcs-providers/github.mjs',
386
+ 'vcs-providers/index.mjs',
387
+ 'vcs-providers/shell-helpers.mjs',
388
+ ];
389
+
390
+ /**
391
+ * Modules the dolt-literal guard must NEVER scan, by basename. dolt-sync.mjs
392
+ * is the single permitted dolt command surface: it builds the literal
393
+ * `bd dolt pull` / `bd dolt push` strings on purpose (apra-fleet-417.2.1/
394
+ * 417.2.2), so pointing the dolt-literal guard at it would flag the sync
395
+ * module for being the sync module. Documented verbatim in
396
+ * dolt-literal-guard.mjs's header; enforced here so the exemption survives
397
+ * anyone adding dolt-sync.mjs to GUARDED_MODULES (or passing it explicitly).
398
+ */
399
+ export const DOLT_LITERAL_EXEMPT = ['dolt-sync.mjs'];
400
+
401
+ /**
402
+ * Modules the unbracketed-push guard (unbracketed-push-guard.mjs) must NEVER
403
+ * scan, by basename. git-sync.mjs is the single module allowed to call the
404
+ * raw doltPushAfter()/syncMemberAfter()/DoltSync.syncBefore()/
405
+ * DoltSync.syncAfter() primitives directly: that IS the bracketed-entry-point
406
+ * implementation the guard exists to protect (apra-fleet-3swo.4.1/.4.2), so
407
+ * pointing the guard at git-sync.mjs itself would flag the module for being
408
+ * the module. Mirrors DOLT_LITERAL_EXEMPT's precedent for dolt-sync.mjs
409
+ * above.
410
+ */
411
+ export const UNBRACKETED_PUSH_EXEMPT = ['git-sync.mjs'];
412
+
413
+ /**
414
+ * Modules the explicit-id create guard (explicit-id-create-guard.mjs) must
415
+ * NEVER scan, by basename. beads-children.mjs is the single module allowed to
416
+ * issue a `bd create` command AT ALL (the guard flags any `bd create` site,
417
+ * not just ones carrying a literal `--id` flag -- see that file's header for
418
+ * why): it is the only place the probe-and-refuse seam (assertChildIdFree(),
419
+ * called from createChildBeadWithAllocatedId, apra-fleet-btj9.7) sits
420
+ * immediately before that create, so pointing the guard at beads-children.mjs
421
+ * itself would flag the module for being the module. Mirrors
422
+ * DOLT_LITERAL_EXEMPT's precedent for dolt-sync.mjs above.
423
+ */
424
+ export const EXPLICIT_ID_CREATE_EXEMPT = ['beads-children.mjs'];
425
+
426
+ /**
427
+ * apra-fleet-3swo.25: modules deliberately excluded from GUARDED_MODULES
428
+ * ENTIRELY -- never registered, never scanned by any of the five guards --
429
+ * keyed by filename (relative to this directory, same convention as
430
+ * GUARDED_MODULES) with a non-empty written reason as the value.
431
+ *
432
+ * This is a DIFFERENT kind of exemption than DOLT_LITERAL_EXEMPT/
433
+ * UNBRACKETED_PUSH_EXEMPT above: those two keep a module registered and
434
+ * scanned by the other four guards, filtering it out of ONE guard only. An
435
+ * entry here is not registered at all, because scanning it with ANY guard
436
+ * would report the module's entire reason for existing (or the guard's own
437
+ * detection logic) as a violation of itself.
438
+ * guarded-modules-coverage.test.mjs asserts every *.mjs/*.js file found by a
439
+ * RECURSIVE walk of this directory is present in either GUARDED_MODULES or
440
+ * this map -- so a module can no longer silently fall through both lists.
441
+ */
442
+ export const GUARD_REGISTRATION_EXEMPT = {
443
+ // The five shell builders -- reasons reused verbatim from this file's own
444
+ // "WHAT DOES NOT BELONG HERE" header above (do not re-derive them).
445
+ 'se-posix.mjs':
446
+ 'deliberately emits `$HOME`, `$env:USERPROFILE`, `$env:TEMP` and `$( )` because it IS the ' +
447
+ 'OS-branched command surface the shell-command invariant tells everyone else to route ' +
448
+ 'through; scanning it would report its entire reason for existing as violations.',
449
+ 'se-windows.mjs':
450
+ 'deliberately emits `$HOME`, `$env:USERPROFILE`, `$env:TEMP` and `$( )` because it IS the ' +
451
+ 'OS-branched command surface the shell-command invariant tells everyone else to route ' +
452
+ 'through; scanning it would report its entire reason for existing as violations.',
453
+ 'se-windows-gitbash.mjs':
454
+ 'deliberately emits `$HOME`, `$env:USERPROFILE`, `$env:TEMP` and `$( )` because it IS the ' +
455
+ 'OS-branched command surface the shell-command invariant tells everyone else to route ' +
456
+ 'through; scanning it would report its entire reason for existing as violations.',
457
+ 'se-os-commands.mjs':
458
+ 'deliberately emits `$HOME`, `$env:USERPROFILE`, `$env:TEMP` and `$( )` because it IS the ' +
459
+ 'OS-branched command surface the shell-command invariant tells everyone else to route ' +
460
+ 'through; scanning it would report its entire reason for existing as violations.',
461
+ 'dolt-settle.mjs':
462
+ 'deliberately emits `$HOME`, `$env:USERPROFILE`, `$env:TEMP` and `$( )` because it IS the ' +
463
+ 'OS-branched command surface the shell-command invariant tells everyone else to route ' +
464
+ 'through; scanning it would report its entire reason for existing as violations.',
465
+ // dolt-sync.mjs -- reason reused verbatim from the same header (do not
466
+ // re-derive it).
467
+ 'dolt-sync.mjs':
468
+ 'legitimately builds the `bd dolt pull`/`bd dolt push` command strings (see ' +
469
+ 'DOLT_LITERAL_EXEMPT above and dolt-literal-guard.mjs\'s own header).',
470
+
471
+ // apra-fleet-3swo.25: dolt-literal-guard.mjs -- confirmed guard-detection
472
+ // false positive. dolt-literal-guard.mjs has no per-line suppression
473
+ // mechanism (unlike shell-command-guard.mjs's shell-guard-allow
474
+ // directive, used instead for the other siblings this bead registers --
475
+ // see contracts.mjs, vcs-module.mjs and vcs-providers/{index,shell-
476
+ // helpers}.mjs, all now registered above with per-line allow comments),
477
+ // so this one file is exempted here rather than registered.
478
+ 'dolt-literal-guard.mjs':
479
+ 'dolt-literal-guard\'s own violation-message text builds the literal phrase \'bd dolt pull\'/' +
480
+ '\'bd dolt push\' to describe what it detects, which the guard then flags as a ' +
481
+ 'self-referential violation of its own implementation, and the guard has no per-line ' +
482
+ 'suppression mechanism (unlike shell-command-guard.mjs) to carve out just that one line.',
483
+ // guarded-modules.mjs itself: this map's own reason strings (and the
484
+ // shell-builder header above) necessarily QUOTE the shell-syntax
485
+ // substrings ($HOME, $(, ~/, 'bd dolt pull'/'bd dolt push', etc.) they
486
+ // describe, in real JS string literals -- which the dolt-literal and
487
+ // shell-command guards' naive text-matching then flags as this file
488
+ // issuing/emitting those constructs itself. Same self-referential class
489
+ // of false positive as dolt-literal-guard.mjs and shell-command-guard.mjs
490
+ // above (confirmed by scanning this file with GUARD_REGISTRATION_EXEMPT
491
+ // populated), not a real dispatched command or shell expansion.
492
+ 'guarded-modules.mjs':
493
+ 'this map\'s own reason strings (and the header above) necessarily quote the shell-syntax ' +
494
+ 'and dolt-command substrings they describe, in real JS string literals, which the ' +
495
+ 'dolt-literal and shell-command guards then flag as this file issuing/emitting those ' +
496
+ 'constructs itself -- the same self-referential false positive as dolt-literal-guard.mjs ' +
497
+ 'and shell-command-guard.mjs above.',
498
+ };
499
+
500
+ /** Absolute path to a fleet-sprint module by filename. */
501
+ export function guardedModulePath(fileName) {
502
+ return path.join(__dirname, fileName);
503
+ }
504
+
505
+ /**
506
+ * Absolute paths of every registered guarded module, plus any `extraPaths`
507
+ * the caller appends (tests pass a throwaway fixture module this way, proving
508
+ * the list is what the guards actually read rather than a hard-coded name).
509
+ */
510
+ export function guardedModulePaths(extraPaths = []) {
511
+ if (!Array.isArray(extraPaths)) {
512
+ throw new TypeError('guardedModulePaths(extraPaths): extraPaths must be an array of file paths');
513
+ }
514
+ return [...GUARDED_MODULES.map(guardedModulePath), ...extraPaths];
515
+ }
516
+
517
+ /**
518
+ * Basenames of every registered guarded module, plus any `extraPaths`'
519
+ * basenames appended -- same `extraPaths` contract as guardedModulePaths().
520
+ *
521
+ * apra-fleet-3swo.14: every guard's aggregate entry point (checkModules(),
522
+ * checkDoltLiteralModules(), checkFullDbFetchModules(), checkShellCommandPaths())
523
+ * labels each scanned file by `path.basename(p)`, both in its `files` return
524
+ * value and in every violation string it emits -- so a nested GUARDED_MODULES
525
+ * entry (e.g. 'phases/plan.mjs', legal per guardedModulePath()'s path.join)
526
+ * resolves and scans correctly but is always reported as just 'plan.mjs'.
527
+ * Comparing a guard's `files` output against GUARDED_MODULES verbatim only
528
+ * holds while every entry is a bare filename with no directory component.
529
+ * Baseline tests must compare against THIS function's output instead of
530
+ * GUARDED_MODULES directly.
531
+ */
532
+ export function guardedModuleBasenames(extraPaths = []) {
533
+ return guardedModulePaths(extraPaths).map((p) => path.basename(p));
534
+ }
535
+
536
+ /**
537
+ * The guarded-module list as the dolt-literal guard must see it: the shared
538
+ * list with DOLT_LITERAL_EXEMPT basenames filtered out. Takes the same
539
+ * `extraPaths` as guardedModulePaths so the exemption applies to caller-
540
+ * supplied paths too -- a fixture literally named dolt-sync.mjs is exempt,
541
+ * while byte-identical content under any other name is not.
542
+ */
543
+ export function doltLiteralModulePaths(extraPaths = []) {
544
+ return guardedModulePaths(extraPaths).filter((p) => !DOLT_LITERAL_EXEMPT.includes(path.basename(p)));
545
+ }
546
+
547
+ /**
548
+ * The guarded-module list as the unbracketed-push guard must see it: the
549
+ * shared list with UNBRACKETED_PUSH_EXEMPT basenames filtered out. Same
550
+ * `extraPaths` contract as guardedModulePaths/doltLiteralModulePaths.
551
+ */
552
+ export function unbracketedPushModulePaths(extraPaths = []) {
553
+ return guardedModulePaths(extraPaths).filter((p) => !UNBRACKETED_PUSH_EXEMPT.includes(path.basename(p)));
554
+ }
555
+
556
+ /**
557
+ * The guarded-module list as the explicit-id create guard must see it: the
558
+ * shared list with EXPLICIT_ID_CREATE_EXEMPT basenames filtered out. Same
559
+ * `extraPaths` contract as guardedModulePaths/doltLiteralModulePaths/
560
+ * unbracketedPushModulePaths.
561
+ */
562
+ export function explicitIdCreateModulePaths(extraPaths = []) {
563
+ return guardedModulePaths(extraPaths).filter((p) => !EXPLICIT_ID_CREATE_EXEMPT.includes(path.basename(p)));
564
+ }