/** * SMI-628: IndexerRepository - Database operations for skill indexing * * Provides: * - Upsert skills with conflict resolution on repo_url * - Track last_indexed_at for incremental updates * - Store raw SKILL.md content for re-parsing * - Batch operations for efficient bulk indexing */ import type { Database as DatabaseType } from '../db/database-interface.js'; import type { Skill, TrustTier } from '../types/skill.js'; import type { SkillMetadata } from '../indexer/GitHubIndexer.js'; /** * Extended skill with indexing metadata */ export interface IndexedSkill extends Skill { /** * When the skill was last indexed from source */ lastIndexedAt: string; /** * SHA of the source file for change detection */ sourceSha: string | null; /** * Path to the source file in the repository */ sourceFilePath: string | null; /** * Raw content of the SKILL.md file */ rawContent: string | null; } /** * Upsert result */ export interface UpsertResult { /** * Whether this was an insert (true) or update (false) */ inserted: boolean; /** * The resulting skill */ skill: IndexedSkill; /** * Whether the content changed (for updates) */ contentChanged: boolean; } /** * Batch upsert result */ export interface BatchUpsertResult { /** * Total skills processed */ total: number; /** * Number of new skills inserted */ inserted: number; /** * Number of existing skills updated */ updated: number; /** * Number of skills unchanged (same SHA) */ unchanged: number; /** * Any errors that occurred */ errors: Array<{ repoUrl: string; error: string; }>; } /** * Repository for indexer-specific database operations */ export declare class IndexerRepository { private db; private migrationApplied; constructor(db: DatabaseType); private stmts; /** * Ensure the indexer columns exist */ private ensureMigration; private prepareStatements; /** * Convert a database row to an IndexedSkill object * SMI-825: Added security scan fields */ private rowToSkill; /** * Upsert a skill from indexer metadata */ upsertFromMetadata(metadata: SkillMetadata, trustTier?: TrustTier): UpsertResult; /** * Batch upsert skills from indexer metadata */ batchUpsertFromMetadata(metadataList: SkillMetadata[]): BatchUpsertResult; /** * Find skills that need reindexing */ findNeedingReindex(olderThan?: string, limit?: number): IndexedSkill[]; /** * Find skill by repository URL */ findByRepoUrl(repoUrl: string): IndexedSkill | null; /** * Find skill by source SHA */ findBySha(sha: string): IndexedSkill | null; /** * Get all indexed skills with pagination */ findAllIndexed(limit?: number, offset?: number): IndexedSkill[]; /** * Calculate quality score from metadata */ private calculateQualityScore; } export default IndexerRepository; //# sourceMappingURL=IndexerRepository.d.ts.map