feat: terminal reattach, explorer tab memory, worktree terminals

This commit is contained in:
Mohamed Boudra
2026-02-15 14:05:29 +07:00
parent 1f72ce63cd
commit 9244f1fbd6
31 changed files with 2009 additions and 385 deletions
+42
View File
@@ -11,6 +11,7 @@ interface PaseoConfig {
worktree?: {
setup?: string[];
destroy?: string[];
terminals?: WorktreeTerminalConfig[];
};
}
@@ -33,6 +34,11 @@ export type WorktreeSetupCommandResult = {
exitCode: number | null;
};
export interface WorktreeTerminalConfig {
name?: string;
command: string;
}
export class WorktreeSetupError extends Error {
readonly results: WorktreeSetupCommandResult[];
@@ -107,6 +113,42 @@ export function getWorktreeDestroyCommands(repoRoot: string): string[] {
return destroyCommands.filter((cmd) => typeof cmd === "string" && cmd.trim().length > 0);
}
export function getWorktreeTerminalSpecs(repoRoot: string): WorktreeTerminalConfig[] {
const config = readPaseoConfig(repoRoot);
const terminals = config?.worktree?.terminals;
if (!Array.isArray(terminals) || terminals.length === 0) {
return [];
}
const specs: WorktreeTerminalConfig[] = [];
for (const terminal of terminals) {
if (!terminal || typeof terminal !== "object") {
continue;
}
const rawCommand = terminal.command;
if (typeof rawCommand !== "string") {
continue;
}
const command = rawCommand.trim();
if (!command) {
continue;
}
const rawName = terminal.name;
const name = typeof rawName === "string" && rawName.trim().length > 0
? rawName.trim()
: undefined;
specs.push({
...(name ? { name } : {}),
command,
});
}
return specs;
}
async function execSetupCommand(
command: string,
options: { cwd: string; env: NodeJS.ProcessEnv }