ctx-gen
Version:
AI-Enhanced Documentation Generator for Code Understanding
48 lines (47 loc) • 1.88 kB
TypeScript
/**
* Updates the .gitignore file to include the documentation directory
* @param docsDir - The documentation directory to ignore
*/
export declare function updateGitIgnore(docsDir: string): Promise<void>;
/**
* Creates a directory if it doesn't exist
* @param dirPath - The directory path to create
*/
export declare function ensureDirectory(dirPath: string): Promise<void>;
/**
* Ensures parent directory exists before writing a file
* @param filePath - The file path
* @param content - The content to write
*/
export declare function writeFileWithDir(filePath: string, content: string): Promise<void>;
/**
* Gets the relative path from the current working directory
* @param absolutePath - The absolute file path
* @returns The relative path from cwd
*/
export declare function getRelativePath(absolutePath: string): string;
/**
* Read patterns from .gitignore file
* @returns Array of gitignore patterns
*/
export declare function readGitignorePatterns(): Promise<string[]>;
/**
* Checks if a file should be excluded based on patterns including gitignore
* @param filePath - The file path to check
* @param excludePatterns - Array of exclude patterns (glob patterns)
* @param gitignorePatterns - Array of gitignore patterns
* @returns Whether the file should be excluded
*/
export declare function shouldExcludeFile(filePath: string, excludePatterns: string[], gitignorePatterns?: string[]): boolean;
/**
* Gets the language of a file based on extension
* @param filePath - The file path
* @returns The file language if supported, undefined otherwise
*/
export declare function getFileLanguage(filePath: string): string | undefined;
/**
* Detects if a file contains binary content
* @param filePath - The file path
* @returns True if file is binary, false otherwise
*/
export declare function isBinaryFile(filePath: string): Promise<boolean>;