/** * Worktree bootstrap — prepare a freshly-created git worktree for the subagent. * * Responsibilities: * 1. Symlink shared config directories (.pi/, .commandcode/) from the parent repo * into the worktree, so the subagent sees the same skills, settings, and hooks. * 2. Optionally copy gitignored cache directories (node_modules/, target/, etc.) * from the nearest existing worktree (or main repo) into the new worktree, * via `rsync` to avoid cold builds. * 3. Parse `.pi/worktree.yaml` for per-project configuration. If absent, fall * back to safe defaults (symlinks only, no cache copy). * * Symlinks (not copies) for config dirs: * - The config dirs are read-mostly during agent execution * - Symlinks are instant (zero copy time) and stay in sync automatically * - Write points (e.g. .commandcode/settings.json) are atomic (write-temp-rename) * and guarded by idempotency checks, so concurrent agents don't race * * Cache directories: * - Read from `.pi/worktree.yaml` `cache_sharing.copy_ignored` list * - Only directories that are gitignored are copied (to avoid clobbering * tracked files in the worktree's branch) * - Copy is skipped if the source doesn't exist * - Uses `rsync -a` (archive mode: recursive, preserve perms, etc.) */ import { WorktreeManager } from "#src/worktree-manager"; /** Parsed contents of `.pi/worktree.yaml`. */ export interface WorktreeConfigFile { /** Directories to symlink from the parent repo into the worktree. */ symlinks?: string[]; /** Cache sharing settings. */ cache_sharing?: { /** List of gitignored directory names to copy from nearest worktree. */ copy_ignored?: string[]; }; } /** Result of bootstrapping a worktree. */ export interface BootstrapResult { /** Directories that were symlinked (path relative to worktree root). */ symlinksCreated: string[]; /** Directories that were copied as cache (path relative to worktree root). */ cachesCopied: string[]; /** Directories that were skipped (not present, not gitignored, etc.). */ skipped: Array<{ path: string; reason: string; }>; /** Any non-fatal warnings encountered during bootstrap. */ warnings: string[]; } /** * Load worktree config from `/.pi/worktree.yaml`. * Returns `null` when the file does not exist or is unparseable. * * The config is intentionally permissive: invalid YAML falls back to * `null` (i.e. defaults) with a warning, rather than aborting the spawn. */ export declare function loadWorktreeConfig(repoRoot: string, warnings?: string[]): WorktreeConfigFile | null; /** * Bootstrap a freshly-created worktree: symlink config dirs, copy cache * directories, return a summary of what happened. * * Safe to call multiple times — symlink creation is idempotent, cache * copy will overwrite the destination. */ export declare function bootstrapWorktree(manager: WorktreeManager, worktreePath: string, config?: WorktreeConfigFile | null): BootstrapResult; export { WorktreeManager }; export declare function toRepoRelative(absolutePath: string, repoRoot: string): string; //# sourceMappingURL=worktree-bootstrap.d.ts.map