/**
 * Official documentation for CI/CD environment variables:
 * - GitHub Actions: https://docs.github.com/en/actions/reference/environment-variables
 * - CircleCI: https://circleci.com/docs/reference/variables/
 * - GitLab CI: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
 * - Azure DevOps: https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
 */
/**
 * Git metadata structure matching server schema
 */
export interface GitMetadata {
    branch: string;
    commit: {
        hash: string;
        message: string;
        author: string;
        authorId?: string;
        email: string;
        timestamp: string;
    };
    repository: {
        name: string;
        url: string;
    };
    pr: {
        id: string;
        title: string;
        url: string;
        status: '' | 'open' | 'draft' | 'ready_for_review' | 'changes_requested' | 'approved' | 'merged' | 'closed';
    };
    environment?: string;
}
/**
 * Collector for Git metadata
 */
export declare class GitCollector {
    private readonly git;
    private readonly repoPath;
    constructor(repoPath?: string);
    /**
     * Configure git to work properly in CI/CD environments
     * Fixes "dubious ownership" errors in GitHub Actions and other CI/CD platforms
     */
    private configureGitForCI;
    /**
     * Gather Git metadata: branch, latest commit, and remote repository info
     * Uses git commands as primary source, falls back to environment variables in CI/CD
     */
    getMetadata(): Promise<GitMetadata>;
    /**
     * Normalize PR status to match server enum
     */
    private normalizeStatus;
    /**
     * Attempt to gather metadata using git commands with comprehensive error handling
     * CRITICAL: Ensures no data loss - always collects what's available
     */
    private getGitCommandMetadata;
    /**
     * Extract git metadata from environment variables (CI/CD contexts)
     *
     * Author Resolution Priority (highest to lowest):
     * ============================================
     * For Pull Request Events:
     *   1. GitHub Branch Commit API (data.author.login) - Most accurate, includes user ID
     *   2. PR Head User Login (event file: pull_request.head.user.login)
     *   3. Git Author Name (git show %an) - Fallback when GitHub login unavailable
     *
     * For Non-PR Events (push, workflow_dispatch, etc.):
     *   1. GitHub Branch Commit API (data.author.login) - Most accurate, includes user ID
     *   2. GitHub Users API (fetched by username) - Fallback if commit API unavailable
     *   3. Git Author Name (git config user.name) - Fallback when APIs unavailable
     *
     * Rationale: GitHub login usernames are preferred for consistent author deduplication
     * across the platform, as git config names can vary (e.g., "John Doe" vs "John" vs "jdoe").
     */
    private getEnvironmentMetadata;
    /**
     * Extract branch name from git ref (e.g., "refs/heads/main" -> "main")
     */
    private extractBranchFromRef;
    /**
     * Extract repository name from URL (e.g., "https://github.com/user/repo.git" -> "user/repo")
     * Special handling for Azure DevOps: "https://dev.azure.com/org/project/_git/repo" -> "project/repo"
     */
    private extractRepoNameFromUrl;
    /**
     * Clean GitLab repository URL by removing CI token
     * Converts: https://gitlab-ci-token:xxxxx@gitlab.com/user/repo.git
     * To: https://gitlab.com/user/repo.git
     */
    private cleanGitLabUrl;
    /**
     * Clean CircleCI repository URL by removing SSH format and converting to HTTPS
     * Converts: git@github.com:user/repo.git -> https://github.com/user/repo.git
     * Also removes any credentials and normalizes URLs
     */
    private cleanCircleCIUrl;
    /**
     * Clean Azure DevOps repository URL by removing credentials
     * Converts: https://user@dev.azure.com/org/Project%20Name/_git/Repo%20Name
     * To: https://dev.azure.com/org/Project%20Name/_git/Repo%20Name
     * Note: Keeps URL encoding intact for valid URL format
     */
    private cleanAzureDevOpsUrl;
    /**
     * Fetch GitHub user info using the public Users API
     * This works for both public and private repos since it only queries user data
     */
    private fetchGitHubUserInfo;
    /**
     * Fetch the HEAD commit information from a specific branch to get the actual commit message
     * This avoids merge commit messages in PR scenarios
     */
    private fetchGitHubBranchCommit;
    /**
     * Fetch pull request details from GitHub API to get PR title and status
     */
    private fetchGitHubPullRequestDetails;
}
//# sourceMappingURL=git.d.ts.map