@paraharness/git 0.0.0-stage → 0.2.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 +14 -0
- package/dist/builders/create-git-candidate-comparison-tools.d.ts.map +1 -0
- package/dist/builders/create-git-candidate-comparison-tools.js +42 -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 +60 -0
- package/dist/builders/create-git-commit-and-push-builder.js.map +1 -0
- package/dist/builders/create-git-cow-worktree-builder.d.ts +16 -0
- package/dist/builders/create-git-cow-worktree-builder.d.ts.map +1 -0
- package/dist/builders/create-git-cow-worktree-builder.js +72 -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 +38 -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 +14 -0
- package/dist/builders/create-git-ref-reader-tools.d.ts.map +1 -0
- package/dist/builders/create-git-ref-reader-tools.js +42 -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 +142 -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,43 @@
|
|
|
1
|
+
import type { GitWorktreeHandle, LeaseDelta } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Tests whether `content` contains a complete paired Git conflict marker block (`<<<<<<< `, `=======`, `>>>>>>> `).
|
|
4
|
+
*
|
|
5
|
+
* Ignores standalone Markdown `=======` headings that are not preceded by `^<{7} ` and followed by `^>{7} `.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} content - UTF-8 file or diff text to inspect.
|
|
8
|
+
*
|
|
9
|
+
* @returns {boolean} `true` if a complete paired conflict marker block is present.
|
|
10
|
+
*/
|
|
11
|
+
export declare function hasPairedConflictMarkers(content: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Prunes entries in `handle.unresolvedConflictPaths` whose working-tree digest changed and contain no conflict markers.
|
|
14
|
+
*
|
|
15
|
+
* Persists the updated `unresolvedConflictPaths` map in `<gitdir>/harness-meta.json` and updates `handle` in-place.
|
|
16
|
+
*
|
|
17
|
+
* @param {GitWorktreeHandle} handle - Worktree handle whose conflict map should be pruned.
|
|
18
|
+
*
|
|
19
|
+
* @returns {Promise<Readonly<Record<string, string>>>} Frozen map of remaining unresolved conflict paths to digests.
|
|
20
|
+
*/
|
|
21
|
+
export declare function gitWorktreePruneResolvedConflicts(handle: GitWorktreeHandle): Promise<Readonly<Record<string, string>>>;
|
|
22
|
+
/**
|
|
23
|
+
* Auto-commits non-conflicted dirty working-tree files on `parentHandle` onto `parentHandle.HEAD`.
|
|
24
|
+
*
|
|
25
|
+
* Keeps `parentHandle.baseRef` pinned while advancing `parentHandle.HEAD` so child forks and 3-way merges see parent edits.
|
|
26
|
+
*
|
|
27
|
+
* @param {GitWorktreeHandle} parentHandle - Parent worktree handle to flush.
|
|
28
|
+
* @param {readonly string[] | undefined} [excludeGlobs] - Optional glob patterns excluded from status scanning.
|
|
29
|
+
*
|
|
30
|
+
* @returns {Promise<string>} Resolved `HEAD` commit SHA on `parentHandle` after flushing.
|
|
31
|
+
*/
|
|
32
|
+
export declare function gitWorktreeFlushCleanParentChanges(parentHandle: GitWorktreeHandle, excludeGlobs?: readonly string[]): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Constructs the temporary `LeaseDelta` (`type: 'harness:lease-delta'`) granting write access to `handle.unresolvedConflictPaths`.
|
|
35
|
+
*
|
|
36
|
+
* Returns `undefined` when `handle.unresolvedConflictPaths` is empty, without importing `@paraharness/fs`.
|
|
37
|
+
*
|
|
38
|
+
* @param {GitWorktreeHandle} handle - Worktree handle to inspect for unresolved conflicts.
|
|
39
|
+
*
|
|
40
|
+
* @returns {LeaseDelta | undefined} Frozen `LeaseDelta` unlocking conflicted paths, or `undefined`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildConflictLeaseDelta(handle: GitWorktreeHandle): LeaseDelta | undefined;
|
|
43
|
+
//# sourceMappingURL=git-worktree-flush-and-prune.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-worktree-flush-and-prune.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/git-worktree-flush-and-prune.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,iBAAiB,EACjB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAe3B;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAYjE;AAED;;;;;;;;GAQG;AACH,wBAAsB,iCAAiC,CACrD,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CA8B3C;AAED;;;;;;;;;GASG;AACH,wBAAsB,kCAAkC,CACtD,YAAY,EAAE,iBAAiB,EAC/B,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAC/B,OAAO,CAAC,MAAM,CAAC,CAiEjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,iBAAiB,GACxB,UAAU,GAAG,SAAS,CAexB"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { computePathModeAndSha256 } from './file-digest-and-globs.js';
|
|
4
|
+
import { gitCheckpointStatusMap } from './git-checkpoint-status-map.js';
|
|
5
|
+
import { readHarnessMeta, runGitCommand, updateWorktreeHandleInPlace, writeHarnessMeta, } from './git-cli-runner.js';
|
|
6
|
+
import { CONFLICT_END_REGEX, CONFLICT_SEP_REGEX, CONFLICT_START_REGEX, } from './git-executor.constants.js';
|
|
7
|
+
/**
|
|
8
|
+
* Tests whether `content` contains a complete paired Git conflict marker block (`<<<<<<< `, `=======`, `>>>>>>> `).
|
|
9
|
+
*
|
|
10
|
+
* Ignores standalone Markdown `=======` headings that are not preceded by `^<{7} ` and followed by `^>{7} `.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} content - UTF-8 file or diff text to inspect.
|
|
13
|
+
*
|
|
14
|
+
* @returns {boolean} `true` if a complete paired conflict marker block is present.
|
|
15
|
+
*/
|
|
16
|
+
export function hasPairedConflictMarkers(content) {
|
|
17
|
+
let state = 0;
|
|
18
|
+
for (const rawLine of content.split(/\r?\n/)) {
|
|
19
|
+
if (state === 0 && CONFLICT_START_REGEX.test(rawLine)) {
|
|
20
|
+
state = 1;
|
|
21
|
+
}
|
|
22
|
+
else if (state === 1 && CONFLICT_SEP_REGEX.test(rawLine)) {
|
|
23
|
+
state = 2;
|
|
24
|
+
}
|
|
25
|
+
else if (state === 2 && CONFLICT_END_REGEX.test(rawLine)) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Prunes entries in `handle.unresolvedConflictPaths` whose working-tree digest changed and contain no conflict markers.
|
|
33
|
+
*
|
|
34
|
+
* Persists the updated `unresolvedConflictPaths` map in `<gitdir>/harness-meta.json` and updates `handle` in-place.
|
|
35
|
+
*
|
|
36
|
+
* @param {GitWorktreeHandle} handle - Worktree handle whose conflict map should be pruned.
|
|
37
|
+
*
|
|
38
|
+
* @returns {Promise<Readonly<Record<string, string>>>} Frozen map of remaining unresolved conflict paths to digests.
|
|
39
|
+
*/
|
|
40
|
+
export async function gitWorktreePruneResolvedConflicts(handle) {
|
|
41
|
+
const meta = await readHarnessMeta(handle.gitDirPath);
|
|
42
|
+
const mergedConflicts = {
|
|
43
|
+
...meta.unresolvedConflictPaths,
|
|
44
|
+
...handle.unresolvedConflictPaths,
|
|
45
|
+
};
|
|
46
|
+
const remaining = {};
|
|
47
|
+
for (const [relPath, recordedDigest] of Object.entries(mergedConflicts)) {
|
|
48
|
+
const absPath = path.join(handle.worktreePath, relPath);
|
|
49
|
+
const rawDigest = await computePathModeAndSha256(absPath);
|
|
50
|
+
const currentDigest = rawDigest === 'DELETED' ? 'MISSING' : rawDigest;
|
|
51
|
+
const content = currentDigest !== 'MISSING'
|
|
52
|
+
? await readFile(absPath, 'utf8').catch(() => '')
|
|
53
|
+
: '';
|
|
54
|
+
const hasMarkers = currentDigest !== 'MISSING' && hasPairedConflictMarkers(content);
|
|
55
|
+
if (currentDigest === recordedDigest || hasMarkers) {
|
|
56
|
+
remaining[relPath] = recordedDigest;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const frozenRemaining = Object.freeze(remaining);
|
|
60
|
+
await writeHarnessMeta(handle.gitDirPath, {
|
|
61
|
+
...meta,
|
|
62
|
+
unresolvedConflictPaths: frozenRemaining,
|
|
63
|
+
});
|
|
64
|
+
updateWorktreeHandleInPlace(handle, {
|
|
65
|
+
unresolvedConflictPaths: frozenRemaining,
|
|
66
|
+
});
|
|
67
|
+
return frozenRemaining;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Auto-commits non-conflicted dirty working-tree files on `parentHandle` onto `parentHandle.HEAD`.
|
|
71
|
+
*
|
|
72
|
+
* Keeps `parentHandle.baseRef` pinned while advancing `parentHandle.HEAD` so child forks and 3-way merges see parent edits.
|
|
73
|
+
*
|
|
74
|
+
* @param {GitWorktreeHandle} parentHandle - Parent worktree handle to flush.
|
|
75
|
+
* @param {readonly string[] | undefined} [excludeGlobs] - Optional glob patterns excluded from status scanning.
|
|
76
|
+
*
|
|
77
|
+
* @returns {Promise<string>} Resolved `HEAD` commit SHA on `parentHandle` after flushing.
|
|
78
|
+
*/
|
|
79
|
+
export async function gitWorktreeFlushCleanParentChanges(parentHandle, excludeGlobs) {
|
|
80
|
+
const remainingConflicts = await gitWorktreePruneResolvedConflicts(parentHandle);
|
|
81
|
+
const snapshot = await gitCheckpointStatusMap(parentHandle.worktreePath, {
|
|
82
|
+
excludeGlobs,
|
|
83
|
+
});
|
|
84
|
+
const toAdd = [];
|
|
85
|
+
const toRemove = [];
|
|
86
|
+
for (const [relPath, digest] of Object.entries(snapshot.statusMap)) {
|
|
87
|
+
if (remainingConflicts[relPath] !== undefined)
|
|
88
|
+
continue;
|
|
89
|
+
if (digest === 'DELETED') {
|
|
90
|
+
toRemove.push(relPath);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const content = await readFile(path.join(parentHandle.worktreePath, relPath), 'utf8').catch(() => '');
|
|
94
|
+
if (!hasPairedConflictMarkers(content)) {
|
|
95
|
+
toAdd.push(relPath);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const headResult = await runGitCommand({
|
|
99
|
+
cwd: parentHandle.worktreePath,
|
|
100
|
+
args: ['rev-parse', 'HEAD'],
|
|
101
|
+
});
|
|
102
|
+
const headSha = headResult.stdout.trim();
|
|
103
|
+
if (toAdd.length === 0 && toRemove.length === 0)
|
|
104
|
+
return headSha;
|
|
105
|
+
if (toRemove.length > 0) {
|
|
106
|
+
await runGitCommand({
|
|
107
|
+
cwd: parentHandle.worktreePath,
|
|
108
|
+
args: ['update-index', '--force-remove', '-z', '--stdin'],
|
|
109
|
+
stdin: `${toRemove.join('\0')}\0`,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (toAdd.length > 0) {
|
|
113
|
+
await runGitCommand({
|
|
114
|
+
cwd: parentHandle.worktreePath,
|
|
115
|
+
args: ['update-index', '--add', '-z', '--stdin'],
|
|
116
|
+
stdin: `${toAdd.join('\0')}\0`,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
const treeResult = await runGitCommand({
|
|
120
|
+
cwd: parentHandle.worktreePath,
|
|
121
|
+
args: ['write-tree'],
|
|
122
|
+
});
|
|
123
|
+
const treeSha = treeResult.stdout.trim();
|
|
124
|
+
const commitResult = await runGitCommand({
|
|
125
|
+
cwd: parentHandle.worktreePath,
|
|
126
|
+
args: [
|
|
127
|
+
'commit-tree',
|
|
128
|
+
treeSha,
|
|
129
|
+
'-p',
|
|
130
|
+
headSha,
|
|
131
|
+
'-m',
|
|
132
|
+
'harness: flush parent working tree',
|
|
133
|
+
],
|
|
134
|
+
});
|
|
135
|
+
const commitSha = commitResult.stdout.trim();
|
|
136
|
+
await runGitCommand({
|
|
137
|
+
cwd: parentHandle.worktreePath,
|
|
138
|
+
args: ['update-ref', 'HEAD', commitSha, headSha],
|
|
139
|
+
});
|
|
140
|
+
updateWorktreeHandleInPlace(parentHandle, { headRef: commitSha });
|
|
141
|
+
return commitSha;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Constructs the temporary `LeaseDelta` (`type: 'harness:lease-delta'`) granting write access to `handle.unresolvedConflictPaths`.
|
|
145
|
+
*
|
|
146
|
+
* Returns `undefined` when `handle.unresolvedConflictPaths` is empty, without importing `@paraharness/fs`.
|
|
147
|
+
*
|
|
148
|
+
* @param {GitWorktreeHandle} handle - Worktree handle to inspect for unresolved conflicts.
|
|
149
|
+
*
|
|
150
|
+
* @returns {LeaseDelta | undefined} Frozen `LeaseDelta` unlocking conflicted paths, or `undefined`.
|
|
151
|
+
*/
|
|
152
|
+
export function buildConflictLeaseDelta(handle) {
|
|
153
|
+
const globs = Object.keys(handle.unresolvedConflictPaths);
|
|
154
|
+
if (globs.length === 0)
|
|
155
|
+
return undefined;
|
|
156
|
+
const scopeTag = path.basename(handle.worktreePath);
|
|
157
|
+
const matcher = Object.freeze({
|
|
158
|
+
type: 'fs:match-globs',
|
|
159
|
+
id: `git-conflict-globs:${scopeTag}`,
|
|
160
|
+
globs: Object.freeze([...globs]),
|
|
161
|
+
mode: 'write',
|
|
162
|
+
});
|
|
163
|
+
return Object.freeze({
|
|
164
|
+
type: 'harness:lease-delta',
|
|
165
|
+
id: `git-conflict-lease:${scopeTag}`,
|
|
166
|
+
grantedMatchers: Object.freeze([matcher]),
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=git-worktree-flush-and-prune.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-worktree-flush-and-prune.js","sourceRoot":"","sources":["../../../src/executors/internal/git-worktree-flush-and-prune.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAM7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EACL,eAAe,EACf,aAAa,EACb,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7C,IAAI,KAAK,KAAK,CAAC,IAAI,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACtD,KAAK,GAAG,CAAC,CAAC;QACZ,CAAC;aAAM,IAAI,KAAK,KAAK,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3D,KAAK,GAAG,CAAC,CAAC;QACZ,CAAC;aAAM,IAAI,KAAK,KAAK,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3D,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACr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OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAClE,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAyB;IAEzB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAC1D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAoB;QAC/C,IAAI,EAAE,gBAAgB;QACtB,EAAE,EAAE,sBAAsB,QAAQ,EAAE;QACpC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;QAChC,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAa;QAC/B,IAAI,EAAE,qBAAqB;QAC3B,EAAE,EAAE,sBAAsB,QAAQ,EAAE;QACpC,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { GitCowWorktreeNode, GitWorktreeHandle } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Copies any unresolved conflict files from `parentWorktreePath` into `childWorktreePath`.
|
|
4
|
+
*
|
|
5
|
+
* Unlinks paths recorded as `'MISSING'` and returns a frozen copy of the unresolved conflict map.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} parentWorktreePath - Source parent worktree directory path.
|
|
8
|
+
* @param {string} childWorktreePath - Destination child worktree directory path.
|
|
9
|
+
* @param {Readonly<Record<string, string>>} unresolvedConflictPaths - Map of conflicted paths to digests on the parent.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Promise<Readonly<Record<string, string>>>} Frozen unresolved conflict digest map for the child worktree.
|
|
12
|
+
*/
|
|
13
|
+
export declare function copyParentUnresolvedConflictsToChild(parentWorktreePath: string, childWorktreePath: string, unresolvedConflictPaths: Readonly<Record<string, string>>): Promise<Readonly<Record<string, string>>>;
|
|
14
|
+
/**
|
|
15
|
+
* Forks an isolated child worktree at `<dir>/forks/<runId>/<forkId>` from an already-flushed `parent` handle.
|
|
16
|
+
*
|
|
17
|
+
* Clones `node_modules` and copies any `unresolvedConflictPaths` from `parent` into the child worktree.
|
|
18
|
+
*
|
|
19
|
+
* @param {GitCowWorktreeNode} node - Worktree scope AST node configuration.
|
|
20
|
+
* @param {GitWorktreeHandle} parent - Flushed parent worktree handle.
|
|
21
|
+
* @param {string} forkId - Unique fork or speculative branch identifier.
|
|
22
|
+
*
|
|
23
|
+
* @returns {Promise<GitWorktreeHandle>} Newly provisioned child `GitWorktreeHandle`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function gitWorktreeForkChild(node: GitCowWorktreeNode, parent: GitWorktreeHandle, forkId: string): Promise<GitWorktreeHandle>;
|
|
26
|
+
/**
|
|
27
|
+
* Pins the terminal worktree state under `refs/harness/completed/{roots,forks}/...` and removes the worktree directory.
|
|
28
|
+
*
|
|
29
|
+
* Cleans up `<gitdir>/harness-ckpt-blobs/` and `<gitdir>/harness-ckpt-nm/` before running `git worktree remove --force`.
|
|
30
|
+
*
|
|
31
|
+
* @param {GitWorktreeHandle} handle - Root or child worktree handle to release.
|
|
32
|
+
* @param {readonly string[] | undefined} [excludeGlobs] - Optional glob patterns excluded when synthesizing the final commit.
|
|
33
|
+
*
|
|
34
|
+
* @returns {Promise<void>} Resolves once the completed ref is pinned and the worktree is removed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function gitWorktreeReleaseAndPinRef(handle: GitWorktreeHandle, excludeGlobs?: readonly string[]): Promise<void>;
|
|
37
|
+
//# sourceMappingURL=git-worktree-fork-and-release.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-worktree-fork-and-release.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/git-worktree-fork-and-release.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAW/E;;;;;;;;;;GAUG;AACH,wBAAsB,oCAAoC,CACxD,kBAAkB,EAAE,MAAM,EAC1B,iBAAiB,EAAE,MAAM,EACzB,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAgB3C;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAoE5B;AAED;;;;;;;;;GASG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,iBAAiB,EACzB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAC/B,OAAO,CAAC,IAAI,CAAC,CAmDf"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { mkdir, rm } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { cloneNodeModulesTree } from './cow-worktree-hydrator.js';
|
|
4
|
+
import { copyFileCowOrValue } from './file-digest-and-globs.js';
|
|
5
|
+
import { readHarnessMeta, runGitCommand, withHostWorktreeLock, writeHarnessMeta, } from './git-cli-runner.js';
|
|
6
|
+
import { synthesizeWorkingTreeCommitOverBase } from './git-worktree-materialize-merge.js';
|
|
7
|
+
/**
|
|
8
|
+
* Copies any unresolved conflict files from `parentWorktreePath` into `childWorktreePath`.
|
|
9
|
+
*
|
|
10
|
+
* Unlinks paths recorded as `'MISSING'` and returns a frozen copy of the unresolved conflict map.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} parentWorktreePath - Source parent worktree directory path.
|
|
13
|
+
* @param {string} childWorktreePath - Destination child worktree directory path.
|
|
14
|
+
* @param {Readonly<Record<string, string>>} unresolvedConflictPaths - Map of conflicted paths to digests on the parent.
|
|
15
|
+
*
|
|
16
|
+
* @returns {Promise<Readonly<Record<string, string>>>} Frozen unresolved conflict digest map for the child worktree.
|
|
17
|
+
*/
|
|
18
|
+
export async function copyParentUnresolvedConflictsToChild(parentWorktreePath, childWorktreePath, unresolvedConflictPaths) {
|
|
19
|
+
const copiedConflicts = {
|
|
20
|
+
...unresolvedConflictPaths,
|
|
21
|
+
};
|
|
22
|
+
for (const [relPath, digest] of Object.entries(copiedConflicts)) {
|
|
23
|
+
const childTargetPath = path.join(childWorktreePath, relPath);
|
|
24
|
+
if (digest === 'MISSING') {
|
|
25
|
+
await rm(childTargetPath, { force: true });
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
await copyFileCowOrValue(path.join(parentWorktreePath, relPath), childTargetPath);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return Object.freeze(copiedConflicts);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Forks an isolated child worktree at `<dir>/forks/<runId>/<forkId>` from an already-flushed `parent` handle.
|
|
35
|
+
*
|
|
36
|
+
* Clones `node_modules` and copies any `unresolvedConflictPaths` from `parent` into the child worktree.
|
|
37
|
+
*
|
|
38
|
+
* @param {GitCowWorktreeNode} node - Worktree scope AST node configuration.
|
|
39
|
+
* @param {GitWorktreeHandle} parent - Flushed parent worktree handle.
|
|
40
|
+
* @param {string} forkId - Unique fork or speculative branch identifier.
|
|
41
|
+
*
|
|
42
|
+
* @returns {Promise<GitWorktreeHandle>} Newly provisioned child `GitWorktreeHandle`.
|
|
43
|
+
*/
|
|
44
|
+
export async function gitWorktreeForkChild(node, parent, forkId) {
|
|
45
|
+
const repoPath = path.resolve(node.repo);
|
|
46
|
+
const baseDir = path.isAbsolute(node.dir)
|
|
47
|
+
? node.dir
|
|
48
|
+
: path.resolve(repoPath, node.dir);
|
|
49
|
+
const parentDirName = path.basename(path.dirname(parent.worktreePath));
|
|
50
|
+
const runId = parentDirName === 'roots'
|
|
51
|
+
? path.basename(parent.worktreePath)
|
|
52
|
+
: parentDirName;
|
|
53
|
+
const safeForkId = forkId.replace(/[^a-zA-Z0-9._-]/g, '_');
|
|
54
|
+
const worktreePath = path.join(baseDir, 'forks', runId, safeForkId);
|
|
55
|
+
await rm(worktreePath, { recursive: true, force: true });
|
|
56
|
+
await mkdir(path.dirname(worktreePath), { recursive: true });
|
|
57
|
+
const parentHeadResult = await runGitCommand({
|
|
58
|
+
cwd: parent.worktreePath,
|
|
59
|
+
args: ['rev-parse', 'HEAD'],
|
|
60
|
+
});
|
|
61
|
+
const parentHeadSha = parentHeadResult.stdout.trim();
|
|
62
|
+
const parentMeta = await readHarnessMeta(parent.gitDirPath);
|
|
63
|
+
await withHostWorktreeLock(parent.worktreePath, async () => {
|
|
64
|
+
await runGitCommand({
|
|
65
|
+
cwd: parent.worktreePath,
|
|
66
|
+
args: ['worktree', 'prune'],
|
|
67
|
+
allowNonZeroExit: true,
|
|
68
|
+
});
|
|
69
|
+
await runGitCommand({
|
|
70
|
+
cwd: parent.worktreePath,
|
|
71
|
+
args: [
|
|
72
|
+
'worktree',
|
|
73
|
+
'add',
|
|
74
|
+
'--detach',
|
|
75
|
+
'--force',
|
|
76
|
+
worktreePath,
|
|
77
|
+
parentHeadSha,
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
const gitDirResult = await runGitCommand({
|
|
82
|
+
cwd: worktreePath,
|
|
83
|
+
args: ['rev-parse', '--git-dir'],
|
|
84
|
+
});
|
|
85
|
+
const gitDirPath = path.resolve(worktreePath, gitDirResult.stdout.trim());
|
|
86
|
+
await cloneNodeModulesTree(parent.worktreePath, worktreePath, node.excludeFromCloneGlobs);
|
|
87
|
+
const frozenConflicts = await copyParentUnresolvedConflictsToChild(parent.worktreePath, worktreePath, parentMeta.unresolvedConflictPaths);
|
|
88
|
+
await writeHarnessMeta(gitDirPath, {
|
|
89
|
+
baseRef: parentHeadSha,
|
|
90
|
+
baseBranch: parent.baseBranch,
|
|
91
|
+
branchName: parent.branchName,
|
|
92
|
+
unresolvedConflictPaths: frozenConflicts,
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
worktreePath,
|
|
96
|
+
gitDirPath,
|
|
97
|
+
baseRef: parentHeadSha,
|
|
98
|
+
baseBranch: parent.baseBranch,
|
|
99
|
+
branchName: parent.branchName,
|
|
100
|
+
headRef: parentHeadSha,
|
|
101
|
+
unresolvedConflictPaths: frozenConflicts,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Pins the terminal worktree state under `refs/harness/completed/{roots,forks}/...` and removes the worktree directory.
|
|
106
|
+
*
|
|
107
|
+
* Cleans up `<gitdir>/harness-ckpt-blobs/` and `<gitdir>/harness-ckpt-nm/` before running `git worktree remove --force`.
|
|
108
|
+
*
|
|
109
|
+
* @param {GitWorktreeHandle} handle - Root or child worktree handle to release.
|
|
110
|
+
* @param {readonly string[] | undefined} [excludeGlobs] - Optional glob patterns excluded when synthesizing the final commit.
|
|
111
|
+
*
|
|
112
|
+
* @returns {Promise<void>} Resolves once the completed ref is pinned and the worktree is removed.
|
|
113
|
+
*/
|
|
114
|
+
export async function gitWorktreeReleaseAndPinRef(handle, excludeGlobs) {
|
|
115
|
+
const synth = await synthesizeWorkingTreeCommitOverBase(handle, handle.baseRef, excludeGlobs);
|
|
116
|
+
const parentDir = path.dirname(handle.worktreePath);
|
|
117
|
+
const isRoot = path.basename(parentDir) === 'roots';
|
|
118
|
+
const completedRef = isRoot
|
|
119
|
+
? `refs/harness/completed/roots/${path.basename(handle.worktreePath)}`
|
|
120
|
+
: `refs/harness/completed/forks/${path.basename(parentDir)}/${path.basename(handle.worktreePath)}`;
|
|
121
|
+
await runGitCommand({
|
|
122
|
+
cwd: handle.worktreePath,
|
|
123
|
+
args: ['update-ref', completedRef, synth.commitSha],
|
|
124
|
+
});
|
|
125
|
+
const commonDirResult = await runGitCommand({
|
|
126
|
+
cwd: handle.worktreePath,
|
|
127
|
+
args: ['rev-parse', '--git-common-dir'],
|
|
128
|
+
});
|
|
129
|
+
const commonGitDir = path.resolve(handle.worktreePath, commonDirResult.stdout.trim());
|
|
130
|
+
await rm(path.join(handle.gitDirPath, 'harness-ckpt-blobs'), {
|
|
131
|
+
recursive: true,
|
|
132
|
+
force: true,
|
|
133
|
+
});
|
|
134
|
+
await rm(path.join(handle.gitDirPath, 'harness-ckpt-nm'), {
|
|
135
|
+
recursive: true,
|
|
136
|
+
force: true,
|
|
137
|
+
});
|
|
138
|
+
await withHostWorktreeLock(commonGitDir, async () => {
|
|
139
|
+
await runGitCommand({
|
|
140
|
+
cwd: commonGitDir,
|
|
141
|
+
args: [
|
|
142
|
+
'--git-dir',
|
|
143
|
+
commonGitDir,
|
|
144
|
+
'worktree',
|
|
145
|
+
'remove',
|
|
146
|
+
'--force',
|
|
147
|
+
handle.worktreePath,
|
|
148
|
+
],
|
|
149
|
+
allowNonZeroExit: true,
|
|
150
|
+
});
|
|
151
|
+
await rm(handle.worktreePath, { recursive: true, force: true });
|
|
152
|
+
await runGitCommand({
|
|
153
|
+
cwd: commonGitDir,
|
|
154
|
+
args: ['--git-dir', commonGitDir, 'worktree', 'prune'],
|
|
155
|
+
allowNonZeroExit: true,
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=git-worktree-fork-and-release.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-worktree-fork-and-release.js","sourceRoot":"","sources":["../../../src/executors/internal/git-worktree-fork-and-release.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,IAAI,M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,IAAI,EAAE;gBACJ,WAAW;gBACX,YAAY;gBACZ,UAAU;gBACV,QAAQ;gBACR,SAAS;gBACT,MAAM,CAAC,YAAY;aACpB;YACD,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,MAAM,aAAa,CAAC;YAClB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,CAAC;YACtD,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { GitWorktreeHandle } from '@paraharness/core';
|
|
2
|
+
import type { MaterializeInFlightMergeParams } from './merge-tree-materializer-params.js';
|
|
3
|
+
import type { StatelessMergeTreeResult } from './stateless-merge-tree-result.js';
|
|
4
|
+
import type { SynthesizedWorkingTreeCommit } from './synthesized-working-tree-commit.js';
|
|
5
|
+
/**
|
|
6
|
+
* Synthesizes a temporary Git tree and commit object over `parentCommitSha` without mutating `<gitdir>/index` or `HEAD`.
|
|
7
|
+
*
|
|
8
|
+
* Stages all dirty tracked and untracked files from `gitCheckpointStatusMap` into a temporary index file.
|
|
9
|
+
*
|
|
10
|
+
* @param {GitWorktreeHandle} handle - Worktree handle whose working state should be synthesized.
|
|
11
|
+
* @param {string} parentCommitSha - Parent commit SHA (`-p`) for `git commit-tree`.
|
|
12
|
+
* @param {readonly string[] | undefined} [excludeGlobs] - Optional glob patterns excluded from staging.
|
|
13
|
+
*
|
|
14
|
+
* @returns {Promise<SynthesizedWorkingTreeCommit>} Synthesized tree SHA and commit SHA.
|
|
15
|
+
*/
|
|
16
|
+
export declare function synthesizeWorkingTreeCommitOverBase(handle: GitWorktreeHandle, parentCommitSha: string, excludeGlobs?: readonly string[]): Promise<SynthesizedWorkingTreeCommit>;
|
|
17
|
+
/**
|
|
18
|
+
* Executes a stateless 3-way `git merge-tree --write-tree -z` between `targetCommitSha` and `sourceCommitSha` over `baseRef`.
|
|
19
|
+
*
|
|
20
|
+
* Synthesizes `targetPrime` with `baseRef` as its sole immediate parent so Git 2.38+ always uses `baseRef` as the merge base.
|
|
21
|
+
*
|
|
22
|
+
* @param {GitWorktreeHandle} handle - Worktree handle providing `worktreePath` and `baseRef`.
|
|
23
|
+
* @param {string} targetCommitSha - Target commit SHA ($C_1$ or $C_{\text{prereq}}$).
|
|
24
|
+
* @param {string} sourceCommitSha - Source commit SHA ($C_{\text{child}}$ or $C_{\text{root}}$) parented on `handle.baseRef`.
|
|
25
|
+
*
|
|
26
|
+
* @returns {Promise<StatelessMergeTreeResult>} Merge tree result.
|
|
27
|
+
*/
|
|
28
|
+
export declare function executeStatelessMergeTree(handle: GitWorktreeHandle, targetCommitSha: string, sourceCommitSha: string): Promise<StatelessMergeTreeResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Atomically materializes `inFlightMerge` into `handle`'s working tree and updates `HEAD`, `.git/index`, and `baseRef`.
|
|
31
|
+
*
|
|
32
|
+
* Persists `inFlightMerge` in `<gitdir>/harness-meta.json` before modifying files, checks out `mergedTreeSha`, unlinks removed paths, and records conflict digests.
|
|
33
|
+
*
|
|
34
|
+
* @param {GitWorktreeHandle} handle - Target worktree handle to materialize into.
|
|
35
|
+
* @param {MaterializeInFlightMergeParams} mergeParams - Merge materialization parameters.
|
|
36
|
+
*
|
|
37
|
+
* @returns {Promise<Readonly<Record<string, string>>>} Frozen map of conflicted paths to their materialized `${mode}:${sha256}` digests.
|
|
38
|
+
*/
|
|
39
|
+
export declare function gitWorktreeMaterializeMerge(handle: GitWorktreeHandle, mergeParams: MaterializeInFlightMergeParams): Promise<Readonly<Record<string, string>>>;
|
|
40
|
+
/**
|
|
41
|
+
* Completes `gitWorktreeMaterializeMerge` by updating `HEAD`, live `.git/index`, `baseRef`, and `unresolvedConflictPaths`.
|
|
42
|
+
*
|
|
43
|
+
* Computes post-checkout `${mode}:${sha256}` digests for `conflictedPaths` and clears `inFlightMerge` in `harness-meta.json`.
|
|
44
|
+
*
|
|
45
|
+
* @param {GitWorktreeHandle} handle - Target worktree handle.
|
|
46
|
+
* @param {MaterializeInFlightMergeParams} mergeParams - Finalization parameters.
|
|
47
|
+
*
|
|
48
|
+
* @returns {Promise<Readonly<Record<string, string>>>} Frozen map of unresolved conflict paths to materialized digests.
|
|
49
|
+
*/
|
|
50
|
+
export declare function finalizeMaterializedMergeMetadata(handle: GitWorktreeHandle, mergeParams: MaterializeInFlightMergeParams): Promise<Readonly<Record<string, string>>>;
|
|
51
|
+
//# sourceMappingURL=git-worktree-materialize-merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-worktree-materialize-merge.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/git-worktree-materialize-merge.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAU3D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAC1F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,wBAAsB,mCAAmC,CACvD,MAAM,EAAE,iBAAiB,EACzB,eAAe,EAAE,MAAM,EACvB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAC/B,OAAO,CAAC,4BAA4B,CAAC,CAwBvC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,iBAAiB,EACzB,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,wBAAwB,CAAC,CAqBnC;AAED;;;;;;;;;GASG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,iBAAiB,EACzB,WAAW,EAAE,8BAA8B,GAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CA2B3C;AAED;;;;;;;;;GASG;AACH,wBAAsB,iCAAiC,CACrD,MAAM,EAAE,iBAAiB,EACzB,WAAW,EAAE,8BAA8B,GAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CA2B3C"}
|