/** * Source Indexer * Connects source adapters to the skill parsing and persistence pipeline */ import type { ISourceAdapter } from './ISourceAdapter.js'; import type { SourceSearchOptions, SourceRepository, BatchIndexResult, SkillIndexResult } from './types.js'; import type { DependencyDeclaration } from '../types/dependencies.js'; /** * Parsed skill metadata (matches existing SkillParser output) */ export interface ParsedSkillMetadata { name: string; description: string | null; author: string | null; version: string | null; tags: string[]; /** SMI-3135: Structured dependency declaration (replaces string[]) */ dependencies?: DependencyDeclaration; category: string | null; license: string | null; rawContent: string; repoUrl: string; filePath: string; sha: string; owner: string; repo: string; } /** * Skill parser interface (matches existing SkillParser) */ export interface ISkillParser { parse(content: string): ParsedSkillMetadata | null; } /** * Repository interface for persisting skills */ export interface ISkillRepository { upsertFromMetadata(metadata: ParsedSkillMetadata): Promise<{ id: string; action: 'created' | 'updated' | 'unchanged'; }>; getSkillBySha(sha: string): Promise<{ id: string; } | null>; } /** * Indexer options */ export interface SourceIndexerOptions { /** Maximum concurrent fetch operations */ concurrency?: number; /** Whether to skip unchanged skills (SHA match) */ skipUnchanged?: boolean; /** Progress callback */ onProgress?: (current: number, total: number, repo: string) => void; /** Error callback */ onError?: (error: Error, repo: SourceRepository) => void; } /** * Source Indexer * * Orchestrates the indexing pipeline: * 1. Search source for repositories * 2. Fetch skill content from each repository * 3. Parse skill metadata * 4. Persist to database * * @example * ```typescript * const indexer = new SourceIndexer( * githubAdapter, * skillParser, * skillRepository * ) * * const result = await indexer.indexAll({ * topics: ['claude-skill'], * limit: 100 * }) * * console.log(`Indexed ${result.indexed} skills`) * ``` */ export declare class SourceIndexer { private readonly adapter; private readonly parser; private readonly repository; private readonly options; constructor(adapter: ISourceAdapter, parser: ISkillParser, repository: ISkillRepository, options?: SourceIndexerOptions); /** * Index all skills from the source matching search options * * @param searchOptions - Options for searching the source * @returns Batch index result */ indexAll(searchOptions?: SourceSearchOptions): Promise; /** * Index a single repository * * @param repo - Repository to index * @param skipUnchanged - Whether to skip if SHA unchanged * @returns Index result */ indexRepository(repo: SourceRepository, skipUnchanged?: boolean): Promise; /** * Index specific repositories by URL * * @param urls - Repository URLs to index * @returns Batch index result */ indexUrls(urls: string[]): Promise; /** * Parse a repository URL into owner/repo components */ private parseRepoUrl; /** * Split array into chunks */ private chunkArray; } //# sourceMappingURL=SourceIndexer.d.ts.map