/** * Task data query operations — deps overview, cycles, stats, depends, deps, and relations. * @task T10064 * @epic T9834 */ import type { TaskRef, TasksRelatesAddBatchEntry, TasksRelatesAddBatchResult, TasksSliceResult } from '@cleocode/contracts'; /** * Overview of all dependencies across the project. * * @param projectRoot - Absolute path to the CLEO project root directory * @returns Project-wide dependency summary including blocked tasks, ready tasks, and validation results * * @remarks * Aggregates dependency data across all tasks to provide a high-level view of * the dependency graph health, including which tasks are blocked and what would unblock them. * * @example * ```typescript * const overview = await coreTaskDepsOverview('/project'); * console.log(`${overview.blockedTasks.length} blocked, ${overview.readyTasks.length} ready`); * ``` * * @task T5157 */ export declare function coreTaskDepsOverview(projectRoot: string): Promise<{ totalTasks: number; tasksWithDeps: number; blockedTasks: Array; readyTasks: TaskRef[]; validation: { valid: boolean; errorCount: number; warningCount: number; }; }>; /** * Detect circular dependencies across the project. * * @param projectRoot - Absolute path to the CLEO project root directory * @returns Whether cycles exist and the list of detected cycles with their task paths * * @remarks * Iterates through all tasks with dependencies and uses cycle detection to find * circular chains. Each cycle includes the full path (e.g. [A, B, C, A]) and * the tasks involved with their titles. * * @example * ```typescript * const { hasCycles, cycles } = await coreTaskDepsCycles('/project'); * if (hasCycles) console.log('Circular deps:', cycles.map(c => c.path.join(' -> '))); * ``` * * @task T5157 */ export declare function coreTaskDepsCycles(projectRoot: string): Promise<{ hasCycles: boolean; cycles: Array<{ path: string[]; tasks: Array>; }>; }>; /** * Compute task statistics. * * @param projectRoot - Absolute path to the CLEO project root directory * @param epicId - Optional epic ID to scope stats to that subtree * @returns Status counts, priority distribution, and type distribution * * @remarks * When an epicId is provided, statistics are scoped to that epic and all its * transitive children. Without an epicId, stats cover the entire project. * * @example * ```typescript * const stats = await coreTaskStats('/project', 'T001'); * console.log(`${stats.done}/${stats.total} complete`); * ``` * * @task T4790 */ export declare function coreTaskStats(projectRoot: string, epicId?: string): Promise<{ total: number; pending: number; active: number; blocked: number; done: number; cancelled: number; byPriority: Record; byType: Record; }>; /** * List dependencies for a task in a given direction. * * @param projectRoot - Absolute path to the CLEO project root directory * @param taskId - The task ID to inspect * @param direction - Direction to traverse: "upstream" (what this task depends on), "downstream" (what depends on it), or "both" * @param options - Optional display configuration * @param options.tree - When true, includes a recursive upstream dependency tree * @returns Upstream and downstream deps, transitive chain length, leaf blockers, and readiness status * * @remarks * Combines direct dependency lookups with transitive analysis. Leaf blockers are * the deepest unresolved tasks in the dependency chain -- resolving them first * has the most impact on unblocking. * * @example * ```typescript * const deps = await coreTaskDepends('/project', 'T100', 'both', { tree: true }); * console.log('Leaf blockers:', deps.leafBlockers.map(b => b.id)); * ``` * * @task T4790 */ export declare function coreTaskDepends(projectRoot: string, taskId: string, direction?: 'upstream' | 'downstream' | 'both', options?: { tree?: boolean; }): Promise<{ taskId: string; direction: string; upstream: TaskRef[]; downstream: TaskRef[]; unresolvedChain: number; leafBlockers: TaskRef[]; allDepsReady: boolean; hint?: string; upstreamTree?: import('./task-tree.js').FlatTreeNode[]; }>; /** * Return a localized WorkGraph slice around one task. * * The default radius is 1, which returns the task itself, its direct upstream * dependencies, direct downstream dependents, and siblings (other children of * the same parent). A larger radius expands only the upstream/downstream * dependency neighborhoods; siblings remain the center task's direct siblings. * * @task T10628 */ export declare function coreTaskSlice(projectRoot: string, taskId: string, options?: { radius?: number; depth?: number; budget?: number; direction?: 'upstream' | 'downstream' | 'around'; includeRelates?: boolean; }): Promise; /** * Show dependencies for a task. * * @param projectRoot - Absolute path to the CLEO project root directory * @param taskId - The task ID to inspect dependencies for * @returns Upstream and downstream dependencies, unresolved deps, and readiness flag * * @remarks * Returns both the tasks this task depends on (upstream) and the tasks that depend * on it (downstream). Unresolved deps are those not yet done or cancelled. * * @example * ```typescript * const deps = await coreTaskDeps('/project', 'T100'); * if (!deps.allDepsReady) console.log('Blocked by:', deps.unresolvedDeps); * ``` * * @task T4790 */ export declare function coreTaskDeps(projectRoot: string, taskId: string): Promise; /** * Show task relations. * * @param projectRoot - Absolute path to the CLEO project root directory * @param taskId - The task ID to retrieve relations for * @returns The task's relations array and count * * @remarks * Relations are non-dependency links between tasks (e.g. "related-to", "duplicates"). * Unlike dependencies, relations do not affect blocking or scheduling. * * @example * ```typescript * const { relations, count } = await coreTaskRelates('/project', 'T050'); * console.log(`${count} relations found`); * ``` * * @task T4790 */ export type TaskRelatesDirection = 'out' | 'in' | 'both'; export interface CoreTaskRelatesOptions { /** Which side of a stored edge should match `taskId`. Defaults to both. */ direction?: TaskRelatesDirection; /** Relation/dependency type filter. Use `depends`/`depends_on` for scheduler dependency edges. */ type?: string; /** Include scheduler dependency edges alongside task_relations edges. Defaults to true. */ includeDependencies?: boolean; } type CoreTaskRelationEntry = { taskId: string; type: string; reason?: string; direction?: 'out' | 'in'; source?: 'relation' | 'dependency'; ready?: boolean; status?: string; }; export declare function coreTaskRelates(projectRoot: string, taskId: string, options?: CoreTaskRelatesOptions): Promise<{ taskId: string; direction: TaskRelatesDirection; relations: CoreTaskRelationEntry[]; count: number; }>; /** * Add a relation between two tasks. * * @param projectRoot - Absolute path to the CLEO project root directory * @param taskId - The source task ID * @param relatedId - The target task ID to relate to * @param type - Relation type (e.g. "related-to", "duplicates", "blocks") * @param reason - Optional human-readable reason for the relation * @returns Confirmation of the added relation with source, target, and type * * @remarks * Persists the relation both on the task's `relates` array and in the * `task_relations` table for bidirectional querying. * * @example * ```typescript * const result = await coreTaskRelatesAdd('/project', 'T010', 'T020', 'related-to', 'Shared scope'); * console.log(result.added); // true * ``` * * @task T4790 */ export declare function coreTaskRelatesAdd(projectRoot: string, taskId: string, relatedId: string, type: string, reason?: string): Promise<{ from: string; to: string; type: string; reason?: string; added: boolean; }>; /** * Remove a relation between two tasks. * * @param projectRoot - Absolute path to the CLEO project root directory * @param taskId - The source task ID * @param relatedId - The target task ID whose relation is to be removed * @param type - Optional relation type to narrow the deletion; omit to remove any type * @returns Confirmation of the removed relation * * @task T9240 */ export declare function coreTaskRelatesAddBatch(projectRoot: string, params: { relations?: TasksRelatesAddBatchEntry[]; edges?: TasksRelatesAddBatchEntry[]; dryRun?: boolean; reasonWaiver?: string; }): Promise; export declare function coreTaskRelatesRemove(projectRoot: string, taskId: string, relatedId: string, type?: string): Promise<{ from: string; to: string; type?: string; removed: boolean; }>; export {}; //# sourceMappingURL=task-data.d.ts.map