@apralabs/apra-fleet 0.4.3 → 0.4.5
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 +114 -33
- package/dist/agents/backlog-groomer.md +80 -27
- package/dist/agents/ci-watcher.md +42 -22
- package/dist/agents/deployer.md +59 -24
- package/dist/agents/doer.md +111 -41
- package/dist/agents/harvester.md +60 -48
- package/dist/agents/integ-test-runner.md +45 -23
- package/dist/agents/kb-reconciler.md +34 -7
- package/dist/agents/plan-reviewer.md +54 -24
- package/dist/agents/planner.md +71 -43
- package/dist/agents/regression-test-runner.md +106 -78
- package/dist/agents/reviewer.md +170 -57
- package/dist/agents/schemas/backlog-groomer-output.json +1 -1
- package/dist/agents/schemas/deployer-output.json +5 -0
- package/dist/agents/schemas/doer-output.json +110 -2
- package/dist/agents/schemas/harvester-input.json +1 -5
- package/dist/agents/schemas/planner-output.json +1 -1
- package/dist/agents/schemas/regression-test-runner-output.json +41 -7
- package/dist/agents/schemas/reviewer-output.json +166 -5
- package/dist/cli/agent-transform.d.ts +7 -0
- package/dist/cli/agent-transform.js +46 -1
- package/dist/cli/auth.d.ts +1 -0
- package/dist/cli/auth.js +42 -8
- package/dist/cli/beads-install.d.ts +35 -0
- package/dist/cli/beads-install.js +125 -0
- package/dist/cli/beads-pin.d.ts +5 -0
- package/dist/cli/beads-pin.js +26 -0
- package/dist/cli/call.d.ts +27 -0
- package/dist/cli/call.js +177 -0
- package/dist/cli/claude-mod.d.ts +75 -0
- package/dist/cli/claude-mod.js +288 -0
- package/dist/cli/config.d.ts +24 -1
- package/dist/cli/config.js +69 -2
- package/dist/cli/dolt-install.d.ts +19 -3
- package/dist/cli/dolt-install.js +51 -16
- package/dist/cli/fleet-se-guard.d.ts +59 -0
- package/dist/cli/fleet-se-guard.js +231 -0
- package/dist/cli/install-guard.d.ts +63 -0
- package/dist/cli/install-guard.js +156 -4
- package/dist/cli/install.d.ts +89 -21
- package/dist/cli/install.js +778 -160
- package/dist/cli/kb-commit.d.ts +2 -1
- package/dist/cli/kb-commit.js +1 -1
- package/dist/cli/kb-import.d.ts +2 -1
- package/dist/cli/kb-import.js +1 -1
- package/dist/cli/kb-profile.d.ts +16 -0
- package/dist/cli/kb-profile.js +81 -0
- package/dist/cli/register-member.js +20 -3
- package/dist/cli/remove-member.d.ts +4 -0
- package/dist/cli/remove-member.js +63 -0
- package/dist/cli/secret.js +9 -0
- package/dist/cli/start.js +62 -4
- package/dist/cli/status.d.ts +3 -0
- package/dist/cli/status.js +45 -12
- package/dist/cli/stop.js +64 -9
- package/dist/cli/uninstall.js +112 -16
- package/dist/cli/update.d.ts +4 -0
- package/dist/cli/update.js +52 -5
- package/dist/cli/watch.js +1 -1
- package/dist/cli/workflow.js +3 -2
- package/dist/commands/kb-server.d.ts +10 -1
- package/dist/commands/kb-server.js +292 -11
- package/dist/hub-service/http-server.d.ts +5 -1
- package/dist/hub-service/http-server.js +55 -5
- package/dist/index.js +177 -9
- package/dist/os/child-env-bound.d.ts +77 -0
- package/dist/os/child-env-bound.js +171 -0
- package/dist/os/git-executable.d.ts +57 -0
- package/dist/os/git-executable.js +85 -0
- package/dist/os/go-concurrency.d.ts +44 -0
- package/dist/os/go-concurrency.js +53 -0
- package/dist/os/index.d.ts +1 -0
- package/dist/os/index.js +1 -0
- package/dist/os/linux.d.ts +9 -2
- package/dist/os/linux.js +50 -15
- package/dist/os/macos.d.ts +1 -1
- package/dist/os/macos.js +2 -11
- package/dist/os/os-commands.d.ts +42 -2
- package/dist/os/os-commands.js +2 -0
- package/dist/os/windows-executable.d.ts +53 -0
- package/dist/os/windows-executable.js +185 -0
- package/dist/os/windows-gitbash.d.ts +24 -14
- package/dist/os/windows-gitbash.js +56 -18
- package/dist/os/windows-wrapper.d.ts +0 -4
- package/dist/os/windows-wrapper.js +2 -1
- package/dist/os/windows.d.ts +7 -2
- package/dist/os/windows.js +109 -32
- package/dist/paths.d.ts +30 -0
- package/dist/paths.js +52 -0
- package/dist/providers/agy.d.ts +6 -2
- package/dist/providers/agy.js +245 -106
- package/dist/providers/claude-permission-denial.d.ts +7 -0
- package/dist/providers/claude-permission-denial.js +137 -0
- package/dist/providers/claude.d.ts +86 -38
- package/dist/providers/claude.js +426 -164
- package/dist/providers/codex.js +5 -1
- package/dist/providers/copilot.js +5 -1
- package/dist/providers/opencode.d.ts +10 -2
- package/dist/providers/opencode.js +114 -53
- package/dist/providers/provider.d.ts +171 -33
- package/dist/providers/provider.js +164 -3
- package/dist/services/agent-provisioner.d.ts +29 -0
- package/dist/services/agent-provisioner.js +107 -0
- package/dist/services/agent-shadow.d.ts +96 -0
- package/dist/services/agent-shadow.js +479 -0
- package/dist/services/agy-project.d.ts +9 -2
- package/dist/services/agy-project.js +22 -19
- package/dist/services/auth-socket.d.ts +43 -0
- package/dist/services/auth-socket.js +97 -26
- package/dist/services/auth-web.js +1 -1
- package/dist/services/budget-awareness.d.ts +11 -11
- package/dist/services/budget-awareness.js +15 -3
- package/dist/services/claude-local-scope-mcp.d.ts +19 -0
- package/dist/services/claude-local-scope-mcp.js +91 -0
- package/dist/services/cloud/aws.js +2 -1
- package/dist/services/cloud/lifecycle.js +19 -2
- package/dist/services/cloud/task-wrapper.d.ts +0 -9
- package/dist/services/cloud/task-wrapper.js +15 -6
- package/dist/services/credential-store.d.ts +33 -0
- package/dist/services/credential-store.js +79 -2
- package/dist/services/event-loop-watchdog.d.ts +32 -0
- package/dist/services/event-loop-watchdog.js +140 -0
- package/dist/services/http-transport.d.ts +78 -1
- package/dist/services/http-transport.js +347 -52
- package/dist/services/in-flight-agents.d.ts +2 -0
- package/dist/services/in-flight-agents.js +4 -0
- package/dist/services/kb-tool-profile.d.ts +36 -0
- package/dist/services/kb-tool-profile.js +88 -0
- package/dist/services/knowledge/bible-basis-filter.d.ts +53 -0
- package/dist/services/knowledge/bible-basis-filter.js +134 -0
- package/dist/services/knowledge/bible-blob-id.d.ts +44 -0
- package/dist/services/knowledge/bible-blob-id.js +122 -0
- package/dist/services/knowledge/bible-import.d.ts +173 -0
- package/dist/services/knowledge/bible-import.js +344 -0
- package/dist/services/knowledge/file-hash.d.ts +31 -0
- package/dist/services/knowledge/file-hash.js +155 -24
- package/dist/services/knowledge/http-provider.d.ts +305 -21
- package/dist/services/knowledge/http-provider.js +801 -119
- package/dist/services/knowledge/kb-config.d.ts +65 -1
- package/dist/services/knowledge/kb-config.js +143 -3
- package/dist/services/knowledge/kb-http-auth-state.d.ts +26 -0
- package/dist/services/knowledge/kb-http-auth-state.js +40 -0
- package/dist/services/knowledge/kb-maintainer-grant.d.ts +15 -0
- package/dist/services/knowledge/kb-maintainer-grant.js +34 -0
- package/dist/services/knowledge/kb-providers.d.ts +13 -2
- package/dist/services/knowledge/kb-providers.js +75 -37
- package/dist/services/knowledge/kb-removed-scope-keys.d.ts +28 -0
- package/dist/services/knowledge/kb-removed-scope-keys.js +59 -0
- package/dist/services/knowledge/kb-scopes.d.ts +14 -0
- package/dist/services/knowledge/kb-scopes.js +47 -0
- package/dist/services/knowledge/kb-self.d.ts +204 -0
- package/dist/services/knowledge/kb-self.js +358 -0
- package/dist/services/knowledge/member-bible-view.d.ts +21 -0
- package/dist/services/knowledge/member-bible-view.js +207 -0
- package/dist/services/knowledge/path-validation.d.ts +7 -0
- package/dist/services/knowledge/path-validation.js +11 -0
- package/dist/services/knowledge/pre-init.js +1 -0
- package/dist/services/knowledge/project-slug.js +5 -4
- package/dist/services/knowledge/repository-header.d.ts +77 -0
- package/dist/services/knowledge/repository-header.js +233 -0
- package/dist/services/knowledge/require-sqlite-project.d.ts +1 -1
- package/dist/services/knowledge/require-sqlite-project.js +1 -1
- package/dist/services/knowledge/sqlite-provider.d.ts +233 -11
- package/dist/services/knowledge/sqlite-provider.js +719 -45
- package/dist/services/knowledge/types.d.ts +59 -3
- package/dist/services/member-access-secret.d.ts +70 -0
- package/dist/services/member-access-secret.js +195 -0
- package/dist/services/member-busy.d.ts +12 -0
- package/dist/services/member-busy.js +20 -0
- package/dist/services/member-call-counts.d.ts +24 -0
- package/dist/services/member-call-counts.js +58 -0
- package/dist/services/member-config-io.d.ts +193 -0
- package/dist/services/member-config-io.js +446 -0
- package/dist/services/member-fleet-install.d.ts +710 -0
- package/dist/services/member-fleet-install.js +1896 -0
- package/dist/services/member-secret-env.d.ts +42 -0
- package/dist/services/member-secret-env.js +68 -0
- package/dist/services/member-tool-allowlist.d.ts +49 -0
- package/dist/services/member-tool-allowlist.js +115 -0
- package/dist/services/model-pricing.d.ts +19 -0
- package/dist/services/model-pricing.js +54 -8
- package/dist/services/port-holder.d.ts +86 -0
- package/dist/services/port-holder.js +352 -0
- package/dist/services/preflight-check.js +2 -0
- package/dist/services/registry.d.ts +13 -2
- package/dist/services/registry.js +27 -1
- package/dist/services/relay-strategy.d.ts +2 -0
- package/dist/services/relay-strategy.js +8 -0
- package/dist/services/server-lifecycle.d.ts +26 -0
- package/dist/services/server-lifecycle.js +85 -0
- package/dist/services/service-manager/index.d.ts +7 -1
- package/dist/services/service-manager/index.js +17 -4
- package/dist/services/service-manager/linux.d.ts +1 -1
- package/dist/services/service-manager/linux.js +15 -7
- package/dist/services/service-manager/macos.d.ts +11 -1
- package/dist/services/service-manager/macos.js +45 -7
- package/dist/services/service-manager/service-path.d.ts +24 -0
- package/dist/services/service-manager/service-path.js +55 -0
- package/dist/services/service-manager/types.d.ts +54 -3
- package/dist/services/service-manager/types.js +29 -0
- package/dist/services/service-manager/windows.d.ts +187 -3
- package/dist/services/service-manager/windows.js +684 -50
- package/dist/services/service-notice.d.ts +21 -0
- package/dist/services/service-notice.js +81 -0
- package/dist/services/service-start-guard.d.ts +20 -0
- package/dist/services/service-start-guard.js +86 -0
- package/dist/services/session-cost.d.ts +24 -0
- package/dist/services/session-cost.js +105 -0
- package/dist/services/session-mcp-config.d.ts +83 -0
- package/dist/services/session-mcp-config.js +211 -0
- package/dist/services/session-registry.d.ts +13 -0
- package/dist/services/session-registry.js +13 -0
- package/dist/services/session-roots.d.ts +67 -0
- package/dist/services/session-roots.js +126 -0
- package/dist/services/sftp.d.ts +34 -0
- package/dist/services/sftp.js +304 -76
- package/dist/services/shell-probe.d.ts +0 -24
- package/dist/services/shell-probe.js +28 -3
- package/dist/services/singleton.d.ts +68 -2
- package/dist/services/singleton.js +168 -11
- package/dist/services/sprint-coordination.js +9 -3
- package/dist/services/ssh.d.ts +27 -0
- package/dist/services/ssh.js +229 -38
- package/dist/services/stall/find-log-file.js +12 -5
- package/dist/services/stall/index.d.ts +1 -1
- package/dist/services/stall/read-log-tail.d.ts +23 -0
- package/dist/services/stall/read-log-tail.js +33 -2
- package/dist/services/stall/stall-detector.d.ts +25 -1
- package/dist/services/stall/stall-detector.js +85 -6
- package/dist/services/stall/stall-poller.d.ts +16 -0
- package/dist/services/stall/stall-poller.js +50 -6
- package/dist/services/statusline.d.ts +21 -0
- package/dist/services/statusline.js +97 -1
- package/dist/services/stopped-marker.d.ts +16 -0
- package/dist/services/stopped-marker.js +55 -0
- package/dist/services/strategy.d.ts +33 -1
- package/dist/services/strategy.js +86 -17
- package/dist/services/supervisor-service-cleanup.d.ts +52 -0
- package/dist/services/supervisor-service-cleanup.js +333 -0
- package/dist/services/tool-registry.d.ts +8 -1
- package/dist/services/tool-registry.js +251 -62
- package/dist/services/tool-scope.d.ts +91 -0
- package/dist/services/tool-scope.js +124 -0
- package/dist/services/vcs/azure-devops.js +10 -0
- package/dist/services/vcs/bitbucket.d.ts +22 -1
- package/dist/services/vcs/bitbucket.js +163 -17
- package/dist/services/vcs/types.d.ts +25 -2
- package/dist/services/watch/project-resolver.js +3 -1
- package/dist/skills/auto-sprint-args/SKILL.md +2 -2
- package/dist/skills/fleet-sprint-cli/SKILL.md +39 -15
- package/dist/skills/pm/SKILL.md +3 -3
- package/dist/skills/pm/cost.md +5 -1
- package/dist/skills/pm/index.md +11 -9
- package/dist/skills/pm/kb-reconcile.md +29 -14
- package/dist/skills/pm/kb-review.md +1 -0
- package/dist/skills/pm/sprint.md +7 -6
- package/dist/tools/check-status.d.ts +104 -5
- package/dist/tools/check-status.js +326 -57
- package/dist/tools/child-id-allocator.d.ts +2 -2
- package/dist/tools/child-id-allocator.js +1 -1
- package/dist/tools/code-index-heal.d.ts +8 -0
- package/dist/tools/code-index-heal.js +21 -0
- package/dist/tools/code-index-state.d.ts +45 -0
- package/dist/tools/code-index-state.js +115 -0
- package/dist/tools/code-intelligence-codebase-memory.js +6 -33
- package/dist/tools/code-intelligence-freshness.js +1 -1
- package/dist/tools/code-intelligence-gitnexus.d.ts +49 -0
- package/dist/tools/code-intelligence-gitnexus.js +488 -55
- package/dist/tools/code-intelligence-kb-enrich.js +7 -6
- package/dist/tools/code-intelligence-readiness.d.ts +156 -0
- package/dist/tools/code-intelligence-readiness.js +291 -0
- package/dist/tools/code-intelligence-reindex.d.ts +219 -0
- package/dist/tools/code-intelligence-reindex.js +602 -50
- package/dist/tools/code-intelligence-telemetry.d.ts +6 -1
- package/dist/tools/code-intelligence-telemetry.js +12 -3
- package/dist/tools/code-intelligence.d.ts +81 -31
- package/dist/tools/code-intelligence.js +156 -52
- package/dist/tools/compose-permissions.d.ts +57 -2
- package/dist/tools/compose-permissions.js +497 -44
- package/dist/tools/execute-command.d.ts +11 -0
- package/dist/tools/execute-command.js +92 -18
- package/dist/tools/execute-prompt.d.ts +59 -15
- package/dist/tools/execute-prompt.js +550 -135
- package/dist/tools/fleet-snapshot.d.ts +21 -0
- package/dist/tools/fleet-snapshot.js +78 -0
- package/dist/tools/kb-bible-commit.d.ts +79 -0
- package/dist/tools/kb-bible-commit.js +348 -0
- package/dist/tools/kb-capture.d.ts +15 -11
- package/dist/tools/kb-capture.js +42 -11
- package/dist/tools/kb-context.d.ts +27 -7
- package/dist/tools/kb-context.js +85 -14
- package/dist/tools/kb-demote.d.ts +27 -0
- package/dist/tools/kb-demote.js +37 -0
- package/dist/tools/kb-export.d.ts +128 -7
- package/dist/tools/kb-export.js +273 -67
- package/dist/tools/kb-feedback.d.ts +15 -9
- package/dist/tools/kb-feedback.js +27 -11
- package/dist/tools/kb-freshness-sweep.d.ts +11 -7
- package/dist/tools/kb-freshness-sweep.js +7 -7
- package/dist/tools/kb-harvest.d.ts +11 -7
- package/dist/tools/kb-harvest.js +35 -16
- package/dist/tools/kb-import.d.ts +42 -10
- package/dist/tools/kb-import.js +185 -160
- package/dist/tools/kb-invalidate.d.ts +26 -11
- package/dist/tools/kb-invalidate.js +118 -12
- package/dist/tools/kb-list.d.ts +14 -10
- package/dist/tools/kb-list.js +61 -13
- package/dist/tools/kb-promote.d.ts +11 -7
- package/dist/tools/kb-promote.js +16 -8
- package/dist/tools/kb-query.d.ts +24 -11
- package/dist/tools/kb-query.js +230 -23
- package/dist/tools/kb-reconcile-prefilter.d.ts +11 -7
- package/dist/tools/kb-reconcile-prefilter.js +10 -8
- package/dist/tools/kb-resolve-contradiction.d.ts +11 -7
- package/dist/tools/kb-resolve-contradiction.js +7 -7
- package/dist/tools/kb-session-prime.d.ts +14 -7
- package/dist/tools/kb-session-prime.js +127 -47
- package/dist/tools/kb-setup.d.ts +31 -4
- package/dist/tools/kb-setup.js +172 -20
- package/dist/tools/kb-stats.d.ts +11 -10
- package/dist/tools/kb-stats.js +22 -41
- package/dist/tools/list-members.js +6 -3
- package/dist/tools/member-detail.d.ts +3 -0
- package/dist/tools/member-detail.js +95 -20
- package/dist/tools/member-reservation.d.ts +2 -2
- package/dist/tools/provision-auth.d.ts +39 -1
- package/dist/tools/provision-auth.js +269 -47
- package/dist/tools/provision-vcs-auth.d.ts +30 -5
- package/dist/tools/provision-vcs-auth.js +53 -7
- package/dist/tools/receive-files.js +8 -3
- package/dist/tools/register-member.d.ts +34 -8
- package/dist/tools/register-member.js +76 -58
- package/dist/tools/remove-member.js +110 -32
- package/dist/tools/send-email.d.ts +2 -2
- package/dist/tools/send-files.js +9 -6
- package/dist/tools/send-message.d.ts +3 -0
- package/dist/tools/send-message.js +15 -2
- package/dist/tools/session-stats.d.ts +17 -0
- package/dist/tools/session-stats.js +27 -0
- package/dist/tools/shutdown-server.js +5 -0
- package/dist/tools/stop-prompt.js +3 -1
- package/dist/tools/update-agent-cli.d.ts +19 -0
- package/dist/tools/update-agent-cli.js +59 -2
- package/dist/tools/update-member.d.ts +13 -10
- package/dist/tools/update-member.js +138 -7
- package/dist/tools/vcs-credential-exec.d.ts +45 -3
- package/dist/tools/vcs-credential-exec.js +98 -13
- package/dist/types.d.ts +98 -1
- package/dist/utils/agent-helpers.js +2 -0
- package/dist/utils/auth-env.d.ts +15 -4
- package/dist/utils/auth-env.js +52 -23
- package/dist/utils/find-on-path.d.ts +37 -0
- package/dist/utils/find-on-path.js +85 -0
- package/dist/utils/log-helpers.d.ts +37 -0
- package/dist/utils/log-helpers.js +106 -20
- package/dist/utils/owner-only-fs.d.ts +56 -0
- package/dist/utils/owner-only-fs.js +98 -0
- package/dist/utils/process-utils.d.ts +28 -0
- package/dist/utils/process-utils.js +72 -0
- package/dist/utils/prompt-errors.js +4 -1
- package/dist/utils/redact-known-secrets.d.ts +17 -0
- package/dist/utils/redact-known-secrets.js +70 -0
- package/dist/utils/session-caller.d.ts +4 -2
- package/dist/utils/session-caller.js +3 -2
- package/dist/utils/shell-escape.d.ts +42 -3
- package/dist/utils/shell-escape.js +70 -4
- package/dist/utils/skill-matrix.js +1 -1
- package/dist/utils/ssh-error-messages.js +3 -0
- package/dist/utils/vcs-provider-detect.js +2 -2
- package/dist/utils/workspace-trust.d.ts +24 -1
- package/dist/utils/workspace-trust.js +21 -17
- package/dist/workflows/auto-sprint.js +468 -52
- package/package.json +15 -9
- package/packages/apra-fleet-client/package.json +2 -2
- package/packages/apra-fleet-client/src/client/api.mjs +722 -38
- package/packages/apra-fleet-client/src/client/auto-start.mjs +434 -0
- package/packages/apra-fleet-client/src/client/client.mjs +9 -0
- package/packages/apra-fleet-client/src/client/factory.mjs +23 -4
- package/packages/apra-fleet-client/src/client/reconnecting-transport.mjs +170 -0
- package/packages/apra-fleet-client/src/client/server-resolution.mjs +267 -30
- package/packages/apra-fleet-client/src/client/transport.mjs +43 -3
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +80 -27
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +42 -22
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +59 -24
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +111 -41
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +60 -48
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +45 -23
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +34 -7
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +54 -24
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +71 -43
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +106 -78
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +170 -57
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/deployer-output.json +5 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +110 -2
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-input.json +1 -5
- package/packages/apra-fleet-se/apra-pm/agents/schemas/planner-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +41 -7
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +166 -5
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +3 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +5 -1
- package/packages/apra-fleet-se/apra-pm/skills/pm/index.md +11 -9
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-reconcile.md +29 -14
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-review.md +1 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +7 -6
- package/packages/apra-fleet-se/bin/cli.mjs +282 -79
- package/packages/apra-fleet-se/bin/serve.mjs +186 -15
- package/packages/apra-fleet-se/fleet-sprint/abort.mjs +234 -46
- package/packages/apra-fleet-se/fleet-sprint/backlog-role.mjs +93 -0
- package/packages/apra-fleet-se/fleet-sprint/bd-sync-command.mjs +69 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +229 -53
- package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +576 -33
- package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +9 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-lock-probe.mjs +176 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-memory-hygiene.mjs +201 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-reachability.mjs +126 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +271 -7
- package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +154 -8
- package/packages/apra-fleet-se/fleet-sprint/ci-gate.mjs +353 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +12 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +142 -3
- package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +48 -8
- package/packages/apra-fleet-se/fleet-sprint/decision-notify.mjs +338 -0
- package/packages/apra-fleet-se/fleet-sprint/decision-wait.mjs +731 -0
- package/packages/apra-fleet-se/fleet-sprint/decisions.mjs +372 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-accounting.mjs +270 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +22 -2
- package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +244 -22
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +56 -15
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +6 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/fleet-sprint-diagram.md +3 -3
- package/packages/apra-fleet-se/fleet-sprint/dolt-settle.mjs +9 -3
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +651 -37
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +282 -15
- package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +4 -4
- package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +207 -10
- package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +169 -10
- package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +88 -5
- package/packages/apra-fleet-se/fleet-sprint/kb-hints.mjs +181 -0
- package/packages/apra-fleet-se/fleet-sprint/kb-injection.mjs +64 -0
- package/packages/apra-fleet-se/fleet-sprint/kb-maintainer.mjs +298 -0
- package/packages/apra-fleet-se/fleet-sprint/kb.mjs +1896 -305
- package/packages/apra-fleet-se/fleet-sprint/lower-quality.mjs +39 -0
- package/packages/apra-fleet-se/fleet-sprint/member-align.mjs +391 -0
- package/packages/apra-fleet-se/fleet-sprint/member-call.mjs +374 -0
- package/packages/apra-fleet-se/fleet-sprint/member-init-probe.mjs +644 -0
- package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +454 -1
- package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +250 -29
- package/packages/apra-fleet-se/fleet-sprint/orphan-reclaim.mjs +153 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +129 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +302 -52
- package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +1 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +142 -21
- package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +118 -36
- package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +6 -6
- package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +27 -18
- package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +99 -52
- package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +58 -10
- package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +16 -11
- package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +36 -3
- package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +90 -15
- package/packages/apra-fleet-se/fleet-sprint/pr-body.mjs +272 -0
- package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +113 -28
- package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +19 -1
- package/packages/apra-fleet-se/fleet-sprint/runner.js +1631 -213
- package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +26 -0
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +183 -0
- package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +138 -0
- package/packages/apra-fleet-se/fleet-sprint/set-aside.mjs +288 -0
- package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +44 -1
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +39 -15
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +87 -32
- package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +158 -2
- package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +132 -11
- package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +31 -0
- package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +7 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +774 -35
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +134 -7
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +99 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +811 -17
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +223 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +138 -1
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +8 -4
- package/packages/apra-fleet-se/fleet-sprint/verify-block.mjs +152 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +460 -23
- package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +59 -3
- package/packages/apra-fleet-se/package.json +2 -2
- package/packages/apra-fleet-se/src/supervisor/api.mjs +1059 -0
- package/packages/apra-fleet-se/src/supervisor/backlog-member.mjs +332 -0
- package/packages/apra-fleet-se/src/supervisor/backlog.mjs +982 -0
- package/packages/apra-fleet-se/src/supervisor/beads-identity.mjs +246 -0
- package/packages/apra-fleet-se/src/supervisor/beads-view.mjs +438 -0
- package/packages/apra-fleet-se/src/supervisor/child-port.mjs +36 -0
- package/packages/apra-fleet-se/src/supervisor/dashboard.mjs +1662 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-mutex.mjs +370 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-orphan-sweep.mjs +338 -0
- package/packages/apra-fleet-se/src/supervisor/fleet-members.mjs +292 -0
- package/packages/apra-fleet-se/src/supervisor/history-view.mjs +276 -0
- package/packages/apra-fleet-se/src/supervisor/history.mjs +335 -0
- package/packages/apra-fleet-se/src/supervisor/id-allocator.mjs +611 -0
- package/packages/apra-fleet-se/src/supervisor/launch-form.mjs +444 -0
- package/packages/apra-fleet-se/src/supervisor/ledger.mjs +629 -0
- package/packages/apra-fleet-se/src/supervisor/lib/exec-bd.mjs +303 -0
- package/packages/apra-fleet-se/src/supervisor/log-timestamp.mjs +51 -0
- package/packages/apra-fleet-se/src/supervisor/log-view.mjs +159 -0
- package/packages/apra-fleet-se/src/supervisor/proxy.mjs +499 -0
- package/packages/apra-fleet-se/src/supervisor/readopt.mjs +136 -0
- package/packages/apra-fleet-se/src/supervisor/reconcile.mjs +263 -0
- package/packages/apra-fleet-se/src/supervisor/rename-with-retry.mjs +87 -0
- package/packages/apra-fleet-se/src/supervisor/scope-overlap.mjs +327 -0
- package/packages/apra-fleet-se/src/supervisor/self-log.mjs +133 -0
- package/packages/apra-fleet-se/src/supervisor/server.mjs +542 -0
- package/packages/apra-fleet-se/src/supervisor/spawner.mjs +544 -0
- package/packages/apra-fleet-se/src/supervisor/sprint-identity.mjs +96 -0
- package/packages/apra-fleet-se/src/supervisor/watchdog.mjs +993 -0
- package/packages/apra-fleet-workflow/package.json +3 -2
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +150 -14
- package/packages/apra-fleet-workflow/src/viewer/request-guard.mjs +222 -0
- package/packages/apra-fleet-workflow/src/viewer/run-summary.mjs +127 -0
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +105 -7
- package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +75 -25
- package/plugins/claude-code/fleet-status/.claude-plugin/plugin.json +7 -0
- package/plugins/claude-code/fleet-status/hooks/hooks.json +1 -0
- package/plugins/claude-code/fleet-status/hooks/register.tsx +906 -0
- package/plugins/claude-code/fleet-status/types/index.d.ts +88 -0
- package/skills/fleet/auth-bitbucket.md +47 -20
- package/skills/fleet/onboarding.md +1 -1
- package/skills/fleet/permissions.md +9 -0
- package/skills/fleet/profiles/tag-kb-reconciler.json +2 -6
- package/skills/fleet/skill-matrix.md +3 -3
- package/version.json +1 -1
- package/dist/cli/agent-transform.d.ts.map +0 -1
- package/dist/cli/agent-transform.js.map +0 -1
- package/dist/cli/auth.d.ts.map +0 -1
- package/dist/cli/auth.js.map +0 -1
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/dolt-install.d.ts.map +0 -1
- package/dist/cli/dolt-install.js.map +0 -1
- package/dist/cli/install-guard.d.ts.map +0 -1
- package/dist/cli/install-guard.js.map +0 -1
- package/dist/cli/install.d.ts.map +0 -1
- package/dist/cli/install.js.map +0 -1
- package/dist/cli/join.d.ts.map +0 -1
- package/dist/cli/join.js.map +0 -1
- package/dist/cli/kb-commit.d.ts.map +0 -1
- package/dist/cli/kb-commit.js.map +0 -1
- package/dist/cli/kb-directives.d.ts.map +0 -1
- package/dist/cli/kb-directives.js.map +0 -1
- package/dist/cli/kb-import.d.ts.map +0 -1
- package/dist/cli/kb-import.js.map +0 -1
- package/dist/cli/register-member.d.ts.map +0 -1
- package/dist/cli/register-member.js.map +0 -1
- package/dist/cli/restart.d.ts.map +0 -1
- package/dist/cli/restart.js.map +0 -1
- package/dist/cli/secret.d.ts.map +0 -1
- package/dist/cli/secret.js.map +0 -1
- package/dist/cli/spoke.d.ts.map +0 -1
- package/dist/cli/spoke.js.map +0 -1
- package/dist/cli/start.d.ts.map +0 -1
- package/dist/cli/start.js.map +0 -1
- package/dist/cli/status.d.ts.map +0 -1
- package/dist/cli/status.js.map +0 -1
- package/dist/cli/stop.d.ts.map +0 -1
- package/dist/cli/stop.js.map +0 -1
- package/dist/cli/uninstall.d.ts.map +0 -1
- package/dist/cli/uninstall.js.map +0 -1
- package/dist/cli/update.d.ts.map +0 -1
- package/dist/cli/update.js.map +0 -1
- package/dist/cli/watch.d.ts.map +0 -1
- package/dist/cli/watch.js.map +0 -1
- package/dist/cli/workflow-assets.d.ts.map +0 -1
- package/dist/cli/workflow-assets.js.map +0 -1
- package/dist/cli/workflow.d.ts.map +0 -1
- package/dist/cli/workflow.js.map +0 -1
- package/dist/commands/kb-server.d.ts.map +0 -1
- package/dist/commands/kb-server.js.map +0 -1
- package/dist/delivery-mode.d.ts.map +0 -1
- package/dist/delivery-mode.js.map +0 -1
- package/dist/hub-service/activity.d.ts.map +0 -1
- package/dist/hub-service/activity.js.map +0 -1
- package/dist/hub-service/audit-log.d.ts.map +0 -1
- package/dist/hub-service/audit-log.js.map +0 -1
- package/dist/hub-service/db/pool.d.ts.map +0 -1
- package/dist/hub-service/db/pool.js.map +0 -1
- package/dist/hub-service/enrollment.d.ts.map +0 -1
- package/dist/hub-service/enrollment.js.map +0 -1
- package/dist/hub-service/envelope-routes.d.ts.map +0 -1
- package/dist/hub-service/envelope-routes.js.map +0 -1
- package/dist/hub-service/handlers/installers.d.ts.map +0 -1
- package/dist/hub-service/handlers/installers.js.map +0 -1
- package/dist/hub-service/http-server.d.ts.map +0 -1
- package/dist/hub-service/http-server.js.map +0 -1
- package/dist/hub-service/hub-jwt.d.ts.map +0 -1
- package/dist/hub-service/hub-jwt.js.map +0 -1
- package/dist/hub-service/jwt-revocation.d.ts.map +0 -1
- package/dist/hub-service/jwt-revocation.js.map +0 -1
- package/dist/hub-service/machines.d.ts.map +0 -1
- package/dist/hub-service/machines.js.map +0 -1
- package/dist/hub-service/main.d.ts.map +0 -1
- package/dist/hub-service/main.js.map +0 -1
- package/dist/hub-service/member-tokens.d.ts.map +0 -1
- package/dist/hub-service/member-tokens.js.map +0 -1
- package/dist/hub-service/member-view.d.ts.map +0 -1
- package/dist/hub-service/member-view.js.map +0 -1
- package/dist/hub-service/members.d.ts.map +0 -1
- package/dist/hub-service/members.js.map +0 -1
- package/dist/hub-service/presence.d.ts.map +0 -1
- package/dist/hub-service/presence.js.map +0 -1
- package/dist/hub-service/project-view.d.ts.map +0 -1
- package/dist/hub-service/project-view.js.map +0 -1
- package/dist/hub-service/projects.d.ts.map +0 -1
- package/dist/hub-service/projects.js.map +0 -1
- package/dist/hub-service/relay-queue.d.ts.map +0 -1
- package/dist/hub-service/relay-queue.js.map +0 -1
- package/dist/hub-service/session-jwt.d.ts.map +0 -1
- package/dist/hub-service/session-jwt.js.map +0 -1
- package/dist/hub-service/usage.d.ts.map +0 -1
- package/dist/hub-service/usage.js.map +0 -1
- package/dist/hub-service/users.d.ts.map +0 -1
- package/dist/hub-service/users.js.map +0 -1
- package/dist/hub-service/workspaces.d.ts.map +0 -1
- package/dist/hub-service/workspaces.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/onboarding/text.d.ts.map +0 -1
- package/dist/onboarding/text.js.map +0 -1
- package/dist/os/git-bash-candidates.d.ts.map +0 -1
- package/dist/os/git-bash-candidates.js.map +0 -1
- package/dist/os/index.d.ts.map +0 -1
- package/dist/os/index.js.map +0 -1
- package/dist/os/linux.d.ts.map +0 -1
- package/dist/os/linux.js.map +0 -1
- package/dist/os/macos.d.ts.map +0 -1
- package/dist/os/macos.js.map +0 -1
- package/dist/os/os-commands.d.ts.map +0 -1
- package/dist/os/os-commands.js.map +0 -1
- package/dist/os/windows-gitbash.d.ts.map +0 -1
- package/dist/os/windows-gitbash.js.map +0 -1
- package/dist/os/windows-wrapper.d.ts.map +0 -1
- package/dist/os/windows-wrapper.js.map +0 -1
- package/dist/os/windows.d.ts.map +0 -1
- package/dist/os/windows.js.map +0 -1
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/providers/agy.d.ts.map +0 -1
- package/dist/providers/agy.js.map +0 -1
- package/dist/providers/claude.d.ts.map +0 -1
- package/dist/providers/claude.js.map +0 -1
- package/dist/providers/codex.d.ts.map +0 -1
- package/dist/providers/codex.js.map +0 -1
- package/dist/providers/copilot.d.ts.map +0 -1
- package/dist/providers/copilot.js.map +0 -1
- package/dist/providers/email/headers.d.ts.map +0 -1
- package/dist/providers/email/headers.js.map +0 -1
- package/dist/providers/email/index.d.ts.map +0 -1
- package/dist/providers/email/index.js.map +0 -1
- package/dist/providers/email/provider.d.ts.map +0 -1
- package/dist/providers/email/provider.js.map +0 -1
- package/dist/providers/email/sendgrid.d.ts.map +0 -1
- package/dist/providers/email/sendgrid.js.map +0 -1
- package/dist/providers/email/smtp.d.ts.map +0 -1
- package/dist/providers/email/smtp.js.map +0 -1
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/none.d.ts.map +0 -1
- package/dist/providers/none.js.map +0 -1
- package/dist/providers/opencode.d.ts.map +0 -1
- package/dist/providers/opencode.js.map +0 -1
- package/dist/providers/provider.d.ts.map +0 -1
- package/dist/providers/provider.js.map +0 -1
- package/dist/services/agent-provisioner.d.ts.map +0 -1
- package/dist/services/agent-provisioner.js.map +0 -1
- package/dist/services/agy-project.d.ts.map +0 -1
- package/dist/services/agy-project.js.map +0 -1
- package/dist/services/auth-socket.d.ts.map +0 -1
- package/dist/services/auth-socket.js.map +0 -1
- package/dist/services/auth-web.d.ts.map +0 -1
- package/dist/services/auth-web.js.map +0 -1
- package/dist/services/budget-awareness.d.ts.map +0 -1
- package/dist/services/budget-awareness.js.map +0 -1
- package/dist/services/cloud/activity.d.ts.map +0 -1
- package/dist/services/cloud/activity.js.map +0 -1
- package/dist/services/cloud/aws.d.ts.map +0 -1
- package/dist/services/cloud/aws.js.map +0 -1
- package/dist/services/cloud/cost.d.ts.map +0 -1
- package/dist/services/cloud/cost.js.map +0 -1
- package/dist/services/cloud/idle-manager.d.ts.map +0 -1
- package/dist/services/cloud/idle-manager.js.map +0 -1
- package/dist/services/cloud/lifecycle.d.ts.map +0 -1
- package/dist/services/cloud/lifecycle.js.map +0 -1
- package/dist/services/cloud/task-wrapper.d.ts.map +0 -1
- package/dist/services/cloud/task-wrapper.js.map +0 -1
- package/dist/services/cloud/types.d.ts.map +0 -1
- package/dist/services/cloud/types.js.map +0 -1
- package/dist/services/cloud-sync.d.ts.map +0 -1
- package/dist/services/cloud-sync.js.map +0 -1
- package/dist/services/context-admission.d.ts.map +0 -1
- package/dist/services/context-admission.js.map +0 -1
- package/dist/services/credential-cleanup.d.ts.map +0 -1
- package/dist/services/credential-cleanup.js.map +0 -1
- package/dist/services/credential-store.d.ts.map +0 -1
- package/dist/services/credential-store.js.map +0 -1
- package/dist/services/event-bus.d.ts.map +0 -1
- package/dist/services/event-bus.js.map +0 -1
- package/dist/services/exit-drain.d.ts.map +0 -1
- package/dist/services/exit-drain.js.map +0 -1
- package/dist/services/file-chunker.d.ts.map +0 -1
- package/dist/services/file-chunker.js.map +0 -1
- package/dist/services/file-transfer-relay.d.ts.map +0 -1
- package/dist/services/file-transfer-relay.js.map +0 -1
- package/dist/services/file-transfer.d.ts.map +0 -1
- package/dist/services/file-transfer.js.map +0 -1
- package/dist/services/git-config.d.ts.map +0 -1
- package/dist/services/git-config.js.map +0 -1
- package/dist/services/github-app.d.ts.map +0 -1
- package/dist/services/github-app.js.map +0 -1
- package/dist/services/http-transport.d.ts.map +0 -1
- package/dist/services/http-transport.js.map +0 -1
- package/dist/services/hub-client.d.ts.map +0 -1
- package/dist/services/hub-client.js.map +0 -1
- package/dist/services/icons.d.ts.map +0 -1
- package/dist/services/icons.js.map +0 -1
- package/dist/services/jwt.d.ts.map +0 -1
- package/dist/services/jwt.js.map +0 -1
- package/dist/services/knowledge/audn.d.ts.map +0 -1
- package/dist/services/knowledge/audn.js.map +0 -1
- package/dist/services/knowledge/file-hash.d.ts.map +0 -1
- package/dist/services/knowledge/file-hash.js.map +0 -1
- package/dist/services/knowledge/http-provider.d.ts.map +0 -1
- package/dist/services/knowledge/http-provider.js.map +0 -1
- package/dist/services/knowledge/kb-config.d.ts.map +0 -1
- package/dist/services/knowledge/kb-config.js.map +0 -1
- package/dist/services/knowledge/kb-providers.d.ts.map +0 -1
- package/dist/services/knowledge/kb-providers.js.map +0 -1
- package/dist/services/knowledge/kb-scope-input.d.ts +0 -5
- package/dist/services/knowledge/kb-scope-input.d.ts.map +0 -1
- package/dist/services/knowledge/kb-scope-input.js +0 -11
- package/dist/services/knowledge/kb-scope-input.js.map +0 -1
- package/dist/services/knowledge/kb-service.d.ts.map +0 -1
- package/dist/services/knowledge/kb-service.js.map +0 -1
- package/dist/services/knowledge/path-validation.d.ts.map +0 -1
- package/dist/services/knowledge/path-validation.js.map +0 -1
- package/dist/services/knowledge/pre-init.d.ts.map +0 -1
- package/dist/services/knowledge/pre-init.js.map +0 -1
- package/dist/services/knowledge/project-slug.d.ts.map +0 -1
- package/dist/services/knowledge/project-slug.js.map +0 -1
- package/dist/services/knowledge/require-sqlite-project.d.ts.map +0 -1
- package/dist/services/knowledge/require-sqlite-project.js.map +0 -1
- package/dist/services/knowledge/sqlite-provider.d.ts.map +0 -1
- package/dist/services/knowledge/sqlite-provider.js.map +0 -1
- package/dist/services/knowledge/types.d.ts.map +0 -1
- package/dist/services/knowledge/types.js.map +0 -1
- package/dist/services/known-hosts.d.ts.map +0 -1
- package/dist/services/known-hosts.js.map +0 -1
- package/dist/services/known-sessions.d.ts.map +0 -1
- package/dist/services/known-sessions.js.map +0 -1
- package/dist/services/member-home.d.ts.map +0 -1
- package/dist/services/member-home.js.map +0 -1
- package/dist/services/member-remote-url.d.ts.map +0 -1
- package/dist/services/member-remote-url.js.map +0 -1
- package/dist/services/model-pricing.d.ts.map +0 -1
- package/dist/services/model-pricing.js.map +0 -1
- package/dist/services/onboarding.d.ts.map +0 -1
- package/dist/services/onboarding.js.map +0 -1
- package/dist/services/orphan-recovery.d.ts.map +0 -1
- package/dist/services/orphan-recovery.js.map +0 -1
- package/dist/services/pending-responses.d.ts.map +0 -1
- package/dist/services/pending-responses.js.map +0 -1
- package/dist/services/preflight-check.d.ts.map +0 -1
- package/dist/services/preflight-check.js.map +0 -1
- package/dist/services/registry.d.ts.map +0 -1
- package/dist/services/registry.js.map +0 -1
- package/dist/services/relay-context.d.ts.map +0 -1
- package/dist/services/relay-context.js.map +0 -1
- package/dist/services/relay-executor.d.ts.map +0 -1
- package/dist/services/relay-executor.js.map +0 -1
- package/dist/services/relay-request.d.ts.map +0 -1
- package/dist/services/relay-request.js.map +0 -1
- package/dist/services/relay-strategy.d.ts.map +0 -1
- package/dist/services/relay-strategy.js.map +0 -1
- package/dist/services/secret-token.d.ts.map +0 -1
- package/dist/services/secret-token.js.map +0 -1
- package/dist/services/service-manager/index.d.ts.map +0 -1
- package/dist/services/service-manager/index.js.map +0 -1
- package/dist/services/service-manager/linux.d.ts.map +0 -1
- package/dist/services/service-manager/linux.js.map +0 -1
- package/dist/services/service-manager/macos.d.ts.map +0 -1
- package/dist/services/service-manager/macos.js.map +0 -1
- package/dist/services/service-manager/types.d.ts.map +0 -1
- package/dist/services/service-manager/types.js.map +0 -1
- package/dist/services/service-manager/windows.d.ts.map +0 -1
- package/dist/services/service-manager/windows.js.map +0 -1
- package/dist/services/session-registry.d.ts.map +0 -1
- package/dist/services/session-registry.js.map +0 -1
- package/dist/services/sftp.d.ts.map +0 -1
- package/dist/services/sftp.js.map +0 -1
- package/dist/services/shell-probe.d.ts.map +0 -1
- package/dist/services/shell-probe.js.map +0 -1
- package/dist/services/singleton.d.ts.map +0 -1
- package/dist/services/singleton.js.map +0 -1
- package/dist/services/sprint-coordination.d.ts.map +0 -1
- package/dist/services/sprint-coordination.js.map +0 -1
- package/dist/services/ssh.d.ts.map +0 -1
- package/dist/services/ssh.js.map +0 -1
- package/dist/services/stall/find-log-file.d.ts.map +0 -1
- package/dist/services/stall/find-log-file.js.map +0 -1
- package/dist/services/stall/index.d.ts.map +0 -1
- package/dist/services/stall/index.js.map +0 -1
- package/dist/services/stall/log-path-resolver.d.ts.map +0 -1
- package/dist/services/stall/log-path-resolver.js.map +0 -1
- package/dist/services/stall/read-log-tail.d.ts.map +0 -1
- package/dist/services/stall/read-log-tail.js.map +0 -1
- package/dist/services/stall/stall-detector.d.ts.map +0 -1
- package/dist/services/stall/stall-detector.js.map +0 -1
- package/dist/services/stall/stall-poller.d.ts.map +0 -1
- package/dist/services/stall/stall-poller.js.map +0 -1
- package/dist/services/stall/time-utils.d.ts.map +0 -1
- package/dist/services/stall/time-utils.js.map +0 -1
- package/dist/services/statusline.d.ts.map +0 -1
- package/dist/services/statusline.js.map +0 -1
- package/dist/services/strategy.d.ts.map +0 -1
- package/dist/services/strategy.js.map +0 -1
- package/dist/services/substitution-engine.d.ts.map +0 -1
- package/dist/services/substitution-engine.js.map +0 -1
- package/dist/services/task-cleanup.d.ts.map +0 -1
- package/dist/services/task-cleanup.js.map +0 -1
- package/dist/services/token-issuer.d.ts.map +0 -1
- package/dist/services/token-issuer.js.map +0 -1
- package/dist/services/tool-registry.d.ts.map +0 -1
- package/dist/services/tool-registry.js.map +0 -1
- package/dist/services/update-check.d.ts.map +0 -1
- package/dist/services/update-check.js.map +0 -1
- package/dist/services/user-config.d.ts.map +0 -1
- package/dist/services/user-config.js.map +0 -1
- package/dist/services/vcs/azure-devops.d.ts.map +0 -1
- package/dist/services/vcs/azure-devops.js.map +0 -1
- package/dist/services/vcs/bitbucket.d.ts.map +0 -1
- package/dist/services/vcs/bitbucket.js.map +0 -1
- package/dist/services/vcs/constants.d.ts.map +0 -1
- package/dist/services/vcs/constants.js.map +0 -1
- package/dist/services/vcs/github.d.ts.map +0 -1
- package/dist/services/vcs/github.js.map +0 -1
- package/dist/services/vcs/types.d.ts.map +0 -1
- package/dist/services/vcs/types.js.map +0 -1
- package/dist/services/version-check.d.ts.map +0 -1
- package/dist/services/version-check.js.map +0 -1
- package/dist/services/watch/fleet-log.d.ts.map +0 -1
- package/dist/services/watch/fleet-log.js.map +0 -1
- package/dist/services/watch/project-resolver.d.ts.map +0 -1
- package/dist/services/watch/project-resolver.js.map +0 -1
- package/dist/services/watch/transcript-formatter.d.ts.map +0 -1
- package/dist/services/watch/transcript-formatter.js.map +0 -1
- package/dist/smoke-test.d.ts.map +0 -1
- package/dist/smoke-test.js.map +0 -1
- package/dist/tools/check-status.d.ts.map +0 -1
- package/dist/tools/check-status.js.map +0 -1
- package/dist/tools/child-id-allocator.d.ts.map +0 -1
- package/dist/tools/child-id-allocator.js.map +0 -1
- package/dist/tools/cloud-control.d.ts.map +0 -1
- package/dist/tools/cloud-control.js.map +0 -1
- package/dist/tools/code-intelligence-codebase-memory.d.ts.map +0 -1
- package/dist/tools/code-intelligence-codebase-memory.js.map +0 -1
- package/dist/tools/code-intelligence-freshness.d.ts.map +0 -1
- package/dist/tools/code-intelligence-freshness.js.map +0 -1
- package/dist/tools/code-intelligence-gitnexus.d.ts.map +0 -1
- package/dist/tools/code-intelligence-gitnexus.js.map +0 -1
- package/dist/tools/code-intelligence-kb-enrich.d.ts.map +0 -1
- package/dist/tools/code-intelligence-kb-enrich.js.map +0 -1
- package/dist/tools/code-intelligence-reindex.d.ts.map +0 -1
- package/dist/tools/code-intelligence-reindex.js.map +0 -1
- package/dist/tools/code-intelligence-telemetry.d.ts.map +0 -1
- package/dist/tools/code-intelligence-telemetry.js.map +0 -1
- package/dist/tools/code-intelligence-tests.d.ts.map +0 -1
- package/dist/tools/code-intelligence-tests.js.map +0 -1
- package/dist/tools/code-intelligence.d.ts.map +0 -1
- package/dist/tools/code-intelligence.js.map +0 -1
- package/dist/tools/compose-permissions.d.ts.map +0 -1
- package/dist/tools/compose-permissions.js.map +0 -1
- package/dist/tools/credential-store-delete.d.ts.map +0 -1
- package/dist/tools/credential-store-delete.js.map +0 -1
- package/dist/tools/credential-store-list.d.ts.map +0 -1
- package/dist/tools/credential-store-list.js.map +0 -1
- package/dist/tools/credential-store-set.d.ts.map +0 -1
- package/dist/tools/credential-store-set.js.map +0 -1
- package/dist/tools/credential-store-update.d.ts.map +0 -1
- package/dist/tools/credential-store-update.js.map +0 -1
- package/dist/tools/dolt-push-mutex.d.ts.map +0 -1
- package/dist/tools/dolt-push-mutex.js.map +0 -1
- package/dist/tools/execute-command.d.ts.map +0 -1
- package/dist/tools/execute-command.js.map +0 -1
- package/dist/tools/execute-prompt.d.ts.map +0 -1
- package/dist/tools/execute-prompt.js.map +0 -1
- package/dist/tools/get-member-model-pricing.d.ts.map +0 -1
- package/dist/tools/get-member-model-pricing.js.map +0 -1
- package/dist/tools/kb-capture.d.ts.map +0 -1
- package/dist/tools/kb-capture.js.map +0 -1
- package/dist/tools/kb-context.d.ts.map +0 -1
- package/dist/tools/kb-context.js.map +0 -1
- package/dist/tools/kb-export.d.ts.map +0 -1
- package/dist/tools/kb-export.js.map +0 -1
- package/dist/tools/kb-feedback.d.ts.map +0 -1
- package/dist/tools/kb-feedback.js.map +0 -1
- package/dist/tools/kb-freshness-sweep.d.ts.map +0 -1
- package/dist/tools/kb-freshness-sweep.js.map +0 -1
- package/dist/tools/kb-harvest.d.ts.map +0 -1
- package/dist/tools/kb-harvest.js.map +0 -1
- package/dist/tools/kb-import.d.ts.map +0 -1
- package/dist/tools/kb-import.js.map +0 -1
- package/dist/tools/kb-invalidate.d.ts.map +0 -1
- package/dist/tools/kb-invalidate.js.map +0 -1
- package/dist/tools/kb-list.d.ts.map +0 -1
- package/dist/tools/kb-list.js.map +0 -1
- package/dist/tools/kb-promote.d.ts.map +0 -1
- package/dist/tools/kb-promote.js.map +0 -1
- package/dist/tools/kb-query.d.ts.map +0 -1
- package/dist/tools/kb-query.js.map +0 -1
- package/dist/tools/kb-reconcile-prefilter.d.ts.map +0 -1
- package/dist/tools/kb-reconcile-prefilter.js.map +0 -1
- package/dist/tools/kb-resolve-contradiction.d.ts.map +0 -1
- package/dist/tools/kb-resolve-contradiction.js.map +0 -1
- package/dist/tools/kb-session-prime.d.ts.map +0 -1
- package/dist/tools/kb-session-prime.js.map +0 -1
- package/dist/tools/kb-setup.d.ts.map +0 -1
- package/dist/tools/kb-setup.js.map +0 -1
- package/dist/tools/kb-stats.d.ts.map +0 -1
- package/dist/tools/kb-stats.js.map +0 -1
- package/dist/tools/list-members.d.ts.map +0 -1
- package/dist/tools/list-members.js.map +0 -1
- package/dist/tools/member-detail.d.ts.map +0 -1
- package/dist/tools/member-detail.js.map +0 -1
- package/dist/tools/member-reservation.d.ts.map +0 -1
- package/dist/tools/member-reservation.js.map +0 -1
- package/dist/tools/monitor-task.d.ts.map +0 -1
- package/dist/tools/monitor-task.js.map +0 -1
- package/dist/tools/provision-auth.d.ts.map +0 -1
- package/dist/tools/provision-auth.js.map +0 -1
- package/dist/tools/provision-vcs-auth.d.ts.map +0 -1
- package/dist/tools/provision-vcs-auth.js.map +0 -1
- package/dist/tools/receive-files.d.ts.map +0 -1
- package/dist/tools/receive-files.js.map +0 -1
- package/dist/tools/register-member.d.ts.map +0 -1
- package/dist/tools/register-member.js.map +0 -1
- package/dist/tools/remove-member.d.ts.map +0 -1
- package/dist/tools/remove-member.js.map +0 -1
- package/dist/tools/report-status.d.ts.map +0 -1
- package/dist/tools/report-status.js.map +0 -1
- package/dist/tools/respond-to-message.d.ts.map +0 -1
- package/dist/tools/respond-to-message.js.map +0 -1
- package/dist/tools/revoke-vcs-auth.d.ts.map +0 -1
- package/dist/tools/revoke-vcs-auth.js.map +0 -1
- package/dist/tools/send-email.d.ts.map +0 -1
- package/dist/tools/send-email.js.map +0 -1
- package/dist/tools/send-files.d.ts.map +0 -1
- package/dist/tools/send-files.js.map +0 -1
- package/dist/tools/send-message.d.ts.map +0 -1
- package/dist/tools/send-message.js.map +0 -1
- package/dist/tools/setup-git-app.d.ts.map +0 -1
- package/dist/tools/setup-git-app.js.map +0 -1
- package/dist/tools/setup-ssh-key.d.ts.map +0 -1
- package/dist/tools/setup-ssh-key.js.map +0 -1
- package/dist/tools/shutdown-server.d.ts.map +0 -1
- package/dist/tools/shutdown-server.js.map +0 -1
- package/dist/tools/stop-prompt.d.ts.map +0 -1
- package/dist/tools/stop-prompt.js.map +0 -1
- package/dist/tools/update-agent-cli.d.ts.map +0 -1
- package/dist/tools/update-agent-cli.js.map +0 -1
- package/dist/tools/update-member.d.ts.map +0 -1
- package/dist/tools/update-member.js.map +0 -1
- package/dist/tools/vcs-credential-exec.d.ts.map +0 -1
- package/dist/tools/vcs-credential-exec.js.map +0 -1
- package/dist/tools/version.d.ts.map +0 -1
- package/dist/tools/version.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/agent-helpers.d.ts.map +0 -1
- package/dist/utils/agent-helpers.js.map +0 -1
- package/dist/utils/ansi.d.ts.map +0 -1
- package/dist/utils/ansi.js.map +0 -1
- package/dist/utils/auth-env.d.ts.map +0 -1
- package/dist/utils/auth-env.js.map +0 -1
- package/dist/utils/collect-secret.d.ts.map +0 -1
- package/dist/utils/collect-secret.js.map +0 -1
- package/dist/utils/credential-validation.d.ts.map +0 -1
- package/dist/utils/credential-validation.js.map +0 -1
- package/dist/utils/crypto.d.ts.map +0 -1
- package/dist/utils/crypto.js.map +0 -1
- package/dist/utils/deep-merge.d.ts.map +0 -1
- package/dist/utils/deep-merge.js.map +0 -1
- package/dist/utils/file-permissions.d.ts.map +0 -1
- package/dist/utils/file-permissions.js.map +0 -1
- package/dist/utils/gpu-parser.d.ts.map +0 -1
- package/dist/utils/gpu-parser.js.map +0 -1
- package/dist/utils/log-helpers.d.ts.map +0 -1
- package/dist/utils/log-helpers.js.map +0 -1
- package/dist/utils/oob-timeout.d.ts.map +0 -1
- package/dist/utils/oob-timeout.js.map +0 -1
- package/dist/utils/opencode-model-validation.d.ts.map +0 -1
- package/dist/utils/opencode-model-validation.js.map +0 -1
- package/dist/utils/pid-helpers.d.ts.map +0 -1
- package/dist/utils/pid-helpers.js.map +0 -1
- package/dist/utils/platform.d.ts.map +0 -1
- package/dist/utils/platform.js.map +0 -1
- package/dist/utils/process-utils.d.ts.map +0 -1
- package/dist/utils/process-utils.js.map +0 -1
- package/dist/utils/prompt-errors.d.ts.map +0 -1
- package/dist/utils/prompt-errors.js.map +0 -1
- package/dist/utils/resolve-member.d.ts.map +0 -1
- package/dist/utils/resolve-member.js.map +0 -1
- package/dist/utils/secure-input.d.ts.map +0 -1
- package/dist/utils/secure-input.js.map +0 -1
- package/dist/utils/session-caller.d.ts.map +0 -1
- package/dist/utils/session-caller.js.map +0 -1
- package/dist/utils/shell-escape.d.ts.map +0 -1
- package/dist/utils/shell-escape.js.map +0 -1
- package/dist/utils/skill-matrix.d.ts.map +0 -1
- package/dist/utils/skill-matrix.js.map +0 -1
- package/dist/utils/ssh-error-messages.d.ts.map +0 -1
- package/dist/utils/ssh-error-messages.js.map +0 -1
- package/dist/utils/vcs-provider-detect.d.ts.map +0 -1
- package/dist/utils/vcs-provider-detect.js.map +0 -1
- package/dist/utils/work-folder-validation.d.ts.map +0 -1
- package/dist/utils/work-folder-validation.js.map +0 -1
- package/dist/utils/workspace-trust.d.ts.map +0 -1
- package/dist/utils/workspace-trust.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
// Bible (.fleet/kb-canonical.json) parsing and import-mode loading, shared by
|
|
2
|
+
// kb_import (src/tools/kb-import.ts) and the member bible view
|
|
3
|
+
// (member-bible-view.ts). One parser and one capture path: the view must rank,
|
|
4
|
+
// quarantine directives and preserve bible confidence exactly as an import
|
|
5
|
+
// into the per-repo DB does, so it reuses this code rather than a copy.
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import { KbCaptureRejected } from './types.js';
|
|
8
|
+
import { isRepoRelativePath } from './bible-basis-filter.js';
|
|
9
|
+
/**
|
|
10
|
+
* A bible file that exists but cannot be read as a bible: invalid JSON, or a
|
|
11
|
+
* shape that is neither the legacy bare array nor the v2 { entries } envelope.
|
|
12
|
+
* Never treated as an empty bible.
|
|
13
|
+
*/
|
|
14
|
+
export class KbBibleError extends Error {
|
|
15
|
+
code;
|
|
16
|
+
biblePath;
|
|
17
|
+
remediation;
|
|
18
|
+
constructor(message, biblePath) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = 'KbBibleError';
|
|
21
|
+
this.code = 'E-BIBLE-MALFORMED';
|
|
22
|
+
this.biblePath = biblePath;
|
|
23
|
+
this.remediation = `Fix or regenerate '${biblePath}' (kb_export writes it), or restore it from git.`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** The tombstone reason a kb_demote produces; the only one that demotes on import. */
|
|
27
|
+
export const TOMBSTONE_DEMOTED = 'demoted';
|
|
28
|
+
/**
|
|
29
|
+
* The tombstones of an already-parsed bible value, in id order and deduped
|
|
30
|
+
* (last wins). Only a v3 envelope may carry them: a legacy bare array or a v2
|
|
31
|
+
* envelope yields none, whatever it holds. Tolerant otherwise: the field is
|
|
32
|
+
* OPTIONAL, and a malformed tombstone is dropped individually rather than
|
|
33
|
+
* failing the whole bible -- exactly how a malformed ENTRY is treated by
|
|
34
|
+
* importBibleEntries below. kb-export.ts's reader calls this too.
|
|
35
|
+
*
|
|
36
|
+
* Each `at` is clamped to `now` (clampBibleTimeToNow): a future-dated tombstone
|
|
37
|
+
* would otherwise become a future demoted_at on import, and every later
|
|
38
|
+
* re-promotion would count as withdrawn against it.
|
|
39
|
+
*/
|
|
40
|
+
export function extractBibleDemotions(parsed, now = new Date()) {
|
|
41
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
42
|
+
return [];
|
|
43
|
+
const doc = parsed;
|
|
44
|
+
if (doc.version !== 3 || !Array.isArray(doc.demotions))
|
|
45
|
+
return [];
|
|
46
|
+
const byId = new Map();
|
|
47
|
+
for (const candidate of doc.demotions) {
|
|
48
|
+
if (!candidate || typeof candidate !== 'object')
|
|
49
|
+
continue;
|
|
50
|
+
const r = candidate;
|
|
51
|
+
if (typeof r.id !== 'string' || r.id.length === 0)
|
|
52
|
+
continue;
|
|
53
|
+
if (typeof r.at !== 'string' || r.at.length === 0)
|
|
54
|
+
continue;
|
|
55
|
+
if (typeof r.reason !== 'string' || r.reason.length === 0)
|
|
56
|
+
continue;
|
|
57
|
+
byId.set(r.id, { id: r.id, at: clampBibleTimeToNow(r.at, now), reason: r.reason });
|
|
58
|
+
}
|
|
59
|
+
return Array.from(byId.values()).sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A bible-carried updated_at, clamped to `now`. A future-dated entry would
|
|
63
|
+
* otherwise outrank every later tombstone under standingAgainstTombstone. An
|
|
64
|
+
* unparseable value is returned unchanged (the standing rule reports it as
|
|
65
|
+
* 'unknown').
|
|
66
|
+
*/
|
|
67
|
+
export function clampBibleTimeToNow(time, now = new Date()) {
|
|
68
|
+
const parsed = Date.parse(time);
|
|
69
|
+
if (Number.isNaN(parsed) || parsed <= now.getTime())
|
|
70
|
+
return time;
|
|
71
|
+
return now.toISOString();
|
|
72
|
+
}
|
|
73
|
+
export function standingAgainstTombstone(trustTime, at) {
|
|
74
|
+
const tombstoneTime = Date.parse(at);
|
|
75
|
+
if (Number.isNaN(tombstoneTime))
|
|
76
|
+
return 'unknown';
|
|
77
|
+
if (trustTime === null)
|
|
78
|
+
return 'withdrawn';
|
|
79
|
+
const rowTime = Date.parse(trustTime);
|
|
80
|
+
if (Number.isNaN(rowTime))
|
|
81
|
+
return 'unknown';
|
|
82
|
+
return rowTime > tombstoneTime ? 'repromoted' : 'withdrawn';
|
|
83
|
+
}
|
|
84
|
+
/** The tombstoned ids of a parsed bible, as a set for membership tests. */
|
|
85
|
+
export function tombstonedIds(demotions) {
|
|
86
|
+
return new Set(demotions.map(d => d.id));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Drop every entry a tombstone names from a raw bible entry array.
|
|
90
|
+
*
|
|
91
|
+
* For the READ paths that build a view of the bible rather than merging it into
|
|
92
|
+
* an existing KB -- the member bible view, which imports into a FRESH empty
|
|
93
|
+
* in-memory provider. There is no local row there for a tombstone to demote, so
|
|
94
|
+
* the demotion can only be honoured by not listing the entry at all.
|
|
95
|
+
*
|
|
96
|
+
* Normally a committed bible holds no entry for a tombstoned id (kb_bible_commit
|
|
97
|
+
* removes it when it records the tombstone), so this is belt-and-braces against
|
|
98
|
+
* a hand-edited or partially merged bible -- the one place where "the file says
|
|
99
|
+
* both" must resolve to the demotion, because a view that lists a demoted entry
|
|
100
|
+
* is exactly the staleness the tombstone exists to stop.
|
|
101
|
+
*
|
|
102
|
+
* Entries too malformed to carry an id are left alone; importBibleEntries
|
|
103
|
+
* already tolerates and skips those.
|
|
104
|
+
*/
|
|
105
|
+
export function excludeTombstonedEntries(entries, demotions) {
|
|
106
|
+
if (demotions.length === 0)
|
|
107
|
+
return entries;
|
|
108
|
+
const dropped = tombstonedIds(demotions);
|
|
109
|
+
return entries.filter(e => {
|
|
110
|
+
if (!e || typeof e !== 'object')
|
|
111
|
+
return true;
|
|
112
|
+
const id = e.id;
|
|
113
|
+
return typeof id !== 'string' || !dropped.has(id);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Read and parse a bible file into its raw entry array. Throws KbBibleError
|
|
118
|
+
* when the file is not valid JSON or not a bible shape. `label` prefixes the
|
|
119
|
+
* error message (e.g. 'kb_import'). A missing file surfaces as the fs error;
|
|
120
|
+
* callers decide whether missing is an error (kb_import) or empty (the view).
|
|
121
|
+
*
|
|
122
|
+
* The bible has THREE on-disk shapes and must accept all of them.
|
|
123
|
+
* v1 (legacy): a bare JSON array of entries.
|
|
124
|
+
* v2: { version, provenance: {commit, branch, entry_count}, entries }
|
|
125
|
+
* v3: the v2 envelope; entries may carry source_file_hashes.
|
|
126
|
+
* Selection is on Array.isArray (v2 and v3 share the envelope). The reader
|
|
127
|
+
* must never lag the writer.
|
|
128
|
+
*/
|
|
129
|
+
export function readBibleEntries(biblePath, label) {
|
|
130
|
+
return readBibleDocument(biblePath, label).entries;
|
|
131
|
+
}
|
|
132
|
+
/** Parse bible text already in memory (e.g. fetched from a remote member). */
|
|
133
|
+
export function parseBibleText(raw, biblePath, label) {
|
|
134
|
+
return parseBibleDocument(raw, biblePath, label).entries;
|
|
135
|
+
}
|
|
136
|
+
/** Entries AND tombstones of a bible file. Same parse, same refusals. */
|
|
137
|
+
export function readBibleDocument(biblePath, label) {
|
|
138
|
+
return parseBibleDocument(fs.readFileSync(biblePath, 'utf-8'), biblePath, label);
|
|
139
|
+
}
|
|
140
|
+
/** Entries AND tombstones of bible text already in memory. */
|
|
141
|
+
export function parseBibleDocument(raw, biblePath, label) {
|
|
142
|
+
if (raw.charCodeAt(0) === 0xfeff)
|
|
143
|
+
raw = raw.slice(1);
|
|
144
|
+
let parsed;
|
|
145
|
+
try {
|
|
146
|
+
parsed = JSON.parse(raw);
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
throw new KbBibleError(`${label}: bible file is not valid JSON: ${biblePath}`, biblePath);
|
|
150
|
+
}
|
|
151
|
+
const entries = Array.isArray(parsed)
|
|
152
|
+
? parsed
|
|
153
|
+
: (parsed && typeof parsed === 'object' && Array.isArray(parsed.entries))
|
|
154
|
+
? parsed.entries
|
|
155
|
+
: null;
|
|
156
|
+
if (entries === null) {
|
|
157
|
+
throw new KbBibleError(`${label}: bible file is not a JSON array of entries: ${biblePath}`, biblePath);
|
|
158
|
+
}
|
|
159
|
+
// A legacy bare array carries no demotions field; extract returns [] for it.
|
|
160
|
+
return { entries, demotions: extractBibleDemotions(parsed) };
|
|
161
|
+
}
|
|
162
|
+
const VALID_TYPES = ['context-cache', 'learning', 'knowledge', 'runbook', 'user-directive'];
|
|
163
|
+
const VALID_CONFIDENCE = ['CONFIRMED', 'INFERRED', 'UNVERIFIED'];
|
|
164
|
+
/**
|
|
165
|
+
* The basis a v3 bible entry carries, or null when it carries none or an
|
|
166
|
+
* invalid one. Valid means: a plain object, at least one key, every key
|
|
167
|
+
* repo-relative (isRepoRelativePath), every value a non-empty string, and
|
|
168
|
+
* every cited source_file present as a key. Anything else gets no verified
|
|
169
|
+
* basis -- never a partial carried map: capture() then stores a LOCAL
|
|
170
|
+
* freshness-only basis that is never exported or used for bible admission.
|
|
171
|
+
*/
|
|
172
|
+
export function carriedBasisOf(entry) {
|
|
173
|
+
const raw = entry.source_file_hashes;
|
|
174
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
175
|
+
return null;
|
|
176
|
+
const map = raw;
|
|
177
|
+
const keys = Object.keys(map);
|
|
178
|
+
if (keys.length === 0)
|
|
179
|
+
return null;
|
|
180
|
+
const out = {};
|
|
181
|
+
for (const key of keys.sort()) {
|
|
182
|
+
if (!isRepoRelativePath(key))
|
|
183
|
+
return null;
|
|
184
|
+
const value = map[key];
|
|
185
|
+
if (typeof value !== 'string' || value.length === 0)
|
|
186
|
+
return null;
|
|
187
|
+
out[key] = value;
|
|
188
|
+
}
|
|
189
|
+
const files = Array.isArray(entry.source_files) ? entry.source_files : [];
|
|
190
|
+
for (const file of files) {
|
|
191
|
+
if (typeof file !== 'string' || !Object.prototype.hasOwnProperty.call(out, file))
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
return out;
|
|
195
|
+
}
|
|
196
|
+
// Validate a single parsed bible entry against the exported CanonicalEntry field
|
|
197
|
+
// set {id, type, title, summary, symbols, source_files, confidence, updated_at}
|
|
198
|
+
// (KB b9df569a -- NOTE: no content field). Malformed entries are tolerated and
|
|
199
|
+
// skipped individually rather than aborting the whole import.
|
|
200
|
+
function isValidBibleEntry(e) {
|
|
201
|
+
if (!e || typeof e !== 'object')
|
|
202
|
+
return false;
|
|
203
|
+
const r = e;
|
|
204
|
+
if (typeof r.id !== 'string' || r.id.length === 0)
|
|
205
|
+
return false;
|
|
206
|
+
if (typeof r.type !== 'string' || !VALID_TYPES.includes(r.type))
|
|
207
|
+
return false;
|
|
208
|
+
if (typeof r.title !== 'string' || r.title.length === 0)
|
|
209
|
+
return false;
|
|
210
|
+
if (typeof r.summary !== 'string' || r.summary.length === 0)
|
|
211
|
+
return false;
|
|
212
|
+
if (typeof r.confidence !== 'string' || !VALID_CONFIDENCE.includes(r.confidence))
|
|
213
|
+
return false;
|
|
214
|
+
if (r.symbols !== undefined && !Array.isArray(r.symbols))
|
|
215
|
+
return false;
|
|
216
|
+
if (r.source_files !== undefined && !Array.isArray(r.source_files))
|
|
217
|
+
return false;
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
// LOW-2: bible entries carry no content field, so synthesize content
|
|
221
|
+
// DETERMINISTICALLY from the summary. Determinism matters twice: (1) a re-import
|
|
222
|
+
// of the same bible produces byte-identical content so AUDN's content-equality
|
|
223
|
+
// 'none' path can dedupe an id-collision-with-identical-content case; (2) it
|
|
224
|
+
// keeps import a pure function of the bible file.
|
|
225
|
+
function synthesizeContent(entry) {
|
|
226
|
+
return entry.summary;
|
|
227
|
+
}
|
|
228
|
+
export async function importBibleEntries(provider, bibleEntries, options = {}) {
|
|
229
|
+
let imported = 0;
|
|
230
|
+
let skipped = 0;
|
|
231
|
+
let linked = 0;
|
|
232
|
+
let flagged = 0;
|
|
233
|
+
let rejected = 0;
|
|
234
|
+
let demoted = 0;
|
|
235
|
+
// A bible that carries BOTH an entry and a tombstone for the same id is
|
|
236
|
+
// self-contradictory, and "the file says both" must resolve to the DEMOTION
|
|
237
|
+
// -- the same rule the member bible view applies (excludeTombstonedEntries is
|
|
238
|
+
// called at member-bible-view.ts buildView for the local and the remote path).
|
|
239
|
+
// Without this filter a tombstoned id with NO local row is CREATED by the
|
|
240
|
+
// entry loop below, because the tombstone loop never creates a row: the import
|
|
241
|
+
// would resurrect, as a fresh CONFIRMED row, exactly the entry the tombstone
|
|
242
|
+
// withdrew trust from. A freshly imported row's created_at is import time, not
|
|
243
|
+
// evidence that the id was re-promoted after the tombstone, so the tombstone
|
|
244
|
+
// loop cannot undo it either.
|
|
245
|
+
//
|
|
246
|
+
// For every bible kb_bible_commit actually writes this is a no-op: recording a
|
|
247
|
+
// tombstone removes the entry. It is belt-and-braces against a hand-edited or
|
|
248
|
+
// partially merged bible.
|
|
249
|
+
const importable = excludeTombstonedEntries(bibleEntries, options.demotions ?? []);
|
|
250
|
+
for (const candidate of importable) {
|
|
251
|
+
// Malformed entry -> tolerate and skip individually.
|
|
252
|
+
if (!isValidBibleEntry(candidate)) {
|
|
253
|
+
skipped++;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const entry = candidate;
|
|
257
|
+
// ORDER OF OPERATIONS (LOW-2): id-exists check FIRST, before capture()/AUDN.
|
|
258
|
+
// This is what makes re-import EXACT even for symbol-less/file-less entries
|
|
259
|
+
// AUDN can never dedupe.
|
|
260
|
+
if (provider.hasEntry(entry.id)) {
|
|
261
|
+
skipped++;
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
const kbInput = {
|
|
265
|
+
type: entry.type,
|
|
266
|
+
title: entry.title,
|
|
267
|
+
summary: entry.summary,
|
|
268
|
+
content: synthesizeContent(entry),
|
|
269
|
+
source_files: entry.source_files ?? [],
|
|
270
|
+
symbols: entry.symbols ?? [],
|
|
271
|
+
tags: [],
|
|
272
|
+
content_hash: '',
|
|
273
|
+
content_hash_type: 'sha256',
|
|
274
|
+
flagged_for_review: false,
|
|
275
|
+
// Bible entries carry no author; the trusted channel is the provenance.
|
|
276
|
+
author: 'unknown',
|
|
277
|
+
source: 'import',
|
|
278
|
+
confidence: entry.confidence,
|
|
279
|
+
scope: 'project',
|
|
280
|
+
};
|
|
281
|
+
// Route through the AUDN choke point with the INTERNAL import mode and the
|
|
282
|
+
// preserved bible id. A user-directive is still forced through the directive
|
|
283
|
+
// gate (pending proposal) INSIDE capture() -- import mode does not bypass it.
|
|
284
|
+
// KB-TRUST PHASE 1: isolate each entry so one unfalsifiable bible entry is
|
|
285
|
+
// counted and the import continues, rather than aborting every entry after
|
|
286
|
+
// it. Import mode exempts the confidence clamp, never the basis check.
|
|
287
|
+
//
|
|
288
|
+
// Bible format v3: the entry's carried basis is stored EXACTLY (capture
|
|
289
|
+
// does not hash this clone's files for it). A v1/v2 entry, or one whose
|
|
290
|
+
// carried map is invalid (carriedBasis null), gets a LOCAL freshness-only
|
|
291
|
+
// basis hashed from this clone: it can go stale when code drifts, but the
|
|
292
|
+
// bible predicate never sees it, so the entry is not re-exported until it
|
|
293
|
+
// is recaptured.
|
|
294
|
+
let audn_decision;
|
|
295
|
+
try {
|
|
296
|
+
({ audn_decision } = await provider.capture(kbInput, {
|
|
297
|
+
importMode: true,
|
|
298
|
+
preferredId: entry.id,
|
|
299
|
+
verbatim: options.verbatim === true,
|
|
300
|
+
carriedBasis: carriedBasisOf(entry),
|
|
301
|
+
carriedUpdatedAt: typeof entry.updated_at === 'string' && entry.updated_at.length > 0 ? clampBibleTimeToNow(entry.updated_at) : undefined,
|
|
302
|
+
}));
|
|
303
|
+
}
|
|
304
|
+
catch (err) {
|
|
305
|
+
if (err instanceof KbCaptureRejected) {
|
|
306
|
+
rejected++;
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
throw err;
|
|
310
|
+
}
|
|
311
|
+
if (audn_decision === 'add')
|
|
312
|
+
imported++;
|
|
313
|
+
else if (audn_decision === 'none')
|
|
314
|
+
skipped++;
|
|
315
|
+
// AUDN 'update' means the entry was linked to a same-topic predecessor and
|
|
316
|
+
// BOTH stay live -- supersede is opt-in (input.supersedes) and kb_import
|
|
317
|
+
// never sets it, because a bible authored on another branch cannot name a
|
|
318
|
+
// local entry's id. Counting these as "superseded" reported a retirement
|
|
319
|
+
// that never happened.
|
|
320
|
+
else if (audn_decision === 'update')
|
|
321
|
+
linked++;
|
|
322
|
+
else if (audn_decision === 'flagged')
|
|
323
|
+
flagged++;
|
|
324
|
+
}
|
|
325
|
+
// TOMBSTONES, applied AFTER the entry loop. The entry loop can no longer have
|
|
326
|
+
// introduced a row for any id named here -- those entries were filtered out
|
|
327
|
+
// above -- so this loop only ever judges rows that ALREADY existed locally,
|
|
328
|
+
// which is the only population a tombstone is allowed to act on. The provider
|
|
329
|
+
// holds every rule -- never create, standingAgainstTombstone, no ownerTag
|
|
330
|
+
// check -- in applyBibleDemotion; this loop only counts what it changed.
|
|
331
|
+
// Only a 'demoted' tombstone lowers a row: another removal reason keeps the
|
|
332
|
+
// entry out of the bible without saying anything about this clone's trust.
|
|
333
|
+
//
|
|
334
|
+
// Note what is NOT here: nothing walks the local rows looking for ids missing
|
|
335
|
+
// from the bible. Only an id with an EXPLICIT tombstone is ever touched.
|
|
336
|
+
for (const tombstone of options.demotions ?? []) {
|
|
337
|
+
if (tombstone.reason !== TOMBSTONE_DEMOTED)
|
|
338
|
+
continue;
|
|
339
|
+
if (provider.applyBibleDemotion(tombstone.id, tombstone.at))
|
|
340
|
+
demoted++;
|
|
341
|
+
}
|
|
342
|
+
return { imported, skipped, linked, flagged, rejected, demoted };
|
|
343
|
+
}
|
|
344
|
+
//# sourceMappingURL=bible-import.js.map
|
|
@@ -8,4 +8,35 @@ export declare function computeFileHashBatch(filePaths: string[], opts?: {
|
|
|
8
8
|
cwd?: string;
|
|
9
9
|
}): Promise<Record<string, FileHashResult | null>>;
|
|
10
10
|
export declare function checkStaleness(entry: KBEntry): Promise<StalenessResult>;
|
|
11
|
+
/**
|
|
12
|
+
* The repo folder a HEAD-anchored hash was asked for is not inside a git work
|
|
13
|
+
* tree. Thrown instead of silently falling back to hashing files on disk:
|
|
14
|
+
* a disk hash is a working-tree hash, not a branch-HEAD hash.
|
|
15
|
+
*/
|
|
16
|
+
export declare class KbHeadHashError extends Error {
|
|
17
|
+
readonly code: "E-BIBLE-BASIS-NOT-GIT";
|
|
18
|
+
readonly folder: string;
|
|
19
|
+
readonly remediation: string;
|
|
20
|
+
constructor(folder: string, detail: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Hash each file's content AT THE WORK TREE'S HEAD COMMIT (not the file on
|
|
24
|
+
* disk), keyed by the original path strings. Relative paths resolve against
|
|
25
|
+
* `cwd`, exactly as computeFileHashBatch({ cwd }) resolves them.
|
|
26
|
+
*
|
|
27
|
+
* Digest: the git blob id of HEAD:<path>. That is the same digest the stored
|
|
28
|
+
* basis carries -- computeFileHashBatch runs `git hash-object <file>`, which
|
|
29
|
+
* applies the same clean filters as `git add`, so a file whose on-disk content
|
|
30
|
+
* equals its HEAD content hashes to the HEAD blob id. Uncommitted edits
|
|
31
|
+
* therefore never change the result.
|
|
32
|
+
*
|
|
33
|
+
* A file absent at HEAD (untracked, deleted, a directory, a submodule) maps to
|
|
34
|
+
* null. An unborn HEAD (no commit yet) maps every file to null. A `cwd` that is
|
|
35
|
+
* not inside a git work tree throws KbHeadHashError -- never a disk fallback.
|
|
36
|
+
* Absolute paths are not supported (they map to null): HEAD content is only
|
|
37
|
+
* addressable repo-relatively.
|
|
38
|
+
*/
|
|
39
|
+
export declare function computeHeadFileHashBatch(filePaths: string[], opts: {
|
|
40
|
+
cwd: string;
|
|
41
|
+
}): Promise<Record<string, FileHashResult | null>>;
|
|
11
42
|
//# sourceMappingURL=file-hash.d.ts.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { execFile } from 'node:child_process';
|
|
1
|
+
import { execFile, spawn } from 'node:child_process';
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
+
import { logWarn } from '../../utils/log-helpers.js';
|
|
6
|
+
import { gitExecutable } from '../../os/git-executable.js';
|
|
5
7
|
// T3.1 (D4 fold-in, Phase 2 review MEDIUM yashr-d8b): computeFileHashBatch
|
|
6
8
|
// gains an optional { cwd } anchor so a caller resolving a bible/basis against
|
|
7
9
|
// a DIFFERENT repo root (e.g. kb_import's --repo) never needs to mutate the
|
|
@@ -14,7 +16,7 @@ import path from 'node:path';
|
|
|
14
16
|
// (implicit process.cwd() resolution via fs/execFile defaults).
|
|
15
17
|
function execFileAsync(cmd, args, opts) {
|
|
16
18
|
return new Promise((resolve, reject) => {
|
|
17
|
-
execFile(cmd, args, opts
|
|
19
|
+
execFile(cmd, args, { ...opts, windowsHide: true }, (err, stdout, stderr) => {
|
|
18
20
|
if (err)
|
|
19
21
|
reject(err);
|
|
20
22
|
else
|
|
@@ -30,7 +32,7 @@ export async function computeFileHash(filePath) {
|
|
|
30
32
|
if (!fs.existsSync(filePath))
|
|
31
33
|
return null;
|
|
32
34
|
try {
|
|
33
|
-
const { stdout } = await execFileAsync(
|
|
35
|
+
const { stdout } = await execFileAsync(gitExecutable(), ['hash-object', filePath]);
|
|
34
36
|
const hash = stdout.trim();
|
|
35
37
|
if (hash.length > 0) {
|
|
36
38
|
return { hash, type: 'git' };
|
|
@@ -57,35 +59,65 @@ export async function computeFileHashBatch(filePaths, opts) {
|
|
|
57
59
|
}
|
|
58
60
|
if (existing.length === 0)
|
|
59
61
|
return result;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
// One `git hash-object` per chunk, each kept under HASH_ARGV_CHAR_BUDGET:
|
|
63
|
+
// a single argv holding every path overflowed the Windows command-line limit
|
|
64
|
+
// (32767 chars) for large bibles / long checkout paths, git failed, and the
|
|
65
|
+
// sha256 fallback below then never matched the stored git-type basis -- so
|
|
66
|
+
// freshnessSweep silently staled EVERY entry.
|
|
67
|
+
for (const chunk of chunkByArgvLength(existing, resolvePath)) {
|
|
68
|
+
let gitSucceeded = false;
|
|
69
|
+
try {
|
|
70
|
+
const { stdout } = await execFileAsync(gitExecutable(), ['hash-object', ...chunk.map(resolvePath)], root ? { cwd: root } : undefined);
|
|
71
|
+
const lines = stdout.trim().split('\n');
|
|
72
|
+
if (lines.length === chunk.length) {
|
|
73
|
+
for (let i = 0; i < chunk.length; i++) {
|
|
74
|
+
const hash = lines[i].trim();
|
|
75
|
+
if (hash.length > 0) {
|
|
76
|
+
result[chunk[i]] = { hash, type: 'git' };
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
result[chunk[i]] = { hash: sha256File(resolvePath(chunk[i])), type: 'sha256' };
|
|
80
|
+
}
|
|
72
81
|
}
|
|
82
|
+
gitSucceeded = true;
|
|
73
83
|
}
|
|
74
|
-
gitSucceeded = true;
|
|
75
84
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
result[p]
|
|
85
|
+
catch (err) {
|
|
86
|
+
// Not silent: a sha256 fallback cannot match a git-type basis, so every
|
|
87
|
+
// entry citing these files will look stale until git hashing works again.
|
|
88
|
+
logWarn('kb_hash', `git hash-object failed for ${chunk.length} file(s); falling back to sha256, so freshness checks against git-type bases will report them stale: ${err?.message ?? String(err)}`);
|
|
89
|
+
}
|
|
90
|
+
if (!gitSucceeded) {
|
|
91
|
+
for (const p of chunk) {
|
|
92
|
+
if (!result[p]) {
|
|
93
|
+
result[p] = { hash: sha256File(resolvePath(p)), type: 'sha256' };
|
|
94
|
+
}
|
|
84
95
|
}
|
|
85
96
|
}
|
|
86
97
|
}
|
|
87
98
|
return result;
|
|
88
99
|
}
|
|
100
|
+
// Well under the Windows 32767-char command-line limit (and POSIX ARG_MAX),
|
|
101
|
+
// leaving room for the executable path and quoting overhead.
|
|
102
|
+
const HASH_ARGV_CHAR_BUDGET = 8000;
|
|
103
|
+
function chunkByArgvLength(paths, resolvePath) {
|
|
104
|
+
const chunks = [];
|
|
105
|
+
let current = [];
|
|
106
|
+
let length = 0;
|
|
107
|
+
for (const p of paths) {
|
|
108
|
+
const cost = resolvePath(p).length + 3; // separator + possible quotes
|
|
109
|
+
if (current.length > 0 && length + cost > HASH_ARGV_CHAR_BUDGET) {
|
|
110
|
+
chunks.push(current);
|
|
111
|
+
current = [];
|
|
112
|
+
length = 0;
|
|
113
|
+
}
|
|
114
|
+
current.push(p);
|
|
115
|
+
length += cost;
|
|
116
|
+
}
|
|
117
|
+
if (current.length > 0)
|
|
118
|
+
chunks.push(current);
|
|
119
|
+
return chunks;
|
|
120
|
+
}
|
|
89
121
|
export async function checkStaleness(entry) {
|
|
90
122
|
if (entry.type !== 'context-cache')
|
|
91
123
|
return { stale: false };
|
|
@@ -120,4 +152,103 @@ export async function checkStaleness(entry) {
|
|
|
120
152
|
throw err;
|
|
121
153
|
}
|
|
122
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* The repo folder a HEAD-anchored hash was asked for is not inside a git work
|
|
157
|
+
* tree. Thrown instead of silently falling back to hashing files on disk:
|
|
158
|
+
* a disk hash is a working-tree hash, not a branch-HEAD hash.
|
|
159
|
+
*/
|
|
160
|
+
export class KbHeadHashError extends Error {
|
|
161
|
+
code = 'E-BIBLE-BASIS-NOT-GIT';
|
|
162
|
+
folder;
|
|
163
|
+
remediation;
|
|
164
|
+
constructor(folder, detail) {
|
|
165
|
+
const remediation = `Run this from a git checkout ('git init' or clone the repository into '${folder}').`;
|
|
166
|
+
super(`E-BIBLE-BASIS-NOT-GIT: '${folder}' is not inside a git work tree, so file content at HEAD cannot be read (${detail}). Remediation: ${remediation}`);
|
|
167
|
+
this.name = 'KbHeadHashError';
|
|
168
|
+
this.folder = folder;
|
|
169
|
+
this.remediation = remediation;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function gitWithStdin(args, cwd, input) {
|
|
173
|
+
return new Promise((resolve, reject) => {
|
|
174
|
+
const child = spawn(gitExecutable(), args, { cwd, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
|
|
175
|
+
const out = [];
|
|
176
|
+
const err = [];
|
|
177
|
+
child.stdout.on('data', (d) => out.push(d));
|
|
178
|
+
child.stderr.on('data', (d) => err.push(d));
|
|
179
|
+
child.on('error', reject);
|
|
180
|
+
child.on('close', code => {
|
|
181
|
+
if (code === 0)
|
|
182
|
+
resolve(Buffer.concat(out).toString('utf-8'));
|
|
183
|
+
else
|
|
184
|
+
reject(new Error(`git ${args.join(' ')} exited ${code}: ${Buffer.concat(err).toString('utf-8').trim()}`));
|
|
185
|
+
});
|
|
186
|
+
child.stdin.end(input);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Hash each file's content AT THE WORK TREE'S HEAD COMMIT (not the file on
|
|
191
|
+
* disk), keyed by the original path strings. Relative paths resolve against
|
|
192
|
+
* `cwd`, exactly as computeFileHashBatch({ cwd }) resolves them.
|
|
193
|
+
*
|
|
194
|
+
* Digest: the git blob id of HEAD:<path>. That is the same digest the stored
|
|
195
|
+
* basis carries -- computeFileHashBatch runs `git hash-object <file>`, which
|
|
196
|
+
* applies the same clean filters as `git add`, so a file whose on-disk content
|
|
197
|
+
* equals its HEAD content hashes to the HEAD blob id. Uncommitted edits
|
|
198
|
+
* therefore never change the result.
|
|
199
|
+
*
|
|
200
|
+
* A file absent at HEAD (untracked, deleted, a directory, a submodule) maps to
|
|
201
|
+
* null. An unborn HEAD (no commit yet) maps every file to null. A `cwd` that is
|
|
202
|
+
* not inside a git work tree throws KbHeadHashError -- never a disk fallback.
|
|
203
|
+
* Absolute paths are not supported (they map to null): HEAD content is only
|
|
204
|
+
* addressable repo-relatively.
|
|
205
|
+
*/
|
|
206
|
+
export async function computeHeadFileHashBatch(filePaths, opts) {
|
|
207
|
+
const result = {};
|
|
208
|
+
const cwd = opts.cwd;
|
|
209
|
+
// The git check runs even for an empty list, so a caller in a non-git
|
|
210
|
+
// folder always fails loud rather than quietly admitting nothing.
|
|
211
|
+
let prefix;
|
|
212
|
+
try {
|
|
213
|
+
const { stdout } = await execFileAsync(gitExecutable(), ['rev-parse', '--is-inside-work-tree', '--show-prefix'], { cwd });
|
|
214
|
+
const lines = stdout.split('\n');
|
|
215
|
+
if (lines[0].trim() !== 'true')
|
|
216
|
+
throw new Error('not inside a work tree');
|
|
217
|
+
prefix = (lines[1] ?? '').trim();
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
throw new KbHeadHashError(cwd, err?.message ?? String(err));
|
|
221
|
+
}
|
|
222
|
+
if (filePaths.length === 0)
|
|
223
|
+
return result;
|
|
224
|
+
for (const p of filePaths)
|
|
225
|
+
result[p] = null;
|
|
226
|
+
try {
|
|
227
|
+
await execFileAsync(gitExecutable(), ['rev-parse', '--verify', '--quiet', 'HEAD^{commit}'], { cwd });
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
return result; // unborn HEAD: nothing is committed, so nothing matches
|
|
231
|
+
}
|
|
232
|
+
const queried = [];
|
|
233
|
+
const lines = [];
|
|
234
|
+
for (const p of filePaths) {
|
|
235
|
+
if (typeof p !== 'string' || p.length === 0 || /[\r\n]/.test(p) || path.isAbsolute(p) || path.win32.isAbsolute(p))
|
|
236
|
+
continue;
|
|
237
|
+
const rel = path.posix.normalize(prefix + p.replace(/\\/g, '/'));
|
|
238
|
+
if (rel.startsWith('../') || rel === '..' || rel === '.')
|
|
239
|
+
continue;
|
|
240
|
+
queried.push(p);
|
|
241
|
+
lines.push('HEAD:' + rel);
|
|
242
|
+
}
|
|
243
|
+
if (queried.length === 0)
|
|
244
|
+
return result;
|
|
245
|
+
const stdout = await gitWithStdin(['cat-file', '--batch-check=%(objectname) %(objecttype)'], cwd, lines.join('\n') + '\n');
|
|
246
|
+
const outLines = stdout.split('\n');
|
|
247
|
+
for (let i = 0; i < queried.length; i++) {
|
|
248
|
+
const [oid, type] = (outLines[i] ?? '').trim().split(' ');
|
|
249
|
+
if (type === 'blob' && /^[0-9a-f]{40,64}$/.test(oid))
|
|
250
|
+
result[queried[i]] = { hash: oid, type: 'git' };
|
|
251
|
+
}
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
123
254
|
//# sourceMappingURL=file-hash.js.map
|