Skip to content

Quick Start

Install Lucerna as a library dependency:

Terminal window
pnpm add @upstart.gg/lucerna
# or
npm install @upstart.gg/lucerna
# or
bun add @upstart.gg/lucerna

Then index and search your project:

import { CodeIndexer } from '@upstart.gg/lucerna';
const indexer = new CodeIndexer({
projectRoot: '/path/to/your/project',
});
await indexer.initialize(); // open DB, init tree-sitter
await indexer.indexProject(); // walk and chunk all matching files
// Hybrid search (semantic + BM25 fused via RRF)
const results = await indexer.search('authentication middleware', { limit: 5 });
for (const r of results) {
console.log(`${r.chunk.filePath}:${r.chunk.startLine} [${r.chunk.type}] ${r.chunk.name ?? ''}`);
console.log(r.chunk.content.slice(0, 200));
}
await indexer.close();