import type { OperationOptions } from "../types/operations.js"; /** * Configuration options for external link checking operations. * * Optimized specifically for external HTTP/HTTPS link validation with smart defaults for common use * cases. * * @category Commands */ export interface CheckLinksOperationOptions extends OperationOptions { /** Timeout for external link validation in milliseconds (default: 10000) */ timeout: number; /** Number of retry attempts for failed requests (default: 3) */ retry: number; /** Delay between retry attempts in milliseconds (default: 1000) */ retryDelay: number; /** Maximum concurrent requests (default: 10) */ concurrency: number; /** HTTP method to use for checking links (default: 'HEAD') */ method: "HEAD" | "GET"; /** Follow redirects (default: true) */ followRedirects: boolean; /** HTTP status codes to ignore (default: [403, 999]) */ ignoreStatusCodes: number[]; /** URL patterns to ignore (regex strings) */ ignorePatterns: string[]; /** Cache results to avoid re-checking recently validated URLs */ useCache: boolean; /** Cache duration in minutes (default: 60) */ cacheDuration: number; /** Show progress indicator for large operations */ showProgress: boolean; /** Output format for results */ format: "text" | "json" | "markdown" | "csv"; /** Include response times in output */ includeResponseTimes: boolean; /** Include HTTP headers in detailed output */ includeHeaders: boolean; /** Maximum depth to traverse subdirectories */ maxDepth?: number; /** Group results by file or by status code */ groupBy: "file" | "status" | "domain"; } /** * CLI-specific options for the check-links command. * * @category Commands */ /** * Options as commander produces them for the check-links command: numeric options are already * parsed, negated flags appear as their positive boolean, and list options arrive as raw * comma-separated strings. * * @category Commands */ export interface CheckLinksCliOptions { /** Show what would be checked without making requests */ dryRun?: boolean; /** Show detailed output */ verbose?: boolean; /** Timeout for external link validation in milliseconds */ timeout?: number; /** Number of retry attempts for failed requests */ retry?: number; /** Delay between retry attempts in milliseconds */ retryDelay?: number; /** Maximum concurrent requests */ concurrency?: number; /** HTTP method to use */ method?: string; /** Follow HTTP redirects unless --no-follow-redirects is passed */ followRedirects?: boolean; /** Comma-separated HTTP status codes to ignore */ ignoreStatus?: string; /** Comma-separated regex patterns to ignore */ ignorePatterns?: string; /** Cache results unless --no-cache is passed */ cache?: boolean; /** Cache duration in minutes */ cacheDuration?: number; /** Show progress unless --no-progress is passed */ progress?: boolean; /** Output format */ format?: string; /** Include response times in output */ includeResponseTimes?: boolean; /** Include HTTP headers in detailed output */ includeHeaders?: boolean; /** Maximum depth to traverse subdirectories */ maxDepth?: number; /** Group results by file, status, or domain */ groupBy?: string; /** Output file path for results */ output?: string; /** Configuration file path */ config?: string; } /** * External link validation result with detailed information. * * @category Commands */ interface ExternalLinkResult { /** File containing the link */ filePath: string; /** Line number where the link was found */ line?: number; /** Link text */ text: string; /** Link URL */ href: string; /** Reason for failure (if broken) */ reason: string; /** Whether the link is broken */ isBroken: boolean; /** HTTP status code */ statusCode?: number; /** Response time in milliseconds */ responseTime?: number; /** Final URL after redirects */ finalUrl?: string; /** Number of redirects followed */ redirectCount?: number; /** HTTP headers (if includeHeaders is true) */ headers?: Record; /** Domain name for grouping */ domain: string; /** Whether this was from cache */ cached?: boolean; /** Retry attempt number (0 for first attempt) */ retryAttempt?: number; } /** * Result of an external link checking operation. * * @category Commands */ export interface CheckLinksResult { /** Total number of files processed */ filesProcessed: number; /** Total number of external links found */ totalExternalLinks: number; /** Number of broken external links */ brokenLinks: number; /** Number of working external links */ workingLinks: number; /** Number of links with warnings (redirects, slow response, etc.) */ warningLinks: number; /** Detailed results for each link */ linkResults: ExternalLinkResult[]; /** Results grouped by file */ resultsByFile: Partial>; /** Results grouped by status code */ resultsByStatus: Partial>; /** Results grouped by domain */ resultsByDomain: Partial>; /** Files that had processing errors */ fileErrors: { file: string; error: string; }[]; /** Processing time in milliseconds */ processingTime: number; /** Cache hit rate (percentage) */ cacheHitRate?: number; /** Average response time in milliseconds */ averageResponseTime?: number; } /** Default configuration for external link checking. */ declare const DEFAULT_CHECK_LINKS_OPTIONS: CheckLinksOperationOptions; /** * Validates external links in markdown files with optimized defaults and advanced features. * * This command is specifically designed for checking HTTP/HTTPS URLs with features like: * * - Smart retry logic for temporary failures * - Configurable concurrency for parallel checking * - Response caching to avoid re-checking recently validated URLs * - Multiple output formats (text, JSON, markdown, CSV) * - Progress indicators for large documentation sets * - Bot-detection handling (ignores 403s by default) * - Response time measurement and statistics * * @example * ```typescript * // Check all external links in current directory * const result = await checkLinks(['.'], { * ...DEFAULT_CHECK_LINKS_OPTIONS, * verbose: true * }); * * // Check with custom timeout and retry logic * const result = await checkLinks(['docs/**\/*.md'], { * ...DEFAULT_CHECK_LINKS_OPTIONS, * timeout: 15000, * retry: 5, * retryDelay: 2000 * }); * ```; * * @param files - Array of file paths or glob patterns to check * @param options - Configuration options for the checking operation * * @returns Promise resolving to detailed results of the link checking operation * * @group Commands */ export declare function checkLinks(files: string[], options?: CheckLinksOperationOptions): Promise; /** Formats the check-links results for display. */ export declare function formatCheckLinksResults(result: CheckLinksResult, options: CheckLinksOperationOptions): string; /** Command handler for the check-links CLI command. */ export declare function checkLinksCommand(files: string[] | undefined, options: CheckLinksCliOptions): Promise; export { DEFAULT_CHECK_LINKS_OPTIONS }; //# sourceMappingURL=check-links.d.ts.map