// "Spawn similar" (#28): the seed a cloned session hands to a draft pane. // Pure — the caller owns opening the pane. import type { Draft } from "./layout.js"; import type { Session } from "./types.js"; /** Clone a session into draft values: same project, same command, same * worktree decision, fresh name. * * A worktree session seeds its *base repository*, not the checkout the daemon * made for it: "similar" is another session of that project, and the daemon * never adopts an existing worktree (docs/WORKTREES.md), so seeding the * checkout would ask it to build a worktree out of a worktree. The picker * then lands on that repository's box with "+ new" active. * * `cwdRawVisible: false` keeps the two-step project picker on screen with the * cloned project selected, instead of dropping the path into the free-text * escape hatch. * * The name is left out on purpose: a clone is a new session and takes its own * generated handle. */ export function spawnSimilarSeed(s: Session): Partial { const wt = s.worktree ?? null; return { command: s.command, cwd: wt ? wt.base_repo : s.cwd, worktreeEnabled: wt != null, cwdRawVisible: false, }; }