Add configurable worktree root

* Add configurable worktree root

Allow new Paseo worktrees to be created under a custom worktrees.root from config.json while preserving the existing PASEO_HOME/worktrees default. Thread the resolved root through create/list/archive/ownership flows, MCP/session paths, checkout metadata, schema, docs, and targeted tests.

* Address worktree root review feedback

Use the resolved Paseo worktree base when a custom PASEO_HOME is provided, and remove an unused worktreesRoot dependency from worktree list handling.

* Fix checkout worktree path test on Windows

Use platform-native paths in the custom PASEO_HOME regression test so Windows CI compares against the same resolved root shape as production code.

* Clarify optional worktrees config docs

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
This commit is contained in:
Matt Cowger
2026-06-01 16:19:29 +08:00
committed by GitHub
co-authored by Mohamed Boudra
parent 8c6abcb41f
commit d406c29e16
25 changed files with 324 additions and 42 deletions
@@ -10,6 +10,7 @@ import {
mkdirSync,
} from "fs";
import { join } from "path";
import { win32 } from "node:path";
import { tmpdir } from "os";
import {
__resetCheckoutShortstatCacheForTests,
@@ -2355,6 +2356,20 @@ const x = 1;
expect(isPaseoWorktreePath("C:\\Users\\dev\\.paseo\\worktrees\\feature")).toBe(true);
});
it("matches worktrees under a custom PASEO_HOME", () => {
const customPaseoHome = process.platform === "win32" ? "C:\\paseo" : "/var/lib/paseo";
const worktreePath =
process.platform === "win32"
? win32.join(customPaseoHome, "worktrees", "project", "feature")
: `${customPaseoHome}/worktrees/project/feature`;
expect(
isPaseoWorktreePath(worktreePath, {
paseoHome: customPaseoHome,
}),
).toBe(true);
});
it("rejects paths without .paseo/worktrees segment", () => {
expect(isPaseoWorktreePath("/home/user/repo")).toBe(false);
expect(isPaseoWorktreePath("C:\\Users\\dev\\repo")).toBe(false);