@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 @@
|
|
|
1
|
+
{"version":3,"file":"git-executors.constants.d.ts","sourceRoot":"","sources":["../../src/executors/git-executors.constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAGtE,qFAAqF;AACrF,eAAO,MAAM,YAAY,EAAE,4BAAmD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-executors.constants.js","sourceRoot":"","sources":["../../src/executors/git-executors.constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,qFAAqF;AACrF,MAAM,CAAC,MAAM,YAAY,GAAiC,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AbortHookExecutionInput, CheckEvaluationResult, GitAbortMeta, GitCleanWorkingTreeNode, GitDiscardBranchNode, GitKeepWorktreeNode, GitSnapshotAndResetNode, GitWorktreeHandle, RewindHookExecutionInput, StepExecutionContext } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Evaluates a `GitCleanWorkingTreeNode` (`git:clean-working-tree`) conflict-clean check on `ctx.scopeHandle`.
|
|
4
|
+
*
|
|
5
|
+
* Prunes resolved entries in `unresolvedConflictPaths` and rejects if any unresolved paths or paired conflict markers remain.
|
|
6
|
+
*
|
|
7
|
+
* @param {GitCleanWorkingTreeNode} _node - Passive clean-working-tree check AST node.
|
|
8
|
+
* @param {void} _input - Unused check input.
|
|
9
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Promise<CheckEvaluationResult>} Check evaluation result listing any remaining conflicted paths.
|
|
12
|
+
*/
|
|
13
|
+
export declare function executeGitCleanWorkingTreeCheck(_node: GitCleanWorkingTreeNode, _input: void, ctx: StepExecutionContext<GitWorktreeHandle>): Promise<CheckEvaluationResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Executes a `GitSnapshotAndResetNode` (`git.snapshotAndReset()`) abort hook on `input.handle`.
|
|
16
|
+
*
|
|
17
|
+
* Idempotently snapshots dirty state over `baseRef` to `refs/harness/aborted/<runId>/<stepExecId>`,
|
|
18
|
+
* resets the worktree to `baseRef`, and clears `unresolvedConflictPaths`.
|
|
19
|
+
*
|
|
20
|
+
* @param {GitSnapshotAndResetNode} _node - Passive snapshot-and-reset abort hook AST node.
|
|
21
|
+
* @param {AbortHookExecutionInput<GitWorktreeHandle>} input - Abort hook execution input with handle and run/step IDs.
|
|
22
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
23
|
+
*
|
|
24
|
+
* @returns {Promise<GitAbortMeta>} Validated `{ abortedSnapshotRef, resetToRef }` abort metadata receipt.
|
|
25
|
+
*/
|
|
26
|
+
export declare function executeGitSnapshotAndResetHook(_node: GitSnapshotAndResetNode, input: AbortHookExecutionInput<GitWorktreeHandle>, ctx: StepExecutionContext<GitWorktreeHandle>): Promise<GitAbortMeta>;
|
|
27
|
+
/**
|
|
28
|
+
* Executes a `GitKeepWorktreeNode` (`git.keepWorktree()`) rewind hook on `input.handle`.
|
|
29
|
+
*
|
|
30
|
+
* Preserves the current working tree, `HEAD`, and `baseRef` in-place across `.rewindTo()` transitions.
|
|
31
|
+
*
|
|
32
|
+
* @param {GitKeepWorktreeNode} _node - Passive keep-worktree rewind hook AST node.
|
|
33
|
+
* @param {RewindHookExecutionInput<GitWorktreeHandle>} _input - Rewind hook execution input.
|
|
34
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} _ctx - Active step execution context.
|
|
35
|
+
*
|
|
36
|
+
* @returns {Promise<void>} Resolves immediately without mutating the worktree.
|
|
37
|
+
*/
|
|
38
|
+
export declare function executeGitKeepWorktreeHook(_node: GitKeepWorktreeNode, _input: RewindHookExecutionInput<GitWorktreeHandle>, _ctx: StepExecutionContext<GitWorktreeHandle>): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Executes a `GitDiscardBranchNode` (`git.resetWorktree()` / `git.discardBranch()`) rewind hook on `input.handle`.
|
|
41
|
+
*
|
|
42
|
+
* Restores `input.handle` to `input.targetStepBaseScopeCheckpoint` (or resets to `handle.baseRef` if absent).
|
|
43
|
+
*
|
|
44
|
+
* @param {GitDiscardBranchNode} _node - Passive discard-branch rewind hook AST node.
|
|
45
|
+
* @param {RewindHookExecutionInput<GitWorktreeHandle>} input - Rewind hook execution input.
|
|
46
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
47
|
+
*
|
|
48
|
+
* @returns {Promise<void>} Resolves once the worktree is restored to the target step's base checkpoint.
|
|
49
|
+
*/
|
|
50
|
+
export declare function executeGitDiscardBranchHook(_node: GitDiscardBranchNode, input: RewindHookExecutionInput<GitWorktreeHandle>, ctx: StepExecutionContext<GitWorktreeHandle>): Promise<void>;
|
|
51
|
+
//# sourceMappingURL=git-hooks-and-checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-hooks-and-checks.d.ts","sourceRoot":"","sources":["../../src/executors/git-hooks-and-checks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACrB,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AA0C3B;;;;;;;;;;GAUG;AACH,wBAAsB,+BAA+B,CACnD,KAAK,EAAE,uBAAuB,EAC9B,MAAM,EAAE,IAAI,EACZ,GAAG,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,GAC3C,OAAO,CAAC,qBAAqB,CAAC,CA2BhC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,8BAA8B,CAClD,KAAK,EAAE,uBAAuB,EAC9B,KAAK,EAAE,uBAAuB,CAAC,iBAAiB,CAAC,EACjD,GAAG,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,GAC3C,OAAO,CAAC,YAAY,CAAC,CAgCvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,EACnD,IAAI,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,GAC5C,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,oBAAoB,EAC3B,KAAK,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,EAClD,GAAG,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,GAC3C,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { gitCheckpointRestore } from './internal/git-checkpoint-restore.js';
|
|
2
|
+
import { readHarnessMeta, runGitCommand, updateWorktreeHandleInPlace, writeHarnessMeta, } from './internal/git-cli-runner.js';
|
|
3
|
+
import { gitWorktreePruneResolvedConflicts } from './internal/git-worktree-flush-and-prune.js';
|
|
4
|
+
import { synthesizeWorkingTreeCommitOverBase } from './internal/git-worktree-materialize-merge.js';
|
|
5
|
+
import { resolveEffectiveCheckpointPolicy } from './internal/git-worktree-reattach.js';
|
|
6
|
+
import { findWorktreeConflictMarkerPaths } from './internal/parent-fast-forward.js';
|
|
7
|
+
/**
|
|
8
|
+
* Hard-resets `handle` to `handle.baseRef`, cleans untracked files (preserving `node_modules`),
|
|
9
|
+
* and clears `unresolvedConflictPaths` in `harness-meta.json` and `handle`.
|
|
10
|
+
*
|
|
11
|
+
* @param {GitWorktreeHandle} handle - Worktree handle to reset.
|
|
12
|
+
*
|
|
13
|
+
* @returns {Promise<void>} Resolves once the worktree and conflict metadata are reset.
|
|
14
|
+
*/
|
|
15
|
+
async function resetWorktreeToBaseRefAndClearConflicts(handle) {
|
|
16
|
+
const cwd = handle.worktreePath;
|
|
17
|
+
await runGitCommand({ cwd, args: ['reset', '--hard', handle.baseRef] });
|
|
18
|
+
await runGitCommand({
|
|
19
|
+
cwd,
|
|
20
|
+
args: ['clean', '-fd', '-e', 'node_modules', '-e', '**/node_modules'],
|
|
21
|
+
});
|
|
22
|
+
const meta = await readHarnessMeta(handle.gitDirPath);
|
|
23
|
+
const emptyConflicts = Object.freeze({});
|
|
24
|
+
await writeHarnessMeta(handle.gitDirPath, {
|
|
25
|
+
...meta,
|
|
26
|
+
unresolvedConflictPaths: emptyConflicts,
|
|
27
|
+
});
|
|
28
|
+
updateWorktreeHandleInPlace(handle, {
|
|
29
|
+
headRef: handle.baseRef,
|
|
30
|
+
unresolvedConflictPaths: emptyConflicts,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Evaluates a `GitCleanWorkingTreeNode` (`git:clean-working-tree`) conflict-clean check on `ctx.scopeHandle`.
|
|
35
|
+
*
|
|
36
|
+
* Prunes resolved entries in `unresolvedConflictPaths` and rejects if any unresolved paths or paired conflict markers remain.
|
|
37
|
+
*
|
|
38
|
+
* @param {GitCleanWorkingTreeNode} _node - Passive clean-working-tree check AST node.
|
|
39
|
+
* @param {void} _input - Unused check input.
|
|
40
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
41
|
+
*
|
|
42
|
+
* @returns {Promise<CheckEvaluationResult>} Check evaluation result listing any remaining conflicted paths.
|
|
43
|
+
*/
|
|
44
|
+
export async function executeGitCleanWorkingTreeCheck(_node, _input, ctx) {
|
|
45
|
+
const handle = ctx.scopeHandle;
|
|
46
|
+
const scopeNode = ctx.scopeNode?.type === 'git:cow-worktree' ? ctx.scopeNode : undefined;
|
|
47
|
+
const effectivePolicy = scopeNode !== undefined
|
|
48
|
+
? resolveEffectiveCheckpointPolicy(scopeNode)
|
|
49
|
+
: undefined;
|
|
50
|
+
const remaining = await gitWorktreePruneResolvedConflicts(handle);
|
|
51
|
+
const markerPaths = await findWorktreeConflictMarkerPaths(handle, effectivePolicy?.excludeGlobs);
|
|
52
|
+
const unresolvedSet = new Set([
|
|
53
|
+
...Object.keys(remaining),
|
|
54
|
+
...markerPaths,
|
|
55
|
+
]);
|
|
56
|
+
if (unresolvedSet.size === 0) {
|
|
57
|
+
return { ok: true, deficits: [] };
|
|
58
|
+
}
|
|
59
|
+
const sorted = [...unresolvedSet].sort();
|
|
60
|
+
return {
|
|
61
|
+
ok: false,
|
|
62
|
+
deficits: sorted.map((relPath) => `Unresolved git merge conflict in '${relPath}'.`),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Executes a `GitSnapshotAndResetNode` (`git.snapshotAndReset()`) abort hook on `input.handle`.
|
|
67
|
+
*
|
|
68
|
+
* Idempotently snapshots dirty state over `baseRef` to `refs/harness/aborted/<runId>/<stepExecId>`,
|
|
69
|
+
* resets the worktree to `baseRef`, and clears `unresolvedConflictPaths`.
|
|
70
|
+
*
|
|
71
|
+
* @param {GitSnapshotAndResetNode} _node - Passive snapshot-and-reset abort hook AST node.
|
|
72
|
+
* @param {AbortHookExecutionInput<GitWorktreeHandle>} input - Abort hook execution input with handle and run/step IDs.
|
|
73
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
74
|
+
*
|
|
75
|
+
* @returns {Promise<GitAbortMeta>} Validated `{ abortedSnapshotRef, resetToRef }` abort metadata receipt.
|
|
76
|
+
*/
|
|
77
|
+
export async function executeGitSnapshotAndResetHook(_node, input, ctx) {
|
|
78
|
+
const handle = input.handle;
|
|
79
|
+
const cwd = handle.worktreePath;
|
|
80
|
+
const scopeNode = ctx.scopeNode?.type === 'git:cow-worktree' ? ctx.scopeNode : undefined;
|
|
81
|
+
const effectivePolicy = scopeNode !== undefined
|
|
82
|
+
? resolveEffectiveCheckpointPolicy(scopeNode)
|
|
83
|
+
: undefined;
|
|
84
|
+
const sanitizedStepExecId = input.stepExecId.replace(/[:~^?*[\\\s]+/g, '-');
|
|
85
|
+
const abortedSnapshotRef = `refs/harness/aborted/${input.runId}/${sanitizedStepExecId}`;
|
|
86
|
+
const synth = await synthesizeWorkingTreeCommitOverBase(handle, handle.baseRef, effectivePolicy?.excludeGlobs);
|
|
87
|
+
const baseTreeSha = (await runGitCommand({ cwd, args: ['rev-parse', `${handle.baseRef}^{tree}`] })).stdout.trim();
|
|
88
|
+
const existingRef = await runGitCommand({
|
|
89
|
+
cwd,
|
|
90
|
+
args: ['rev-parse', '--verify', abortedSnapshotRef],
|
|
91
|
+
allowNonZeroExit: true,
|
|
92
|
+
});
|
|
93
|
+
if (synth.treeSha !== baseTreeSha || existingRef.exitCode !== 0) {
|
|
94
|
+
await runGitCommand({
|
|
95
|
+
cwd,
|
|
96
|
+
args: ['update-ref', abortedSnapshotRef, synth.commitSha],
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
await resetWorktreeToBaseRefAndClearConflicts(handle);
|
|
100
|
+
return { abortedSnapshotRef, resetToRef: handle.baseRef };
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Executes a `GitKeepWorktreeNode` (`git.keepWorktree()`) rewind hook on `input.handle`.
|
|
104
|
+
*
|
|
105
|
+
* Preserves the current working tree, `HEAD`, and `baseRef` in-place across `.rewindTo()` transitions.
|
|
106
|
+
*
|
|
107
|
+
* @param {GitKeepWorktreeNode} _node - Passive keep-worktree rewind hook AST node.
|
|
108
|
+
* @param {RewindHookExecutionInput<GitWorktreeHandle>} _input - Rewind hook execution input.
|
|
109
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} _ctx - Active step execution context.
|
|
110
|
+
*
|
|
111
|
+
* @returns {Promise<void>} Resolves immediately without mutating the worktree.
|
|
112
|
+
*/
|
|
113
|
+
export function executeGitKeepWorktreeHook(_node, _input, _ctx) {
|
|
114
|
+
return Promise.resolve();
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Executes a `GitDiscardBranchNode` (`git.resetWorktree()` / `git.discardBranch()`) rewind hook on `input.handle`.
|
|
118
|
+
*
|
|
119
|
+
* Restores `input.handle` to `input.targetStepBaseScopeCheckpoint` (or resets to `handle.baseRef` if absent).
|
|
120
|
+
*
|
|
121
|
+
* @param {GitDiscardBranchNode} _node - Passive discard-branch rewind hook AST node.
|
|
122
|
+
* @param {RewindHookExecutionInput<GitWorktreeHandle>} input - Rewind hook execution input.
|
|
123
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
124
|
+
*
|
|
125
|
+
* @returns {Promise<void>} Resolves once the worktree is restored to the target step's base checkpoint.
|
|
126
|
+
*/
|
|
127
|
+
export async function executeGitDiscardBranchHook(_node, input, ctx) {
|
|
128
|
+
const handle = input.handle;
|
|
129
|
+
const scopeNode = ctx.scopeNode?.type === 'git:cow-worktree' ? ctx.scopeNode : undefined;
|
|
130
|
+
const effectivePolicy = scopeNode !== undefined
|
|
131
|
+
? resolveEffectiveCheckpointPolicy(scopeNode)
|
|
132
|
+
: undefined;
|
|
133
|
+
if (input.targetStepBaseScopeCheckpoint !== undefined) {
|
|
134
|
+
await gitCheckpointRestore(handle, input.targetStepBaseScopeCheckpoint, effectivePolicy);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
await resetWorktreeToBaseRefAndClearConflicts(handle);
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=git-hooks-and-checks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-hooks-and-checks.js","sourceRoot":"","sources":["../../src/executors/git-hooks-and-checks.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EACL,eAAe,EACf,aAAa,EACb,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,mCAAmC,EAAE,MAAM,8CAA8C,CAAC;AACnG,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF;;;;;;;GAOG;AACH,KAAK,UAAU,uCAAuC,CACpD,MAAyB;IAEzB,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC;IAChC,MAAM,aAAa,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACxE,MAAM,aAAa,CAAC;QAClB,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AM,uCAAuC,CAAC,MAAM,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { GitWorktreeHandle } from '@paraharness/core';
|
|
2
|
+
import type { GitCheckpointPayload } from '../git-checkpoint-payload.js';
|
|
3
|
+
/**
|
|
4
|
+
* Step 1 of `restoreCheckpoint`: restores `<gitdir>/HEAD`, `info/exclude`, `harness-meta.json`, live index, and `.gitignore` files.
|
|
5
|
+
*
|
|
6
|
+
* Ensures subsequent `git status --porcelain=v2` executes under the exact `.gitignore` and `HEAD` state of `fromCheckpoint`.
|
|
7
|
+
*
|
|
8
|
+
* @param {GitWorktreeHandle} handle - Worktree handle being restored.
|
|
9
|
+
* @param {GitCheckpointPayload} fromCheckpoint - Target checkpoint payload.
|
|
10
|
+
* @param {ReadonlySet<string>} treePaths - Set of repository-relative paths present in `fromCheckpoint.treeSha`.
|
|
11
|
+
*
|
|
12
|
+
* @returns {Promise<void>} Resolves once metadata and `.gitignore` files are restored.
|
|
13
|
+
*/
|
|
14
|
+
export declare function restoreGitdirMetadataAndGitignores(handle: GitWorktreeHandle, fromCheckpoint: GitCheckpointPayload, treePaths: ReadonlySet<string>): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Step 2 of `restoreCheckpoint`: unlinks paths in `symDiffPaths` absent from `preservedPaths` and clears directory collisions.
|
|
17
|
+
*
|
|
18
|
+
* Prunes empty parent directories up to `handle.worktreePath` after removing added files.
|
|
19
|
+
*
|
|
20
|
+
* @param {GitWorktreeHandle} handle - Worktree handle being restored.
|
|
21
|
+
* @param {readonly string[]} symDiffPaths - Paths in the symmetric difference between checkpoint and current state.
|
|
22
|
+
* @param {ReadonlySet<string>} preservedPaths - Union of paths in `fromCheckpoint.treeSha` and `oversizedUntrackedBlobs`.
|
|
23
|
+
*
|
|
24
|
+
* @returns {Promise<void>} Resolves once extraneous files and directory collisions are removed.
|
|
25
|
+
*/
|
|
26
|
+
export declare function unlinkAddedAndDirectoryCollisions(handle: GitWorktreeHandle, symDiffPaths: readonly string[], preservedPaths: ReadonlySet<string>): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Step 3 of `restoreCheckpoint`: materializes `fromCheckpoint.treeSha` via temporary index and restores live `indexTreeSha`.
|
|
29
|
+
*
|
|
30
|
+
* Uses `git checkout-index -f -z --stdin` for targeted `symDiff` restoration or `-f -a` when full checkout is requested.
|
|
31
|
+
*
|
|
32
|
+
* @param {GitWorktreeHandle} handle - Worktree handle being restored.
|
|
33
|
+
* @param {GitCheckpointPayload} fromCheckpoint - Target checkpoint payload.
|
|
34
|
+
* @param {readonly string[] | 'ALL'} pathsToMaterialize - Specific paths to materialize, or `'ALL'` on integrity failure.
|
|
35
|
+
*
|
|
36
|
+
* @returns {Promise<void>} Resolves once files and live `<gitdir>/index` are restored.
|
|
37
|
+
*/
|
|
38
|
+
export declare function checkoutCheckpointTreeAndRestoreIndex(handle: GitWorktreeHandle, fromCheckpoint: GitCheckpointPayload, pathsToMaterialize: readonly string[] | 'ALL'): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Step 4 of `restoreCheckpoint`: copies back oversized untracked blobs and restores `node_modules` if tampered with.
|
|
41
|
+
*
|
|
42
|
+
* Restores parent directories, original file modes, and `<gitdir>/harness-ckpt-nm` backup when `nodeModulesDigest` changed.
|
|
43
|
+
*
|
|
44
|
+
* @param {GitWorktreeHandle} handle - Worktree handle being restored.
|
|
45
|
+
* @param {GitCheckpointPayload} fromCheckpoint - Target checkpoint payload.
|
|
46
|
+
*
|
|
47
|
+
* @returns {Promise<void>} Resolves once all spilled untracked blobs and `node_modules` files are restored.
|
|
48
|
+
*/
|
|
49
|
+
export declare function restoreOversizedUntrackedBlobs(handle: GitWorktreeHandle, fromCheckpoint: GitCheckpointPayload): Promise<void>;
|
|
50
|
+
//# sourceMappingURL=checkpoint-restore-steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint-restore-steps.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/checkpoint-restore-steps.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAQzE;;;;;;;;;;GAUG;AACH,wBAAsB,kCAAkC,CACtD,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,oBAAoB,EACpC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iCAAiC,CACrD,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,GAClC,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,oBAAoB,EACpC,kBAAkB,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,GAC5C,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAqCD;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,oBAAoB,GACnC,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { lstat, mkdir, readdir, rmdir, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { computeNodeModulesDigest, copyFileCowOrValue } from './file-digest-and-globs.js';
|
|
5
|
+
import { runGitCommand, updateWorktreeHandleInPlace, writeHarnessMeta, } from './git-cli-runner.js';
|
|
6
|
+
/**
|
|
7
|
+
* Step 1 of `restoreCheckpoint`: restores `<gitdir>/HEAD`, `info/exclude`, `harness-meta.json`, live index, and `.gitignore` files.
|
|
8
|
+
*
|
|
9
|
+
* Ensures subsequent `git status --porcelain=v2` executes under the exact `.gitignore` and `HEAD` state of `fromCheckpoint`.
|
|
10
|
+
*
|
|
11
|
+
* @param {GitWorktreeHandle} handle - Worktree handle being restored.
|
|
12
|
+
* @param {GitCheckpointPayload} fromCheckpoint - Target checkpoint payload.
|
|
13
|
+
* @param {ReadonlySet<string>} treePaths - Set of repository-relative paths present in `fromCheckpoint.treeSha`.
|
|
14
|
+
*
|
|
15
|
+
* @returns {Promise<void>} Resolves once metadata and `.gitignore` files are restored.
|
|
16
|
+
*/
|
|
17
|
+
export async function restoreGitdirMetadataAndGitignores(handle, fromCheckpoint, treePaths) {
|
|
18
|
+
await writeFile(path.join(handle.gitDirPath, 'HEAD'), fromCheckpoint.headRawContent, 'utf8');
|
|
19
|
+
if (fromCheckpoint.headRawContent.startsWith('ref:')) {
|
|
20
|
+
await runGitCommand({ cwd: handle.worktreePath, args: ['update-ref', 'HEAD', fromCheckpoint.headSha] });
|
|
21
|
+
}
|
|
22
|
+
const excludePath = path.join(handle.gitDirPath, 'info', 'exclude');
|
|
23
|
+
if (fromCheckpoint.infoExcludeContent !== null) {
|
|
24
|
+
await mkdir(path.dirname(excludePath), { recursive: true });
|
|
25
|
+
await writeFile(excludePath, fromCheckpoint.infoExcludeContent, 'utf8');
|
|
26
|
+
}
|
|
27
|
+
else
|
|
28
|
+
await rm(excludePath, { force: true });
|
|
29
|
+
await writeHarnessMeta(handle.gitDirPath, fromCheckpoint.meta);
|
|
30
|
+
updateWorktreeHandleInPlace(handle, {
|
|
31
|
+
baseRef: fromCheckpoint.meta.baseRef,
|
|
32
|
+
baseBranch: fromCheckpoint.meta.baseBranch,
|
|
33
|
+
branchName: fromCheckpoint.meta.branchName,
|
|
34
|
+
headRef: fromCheckpoint.headSha,
|
|
35
|
+
unresolvedConflictPaths: Object.freeze({ ...fromCheckpoint.meta.unresolvedConflictPaths }),
|
|
36
|
+
});
|
|
37
|
+
const gitignorePaths = [];
|
|
38
|
+
for (const relPath of treePaths) {
|
|
39
|
+
if (relPath === '.gitignore' || relPath.endsWith('/.gitignore')) {
|
|
40
|
+
gitignorePaths.push(relPath);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (gitignorePaths.length > 0) {
|
|
44
|
+
await checkoutCheckpointTreeAndRestoreIndex(handle, fromCheckpoint, gitignorePaths);
|
|
45
|
+
}
|
|
46
|
+
await runGitCommand({ cwd: handle.worktreePath, args: ['read-tree', fromCheckpoint.headSha] });
|
|
47
|
+
const untrackedGitignores = await runGitCommand({
|
|
48
|
+
cwd: handle.worktreePath,
|
|
49
|
+
args: ['ls-files', '--others', '-z', '--', '.gitignore', ':(glob)**/.gitignore', ':!node_modules/**', ':!**/node_modules/**'],
|
|
50
|
+
});
|
|
51
|
+
for (const rel of untrackedGitignores.stdout.split('\0')) {
|
|
52
|
+
if (rel.length > 0 && !treePaths.has(rel)) {
|
|
53
|
+
await rm(path.join(handle.worktreePath, rel), { force: true });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Step 2 of `restoreCheckpoint`: unlinks paths in `symDiffPaths` absent from `preservedPaths` and clears directory collisions.
|
|
59
|
+
*
|
|
60
|
+
* Prunes empty parent directories up to `handle.worktreePath` after removing added files.
|
|
61
|
+
*
|
|
62
|
+
* @param {GitWorktreeHandle} handle - Worktree handle being restored.
|
|
63
|
+
* @param {readonly string[]} symDiffPaths - Paths in the symmetric difference between checkpoint and current state.
|
|
64
|
+
* @param {ReadonlySet<string>} preservedPaths - Union of paths in `fromCheckpoint.treeSha` and `oversizedUntrackedBlobs`.
|
|
65
|
+
*
|
|
66
|
+
* @returns {Promise<void>} Resolves once extraneous files and directory collisions are removed.
|
|
67
|
+
*/
|
|
68
|
+
export async function unlinkAddedAndDirectoryCollisions(handle, symDiffPaths, preservedPaths) {
|
|
69
|
+
const rootAbs = path.resolve(handle.worktreePath);
|
|
70
|
+
for (const relPath of symDiffPaths) {
|
|
71
|
+
const absPath = path.join(handle.worktreePath, relPath);
|
|
72
|
+
if (!preservedPaths.has(relPath)) {
|
|
73
|
+
await rm(absPath, { recursive: true, force: true });
|
|
74
|
+
let parentDir = path.dirname(path.resolve(absPath));
|
|
75
|
+
while (parentDir.startsWith(rootAbs) && parentDir !== rootAbs) {
|
|
76
|
+
const entries = await readdir(parentDir).catch(() => ['non-empty']);
|
|
77
|
+
if (entries.length > 0)
|
|
78
|
+
break;
|
|
79
|
+
await rmdir(parentDir).catch(() => undefined);
|
|
80
|
+
parentDir = path.dirname(parentDir);
|
|
81
|
+
}
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
const stat = await lstat(absPath).catch(() => null);
|
|
85
|
+
if (stat !== null && stat.isDirectory()) {
|
|
86
|
+
await rm(absPath, { recursive: true, force: true });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Step 3 of `restoreCheckpoint`: materializes `fromCheckpoint.treeSha` via temporary index and restores live `indexTreeSha`.
|
|
92
|
+
*
|
|
93
|
+
* Uses `git checkout-index -f -z --stdin` for targeted `symDiff` restoration or `-f -a` when full checkout is requested.
|
|
94
|
+
*
|
|
95
|
+
* @param {GitWorktreeHandle} handle - Worktree handle being restored.
|
|
96
|
+
* @param {GitCheckpointPayload} fromCheckpoint - Target checkpoint payload.
|
|
97
|
+
* @param {readonly string[] | 'ALL'} pathsToMaterialize - Specific paths to materialize, or `'ALL'` on integrity failure.
|
|
98
|
+
*
|
|
99
|
+
* @returns {Promise<void>} Resolves once files and live `<gitdir>/index` are restored.
|
|
100
|
+
*/
|
|
101
|
+
export async function checkoutCheckpointTreeAndRestoreIndex(handle, fromCheckpoint, pathsToMaterialize) {
|
|
102
|
+
const tmpIndex = path.join(handle.gitDirPath, `harness-restore-idx.${process.pid}.${randomUUID()}`);
|
|
103
|
+
try {
|
|
104
|
+
await runGitCommand({
|
|
105
|
+
cwd: handle.worktreePath,
|
|
106
|
+
args: ['read-tree', fromCheckpoint.treeSha],
|
|
107
|
+
env: { GIT_INDEX_FILE: tmpIndex },
|
|
108
|
+
});
|
|
109
|
+
if (pathsToMaterialize === 'ALL') {
|
|
110
|
+
await runGitCommand({
|
|
111
|
+
cwd: handle.worktreePath,
|
|
112
|
+
args: ['checkout-index', '-f', '-a'],
|
|
113
|
+
env: { GIT_INDEX_FILE: tmpIndex },
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
else if (pathsToMaterialize.length > 0) {
|
|
117
|
+
await runGitCommand({
|
|
118
|
+
cwd: handle.worktreePath,
|
|
119
|
+
args: ['checkout-index', '-f', '-z', '--stdin'],
|
|
120
|
+
env: { GIT_INDEX_FILE: tmpIndex },
|
|
121
|
+
stdin: `${pathsToMaterialize.join('\0')}\0`,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
finally {
|
|
126
|
+
await rm(tmpIndex, { force: true });
|
|
127
|
+
}
|
|
128
|
+
await runGitCommand({ cwd: handle.worktreePath, args: ['read-tree', fromCheckpoint.indexTreeSha] });
|
|
129
|
+
await runGitCommand({ cwd: handle.worktreePath, args: ['update-index', '--refresh', '-q'], allowNonZeroExit: true });
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Restores `<worktree>/node_modules` from `<gitdir>/harness-ckpt-nm/<digest>` when `node_modules` was mutated.
|
|
133
|
+
*
|
|
134
|
+
* @param {GitWorktreeHandle} handle - Worktree handle being restored.
|
|
135
|
+
* @param {GitCheckpointPayload} fromCheckpoint - Target checkpoint payload.
|
|
136
|
+
*
|
|
137
|
+
* @returns {Promise<void>} Resolves once `node_modules` matches `fromCheckpoint.nodeModulesDigest`.
|
|
138
|
+
*/
|
|
139
|
+
async function restoreTamperedNodeModulesFromBackup(handle, fromCheckpoint) {
|
|
140
|
+
const currentNmDigest = await computeNodeModulesDigest(handle.worktreePath);
|
|
141
|
+
if (currentNmDigest === fromCheckpoint.nodeModulesDigest)
|
|
142
|
+
return;
|
|
143
|
+
const nmTarget = path.join(handle.worktreePath, 'node_modules');
|
|
144
|
+
if (fromCheckpoint.nodeModulesDigest === 'ABSENT') {
|
|
145
|
+
await rm(nmTarget, { recursive: true, force: true });
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const nmBackup = path.join(handle.gitDirPath, 'harness-ckpt-nm', fromCheckpoint.nodeModulesDigest);
|
|
149
|
+
const backupStat = await lstat(nmBackup).catch(() => null);
|
|
150
|
+
if (backupStat === null || !backupStat.isDirectory())
|
|
151
|
+
return;
|
|
152
|
+
await rm(nmTarget, { recursive: true, force: true });
|
|
153
|
+
const stack = [''];
|
|
154
|
+
while (stack.length > 0) {
|
|
155
|
+
const rel = stack.pop() ?? '';
|
|
156
|
+
const entries = await readdir(path.join(nmBackup, rel), { withFileTypes: true });
|
|
157
|
+
for (const entry of entries) {
|
|
158
|
+
const childRel = rel.length === 0 ? entry.name : `${rel}/${entry.name}`;
|
|
159
|
+
if (entry.isDirectory())
|
|
160
|
+
stack.push(childRel);
|
|
161
|
+
else
|
|
162
|
+
await copyFileCowOrValue(path.join(nmBackup, childRel), path.join(nmTarget, childRel));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Step 4 of `restoreCheckpoint`: copies back oversized untracked blobs and restores `node_modules` if tampered with.
|
|
168
|
+
*
|
|
169
|
+
* Restores parent directories, original file modes, and `<gitdir>/harness-ckpt-nm` backup when `nodeModulesDigest` changed.
|
|
170
|
+
*
|
|
171
|
+
* @param {GitWorktreeHandle} handle - Worktree handle being restored.
|
|
172
|
+
* @param {GitCheckpointPayload} fromCheckpoint - Target checkpoint payload.
|
|
173
|
+
*
|
|
174
|
+
* @returns {Promise<void>} Resolves once all spilled untracked blobs and `node_modules` files are restored.
|
|
175
|
+
*/
|
|
176
|
+
export async function restoreOversizedUntrackedBlobs(handle, fromCheckpoint) {
|
|
177
|
+
for (const [relPath, blobRecord] of Object.entries(fromCheckpoint.oversizedUntrackedBlobs)) {
|
|
178
|
+
const srcBlob = path.join(handle.gitDirPath, 'harness-ckpt-blobs', blobRecord.blobKey);
|
|
179
|
+
const destPath = path.join(handle.worktreePath, relPath);
|
|
180
|
+
await copyFileCowOrValue(srcBlob, destPath, blobRecord.mode);
|
|
181
|
+
}
|
|
182
|
+
await restoreTamperedNodeModulesFromBackup(handle, fromCheckpoint);
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=checkpoint-restore-steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint-restore-steps.js","sourceRoot":"","sources":["../../../src/executors/internal/checkpoint-restore-steps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,MAAyB,EACzB,cAAoC,EACpC,SAA8B;IAE9B,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,cAAc,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IAC7F,IAAI,cAAc,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACrD,MAAM,aAAa,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,YAAY,EAAE,MAA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CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACxE,IAAI,KAAK,CAAC,WAAW,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;;gBACzC,MAAM,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,MAAyB,EACzB,cAAoC;IAEpC,KAAK,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,uBAAuB,CAAC,EAAE,CAAC;QAC3F,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,oBAAoB,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;QACvF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;IACD,MAAM,oCAAoC,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { GitWorktreeHandle } from '@paraharness/core';
|
|
2
|
+
import type { GitCheckpointPayload } from '../git-checkpoint-payload.js';
|
|
3
|
+
import type { StagedCheckpointTreeResult } from './staged-checkpoint-tree-result.js';
|
|
4
|
+
import type { WorktreeIntegrityVerdict } from './worktree-integrity-verdict.js';
|
|
5
|
+
import type { WorktreeStatusSnapshot } from './worktree-status-snapshot.js';
|
|
6
|
+
/**
|
|
7
|
+
* Stages tracked dirty files and size-bounded untracked files into a temporary git index to produce `treeSha`.
|
|
8
|
+
*
|
|
9
|
+
* Spills untracked (`?`) files exceeding `maxUntrackedBytes` into `<gitdir>/harness-ckpt-blobs/` via CoW/value copy.
|
|
10
|
+
*
|
|
11
|
+
* @param {GitWorktreeHandle} handle - Active worktree handle.
|
|
12
|
+
* @param {WorktreeStatusSnapshot} snapshot - Porcelain v2 status snapshot of the worktree.
|
|
13
|
+
* @param {number} maxUntrackedBytes - Byte threshold above which untracked files spill to `harness-ckpt-blobs/`.
|
|
14
|
+
*
|
|
15
|
+
* @returns {Promise<StagedCheckpointTreeResult>} Synthesized tree SHA and spilled blob map.
|
|
16
|
+
*/
|
|
17
|
+
export declare function stageCheckpointTreeAndOversizedBlobs(handle: GitWorktreeHandle, snapshot: WorktreeStatusSnapshot, maxUntrackedBytes: number): Promise<StagedCheckpointTreeResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Verifies worktree-local `.git` metadata (`HEAD`, `indexTreeSha`, `info/exclude`, `harness-meta.json`) and `node_modules` integrity.
|
|
20
|
+
*
|
|
21
|
+
* Returns `{ intact: false, reason }` if any worktree-local metadata or `node_modules` tree was mutated by a subprocess.
|
|
22
|
+
*
|
|
23
|
+
* @param {GitWorktreeHandle} handle - Active worktree handle.
|
|
24
|
+
* @param {GitCheckpointPayload} fromCheckpoint - Parsed baseline checkpoint payload.
|
|
25
|
+
*
|
|
26
|
+
* @returns {Promise<WorktreeIntegrityVerdict>} Integrity verification result.
|
|
27
|
+
*/
|
|
28
|
+
export declare function verifyWorktreeLocalGitIntegrity(handle: GitWorktreeHandle, fromCheckpoint: GitCheckpointPayload): Promise<WorktreeIntegrityVerdict>;
|
|
29
|
+
/**
|
|
30
|
+
* Lists all repository-relative file paths recorded inside a Git tree object (`git ls-tree -r --name-only -z`).
|
|
31
|
+
*
|
|
32
|
+
* Returns a `ReadonlySet<string>` for $O(1)$ membership queries during checkpoint restoration and merge materialization.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} worktreePath - Worktree directory path.
|
|
35
|
+
* @param {string} treeOrCommit - Git tree or commit SHA to list.
|
|
36
|
+
*
|
|
37
|
+
* @returns {Promise<ReadonlySet<string>>} Set of repository-relative file paths in `treeOrCommit`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function listTreePaths(worktreePath: string, treeOrCommit: string): Promise<ReadonlySet<string>>;
|
|
40
|
+
/**
|
|
41
|
+
* Computes the sorted symmetric difference of paths whose `${mode}:${sha256}` status changed between two status maps.
|
|
42
|
+
*
|
|
43
|
+
* Includes paths added, deleted, modified, or reverted back to clean `HEAD` between `beforeMap` and `afterMap`.
|
|
44
|
+
*
|
|
45
|
+
* @param {Readonly<Record<string, string>>} beforeMap - Baseline status map from `fromCheckpoint`.
|
|
46
|
+
* @param {Readonly<Record<string, string>>} afterMap - Current worktree status map.
|
|
47
|
+
*
|
|
48
|
+
* @returns {readonly string[]} Lexicographically sorted list of changed repository-relative paths.
|
|
49
|
+
*/
|
|
50
|
+
export declare function computeSymmetricStatusDiff(beforeMap: Readonly<Record<string, string>>, afterMap: Readonly<Record<string, string>>): readonly string[];
|
|
51
|
+
//# sourceMappingURL=checkpoint-staging-and-integrity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint-staging-and-integrity.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/checkpoint-staging-and-integrity.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,8BAA8B,CAAC;AAMtC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;;;;;;;;;GAUG;AACH,wBAAsB,oCAAoC,CACxD,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,sBAAsB,EAChC,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC,0BAA0B,CAAC,CA8BrC;AA2ED;;;;;;;;;GASG;AACH,wBAAsB,+BAA+B,CACnD,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,oBAAoB,GACnC,OAAO,CAAC,wBAAwB,CAAC,CAkBnC;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAU9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC3C,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACzC,SAAS,MAAM,EAAE,CAWnB"}
|