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:
co-authored by
Mohamed Boudra
parent
8c6abcb41f
commit
d406c29e16
@@ -1,6 +1,7 @@
|
||||
import path from "node:path";
|
||||
import { resolvePaseoNodeEnv } from "./paseo-env.js";
|
||||
import { z } from "zod";
|
||||
import { expandTilde } from "../utils/path.js";
|
||||
|
||||
import type { PaseoDaemonConfig } from "./bootstrap.js";
|
||||
import {
|
||||
@@ -256,6 +257,21 @@ function resolveAuthConfig(
|
||||
: undefined;
|
||||
}
|
||||
|
||||
function resolveWorktreesRoot(
|
||||
paseoHome: string,
|
||||
persisted: ReturnType<typeof loadPersistedConfig>,
|
||||
): string | undefined {
|
||||
const configuredRoot = persisted.worktrees?.root?.trim();
|
||||
if (!configuredRoot) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const expandedRoot = expandTilde(configuredRoot);
|
||||
return path.isAbsolute(expandedRoot)
|
||||
? path.resolve(expandedRoot)
|
||||
: path.resolve(paseoHome, expandedRoot);
|
||||
}
|
||||
|
||||
function resolveAppendSystemPrompt(persisted: ReturnType<typeof loadPersistedConfig>): string {
|
||||
return persisted.daemon?.appendSystemPrompt ?? "";
|
||||
}
|
||||
@@ -321,6 +337,7 @@ export function loadConfig(
|
||||
return {
|
||||
listen,
|
||||
paseoHome,
|
||||
worktreesRoot: resolveWorktreesRoot(paseoHome, persisted),
|
||||
corsAllowedOrigins: resolveCorsAllowedOrigins(env, persisted),
|
||||
hostnames,
|
||||
mcpEnabled,
|
||||
|
||||
Reference in New Issue
Block a user