/** * SpecVectorIndex * * Builds and queries a LanceDB vector index over OpenSpec spec files. * Each record represents a logical section (requirement, purpose, design note...) * parsed from the Markdown spec files. * * Storage: /vector-index/ (same LanceDB folder as VectorIndex, different table) * Table name: "specs" * * Usage: * // Build (or rebuild) * await SpecVectorIndex.build(outputDir, specsDir, mappingJson, embedSvc); * * // Search * const results = await SpecVectorIndex.search(outputDir, "email validation", embedSvc); */ import type { EmbeddingService } from './embedding-service.js'; export interface SpecRecord { id: string; domain: string; section: string; title: string; /** Concatenated text used for embedding */ text: string; /** Source files linked to this requirement (from mapping.json) */ linkedFiles: string; /** Embedding vector */ vector: number[]; } export interface SpecSearchResult { record: { id: string; domain: string; section: string; title: string; text: string; /** Parsed from JSON -- list of source file paths linked to this spec section */ linkedFiles: string[]; }; score: number; } export declare class SpecVectorIndex { /** * Discover all spec.md files under specsDir, parse them, enrich with mapping, * embed, and write to LanceDB table "specs". * * @param outputDir Path to .openlore/analysis/ * @param specsDir Path to openspec/specs/ (or any directory containing domain/spec.md files) * @param mappingJsonPath Path to mapping.json (optional -- no enrichment if absent) */ static build(outputDir: string, specsDir: string, embedSvc: EmbeddingService | null, mappingJsonPath?: string, decisionsDir?: string): Promise<{ recordCount: number; hasEmbeddings: boolean; }>; /** * Semantic search over the spec index. */ static search(outputDir: string, query: string, embedSvc: EmbeddingService | null | undefined, opts?: { limit?: number; domain?: string; section?: string; }): Promise; /** * BM25-only search over the spec corpus: used when no embedding service is * available or the index was built without embeddings. Scores the full * corpus with BM25 and returns the top `limit` matching sections. */ private static _bm25Only; /** * Returns true if the spec index table exists. */ static exists(outputDir: string): boolean; } //# sourceMappingURL=spec-vector-index.d.ts.map