Indexing
Lifecycle
Section titled “Lifecycle”await indexer.initialize(); // required before any other method; idempotentawait indexer.close(); // flushes pending writes, closes DB, stops watcherIndex a project
Section titled “Index a project”const stats: IndexStats = await indexer.indexProject();// {// projectId, projectRoot,// totalFiles, totalChunks, totalEdges,// byLanguage, // e.g. { typescript: 120, markdown: 12 }// byType, // e.g. { function: 80, class: 15, method: 90, … }// byEdgeType, // e.g. { CALLS: 200, IMPORTS: 150, … }// lastIndexed,// }Index or remove a single file
Section titled “Index or remove a single file”await indexer.indexFile('src/utils.ts'); // (re-)index a single fileawait indexer.removeFile('src/utils.ts'); // remove a file's chunks and edges