Skip to content

feat: support base_branch in matrix YAML and --base-branch CLI flag#163

Merged
c-h- merged 1 commit intomainfrom
feat/issue-162-matrix-base-branch
Mar 25, 2026
Merged

feat: support base_branch in matrix YAML and --base-branch CLI flag#163
c-h- merged 1 commit intomainfrom
feat/issue-162-matrix-base-branch

Conversation

@c-h-
Copy link
Copy Markdown
Collaborator

@c-h- c-h- commented Mar 25, 2026

Summary

Add base_branch field to matrix YAML entries and --base-branch CLI flag so worktrees can branch off a non-main branch (e.g. a research branch with spec artifacts already present).

Changes (6 files, +193/-9)

  • matrix-parser.tsbase_branch field in matrix YAML, propagated to AdapterSlots
  • launch-orchestrator.ts — global baseBranch fallback in OrchestrateOpts
  • worktree.ts — fetches origin/<baseBranch> as start point for new branches
  • cli.ts--base-branch CLI flag wired to both orchestrated and single-adapter paths
  • 7 new tests (4 matrix parser + 3 worktree) — all 602 tests pass

Usage

CLI:

agentctl launch claude-code --worktree ~/project --branch auto/impl --base-branch research/ENG-1234 -p "Implement the spec"

Matrix YAML:

matrix:
  - adapter: opencode
    model: ohm/moonshotai/Kimi-K2.5
    branch: auto/ENG-1234-kimi
    base_branch: research/ENG-1234

Closes #162

…loses #162)

When launching matrix agents, worktrees are always branched from HEAD/main.
This adds base_branch support so worktrees can branch from any ref via
origin/<base_branch>, enabling workflows where a research branch with
spec artifacts is the desired starting point.

Changes:
- MatrixEntry: add optional branch and base_branch fields
- AdapterSlot: add optional branch and baseBranch fields
- expandMatrix: propagate base_branch/branch to expanded slots
- createWorktree: fetch and branch from origin/<baseBranch> when specified
- orchestrateLaunch: pass slot-level or global baseBranch to worktree creation
- CLI launch: add --base-branch option
- Tests: 6 new tests covering specified/omitted/invalid base_branch

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@c-h- c-h- merged commit eb5d932 into main Mar 25, 2026
1 check passed
@c-h- c-h- deleted the feat/issue-162-matrix-base-branch branch March 25, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Matrix YAML: support base_branch to branch worktrees off a non-main branch

1 participant