import type { SurrealConfig } from '../worker/surreal-adapter'; import type { EmbeddingServiceConfig } from '../services/embedding-service'; import type { ChunkOptions } from '../chunking/types'; import type { ICodeAdapter, IEmbeddingService } from './interfaces'; export interface CodebaseIndexerConfig { /** Absolute path to the repository root */ repoPath: string; /** Codebase ID from .flowstate/config.json */ codebaseId: string; /** Organization ID from .flowstate/config.json */ orgId: string; /** Workspace ID from .flowstate/config.json */ workspaceId: string; /** SurrealDB connection configuration */ surreal: SurrealConfig; /** Ollama embedding service configuration (required for sync operations, optional for status/purge) */ embedding?: EmbeddingServiceConfig; /** Chunking options (default: { maxTokens: 512, overlapTokens: 50 }) */ chunking?: ChunkOptions; /** Path to .ragignore file (default: {repoPath}/.ragignore) */ ragignorePath?: string; /** Maximum file size in bytes to index (default: 102400 = 100KB) */ maxFileSizeBytes?: number; /** Progress callback */ onProgress?: (event: ProgressEvent) => void; /** Optional: inject a custom code adapter (for testing) */ codeAdapter?: ICodeAdapter; /** Optional: inject a custom embedding service (for testing) */ embeddingService?: IEmbeddingService; } export interface ProgressEvent { phase: 'scanning' | 'filtering' | 'extracting' | 'embedding' | 'storing' | 'cleaning' | 'complete'; current: number; total: number; file?: string; } export interface IndexResult { filesScanned: number; filesIndexed: number; filesSkipped: number; /** Files skipped because content hash matched (unchanged since last index) */ filesUnchanged: number; /** Files whose chunks were removed (deleted in diff, or stale in full sync) */ filesDeleted: number; chunksCreated: number; /** Chunks removed for deleted/renamed files and stale cleanup */ chunksDeleted: number; embeddingTimeMs: number; totalTimeMs: number; errors: Array<{ file: string; error: string; }>; } /** Options for incremental diff sync */ export interface SyncDiffOptions { /** Git ref to diff against (e.g., 'HEAD~1', 'abc123') */ ref?: string; /** Branch to compute merge-base against (e.g., 'main', 'origin/dev') */ mergeBase?: string; /** Dry run — show what would be indexed without embedding */ dryRun?: boolean; } /** A single file entry from git diff output */ export interface DiffEntry { /** Diff status: A=Added, C=Copied, M=Modified, R=Renamed, D=Deleted */ status: 'A' | 'C' | 'M' | 'R' | 'D'; /** File path (relative to repo root) */ path: string; /** Original path for renamed files (status='R') */ oldPath?: string; } export interface CodeChunkMetadata { codebaseId: string; filePath: string; language: string; contentType: string; packageName?: string; exportName?: string; startLine: number; endLine: number; contentHash: string; sourceType: 'codebase_sync'; indexedAt: string; } //# sourceMappingURL=types.d.ts.map