import { type Platform } from './platform.js'; export declare const SEP: "\\" | "/"; export declare function normalizePath(p: string): string; export declare function pathsEqual(a: string, b: string): boolean; /** * The comparison key for a file path that must survive a different checkout: * repo-relative with POSIX separators. * * Rationale (lint baseline, measured 2026-09-25): ESLint reports `filePath` * absolute for the machine it ran on (`D:\peaks-loop\src\cli\commands\…`), * a committed baseline has to mean the same file on a *different* root, and * `git diff` reports repo-relative paths. Comparing those forms by `!==` is * false on every machine — which silently made both the baseline waiver and * the diff gate inert. Every side of every such comparison must be reduced * through this one function; reducing only one side is the same defect with * an extra step. * * A path that cannot be expressed relative to `projectRoot` — another drive, * or an already-relative key — is returned normalized-but-absolute, so it * still compares consistently: it simply will not match a path rooted * elsewhere. That is deliberate. A stale absolute key keeps working on the * machine that wrote it and stays inert everywhere else, exactly as before. */ export declare function repoRelativeKey(filePath: string, projectRoot: string): string; export declare function localPath(p: string, targetPlatform?: Platform): string; export declare function getTempDir(options?: { env?: NodeJS.ProcessEnv; }): string; export declare function isInsidePath(childPath: string, parentPath: string): boolean; export declare function isWindowsAbsolutePath(path: string): boolean; export declare function resolveInputPath(path: string): string; export declare function stableRealPath(path: string): string; export declare function stablePath(path: string): string; /** * Build the comparison key for a `projectRoot` value. Two paths that * denote the same physical directory MUST produce the same key, and two * paths that denote different directories MUST NOT. * * Composed from the existing `path-utils.ts` primitives; no new * dependency. Three normalizations, in order: * * 1. **Symlink resolution** via `stableRealPath` — collapses macOS * `/var/folders/...` vs `/private/var/folders/...` (`/var` is a * symlink to `/private/var`). Falls back to `resolveInputPath` * when the path does not exist, so this never throws for callers * that pass a not-yet-created root (or a stale binding whose * directory has since been deleted). * 2. **Separator folding** via `normalizePath` — collapses the * Windows `C:\Users\...` (written by `peaks workspace init`) vs * `C:/Users/...` (passed by a Git Bash caller) split that was the * original `PEAKS_SESSION_NOT_BOUND` trigger. * 3. **Case folding, Windows only** — NTFS is case-insensitive, so * `C:\Foo` and `c:/foo` are the same directory. This step is * guarded on `isWindows` because POSIX filesystems are * case-SENSITIVE: folding case on Linux would make the genuinely * distinct `/tmp/Foo` and `/tmp/foo` compare equal. * * Note on step 3: `realpathSync` alone is NOT sufficient for the * Windows case split. Verified empirically on Node 22 / win32 — * `realpathSync('c:\\...\\foo')` echoes the caller's casing, while only * `realpathSync.native` case-folds. We do not switch to `.native` * because it also rewrites 8.3 short names (`SMALLM~1` → `smallMark`), * which would change the on-disk form of every existing binding. * Explicit `toLowerCase()` is the narrower, more predictable fix. * * This is a compare key ONLY — never persist it. The value written to * disk stays the real path (see `writeSessionFile`). * * Lifted from `src/services/session/session-manager.ts` in slice * and `session-binding-bridge.ts` share a single canonicalization * authority. */ export declare function projectRootCompareKey(p: string): string; /** * Compare two `projectRoot` values under the canonicalization rules * documented on `projectRootCompareKey`. Returns true iff both paths * canonicalize to the same key — covers symlink resolution, separator * folding, and (Windows only) case folding. */ export declare function projectRootsMatch(a: string, b: string): boolean;