/** * Repository Manager * * Manages GitNexus index storage in .gitnexus/ at repo root. * Also maintains a global registry at ~/.gitnexus/registry.json * so the MCP server can discover indexed repos from any cwd. */ export interface RepoMeta { repoPath: string; repoId?: string; lastCommit: string; indexedAt: string; analyzeOptions?: { includeExtensions?: string[]; scopeRules?: string[]; repoAlias?: string; embeddings?: boolean; csharpDefineCsproj?: string; }; stats?: { files?: number; nodes?: number; edges?: number; communities?: number; processes?: number; embeddings?: number; }; } export interface IndexedRepo { repoPath: string; storagePath: string; lbugPath: string; metaPath: string; meta: RepoMeta; } /** * Shape of an entry in the global registry (~/.gitnexus/registry.json) */ export interface RegistryEntry { name: string; path: string; storagePath: string; indexedAt: string; lastCommit: string; sourceName?: string; alias?: string; stats?: RepoMeta['stats']; } export interface RegisterRepoOptions { repoAlias?: string; } /** * Get the .gitnexus storage path for a repository */ export declare const getStoragePath: (repoPath: string) => string; /** * Get paths to key storage files */ export declare const getStoragePaths: (repoPath: string) => { storagePath: string; lbugPath: string; metaPath: string; }; /** * Check whether a KuzuDB index exists in the given storage path. * Non-destructive — safe to call from status commands. */ export declare const hasKuzuIndex: (storagePath: string) => Promise; /** * Check whether a LadybugDB index exists in the given storage path. */ export declare const hasLbugIndex: (storagePath: string) => Promise; /** * Clean up stale KuzuDB files after migration to LadybugDB. * * Returns: * found — true if .gitnexus/kuzu existed and was deleted * needsReindex — true if kuzu existed but lbug does not (re-analyze required) * * Callers own the user-facing messaging; this function only deletes files. */ export declare const cleanupOldKuzuFiles: (storagePath: string) => Promise<{ found: boolean; needsReindex: boolean; }>; /** * Load metadata from an indexed repo */ export declare const loadMeta: (storagePath: string) => Promise; /** * Save metadata to storage */ export declare const saveMeta: (storagePath: string, meta: RepoMeta) => Promise; /** * Check if a path has a GitNexus index */ export declare const hasIndex: (repoPath: string) => Promise; /** * Load an indexed repo from a path */ export declare const loadRepo: (repoPath: string) => Promise; /** * Find .gitnexus by walking up from a starting path */ export declare const findRepo: (startPath: string) => Promise; /** * Add .gitnexus to .gitignore if not already present */ export declare const addToGitignore: (repoPath: string) => Promise; /** * Get the path to the global GitNexus directory */ export declare const getGlobalDir: () => string; /** * Get the path to the global registry file */ export declare const getGlobalRegistryPath: () => string; /** * Read the global registry. Returns empty array if not found. */ export declare const readRegistry: () => Promise; /** * Register (add or update) a repo in the global registry. * Called after `gitnexus analyze` completes. */ export declare const registerRepo: (repoPath: string, meta: RepoMeta, options?: RegisterRepoOptions) => Promise; /** * Remove a repo from the global registry. * Called after `gitnexus clean`. */ export declare const unregisterRepo: (repoPath: string) => Promise; /** * List all registered repos from the global registry. * Optionally validates that each entry's .gitnexus/ still exists. */ export declare const listRegisteredRepos: (opts?: { validate?: boolean; }) => Promise; export interface CLIConfig { apiKey?: string; model?: string; baseUrl?: string; setupScope?: 'global' | 'project'; cliPackageSpec?: string; cliVersion?: string; } /** * Get the path to the global CLI config file */ export declare const getGlobalConfigPath: () => string; /** * Load CLI config from ~/.gitnexus/config.json */ export declare const loadCLIConfig: () => Promise; /** * Save CLI config to ~/.gitnexus/config.json */ export declare const saveCLIConfig: (config: CLIConfig) => Promise;