/** * Strategy pattern for child handling during task cancellation. * Ported from lib/tasks/deletion-strategy.sh * * Strategies (T11811 — orphan-prevention guard): * - `block` — fail if the task has children (the lowest-blast-radius * default; the operator must opt into a disposition). * - `cascade` — cancel the whole subtree. * - `reparent` — move the direct children under an existing parent so they * stay attached (routed through `coreTaskReparent` so the * type-matrix / depth / sibling checks run). * * The legacy `orphan` strategy (set `parentId: null` to detach children to * root) was DELETED by T11811: detaching manufactures the exact orphan the * containment guard rejects. `reparent` is its safe replacement. * * @epic T4454 * @task T4529 * @task T11811 — delete `orphan`/detach in favour of `reparent` */ import type { Task } from '@cleocode/contracts'; /** Valid child handling strategies. */ export type ChildStrategy = 'block' | 'cascade' | 'reparent'; export declare const VALID_STRATEGIES: ChildStrategy[]; /** Result from a strategy handler. */ export interface StrategyResult { success: boolean; strategy: ChildStrategy; taskId: string; affectedTasks: string[]; affectedCount?: number; message: string; error?: { code: string; message: string; childCount?: number; childIds?: string[]; suggestion?: string; }; } /** * Validate a strategy name. */ export declare function isValidStrategy(strategy: string): strategy is ChildStrategy; /** * Handle children using the specified strategy. * Returns the modified tasks array and the strategy result. * * @param taskId - The parent task being cancelled. * @param strategy - Child disposition strategy (`block` | `cascade` | `reparent`). * @param tasks - The full in-memory task set (mutated copy returned). * @param options - Strategy tuning. `reparentTo` is REQUIRED for `reparent`. */ export declare function handleChildren(taskId: string, strategy: ChildStrategy, tasks: Task[], options?: { force?: boolean; cascadeThreshold?: number; allowCascade?: boolean; /** Target parent ID for the `reparent` strategy (T11811). */ reparentTo?: string; }): { tasks: Task[]; result: StrategyResult; }; //# sourceMappingURL=deletion-strategy.d.ts.map