/** * Canonical project identity computation (T9149 — W5 N1 Epsilon-unique insight). * * Addresses the 80,969-row pollution from cross-provider mount-path divergence * (e.g. /mnt/projects/cleocode vs /workspace/cleocode both hashing to different * base64url(path) IDs for the same repo). * * `canonicalProjectId` anchors identity to git-root + realpath so container * bind-mounts, CI clones, and developer laptops all produce the same ID. * * @task T9149 * @module nexus/identity */ /** Components that make up the canonical project fingerprint. */ export interface ProjectIdentityComponents { /** Absolute realpath of the git root (resolves symlinks). */ readonly gitRoot: string; /** Project name from project-info.json (if present). */ readonly projectName?: string; /** First git remote URL (origin fetch URL, if present). */ readonly remoteUrl?: string; } /** Result of canonical ID computation. */ export interface CanonicalProjectIdResult { /** The 12-hex-char canonical project ID. */ readonly id: string; /** The components used to compute the ID. */ readonly components: ProjectIdentityComponents; /** * Legacy base64url(path) IDs that should be aliased to this canonical ID. * Populated when the caller supplies known legacy IDs for migration. */ readonly legacyAliases?: ReadonlyArray; } /** * Find the git root for a given directory using `git rev-parse --show-toplevel`. * * Returns `null` if the directory is not inside a git repo (non-fatal: allows * use outside git repos). */ export declare function findGitRoot(fromPath: string): Promise; /** * Find the primary git remote URL (origin fetch URL). * * Returns `null` when there are no remotes or git is unavailable. */ export declare function findGitRemoteUrl(fromPath: string): Promise; /** * Compute the canonical project ID for a given repository path. * * Algorithm: * 1. Resolve `repoPath` to its `realpath` (resolves symlinks, normalises mounts). * 2. Detect the git root via `git rev-parse --show-toplevel` (falls back to realpath). * 3. Read `.cleo/project-info.json` name (optional). * 4. Read `git remote get-url origin` (optional). * 5. SHA-256 of `||`, first 12 hex chars. * * This ensures `/mnt/projects/cleocode` and `/workspace/cleocode` (same git root, * same remote) produce the same ID — resolving the 80,969-row pollution vector. * * @param repoPath - Absolute path to the project root (may be a symlink or bind-mount). * @returns The canonical project ID result with components and hash. * * @task T9149 */ export declare function canonicalProjectId(repoPath: string): Promise; /** * Compute the legacy base64url(path) ID for a given path. * * Canonical source: `@cleocode/paths` (`packages/paths/src/cleo-paths.ts`). * Re-exported here for backward compatibility — all internal nexus consumers * should import from `@cleocode/paths` directly. * * This is the old algorithm used before W5: `Buffer.from(path).toString('base64url').slice(0, 32)`. * Used to populate `projectIdAliases` when migrating existing registrations. */ export { legacyProjectId } from '@cleocode/paths'; /** * Build the set of legacy IDs that should be aliased to the canonical ID. * * Includes the direct path legacy ID and any additional known paths (e.g. * from container mount variants). */ export declare function computeLegacyAliases(repoPath: string, additionalPaths?: string[]): string[]; //# sourceMappingURL=identity.d.ts.map