/** * Git Authentication Module * Resolves credentials for private Git repositories across platforms * * Supports: * - Environment variables (GIT_TOKEN, GITLAB_TOKEN, BITBUCKET_TOKEN, GH_TOKEN) * - SSH key detection * - Git credential helper * - Interactive token prompt (fallback) */ export type GitHost = 'github' | 'gitlab' | 'bitbucket' | 'custom'; export interface GitAuthResult { /** The authentication method that was resolved */ method: 'token' | 'ssh' | 'credential-helper' | 'netrc' | 'none'; /** Token value if method is 'token' */ token?: string; /** Whether SSH keys are available */ sshAvailable?: boolean; /** Detected host type */ host: GitHost; } export interface CloneOptions { /** Branch or tag to checkout */ ref?: string; /** Clone depth (default: 1 for shallow) */ depth?: number; /** Subpath within the repo to sparse-checkout */ subpath?: string; /** Explicit auth token to use (overrides auto-detection) */ token?: string; } /** * Detect the Git hosting provider from a URL */ export declare function detectGitHost(url: string): GitHost; /** * Resolve Git authentication for a given URL * * Resolution priority: * 1. Environment variables (host-specific) * 2. SSH key availability (for SSH URLs) * 3. Git credential helper * 4. .netrc file * 5. None (public repo or will fail) */ export declare function resolveGitAuth(url: string, explicitToken?: string): Promise; /** * Build an authenticated HTTPS URL by injecting a token * * Input: https://gitlab.com/team/repo.git + token "abc123" * Output: https://oauth2:abc123@gitlab.com/team/repo.git */ export declare function buildAuthenticatedUrl(url: string, token: string): string; /** * Convert an SSH URL to HTTPS URL for token-based auth * git@github.com:owner/repo.git → https://github.com/owner/repo.git */ export declare function sshToHttps(url: string): string; /** * Normalize a Git URL for cloning * Ensures URL has .git suffix and proper protocol */ export declare function normalizeGitUrl(url: string): string; /** * Clone a Git repository with automatic authentication * * Handles SSH, HTTPS+token, and public repos transparently. */ export declare function cloneWithAuth(url: string, destDir: string, options?: CloneOptions): Promise; /** * Get the display-safe version of a URL (strips tokens) */ export declare function sanitizeUrl(url: string): string; //# sourceMappingURL=git-auth.d.ts.map