import type { DevToolsSys } from "@builder.io/dev-tools/core";
import { type FusionConfig, type WorkspaceFolder, type InitState, type InitStateStep, type InitStatusLog, type GitDiagnostics } from "#ai-utils";
type ValidatedWorkspaceFolder = WorkspaceFolder & Required<Pick<WorkspaceFolder, "name" | "path">>;
type WorkspaceFolderWithRepoInfo = ValidatedWorkspaceFolder & Required<Pick<WorkspaceFolder, "repoName" | "repoUrl">>;
import type { Credentials } from "../credentials";
import { type GitBackupDownloadResult } from "../backup";
export interface InitConfig {
    fusionConfig: FusionConfig;
    credentials: Credentials;
    sys: DevToolsSys;
    debug?: boolean;
    sentryTags?: Record<string, string>;
}
export interface InitStatus {
    message: string;
    error?: string;
}
export declare class InitStateMachine {
    #private;
    logIdCounter: number;
    initStatusLogs: InitStatusLog[];
    sys: DevToolsSys;
    config: InitConfig;
    /**
     * @deprecated use addInitLog instead. Do not use this directly.
     */
    debug: boolean;
    initState: InitState;
    constructor(config: InitConfig);
    checkout(branchName: string, ref: string | undefined, repoPath: string): Promise<void>;
    execAsync(exec: string, args: string[], cwd?: string, retry?: number): Promise<string>;
    git(args: string[], cwd: string, retry?: number, timeout?: number, skipLogging?: boolean): Promise<string>;
    performBackup({ sys, credentials, fusionConfig, volumePath, repositories, isConnectedToProvider, forcedFullBackup }: {
        sys: DevToolsSys;
        credentials: Credentials;
        fusionConfig: FusionConfig;
        volumePath: string;
        repositories: ValidatedWorkspaceFolder[];
        isConnectedToProvider: boolean;
        forcedFullBackup: boolean;
    }): Promise<void>;
    performRegularBackup(args: Omit<Parameters<typeof this.performBackup>[0], "isConnectedToProvider" | "forcedFullBackup">): Promise<void>;
    performOfflineBackup(args: Omit<Parameters<typeof this.performBackup>[0], "isConnectedToProvider" | "forcedFullBackup">): Promise<void>;
    performForcedFullBackup(args: Omit<Parameters<typeof this.performBackup>[0], "isConnectedToProvider" | "forcedFullBackup">): Promise<void>;
    init(): Promise<boolean>;
    addInitLog(type: "status" | "log" | "error" | "complete", message: string, options?: {
        step?: InitStateStep;
        error?: string;
        success?: boolean;
        gitDiagnostics?: GitDiagnostics;
    }): void;
    clearInitLogs(): void;
    hasFilesButNoGit(repoPath: string): Promise<boolean>;
    step1CheckDirectories(volumePath: string, repositories: ValidatedWorkspaceFolder[]): Promise<void>;
    step2ConfigureGitRepositories(volumePath: string, repositories: ValidatedWorkspaceFolder[]): Promise<void>;
    step3ConfigureGitUser(volumePath: string, repositories: ValidatedWorkspaceFolder[]): Promise<void>;
    step4CollectRepoInfo(config: InitConfig, volumePath: string, repositories: ValidatedWorkspaceFolder[]): Promise<void>;
    private isGitConfigured;
    private getGitRemoteUrl;
    /**
     * Check if the repository URL is from a standard git hosting provider
     */
    private isStandardGitHost;
    private checkHostConnectivity;
    private checkConnectivityDirect;
    private checkConnectivityViaProxy;
    private ensureParentDirExists;
    private cleanupLockFiles;
    validateGitRepo(repoPath: string): Promise<void>;
    private isBackupAlreadyApplied;
    private restoreFromPartialBackup;
    private initializeGitRepo;
    private fetchGitConfigsOnce;
    private applyGitConfig;
    runInitializationCommand({ repo, tempCloningDir, repoPath, initCommand }: {
        repo: ValidatedWorkspaceFolder;
        tempCloningDir: string;
        repoPath: string;
        initCommand: string;
    }): Promise<{
        outcome: boolean;
        error?: Error;
    }>;
    cloneRepository({ repo, repoPath, backupResult, isPrimary }: {
        repo: WorkspaceFolderWithRepoInfo;
        repoPath: string;
        backupResult: GitBackupDownloadResult | undefined;
        isPrimary: boolean;
    }): Promise<boolean>;
    markGitSafe(repoPath: string): Promise<string>;
}
export {};
