import type { RiskLevel, AuditCategory } from './common/index.js';
export interface ResilienceAnalysis {
    failureScenarios: FailureScenario[];
    concurrencyAnalysis: ConcurrencyAnalysis;
    scalabilityAssessment: string;
    overallRisk: RiskLevel;
}
export interface FailureScenario {
    scenario: string;
    probability: 'low' | 'medium' | 'high';
    impact: 'low' | 'medium' | 'high' | 'critical';
    currentHandling: string;
    requiredHandling: string;
    dataConsistency: string;
    userExperience: string;
    /** Relevance score 0-100 relative to the spec's type and target. SPEC-338. */
    relevanceScore?: number;
}
/** Top-3 prioritized scenarios for the spec. SPEC-338. */
export interface PrioritizedScenario extends FailureScenario {
    relevanceScore: number;
    rank: number;
}
export interface ConcurrencyAnalysis {
    hotPaths: string[];
    raceConditions: string[];
    sharedState: string[];
    recommendations: string[];
}
export interface DriftReport {
    specId: string;
    checkType: 'on-demand' | 'ci' | 'pre-commit' | 'scheduled';
    driftScore: number;
    drifts: DriftItem[];
    lastChecked: string;
    isCompliant: boolean;
}
export interface DriftItem {
    file: string;
    specCriterion: string;
    expected: string;
    actual: string;
    severity: 'low' | 'medium' | 'high' | 'critical';
    autoFixable: boolean;
    suggestedFix?: string;
}
export interface QualityProfile {
    enabledCategories: AuditCategory[];
    customRules: QualityRule[];
    principles: string[];
    strictness: 'relaxed' | 'standard' | 'strict';
}
export interface QualityRule {
    id: string;
    description: string;
    category: AuditCategory;
    severity: 'info' | 'warning' | 'error' | 'critical';
    source: string;
    pattern?: string;
}
export interface AuditFinding {
    file: string;
    line?: number;
    category: AuditCategory;
    severity: 'info' | 'warning' | 'error' | 'critical';
    rule: string;
    message: string;
    suggestion: string;
    reference?: string;
}
export interface AuditSummary {
    byCategory: Record<string, {
        count: number;
        severity: string;
    }>;
    topIssues: string[];
    strengths: string[];
    score: number;
}
export interface AuditResult {
    filesAnalyzed: number;
    findings: AuditFinding[];
    summary: AuditSummary;
    score: number;
    qualityScore?: QualityScore;
}
/** Scoring weight per category (must sum to 1.0). */
export type QualityScoringCategory = 'solid' | 'clean-code' | 'architecture' | 'security' | 'performance' | 'dry' | 'error-handling';
export interface QualityCategoryScore {
    category: QualityScoringCategory;
    score: number;
    weight: number;
    issueCount: number;
    worstSeverity: 'info' | 'warning' | 'error' | 'critical' | 'none';
    suggestions: string[];
}
export interface CustomRuleResult {
    rule: string;
    source: string;
    passed: boolean;
    detail: string;
}
export interface QualityScore {
    overall: number;
    categories: QualityCategoryScore[];
    customRules: CustomRuleResult[];
    generatedAt: string;
}
export interface TechDebtItem {
    file: string;
    type: 'anti-pattern' | 'code-smell' | 'outdated-dep' | 'missing-tests' | 'complexity';
    description: string;
    severity: 'low' | 'medium' | 'high';
    effort: 'trivial' | 'small' | 'medium' | 'large';
    suggestion: string;
}
export interface VisualValidation {
    screenshots: VisualScreenshot[];
    designComparison?: VisualComparison;
    visualScore: number;
    issues: VisualIssue[];
}
export interface VisualScreenshot {
    name: string;
    path: string;
    source: 'puppeteer' | 'playwright' | 'manual' | 'figma' | 'pencil';
    viewport: string;
}
export interface VisualComparison {
    designSource: 'figma' | 'pencil' | 'screenshot-reference';
    matchPercentage: number;
    differences: string[];
}
export interface VisualIssue {
    severity: 'critical' | 'warning' | 'info';
    element: string;
    issue: string;
    screenshot?: string;
}
export interface DetectDriftInput {
    specId: string;
    projectId: string;
    mode?: 'full' | 'quick';
    outputFormat?: 'report' | 'ci-json' | 'github-annotations';
    threshold?: number;
}
export interface AuditInput {
    path: string;
    projectId: string;
    categories?: AuditCategory[];
    specId?: string;
}
/** Dimensions that can be evaluated holistically. */
export type HolisticDimension = 'tests' | 'lint' | 'typecheck' | 'security-scan' | 'spec-compliance';
/** Reason a dimension was skipped for a given spec. */
export type HolisticSkipReason = 'doc-only-scope' | 'meta-target' | 'no-source-files' | 'spec-config';
/** A dimension that was excluded from holistic scoring with its reason. */
export interface HolisticSkippedDimension {
    dimension: HolisticDimension;
    reason: HolisticSkipReason;
}
/** Per-dimension score entry inside a HolisticReport. */
export interface HolisticDimensionEntry {
    score: number;
    weight: number;
    evidence: string[];
}
/**
 * SPEC-730: Report returned by validateSpec that includes scope-aware dimension scoring.
 * The `score` is normalised over `applicableDimensions` only, so doc-only specs
 * and meta-target specs are not penalised for dimensions that do not apply to them.
 */
export interface HolisticValidateReport {
    /** Normalised score over applicable dimensions only. Null when no dimensions apply. */
    score: number | null;
    /** Dimensions that were evaluated. */
    applicableDimensions: HolisticDimension[];
    /** Dimensions that were skipped with their reasons. */
    skipped: HolisticSkippedDimension[];
    /** Per-dimension scores, weights, and evidence. Only applicable dimensions are keyed. */
    dimensions: Partial<Record<HolisticDimension, HolisticDimensionEntry>>;
}
export interface ValidateResult {
    matches: string[];
    missing: string[];
    extra: string[];
    fieldsImplemented: number;
    fieldsTotal: number;
    /** 0-100 implementation score, or null when no criteria exist to evaluate. */
    score: number | null;
    qualityIssues: AuditFinding[];
    visualValidation?: VisualValidation;
    /**
     * SPEC-730: Scope/target-aware holistic report.
     * Present when validateSpec runs with the new scope-resolver.
     * Callers (e.g. runValidateGate) should prefer holisticReport.score over bare score
     * to benefit from normalisation over applicable dimensions only.
     */
    holisticReport?: HolisticValidateReport;
}
export interface CodeState {
    affectedFiles: string[];
    unexpectedFiles: string[];
    fileContents: Map<string, string>;
}
export interface FunctionInfo {
    name: string;
    startLine: number;
    length: number;
}
/** A single pattern entry — correct, deprecated, or common mistake. */
export interface FrameworkPattern {
    /** Human-readable description of the pattern. */
    pattern: string;
    /** Optional code example illustrating the pattern. */
    example?: string;
    /** Framework version since which this pattern applies (for correctPatterns). */
    since?: string;
    /** The replacement for deprecated/mistake patterns. */
    replacedBy?: string;
    /** Severity when the pattern is problematic (deprecated / mistake). */
    severity?: 'error' | 'warning';
}
/** Full registry entry for one framework. */
export interface RegistryEntry {
    /** Unique machine-friendly ID, e.g. "nextjs". */
    framework: string;
    /** Human-readable name, e.g. "Next.js". */
    displayName: string;
    /** Reference version range, e.g. "14.x". */
    frameworkVersion: string;
    /** ISO date of last manual update. */
    lastUpdated: string;
    /** Language/platform ecosystem, e.g. "typescript", "python". */
    ecosystem: string;
    /** Patterns that are correct and recommended in this version. */
    correctPatterns: FrameworkPattern[];
    /** Patterns that are outdated / removed. */
    deprecatedPatterns: FrameworkPattern[];
    /** Common LLM hallucinations or misuses. */
    commonMistakes: FrameworkPattern[];
    /** true when added by the user via update_registry, not shipped with Planu. */
    customEntry: boolean;
}
/** A single accuracy problem detected in a spec. */
export interface SpecAccuracyIssue {
    /** Category of the problem. */
    type: 'invalid-api' | 'deprecated-pattern' | 'unknown-framework';
    /** The framework this issue belongs to. */
    framework: string;
    /** The exact text snippet that triggered the issue. */
    reference: string;
    /** Human-readable correction hint. */
    suggestion?: string;
    /** How critical the issue is. */
    severity: 'error' | 'warning' | 'info';
}
/** Full accuracy report returned by check_spec_accuracy. */
export interface SpecAccuracyReport {
    /** Confidence score 0-100 (100 = all references validated). */
    score: number;
    /** All detected issues. */
    issues: SpecAccuracyIssue[];
    /** Framework IDs auto-detected in the spec text. */
    frameworksDetected: string[];
    /** Framework names mentioned in the spec that are not in the registry. */
    frameworksNotInRegistry: string[];
    /** Total number of API/pattern references examined. */
    totalReferencesChecked: number;
    /** How many of those references were found in the registry. */
    validatedReferences: number;
    /** Framework IDs whose registry entry is older than 180 days. */
    staleRegistryEntries: string[];
}
export type ConfigFindingSeverity = 'info' | 'warn' | 'critical';
export interface ConfigFinding {
    /** SPEC-255: Machine-readable finding code for programmatic filtering */
    code?: string;
    area: string;
    severity: ConfigFindingSeverity;
    message: string;
    suggestion: string;
    docsRef: string;
}
export interface ConfigAuditResult {
    score: number;
    grade: 'A' | 'B' | 'C' | 'D' | 'F';
    findings: ConfigFinding[];
    quickWins: ConfigFinding[];
    summary: string;
}
export interface AuditClaudeConfigInput {
    projectPath: string;
    includeGlobal?: boolean;
    /** SPEC-724: When 'core-rules', assert the 3 core rule files for each detected host. */
    gate?: 'core-rules';
}
export type ConfigFindingCode = 'LINE_COUNT_WARN' | 'LINE_COUNT_CRITICAL' | 'REDUNDANT_INSTRUCTION' | 'AMBIGUOUS_INSTRUCTION' | 'AGENTS_MD_NOT_IMPORTED' | 'RULE_MISSING_PATHS' | 'RULE_DEAD_PATH' | 'AUTO_MODE_ENV_MISSING' | 'BYPASS_PERMISSIONS_NO_ISOLATION';
export interface SettingsJson {
    permissions?: {
        allow?: string[];
        deny?: string[];
        defaultMode?: string;
    };
    autoMemoryEnabled?: boolean;
    autoMode?: {
        environment?: string;
        [key: string]: unknown;
    };
    [key: string]: unknown;
}
export type DeepCheckType = 'grep_absent' | 'grep_present' | 'metric_max' | 'file_exists' | 'coverage' | 'manual';
export interface DeepCheckResult {
    criterionText: string;
    checkType: DeepCheckType;
    passed: boolean;
    evidence: string[];
    matchCount: number;
    expected: number;
    description: string;
}
export interface DeepCheckConfig {
    pattern: string;
    scope: string;
    exclude?: string;
    expected: number;
}
export interface QualityGate {
    id: string;
    category: 'security' | 'testing' | 'architecture' | 'performance';
    title: string;
    stacks: string[];
    riskLevels: string[];
    specTypes: string[];
}
export interface QualityGateInjectionResult {
    gates: QualityGate[];
    markdownSection: string;
    count: number;
    categoryCounts: {
        security: number;
        testing: number;
        architecture: number;
        performance: number;
    };
}
export interface QualityGateEvaluation {
    total: number;
    passed: number;
    failed: number;
    failedGates: {
        id: string;
        title: string;
        category: string;
    }[];
    score: number;
}
/** Internal: spec frontmatter read by path-analyzer. */
export interface SpecMetaForPath {
    id: string;
    estimatedHours: number;
    dependencies: string[];
    status: string;
}
/** Internal: flattened spec entry for similarity search. */
export interface SpecEntryForSimilarity {
    specId: string;
    title: string;
    tags: string[];
    projectPath: string;
    tokens: string[];
}
/** Internal: MCP catalog entry for SPEC-405 catalog advisor. */
export interface McpCatalogAdvisorEntry {
    name: string;
    description: string;
    keywords: string[];
    install: string;
    useCases: string[];
}
export interface ApiChange {
    type: 'removed' | 'added' | 'modified';
    item: string;
    severity: 'breaking' | 'additive' | 'informational';
}
export interface ApiCompatibilityResult {
    compatible: boolean;
    specId1: string;
    specId2: string;
    breakingChanges: ApiChange[];
    additiveChanges: ApiChange[];
    score: number;
}
export interface Spec405CriticalPathResult {
    criticalPath: string[];
    totalHours: number;
    parallelizableSpecs: string[];
    bottlenecks: string[];
}
export interface SimilarSpec {
    specId: string;
    title: string;
    projectPath: string;
    similarityScore: number;
    keyMatches: string[];
}
export interface SimilarProblemsResult {
    query: string;
    results: SimilarSpec[];
    totalSearched: number;
}
export interface McpSuggestion {
    name: string;
    description: string;
    installCommand: string;
    rationale: string;
    useCases: string[];
}
export interface McpSuggestionResult {
    suggestions: McpSuggestion[];
    query: string;
}
export interface VerifierScanResult {
    specId: string;
    filesFound: string[];
    gitCommitsFound: string[];
    testFilesFound: string[];
}
export interface CriterionMatch {
    criterion: string;
    status: 'verified' | 'partial' | 'unverified';
    evidence: string[];
    keywords: string[];
}
export interface SpecComplianceScore {
    specId: string;
    score: number;
    level: 'compliant' | 'partial' | 'non-compliant';
    verifiedCriteria: number;
    partialCriteria: number;
    unverifiedCriteria: number;
    totalCriteria: number;
    criteriaDetails: CriterionMatch[];
    checkedAt: string;
}
export interface ComplianceScoreReport {
    projectPath: string;
    overallAverage: number;
    totalSpecs: number;
    compliantCount: number;
    partialCount: number;
    nonCompliantCount: number;
    scores: SpecComplianceScore[];
    generatedAt: string;
}
export interface DuplicateFileLocation {
    path: string;
    startLine: number;
    endLine: number;
}
export interface DuplicateCluster {
    id: string;
    files: DuplicateFileLocation[];
    similarity: number;
    lineCount: number;
    severity: 'info' | 'warning' | 'error';
    suggestion: string;
}
export interface DuplicateDetectionResult {
    clusters: DuplicateCluster[];
    totalClusters: number;
    totalFilesAffected: number;
    severity: 'info' | 'warning' | 'error';
}
export interface DetectDuplicationInput {
    projectPath: string;
    minLines?: number;
    exclude?: string[];
    languages?: string[];
}
export interface DuplicateBlockLocation {
    path: string;
    startLine: number;
    endLine: number;
    lines: string[];
}
export interface DuplicateRawBlock {
    hash: string;
    locations: DuplicateBlockLocation[];
}
//# sourceMappingURL=analysis.d.ts.map