/** * WatchPROrchestrator - Coordinate all components to build complete WatchPRResult * * Responsibilities: * - Coordinate data fetching (PR metadata, checks, history, changes) * - Extract errors from check logs (matrix + non-matrix modes) * - Extract external check details (codecov, SonarCloud, etc.) * - Build complete WatchPRResult with validation * - Generate intelligent guidance * - Handle caching (save/retrieve results) * - Select output format (YAML on failure, text on success) * * @packageDocumentation */ import type { WatchPRResult } from '../schemas/watch-pr-result.schema.js'; /** * WatchPROrchestrator - Build complete WatchPRResult */ export declare class WatchPROrchestrator { private readonly owner; private readonly repo; private readonly fetcher; private readonly historyBuilder; private readonly extractionDetector; private readonly externalCheckExtractor; private cacheManager?; constructor(owner: string, repo: string); /** * Build complete WatchPRResult * * @param prNumber - PR number * @param options - Options (useCache, forceFetch) * @returns Complete WatchPRResult */ buildResult(prNumber: number, options?: { useCache?: boolean; forceFetch?: boolean; }): Promise; /** * Build GitHub Action check from a workflow job */ private buildCheckFromJob; /** * Process a failed check by extracting errors and caching results * * @param check - The action check to process * @param runId - The workflow run ID * @param jobId - Optional job ID for matrix strategies */ private processFailedCheck; /** * Strip extractor metadata to reduce token bloat * * Removes implementation details that don't help LLMs: * - metadata.detector (can be inferred from error format) * - metadata.detection.patterns (implementation detail) * - metadata.detection.reason (debugging noise) * * Keeps metadata.quality if present (indicates extraction confidence) */ private stripExtractorMetadata; /** * Determine overall PR status from checks */ private determineOverallStatus; /** * Build result for a specific run ID * * Fetches all jobs for the workflow run and creates individual checks for each job. * This provides consistent job-level detail matching the default behavior. * * @param prNumber - PR number * @param runId - GitHub run ID * @param options - Options (useCache) * @returns WatchPRResult with job-level checks */ buildResultForRun(prNumber: number, runId: number, options?: { useCache?: boolean; }): Promise; /** * Get priority for check ordering (lower is higher priority) */ private getCheckPriority; /** * Order checks: failed first, then pending, then passed * * @param checks - GitHub Action checks * @returns Ordered checks */ private orderChecks; /** * Order external checks: failed first, then pending, then passed * * @param checks - External checks * @returns Ordered checks */ private orderExternalChecks; /** * Generate intelligent guidance based on check results * * @param status - Overall status * @param githubActions - GitHub Action checks * @param externalChecks - External checks * @param mergeable - Is PR mergeable? * @returns Guidance with next steps */ private generateGuidance; /** * Fetch logs with retry logic for race conditions * * When GitHub marks a check as complete, logs may not be immediately available. * This method retries with exponential backoff to handle the race condition. * * Retry schedule: 2s, 4s, 8s (total 3 attempts over ~14 seconds) * * @param runId - GitHub run ID * @param jobId - GitHub job ID (optional, for matrix strategy jobs) * @param maxRetries - Maximum number of retry attempts (default: 3) * @returns Log content, or null if all retries failed */ private fetchLogsWithRetry; /** * Fetch all workflow runs for a PR (for --history flag) * * @param prNumber - PR number * @returns List of workflow runs with basic metadata */ fetchRunsForPR(prNumber: number): Promise>; /** * Determine if output should be YAML format * * Auto-YAML on failure (consistent with validate command) * * @param status - Overall status * @param forceYAML - Force YAML output * @returns True if should output YAML */ shouldOutputYAML(status: string, forceYAML: boolean): boolean; } //# sourceMappingURL=watch-pr-orchestrator.d.ts.map