taskplane 0.1.13 → 0.1.15

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.
@@ -1403,7 +1403,7 @@ export function computeTransitiveDependents(
1403
1403
  *
1404
1404
  * This function checks each wave task's folder for untracked or modified files,
1405
1405
  * stages them, and creates a commit on the current branch. This must run BEFORE
1406
- * allocateLanes() so that worktrees (which are based on the integration branch)
1406
+ * allocateLanes() so that worktrees (which are based on the batch's base branch)
1407
1407
  * include the task files.
1408
1408
  *
1409
1409
  * Only task-specific folders are staged — no other working tree changes are touched.
@@ -1522,6 +1522,7 @@ export function ensureTaskFilesCommitted(
1522
1522
  * @param batchId - Batch ID for naming
1523
1523
  * @param pauseSignal - Shared pause signal (mutated by stop-wave policy)
1524
1524
  * @param dependencyGraph - Dependency graph for computing transitive dependents
1525
+ * @param baseBranch - Branch to base worktrees on (captured at batch start)
1525
1526
  * @param onMonitorUpdate - Optional callback for dashboard updates during monitoring
1526
1527
  * @param onLanesAllocated - Optional callback fired after lane allocation succeeds
1527
1528
  * @returns WaveExecutionResult with outcomes and blocked task IDs
@@ -1535,6 +1536,7 @@ export async function executeWave(
1535
1536
  batchId: string,
1536
1537
  pauseSignal: { paused: boolean },
1537
1538
  dependencyGraph: DependencyGraph,
1539
+ baseBranch: string,
1538
1540
  onMonitorUpdate?: MonitorUpdateCallback,
1539
1541
  onLanesAllocated?: (lanes: AllocatedLane[]) => void,
1540
1542
  ): Promise<WaveExecutionResult> {
@@ -1576,7 +1578,7 @@ export async function executeWave(
1576
1578
  }
1577
1579
 
1578
1580
  // ── Stage 1: Allocate lanes ──────────────────────────────────
1579
- const allocResult = allocateLanes(waveTasks, pending, config, repoRoot, batchId);
1581
+ const allocResult = allocateLanes(waveTasks, pending, config, repoRoot, batchId, baseBranch);
1580
1582
 
1581
1583
  if (!allocResult.success) {
1582
1584
  const errMsg = allocResult.error?.message || "Unknown allocation failure";
@@ -1,10 +1,28 @@
1
- /**
2
- * Git command runner
3
- * @module orch/git
4
- */
5
- import { execFileSync } from "child_process";
6
-
7
-
1
+ /**
2
+ * Git command runner
3
+ * @module orch/git
4
+ */
5
+ import { execFileSync } from "child_process";
6
+
7
+
8
+ // ── Branch Helpers ───────────────────────────────────────────────────
9
+
10
+ /**
11
+ * Get the current branch name (the branch checked out in the given directory).
12
+ *
13
+ * Uses `git rev-parse --abbrev-ref HEAD`. Returns the branch name or null
14
+ * if HEAD is detached or git fails.
15
+ *
16
+ * @param cwd - Working directory (defaults to process.cwd())
17
+ */
18
+ export function getCurrentBranch(cwd?: string): string | null {
19
+ const result = runGit(["rev-parse", "--abbrev-ref", "HEAD"], cwd);
20
+ if (!result.ok || !result.stdout.trim() || result.stdout.trim() === "HEAD") {
21
+ return null;
22
+ }
23
+ return result.stdout.trim();
24
+ }
25
+
8
26
  // ── Git Command Runner ───────────────────────────────────────────────
9
27
 
10
28
  /**
@@ -1,16 +1,16 @@
1
- /**
2
- * Merge orchestration, merge agents, merge worktree
3
- * @module orch/merge
4
- */
5
- import { readFileSync, writeFileSync, existsSync, unlinkSync } from "fs";
6
- import { spawnSync } from "child_process";
7
- import { join } from "path";
8
-
9
- import { buildLaneEnvVars, buildTmuxSpawnArgs, execLog, tmuxHasSession, tmuxKillSession, toTmuxPath } from "./execution.ts";
10
- import { MERGE_POLL_INTERVAL_MS, MERGE_RESULT_GRACE_MS, MERGE_RESULT_READ_RETRIES, MERGE_RESULT_READ_RETRY_DELAY_MS, MERGE_SPAWN_RETRY_MAX, MERGE_TIMEOUT_MS, MergeError, VALID_MERGE_STATUSES } from "./types.ts";
11
- import type { AllocatedLane, LaneExecutionResult, MergeLaneResult, MergeResult, MergeResultStatus, MergeWaveResult, OrchestratorConfig, WaveExecutionResult } from "./types.ts";
12
- import { sleepSync } from "./worktree.ts";
13
-
1
+ /**
2
+ * Merge orchestration, merge agents, merge worktree
3
+ * @module orch/merge
4
+ */
5
+ import { readFileSync, writeFileSync, existsSync, unlinkSync } from "fs";
6
+ import { spawnSync } from "child_process";
7
+ import { join } from "path";
8
+
9
+ import { buildLaneEnvVars, buildTmuxSpawnArgs, execLog, tmuxHasSession, tmuxKillSession, toTmuxPath } from "./execution.ts";
10
+ import { MERGE_POLL_INTERVAL_MS, MERGE_RESULT_GRACE_MS, MERGE_RESULT_READ_RETRIES, MERGE_RESULT_READ_RETRY_DELAY_MS, MERGE_SPAWN_RETRY_MAX, MERGE_TIMEOUT_MS, MergeError, VALID_MERGE_STATUSES } from "./types.ts";
11
+ import type { AllocatedLane, LaneExecutionResult, MergeLaneResult, MergeResult, MergeResultStatus, MergeWaveResult, OrchestratorConfig, WaveExecutionResult } from "./types.ts";
12
+ import { sleepSync } from "./worktree.ts";
13
+
14
14
  // ── Merge Implementation ─────────────────────────────────────────────
15
15
 
16
16
  /**
@@ -451,7 +451,7 @@ export function waitForMergeResult(
451
451
  }
452
452
 
453
453
  /**
454
- * Merge a completed wave's lane branches into the integration branch.
454
+ * Merge a completed wave's lane branches into the base branch.
455
455
  *
456
456
  * Orchestration flow:
457
457
  * 1. Filter to only succeeded lanes (failed lanes are not merged)
@@ -464,7 +464,7 @@ export function waitForMergeResult(
464
464
  * e. Handle result (continue, log, or pause)
465
465
  * 4. Return MergeWaveResult
466
466
  *
467
- * Sequential execution is mandatory — the integration branch is a shared
467
+ * Sequential execution is mandatory — the base branch is a shared
468
468
  * resource, and each merge must see the prior merge's result.
469
469
  *
470
470
  * On CONFLICT_UNRESOLVED or BUILD_FAILURE: stops merging remaining lanes
@@ -479,6 +479,7 @@ export function waitForMergeResult(
479
479
  * @param config - Orchestrator configuration
480
480
  * @param repoRoot - Main repository root
481
481
  * @param batchId - Batch ID for session naming
482
+ * @param baseBranch - Branch to merge into (captured at batch start)
482
483
  * @returns MergeWaveResult with per-lane outcomes
483
484
  */
484
485
  export function mergeWave(
@@ -488,10 +489,11 @@ export function mergeWave(
488
489
  config: OrchestratorConfig,
489
490
  repoRoot: string,
490
491
  batchId: string,
492
+ baseBranch: string,
491
493
  ): MergeWaveResult {
492
494
  const startTime = Date.now();
493
495
  const tmuxPrefix = config.orchestrator.tmux_prefix;
494
- const targetBranch = config.orchestrator.integration_branch;
496
+ const targetBranch = baseBranch;
495
497
  const laneResults: MergeLaneResult[] = [];
496
498
 
497
499
  // Build lane outcome lookup for merge eligibility checks.