-
Notifications
You must be signed in to change notification settings - Fork 3
Description
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— addbaseBranchparam, pass tocreateWorktreesrc/tools/plan.ts— addbaseBranchparam, pass tocreateIntegrationBranchsrc/lib/worktree.ts—createWorktree()accepts optionalstartPointsrc/lib/integration.ts—createIntegrationBranch()accepts optionalbaseRefsrc/lib/schemas.ts— addbaseBranchto 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