/** * Shared domain types for TrueRef. * These re-export and extend the Drizzle-inferred schema types with * application-level conveniences. */ export type { Repository, NewRepository, RepositoryVersion, NewRepositoryVersion, Document, NewDocument, Snippet, NewSnippet, SnippetEmbedding, NewSnippetEmbedding, IndexingJob, NewIndexingJob, RepositoryConfig, NewRepositoryConfig, Settings, NewSettings } from './server/db/schema'; // --------------------------------------------------------------------------- // Application-level union types (narrower than raw DB enums) // --------------------------------------------------------------------------- export type RepositorySource = 'github' | 'local'; export type RepositoryState = 'pending' | 'indexing' | 'indexed' | 'error'; export type SnippetType = 'code' | 'info'; export type JobStatus = 'queued' | 'running' | 'done' | 'failed'; export type IndexingStage = 'queued' | 'differential' | 'crawling' | 'cloning' | 'parsing' | 'storing' | 'embedding' | 'done' | 'failed'; export type VersionState = 'pending' | 'indexing' | 'indexed' | 'error'; export type EmbeddingProviderKind = 'local-transformers' | 'openai-compatible'; // --------------------------------------------------------------------------- // API / service layer types // --------------------------------------------------------------------------- /** Payload accepted by the repository management service when adding a repo. */ export interface AddRepositoryInput { id: string; title: string; description?: string; source: RepositorySource; sourceUrl: string; branch?: string; githubToken?: string; } /** Lightweight repository summary returned in list endpoints. */ export interface RepositorySummary { id: string; title: string; description: string | null; source: RepositorySource; state: RepositoryState; totalSnippets: number; totalTokens: number; trustScore: number; stars: number | null; lastIndexedAt: Date | null; } /** Snippet returned from search results. */ export interface SearchResultSnippet { id: string; repositoryId: string; documentId: string; type: SnippetType; title: string | null; content: string; language: string | null; breadcrumb: string | null; tokenCount: number; score?: number; } /** Search request parameters. */ export interface SearchQuery { query: string; libraryId?: string; type?: SnippetType; limit?: number; } /** Parsed trueref.json / context7.json configuration. */ export interface TrueRefConfig { projectTitle?: string; description?: string; folders?: string[]; excludeFolders?: string[]; excludeFiles?: string[]; rules?: string[]; previousVersions?: Array<{ tag: string; title: string; commitHash?: string }>; }