/** * Generates a tar download URL for a git repository * * Supported input formats: * - Full URLs: https://github.com/user/repo * - Tree URLs: https://github.com/user/repo/tree/branch/path * - Short format: user/repo * - SSH format: git@github.com:user/repo.git * * Supported platforms: * - GitHub: https://github.com/{owner}/{repo}/archive/{ref}.tar.gz * - GitLab: https://gitlab.com/{owner}/{repo}/-/archive/{ref}/{repo}-{ref}.tar.gz * - Bitbucket: https://bitbucket.org/{owner}/{repo}/get/{ref}.tar.gz * - Gitea: https://{host}/{owner}/{repo}/archive/{ref}.tar.gz * - Codeberg: https://codeberg.org/{owner}/{repo}/archive/{ref}.tar.gz * - Forgejo: https://{host}/{owner}/{repo}/archive/{ref}.tar.gz * * Unsupported platforms (will return null): * - Azure DevOps: Does not support direct tar downloads * * @param input - Repository URL or identifier (user/repo, git@host:user/repo.git, https://...) * @param branch - Optional branch/commit/tag (defaults to "main") * @returns The tar download URL, or null if the platform doesn't support tar downloads */ declare function getTarUrl(input: string, branch?: string): string | null; /** * Base error class for all gittar errors */ declare class GittarError extends Error { readonly cause?: unknown; constructor(message: string, cause?: unknown); } /** * Error thrown when URL parsing or download fails */ declare class URLError extends GittarError {} /** * Error thrown when filesystem operations fail */ declare class FSError extends GittarError {} /** * Cache update strategy: * - 'always': Always re-download, ignore cache * - 'commit': Re-download only if remote commit SHA differs from cached (default) * - 'never': Always use cache if it exists, never check remote */ type UpdateStrategy = "always" | "commit" | "never"; type Config = { cacheDir?: string; outDir?: string; update?: UpdateStrategy; url: string; branch?: string; subpath?: string; }; type GittarResult = { files: string[]; cacheDir: string; outDir: string; subpath?: string; fromCache: boolean; commit?: string; branch?: string; }; /** * Downloads and extracts a git repository tar archive with cache-first support * * Behavior: * - Always caches the full tar archive in cacheDir for reuse * - Subpath filtering (if specified) only affects returned files, not cache * - Returns metadata including cache hit status and storage locations * * Update strategies: * - 'always': Always re-download, ignore cache * - 'commit': Re-download only if remote commit SHA differs from cached (default) * - 'never': Always use cache if it exists, never check remote * * @param config - Configuration object * @returns Object containing filtered files, cache location, output location, and metadata * @throws URLError if URL parsing or download fails * @throws FSError if filesystem operations fail */ declare function gittar(config: Config): Promise; declare function gittar(url: string): Promise; declare function gittar(configOrUrl: Config | string): Promise; export { getTarUrl, gittar as default, UpdateStrategy, URLError, GittarResult, GittarError, FSError, Config };