Skip to content

feat: Support custom base branch for mc_launch and mc_plan #40

@nigel-dev

Description

@nigel-dev

Description

mc_launch and mc_plan always branch from the default branch (main/master). There is no way to start work from a different base — a feature branch, a release branch, or another job's branch.

This forces workarounds like manually creating branches before launching, or using mc_plan solely to get a single integration PR when sequential launches from a feature branch would be simpler.

Current Behavior

mc_launch: createWorktree({ branch }) → if branch doesn't exist, git worktree add -b {branch} {path} branches from HEAD of default branch. No startPoint argument.

mc_plan: createIntegrationBranch(planId)getDefaultBranch()rev-parse that HEAD → creates integration branch from there. Hardcoded.

createWorktree in src/lib/worktree.ts: No startPoint parameter in the function signature or the git command.

Proposed Solution

mc_launch

Add optional baseBranch parameter:

args: {
  // ... existing args
  baseBranch: tool.schema.string().optional()
    .describe('Branch or ref to start from (defaults to default branch)'),
}

In createWorktree, pass startPoint to git:

// Current:
createResult = await gitCommand(['worktree', 'add', '-b', opts.branch, worktreePath]);

// Proposed:
const args = ['worktree', 'add', '-b', opts.branch, worktreePath];
if (opts.startPoint) args.push(opts.startPoint);
createResult = await gitCommand(args);

mc_plan

Add optional baseBranch parameter to the plan spec:

args: {
  // ... existing args
  baseBranch: tool.schema.string().optional()
    .describe('Base branch for the integration branch (defaults to default branch)'),
}

In createIntegrationBranch, accept and use the base ref:

// Current:
const defaultBranch = await getDefaultBranch();
const mainHeadResult = await gitCommand(['rev-parse', defaultBranch]);

// Proposed:
const baseBranch = baseRef ?? await getDefaultBranch();
const baseHeadResult = await gitCommand(['rev-parse', baseBranch]);

Affected Files

  • src/tools/launch.ts — add baseBranch param, pass to createWorktree
  • src/tools/plan.ts — add baseBranch param, pass to createIntegrationBranch
  • src/lib/worktree.tscreateWorktree() accepts optional startPoint
  • src/lib/integration.tscreateIntegrationBranch() accepts optional baseRef
  • src/lib/schemas.ts — add baseBranch to plan schema if applicable

Use Cases

  • Start a plan from a feature branch: mc_plan(baseBranch: "feat/v2")
  • Launch a fix against a release branch: mc_launch(baseBranch: "release/1.5")
  • Chain work without merging to main first: launch from another job's branch
  • Avoid unnecessary version bumps: work on a shared feature branch, single PR to main

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2: mediumShould fix — improves reliability or DXenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions