UNPKG

mira-consciousness

Version:

Memory & Intelligence Retention Archive - Preserving The Spark

96 lines 3.07 kB
/** * Centralized MIRA Memory Path Resolver * ==================================== * * This is the single source of truth for determining where the .mira directory * should be located. All MIRA components receive this path as an argument instead of * trying to figure it out themselves. * * Resolution Priority: * 1. MIRA_MEMORY_DIR environment variable (absolute override) * 2. Git repository root (finds the top-level .git, not nested ones) * 3. Existing .mira directory in current project * 4. Current working directory * 5. User home directory (fallback) * * Features: * - Comprehensive environment detection * - Git repository intelligence (avoids nested repos) * - Validates directory permissions * - Creates directory structure if needed * - Detailed logging for debugging */ export interface MIRAPathInfo { /** The resolved .mira directory path */ memoryDir: string; /** How the path was determined */ resolvedBy: 'env_override' | 'git_root' | 'existing_dir' | 'current_dir' | 'home_fallback'; /** Whether the directory was created during resolution */ created: boolean; /** Git repository root if found */ gitRoot?: string; /** Any warnings or issues encountered */ warnings: string[]; } export declare class MIRAPathResolver { private static instance; private resolvedPath; private constructor(); static getInstance(): MIRAPathResolver; /** * Resolve the MIRA memory directory with comprehensive intelligence */ resolveMIRAMemoryPath(options?: { verbose?: boolean; createIfMissing?: boolean; }): Promise<MIRAPathInfo>; /** * Find git repository root intelligently (avoids nested repos) */ private findGitRepositoryRoot; /** * Find existing .mira directory in project hierarchy */ private findExistingMIRAMemory; /** * Validate and prepare a potential MIRA memory path */ private validateAndPreparePath; /** * Create the complete MIRA directory structure */ private createMIRADirectoryStructure; /** * Initialize The Spark if this is a new installation */ private initializeSparkIfNeeded; /** * Get the cached resolved path (if available) */ getCachedPath(): MIRAPathInfo | null; /** * Clear cached path (for testing or re-resolution) */ clearCache(): void; /** * Get just the memory directory path (convenience method) */ getMemoryDirectoryPath(options?: { verbose?: boolean; }): Promise<string>; /** * Validate that a resolved path is still valid */ validateResolvedPath(pathInfo: MIRAPathInfo): Promise<boolean>; /** * Ensure all MIRA directories exist */ static ensureDirectories(): Promise<void>; } export declare function resolveMIRAMemoryPath(options?: { verbose?: boolean; }): Promise<MIRAPathInfo>; export declare function getMIRAMemoryDir(options?: { verbose?: boolean; }): Promise<string>; //# sourceMappingURL=MIRAPathResolver.d.ts.map