import { InstallationOptions } from "../types/errors.js"; /** * Manages ast-grep binary discovery, installation, validation, and execution. */ export declare class AstGrepBinaryManager { private static readonly HARDCODED_VERSION; private static readonly GITHUB_RELEASES_API; private static readonly CACHE_VALIDATION_RETRIES; private static readonly CACHE_VALIDATION_RETRY_DELAY_MS; private static readonly VERSION_FETCH_TIMEOUT_MS; private binaryPath; private isInitialized; private options; /** * Create a manager with optional installation directives. */ constructor(options?: InstallationOptions); /** * Get the default cache directory with proper path validation. * This method handles cases where os.homedir() may return unexpected values * due to environment variable pollution from workspace configurations. */ private getDefaultCacheDir; private extractBinaryVersion; private compareVersions; private fetchLatestGitHubVersion; /** * Resolve and prepare an ast-grep binary for subsequent tool execution. */ initialize(): Promise; /** * Validate and register a caller supplied binary path without downloading. */ private useCustomBinary; /** * Locate ast-grep on PATH and ensure it can be executed. */ private useSystemBinary; /** * Search the environment PATH for an ast-grep executable. */ private findBinaryInPath; /** * Run --version against the provided binary to confirm it is usable. */ private testBinary; /** * Determine whether a file exists without throwing on access errors. */ private fileExists; /** * Resolve existing cached binary path, handling Windows script wrappers. */ private resolveExistingBinary; /** * Build the expected ast-grep file name for the given platform and architecture. */ private getBinaryName; /** * Download, extract, and validate a platform specific ast-grep binary. */ private downloadBinary; /** * Download a file with retry logic and exponential backoff. */ private downloadWithRetry; /** * Stream a remote file to disk using the built in fetch implementation. */ private downloadFile; private logStage; /** * Extract the ast-grep binary from an archive and stage the executable. */ private extractBinary; /** * Extract zip archive contents using pure JavaScript when platform tools are unavailable. */ private extractZipManually; /** * Walk a directory tree and collect file paths for archive extraction. */ private findFilesRecursively; /** * Remove temporary files created during download or extraction. */ private cleanup; /** * Return the resolved ast-grep binary path if initialization succeeded. */ getBinaryPath(): string | null; /** * Execute ast-grep with the provided arguments and optional stdin payload. */ executeAstGrep(args: string[], options?: { cwd?: string; timeout?: number; stdin?: string; }): Promise<{ stdout: string; stderr: string; }>; /** * Determine the appropriate command wrapper for invoking the binary on each platform. */ private getExecutionCommand; } //# sourceMappingURL=binary-manager.d.ts.map