UNPKG

@invisiblecities/sidequest-cqo

Version:

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

79 lines 2.48 kB
/** * Watch Mode Controller * Manages watch mode lifecycle, coordinates services, and handles state transitions * Extracted from cli.ts to reduce monolithic architecture and improve testability */ import { EventEmitter } from "node:events"; import type { CLIFlags } from "../utils/types.js"; import type { ColorScheme } from "../shared/types.js"; import type { SessionManager } from "../services/session-manager.js"; import type { DeveloperWatchDisplay } from "./watch-display-v2.js"; import type { UnifiedOrchestrator } from "../services/unified-orchestrator.js"; export interface WatchControllerConfig { flags: CLIFlags; orchestrator: UnifiedOrchestrator; sessionManager: SessionManager; display: DeveloperWatchDisplay; legacyOrchestrator: UnifiedOrchestrator; colors: ColorScheme; } /** * WatchController manages the complete watch mode lifecycle * - Handles session restoration/creation * - Coordinates analysis and display updates * - Manages graceful shutdown * - Prevents race conditions through explicit state management */ export declare class WatchController extends EventEmitter { private config; private stateManager; private watchInterval; private watchTimeout; constructor(config: WatchControllerConfig); /** * Start watch mode with proper lifecycle management */ start(): Promise<void>; /** * Reset the inactivity timeout (called on any activity) */ private resetTimeout; /** * Run a single analysis cycle */ private runAnalysisCycle; /** * Handle watch mode errors with comprehensive diagnostics */ private handleError; /** * Log error details to file system */ private logErrorToFile; /** * Setup graceful shutdown handlers */ private setupShutdownHandlers; private handleShutdownSignal; /** * Shutdown watch mode gracefully */ shutdown(reason?: "timeout" | "interrupt" | "error"): Promise<void>; /** * Get current state (read-only) */ getState(): Readonly<import("../services/watch-state-manager.js").WatchStateData>; /** * Get current phase */ getPhase(): import("../services/watch-state-manager.js").WatchPhase; /** * Check if watch mode is ready for display updates */ isReady(): boolean; /** * Get state summary for debugging */ getStateSummary(): string; } //# sourceMappingURL=watch-controller.d.ts.map