@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,152 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { MergeTrainStepInputSchema, } from '../../schemas/git-receipts.schema.js';
|
|
3
|
+
import { buildIsolatedWorktreeGitEnv, runGitCommand, } from './git-cli-runner.js';
|
|
4
|
+
/**
|
|
5
|
+
* Evaluates a deterministic `CheckASTNode` against the active `GitWorktreeHandle`.
|
|
6
|
+
*
|
|
7
|
+
* Dispatches through `ctx.registry.checks` when registered, or executes `command` in the worktree environment.
|
|
8
|
+
*
|
|
9
|
+
* @param {BaseCheckASTNode<string, GitWorktreeHandle>} checkNode - Check AST node to evaluate.
|
|
10
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
11
|
+
*
|
|
12
|
+
* @returns {Promise<CheckEvaluationResult>} Check pass/fail evaluation outcome.
|
|
13
|
+
*/
|
|
14
|
+
export async function evaluateWorktreeCheck(checkNode, ctx) {
|
|
15
|
+
const registered = ctx.registry?.checks?.[checkNode.type];
|
|
16
|
+
if (registered !== undefined) {
|
|
17
|
+
return registered(checkNode, undefined, ctx);
|
|
18
|
+
}
|
|
19
|
+
if ('command' in checkNode && typeof checkNode.command === 'string') {
|
|
20
|
+
const cmd = checkNode.command;
|
|
21
|
+
const cwd = ctx.scopeHandle.worktreePath;
|
|
22
|
+
const env = buildIsolatedWorktreeGitEnv(cwd);
|
|
23
|
+
return new Promise((resolve) => {
|
|
24
|
+
execFile('sh', ['-c', cmd], { cwd, env, signal: ctx.signal }, (err, stdout, stderr) => {
|
|
25
|
+
const ok = err === null;
|
|
26
|
+
const msg = (stderr ||
|
|
27
|
+
stdout ||
|
|
28
|
+
(err?.message ?? 'Check failed')).trim();
|
|
29
|
+
resolve({ ok, deficits: ok ? [] : [msg] });
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
throw new Error(`No CheckExecutor registered for '${checkNode.type}' (id '${checkNode.id}').`);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Normalizes candidate branch inputs for a batch merge-train step up to `maxBatchSize`.
|
|
37
|
+
*
|
|
38
|
+
* Resolves branch names, refs, or receipt objects into `{ label, headSha, baseSha }` descriptors.
|
|
39
|
+
*
|
|
40
|
+
* @param {unknown} input - Step input containing candidate branches/refs or `undefined`.
|
|
41
|
+
* @param {GitWorktreeHandle} handle - Active worktree handle used for ref resolution.
|
|
42
|
+
* @param {number} maxBatchSize - Maximum number of candidates per batch.
|
|
43
|
+
*
|
|
44
|
+
* @returns {Promise<readonly MergeTrainCandidate[]>} Normalized merge-train candidates.
|
|
45
|
+
*/
|
|
46
|
+
export async function extractMergeTrainCandidates(input, handle, maxBatchSize) {
|
|
47
|
+
const parsed = MergeTrainStepInputSchema.safeParse(input);
|
|
48
|
+
const rawItems = parsed.success
|
|
49
|
+
? Array.isArray(parsed.data)
|
|
50
|
+
? parsed.data
|
|
51
|
+
: (parsed.data.candidates ??
|
|
52
|
+
parsed.data.branches ??
|
|
53
|
+
parsed.data.refs ??
|
|
54
|
+
parsed.data.receipts ??
|
|
55
|
+
[])
|
|
56
|
+
: [];
|
|
57
|
+
if (rawItems.length === 0) {
|
|
58
|
+
const fallbackHead = handle.headRef ?? handle.baseRef;
|
|
59
|
+
return Object.freeze([
|
|
60
|
+
{
|
|
61
|
+
label: handle.branchName ?? fallbackHead,
|
|
62
|
+
headSha: fallbackHead,
|
|
63
|
+
baseSha: handle.baseRef,
|
|
64
|
+
},
|
|
65
|
+
]);
|
|
66
|
+
}
|
|
67
|
+
const candidates = [];
|
|
68
|
+
const limit = Math.min(rawItems.length, Math.max(1, maxBatchSize));
|
|
69
|
+
for (let idx = 0; idx < limit; idx += 1) {
|
|
70
|
+
const raw = rawItems[idx];
|
|
71
|
+
if (raw === undefined)
|
|
72
|
+
continue;
|
|
73
|
+
const label = typeof raw === 'string'
|
|
74
|
+
? raw
|
|
75
|
+
: (raw.branchName ?? raw.ref ?? raw.headRef ?? '');
|
|
76
|
+
const refInput = typeof raw === 'string' ? raw : (raw.headRef ?? label);
|
|
77
|
+
const headSha = (await runGitCommand({
|
|
78
|
+
cwd: handle.worktreePath,
|
|
79
|
+
args: ['rev-parse', refInput],
|
|
80
|
+
})).stdout.trim();
|
|
81
|
+
const explicitBase = typeof raw === 'string' ? undefined : raw.baseRef;
|
|
82
|
+
const parentLookup = (await runGitCommand({
|
|
83
|
+
cwd: handle.worktreePath,
|
|
84
|
+
args: ['rev-parse', `${headSha}^`],
|
|
85
|
+
allowNonZeroExit: true,
|
|
86
|
+
})).stdout.trim();
|
|
87
|
+
const baseSha = (explicitBase ?? parentLookup) || handle.baseRef;
|
|
88
|
+
candidates.push({ label, headSha, baseSha });
|
|
89
|
+
}
|
|
90
|
+
return Object.freeze(candidates);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Constructs a cumulative speculative rebase chain $R_1 \dots R_m$ onto `currentTargetSha`.
|
|
94
|
+
*
|
|
95
|
+
* Halts and returns `[chain, conflictedIndex]` if a candidate fails to rebase cleanly onto the prior tip.
|
|
96
|
+
*
|
|
97
|
+
* @param {string} cwd - Worktree directory path.
|
|
98
|
+
* @param {string} currentTargetSha - Base commit SHA for $R_1$.
|
|
99
|
+
* @param {readonly MergeTrainCandidate[]} queue - Remaining candidate branches to chain.
|
|
100
|
+
*
|
|
101
|
+
* @returns {Promise<readonly [readonly MergeTrainChainEntry[], number]>} Tuple of `[chain, conflictedIndex]`.
|
|
102
|
+
*/
|
|
103
|
+
export async function buildCumulativeRebaseChain(cwd, currentTargetSha, queue) {
|
|
104
|
+
const chain = [];
|
|
105
|
+
for (let i = 0; i < queue.length; i += 1) {
|
|
106
|
+
const cand = queue[i];
|
|
107
|
+
if (cand === undefined)
|
|
108
|
+
break;
|
|
109
|
+
const prevEntry = chain[chain.length - 1];
|
|
110
|
+
const prevSha = prevEntry === undefined ? currentTargetSha : prevEntry.rebasedSha;
|
|
111
|
+
await runGitCommand({ cwd, args: ['checkout', '--detach', '--force', cand.headSha] });
|
|
112
|
+
const rebaseOutput = await runGitCommand({ cwd, args: ['rebase', '--onto', prevSha, cand.baseSha, 'HEAD'], allowNonZeroExit: true });
|
|
113
|
+
if (rebaseOutput.exitCode !== 0) {
|
|
114
|
+
await runGitCommand({ cwd, args: ['rebase', '--abort'], allowNonZeroExit: true });
|
|
115
|
+
return [Object.freeze(chain), i];
|
|
116
|
+
}
|
|
117
|
+
const rebasedSha = (await runGitCommand({ cwd, args: ['rev-parse', 'HEAD'] })).stdout.trim();
|
|
118
|
+
chain.push({ candidate: cand, rebasedSha });
|
|
119
|
+
}
|
|
120
|
+
return [Object.freeze(chain), -1];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Binary-bisects a cumulative rebase chain $R_1 \dots R_m$ whose tip $R_m$ failed `verifyWith`.
|
|
124
|
+
*
|
|
125
|
+
* Isolates the first offending candidate index in $O(\log m)$ verification checks.
|
|
126
|
+
*
|
|
127
|
+
* @param {readonly MergeTrainChainEntry[]} chain - Cumulative speculative rebase chain entries.
|
|
128
|
+
* @param {BaseCheckASTNode<string, GitWorktreeHandle>} verifyWith - Verification check AST node.
|
|
129
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
130
|
+
*
|
|
131
|
+
* @returns {Promise<readonly [number, number]>} Tuple of `[firstFailingIndex, verificationRunsUsed]`.
|
|
132
|
+
*/
|
|
133
|
+
export async function gitMergeTrainBisect(chain, verifyWith, ctx) {
|
|
134
|
+
let low = 0;
|
|
135
|
+
let high = chain.length - 1;
|
|
136
|
+
let runs = 0;
|
|
137
|
+
while (low < high) {
|
|
138
|
+
const mid = Math.floor((low + high) / 2);
|
|
139
|
+
const midEntry = chain[mid];
|
|
140
|
+
if (midEntry === undefined)
|
|
141
|
+
break;
|
|
142
|
+
await runGitCommand({ cwd: ctx.scopeHandle.worktreePath, args: ['reset', '--hard', midEntry.rebasedSha] });
|
|
143
|
+
runs += 1;
|
|
144
|
+
const checkOutcome = await evaluateWorktreeCheck(verifyWith, ctx);
|
|
145
|
+
if (checkOutcome.ok)
|
|
146
|
+
low = mid + 1;
|
|
147
|
+
else
|
|
148
|
+
high = mid;
|
|
149
|
+
}
|
|
150
|
+
return [low, runs];
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=git-merge-train-bisect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-merge-train-bisect.js","sourceRoot":"","sources":["../../../src/executors/internal/git-merge-train-bisect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAS9C,OAAO,E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type { GitCandidateComparisonToolNode, GitRefReaderToolNode, GitWorktreeHandle, StepExecutionContext, ToolExecutionResult } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Dispatches a `GitRefReaderToolNode` invocation (`readRefFile`, `diffRefs`, `listRefFiles`) against the object store.
|
|
4
|
+
*
|
|
5
|
+
* Runs read-only `git show`, `git diff`, or `git ls-tree` inside `node.runner` concurrency slots.
|
|
6
|
+
*
|
|
7
|
+
* @param {GitRefReaderToolNode<GitWorktreeHandle>} node - Ref-reader tool AST node.
|
|
8
|
+
* @param {unknown} rawArgs - Unvalidated tool input arguments.
|
|
9
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Promise<ToolExecutionResult>} Serialized git output.
|
|
12
|
+
*/
|
|
13
|
+
export declare function dispatchRefReaderToolCall(node: GitRefReaderToolNode<GitWorktreeHandle>, rawArgs: unknown, ctx: StepExecutionContext<GitWorktreeHandle>): Promise<ToolExecutionResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Dispatches a `GitCandidateComparisonToolNode` invocation (`diffCandidates`, `readCandidateFile`, `evalInCandidates`).
|
|
16
|
+
*
|
|
17
|
+
* Wraps `evalInCandidates` benchmark runs in `serializeCheckpoint` + `try / finally { restoreCheckpoint }`.
|
|
18
|
+
*
|
|
19
|
+
* @param {GitCandidateComparisonToolNode<GitWorktreeHandle>} node - Candidate comparison tool AST node.
|
|
20
|
+
* @param {unknown} rawArgs - Unvalidated tool input arguments.
|
|
21
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
22
|
+
*
|
|
23
|
+
* @returns {Promise<ToolExecutionResult>} Serialized candidate comparison or benchmark output.
|
|
24
|
+
*/
|
|
25
|
+
export declare function dispatchCandidateComparisonToolCall(node: GitCandidateComparisonToolNode<GitWorktreeHandle>, rawArgs: unknown, ctx: StepExecutionContext<GitWorktreeHandle>): Promise<ToolExecutionResult>;
|
|
26
|
+
//# sourceMappingURL=git-tool-dispatchers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-tool-dispatchers.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/git-tool-dispatchers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAC9B,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAmH3B;;;;;;;;;;GAUG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,GAC3C,OAAO,CAAC,mBAAmB,CAAC,CAS9B;AAyDD;;;;;;;;;;GAUG;AACH,wBAAsB,mCAAmC,CACvD,IAAI,EAAE,8BAA8B,CAAC,iBAAiB,CAAC,EACvD,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,GAC3C,OAAO,CAAC,mBAAmB,CAAC,CAQ9B"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { DiffCandidatesInputSchema, DiffRefsInputSchema, EvalInCandidatesInputSchema, ListRefFilesInputSchema, ReadCandidateFileInputSchema, ReadRefFileInputSchema, } from '../../schemas/git-receipts.schema.js';
|
|
2
|
+
import { runGitCommand } from './git-cli-runner.js';
|
|
3
|
+
import { runEvalCommandInSandboxedCandidate } from './git-cross-test-import-scanner.js';
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the git ref or commit SHA for a speculative candidate branch index.
|
|
6
|
+
*
|
|
7
|
+
* Prefers `refs/harness/candidates/<runId>/<branchIndex>` when pinned on the host repo, falling back to `candidateHandles`.
|
|
8
|
+
*
|
|
9
|
+
* @param {number} branchIndex - Zero-based speculative candidate branch index.
|
|
10
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
11
|
+
*
|
|
12
|
+
* @returns {Promise<string>} Resolved git ref or commit SHA for `branchIndex`.
|
|
13
|
+
*/
|
|
14
|
+
async function resolveCandidateBranchRef(branchIndex, ctx) {
|
|
15
|
+
const pinnedRef = `refs/harness/candidates/${ctx.runId}/${String(branchIndex)}`;
|
|
16
|
+
const check = await runGitCommand({
|
|
17
|
+
cwd: ctx.scopeHandle.worktreePath,
|
|
18
|
+
args: ['rev-parse', '--verify', pinnedRef],
|
|
19
|
+
allowNonZeroExit: true,
|
|
20
|
+
});
|
|
21
|
+
if (check.exitCode === 0 && check.stdout.trim().length > 0) {
|
|
22
|
+
return check.stdout.trim();
|
|
23
|
+
}
|
|
24
|
+
const handle = ctx.candidateHandles?.get(branchIndex);
|
|
25
|
+
if (handle !== undefined)
|
|
26
|
+
return handle.headRef ?? handle.baseRef;
|
|
27
|
+
return pinnedRef;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolves the list of candidate branch indices targeted by an `evalInCandidates` tool invocation.
|
|
31
|
+
*
|
|
32
|
+
* @param {EvalInCandidatesInput} parsed - Validated `evalInCandidates` input payload.
|
|
33
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
34
|
+
*
|
|
35
|
+
* @returns {readonly number[]} Target zero-based candidate branch indices.
|
|
36
|
+
*/
|
|
37
|
+
function resolveEvalCandidateBranchIndices(parsed, ctx) {
|
|
38
|
+
if (parsed.branchIndices !== undefined) {
|
|
39
|
+
return parsed.branchIndices;
|
|
40
|
+
}
|
|
41
|
+
if (parsed.branchIndex !== undefined) {
|
|
42
|
+
return [parsed.branchIndex];
|
|
43
|
+
}
|
|
44
|
+
if (ctx.candidateHandles !== undefined) {
|
|
45
|
+
return [...ctx.candidateHandles.keys()];
|
|
46
|
+
}
|
|
47
|
+
return [0];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Executes the underlying Git CLI command for a `GitRefReaderToolNode` tool call.
|
|
51
|
+
*
|
|
52
|
+
* @param {GitRefReaderToolNode<GitWorktreeHandle>} node - Ref-reader tool AST node.
|
|
53
|
+
* @param {unknown} validated - Schema-validated tool input arguments.
|
|
54
|
+
* @param {string} cwd - Worktree directory path.
|
|
55
|
+
*
|
|
56
|
+
* @returns {Promise<ToolExecutionResult>} Serialized git command output.
|
|
57
|
+
*/
|
|
58
|
+
async function executeRefReaderGitCommand(node, validated, cwd) {
|
|
59
|
+
if (node.name === 'readRefFile') {
|
|
60
|
+
const parsed = ReadRefFileInputSchema.parse(validated);
|
|
61
|
+
const showOutput = await runGitCommand({
|
|
62
|
+
cwd,
|
|
63
|
+
args: ['show', `${parsed.ref}:${parsed.path}`],
|
|
64
|
+
});
|
|
65
|
+
return { content: showOutput.stdout };
|
|
66
|
+
}
|
|
67
|
+
if (node.name === 'diffRefs') {
|
|
68
|
+
const parsed = DiffRefsInputSchema.parse(validated);
|
|
69
|
+
const paths = parsed.paths ?? [];
|
|
70
|
+
const args = [
|
|
71
|
+
'diff',
|
|
72
|
+
parsed.fromRef,
|
|
73
|
+
parsed.toRef,
|
|
74
|
+
...(paths.length > 0 ? ['--', ...paths] : []),
|
|
75
|
+
];
|
|
76
|
+
const diffOutput = await runGitCommand({ cwd, args });
|
|
77
|
+
return { content: diffOutput.stdout };
|
|
78
|
+
}
|
|
79
|
+
const parsed = ListRefFilesInputSchema.parse(validated);
|
|
80
|
+
const prefix = parsed.prefix !== undefined && parsed.prefix.length > 0
|
|
81
|
+
? parsed.prefix
|
|
82
|
+
: undefined;
|
|
83
|
+
const args = [
|
|
84
|
+
'ls-tree',
|
|
85
|
+
'-r',
|
|
86
|
+
'--name-only',
|
|
87
|
+
parsed.ref,
|
|
88
|
+
...(prefix !== undefined ? ['--', prefix] : []),
|
|
89
|
+
];
|
|
90
|
+
const lsTreeOutput = await runGitCommand({ cwd, args });
|
|
91
|
+
return { content: lsTreeOutput.stdout };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Dispatches a `GitRefReaderToolNode` invocation (`readRefFile`, `diffRefs`, `listRefFiles`) against the object store.
|
|
95
|
+
*
|
|
96
|
+
* Runs read-only `git show`, `git diff`, or `git ls-tree` inside `node.runner` concurrency slots.
|
|
97
|
+
*
|
|
98
|
+
* @param {GitRefReaderToolNode<GitWorktreeHandle>} node - Ref-reader tool AST node.
|
|
99
|
+
* @param {unknown} rawArgs - Unvalidated tool input arguments.
|
|
100
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
101
|
+
*
|
|
102
|
+
* @returns {Promise<ToolExecutionResult>} Serialized git output.
|
|
103
|
+
*/
|
|
104
|
+
export async function dispatchRefReaderToolCall(node, rawArgs, ctx) {
|
|
105
|
+
const validated = node.inputSchema.parse(rawArgs);
|
|
106
|
+
const cwd = ctx.scopeHandle.worktreePath;
|
|
107
|
+
const runCmd = () => executeRefReaderGitCommand(node, validated, cwd);
|
|
108
|
+
if (node.runner !== undefined && typeof ctx.getRunner === 'function') {
|
|
109
|
+
return ctx.getRunner(node.runner).withSlot(runCmd, ctx.signal);
|
|
110
|
+
}
|
|
111
|
+
return runCmd();
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Executes the underlying Git CLI or sandboxed evaluation command for a `GitCandidateComparisonToolNode`.
|
|
115
|
+
*
|
|
116
|
+
* @param {GitCandidateComparisonToolNode<GitWorktreeHandle>} node - Candidate comparison tool AST node.
|
|
117
|
+
* @param {unknown} validated - Schema-validated tool input arguments.
|
|
118
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
119
|
+
*
|
|
120
|
+
* @returns {Promise<ToolExecutionResult>} Serialized candidate comparison or benchmark output.
|
|
121
|
+
*/
|
|
122
|
+
async function executeCandidateComparisonGitCommand(node, validated, ctx) {
|
|
123
|
+
const cwd = ctx.scopeHandle.worktreePath;
|
|
124
|
+
if (node.name === 'diffCandidates') {
|
|
125
|
+
const parsed = DiffCandidatesInputSchema.parse(validated);
|
|
126
|
+
const leftRef = await resolveCandidateBranchRef(parsed.fromBranchIndex, ctx);
|
|
127
|
+
const rightRef = await resolveCandidateBranchRef(parsed.toBranchIndex, ctx);
|
|
128
|
+
const paths = parsed.paths ?? [];
|
|
129
|
+
const args = [
|
|
130
|
+
'diff',
|
|
131
|
+
leftRef,
|
|
132
|
+
rightRef,
|
|
133
|
+
...(paths.length > 0 ? ['--', ...paths] : []),
|
|
134
|
+
];
|
|
135
|
+
return { content: (await runGitCommand({ cwd, args })).stdout };
|
|
136
|
+
}
|
|
137
|
+
if (node.name === 'readCandidateFile') {
|
|
138
|
+
const parsed = ReadCandidateFileInputSchema.parse(validated);
|
|
139
|
+
const ref = await resolveCandidateBranchRef(parsed.branchIndex, ctx);
|
|
140
|
+
return {
|
|
141
|
+
content: (await runGitCommand({ cwd, args: ['show', `${ref}:${parsed.path}`] })).stdout,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const parsed = EvalInCandidatesInputSchema.parse(validated);
|
|
145
|
+
const branchIndices = resolveEvalCandidateBranchIndices(parsed, ctx);
|
|
146
|
+
const command = parsed.argv ?? parsed.command ?? '';
|
|
147
|
+
const outcomes = [];
|
|
148
|
+
for (const branchIndex of branchIndices) {
|
|
149
|
+
const candidateHandle = ctx.candidateHandles?.get(branchIndex) ?? ctx.scopeHandle;
|
|
150
|
+
const evalOutcome = await runEvalCommandInSandboxedCandidate(candidateHandle, command, ctx);
|
|
151
|
+
outcomes.push({ branchIndex, ...evalOutcome });
|
|
152
|
+
}
|
|
153
|
+
return { content: JSON.stringify(outcomes) };
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Dispatches a `GitCandidateComparisonToolNode` invocation (`diffCandidates`, `readCandidateFile`, `evalInCandidates`).
|
|
157
|
+
*
|
|
158
|
+
* Wraps `evalInCandidates` benchmark runs in `serializeCheckpoint` + `try / finally { restoreCheckpoint }`.
|
|
159
|
+
*
|
|
160
|
+
* @param {GitCandidateComparisonToolNode<GitWorktreeHandle>} node - Candidate comparison tool AST node.
|
|
161
|
+
* @param {unknown} rawArgs - Unvalidated tool input arguments.
|
|
162
|
+
* @param {StepExecutionContext<GitWorktreeHandle>} ctx - Active step execution context.
|
|
163
|
+
*
|
|
164
|
+
* @returns {Promise<ToolExecutionResult>} Serialized candidate comparison or benchmark output.
|
|
165
|
+
*/
|
|
166
|
+
export async function dispatchCandidateComparisonToolCall(node, rawArgs, ctx) {
|
|
167
|
+
const validated = node.inputSchema.parse(rawArgs);
|
|
168
|
+
const runCmd = () => executeCandidateComparisonGitCommand(node, validated, ctx);
|
|
169
|
+
if (node.runner !== undefined && typeof ctx.getRunner === 'function') {
|
|
170
|
+
return ctx.getRunner(node.runner).withSlot(runCmd, ctx.signal);
|
|
171
|
+
}
|
|
172
|
+
return runCmd();
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=git-tool-dispatchers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-tool-dispatchers.js","sourceRoot":"","sources":["../../../src/executors/internal/git-tool-dispatchers.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,EACvB,4BAA4B,EAC5B,sBAAsB,GAEvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kCAAkC,EAAE,MAAM,oCAAoC,CAAC;AAExF;;;;;;;;;GASG;AACH,KAAK,UAAU,yBAAyB,CACtC,WAAmB,EACnB,GAA4C;IAE5C,MAAM,SAAS,GAAG,2BAA2B,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;IAChF,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC;QAChC,GAAG,EAAE,GAAG,CAAC,WAAW,CAAC,YAAY;QACjC,IAAI,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,CAAC;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AE,GAAG,WAAW,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,mCAAmC,CACvD,IAAuD,EACvD,OAAgB,EAChB,GAA4C;IAE5C,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,GAAiC,EAAE,CAChD,oCAAoC,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IAC7D,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;QACrE,OAAO,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,MAAM,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GitCowWorktreeNode, GitWorktreeHandle } from '@paraharness/core';
|
|
2
|
+
import type { HostRepositoryHeadState } from './host-repository-head-state.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves `baseRef` (`HEAD` commit SHA) and `baseBranch` (`symbolic-ref --short HEAD` or `'main'`) from `repoPath`.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} repoPath - Absolute path to the host Git repository.
|
|
7
|
+
*
|
|
8
|
+
* @returns {Promise<HostRepositoryHeadState>} Resolved `baseRef` and `baseBranch`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveHostRepositoryHeadState(repoPath: string): Promise<HostRepositoryHeadState>;
|
|
11
|
+
/**
|
|
12
|
+
* Provisions an isolated Task Root Worktree at `<dir>/roots/<runId>` via `git worktree add --detach`.
|
|
13
|
+
*
|
|
14
|
+
* Hydrates `node_modules` (honoring `.lockfileGate` and `.setup`) and initializes `<gitdir>/harness-meta.json`.
|
|
15
|
+
*
|
|
16
|
+
* @param {GitCowWorktreeNode} node - Worktree scope AST node configuration.
|
|
17
|
+
* @param {string} runId - Unique flow run identifier.
|
|
18
|
+
*
|
|
19
|
+
* @returns {Promise<GitWorktreeHandle>} Newly provisioned root `GitWorktreeHandle`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function gitWorktreeAcquireRoot(node: GitCowWorktreeNode, runId: string): Promise<GitWorktreeHandle>;
|
|
22
|
+
//# sourceMappingURL=git-worktree-acquire-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-worktree-acquire-root.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/git-worktree-acquire-root.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAO/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE/E;;;;;;GAMG;AACH,wBAAsB,8BAA8B,CAClD,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,uBAAuB,CAAC,CAUlC;AAED;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,kBAAkB,EACxB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,iBAAiB,CAAC,CAoC5B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { mkdir, rm } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { hydrateWorktreeDependencies } from './cow-worktree-hydrator.js';
|
|
4
|
+
import { runGitCommand, withHostWorktreeLock, writeHarnessMeta, } from './git-cli-runner.js';
|
|
5
|
+
/**
|
|
6
|
+
* Resolves `baseRef` (`HEAD` commit SHA) and `baseBranch` (`symbolic-ref --short HEAD` or `'main'`) from `repoPath`.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} repoPath - Absolute path to the host Git repository.
|
|
9
|
+
*
|
|
10
|
+
* @returns {Promise<HostRepositoryHeadState>} Resolved `baseRef` and `baseBranch`.
|
|
11
|
+
*/
|
|
12
|
+
export async function resolveHostRepositoryHeadState(repoPath) {
|
|
13
|
+
const baseRef = (await runGitCommand({ cwd: repoPath, args: ['rev-parse', 'HEAD'] })).stdout.trim();
|
|
14
|
+
const branchOutput = await runGitCommand({
|
|
15
|
+
cwd: repoPath,
|
|
16
|
+
args: ['symbolic-ref', '--short', 'HEAD'],
|
|
17
|
+
allowNonZeroExit: true,
|
|
18
|
+
});
|
|
19
|
+
const trimmedBranch = branchOutput.stdout.trim();
|
|
20
|
+
const baseBranch = branchOutput.exitCode === 0 && trimmedBranch.length > 0 ? trimmedBranch : 'main';
|
|
21
|
+
return { baseRef, baseBranch };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Provisions an isolated Task Root Worktree at `<dir>/roots/<runId>` via `git worktree add --detach`.
|
|
25
|
+
*
|
|
26
|
+
* Hydrates `node_modules` (honoring `.lockfileGate` and `.setup`) and initializes `<gitdir>/harness-meta.json`.
|
|
27
|
+
*
|
|
28
|
+
* @param {GitCowWorktreeNode} node - Worktree scope AST node configuration.
|
|
29
|
+
* @param {string} runId - Unique flow run identifier.
|
|
30
|
+
*
|
|
31
|
+
* @returns {Promise<GitWorktreeHandle>} Newly provisioned root `GitWorktreeHandle`.
|
|
32
|
+
*/
|
|
33
|
+
export async function gitWorktreeAcquireRoot(node, runId) {
|
|
34
|
+
const repoPath = path.resolve(node.repo);
|
|
35
|
+
const baseDir = path.isAbsolute(node.dir) ? node.dir : path.resolve(repoPath, node.dir);
|
|
36
|
+
const safeRunId = runId.replace(/[^a-zA-Z0-9._-]/g, '_');
|
|
37
|
+
const worktreePath = path.join(baseDir, 'roots', safeRunId);
|
|
38
|
+
await rm(worktreePath, { recursive: true, force: true });
|
|
39
|
+
await mkdir(path.dirname(worktreePath), { recursive: true });
|
|
40
|
+
const { baseRef, baseBranch } = await withHostWorktreeLock(repoPath, async () => {
|
|
41
|
+
await runGitCommand({
|
|
42
|
+
cwd: repoPath,
|
|
43
|
+
args: ['worktree', 'prune'],
|
|
44
|
+
allowNonZeroExit: true,
|
|
45
|
+
});
|
|
46
|
+
const headState = await resolveHostRepositoryHeadState(repoPath);
|
|
47
|
+
await runGitCommand({
|
|
48
|
+
cwd: repoPath,
|
|
49
|
+
args: ['worktree', 'add', '--detach', '--force', worktreePath, headState.baseRef],
|
|
50
|
+
});
|
|
51
|
+
return headState;
|
|
52
|
+
});
|
|
53
|
+
const rawGitDir = (await runGitCommand({ cwd: worktreePath, args: ['rev-parse', '--git-dir'] })).stdout.trim();
|
|
54
|
+
const gitDirPath = path.resolve(worktreePath, rawGitDir);
|
|
55
|
+
await hydrateWorktreeDependencies(node, repoPath, worktreePath);
|
|
56
|
+
const emptyConflicts = Object.freeze({});
|
|
57
|
+
await writeHarnessMeta(gitDirPath, { baseRef, baseBranch, unresolvedConflictPaths: emptyConflicts });
|
|
58
|
+
return {
|
|
59
|
+
worktreePath,
|
|
60
|
+
gitDirPath,
|
|
61
|
+
baseRef,
|
|
62
|
+
baseBranch,
|
|
63
|
+
headRef: baseRef,
|
|
64
|
+
unresolvedConflictPaths: emptyConflicts,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=git-worktree-acquire-root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-worktree-acquire-root.js","sourceRoot":"","sources":["../../../src/executors/internal/git-worktree-acquire-root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,qBAAq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G,OAAO;QACL,YAAY;QACZ,UAAU;QACV,OAAO;QACP,UAAU;QACV,OAAO,EAAE,OAAO;QAChB,uBAAuB,EAAE,cAAc;KACxC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { GitScopeReceipt, GitWorktreeHandle, ReconcileResult } from '@paraharness/core';
|
|
2
|
+
/**
|
|
3
|
+
* Captures a 100% non-mutating `GitScopeReceipt` for `handle` using a temporary index file.
|
|
4
|
+
*
|
|
5
|
+
* Reuses `HEAD` directly when the working tree is clean and `HEAD` descends from `baseRef`,
|
|
6
|
+
* and pins `refs/harness/candidates/<run-id>/<branch-index>` for child fork worktrees.
|
|
7
|
+
*
|
|
8
|
+
* @param {GitWorktreeHandle} handle - Active worktree handle to inspect.
|
|
9
|
+
* @param {readonly string[] | undefined} [excludeGlobs] - Optional glob patterns excluded from staging.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Promise<GitScopeReceipt>} Validated `GitScopeReceipt` with `headRef`, `diffStat`, and `mutatedFiles`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function gitWorktreeInspectNonMutating(handle: GitWorktreeHandle, excludeGlobs?: readonly string[]): Promise<GitScopeReceipt>;
|
|
14
|
+
/**
|
|
15
|
+
* Reconciles `child` into `parent` via stateless 3-way `git merge-tree --write-tree` without polluting `parent` on conflict.
|
|
16
|
+
*
|
|
17
|
+
* Leaves `child.baseRef` untouched on a clean merge, or materializes conflicts into `child` and advances `child.baseRef = C_1` on conflict.
|
|
18
|
+
*
|
|
19
|
+
* @param {GitWorktreeHandle} child - Completed child worktree handle.
|
|
20
|
+
* @param {GitWorktreeHandle} parent - Target parent worktree handle.
|
|
21
|
+
* @param {readonly string[] | undefined} [excludeGlobs] - Optional glob patterns excluded from staging.
|
|
22
|
+
*
|
|
23
|
+
* @returns {Promise<ReconcileResult<GitScopeReceipt>>} Clean or conflicted reconciliation result.
|
|
24
|
+
*/
|
|
25
|
+
export declare function gitWorktreeCommitChild(child: GitWorktreeHandle, parent: GitWorktreeHandle, excludeGlobs?: readonly string[]): Promise<ReconcileResult<GitScopeReceipt>>;
|
|
26
|
+
//# sourceMappingURL=git-worktree-commit-child.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-worktree-commit-child.d.ts","sourceRoot":"","sources":["../../../src/executors/internal/git-worktree-commit-child.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAmB3B;;;;;;;;;;GAUG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,iBAAiB,EACzB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAC/B,OAAO,CAAC,eAAe,CAAC,CA4B1B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,iBAAiB,EACzB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAC/B,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CA4B3C"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { GitScopeReceiptSchema } from '../../schemas/git-receipts.schema.js';
|
|
2
|
+
import { gitCheckpointStatusMap } from './git-checkpoint-status-map.js';
|
|
3
|
+
import { runGitCommand } from './git-cli-runner.js';
|
|
4
|
+
import { gitWorktreeFlushCleanParentChanges, gitWorktreePruneResolvedConflicts, } from './git-worktree-flush-and-prune.js';
|
|
5
|
+
import { executeStatelessMergeTree, gitWorktreeMaterializeMerge, synthesizeWorkingTreeCommitOverBase, } from './git-worktree-materialize-merge.js';
|
|
6
|
+
import { fastForwardParentToTargetCommit, findWorktreeConflictMarkerPaths, pinCandidateRefIfSpeculativeBranch, } from './parent-fast-forward.js';
|
|
7
|
+
/**
|
|
8
|
+
* Captures a 100% non-mutating `GitScopeReceipt` for `handle` using a temporary index file.
|
|
9
|
+
*
|
|
10
|
+
* Reuses `HEAD` directly when the working tree is clean and `HEAD` descends from `baseRef`,
|
|
11
|
+
* and pins `refs/harness/candidates/<run-id>/<branch-index>` for child fork worktrees.
|
|
12
|
+
*
|
|
13
|
+
* @param {GitWorktreeHandle} handle - Active worktree handle to inspect.
|
|
14
|
+
* @param {readonly string[] | undefined} [excludeGlobs] - Optional glob patterns excluded from staging.
|
|
15
|
+
*
|
|
16
|
+
* @returns {Promise<GitScopeReceipt>} Validated `GitScopeReceipt` with `headRef`, `diffStat`, and `mutatedFiles`.
|
|
17
|
+
*/
|
|
18
|
+
export async function gitWorktreeInspectNonMutating(handle, excludeGlobs) {
|
|
19
|
+
const snap = await gitCheckpointStatusMap(handle.worktreePath, { excludeGlobs });
|
|
20
|
+
const currentHead = (await runGitCommand({ cwd: handle.worktreePath, args: ['rev-parse', 'HEAD'] })).stdout.trim();
|
|
21
|
+
let headRef;
|
|
22
|
+
if (Object.keys(snap.statusMap).length === 0 && currentHead !== handle.baseRef) {
|
|
23
|
+
const ancestorCheck = await runGitCommand({
|
|
24
|
+
cwd: handle.worktreePath,
|
|
25
|
+
args: ['merge-base', '--is-ancestor', handle.baseRef, currentHead],
|
|
26
|
+
allowNonZeroExit: true,
|
|
27
|
+
});
|
|
28
|
+
headRef = ancestorCheck.exitCode === 0
|
|
29
|
+
? currentHead
|
|
30
|
+
: (await synthesizeWorkingTreeCommitOverBase(handle, handle.baseRef, excludeGlobs)).commitSha;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
headRef = (await synthesizeWorkingTreeCommitOverBase(handle, handle.baseRef, excludeGlobs)).commitSha;
|
|
34
|
+
}
|
|
35
|
+
await pinCandidateRefIfSpeculativeBranch(handle, headRef);
|
|
36
|
+
const statOutput = await runGitCommand({ cwd: handle.worktreePath, args: ['diff', '--stat', handle.baseRef, headRef] });
|
|
37
|
+
const filesOutput = await runGitCommand({ cwd: handle.worktreePath, args: ['diff', '--name-only', '-z', handle.baseRef, headRef] });
|
|
38
|
+
const mutatedFiles = filesOutput.stdout.split('\0').filter((relPath) => relPath.length > 0);
|
|
39
|
+
return GitScopeReceiptSchema.parse({
|
|
40
|
+
headRef,
|
|
41
|
+
baseRef: handle.baseRef,
|
|
42
|
+
branchName: handle.branchName,
|
|
43
|
+
baseBranch: handle.baseBranch,
|
|
44
|
+
diffStat: statOutput.stdout.trim(),
|
|
45
|
+
mutatedFiles,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Reconciles `child` into `parent` via stateless 3-way `git merge-tree --write-tree` without polluting `parent` on conflict.
|
|
50
|
+
*
|
|
51
|
+
* Leaves `child.baseRef` untouched on a clean merge, or materializes conflicts into `child` and advances `child.baseRef = C_1` on conflict.
|
|
52
|
+
*
|
|
53
|
+
* @param {GitWorktreeHandle} child - Completed child worktree handle.
|
|
54
|
+
* @param {GitWorktreeHandle} parent - Target parent worktree handle.
|
|
55
|
+
* @param {readonly string[] | undefined} [excludeGlobs] - Optional glob patterns excluded from staging.
|
|
56
|
+
*
|
|
57
|
+
* @returns {Promise<ReconcileResult<GitScopeReceipt>>} Clean or conflicted reconciliation result.
|
|
58
|
+
*/
|
|
59
|
+
export async function gitWorktreeCommitChild(child, parent, excludeGlobs) {
|
|
60
|
+
const remainingConflicts = await gitWorktreePruneResolvedConflicts(child);
|
|
61
|
+
const markerPaths = await findWorktreeConflictMarkerPaths(child, excludeGlobs);
|
|
62
|
+
if (Object.keys(remainingConflicts).length > 0 || markerPaths.length > 0) {
|
|
63
|
+
const unresolved = [...new Set([...Object.keys(remainingConflicts), ...markerPaths])];
|
|
64
|
+
const receipt = await gitWorktreeInspectNonMutating(child, excludeGlobs);
|
|
65
|
+
return { status: 'conflict', conflictedSummary: `Unresolved conflicts on child worktree: ${unresolved.join(', ')}`, data: receipt };
|
|
66
|
+
}
|
|
67
|
+
const c1Sha = await gitWorktreeFlushCleanParentChanges(parent, excludeGlobs);
|
|
68
|
+
const childSynth = await synthesizeWorkingTreeCommitOverBase(child, child.baseRef, excludeGlobs);
|
|
69
|
+
if (child.baseRef === c1Sha) {
|
|
70
|
+
await fastForwardParentToTargetCommit(parent, c1Sha, childSynth.commitSha);
|
|
71
|
+
return { status: 'clean', data: await gitWorktreeInspectNonMutating(parent, excludeGlobs) };
|
|
72
|
+
}
|
|
73
|
+
const mergeOutcome = await executeStatelessMergeTree(child, c1Sha, childSynth.commitSha);
|
|
74
|
+
if (mergeOutcome.clean) {
|
|
75
|
+
const commitOutput = await runGitCommand({ cwd: parent.worktreePath, args: ['commit-tree', mergeOutcome.mergedTreeSha, '-p', c1Sha, '-m', 'harness: commit child merge'] });
|
|
76
|
+
await fastForwardParentToTargetCommit(parent, c1Sha, commitOutput.stdout.trim());
|
|
77
|
+
return { status: 'clean', data: await gitWorktreeInspectNonMutating(parent, excludeGlobs) };
|
|
78
|
+
}
|
|
79
|
+
await gitWorktreeMaterializeMerge(child, {
|
|
80
|
+
targetHeadSha: c1Sha,
|
|
81
|
+
mergedTreeSha: mergeOutcome.mergedTreeSha,
|
|
82
|
+
priorTreeSha: childSynth.treeSha,
|
|
83
|
+
conflictedPaths: mergeOutcome.conflictedPaths,
|
|
84
|
+
});
|
|
85
|
+
const receipt = await gitWorktreeInspectNonMutating(child, excludeGlobs);
|
|
86
|
+
return { status: 'conflict', conflictedSummary: `3-way merge conflict on paths: ${mergeOutcome.conflictedPaths.join(', ')}`, data: receipt };
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=git-worktree-commit-child.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-worktree-commit-child.js","sourceRoot":"","sources":["../../../src/executors/internal/git-worktree-commit-child.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,kCAA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