/** * The linked worktrees in a `git worktree list --porcelain -z` dump, main and * bare ones excluded — those are not removable, so their state is never at risk * from a teardown command, and the main one is the scan root a prune must never * swallow. * @param {string} porcelain * @returns {string[]} absolute worktree paths */ export function parseWorktreeList(porcelain: string): string[]; /** * The linked worktrees of the repo at `cwd`. The guard on `git worktree remove` * asks this the same way the prune below does, so one parser answers for both. * @param {string} cwd * @param {GitRun} run * @returns {string[]} absolute worktree paths */ export function linkedWorktrees(cwd: string, run: GitRun): string[]; /** * Directory paths a context scan of `dir` must not walk, relative to it and * `/`-separated: every wholly-ignored directory (unless `ignoredDirs` is off) * and every linked worktree nested inside it. * @param {string} dir * @param {{ ignoredDirs?: boolean, run?: GitRun }} [options] * @returns {Set} */ export function repoPrunedDirs(dir: string, { ignoredDirs, run }?: { ignoredDirs?: boolean; run?: GitRun; }): Set; /** * The `exclude` predicate for an instruction-file walk of `dir`: the static * context-scope prune, plus {@link repoPrunedDirs}. * * `ignoredDirs: false` is the LAUNCH scan's posture, and it is a security * choice rather than a performance one: `.gitignore` is repo-controlled, so * honouring it in the one scan that covers launch-time ingress would let a * hostile repo hide a planted `.claude/skills/…/SKILL.md` from it by ignoring * that directory. The whole-tree scan can honour it because anything it prunes * is still scanned by scan-loaded-instructions at the moment the host loads it. * * The lookup is EXACT, so the walk must hand it the same spelling * {@link repoPrunedDirs} uses — one root-relative, `/`-separated path per entry, * which is what walkContextGlobs normalizes to. A predicate that accepted a bare * name as well would prune a tracked `src/build/` for a top-level ignored * `build/`, splicing real instruction files out of the scan. * @param {string} dir * @param {{ ignoredDirs?: boolean, run?: GitRun }} [options] * @returns {(entry: string) => boolean} */ export function contextScanExclude(dir: string, options?: { ignoredDirs?: boolean; run?: GitRun; }): (entry: string) => boolean; /** * How git is asked. Injectable so a test can drive the failure paths, which no * filesystem state can force. */ export type GitRun = (file: string, args: string[], cwd: string) => string;