feat(lanes): pick Claude Code or Codex when adding a lane

This commit is contained in:
2026-08-27 10:49:08 +07:00
parent 02050ac0ad
commit 810c28cdf6
4 changed files with 74 additions and 1 deletions
@@ -192,6 +192,7 @@ describe("AddLaneModal — worktree mode (default)", () => {
base: "main",
branch: "feat/new-feature",
pipeline: "default",
tool: "claude",
});
});
expect(onAdded).toHaveBeenCalledWith(
@@ -346,6 +347,7 @@ describe("AddLaneModal — repo mode (adopt)", () => {
cwd: "/Users/tester/projects/repo",
title: "main repo",
pipeline: "default",
tool: "claude",
})
);
expect(api.lanes.worktree).not.toHaveBeenCalled();
@@ -439,3 +441,48 @@ describe("AddLaneModal — pipeline template", () => {
expect(screen.getByRole("option", { name: "default" })).toBeInTheDocument();
});
});
describe("AddLaneModal — tool selection", () => {
it("sends the picked tool when adopting a repo", async () => {
vi.mocked(api.lanes.ensure).mockResolvedValue({
lane: laneFixture({ id: 23, kind: "adopted", status: "idle" }),
created: true,
});
const onAdded = vi.fn();
const onClose = vi.fn();
renderModal({ onAdded, onClose });
const user = userEvent.setup();
await user.click(screen.getByRole("button", { name: "Repo" }));
const dirField = screen.getByLabelText("Directory");
await focusField(user, dirField);
await user.type(dirField, "/tmp/demo");
await user.click(screen.getByRole("button", { name: /codex/i }));
await user.click(screen.getByRole("button", { name: /add lane|create/i }));
await waitFor(() =>
expect(api.lanes.ensure).toHaveBeenCalledWith(expect.objectContaining({ tool: "codex" }))
);
});
it("defaults to claude code", async () => {
vi.mocked(api.lanes.ensure).mockResolvedValue({
lane: laneFixture({ id: 24, kind: "adopted", status: "idle" }),
created: true,
});
const onAdded = vi.fn();
const onClose = vi.fn();
renderModal({ onAdded, onClose });
const user = userEvent.setup();
await user.click(screen.getByRole("button", { name: "Repo" }));
const dirField = screen.getByLabelText("Directory");
await focusField(user, dirField);
await user.type(dirField, "/tmp/demo");
await user.click(screen.getByRole("button", { name: /add lane|create/i }));
await waitFor(() =>
expect(api.lanes.ensure).toHaveBeenCalledWith(expect.objectContaining({ tool: "claude" }))
);
});
});