@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,501 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import {
|
|
4
|
+
findCallSites,
|
|
5
|
+
maskComments,
|
|
6
|
+
skipStringLiteral,
|
|
7
|
+
canStartRegex,
|
|
8
|
+
skipRegexLiteral,
|
|
9
|
+
} from './dispatch-safety-guard.mjs';
|
|
10
|
+
import { explicitIdCreateModulePaths, EXPLICIT_ID_CREATE_EXEMPT } from './guarded-modules.mjs';
|
|
11
|
+
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// apra-fleet-btj9.7 -- explicit-id-create guard checker.
|
|
14
|
+
//
|
|
15
|
+
// Invariant under test: no scanned module may dispatch a bead-CREATION
|
|
16
|
+
// command (`bd create`, of ANY shape) unless it lives in beads-children.mjs
|
|
17
|
+
// -- the single module that pairs an explicit-id create with the
|
|
18
|
+
// probe-and-refuse seam (assertChildIdFree(), called from
|
|
19
|
+
// createChildBeadWithAllocatedId) that guards against `bd create`'s silent
|
|
20
|
+
// overwrite-on-collision behavior (apra-fleet-btj9). A second, unguarded
|
|
21
|
+
// bead-creation site anywhere else in this directory is exactly how that
|
|
22
|
+
// overwrite bug returns, so this is a mechanical scan -- same shape as the
|
|
23
|
+
// sibling guards -- rather than a call-graph proof that assertChildIdFree()
|
|
24
|
+
// actually ran first.
|
|
25
|
+
//
|
|
26
|
+
// -----------------------------------------------------------------------
|
|
27
|
+
// THE RULE, AND THE TWO WIDENINGS THAT PRODUCED IT
|
|
28
|
+
// -----------------------------------------------------------------------
|
|
29
|
+
//
|
|
30
|
+
// WIDENING 1 -- PAST "carries a literal --id flag" (review round on
|
|
31
|
+
// apra-fleet-btj9.7): the first cut of this guard matched `bd create` only
|
|
32
|
+
// when an explicit `--id` flag literal appeared LATER in the same balanced
|
|
33
|
+
// call text. That misses the one real call site's own shape --
|
|
34
|
+
// beads-children.mjs's `bd create "${title}" --body-file
|
|
35
|
+
// "${descriptionFile}" -p "${priority}" ${parentageFlags} --silent`, where
|
|
36
|
+
// the id flag is assembled into `parentageFlags` (`--id ${grant.childId}`)
|
|
37
|
+
// and never appears as literal text inside the command() call itself. A
|
|
38
|
+
// second, unguarded module that copied exactly that shape would scan clean
|
|
39
|
+
// under the literal-`--id` regex. Rather than chase every way an id flag can
|
|
40
|
+
// be assembled through a variable (an open-ended, unwinnable text-matching
|
|
41
|
+
// problem), the rule flags a bead-creation command regardless of whether an
|
|
42
|
+
// id flag is literal, interpolated, or absent entirely.
|
|
43
|
+
//
|
|
44
|
+
// WIDENING 2 -- PAST "inside a call spelled literally command(" (this bead,
|
|
45
|
+
// apra-fleet-btj9.4): the call-site rule below reuses findCallSites(), whose
|
|
46
|
+
// regex recognizes only the identifiers `command(` / `agent(` when not
|
|
47
|
+
// preceded by a dot or word character. So the effective rule WAS: a bead
|
|
48
|
+
// creation is only seen when it is dispatched from a call spelled literally
|
|
49
|
+
// `command(`. A module that routed the same command through ANY other
|
|
50
|
+
// wrapper -- a local `runBd` helper, a destructured or renamed binding, or a
|
|
51
|
+
// method call such as `ctx.command(...)` which the lookbehind deliberately
|
|
52
|
+
// excludes -- reintroduced an unguarded bead-creation site that this guard
|
|
53
|
+
// reported clean. Measured directly against the real checker before the fix:
|
|
54
|
+
// a fixture dispatching `bd create "${title}" --id ${id} --silent` through
|
|
55
|
+
// both a `runBd(...)` wrapper and a `ctx.command(...)` method call produced
|
|
56
|
+
// ZERO violations.
|
|
57
|
+
//
|
|
58
|
+
// HOW WIDENING 2 IS DONE, AND WHY NOT THE OBVIOUS WAY. The tempting fix is
|
|
59
|
+
// "flag the `bd create` token anywhere in the module, forget the enclosing
|
|
60
|
+
// call expression". That was MEASURED and rejected: across the 58 modules in
|
|
61
|
+
// the scanned set it produces 14 false positives, every one of them prose --
|
|
62
|
+
// LLM-prompt text in prompts.mjs / regression-test.mjs / newtask-text.mjs
|
|
63
|
+
// that instructs an agent about `bd create`, and log/reason strings in
|
|
64
|
+
// abort.mjs / review.mjs / re-review.mjs / final-review.mjs /
|
|
65
|
+
// sprint-report.mjs that merely NAME the command. A guard that needs a
|
|
66
|
+
// hand-maintained prose-exemption list of that size rots faster than the
|
|
67
|
+
// hole it closes.
|
|
68
|
+
//
|
|
69
|
+
// The discriminator this guard uses instead needs no exemption list: a
|
|
70
|
+
// DISPATCH is a command literal -- a string/template literal whose content
|
|
71
|
+
// BEGINS with `bd create` and continues into an ARGUMENT (a quoted value, a
|
|
72
|
+
// `${...}` interpolation, a `-` flag, or nothing left in the literal, i.e.
|
|
73
|
+
// the string-concatenation shape). Prose that merely mentions the command
|
|
74
|
+
// either does not begin with it ("...not sent to bd create") or continues
|
|
75
|
+
// into English words ("bd create failed (${stage})"). That rule is
|
|
76
|
+
// deliberately blind to the enclosing call expression, so it covers a
|
|
77
|
+
// wrapper, a renamed binding, a method call, and a call assembled at runtime
|
|
78
|
+
// alike -- which is why this guard does NOT instead try to pin the set of
|
|
79
|
+
// recognized dispatch-primitive identifiers: there is nothing left to
|
|
80
|
+
// enumerate. Measured: 0 hits across the whole scanned set, and it does
|
|
81
|
+
// catch beads-children.mjs's own real create when that file is offered
|
|
82
|
+
// directly (see the exemption note below).
|
|
83
|
+
//
|
|
84
|
+
// THE TWO RULES ARE A UNION, NOT A REPLACEMENT. The call-site rule is kept
|
|
85
|
+
// so that widening 2 strictly ADDS coverage: a command() call text whose
|
|
86
|
+
// `bd create` is NOT at the start of a literal -- for example
|
|
87
|
+
// `command(`cd ${dir} && bd create ...`)` -- was already flagged and still
|
|
88
|
+
// is. Violations are deduplicated across the two rules: a reported
|
|
89
|
+
// `command(...)` site claims its whole multi-line span, so the command
|
|
90
|
+
// literal nested inside it (which that violation already quotes in full) is
|
|
91
|
+
// not reported a second time.
|
|
92
|
+
//
|
|
93
|
+
// RESIDUAL LIMITS (known, accepted, measured -- not silent):
|
|
94
|
+
// - A `bd create` that is neither inside a `command(`/`agent(` call nor at
|
|
95
|
+
// the start of its own literal is not seen. Concretely: a non-command
|
|
96
|
+
// wrapper handed `cd ${dir} && bd create ...`. Closing that would
|
|
97
|
+
// require the prose-exemption list rejected above.
|
|
98
|
+
// - A creation assembled from fragments that never spell `bd` and
|
|
99
|
+
// `create` adjacently in any one literal (`bd ${verb}`) is not seen.
|
|
100
|
+
// This is the same unwinnable text-matching frontier widening 1 already
|
|
101
|
+
// declined to chase.
|
|
102
|
+
// - This is a source-text scan over the registered module list, not a
|
|
103
|
+
// call-graph proof; a create reached through a module that is not
|
|
104
|
+
// registered in guarded-modules.mjs is out of scope by construction
|
|
105
|
+
// (that list is what guarded-modules-coverage.test.mjs pins).
|
|
106
|
+
// - The command-literal rule lexes JavaScript with a hand-written scanner
|
|
107
|
+
// (scanModuleLiterals() below), so its grammar coverage has a frontier:
|
|
108
|
+
// comments, regex literals (including character classes), strings, and
|
|
109
|
+
// templates with nested `${...}` interpolations are modeled; anything
|
|
110
|
+
// else that can open a literal is not. That frontier is deliberately NOT
|
|
111
|
+
// silent -- see the DESYNC BACKSTOP note on scanModuleLiterals(): a
|
|
112
|
+
// construct that provably desyncs the walk is reported as a loud
|
|
113
|
+
// `parse-desync` violation naming the file and line, so a module this
|
|
114
|
+
// guard cannot read fails it instead of passing it. Measured on the tree
|
|
115
|
+
// as it stands: zero desyncs across the 58 scanned modules.
|
|
116
|
+
// - NOT a limit, contrary to an earlier note on this bead: `bd` and
|
|
117
|
+
// `create` split across a newline inside a template literal ARE matched,
|
|
118
|
+
// because both rules join them with `\s+`, which matches a newline. This
|
|
119
|
+
// was re-probed directly against the checker.
|
|
120
|
+
//
|
|
121
|
+
// CALL-SITE EXTRACTION REUSES dispatch-safety-guard.mjs's findCallSites()
|
|
122
|
+
// (that file's own header names it "the reference implementation the sibling
|
|
123
|
+
// guards follow"), rather than a naive per-line quote-stopping scan: a real
|
|
124
|
+
// `bd create "<title>" --body-file "<path>" --id <id> --silent` command
|
|
125
|
+
// literal has an inner quoted title BETWEEN "bd create" and the id flag, so a
|
|
126
|
+
// scan that stops at the first quote after "bd create" (the technique
|
|
127
|
+
// dolt-literal-guard.mjs/full-db-fetch-guard.mjs use, safe for THEIR simpler
|
|
128
|
+
// command shapes) would silently miss it. findCallSites() already extracts
|
|
129
|
+
// the FULL balanced call text -- including embedded quotes -- for every
|
|
130
|
+
// `command(`/`agent(` site, and already skips full-line comments and
|
|
131
|
+
// same-line-string false positives, so this guard reuses it rather than
|
|
132
|
+
// re-deriving that logic.
|
|
133
|
+
//
|
|
134
|
+
// THE COMMAND-LITERAL RULE, BY CONTRAST, LEXES THE RAW SOURCE ITSELF
|
|
135
|
+
// (scanModuleLiterals() below) instead of walking a maskComments() copy. Its
|
|
136
|
+
// first cut did reuse maskComments()/skipStringLiteral(), on the same "do not
|
|
137
|
+
// re-derive it" reasoning -- and was measured SILENTLY BLIND over 867 lines
|
|
138
|
+
// of the real scanned set, because three ordinary constructs open a phantom
|
|
139
|
+
// string in a naive quote-walk: a regex body holding an apostrophe, a regex
|
|
140
|
+
// character class holding a quote, and a nested template inside a `${...}`
|
|
141
|
+
// interpolation (that last one desyncs maskComments() ITSELF, so it cannot
|
|
142
|
+
// be repaired downstream of it). The full account, naming the real modules
|
|
143
|
+
// that trigger each, is on scanModuleLiterals(). Comment spans are still
|
|
144
|
+
// never entered, so the many prose mentions of `bd create` in this
|
|
145
|
+
// directory's comments (including this header) are still never read as
|
|
146
|
+
// dispatches.
|
|
147
|
+
//
|
|
148
|
+
// EXEMPTION: beads-children.mjs itself (EXPLICIT_ID_CREATE_EXEMPT), the
|
|
149
|
+
// single permitted surface -- scanning it would flag the module for being
|
|
150
|
+
// the module, same precedent as DOLT_LITERAL_EXEMPT/dolt-sync.mjs and
|
|
151
|
+
// UNBRACKETED_PUSH_EXEMPT/git-sync.mjs. (`agent(` call sites are still
|
|
152
|
+
// ignored by the call-site rule: agent() never dispatches a bd command. The
|
|
153
|
+
// command-literal rule has no such carve-out and does not need one.)
|
|
154
|
+
//
|
|
155
|
+
// MODULE-LIST GENERALIZATION: this guard is not pointed at a single
|
|
156
|
+
// hard-coded file. checkExplicitIdCreateModules() below reads the SHARED
|
|
157
|
+
// guarded-module list (./guarded-modules.mjs), filtered through
|
|
158
|
+
// EXPLICIT_ID_CREATE_EXEMPT, and defines no list of its own.
|
|
159
|
+
// checkExplicitIdCreatePath() remains exported and behaves exactly as
|
|
160
|
+
// before for a single file (a fixture, or beads-children.mjs itself when a
|
|
161
|
+
// caller deliberately wants its own violations, none expected).
|
|
162
|
+
// =============================================================================
|
|
163
|
+
|
|
164
|
+
// Matches a bead-creation subcommand ANYWHERE in the balanced call text --
|
|
165
|
+
// deliberately not conditioned on an explicit id flag appearing later (see
|
|
166
|
+
// "WIDENING 1" above): the one real call site assembles its id flag into an
|
|
167
|
+
// interpolated variable that never appears as literal `--id` text inside the
|
|
168
|
+
// command() call, so requiring a literal id flag would miss the exact shape a
|
|
169
|
+
// copy-paste of that site produces. Written as `bd` + `\s+` + `create`
|
|
170
|
+
// (never a literal space between the two tokens) so this guard's own
|
|
171
|
+
// definition line can never match itself.
|
|
172
|
+
const EXPLICIT_ID_CREATE_RE = /bd\s+create\b/;
|
|
173
|
+
|
|
174
|
+
// Matches a string/template literal's CONTENT when that content begins with
|
|
175
|
+
// the bead-creation command itself and continues into an argument (see
|
|
176
|
+
// "HOW WIDENING 2 IS DONE" above). The argument-start character class is
|
|
177
|
+
// written with hex escapes -- \x22 " , \x27 ' , \x60 ` -- rather than the
|
|
178
|
+
// characters themselves. That is belt-and-braces rather than load-bearing
|
|
179
|
+
// now: both this guard's own lexer and maskComments() model regex literals,
|
|
180
|
+
// so a bare quote inside this regex would no longer corrupt the scan of this
|
|
181
|
+
// very file (which IS in the guarded set). The escapes are kept because they
|
|
182
|
+
// cost nothing and keep the line safe for any SIMPLER scanner that does not
|
|
183
|
+
// model regex literals.
|
|
184
|
+
const CREATE_DISPATCH_LITERAL_RE = /^\s*bd\s+create\s+(\x22|\x27|\x60|\$|-|$)/;
|
|
185
|
+
|
|
186
|
+
// A raw (unescaped) newline inside a `'`/`"` literal. Such a literal is
|
|
187
|
+
// INVALID JavaScript -- only a template literal may span lines -- so seeing
|
|
188
|
+
// one means the scan's own notion of "where string literals begin and end"
|
|
189
|
+
// has desynced from the real source, and every line it swallowed is invisible
|
|
190
|
+
// to the command-literal rule below. Matched as: a newline preceded by an
|
|
191
|
+
// EVEN number of backslashes (zero counts), so a legitimate line
|
|
192
|
+
// continuation (`\` immediately before the newline) is not mistaken for one.
|
|
193
|
+
const RAW_NEWLINE_IN_QUOTED_LITERAL_RE = /(?:^|[^\\])(?:\\\\)*\n/;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Walks `src` once and returns BOTH of the things the command-literal rule
|
|
197
|
+
* needs:
|
|
198
|
+
* - `literals`: every string/template literal as { line, content }, in
|
|
199
|
+
* source order, with comment spans never entered (so prose mentions of a
|
|
200
|
+
* command inside a comment are never extracted);
|
|
201
|
+
* - `desyncs`: every position where the walk could not trust its own
|
|
202
|
+
* literal boundaries (see the DESYNC note in the module header).
|
|
203
|
+
*
|
|
204
|
+
* WHY THIS IS A LOCAL LEXER AND NOT maskComments() + skipStringLiteral()
|
|
205
|
+
* (this bead's review round). The first cut of this rule extracted literals
|
|
206
|
+
* by walking a maskComments() copy and calling skipStringLiteral() at every
|
|
207
|
+
* quote. Measured against the real scanned set, that walk was SILENTLY BLIND:
|
|
208
|
+
* 867 lines across 8 of the 58 scanned modules sat inside a phantom `'`/`"`
|
|
209
|
+
* span, and injecting a real wrapper dispatch line by line showed 1085
|
|
210
|
+
* injection points -- ordinary statements in function bodies, in abort.mjs,
|
|
211
|
+
* member-sync.mjs, branch-ensure.mjs, newtask-text.mjs, contracts.mjs and
|
|
212
|
+
* five more -- that this rule reported CLEAN and now reports. (The same
|
|
213
|
+
* desync also had a false-POSITIVE direction, prose inside a phantom span
|
|
214
|
+
* being read as a dispatch; that half was already closed upstream when
|
|
215
|
+
* maskComments() learned about regex literals, and is pinned by
|
|
216
|
+
* dispatch-safety-guard.test.mjs.) Three distinct constructs open a
|
|
217
|
+
* "phantom string" that swallows source up to the next matching quote:
|
|
218
|
+
* 1. a REGEX whose body holds a quote -- branch-ensure.mjs's
|
|
219
|
+
* `/couldn't find remote ref/i`. maskComments() copies a regex through
|
|
220
|
+
* VERBATIM (it is real code, not a comment), so the apostrophe inside
|
|
221
|
+
* it is still there for a naive quote-walk to trip over. Handled here by
|
|
222
|
+
* skipping regex spans with the SAME canStartRegex()/skipRegexLiteral()
|
|
223
|
+
* heuristic maskComments() used when it decided to copy that span.
|
|
224
|
+
* 2. a CHARACTER CLASS holding a quote -- newtask-text.mjs's
|
|
225
|
+
* SAFE_TEXT_RE -- same cause, same fix.
|
|
226
|
+
* 3. a NESTED TEMPLATE inside a `${...}` interpolation --
|
|
227
|
+
* vcs-providers/shell-helpers.mjs's
|
|
228
|
+
* shQuote (a `.replace()` whose arguments are themselves backtick
|
|
229
|
+
* literals). skipStringLiteral() has no notion of interpolation, so it
|
|
230
|
+
* ends the OUTER template at the INNER template's opening backtick and
|
|
231
|
+
* every boundary after that is off by one literal. This one desyncs
|
|
232
|
+
* maskComments() itself, so no amount of care in a walk built on its
|
|
233
|
+
* output can recover -- which is why the walk below lexes the raw source
|
|
234
|
+
* directly instead.
|
|
235
|
+
* The call-site rule is unaffected by all three: it reads
|
|
236
|
+
* extractBalancedCall(), which skips regex spans and only needs paren depth.
|
|
237
|
+
*
|
|
238
|
+
* DESYNC BACKSTOP. Lexing JavaScript with a hand-written scanner will always
|
|
239
|
+
* have a frontier. So rather than trusting this one to be complete, it
|
|
240
|
+
* reports the two constructs that PROVE it has lost the thread -- a
|
|
241
|
+
* `'`/`"` literal carrying a raw newline, and an unterminated template --
|
|
242
|
+
* as `desyncs`, which findExplicitIdCreateViolations() turns into a loud
|
|
243
|
+
* violation. A guard that cannot parse a module must say so, not report it
|
|
244
|
+
* clean.
|
|
245
|
+
*/
|
|
246
|
+
export function scanModuleLiterals(src) {
|
|
247
|
+
const lineStarts = [0];
|
|
248
|
+
for (let i = 0; i < src.length; i++) {
|
|
249
|
+
if (src[i] === '\n') lineStarts.push(i + 1);
|
|
250
|
+
}
|
|
251
|
+
const lineNumberForIndex = (idx) => {
|
|
252
|
+
let lo = 0;
|
|
253
|
+
let hi = lineStarts.length - 1;
|
|
254
|
+
while (lo < hi) {
|
|
255
|
+
const mid = (lo + hi + 1) >> 1;
|
|
256
|
+
if (lineStarts[mid] <= idx) lo = mid;
|
|
257
|
+
else hi = mid - 1;
|
|
258
|
+
}
|
|
259
|
+
return lo + 1; // 1-based
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const ctx = {
|
|
263
|
+
literals: [],
|
|
264
|
+
desyncs: [],
|
|
265
|
+
// Code seen so far with comments blanked, ONLY so canStartRegex()'s
|
|
266
|
+
// preceding-token heuristic sees the same thing it would have seen
|
|
267
|
+
// inside maskComments(). Never scanned for content.
|
|
268
|
+
code: '',
|
|
269
|
+
lineNumberForIndex,
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
scanCodeSpan(src, 0, null, ctx);
|
|
273
|
+
return { literals: ctx.literals, desyncs: ctx.desyncs };
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Scans a CODE region of `src` starting at `start`, recording every string /
|
|
278
|
+
* template literal it contains (including inside nested `${...}`
|
|
279
|
+
* interpolations) into `ctx`. When `stopAt` is `'}'` the scan is inside a
|
|
280
|
+
* `${...}` interpolation and returns the index just past the `}` that closes
|
|
281
|
+
* it, counting nested braces on the way; when `stopAt` is null it runs to end
|
|
282
|
+
* of file. Returns the index it stopped at.
|
|
283
|
+
*/
|
|
284
|
+
function scanCodeSpan(src, start, stopAt, ctx) {
|
|
285
|
+
let depth = 0;
|
|
286
|
+
let i = start;
|
|
287
|
+
while (i < src.length) {
|
|
288
|
+
const ch = src[i];
|
|
289
|
+
if (ch === '/' && src[i + 1] === '/') {
|
|
290
|
+
while (i < src.length && src[i] !== '\n') { ctx.code += ' '; i++; }
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (ch === '/' && src[i + 1] === '*') {
|
|
294
|
+
const close = src.indexOf('*/', i + 2);
|
|
295
|
+
const stop = close < 0 ? src.length : close + 2;
|
|
296
|
+
for (; i < stop; i++) ctx.code += src[i] === '\n' ? '\n' : ' ';
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (ch === '/' && canStartRegex(ctx.code, ctx.code.length)) {
|
|
300
|
+
const close = skipRegexLiteral(src, i);
|
|
301
|
+
if (close !== -1) {
|
|
302
|
+
let flagEnd = close;
|
|
303
|
+
while (flagEnd + 1 < src.length && /[a-zA-Z]/.test(src[flagEnd + 1])) flagEnd++;
|
|
304
|
+
ctx.code += src.slice(i, flagEnd + 1);
|
|
305
|
+
i = flagEnd + 1;
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
// No closing `/` before end of line: not a regex after all, so
|
|
309
|
+
// fall through and treat it as an ordinary character.
|
|
310
|
+
}
|
|
311
|
+
if (ch === '"' || ch === "'") {
|
|
312
|
+
const close = skipStringLiteral(src, i, ch);
|
|
313
|
+
const content = src.slice(i + 1, close);
|
|
314
|
+
if (RAW_NEWLINE_IN_QUOTED_LITERAL_RE.test(content)) {
|
|
315
|
+
// Desync: do NOT consume the span. Consuming it is what makes
|
|
316
|
+
// the blindness silent -- report it loudly and carry on from
|
|
317
|
+
// the very next character so the rest of the module is still
|
|
318
|
+
// examined rather than swallowed.
|
|
319
|
+
ctx.desyncs.push({ line: ctx.lineNumberForIndex(i), detail: `a ${ch} string literal` });
|
|
320
|
+
ctx.code += ' ';
|
|
321
|
+
i++;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
ctx.literals.push({ line: ctx.lineNumberForIndex(i), content });
|
|
325
|
+
ctx.code += src.slice(i, close + 1);
|
|
326
|
+
i = close + 1;
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
if (ch === '`') {
|
|
330
|
+
i = scanTemplateLiteral(src, i, ctx);
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
if (stopAt === '}') {
|
|
334
|
+
if (ch === '{') depth++;
|
|
335
|
+
else if (ch === '}') {
|
|
336
|
+
if (depth === 0) { ctx.code += ch; return i + 1; }
|
|
337
|
+
depth--;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
ctx.code += ch;
|
|
341
|
+
i++;
|
|
342
|
+
}
|
|
343
|
+
return i;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Scans the template literal opening at `start`, recording it (and anything
|
|
348
|
+
* nested in its `${...}` interpolations) into `ctx`. Returns the index just
|
|
349
|
+
* past the closing backtick. The recorded `content` is the RAW text between
|
|
350
|
+
* the backticks, interpolations included, which is exactly what
|
|
351
|
+
* CREATE_DISPATCH_LITERAL_RE wants to see: a dispatch's command text with its
|
|
352
|
+
* `${...}` arguments still in place.
|
|
353
|
+
*/
|
|
354
|
+
function scanTemplateLiteral(src, start, ctx) {
|
|
355
|
+
for (let i = start + 1; i < src.length; i++) {
|
|
356
|
+
const ch = src[i];
|
|
357
|
+
if (ch === '\\') { i++; continue; }
|
|
358
|
+
if (ch === '`') {
|
|
359
|
+
ctx.literals.push({ line: ctx.lineNumberForIndex(start), content: src.slice(start + 1, i) });
|
|
360
|
+
// Only a marker: ctx.code exists solely so canStartRegex() can see
|
|
361
|
+
// what token precedes a `/`, and "a literal just ended" is all it
|
|
362
|
+
// needs to know here.
|
|
363
|
+
ctx.code += '`';
|
|
364
|
+
return i + 1;
|
|
365
|
+
}
|
|
366
|
+
if (ch === '$' && src[i + 1] === '{') {
|
|
367
|
+
// Recurse through the interpolation so a literal nested inside it
|
|
368
|
+
// is seen, and so the OUTER template ends at the right backtick.
|
|
369
|
+
// The parens bracket the interpolation in ctx.code so that a `/`
|
|
370
|
+
// as its first token reads as a regex start, exactly as it would
|
|
371
|
+
// after a real `(`.
|
|
372
|
+
ctx.code += '(';
|
|
373
|
+
i = scanCodeSpan(src, i + 2, '}', ctx) - 1;
|
|
374
|
+
ctx.code += ')';
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
// Unterminated template literal: another unambiguous desync tell, since
|
|
378
|
+
// the rest of the file has just been swallowed by it.
|
|
379
|
+
ctx.desyncs.push({ line: ctx.lineNumberForIndex(start), detail: 'a template literal' });
|
|
380
|
+
return src.length;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Convenience wrapper over scanModuleLiterals() for callers that only want
|
|
385
|
+
* the literals. Kept as a named export because it is this guard's most
|
|
386
|
+
* reusable primitive.
|
|
387
|
+
*/
|
|
388
|
+
export function findCommandLiterals(src) {
|
|
389
|
+
return scanModuleLiterals(src).literals;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Scans `src` for bead-creation dispatches, as the UNION of two rules (see
|
|
394
|
+
* the module header):
|
|
395
|
+
* 1. call-site rule -- a `command(...)` call whose full balanced call text
|
|
396
|
+
* carries `bd create` in any shape;
|
|
397
|
+
* 2. command-literal rule -- any string/template literal, ANYWHERE in the
|
|
398
|
+
* module and regardless of the enclosing call expression, whose content
|
|
399
|
+
* begins with `bd create` followed by an argument.
|
|
400
|
+
* Returns an array of { line, rule, command }, one entry per violating line,
|
|
401
|
+
* sorted by line.
|
|
402
|
+
*/
|
|
403
|
+
export function findExplicitIdCreateViolations(src) {
|
|
404
|
+
const byLine = new Map();
|
|
405
|
+
// Lines already accounted for by a reported call site, so the same
|
|
406
|
+
// dispatch is not reported twice when both rules see it. A multi-line
|
|
407
|
+
// `command(...)` call is claimed across its WHOLE span, not just its
|
|
408
|
+
// opening line: the command literal inside it sits on a later line, and
|
|
409
|
+
// the call-site violation already quotes that literal in full.
|
|
410
|
+
const claimed = new Set();
|
|
411
|
+
for (const site of findCallSites(src)) {
|
|
412
|
+
if (site.fnName !== 'command') continue;
|
|
413
|
+
if (!EXPLICIT_ID_CREATE_RE.test(site.callText)) continue;
|
|
414
|
+
const span = (site.callText.match(/\n/g) || []).length;
|
|
415
|
+
for (let ln = site.line; ln <= site.line + span; ln++) claimed.add(ln);
|
|
416
|
+
if (byLine.has(site.line)) continue;
|
|
417
|
+
byLine.set(site.line, {
|
|
418
|
+
line: site.line,
|
|
419
|
+
rule: 'command-call-site',
|
|
420
|
+
command: site.callText.replace(/\s+/g, ' ').trim(),
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
const { literals, desyncs } = scanModuleLiterals(src);
|
|
424
|
+
for (const literal of literals) {
|
|
425
|
+
if (!CREATE_DISPATCH_LITERAL_RE.test(literal.content)) continue;
|
|
426
|
+
if (claimed.has(literal.line) || byLine.has(literal.line)) continue;
|
|
427
|
+
byLine.set(literal.line, {
|
|
428
|
+
line: literal.line,
|
|
429
|
+
rule: 'command-literal',
|
|
430
|
+
command: literal.content.replace(/\s+/g, ' ').trim(),
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
// Reported LAST and never deduplicated away: a desync is not a dispatch,
|
|
434
|
+
// it is this scan admitting it could not read the module. Silently
|
|
435
|
+
// returning "clean" for such a module is the exact failure mode this
|
|
436
|
+
// guard exists to prevent.
|
|
437
|
+
for (const desync of desyncs) {
|
|
438
|
+
if (byLine.has(desync.line)) continue;
|
|
439
|
+
byLine.set(desync.line, {
|
|
440
|
+
line: desync.line,
|
|
441
|
+
rule: 'parse-desync',
|
|
442
|
+
command: desync.detail,
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
return [...byLine.values()].sort((a, b) => a.line - b.line);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Reads and scans the source file at `filePath`, returning { violations },
|
|
450
|
+
* each entry a human-readable message naming the offending file:line and
|
|
451
|
+
* pointing at the single permitted surface.
|
|
452
|
+
*/
|
|
453
|
+
export function checkExplicitIdCreatePath(filePath) {
|
|
454
|
+
const src = fs.readFileSync(filePath, 'utf8');
|
|
455
|
+
const fileLabel = path.basename(filePath);
|
|
456
|
+
const violations = findExplicitIdCreateViolations(src).map(({ line, rule, command }) =>
|
|
457
|
+
rule === 'parse-desync'
|
|
458
|
+
? `${fileLabel}:${line} could not be scanned reliably: ${command} opens here and is never closed ` +
|
|
459
|
+
'where the JavaScript grammar requires, which means this scan\'s literal boundaries have desynced ' +
|
|
460
|
+
'from the real source and an unguarded bead-creation command could be hiding in the span it would ' +
|
|
461
|
+
'otherwise have swallowed. This guard refuses to report a module it cannot parse as clean -- fix the ' +
|
|
462
|
+
'construct that confuses the scan (see this module\'s DESYNC note), do not suppress this message.'
|
|
463
|
+
: `${fileLabel}:${line} issues a bead-creation command ("${command}", matched by the ${rule} rule) ` +
|
|
464
|
+
'outside the single guarded probe-and-refuse seam -- route it through beads-children.mjs\'s ' +
|
|
465
|
+
'assertChildIdFree() / createChildBeadWithAllocatedId, the only permitted bead-creation surface. ' +
|
|
466
|
+
'Flagged regardless of whether an id flag is literal, interpolated, or absent, and regardless of ' +
|
|
467
|
+
'the wrapper it is dispatched through (see this module\'s header).'
|
|
468
|
+
);
|
|
469
|
+
return { violations };
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Aggregate entry point: scans every module in the SHARED guarded-module list
|
|
474
|
+
* (./guarded-modules.mjs), MINUS EXPLICIT_ID_CREATE_EXEMPT, and returns the
|
|
475
|
+
* union of their violations. Follows checkDoltLiteralModules()/
|
|
476
|
+
* checkUnbracketedPushModules() -- the reference implementations for a
|
|
477
|
+
* single-permitted-surface exemption -- so a create call that moves out of
|
|
478
|
+
* beads-children.mjs into a newly extracted module stays covered instead of
|
|
479
|
+
* silently falling out of scan scope.
|
|
480
|
+
*
|
|
481
|
+
* @param {string[]} [paths]
|
|
482
|
+
* @returns {{ violations: string[], files: string[], skipped: string[] }}
|
|
483
|
+
*/
|
|
484
|
+
export function checkExplicitIdCreateModules(paths = explicitIdCreateModulePaths()) {
|
|
485
|
+
if (!Array.isArray(paths)) {
|
|
486
|
+
throw new TypeError('checkExplicitIdCreateModules(paths): paths must be an array of file paths');
|
|
487
|
+
}
|
|
488
|
+
const violations = [];
|
|
489
|
+
const files = [];
|
|
490
|
+
const skipped = [];
|
|
491
|
+
for (const p of paths) {
|
|
492
|
+
const file = path.basename(p);
|
|
493
|
+
if (EXPLICIT_ID_CREATE_EXEMPT.includes(file)) {
|
|
494
|
+
skipped.push(file);
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
files.push(file);
|
|
498
|
+
violations.push(...checkExplicitIdCreatePath(p).violations);
|
|
499
|
+
}
|
|
500
|
+
return { violations, files, skipped };
|
|
501
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Fatal-diagnostics guard and the terminal-state Dolt-conflict classification
|
|
2
|
+
// helpers, extracted out of runner.js (apra-fleet-3swo.6.16); runner.js
|
|
3
|
+
// re-exports every symbol it previously exported from this region, so
|
|
4
|
+
// existing importers of fleet-sprint/runner.js resolve unchanged.
|
|
5
|
+
import { DoltDivergedError } from './errors.mjs';
|
|
6
|
+
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Fatal-diagnostics guard
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
//
|
|
11
|
+
// main()'s try/catch around runSprintCycle() only ever sees errors that
|
|
12
|
+
// propagate up an AWAITED call chain: it can never see a promise that rejects
|
|
13
|
+
// with nothing awaiting it, or a synchronous throw that escapes every awaited
|
|
14
|
+
// frame. Without this guard such a failure ends the run with no usable signal.
|
|
15
|
+
// The guard makes it observable: an explicit [FATAL] line (cause + the last
|
|
16
|
+
// phase this run entered) through the run's own log(), plus a best-effort
|
|
17
|
+
// publishState('terminal', ...) so a watchdog, dashboard, or human sees a real
|
|
18
|
+
// lastError instead of state frozen mid-run with no explanation.
|
|
19
|
+
//
|
|
20
|
+
// It deliberately does not attempt to recover or continue -- by the time either
|
|
21
|
+
// process-level event fires the process's control flow is in an unspecified
|
|
22
|
+
// state.
|
|
23
|
+
/**
|
|
24
|
+
* @param {{ log?: (msg: string) => void, publishState?: (namespace: string, data: any) => void, phaseOf?: () => string|null }} deps
|
|
25
|
+
* @returns {() => void} uninstall() -- removes both listeners.
|
|
26
|
+
*/
|
|
27
|
+
export function installFatalDiagnosticsGuard(deps = {}) {
|
|
28
|
+
const log = typeof deps.log === 'function' ? deps.log : () => {};
|
|
29
|
+
const publishState = typeof deps.publishState === 'function' ? deps.publishState : null;
|
|
30
|
+
const phaseOf = typeof deps.phaseOf === 'function' ? deps.phaseOf : () => null;
|
|
31
|
+
|
|
32
|
+
const handle = (kind) => (err) => {
|
|
33
|
+
const message = (err && err.message) || String(err);
|
|
34
|
+
const stack = (err && err.stack) || null;
|
|
35
|
+
const phase = phaseOf();
|
|
36
|
+
log(`[FATAL] ${kind} (last known phase: ${phase ?? 'unknown'}): ${message}${stack ? `\n${stack}` : ''}`);
|
|
37
|
+
if (publishState) {
|
|
38
|
+
try {
|
|
39
|
+
publishState('terminal', {
|
|
40
|
+
verdict: 'ABORTED',
|
|
41
|
+
failed: true,
|
|
42
|
+
terminalReason: kind,
|
|
43
|
+
lastError: { message, stack, phase, kind, at: new Date().toISOString() },
|
|
44
|
+
});
|
|
45
|
+
} catch (publishErr) {
|
|
46
|
+
// Diagnostics reporting itself must never crash harder than the
|
|
47
|
+
// failure it is trying to record -- log and move on.
|
|
48
|
+
log(`[FATAL] ${kind}: failed to persist terminal error state: ${(publishErr && publishErr.message) || publishErr}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const onUnhandledRejection = handle('unhandledRejection');
|
|
54
|
+
const onUncaughtException = handle('uncaughtException');
|
|
55
|
+
process.on('unhandledRejection', onUnhandledRejection);
|
|
56
|
+
process.on('uncaughtException', onUncaughtException);
|
|
57
|
+
|
|
58
|
+
return function uninstall() {
|
|
59
|
+
process.off('unhandledRejection', onUnhandledRejection);
|
|
60
|
+
process.off('uncaughtException', onUncaughtException);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
// Classify an unmergeable Dolt conflict as its own terminal state
|
|
66
|
+
// (BEADS_SYNC_CONFLICT), not the generic wrapper/UNKNOWN bucket -- and
|
|
67
|
+
// best-effort carry forward the raw conflict diagnostics an operator would
|
|
68
|
+
// otherwise have to re-derive by hand.
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Walks a thrown error's `.cause` chain (bounded, so a pathological circular
|
|
73
|
+
* cause can never loop forever) looking for a DoltDivergedError -- either
|
|
74
|
+
* the error itself, or wrapped one level down inside a PostDispatchSyncError
|
|
75
|
+
* (withGitSync's post-dispatch D-push bracket wraps a diverged sync failure
|
|
76
|
+
* this way; see PostDispatchSyncError's own doc comment in errors.mjs). A
|
|
77
|
+
* plain `bd dolt pull` divergence (preflightBeadsHealthGate / doltPullBefore,
|
|
78
|
+
* before any dispatch ever ran) throws DoltDivergedError directly, with no
|
|
79
|
+
* wrapper -- also matched here.
|
|
80
|
+
* @param {unknown} err
|
|
81
|
+
* @returns {import('./errors.mjs').DoltDivergedError|null}
|
|
82
|
+
*/
|
|
83
|
+
export function findDoltDivergedCause(err) {
|
|
84
|
+
let cur = err;
|
|
85
|
+
for (let depth = 0; cur && depth < 5; depth += 1) {
|
|
86
|
+
if (cur instanceof DoltDivergedError) return cur;
|
|
87
|
+
cur = cur.cause;
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The terminal-state `terminalReason` main()'s typed-abort catch persists. A
|
|
94
|
+
* genuinely unmergeable Dolt conflict -- surfaced either directly (a
|
|
95
|
+
* pre-dispatch `bd dolt pull` divergence) or wrapped inside a
|
|
96
|
+
* PostDispatchSyncError (a D-push divergence discovered AFTER a dispatch
|
|
97
|
+
* already completed) -- is reported as the distinct 'BEADS_SYNC_CONFLICT', so
|
|
98
|
+
* the supervisor/dashboard shows "beads sync conflict, needs operator
|
|
99
|
+
* resolution" instead of collapsing it into the same generic bucket as every
|
|
100
|
+
* other termination reason. Every other error keeps the
|
|
101
|
+
* `err.code || err.name || 'UNKNOWN_ABORT'` behavior.
|
|
102
|
+
* @param {unknown} err
|
|
103
|
+
* @returns {string}
|
|
104
|
+
*/
|
|
105
|
+
export function resolveTerminalReason(err) {
|
|
106
|
+
if (findDoltDivergedCause(err)) return 'BEADS_SYNC_CONFLICT';
|
|
107
|
+
return (err && (err.code || err.name)) || 'UNKNOWN_ABORT';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Best-effort diagnostics for a BEADS_SYNC_CONFLICT terminal state -- the raw
|
|
112
|
+
* `bd dolt pull`/`bd dolt push` stderr
|
|
113
|
+
* (DoltDivergedError.doltOutput) that proved the divergence, captured at the
|
|
114
|
+
* moment `runDoltStep()` observed the failure (i.e. BEFORE any later `bd`
|
|
115
|
+
* invocation's own safe-abort/cleanup could discard whatever state it was
|
|
116
|
+
* describing) and carried on the error object ever since. This is pure
|
|
117
|
+
* plumbing of already-captured data through to the terminal state -- no new
|
|
118
|
+
* `bd`/SQL command is issued here -- so a human resolving the conflict later
|
|
119
|
+
* starts with the actual rejection text in hand instead of having to
|
|
120
|
+
* reproduce it by re-running `bd dolt pull`/`dolt merge --no-commit`
|
|
121
|
+
* themselves. Returns `null` (never throws) when `err` carries no
|
|
122
|
+
* DoltDivergedError cause.
|
|
123
|
+
* @param {unknown} err
|
|
124
|
+
* @returns {{ member: string|null, operation: string|null, doltOutput: string|null }|null}
|
|
125
|
+
*/
|
|
126
|
+
export function captureDoltConflictDump(err) {
|
|
127
|
+
const diverged = findDoltDivergedCause(err);
|
|
128
|
+
if (!diverged) return null;
|
|
129
|
+
return {
|
|
130
|
+
member: diverged.member ?? null,
|
|
131
|
+
operation: diverged.operation ?? null,
|
|
132
|
+
doltOutput: diverged.doltOutput ?? null,
|
|
133
|
+
};
|
|
134
|
+
}
|