/** * External Tool Drift Detector * * Detects when external tools (GitHub/JIRA/ADO) haven't been synced recently, * indicating potential drift between living docs and external systems. * * Used by: * - sw:done (validation warning if drift > 24h) * - Status line (show "sync pending" indicator) * - sw:progress (show last sync time) * * See: ADR-0131 (External Tool Sync Context Detection) */ import { Logger } from './logger.js'; export interface DriftStatus { hasDrift: boolean; lastSyncTime: Date | null; hoursSinceSync: number | null; externalToolsConfigured: boolean; recommendation: string; error?: string; } export declare class ExternalToolDriftDetector { private projectRoot; private logger; constructor(projectRoot: string, options?: { logger?: Logger; }); /** * Validate increment ID format to prevent path traversal attacks * P0-1: Path traversal vulnerability fix * * @param incrementId - Increment ID to validate (e.g., "0053-feature" or "0111E-external") * @throws Error if increment ID format is invalid */ private validateIncrementId; /** * Safely parse and validate metadata.json * P0-2: JSON injection protection * * @param metadataPath - Path to metadata.json * @returns Parsed metadata object * @throws Error if JSON is invalid or malformed */ private readAndValidateMetadata; /** * Get most recent sync time across ALL external tools * P1-1: Check all tools instead of just first configured tool * * @param metadata - Parsed metadata.json * @returns Most recent sync date or null if no syncs found */ private getMostRecentSync; /** * Safely parse date string with validation * * @param dateString - ISO date string * @returns Date object or null if invalid */ private parseSafeDate; /** * Detect drift for a specific increment * * @param incrementId - Increment ID (e.g., "0053-safe-feature-deletion") * @returns Drift status with recommendations */ detectDrift(incrementId: string): Promise; /** * Get human-readable drift message for display * * @param drift - Drift status from detectDrift() * @returns Formatted message with emoji indicator */ getDriftMessage(drift: DriftStatus): string; } //# sourceMappingURL=external-tool-drift-detector.d.ts.map