/**
 * ProjectTaskWatcherService — Watches `.crewly/tasks/` for new ProjectTask files
 * and automatically creates WorkItems in the TaskPool.
 *
 * This service ensures that every ProjectTask file with status 'open' or 'in_progress'
 * results in a corresponding WorkItem. It handles two scenarios:
 *
 * 1. **Initial sync**: Scans existing task files on startup and creates missing WorkItems
 * 2. **Live watch**: Monitors the tasks directory for new `.md` files via chokidar
 *
 * Design principle: Fire-and-forget. Errors are logged but never block normal operations.
 *
 * @module services/v3/project-task-watcher.service
 */
/**
 * Metadata parsed from a ProjectTask markdown file.
 */
export interface ParsedProjectTask {
    /** Derived from filename (sans extension) */
    taskId: string;
    /** First H1 heading or filename */
    title: string;
    /** Full markdown content */
    description: string;
    /** Priority parsed from metadata block, defaults to 'medium' */
    priority: string;
    /** Milestone (parent directory name) */
    milestone: string;
    /** Status folder name: 'open' | 'in_progress' */
    statusFolder: string;
    /** Assigned session name, if present */
    assignedTo?: string;
}
/**
 * Watches the `.crewly/tasks/` directory for ProjectTask files and ensures
 * each one has a corresponding WorkItem in the TaskPool.
 *
 * @example
 * ```typescript
 * const watcher = new ProjectTaskWatcherService('/path/to/project');
 * await watcher.start();
 * // ...later:
 * watcher.dispose();
 * ```
 */
export declare class ProjectTaskWatcherService {
    private readonly logger;
    private readonly projectPath;
    private readonly tasksBaseDir;
    private watcher;
    private pendingFiles;
    private debounceTimer;
    /**
     * Creates a new ProjectTaskWatcherService.
     *
     * @param projectPath - Absolute path to the project root
     */
    constructor(projectPath: string);
    /**
     * Starts watching for new ProjectTask files and performs an initial sync.
     *
     * 1. Ensures the tasks directory exists
     * 2. Scans all existing open/in_progress tasks and creates missing WorkItems
     * 3. Starts a chokidar watcher for live file creation events
     */
    start(): Promise<void>;
    /**
     * Scans all milestone directories for open/in_progress task files
     * and creates WorkItems for any that don't already exist in the TaskPool.
     */
    syncExistingTasks(): Promise<void>;
    /**
     * Starts the chokidar file watcher on the tasks directory.
     * Watches for new `.md` files in any `open/` or `in_progress/` subdirectory.
     */
    private startWatcher;
    /**
     * Handles a newly detected task file. Debounces rapid creation events.
     *
     * @param filePath - Absolute path to the new task file
     */
    private onFileAdded;
    /**
     * Schedules a debounced batch sync of pending files.
     */
    private scheduleDebouncedSync;
    /**
     * Ensures a WorkItem exists in the TaskPool for the given ProjectTask file.
     * If one already exists (matched by projectTaskId), this is a no-op.
     *
     * @param filePath - Absolute path to the task .md file
     * @param milestone - The milestone directory name
     * @param statusFolder - The status folder name ('open' or 'in_progress')
     * @returns True if a new WorkItem was created, false if already existed
     */
    ensureWorkItemForTask(filePath: string, milestone: string, statusFolder: string, options?: {
        skipStalenessCheck?: boolean;
    }): Promise<boolean>;
    /**
     * Stops the file watcher and cleans up resources.
     */
    dispose(): void;
}
/**
 * Parses a ProjectTask markdown file to extract metadata.
 *
 * Extracts:
 * - Title from first H1 heading or filename
 * - Priority from `**Priority**: ...` line
 * - AssignedTo from `**Assigned to**: ...` line
 *
 * @param filePath - Absolute path to the .md file
 * @param milestone - Milestone directory name
 * @param statusFolder - Status folder name
 * @returns Parsed task metadata, or null if the file is unreadable
 */
export declare function parseProjectTaskFile(filePath: string, milestone: string, statusFolder: string): Promise<ParsedProjectTask | null>;
//# sourceMappingURL=project-task-watcher.service.d.ts.map