/** * Feature Consistency Validator * v5.0.0 - Unified Project Structure * * Validates feature folder consistency within project folders: * - .specweave/docs/internal/specs/{project}/FS-XXX/FEATURE.md * * PROBLEM SOLVED: * Features in project folders should have proper FEATURE.md files. * If sync fails midway or increment is deleted, features can be orphaned. * * SOLUTION: * 1. Detect orphaned features (no FEATURE.md or linked increment deleted) * 2. Auto-repair by archiving orphaned features * 3. Report issues for manual intervention when auto-repair not possible * * @see ADR-0142 (if created) for architectural decision */ import { Logger } from '../../utils/logger.js'; export interface DiscrepancyReport { /** Feature ID (e.g., "FS-062") */ featureId: string; /** Type of discrepancy */ type: 'missing_feature_md' | 'orphaned_feature'; /** Description of the issue */ description: string; /** Can this be auto-repaired? */ autoRepairable: boolean; /** Path to feature folder in project */ featurePath?: string; /** Project ID */ projectId?: string; /** Linked increment ID (if found in FEATURE.md) */ linkedIncrementId?: string; /** Whether linked increment exists */ incrementExists?: boolean; } export interface ValidationResult { /** Total features scanned */ totalFeatures: number; /** Number of consistent features */ consistentCount: number; /** List of discrepancies found */ discrepancies: DiscrepancyReport[]; /** Auto-repair results (if repair was attempted) */ repairs?: RepairResult[]; } export interface RepairResult { featureId: string; success: boolean; action: string; error?: string; } export interface ValidatorOptions { /** Logger instance */ logger?: Logger; /** Default project name (for creating missing project folders) */ defaultProject?: string; /** Whether to include archived features in validation */ includeArchived?: boolean; } export declare class FeatureConsistencyValidator { private projectRoot; private specsPath; private incrementsPath; private logger; private defaultProject; private includeArchived; constructor(projectRoot: string, options?: ValidatorOptions); /** * Validate feature folder consistency within project folders * v5.0.0: Features now live in {project}/FS-XXX/ (no _features folder) * * @param autoRepair - If true, attempt to auto-repair discrepancies * @returns Validation result with discrepancies and repair results */ validate(autoRepair?: boolean): Promise; /** * Get all feature folder IDs from a project directory * v5.0.0: Features now live in {project}/FS-XXX/ */ private getFeatureFoldersInProject; /** * Get all project folder names (excluding _features, _epics, _archive) */ private getProjectFolders; /** * Check if a feature has proper FEATURE.md and linked increment * v5.0.0: Features live in {project}/FS-XXX/ */ private checkFeatureConsistency; /** * Check if a feature is from an external source (GitHub, JIRA, ADO) * External features should NOT be considered orphaned even if local increment is missing */ private isExternalFeature; /** * Extract linked increment ID from FEATURE.md */ private extractLinkedIncrement; /** * Check if an increment exists (in active or archive folder) */ private checkIncrementExists; /** * Attempt to repair a discrepancy * v5.0.0: Only orphaned_feature repairs supported (archiving) */ private repairDiscrepancy; /** * Archive an orphaned feature (increment was deleted) * v5.0.0: Delegates to FeatureArchiver for consistent archiving behavior */ private archiveOrphanedFeature; /** * Log validation summary */ private logValidationSummary; /** * Quick check: Are there any discrepancies? * Use this for fast validation without full report */ hasDiscrepancies(): Promise; /** * Get list of orphaned features (features with deleted increments) * v5.0.0: Now checks features in project folders, not _features */ getOrphanedFeatures(): Promise; } //# sourceMappingURL=feature-consistency-validator.d.ts.map