@apralabs/apra-fleet 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +245 -257
- package/dist/agents/backlog-groomer.md +287 -0
- package/dist/agents/deployer.md +52 -11
- package/dist/agents/doer.md +32 -7
- package/dist/agents/integ-test-runner.md +151 -61
- package/dist/agents/plan-reviewer.md +74 -17
- package/dist/agents/planner.md +94 -14
- package/dist/agents/regression-test-runner.md +216 -0
- package/dist/agents/reviewer.md +21 -6
- package/dist/agents/schemas/backlog-groomer-input.json +35 -0
- package/dist/agents/schemas/backlog-groomer-output.json +164 -0
- package/dist/agents/schemas/integ-test-runner-output.json +34 -0
- package/dist/agents/schemas/regression-test-runner-input.json +15 -0
- package/dist/agents/schemas/regression-test-runner-output.json +50 -0
- package/dist/agents/schemas/reviewer-output.json +4 -0
- package/dist/cli/agent-transform.d.ts +1 -0
- package/dist/cli/agent-transform.d.ts.map +1 -1
- package/dist/cli/agent-transform.js +77 -0
- package/dist/cli/agent-transform.js.map +1 -1
- package/dist/cli/auth.d.ts +3 -0
- package/dist/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +181 -5
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/config.d.ts +5 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +7 -1
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/dolt-install.d.ts +91 -0
- package/dist/cli/dolt-install.d.ts.map +1 -0
- package/dist/cli/dolt-install.js +334 -0
- package/dist/cli/dolt-install.js.map +1 -0
- package/dist/cli/install-guard.d.ts +29 -0
- package/dist/cli/install-guard.d.ts.map +1 -0
- package/dist/cli/install-guard.js +153 -0
- package/dist/cli/install-guard.js.map +1 -0
- package/dist/cli/install.d.ts +44 -3
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +604 -108
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/join.d.ts +12 -0
- package/dist/cli/join.d.ts.map +1 -0
- package/dist/cli/join.js +87 -0
- package/dist/cli/join.js.map +1 -0
- package/dist/cli/register-member.d.ts +2 -0
- package/dist/cli/register-member.d.ts.map +1 -0
- package/dist/cli/register-member.js +193 -0
- package/dist/cli/register-member.js.map +1 -0
- package/dist/cli/restart.d.ts +2 -0
- package/dist/cli/restart.d.ts.map +1 -0
- package/dist/cli/restart.js +7 -0
- package/dist/cli/restart.js.map +1 -0
- package/dist/cli/spoke.d.ts +35 -0
- package/dist/cli/spoke.d.ts.map +1 -0
- package/dist/cli/spoke.js +212 -0
- package/dist/cli/spoke.js.map +1 -0
- package/dist/cli/start.d.ts +2 -0
- package/dist/cli/start.d.ts.map +1 -0
- package/dist/cli/start.js +92 -0
- package/dist/cli/start.js.map +1 -0
- package/dist/cli/status.d.ts +2 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +83 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/stop.d.ts +2 -0
- package/dist/cli/stop.d.ts.map +1 -0
- package/dist/cli/stop.js +51 -0
- package/dist/cli/stop.js.map +1 -0
- package/dist/cli/uninstall.d.ts.map +1 -1
- package/dist/cli/uninstall.js +109 -9
- package/dist/cli/uninstall.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +10 -1
- package/dist/cli/update.js.map +1 -1
- package/dist/cli/workflow-assets.d.ts +37 -0
- package/dist/cli/workflow-assets.d.ts.map +1 -0
- package/dist/cli/workflow-assets.js +144 -0
- package/dist/cli/workflow-assets.js.map +1 -0
- package/dist/cli/workflow.d.ts +75 -0
- package/dist/cli/workflow.d.ts.map +1 -0
- package/dist/cli/workflow.js +397 -0
- package/dist/cli/workflow.js.map +1 -0
- package/dist/hub-service/activity.d.ts +30 -0
- package/dist/hub-service/activity.d.ts.map +1 -0
- package/dist/hub-service/activity.js +20 -0
- package/dist/hub-service/activity.js.map +1 -0
- package/dist/hub-service/audit-log.d.ts +19 -0
- package/dist/hub-service/audit-log.d.ts.map +1 -0
- package/dist/hub-service/audit-log.js +13 -0
- package/dist/hub-service/audit-log.js.map +1 -0
- package/dist/hub-service/db/pool.d.ts +19 -0
- package/dist/hub-service/db/pool.d.ts.map +1 -0
- package/dist/hub-service/db/pool.js +53 -0
- package/dist/hub-service/db/pool.js.map +1 -0
- package/dist/hub-service/enrollment.d.ts +29 -0
- package/dist/hub-service/enrollment.d.ts.map +1 -0
- package/dist/hub-service/enrollment.js +48 -0
- package/dist/hub-service/enrollment.js.map +1 -0
- package/dist/hub-service/envelope-routes.d.ts +46 -0
- package/dist/hub-service/envelope-routes.d.ts.map +1 -0
- package/dist/hub-service/envelope-routes.js +94 -0
- package/dist/hub-service/envelope-routes.js.map +1 -0
- package/dist/hub-service/handlers/installers.d.ts +14 -0
- package/dist/hub-service/handlers/installers.d.ts.map +1 -0
- package/dist/hub-service/handlers/installers.js +8 -0
- package/dist/hub-service/handlers/installers.js.map +1 -0
- package/dist/hub-service/http-server.d.ts +31 -0
- package/dist/hub-service/http-server.d.ts.map +1 -0
- package/dist/hub-service/http-server.js +711 -0
- package/dist/hub-service/http-server.js.map +1 -0
- package/dist/hub-service/hub-jwt.d.ts +30 -0
- package/dist/hub-service/hub-jwt.d.ts.map +1 -0
- package/dist/hub-service/hub-jwt.js +105 -0
- package/dist/hub-service/hub-jwt.js.map +1 -0
- package/dist/hub-service/jwt-revocation.d.ts +20 -0
- package/dist/hub-service/jwt-revocation.d.ts.map +1 -0
- package/dist/hub-service/jwt-revocation.js +18 -0
- package/dist/hub-service/jwt-revocation.js.map +1 -0
- package/dist/hub-service/machines.d.ts +16 -0
- package/dist/hub-service/machines.d.ts.map +1 -0
- package/dist/hub-service/machines.js +14 -0
- package/dist/hub-service/machines.js.map +1 -0
- package/dist/hub-service/main.d.ts +3 -0
- package/dist/hub-service/main.d.ts.map +1 -0
- package/dist/hub-service/main.js +64 -0
- package/dist/hub-service/main.js.map +1 -0
- package/dist/hub-service/member-tokens.d.ts +11 -0
- package/dist/hub-service/member-tokens.d.ts.map +1 -0
- package/dist/hub-service/member-tokens.js +49 -0
- package/dist/hub-service/member-tokens.js.map +1 -0
- package/dist/hub-service/member-view.d.ts +20 -0
- package/dist/hub-service/member-view.d.ts.map +1 -0
- package/dist/hub-service/member-view.js +76 -0
- package/dist/hub-service/member-view.js.map +1 -0
- package/dist/hub-service/members.d.ts +44 -0
- package/dist/hub-service/members.d.ts.map +1 -0
- package/dist/hub-service/members.js +25 -0
- package/dist/hub-service/members.js.map +1 -0
- package/dist/hub-service/presence.d.ts +40 -0
- package/dist/hub-service/presence.d.ts.map +1 -0
- package/dist/hub-service/presence.js +44 -0
- package/dist/hub-service/presence.js.map +1 -0
- package/dist/hub-service/project-view.d.ts +12 -0
- package/dist/hub-service/project-view.d.ts.map +1 -0
- package/dist/hub-service/project-view.js +34 -0
- package/dist/hub-service/project-view.js.map +1 -0
- package/dist/hub-service/projects.d.ts +48 -0
- package/dist/hub-service/projects.d.ts.map +1 -0
- package/dist/hub-service/projects.js +80 -0
- package/dist/hub-service/projects.js.map +1 -0
- package/dist/hub-service/relay-queue.d.ts +115 -0
- package/dist/hub-service/relay-queue.d.ts.map +1 -0
- package/dist/hub-service/relay-queue.js +148 -0
- package/dist/hub-service/relay-queue.js.map +1 -0
- package/dist/hub-service/session-jwt.d.ts +10 -0
- package/dist/hub-service/session-jwt.d.ts.map +1 -0
- package/dist/hub-service/session-jwt.js +69 -0
- package/dist/hub-service/session-jwt.js.map +1 -0
- package/dist/hub-service/usage.d.ts +40 -0
- package/dist/hub-service/usage.d.ts.map +1 -0
- package/dist/hub-service/usage.js +25 -0
- package/dist/hub-service/usage.js.map +1 -0
- package/dist/hub-service/users.d.ts +56 -0
- package/dist/hub-service/users.d.ts.map +1 -0
- package/dist/hub-service/users.js +72 -0
- package/dist/hub-service/users.js.map +1 -0
- package/dist/hub-service/workspaces.d.ts +20 -0
- package/dist/hub-service/workspaces.d.ts.map +1 -0
- package/dist/hub-service/workspaces.js +10 -0
- package/dist/hub-service/workspaces.js.map +1 -0
- package/dist/index.js +179 -132
- package/dist/index.js.map +1 -1
- package/dist/os/linux.d.ts +13 -0
- package/dist/os/linux.d.ts.map +1 -1
- package/dist/os/linux.js +62 -3
- package/dist/os/linux.js.map +1 -1
- package/dist/os/os-commands.d.ts +10 -0
- package/dist/os/os-commands.d.ts.map +1 -1
- package/dist/os/windows.d.ts +1 -0
- package/dist/os/windows.d.ts.map +1 -1
- package/dist/os/windows.js +21 -1
- package/dist/os/windows.js.map +1 -1
- package/dist/paths.d.ts +23 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +29 -0
- package/dist/paths.js.map +1 -1
- package/dist/providers/agy.d.ts +9 -2
- package/dist/providers/agy.d.ts.map +1 -1
- package/dist/providers/agy.js +127 -14
- package/dist/providers/agy.js.map +1 -1
- package/dist/providers/claude.d.ts +6 -2
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +248 -9
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.d.ts +3 -2
- package/dist/providers/codex.d.ts.map +1 -1
- package/dist/providers/codex.js +7 -0
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/copilot.d.ts +3 -2
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/copilot.js +8 -1
- package/dist/providers/copilot.js.map +1 -1
- package/dist/providers/gemini.d.ts +3 -2
- package/dist/providers/gemini.d.ts.map +1 -1
- package/dist/providers/gemini.js +11 -1
- package/dist/providers/gemini.js.map +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +3 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/none.d.ts +51 -0
- package/dist/providers/none.d.ts.map +1 -0
- package/dist/providers/none.js +103 -0
- package/dist/providers/none.js.map +1 -0
- package/dist/providers/opencode.d.ts +4 -2
- package/dist/providers/opencode.d.ts.map +1 -1
- package/dist/providers/opencode.js +49 -0
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/provider.d.ts +79 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js +10 -0
- package/dist/providers/provider.js.map +1 -1
- package/dist/services/agent-provisioner.d.ts +3 -3
- package/dist/services/agent-provisioner.d.ts.map +1 -1
- package/dist/services/agent-provisioner.js +12 -5
- package/dist/services/agent-provisioner.js.map +1 -1
- package/dist/services/auth-socket.d.ts.map +1 -1
- package/dist/services/auth-socket.js +2 -0
- package/dist/services/auth-socket.js.map +1 -1
- package/dist/services/budget-awareness.d.ts +130 -0
- package/dist/services/budget-awareness.d.ts.map +1 -0
- package/dist/services/budget-awareness.js +129 -0
- package/dist/services/budget-awareness.js.map +1 -0
- package/dist/services/cloud-sync.d.ts +35 -0
- package/dist/services/cloud-sync.d.ts.map +1 -0
- package/dist/services/cloud-sync.js +90 -0
- package/dist/services/cloud-sync.js.map +1 -0
- package/dist/services/context-admission.d.ts +82 -0
- package/dist/services/context-admission.d.ts.map +1 -0
- package/dist/services/context-admission.js +136 -0
- package/dist/services/context-admission.js.map +1 -0
- package/dist/services/event-bus.d.ts +27 -0
- package/dist/services/event-bus.d.ts.map +1 -0
- package/dist/services/event-bus.js +20 -0
- package/dist/services/event-bus.js.map +1 -0
- package/dist/services/file-chunker.d.ts +38 -0
- package/dist/services/file-chunker.d.ts.map +1 -0
- package/dist/services/file-chunker.js +63 -0
- package/dist/services/file-chunker.js.map +1 -0
- package/dist/services/file-transfer-relay.d.ts +55 -0
- package/dist/services/file-transfer-relay.d.ts.map +1 -0
- package/dist/services/file-transfer-relay.js +115 -0
- package/dist/services/file-transfer-relay.js.map +1 -0
- package/dist/services/github-app.d.ts.map +1 -1
- package/dist/services/github-app.js +1 -0
- package/dist/services/github-app.js.map +1 -1
- package/dist/services/http-transport.d.ts +25 -0
- package/dist/services/http-transport.d.ts.map +1 -0
- package/dist/services/http-transport.js +371 -0
- package/dist/services/http-transport.js.map +1 -0
- package/dist/services/hub-client.d.ts +69 -0
- package/dist/services/hub-client.d.ts.map +1 -0
- package/dist/services/hub-client.js +217 -0
- package/dist/services/hub-client.js.map +1 -0
- package/dist/services/jwt.d.ts +17 -0
- package/dist/services/jwt.d.ts.map +1 -0
- package/dist/services/jwt.js +70 -0
- package/dist/services/jwt.js.map +1 -0
- package/dist/services/known-sessions.d.ts +8 -0
- package/dist/services/known-sessions.d.ts.map +1 -0
- package/dist/services/known-sessions.js +40 -0
- package/dist/services/known-sessions.js.map +1 -0
- package/dist/services/model-pricing.d.ts +36 -0
- package/dist/services/model-pricing.d.ts.map +1 -0
- package/dist/services/model-pricing.js +108 -0
- package/dist/services/model-pricing.js.map +1 -0
- package/dist/services/orphan-recovery.d.ts +56 -0
- package/dist/services/orphan-recovery.d.ts.map +1 -0
- package/dist/services/orphan-recovery.js +111 -0
- package/dist/services/orphan-recovery.js.map +1 -0
- package/dist/services/pending-responses.d.ts +23 -0
- package/dist/services/pending-responses.d.ts.map +1 -0
- package/dist/services/pending-responses.js +52 -0
- package/dist/services/pending-responses.js.map +1 -0
- package/dist/services/registry.d.ts +4 -1
- package/dist/services/registry.d.ts.map +1 -1
- package/dist/services/registry.js +3 -0
- package/dist/services/registry.js.map +1 -1
- package/dist/services/relay-context.d.ts +23 -0
- package/dist/services/relay-context.d.ts.map +1 -0
- package/dist/services/relay-context.js +8 -0
- package/dist/services/relay-context.js.map +1 -0
- package/dist/services/relay-executor.d.ts +68 -0
- package/dist/services/relay-executor.d.ts.map +1 -0
- package/dist/services/relay-executor.js +70 -0
- package/dist/services/relay-executor.js.map +1 -0
- package/dist/services/relay-request.d.ts +65 -0
- package/dist/services/relay-request.d.ts.map +1 -0
- package/dist/services/relay-request.js +129 -0
- package/dist/services/relay-request.js.map +1 -0
- package/dist/services/relay-strategy.d.ts +19 -0
- package/dist/services/relay-strategy.d.ts.map +1 -0
- package/dist/services/relay-strategy.js +111 -0
- package/dist/services/relay-strategy.js.map +1 -0
- package/dist/services/service-manager/index.d.ts +5 -0
- package/dist/services/service-manager/index.d.ts.map +1 -0
- package/dist/services/service-manager/index.js +66 -0
- package/dist/services/service-manager/index.js.map +1 -0
- package/dist/services/service-manager/linux.d.ts +10 -0
- package/dist/services/service-manager/linux.d.ts.map +1 -0
- package/dist/services/service-manager/linux.js +97 -0
- package/dist/services/service-manager/linux.js.map +1 -0
- package/dist/services/service-manager/macos.d.ts +10 -0
- package/dist/services/service-manager/macos.d.ts.map +1 -0
- package/dist/services/service-manager/macos.js +94 -0
- package/dist/services/service-manager/macos.js.map +1 -0
- package/dist/services/service-manager/types.d.ts +18 -0
- package/dist/services/service-manager/types.d.ts.map +1 -0
- package/dist/services/service-manager/types.js +5 -0
- package/dist/services/service-manager/types.js.map +1 -0
- package/dist/services/service-manager/windows.d.ts +10 -0
- package/dist/services/service-manager/windows.d.ts.map +1 -0
- package/dist/services/service-manager/windows.js +73 -0
- package/dist/services/service-manager/windows.js.map +1 -0
- package/dist/services/session-registry.d.ts +70 -0
- package/dist/services/session-registry.d.ts.map +1 -0
- package/dist/services/session-registry.js +91 -0
- package/dist/services/session-registry.js.map +1 -0
- package/dist/services/singleton.d.ts +15 -0
- package/dist/services/singleton.d.ts.map +1 -0
- package/dist/services/singleton.js +98 -0
- package/dist/services/singleton.js.map +1 -0
- package/dist/services/sprint-coordination.d.ts +168 -0
- package/dist/services/sprint-coordination.d.ts.map +1 -0
- package/dist/services/sprint-coordination.js +564 -0
- package/dist/services/sprint-coordination.js.map +1 -0
- package/dist/services/ssh.d.ts.map +1 -1
- package/dist/services/ssh.js +70 -3
- package/dist/services/ssh.js.map +1 -1
- package/dist/services/stall/log-path-resolver.d.ts.map +1 -1
- package/dist/services/stall/log-path-resolver.js +8 -1
- package/dist/services/stall/log-path-resolver.js.map +1 -1
- package/dist/services/stall/stall-detector.d.ts.map +1 -1
- package/dist/services/stall/stall-detector.js +39 -7
- package/dist/services/stall/stall-detector.js.map +1 -1
- package/dist/services/stall/stall-poller.d.ts +16 -0
- package/dist/services/stall/stall-poller.d.ts.map +1 -1
- package/dist/services/stall/stall-poller.js +136 -18
- package/dist/services/stall/stall-poller.js.map +1 -1
- package/dist/services/strategy.d.ts.map +1 -1
- package/dist/services/strategy.js +55 -5
- package/dist/services/strategy.js.map +1 -1
- package/dist/services/substitution-engine.d.ts +20 -0
- package/dist/services/substitution-engine.d.ts.map +1 -0
- package/dist/services/substitution-engine.js +92 -0
- package/dist/services/substitution-engine.js.map +1 -0
- package/dist/services/task-cleanup.d.ts.map +1 -1
- package/dist/services/task-cleanup.js +1 -9
- package/dist/services/task-cleanup.js.map +1 -1
- package/dist/services/token-issuer.d.ts +47 -0
- package/dist/services/token-issuer.d.ts.map +1 -0
- package/dist/services/token-issuer.js +63 -0
- package/dist/services/token-issuer.js.map +1 -0
- package/dist/services/tool-registry.d.ts +3 -0
- package/dist/services/tool-registry.d.ts.map +1 -0
- package/dist/services/tool-registry.js +139 -0
- package/dist/services/tool-registry.js.map +1 -0
- package/dist/services/user-config.d.ts +14 -0
- package/dist/services/user-config.d.ts.map +1 -1
- package/dist/services/user-config.js +55 -0
- package/dist/services/user-config.js.map +1 -1
- package/dist/services/vcs/types.d.ts +44 -0
- package/dist/services/vcs/types.d.ts.map +1 -1
- package/dist/skills/fleet-sprint-cli/SKILL.md +103 -0
- package/dist/skills/pm/cost.md +3 -0
- package/dist/skills/pm/doer-reviewer-loop.md +3 -0
- package/dist/tools/check-status.d.ts.map +1 -1
- package/dist/tools/check-status.js +8 -2
- package/dist/tools/check-status.js.map +1 -1
- package/dist/tools/child-id-allocator.d.ts +45 -0
- package/dist/tools/child-id-allocator.d.ts.map +1 -0
- package/dist/tools/child-id-allocator.js +62 -0
- package/dist/tools/child-id-allocator.js.map +1 -0
- package/dist/tools/cloud-control.d.ts +2 -2
- package/dist/tools/compose-permissions.d.ts +12 -4
- package/dist/tools/compose-permissions.d.ts.map +1 -1
- package/dist/tools/compose-permissions.js +55 -4
- package/dist/tools/compose-permissions.js.map +1 -1
- package/dist/tools/dolt-push-mutex.d.ts +44 -0
- package/dist/tools/dolt-push-mutex.d.ts.map +1 -0
- package/dist/tools/dolt-push-mutex.js +83 -0
- package/dist/tools/dolt-push-mutex.js.map +1 -0
- package/dist/tools/execute-command.d.ts +11 -1
- package/dist/tools/execute-command.d.ts.map +1 -1
- package/dist/tools/execute-command.js +22 -5
- package/dist/tools/execute-command.js.map +1 -1
- package/dist/tools/execute-prompt.d.ts +72 -12
- package/dist/tools/execute-prompt.d.ts.map +1 -1
- package/dist/tools/execute-prompt.js +962 -71
- package/dist/tools/execute-prompt.js.map +1 -1
- package/dist/tools/get-member-model-pricing.d.ts +21 -0
- package/dist/tools/get-member-model-pricing.d.ts.map +1 -0
- package/dist/tools/get-member-model-pricing.js +29 -0
- package/dist/tools/get-member-model-pricing.js.map +1 -0
- package/dist/tools/list-members.d.ts.map +1 -1
- package/dist/tools/list-members.js +39 -7
- package/dist/tools/list-members.js.map +1 -1
- package/dist/tools/member-detail.d.ts +1 -1
- package/dist/tools/member-detail.d.ts.map +1 -1
- package/dist/tools/member-detail.js +8 -2
- package/dist/tools/member-detail.js.map +1 -1
- package/dist/tools/member-reservation.d.ts +29 -0
- package/dist/tools/member-reservation.d.ts.map +1 -0
- package/dist/tools/member-reservation.js +71 -0
- package/dist/tools/member-reservation.js.map +1 -0
- package/dist/tools/provision-vcs-auth.d.ts +7 -7
- package/dist/tools/provision-vcs-auth.js +1 -1
- package/dist/tools/provision-vcs-auth.js.map +1 -1
- package/dist/tools/register-member.d.ts +17 -5
- package/dist/tools/register-member.d.ts.map +1 -1
- package/dist/tools/register-member.js +144 -5
- package/dist/tools/register-member.js.map +1 -1
- package/dist/tools/remove-member.d.ts +1 -1
- package/dist/tools/report-status.d.ts +33 -0
- package/dist/tools/report-status.d.ts.map +1 -0
- package/dist/tools/report-status.js +44 -0
- package/dist/tools/report-status.js.map +1 -0
- package/dist/tools/respond-to-message.d.ts +21 -0
- package/dist/tools/respond-to-message.d.ts.map +1 -0
- package/dist/tools/respond-to-message.js +23 -0
- package/dist/tools/respond-to-message.js.map +1 -0
- package/dist/tools/send-files.d.ts +3 -0
- package/dist/tools/send-files.d.ts.map +1 -1
- package/dist/tools/send-files.js +88 -8
- package/dist/tools/send-files.js.map +1 -1
- package/dist/tools/send-message.d.ts +27 -0
- package/dist/tools/send-message.d.ts.map +1 -0
- package/dist/tools/send-message.js +46 -0
- package/dist/tools/send-message.js.map +1 -0
- 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 +19 -0
- package/dist/tools/shutdown-server.js.map +1 -1
- package/dist/tools/update-member.d.ts +8 -8
- package/dist/tools/update-member.d.ts.map +1 -1
- package/dist/tools/update-member.js +11 -1
- package/dist/tools/update-member.js.map +1 -1
- package/dist/types.d.ts +15 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/agent-helpers.d.ts +2 -1
- package/dist/utils/agent-helpers.d.ts.map +1 -1
- package/dist/utils/agent-helpers.js +7 -2
- package/dist/utils/agent-helpers.js.map +1 -1
- package/dist/utils/pid-helpers.d.ts +15 -0
- package/dist/utils/pid-helpers.d.ts.map +1 -1
- package/dist/utils/pid-helpers.js +23 -0
- package/dist/utils/pid-helpers.js.map +1 -1
- package/dist/utils/process-utils.d.ts +3 -0
- package/dist/utils/process-utils.d.ts.map +1 -0
- package/dist/utils/process-utils.js +42 -0
- package/dist/utils/process-utils.js.map +1 -0
- package/dist/utils/prompt-errors.d.ts +2 -1
- package/dist/utils/prompt-errors.d.ts.map +1 -1
- package/dist/utils/prompt-errors.js +13 -3
- package/dist/utils/prompt-errors.js.map +1 -1
- package/dist/utils/workspace-trust.d.ts +24 -0
- package/dist/utils/workspace-trust.d.ts.map +1 -0
- package/dist/utils/workspace-trust.js +35 -0
- package/dist/utils/workspace-trust.js.map +1 -0
- package/dist/workflows/auto-sprint.js +450 -87
- package/package.json +35 -7
- package/packages/apra-fleet-client/package.json +26 -0
- package/packages/apra-fleet-client/src/client/api.mjs +396 -0
- package/packages/apra-fleet-client/src/client/client.mjs +146 -0
- package/packages/apra-fleet-client/src/client/errors.mjs +71 -0
- package/packages/apra-fleet-client/src/client/factory.mjs +65 -0
- package/packages/apra-fleet-client/src/client/server-resolution.mjs +265 -0
- package/packages/apra-fleet-client/src/client/transport.mjs +327 -0
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +287 -0
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +89 -0
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +139 -0
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +225 -0
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +169 -0
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +316 -0
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +188 -0
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +239 -0
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +216 -0
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +174 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-input.json +35 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +164 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/ci-watcher-input.json +26 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/ci-watcher-output.json +18 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/deployer-input.json +19 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/deployer-output.json +17 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-input.json +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +22 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-input.json +31 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-output.json +18 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-input.json +20 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-output.json +61 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-input.json +15 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +30 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-input.json +15 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +50 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-input.json +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +38 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +402 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/beads.md +142 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +157 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/doer-reviewer-loop.md +300 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +121 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/simple-sprint.md +65 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +327 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/worktrees.md +92 -0
- package/packages/apra-fleet-se/apra-pm/version.json +3 -0
- package/packages/apra-fleet-se/bin/cli.mjs +857 -0
- package/packages/apra-fleet-se/bin/serve.mjs +383 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +178 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +914 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +177 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +191 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/coach-role-design.md +151 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-tier2-runbook.md +127 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/fleet-sprint-diagram.md +94 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/stabilization-log.md +1125 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +72 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery-path-b.mjs +339 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery-tier2.mjs +360 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery.mjs +363 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +1244 -0
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +572 -0
- package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +118 -0
- package/packages/apra-fleet-se/fleet-sprint/runner.js +9447 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +103 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-lock.mjs +140 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +435 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +68 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +53 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/dolt.mjs +146 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/generic-git.mjs +176 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +222 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +218 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +882 -0
- package/packages/apra-fleet-se/package.json +28 -0
- package/packages/apra-fleet-se/workflow.json +1 -0
- package/packages/apra-fleet-workflow/package.json +30 -0
- package/packages/apra-fleet-workflow/src/viewer/command-output-cap.mjs +112 -0
- package/packages/apra-fleet-workflow/src/viewer/debounced-writer.mjs +153 -0
- package/packages/apra-fleet-workflow/src/viewer/html-utils.mjs +31 -0
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +1325 -0
- package/packages/apra-fleet-workflow/src/viewer/lean-state.mjs +237 -0
- package/packages/apra-fleet-workflow/src/viewer/run-state-paths.mjs +130 -0
- package/packages/apra-fleet-workflow/src/viewer/sprint-state-paths.mjs +29 -0
- package/packages/apra-fleet-workflow/src/workflow/engine.mjs +200 -0
- package/packages/apra-fleet-workflow/src/workflow/errors.mjs +146 -0
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +1723 -0
- package/packages/apra-fleet-workflow/src/workflow/journal.mjs +291 -0
- package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +99 -0
- package/packages/apra-fleet-workflow/src/workflow/vetting.mjs +111 -0
- package/scripts/agy-transcript-reader.js +1 -0
- package/scripts/fleet-statusline.sh +17 -13
- package/skills/fleet/SKILL.md +37 -2
- package/skills/fleet/beads.md +14 -7
- package/skills/fleet/permissions.md +50 -0
- package/skills/fleet/profiles/base-dev.json +1 -0
- package/skills/fleet/profiles/base-reviewer.json +1 -0
- package/skills/fleet/profiles/node.json +2 -2
- package/version.json +1 -1
- package/scripts/agy-settings-merge.js +0 -27
- /package/{dist → packages/apra-fleet-se/apra-pm}/agents/_shared/GRAPH-SEMANTICS.md +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fleet-sprint-cli
|
|
3
|
+
description: How to launch and supervise apra-fleet's autonomous sprint workflow from the CLI (`apra-fleet workflow fleet-sprint`) -- the --issue/--members/--branch/--base flag contract, the preconditions to check first, how to launch it as a detached process, and how to watch it via its dashboard. Trigger before running `apra-fleet workflow fleet-sprint`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# fleet-sprint
|
|
7
|
+
|
|
8
|
+
`fleet-sprint` is apra-fleet's autonomous sprint engine. It drives a full
|
|
9
|
+
plan -> develop -> review -> deploy -> integ-test -> harvest cycle across one
|
|
10
|
+
or more registered fleet members, working a set of beads issues on a branch
|
|
11
|
+
and opening a PR at the end.
|
|
12
|
+
|
|
13
|
+
## The command
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
apra-fleet workflow fleet-sprint \
|
|
17
|
+
--issue <id[,id2,...]> \
|
|
18
|
+
--members <name[,name2,...]> \
|
|
19
|
+
--branch <branch-name> \
|
|
20
|
+
--base <base-branch> \
|
|
21
|
+
[--goal P1|P1/P2|P1/P2/P3] # default P1/P2
|
|
22
|
+
[--max-cycles N] # default 5
|
|
23
|
+
[--allow-missing-members]
|
|
24
|
+
[--requirements-file <path>]
|
|
25
|
+
[--role-map <json|@file>] # {"doer":["m1","m2"], ...}
|
|
26
|
+
[--viewer-port <port>] # default 8080
|
|
27
|
+
[--budget <usd>] # default unlimited
|
|
28
|
+
[--dispatch-timeout-s <s>] # default 3600
|
|
29
|
+
[--sync] # synced-topology mode
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`--issue`, `--members`, `--branch`, and `--base` are required. Verify the
|
|
33
|
+
live flag set with `apra-fleet workflow fleet-sprint --help` before relying
|
|
34
|
+
on this list -- flags evolve and this skill can drift.
|
|
35
|
+
|
|
36
|
+
## Flag notes
|
|
37
|
+
|
|
38
|
+
- `--issue` takes comma-separated **beads parent/epic IDs**. Scope is
|
|
39
|
+
resolved internally via `bd list --parent <id>`, so it only ever
|
|
40
|
+
understands the parent-child hierarchy. A `blocked-by`-only manifest bead
|
|
41
|
+
is invisible to the scope filter no matter what you pass -- only true
|
|
42
|
+
children are picked up. See the epics/manifest-bead guidance in
|
|
43
|
+
`packages/apra-fleet-se/fleet-sprint/docs/README.md`.
|
|
44
|
+
- `--branch` is created from `--base` if it does not already exist. If it
|
|
45
|
+
does exist (e.g. you are resuming), it is reused as-is.
|
|
46
|
+
- `--role-map` assigns specific members to specific roles, e.g.
|
|
47
|
+
`--role-map '{"doer":["m1","m2"],"reviewer":["m3"]}'`. Accepts inline JSON
|
|
48
|
+
or `@path/to/file.json`.
|
|
49
|
+
- `--goal` controls which bead priorities are in scope for the run.
|
|
50
|
+
- `--budget` caps total spend in USD; the run aborts when it is exhausted.
|
|
51
|
+
|
|
52
|
+
## Preconditions to check first
|
|
53
|
+
|
|
54
|
+
1. Every `--issue` target exists and is open: `bd show <id>`.
|
|
55
|
+
2. Every `--members` name is registered with the fleet (`list_members` /
|
|
56
|
+
`mcp__apra-fleet__list_members`). An unregistered member aborts the
|
|
57
|
+
sprint unless `--allow-missing-members` is passed.
|
|
58
|
+
3. Multi-member sprints require all members to share the same git topology
|
|
59
|
+
unless `--sync` is passed. Stick to single-member unless that is
|
|
60
|
+
verified -- see `fleet-sprint-diagram.md` in the package docs.
|
|
61
|
+
4. If a member's LLM session is stale or unauthenticated (dispatch fails
|
|
62
|
+
with `empty_response`, or "member CLI likely died"), re-run
|
|
63
|
+
`provision_llm_auth` for that member before retrying.
|
|
64
|
+
|
|
65
|
+
## Launching it
|
|
66
|
+
|
|
67
|
+
Run this on your own orchestrating machine, not on a `--members` target --
|
|
68
|
+
members are dispatch destinations, not where this command runs.
|
|
69
|
+
|
|
70
|
+
Use the delivered `apra-fleet` binary (on PATH after `npm run build:binary`),
|
|
71
|
+
and start it as a genuinely detached OS process. A harness-owned background
|
|
72
|
+
task can be silently killed when its owning tool call's process group ends,
|
|
73
|
+
which orphans the sprint mid-run.
|
|
74
|
+
|
|
75
|
+
Windows:
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
Start-Process -FilePath "apra-fleet" -ArgumentList "workflow","fleet-sprint", `
|
|
79
|
+
"--issue","<id>","--members","<name>","--branch","<branch>","--base","<base>" `
|
|
80
|
+
-RedirectStandardOutput "<log>.log" -RedirectStandardError "<log>.err.log" `
|
|
81
|
+
-WindowStyle Hidden -PassThru
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
POSIX:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
nohup apra-fleet workflow fleet-sprint \
|
|
88
|
+
--issue <id> --members <name> --branch <branch> --base <base> \
|
|
89
|
+
> sprint.log 2>&1 &
|
|
90
|
+
disown
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
From a source checkout you can run the same engine directly with
|
|
94
|
+
`node packages/apra-fleet-se/bin/cli.mjs <same flags>`. That form runs the
|
|
95
|
+
working tree instead of the installed copy -- use it when developing the
|
|
96
|
+
engine itself, and the packaged binary otherwise.
|
|
97
|
+
|
|
98
|
+
## Watching it
|
|
99
|
+
|
|
100
|
+
On start, the run prints a dashboard URL (`http://localhost:<viewer-port>`,
|
|
101
|
+
default port 8080). Watch progress there rather than tailing raw stdout --
|
|
102
|
+
the dashboard shows per-role activity, the bead DAG, live cost, and the
|
|
103
|
+
final verdict and PR link.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// apra-fleet-eft.75.2 -- a machine-local pidfile mutex keyed on
|
|
2
|
+
// (branch, members), guarding against a duplicate concurrent `fleet-sprint`
|
|
3
|
+
// engine launch for the SAME sprint.
|
|
4
|
+
//
|
|
5
|
+
// Root incident (apra-fleet-eft.75): a duplicate concurrent runner.js engine
|
|
6
|
+
// dispatched against the same shared git branch/beads DB while the first was
|
|
7
|
+
// still alive (both alive 50+ minutes, a duplicate smoke-test sprint
|
|
8
|
+
// launched by the orphaned first session was itself duplicated by the
|
|
9
|
+
// second). The ONLY thing that had stopped a duplicate concurrent runner
|
|
10
|
+
// before this was an ACCIDENTAL viewer-port-8080 collision -- itself
|
|
11
|
+
// trivially avoided by passing a different --viewer-port, so it was never a
|
|
12
|
+
// real guard. This module is the explicit, always-on mutex that replaces
|
|
13
|
+
// that accident with a deliberate, named lock.
|
|
14
|
+
//
|
|
15
|
+
// One pidfile per (branch, sorted-members) combination lives under
|
|
16
|
+
// `lockDir` (default: a fixed subdirectory of the OS tmpdir; override via
|
|
17
|
+
// APRA_FLEET_SPRINT_LOCK_DIR for test isolation / a non-default host
|
|
18
|
+
// layout). Its content is just the acquiring process's pid as plain text.
|
|
19
|
+
// A conflicting acquire attempt:
|
|
20
|
+
// - if the recorded pid is verifiably alive: refuses with the distinct,
|
|
21
|
+
// named SprintLockHeldError (never falls through to a generic error a
|
|
22
|
+
// caller could accidentally swallow/retry).
|
|
23
|
+
// - if the recorded pid is dead (crashed process that never released
|
|
24
|
+
// cleanly), or the pidfile is unreadable/corrupt: reclaims the stale
|
|
25
|
+
// pidfile and proceeds, exactly once per acquire() call, without a
|
|
26
|
+
// false block.
|
|
27
|
+
|
|
28
|
+
import fs from 'node:fs';
|
|
29
|
+
import path from 'node:path';
|
|
30
|
+
import os from 'node:os';
|
|
31
|
+
import { SprintLockHeldError } from './errors.mjs';
|
|
32
|
+
|
|
33
|
+
export { SprintLockHeldError };
|
|
34
|
+
|
|
35
|
+
function defaultLockDir() {
|
|
36
|
+
return process.env.APRA_FLEET_SPRINT_LOCK_DIR
|
|
37
|
+
|| path.join(os.tmpdir(), 'apra-fleet-sprint-locks');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Filename-safe key for a (branch, members) pair -- deterministic
|
|
42
|
+
* regardless of `members` input ORDER or duplicate entries, so the SAME
|
|
43
|
+
* sprint (same branch, same member set) always maps to the SAME lock file
|
|
44
|
+
* no matter which order/repetition --members were listed in on either
|
|
45
|
+
* launch.
|
|
46
|
+
* @param {string} branch
|
|
47
|
+
* @param {string[]} members
|
|
48
|
+
* @returns {string}
|
|
49
|
+
*/
|
|
50
|
+
export function sprintLockKey(branch, members) {
|
|
51
|
+
const memberPart = Array.from(new Set((members || []).map(String))).sort().join('+');
|
|
52
|
+
const raw = `${branch}::${memberPart}`;
|
|
53
|
+
return raw.replace(/[^a-zA-Z0-9._+-]/g, '_');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* True when `pid` is a currently-running process on this machine. Mirrors
|
|
58
|
+
* the fleet server's own isPidAlive (src/utils/pid-helpers.ts) but is
|
|
59
|
+
* reimplemented locally -- this package never imports server TS source
|
|
60
|
+
* directly. EPERM (process exists, owned by a different user) is treated as
|
|
61
|
+
* alive: we could signal it but that does not mean it is dead.
|
|
62
|
+
* @param {number} pid
|
|
63
|
+
* @returns {boolean}
|
|
64
|
+
*/
|
|
65
|
+
function isPidAlive(pid) {
|
|
66
|
+
if (typeof pid !== 'number' || !Number.isInteger(pid) || pid <= 0) return false;
|
|
67
|
+
try {
|
|
68
|
+
process.kill(pid, 0);
|
|
69
|
+
return true;
|
|
70
|
+
} catch (err) {
|
|
71
|
+
return err && err.code === 'EPERM';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Acquire the sprint lock for (branch, members). Synchronous (pidfile
|
|
77
|
+
* open/write/read are all cheap local-disk ops and every existing call site
|
|
78
|
+
* in this package -- sprint launch, once, before any dispatch -- has no need
|
|
79
|
+
* to await anything else concurrently).
|
|
80
|
+
*
|
|
81
|
+
* @param {{ branch: string, members: string[], lockDir?: string, pid?: number }} opts
|
|
82
|
+
* @returns {{ path: string, release: () => void }}
|
|
83
|
+
* @throws {SprintLockHeldError} when a live process already holds the lock
|
|
84
|
+
* for this exact (branch, members) key, or a concurrent process wins the
|
|
85
|
+
* reclaim race.
|
|
86
|
+
*/
|
|
87
|
+
export function acquireSprintLock({ branch, members, lockDir = defaultLockDir(), pid = process.pid }) {
|
|
88
|
+
fs.mkdirSync(lockDir, { recursive: true });
|
|
89
|
+
const key = sprintLockKey(branch, members);
|
|
90
|
+
const lockPath = path.join(lockDir, `${key}.lock`);
|
|
91
|
+
|
|
92
|
+
function tryAcquire(allowReclaim) {
|
|
93
|
+
try {
|
|
94
|
+
const fd = fs.openSync(lockPath, 'wx');
|
|
95
|
+
fs.writeSync(fd, String(pid));
|
|
96
|
+
fs.closeSync(fd);
|
|
97
|
+
return {
|
|
98
|
+
path: lockPath,
|
|
99
|
+
release: () => { try { fs.unlinkSync(lockPath); } catch { /* already gone -- fine */ } },
|
|
100
|
+
};
|
|
101
|
+
} catch (err) {
|
|
102
|
+
if (!err || err.code !== 'EEXIST') throw err;
|
|
103
|
+
|
|
104
|
+
let existingPid = null;
|
|
105
|
+
try {
|
|
106
|
+
existingPid = parseInt(fs.readFileSync(lockPath, 'utf8').trim(), 10);
|
|
107
|
+
} catch {
|
|
108
|
+
// File vanished (or became unreadable) between our openSync
|
|
109
|
+
// failing and this read -- treat as reclaimable below.
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (Number.isInteger(existingPid) && isPidAlive(existingPid)) {
|
|
113
|
+
throw new SprintLockHeldError(
|
|
114
|
+
`[Sprint Lock] Sprint branch "${branch}" (members: ${(members || []).join(', ')}) is already ` +
|
|
115
|
+
`running under pid ${existingPid}. Refusing to start a second concurrent engine against the ` +
|
|
116
|
+
`same sprint -- wait for it to finish, or stop it first.`,
|
|
117
|
+
{ branch, members, existingPid },
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (!allowReclaim) {
|
|
122
|
+
// We already reclaimed once in this call and STILL hit
|
|
123
|
+
// EEXIST -- a concurrent acquire won the race between our
|
|
124
|
+
// unlink and this retry.
|
|
125
|
+
throw new SprintLockHeldError(
|
|
126
|
+
`[Sprint Lock] Sprint branch "${branch}" (members: ${(members || []).join(', ')}) lock could ` +
|
|
127
|
+
`not be acquired -- a concurrent process claimed it during stale-pidfile reclaim.`,
|
|
128
|
+
{ branch, members },
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Stale pidfile (dead pid, or unreadable/corrupt content) --
|
|
133
|
+
// reclaim it and retry exactly once, never a false block.
|
|
134
|
+
try { fs.unlinkSync(lockPath); } catch { /* already gone -- fine */ }
|
|
135
|
+
return tryAcquire(false);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return tryAcquire(true);
|
|
140
|
+
}
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VCSModule -- orchestrator-side (fleet-se), provider-dispatched command
|
|
3
|
+
* builder for VCS actions raised against a hosted repo provider.
|
|
4
|
+
*
|
|
5
|
+
* Architectural context (apra-fleet-tfx, correction note 2026-08-02): this
|
|
6
|
+
* module lives in the orchestrator (fleet-se, alongside runner.js and the
|
|
7
|
+
* server-side src/services/vcs/ provider seam -- see that seam's
|
|
8
|
+
* VcsProviderService in src/services/vcs/types.ts, which this module's shape
|
|
9
|
+
* mirrors/extends rather than inventing a parallel one). It NEVER runs on the
|
|
10
|
+
* member and NEVER performs network I/O itself. Its only job is: given a
|
|
11
|
+
* provider name and the already-minted credential, deterministically build
|
|
12
|
+
* the exact command (a curl(1) invocation over the provider's REST API) that
|
|
13
|
+
* the member will run via execute_command, plus the metadata a caller needs
|
|
14
|
+
* to interpret that command's output (success / already-exists / error).
|
|
15
|
+
*
|
|
16
|
+
* The member is a dumb executor: it holds no VCS-abstraction code and makes
|
|
17
|
+
* no choice about how the PR gets raised. No vendor CLI (`gh`, `hub`, ...)
|
|
18
|
+
* appears anywhere in the commands this module builds, and there is no
|
|
19
|
+
* server-side fallback -- callers that get an unsupported provider get a
|
|
20
|
+
* clear ASCII "ERROR:" failure, never a silently wrong command.
|
|
21
|
+
*
|
|
22
|
+
* Token-safety invariant (apra-fleet-tfx.7 AC3): the raw token is placed only
|
|
23
|
+
* in the `command` string that is actually dispatched for execution (never
|
|
24
|
+
* echoed by curl itself -- no -v/--trace flag is ever added). Every field
|
|
25
|
+
* meant for logs (`logSafeCommand`) has the token replaced with a fixed
|
|
26
|
+
* redaction marker. Callers must log/echo `logSafeCommand`, never `command`.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { VCS_FAILURE_KINDS, VCS_RETRYABLE_KINDS } from './errors.mjs';
|
|
30
|
+
import {
|
|
31
|
+
DEFAULT_VCS_PROVIDER,
|
|
32
|
+
registerVcsProvider,
|
|
33
|
+
unregisterVcsProvider,
|
|
34
|
+
isKnownVcsProvider,
|
|
35
|
+
listVcsProviders,
|
|
36
|
+
listVcsAuthProviders,
|
|
37
|
+
getVcsProvider,
|
|
38
|
+
resolveVcsProviderChain,
|
|
39
|
+
resolveVcsProviderForHost,
|
|
40
|
+
} from './vcs-providers/index.mjs';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Provider-dispatched command build step. `action` is one of
|
|
44
|
+
* 'create-pull-request' | 'comment'; `params.provider` selects the REST
|
|
45
|
+
* dispatch. Pure and deterministic -- no network I/O, no filesystem access,
|
|
46
|
+
* no randomness (beyond whatever caller-supplied fields it is handed).
|
|
47
|
+
*
|
|
48
|
+
* apra-fleet-647.1.5.1: dispatches through the vcs-providers/ registry --
|
|
49
|
+
* each provider's own command builders live as a `builders` field on its
|
|
50
|
+
* descriptor (see ./vcs-providers/github.mjs) rather than in a second
|
|
51
|
+
* provider-name-keyed table here. Adding a provider's builders is therefore
|
|
52
|
+
* one file under vcs-providers/, never a change to this function.
|
|
53
|
+
*
|
|
54
|
+
* Returns { provider, action, command, logSafeCommand, interpret }.
|
|
55
|
+
* Throws an Error whose message starts with the ASCII marker "ERROR:" for an
|
|
56
|
+
* unsupported/unknown provider or missing required fields, rather than
|
|
57
|
+
* silently building a wrong command.
|
|
58
|
+
*/
|
|
59
|
+
function buildVcsCommand(action, params) {
|
|
60
|
+
const provider = params && params.provider;
|
|
61
|
+
const impl = getVcsProvider(provider);
|
|
62
|
+
if (!impl) {
|
|
63
|
+
const known = listVcsAuthProviders().join(', ');
|
|
64
|
+
throw new Error(`ERROR: VCSModule: unsupported VCS provider "${provider}" -- known providers: ${known}.`);
|
|
65
|
+
}
|
|
66
|
+
const builder = impl.builders && impl.builders[action];
|
|
67
|
+
if (!builder) {
|
|
68
|
+
throw new Error(`ERROR: VCSModule: provider "${provider}" does not yet implement action "${action}".`);
|
|
69
|
+
}
|
|
70
|
+
return builder(params);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Build a "raise a PR" command for the given provider. */
|
|
74
|
+
export function buildCreatePrCommand(params) {
|
|
75
|
+
return buildVcsCommand('create-pull-request', params);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
// Provider resolution (apra-fleet-647.1.2.1; refolded onto the registry
|
|
80
|
+
// apra-fleet-647.1.5.1)
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
//
|
|
83
|
+
// Each provider owns its OWN default auth-mode vocabulary (GitHub: App vs.
|
|
84
|
+
// PAT; Bitbucket/Azure DevOps have no such axis -- they always authenticate
|
|
85
|
+
// via their own single token field) so a caller (runner.js) never has to
|
|
86
|
+
// hardcode a provider-specific mode literal alongside the provider name.
|
|
87
|
+
// `null` means "this provider has no separate auth-mode choice at
|
|
88
|
+
// provision_vcs_auth call time". That per-provider default now lives as the
|
|
89
|
+
// `defaultAuthMode` field on the provider's OWN descriptor (see
|
|
90
|
+
// ./vcs-providers/github.mjs, ./vcs-providers/bitbucket.mjs,
|
|
91
|
+
// ./vcs-providers/azure-devops.mjs) rather than in a second provider-name-
|
|
92
|
+
// keyed table here.
|
|
93
|
+
//
|
|
94
|
+
// GitHub defaults to 'github-app' (never 'pat') because that is the mode
|
|
95
|
+
// runner.js has always hardcoded -- resolveProvider() must reproduce that
|
|
96
|
+
// exact behavior for every already-github-provisioned member, not merely a
|
|
97
|
+
// plausible one (apra-fleet-647.1.2.1 AC: "Existing GitHub members behave
|
|
98
|
+
// exactly as before").
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Resolve `member`'s persisted VCS provider (and that provider's own default
|
|
102
|
+
* auth mode) from the fleet member registry, via the injected `fleetApi`'s
|
|
103
|
+
* `memberDetail()` (member_detail, the only MCP surface that currently
|
|
104
|
+
* exposes Agent.vcsProvider -- src/tools/member-detail.ts). NO default, NO
|
|
105
|
+
* guessing: an absent or unrecognized vcsProvider is a typed "ERROR:"
|
|
106
|
+
* failure naming the member and the known providers, never a silent GitHub
|
|
107
|
+
* assumption (apra-fleet-647.1.2's whole point).
|
|
108
|
+
*
|
|
109
|
+
* The known-provider vocabulary is listVcsAuthProviders() -- every registered
|
|
110
|
+
* vcs-providers/ descriptor that declares its own `defaultAuthMode` (this
|
|
111
|
+
* module's single manifest of member-facing VCS auth backends it is aware of
|
|
112
|
+
* at all; see ./vcs-providers/index.mjs's isAuthBackend()) -- so a provider
|
|
113
|
+
* added there is automatically recognized here too, no second list to keep
|
|
114
|
+
* in sync.
|
|
115
|
+
*
|
|
116
|
+
* @param {string} member
|
|
117
|
+
* @param {{ fleetApi: { memberDetail: (opts: { member_name: string, format?: string }) => Promise<any> } }} opts
|
|
118
|
+
* @returns {Promise<{ provider: string, authMode: string|null }>}
|
|
119
|
+
*/
|
|
120
|
+
export async function resolveProvider(member, { fleetApi } = {}) {
|
|
121
|
+
if (!fleetApi || typeof fleetApi.memberDetail !== 'function') {
|
|
122
|
+
throw new Error(`ERROR: VCSModule: resolveProvider requires an injected fleetApi.memberDetail() -- cannot resolve a VCS provider for member '${member}' without one.`);
|
|
123
|
+
}
|
|
124
|
+
const known = listVcsAuthProviders();
|
|
125
|
+
|
|
126
|
+
let res;
|
|
127
|
+
try {
|
|
128
|
+
res = await fleetApi.memberDetail({ member_name: member, format: 'json' });
|
|
129
|
+
} catch (err) {
|
|
130
|
+
throw new Error(`ERROR: VCSModule: resolveProvider could not read the member registry for member '${member}': ${err && err.message ? err.message : err}`);
|
|
131
|
+
}
|
|
132
|
+
const text = typeof res === 'string'
|
|
133
|
+
? res
|
|
134
|
+
: (res && Array.isArray(res.content) && res.content[0] && typeof res.content[0].text === 'string')
|
|
135
|
+
? res.content[0].text
|
|
136
|
+
: '';
|
|
137
|
+
|
|
138
|
+
let parsed = null;
|
|
139
|
+
try {
|
|
140
|
+
parsed = JSON.parse(text);
|
|
141
|
+
} catch {
|
|
142
|
+
// member_detail returns a plain (non-JSON) string when the member
|
|
143
|
+
// itself cannot be resolved (see resolveMember in
|
|
144
|
+
// src/utils/resolve-member.ts) -- surface that text as-is rather
|
|
145
|
+
// than a generic parse-error message, since it already names the
|
|
146
|
+
// problem (e.g. "no member found matching ...").
|
|
147
|
+
throw new Error(`ERROR: VCSModule: resolveProvider could not resolve member '${member}' from the registry: ${text || '(empty member_detail response)'}`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const provider = parsed && typeof parsed.vcsProvider === 'string' ? parsed.vcsProvider : null;
|
|
151
|
+
if (!provider || !known.includes(provider)) {
|
|
152
|
+
throw new Error(`ERROR: VCSModule: resolveProvider: member '${member}' has no registered VCS provider (vcsProvider: ${provider ? `"${provider}"` : '(absent)'}) -- known providers: ${known.join(', ')}. Provision one via provision_vcs_auth with an explicit 'provider' before relying on resolveProvider.`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const impl = getVcsProvider(provider);
|
|
156
|
+
return { provider, authMode: impl && Object.prototype.hasOwnProperty.call(impl, 'defaultAuthMode') ? impl.defaultAuthMode : null };
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Build a "comment on abort" command for the given provider. */
|
|
160
|
+
export function buildCommentCommand(params) {
|
|
161
|
+
return buildVcsCommand('comment', params);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
// Failure classification (apra-fleet-647.1.3.1)
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
//
|
|
168
|
+
// classifyFailure() is the ONE place VCS stderr is ever parsed. No other file
|
|
169
|
+
// may carry a regex over a git/dolt/provider error string: add a pattern to a
|
|
170
|
+
// provider file under ./vcs-providers/ instead. Downstream code branches on
|
|
171
|
+
// the neutral `kind` ALONE -- never on `providerCode`, never on `raw`.
|
|
172
|
+
//
|
|
173
|
+
// TAXONOMY (the neutral vocabulary; canonical definitions in errors.mjs
|
|
174
|
+
// VCS_FAILURE_KINDS)
|
|
175
|
+
//
|
|
176
|
+
// kind | retryable | meaning | remediation
|
|
177
|
+
// -----------------------+-----------+------------------------------------------+---------------------------
|
|
178
|
+
// AUTH_EXPIRED | false | credential missing/stale/invalid | re-provision, then retry
|
|
179
|
+
// AUTH_DENIED | false | identity refused; lacks access | operator grants access
|
|
180
|
+
// DIVERGED | false | non-FF / unmerged / conflicted | never auto-resolve
|
|
181
|
+
// TRANSIENT | true | network / server / lock blip | retry, bounded
|
|
182
|
+
// NO_REMOTE | false | no remote configured; nothing to sync | none; benign no-op
|
|
183
|
+
// UNSUPPORTED_OPERATION | false | action not implemented for this provider | fix the call/config
|
|
184
|
+
// UNKNOWN | false | unrecognized -- must surface, not guess | operator triage
|
|
185
|
+
//
|
|
186
|
+
// `retryable` is true ONLY for TRANSIENT, and means "safe to re-run the same
|
|
187
|
+
// command with NO remediation first". AUTH_EXPIRED is therefore false even
|
|
188
|
+
// though the self-heal path retries once -- that retry follows remediation.
|
|
189
|
+
//
|
|
190
|
+
// PRECEDENCE. Kinds are checked in KIND_PRECEDENCE order and the first match
|
|
191
|
+
// wins, so a stderr carrying several signals gets the most dangerous reading:
|
|
192
|
+
// DIVERGED before AUTH before TRANSIENT is exactly runner.js's
|
|
193
|
+
// classifyGitFailure ordering -- a diverged state must never be misread as a
|
|
194
|
+
// retryable blip because its message happens to contain a lock or credential
|
|
195
|
+
// word, and an auth failure must never be blindly retried. NO_REMOTE and
|
|
196
|
+
// UNSUPPORTED_OPERATION come last because their texts are the narrowest and
|
|
197
|
+
// the least dangerous to under-match. A provider may override the order with
|
|
198
|
+
// its own `precedence` array (dolt's classifier, for example, promotes
|
|
199
|
+
// no-remote to first) without any change here.
|
|
200
|
+
|
|
201
|
+
const KIND_PRECEDENCE = Object.freeze([
|
|
202
|
+
VCS_FAILURE_KINDS.DIVERGED,
|
|
203
|
+
VCS_FAILURE_KINDS.AUTH_EXPIRED,
|
|
204
|
+
VCS_FAILURE_KINDS.AUTH_DENIED,
|
|
205
|
+
VCS_FAILURE_KINDS.TRANSIENT,
|
|
206
|
+
VCS_FAILURE_KINDS.NO_REMOTE,
|
|
207
|
+
VCS_FAILURE_KINDS.UNSUPPORTED_OPERATION,
|
|
208
|
+
]);
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Classify a failed VCS command's raw stderr/stdout into the neutral taxonomy.
|
|
212
|
+
*
|
|
213
|
+
* PURE: no I/O, no clock, no randomness, no module-level mutable state, and no
|
|
214
|
+
* global (/g) regexes -- calling it twice with the same input always returns a
|
|
215
|
+
* deeply-equal result.
|
|
216
|
+
*
|
|
217
|
+
* NON-THROWING, including for an unknown/absent provider, which falls back to
|
|
218
|
+
* the default provider's chain. This is a DELIBERATE asymmetry with
|
|
219
|
+
* buildVcsCommand() above, which DOES throw "ERROR:" on an unsupported
|
|
220
|
+
* provider: building a wrong command silently would corrupt a repo, whereas a
|
|
221
|
+
* classifier that throws would convert a recoverable sync failure into a crash
|
|
222
|
+
* -- and would do it precisely when something is already going wrong. An
|
|
223
|
+
* unmatched stderr returns UNKNOWN, which is never retried and never
|
|
224
|
+
* self-healed, so a mis-fallback degrades to "surface it", not to a guess.
|
|
225
|
+
*
|
|
226
|
+
* @param {string} rawStderr - the raw stderr/stdout of the failed command
|
|
227
|
+
* @param {{ provider?: string }} [opts] - provider selects the rule chain;
|
|
228
|
+
* defaults to DEFAULT_VCS_PROVIDER ('github'), which reproduces runner.js's
|
|
229
|
+
* full auth pattern set exactly.
|
|
230
|
+
* @returns {{ kind: string, providerCode: string|null, retryable: boolean, raw: string }}
|
|
231
|
+
* `kind` is the ONLY field control flow may branch on. `providerCode` is the
|
|
232
|
+
* provider-specific token (e.g. an HTTP status, or an Azure DevOps
|
|
233
|
+
* 'TF401019') carried as a DIAGNOSTIC detail. `raw` is the input, normalized
|
|
234
|
+
* to a string, so a caller can log the evidence behind the verdict.
|
|
235
|
+
*/
|
|
236
|
+
export function classifyFailure(rawStderr, opts = {}) {
|
|
237
|
+
const raw = String(rawStderr == null ? '' : rawStderr);
|
|
238
|
+
const providerName = (opts && opts.provider) || DEFAULT_VCS_PROVIDER;
|
|
239
|
+
const chain = resolveVcsProviderChain(providerName);
|
|
240
|
+
|
|
241
|
+
const precedence = chain.find((p) => Array.isArray(p.precedence))?.precedence || KIND_PRECEDENCE;
|
|
242
|
+
|
|
243
|
+
let kind = VCS_FAILURE_KINDS.UNKNOWN;
|
|
244
|
+
outer:
|
|
245
|
+
for (const candidate of precedence) {
|
|
246
|
+
// Most-derived provider first within each kind, so a provider can
|
|
247
|
+
// sharpen a base verdict without editing the base.
|
|
248
|
+
for (const provider of chain) {
|
|
249
|
+
const patterns = (provider.rules && provider.rules[candidate]) || [];
|
|
250
|
+
for (const re of patterns) {
|
|
251
|
+
if (re.test(raw)) {
|
|
252
|
+
kind = candidate;
|
|
253
|
+
break outer;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let providerCode = null;
|
|
260
|
+
for (const provider of chain) {
|
|
261
|
+
if (typeof provider.extractProviderCode === 'function') {
|
|
262
|
+
providerCode = provider.extractProviderCode(raw) ?? null;
|
|
263
|
+
if (providerCode !== null) break;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return { kind, providerCode, retryable: VCS_RETRYABLE_KINDS.has(kind), raw };
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Adapter from the neutral taxonomy to runner.js's legacy git verdict
|
|
272
|
+
* vocabulary, so apra-fleet-647.1.3.2 can delete GIT_*_PATTERNS and delegate
|
|
273
|
+
* classifyGitFailure() to classifyFailure() with NO verdict change.
|
|
274
|
+
*
|
|
275
|
+
* Both AUTH kinds collapse to 'auth' (today's classifier does not distinguish
|
|
276
|
+
* them). NO_REMOTE and UNSUPPORTED_OPERATION collapse to 'unknown' because git
|
|
277
|
+
* has no such verdict today and 'unknown' is what those texts classify as --
|
|
278
|
+
* preserving parity, not inventing behavior.
|
|
279
|
+
*
|
|
280
|
+
* @param {string} kind - a VCS_FAILURE_KINDS member
|
|
281
|
+
* @returns {'diverged'|'auth'|'transient'|'unknown'}
|
|
282
|
+
*/
|
|
283
|
+
export function toGitVerdict(kind) {
|
|
284
|
+
switch (kind) {
|
|
285
|
+
case VCS_FAILURE_KINDS.DIVERGED: return 'diverged';
|
|
286
|
+
case VCS_FAILURE_KINDS.AUTH_EXPIRED:
|
|
287
|
+
case VCS_FAILURE_KINDS.AUTH_DENIED: return 'auth';
|
|
288
|
+
case VCS_FAILURE_KINDS.TRANSIENT: return 'transient';
|
|
289
|
+
default: return 'unknown';
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Adapter from the neutral taxonomy to dolt-sync.mjs's legacy classifyDoltFailure
|
|
295
|
+
* verdict vocabulary (apra-fleet-647.1.3.2), so classifyDoltFailure can delegate
|
|
296
|
+
* to classifyFailure(raw, { provider: 'dolt' }) with NO verdict change. The
|
|
297
|
+
* companion of toGitVerdict() above -- same collapsing rules, but preserves the
|
|
298
|
+
* three dolt-only benign/fatal kinds (NO_REMOTE, EMPTY_REMOTE,
|
|
299
|
+
* REMOTE_UNREACHABLE) that git has no equivalent of, instead of folding them
|
|
300
|
+
* into 'unknown'.
|
|
301
|
+
*
|
|
302
|
+
* Both AUTH kinds collapse to 'auth' -- classifyDoltFailure has never
|
|
303
|
+
* distinguished them (DoltVCS's own AUTH_EXPIRED table already carries every
|
|
304
|
+
* dolt auth literal, including the publickey-refusal one; see dolt.mjs).
|
|
305
|
+
*
|
|
306
|
+
* @param {string} kind - a VCS_FAILURE_KINDS member
|
|
307
|
+
* @returns {'no-remote'|'empty-remote'|'remote-unreachable'|'auth'|'diverged'|'transient'|'unknown'}
|
|
308
|
+
*/
|
|
309
|
+
export function toDoltVerdict(kind) {
|
|
310
|
+
switch (kind) {
|
|
311
|
+
case VCS_FAILURE_KINDS.NO_REMOTE: return 'no-remote';
|
|
312
|
+
case VCS_FAILURE_KINDS.EMPTY_REMOTE: return 'empty-remote';
|
|
313
|
+
case VCS_FAILURE_KINDS.REMOTE_UNREACHABLE: return 'remote-unreachable';
|
|
314
|
+
case VCS_FAILURE_KINDS.DIVERGED: return 'diverged';
|
|
315
|
+
case VCS_FAILURE_KINDS.AUTH_EXPIRED:
|
|
316
|
+
case VCS_FAILURE_KINDS.AUTH_DENIED: return 'auth';
|
|
317
|
+
case VCS_FAILURE_KINDS.TRANSIENT: return 'transient';
|
|
318
|
+
default: return 'unknown';
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// ---------------------------------------------------------------------------
|
|
323
|
+
// capabilities(remoteUrl) (apra-fleet-647.1.4.1)
|
|
324
|
+
// ---------------------------------------------------------------------------
|
|
325
|
+
//
|
|
326
|
+
// The ONE place a git remote URL is parsed into a host and classified for PR
|
|
327
|
+
// capability -- replaces runner.js's isHostedGithubRemote(), whose regex
|
|
328
|
+
// hardcoded 'github.com' literally and treated every other host (Azure
|
|
329
|
+
// DevOps, GitLab, GitHub Enterprise, ...) as "non-hosted" by default. Here
|
|
330
|
+
// the URL is parsed into a bare host and the decision is delegated to
|
|
331
|
+
// whichever registered provider's matchesHost() claims it (see
|
|
332
|
+
// resolveVcsProviderForHost() in ./vcs-providers/index.mjs) -- so a provider
|
|
333
|
+
// added later (e.g. a real Azure DevOps/GitLab implementation) gains
|
|
334
|
+
// capability recognition for free, with zero change here.
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Parse a git remote URL into its scheme and bare lowercase host, or null for
|
|
338
|
+
* anything unresolvable (missing/empty/malformed). Accepts the three shapes
|
|
339
|
+
* runner.js's PR-gate call sites can see:
|
|
340
|
+
* - a normal URL with a scheme: https://[user@]host/owner/repo(.git)
|
|
341
|
+
* ssh://[user@]host/owner/repo
|
|
342
|
+
* file:///path/to/bare.git
|
|
343
|
+
* - scp-like SSH shorthand with NO scheme: user@host:owner/repo(.git)
|
|
344
|
+
* @param {unknown} remoteUrl
|
|
345
|
+
* @returns {{ scheme: string, host: string|null } | null}
|
|
346
|
+
*/
|
|
347
|
+
function parseRemote(remoteUrl) {
|
|
348
|
+
const url = String(remoteUrl ?? '').trim();
|
|
349
|
+
if (!url) return null;
|
|
350
|
+
|
|
351
|
+
// scp-like shorthand (e.g. git@github.com:owner/repo.git) has no
|
|
352
|
+
// `scheme://` prefix at all, which `new URL()` cannot parse -- detect and
|
|
353
|
+
// extract the host directly. Guarded by the scheme-prefix test so an
|
|
354
|
+
// actual `ssh://user@host/...` URL (which DOES have a scheme) falls
|
|
355
|
+
// through to the URL branch below instead.
|
|
356
|
+
if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(url)) {
|
|
357
|
+
const scpMatch = /^[^@\s/]+@([^:\s/]+):/.exec(url);
|
|
358
|
+
if (scpMatch) return { scheme: 'ssh', host: scpMatch[1].toLowerCase() };
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
let parsed;
|
|
363
|
+
try {
|
|
364
|
+
parsed = new URL(url);
|
|
365
|
+
} catch {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
const scheme = parsed.protocol.replace(/:$/, '').toLowerCase();
|
|
369
|
+
if (scheme === 'file') return { scheme: 'file', host: null };
|
|
370
|
+
const host = parsed.hostname ? parsed.hostname.toLowerCase() : null;
|
|
371
|
+
if (!host) return null;
|
|
372
|
+
return { scheme, host };
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Answer what a git 'origin' remote supports, dispatched through the
|
|
377
|
+
* resolved provider implementation -- NOT a literal host list. Used by
|
|
378
|
+
* runner.js's Publish-PR non-hosted-remote gate and finalizeAbort's
|
|
379
|
+
* abort-PR gate; both replace their former isHostedGithubRemote() call with
|
|
380
|
+
* this.
|
|
381
|
+
*
|
|
382
|
+
* Behavior preserved from isHostedGithubRemote() (apra-fleet-647.1.4 AC):
|
|
383
|
+
* - a `file://` remote: hasRemote:true, canOpenPullRequest:false
|
|
384
|
+
* - missing/empty/unresolvable URL: hasRemote:false, canOpenPullRequest:false (fails closed)
|
|
385
|
+
* - a `github.com` remote (any of the 3 URL shapes isHostedGithubRemote
|
|
386
|
+
* recognized): canOpenPullRequest:true, same as before.
|
|
387
|
+
* NEW behavior (the whole point of apra-fleet-647.1.4): a GitHub Enterprise
|
|
388
|
+
* host, or any other resolvable host, is classified by asking its provider
|
|
389
|
+
* rather than being bucketed into "non-hosted" purely for not being
|
|
390
|
+
* literally 'github.com'.
|
|
391
|
+
*
|
|
392
|
+
* @param {unknown} remoteUrl
|
|
393
|
+
* @returns {{ hasRemote: boolean, canOpenPullRequest: boolean, host: string|null }}
|
|
394
|
+
*/
|
|
395
|
+
export function capabilities(remoteUrl) {
|
|
396
|
+
const parsed = parseRemote(remoteUrl);
|
|
397
|
+
if (!parsed) return { hasRemote: false, canOpenPullRequest: false, host: null };
|
|
398
|
+
if (parsed.scheme === 'file') return { hasRemote: true, canOpenPullRequest: false, host: null };
|
|
399
|
+
|
|
400
|
+
const provider = resolveVcsProviderForHost(parsed.host);
|
|
401
|
+
const providerCaps = (provider && typeof provider.capabilitiesForHost === 'function')
|
|
402
|
+
? provider.capabilitiesForHost(parsed.host)
|
|
403
|
+
: { canOpenPullRequest: false };
|
|
404
|
+
return { hasRemote: true, canOpenPullRequest: !!providerCaps.canOpenPullRequest, host: parsed.host };
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export const VCSModule = {
|
|
408
|
+
buildCreatePrCommand,
|
|
409
|
+
buildCommentCommand,
|
|
410
|
+
classifyFailure,
|
|
411
|
+
toGitVerdict,
|
|
412
|
+
toDoltVerdict,
|
|
413
|
+
resolveProvider,
|
|
414
|
+
capabilities,
|
|
415
|
+
registerVcsProvider,
|
|
416
|
+
unregisterVcsProvider,
|
|
417
|
+
isKnownVcsProvider,
|
|
418
|
+
listVcsProviders,
|
|
419
|
+
listVcsAuthProviders,
|
|
420
|
+
getVcsProvider,
|
|
421
|
+
DEFAULT_VCS_PROVIDER,
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
export {
|
|
425
|
+
VCS_FAILURE_KINDS,
|
|
426
|
+
DEFAULT_VCS_PROVIDER,
|
|
427
|
+
registerVcsProvider,
|
|
428
|
+
unregisterVcsProvider,
|
|
429
|
+
isKnownVcsProvider,
|
|
430
|
+
listVcsProviders,
|
|
431
|
+
listVcsAuthProviders,
|
|
432
|
+
getVcsProvider,
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
export default VCSModule;
|