/**
 * GitHub Actions Integration
 *
 * Enables AI-powered CI/CD workflow management:
 * - Create and manage GitHub Actions workflows
 * - AI-assisted workflow debugging
 * - Automated PR checks
 * - Security scanning in CI
 * - Cost optimization for workflows
 *
 * Inspired by Gemini CLI's GitHub integration.
 */
import { EventEmitter } from 'events';
export interface WorkflowConfig {
    name: string;
    on: WorkflowTrigger;
    jobs: Record<string, WorkflowJob>;
    env?: Record<string, string>;
    defaults?: {
        run?: {
            shell?: string;
            'working-directory'?: string;
        };
    };
}
export interface WorkflowTrigger {
    push?: {
        branches?: string[];
        paths?: string[];
        tags?: string[];
    };
    pull_request?: {
        branches?: string[];
        types?: string[];
    };
    workflow_dispatch?: {
        inputs?: Record<string, {
            description: string;
            required?: boolean;
            default?: string;
            type?: 'string' | 'boolean' | 'choice';
            options?: string[];
        }>;
    };
    schedule?: Array<{
        cron: string;
    }>;
}
export interface WorkflowJob {
    name?: string;
    'runs-on': string;
    needs?: string | string[];
    if?: string;
    steps: WorkflowStep[];
    env?: Record<string, string>;
    strategy?: {
        matrix?: Record<string, (string | number | boolean)[]>;
        'fail-fast'?: boolean;
        'max-parallel'?: number;
    };
    timeout?: number;
    services?: Record<string, WorkflowService>;
}
interface WorkflowService {
    image: string;
    env?: Record<string, string>;
    ports?: (string | number)[];
    options?: string;
    volumes?: string[];
}
export interface WorkflowStep {
    name?: string;
    uses?: string;
    run?: string;
    with?: Record<string, string | number | boolean>;
    env?: Record<string, string>;
    if?: string;
    id?: string;
    'working-directory'?: string;
    shell?: string;
    'continue-on-error'?: boolean;
    'timeout-minutes'?: number;
}
export interface WorkflowRun {
    id: number;
    name: string;
    status: 'queued' | 'in_progress' | 'completed';
    conclusion?: 'success' | 'failure' | 'cancelled' | 'skipped' | 'timed_out';
    created_at: string;
    updated_at: string;
    html_url: string;
    workflow_id: number;
    run_number: number;
    head_branch: string;
    head_sha: string;
}
export interface GitHubActionsConfig {
    /** GitHub token */
    token?: string;
    /** Repository owner */
    owner?: string;
    /** Repository name */
    repo?: string;
    /** Workflows directory */
    workflowsDir: string;
}
export declare class GitHubActionsManager extends EventEmitter {
    private config;
    private workflowsDir;
    constructor(config?: Partial<GitHubActionsConfig>);
    /**
     * Initialize and detect repository info
     */
    initialize(): Promise<void>;
    /**
     * List available workflow templates
     */
    getTemplates(): string[];
    /**
     * Get template details
     */
    getTemplate(name: string): WorkflowConfig | null;
    /**
     * Create workflow from template
     */
    createFromTemplate(templateName: string, fileName?: string): Promise<string>;
    /**
     * Create custom workflow
     */
    createWorkflow(config: WorkflowConfig, fileName: string): Promise<string>;
    /**
     * List existing workflows
     */
    listWorkflows(): Array<{
        name: string;
        path: string;
        config?: WorkflowConfig;
    }>;
    /**
     * Read workflow file
     */
    readWorkflow(fileName: string): WorkflowConfig | null;
    /**
     * Update workflow file
     */
    updateWorkflow(fileName: string, config: WorkflowConfig): Promise<void>;
    /**
     * Delete workflow file
     */
    deleteWorkflow(fileName: string): boolean;
    /**
     * Validate workflow syntax
     */
    validateWorkflow(config: WorkflowConfig): {
        valid: boolean;
        errors: string[];
    };
    /**
     * Get workflow runs using GitHub CLI
     */
    getWorkflowRuns(workflowName?: string, limit?: number): Promise<WorkflowRun[]>;
    /**
     * Trigger workflow manually
     */
    triggerWorkflow(workflowName: string, ref?: string, inputs?: Record<string, string>): Promise<boolean>;
    /**
     * View workflow run logs
     */
    getRunLogs(runId: number): Promise<string>;
    /**
     * Cancel workflow run
     */
    cancelRun(runId: number): Promise<boolean>;
    /**
     * Re-run workflow
     */
    rerunWorkflow(runId: number, failedOnly?: boolean): Promise<boolean>;
    /**
     * Analyze workflow for optimizations
     */
    analyzeWorkflow(config: WorkflowConfig): Array<{
        type: string;
        message: string;
        severity: 'info' | 'warning' | 'error';
    }>;
    /**
     * Format workflow summary
     */
    formatSummary(): string;
    private execGit;
    private execGh;
}
export declare function getGitHubActionsManager(config?: Partial<GitHubActionsConfig>): GitHubActionsManager;
export declare function resetGitHubActionsManager(): void;
export {};
