@wildcard-ai/deepcontext
Version:
Advanced codebase indexing and semantic search MCP server
136 lines • 3.96 kB
TypeScript
/**
* Namespace Manager Service
* Handles namespace generation, indexed codebase management, and persistence
*/
export interface IndexedCodebase {
path: string;
namespace: string;
totalChunks: number;
indexedAt: string;
failed?: boolean;
failureReason?: string;
}
export interface CodebaseOperations {
clearNamespace(namespace: string): Promise<void>;
}
export interface NamespaceInfo {
namespace: string;
codebasePath: string;
totalChunks: number;
indexedAt: Date;
}
export declare class NamespaceManagerService {
private codebaseOperations;
private logger;
private indexedCodebases;
constructor(codebaseOperations: CodebaseOperations, loggerName?: string);
/**
* Generate a namespace from a codebase path
*/
generateNamespace(codebasePath: string): string;
/**
* Register a new indexed codebase
*/
registerCodebase(codebasePath: string, totalChunks: number, indexedAt?: Date): Promise<string>;
/**
* Register a failed indexing attempt
*/
registerFailedIndexing(codebasePath: string, failureReason: string, indexedAt?: Date): Promise<string>;
/**
* Get namespace for a codebase path
*/
getNamespaceForCodebase(codebasePath: string): string | null;
/**
* Get indexed codebase information
*/
getIndexedCodebase(codebasePath: string): IndexedCodebase | null;
/**
* Check if a codebase is indexed
*/
isCodebaseIndexed(codebasePath: string): boolean;
/**
* Get all indexed codebases
*/
getAllIndexedCodebases(): Promise<Map<string, IndexedCodebase>>;
/**
* Get list of indexed codebases as array
*/
getIndexedCodebasesList(): IndexedCodebase[];
/**
* Find codebase path by namespace
*/
getCodebaseByNamespace(namespace: string): string | null;
/**
* Get the first available indexed codebase (for default operations)
*/
getFirstIndexedCodebase(): {
path: string;
indexed: IndexedCodebase;
} | null;
/**
* Update chunk count for an indexed codebase
*/
updateChunkCount(codebasePath: string, totalChunks: number): Promise<void>;
/**
* Clear/remove indexed codebases
*/
clearIndexedCodebases(codebasePath?: string): Promise<{
success: boolean;
message: string;
namespacesCleared: string[];
}>;
/**
* Get namespace information with metadata
*/
getNamespaceInfo(codebasePath: string): NamespaceInfo | null;
/**
* Get all namespace information
*/
getAllNamespaceInfo(): NamespaceInfo[];
/**
* Persistence methods
*/
private getIndexedCodebasesPath;
private saveIndexedCodebases;
private loadIndexedCodebases;
/**
* Initialize the service by loading existing data
*/
initialize(): Promise<void>;
/**
* Refresh the registry by reloading from disk (for background indexing updates)
*/
refreshRegistry(): Promise<void>;
/**
* Get service statistics
*/
getStatistics(): {
totalCodebases: number;
totalChunks: number;
namespaces: string[];
oldestIndexed?: Date;
newestIndexed?: Date;
};
/**
* Get indexing status for codebases (compatible with IndexingOrchestrator interface)
*/
getIndexingStatus(codebasePath?: string): Promise<{
indexedCodebases: IndexedCodebase[];
currentCodebase?: IndexedCodebase;
incrementalStats?: any;
indexed: boolean;
fileCount: number;
}>;
/**
* Validate namespace format
*/
isValidNamespace(namespace: string): boolean;
/**
* Cleanup orphaned namespaces (namespaces not in our registry)
*/
cleanupOrphanedNamespaces(allNamespaces: string[]): Promise<{
orphaned: string[];
cleaned: number;
}>;
}
//# sourceMappingURL=NamespaceManagerService.d.ts.map