/** * Git common-dir resolution shared by claim store and registry. * * All worktrees of a repository share one common dir (the primary * checkout's `.git`); coordination data placed under * `/aidlc/` is therefore visible from every worktree (AC-2). * * Extracted from cost/sessions.ts `repoIdentity` so both modules use one * resolution path (design DD1). */ /** * Resolve the git common dir for `cwd`, or null outside a git repo (AC-5). * Symlink-normalized (realpath) so the same dir compares equal regardless * of the path it was reached through (e.g. macOS /var → /private/var). */ export declare function gitCommonDir(cwd: string): string | null; /** * The primary checkout's copy of the project at `projectRoot`, or null outside a git * repository (or wherever git reports no working tree). * * All worktrees share one common dir — the primary checkout's `.git` — so its parent is * the primary working tree. That is the *repository's* top, and an AIDLC project can sit * below it (a monorepo package): the project is the primary working tree joined with * the project's path inside its own working tree, which is the same path in every * checkout of one repository (repo-root-is-not-the-project/AC-1). At the repository * root that path is empty and this is the primary working tree, as before (AC-2). * * It replaced `primaryWorkingTree`, which returned that top. Every caller of it — the * roadmap, the concurrency gate (automation-verdicts/AC-8), autopilot — meant the * project, and an export answering the wrong question beside this one is how one * mistake reached five call sites. One resolution path, per this module's own DD1. * * `projectRoot` is the RESOLVED project root (`resolveProjectRoot`); every caller has * one already, and resolving again here would be a second answer to "which project". * * `--show-toplevel`, not `--show-prefix`: the prefix is an empty line at the top, and * trimming the output drops it, leaving one line that reads like a failure. * * A path that climbs out of git's working tree is never joined. `GIT_WORK_TREE` naming * another directory makes `--show-toplevel` report a tree that does not contain the * project; the answer is then the primary working tree, which every caller handles — * null would instead switch the roadmap to this checkout's own copy. */ export declare function primaryProjectRoot(projectRoot: string): string | null; /** * The project's path inside the checkout it sits in — `packages/app` for a monorepo * package, '' at the repository root — or null outside a git repository. * * `createWorktree` needs it twice: to put a new worktree beside the checkout rather * than beside the project, and to find the project's copy inside that worktree * (worktree-start-in-nested-project/AC-1, AC-2). */ export declare function projectPathInCheckout(projectRoot: string): string | null; /** * Resolve the writable coordination root `/aidlc/`, creating it * on first use. Returns null outside a git repo (AC-5) or when the common * dir is not writable (AC-27) — callers fall back to legacy behavior. */ export declare function coordinationRoot(cwd: string): string | null; /** * The common dir and whether `cwd` is in a linked worktree, from ONE `git` * spawn, or null outside a git repo. * * `gitCommonDir` plus `isLinkedWorktree` is three spawns; a hook that runs on * every session start pays for each (hooks-carry-lifecycle-state/AC-10). Same * comparison as `isLinkedWorktree`: the per-worktree git dir differs from the * common one only in a linked worktree. That — not "is this the parent of the * common dir" — is what tells the primary checkout, because an AIDLC project can * sit below the repository root (a monorepo package, a project in a dotfiles repo). */ export declare function gitDirs(cwd: string): { common: string; linked: boolean; } | null; /** True when `cwd` is inside a linked worktree (not the primary checkout). */ export declare function isLinkedWorktree(cwd: string): boolean; //# sourceMappingURL=common-dir.d.ts.map