/** * EngineResult-returning wrappers for non-CRUD task ops (T1568 / ADR-057 / ADR-058). * Consolidates all task* wrapper functions that wrap coreTask* in try/catch → EngineResult. * Also includes coreTaskCancel and claim/unclaim wrappers. * @task T10064 * @epic T9834 */ import { type EngineResult } from '../engine-result.js'; import type { ImpactReport } from '../intelligence/types.js'; import type { ChildStrategy } from './deletion-strategy.js'; import { coreTaskAnalyze } from './task-analyze.js'; import { coreTaskBlockers } from './task-blockers.js'; import { coreTaskDeps, coreTaskRelates, coreTaskRelatesAdd, coreTaskRelatesAddBatch, coreTaskRelatesRemove } from './task-import.js'; import { coreTaskNext } from './task-next.js'; import { coreTaskAssignee, coreTaskBulkMove, coreTaskPromote, coreTaskReopen, coreTaskReorder, coreTaskReorderRank, coreTaskReparent, coreTaskRestore, coreTaskUnarchive } from './task-reparent.js'; import { coreTaskTree } from './task-tree.js'; export { taskBatchValidate, taskClaim, taskComplexityEstimate, taskDepends, taskDepsCycles, taskDepsOverview, taskDepsTree, taskDepsValidate, taskExport, taskHistory, taskImport, taskLint, taskStats, taskUnclaim, } from './engine-wrap-ops.js'; export { coreTaskAnalyze, coreTaskAssignee, coreTaskBlockers, coreTaskBulkMove, coreTaskDeps, coreTaskNext, coreTaskPromote, coreTaskRelates, coreTaskRelatesAdd, coreTaskRelatesRemove, coreTaskReopen, coreTaskReorder, coreTaskReorderRank, coreTaskReparent, coreTaskRestore, coreTaskTree, coreTaskUnarchive, }; /** * Cancel a task (sets status to 'cancelled', a soft terminal state). * Use restore to reverse. Use delete for permanent removal. * * @param projectRoot - Absolute path to the CLEO project root directory * @param taskId - The task ID to cancel * @param params - Optional cancel options * @param params.reason - Human-readable cancellation reason stored on the task * @returns Confirmation with cancelled flag and timestamp. When the task is * already cancelled, the response includes `alreadyCancelled: true` * and echoes the existing `cancelledAt` (idempotent — T9838). * * @remarks * Cancellation is a soft terminal state -- the task remains in the database and * can be restored via {@link coreTaskRestore}. Not all statuses are cancellable; * the `canCancel` guard determines eligibility. * * The T877 DB trigger enforces an invariant: when `status='cancelled'`, the * `pipeline_stage` MUST equal `'cancelled'`. This function therefore always * forces `pipelineStage='cancelled'` on a successful cancel, overriding any * prior terminal value such as `'contribution'`. The previous T871 carve-out * (skip overwrite when stage was already terminal) caused * `T877_INVARIANT_VIOLATION` for tasks that had reached the `'contribution'` * terminal stage before cancellation — see T9838 repro. * * @example * ```typescript * const result = await coreTaskCancel('/project', 'T077', { reason: 'Superseded by T080' }); * console.log(result.cancelledAt); * ``` * * @task T4529 * @task T9838 (T877 invariant fix + idempotent re-cancel) */ export declare function coreTaskCancel(projectRoot: string, taskId: string, params?: { reason?: string; /** Explicit child handling mode. Defaults to 'block' so propagation is never implicit. */ children?: ChildStrategy; /** * Target parent ID for the `reparent` strategy (T11811). REQUIRED when * `children='reparent'` — the direct children move under this parent via * {@link coreTaskReparent} so the type-matrix / depth / sibling checks run. */ reparentTo?: string; /** Required when cascade affects more than cascadeThreshold descendants. */ force?: boolean; /** Large-subtree guard threshold. Defaults to 10 descendants. */ cascadeThreshold?: number; /** Config-level escape hatch for installations that forbid cascade cancellation. */ allowCascade?: boolean; }): Promise<{ task: string; cancelled: boolean; reason?: string; cancelledAt: string; alreadyCancelled?: boolean; childStrategy?: ChildStrategy; affectedTasks?: string[]; affectedCount?: number; }>; /** * Suggest next task to work on. * @task T1568 * @epic T1566 */ export declare function taskNext(projectRoot: string, params?: { count?: number; explain?: boolean; }): Promise; totalCandidates: number; }>>; /** * Show blocked tasks and analyze blocking chains. * @task T1568 * @epic T1566 */ export declare function taskBlockers(projectRoot: string, params?: { analyze?: boolean; limit?: number; }): Promise; criticalBlockers: Array<{ id: string; title: string; blocksCount: number; }>; summary: string; total: number; limit: number; }>>; /** * Build hierarchy tree. * @task T1568 * @epic T1566 */ export declare function taskTree(projectRoot: string, taskId?: string, withBlockers?: boolean): Promise; /** * Show dependencies for a task. * @task T1568 * @epic T1566 */ export declare function taskDeps(projectRoot: string, taskId: string): Promise; dependedOnBy: Array<{ id: string; title: string; status: string; }>; unresolvedDeps: string[]; allDepsReady: boolean; }>>; /** * Show task relations. * @task T1568 * @epic T1566 */ export declare function taskRelates(projectRoot: string, taskId: string, options?: { direction?: 'out' | 'in' | 'both'; type?: string; includeDependencies?: boolean; }): Promise; count: number; }>>; /** * Add a relation between two tasks. * @task T1568 * @epic T1566 */ export declare function taskRelatesAdd(projectRoot: string, taskId: string, relatedId: string, type: string, reason?: string): Promise>; /** * Remove a relation between two tasks. * @task T9240 */ export declare function taskRelatesAddBatch(projectRoot: string, params: Parameters[1]): Promise>>>; export declare function taskRelatesRemove(projectRoot: string, taskId: string, relatedId: string, type?: string): Promise>; /** * Find related tasks using semantic search or keyword matching. * @task T1568 * @epic T1566 */ export declare function taskRelatesFind(projectRoot: string, taskId: string, params?: { mode?: 'suggest' | 'discover'; threshold?: number; }): Promise>>; /** * Analyze task quality and project health. * @task T1568 * @epic T1566 */ export declare function taskAnalyze(projectRoot: string, taskId?: string, params?: { tierLimit?: number; }): Promise; tiers: { critical: Array<{ id: string; title: string; leverage: number; }>; high: Array<{ id: string; title: string; leverage: number; }>; normal: Array<{ id: string; title: string; leverage: number; }>; }; metrics: { totalTasks: number; actionable: number; blocked: number; avgLeverage: number; }; tierLimit: number; }>>; /** * Predict downstream impact of a change. * @task T1568 * @epic T1566 */ export declare function taskImpact(projectRoot: string, change: string, matchLimit?: number): Promise>; /** * Restore a cancelled task back to pending. * @task T1568 * @epic T1566 */ export declare function taskRestore(projectRoot: string, taskId: string, params?: { cascade?: boolean; notes?: string; }): Promise>; /** * Move an archived task back to active. * @task T1568 * @epic T1566 */ export declare function taskUnarchive(projectRoot: string, taskId: string, params?: { status?: string; preserveStatus?: boolean; }): Promise>; /** * Change task position within its sibling group. * @task T1568 * @epic T1566 */ export declare function taskReorder(projectRoot: string, taskId: string, position: number): Promise>; /** * Re-rank a column/sibling scope from an explicit top-to-bottom ID order. * @task T11786 * @epic T11556 */ export declare function taskReorderRank(projectRoot: string, orderedIds: string[]): Promise>; /** * Atomically move N tasks to a new status and/or pipeline stage. * @task T11786 * @epic T11556 */ export declare function taskBulkMove(projectRoot: string, taskIds: string[], target: { status?: string; pipelineStage?: string; }): Promise>; /** * Set or clear a task's first-class assignee (distinct from agent claim). * @task T11786 * @epic T11556 */ export declare function taskAssignee(projectRoot: string, taskId: string, assignee: string | null | undefined): Promise>; /** * Move task under a different parent. * @task T1568 * @epic T1566 */ export declare function taskReparent(projectRoot: string, taskId: string, newParentId: string | null): Promise>; /** * Promote a subtask to task or task to root. * @task T1568 * @epic T1566 */ export declare function taskPromote(projectRoot: string, taskId: string): Promise>; /** * Reopen a completed task. * @task T1568 * @epic T1566 * @task T10605 */ export declare function taskReopen(projectRoot: string, taskId: string, params?: { status?: string; reason?: string; regressionOf?: string; reopenAncestors?: boolean; }): Promise>; /** * Cancel a task (soft terminal state). * @task T1568 * @epic T1566 */ export declare function taskCancel(projectRoot: string, taskId: string, reasonOrParams?: string | { reason?: string; children?: ChildStrategy; /** Target parent for the `reparent` strategy (T11811). */ reparentTo?: string; force?: boolean; cascadeThreshold?: number; allowCascade?: boolean; }): Promise>; //# sourceMappingURL=engine-wrap.d.ts.map