/** * workspace/registration/worktree-link.ts * * The impure worktree→main-repo LINK probe. A linked git worktree records its * main repository in its own `.git` file, and `git rev-parse --git-common-dir` * resolves to that main repo's shared `.git` directory regardless of where the * worktree lives on disk. This is exactly the link registration inheritance must * follow, an orchestration-spawned worktree can sit outside the registered * project's subtree yet still belong to it, so we derive the MAIN worktree root * from the common dir rather than from path ancestry. * * Kept isolated (and behind an injectable runner) so the resolver and store stay * pure/testable and only this file shells out. */ import type { WorkspaceGitMetadata } from './types.js'; /** Runs one `git -C ` and returns trimmed stdout, or null on any failure. */ export type GitRunner = (cwd: string, args: readonly string[]) => string | null; /** * Probe the worktree→main-repo link for `path`. Returns `mainWorktreeRoot` only * when `path` is a LINKED worktree whose main repo lives elsewhere; returns an * empty object for the main worktree, a non-worktree directory, or a * non-repo/bare-repo path. */ export declare function probeWorktreeLink(path: string, runGit?: GitRunner): WorkspaceGitMetadata; //# sourceMappingURL=worktree-link.d.ts.map