/** * State Checklist Service - Centralized state checklist logic for all workflow states * * Phase 1.2: Extended from ReviewChecklistService to support all 6 workflow states. * Handles checklist initialization, validation, persistence, and loading for any state. * * @internal * @requirement Dynamic State Checklists - Phase 1.2 */ import { WorkflowState } from '@shadel/workflow-core'; import { TaskQueueManager } from './task-queue.js'; import { TaskFileSync } from './task-file-sync.js'; import { ChecklistRegistry } from './checklist-registry.js'; import { PatternProvider } from './pattern-provider.js'; /** * State Checklist structure (generalized from ReviewChecklist) */ export interface StateChecklist { items: StateChecklistItem[]; completedAt?: string; validationResult?: any; } /** * Checklist Evidence structure */ export interface ChecklistEvidence { type: 'file_created' | 'file_modified' | 'command_run' | 'test_passed' | 'validation_passed' | 'manual' | 'other'; description: string; files?: string[]; command?: string; output?: string; testResults?: { passed: number; failed: number; total: number; }; validationResults?: any; manualNotes?: string; timestamp: string; verified?: boolean; } /** * State Checklist Item (generalized from ReviewChecklistItem) */ export interface StateChecklistItem { id: string; title: string; description: string; required?: boolean; priority?: 'high' | 'medium' | 'low'; completed: boolean; completedAt?: string; notes?: string; evidence?: ChecklistEvidence; evidenceRequired?: boolean; } /** * State Checklist Service * * Centralizes checklist logic for all workflow states with initialization, * validation, persistence, and loading. */ export declare class StateChecklistService { private queueManager; private fileSync; private taskFile; private registry; private patternProvider; private patternChecklistGenerator; private patternVerificationService; constructor(queueManager: TaskQueueManager, fileSync: TaskFileSync, taskFile: string, registry?: ChecklistRegistry, patternProvider?: PatternProvider); /** * Initialize state checklist when entering a state * Generalized from initializeReviewChecklist to work for all states * Phase 2.3: Enhanced with pattern checklist integration */ initializeStateChecklist(state: WorkflowState): Promise; /** * Validate that state checklist is complete before allowing transition * Generalized from validateReviewChecklistComplete to work for all states */ validateStateChecklistComplete(state: WorkflowState): Promise; /** * Save state checklist to task * Generalized from saveReviewChecklist to work for all states */ saveStateChecklist(checklist: StateChecklist, state: WorkflowState): Promise; /** * Load state checklist from task * Generalized from loadReviewChecklist to work for all states * Phase 2: Added lazy initialization for early states (UNDERSTANDING, DESIGNING) */ loadStateChecklist(state: WorkflowState): Promise; /** * Helper method to try loading existing checklist * Extracted from current loadStateChecklist() implementation * Phase 2: Refactored for lazy initialization support */ private tryLoadExistingChecklist; /** * Save migrated checklist data (helper for auto-migration) * Phase 4.2: Preserve migrated data */ private saveMigratedChecklist; /** * Mark a checklist item as complete * New method for marking individual items complete * @param state - Workflow state * @param itemId - Checklist item ID * @param evidence - Evidence for completion (required if evidenceRequired is true) */ markItemComplete(state: WorkflowState, itemId: string, evidence?: ChecklistEvidence): Promise; /** * Validate evidence structure */ private validateEvidence; /** * Display checklist for a state * Enhanced from ReviewChecklistManager.displayChecklist */ displayChecklist(checklist: StateChecklist, state: WorkflowState): void; /** * Initialize review checklist (REVIEWING state specific) * Used internally by initializeStateChecklist for REVIEWING state */ private initializeReviewChecklistInternal; /** * Convert ReviewChecklistItem to StateChecklistItem by adding title property */ private convertReviewChecklistItemToStateChecklistItem; /** * Convert ReviewChecklist to StateChecklist format */ private convertReviewChecklistToStateChecklist; /** * @deprecated Use initializeStateChecklist('REVIEWING') instead */ initializeReviewChecklist(): Promise; /** * @deprecated Use validateStateChecklistComplete('REVIEWING') instead */ validateReviewChecklistComplete(): Promise; /** * @deprecated Use saveStateChecklist(checklist, 'REVIEWING') instead */ saveReviewChecklist(checklist: any): Promise; /** * @deprecated Use loadStateChecklist('REVIEWING') instead */ loadReviewChecklist(): Promise; }