/**
 * Background Job Launcher
 *
 * Spawns import workers as detached processes that survive terminal close.
 * Progress tracked via file system - check with sw:jobs
 */
import { Logger } from '../../utils/logger.js';
import type { BackgroundJob, JobType, LivingDocsUserInputs } from './types.js';
/**
 * Set the logger for this module
 */
export declare function setJobLauncherLogger(logger: Logger): void;
export interface LaunchOptions {
    /** Job type */
    type: JobType;
    /** Project path */
    projectPath: string;
    /** Coordinator config for import */
    coordinatorConfig: any;
    /** Estimated total items (can be updated by worker) */
    estimatedTotal?: number;
    /** Run in foreground (blocking) instead of background */
    foreground?: boolean;
}
export interface LaunchResult {
    job: BackgroundJob;
    /** PID of background process (undefined if foreground) */
    pid?: number;
    /** Whether running in background */
    isBackground: boolean;
    /** Whether all repos were already cloned (pre-flight skip) */
    skippedPreFlight?: boolean;
}
/**
 * Check if there's an active import job running
 * P2 FIX: Prevents concurrent imports that could conflict
 */
export declare function getActiveImportJob(projectPath: string): BackgroundJob | null;
/**
 * Launch an import job
 *
 * @param options Launch configuration
 * @returns Job info and process details
 */
export declare function launchImportJob(options: LaunchOptions): Promise<LaunchResult>;
export interface CloneLaunchOptions {
    /** Project path */
    projectPath: string;
    /** Repositories to clone with URLs */
    repositories: Array<{
        owner: string;
        name: string;
        path: string;
        cloneUrl: string;
    }>;
    /** Run in foreground (blocking) instead of background */
    foreground?: boolean;
}
/**
 * Launch a clone job
 *
 * @param options Launch configuration
 * @returns Job info and process details
 */
export declare function launchCloneJob(options: CloneLaunchOptions): Promise<LaunchResult>;
export interface LivingDocsLaunchOptions {
    /** Project path */
    projectPath: string;
    /** User inputs collected before launch */
    userInputs: LivingDocsUserInputs;
    /** Job IDs to wait for before starting */
    dependsOn?: string[];
    /** Run in foreground (blocking) instead of background */
    foreground?: boolean;
}
/**
 * Launch a living-docs-builder job
 *
 * This job waits for dependencies (clone/import jobs) to complete before
 * analyzing the codebase and generating living documentation.
 *
 * @param options Launch configuration
 * @returns Job info and process details
 */
export declare function launchLivingDocsJob(options: LivingDocsLaunchOptions): Promise<LaunchResult>;
export interface CodebaseRescanLaunchOptions {
    /** Project path */
    projectPath: string;
    /** The closed increment that triggered this rescan */
    closedIncrementId: string;
    /** Feature ID associated with the increment */
    featureId?: string;
    /** Specific paths/modules to focus on (derived from increment scope) */
    scopePaths?: string[];
    /** Whether to do deep analysis or quick sync */
    depth?: 'quick' | 'full';
    /** Run in foreground (blocking) instead of background */
    foreground?: boolean;
}
/**
 * Launch a codebase rescan job
 *
 * Triggered automatically when an increment closes to ensure living docs
 * reflect the ACTUAL code implementation (code as source of truth).
 *
 * @param options Launch configuration
 * @returns Job info and process details
 */
export declare function launchCodebaseRescanJob(options: CodebaseRescanLaunchOptions): Promise<LaunchResult>;
export interface MarketplaceScanLaunchOptions {
    /** Project path */
    projectPath: string;
    /** GitHub topics to search for */
    searchTopics: string[];
    /** Filenames to search for in repos */
    searchFilenames: string[];
    /** Maximum results per scan cycle */
    maxResultsPerScan?: number;
    /** Minutes between scan cycles */
    intervalMinutes?: number;
    /** Run in foreground (blocking) instead of background */
    foreground?: boolean;
}
/**
 * Launch a marketplace scan job
 *
 * Scans GitHub for community Claude Code skills and feeds them
 * through the submission queue for security verification.
 *
 * @param options Launch configuration
 * @returns Job info and process details
 */
export declare function launchMarketplaceScanJob(options: MarketplaceScanLaunchOptions): Promise<LaunchResult>;
/**
 * Check if a background job is still running
 */
export declare function isJobRunning(projectPath: string, jobId: string): boolean;
/**
 * Kill a background job
 */
export declare function killJob(projectPath: string, jobId: string): boolean;
/**
 * Get worker log output
 */
export declare function getJobLog(projectPath: string, jobId: string, tailLines?: number): string;
/**
 * Get job result (after completion)
 */
export declare function getJobResult(projectPath: string, jobId: string): any | null;
/**
 * Get orphaned jobs without modifying them (for display)
 */
export declare function getOrphanedJobs(projectPath: string): BackgroundJob[];
/**
 * Detect and handle orphaned jobs
 * P2 FIX: Jobs marked as "running" but worker is dead
 *
 * Returns list of orphaned jobs that were fixed
 */
export declare function detectOrphanedJobs(projectPath: string): BackgroundJob[];
/**
 * Clean up old job directories
 */
export declare function cleanupOldJobs(projectPath: string, keepDays?: number): void;
//# sourceMappingURL=job-launcher.d.ts.map