@apralabs/apra-fleet 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -12
- package/dist/agents/backlog-groomer.md +42 -21
- package/dist/agents/ci-watcher.md +14 -0
- package/dist/agents/deployer.md +59 -46
- package/dist/agents/doer.md +157 -134
- package/dist/agents/harvester.md +31 -32
- package/dist/agents/integ-test-runner.md +92 -113
- package/dist/agents/kb-reconciler.md +40 -42
- package/dist/agents/plan-reviewer.md +139 -63
- package/dist/agents/planner.md +176 -100
- package/dist/agents/regression-test-runner.md +77 -81
- package/dist/agents/reviewer.md +69 -85
- package/dist/agents/schemas/integ-test-runner-output.json +1 -1
- package/dist/agents/schemas/plan-reviewer-output.json +37 -0
- package/dist/agents/schemas/regression-test-runner-output.json +4 -17
- 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 +29 -11
- 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 -43
- 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 +294 -61
- 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 +7 -3
- package/dist/cli/register-member.js.map +1 -1
- package/dist/cli/start.d.ts.map +1 -1
- package/dist/cli/start.js +7 -0
- package/dist/cli/start.js.map +1 -1
- package/dist/cli/uninstall.d.ts.map +1 -1
- package/dist/cli/uninstall.js +5 -3
- package/dist/cli/uninstall.js.map +1 -1
- package/dist/cli/watch.d.ts +26 -3
- package/dist/cli/watch.d.ts.map +1 -1
- package/dist/cli/watch.js +41 -9
- package/dist/cli/watch.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/git-bash-candidates.d.ts +35 -0
- package/dist/os/git-bash-candidates.d.ts.map +1 -0
- package/dist/os/git-bash-candidates.js +46 -0
- package/dist/os/git-bash-candidates.js.map +1 -0
- package/dist/os/index.d.ts +13 -4
- package/dist/os/index.d.ts.map +1 -1
- package/dist/os/index.js +17 -2
- package/dist/os/index.js.map +1 -1
- package/dist/os/linux.d.ts +6 -0
- package/dist/os/linux.d.ts.map +1 -1
- package/dist/os/linux.js +36 -3
- package/dist/os/linux.js.map +1 -1
- package/dist/os/os-commands.d.ts +68 -2
- package/dist/os/os-commands.d.ts.map +1 -1
- package/dist/os/os-commands.js.map +1 -1
- package/dist/os/windows-gitbash.d.ts +98 -0
- package/dist/os/windows-gitbash.d.ts.map +1 -0
- package/dist/os/windows-gitbash.js +259 -0
- package/dist/os/windows-gitbash.js.map +1 -0
- package/dist/os/windows.d.ts +6 -0
- package/dist/os/windows.d.ts.map +1 -1
- package/dist/os/windows.js +73 -8
- package/dist/os/windows.js.map +1 -1
- package/dist/providers/agy.d.ts +118 -8
- package/dist/providers/agy.d.ts.map +1 -1
- package/dist/providers/agy.js +580 -55
- package/dist/providers/agy.js.map +1 -1
- package/dist/providers/claude.d.ts +83 -4
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +365 -12
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.d.ts +7 -4
- package/dist/providers/codex.d.ts.map +1 -1
- package/dist/providers/codex.js +24 -4
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/copilot.d.ts +7 -4
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/copilot.js +27 -4
- package/dist/providers/copilot.js.map +1 -1
- package/dist/providers/index.d.ts +0 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +0 -3
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/none.d.ts +7 -4
- package/dist/providers/none.d.ts.map +1 -1
- package/dist/providers/none.js +22 -4
- package/dist/providers/none.js.map +1 -1
- package/dist/providers/opencode.d.ts +6 -3
- package/dist/providers/opencode.d.ts.map +1 -1
- package/dist/providers/opencode.js +27 -4
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/provider.d.ts +215 -11
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js +58 -2
- package/dist/providers/provider.js.map +1 -1
- package/dist/services/agent-provisioner.js +2 -2
- package/dist/services/agent-provisioner.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/activity.js +2 -2
- package/dist/services/cloud/activity.js.map +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/context-admission.d.ts.map +1 -1
- package/dist/services/context-admission.js +9 -7
- package/dist/services/context-admission.js.map +1 -1
- package/dist/services/credential-cleanup.d.ts.map +1 -1
- package/dist/services/credential-cleanup.js +47 -10
- 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/member-home.d.ts +1 -1
- package/dist/services/member-home.d.ts.map +1 -1
- package/dist/services/member-home.js +15 -12
- package/dist/services/member-home.js.map +1 -1
- package/dist/services/model-pricing.d.ts.map +1 -1
- package/dist/services/model-pricing.js +7 -8
- package/dist/services/model-pricing.js.map +1 -1
- package/dist/services/orphan-recovery.d.ts +6 -3
- package/dist/services/orphan-recovery.d.ts.map +1 -1
- package/dist/services/orphan-recovery.js +17 -14
- package/dist/services/orphan-recovery.js.map +1 -1
- package/dist/services/preflight-check.js +2 -2
- package/dist/services/preflight-check.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/shell-probe.d.ts +131 -0
- package/dist/services/shell-probe.d.ts.map +1 -0
- package/dist/services/shell-probe.js +210 -0
- package/dist/services/shell-probe.js.map +1 -0
- package/dist/services/singleton.d.ts +2 -0
- package/dist/services/singleton.d.ts.map +1 -1
- package/dist/services/singleton.js +1 -1
- package/dist/services/singleton.js.map +1 -1
- package/dist/services/ssh.d.ts.map +1 -1
- package/dist/services/ssh.js +60 -4
- package/dist/services/ssh.js.map +1 -1
- package/dist/services/stall/find-log-file.d.ts.map +1 -1
- package/dist/services/stall/find-log-file.js +22 -16
- package/dist/services/stall/find-log-file.js.map +1 -1
- package/dist/services/stall/read-log-tail.d.ts.map +1 -1
- package/dist/services/stall/read-log-tail.js +26 -15
- 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/stall/stall-poller.d.ts.map +1 -1
- package/dist/services/stall/stall-poller.js +35 -42
- package/dist/services/stall/stall-poller.js.map +1 -1
- package/dist/services/strategy.d.ts +9 -0
- package/dist/services/strategy.d.ts.map +1 -1
- package/dist/services/strategy.js +119 -8
- 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/user-config.js +1 -1
- package/dist/services/user-config.js.map +1 -1
- package/dist/services/vcs/azure-devops.d.ts +67 -2
- package/dist/services/vcs/azure-devops.d.ts.map +1 -1
- package/dist/services/vcs/azure-devops.js +281 -15
- package/dist/services/vcs/azure-devops.js.map +1 -1
- package/dist/services/vcs/bitbucket.d.ts.map +1 -1
- package/dist/services/vcs/bitbucket.js +16 -0
- package/dist/services/vcs/bitbucket.js.map +1 -1
- package/dist/services/vcs/github.d.ts.map +1 -1
- package/dist/services/vcs/github.js +24 -0
- package/dist/services/vcs/github.js.map +1 -1
- package/dist/services/vcs/types.d.ts +123 -2
- package/dist/services/vcs/types.d.ts.map +1 -1
- package/dist/skills/fleet-sprint-cli/SKILL.md +20 -1
- package/dist/skills/pm/SKILL.md +1 -2
- package/dist/skills/pm/cost.md +0 -4
- package/dist/skills/pm/fleet-addendum.md +2 -3
- 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 +5 -3
- package/dist/tools/check-status.js.map +1 -1
- package/dist/tools/cloud-control.js +2 -2
- package/dist/tools/cloud-control.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 +211 -50
- 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 +56 -29
- 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 +1214 -873
- 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 +7 -2
- 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 +22 -3
- 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 +71 -18
- package/dist/tools/member-reservation.js.map +1 -1
- package/dist/tools/monitor-task.d.ts.map +1 -1
- package/dist/tools/monitor-task.js +17 -2
- package/dist/tools/monitor-task.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 +147 -59
- package/dist/tools/provision-auth.js.map +1 -1
- package/dist/tools/provision-vcs-auth.d.ts +96 -3
- package/dist/tools/provision-vcs-auth.d.ts.map +1 -1
- package/dist/tools/provision-vcs-auth.js +254 -88
- package/dist/tools/provision-vcs-auth.js.map +1 -1
- package/dist/tools/register-member.d.ts +21 -12
- package/dist/tools/register-member.d.ts.map +1 -1
- package/dist/tools/register-member.js +141 -16
- 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 +29 -4
- package/dist/tools/remove-member.js.map +1 -1
- package/dist/tools/revoke-vcs-auth.js +2 -2
- package/dist/tools/revoke-vcs-auth.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/setup-ssh-key.d.ts.map +1 -1
- package/dist/tools/setup-ssh-key.js +2 -1
- package/dist/tools/setup-ssh-key.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/stop-prompt.js +2 -2
- package/dist/tools/stop-prompt.js.map +1 -1
- package/dist/tools/update-agent-cli.js +2 -2
- package/dist/tools/update-agent-cli.js.map +1 -1
- package/dist/tools/update-member.d.ts +21 -12
- package/dist/tools/update-member.d.ts.map +1 -1
- package/dist/tools/update-member.js +61 -12
- 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 +24 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/agent-helpers.d.ts +36 -0
- package/dist/utils/agent-helpers.d.ts.map +1 -1
- package/dist/utils/agent-helpers.js +39 -1
- package/dist/utils/agent-helpers.js.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/platform.d.ts +7 -0
- package/dist/utils/platform.d.ts.map +1 -1
- package/dist/utils/platform.js +11 -1
- package/dist/utils/platform.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 +91 -1
- package/dist/utils/workspace-trust.js.map +1 -1
- package/dist/workflows/auto-sprint.js +180 -32
- package/package.json +7 -5
- package/packages/apra-fleet-client/src/client/api.mjs +403 -12
- 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 +42 -21
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +14 -0
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +59 -46
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +157 -134
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +31 -32
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +92 -113
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +40 -42
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +139 -63
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +176 -100
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +77 -81
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +69 -85
- package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +4 -17
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +1 -2
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -4
- package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -3
- package/packages/apra-fleet-se/bin/cli.mjs +280 -3
- package/packages/apra-fleet-se/bin/serve.mjs +114 -5
- 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 +199 -34
- 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 +23 -8
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-manual-recovery-verified.md +10 -8
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +285 -4
- package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +3 -3
- package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/shared-orchestrator-reservation-design.md +12 -12
- package/packages/apra-fleet-se/fleet-sprint/docs/stabilization-log.md +14 -4
- package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
- package/packages/apra-fleet-se/fleet-sprint/dolt-settle.mjs +275 -99
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +1054 -39
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +308 -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 +1672 -9072
- package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +134 -0
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +159 -0
- package/packages/apra-fleet-se/fleet-sprint/se-windows-gitbash.mjs +97 -0
- package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +143 -0
- 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 +20 -1
- 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 +204 -19
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +707 -12
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/dolt.mjs +33 -4
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +191 -43
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +333 -6
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +165 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +167 -37
- 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 +178 -1
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +478 -32
- package/skills/fleet/SKILL.md +27 -16
- package/skills/fleet/auth-azdevops.md +57 -7
- package/skills/fleet/auth-bitbucket.md +5 -5
- package/skills/fleet/auth-github.md +7 -6
- package/skills/fleet/beads-conflict-resolution.md +141 -0
- package/skills/fleet/beads.md +16 -12
- package/skills/fleet/onboarding.md +6 -6
- package/skills/fleet/permissions.md +11 -7
- package/skills/fleet/profiles/node.json +1 -1
- package/skills/fleet/skill-matrix.md +1 -1
- package/skills/fleet/troubleshooting.md +4 -3
- package/version.json +1 -1
- package/dist/providers/gemini.d.ts +0 -52
- package/dist/providers/gemini.d.ts.map +0 -1
- package/dist/providers/gemini.js +0 -236
- package/dist/providers/gemini.js.map +0 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/coach-role-design.md +0 -23
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// se-os-commands.mjs -- the one place fleet-sprint and the supervisor ask
|
|
2
|
+
// "what does a command string look like for THIS member?".
|
|
3
|
+
//
|
|
4
|
+
// Same package as its callers, imported directly: no REST hop, no IPC, no
|
|
5
|
+
// build step, and no dependency on apra-fleet core (which ships as a compiled
|
|
6
|
+
// binary, while these files ship as open user-copyable source).
|
|
7
|
+
//
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// WHY THESE PRIMITIVES AND NO OTHERS
|
|
10
|
+
//
|
|
11
|
+
// The set is derived from the member-bound strings this package actually
|
|
12
|
+
// builds today, not from a general model of a shell:
|
|
13
|
+
//
|
|
14
|
+
// wrapForMember runner.js's local PowerShell envelope builder (the
|
|
15
|
+
// only ad-hoc PowerShell builder in the runner) and
|
|
16
|
+
// its git-credential call site.
|
|
17
|
+
// readCredentialHelper runner.js buildCredentialReadCommand(os, label) --
|
|
18
|
+
// the runner's only OS-branched member-bound command.
|
|
19
|
+
// credentialHelperPath the readable descriptor that same function returns
|
|
20
|
+
// for its error messages.
|
|
21
|
+
// homePath dolt-settle.mjs's member-side dolt path
|
|
22
|
+
// ("$env:USERPROFILE\.apra-fleet\bin\dolt.exe" vs
|
|
23
|
+
// "$HOME/.apra-fleet/bin/dolt").
|
|
24
|
+
// invoke dolt-settle.mjs's invokeBinary(): PowerShell needs
|
|
25
|
+
// the call operator, POSIX must not have it.
|
|
26
|
+
// escapeSqlArg dolt-settle.mjs's escapeSqlForShell(): quotes a SQL
|
|
27
|
+
// string as one double-quoted shell argument. Added
|
|
28
|
+
// (apra-fleet-7dir.20) as a narrow exception to the
|
|
29
|
+
// "no argument quoting" exclusion below, because its
|
|
30
|
+
// call site picked dialect off a bare `platform ===
|
|
31
|
+
// 'win32'` flag -- wrong for a Windows member whose
|
|
32
|
+
// registered shell is gitbash, which needs bash
|
|
33
|
+
// escaping, not PowerShell's. Unlike the excluded
|
|
34
|
+
// GitHub-provider quoting, this call site is
|
|
35
|
+
// genuinely shell-shaped (its two dialects differ
|
|
36
|
+
// because bash and PowerShell disagree about `,
|
|
37
|
+
// $ and \\ inside double quotes) and has exactly the
|
|
38
|
+
// shape every other primitive in this module has:
|
|
39
|
+
// one member-bound string, two dialects, resolved
|
|
40
|
+
// through getSeCommands. General argument quoting
|
|
41
|
+
// otherwise stays out for the reasons below.
|
|
42
|
+
// wrapPowerShellScript dolt-settle.mjs's installPinnedDolt/
|
|
43
|
+
// killProcessAtPath/spawnEphemeralServer (Sections
|
|
44
|
+
// 3/4): whole PowerShell SCRIPTS with no safe bash
|
|
45
|
+
// equivalent worth inventing (Invoke-WebRequest/
|
|
46
|
+
// Expand-Archive install, Get-Process/Stop-Process
|
|
47
|
+
// kill, Invoke-CimMethod Win32_Process spawn --
|
|
48
|
+
// the last one's own header records that
|
|
49
|
+
// Start-Process/schtasks were verified live to die
|
|
50
|
+
// with the SSH session, so the script body itself
|
|
51
|
+
// is not something to casually replace). Added
|
|
52
|
+
// (apra-fleet-7dir.21) because a Windows member
|
|
53
|
+
// whose registered shell is gitbash still HAS a
|
|
54
|
+
// PowerShell interpreter available -- per the repo
|
|
55
|
+
// CLAUDE.md rule ("Wrap PowerShell commands
|
|
56
|
+
// explicitly... rather than assuming the member's
|
|
57
|
+
// shell"), the fix is to keep the live-verified
|
|
58
|
+
// PowerShell script bodies unchanged and invoke
|
|
59
|
+
// them FROM bash via `-EncodedCommand`, not to
|
|
60
|
+
// rewrite them in bash. SeWindowsCommands returns
|
|
61
|
+
// the script unchanged (its own shell already IS
|
|
62
|
+
// PowerShell); SeWindowsGitbashCommands wraps it as
|
|
63
|
+
// a bash-invocable `powershell -EncodedCommand
|
|
64
|
+
// <base64 utf16le>` string; SePosixCommands throws
|
|
65
|
+
// (a true POSIX member has no PowerShell to hand
|
|
66
|
+
// the script to at all).
|
|
67
|
+
//
|
|
68
|
+
// Deliberately NOT included, so this stays an interface rather than a
|
|
69
|
+
// catalogue:
|
|
70
|
+
// - argument quoting and the curl/curl.exe binary choice: their only call
|
|
71
|
+
// site is the GitHub VCS provider, and provider-specific logic belongs
|
|
72
|
+
// behind the provider descriptor hooks, never in a shared module.
|
|
73
|
+
// - work-folder wrapping and PID capture: apra-fleet core's execute_command
|
|
74
|
+
// applies both server-side. No file in this package builds either -- the
|
|
75
|
+
// runner only MENTIONS them in comments describing what core does. A
|
|
76
|
+
// primitive here would have no caller.
|
|
77
|
+
// - credential file WRITE: core's provision_vcs_auth owns the write side;
|
|
78
|
+
// this package only ever reads the deployed helper back.
|
|
79
|
+
//
|
|
80
|
+
// The supervisor was audited too: its only shell text is a local
|
|
81
|
+
// process-inspection call on the supervisor's OWN host (wmic / Get-CimInstance
|
|
82
|
+
// / ps, chosen from process.platform), never a member-bound command string, so
|
|
83
|
+
// it needs nothing of its own from this module.
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
|
|
86
|
+
import { SePosixCommands } from './se-posix.mjs';
|
|
87
|
+
import { SeWindowsCommands } from './se-windows.mjs';
|
|
88
|
+
import { SeWindowsGitbashCommands } from './se-windows-gitbash.mjs';
|
|
89
|
+
|
|
90
|
+
export { SePosixCommands } from './se-posix.mjs';
|
|
91
|
+
export { SeWindowsCommands } from './se-windows.mjs';
|
|
92
|
+
export { SeWindowsGitbashCommands } from './se-windows-gitbash.mjs';
|
|
93
|
+
|
|
94
|
+
const posix = new SePosixCommands();
|
|
95
|
+
const windowsPowerShell = new SeWindowsCommands();
|
|
96
|
+
const windowsGitbash = new SeWindowsGitbashCommands();
|
|
97
|
+
|
|
98
|
+
/** Normalize whatever a caller has to hand into { os, shell }. */
|
|
99
|
+
function normalizeTarget(target) {
|
|
100
|
+
if (typeof target === 'string') return { os: target.trim().toLowerCase(), shell: '' };
|
|
101
|
+
const os = String((target && target.os) || '').trim().toLowerCase();
|
|
102
|
+
const shell = String((target && target.shell) || '').trim().toLowerCase();
|
|
103
|
+
return { os, shell };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Resolve the command primitives for a member.
|
|
108
|
+
*
|
|
109
|
+
* Accepts either a member record shape ({ os, shell } -- exactly the two
|
|
110
|
+
* fields member_detail exposes) or a bare OS string, so existing callers that
|
|
111
|
+
* only know the OS can adopt this without first widening their resolver.
|
|
112
|
+
*
|
|
113
|
+
* A member whose OS cannot be determined resolves to POSIX: that is the
|
|
114
|
+
* historical behaviour of every string this module replaces, and keeping it
|
|
115
|
+
* means an unresolvable member degrades exactly as it does today rather than
|
|
116
|
+
* silently switching dialect.
|
|
117
|
+
*
|
|
118
|
+
* @param {{ os?: string, shell?: string }|string} target
|
|
119
|
+
* @returns {SePosixCommands|SeWindowsCommands}
|
|
120
|
+
*/
|
|
121
|
+
export function getSeCommands(target) {
|
|
122
|
+
const { os, shell } = normalizeTarget(target);
|
|
123
|
+
if (os === 'windows' || os === 'win32') {
|
|
124
|
+
if (shell === 'gitbash') return windowsGitbash;
|
|
125
|
+
// A Windows member with no recorded shell (or any shell other than
|
|
126
|
+
// gitbash) is a PowerShell member: that is what every Windows member was
|
|
127
|
+
// assumed to be before shells were recorded, so it must stay
|
|
128
|
+
// byte-identical.
|
|
129
|
+
return windowsPowerShell;
|
|
130
|
+
}
|
|
131
|
+
return posix;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export default getSeCommands;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// se-posix.mjs -- POSIX (linux/darwin) member-bound command primitives for
|
|
2
|
+
// fleet-sprint and the supervisor.
|
|
3
|
+
//
|
|
4
|
+
// This is fleet-sprint's OWN shell layer, deliberately NOT shared with
|
|
5
|
+
// apra-fleet core's src/os/*.ts: core ships as a compiled binary while these
|
|
6
|
+
// files ship as open, user-copyable source, and fleet-sprint is meant to stay
|
|
7
|
+
// apra-fleet-agnostic. The `se-` filename prefix keeps them from being
|
|
8
|
+
// confused with the core-side modules. Nothing here imports apra-fleet core,
|
|
9
|
+
// and nothing here needs a build step -- plain ESM that Node runs as-is.
|
|
10
|
+
//
|
|
11
|
+
// SCOPE OF THE PRIMITIVE SET: every method below exists because a real
|
|
12
|
+
// member-bound call site in this package builds that string today. See
|
|
13
|
+
// se-os-commands.mjs's header for the call-site inventory. Primitives are
|
|
14
|
+
// added when a call site needs one, never speculatively.
|
|
15
|
+
//
|
|
16
|
+
// HOUSE RULE THIS LAYER ENFORCES: a member-bound command string must not rely
|
|
17
|
+
// on the ORCHESTRATOR's shell or filesystem -- paths are resolved in
|
|
18
|
+
// JavaScript, and the only shell-level expansion that survives is the member's
|
|
19
|
+
// own home-directory token ($HOME here, $env:USERPROFILE on the PowerShell
|
|
20
|
+
// side). That single exception is deliberate and load-bearing: the credential
|
|
21
|
+
// helper file was WRITTEN by apra-fleet core using exactly that token, so the
|
|
22
|
+
// read must resolve the home directory the same way the write did rather than
|
|
23
|
+
// through an independently probed path.
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* POSIX command primitives. Also the base class the Git-for-Windows bash
|
|
27
|
+
* implementation extends -- a gitbash member receives bash strings, so the
|
|
28
|
+
* whole surface below is correct for it apart from genuinely Windows-native
|
|
29
|
+
* details.
|
|
30
|
+
*/
|
|
31
|
+
export class SePosixCommands {
|
|
32
|
+
/** Stable identifier for logging/tests. */
|
|
33
|
+
get shell() {
|
|
34
|
+
return 'posix';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Suffix of the deployed git-credential-helper file. Empty on POSIX: core's
|
|
39
|
+
* linux implementation writes an extensionless executable script. Overridden
|
|
40
|
+
* where the helper is a Windows .bat.
|
|
41
|
+
*/
|
|
42
|
+
get credentialHelperSuffix() {
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Envelope for a command dispatched to the member. POSIX needs none -- the
|
|
48
|
+
* string is already in the member's own dialect -- so this is deliberately
|
|
49
|
+
* the identity function, which is what keeps every historical POSIX command
|
|
50
|
+
* string byte-identical.
|
|
51
|
+
* @param {string} script
|
|
52
|
+
* @returns {string}
|
|
53
|
+
*/
|
|
54
|
+
wrapForMember(script) {
|
|
55
|
+
return String(script);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A path under the MEMBER's home directory. `$HOME` (not `~`) matches what
|
|
60
|
+
* core's linux gitCredentialHelperWrite() wrote.
|
|
61
|
+
* @param {string} relative
|
|
62
|
+
* @returns {string}
|
|
63
|
+
*/
|
|
64
|
+
homePath(relative) {
|
|
65
|
+
const rel = String(relative).replace(/^[\\/]+/, '');
|
|
66
|
+
return `$HOME/${rel}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Invoke an executable at `path` with `args`.
|
|
71
|
+
*
|
|
72
|
+
* QUOTING CONTRACT (differs per implementation on purpose -- pass `path`
|
|
73
|
+
* UNQUOTED; this method adds its own quoting): POSIX double-quotes the path
|
|
74
|
+
* token so a member whose HOME contains whitespace (or other word-splitting
|
|
75
|
+
* characters) still resolves correctly -- `$HOME` still expands inside
|
|
76
|
+
* double quotes, it just no longer gets split on the result (apra-fleet-
|
|
77
|
+
* j918.12; the bare, unquoted form was a real production defect, pinned by
|
|
78
|
+
* apra-fleet-j918.6.3's round-trip harness before this fix). The PowerShell
|
|
79
|
+
* implementation adds both the call operator and double quotes, without
|
|
80
|
+
* which PowerShell merely echoes the path back as a string and the failure
|
|
81
|
+
* looks like success.
|
|
82
|
+
* @param {string} path unquoted; this method adds double quotes
|
|
83
|
+
* @param {string} [args]
|
|
84
|
+
* @returns {string}
|
|
85
|
+
*/
|
|
86
|
+
invoke(path, args = '') {
|
|
87
|
+
const suffix = String(args || '').trim();
|
|
88
|
+
const quoted = `"${path}"`;
|
|
89
|
+
return suffix ? `${quoted} ${suffix}` : quoted;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Member-side path of the git-credential-helper file apra-fleet core's
|
|
94
|
+
* provision_vcs_auth deployed. fleet-sprint only ever READS this file; the
|
|
95
|
+
* write side belongs to core.
|
|
96
|
+
* @param {string} label
|
|
97
|
+
* @returns {string}
|
|
98
|
+
*/
|
|
99
|
+
credentialHelperPath(label) {
|
|
100
|
+
return this.homePath(`.fleet-git-credential-${label}${this.credentialHelperSuffix}`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The command that RUNS the credential helper (so its "password=<token>"
|
|
105
|
+
* line reaches stdout) plus a human-readable descriptor for error messages
|
|
106
|
+
* -- on the PowerShell side the command itself is an opaque base64 blob, so
|
|
107
|
+
* the descriptor has to carry the readable path.
|
|
108
|
+
*
|
|
109
|
+
* NOTE: the POSIX label is intentionally NOT validated, unlike the
|
|
110
|
+
* PowerShell implementation (which is newer and does validate). The path
|
|
111
|
+
* itself is now double-quoted by `invoke()` (apra-fleet-j918.12) so a
|
|
112
|
+
* member whose HOME contains whitespace still resolves; that quoting
|
|
113
|
+
* change does not extend to validating the label.
|
|
114
|
+
* @param {string} label
|
|
115
|
+
* @returns {{ command: string, descriptor: string }}
|
|
116
|
+
*/
|
|
117
|
+
readCredentialHelper(label) {
|
|
118
|
+
const descriptor = this.credentialHelperPath(label);
|
|
119
|
+
return { command: this.wrapForMember(this.invoke(descriptor)), descriptor };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Escape a SQL string so it survives as ONE double-quoted argument in the
|
|
124
|
+
* member's shell. Backticks and `$` are the dangerous characters: bash
|
|
125
|
+
* treats a backtick inside double quotes as command substitution, so both
|
|
126
|
+
* backslash and backtick are backslash-escaped, along with `$` and `"`.
|
|
127
|
+
* Byte-identical to dolt-settle.mjs's escapeSqlForShell('linux', sql).
|
|
128
|
+
* @param {string} sql
|
|
129
|
+
* @returns {string}
|
|
130
|
+
*/
|
|
131
|
+
escapeSqlArg(sql) {
|
|
132
|
+
const bq = String.fromCharCode(96);
|
|
133
|
+
return String(sql)
|
|
134
|
+
.replace(/\\/g, '\\\\')
|
|
135
|
+
.split(bq).join('\\' + bq)
|
|
136
|
+
.replace(/\$/g, '\\$')
|
|
137
|
+
.replace(/"/g, '\\"');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* A POSIX member has no PowerShell -- there is nothing this method could
|
|
142
|
+
* correctly return (returning the script unchanged would hand a bash
|
|
143
|
+
* interpreter raw PowerShell text and fail confusingly; inventing a bash
|
|
144
|
+
* translation would violate the design decision pinned on this primitive,
|
|
145
|
+
* which is to keep the live-verified PowerShell body and only change how
|
|
146
|
+
* it is INVOKED). So the base implementation throws a clear, loud error
|
|
147
|
+
* naming the caller, rather than silently returning something that runs
|
|
148
|
+
* the wrong interpreter (apra-fleet-7dir.21). SeWindowsCommands and
|
|
149
|
+
* SeWindowsGitbashCommands both override this with a real implementation.
|
|
150
|
+
* @param {string} _script
|
|
151
|
+
* @param {string} [callerName] name of the calling function/site, for the error message
|
|
152
|
+
* @returns {never}
|
|
153
|
+
*/
|
|
154
|
+
wrapPowerShellScript(_script, callerName = 'wrapPowerShellScript caller') {
|
|
155
|
+
throw new Error(`${callerName}: cannot wrap a PowerShell script for a POSIX member -- this member has no PowerShell interpreter to invoke it with.`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export default SePosixCommands;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// se-windows-gitbash.mjs -- member-bound command primitives for a Windows
|
|
2
|
+
// member whose registered shell is Git-for-Windows bash (`shell: 'gitbash'`).
|
|
3
|
+
//
|
|
4
|
+
// EXTENDS SePosixCommands (not SeWindowsCommands): what this member's shell
|
|
5
|
+
// actually receives is a *bash* command string, so the whole POSIX surface
|
|
6
|
+
// (wrapForMember's identity passthrough, homePath's `$HOME/...` form, invoke's
|
|
7
|
+
// unquoted-path contract, readCredentialHelper's unvalidated label) is correct
|
|
8
|
+
// as-is and is inherited verbatim -- Git for Windows sets `$HOME` to the same
|
|
9
|
+
// user-profile directory `$env:USERPROFILE` resolves to, so no path-root
|
|
10
|
+
// override is needed. This mirrors the extends-based reuse shape used on the
|
|
11
|
+
// core side by src/os/windows-gitbash.ts (which extends LinuxCommands for the
|
|
12
|
+
// identical reason), even though the two implementations share no code.
|
|
13
|
+
//
|
|
14
|
+
// The ONLY genuinely Windows-native detail left is the deployed
|
|
15
|
+
// git-credential-helper's file suffix: apra-fleet core's Windows
|
|
16
|
+
// gitCredentialHelperWrite (both the PowerShell and the gitbash variant --
|
|
17
|
+
// see src/os/windows-gitbash.ts's gitCredentialHelperWrite, which writes
|
|
18
|
+
// "$HOME/${credFileName}.bat") always writes a native Windows `.bat` helper,
|
|
19
|
+
// never the extensionless POSIX script SePosixCommands assumes. Everything
|
|
20
|
+
// else -- wrapForMember, homePath, invoke, credentialHelperPath,
|
|
21
|
+
// readCredentialHelper -- inherits unchanged from se-posix.mjs; duplicating
|
|
22
|
+
// any of those bodies here would just be bash-string-building drift waiting
|
|
23
|
+
// to happen.
|
|
24
|
+
//
|
|
25
|
+
// PID capture is deliberately NOT overridden here: se-os-commands.mjs's
|
|
26
|
+
// header audit found no call site in this package that builds a PID-capture
|
|
27
|
+
// command string (apra-fleet core's execute_command applies that server-side
|
|
28
|
+
// for every member OS), so there is no primitive to override.
|
|
29
|
+
//
|
|
30
|
+
// wrapPowerShellScript IS overridden here, even though this class extends
|
|
31
|
+
// SePosixCommands: a handful of member-bound scripts (dolt-settle.mjs's
|
|
32
|
+
// installPinnedDolt/killProcessAtPath/spawnEphemeralServer) are whole
|
|
33
|
+
// PowerShell scripts with no safe bash equivalent, so this member -- despite
|
|
34
|
+
// its own shell being bash -- still needs a way to invoke real PowerShell
|
|
35
|
+
// for them (apra-fleet-7dir.21). See that method's own doc comment for the
|
|
36
|
+
// full design rationale.
|
|
37
|
+
|
|
38
|
+
import { SePosixCommands } from './se-posix.mjs';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Bash command primitives for a Windows member running Git-for-Windows bash.
|
|
42
|
+
*/
|
|
43
|
+
export class SeWindowsGitbashCommands extends SePosixCommands {
|
|
44
|
+
/** Stable identifier for logging/tests. */
|
|
45
|
+
get shell() {
|
|
46
|
+
return 'gitbash';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The deployed git-credential helper on ANY Windows member is a native
|
|
51
|
+
* `.bat` (git.exe execs it directly), even when the member's own shell is
|
|
52
|
+
* bash -- see src/os/windows-gitbash.ts's gitCredentialHelperWrite, which
|
|
53
|
+
* writes "$HOME/${credFileName}.bat" rather than the extensionless
|
|
54
|
+
* `#!/bin/sh` script SePosixCommands.credentialHelperSuffix assumes.
|
|
55
|
+
*/
|
|
56
|
+
get credentialHelperSuffix() {
|
|
57
|
+
return '.bat';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Wrap a whole PowerShell SCRIPT (not a single command string) into a
|
|
62
|
+
* bash-invocable form, for the handful of member-bound scripts that have
|
|
63
|
+
* no safe bash equivalent (installPinnedDolt's Invoke-WebRequest/
|
|
64
|
+
* Expand-Archive install, killProcessAtPath's Get-Process/Stop-Process
|
|
65
|
+
* pipeline, spawnEphemeralServer's Invoke-CimMethod Win32_Process spawn --
|
|
66
|
+
* see dolt-settle.mjs). This member's OWN shell is bash (that is what
|
|
67
|
+
* `shell: 'gitbash'` means), but per the repo CLAUDE.md rule ("Wrap
|
|
68
|
+
* PowerShell commands explicitly... rather than assuming the member's
|
|
69
|
+
* shell") a Windows gitbash member still HAS a PowerShell interpreter
|
|
70
|
+
* available, so the live-verified PowerShell script bodies are kept
|
|
71
|
+
* as-is and invoked FROM bash, never rewritten in bash.
|
|
72
|
+
*
|
|
73
|
+
* `-EncodedCommand` (base64 UTF-16LE) is used rather than `-Command`
|
|
74
|
+
* specifically because it removes every quoting interaction between bash
|
|
75
|
+
* and PowerShell -- a script containing double quotes, `$` or backticks
|
|
76
|
+
* would otherwise need bash-safe AND PowerShell-safe quoting
|
|
77
|
+
* simultaneously, which the two dialects cannot agree on (see
|
|
78
|
+
* dolt-settle.mjs's own Section 1b header for concrete examples of that
|
|
79
|
+
* disagreement). Decoding the base64 blob as UTF-16LE reproduces the
|
|
80
|
+
* original script exactly.
|
|
81
|
+
*
|
|
82
|
+
* NON-OBVIOUS: inside the wrapped script the dialect is STILL PowerShell,
|
|
83
|
+
* never this member's own bash -- paths and escaping inside `script` must
|
|
84
|
+
* keep the PowerShell form ($env:USERPROFILE\..., backtick escaping) even
|
|
85
|
+
* though this member's shell is bash. This override only changes how the
|
|
86
|
+
* script is INVOKED, never what it contains.
|
|
87
|
+
*
|
|
88
|
+
* @param {string} script a whole PowerShell script body
|
|
89
|
+
* @returns {string} a bash-safe command line that runs it via PowerShell
|
|
90
|
+
*/
|
|
91
|
+
wrapPowerShellScript(script) {
|
|
92
|
+
const encoded = Buffer.from(String(script), 'utf16le').toString('base64');
|
|
93
|
+
return `powershell -NoProfile -EncodedCommand ${encoded}`;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default SeWindowsGitbashCommands;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// se-windows.mjs -- PowerShell member-bound command primitives for a Windows
|
|
2
|
+
// member with no Git-for-Windows bash shell recorded.
|
|
3
|
+
//
|
|
4
|
+
// Deliberately NOT a subclass of SePosixCommands: what this member's shell
|
|
5
|
+
// receives is PowerShell text, so essentially nothing on the POSIX surface is
|
|
6
|
+
// reusable. (The Git-for-Windows implementation is the opposite case -- it
|
|
7
|
+
// receives bash text and therefore does extend the POSIX base.)
|
|
8
|
+
//
|
|
9
|
+
// Like its sibling, this file imports nothing from apra-fleet core and needs
|
|
10
|
+
// no build step. The PowerShell envelope below is a deliberate MIRROR of
|
|
11
|
+
// core's src/os/windows.ts wrapPowerShellEncoded(), not a reuse of it: this
|
|
12
|
+
// package cannot import core.
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* PowerShell command primitives for a Windows member.
|
|
16
|
+
*/
|
|
17
|
+
export class SeWindowsCommands {
|
|
18
|
+
/** Stable identifier for logging/tests. */
|
|
19
|
+
get shell() {
|
|
20
|
+
return 'powershell';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The deployed git-credential helper is a .bat on a PowerShell Windows
|
|
25
|
+
* member (core's windows gitCredentialHelperWrite writes
|
|
26
|
+
* "$env:USERPROFILE\.fleet-git-credential-<label>.bat").
|
|
27
|
+
*/
|
|
28
|
+
get credentialHelperSuffix() {
|
|
29
|
+
return '.bat';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Wrap a PowerShell script into the envelope this package dispatches to a
|
|
34
|
+
* Windows member.
|
|
35
|
+
*
|
|
36
|
+
* Every part of this shape is load-bearing:
|
|
37
|
+
* - `$ErrorActionPreference = 'Stop'` + try/catch makes a NON-TERMINATING
|
|
38
|
+
* PowerShell failure surface as a non-zero exit instead of a false
|
|
39
|
+
* success;
|
|
40
|
+
* - `-EncodedCommand` (base64 UTF-16LE) removes every quoting question
|
|
41
|
+
* about which shell the transport hands the string to -- it is valid to
|
|
42
|
+
* launch from PowerShell or from cmd.exe;
|
|
43
|
+
* - the `$LASTEXITCODE` check before the trailing `exit 0` preserves a
|
|
44
|
+
* NATIVE command's exit code (e.g. the credential-helper .bat invoked
|
|
45
|
+
* below) that the trailing `exit 0` would otherwise mask -- without it a
|
|
46
|
+
* broken helper reports success with no `password=` line.
|
|
47
|
+
*
|
|
48
|
+
* Byte-identical to the string runner.js builds today.
|
|
49
|
+
* @param {string} script
|
|
50
|
+
* @returns {string}
|
|
51
|
+
*/
|
|
52
|
+
wrapForMember(script) {
|
|
53
|
+
const guarded = `$ErrorActionPreference = 'Stop'; try { ${script}; if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) { exit $LASTEXITCODE }; exit 0 } catch { Write-Error $_; exit 1 }`;
|
|
54
|
+
return `powershell -EncodedCommand ${Buffer.from(guarded, 'utf16le').toString('base64')}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A path under the MEMBER's home directory, expanded ON THE MEMBER.
|
|
59
|
+
* `$env:USERPROFILE` rather than a JavaScript-resolved home path is
|
|
60
|
+
* deliberate and is the one shell expansion this layer permits: core's
|
|
61
|
+
* Windows credential write used exactly this token, so an independently
|
|
62
|
+
* probed home could point somewhere the file was never written.
|
|
63
|
+
* @param {string} relative
|
|
64
|
+
* @returns {string}
|
|
65
|
+
*/
|
|
66
|
+
homePath(relative) {
|
|
67
|
+
const rel = String(relative).replace(/^[\\/]+/, '').replace(/\//g, '\\');
|
|
68
|
+
return `$env:USERPROFILE\\${rel}`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Invoke an executable with PowerShell's call operator, so PowerShell
|
|
73
|
+
* EXECUTES it instead of echoing the quoted path back as a string (which
|
|
74
|
+
* exits 0 and looks like success).
|
|
75
|
+
*
|
|
76
|
+
* Pass `path` UNQUOTED: this adds the double quotes itself (the POSIX
|
|
77
|
+
* implementation deliberately adds none -- see its quoting contract).
|
|
78
|
+
* @param {string} path unquoted
|
|
79
|
+
* @param {string} [args]
|
|
80
|
+
* @returns {string}
|
|
81
|
+
*/
|
|
82
|
+
invoke(path, args = '') {
|
|
83
|
+
const suffix = String(args || '').trim();
|
|
84
|
+
return suffix ? `& "${path}" ${suffix}` : `& "${path}"`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @param {string} label
|
|
89
|
+
* @returns {string}
|
|
90
|
+
*/
|
|
91
|
+
credentialHelperPath(label) {
|
|
92
|
+
return this.homePath(`.fleet-git-credential-${label}${this.credentialHelperSuffix}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Unlike the POSIX branch (kept unvalidated for byte-identical
|
|
97
|
+
* back-compat), the label here is interpolated into a PowerShell
|
|
98
|
+
* double-quoted string and a filename, so shell metacharacters are refused
|
|
99
|
+
* outright.
|
|
100
|
+
* @param {string} label
|
|
101
|
+
* @returns {{ command: string, descriptor: string }}
|
|
102
|
+
*/
|
|
103
|
+
readCredentialHelper(label) {
|
|
104
|
+
if (!/^[A-Za-z0-9._-]+$/.test(String(label))) {
|
|
105
|
+
throw new Error(`Refusing to build a Windows credential-read command for unsafe VCS credential label '${label}' (allowed: letters, digits, '.', '_', '-').`);
|
|
106
|
+
}
|
|
107
|
+
const descriptor = this.credentialHelperPath(label);
|
|
108
|
+
return { command: this.wrapForMember(this.invoke(descriptor)), descriptor };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Escape a SQL string so it survives as ONE double-quoted argument in
|
|
113
|
+
* PowerShell. A backtick is PowerShell's escape character: a literal
|
|
114
|
+
* backtick is a doubled backtick, a literal quote is `` `" ``, and a
|
|
115
|
+
* literal `$` is `` `$ `` (otherwise PowerShell expands it as a variable).
|
|
116
|
+
* Byte-identical to dolt-settle.mjs's escapeSqlForShell('win32', sql).
|
|
117
|
+
* @param {string} sql
|
|
118
|
+
* @returns {string}
|
|
119
|
+
*/
|
|
120
|
+
escapeSqlArg(sql) {
|
|
121
|
+
const bq = String.fromCharCode(96);
|
|
122
|
+
return String(sql)
|
|
123
|
+
.split(bq).join(bq + bq)
|
|
124
|
+
.replace(/\$/g, `${bq}$`)
|
|
125
|
+
.replace(/"/g, `${bq}"`);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* This member's OWN shell already IS PowerShell, so a script destined for
|
|
130
|
+
* it needs no envelope at all -- returning it unchanged is what keeps
|
|
131
|
+
* every non-gitbash Windows member's dispatched script byte-identical to
|
|
132
|
+
* today (apra-fleet-7dir.21). Contrast with SeWindowsGitbashCommands'
|
|
133
|
+
* override, which DOES need to wrap the same script for a bash shell to
|
|
134
|
+
* invoke it.
|
|
135
|
+
* @param {string} script
|
|
136
|
+
* @returns {string}
|
|
137
|
+
*/
|
|
138
|
+
wrapPowerShellScript(script) {
|
|
139
|
+
return String(script);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export default SeWindowsCommands;
|