@apralabs/apra-fleet 0.4.2 → 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 (370) hide show
  1. package/README.md +38 -5
  2. package/dist/agents/backlog-groomer.md +25 -0
  3. package/dist/agents/ci-watcher.md +11 -0
  4. package/dist/agents/deployer.md +37 -2
  5. package/dist/agents/doer.md +36 -12
  6. package/dist/agents/harvester.md +11 -0
  7. package/dist/agents/integ-test-runner.md +11 -0
  8. package/dist/agents/kb-reconciler.md +9 -0
  9. package/dist/agents/plan-reviewer.md +110 -22
  10. package/dist/agents/planner.md +125 -37
  11. package/dist/agents/regression-test-runner.md +11 -0
  12. package/dist/agents/reviewer.md +13 -2
  13. package/dist/agents/schemas/plan-reviewer-output.json +37 -0
  14. package/dist/cli/agent-transform.d.ts +83 -2
  15. package/dist/cli/agent-transform.d.ts.map +1 -1
  16. package/dist/cli/agent-transform.js +266 -21
  17. package/dist/cli/agent-transform.js.map +1 -1
  18. package/dist/cli/auth.d.ts.map +1 -1
  19. package/dist/cli/auth.js +28 -9
  20. package/dist/cli/auth.js.map +1 -1
  21. package/dist/cli/config.d.ts +7 -5
  22. package/dist/cli/config.d.ts.map +1 -1
  23. package/dist/cli/config.js +44 -34
  24. package/dist/cli/config.js.map +1 -1
  25. package/dist/cli/install.d.ts +33 -0
  26. package/dist/cli/install.d.ts.map +1 -1
  27. package/dist/cli/install.js +290 -23
  28. package/dist/cli/install.js.map +1 -1
  29. package/dist/cli/kb-directives.d.ts.map +1 -1
  30. package/dist/cli/kb-directives.js +2 -1
  31. package/dist/cli/kb-directives.js.map +1 -1
  32. package/dist/cli/register-member.d.ts.map +1 -1
  33. package/dist/cli/register-member.js +6 -2
  34. package/dist/cli/register-member.js.map +1 -1
  35. package/dist/commands/kb-server.d.ts +3 -0
  36. package/dist/commands/kb-server.d.ts.map +1 -1
  37. package/dist/commands/kb-server.js +43 -3
  38. package/dist/commands/kb-server.js.map +1 -1
  39. package/dist/index.js +3 -3
  40. package/dist/os/linux.d.ts +6 -0
  41. package/dist/os/linux.d.ts.map +1 -1
  42. package/dist/os/linux.js +35 -2
  43. package/dist/os/linux.js.map +1 -1
  44. package/dist/os/os-commands.d.ts +61 -2
  45. package/dist/os/os-commands.d.ts.map +1 -1
  46. package/dist/os/windows-gitbash.d.ts +5 -0
  47. package/dist/os/windows-gitbash.d.ts.map +1 -1
  48. package/dist/os/windows-gitbash.js +15 -0
  49. package/dist/os/windows-gitbash.js.map +1 -1
  50. package/dist/os/windows.d.ts +6 -0
  51. package/dist/os/windows.d.ts.map +1 -1
  52. package/dist/os/windows.js +46 -3
  53. package/dist/os/windows.js.map +1 -1
  54. package/dist/providers/agy.d.ts +115 -6
  55. package/dist/providers/agy.d.ts.map +1 -1
  56. package/dist/providers/agy.js +569 -53
  57. package/dist/providers/agy.js.map +1 -1
  58. package/dist/providers/claude.d.ts +81 -3
  59. package/dist/providers/claude.d.ts.map +1 -1
  60. package/dist/providers/claude.js +344 -10
  61. package/dist/providers/claude.js.map +1 -1
  62. package/dist/providers/codex.d.ts +4 -2
  63. package/dist/providers/codex.d.ts.map +1 -1
  64. package/dist/providers/codex.js +19 -2
  65. package/dist/providers/codex.js.map +1 -1
  66. package/dist/providers/copilot.d.ts +4 -2
  67. package/dist/providers/copilot.d.ts.map +1 -1
  68. package/dist/providers/copilot.js +20 -2
  69. package/dist/providers/copilot.js.map +1 -1
  70. package/dist/providers/none.d.ts +4 -2
  71. package/dist/providers/none.d.ts.map +1 -1
  72. package/dist/providers/none.js +17 -2
  73. package/dist/providers/none.js.map +1 -1
  74. package/dist/providers/opencode.d.ts +3 -1
  75. package/dist/providers/opencode.d.ts.map +1 -1
  76. package/dist/providers/opencode.js +22 -2
  77. package/dist/providers/opencode.js.map +1 -1
  78. package/dist/providers/provider.d.ts +201 -6
  79. package/dist/providers/provider.d.ts.map +1 -1
  80. package/dist/providers/provider.js +56 -0
  81. package/dist/providers/provider.js.map +1 -1
  82. package/dist/services/agy-project.d.ts +102 -0
  83. package/dist/services/agy-project.d.ts.map +1 -0
  84. package/dist/services/agy-project.js +356 -0
  85. package/dist/services/agy-project.js.map +1 -0
  86. package/dist/services/auth-socket.js +4 -4
  87. package/dist/services/auth-web.js +1 -1
  88. package/dist/services/cloud/lifecycle.d.ts.map +1 -1
  89. package/dist/services/cloud/lifecycle.js +33 -4
  90. package/dist/services/cloud/lifecycle.js.map +1 -1
  91. package/dist/services/credential-cleanup.d.ts.map +1 -1
  92. package/dist/services/credential-cleanup.js +35 -17
  93. package/dist/services/credential-cleanup.js.map +1 -1
  94. package/dist/services/exit-drain.d.ts +44 -0
  95. package/dist/services/exit-drain.d.ts.map +1 -0
  96. package/dist/services/exit-drain.js +52 -0
  97. package/dist/services/exit-drain.js.map +1 -0
  98. package/dist/services/github-app.d.ts.map +1 -1
  99. package/dist/services/github-app.js +32 -4
  100. package/dist/services/github-app.js.map +1 -1
  101. package/dist/services/http-transport.d.ts +1 -0
  102. package/dist/services/http-transport.d.ts.map +1 -1
  103. package/dist/services/http-transport.js +48 -1
  104. package/dist/services/http-transport.js.map +1 -1
  105. package/dist/services/knowledge/kb-config.d.ts +42 -0
  106. package/dist/services/knowledge/kb-config.d.ts.map +1 -0
  107. package/dist/services/knowledge/kb-config.js +54 -0
  108. package/dist/services/knowledge/kb-config.js.map +1 -0
  109. package/dist/services/knowledge/kb-providers.d.ts +7 -1
  110. package/dist/services/knowledge/kb-providers.d.ts.map +1 -1
  111. package/dist/services/knowledge/kb-providers.js +191 -17
  112. package/dist/services/knowledge/kb-providers.js.map +1 -1
  113. package/dist/services/knowledge/require-sqlite-project.d.ts +32 -0
  114. package/dist/services/knowledge/require-sqlite-project.d.ts.map +1 -0
  115. package/dist/services/knowledge/require-sqlite-project.js +38 -0
  116. package/dist/services/knowledge/require-sqlite-project.js.map +1 -0
  117. package/dist/services/model-pricing.d.ts.map +1 -1
  118. package/dist/services/model-pricing.js +7 -3
  119. package/dist/services/model-pricing.js.map +1 -1
  120. package/dist/services/secret-token.d.ts +38 -0
  121. package/dist/services/secret-token.d.ts.map +1 -0
  122. package/dist/services/secret-token.js +51 -0
  123. package/dist/services/secret-token.js.map +1 -0
  124. package/dist/services/service-manager/types.d.ts +3 -1
  125. package/dist/services/service-manager/types.d.ts.map +1 -1
  126. package/dist/services/service-manager/windows.d.ts +14 -2
  127. package/dist/services/service-manager/windows.d.ts.map +1 -1
  128. package/dist/services/service-manager/windows.js +65 -7
  129. package/dist/services/service-manager/windows.js.map +1 -1
  130. package/dist/services/ssh.d.ts.map +1 -1
  131. package/dist/services/ssh.js +58 -2
  132. package/dist/services/ssh.js.map +1 -1
  133. package/dist/services/stall/read-log-tail.d.ts.map +1 -1
  134. package/dist/services/stall/read-log-tail.js +20 -10
  135. package/dist/services/stall/read-log-tail.js.map +1 -1
  136. package/dist/services/stall/stall-detector.d.ts +53 -4
  137. package/dist/services/stall/stall-detector.d.ts.map +1 -1
  138. package/dist/services/stall/stall-detector.js +212 -34
  139. package/dist/services/stall/stall-detector.js.map +1 -1
  140. package/dist/services/strategy.d.ts.map +1 -1
  141. package/dist/services/strategy.js +79 -2
  142. package/dist/services/strategy.js.map +1 -1
  143. package/dist/services/substitution-engine.js +2 -2
  144. package/dist/services/substitution-engine.js.map +1 -1
  145. package/dist/services/tool-registry.d.ts.map +1 -1
  146. package/dist/services/tool-registry.js +5 -3
  147. package/dist/services/tool-registry.js.map +1 -1
  148. package/dist/services/vcs/azure-devops.d.ts +66 -1
  149. package/dist/services/vcs/azure-devops.d.ts.map +1 -1
  150. package/dist/services/vcs/azure-devops.js +192 -21
  151. package/dist/services/vcs/azure-devops.js.map +1 -1
  152. package/dist/services/vcs/types.d.ts +1 -1
  153. package/dist/skills/fleet-sprint-cli/SKILL.md +18 -0
  154. package/dist/skills/pm/SKILL.md +1 -1
  155. package/dist/skills/pm/cost.md +0 -3
  156. package/dist/skills/pm/fleet-addendum.md +2 -2
  157. package/dist/tools/check-status.d.ts +7 -4
  158. package/dist/tools/check-status.d.ts.map +1 -1
  159. package/dist/tools/check-status.js +2 -0
  160. package/dist/tools/check-status.js.map +1 -1
  161. package/dist/tools/compose-permissions.d.ts +6 -0
  162. package/dist/tools/compose-permissions.d.ts.map +1 -1
  163. package/dist/tools/compose-permissions.js +182 -34
  164. package/dist/tools/compose-permissions.js.map +1 -1
  165. package/dist/tools/credential-store-set.js +1 -1
  166. package/dist/tools/execute-command.d.ts.map +1 -1
  167. package/dist/tools/execute-command.js +31 -20
  168. package/dist/tools/execute-command.js.map +1 -1
  169. package/dist/tools/execute-prompt.d.ts +15 -2
  170. package/dist/tools/execute-prompt.d.ts.map +1 -1
  171. package/dist/tools/execute-prompt.js +1196 -892
  172. package/dist/tools/execute-prompt.js.map +1 -1
  173. package/dist/tools/kb-capture.d.ts +2 -2
  174. package/dist/tools/kb-capture.d.ts.map +1 -1
  175. package/dist/tools/kb-capture.js +29 -5
  176. package/dist/tools/kb-capture.js.map +1 -1
  177. package/dist/tools/kb-export.d.ts +2 -2
  178. package/dist/tools/kb-export.d.ts.map +1 -1
  179. package/dist/tools/kb-export.js +3 -28
  180. package/dist/tools/kb-export.js.map +1 -1
  181. package/dist/tools/kb-feedback.d.ts.map +1 -1
  182. package/dist/tools/kb-feedback.js +3 -1
  183. package/dist/tools/kb-feedback.js.map +1 -1
  184. package/dist/tools/kb-freshness-sweep.d.ts.map +1 -1
  185. package/dist/tools/kb-freshness-sweep.js +3 -1
  186. package/dist/tools/kb-freshness-sweep.js.map +1 -1
  187. package/dist/tools/kb-import.d.ts.map +1 -1
  188. package/dist/tools/kb-import.js +2 -1
  189. package/dist/tools/kb-import.js.map +1 -1
  190. package/dist/tools/kb-list.d.ts.map +1 -1
  191. package/dist/tools/kb-list.js +3 -1
  192. package/dist/tools/kb-list.js.map +1 -1
  193. package/dist/tools/kb-query.d.ts +2 -2
  194. package/dist/tools/kb-reconcile-prefilter.d.ts.map +1 -1
  195. package/dist/tools/kb-reconcile-prefilter.js +3 -1
  196. package/dist/tools/kb-reconcile-prefilter.js.map +1 -1
  197. package/dist/tools/kb-resolve-contradiction.d.ts.map +1 -1
  198. package/dist/tools/kb-resolve-contradiction.js +3 -1
  199. package/dist/tools/kb-resolve-contradiction.js.map +1 -1
  200. package/dist/tools/kb-setup.d.ts.map +1 -1
  201. package/dist/tools/kb-setup.js +125 -20
  202. package/dist/tools/kb-setup.js.map +1 -1
  203. package/dist/tools/kb-stats.d.ts.map +1 -1
  204. package/dist/tools/kb-stats.js +64 -43
  205. package/dist/tools/kb-stats.js.map +1 -1
  206. package/dist/tools/list-members.d.ts +2 -2
  207. package/dist/tools/list-members.d.ts.map +1 -1
  208. package/dist/tools/list-members.js +1 -0
  209. package/dist/tools/list-members.js.map +1 -1
  210. package/dist/tools/member-detail.d.ts +2 -2
  211. package/dist/tools/member-detail.d.ts.map +1 -1
  212. package/dist/tools/member-detail.js +17 -0
  213. package/dist/tools/member-detail.js.map +1 -1
  214. package/dist/tools/member-reservation.d.ts +58 -1
  215. package/dist/tools/member-reservation.d.ts.map +1 -1
  216. package/dist/tools/member-reservation.js +61 -20
  217. package/dist/tools/member-reservation.js.map +1 -1
  218. package/dist/tools/provision-auth.d.ts +80 -1
  219. package/dist/tools/provision-auth.d.ts.map +1 -1
  220. package/dist/tools/provision-auth.js +142 -54
  221. package/dist/tools/provision-auth.js.map +1 -1
  222. package/dist/tools/provision-vcs-auth.d.ts +91 -1
  223. package/dist/tools/provision-vcs-auth.d.ts.map +1 -1
  224. package/dist/tools/provision-vcs-auth.js +209 -49
  225. package/dist/tools/provision-vcs-auth.js.map +1 -1
  226. package/dist/tools/register-member.d.ts +12 -9
  227. package/dist/tools/register-member.d.ts.map +1 -1
  228. package/dist/tools/register-member.js +99 -12
  229. package/dist/tools/register-member.js.map +1 -1
  230. package/dist/tools/remove-member.d.ts.map +1 -1
  231. package/dist/tools/remove-member.js +27 -2
  232. package/dist/tools/remove-member.js.map +1 -1
  233. package/dist/tools/send-email.d.ts +2 -2
  234. package/dist/tools/setup-git-app.d.ts.map +1 -1
  235. package/dist/tools/setup-git-app.js +11 -7
  236. package/dist/tools/setup-git-app.js.map +1 -1
  237. package/dist/tools/shutdown-server.d.ts +2 -0
  238. package/dist/tools/shutdown-server.d.ts.map +1 -1
  239. package/dist/tools/shutdown-server.js +23 -1
  240. package/dist/tools/shutdown-server.js.map +1 -1
  241. package/dist/tools/update-member.d.ts +12 -9
  242. package/dist/tools/update-member.d.ts.map +1 -1
  243. package/dist/tools/update-member.js +43 -11
  244. package/dist/tools/update-member.js.map +1 -1
  245. package/dist/tools/vcs-credential-exec.d.ts +127 -0
  246. package/dist/tools/vcs-credential-exec.d.ts.map +1 -0
  247. package/dist/tools/vcs-credential-exec.js +197 -0
  248. package/dist/tools/vcs-credential-exec.js.map +1 -0
  249. package/dist/types.d.ts +13 -0
  250. package/dist/types.d.ts.map +1 -1
  251. package/dist/utils/log-helpers.d.ts.map +1 -1
  252. package/dist/utils/log-helpers.js +2 -2
  253. package/dist/utils/log-helpers.js.map +1 -1
  254. package/dist/utils/prompt-errors.d.ts.map +1 -1
  255. package/dist/utils/prompt-errors.js +7 -1
  256. package/dist/utils/prompt-errors.js.map +1 -1
  257. package/dist/utils/shell-escape.d.ts +16 -0
  258. package/dist/utils/shell-escape.d.ts.map +1 -1
  259. package/dist/utils/shell-escape.js +22 -2
  260. package/dist/utils/shell-escape.js.map +1 -1
  261. package/dist/utils/vcs-provider-detect.d.ts +65 -0
  262. package/dist/utils/vcs-provider-detect.d.ts.map +1 -0
  263. package/dist/utils/vcs-provider-detect.js +109 -0
  264. package/dist/utils/vcs-provider-detect.js.map +1 -0
  265. package/dist/utils/workspace-trust.d.ts +20 -17
  266. package/dist/utils/workspace-trust.d.ts.map +1 -1
  267. package/dist/utils/workspace-trust.js +87 -1
  268. package/dist/utils/workspace-trust.js.map +1 -1
  269. package/dist/workflows/auto-sprint.js +176 -15
  270. package/package.json +6 -4
  271. package/packages/apra-fleet-client/src/client/api.mjs +319 -17
  272. package/packages/apra-fleet-client/src/client/errors.mjs +6 -2
  273. package/packages/apra-fleet-se/apra-pm/agents/_shared/GRAPH-SEMANTICS.md +10 -2
  274. package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +25 -0
  275. package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +11 -0
  276. package/packages/apra-fleet-se/apra-pm/agents/deployer.md +37 -2
  277. package/packages/apra-fleet-se/apra-pm/agents/doer.md +36 -12
  278. package/packages/apra-fleet-se/apra-pm/agents/harvester.md +11 -0
  279. package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +11 -0
  280. package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +9 -0
  281. package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +110 -22
  282. package/packages/apra-fleet-se/apra-pm/agents/planner.md +125 -37
  283. package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +11 -0
  284. package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +13 -2
  285. package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
  286. package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +1 -1
  287. package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -3
  288. package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -2
  289. package/packages/apra-fleet-se/bin/cli.mjs +149 -1
  290. package/packages/apra-fleet-se/bin/serve.mjs +78 -4
  291. package/packages/apra-fleet-se/fleet-sprint/abort.mjs +481 -0
  292. package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +491 -0
  293. package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +282 -0
  294. package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +208 -0
  295. package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +638 -0
  296. package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +301 -0
  297. package/packages/apra-fleet-se/fleet-sprint/branch-ensure.mjs +96 -0
  298. package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +8 -0
  299. package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +61 -14
  300. package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +516 -0
  301. package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +184 -0
  302. package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +1121 -0
  303. package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +216 -4
  304. package/packages/apra-fleet-se/fleet-sprint/docs/README.md +1 -1
  305. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +276 -0
  306. package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +1 -1
  307. package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
  308. package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
  309. package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +996 -32
  310. package/packages/apra-fleet-se/fleet-sprint/errors.mjs +267 -0
  311. package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +501 -0
  312. package/packages/apra-fleet-se/fleet-sprint/fatal-diagnostics.mjs +134 -0
  313. package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +102 -0
  314. package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +556 -0
  315. package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +495 -0
  316. package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +564 -0
  317. package/packages/apra-fleet-se/fleet-sprint/inline-ladder-guard.mjs +216 -0
  318. package/packages/apra-fleet-se/fleet-sprint/kb.mjs +728 -0
  319. package/packages/apra-fleet-se/fleet-sprint/mcp-result.mjs +75 -0
  320. package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +252 -0
  321. package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +581 -0
  322. package/packages/apra-fleet-se/fleet-sprint/member-target.mjs +93 -0
  323. package/packages/apra-fleet-se/fleet-sprint/newtask-text.mjs +266 -0
  324. package/packages/apra-fleet-se/fleet-sprint/parent-notes-staleness.mjs +201 -0
  325. package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +136 -0
  326. package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +822 -0
  327. package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +294 -0
  328. package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +403 -0
  329. package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +180 -0
  330. package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +358 -0
  331. package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +390 -0
  332. package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +323 -0
  333. package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +232 -0
  334. package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +174 -0
  335. package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +197 -0
  336. package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +305 -0
  337. package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +559 -0
  338. package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +1416 -0
  339. package/packages/apra-fleet-se/fleet-sprint/round-session.mjs +100 -0
  340. package/packages/apra-fleet-se/fleet-sprint/runner.js +1467 -9798
  341. package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +17 -12
  342. package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +304 -0
  343. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +18 -0
  344. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +21 -2
  345. package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +454 -0
  346. package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +239 -0
  347. package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +163 -0
  348. package/packages/apra-fleet-se/fleet-sprint/unbracketed-push-guard.mjs +234 -0
  349. package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +211 -0
  350. package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +1279 -0
  351. package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +153 -19
  352. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +71 -21
  353. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
  354. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +131 -0
  355. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +140 -16
  356. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +1 -0
  357. package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +77 -2
  358. package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +559 -0
  359. package/packages/apra-fleet-se/package.json +1 -1
  360. package/packages/apra-fleet-workflow/src/viewer/index.mjs +17 -6
  361. package/packages/apra-fleet-workflow/src/workflow/index.mjs +49 -7
  362. package/skills/fleet/SKILL.md +8 -8
  363. package/skills/fleet/auth-azdevops.md +14 -3
  364. package/skills/fleet/auth-bitbucket.md +2 -2
  365. package/skills/fleet/auth-github.md +5 -4
  366. package/skills/fleet/onboarding.md +3 -3
  367. package/skills/fleet/permissions.md +5 -1
  368. package/skills/fleet/profiles/node.json +1 -1
  369. package/skills/fleet/troubleshooting.md +3 -3
  370. package/version.json +1 -1
@@ -0,0 +1,215 @@
1
+ # Decision: runSprintCycle's closure prelude stays; the "~700-line runner.js" target is restated
2
+
3
+ Status: DECIDED. **Option (1) -- KEEP the prelude as composition-root wiring, and
4
+ restate the epic's roughly 700-line aspiration for `runner.js`.**
5
+
6
+ This note records a decision only. **No code was moved, no module was created or
7
+ deleted, and no behaviour changed by the task that wrote it.** If a later change
8
+ makes the reasoning below false, reopen the question (see "What would reopen
9
+ this") rather than quietly extracting.
10
+
11
+ Scope of the question: `runSprintCycle()` in
12
+ `packages/apra-fleet-se/fleet-sprint/runner.js` is a closure. Everything declared
13
+ inside it captures the per-cycle context, so slicing it is not the move-only
14
+ mechanical operation the twelve `phases/*` extractions were -- it is a design
15
+ change about what the per-cycle context IS and who owns it. The prelude here
16
+ means everything from the `runSprintCycle` function header down to the FIRST
17
+ phase invocation (the `runEnsureSprintBranchPhase` call).
18
+
19
+ ## How the figures below were measured
20
+
21
+ Anchored by symbol, never by line number: the script locates the header, the
22
+ closing brace and the first `run*Phase(` call itself. Run from
23
+ `packages/apra-fleet-se`:
24
+
25
+ ```sh
26
+ F=fleet-sprint/runner.js
27
+ S=$(grep -n '^async function runSprintCycle' $F | cut -d: -f1)
28
+ E=$(awk -v s="$S" 'NR>s && /^}/ {print NR; exit}' $F)
29
+ P=$(awk -v s="$S" -v e="$E" 'NR>s && NR<e && /await run[A-Za-z]*Phase\(/ {print NR; exit}' $F)
30
+ body() { sed -n "$1,$2p" $F; }
31
+
32
+ echo "runSprintCycle total=$(body $S $E | wc -l)"
33
+ echo "prelude total=$(body $S $((P-1)) | wc -l)" \
34
+ "comment=$(body $S $((P-1)) | grep -cE '^\s*(//|/\*|\*)')" \
35
+ "blank=$(body $S $((P-1)) | grep -cE '^\s*$')"
36
+ echo "runner.js total=$(wc -l < $F) comment=$(grep -cE '^\s*(//|/\*|\*)' $F)" \
37
+ "imports=$(grep -cE '^import ' $F) exports=$(grep -cE '^export ' $F)"
38
+
39
+ # named inner closures of runSprintCycle
40
+ body $S $E | grep -nE '^ (async )?function [A-Za-z_$]+|^ const [A-Za-z_$]+ = (async )?\(|^ const dispatchCtx = \{' \
41
+ | awk -F: -v s="$S" '{print " line "($1+s-1)": "$2}'
42
+ ```
43
+
44
+ ## The measurement (observations at the HEAD this note was written against)
45
+
46
+ These are observations of one tree, not targets and not literals to assert
47
+ against. Re-run the script above before relying on any of them.
48
+
49
+ ```
50
+ runSprintCycle 769..2934 total=2166
51
+ first phase invocation at 1780: await runEnsureSprintBranchPhase({
52
+ prelude 769..1779 total=1011 comment=630 blank=41
53
+ runner.js total=3097 comment=1862 imports=49 exports=28
54
+ ```
55
+
56
+ Derived: the prelude is 1011 lines of which **630 are comment lines and 41 are
57
+ blank, leaving roughly 340 lines that are actually code**. Across the whole file,
58
+ 1862 of 3097 lines are comments -- `runner.js` is about 60% prose. The part of
59
+ `runSprintCycle` after the first phase invocation is 1155 lines, of which 605 are
60
+ comments and 72 blank, leaving roughly 478 code lines. `main()` is 142 lines.
61
+
62
+ ### The named inner closures
63
+
64
+ Sizes are the declaration's own span. "Captures mutable" lists which of
65
+ `runSprintCycle`'s fourteen `let` bindings the body references -- the property
66
+ that decides whether a helper can be lifted at all.
67
+
68
+ | Closure | Lines | Captures per-cycle MUTABLE state | Cycle-scope bindings captured |
69
+ |---|---|---|---|
70
+ | `agent` | 12 | none | dispatch wrapper over `context.agent` |
71
+ | `unmappedRoleFallbackPool` | 12 | none | few |
72
+ | `getMemberForRole` | 6 | none | few |
73
+ | `getMembersForRole` | 12 | none | few |
74
+ | `withGitSync` | 1 | none | alias onto `gitSync.withGitSync` |
75
+ | `dispatchCtx` (dispatchRole engine context) | 112 | none | 15 |
76
+ | `decomposedParentIds` | 4 | none | 1 (`bdListScoped`) |
77
+ | `readyLeafBeads` | 7 | none | 1 (`bdListScoped`) |
78
+ | `reclaimStaleInProgress` | 32 | `sprintLaunchTime` | 6 |
79
+ | `dispatchReview` | 109 | `cycle` | 8 |
80
+ | `reEnsureBranchOnMembers` | 13 | none | 3 |
81
+ | `updateDashboard` | 63 | none | 5 |
82
+ | `probeFileExists` | 11 | none | 3 |
83
+ | `recordReopen` | 3 | none | `reopenCounts` |
84
+ | `thrashingBeadIds` | 5 | none | `reopenCounts` |
85
+
86
+ Summed declaration bodies: **401 lines**; including each one's leading doc
87
+ comment block (which would move with it): **537 lines**.
88
+
89
+ ## The decision, and the arithmetic that forces it
90
+
91
+ **Extracting the prelude cannot deliver the stated goal, so it is not worth its
92
+ cost.** If every one of the fourteen closures above were extracted -- the
93
+ maximal, most aggressive version of option (2) -- `runner.js` would fall from
94
+ 3097 lines to roughly **2560**. That is still about 3.6x the roughly 700-line
95
+ aspiration, and it is an *over*-estimate of the saving: each extracted helper
96
+ must be re-injected at its call sites, which adds lines back. No amount of
97
+ prelude extraction reaches ~700. The target was never going to be met this way,
98
+ so choosing between "extract" and "keep" on the basis of that number is choosing
99
+ between two ways of missing it.
100
+
101
+ ### Why the prelude is composition-root wiring rather than implementation
102
+
103
+ The concrete, checkable property: **essentially every code-bearing statement in
104
+ the prelude either resolves an injectable seam or constructs a collaborator, and
105
+ almost none of them compute anything about the sprint.** The dominant shapes are
106
+
107
+ ```js
108
+ const X = context.X ?? createX({ ...wiring }); // injectable seam with a default
109
+ const { a, b, c } = createY({ ...wiring }); // collaborator construction
110
+ ```
111
+
112
+ covering `createSyncBrackets`, `createBeadsScope`, `createSprintState`,
113
+ `createMemberSessionGuard`, `createRoundSessionRegistry`, `createKbPrimingClient`,
114
+ `createKbWorkClient`, `createGitSync`, the dolt-push mutex, the child-id
115
+ allocator, and the `dispatchCtx` engine context. That is the definition of a
116
+ composition root: the one place that knows how the object graph is assembled and
117
+ is therefore allowed to depend on everything. Pushing it into a "context module"
118
+ does not remove the wiring, it renames its file -- and it breaks the one property
119
+ a composition root exists to provide, that there is exactly ONE place to look to
120
+ see how a sprint is assembled.
121
+
122
+ The second property: **the prelude is mostly prose.** 630 of its 1011 lines are
123
+ comments, and they are not decoration -- they record why each seam has the
124
+ precedence order it has (the four-source ladders for the push mutex and the id
125
+ allocator), why the `agent` wrapper is the single place `sprint_id` and the
126
+ knowledge-bank block are attached, and why the pause guard is registered before
127
+ any dispatch can occur. A line count that treats those lines as debt is measuring
128
+ the wrong thing; deleting them to hit a number would be a strict loss.
129
+
130
+ ### Why option (2) -- a per-cycle context module -- is rejected
131
+
132
+ Beyond the arithmetic above: it trades closure capture for parameter passing at
133
+ a bad exchange rate. `dispatchCtx` alone captures 15 cycle-scope bindings and
134
+ `dispatchReview` captures 8. Converting those to explicit parameters widens every
135
+ signature and every call site, and the resulting module would still have to be
136
+ constructed from the same wiring, in the same place, in the same order. The
137
+ `phases/*` slices were worth their widened signatures because each one removed a
138
+ self-contained *phase body* -- a unit with a name in the sprint's vocabulary. A
139
+ "per-cycle context" module is not such a unit; it is the composition root with an
140
+ extra import hop.
141
+
142
+ ### Why option (3) -- extract only the non-capturing subset -- is rejected
143
+
144
+ The measurement makes option (3) look more attractive than it is: only two of the
145
+ fourteen closures capture mutable state (`reclaimStaleInProgress` ->
146
+ `sprintLaunchTime`, `dispatchReview` -> `cycle`), so a naive reading says the
147
+ other twelve are liftable. But mutable capture is not the real cost -- immutable
148
+ capture is. The twelve non-mutating closures still capture between 1 and 15
149
+ cycle-scope bindings each, and the two largest (`dispatchCtx` at 112 lines,
150
+ `updateDashboard` at 63) are among the heaviest capturers. What is left after
151
+ excluding them is genuinely tiny: `decomposedParentIds` (4 lines),
152
+ `readyLeafBeads` (7), `recordReopen` (3), `thrashingBeadIds` (5),
153
+ `getMemberForRole` (6) -- roughly 25 lines of body. Creating a module to hold
154
+ 25 lines of one-liners, each of which then needs to be threaded back in, makes
155
+ the codebase harder to read to save nothing. Option (3) is a real option; it is
156
+ rejected on measured size, not on principle.
157
+
158
+ `dispatchReview` deserves a specific note because it is the largest genuinely
159
+ shared helper. It is injected into `phases/review.mjs` and `phases/re-review.mjs`
160
+ (both name it in their "WHY SOME HELPERS ARE INJECTED RATHER THAN IMPORTED"
161
+ headers). Being shared by two phases is exactly why it sits at cycle scope rather
162
+ than in either phase module, and it captures `cycle`, so it is the single worst
163
+ candidate for a mechanical lift.
164
+
165
+ ## The roughly 700-line target is restated
166
+
167
+ The `~700-line` figure originated in the Phase 0 epic description, derived
168
+ against a tree where `phases/*` did not exist and `runner.js` was 11,678 lines.
169
+ It was an aspiration attached to an estimate, never a computed budget, and the
170
+ work since has shown it is unreachable: the composition root plus the facade plus
171
+ their documentation costs more than 700 lines on their own, and the floor
172
+ computed above puts even a maximal extraction at roughly 2560.
173
+
174
+ **Stop quoting ~700.** It is replaced by two properties that are already
175
+ mechanically enforced, and which say what the refactor was actually for:
176
+
177
+ 1. **`runner.js` hosts no phase body.** Pinned by
178
+ `test/phase-sequence-order.test.mjs`, which asserts a zero-match shape scan
179
+ over `runner.js` with a `>= 12` count across `phases/*` as its non-vacuity
180
+ control.
181
+ 2. **`runner.js` is a complete facade.** Every previously-exported symbol is
182
+ still importable from it, so no importer or mock-sprint file changes.
183
+
184
+ Size becomes an *observation* reported alongside those gates, not a gate itself.
185
+ For context, `runner.js` at 3097 lines is not an outlier in its own package:
186
+ `dolt-sync.mjs` is 2325, and `dolt-settle.mjs`, `role-policies.mjs`,
187
+ `contracts.mjs`, `dispatch-role.mjs` and `vcs-auth.mjs` are all around 1000+.
188
+
189
+ ## What would reopen this
190
+
191
+ Any one of these makes the reasoning above false and the question worth asking
192
+ again:
193
+
194
+ - A **third** consumer appears for `dispatchReview`, or `dispatchReview` stops
195
+ capturing `cycle`. It would then be a shared service rather than cycle-scoped
196
+ glue, and `phases/`-adjacent placement becomes defensible.
197
+ - The prelude starts doing **sprint computation** rather than wiring -- i.e. new
198
+ statements that are not `context.X ?? createX(...)`-shaped and that derive
199
+ decisions about beads, members or scheduling. That is implementation, and it
200
+ belongs in a module.
201
+ - `updateDashboard` or `probeFileExists` grows materially, or acquires a second
202
+ caller outside `runSprintCycle`.
203
+ - The comment-to-code ratio inverts: if the prelude's code lines exceed its
204
+ comment lines, the "it is mostly prose" argument no longer holds and the raw
205
+ code size should be re-weighed.
206
+
207
+ ## Correction to an inherited claim
208
+
209
+ The planning note for this decision stated that "Review, Re-Review and Final
210
+ Review all share `dispatchReview`". **That is not true at this HEAD.** Only
211
+ `phases/review.mjs` and `phases/re-review.mjs` receive it;
212
+ `phases/final-review.mjs` merely cites it in a comment ("No duplicate log() dump
213
+ -- see dispatchReview() for why") and runs its own dispatch. The conclusion is
214
+ unaffected -- two sharers is still more than one, which is still the reason the
215
+ helper is cycle-scoped -- but the count is two, not three.
@@ -1,5 +1,6 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
+ import { doltLiteralModulePaths, DOLT_LITERAL_EXEMPT } from './guarded-modules.mjs';
3
4
 
4
5
  // =============================================================================
5
6
  // apra-fleet-417.2.3 -- dolt-literal guard checker.
@@ -24,6 +25,15 @@ import path from 'path';
24
25
  // Anything else -- a live command()/template-literal/string containing the
25
26
  // literal substring -- is a violation: the sync module must be called by its
26
27
  // exported entry points, never re-inlined.
28
+ //
29
+ // MODULE-LIST GENERALIZATION: this guard is no longer pointed at a single
30
+ // hard-coded file. checkDoltLiteralModules() below reads the SHARED
31
+ // guarded-module list (./guarded-modules.mjs) -- the one place a newly
32
+ // extracted fleet-sprint module is registered -- and defines no list of its
33
+ // own. The dolt-sync.mjs carve-out described above is now MECHANICALLY
34
+ // enforced there (DOLT_LITERAL_EXEMPT) rather than left to whoever wires up
35
+ // the call. checkDoltLiteralPath() remains exported and behaves exactly as
36
+ // before.
27
37
  // =============================================================================
28
38
 
29
39
  const DOLT_LITERAL_RE = /\bbd dolt (pull|push)\b/;
@@ -63,10 +73,55 @@ export function findDoltLiteralViolations(src) {
63
73
  export function checkDoltLiteralPath(filePath) {
64
74
  const src = fs.readFileSync(filePath, 'utf8');
65
75
  const fileLabel = path.basename(filePath);
76
+ // The single-surface rule this message enforces was established by
77
+ // apra-fleet-417.2.1/417.2.2 (dolt command consolidation into
78
+ // ./dolt-sync.mjs). Provenance stays in this comment: the message itself
79
+ // is runtime output and must not cite a tracker id.
66
80
  const violations = findDoltLiteralViolations(src).map(({ line, text }) =>
67
81
  `${fileLabel}:${line} issues a direct 'bd dolt pull'/'bd dolt push' literal ("${text}") -- ` +
68
82
  `route it through ./dolt-sync.mjs (DoltSync.syncBefore/syncAfter/status) instead, the single ` +
69
- `permitted dolt command surface (apra-fleet-417.2.1/417.2.2).`
83
+ `permitted dolt command surface.`
70
84
  );
71
85
  return { violations };
72
86
  }
87
+
88
+ /**
89
+ * Aggregate entry point: scans every module in the SHARED guarded-module list
90
+ * (./guarded-modules.mjs), MINUS the dolt-literal exemptions, and returns the
91
+ * union of their violations. Follows checkModules() in
92
+ * dispatch-safety-guard.mjs -- the reference implementation -- so a dolt
93
+ * command that moves out of runner.js into a newly extracted module stays
94
+ * covered instead of silently falling out of scan scope.
95
+ *
96
+ * Each violation string already names the basename of the file it came from
97
+ * (checkDoltLiteralPath's `fileLabel`), so an aggregate run attributes every
98
+ * finding to the correct module.
99
+ *
100
+ * THE EXEMPTION IS ENFORCED HERE, NOT ASSUMED: dolt-sync.mjs is the single
101
+ * permitted dolt command surface -- it BUILDS the `bd dolt pull`/`bd dolt
102
+ * push` strings on purpose -- so it is filtered out by basename via
103
+ * DOLT_LITERAL_EXEMPT even if someone registers it in the shared list or
104
+ * passes it here explicitly. Byte-identical content under any OTHER name is
105
+ * still a violation. This guard defines no list of its own.
106
+ *
107
+ * @param {string[]} [paths]
108
+ * @returns {{ violations: string[], files: string[], skipped: string[] }}
109
+ */
110
+ export function checkDoltLiteralModules(paths = doltLiteralModulePaths()) {
111
+ if (!Array.isArray(paths)) {
112
+ throw new TypeError('checkDoltLiteralModules(paths): paths must be an array of file paths');
113
+ }
114
+ const violations = [];
115
+ const files = [];
116
+ const skipped = [];
117
+ for (const p of paths) {
118
+ const file = path.basename(p);
119
+ if (DOLT_LITERAL_EXEMPT.includes(file)) {
120
+ skipped.push(file);
121
+ continue;
122
+ }
123
+ files.push(file);
124
+ violations.push(...checkDoltLiteralPath(p).violations);
125
+ }
126
+ return { violations, files, skipped };
127
+ }