fix(FN-4623): align worktrunk create/remove argv semantics

Fusion-Task-Id: FN-4623
Fusion-Task-Lineage: 58122853-cab7-4102-9649-4ceda4c5959e
This commit is contained in:
Fusion (runfusion.ai)
2026-05-15 19:05:59 -07:00
committed by gsxdsm
parent 35279a2517
commit bcf140a92a
2 changed files with 7 additions and 4 deletions

View File

@@ -162,7 +162,7 @@ describe("WorktrunkWorktreeBackend", () => {
expect(execFileMock).toHaveBeenCalledWith(
"worktrunk",
["switch", "--create", "fusion/fn-1", "main"],
["switch", "--create", "fusion/fn-1", "--base", "main"],
expect.objectContaining({ cwd: "/repo", timeout: 120000, maxBuffer: 10485760 }),
);
});
@@ -179,7 +179,7 @@ describe("WorktrunkWorktreeBackend", () => {
expect(execFileMock).toHaveBeenCalledWith(
"worktrunk",
["remove", "fusion/fn-1"],
["remove", "--foreground", "fusion/fn-1"],
expect.objectContaining({ cwd: "/repo", timeout: 60000, maxBuffer: 10485760 }),
);
});

View File

@@ -294,14 +294,17 @@ export class WorktrunkWorktreeBackend implements WorktreeBackend {
// backend currently assumes that template aligns with Fusion's configured
// worktree path resolution so callers can keep using `input.worktreePath`.
const args = ["switch", "--create", input.branch];
if (input.startPoint) args.push(input.startPoint);
if (input.startPoint) args.push("--base", input.startPoint);
await this.runWorktrunk(args, { cwd: input.rootDir, operation: "create" });
return { path: input.worktreePath, branch: input.branch };
}
async remove(input: WorktreeRemoveInput): Promise<void> {
// worktrunk mapping: `wt remove <branch>` from repo root.
await this.runWorktrunk(["remove", input.branch ?? input.worktreePath], { cwd: input.rootDir, operation: "remove" });
await this.runWorktrunk(["remove", "--foreground", input.branch ?? input.worktreePath], {
cwd: input.rootDir,
operation: "remove",
});
}
async sync(_input: WorktreeSyncInput): Promise<{ skipped: boolean }> {