import type { Ignore } from 'ignore'; import { VersionControlProvider, VersionControlLayer, VersionControlIgnorePattern } from '../types/version-control-layer'; export interface FileSystemAdapter { readFile(path: string): Promise<{ content: string; } | null>; fileExists?(path: string): Promise; isDirectory?(path: string): Promise; readDirectory?(path: string): Promise; getFileStats?(path: string): Promise<{ size: number; isDirectory: boolean; lastModified: Date; } | null>; /** * Fast filtered file tree building - adapters must implement this efficiently * for their environment (e.g., using fdir in Node.js, batch APIs for remote, etc.) * @returns paths: Array of relative paths from directoryPath (directories end with '/') * @returns stats: Optional map of path to file stats for performance */ buildFilteredFileTree(directoryPath: string, patterns?: string[], // Array of gitignore-style patterns to exclude sourceDirectory?: string): Promise<{ paths: string[]; stats?: Map; }>; } export interface GitAdapter { getCurrentBranch?(repoPath: string): Promise; getCurrentCommit?(repoPath: string): Promise; getRemotes?(repoPath: string): Promise>; getStatus?(repoPath: string): Promise<{ modified: string[]; untracked: string[]; staged: string[]; }>; detectRepository?(path: string): Promise<{ isGitRepository: boolean; currentBranch?: string; owner?: string; repo?: string; } | null>; watchGitRepository?(path: string): Promise; stopWatchingGit?(): Promise; onGitStatusChange?(callback: (data: { changedFiles: Array<{ path: string; status: 'added' | 'modified' | 'deleted' | 'renamed'; lastModified?: Date; }>; }) => void): () => void; } export interface ShellAdapter { openExternal(url: string): Promise; } /** * Git implementation of VersionControlProvider for core library * Handles .gitignore parsing and Git-specific operations */ export declare class GitVersionControlProvider implements VersionControlProvider { private fileSystemAdapter; private gitAdapter?; constructor(fileSystemAdapter: FileSystemAdapter, gitAdapter?: GitAdapter | undefined); detect(directoryPath: string): Promise; getRepositoryRoot(directoryPath: string): Promise; createLayer(repositoryRoot: string): Promise; /** * Extract all .gitignore patterns from the repository */ extractIgnorePatterns(repositoryRoot: string): Promise; /** * Recursively find and parse .gitignore files */ private findAndParseGitignoreFiles; /** * Parse a .gitignore file and return patterns using the ignore library */ private parseGitignoreFile; /** * Create an ignore instance from patterns for efficient filtering * This can be used by FilesystemService or other components */ createIgnoreFromPatterns(patterns: VersionControlIgnorePattern[]): Ignore | null; /** * Get current branch name */ getCurrentBranch(repositoryRoot: string): Promise; /** * Get current commit SHA */ getCurrentRevision(repositoryRoot: string): Promise; /** * Get remote repositories */ getRemotes(repositoryRoot: string): Promise>; } //# sourceMappingURL=GitVersionControlProvider.d.ts.map