@paraharness/git 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +68 -2
- package/dist/builders/create-git-candidate-comparison-tools.d.ts +13 -0
- package/dist/builders/create-git-candidate-comparison-tools.d.ts.map +1 -0
- package/dist/builders/create-git-candidate-comparison-tools.js +41 -0
- package/dist/builders/create-git-candidate-comparison-tools.js.map +1 -0
- package/dist/builders/create-git-commit-and-push-builder.d.ts +18 -0
- package/dist/builders/create-git-commit-and-push-builder.d.ts.map +1 -0
- package/dist/builders/create-git-commit-and-push-builder.js +65 -0
- package/dist/builders/create-git-commit-and-push-builder.js.map +1 -0
- package/dist/builders/create-git-cow-worktree-builder.d.ts +15 -0
- package/dist/builders/create-git-cow-worktree-builder.d.ts.map +1 -0
- package/dist/builders/create-git-cow-worktree-builder.js +64 -0
- package/dist/builders/create-git-cow-worktree-builder.js.map +1 -0
- package/dist/builders/create-git-discard-branch-builder.d.ts +13 -0
- package/dist/builders/create-git-discard-branch-builder.d.ts.map +1 -0
- package/dist/builders/create-git-discard-branch-builder.js +22 -0
- package/dist/builders/create-git-discard-branch-builder.js.map +1 -0
- package/dist/builders/create-git-keep-worktree-builder.d.ts +13 -0
- package/dist/builders/create-git-keep-worktree-builder.d.ts.map +1 -0
- package/dist/builders/create-git-keep-worktree-builder.js +22 -0
- package/dist/builders/create-git-keep-worktree-builder.js.map +1 -0
- package/dist/builders/create-git-merge-queue-builder.d.ts +19 -0
- package/dist/builders/create-git-merge-queue-builder.d.ts.map +1 -0
- package/dist/builders/create-git-merge-queue-builder.js +59 -0
- package/dist/builders/create-git-merge-queue-builder.js.map +1 -0
- package/dist/builders/create-git-patch-equivalence-builder.d.ts +13 -0
- package/dist/builders/create-git-patch-equivalence-builder.d.ts.map +1 -0
- package/dist/builders/create-git-patch-equivalence-builder.js +32 -0
- package/dist/builders/create-git-patch-equivalence-builder.js.map +1 -0
- package/dist/builders/create-git-public-surface-cross-tester-builder.d.ts +14 -0
- package/dist/builders/create-git-public-surface-cross-tester-builder.d.ts.map +1 -0
- package/dist/builders/create-git-public-surface-cross-tester-builder.js +36 -0
- package/dist/builders/create-git-public-surface-cross-tester-builder.js.map +1 -0
- package/dist/builders/create-git-ref-reader-tools.d.ts +13 -0
- package/dist/builders/create-git-ref-reader-tools.d.ts.map +1 -0
- package/dist/builders/create-git-ref-reader-tools.js +41 -0
- package/dist/builders/create-git-ref-reader-tools.js.map +1 -0
- package/dist/builders/create-git-reset-worktree-builder.d.ts +13 -0
- package/dist/builders/create-git-reset-worktree-builder.d.ts.map +1 -0
- package/dist/builders/create-git-reset-worktree-builder.js +22 -0
- package/dist/builders/create-git-reset-worktree-builder.js.map +1 -0
- package/dist/builders/create-git-snapshot-and-reset-builder.d.ts +13 -0
- package/dist/builders/create-git-snapshot-and-reset-builder.d.ts.map +1 -0
- package/dist/builders/create-git-snapshot-and-reset-builder.js +23 -0
- package/dist/builders/create-git-snapshot-and-reset-builder.js.map +1 -0
- package/dist/builders/git-commit-and-push-builder.d.ts +44 -0
- package/dist/builders/git-commit-and-push-builder.d.ts.map +1 -0
- package/dist/builders/git-commit-and-push-builder.js +2 -0
- package/dist/builders/git-commit-and-push-builder.js.map +1 -0
- package/dist/builders/git-commit-and-push-options.d.ts +22 -0
- package/dist/builders/git-commit-and-push-options.d.ts.map +1 -0
- package/dist/builders/git-commit-and-push-options.js +2 -0
- package/dist/builders/git-commit-and-push-options.js.map +1 -0
- package/dist/builders/git-cow-worktree-builder.d.ts +64 -0
- package/dist/builders/git-cow-worktree-builder.d.ts.map +1 -0
- package/dist/builders/git-cow-worktree-builder.js +2 -0
- package/dist/builders/git-cow-worktree-builder.js.map +1 -0
- package/dist/builders/git-cow-worktree-options.d.ts +42 -0
- package/dist/builders/git-cow-worktree-options.d.ts.map +1 -0
- package/dist/builders/git-cow-worktree-options.js +2 -0
- package/dist/builders/git-cow-worktree-options.js.map +1 -0
- package/dist/builders/git-merge-queue-builder.d.ts +37 -0
- package/dist/builders/git-merge-queue-builder.d.ts.map +1 -0
- package/dist/builders/git-merge-queue-builder.js +2 -0
- package/dist/builders/git-merge-queue-builder.js.map +1 -0
- package/dist/builders/git-merge-queue-options.d.ts +23 -0
- package/dist/builders/git-merge-queue-options.d.ts.map +1 -0
- package/dist/builders/git-merge-queue-options.js +2 -0
- package/dist/builders/git-merge-queue-options.js.map +1 -0
- package/dist/builders/git-namespace-contract.d.ts +141 -0
- package/dist/builders/git-namespace-contract.d.ts.map +1 -0
- package/dist/builders/git-namespace-contract.js +2 -0
- package/dist/builders/git-namespace-contract.js.map +1 -0
- package/dist/builders/git-namespace.d.ts +6 -0
- package/dist/builders/git-namespace.d.ts.map +1 -0
- package/dist/builders/git-namespace.js +32 -0
- package/dist/builders/git-namespace.js.map +1 -0
- package/dist/builders/git-public-surface-cross-tester-options.d.ts +16 -0
- package/dist/builders/git-public-surface-cross-tester-options.d.ts.map +1 -0
- package/dist/builders/git-public-surface-cross-tester-options.js +2 -0
- package/dist/builders/git-public-surface-cross-tester-options.js.map +1 -0
- package/dist/builders/git-reconcile-strategy-options.d.ts +16 -0
- package/dist/builders/git-reconcile-strategy-options.d.ts.map +1 -0
- package/dist/builders/git-reconcile-strategy-options.js +2 -0
- package/dist/builders/git-reconcile-strategy-options.js.map +1 -0
- package/dist/builders/internal/build-git-cow-worktree-node.d.ts +35 -0
- package/dist/builders/internal/build-git-cow-worktree-node.d.ts.map +1 -0
- package/dist/builders/internal/build-git-cow-worktree-node.js +77 -0
- package/dist/builders/internal/build-git-cow-worktree-node.js.map +1 -0
- package/dist/executors/create-git-executors.d.ts +12 -0
- package/dist/executors/create-git-executors.d.ts.map +1 -0
- package/dist/executors/create-git-executors.js +43 -0
- package/dist/executors/create-git-executors.js.map +1 -0
- package/dist/executors/git-checkpoint-payload.d.ts +44 -0
- package/dist/executors/git-checkpoint-payload.d.ts.map +1 -0
- package/dist/executors/git-checkpoint-payload.js +2 -0
- package/dist/executors/git-checkpoint-payload.js.map +1 -0
- package/dist/executors/git-commit-and-merge-steps.d.ts +33 -0
- package/dist/executors/git-commit-and-merge-steps.d.ts.map +1 -0
- package/dist/executors/git-commit-and-merge-steps.js +52 -0
- package/dist/executors/git-commit-and-merge-steps.js.map +1 -0
- package/dist/executors/git-cow-worktree-scope.d.ts +201 -0
- package/dist/executors/git-cow-worktree-scope.d.ts.map +1 -0
- package/dist/executors/git-cow-worktree-scope.js +260 -0
- package/dist/executors/git-cow-worktree-scope.js.map +1 -0
- package/dist/executors/git-cross-verifiers-and-tools.d.ts +42 -0
- package/dist/executors/git-cross-verifiers-and-tools.d.ts.map +1 -0
- package/dist/executors/git-cross-verifiers-and-tools.js +112 -0
- package/dist/executors/git-cross-verifiers-and-tools.js.map +1 -0
- package/dist/executors/git-executors.constants.d.ts +4 -0
- package/dist/executors/git-executors.constants.d.ts.map +1 -0
- package/dist/executors/git-executors.constants.js +4 -0
- package/dist/executors/git-executors.constants.js.map +1 -0
- package/dist/executors/git-hooks-and-checks.d.ts +51 -0
- package/dist/executors/git-hooks-and-checks.d.ts.map +1 -0
- package/dist/executors/git-hooks-and-checks.js +139 -0
- package/dist/executors/git-hooks-and-checks.js.map +1 -0
- package/dist/executors/internal/checkpoint-restore-steps.d.ts +50 -0
- package/dist/executors/internal/checkpoint-restore-steps.d.ts.map +1 -0
- package/dist/executors/internal/checkpoint-restore-steps.js +184 -0
- package/dist/executors/internal/checkpoint-restore-steps.js.map +1 -0
- package/dist/executors/internal/checkpoint-staging-and-integrity.d.ts +51 -0
- package/dist/executors/internal/checkpoint-staging-and-integrity.d.ts.map +1 -0
- package/dist/executors/internal/checkpoint-staging-and-integrity.js +192 -0
- package/dist/executors/internal/checkpoint-staging-and-integrity.js.map +1 -0
- package/dist/executors/internal/compute-worktree-status-options.d.ts +15 -0
- package/dist/executors/internal/compute-worktree-status-options.d.ts.map +1 -0
- package/dist/executors/internal/compute-worktree-status-options.js +2 -0
- package/dist/executors/internal/compute-worktree-status-options.js.map +1 -0
- package/dist/executors/internal/cow-worktree-hydrator.d.ts +51 -0
- package/dist/executors/internal/cow-worktree-hydrator.d.ts.map +1 -0
- package/dist/executors/internal/cow-worktree-hydrator.js +174 -0
- package/dist/executors/internal/cow-worktree-hydrator.js.map +1 -0
- package/dist/executors/internal/file-digest-and-globs.d.ts +58 -0
- package/dist/executors/internal/file-digest-and-globs.d.ts.map +1 -0
- package/dist/executors/internal/file-digest-and-globs.js +188 -0
- package/dist/executors/internal/file-digest-and-globs.js.map +1 -0
- package/dist/executors/internal/git-checkpoint-diff-effects.d.ts +16 -0
- package/dist/executors/internal/git-checkpoint-diff-effects.d.ts.map +1 -0
- package/dist/executors/internal/git-checkpoint-diff-effects.js +38 -0
- package/dist/executors/internal/git-checkpoint-diff-effects.js.map +1 -0
- package/dist/executors/internal/git-checkpoint-restore.d.ts +14 -0
- package/dist/executors/internal/git-checkpoint-restore.d.ts.map +1 -0
- package/dist/executors/internal/git-checkpoint-restore.js +37 -0
- package/dist/executors/internal/git-checkpoint-restore.js.map +1 -0
- package/dist/executors/internal/git-checkpoint-serialize.d.ts +13 -0
- package/dist/executors/internal/git-checkpoint-serialize.d.ts.map +1 -0
- package/dist/executors/internal/git-checkpoint-serialize.js +48 -0
- package/dist/executors/internal/git-checkpoint-serialize.js.map +1 -0
- package/dist/executors/internal/git-checkpoint-status-map.d.ts +14 -0
- package/dist/executors/internal/git-checkpoint-status-map.d.ts.map +1 -0
- package/dist/executors/internal/git-checkpoint-status-map.js +27 -0
- package/dist/executors/internal/git-checkpoint-status-map.js.map +1 -0
- package/dist/executors/internal/git-cli-command-options.d.ts +21 -0
- package/dist/executors/internal/git-cli-command-options.d.ts.map +1 -0
- package/dist/executors/internal/git-cli-command-options.js +2 -0
- package/dist/executors/internal/git-cli-command-options.js.map +1 -0
- package/dist/executors/internal/git-cli-command-result.d.ts +16 -0
- package/dist/executors/internal/git-cli-command-result.d.ts.map +1 -0
- package/dist/executors/internal/git-cli-command-result.js +2 -0
- package/dist/executors/internal/git-cli-command-result.js.map +1 -0
- package/dist/executors/internal/git-cli-runner.d.ts +73 -0
- package/dist/executors/internal/git-cli-runner.d.ts.map +1 -0
- package/dist/executors/internal/git-cli-runner.js +157 -0
- package/dist/executors/internal/git-cli-runner.js.map +1 -0
- package/dist/executors/internal/git-cross-test-import-scanner.d.ts +68 -0
- package/dist/executors/internal/git-cross-test-import-scanner.d.ts.map +1 -0
- package/dist/executors/internal/git-cross-test-import-scanner.js +226 -0
- package/dist/executors/internal/git-cross-test-import-scanner.js.map +1 -0
- package/dist/executors/internal/git-executor.constants.d.ts +29 -0
- package/dist/executors/internal/git-executor.constants.d.ts.map +1 -0
- package/dist/executors/internal/git-executor.constants.js +40 -0
- package/dist/executors/internal/git-executor.constants.js.map +1 -0
- package/dist/executors/internal/git-merge-train-bisect.d.ts +51 -0
- package/dist/executors/internal/git-merge-train-bisect.d.ts.map +1 -0
- package/dist/executors/internal/git-merge-train-bisect.js +152 -0
- package/dist/executors/internal/git-merge-train-bisect.js.map +1 -0
- package/dist/executors/internal/git-tool-dispatchers.d.ts +26 -0
- package/dist/executors/internal/git-tool-dispatchers.d.ts.map +1 -0
- package/dist/executors/internal/git-tool-dispatchers.js +174 -0
- package/dist/executors/internal/git-tool-dispatchers.js.map +1 -0
- package/dist/executors/internal/git-worktree-acquire-root.d.ts +22 -0
- package/dist/executors/internal/git-worktree-acquire-root.d.ts.map +1 -0
- package/dist/executors/internal/git-worktree-acquire-root.js +67 -0
- package/dist/executors/internal/git-worktree-acquire-root.js.map +1 -0
- package/dist/executors/internal/git-worktree-commit-child.d.ts +26 -0
- package/dist/executors/internal/git-worktree-commit-child.d.ts.map +1 -0
- package/dist/executors/internal/git-worktree-commit-child.js +88 -0
- package/dist/executors/internal/git-worktree-commit-child.js.map +1 -0
- package/dist/executors/internal/git-worktree-flush-and-prune.d.ts +43 -0
- package/dist/executors/internal/git-worktree-flush-and-prune.d.ts.map +1 -0
- package/dist/executors/internal/git-worktree-flush-and-prune.js +169 -0
- package/dist/executors/internal/git-worktree-flush-and-prune.js.map +1 -0
- package/dist/executors/internal/git-worktree-fork-and-release.d.ts +37 -0
- package/dist/executors/internal/git-worktree-fork-and-release.d.ts.map +1 -0
- package/dist/executors/internal/git-worktree-fork-and-release.js +159 -0
- package/dist/executors/internal/git-worktree-fork-and-release.js.map +1 -0
- package/dist/executors/internal/git-worktree-materialize-merge.d.ts +51 -0
- package/dist/executors/internal/git-worktree-materialize-merge.d.ts.map +1 -0
- package/dist/executors/internal/git-worktree-materialize-merge.js +161 -0
- package/dist/executors/internal/git-worktree-materialize-merge.js.map +1 -0
- package/dist/executors/internal/git-worktree-reattach.d.ts +57 -0
- package/dist/executors/internal/git-worktree-reattach.d.ts.map +1 -0
- package/dist/executors/internal/git-worktree-reattach.js +324 -0
- package/dist/executors/internal/git-worktree-reattach.js.map +1 -0
- package/dist/executors/internal/git-worktree-sync-child-and-root.d.ts +26 -0
- package/dist/executors/internal/git-worktree-sync-child-and-root.d.ts.map +1 -0
- package/dist/executors/internal/git-worktree-sync-child-and-root.js +82 -0
- package/dist/executors/internal/git-worktree-sync-child-and-root.js.map +1 -0
- package/dist/executors/internal/host-repository-head-state.d.ts +10 -0
- package/dist/executors/internal/host-repository-head-state.d.ts.map +1 -0
- package/dist/executors/internal/host-repository-head-state.js +2 -0
- package/dist/executors/internal/host-repository-head-state.js.map +1 -0
- package/dist/executors/internal/merge-train-candidate.d.ts +14 -0
- package/dist/executors/internal/merge-train-candidate.d.ts.map +1 -0
- package/dist/executors/internal/merge-train-candidate.js +2 -0
- package/dist/executors/internal/merge-train-candidate.js.map +1 -0
- package/dist/executors/internal/merge-train-chain-entry.d.ts +13 -0
- package/dist/executors/internal/merge-train-chain-entry.d.ts.map +1 -0
- package/dist/executors/internal/merge-train-chain-entry.js +2 -0
- package/dist/executors/internal/merge-train-chain-entry.js.map +1 -0
- package/dist/executors/internal/merge-train-result.d.ts +19 -0
- package/dist/executors/internal/merge-train-result.d.ts.map +1 -0
- package/dist/executors/internal/merge-train-result.js +2 -0
- package/dist/executors/internal/merge-train-result.js.map +1 -0
- package/dist/executors/internal/merge-train-runner.d.ts +16 -0
- package/dist/executors/internal/merge-train-runner.d.ts.map +1 -0
- package/dist/executors/internal/merge-train-runner.js +141 -0
- package/dist/executors/internal/merge-train-runner.js.map +1 -0
- package/dist/executors/internal/merge-tree-materializer-params.d.ts +19 -0
- package/dist/executors/internal/merge-tree-materializer-params.d.ts.map +1 -0
- package/dist/executors/internal/merge-tree-materializer-params.js +2 -0
- package/dist/executors/internal/merge-tree-materializer-params.js.map +1 -0
- package/dist/executors/internal/parent-fast-forward.d.ts +47 -0
- package/dist/executors/internal/parent-fast-forward.d.ts.map +1 -0
- package/dist/executors/internal/parent-fast-forward.js +138 -0
- package/dist/executors/internal/parent-fast-forward.js.map +1 -0
- package/dist/executors/internal/porcelain-v2-parser.d.ts +49 -0
- package/dist/executors/internal/porcelain-v2-parser.d.ts.map +1 -0
- package/dist/executors/internal/porcelain-v2-parser.js +165 -0
- package/dist/executors/internal/porcelain-v2-parser.js.map +1 -0
- package/dist/executors/internal/resolve-effective-base-branch.d.ts +13 -0
- package/dist/executors/internal/resolve-effective-base-branch.d.ts.map +1 -0
- package/dist/executors/internal/resolve-effective-base-branch.js +38 -0
- package/dist/executors/internal/resolve-effective-base-branch.js.map +1 -0
- package/dist/executors/internal/squash-rebase-and-push.d.ts +14 -0
- package/dist/executors/internal/squash-rebase-and-push.d.ts.map +1 -0
- package/dist/executors/internal/squash-rebase-and-push.js +192 -0
- package/dist/executors/internal/squash-rebase-and-push.js.map +1 -0
- package/dist/executors/internal/staged-checkpoint-tree-result.d.ts +13 -0
- package/dist/executors/internal/staged-checkpoint-tree-result.d.ts.map +1 -0
- package/dist/executors/internal/staged-checkpoint-tree-result.js +2 -0
- package/dist/executors/internal/staged-checkpoint-tree-result.js.map +1 -0
- package/dist/executors/internal/stateless-merge-tree-result.d.ts +12 -0
- package/dist/executors/internal/stateless-merge-tree-result.d.ts.map +1 -0
- package/dist/executors/internal/stateless-merge-tree-result.js +2 -0
- package/dist/executors/internal/stateless-merge-tree-result.js.map +1 -0
- package/dist/executors/internal/synthesized-working-tree-commit.d.ts +10 -0
- package/dist/executors/internal/synthesized-working-tree-commit.d.ts.map +1 -0
- package/dist/executors/internal/synthesized-working-tree-commit.js +2 -0
- package/dist/executors/internal/synthesized-working-tree-commit.js.map +1 -0
- package/dist/executors/internal/worktree-integrity-verdict.d.ts +10 -0
- package/dist/executors/internal/worktree-integrity-verdict.d.ts.map +1 -0
- package/dist/executors/internal/worktree-integrity-verdict.js +2 -0
- package/dist/executors/internal/worktree-integrity-verdict.js.map +1 -0
- package/dist/executors/internal/worktree-status-snapshot.d.ts +17 -0
- package/dist/executors/internal/worktree-status-snapshot.d.ts.map +1 -0
- package/dist/executors/internal/worktree-status-snapshot.js +2 -0
- package/dist/executors/internal/worktree-status-snapshot.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/git-receipts.schema.d.ts +174 -0
- package/dist/schemas/git-receipts.schema.d.ts.map +1 -0
- package/dist/schemas/git-receipts.schema.js +123 -0
- package/dist/schemas/git-receipts.schema.js.map +1 -0
- package/package.json +71 -3
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import type { BranchableScope, GitCowWorktreeNode, GitScopeReceipt, GitSyncReceipt, GitWorktreeHandle, LeaseDelta, ReconcileResult, ToolEffect } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Tier-3 branchable Copy-on-Write Git worktree isolation scope driver (`git.cowWorktree`).
|
|
4
|
+
*
|
|
5
|
+
* Implements disjoint root/fork worktrees, git-index checkpoints, post-flight `.git` integrity diffing,
|
|
6
|
+
* automatic parent dirty-tree flushing, and stateless `git merge-tree --write-tree` 3-way reconciliation.
|
|
7
|
+
*/
|
|
8
|
+
export declare class GitCowWorktreeScopeDriver implements BranchableScope<GitWorktreeHandle, GitScopeReceipt, GitSyncReceipt> {
|
|
9
|
+
/** Unique identifier of this isolation scope driver instance. */
|
|
10
|
+
readonly id: string;
|
|
11
|
+
/** Zod schema validating inspection receipts returned by `inspect()`. */
|
|
12
|
+
readonly receiptSchema: import("zod").ZodObject<{
|
|
13
|
+
headRef: import("zod").ZodString;
|
|
14
|
+
baseRef: import("zod").ZodString;
|
|
15
|
+
branchName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
16
|
+
baseBranch: import("zod").ZodDefault<import("zod").ZodString>;
|
|
17
|
+
diffStat: import("zod").ZodString;
|
|
18
|
+
mutatedFiles: import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>;
|
|
19
|
+
}, import("zod/v4/core").$strip>;
|
|
20
|
+
/** Zod schema validating synchronization receipts returned by `syncChild()` and `syncRoot()`. */
|
|
21
|
+
readonly syncSchema: import("zod").ZodObject<{
|
|
22
|
+
rebasedOntoRef: import("zod").ZodString;
|
|
23
|
+
baseBranch: import("zod").ZodDefault<import("zod").ZodString>;
|
|
24
|
+
updatedFiles: import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>;
|
|
25
|
+
}, import("zod/v4/core").$strip>;
|
|
26
|
+
/** Capability flag confirming git-index checkpoint serialization and rollback support. */
|
|
27
|
+
readonly supportsCheckpoints: true;
|
|
28
|
+
/** Capability flag confirming Copy-on-Write child worktree branching and 3-way reconciliation support. */
|
|
29
|
+
readonly supportsBranching: true;
|
|
30
|
+
/** Passive AST configuration node for this worktree scope. */
|
|
31
|
+
private readonly node;
|
|
32
|
+
/** Precomputed union of `node.excludeFromCloneGlobs` and `node.checkpointPolicy?.excludeGlobs`. */
|
|
33
|
+
private readonly effectiveExcludeGlobs;
|
|
34
|
+
/** Precomputed checkpoint policy with merged `effectiveExcludeGlobs`. */
|
|
35
|
+
private readonly effectiveCheckpointPolicy;
|
|
36
|
+
/** Per-parent worktree `PQueue` (`concurrency: 1`) serializing automatic parent dirty-tree flushes during `forkChild`. */
|
|
37
|
+
private readonly parentFlushQueues;
|
|
38
|
+
/**
|
|
39
|
+
* Initializes a `GitCowWorktreeScopeDriver` from its passive `GitCowWorktreeNode` AST configuration.
|
|
40
|
+
*
|
|
41
|
+
* Binds the repository path, disjoint worktree directory layout, and checkpoint policy configuration.
|
|
42
|
+
*
|
|
43
|
+
* @param {GitCowWorktreeNode} node - Passive worktree scope AST configuration node.
|
|
44
|
+
*/
|
|
45
|
+
constructor(node: GitCowWorktreeNode);
|
|
46
|
+
/**
|
|
47
|
+
* Provisions an isolated Task Root Worktree at `<dir>/roots/<runId>` for `runId`.
|
|
48
|
+
*
|
|
49
|
+
* Hydrates `node_modules` according to `.lockfileGate` and `.setup` and initializes `<gitdir>/harness-meta.json`.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} runId - Unique identifier of the flow run.
|
|
52
|
+
*
|
|
53
|
+
* @returns {Promise<GitWorktreeHandle>} Newly acquired root worktree handle.
|
|
54
|
+
*/
|
|
55
|
+
acquireRoot(runId: string): Promise<GitWorktreeHandle>;
|
|
56
|
+
/**
|
|
57
|
+
* Rebinds an existing Task Root Worktree at `<dir>/roots/<runId>` during crash recovery.
|
|
58
|
+
*
|
|
59
|
+
* Completes interrupted `pendingParentHeadSha` or `inFlightMerge` state and rolls back `inFlightCommitAndPush`.
|
|
60
|
+
*
|
|
61
|
+
* @param {string} runId - Unique identifier of the recovering flow run.
|
|
62
|
+
* @param {string} [checkpoint] - Optional serialized checkpoint fallback when the worktree directory is missing.
|
|
63
|
+
*
|
|
64
|
+
* @returns {Promise<GitWorktreeHandle>} Reattached root worktree handle.
|
|
65
|
+
*/
|
|
66
|
+
reattachRoot(runId: string, checkpoint?: string): Promise<GitWorktreeHandle>;
|
|
67
|
+
/**
|
|
68
|
+
* Captures a non-mutating `GitScopeReceipt` for `handle` using a temporary `GIT_INDEX_FILE`.
|
|
69
|
+
*
|
|
70
|
+
* Pins `refs/harness/candidates/<run-id>/<branch-index>` when inspecting a speculative branch handle.
|
|
71
|
+
*
|
|
72
|
+
* @param {GitWorktreeHandle} handle - Active worktree handle to inspect.
|
|
73
|
+
*
|
|
74
|
+
* @returns {Promise<GitScopeReceipt>} Validated `GitScopeReceipt` without mutating live `HEAD` or `.git/index`.
|
|
75
|
+
*/
|
|
76
|
+
inspect(handle: GitWorktreeHandle): Promise<GitScopeReceipt>;
|
|
77
|
+
/**
|
|
78
|
+
* Pins the final commit SHA under `refs/harness/completed/...` and removes the worktree directory.
|
|
79
|
+
*
|
|
80
|
+
* Prunes `<gitdir>/harness-ckpt-blobs/` and `<gitdir>/harness-ckpt-nm/` before `git worktree remove --force`.
|
|
81
|
+
*
|
|
82
|
+
* @param {GitWorktreeHandle} handle - Ephemeral root or child worktree handle to release.
|
|
83
|
+
*
|
|
84
|
+
* @returns {Promise<void>} Resolves once the completed ref is pinned and the worktree is removed.
|
|
85
|
+
*/
|
|
86
|
+
release(handle: GitWorktreeHandle): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Captures the uncommitted working-tree and worktree-local `.git` state of `handle` into a JSON checkpoint token.
|
|
89
|
+
*
|
|
90
|
+
* Uses `git status --porcelain=v2 -z --no-renames --untracked-files=all` and a temporary `GIT_INDEX_FILE`.
|
|
91
|
+
*
|
|
92
|
+
* @param {GitWorktreeHandle} handle - Active worktree handle to snapshot.
|
|
93
|
+
*
|
|
94
|
+
* @returns {Promise<string>} Serialized JSON `GitCheckpointPayload` string.
|
|
95
|
+
*/
|
|
96
|
+
serializeCheckpoint(handle: GitWorktreeHandle): Promise<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Restores `handle` to the exact state captured by `checkpoint` using the 4-step restoration protocol.
|
|
99
|
+
*
|
|
100
|
+
* Restores `.git` metadata and `.gitignore` rules, unlinks symmetric-diff extras, checks out `treeSha`, and copies back oversized blobs.
|
|
101
|
+
*
|
|
102
|
+
* @param {GitWorktreeHandle} handle - Active worktree handle to roll back.
|
|
103
|
+
* @param {string} checkpoint - Serialized JSON checkpoint payload.
|
|
104
|
+
*
|
|
105
|
+
* @returns {Promise<void>} Resolves once `handle` matches `checkpoint`.
|
|
106
|
+
*/
|
|
107
|
+
restoreCheckpoint(handle: GitWorktreeHandle, checkpoint: string): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Verifies worktree-local `.git` and `node_modules` integrity and diffs `handle` against `fromCheckpoint`.
|
|
110
|
+
*
|
|
111
|
+
* Restores `fromCheckpoint` and throws immediately if `.git` metadata or `node_modules` was tampered with.
|
|
112
|
+
*
|
|
113
|
+
* @param {string} fromCheckpoint - Pre-tool serialized checkpoint payload.
|
|
114
|
+
* @param {GitWorktreeHandle} handle - Worktree handle after subprocess tool execution.
|
|
115
|
+
*
|
|
116
|
+
* @returns {Promise<readonly ToolEffect[]>} Synthesized `FsToolEffect` list for modified paths.
|
|
117
|
+
*/
|
|
118
|
+
diffEffects(fromCheckpoint: string, handle: GitWorktreeHandle): Promise<readonly ToolEffect[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Returns or creates the serialized `PQueue` (`concurrency: 1`) for `parentWorktreePath`.
|
|
121
|
+
*
|
|
122
|
+
* @param {string} parentWorktreePath - Absolute path of the parent worktree.
|
|
123
|
+
*
|
|
124
|
+
* @returns {PQueue} Serialized parent flush queue for `parentWorktreePath`.
|
|
125
|
+
*/
|
|
126
|
+
private getOrCreateParentFlushQueue;
|
|
127
|
+
/**
|
|
128
|
+
* Removes `activeQueue` from `parentFlushQueues` once no tasks remain queued or running.
|
|
129
|
+
*
|
|
130
|
+
* @param {string} parentWorktreePath - Absolute path of the parent worktree.
|
|
131
|
+
* @param {PQueue} activeQueue - Queue instance that just completed a task.
|
|
132
|
+
*/
|
|
133
|
+
private pruneIdleParentFlushQueue;
|
|
134
|
+
/**
|
|
135
|
+
* Flushes clean dirty files on `parent` under a per-parent async mutex and forks `<dir>/forks/<runId>/<forkId>`.
|
|
136
|
+
*
|
|
137
|
+
* Copies any remaining `unresolvedConflictPaths` from `parent` into the newly forked child worktree.
|
|
138
|
+
*
|
|
139
|
+
* @param {GitWorktreeHandle} parent - Parent worktree handle to clone from.
|
|
140
|
+
* @param {string} forkId - Unique child fork or speculative branch identifier.
|
|
141
|
+
*
|
|
142
|
+
* @returns {Promise<GitWorktreeHandle>} Newly provisioned child worktree handle.
|
|
143
|
+
*/
|
|
144
|
+
forkChild(parent: GitWorktreeHandle, forkId: string): Promise<GitWorktreeHandle>;
|
|
145
|
+
/**
|
|
146
|
+
* Rebinds an existing child fork worktree at `<dir>/forks/<runId>/<forkId>` during crash recovery.
|
|
147
|
+
*
|
|
148
|
+
* Completes any interrupted `inFlightMerge` state and preserves uncommitted child edits across reboots.
|
|
149
|
+
*
|
|
150
|
+
* @param {GitWorktreeHandle} parent - Reattached parent worktree handle.
|
|
151
|
+
* @param {string} forkId - Unique child fork identifier.
|
|
152
|
+
* @param {string} [checkpoint] - Optional serialized checkpoint fallback when the directory is missing.
|
|
153
|
+
*
|
|
154
|
+
* @returns {Promise<GitWorktreeHandle>} Reattached child worktree handle.
|
|
155
|
+
*/
|
|
156
|
+
reattachChild(parent: GitWorktreeHandle, forkId: string, checkpoint?: string): Promise<GitWorktreeHandle>;
|
|
157
|
+
/**
|
|
158
|
+
* Reconciles `child` into `parent` via stateless `git merge-tree --write-tree` over shared parent $C_0$.
|
|
159
|
+
*
|
|
160
|
+
* Leaves `parent` untouched on conflict and materializes conflicted blobs into `child` with `unresolvedConflictPaths`.
|
|
161
|
+
*
|
|
162
|
+
* @param {GitWorktreeHandle} child - Completed child worktree handle.
|
|
163
|
+
* @param {GitWorktreeHandle} parent - Target parent worktree handle.
|
|
164
|
+
*
|
|
165
|
+
* @returns {Promise<ReconcileResult<GitScopeReceipt>>} Clean or conflicted reconciliation result.
|
|
166
|
+
*/
|
|
167
|
+
commitChild(child: GitWorktreeHandle, parent: GitWorktreeHandle): Promise<ReconcileResult<GitScopeReceipt>>;
|
|
168
|
+
/**
|
|
169
|
+
* Rebases/merges uncommitted changes in `pausedChild` onto an updated `parent` worktree handle.
|
|
170
|
+
*
|
|
171
|
+
* Materializes the merged tree into `pausedChild` and updates `pausedChild.baseRef` to `parent.HEAD`.
|
|
172
|
+
*
|
|
173
|
+
* @param {GitWorktreeHandle} parent - Updated parent worktree handle.
|
|
174
|
+
* @param {GitWorktreeHandle} pausedChild - Suspended child worktree handle being resumed.
|
|
175
|
+
*
|
|
176
|
+
* @returns {Promise<ReconcileResult<GitSyncReceipt>>} Clean or conflicted synchronization result.
|
|
177
|
+
*/
|
|
178
|
+
syncChild(parent: GitWorktreeHandle, pausedChild: GitWorktreeHandle): Promise<ReconcileResult<GitSyncReceipt>>;
|
|
179
|
+
/**
|
|
180
|
+
* Synchronizes `rootHandle` onto the terminal commit of completed prerequisite runs.
|
|
181
|
+
*
|
|
182
|
+
* Updates `rootHandle.baseBranch` when prerequisite branches remain unmerged on `origin/main`.
|
|
183
|
+
*
|
|
184
|
+
* @param {GitWorktreeHandle} rootHandle - Task root worktree handle.
|
|
185
|
+
* @param {readonly GitScopeReceipt[]} prerequisiteReceipts - Terminal scope receipts of completed prerequisites.
|
|
186
|
+
*
|
|
187
|
+
* @returns {Promise<ReconcileResult<GitSyncReceipt>>} Clean or conflicted synchronization result.
|
|
188
|
+
*/
|
|
189
|
+
syncRoot(rootHandle: GitWorktreeHandle, prerequisiteReceipts: readonly GitScopeReceipt[]): Promise<ReconcileResult<GitSyncReceipt>>;
|
|
190
|
+
/**
|
|
191
|
+
* Returns a temporary write capability lease (`fs:match-globs`) for `handle.unresolvedConflictPaths`.
|
|
192
|
+
*
|
|
193
|
+
* Returns `undefined` when `handle.unresolvedConflictPaths` is empty.
|
|
194
|
+
*
|
|
195
|
+
* @param {GitWorktreeHandle} handle - Worktree handle containing unresolved conflict paths.
|
|
196
|
+
*
|
|
197
|
+
* @returns {LeaseDelta | undefined} Temporary conflict write lease delta, or `undefined` when clean.
|
|
198
|
+
*/
|
|
199
|
+
getConflictLease(handle: GitWorktreeHandle): LeaseDelta | undefined;
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=git-cow-worktree-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-cow-worktree-scope.d.ts","sourceRoot":"","sources":["../../src/executors/git-cow-worktree-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,UAAU,EACX,MAAM,mBAAmB,CAAC;AAgC3B;;;;;GAKG;AACH,qBAAa,yBACX,YAAW,eAAe,CAAC,iBAAiB,EAAE,eAAe,EAAE,cAAc,CAAC;IAE9E,iEAAiE;IACjE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,QAAQ,CAAC,aAAa;;;;;;;qCAAyB;IAC/C,iGAAiG;IACjG,QAAQ,CAAC,UAAU;;;;qCAAwB;IAC3C,0FAA0F;IAC1F,QAAQ,CAAC,mBAAmB,EAAG,IAAI,CAAU;IAC7C,0GAA0G;IAC1G,QAAQ,CAAC,iBAAiB,EAAG,IAAI,CAAU;IAC3C,8DAA8D;IAC9D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;IAC1C,mGAAmG;IACnG,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAgC;IACtE,yEAAyE;IACzE,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAyC;IACnF,0HAA0H;IAC1H,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA6B;IAE/D;;;;;;OAMG;gBACS,IAAI,EAAE,kBAAkB;IAOpC;;;;;;;;OAQG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAItD;;;;;;;;;OASG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CA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G,OAAO,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAInI;;;;;;;;OAQG;IACH,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU,GAAG,SAAS;CAGpE"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import PQueue from 'p-queue';
|
|
2
|
+
import { GitScopeReceiptSchema, GitSyncReceiptSchema, } from '../schemas/git-receipts.schema.js';
|
|
3
|
+
import { gitCheckpointDiffEffects } from './internal/git-checkpoint-diff-effects.js';
|
|
4
|
+
import { gitCheckpointRestore } from './internal/git-checkpoint-restore.js';
|
|
5
|
+
import { gitCheckpointSerialize } from './internal/git-checkpoint-serialize.js';
|
|
6
|
+
import { gitWorktreeAcquireRoot } from './internal/git-worktree-acquire-root.js';
|
|
7
|
+
import { gitWorktreeCommitChild, gitWorktreeInspectNonMutating, } from './internal/git-worktree-commit-child.js';
|
|
8
|
+
import { buildConflictLeaseDelta, gitWorktreeFlushCleanParentChanges, } from './internal/git-worktree-flush-and-prune.js';
|
|
9
|
+
import { gitWorktreeForkChild, gitWorktreeReleaseAndPinRef, } from './internal/git-worktree-fork-and-release.js';
|
|
10
|
+
import { gitWorktreeReattachChild, gitWorktreeReattachRoot, resolveEffectiveCheckpointPolicy, } from './internal/git-worktree-reattach.js';
|
|
11
|
+
import { gitWorktreeSyncChild, gitWorktreeSyncRoot, } from './internal/git-worktree-sync-child-and-root.js';
|
|
12
|
+
/**
|
|
13
|
+
* Tier-3 branchable Copy-on-Write Git worktree isolation scope driver (`git.cowWorktree`).
|
|
14
|
+
*
|
|
15
|
+
* Implements disjoint root/fork worktrees, git-index checkpoints, post-flight `.git` integrity diffing,
|
|
16
|
+
* automatic parent dirty-tree flushing, and stateless `git merge-tree --write-tree` 3-way reconciliation.
|
|
17
|
+
*/
|
|
18
|
+
export class GitCowWorktreeScopeDriver {
|
|
19
|
+
/** Unique identifier of this isolation scope driver instance. */
|
|
20
|
+
id;
|
|
21
|
+
/** Zod schema validating inspection receipts returned by `inspect()`. */
|
|
22
|
+
receiptSchema = GitScopeReceiptSchema;
|
|
23
|
+
/** Zod schema validating synchronization receipts returned by `syncChild()` and `syncRoot()`. */
|
|
24
|
+
syncSchema = GitSyncReceiptSchema;
|
|
25
|
+
/** Capability flag confirming git-index checkpoint serialization and rollback support. */
|
|
26
|
+
supportsCheckpoints = true;
|
|
27
|
+
/** Capability flag confirming Copy-on-Write child worktree branching and 3-way reconciliation support. */
|
|
28
|
+
supportsBranching = true;
|
|
29
|
+
/** Passive AST configuration node for this worktree scope. */
|
|
30
|
+
node;
|
|
31
|
+
/** Precomputed union of `node.excludeFromCloneGlobs` and `node.checkpointPolicy?.excludeGlobs`. */
|
|
32
|
+
effectiveExcludeGlobs;
|
|
33
|
+
/** Precomputed checkpoint policy with merged `effectiveExcludeGlobs`. */
|
|
34
|
+
effectiveCheckpointPolicy;
|
|
35
|
+
/** Per-parent worktree `PQueue` (`concurrency: 1`) serializing automatic parent dirty-tree flushes during `forkChild`. */
|
|
36
|
+
parentFlushQueues = new Map();
|
|
37
|
+
/**
|
|
38
|
+
* Initializes a `GitCowWorktreeScopeDriver` from its passive `GitCowWorktreeNode` AST configuration.
|
|
39
|
+
*
|
|
40
|
+
* Binds the repository path, disjoint worktree directory layout, and checkpoint policy configuration.
|
|
41
|
+
*
|
|
42
|
+
* @param {GitCowWorktreeNode} node - Passive worktree scope AST configuration node.
|
|
43
|
+
*/
|
|
44
|
+
constructor(node) {
|
|
45
|
+
this.id = node.id;
|
|
46
|
+
this.node = node;
|
|
47
|
+
this.effectiveCheckpointPolicy = resolveEffectiveCheckpointPolicy(node);
|
|
48
|
+
this.effectiveExcludeGlobs = this.effectiveCheckpointPolicy?.excludeGlobs;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Provisions an isolated Task Root Worktree at `<dir>/roots/<runId>` for `runId`.
|
|
52
|
+
*
|
|
53
|
+
* Hydrates `node_modules` according to `.lockfileGate` and `.setup` and initializes `<gitdir>/harness-meta.json`.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} runId - Unique identifier of the flow run.
|
|
56
|
+
*
|
|
57
|
+
* @returns {Promise<GitWorktreeHandle>} Newly acquired root worktree handle.
|
|
58
|
+
*/
|
|
59
|
+
acquireRoot(runId) {
|
|
60
|
+
return gitWorktreeAcquireRoot(this.node, runId);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Rebinds an existing Task Root Worktree at `<dir>/roots/<runId>` during crash recovery.
|
|
64
|
+
*
|
|
65
|
+
* Completes interrupted `pendingParentHeadSha` or `inFlightMerge` state and rolls back `inFlightCommitAndPush`.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} runId - Unique identifier of the recovering flow run.
|
|
68
|
+
* @param {string} [checkpoint] - Optional serialized checkpoint fallback when the worktree directory is missing.
|
|
69
|
+
*
|
|
70
|
+
* @returns {Promise<GitWorktreeHandle>} Reattached root worktree handle.
|
|
71
|
+
*/
|
|
72
|
+
reattachRoot(runId, checkpoint) {
|
|
73
|
+
return gitWorktreeReattachRoot(this.node, runId, checkpoint);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Captures a non-mutating `GitScopeReceipt` for `handle` using a temporary `GIT_INDEX_FILE`.
|
|
77
|
+
*
|
|
78
|
+
* Pins `refs/harness/candidates/<run-id>/<branch-index>` when inspecting a speculative branch handle.
|
|
79
|
+
*
|
|
80
|
+
* @param {GitWorktreeHandle} handle - Active worktree handle to inspect.
|
|
81
|
+
*
|
|
82
|
+
* @returns {Promise<GitScopeReceipt>} Validated `GitScopeReceipt` without mutating live `HEAD` or `.git/index`.
|
|
83
|
+
*/
|
|
84
|
+
inspect(handle) {
|
|
85
|
+
return gitWorktreeInspectNonMutating(handle, this.effectiveExcludeGlobs);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Pins the final commit SHA under `refs/harness/completed/...` and removes the worktree directory.
|
|
89
|
+
*
|
|
90
|
+
* Prunes `<gitdir>/harness-ckpt-blobs/` and `<gitdir>/harness-ckpt-nm/` before `git worktree remove --force`.
|
|
91
|
+
*
|
|
92
|
+
* @param {GitWorktreeHandle} handle - Ephemeral root or child worktree handle to release.
|
|
93
|
+
*
|
|
94
|
+
* @returns {Promise<void>} Resolves once the completed ref is pinned and the worktree is removed.
|
|
95
|
+
*/
|
|
96
|
+
release(handle) {
|
|
97
|
+
this.parentFlushQueues.delete(handle.worktreePath);
|
|
98
|
+
return gitWorktreeReleaseAndPinRef(handle, this.effectiveExcludeGlobs);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Captures the uncommitted working-tree and worktree-local `.git` state of `handle` into a JSON checkpoint token.
|
|
102
|
+
*
|
|
103
|
+
* Uses `git status --porcelain=v2 -z --no-renames --untracked-files=all` and a temporary `GIT_INDEX_FILE`.
|
|
104
|
+
*
|
|
105
|
+
* @param {GitWorktreeHandle} handle - Active worktree handle to snapshot.
|
|
106
|
+
*
|
|
107
|
+
* @returns {Promise<string>} Serialized JSON `GitCheckpointPayload` string.
|
|
108
|
+
*/
|
|
109
|
+
serializeCheckpoint(handle) {
|
|
110
|
+
return gitCheckpointSerialize(handle, this.effectiveCheckpointPolicy);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Restores `handle` to the exact state captured by `checkpoint` using the 4-step restoration protocol.
|
|
114
|
+
*
|
|
115
|
+
* Restores `.git` metadata and `.gitignore` rules, unlinks symmetric-diff extras, checks out `treeSha`, and copies back oversized blobs.
|
|
116
|
+
*
|
|
117
|
+
* @param {GitWorktreeHandle} handle - Active worktree handle to roll back.
|
|
118
|
+
* @param {string} checkpoint - Serialized JSON checkpoint payload.
|
|
119
|
+
*
|
|
120
|
+
* @returns {Promise<void>} Resolves once `handle` matches `checkpoint`.
|
|
121
|
+
*/
|
|
122
|
+
restoreCheckpoint(handle, checkpoint) {
|
|
123
|
+
return gitCheckpointRestore(handle, checkpoint, this.effectiveCheckpointPolicy);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Verifies worktree-local `.git` and `node_modules` integrity and diffs `handle` against `fromCheckpoint`.
|
|
127
|
+
*
|
|
128
|
+
* Restores `fromCheckpoint` and throws immediately if `.git` metadata or `node_modules` was tampered with.
|
|
129
|
+
*
|
|
130
|
+
* @param {string} fromCheckpoint - Pre-tool serialized checkpoint payload.
|
|
131
|
+
* @param {GitWorktreeHandle} handle - Worktree handle after subprocess tool execution.
|
|
132
|
+
*
|
|
133
|
+
* @returns {Promise<readonly ToolEffect[]>} Synthesized `FsToolEffect` list for modified paths.
|
|
134
|
+
*/
|
|
135
|
+
diffEffects(fromCheckpoint, handle) {
|
|
136
|
+
return gitCheckpointDiffEffects(fromCheckpoint, handle, this.effectiveCheckpointPolicy);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Returns or creates the serialized `PQueue` (`concurrency: 1`) for `parentWorktreePath`.
|
|
140
|
+
*
|
|
141
|
+
* @param {string} parentWorktreePath - Absolute path of the parent worktree.
|
|
142
|
+
*
|
|
143
|
+
* @returns {PQueue} Serialized parent flush queue for `parentWorktreePath`.
|
|
144
|
+
*/
|
|
145
|
+
getOrCreateParentFlushQueue(parentWorktreePath) {
|
|
146
|
+
const existing = this.parentFlushQueues.get(parentWorktreePath);
|
|
147
|
+
if (existing !== undefined)
|
|
148
|
+
return existing;
|
|
149
|
+
const created = new PQueue({ concurrency: 1 });
|
|
150
|
+
this.parentFlushQueues.set(parentWorktreePath, created);
|
|
151
|
+
return created;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Removes `activeQueue` from `parentFlushQueues` once no tasks remain queued or running.
|
|
155
|
+
*
|
|
156
|
+
* @param {string} parentWorktreePath - Absolute path of the parent worktree.
|
|
157
|
+
* @param {PQueue} activeQueue - Queue instance that just completed a task.
|
|
158
|
+
*/
|
|
159
|
+
pruneIdleParentFlushQueue(parentWorktreePath, activeQueue) {
|
|
160
|
+
if (activeQueue.size === 0 &&
|
|
161
|
+
activeQueue.pending === 0 &&
|
|
162
|
+
this.parentFlushQueues.get(parentWorktreePath) === activeQueue) {
|
|
163
|
+
this.parentFlushQueues.delete(parentWorktreePath);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Flushes clean dirty files on `parent` under a per-parent async mutex and forks `<dir>/forks/<runId>/<forkId>`.
|
|
168
|
+
*
|
|
169
|
+
* Copies any remaining `unresolvedConflictPaths` from `parent` into the newly forked child worktree.
|
|
170
|
+
*
|
|
171
|
+
* @param {GitWorktreeHandle} parent - Parent worktree handle to clone from.
|
|
172
|
+
* @param {string} forkId - Unique child fork or speculative branch identifier.
|
|
173
|
+
*
|
|
174
|
+
* @returns {Promise<GitWorktreeHandle>} Newly provisioned child worktree handle.
|
|
175
|
+
*/
|
|
176
|
+
async forkChild(parent, forkId) {
|
|
177
|
+
const excludeGlobs = this.effectiveExcludeGlobs;
|
|
178
|
+
const activeQueue = this.getOrCreateParentFlushQueue(parent.worktreePath);
|
|
179
|
+
try {
|
|
180
|
+
await activeQueue.add(async () => {
|
|
181
|
+
await gitWorktreeFlushCleanParentChanges(parent, excludeGlobs);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
finally {
|
|
185
|
+
this.pruneIdleParentFlushQueue(parent.worktreePath, activeQueue);
|
|
186
|
+
}
|
|
187
|
+
return gitWorktreeForkChild(this.node, parent, forkId);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Rebinds an existing child fork worktree at `<dir>/forks/<runId>/<forkId>` during crash recovery.
|
|
191
|
+
*
|
|
192
|
+
* Completes any interrupted `inFlightMerge` state and preserves uncommitted child edits across reboots.
|
|
193
|
+
*
|
|
194
|
+
* @param {GitWorktreeHandle} parent - Reattached parent worktree handle.
|
|
195
|
+
* @param {string} forkId - Unique child fork identifier.
|
|
196
|
+
* @param {string} [checkpoint] - Optional serialized checkpoint fallback when the directory is missing.
|
|
197
|
+
*
|
|
198
|
+
* @returns {Promise<GitWorktreeHandle>} Reattached child worktree handle.
|
|
199
|
+
*/
|
|
200
|
+
reattachChild(parent, forkId, checkpoint) {
|
|
201
|
+
return gitWorktreeReattachChild({
|
|
202
|
+
node: this.node,
|
|
203
|
+
parent,
|
|
204
|
+
forkId,
|
|
205
|
+
checkpoint,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Reconciles `child` into `parent` via stateless `git merge-tree --write-tree` over shared parent $C_0$.
|
|
210
|
+
*
|
|
211
|
+
* Leaves `parent` untouched on conflict and materializes conflicted blobs into `child` with `unresolvedConflictPaths`.
|
|
212
|
+
*
|
|
213
|
+
* @param {GitWorktreeHandle} child - Completed child worktree handle.
|
|
214
|
+
* @param {GitWorktreeHandle} parent - Target parent worktree handle.
|
|
215
|
+
*
|
|
216
|
+
* @returns {Promise<ReconcileResult<GitScopeReceipt>>} Clean or conflicted reconciliation result.
|
|
217
|
+
*/
|
|
218
|
+
commitChild(child, parent) {
|
|
219
|
+
return gitWorktreeCommitChild(child, parent, this.effectiveExcludeGlobs);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Rebases/merges uncommitted changes in `pausedChild` onto an updated `parent` worktree handle.
|
|
223
|
+
*
|
|
224
|
+
* Materializes the merged tree into `pausedChild` and updates `pausedChild.baseRef` to `parent.HEAD`.
|
|
225
|
+
*
|
|
226
|
+
* @param {GitWorktreeHandle} parent - Updated parent worktree handle.
|
|
227
|
+
* @param {GitWorktreeHandle} pausedChild - Suspended child worktree handle being resumed.
|
|
228
|
+
*
|
|
229
|
+
* @returns {Promise<ReconcileResult<GitSyncReceipt>>} Clean or conflicted synchronization result.
|
|
230
|
+
*/
|
|
231
|
+
syncChild(parent, pausedChild) {
|
|
232
|
+
return gitWorktreeSyncChild(parent, pausedChild, this.effectiveExcludeGlobs);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Synchronizes `rootHandle` onto the terminal commit of completed prerequisite runs.
|
|
236
|
+
*
|
|
237
|
+
* Updates `rootHandle.baseBranch` when prerequisite branches remain unmerged on `origin/main`.
|
|
238
|
+
*
|
|
239
|
+
* @param {GitWorktreeHandle} rootHandle - Task root worktree handle.
|
|
240
|
+
* @param {readonly GitScopeReceipt[]} prerequisiteReceipts - Terminal scope receipts of completed prerequisites.
|
|
241
|
+
*
|
|
242
|
+
* @returns {Promise<ReconcileResult<GitSyncReceipt>>} Clean or conflicted synchronization result.
|
|
243
|
+
*/
|
|
244
|
+
syncRoot(rootHandle, prerequisiteReceipts) {
|
|
245
|
+
return gitWorktreeSyncRoot(rootHandle, prerequisiteReceipts, this.effectiveExcludeGlobs);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Returns a temporary write capability lease (`fs:match-globs`) for `handle.unresolvedConflictPaths`.
|
|
249
|
+
*
|
|
250
|
+
* Returns `undefined` when `handle.unresolvedConflictPaths` is empty.
|
|
251
|
+
*
|
|
252
|
+
* @param {GitWorktreeHandle} handle - Worktree handle containing unresolved conflict paths.
|
|
253
|
+
*
|
|
254
|
+
* @returns {LeaseDelta | undefined} Temporary conflict write lease delta, or `undefined` when clean.
|
|
255
|
+
*/
|
|
256
|
+
getConflictLease(handle) {
|
|
257
|
+
return buildConflictLeaseDelta(handle);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=git-cow-worktree-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-cow-worktree-scope.js","sourceRoot":"","sources":["../../src/executors/git-cow-worktree-scope.ts"],"names":[],"mappings":"AAUA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC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AK,EAAE,MAAM,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;;;;;OASG;IACH,SAAS,CAAC,MAAyB,EAAE,WAA8B;QACjE,OAAO,oBAAoB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,UAA6B,EAAE,oBAAgD;QACtF,OAAO,mBAAmB,CAAC,UAAU,EAAE,oBAAoB,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;;;;OAQG;IACH,gBAAgB,CAAC,MAAyB;QACxC,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CrossVerifierBranchCandidate, GitCandidateComparisonToolNode, GitPatchEquivalenceNode, GitPublicSurfaceCrossTesterNode, GitRefReaderToolNode, GitWorktreeHandle, StepExecutionContext, ToolDriver } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Executes a `GitPublicSurfaceCrossTesterNode` (`git.publicSurfaceCrossTester`) across speculative candidates.
|
|
4
|
+
*
|
|
5
|
+
* Collects boundary-only tests from each candidate and transplants them into sibling candidates inside a checkpoint sandbox.
|
|
6
|
+
*
|
|
7
|
+
* @param {GitPublicSurfaceCrossTesterNode<unknown>} node - Public-surface cross-tester AST node.
|
|
8
|
+
* @param {ReadonlyArray<CrossVerifierBranchCandidate<GitWorktreeHandle>>} candidates - Surviving speculative candidate branches.
|
|
9
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Promise<Readonly<Record<number, unknown>>>} Per-branch cross-testing report indexed by `branchIndex`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function executeGitPublicSurfaceCrossTester(node: GitPublicSurfaceCrossTesterNode<unknown>, candidates: ReadonlyArray<CrossVerifierBranchCandidate<GitWorktreeHandle>>, ctx: StepExecutionContext<GitWorktreeHandle>): Promise<Readonly<Record<number, unknown>>>;
|
|
14
|
+
/**
|
|
15
|
+
* Executes a `GitPatchEquivalenceNode` (`git.patchEquivalence`) across speculative worktree candidates.
|
|
16
|
+
*
|
|
17
|
+
* Computes normalized patch digests relative to `baseRef` and groups equivalent candidate branch indices.
|
|
18
|
+
*
|
|
19
|
+
* @param {GitPatchEquivalenceNode<unknown>} node - Patch-equivalence cross-verifier AST node.
|
|
20
|
+
* @param {ReadonlyArray<CrossVerifierBranchCandidate<GitWorktreeHandle>>} candidates - Surviving speculative candidate branches.
|
|
21
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} _ctx - Active step execution context.
|
|
22
|
+
*
|
|
23
|
+
* @returns {Promise<Readonly<Record<number, unknown>>>} Per-branch patch equivalence report indexed by `branchIndex`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function executeGitPatchEquivalence(node: GitPatchEquivalenceNode<unknown>, candidates: ReadonlyArray<CrossVerifierBranchCandidate<GitWorktreeHandle>>, _ctx: StepExecutionContext<GitWorktreeHandle>): Promise<Readonly<Record<number, unknown>>>;
|
|
26
|
+
/**
|
|
27
|
+
* Creates the `ToolDriver` handling `GitRefReaderToolNode` (`git:ref-reader-tool`) invocations.
|
|
28
|
+
*
|
|
29
|
+
* Declares zero scope effects (`describeEffects: () => []`) and dispatches `readRefFile`, `diffRefs`, and `listRefFiles`.
|
|
30
|
+
*
|
|
31
|
+
* @returns {ToolDriver<GitRefReaderToolNode<GitWorktreeHandle>, GitWorktreeHandle>} Stateless ref-reader tool driver.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createGitRefReaderToolDrivers(): ToolDriver<GitRefReaderToolNode<GitWorktreeHandle>, GitWorktreeHandle>;
|
|
34
|
+
/**
|
|
35
|
+
* Creates the `ToolDriver` handling `GitCandidateComparisonToolNode` (`git:candidate-comparison-tool`) invocations.
|
|
36
|
+
*
|
|
37
|
+
* Declares zero scope effects (`describeEffects: () => []`) and dispatches `diffCandidates`, `readCandidateFile`, and `evalInCandidates`.
|
|
38
|
+
*
|
|
39
|
+
* @returns {ToolDriver<GitCandidateComparisonToolNode<GitWorktreeHandle>, GitWorktreeHandle>} Stateless candidate comparison tool driver.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createGitCandidateComparisonToolDrivers(): ToolDriver<GitCandidateComparisonToolNode<GitWorktreeHandle>, GitWorktreeHandle>;
|
|
42
|
+
//# sourceMappingURL=git-cross-verifiers-and-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-cross-verifiers-and-tools.d.ts","sourceRoot":"","sources":["../../src/executors/git-cross-verifiers-and-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,8BAA8B,EAC9B,uBAAuB,EACvB,+BAA+B,EAC/B,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAQ3B;;;;;;;;;;GAUG;AACH,wBAAsB,kCAAkC,CACtD,IAAI,EAAE,+BAA+B,CAAC,OAAO,CAAC,EAC9C,UAAU,EAAE,aAAa,CAAC,4BAA4B,CAAC,iBAAiB,CAAC,CAAC,EAC1E,GAAG,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,GAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAO5C;AA6BD;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,uBAAuB,CAAC,OAAO,CAAC,EACtC,UAAU,EAAE,aAAa,CAAC,4BAA4B,CAAC,iBAAiB,CAAC,CAAC,EAC1E,IAAI,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,GAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CA0B5C;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,IAAI,UAAU,CACzD,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,iBAAiB,CAClB,CASA;AAED;;;;;;GAMG;AACH,wBAAgB,uCAAuC,IAAI,UAAU,CACnE,8BAA8B,CAAC,iBAAiB,CAAC,EACjD,iBAAiB,CAClB,CASA"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { runGitCommand } from './internal/git-cli-runner.js';
|
|
2
|
+
import { runPublicSurfaceCrossVerification } from './internal/git-cross-test-import-scanner.js';
|
|
3
|
+
import { dispatchCandidateComparisonToolCall, dispatchRefReaderToolCall, } from './internal/git-tool-dispatchers.js';
|
|
4
|
+
/**
|
|
5
|
+
* Executes a `GitPublicSurfaceCrossTesterNode` (`git.publicSurfaceCrossTester`) across speculative candidates.
|
|
6
|
+
*
|
|
7
|
+
* Collects boundary-only tests from each candidate and transplants them into sibling candidates inside a checkpoint sandbox.
|
|
8
|
+
*
|
|
9
|
+
* @param {GitPublicSurfaceCrossTesterNode<unknown>} node - Public-surface cross-tester AST node.
|
|
10
|
+
* @param {ReadonlyArray<CrossVerifierBranchCandidate<GitWorktreeHandle>>} candidates - Surviving speculative candidate branches.
|
|
11
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
12
|
+
*
|
|
13
|
+
* @returns {Promise<Readonly<Record<number, unknown>>>} Per-branch cross-testing report indexed by `branchIndex`.
|
|
14
|
+
*/
|
|
15
|
+
export async function executeGitPublicSurfaceCrossTester(node, candidates, ctx) {
|
|
16
|
+
const runVerifier = () => runPublicSurfaceCrossVerification(node, candidates, ctx.signal);
|
|
17
|
+
if (node.runner !== undefined && typeof ctx.getRunner === 'function') {
|
|
18
|
+
return ctx.getRunner(node.runner).withSlot(runVerifier, ctx.signal);
|
|
19
|
+
}
|
|
20
|
+
return runVerifier();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Computes the normalized `git patch-id --stable` digest for a single speculative candidate branch.
|
|
24
|
+
*
|
|
25
|
+
* @param {CrossVerifierBranchCandidate<GitWorktreeHandle>} candidate - Speculative candidate descriptor.
|
|
26
|
+
*
|
|
27
|
+
* @returns {Promise<string>} Stable normalized patch digest, or `'EMPTY_PATCH'` when the diff is empty.
|
|
28
|
+
*/
|
|
29
|
+
async function computeCandidatePatchDigest(candidate) {
|
|
30
|
+
const cwd = candidate.scopeHandle.worktreePath;
|
|
31
|
+
const headSha = typeof candidate.scopeReceipt['headRef'] === 'string'
|
|
32
|
+
? candidate.scopeReceipt['headRef']
|
|
33
|
+
: (candidate.scopeHandle.headRef ?? candidate.scopeHandle.baseRef);
|
|
34
|
+
const diffOutput = await runGitCommand({
|
|
35
|
+
cwd,
|
|
36
|
+
args: ['diff', '--no-ext-diff', '--no-color', candidate.scopeHandle.baseRef, headSha],
|
|
37
|
+
});
|
|
38
|
+
if (diffOutput.stdout.trim().length === 0)
|
|
39
|
+
return 'EMPTY_PATCH';
|
|
40
|
+
const patchOutput = await runGitCommand({
|
|
41
|
+
cwd,
|
|
42
|
+
args: ['patch-id', '--stable'],
|
|
43
|
+
stdin: diffOutput.stdout,
|
|
44
|
+
});
|
|
45
|
+
return patchOutput.stdout.trim().split(/\s+/)[0] || 'EMPTY_PATCH';
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Executes a `GitPatchEquivalenceNode` (`git.patchEquivalence`) across speculative worktree candidates.
|
|
49
|
+
*
|
|
50
|
+
* Computes normalized patch digests relative to `baseRef` and groups equivalent candidate branch indices.
|
|
51
|
+
*
|
|
52
|
+
* @param {GitPatchEquivalenceNode<unknown>} node - Patch-equivalence cross-verifier AST node.
|
|
53
|
+
* @param {ReadonlyArray<CrossVerifierBranchCandidate<GitWorktreeHandle>>} candidates - Surviving speculative candidate branches.
|
|
54
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} _ctx - Active step execution context.
|
|
55
|
+
*
|
|
56
|
+
* @returns {Promise<Readonly<Record<number, unknown>>>} Per-branch patch equivalence report indexed by `branchIndex`.
|
|
57
|
+
*/
|
|
58
|
+
export async function executeGitPatchEquivalence(node, candidates, _ctx) {
|
|
59
|
+
const digestByBranch = new Map();
|
|
60
|
+
const branchesByDigest = new Map();
|
|
61
|
+
const groupIndexByDigest = new Map();
|
|
62
|
+
for (const cand of candidates) {
|
|
63
|
+
const digest = await computeCandidatePatchDigest(cand);
|
|
64
|
+
digestByBranch.set(cand.branchIndex, digest);
|
|
65
|
+
const existingGroup = branchesByDigest.get(digest);
|
|
66
|
+
if (existingGroup !== undefined)
|
|
67
|
+
existingGroup.push(cand.branchIndex);
|
|
68
|
+
else {
|
|
69
|
+
groupIndexByDigest.set(digest, branchesByDigest.size);
|
|
70
|
+
branchesByDigest.set(digest, [cand.branchIndex]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const reports = {};
|
|
74
|
+
for (const cand of candidates) {
|
|
75
|
+
const digest = digestByBranch.get(cand.branchIndex) ?? '';
|
|
76
|
+
const equivalenceGroupIndex = groupIndexByDigest.get(digest) ?? 0;
|
|
77
|
+
const equivalentBranchIndices = branchesByDigest.get(digest) ?? [cand.branchIndex];
|
|
78
|
+
reports[cand.branchIndex] = node.reportSchema.parse({
|
|
79
|
+
equivalenceGroupIndex,
|
|
80
|
+
equivalentBranchIndices,
|
|
81
|
+
normalizedPatchDigest: digest,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return Object.freeze(reports);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Creates the `ToolDriver` handling `GitRefReaderToolNode` (`git:ref-reader-tool`) invocations.
|
|
88
|
+
*
|
|
89
|
+
* Declares zero scope effects (`describeEffects: () => []`) and dispatches `readRefFile`, `diffRefs`, and `listRefFiles`.
|
|
90
|
+
*
|
|
91
|
+
* @returns {ToolDriver<GitRefReaderToolNode<GitWorktreeHandle>, GitWorktreeHandle>} Stateless ref-reader tool driver.
|
|
92
|
+
*/
|
|
93
|
+
export function createGitRefReaderToolDrivers() {
|
|
94
|
+
return Object.freeze({
|
|
95
|
+
describeEffects: () => [],
|
|
96
|
+
execute: (node, args, ctx) => dispatchRefReaderToolCall(node, args, ctx),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Creates the `ToolDriver` handling `GitCandidateComparisonToolNode` (`git:candidate-comparison-tool`) invocations.
|
|
101
|
+
*
|
|
102
|
+
* Declares zero scope effects (`describeEffects: () => []`) and dispatches `diffCandidates`, `readCandidateFile`, and `evalInCandidates`.
|
|
103
|
+
*
|
|
104
|
+
* @returns {ToolDriver<GitCandidateComparisonToolNode<GitWorktreeHandle>, GitWorktreeHandle>} Stateless candidate comparison tool driver.
|
|
105
|
+
*/
|
|
106
|
+
export function createGitCandidateComparisonToolDrivers() {
|
|
107
|
+
return Object.freeze({
|
|
108
|
+
describeEffects: () => [],
|
|
109
|
+
execute: (node, args, ctx) => dispatchCandidateComparisonToolCall(node, args, ctx),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=git-cross-verifiers-and-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-cross-verifiers-and-tools.js","sourceRoot":"","sources":["../../src/executors/git-cross-verifiers-and-tools.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,6CAA6C,CAAC;AAChG,OAAO,EACL,mCAAmC,EACnC,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,IAA8C,EAC9C,UAA0E,EAC1E,GAA4C;IAE5C,MAAM,WAAW,GAAG,GAA+C,EAAE,CACnE,iCAAiC,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClE,IAAI,IAAI,CAAC,MAAM,KAAK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CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,6BAA6B;IAI3C,OAAO,MAAM,CAAC,MAAM,CAAyE;QAC3F,eAAe,EAAE,GAAG,EAAE,CAAC,EAAE;QACzB,OAAO,EAAE,CACP,IAA6C,EAC7C,IAAa,EACb,GAA4C,EAC5C,EAAE,CAAC,yBAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC;KAChD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uCAAuC;IAIrD,OAAO,MAAM,CAAC,MAAM,CAAmF;QACrG,eAAe,EAAE,GAAG,EAAE,CAAC,EAAE;QACzB,OAAO,EAAE,CACP,IAAuD,EACvD,IAAa,EACb,GAA4C,EAC5C,EAAE,CAAC,mCAAmC,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC;KAC1D,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RuntimeExecutorRegistrySlice } from '@paraharness/core';
|
|
2
|
+
/** Default frozen `RuntimeExecutorRegistrySlice` instance for `@paraharness/git`. */
|
|
3
|
+
export declare const gitExecutors: RuntimeExecutorRegistrySlice;
|
|
4
|
+
//# sourceMappingURL=git-executors.constants.d.ts.map
|