/** * #2661 — Git workspace identity: separate WORKTREE identity from * REPOSITORY identity. * * Daemon dedup, state, and scheduling have historically been keyed on the * worktree path (`process.cwd()`), so N Git worktrees of the same repository * behave as N unrelated projects — the cardinality bug behind the worktree * daemon fanout. This service resolves the identity that is SHARED across * worktrees: * * worktreeRoot `git rev-parse --show-toplevel` — per-worktree * commonGitDir `git rev-parse --git-common-dir` — shared by all worktrees * repositoryId sha256(canonical commonGitDir) — stable repo key * head `git rev-parse HEAD` — current commit * * Two worktrees of one repository resolve to the SAME repositoryId (and, * when checked out at the same commit, the same head) — the key ingredient * for cross-worktree job dedup (issue invariant 5). * * Non-git directories degrade gracefully: repositoryId falls back to a hash * of the resolved directory path (prefixed `dir:`-style via isGit=false), so * callers never need a special case. */ export interface GitWorkspaceIdentity { /** Absolute root of this worktree (or the input dir when not a git repo). */ worktreeRoot: string; /** Absolute path of the shared .git directory (equals worktreeRoot/.git for non-worktree clones). */ commonGitDir: string; /** Stable id shared by ALL worktrees of one repository. */ repositoryId: string; /** Current HEAD commit sha ('' when not a git repo or unborn HEAD). */ head: string; /** False when the directory is not inside a git repository. */ isGit: boolean; } /** * Resolve the git workspace identity for a directory. Never throws. */ export declare function resolveGitWorkspaceIdentity(dir: string): GitWorkspaceIdentity; /** Test hook: clear the per-process identity cache. */ export declare function resetGitIdentityCacheForTests(): void; //# sourceMappingURL=git-workspace-identity.d.ts.map