@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.
- package/README.md +38 -5
- package/dist/agents/backlog-groomer.md +25 -0
- package/dist/agents/ci-watcher.md +11 -0
- package/dist/agents/deployer.md +37 -2
- package/dist/agents/doer.md +36 -12
- package/dist/agents/harvester.md +11 -0
- package/dist/agents/integ-test-runner.md +11 -0
- package/dist/agents/kb-reconciler.md +9 -0
- package/dist/agents/plan-reviewer.md +110 -22
- package/dist/agents/planner.md +125 -37
- package/dist/agents/regression-test-runner.md +11 -0
- package/dist/agents/reviewer.md +13 -2
- package/dist/agents/schemas/plan-reviewer-output.json +37 -0
- package/dist/cli/agent-transform.d.ts +83 -2
- package/dist/cli/agent-transform.d.ts.map +1 -1
- package/dist/cli/agent-transform.js +266 -21
- package/dist/cli/agent-transform.js.map +1 -1
- package/dist/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +28 -9
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/config.d.ts +7 -5
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +44 -34
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/install.d.ts +33 -0
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +290 -23
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/kb-directives.d.ts.map +1 -1
- package/dist/cli/kb-directives.js +2 -1
- package/dist/cli/kb-directives.js.map +1 -1
- package/dist/cli/register-member.d.ts.map +1 -1
- package/dist/cli/register-member.js +6 -2
- package/dist/cli/register-member.js.map +1 -1
- package/dist/commands/kb-server.d.ts +3 -0
- package/dist/commands/kb-server.d.ts.map +1 -1
- package/dist/commands/kb-server.js +43 -3
- package/dist/commands/kb-server.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/os/linux.d.ts +6 -0
- package/dist/os/linux.d.ts.map +1 -1
- package/dist/os/linux.js +35 -2
- package/dist/os/linux.js.map +1 -1
- package/dist/os/os-commands.d.ts +61 -2
- package/dist/os/os-commands.d.ts.map +1 -1
- package/dist/os/windows-gitbash.d.ts +5 -0
- package/dist/os/windows-gitbash.d.ts.map +1 -1
- package/dist/os/windows-gitbash.js +15 -0
- package/dist/os/windows-gitbash.js.map +1 -1
- package/dist/os/windows.d.ts +6 -0
- package/dist/os/windows.d.ts.map +1 -1
- package/dist/os/windows.js +46 -3
- package/dist/os/windows.js.map +1 -1
- package/dist/providers/agy.d.ts +115 -6
- package/dist/providers/agy.d.ts.map +1 -1
- package/dist/providers/agy.js +569 -53
- package/dist/providers/agy.js.map +1 -1
- package/dist/providers/claude.d.ts +81 -3
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +344 -10
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.d.ts +4 -2
- package/dist/providers/codex.d.ts.map +1 -1
- package/dist/providers/codex.js +19 -2
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/copilot.d.ts +4 -2
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/copilot.js +20 -2
- package/dist/providers/copilot.js.map +1 -1
- package/dist/providers/none.d.ts +4 -2
- package/dist/providers/none.d.ts.map +1 -1
- package/dist/providers/none.js +17 -2
- package/dist/providers/none.js.map +1 -1
- package/dist/providers/opencode.d.ts +3 -1
- package/dist/providers/opencode.d.ts.map +1 -1
- package/dist/providers/opencode.js +22 -2
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/provider.d.ts +201 -6
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js +56 -0
- package/dist/providers/provider.js.map +1 -1
- package/dist/services/agy-project.d.ts +102 -0
- package/dist/services/agy-project.d.ts.map +1 -0
- package/dist/services/agy-project.js +356 -0
- package/dist/services/agy-project.js.map +1 -0
- package/dist/services/auth-socket.js +4 -4
- package/dist/services/auth-web.js +1 -1
- package/dist/services/cloud/lifecycle.d.ts.map +1 -1
- package/dist/services/cloud/lifecycle.js +33 -4
- package/dist/services/cloud/lifecycle.js.map +1 -1
- package/dist/services/credential-cleanup.d.ts.map +1 -1
- package/dist/services/credential-cleanup.js +35 -17
- package/dist/services/credential-cleanup.js.map +1 -1
- package/dist/services/exit-drain.d.ts +44 -0
- package/dist/services/exit-drain.d.ts.map +1 -0
- package/dist/services/exit-drain.js +52 -0
- package/dist/services/exit-drain.js.map +1 -0
- package/dist/services/github-app.d.ts.map +1 -1
- package/dist/services/github-app.js +32 -4
- package/dist/services/github-app.js.map +1 -1
- package/dist/services/http-transport.d.ts +1 -0
- package/dist/services/http-transport.d.ts.map +1 -1
- package/dist/services/http-transport.js +48 -1
- package/dist/services/http-transport.js.map +1 -1
- package/dist/services/knowledge/kb-config.d.ts +42 -0
- package/dist/services/knowledge/kb-config.d.ts.map +1 -0
- package/dist/services/knowledge/kb-config.js +54 -0
- package/dist/services/knowledge/kb-config.js.map +1 -0
- package/dist/services/knowledge/kb-providers.d.ts +7 -1
- package/dist/services/knowledge/kb-providers.d.ts.map +1 -1
- package/dist/services/knowledge/kb-providers.js +191 -17
- package/dist/services/knowledge/kb-providers.js.map +1 -1
- package/dist/services/knowledge/require-sqlite-project.d.ts +32 -0
- package/dist/services/knowledge/require-sqlite-project.d.ts.map +1 -0
- package/dist/services/knowledge/require-sqlite-project.js +38 -0
- package/dist/services/knowledge/require-sqlite-project.js.map +1 -0
- package/dist/services/model-pricing.d.ts.map +1 -1
- package/dist/services/model-pricing.js +7 -3
- package/dist/services/model-pricing.js.map +1 -1
- package/dist/services/secret-token.d.ts +38 -0
- package/dist/services/secret-token.d.ts.map +1 -0
- package/dist/services/secret-token.js +51 -0
- package/dist/services/secret-token.js.map +1 -0
- package/dist/services/service-manager/types.d.ts +3 -1
- package/dist/services/service-manager/types.d.ts.map +1 -1
- package/dist/services/service-manager/windows.d.ts +14 -2
- package/dist/services/service-manager/windows.d.ts.map +1 -1
- package/dist/services/service-manager/windows.js +65 -7
- package/dist/services/service-manager/windows.js.map +1 -1
- package/dist/services/ssh.d.ts.map +1 -1
- package/dist/services/ssh.js +58 -2
- package/dist/services/ssh.js.map +1 -1
- package/dist/services/stall/read-log-tail.d.ts.map +1 -1
- package/dist/services/stall/read-log-tail.js +20 -10
- package/dist/services/stall/read-log-tail.js.map +1 -1
- package/dist/services/stall/stall-detector.d.ts +53 -4
- package/dist/services/stall/stall-detector.d.ts.map +1 -1
- package/dist/services/stall/stall-detector.js +212 -34
- package/dist/services/stall/stall-detector.js.map +1 -1
- package/dist/services/strategy.d.ts.map +1 -1
- package/dist/services/strategy.js +79 -2
- package/dist/services/strategy.js.map +1 -1
- package/dist/services/substitution-engine.js +2 -2
- package/dist/services/substitution-engine.js.map +1 -1
- package/dist/services/tool-registry.d.ts.map +1 -1
- package/dist/services/tool-registry.js +5 -3
- package/dist/services/tool-registry.js.map +1 -1
- package/dist/services/vcs/azure-devops.d.ts +66 -1
- package/dist/services/vcs/azure-devops.d.ts.map +1 -1
- package/dist/services/vcs/azure-devops.js +192 -21
- package/dist/services/vcs/azure-devops.js.map +1 -1
- package/dist/services/vcs/types.d.ts +1 -1
- package/dist/skills/fleet-sprint-cli/SKILL.md +18 -0
- package/dist/skills/pm/SKILL.md +1 -1
- package/dist/skills/pm/cost.md +0 -3
- package/dist/skills/pm/fleet-addendum.md +2 -2
- package/dist/tools/check-status.d.ts +7 -4
- package/dist/tools/check-status.d.ts.map +1 -1
- package/dist/tools/check-status.js +2 -0
- package/dist/tools/check-status.js.map +1 -1
- package/dist/tools/compose-permissions.d.ts +6 -0
- package/dist/tools/compose-permissions.d.ts.map +1 -1
- package/dist/tools/compose-permissions.js +182 -34
- package/dist/tools/compose-permissions.js.map +1 -1
- package/dist/tools/credential-store-set.js +1 -1
- package/dist/tools/execute-command.d.ts.map +1 -1
- package/dist/tools/execute-command.js +31 -20
- package/dist/tools/execute-command.js.map +1 -1
- package/dist/tools/execute-prompt.d.ts +15 -2
- package/dist/tools/execute-prompt.d.ts.map +1 -1
- package/dist/tools/execute-prompt.js +1196 -892
- package/dist/tools/execute-prompt.js.map +1 -1
- package/dist/tools/kb-capture.d.ts +2 -2
- package/dist/tools/kb-capture.d.ts.map +1 -1
- package/dist/tools/kb-capture.js +29 -5
- package/dist/tools/kb-capture.js.map +1 -1
- package/dist/tools/kb-export.d.ts +2 -2
- package/dist/tools/kb-export.d.ts.map +1 -1
- package/dist/tools/kb-export.js +3 -28
- package/dist/tools/kb-export.js.map +1 -1
- package/dist/tools/kb-feedback.d.ts.map +1 -1
- package/dist/tools/kb-feedback.js +3 -1
- package/dist/tools/kb-feedback.js.map +1 -1
- package/dist/tools/kb-freshness-sweep.d.ts.map +1 -1
- package/dist/tools/kb-freshness-sweep.js +3 -1
- package/dist/tools/kb-freshness-sweep.js.map +1 -1
- package/dist/tools/kb-import.d.ts.map +1 -1
- package/dist/tools/kb-import.js +2 -1
- package/dist/tools/kb-import.js.map +1 -1
- package/dist/tools/kb-list.d.ts.map +1 -1
- package/dist/tools/kb-list.js +3 -1
- package/dist/tools/kb-list.js.map +1 -1
- package/dist/tools/kb-query.d.ts +2 -2
- package/dist/tools/kb-reconcile-prefilter.d.ts.map +1 -1
- package/dist/tools/kb-reconcile-prefilter.js +3 -1
- package/dist/tools/kb-reconcile-prefilter.js.map +1 -1
- package/dist/tools/kb-resolve-contradiction.d.ts.map +1 -1
- package/dist/tools/kb-resolve-contradiction.js +3 -1
- package/dist/tools/kb-resolve-contradiction.js.map +1 -1
- package/dist/tools/kb-setup.d.ts.map +1 -1
- package/dist/tools/kb-setup.js +125 -20
- package/dist/tools/kb-setup.js.map +1 -1
- package/dist/tools/kb-stats.d.ts.map +1 -1
- package/dist/tools/kb-stats.js +64 -43
- package/dist/tools/kb-stats.js.map +1 -1
- package/dist/tools/list-members.d.ts +2 -2
- package/dist/tools/list-members.d.ts.map +1 -1
- package/dist/tools/list-members.js +1 -0
- package/dist/tools/list-members.js.map +1 -1
- package/dist/tools/member-detail.d.ts +2 -2
- package/dist/tools/member-detail.d.ts.map +1 -1
- package/dist/tools/member-detail.js +17 -0
- package/dist/tools/member-detail.js.map +1 -1
- package/dist/tools/member-reservation.d.ts +58 -1
- package/dist/tools/member-reservation.d.ts.map +1 -1
- package/dist/tools/member-reservation.js +61 -20
- package/dist/tools/member-reservation.js.map +1 -1
- package/dist/tools/provision-auth.d.ts +80 -1
- package/dist/tools/provision-auth.d.ts.map +1 -1
- package/dist/tools/provision-auth.js +142 -54
- package/dist/tools/provision-auth.js.map +1 -1
- package/dist/tools/provision-vcs-auth.d.ts +91 -1
- package/dist/tools/provision-vcs-auth.d.ts.map +1 -1
- package/dist/tools/provision-vcs-auth.js +209 -49
- package/dist/tools/provision-vcs-auth.js.map +1 -1
- package/dist/tools/register-member.d.ts +12 -9
- package/dist/tools/register-member.d.ts.map +1 -1
- package/dist/tools/register-member.js +99 -12
- package/dist/tools/register-member.js.map +1 -1
- package/dist/tools/remove-member.d.ts.map +1 -1
- package/dist/tools/remove-member.js +27 -2
- package/dist/tools/remove-member.js.map +1 -1
- package/dist/tools/send-email.d.ts +2 -2
- package/dist/tools/setup-git-app.d.ts.map +1 -1
- package/dist/tools/setup-git-app.js +11 -7
- package/dist/tools/setup-git-app.js.map +1 -1
- package/dist/tools/shutdown-server.d.ts +2 -0
- package/dist/tools/shutdown-server.d.ts.map +1 -1
- package/dist/tools/shutdown-server.js +23 -1
- package/dist/tools/shutdown-server.js.map +1 -1
- package/dist/tools/update-member.d.ts +12 -9
- package/dist/tools/update-member.d.ts.map +1 -1
- package/dist/tools/update-member.js +43 -11
- package/dist/tools/update-member.js.map +1 -1
- package/dist/tools/vcs-credential-exec.d.ts +127 -0
- package/dist/tools/vcs-credential-exec.d.ts.map +1 -0
- package/dist/tools/vcs-credential-exec.js +197 -0
- package/dist/tools/vcs-credential-exec.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/log-helpers.d.ts.map +1 -1
- package/dist/utils/log-helpers.js +2 -2
- package/dist/utils/log-helpers.js.map +1 -1
- package/dist/utils/prompt-errors.d.ts.map +1 -1
- package/dist/utils/prompt-errors.js +7 -1
- package/dist/utils/prompt-errors.js.map +1 -1
- package/dist/utils/shell-escape.d.ts +16 -0
- package/dist/utils/shell-escape.d.ts.map +1 -1
- package/dist/utils/shell-escape.js +22 -2
- package/dist/utils/shell-escape.js.map +1 -1
- package/dist/utils/vcs-provider-detect.d.ts +65 -0
- package/dist/utils/vcs-provider-detect.d.ts.map +1 -0
- package/dist/utils/vcs-provider-detect.js +109 -0
- package/dist/utils/vcs-provider-detect.js.map +1 -0
- package/dist/utils/workspace-trust.d.ts +20 -17
- package/dist/utils/workspace-trust.d.ts.map +1 -1
- package/dist/utils/workspace-trust.js +87 -1
- package/dist/utils/workspace-trust.js.map +1 -1
- package/dist/workflows/auto-sprint.js +176 -15
- package/package.json +6 -4
- package/packages/apra-fleet-client/src/client/api.mjs +319 -17
- package/packages/apra-fleet-client/src/client/errors.mjs +6 -2
- package/packages/apra-fleet-se/apra-pm/agents/_shared/GRAPH-SEMANTICS.md +10 -2
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +37 -2
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +36 -12
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +9 -0
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +110 -22
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +125 -37
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +13 -2
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +1 -1
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -2
- package/packages/apra-fleet-se/bin/cli.mjs +149 -1
- package/packages/apra-fleet-se/bin/serve.mjs +78 -4
- package/packages/apra-fleet-se/fleet-sprint/abort.mjs +481 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +491 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +282 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +208 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +638 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +301 -0
- package/packages/apra-fleet-se/fleet-sprint/branch-ensure.mjs +96 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +8 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +61 -14
- package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +516 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +184 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +1121 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +216 -4
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +1 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +276 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +1 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +996 -32
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +267 -0
- package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +501 -0
- package/packages/apra-fleet-se/fleet-sprint/fatal-diagnostics.mjs +134 -0
- package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +102 -0
- package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +556 -0
- package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +495 -0
- package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +564 -0
- package/packages/apra-fleet-se/fleet-sprint/inline-ladder-guard.mjs +216 -0
- package/packages/apra-fleet-se/fleet-sprint/kb.mjs +728 -0
- package/packages/apra-fleet-se/fleet-sprint/mcp-result.mjs +75 -0
- package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +252 -0
- package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +581 -0
- package/packages/apra-fleet-se/fleet-sprint/member-target.mjs +93 -0
- package/packages/apra-fleet-se/fleet-sprint/newtask-text.mjs +266 -0
- package/packages/apra-fleet-se/fleet-sprint/parent-notes-staleness.mjs +201 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +136 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +822 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +294 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +403 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +180 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +358 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +390 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +323 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +232 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +174 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +197 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +305 -0
- package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +559 -0
- package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +1416 -0
- package/packages/apra-fleet-se/fleet-sprint/round-session.mjs +100 -0
- package/packages/apra-fleet-se/fleet-sprint/runner.js +1467 -9798
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +17 -12
- package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +304 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +18 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +21 -2
- package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +454 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +239 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +163 -0
- package/packages/apra-fleet-se/fleet-sprint/unbracketed-push-guard.mjs +234 -0
- package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +211 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +1279 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +153 -19
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +71 -21
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +131 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +140 -16
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +1 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +77 -2
- package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +559 -0
- package/packages/apra-fleet-se/package.json +1 -1
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +17 -6
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +49 -7
- package/skills/fleet/SKILL.md +8 -8
- package/skills/fleet/auth-azdevops.md +14 -3
- package/skills/fleet/auth-bitbucket.md +2 -2
- package/skills/fleet/auth-github.md +5 -4
- package/skills/fleet/onboarding.md +3 -3
- package/skills/fleet/permissions.md +5 -1
- package/skills/fleet/profiles/node.json +1 -1
- package/skills/fleet/troubleshooting.md +3 -3
- package/version.json +1 -1
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// PHASE MODULE: Ensure Sprint Branch (apra-fleet-3swo.6.2).
|
|
3
|
+
//
|
|
4
|
+
// The FIRST of runSprintCycle's twelve phase() boundaries, moved verbatim out of
|
|
5
|
+
// runner.js. This is a MOVE-ONLY extraction: the command sequence, the log
|
|
6
|
+
// text, the publishState payload and the group()/phase()/endGroup()
|
|
7
|
+
// presentation calls are byte-identical to the inline version, so the golden
|
|
8
|
+
// transcript is unchanged.
|
|
9
|
+
//
|
|
10
|
+
// EXPLICIT STATE, NOT A CLOSURE. The inline version read nine runSprintCycle
|
|
11
|
+
// locals off the enclosing scope. This module receives them as ONE explicit
|
|
12
|
+
// state argument instead -- the same object runSprintCycle threads to every
|
|
13
|
+
// phase module Phase 4 slices out. Nothing here reaches back into runner.js:
|
|
14
|
+
// the single pure helper this phase needs (decideEnsureBranchAction) is
|
|
15
|
+
// imported from ../branch-ensure.mjs, which is where that helper already lived.
|
|
16
|
+
//
|
|
17
|
+
// WHY THIS PHASE TAKES NO WORK FROM sprintState. The state object carries the
|
|
18
|
+
// sprint-scoped fleet client and the per-member VCS provider resolver
|
|
19
|
+
// (../sprint-state.mjs). This phase issues only plain git commands through
|
|
20
|
+
// command() and resolves no member shell of its own -- the one settle-shell
|
|
21
|
+
// resolution near this phase (the pre-flight beads-health gate) sits BEFORE
|
|
22
|
+
// the Ensure Sprint Branch boundary and stays in runner.js. So the state
|
|
23
|
+
// argument is destructured down to exactly the seams this phase uses, rather
|
|
24
|
+
// than accepting a field it would never read.
|
|
25
|
+
//
|
|
26
|
+
// GUARD COVERAGE: registered as 'phases/ensure-sprint-branch.mjs' in
|
|
27
|
+
// ../guarded-modules.mjs. It carries eight command() call sites, every one of
|
|
28
|
+
// them member_name-bearing, which is precisely why registration is part of
|
|
29
|
+
// this extraction rather than a follow-up -- an unregistered module loses all
|
|
30
|
+
// five mechanical guards silently while they keep reporting green.
|
|
31
|
+
//
|
|
32
|
+
// POST-EXTRACTION FIX (apra-fleet-3swo, fleet-mac regression investigation,
|
|
33
|
+
// not part of the move-only slice above): a 'diverged' abort was reported to
|
|
34
|
+
// an operator whose own checkout showed no local branch of that name at all.
|
|
35
|
+
// Reading decideEnsureBranchAction() and this phase's wiring end to end (plus
|
|
36
|
+
// the passing "no local branch -> fresh checkout" unit and mock-sprint
|
|
37
|
+
// coverage) turned up no misclassification -- the tip-comparison block below
|
|
38
|
+
// is correctly gated on `localBranchExists`, and a 'diverged' verdict is only
|
|
39
|
+
// reachable when git's own `rev-parse --verify --quiet` genuinely resolved
|
|
40
|
+
// the local ref. The much more likely explanation is an operational mismatch
|
|
41
|
+
// (the member's actual command-dispatch working directory, or a stale build,
|
|
42
|
+
// differing from wherever was manually inspected) rather than a code defect.
|
|
43
|
+
// Since a wrong-looking 'diverged' verdict is expensive to debug from the
|
|
44
|
+
// abort message alone, this phase now resolves and reports both tip SHAs on
|
|
45
|
+
// that path (see the diagnostic block below and the shaNote branch in
|
|
46
|
+
// decideEnsureBranchAction()) -- two extra command() call sites, so the
|
|
47
|
+
// EXPECTED_ENSURE_SPRINT_BRANCH_COMMAND_COUNT in
|
|
48
|
+
// test/dispatch-safety-guard.test.mjs went from 8 to 10.
|
|
49
|
+
// =============================================================================
|
|
50
|
+
|
|
51
|
+
import { decideEnsureBranchAction } from '../branch-ensure.mjs';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Runs the Ensure Sprint Branch phase: fetch base and the sprint branch on
|
|
55
|
+
* every ensure-set member, decide per member whether to reuse an existing
|
|
56
|
+
* local branch or check one out from a start point, and dispatch that
|
|
57
|
+
* decision -- preserving orphaned WIP in a named stash rather than aborting
|
|
58
|
+
* or discarding it.
|
|
59
|
+
*
|
|
60
|
+
* @param {{
|
|
61
|
+
* command: Function,
|
|
62
|
+
* log: (msg: string) => void,
|
|
63
|
+
* group: (label: string) => void,
|
|
64
|
+
* phase: (label: string) => void,
|
|
65
|
+
* endGroup: () => void,
|
|
66
|
+
* publishState: (namespace: string, data: any) => void,
|
|
67
|
+
* branchEnsureMembers: string[],
|
|
68
|
+
* validated: { branch: string, baseBranch: string, goal: string, maxCycles: number, requirementsFile?: string|null },
|
|
69
|
+
* }} state
|
|
70
|
+
* @returns {Promise<void>}
|
|
71
|
+
*/
|
|
72
|
+
export async function runEnsureSprintBranchPhase({
|
|
73
|
+
command,
|
|
74
|
+
log,
|
|
75
|
+
group,
|
|
76
|
+
phase,
|
|
77
|
+
endGroup,
|
|
78
|
+
publishState,
|
|
79
|
+
branchEnsureMembers,
|
|
80
|
+
validated,
|
|
81
|
+
}) {
|
|
82
|
+
// =======================
|
|
83
|
+
// 0. Git Setup: ensure the sprint branch exists off base_branch
|
|
84
|
+
// =======================
|
|
85
|
+
// First GIT dispatch of the run -- runs before any bd/agent activity so
|
|
86
|
+
// the whole sprint develops on `branch`, branched from `base_branch`.
|
|
87
|
+
group('Sprint Setup');
|
|
88
|
+
phase('Ensure Sprint Branch');
|
|
89
|
+
// Dispatch the fetch + checkout to EVERY member in the ensure set, not just
|
|
90
|
+
// the orchestrator. Sequential (not parallel) so the command log stays
|
|
91
|
+
// deterministic.
|
|
92
|
+
for (const member of branchEnsureMembers) {
|
|
93
|
+
// Two sequential command() calls, not a single `a && b` shell string:
|
|
94
|
+
// `&&` is a bash-ism that PowerShell 5.1 (Windows' default, pre-7.0)
|
|
95
|
+
// rejects outright ("The token '&&' is not a valid statement
|
|
96
|
+
// separator in this version"), breaking this phase on any Windows
|
|
97
|
+
// member. command() already throws on a non-zero exit by default (no
|
|
98
|
+
// failSoft here), so awaiting the fetch before the checkout
|
|
99
|
+
// reproduces `&&`'s fail-fast semantics -- if the fetch fails, the
|
|
100
|
+
// checkout is never attempted, on every OS/shell.
|
|
101
|
+
await command(
|
|
102
|
+
`git fetch origin ${validated.baseBranch} --quiet`,
|
|
103
|
+
{
|
|
104
|
+
member_name: member,
|
|
105
|
+
silent: true,
|
|
106
|
+
label: `Fetch '${validated.baseBranch}' on member '${member}'`,
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// Fetch <branch> itself before deciding the checkout start-point:
|
|
111
|
+
// adopting origin/<branch> when it exists keeps real pushed sprint
|
|
112
|
+
// history from being force-reset to base's tip on a relaunch, and makes
|
|
113
|
+
// `checkout -B <branch> origin/<branch>` set up correct upstream
|
|
114
|
+
// tracking. failSoft because a brand-new sprint branch legitimately
|
|
115
|
+
// does not exist on origin yet, and that must never abort the run;
|
|
116
|
+
// origin/<baseBranch> is the fallback only when it is genuinely new.
|
|
117
|
+
const branchFetch = await command(
|
|
118
|
+
`git fetch origin ${validated.branch} --quiet`,
|
|
119
|
+
{
|
|
120
|
+
member_name: member,
|
|
121
|
+
silent: true,
|
|
122
|
+
failSoft: true,
|
|
123
|
+
label: `Fetch existing '${validated.branch}' (if any) on member '${member}'`,
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
// Probe for a pre-existing local branch. When the remote ref is
|
|
127
|
+
// missing, the naive fallback would force-reset that local branch to
|
|
128
|
+
// base's tip, discarding commits that closed beads but were never
|
|
129
|
+
// pushed and leaving beads and the git tree disagreeing. The probe also
|
|
130
|
+
// runs when the fetch SUCCEEDED, because a successful fetch alone does
|
|
131
|
+
// not make origin/<branch> authoritative if the local branch has
|
|
132
|
+
// committed work origin does not (see the tip comparison below).
|
|
133
|
+
const localProbe = await command(
|
|
134
|
+
`git rev-parse --verify --quiet refs/heads/${validated.branch}`,
|
|
135
|
+
{
|
|
136
|
+
member_name: member,
|
|
137
|
+
silent: true,
|
|
138
|
+
failSoft: true,
|
|
139
|
+
label: `Probe for pre-existing local branch '${validated.branch}' on member '${member}'`,
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
const localBranchExists = localProbe.ok;
|
|
143
|
+
|
|
144
|
+
// When both origin/<branch> and a local <branch> exist, compare their
|
|
145
|
+
// tips with two `git merge-base --is-ancestor` checks (one each
|
|
146
|
+
// direction) so decideEnsureBranchAction() never has to assume a
|
|
147
|
+
// successful fetch means "safe to reset" -- see that function for the
|
|
148
|
+
// ahead/behind/diverged case breakdown this feeds.
|
|
149
|
+
let localTipStatus;
|
|
150
|
+
if (branchFetch.ok && localBranchExists) {
|
|
151
|
+
const localIsAncestorOfRemote = await command(
|
|
152
|
+
`git merge-base --is-ancestor ${validated.branch} origin/${validated.branch}`,
|
|
153
|
+
{
|
|
154
|
+
member_name: member,
|
|
155
|
+
silent: true,
|
|
156
|
+
failSoft: true,
|
|
157
|
+
label: `Check whether local '${validated.branch}' is an ancestor of 'origin/${validated.branch}' on member '${member}'`,
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
const remoteIsAncestorOfLocal = await command(
|
|
161
|
+
`git merge-base --is-ancestor origin/${validated.branch} ${validated.branch}`,
|
|
162
|
+
{
|
|
163
|
+
member_name: member,
|
|
164
|
+
silent: true,
|
|
165
|
+
failSoft: true,
|
|
166
|
+
label: `Check whether 'origin/${validated.branch}' is an ancestor of local '${validated.branch}' on member '${member}'`,
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
if (localIsAncestorOfRemote.ok && remoteIsAncestorOfLocal.ok) {
|
|
170
|
+
localTipStatus = 'behind-or-equal'; // tips are equal
|
|
171
|
+
} else if (localIsAncestorOfRemote.ok) {
|
|
172
|
+
localTipStatus = 'behind-or-equal'; // local is a strict ancestor of origin
|
|
173
|
+
} else if (remoteIsAncestorOfLocal.ok) {
|
|
174
|
+
localTipStatus = 'ahead';
|
|
175
|
+
} else {
|
|
176
|
+
localTipStatus = 'diverged';
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Diagnostic-only, and ONLY on the rare path that is about to abort:
|
|
181
|
+
// name the two tip SHAs so a human reading the abort message can
|
|
182
|
+
// immediately tell genuine divergence apart from "this member's
|
|
183
|
+
// actual git working directory is not the one I just inspected" --
|
|
184
|
+
// in practice the far more common explanation for a 'diverged'
|
|
185
|
+
// report that looks wrong from the operator's own checkout. Cheap
|
|
186
|
+
// and failSoft; never adds a command on the common (non-diverged)
|
|
187
|
+
// path, and never blocks the abort if a probe itself fails.
|
|
188
|
+
let localSha, remoteSha;
|
|
189
|
+
if (localTipStatus === 'diverged') {
|
|
190
|
+
const localShaRes = await command(
|
|
191
|
+
`git rev-parse --short ${validated.branch}`,
|
|
192
|
+
{ member_name: member, silent: true, failSoft: true, label: `Resolve local '${validated.branch}' tip SHA for diagnostics on member '${member}'` }
|
|
193
|
+
);
|
|
194
|
+
const remoteShaRes = await command(
|
|
195
|
+
`git rev-parse --short origin/${validated.branch}`,
|
|
196
|
+
{ member_name: member, silent: true, failSoft: true, label: `Resolve 'origin/${validated.branch}' tip SHA for diagnostics on member '${member}'` }
|
|
197
|
+
);
|
|
198
|
+
localSha = localShaRes.ok ? localShaRes.output.trim() : undefined;
|
|
199
|
+
remoteSha = remoteShaRes.ok ? remoteShaRes.output.trim() : undefined;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// The fetch-outcome / local-probe / tip-comparison -> checkout-command
|
|
203
|
+
// decision lives in the pure decideEnsureBranchAction() helper above;
|
|
204
|
+
// this call site only turns that decision into a command()/log()
|
|
205
|
+
// dispatch.
|
|
206
|
+
const decision = decideEnsureBranchAction({
|
|
207
|
+
branch: validated.branch,
|
|
208
|
+
baseBranch: validated.baseBranch,
|
|
209
|
+
branchFetchOk: branchFetch.ok,
|
|
210
|
+
branchFetchError: branchFetch.error,
|
|
211
|
+
localBranchExists,
|
|
212
|
+
localTipStatus,
|
|
213
|
+
localSha,
|
|
214
|
+
remoteSha,
|
|
215
|
+
});
|
|
216
|
+
if (decision.action === 'abort') {
|
|
217
|
+
throw new Error(`${decision.message} (member '${member}')`);
|
|
218
|
+
}
|
|
219
|
+
if (decision.reused) {
|
|
220
|
+
if (branchFetch.ok) {
|
|
221
|
+
log(
|
|
222
|
+
`Ensure Sprint Branch: local branch '${validated.branch}' on member '${member}' is AHEAD of ` +
|
|
223
|
+
`'origin/${validated.branch}' (has committed, unpushed work) -- reusing it as-is instead of ` +
|
|
224
|
+
`resetting to origin, to avoid discarding local-only commits.`
|
|
225
|
+
);
|
|
226
|
+
} else {
|
|
227
|
+
log(
|
|
228
|
+
`Ensure Sprint Branch: remote ref for '${validated.branch}' is missing on member '${member}' ` +
|
|
229
|
+
`but a local branch of that name already exists -- reusing it as-is instead of resetting to base, ` +
|
|
230
|
+
`to avoid discarding local-only commits.`
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const checkoutCommand = decision.command;
|
|
235
|
+
const checkoutLabel = decision.reused
|
|
236
|
+
? (branchFetch.ok
|
|
237
|
+
? `Reuse existing local sprint branch '${validated.branch}' on member '${member}' (local ahead of origin)`
|
|
238
|
+
: `Reuse existing local sprint branch '${validated.branch}' on member '${member}' (remote ref missing)`)
|
|
239
|
+
: `Ensure sprint branch '${validated.branch}' from '${decision.startPoint}' on member '${member}'`;
|
|
240
|
+
|
|
241
|
+
// An infrastructure-killed dispatch (transport drop, timeout,
|
|
242
|
+
// stop_prompt) leaves the member's working tree DIRTY with whatever the
|
|
243
|
+
// agent had in flight, and the checkout then fails with "Your local
|
|
244
|
+
// changes ... would be overwritten". That orphaned WIP belongs to a
|
|
245
|
+
// bead that is still open (a future streak redoes it properly), so
|
|
246
|
+
// preserve it in a named stash and proceed -- never abort the sprint
|
|
247
|
+
// over it, and never discard it. A clean tree issues no extra commands.
|
|
248
|
+
const checkoutResult = await command(
|
|
249
|
+
checkoutCommand,
|
|
250
|
+
{
|
|
251
|
+
member_name: member,
|
|
252
|
+
silent: true,
|
|
253
|
+
failSoft: true,
|
|
254
|
+
label: checkoutLabel,
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
if (!checkoutResult.ok) {
|
|
258
|
+
if (!/would be overwritten/i.test(checkoutResult.error || '')) {
|
|
259
|
+
throw new Error(
|
|
260
|
+
`Ensure Sprint Branch: checkout of '${validated.branch}' on member '${member}' failed for a ` +
|
|
261
|
+
`reason other than a dirty working tree (${checkoutResult.error || 'unknown error'}) -- aborting.`
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
log(
|
|
265
|
+
`Ensure Sprint Branch: member '${member}' has uncommitted changes (likely orphaned WIP from an ` +
|
|
266
|
+
`interrupted prior dispatch) blocking checkout -- preserving them in a named stash and retrying.`
|
|
267
|
+
);
|
|
268
|
+
await command(
|
|
269
|
+
`git stash push -u -m "fleet-sprint[${validated.branch}] auto-stash of orphaned WIP blocking branch ensure"`,
|
|
270
|
+
{
|
|
271
|
+
member_name: member,
|
|
272
|
+
silent: true,
|
|
273
|
+
label: `Stash orphaned WIP on member '${member}'`,
|
|
274
|
+
}
|
|
275
|
+
);
|
|
276
|
+
await command(
|
|
277
|
+
checkoutCommand,
|
|
278
|
+
{
|
|
279
|
+
member_name: member,
|
|
280
|
+
silent: true,
|
|
281
|
+
label: `${checkoutLabel} (post-stash retry)`,
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
publishState('sprint-args', {
|
|
287
|
+
branch: validated.branch,
|
|
288
|
+
baseBranch: validated.baseBranch,
|
|
289
|
+
goal: validated.goal,
|
|
290
|
+
maxCycles: validated.maxCycles,
|
|
291
|
+
requirementsFile: validated.requirementsFile || null,
|
|
292
|
+
});
|
|
293
|
+
endGroup();
|
|
294
|
+
}
|