@software-dlc/cli 0.157.2
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/CHANGELOG.md +11 -0
- package/LICENSE +105 -0
- package/README.md +31 -0
- package/dist/checkout.d.ts +43 -0
- package/dist/checkout.d.ts.map +1 -0
- package/dist/checkout.js +92 -0
- package/dist/checkout.js.map +1 -0
- package/dist/cli-arguments.d.ts +13 -0
- package/dist/cli-arguments.d.ts.map +1 -0
- package/dist/cli-arguments.js +67 -0
- package/dist/cli-arguments.js.map +1 -0
- package/dist/cli-branch-history.d.ts +48 -0
- package/dist/cli-branch-history.d.ts.map +1 -0
- package/dist/cli-branch-history.js +319 -0
- package/dist/cli-branch-history.js.map +1 -0
- package/dist/cli-branches.d.ts +22 -0
- package/dist/cli-branches.d.ts.map +1 -0
- package/dist/cli-branches.js +59 -0
- package/dist/cli-branches.js.map +1 -0
- package/dist/cli-deploy.d.ts +14 -0
- package/dist/cli-deploy.d.ts.map +1 -0
- package/dist/cli-deploy.js +164 -0
- package/dist/cli-deploy.js.map +1 -0
- package/dist/cli-health.d.ts +3 -0
- package/dist/cli-health.d.ts.map +1 -0
- package/dist/cli-health.js +73 -0
- package/dist/cli-health.js.map +1 -0
- package/dist/cli-help.d.ts +21 -0
- package/dist/cli-help.d.ts.map +1 -0
- package/dist/cli-help.js +176 -0
- package/dist/cli-help.js.map +1 -0
- package/dist/cli-login.d.ts +76 -0
- package/dist/cli-login.d.ts.map +1 -0
- package/dist/cli-login.js +634 -0
- package/dist/cli-login.js.map +1 -0
- package/dist/cli-operation.d.ts +2 -0
- package/dist/cli-operation.d.ts.map +1 -0
- package/dist/cli-operation.js +66 -0
- package/dist/cli-operation.js.map +1 -0
- package/dist/cli-org.d.ts +12 -0
- package/dist/cli-org.d.ts.map +1 -0
- package/dist/cli-org.js +218 -0
- package/dist/cli-org.js.map +1 -0
- package/dist/cli-rebuild.d.ts +20 -0
- package/dist/cli-rebuild.d.ts.map +1 -0
- package/dist/cli-rebuild.js +29 -0
- package/dist/cli-rebuild.js.map +1 -0
- package/dist/cli-reset.d.ts +27 -0
- package/dist/cli-reset.d.ts.map +1 -0
- package/dist/cli-reset.js +44 -0
- package/dist/cli-reset.js.map +1 -0
- package/dist/cli-snapshot.d.ts +398 -0
- package/dist/cli-snapshot.d.ts.map +1 -0
- package/dist/cli-snapshot.js +45 -0
- package/dist/cli-snapshot.js.map +1 -0
- package/dist/cli-task-context.d.ts +3 -0
- package/dist/cli-task-context.d.ts.map +1 -0
- package/dist/cli-task-context.js +112 -0
- package/dist/cli-task-context.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1004 -0
- package/dist/cli.js.map +1 -0
- package/dist/graph-packages-lock.d.ts +169 -0
- package/dist/graph-packages-lock.d.ts.map +1 -0
- package/dist/graph-packages-lock.js +503 -0
- package/dist/graph-packages-lock.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/local/aggregate-preflight.d.ts +12 -0
- package/dist/local/aggregate-preflight.d.ts.map +1 -0
- package/dist/local/aggregate-preflight.js +22 -0
- package/dist/local/aggregate-preflight.js.map +1 -0
- package/dist/local/allow-mcp.d.ts +77 -0
- package/dist/local/allow-mcp.d.ts.map +1 -0
- package/dist/local/allow-mcp.js +394 -0
- package/dist/local/allow-mcp.js.map +1 -0
- package/dist/local/api-client.d.ts +15 -0
- package/dist/local/api-client.d.ts.map +1 -0
- package/dist/local/api-client.js +87 -0
- package/dist/local/api-client.js.map +1 -0
- package/dist/local/app-contract-readers.d.ts +229 -0
- package/dist/local/app-contract-readers.d.ts.map +1 -0
- package/dist/local/app-contract-readers.js +450 -0
- package/dist/local/app-contract-readers.js.map +1 -0
- package/dist/local/app-org-reader.d.ts +21 -0
- package/dist/local/app-org-reader.d.ts.map +1 -0
- package/dist/local/app-org-reader.js +66 -0
- package/dist/local/app-org-reader.js.map +1 -0
- package/dist/local/app-shell-readers.d.ts +96 -0
- package/dist/local/app-shell-readers.d.ts.map +1 -0
- package/dist/local/app-shell-readers.js +381 -0
- package/dist/local/app-shell-readers.js.map +1 -0
- package/dist/local/app-tasks-read.d.ts +202 -0
- package/dist/local/app-tasks-read.d.ts.map +1 -0
- package/dist/local/app-tasks-read.js +290 -0
- package/dist/local/app-tasks-read.js.map +1 -0
- package/dist/local/app-worktrees.d.ts +69 -0
- package/dist/local/app-worktrees.d.ts.map +1 -0
- package/dist/local/app-worktrees.js +554 -0
- package/dist/local/app-worktrees.js.map +1 -0
- package/dist/local/base-sync-manifest.d.ts +12 -0
- package/dist/local/base-sync-manifest.d.ts.map +1 -0
- package/dist/local/base-sync-manifest.js +57 -0
- package/dist/local/base-sync-manifest.js.map +1 -0
- package/dist/local/blast-radius.d.ts +191 -0
- package/dist/local/blast-radius.d.ts.map +1 -0
- package/dist/local/blast-radius.js +585 -0
- package/dist/local/blast-radius.js.map +1 -0
- package/dist/local/canonical.d.ts +2 -0
- package/dist/local/canonical.d.ts.map +1 -0
- package/dist/local/canonical.js +2 -0
- package/dist/local/canonical.js.map +1 -0
- package/dist/local/config.d.ts +22 -0
- package/dist/local/config.d.ts.map +1 -0
- package/dist/local/config.js +57 -0
- package/dist/local/config.js.map +1 -0
- package/dist/local/document-commands.d.ts +163 -0
- package/dist/local/document-commands.d.ts.map +1 -0
- package/dist/local/document-commands.js +620 -0
- package/dist/local/document-commands.js.map +1 -0
- package/dist/local/document-embeds.d.ts +21 -0
- package/dist/local/document-embeds.d.ts.map +1 -0
- package/dist/local/document-embeds.js +38 -0
- package/dist/local/document-embeds.js.map +1 -0
- package/dist/local/environment-context.d.ts +39 -0
- package/dist/local/environment-context.d.ts.map +1 -0
- package/dist/local/environment-context.js +193 -0
- package/dist/local/environment-context.js.map +1 -0
- package/dist/local/environment-exclude.d.ts +7 -0
- package/dist/local/environment-exclude.d.ts.map +1 -0
- package/dist/local/environment-exclude.js +82 -0
- package/dist/local/environment-exclude.js.map +1 -0
- package/dist/local/environment-sidecar.d.ts +126 -0
- package/dist/local/environment-sidecar.d.ts.map +1 -0
- package/dist/local/environment-sidecar.js +442 -0
- package/dist/local/environment-sidecar.js.map +1 -0
- package/dist/local/environment-switch.d.ts +22 -0
- package/dist/local/environment-switch.d.ts.map +1 -0
- package/dist/local/environment-switch.js +385 -0
- package/dist/local/environment-switch.js.map +1 -0
- package/dist/local/exact-remote-projection.d.ts +17 -0
- package/dist/local/exact-remote-projection.d.ts.map +1 -0
- package/dist/local/exact-remote-projection.js +53 -0
- package/dist/local/exact-remote-projection.js.map +1 -0
- package/dist/local/experimental/path-object-store.d.ts +66 -0
- package/dist/local/experimental/path-object-store.d.ts.map +1 -0
- package/dist/local/experimental/path-object-store.js +135 -0
- package/dist/local/experimental/path-object-store.js.map +1 -0
- package/dist/local/external-worktree-binding.d.ts +21 -0
- package/dist/local/external-worktree-binding.d.ts.map +1 -0
- package/dist/local/external-worktree-binding.js +56 -0
- package/dist/local/external-worktree-binding.js.map +1 -0
- package/dist/local/folder-members.d.ts +34 -0
- package/dist/local/folder-members.d.ts.map +1 -0
- package/dist/local/folder-members.js +168 -0
- package/dist/local/folder-members.js.map +1 -0
- package/dist/local/git-ref-authority.d.ts +11 -0
- package/dist/local/git-ref-authority.d.ts.map +1 -0
- package/dist/local/git-ref-authority.js +76 -0
- package/dist/local/git-ref-authority.js.map +1 -0
- package/dist/local/git.d.ts +88 -0
- package/dist/local/git.d.ts.map +1 -0
- package/dist/local/git.js +413 -0
- package/dist/local/git.js.map +1 -0
- package/dist/local/graph-read.d.ts +168 -0
- package/dist/local/graph-read.d.ts.map +1 -0
- package/dist/local/graph-read.js +360 -0
- package/dist/local/graph-read.js.map +1 -0
- package/dist/local/graph-sync.d.ts +39 -0
- package/dist/local/graph-sync.d.ts.map +1 -0
- package/dist/local/graph-sync.js +186 -0
- package/dist/local/graph-sync.js.map +1 -0
- package/dist/local/guide-commands.d.ts +79 -0
- package/dist/local/guide-commands.d.ts.map +1 -0
- package/dist/local/guide-commands.js +247 -0
- package/dist/local/guide-commands.js.map +1 -0
- package/dist/local/health-files.d.ts +24 -0
- package/dist/local/health-files.d.ts.map +1 -0
- package/dist/local/health-files.js +133 -0
- package/dist/local/health-files.js.map +1 -0
- package/dist/local/health-inspection.d.ts +12 -0
- package/dist/local/health-inspection.d.ts.map +1 -0
- package/dist/local/health-inspection.js +407 -0
- package/dist/local/health-inspection.js.map +1 -0
- package/dist/local/health-policy.d.ts +11 -0
- package/dist/local/health-policy.d.ts.map +1 -0
- package/dist/local/health-policy.js +257 -0
- package/dist/local/health-policy.js.map +1 -0
- package/dist/local/health-projection.d.ts +14 -0
- package/dist/local/health-projection.d.ts.map +1 -0
- package/dist/local/health-projection.js +102 -0
- package/dist/local/health-projection.js.map +1 -0
- package/dist/local/health-schema.d.ts +338 -0
- package/dist/local/health-schema.d.ts.map +1 -0
- package/dist/local/health-schema.js +213 -0
- package/dist/local/health-schema.js.map +1 -0
- package/dist/local/health-store.d.ts +61 -0
- package/dist/local/health-store.d.ts.map +1 -0
- package/dist/local/health-store.js +218 -0
- package/dist/local/health-store.js.map +1 -0
- package/dist/local/index.d.ts +66 -0
- package/dist/local/index.d.ts.map +1 -0
- package/dist/local/index.js +66 -0
- package/dist/local/index.js.map +1 -0
- package/dist/local/journey-commands.d.ts +65 -0
- package/dist/local/journey-commands.d.ts.map +1 -0
- package/dist/local/journey-commands.js +138 -0
- package/dist/local/journey-commands.js.map +1 -0
- package/dist/local/local-org-store.d.ts +46 -0
- package/dist/local/local-org-store.d.ts.map +1 -0
- package/dist/local/local-org-store.js +132 -0
- package/dist/local/local-org-store.js.map +1 -0
- package/dist/local/local-org.d.ts +389 -0
- package/dist/local/local-org.d.ts.map +1 -0
- package/dist/local/local-org.js +855 -0
- package/dist/local/local-org.js.map +1 -0
- package/dist/local/media-upload.d.ts +5 -0
- package/dist/local/media-upload.d.ts.map +1 -0
- package/dist/local/media-upload.js +41 -0
- package/dist/local/media-upload.js.map +1 -0
- package/dist/local/operation.d.ts +155 -0
- package/dist/local/operation.d.ts.map +1 -0
- package/dist/local/operation.js +340 -0
- package/dist/local/operation.js.map +1 -0
- package/dist/local/ownership-reader-schema.d.ts +117 -0
- package/dist/local/ownership-reader-schema.d.ts.map +1 -0
- package/dist/local/ownership-reader-schema.js +105 -0
- package/dist/local/ownership-reader-schema.js.map +1 -0
- package/dist/local/ownership-reader-worker.d.ts +2 -0
- package/dist/local/ownership-reader-worker.d.ts.map +1 -0
- package/dist/local/ownership-reader-worker.js +341 -0
- package/dist/local/ownership-reader-worker.js.map +1 -0
- package/dist/local/ownership-reader.d.ts +10 -0
- package/dist/local/ownership-reader.d.ts.map +1 -0
- package/dist/local/ownership-reader.js +93 -0
- package/dist/local/ownership-reader.js.map +1 -0
- package/dist/local/package-uses-check.d.ts +33 -0
- package/dist/local/package-uses-check.d.ts.map +1 -0
- package/dist/local/package-uses-check.js +62 -0
- package/dist/local/package-uses-check.js.map +1 -0
- package/dist/local/pending-recovery.d.ts +22 -0
- package/dist/local/pending-recovery.d.ts.map +1 -0
- package/dist/local/pending-recovery.js +171 -0
- package/dist/local/pending-recovery.js.map +1 -0
- package/dist/local/portable-commit-store.d.ts +28 -0
- package/dist/local/portable-commit-store.d.ts.map +1 -0
- package/dist/local/portable-commit-store.js +187 -0
- package/dist/local/portable-commit-store.js.map +1 -0
- package/dist/local/portable-commit.d.ts +109 -0
- package/dist/local/portable-commit.d.ts.map +1 -0
- package/dist/local/portable-commit.js +209 -0
- package/dist/local/portable-commit.js.map +1 -0
- package/dist/local/portable-remote.d.ts +432 -0
- package/dist/local/portable-remote.d.ts.map +1 -0
- package/dist/local/portable-remote.js +280 -0
- package/dist/local/portable-remote.js.map +1 -0
- package/dist/local/project-deleted.d.ts +4 -0
- package/dist/local/project-deleted.d.ts.map +1 -0
- package/dist/local/project-deleted.js +13 -0
- package/dist/local/project-deleted.js.map +1 -0
- package/dist/local/projection.d.ts +166 -0
- package/dist/local/projection.d.ts.map +1 -0
- package/dist/local/projection.js +709 -0
- package/dist/local/projection.js.map +1 -0
- package/dist/local/read-operation.d.ts +3 -0
- package/dist/local/read-operation.d.ts.map +1 -0
- package/dist/local/read-operation.js +19 -0
- package/dist/local/read-operation.js.map +1 -0
- package/dist/local/rebuild.d.ts +11 -0
- package/dist/local/rebuild.d.ts.map +1 -0
- package/dist/local/rebuild.js +42 -0
- package/dist/local/rebuild.js.map +1 -0
- package/dist/local/remote-base.d.ts +25 -0
- package/dist/local/remote-base.d.ts.map +1 -0
- package/dist/local/remote-base.js +68 -0
- package/dist/local/remote-base.js.map +1 -0
- package/dist/local/save-layout-worker.d.ts +19 -0
- package/dist/local/save-layout-worker.d.ts.map +1 -0
- package/dist/local/save-layout-worker.js +28 -0
- package/dist/local/save-layout-worker.js.map +1 -0
- package/dist/local/save-layout.d.ts +84 -0
- package/dist/local/save-layout.d.ts.map +1 -0
- package/dist/local/save-layout.js +221 -0
- package/dist/local/save-layout.js.map +1 -0
- package/dist/local/scope-impact.d.ts +31 -0
- package/dist/local/scope-impact.d.ts.map +1 -0
- package/dist/local/scope-impact.js +32 -0
- package/dist/local/scope-impact.js.map +1 -0
- package/dist/local/source-evidence/filesystem-worker.d.ts +2 -0
- package/dist/local/source-evidence/filesystem-worker.d.ts.map +1 -0
- package/dist/local/source-evidence/filesystem-worker.js +139 -0
- package/dist/local/source-evidence/filesystem-worker.js.map +1 -0
- package/dist/local/source-evidence/processes.d.ts +20 -0
- package/dist/local/source-evidence/processes.d.ts.map +1 -0
- package/dist/local/source-evidence/processes.js +133 -0
- package/dist/local/source-evidence/processes.js.map +1 -0
- package/dist/local/source-evidence/protocol.d.ts +52 -0
- package/dist/local/source-evidence/protocol.d.ts.map +1 -0
- package/dist/local/source-evidence/protocol.js +72 -0
- package/dist/local/source-evidence/protocol.js.map +1 -0
- package/dist/local/source-evidence/reader.d.ts +14 -0
- package/dist/local/source-evidence/reader.d.ts.map +1 -0
- package/dist/local/source-evidence/reader.js +308 -0
- package/dist/local/source-evidence/reader.js.map +1 -0
- package/dist/local/source-evidence/schema.d.ts +2504 -0
- package/dist/local/source-evidence/schema.d.ts.map +1 -0
- package/dist/local/source-evidence/schema.js +99 -0
- package/dist/local/source-evidence/schema.js.map +1 -0
- package/dist/local/source-policy/loader.d.ts +29 -0
- package/dist/local/source-policy/loader.d.ts.map +1 -0
- package/dist/local/source-policy/loader.js +209 -0
- package/dist/local/source-policy/loader.js.map +1 -0
- package/dist/local/source-policy/process.d.ts +7 -0
- package/dist/local/source-policy/process.d.ts.map +1 -0
- package/dist/local/source-policy/process.js +53 -0
- package/dist/local/source-policy/process.js.map +1 -0
- package/dist/local/source-policy/protocol.d.ts +27 -0
- package/dist/local/source-policy/protocol.d.ts.map +1 -0
- package/dist/local/source-policy/protocol.js +48 -0
- package/dist/local/source-policy/protocol.js.map +1 -0
- package/dist/local/source-policy/worker.d.ts +2 -0
- package/dist/local/source-policy/worker.d.ts.map +1 -0
- package/dist/local/source-policy/worker.js +100 -0
- package/dist/local/source-policy/worker.js.map +1 -0
- package/dist/local/state-directory.d.ts +17 -0
- package/dist/local/state-directory.d.ts.map +1 -0
- package/dist/local/state-directory.js +68 -0
- package/dist/local/state-directory.js.map +1 -0
- package/dist/local/store-database.d.ts +13 -0
- package/dist/local/store-database.d.ts.map +1 -0
- package/dist/local/store-database.js +187 -0
- package/dist/local/store-database.js.map +1 -0
- package/dist/local/store.d.ts +181 -0
- package/dist/local/store.d.ts.map +1 -0
- package/dist/local/store.js +585 -0
- package/dist/local/store.js.map +1 -0
- package/dist/local/sync.d.ts +47 -0
- package/dist/local/sync.d.ts.map +1 -0
- package/dist/local/sync.js +518 -0
- package/dist/local/sync.js.map +1 -0
- package/dist/local/task-context-inspection.d.ts +23 -0
- package/dist/local/task-context-inspection.d.ts.map +1 -0
- package/dist/local/task-context-inspection.js +165 -0
- package/dist/local/task-context-inspection.js.map +1 -0
- package/dist/local/task-context-observations.d.ts +9553 -0
- package/dist/local/task-context-observations.d.ts.map +1 -0
- package/dist/local/task-context-observations.js +232 -0
- package/dist/local/task-context-observations.js.map +1 -0
- package/dist/local/task-context-provider.d.ts +18 -0
- package/dist/local/task-context-provider.d.ts.map +1 -0
- package/dist/local/task-context-provider.js +231 -0
- package/dist/local/task-context-provider.js.map +1 -0
- package/dist/local/task-context-schema.d.ts +847 -0
- package/dist/local/task-context-schema.d.ts.map +1 -0
- package/dist/local/task-context-schema.js +305 -0
- package/dist/local/task-context-schema.js.map +1 -0
- package/dist/local/task-context-source.d.ts +16 -0
- package/dist/local/task-context-source.d.ts.map +1 -0
- package/dist/local/task-context-source.js +45 -0
- package/dist/local/task-context-source.js.map +1 -0
- package/dist/local/task-context.d.ts +14 -0
- package/dist/local/task-context.d.ts.map +1 -0
- package/dist/local/task-context.js +570 -0
- package/dist/local/task-context.js.map +1 -0
- package/dist/local/test-commands.d.ts +71 -0
- package/dist/local/test-commands.d.ts.map +1 -0
- package/dist/local/test-commands.js +292 -0
- package/dist/local/test-commands.js.map +1 -0
- package/dist/local/tree-save.d.ts +117 -0
- package/dist/local/tree-save.d.ts.map +1 -0
- package/dist/local/tree-save.js +615 -0
- package/dist/local/tree-save.js.map +1 -0
- package/dist/local/variants.d.ts +125 -0
- package/dist/local/variants.d.ts.map +1 -0
- package/dist/local/variants.js +267 -0
- package/dist/local/variants.js.map +1 -0
- package/dist/local/workspace-admission.d.ts +61 -0
- package/dist/local/workspace-admission.d.ts.map +1 -0
- package/dist/local/workspace-admission.js +112 -0
- package/dist/local/workspace-admission.js.map +1 -0
- package/dist/local/workspace-authority-guard.d.ts +18 -0
- package/dist/local/workspace-authority-guard.d.ts.map +1 -0
- package/dist/local/workspace-authority-guard.js +69 -0
- package/dist/local/workspace-authority-guard.js.map +1 -0
- package/dist/local/workspace-authority.d.ts +33 -0
- package/dist/local/workspace-authority.d.ts.map +1 -0
- package/dist/local/workspace-authority.js +33 -0
- package/dist/local/workspace-authority.js.map +1 -0
- package/dist/local/workspace-branch-runtime.d.ts +61 -0
- package/dist/local/workspace-branch-runtime.d.ts.map +1 -0
- package/dist/local/workspace-branch-runtime.js +216 -0
- package/dist/local/workspace-branch-runtime.js.map +1 -0
- package/dist/local/workspace-built-content.d.ts +137 -0
- package/dist/local/workspace-built-content.d.ts.map +1 -0
- package/dist/local/workspace-built-content.js +393 -0
- package/dist/local/workspace-built-content.js.map +1 -0
- package/dist/local/workspace-claim-status-read.d.ts +53 -0
- package/dist/local/workspace-claim-status-read.d.ts.map +1 -0
- package/dist/local/workspace-claim-status-read.js +118 -0
- package/dist/local/workspace-claim-status-read.js.map +1 -0
- package/dist/local/workspace-claim-status.d.ts +172 -0
- package/dist/local/workspace-claim-status.d.ts.map +1 -0
- package/dist/local/workspace-claim-status.js +721 -0
- package/dist/local/workspace-claim-status.js.map +1 -0
- package/dist/local/workspace-claim-views.d.ts +45 -0
- package/dist/local/workspace-claim-views.d.ts.map +1 -0
- package/dist/local/workspace-claim-views.js +45 -0
- package/dist/local/workspace-claim-views.js.map +1 -0
- package/dist/local/workspace-cli.d.ts +46 -0
- package/dist/local/workspace-cli.d.ts.map +1 -0
- package/dist/local/workspace-cli.js +1524 -0
- package/dist/local/workspace-cli.js.map +1 -0
- package/dist/local/workspace-commit-resolver.d.ts +19 -0
- package/dist/local/workspace-commit-resolver.d.ts.map +1 -0
- package/dist/local/workspace-commit-resolver.js +47 -0
- package/dist/local/workspace-commit-resolver.js.map +1 -0
- package/dist/local/workspace-decision-store.d.ts +184 -0
- package/dist/local/workspace-decision-store.d.ts.map +1 -0
- package/dist/local/workspace-decision-store.js +510 -0
- package/dist/local/workspace-decision-store.js.map +1 -0
- package/dist/local/workspace-environment-runtime.d.ts +107 -0
- package/dist/local/workspace-environment-runtime.d.ts.map +1 -0
- package/dist/local/workspace-environment-runtime.js +135 -0
- package/dist/local/workspace-environment-runtime.js.map +1 -0
- package/dist/local/workspace-evidence-drop.d.ts +21 -0
- package/dist/local/workspace-evidence-drop.d.ts.map +1 -0
- package/dist/local/workspace-evidence-drop.js +58 -0
- package/dist/local/workspace-evidence-drop.js.map +1 -0
- package/dist/local/workspace-evidence-sign-tool.d.ts +20 -0
- package/dist/local/workspace-evidence-sign-tool.d.ts.map +1 -0
- package/dist/local/workspace-evidence-sign-tool.js +85 -0
- package/dist/local/workspace-evidence-sign-tool.js.map +1 -0
- package/dist/local/workspace-evidence-status.d.ts +89 -0
- package/dist/local/workspace-evidence-status.d.ts.map +1 -0
- package/dist/local/workspace-evidence-status.js +141 -0
- package/dist/local/workspace-evidence-status.js.map +1 -0
- package/dist/local/workspace-evidence.d.ts +145 -0
- package/dist/local/workspace-evidence.d.ts.map +1 -0
- package/dist/local/workspace-evidence.js +347 -0
- package/dist/local/workspace-evidence.js.map +1 -0
- package/dist/local/workspace-graph-store.d.ts +32 -0
- package/dist/local/workspace-graph-store.d.ts.map +1 -0
- package/dist/local/workspace-graph-store.js +249 -0
- package/dist/local/workspace-graph-store.js.map +1 -0
- package/dist/local/workspace-handoff.d.ts +32 -0
- package/dist/local/workspace-handoff.d.ts.map +1 -0
- package/dist/local/workspace-handoff.js +144 -0
- package/dist/local/workspace-handoff.js.map +1 -0
- package/dist/local/workspace-history-journal.d.ts +70 -0
- package/dist/local/workspace-history-journal.d.ts.map +1 -0
- package/dist/local/workspace-history-journal.js +131 -0
- package/dist/local/workspace-history-journal.js.map +1 -0
- package/dist/local/workspace-history-store.d.ts +98 -0
- package/dist/local/workspace-history-store.d.ts.map +1 -0
- package/dist/local/workspace-history-store.js +632 -0
- package/dist/local/workspace-history-store.js.map +1 -0
- package/dist/local/workspace-history-types.d.ts +307 -0
- package/dist/local/workspace-history-types.d.ts.map +1 -0
- package/dist/local/workspace-history-types.js +2 -0
- package/dist/local/workspace-history-types.js.map +1 -0
- package/dist/local/workspace-integration-runtime.d.ts +48 -0
- package/dist/local/workspace-integration-runtime.d.ts.map +1 -0
- package/dist/local/workspace-integration-runtime.js +419 -0
- package/dist/local/workspace-integration-runtime.js.map +1 -0
- package/dist/local/workspace-lock.d.ts +7 -0
- package/dist/local/workspace-lock.d.ts.map +1 -0
- package/dist/local/workspace-lock.js +211 -0
- package/dist/local/workspace-lock.js.map +1 -0
- package/dist/local/workspace-merge.d.ts +77 -0
- package/dist/local/workspace-merge.d.ts.map +1 -0
- package/dist/local/workspace-merge.js +703 -0
- package/dist/local/workspace-merge.js.map +1 -0
- package/dist/local/workspace-mixed-history.d.ts +33 -0
- package/dist/local/workspace-mixed-history.d.ts.map +1 -0
- package/dist/local/workspace-mixed-history.js +107 -0
- package/dist/local/workspace-mixed-history.js.map +1 -0
- package/dist/local/workspace-overlap-allocation.d.ts +33 -0
- package/dist/local/workspace-overlap-allocation.d.ts.map +1 -0
- package/dist/local/workspace-overlap-allocation.js +69 -0
- package/dist/local/workspace-overlap-allocation.js.map +1 -0
- package/dist/local/workspace-overlap-impact.d.ts +46 -0
- package/dist/local/workspace-overlap-impact.d.ts.map +1 -0
- package/dist/local/workspace-overlap-impact.js +162 -0
- package/dist/local/workspace-overlap-impact.js.map +1 -0
- package/dist/local/workspace-overlap.d.ts +109 -0
- package/dist/local/workspace-overlap.d.ts.map +1 -0
- package/dist/local/workspace-overlap.js +327 -0
- package/dist/local/workspace-overlap.js.map +1 -0
- package/dist/local/workspace-paths.d.ts +4 -0
- package/dist/local/workspace-paths.d.ts.map +1 -0
- package/dist/local/workspace-paths.js +8 -0
- package/dist/local/workspace-paths.js.map +1 -0
- package/dist/local/workspace-pick-runtime.d.ts +70 -0
- package/dist/local/workspace-pick-runtime.d.ts.map +1 -0
- package/dist/local/workspace-pick-runtime.js +177 -0
- package/dist/local/workspace-pick-runtime.js.map +1 -0
- package/dist/local/workspace-pick-store.d.ts +33 -0
- package/dist/local/workspace-pick-store.d.ts.map +1 -0
- package/dist/local/workspace-pick-store.js +43 -0
- package/dist/local/workspace-pick-store.js.map +1 -0
- package/dist/local/workspace-pick.d.ts +73 -0
- package/dist/local/workspace-pick.d.ts.map +1 -0
- package/dist/local/workspace-pick.js +253 -0
- package/dist/local/workspace-pick.js.map +1 -0
- package/dist/local/workspace-portable-authoring.d.ts +43 -0
- package/dist/local/workspace-portable-authoring.d.ts.map +1 -0
- package/dist/local/workspace-portable-authoring.js +128 -0
- package/dist/local/workspace-portable-authoring.js.map +1 -0
- package/dist/local/workspace-prune.d.ts +63 -0
- package/dist/local/workspace-prune.d.ts.map +1 -0
- package/dist/local/workspace-prune.js +267 -0
- package/dist/local/workspace-prune.js.map +1 -0
- package/dist/local/workspace-remote-fetch.d.ts +82 -0
- package/dist/local/workspace-remote-fetch.d.ts.map +1 -0
- package/dist/local/workspace-remote-fetch.js +409 -0
- package/dist/local/workspace-remote-fetch.js.map +1 -0
- package/dist/local/workspace-remote-provider.d.ts +97 -0
- package/dist/local/workspace-remote-provider.d.ts.map +1 -0
- package/dist/local/workspace-remote-provider.js +400 -0
- package/dist/local/workspace-remote-provider.js.map +1 -0
- package/dist/local/workspace-remote-pull-request-journal.d.ts +49 -0
- package/dist/local/workspace-remote-pull-request-journal.d.ts.map +1 -0
- package/dist/local/workspace-remote-pull-request-journal.js +63 -0
- package/dist/local/workspace-remote-pull-request-journal.js.map +1 -0
- package/dist/local/workspace-remote-pull-request.d.ts +36 -0
- package/dist/local/workspace-remote-pull-request.d.ts.map +1 -0
- package/dist/local/workspace-remote-pull-request.js +158 -0
- package/dist/local/workspace-remote-pull-request.js.map +1 -0
- package/dist/local/workspace-remote-push.d.ts +88 -0
- package/dist/local/workspace-remote-push.d.ts.map +1 -0
- package/dist/local/workspace-remote-push.js +297 -0
- package/dist/local/workspace-remote-push.js.map +1 -0
- package/dist/local/workspace-remote-topic-journal.d.ts +56 -0
- package/dist/local/workspace-remote-topic-journal.d.ts.map +1 -0
- package/dist/local/workspace-remote-topic-journal.js +121 -0
- package/dist/local/workspace-remote-topic-journal.js.map +1 -0
- package/dist/local/workspace-remote-topic.d.ts +45 -0
- package/dist/local/workspace-remote-topic.d.ts.map +1 -0
- package/dist/local/workspace-remote-topic.js +204 -0
- package/dist/local/workspace-remote-topic.js.map +1 -0
- package/dist/local/workspace-remote-transfer.d.ts +76 -0
- package/dist/local/workspace-remote-transfer.d.ts.map +1 -0
- package/dist/local/workspace-remote-transfer.js +270 -0
- package/dist/local/workspace-remote-transfer.js.map +1 -0
- package/dist/local/workspace-resolution.d.ts +145 -0
- package/dist/local/workspace-resolution.d.ts.map +1 -0
- package/dist/local/workspace-resolution.js +479 -0
- package/dist/local/workspace-resolution.js.map +1 -0
- package/dist/local/workspace-resolver-provider.d.ts +72 -0
- package/dist/local/workspace-resolver-provider.d.ts.map +1 -0
- package/dist/local/workspace-resolver-provider.js +312 -0
- package/dist/local/workspace-resolver-provider.js.map +1 -0
- package/dist/local/workspace-runtime-handoff.d.ts +52 -0
- package/dist/local/workspace-runtime-handoff.d.ts.map +1 -0
- package/dist/local/workspace-runtime-handoff.js +237 -0
- package/dist/local/workspace-runtime-handoff.js.map +1 -0
- package/dist/local/workspace-runtime-lease.d.ts +26 -0
- package/dist/local/workspace-runtime-lease.d.ts.map +1 -0
- package/dist/local/workspace-runtime-lease.js +123 -0
- package/dist/local/workspace-runtime-lease.js.map +1 -0
- package/dist/local/workspace-runtime.d.ts +690 -0
- package/dist/local/workspace-runtime.d.ts.map +1 -0
- package/dist/local/workspace-runtime.js +2124 -0
- package/dist/local/workspace-runtime.js.map +1 -0
- package/dist/local/workspace-scope.d.ts +70 -0
- package/dist/local/workspace-scope.d.ts.map +1 -0
- package/dist/local/workspace-scope.js +206 -0
- package/dist/local/workspace-scope.js.map +1 -0
- package/dist/local/workspace-sources.d.ts +159 -0
- package/dist/local/workspace-sources.d.ts.map +1 -0
- package/dist/local/workspace-sources.js +570 -0
- package/dist/local/workspace-sources.js.map +1 -0
- package/dist/local/workspace-store-database.d.ts +5 -0
- package/dist/local/workspace-store-database.d.ts.map +1 -0
- package/dist/local/workspace-store-database.js +726 -0
- package/dist/local/workspace-store-database.js.map +1 -0
- package/dist/local/workspace-store.d.ts +261 -0
- package/dist/local/workspace-store.d.ts.map +1 -0
- package/dist/local/workspace-store.js +831 -0
- package/dist/local/workspace-store.js.map +1 -0
- package/dist/local/workspace-topology-runtime.d.ts +27 -0
- package/dist/local/workspace-topology-runtime.d.ts.map +1 -0
- package/dist/local/workspace-topology-runtime.js +396 -0
- package/dist/local/workspace-topology-runtime.js.map +1 -0
- package/dist/local/workspace-topology.d.ts +140 -0
- package/dist/local/workspace-topology.d.ts.map +1 -0
- package/dist/local/workspace-topology.js +359 -0
- package/dist/local/workspace-topology.js.map +1 -0
- package/dist/local/workspace-upstream-inspection.d.ts +60 -0
- package/dist/local/workspace-upstream-inspection.d.ts.map +1 -0
- package/dist/local/workspace-upstream-inspection.js +189 -0
- package/dist/local/workspace-upstream-inspection.js.map +1 -0
- package/dist/local/workspace-upstream-runtime.d.ts +91 -0
- package/dist/local/workspace-upstream-runtime.d.ts.map +1 -0
- package/dist/local/workspace-upstream-runtime.js +270 -0
- package/dist/local/workspace-upstream-runtime.js.map +1 -0
- package/dist/local/workspace-upstream-store.d.ts +51 -0
- package/dist/local/workspace-upstream-store.d.ts.map +1 -0
- package/dist/local/workspace-upstream-store.js +475 -0
- package/dist/local/workspace-upstream-store.js.map +1 -0
- package/dist/local/workspace-viewer-server.d.ts +136 -0
- package/dist/local/workspace-viewer-server.d.ts.map +1 -0
- package/dist/local/workspace-viewer-server.js +1097 -0
- package/dist/local/workspace-viewer-server.js.map +1 -0
- package/dist/local/workspace-viewer-snapshot.d.ts +49 -0
- package/dist/local/workspace-viewer-snapshot.d.ts.map +1 -0
- package/dist/local/workspace-viewer-snapshot.js +91 -0
- package/dist/local/workspace-viewer-snapshot.js.map +1 -0
- package/dist/local/worktree-projection.d.ts +76 -0
- package/dist/local/worktree-projection.d.ts.map +1 -0
- package/dist/local/worktree-projection.js +470 -0
- package/dist/local/worktree-projection.js.map +1 -0
- package/dist/mcp/client-identity.d.ts +8 -0
- package/dist/mcp/client-identity.d.ts.map +1 -0
- package/dist/mcp/client-identity.js +33 -0
- package/dist/mcp/client-identity.js.map +1 -0
- package/dist/mcp/graph-to-code.d.ts +53 -0
- package/dist/mcp/graph-to-code.d.ts.map +1 -0
- package/dist/mcp/graph-to-code.js +1624 -0
- package/dist/mcp/graph-to-code.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/stdio/graph-to-code.d.ts +3 -0
- package/dist/mcp/stdio/graph-to-code.d.ts.map +1 -0
- package/dist/mcp/stdio/graph-to-code.js +55 -0
- package/dist/mcp/stdio/graph-to-code.js.map +1 -0
- package/dist/mcp/stdio/worktree.d.ts +3 -0
- package/dist/mcp/stdio/worktree.d.ts.map +1 -0
- package/dist/mcp/stdio/worktree.js +67 -0
- package/dist/mcp/stdio/worktree.js.map +1 -0
- package/dist/mcp/worktree-claim-status.d.ts +162 -0
- package/dist/mcp/worktree-claim-status.d.ts.map +1 -0
- package/dist/mcp/worktree-claim-status.js +113 -0
- package/dist/mcp/worktree-claim-status.js.map +1 -0
- package/dist/mcp/worktree-dispatch.d.ts +13 -0
- package/dist/mcp/worktree-dispatch.d.ts.map +1 -0
- package/dist/mcp/worktree-dispatch.js +52 -0
- package/dist/mcp/worktree-dispatch.js.map +1 -0
- package/dist/mcp/worktree-errors.d.ts +15 -0
- package/dist/mcp/worktree-errors.d.ts.map +1 -0
- package/dist/mcp/worktree-errors.js +17 -0
- package/dist/mcp/worktree-errors.js.map +1 -0
- package/dist/mcp/worktree-health.d.ts +12 -0
- package/dist/mcp/worktree-health.d.ts.map +1 -0
- package/dist/mcp/worktree-health.js +32 -0
- package/dist/mcp/worktree-health.js.map +1 -0
- package/dist/mcp/worktree-results.d.ts +15 -0
- package/dist/mcp/worktree-results.d.ts.map +1 -0
- package/dist/mcp/worktree-results.js +12 -0
- package/dist/mcp/worktree-results.js.map +1 -0
- package/dist/mcp/worktree-task-context.d.ts +57 -0
- package/dist/mcp/worktree-task-context.d.ts.map +1 -0
- package/dist/mcp/worktree-task-context.js +45 -0
- package/dist/mcp/worktree-task-context.js.map +1 -0
- package/dist/mcp/worktree-tools.d.ts +2648 -0
- package/dist/mcp/worktree-tools.d.ts.map +1 -0
- package/dist/mcp/worktree-tools.js +192 -0
- package/dist/mcp/worktree-tools.js.map +1 -0
- package/dist/mcp/worktree.d.ts +33 -0
- package/dist/mcp/worktree.d.ts.map +1 -0
- package/dist/mcp/worktree.js +551 -0
- package/dist/mcp/worktree.js.map +1 -0
- package/dist/own-package.d.ts +13 -0
- package/dist/own-package.d.ts.map +1 -0
- package/dist/own-package.js +32 -0
- package/dist/own-package.js.map +1 -0
- package/dist/packages-browse.d.ts +107 -0
- package/dist/packages-browse.d.ts.map +1 -0
- package/dist/packages-browse.js +646 -0
- package/dist/packages-browse.js.map +1 -0
- package/dist/packages-cli.d.ts +8 -0
- package/dist/packages-cli.d.ts.map +1 -0
- package/dist/packages-cli.js +184 -0
- package/dist/packages-cli.js.map +1 -0
- package/dist/packages-uses.d.ts +46 -0
- package/dist/packages-uses.d.ts.map +1 -0
- package/dist/packages-uses.js +737 -0
- package/dist/packages-uses.js.map +1 -0
- package/dist/portable.d.ts +7 -0
- package/dist/portable.d.ts.map +1 -0
- package/dist/portable.js +14 -0
- package/dist/portable.js.map +1 -0
- package/dist/quiet-warnings.d.ts +3 -0
- package/dist/quiet-warnings.d.ts.map +1 -0
- package/dist/quiet-warnings.js +21 -0
- package/dist/quiet-warnings.js.map +1 -0
- package/dist/view-seam.d.ts +62 -0
- package/dist/view-seam.d.ts.map +1 -0
- package/dist/view-seam.js +70 -0
- package/dist/view-seam.js.map +1 -0
- package/generated/graph-packages/index.json +5 -0
- package/graph-packages.lock.json +4 -0
- package/package.json +81 -0
- package/viewer/assets/index-BZKGDARF.css +1 -0
- package/viewer/assets/index-DWu0CbZZ.js +272 -0
- package/viewer/index.html +13 -0
|
@@ -0,0 +1,831 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { isAbsolute, join, resolve } from 'node:path';
|
|
3
|
+
import { openLocalWorkspaceStoreDatabase } from './workspace-store-database.js';
|
|
4
|
+
import { LocalWorkspaceHistoryStore } from './workspace-history-store.js';
|
|
5
|
+
import { LocalPortableCommitStore } from './portable-commit-store.js';
|
|
6
|
+
import { parsePortableCommit } from './portable-commit.js';
|
|
7
|
+
import { LocalRemoteTrackingStore } from './workspace-remote-fetch.js';
|
|
8
|
+
import { LocalRemotePushJournalStore } from './workspace-remote-push.js';
|
|
9
|
+
import { LocalRemoteTopicJournalStore } from './workspace-remote-topic-journal.js';
|
|
10
|
+
import { LocalRemotePullRequestJournalStore } from './workspace-remote-pull-request-journal.js';
|
|
11
|
+
import { LocalDecisionStore } from './workspace-decision-store.js';
|
|
12
|
+
import { LocalPickStore } from './workspace-pick-store.js';
|
|
13
|
+
import { LocalBuiltContentStore } from './workspace-built-content.js';
|
|
14
|
+
import { LocalVocabularyAdmissionStore } from './workspace-admission.js';
|
|
15
|
+
import { LocalOrgStore } from './local-org-store.js';
|
|
16
|
+
import { requireMutableLocalBranchRef } from './git-ref-authority.js';
|
|
17
|
+
import { assertTaskScopeSubset, local_workspace_task_scope_schema } from './workspace-scope.js';
|
|
18
|
+
function requireValue(value, label) {
|
|
19
|
+
const normalized_value = value.trim();
|
|
20
|
+
if (normalized_value.length === 0) {
|
|
21
|
+
throw new Error(`${label} must not be empty.`);
|
|
22
|
+
}
|
|
23
|
+
return normalized_value;
|
|
24
|
+
}
|
|
25
|
+
function requireAbsolutePath(path, label) {
|
|
26
|
+
if (!isAbsolute(path)) {
|
|
27
|
+
throw new Error(`${label} must be an absolute path.`);
|
|
28
|
+
}
|
|
29
|
+
return resolve(path);
|
|
30
|
+
}
|
|
31
|
+
function assertPersistedRefAuthority(database) {
|
|
32
|
+
const rows = database
|
|
33
|
+
.prepare(`
|
|
34
|
+
select ref_name from local_workspace_ref
|
|
35
|
+
union
|
|
36
|
+
select attached_ref as ref_name from local_workspace
|
|
37
|
+
where attached_ref is not null
|
|
38
|
+
`)
|
|
39
|
+
.all();
|
|
40
|
+
for (const row of rows) {
|
|
41
|
+
requireMutableLocalBranchRef(row.ref_name, 'Persisted workspace ref');
|
|
42
|
+
}
|
|
43
|
+
const associations = database
|
|
44
|
+
.prepare('select local_ref, git_ref from local_branch_association')
|
|
45
|
+
.all();
|
|
46
|
+
for (const association of associations) {
|
|
47
|
+
requireMutableLocalBranchRef(association.local_ref, 'Persisted local SDLC branch ref');
|
|
48
|
+
requireMutableLocalBranchRef(association.git_ref, 'Persisted associated Git branch ref');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function backfillLocalBranchAssociations(database) {
|
|
52
|
+
const now = new Date().toISOString();
|
|
53
|
+
database
|
|
54
|
+
.prepare(`
|
|
55
|
+
insert into local_branch_association (
|
|
56
|
+
local_ref, git_ref, upstream_remote_name, upstream_source_ref,
|
|
57
|
+
upstream_tracking_ref, base_portable_commit_id, created_at, updated_at
|
|
58
|
+
)
|
|
59
|
+
select ref_name, ref_name, null, null, null, null, ?, ?
|
|
60
|
+
from local_workspace_ref
|
|
61
|
+
where not exists (
|
|
62
|
+
select 1 from local_branch_association
|
|
63
|
+
where local_branch_association.local_ref = local_workspace_ref.ref_name
|
|
64
|
+
)
|
|
65
|
+
and not exists (
|
|
66
|
+
select 1 from local_branch_association
|
|
67
|
+
where local_branch_association.git_ref = local_workspace_ref.ref_name
|
|
68
|
+
)
|
|
69
|
+
`)
|
|
70
|
+
.run(now, now);
|
|
71
|
+
}
|
|
72
|
+
export class LocalWorkspaceStore {
|
|
73
|
+
state_dir;
|
|
74
|
+
database_path;
|
|
75
|
+
repository;
|
|
76
|
+
history;
|
|
77
|
+
portable_commits;
|
|
78
|
+
remote_tracking;
|
|
79
|
+
remote_push;
|
|
80
|
+
remote_topic;
|
|
81
|
+
remote_pull_request;
|
|
82
|
+
decisions;
|
|
83
|
+
picks;
|
|
84
|
+
built_content;
|
|
85
|
+
admissions;
|
|
86
|
+
org;
|
|
87
|
+
database;
|
|
88
|
+
constructor(input) {
|
|
89
|
+
this.state_dir = input.state_dir;
|
|
90
|
+
this.database_path = join(input.state_dir, 'repository.sqlite');
|
|
91
|
+
this.database = input.database;
|
|
92
|
+
this.repository = input.repository;
|
|
93
|
+
this.history = new LocalWorkspaceHistoryStore(input.database);
|
|
94
|
+
this.portable_commits = new LocalPortableCommitStore(input.database, this.history);
|
|
95
|
+
this.remote_tracking = new LocalRemoteTrackingStore(input.database, this.portable_commits);
|
|
96
|
+
this.remote_push = new LocalRemotePushJournalStore(input.database);
|
|
97
|
+
this.remote_topic = new LocalRemoteTopicJournalStore(input.database);
|
|
98
|
+
this.remote_pull_request = new LocalRemotePullRequestJournalStore(input.database);
|
|
99
|
+
this.picks = new LocalPickStore(input.database);
|
|
100
|
+
this.built_content = new LocalBuiltContentStore(input.database);
|
|
101
|
+
this.admissions = new LocalVocabularyAdmissionStore(input.database);
|
|
102
|
+
this.org = new LocalOrgStore(input.database);
|
|
103
|
+
this.decisions = new LocalDecisionStore(input.database, {
|
|
104
|
+
picks: this.picks,
|
|
105
|
+
isAncestor: (ancestor_id, descendant_id) => this.history.isAncestor(ancestor_id, descendant_id)
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
static async open(input) {
|
|
109
|
+
const state_dir = requireAbsolutePath(input.state_dir, 'State directory');
|
|
110
|
+
const git_common_dir = requireAbsolutePath(input.git_common_dir, 'Git common directory');
|
|
111
|
+
const database = await openLocalWorkspaceStoreDatabase(state_dir);
|
|
112
|
+
const proposed_repository = {
|
|
113
|
+
repository_id: randomUUID(),
|
|
114
|
+
git_common_dir,
|
|
115
|
+
schema_version: 1,
|
|
116
|
+
created_at: new Date().toISOString()
|
|
117
|
+
};
|
|
118
|
+
database
|
|
119
|
+
.prepare(`
|
|
120
|
+
insert into local_repository (
|
|
121
|
+
singleton, repository_id, git_common_dir, schema_version,
|
|
122
|
+
created_at
|
|
123
|
+
) values (1, ?, ?, ?, ?)
|
|
124
|
+
on conflict(singleton) do nothing
|
|
125
|
+
`)
|
|
126
|
+
.run(proposed_repository.repository_id, proposed_repository.git_common_dir, proposed_repository.schema_version, proposed_repository.created_at);
|
|
127
|
+
const repository = database
|
|
128
|
+
.prepare('select * from local_repository where singleton = 1')
|
|
129
|
+
.get();
|
|
130
|
+
if (input.expected_repository_id &&
|
|
131
|
+
repository.repository_id !== input.expected_repository_id) {
|
|
132
|
+
database.close();
|
|
133
|
+
throw new Error('Logical graph repository identity does not match.');
|
|
134
|
+
}
|
|
135
|
+
if (repository.git_common_dir !== git_common_dir &&
|
|
136
|
+
!input.expected_repository_id) {
|
|
137
|
+
database.close();
|
|
138
|
+
throw new Error('Local workspace store belongs to another Git repository; cross-repository access requires its exact graph repository id.');
|
|
139
|
+
}
|
|
140
|
+
backfillLocalBranchAssociations(database);
|
|
141
|
+
try {
|
|
142
|
+
assertPersistedRefAuthority(database);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
database.close();
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
return new LocalWorkspaceStore({ state_dir, database, repository });
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
database.close();
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
close() {
|
|
157
|
+
this.database.close();
|
|
158
|
+
}
|
|
159
|
+
checkpoint() {
|
|
160
|
+
this.database.exec('pragma wal_checkpoint(TRUNCATE)');
|
|
161
|
+
}
|
|
162
|
+
runTransaction(operation) {
|
|
163
|
+
this.database.exec('begin immediate');
|
|
164
|
+
try {
|
|
165
|
+
const result = operation();
|
|
166
|
+
this.database.exec('commit');
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
this.database.exec('rollback');
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
getSourceRepositoryBinding(git_common_dir) {
|
|
175
|
+
const path = requireAbsolutePath(git_common_dir, 'Git common directory');
|
|
176
|
+
return (this.database
|
|
177
|
+
.prepare('select * from local_source_repository_binding where git_common_dir = ?')
|
|
178
|
+
.get(path) ?? null);
|
|
179
|
+
}
|
|
180
|
+
/** A binding of the source association in this graph, from any repository. */
|
|
181
|
+
getSourceAssociationBinding(source_repository_association_id) {
|
|
182
|
+
return (this.database
|
|
183
|
+
.prepare(`select * from local_source_repository_binding
|
|
184
|
+
where repository_id = ? and source_repository_association_id = ?
|
|
185
|
+
limit 1`)
|
|
186
|
+
.get(this.repository.repository_id, source_repository_association_id) ?? null);
|
|
187
|
+
}
|
|
188
|
+
bindSourceRepository(input) {
|
|
189
|
+
const git_common_dir = requireAbsolutePath(input.git_common_dir, 'Git common directory');
|
|
190
|
+
const association_id = requireValue(input.source_repository_association_id, 'Source repository association id');
|
|
191
|
+
const remote_name = requireValue(input.remote_name, 'Git remote name');
|
|
192
|
+
const remote_url = requireValue(input.remote_url, 'Git remote URL');
|
|
193
|
+
const remote_identity = requireValue(input.remote_identity, 'Git remote identity');
|
|
194
|
+
return this.runTransaction(() => {
|
|
195
|
+
const existing = this.getSourceRepositoryBinding(git_common_dir);
|
|
196
|
+
if (existing) {
|
|
197
|
+
if (existing.source_repository_association_id !== association_id ||
|
|
198
|
+
existing.remote_name !== remote_name ||
|
|
199
|
+
existing.remote_identity !== remote_identity) {
|
|
200
|
+
throw new Error('Current Git repository already has a different source-association binding.');
|
|
201
|
+
}
|
|
202
|
+
return existing;
|
|
203
|
+
}
|
|
204
|
+
const association_binding = this.getSourceAssociationBinding(association_id);
|
|
205
|
+
if (association_binding &&
|
|
206
|
+
association_binding.remote_identity !== remote_identity) {
|
|
207
|
+
throw new Error('Source association is already bound to a different Git repository identity.');
|
|
208
|
+
}
|
|
209
|
+
const now = new Date().toISOString();
|
|
210
|
+
this.database
|
|
211
|
+
.prepare(`insert into local_source_repository_binding (
|
|
212
|
+
git_common_dir, repository_id, source_repository_association_id,
|
|
213
|
+
remote_name, remote_url, remote_identity, created_at, updated_at
|
|
214
|
+
) values (?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
215
|
+
.run(git_common_dir, this.repository.repository_id, association_id, remote_name, remote_url, remote_identity, now, now);
|
|
216
|
+
return this.getSourceRepositoryBinding(git_common_dir);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Moves a repository's binding from `expected_remote_name` to another
|
|
221
|
+
* remote, keeping its association. Returns null, changing nothing, when the
|
|
222
|
+
* binding is gone or moved, or another repository binds the association
|
|
223
|
+
* under a different identity.
|
|
224
|
+
*/
|
|
225
|
+
rebindSourceRepositoryRemote(input) {
|
|
226
|
+
const git_common_dir = requireAbsolutePath(input.git_common_dir, 'Git common directory');
|
|
227
|
+
const remote_name = requireValue(input.remote_name, 'Git remote name');
|
|
228
|
+
const remote_url = requireValue(input.remote_url, 'Git remote URL');
|
|
229
|
+
const remote_identity = requireValue(input.remote_identity, 'Git remote identity');
|
|
230
|
+
return this.runTransaction(() => {
|
|
231
|
+
const existing = this.getSourceRepositoryBinding(git_common_dir);
|
|
232
|
+
if (!existing || existing.remote_name !== input.expected_remote_name) {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
const held = this.database
|
|
236
|
+
.prepare(`select 1 from local_source_repository_binding
|
|
237
|
+
where repository_id = ? and source_repository_association_id = ?
|
|
238
|
+
and git_common_dir <> ? and remote_identity <> ?
|
|
239
|
+
limit 1`)
|
|
240
|
+
.get(this.repository.repository_id, existing.source_repository_association_id, git_common_dir, remote_identity);
|
|
241
|
+
if (held)
|
|
242
|
+
return null;
|
|
243
|
+
this.database
|
|
244
|
+
.prepare(`update local_source_repository_binding
|
|
245
|
+
set remote_name = ?, remote_url = ?, remote_identity = ?,
|
|
246
|
+
moved_from_remote_identity = ?, updated_at = ?
|
|
247
|
+
where git_common_dir = ?`)
|
|
248
|
+
.run(remote_name, remote_url, remote_identity, existing.remote_identity, new Date().toISOString(), git_common_dir);
|
|
249
|
+
return this.getSourceRepositoryBinding(git_common_dir);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
unbindSourceRepository(input) {
|
|
253
|
+
const git_common_dir = requireAbsolutePath(input.git_common_dir, 'Git common directory');
|
|
254
|
+
return this.runTransaction(() => {
|
|
255
|
+
const binding = this.getSourceRepositoryBinding(git_common_dir);
|
|
256
|
+
if (!binding)
|
|
257
|
+
throw new Error('Source repository binding was not found.');
|
|
258
|
+
if (binding.source_repository_association_id !==
|
|
259
|
+
input.expected_source_repository_association_id) {
|
|
260
|
+
throw new Error('Source repository binding identity changed.');
|
|
261
|
+
}
|
|
262
|
+
const row = this.database
|
|
263
|
+
.prepare(`select count(*) as count from local_workspace
|
|
264
|
+
where git_common_dir = ? and status = 'active'`)
|
|
265
|
+
.get(git_common_dir);
|
|
266
|
+
if (row.count > 0) {
|
|
267
|
+
return { removed: false, binding, active_workspace_count: row.count };
|
|
268
|
+
}
|
|
269
|
+
this.database
|
|
270
|
+
.prepare(`delete from local_source_repository_binding
|
|
271
|
+
where git_common_dir = ? and source_repository_association_id = ?`)
|
|
272
|
+
.run(git_common_dir, input.expected_source_repository_association_id);
|
|
273
|
+
return { removed: true, binding, active_workspace_count: 0 };
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
getWorkspaceCommitSourceContext(commit_id) {
|
|
277
|
+
const row = this.database
|
|
278
|
+
.prepare('select * from local_workspace_commit_source_context where commit_id = ?')
|
|
279
|
+
.get(commit_id);
|
|
280
|
+
if (!row)
|
|
281
|
+
return null;
|
|
282
|
+
const parsed = JSON.parse(row.evidence_scope_json);
|
|
283
|
+
return {
|
|
284
|
+
commit_id: row.commit_id,
|
|
285
|
+
source_repository_association_id: row.source_repository_association_id,
|
|
286
|
+
remote_identity: row.remote_identity,
|
|
287
|
+
git_ref: row.git_ref,
|
|
288
|
+
git_head: row.git_head,
|
|
289
|
+
evidence_scope: parsed,
|
|
290
|
+
created_at: row.created_at
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
getWorkspace(workspace_id) {
|
|
294
|
+
return (this.database
|
|
295
|
+
.prepare('select * from local_workspace where id = ?')
|
|
296
|
+
.get(workspace_id) ?? null);
|
|
297
|
+
}
|
|
298
|
+
getWorkspaceByGitWorktreePath(git_worktree_path) {
|
|
299
|
+
const normalized_path = requireAbsolutePath(git_worktree_path, 'Git worktree path');
|
|
300
|
+
return (this.database
|
|
301
|
+
.prepare('select * from local_workspace where git_worktree_path = ?')
|
|
302
|
+
.get(normalized_path) ?? null);
|
|
303
|
+
}
|
|
304
|
+
listWorkspaces() {
|
|
305
|
+
return this.database
|
|
306
|
+
.prepare('select * from local_workspace order by created_at asc, id asc')
|
|
307
|
+
.all();
|
|
308
|
+
}
|
|
309
|
+
listChildWorkspaces(source_workspace_id) {
|
|
310
|
+
return this.database
|
|
311
|
+
.prepare(`
|
|
312
|
+
select * from local_workspace
|
|
313
|
+
where source_workspace_id = ?
|
|
314
|
+
order by created_at asc, id asc
|
|
315
|
+
`)
|
|
316
|
+
.all(source_workspace_id);
|
|
317
|
+
}
|
|
318
|
+
listRetainedGraphRootHashes() {
|
|
319
|
+
const direct_roots = this.database
|
|
320
|
+
.prepare(`
|
|
321
|
+
select root_hash from local_workspace_commit
|
|
322
|
+
union select base_root_hash from local_integration_attempt
|
|
323
|
+
union select coordinator_root_hash from local_integration_attempt
|
|
324
|
+
union select child_root_hash from local_integration_attempt
|
|
325
|
+
union select candidate_root_hash from local_resolution_attempt
|
|
326
|
+
where candidate_root_hash is not null
|
|
327
|
+
union select base_root_hash from local_reconciliation_attempt
|
|
328
|
+
union select child_root_hash from local_reconciliation_attempt
|
|
329
|
+
union select source_root_hash from local_reconciliation_attempt
|
|
330
|
+
union select candidate_root_hash
|
|
331
|
+
from local_reconciliation_resolution_attempt
|
|
332
|
+
where candidate_root_hash is not null
|
|
333
|
+
union select root_hash from local_governance_graph
|
|
334
|
+
`)
|
|
335
|
+
.all();
|
|
336
|
+
const retained_commit_or_root_ids = this.database
|
|
337
|
+
.prepare(`
|
|
338
|
+
select fork_sdlc_commit_id as id from local_workspace
|
|
339
|
+
union select head_sdlc_commit_id from local_workspace
|
|
340
|
+
union select head_commit_id from local_workspace_ref
|
|
341
|
+
`)
|
|
342
|
+
.all();
|
|
343
|
+
const local_commit_roots = new Map(this.database
|
|
344
|
+
.prepare('select id, root_hash from local_workspace_commit')
|
|
345
|
+
.all().map((commit) => [commit.id, commit.root_hash]));
|
|
346
|
+
const portable_commits = this.database
|
|
347
|
+
.prepare('select commit_json from portable_commit order by id')
|
|
348
|
+
.all().map((row) => parsePortableCommit(JSON.parse(row.commit_json)));
|
|
349
|
+
const portable_commit_roots = new Map(portable_commits.map((commit) => [commit.id, commit.graph_root]));
|
|
350
|
+
const retained_workspace_roots = retained_commit_or_root_ids.map(({ id }) => local_commit_roots.get(id) ?? portable_commit_roots.get(id) ?? id);
|
|
351
|
+
return [
|
|
352
|
+
...direct_roots.map((row) => row.root_hash),
|
|
353
|
+
...portable_commits.map((commit) => commit.graph_root),
|
|
354
|
+
...retained_workspace_roots
|
|
355
|
+
]
|
|
356
|
+
.filter((root_hash) => /^sha256:[0-9a-f]{64}$/.test(root_hash))
|
|
357
|
+
.filter((root_hash, index, values) => values.indexOf(root_hash) === index)
|
|
358
|
+
.sort((left, right) => left.localeCompare(right));
|
|
359
|
+
}
|
|
360
|
+
getWorkspaceTaskScope(workspace_id) {
|
|
361
|
+
const row = this.database
|
|
362
|
+
.prepare('select scope_json from local_workspace_task_scope where workspace_id = ?')
|
|
363
|
+
.get(workspace_id);
|
|
364
|
+
if (!row)
|
|
365
|
+
return null;
|
|
366
|
+
return local_workspace_task_scope_schema.parse(JSON.parse(row.scope_json));
|
|
367
|
+
}
|
|
368
|
+
/** Records that the next projection commit deletes this entity on purpose. */
|
|
369
|
+
recordWorkspaceDeletion(input) {
|
|
370
|
+
this.requireActiveWorkspace(input.workspace_id);
|
|
371
|
+
this.database
|
|
372
|
+
.prepare(`
|
|
373
|
+
insert into local_workspace_deletion_intent (
|
|
374
|
+
workspace_id, entity_kind, entity_id, recorded_at
|
|
375
|
+
) values (?, ?, ?, ?)
|
|
376
|
+
on conflict (workspace_id, entity_kind, entity_id) do nothing
|
|
377
|
+
`)
|
|
378
|
+
.run(input.workspace_id, input.entity_kind, input.entity_id, new Date().toISOString());
|
|
379
|
+
}
|
|
380
|
+
listWorkspaceDeletions(workspace_id) {
|
|
381
|
+
return this.database
|
|
382
|
+
.prepare(`
|
|
383
|
+
select entity_kind, entity_id from local_workspace_deletion_intent
|
|
384
|
+
where workspace_id = ?
|
|
385
|
+
order by entity_kind asc, entity_id asc
|
|
386
|
+
`)
|
|
387
|
+
.all(workspace_id);
|
|
388
|
+
}
|
|
389
|
+
clearWorkspaceDeletions(workspace_id) {
|
|
390
|
+
this.database
|
|
391
|
+
.prepare('delete from local_workspace_deletion_intent where workspace_id = ?')
|
|
392
|
+
.run(workspace_id);
|
|
393
|
+
}
|
|
394
|
+
getRef(ref_name) {
|
|
395
|
+
const local_ref = requireMutableLocalBranchRef(ref_name, 'Workspace ref lookup');
|
|
396
|
+
return (this.database
|
|
397
|
+
.prepare('select * from local_workspace_ref where ref_name = ?')
|
|
398
|
+
.get(local_ref) ?? null);
|
|
399
|
+
}
|
|
400
|
+
getBranchAssociation(local_ref) {
|
|
401
|
+
const ref = requireMutableLocalBranchRef(local_ref, 'Local SDLC branch ref');
|
|
402
|
+
return (this.database
|
|
403
|
+
.prepare('select * from local_branch_association where local_ref = ?')
|
|
404
|
+
.get(ref) ?? null);
|
|
405
|
+
}
|
|
406
|
+
getBranchAssociationByGitRef(git_ref) {
|
|
407
|
+
const ref = requireMutableLocalBranchRef(git_ref, 'Associated Git branch ref');
|
|
408
|
+
return (this.database
|
|
409
|
+
.prepare('select * from local_branch_association where git_ref = ?')
|
|
410
|
+
.get(ref) ?? null);
|
|
411
|
+
}
|
|
412
|
+
listBranchAssociations() {
|
|
413
|
+
return this.database
|
|
414
|
+
.prepare('select * from local_branch_association order by local_ref')
|
|
415
|
+
.all();
|
|
416
|
+
}
|
|
417
|
+
createBranchFromTrackingRef(input) {
|
|
418
|
+
const local_ref = requireMutableLocalBranchRef(input.local_ref, 'Local SDLC branch ref');
|
|
419
|
+
const git_ref = requireMutableLocalBranchRef(input.git_ref, 'Associated Git branch ref');
|
|
420
|
+
return this.runTransaction(() => {
|
|
421
|
+
const workspace = this.requireActiveWorkspace(input.actor_workspace_id);
|
|
422
|
+
if (workspace.actor_kind !== 'human') {
|
|
423
|
+
throw new Error('Local branch creation is owned by the active human workspace.');
|
|
424
|
+
}
|
|
425
|
+
if (workspace.head_sdlc_commit_id !==
|
|
426
|
+
input.expected_workspace_head_commit_id) {
|
|
427
|
+
throw new Error('Workspace head is stale.');
|
|
428
|
+
}
|
|
429
|
+
const active_child = this.database
|
|
430
|
+
.prepare(`select id from local_workspace where source_workspace_id = ? and status = 'active' limit 1`)
|
|
431
|
+
.get(workspace.id);
|
|
432
|
+
if (active_child)
|
|
433
|
+
throw new Error('Close active child workspaces before changing branches.');
|
|
434
|
+
if (this.getRef(local_ref))
|
|
435
|
+
throw new Error(`Local SDLC branch ${local_ref} already exists.`);
|
|
436
|
+
const existing_git = this.getBranchAssociationByGitRef(git_ref);
|
|
437
|
+
if (existing_git)
|
|
438
|
+
throw new Error(`Git branch ${git_ref} is already associated with ${existing_git.local_ref}.`);
|
|
439
|
+
const tracking = this.database
|
|
440
|
+
.prepare(`select * from remote_tracking_ref where remote_name = ? and source_ref = ? and tracking_ref = ?`)
|
|
441
|
+
.get(input.remote_name, input.source_ref, input.tracking_ref);
|
|
442
|
+
if (!tracking ||
|
|
443
|
+
tracking.commit_id !== input.expected_tracking_commit_id) {
|
|
444
|
+
throw new Error('Remote-tracking ref is missing or stale. Fetch it again.');
|
|
445
|
+
}
|
|
446
|
+
const portable = this.portable_commits.getCommit(input.expected_tracking_commit_id);
|
|
447
|
+
if (!portable)
|
|
448
|
+
throw new Error('Remote-tracking commit is unavailable locally.');
|
|
449
|
+
const now = new Date().toISOString();
|
|
450
|
+
this.database
|
|
451
|
+
.prepare(`insert into local_workspace_ref (ref_name, head_commit_id, created_at, updated_at) values (?, ?, ?, ?)`)
|
|
452
|
+
.run(local_ref, portable.id, now, now);
|
|
453
|
+
this.database
|
|
454
|
+
.prepare(`insert into local_branch_association (
|
|
455
|
+
local_ref, git_ref, upstream_remote_name, upstream_source_ref,
|
|
456
|
+
upstream_tracking_ref, base_portable_commit_id, created_at, updated_at
|
|
457
|
+
) values (?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
458
|
+
.run(local_ref, git_ref, input.remote_name, input.source_ref, input.tracking_ref, portable.id, now, now);
|
|
459
|
+
this.database
|
|
460
|
+
.prepare(`update local_workspace set fork_git_commit_id = ?, fork_sdlc_commit_id = ?,
|
|
461
|
+
head_sdlc_commit_id = ?, attached_ref = ?, updated_at = ? where id = ?`)
|
|
462
|
+
.run(requireValue(input.git_head_commit_id, 'Git head commit id'), portable.id, portable.id, local_ref, now, workspace.id);
|
|
463
|
+
const association = this.getBranchAssociation(local_ref);
|
|
464
|
+
if (!association)
|
|
465
|
+
throw new Error('Local branch association was not persisted.');
|
|
466
|
+
return {
|
|
467
|
+
workspace: this.requireActiveWorkspace(workspace.id),
|
|
468
|
+
association
|
|
469
|
+
};
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
selectBranchForWorkspace(input) {
|
|
473
|
+
const local_ref = requireMutableLocalBranchRef(input.local_ref, 'Local SDLC branch ref');
|
|
474
|
+
const git_ref = requireMutableLocalBranchRef(input.git_ref, 'Associated Git branch ref');
|
|
475
|
+
return this.runTransaction(() => {
|
|
476
|
+
const workspace = this.requireActiveWorkspace(input.actor_workspace_id);
|
|
477
|
+
if (workspace.actor_kind !== 'human') {
|
|
478
|
+
throw new Error('Local branch selection is owned by the active human workspace.');
|
|
479
|
+
}
|
|
480
|
+
if (workspace.head_sdlc_commit_id !==
|
|
481
|
+
input.expected_workspace_head_commit_id) {
|
|
482
|
+
throw new Error('Workspace head is stale.');
|
|
483
|
+
}
|
|
484
|
+
const active_child = this.database
|
|
485
|
+
.prepare(`select id from local_workspace where source_workspace_id = ? and status = 'active' limit 1`)
|
|
486
|
+
.get(workspace.id);
|
|
487
|
+
if (active_child)
|
|
488
|
+
throw new Error('Close active child workspaces before changing branches.');
|
|
489
|
+
const association = this.getBranchAssociation(local_ref);
|
|
490
|
+
if (!association)
|
|
491
|
+
throw new Error(`Local SDLC branch ${local_ref} does not exist.`);
|
|
492
|
+
if (association.git_ref !== git_ref) {
|
|
493
|
+
throw new Error(`Git branch ${git_ref} is not associated with ${local_ref}.`);
|
|
494
|
+
}
|
|
495
|
+
const ref = this.getRef(local_ref);
|
|
496
|
+
if (!ref)
|
|
497
|
+
throw new Error(`Local SDLC branch ${local_ref} is missing.`);
|
|
498
|
+
const attached_elsewhere = this.database
|
|
499
|
+
.prepare(`select id from local_workspace
|
|
500
|
+
where attached_ref = ? and status = 'active' and id <> ? limit 1`)
|
|
501
|
+
.get(local_ref, workspace.id);
|
|
502
|
+
if (attached_elsewhere) {
|
|
503
|
+
throw new Error(`Local SDLC branch ${local_ref} is already attached to another active workspace.`);
|
|
504
|
+
}
|
|
505
|
+
const now = new Date().toISOString();
|
|
506
|
+
this.database
|
|
507
|
+
.prepare(`update local_workspace set fork_git_commit_id = ?, fork_sdlc_commit_id = ?,
|
|
508
|
+
head_sdlc_commit_id = ?, attached_ref = ?, updated_at = ? where id = ?`)
|
|
509
|
+
.run(requireValue(input.git_head_commit_id, 'Git head commit id'), ref.head_commit_id, ref.head_commit_id, local_ref, now, workspace.id);
|
|
510
|
+
return {
|
|
511
|
+
workspace: this.requireActiveWorkspace(workspace.id),
|
|
512
|
+
association
|
|
513
|
+
};
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
registerForegroundWorkspace(input) {
|
|
517
|
+
const git_worktree_path = requireAbsolutePath(input.git_worktree_path, 'Git worktree path');
|
|
518
|
+
const git_dir = requireAbsolutePath(input.git_dir, 'Git directory');
|
|
519
|
+
const git_head_commit_id = requireValue(input.git_head_commit_id, 'Git head commit id');
|
|
520
|
+
const sdlc_head_commit_id = requireValue(input.sdlc_head_commit_id, 'SDLC head commit id');
|
|
521
|
+
const attached_ref = input.attached_ref
|
|
522
|
+
? requireMutableLocalBranchRef(input.attached_ref, 'Attached workspace ref')
|
|
523
|
+
: null;
|
|
524
|
+
return this.runTransaction(() => {
|
|
525
|
+
const now = new Date().toISOString();
|
|
526
|
+
if (attached_ref) {
|
|
527
|
+
const existing_ref = this.getRef(attached_ref);
|
|
528
|
+
if (existing_ref &&
|
|
529
|
+
existing_ref.head_commit_id !== sdlc_head_commit_id) {
|
|
530
|
+
throw new Error('Attached ref head does not match the workspace SDLC head.');
|
|
531
|
+
}
|
|
532
|
+
if (!existing_ref) {
|
|
533
|
+
this.database
|
|
534
|
+
.prepare(`
|
|
535
|
+
insert into local_workspace_ref (
|
|
536
|
+
ref_name, head_commit_id, created_at, updated_at
|
|
537
|
+
) values (?, ?, ?, ?)
|
|
538
|
+
`)
|
|
539
|
+
.run(attached_ref, sdlc_head_commit_id, now, now);
|
|
540
|
+
}
|
|
541
|
+
const existing_association = this.getBranchAssociation(attached_ref);
|
|
542
|
+
if (!existing_association) {
|
|
543
|
+
this.database
|
|
544
|
+
.prepare(`insert into local_branch_association (
|
|
545
|
+
local_ref, git_ref, upstream_remote_name, upstream_source_ref,
|
|
546
|
+
upstream_tracking_ref, base_portable_commit_id, created_at, updated_at
|
|
547
|
+
) values (?, ?, null, null, null, null, ?, ?)`)
|
|
548
|
+
.run(attached_ref, attached_ref, now, now);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
const workspace = {
|
|
552
|
+
id: randomUUID(),
|
|
553
|
+
repository_id: this.repository.repository_id,
|
|
554
|
+
source_workspace_id: null,
|
|
555
|
+
actor_kind: input.actor_kind,
|
|
556
|
+
git_worktree_path,
|
|
557
|
+
git_dir,
|
|
558
|
+
git_common_dir: requireAbsolutePath(input.git_common_dir ?? this.repository.git_common_dir, 'Git common directory'),
|
|
559
|
+
fork_git_commit_id: git_head_commit_id,
|
|
560
|
+
fork_sdlc_commit_id: sdlc_head_commit_id,
|
|
561
|
+
head_sdlc_commit_id: sdlc_head_commit_id,
|
|
562
|
+
attached_ref,
|
|
563
|
+
status: 'active',
|
|
564
|
+
created_at: now,
|
|
565
|
+
updated_at: now
|
|
566
|
+
};
|
|
567
|
+
this.insertWorkspace(workspace);
|
|
568
|
+
return workspace;
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
forkWorkspace(input) {
|
|
572
|
+
return this.runTransaction(() => {
|
|
573
|
+
const source_workspace = this.requireActiveWorkspace(input.actor_workspace_id);
|
|
574
|
+
if (source_workspace.head_sdlc_commit_id !==
|
|
575
|
+
input.expected_source_sdlc_head_commit_id) {
|
|
576
|
+
throw new Error('Source workspace head is stale.');
|
|
577
|
+
}
|
|
578
|
+
const task_scope = local_workspace_task_scope_schema.parse(input.task_scope);
|
|
579
|
+
assertTaskScopeSubset({
|
|
580
|
+
parent_scope: this.getWorkspaceTaskScope(source_workspace.id),
|
|
581
|
+
child_scope: task_scope
|
|
582
|
+
});
|
|
583
|
+
const now = new Date().toISOString();
|
|
584
|
+
const workspace = {
|
|
585
|
+
id: randomUUID(),
|
|
586
|
+
repository_id: this.repository.repository_id,
|
|
587
|
+
source_workspace_id: source_workspace.id,
|
|
588
|
+
actor_kind: input.actor_kind ?? 'ai',
|
|
589
|
+
git_worktree_path: requireAbsolutePath(input.git_worktree_path, 'Git worktree path'),
|
|
590
|
+
git_dir: requireAbsolutePath(input.git_dir, 'Git directory'),
|
|
591
|
+
git_common_dir: requireAbsolutePath(input.git_common_dir ?? this.repository.git_common_dir, 'Git common directory'),
|
|
592
|
+
fork_git_commit_id: requireValue(input.git_head_commit_id, 'Git head commit id'),
|
|
593
|
+
fork_sdlc_commit_id: source_workspace.head_sdlc_commit_id,
|
|
594
|
+
head_sdlc_commit_id: source_workspace.head_sdlc_commit_id,
|
|
595
|
+
attached_ref: null,
|
|
596
|
+
status: 'active',
|
|
597
|
+
created_at: now,
|
|
598
|
+
updated_at: now
|
|
599
|
+
};
|
|
600
|
+
this.insertWorkspace(workspace);
|
|
601
|
+
this.database
|
|
602
|
+
.prepare(`
|
|
603
|
+
insert into local_workspace_task_scope (
|
|
604
|
+
workspace_id, scope_json, created_at
|
|
605
|
+
) values (?, ?, ?)
|
|
606
|
+
`)
|
|
607
|
+
.run(workspace.id, JSON.stringify(task_scope), now);
|
|
608
|
+
return workspace;
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Reopens a Decision (graph-variants.md, Reopen) and, with `revive`, rebinds
|
|
613
|
+
* a closed candidate to a new active workspace in the same transaction.
|
|
614
|
+
* `closed` stays terminal: the new workspace is a sibling plan of the
|
|
615
|
+
* coordinator that starts at the closed candidate's last head and keeps its
|
|
616
|
+
* fork commit and task scope, so it integrates the same changes. This is the
|
|
617
|
+
* only way to fork from a closed workspace; forkWorkspace still refuses.
|
|
618
|
+
*/
|
|
619
|
+
reopenDecision(input) {
|
|
620
|
+
return this.runTransaction(() => {
|
|
621
|
+
let revived = null;
|
|
622
|
+
if (input.revive) {
|
|
623
|
+
const closed = this.getWorkspace(input.revive.workspace_id);
|
|
624
|
+
if (!closed ||
|
|
625
|
+
closed.status !== 'closed' ||
|
|
626
|
+
!closed.source_workspace_id) {
|
|
627
|
+
throw new Error(`Workspace ${input.revive.workspace_id} is not a closed plan workspace.`);
|
|
628
|
+
}
|
|
629
|
+
const coordinator = this.requireActiveWorkspace(closed.source_workspace_id);
|
|
630
|
+
const now = new Date().toISOString();
|
|
631
|
+
revived = {
|
|
632
|
+
id: input.revive.id ?? randomUUID(),
|
|
633
|
+
repository_id: this.repository.repository_id,
|
|
634
|
+
source_workspace_id: coordinator.id,
|
|
635
|
+
actor_kind: input.revive.actor_kind ?? closed.actor_kind,
|
|
636
|
+
git_worktree_path: requireAbsolutePath(input.revive.git_worktree_path, 'Git worktree path'),
|
|
637
|
+
git_dir: requireAbsolutePath(input.revive.git_dir, 'Git directory'),
|
|
638
|
+
git_common_dir: requireAbsolutePath(input.revive.git_common_dir ?? this.repository.git_common_dir, 'Git common directory'),
|
|
639
|
+
fork_git_commit_id: requireValue(input.revive.git_head_commit_id, 'Git head commit id'),
|
|
640
|
+
fork_sdlc_commit_id: closed.fork_sdlc_commit_id,
|
|
641
|
+
head_sdlc_commit_id: closed.head_sdlc_commit_id,
|
|
642
|
+
attached_ref: null,
|
|
643
|
+
status: 'active',
|
|
644
|
+
created_at: now,
|
|
645
|
+
updated_at: now
|
|
646
|
+
};
|
|
647
|
+
this.insertWorkspace(revived);
|
|
648
|
+
const task_scope = this.getWorkspaceTaskScope(closed.id);
|
|
649
|
+
if (task_scope) {
|
|
650
|
+
this.database
|
|
651
|
+
.prepare(`insert into local_workspace_task_scope (
|
|
652
|
+
workspace_id, scope_json, created_at
|
|
653
|
+
) values (?, ?, ?)`)
|
|
654
|
+
.run(revived.id, JSON.stringify(task_scope), now);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
const decision = this.decisions.applyReopen({
|
|
658
|
+
decision_id: input.decision_id,
|
|
659
|
+
reason: input.reason,
|
|
660
|
+
revived: revived
|
|
661
|
+
? {
|
|
662
|
+
from_workspace_id: input.revive.workspace_id,
|
|
663
|
+
workspace_id: revived.id
|
|
664
|
+
}
|
|
665
|
+
: null
|
|
666
|
+
});
|
|
667
|
+
return { decision, workspace: revived };
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
advanceWorkspaceHead(input) {
|
|
671
|
+
if (input.actor_workspace_id !== input.workspace_id) {
|
|
672
|
+
throw new Error('A workspace may advance only its own head outside explicit Handoff.');
|
|
673
|
+
}
|
|
674
|
+
return this.runTransaction(() => {
|
|
675
|
+
const workspace = this.requireActiveWorkspace(input.workspace_id);
|
|
676
|
+
if (workspace.head_sdlc_commit_id !== input.expected_head_commit_id) {
|
|
677
|
+
return {
|
|
678
|
+
status: 'stale',
|
|
679
|
+
current_head_commit_id: workspace.head_sdlc_commit_id
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
const next_head_commit_id = requireValue(input.next_head_commit_id, 'Next head commit id');
|
|
683
|
+
const now = new Date().toISOString();
|
|
684
|
+
if (workspace.attached_ref) {
|
|
685
|
+
const current_ref = this.getRef(workspace.attached_ref);
|
|
686
|
+
if (!current_ref ||
|
|
687
|
+
current_ref.head_commit_id !== workspace.head_sdlc_commit_id) {
|
|
688
|
+
throw new Error('Attached ref and workspace head disagree; refusing to advance.');
|
|
689
|
+
}
|
|
690
|
+
this.database
|
|
691
|
+
.prepare(`
|
|
692
|
+
update local_workspace_ref
|
|
693
|
+
set head_commit_id = ?, updated_at = ?
|
|
694
|
+
where ref_name = ? and head_commit_id = ?
|
|
695
|
+
`)
|
|
696
|
+
.run(next_head_commit_id, now, workspace.attached_ref, workspace.head_sdlc_commit_id);
|
|
697
|
+
}
|
|
698
|
+
this.database
|
|
699
|
+
.prepare(`
|
|
700
|
+
update local_workspace
|
|
701
|
+
set head_sdlc_commit_id = ?, updated_at = ?
|
|
702
|
+
where id = ? and head_sdlc_commit_id = ?
|
|
703
|
+
`)
|
|
704
|
+
.run(next_head_commit_id, now, workspace.id, workspace.head_sdlc_commit_id);
|
|
705
|
+
return {
|
|
706
|
+
status: 'advanced',
|
|
707
|
+
workspace: this.requireActiveWorkspace(workspace.id)
|
|
708
|
+
};
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Replaces a child workspace's task scope. The new scope must stay within
|
|
713
|
+
* its source's scope and keep every active child's scope within itself;
|
|
714
|
+
* the caller checks that it still covers the workspace's own changes.
|
|
715
|
+
*/
|
|
716
|
+
replaceWorkspaceTaskScope(input) {
|
|
717
|
+
return this.runTransaction(() => {
|
|
718
|
+
const actor = this.requireActiveWorkspace(input.actor_workspace_id);
|
|
719
|
+
const workspace = this.requireActiveWorkspace(input.workspace_id);
|
|
720
|
+
if (actor.id !== workspace.id &&
|
|
721
|
+
workspace.source_workspace_id !== actor.id) {
|
|
722
|
+
throw new Error('Only a workspace or its direct source may change its task scope.');
|
|
723
|
+
}
|
|
724
|
+
if (!workspace.source_workspace_id) {
|
|
725
|
+
throw new Error('A root workspace has no task scope.');
|
|
726
|
+
}
|
|
727
|
+
if (workspace.head_sdlc_commit_id !== input.expected_head_commit_id) {
|
|
728
|
+
throw new Error('Workspace head is stale.');
|
|
729
|
+
}
|
|
730
|
+
const task_scope = local_workspace_task_scope_schema.parse(input.task_scope);
|
|
731
|
+
assertTaskScopeSubset({
|
|
732
|
+
parent_scope: this.getWorkspaceTaskScope(workspace.source_workspace_id),
|
|
733
|
+
child_scope: task_scope
|
|
734
|
+
});
|
|
735
|
+
for (const child of this.listChildWorkspaces(workspace.id)) {
|
|
736
|
+
const child_scope = this.getWorkspaceTaskScope(child.id);
|
|
737
|
+
if (child.status !== 'active' || !child_scope)
|
|
738
|
+
continue;
|
|
739
|
+
assertTaskScopeSubset({ parent_scope: task_scope, child_scope });
|
|
740
|
+
}
|
|
741
|
+
const previous_task_scope = this.getWorkspaceTaskScope(workspace.id);
|
|
742
|
+
this.database
|
|
743
|
+
.prepare(`
|
|
744
|
+
insert into local_workspace_task_scope (
|
|
745
|
+
workspace_id, scope_json, created_at
|
|
746
|
+
) values (?, ?, ?)
|
|
747
|
+
on conflict (workspace_id) do update set
|
|
748
|
+
scope_json = excluded.scope_json
|
|
749
|
+
`)
|
|
750
|
+
.run(workspace.id, JSON.stringify(task_scope), new Date().toISOString());
|
|
751
|
+
return { previous_task_scope, task_scope };
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
closeWorkspace(input) {
|
|
755
|
+
return this.runTransaction(() => {
|
|
756
|
+
const actor = this.requireActiveWorkspace(input.actor_workspace_id);
|
|
757
|
+
const workspace = this.requireActiveWorkspace(input.workspace_id);
|
|
758
|
+
if (actor.id !== workspace.id &&
|
|
759
|
+
workspace.source_workspace_id !== actor.id) {
|
|
760
|
+
throw new Error('Only a workspace or its direct source may close the workspace.');
|
|
761
|
+
}
|
|
762
|
+
if (workspace.head_sdlc_commit_id !== input.expected_head_commit_id) {
|
|
763
|
+
throw new Error('Workspace head is stale.');
|
|
764
|
+
}
|
|
765
|
+
const active_child = this.database
|
|
766
|
+
.prepare(`
|
|
767
|
+
select id from local_workspace
|
|
768
|
+
where source_workspace_id = ? and status = 'active'
|
|
769
|
+
limit 1
|
|
770
|
+
`)
|
|
771
|
+
.get(workspace.id);
|
|
772
|
+
if (active_child) {
|
|
773
|
+
throw new Error('Close active child workspaces first.');
|
|
774
|
+
}
|
|
775
|
+
const now = new Date().toISOString();
|
|
776
|
+
this.database
|
|
777
|
+
.prepare(`
|
|
778
|
+
update local_workspace set status = 'closed', updated_at = ?
|
|
779
|
+
where id = ? and status = 'active' and head_sdlc_commit_id = ?
|
|
780
|
+
`)
|
|
781
|
+
.run(now, workspace.id, input.expected_head_commit_id);
|
|
782
|
+
const closed = this.getWorkspace(workspace.id);
|
|
783
|
+
if (!closed || closed.status !== 'closed') {
|
|
784
|
+
throw new Error('Workspace close did not complete.');
|
|
785
|
+
}
|
|
786
|
+
return closed;
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
removeClosedWorkspaceRegistration(input) {
|
|
790
|
+
this.runTransaction(() => {
|
|
791
|
+
const workspace = this.getWorkspace(input.workspace_id);
|
|
792
|
+
if (!workspace ||
|
|
793
|
+
workspace.status !== 'closed' ||
|
|
794
|
+
workspace.source_workspace_id !== input.source_workspace_id ||
|
|
795
|
+
workspace.git_worktree_path !==
|
|
796
|
+
requireAbsolutePath(input.git_worktree_path, 'Git worktree path')) {
|
|
797
|
+
throw new Error('Closed workspace registration does not match attachment rollback.');
|
|
798
|
+
}
|
|
799
|
+
this.database
|
|
800
|
+
.prepare('delete from local_workspace_task_scope where workspace_id = ?')
|
|
801
|
+
.run(workspace.id);
|
|
802
|
+
const removed = this.database
|
|
803
|
+
.prepare(`delete from local_workspace
|
|
804
|
+
where id = ? and status = 'closed' and source_workspace_id = ?`)
|
|
805
|
+
.run(workspace.id, input.source_workspace_id);
|
|
806
|
+
if (removed.changes !== 1) {
|
|
807
|
+
throw new Error('Closed workspace registration was not removed.');
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
requireActiveWorkspace(workspace_id) {
|
|
812
|
+
const workspace = this.getWorkspace(workspace_id);
|
|
813
|
+
if (!workspace || workspace.status !== 'active') {
|
|
814
|
+
throw new Error('Active local workspace was not found.');
|
|
815
|
+
}
|
|
816
|
+
return workspace;
|
|
817
|
+
}
|
|
818
|
+
insertWorkspace(workspace) {
|
|
819
|
+
this.database
|
|
820
|
+
.prepare(`
|
|
821
|
+
insert into local_workspace (
|
|
822
|
+
id, repository_id, source_workspace_id, actor_kind,
|
|
823
|
+
git_worktree_path, git_dir, git_common_dir, fork_git_commit_id,
|
|
824
|
+
fork_sdlc_commit_id, head_sdlc_commit_id, attached_ref, status,
|
|
825
|
+
created_at, updated_at
|
|
826
|
+
) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
827
|
+
`)
|
|
828
|
+
.run(workspace.id, workspace.repository_id, workspace.source_workspace_id, workspace.actor_kind, workspace.git_worktree_path, workspace.git_dir, workspace.git_common_dir, workspace.fork_git_commit_id, workspace.fork_sdlc_commit_id, workspace.head_sdlc_commit_id, workspace.attached_ref, workspace.status, workspace.created_at, workspace.updated_at);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
//# sourceMappingURL=workspace-store.js.map
|