/** * Resolved .gitmem directory path * * Solves: process.cwd() changes when agents cd into other repos (e.g., /workspace/gitmem), * but .gitmem/ was created in the project root. * The MCP server is long-running, so we resolve the path once and cache it. * * Resolution order: * 1. GITMEM_DIR env var (explicit override) * 2. Cached path from session_start (most reliable — session_start created the directory) * 3. Walk up from process.cwd() looking for existing .gitmem/ sentinels (backward compat) * 4. Fall back to ~/.gitmem (developer-scoped, survives across projects/containers) */ /** * Validate a string intended for use as a single path component (directory name or filename). * Rejects path traversal sequences, directory separators, and null bytes. * Throws on invalid input — callers should validate before reaching this layer. */ export declare function sanitizePathComponent(value: string, label: string): string; /** * Set the .gitmem directory path (called by session_start after creating it) */ export declare function setGitmemDir(dir: string): void; /** * Get the resolved .gitmem directory path * * Resolution order: * 1. GITMEM_DIR env var (explicit override) * 2. Cached path from session_start (most reliable) * 3. Walk up from CWD looking for existing .gitmem/ sentinels (backward compat) * 4. Fall back to ~/.gitmem (developer-scoped, survives across projects/containers) */ export declare function getGitmemDir(): string; /** * Get a file path within the .gitmem directory */ export declare function getGitmemPath(filename: string): string; /** * Get the per-session directory path: .gitmem/sessions// * Creates the directory if it doesn't exist. */ export declare function getSessionDir(sessionId: string): string; /** * Get a file path within a per-session directory. */ export declare function getSessionPath(sessionId: string, filename: string): string; /** * Read the "project" field from .gitmem/config.json. * Returns null if the file doesn't exist or has no project field. * * Precedence (handled by callers): explicit param > config.json > "default" */ export declare function getConfigProject(): string | null; /** * Check if feedback submission is enabled in .gitmem/config.json */ export declare function isFeedbackEnabled(): boolean; /** * Get the install_id from .gitmem/config.json (anonymous install identifier) */ export declare function getInstallId(): string | null; /** * Clear the cached path (for testing) */ export declare function clearGitmemDirCache(): void; //# sourceMappingURL=gitmem-dir.d.ts.map