/**
 * Run command - executes the PRD cron script
 */
import { Command } from 'commander';
import { INightWatchConfig, NotificationEvent, parseScriptResult } from '@night-watch/core';
import type { INotificationContext, IPrDetails, JobType } from '@night-watch/core';
/**
 * Options for the run command
 */
export interface IRunOptions {
    dryRun: boolean;
    timeout?: string;
    provider?: string;
    crossProjectFallback?: boolean;
}
export interface IRunOutcomeRecordInput {
    projectDir: string;
    config: INightWatchConfig;
    envVars: Record<string, string>;
    startedAt: number;
    finishedAt: number;
    exitCode: number;
    stdout?: string;
    stderr?: string;
    scriptResult?: ReturnType<typeof parseScriptResult>;
    metadata?: Record<string, unknown>;
}
export interface IRunPrMetadata {
    prUrl?: string;
    branchName?: string;
    prNumber?: number;
}
/**
 * Map executor exit/result state to a notification event.
 * Returns null when the run completed with no actionable work (skip/no-op).
 */
export declare function resolveRunNotificationEvent(exitCode: number, scriptStatus?: string): NotificationEvent | null;
/**
 * Extract the most recent GitHub PR URL from raw executor output.
 * This is a safety net for older/custom scripts that open a PR successfully
 * but do not emit complete NIGHT_WATCH_RESULT metadata.
 */
export declare function extractPrUrlFromOutput(output?: string): string | undefined;
/**
 * Determine if cross-project fallback should run for this executor result.
 */
export declare function shouldAttemptCrossProjectFallback(options: IRunOptions, scriptStatus?: string): boolean;
export declare function parsePrNumberFromUrl(prUrl?: string): number | undefined;
export declare function buildRunNotificationContext(config: INightWatchConfig, projectDir: string, event: NotificationEvent, exitCode: number, scriptResult: ReturnType<typeof parseScriptResult>, prDetails: IPrDetails | null, rawOutput?: string): INotificationContext;
/**
 * Resolve valid registered projects excluding the current project.
 */
export declare function getCrossProjectFallbackCandidates(currentProjectDir: string): Array<{
    name: string;
    path: string;
}>;
/**
 * Return Telegram webhooks that opted in to rate-limit fallback notifications.
 */
export declare function getRateLimitFallbackTelegramWebhooks(config: INightWatchConfig): Array<{
    botToken: string;
    chatId: string;
}>;
/**
 * Whether the bash execution reported a rate-limit fallback trigger.
 */
export declare function isRateLimitFallbackTriggered(resultData?: Record<string, string>): boolean;
export declare function recordRunSessionOutcome(input: IRunOutcomeRecordInput): void;
export declare function applyProjectFeedbackPromptEnv(envVars: Record<string, string>, projectDir: string, jobType: JobType, markApplied?: boolean): void;
/**
 * Build environment variables map from config and CLI options
 */
export declare function buildEnvVars(config: INightWatchConfig, options: IRunOptions): Record<string, string>;
/**
 * Apply CLI flag overrides to the config
 */
export declare function applyCliOverrides(config: INightWatchConfig, options: IRunOptions): INightWatchConfig;
/**
 * Information about a scanned PRD file, including claim status
 */
export interface IPrdScanItem {
    name: string;
    claimed: boolean;
    claimInfo: {
        hostname: string;
        pid: number;
        timestamp: number;
    } | null;
}
/**
 * Scan the PRD directory for eligible PRD files
 */
export declare function scanPrdDirectory(projectDir: string, prdDir: string, maxRuntime: number): {
    pending: IPrdScanItem[];
    completed: string[];
};
/**
 * Register the run command with the program
 */
export declare function runCommand(program: Command): void;
//# sourceMappingURL=run.d.ts.map