/** * Complexity validator - direct token threshold validation * * Implements spec 071: Simplified Token-Based Validation * * Uses direct, independent checks instead of derived scores: * 1. Token count (primary check) - direct thresholds * 2. Structure quality (independent feedback) - sub-specs and sectioning * 3. Line count (backstop only) - for extreme cases * * Research-backed findings: * - Token count predicts AI performance better than line count * - Quality degradation starts before 50K token limits * - Sub-specs enable progressive disclosure (Context Economy) * - Good sectioning enables cognitive chunking (7±2 rule) */ import type { ValidationRule, ValidationResult } from '../utils/validation-framework.js'; import type { SpecInfo } from '../types/index.js'; export interface ComplexityOptions { excellentThreshold?: number; goodThreshold?: number; warningThreshold?: number; maxLines?: number; warningLines?: number; } export interface ComplexityMetrics { lineCount: number; tokenCount: number; sectionCount: number; codeBlockCount: number; listItemCount: number; tableCount: number; hasSubSpecs: boolean; subSpecCount: number; averageSectionLength: number; } export interface ComplexityScore { score: number; factors: { tokens: number; structure: number; }; recommendation: 'excellent' | 'good' | 'review' | 'split'; metrics: ComplexityMetrics; costMultiplier: number; } export declare class ComplexityValidator implements ValidationRule { name: string; description: string; private excellentThreshold; private goodThreshold; private warningThreshold; private maxLines; private warningLines; constructor(options?: ComplexityOptions); validate(spec: SpecInfo, content: string): Promise; /** * Validate token count with direct thresholds */ private validateTokens; /** * Check structure quality independently */ private checkStructure; /** * Provide warnings when line counts exceed backstop thresholds */ private checkLineCounts; /** * Analyze complexity metrics from spec content */ private analyzeComplexity; } //# sourceMappingURL=complexity.d.ts.map