import { basename, dirname, resolve } from "node:path"; // Lane roots are ~/.cache/cottondb//worktree; the lane directory, rather // than the common leaf, identifies their simulator copy and orphan record. export function worktreeName(root) { const path = resolve(root); return basename(path) === "worktree" ? basename(dirname(path)) : basename(path); }