UNPKG

@invisiblecities/sidequest-cqo

Version:

Configuration-agnostic TypeScript and ESLint orchestrator with real-time watch mode, SQLite persistence, and intelligent terminal detection

208 lines 7.19 kB
/** * Configuration Bridge for Unified Orchestrator * * Provides utilities to convert legacy CLI flags and configurations * to the new UnifiedOrchestratorConfig format, enabling seamless * migration from dual orchestrator architecture. */ // convertLegacyToUnifiedConfig function removed - no longer needed // since legacy orchestrator has been fully replaced /** * Create unified orchestrator configuration from CLI flags */ export function createUnifiedConfigFromFlags(flags) { return { // Analysis Configuration targetPath: flags.targetPath, engines: { typescript: { enabled: !flags.eslintOnly, options: { includeAny: flags.includeAny || false, strict: flags.strict || false, targetPath: flags.targetPath, }, priority: 1, timeout: 30_000, allowFailure: false, }, eslint: { enabled: true, options: { includeTypescriptRules: !flags.eslintOnly, targetPath: flags.targetPath, }, priority: 2, timeout: 60_000, allowFailure: false, }, unusedExports: { enabled: true, options: { targetPath: flags.targetPath, }, priority: 3, timeout: 30_000, allowFailure: true, }, zodDetection: { enabled: true, options: { targetPath: flags.targetPath, }, priority: 4, timeout: 15_000, allowFailure: true, }, archaeology: { enabled: flags.archaeology || flags.includeArchaeology || false, options: { targetPath: flags.targetPath, deadCode: { enabled: true, threshold: 0.8 }, duplication: { enabled: true, minTokens: 50, threshold: 0.95 }, }, priority: 5, timeout: 60_000, // Longer timeout for archaeology analysis allowFailure: true, }, }, deduplication: { enabled: true, strategy: "exact", }, crossover: { enabled: !flags.noCrossoverCheck, warnOnTypeAwareRules: true, warnOnDuplicateViolations: true, failOnCrossover: flags.failOnCrossover || false, }, output: { console: !flags.verbose, // Console output disabled in verbose mode (JSON only) ...(flags.verbose ? { json: "stdout" } : {}), }, // Service Configuration database: { path: "./data/dev-code-quality.db", enableWAL: true, maxHistoryDays: 30, }, polling: { defaultFrequencyMs: 30_000, maxConcurrentChecks: 3, adaptivePolling: true, }, watch: { intervalMs: 3000, debounceMs: 500, autoCleanup: true, }, performance: { batchSize: 100, enableMetrics: true, }, }; } /** * Create watch mode configuration from CLI flags */ export function createWatchModeConfig(flags) { const baseConfig = createUnifiedConfigFromFlags(flags); // Watch mode specific adjustments return { ...baseConfig, engines: { ...baseConfig.engines, // In watch mode, always enable ESLint for comprehensive analysis eslint: { ...baseConfig.engines.eslint, enabled: true, }, // In watch mode, enable archaeology if requested (not by default due to performance) archaeology: { ...baseConfig.engines.archaeology, enabled: flags.archaeology || flags.includeArchaeology || false, }, }, output: { // In watch mode, always use console output for real-time display console: true, }, watch: { intervalMs: 3000, debounceMs: 500, autoCleanup: true, }, }; } /** * Create PRD generation configuration from CLI flags */ export function createPRDConfig(flags) { const baseConfig = createUnifiedConfigFromFlags(flags); // PRD generation specific adjustments return { ...baseConfig, engines: { typescript: { enabled: true, // Always enable TypeScript for comprehensive PRD analysis options: { includeAny: true, // Include any-type violations for PRD strict: true, // Use strict mode for comprehensive analysis targetPath: flags.targetPath, }, priority: 1, timeout: 60_000, // Longer timeout for comprehensive analysis allowFailure: false, }, eslint: { enabled: true, // Always enable ESLint for comprehensive PRD analysis options: { includeTypescriptRules: true, targetPath: flags.targetPath, }, priority: 2, timeout: 120_000, // Longer timeout for comprehensive analysis allowFailure: false, }, unusedExports: { enabled: true, options: { targetPath: flags.targetPath, }, priority: 3, timeout: 60_000, allowFailure: true, }, zodDetection: { enabled: true, options: { targetPath: flags.targetPath, }, priority: 4, timeout: 30_000, allowFailure: true, }, archaeology: { enabled: flags.archaeology || flags.includeArchaeology || false, // Enable for comprehensive PRD analysis if requested options: { targetPath: flags.targetPath, deadCode: { enabled: true, threshold: 0.8 }, duplication: { enabled: true, minTokens: 50, threshold: 0.95 }, }, priority: 5, timeout: 120_000, // Extra long timeout for comprehensive PRD analysis allowFailure: true, }, }, crossover: { enabled: true, // Always enable crossover detection for PRD warnOnTypeAwareRules: true, warnOnDuplicateViolations: true, failOnCrossover: false, // Don't fail PRD generation on crossover issues }, output: { console: false, // Disable console output for PRD generation }, }; } //# sourceMappingURL=unified-orchestrator-bridge.js.map