UNPKG

socraticode

Version:

SocratiCode — MCP server for local codebase indexing, semantic search, and code dependency graphs. All private, all local via Docker.

84 lines • 4.49 kB
import { hashContent } from "../constants.js"; import type { FileChunk } from "../types.js"; import type { GitRefreshTarget } from "./git-state.js"; export declare const FILE_SCAN_BATCH = 50; /** Progress details for an in-flight indexing operation */ export interface IndexingProgress { type: "full-index" | "incremental-update"; startedAt: number; filesTotal: number; filesProcessed: number; chunksTotal?: number; chunksProcessed?: number; /** Total number of file batches (each up to INDEX_BATCH_SIZE files) */ batchesTotal?: number; /** Number of file batches fully processed and checkpointed */ batchesProcessed?: number; phase: string; error?: string; } /** Summary of a completed indexing operation */ export interface IndexingCompleted { type: "full-index" | "incremental-update"; completedAt: number; durationMs: number; filesProcessed: number; chunksCreated: number; error?: string; } /** Check if a project is currently being indexed (full index or incremental update) */ export declare function isIndexingInProgress(projectPath: string): boolean; /** Get progress details for a project currently being indexed */ export declare function getIndexingProgress(projectPath: string): IndexingProgress | null; /** Set or clear progress for a project (used by index-tools during infrastructure setup) */ export declare function setIndexingProgress(projectPath: string, progress: IndexingProgress | null): void; /** Get the last completed indexing operation for a project */ export declare function getLastCompleted(projectPath: string): IndexingCompleted | null; /** Get all projects currently being indexed */ export declare function getIndexingInProgressProjects(): string[]; /** Check if a project's index is complete by querying persisted metadata in Qdrant. * Returns "completed", "in-progress", or "unknown" (no metadata found). */ export declare function getPersistedIndexingStatus(projectPath: string): Promise<"completed" | "in-progress" | "unknown">; /** Request graceful cancellation of an in-flight indexing operation. * The operation will stop after the current batch finishes and checkpoint. */ export declare function requestCancellation(projectPath: string): boolean; export { hashContent }; /** Generate a stable chunk ID as a valid UUID (required by Qdrant) */ export declare function chunkId(relativePath: string, startLine: number): string; /** Check if a file should be indexed based on extension or name */ export declare function isIndexableFile(fileName: string, extraExts?: Set<string>, extensionLanguageMap?: Map<string, string>): boolean; /** * Split file content into chunks using AST-aware boundaries when possible. * Falls back to line-based chunking for unsupported languages or on parse * failure. Minified/bundled content (detected via average line length) is * handled by character-based chunking to avoid context-window overflows. * A hard character cap is applied to every chunk regardless of strategy. */ export declare function chunkFileContent(filePath: string, relativePath: string, content: string, options?: { maxChunkChars?: number; extensionLanguageMap?: Map<string, string>; indexFormatVersion?: number; }): FileChunk[]; /** Get all indexable files in a project directory */ export declare function getIndexableFiles(projectPath: string, extraExts?: Set<string>, extensionLanguageMap?: Map<string, string>): Promise<string[]>; /** Full index of a project directory */ export declare function indexProject(projectPath: string, onProgress?: (message: string) => void, extraExtensions?: Set<string>, target?: GitRefreshTarget): Promise<{ filesIndexed: number; chunksCreated: number; cancelled: boolean; skipped?: string; }>; /** Incremental update: only re-index changed/new files, remove deleted ones */ export declare function updateProjectIndex(projectPath: string, onProgress?: (message: string) => void, extraExtensions?: Set<string>, target?: GitRefreshTarget): Promise<{ added: number; updated: number; removed: number; chunksCreated: number; cancelled: boolean; skipped?: string; }>; /** Remove an entire project index */ export declare function removeProjectIndex(projectPath: string): Promise<void>; /** Forget the loaded file hashes of an identity whose collection is gone. */ export declare function invalidateProjectHashesForIdentity(projectId: string): void; //# sourceMappingURL=indexer.d.ts.map