/** * Todo List Manager * * Manages persistent todo lists that survive context compactions. * Uses markdown file storage in .claude/todos/ directory. */ import type { DatabaseClient } from '../db/client.js'; /** * Task status */ export type TaskStatus = 'pending' | 'in-progress' | 'completed' | 'blocked' | 'cancelled'; /** * Todo task */ export interface TodoTask { /** Unique task ID */ id: string; /** Task title (imperative form) */ subject: string; /** Detailed description */ description?: string; /** Current status */ status: TaskStatus; /** Tasks that must complete before this one */ dependencies?: string[]; /** Agent/person assigned to */ assignedTo?: string; /** When task was created */ createdAt: string; /** When task was last updated */ updatedAt: string; /** When task was completed */ completedAt?: string; } /** * Todo session */ export interface TodoSession { /** Unique session ID */ id: string; /** Session name/title */ name: string; /** Session status */ status: 'active' | 'completed' | 'archived'; /** Tasks in this session */ tasks: TodoTask[]; /** When session was created */ createdAt: string; /** When session was last updated */ updatedAt: string; /** Parent session ID if this is a continuation */ parentSession?: string; /** Additional metadata */ metadata?: Record; } /** * Todo list manager options */ export interface TodoListManagerOptions { /** Base directory for todo storage */ baseDir?: string; /** Verbose logging */ verbose?: boolean; } /** * Progress update callback */ export interface ProgressUpdate { sessionId: string; total: number; completed: number; percentage: number; } /** * Todo List Manager * * Manages persistent todo lists stored in markdown files. */ export declare class TodoListManager { private db; private baseDir; private verbose; private readonly TODO_DIR; private readonly ACTIVE_SUBDIR; private readonly COMPLETED_SUBDIR; private readonly ARCHIVED_SUBDIR; constructor(db: DatabaseClient, options?: TodoListManagerOptions); /** * Get todos directory path */ private getTodosDir; /** * Get active todos directory path */ private getActiveDir; /** * Get completed todos directory path */ private getCompletedDir; /** * Get archived todos directory path */ private getArchivedDir; /** * Ensure all required directories exist */ private ensureDirectories; /** * Generate unique session ID */ private generateSessionId; /** * Generate unique task ID */ private generateTaskId; /** * Get current timestamp */ private now; /** * Create a new todo session * * @param name - Session name * @param tasks - Initial tasks (optional) * @returns Created session */ createSession(name: string, tasks?: Array>): Promise; /** * Get active session * * @returns Active session or null if none exists */ getActiveSession(): Promise; /** * Get session by ID * * @param sessionId - Session ID * @returns Session or null if not found */ getSession(sessionId: string): Promise; /** * List all sessions * * @param status - Filter by status (optional) * @returns Array of sessions */ listSessions(status?: 'active' | 'completed' | 'archived'): Promise; /** * Update a task in the active session * * @param taskId - Task ID * @param updates - Fields to update * @returns Updated task or null if not found */ updateTask(taskId: string, updates: Partial): Promise; /** * Add a task to the active session * * @param task - Task to add (without id) * @returns Created task with ID */ addTask(task: Omit): Promise; /** * Complete the active session * * @returns Completed session or null if no active session */ completeSession(): Promise; /** * Archive a session * * @param sessionId - Session ID to archive * @returns True if archived successfully */ archiveSession(sessionId: string): Promise; /** * Get progress for active session * * @returns Progress update or null if no active session */ getProgress(): Promise; /** * Save session to markdown file */ private saveSession; /** * Generate session markdown content */ private generateSessionContent; /** * Generate archive entry content */ private generateArchiveContent; /** * Parse session from markdown content */ private parseSession; /** * Store session in database * * Uses todo_sessions and todo_tasks tables for efficient querying. */ private storeSessionInDatabase; /** * Get session from database * * @param sessionId - Session ID * @returns Session with tasks or null */ private getSessionFromDatabase; /** * Export session as markdown * * @param sessionId - Session ID * @returns Markdown content */ exportSession(sessionId: string): Promise; /** * Import tasks from markdown * * @param markdownContent - Markdown content * @returns Created session */ importTasks(markdownContent: string, sessionName?: string): Promise; /** * Clean up old archived sessions * * @param daysOld - Remove archives older than this many days * @returns Number of archives removed */ cleanupOldArchives(daysOld?: number): Promise; /** * Get all sessions for reporting * * @returns Summary of all sessions */ getSummary(): Promise<{ active: number; completed: number; totalTasks: number; completedTasks: number; }>; } //# sourceMappingURL=todolist-manager.d.ts.map