Run worktree setup async and stream status

This commit is contained in:
Mohamed Boudra
2026-01-23 11:28:48 +07:00
parent 8154a05fa5
commit 69f32da90d
11 changed files with 632 additions and 101 deletions
@@ -142,6 +142,29 @@ describe("createWorktree", () => {
expect(setupLog).toContain("branch=setup-test");
});
it("does not run setup commands when runSetup=false", async () => {
const paseoConfig = {
worktree: {
setup: ['echo "setup ran" > setup.log'],
},
};
writeFileSync(join(repoDir, "paseo.json"), JSON.stringify(paseoConfig));
execSync(
"git add paseo.json && git -c commit.gpgsign=false commit -m 'add paseo.json'",
{ cwd: repoDir }
);
const result = await createWorktree({
branchName: "main",
cwd: repoDir,
worktreeSlug: "no-setup-test",
runSetup: false,
});
expect(existsSync(result.worktreePath)).toBe(true);
expect(existsSync(join(result.worktreePath, "setup.log"))).toBe(false);
});
it("cleans up worktree if setup command fails", async () => {
// Create paseo.json with failing setup command
const paseoConfig = {