Skip to main content Module task_ops Copy item path Source DeletedTask Information about a deleted task (for undo and recovery logging) ReparentResult Result of a reparent operation (for undo) TaskLocation Location of a task in the track tree InsertPosition Where to insert a new task in a section TaskError Error type for task operations add_dep Add a dependency. dep_id is validated to exist somewhere in the provided tracks. add_ref add_subtask Add a subtask to an existing task identified by parent_id.
Returns the assigned subtask ID. add_subtask_after Add a subtask to an existing task, inserted after a specific sibling.
Returns the assigned subtask ID. add_tag add_task Add a task to a track’s backlog section.
Returns the assigned ID. append_note count_subtree_size Count the total number of tasks in a subtree (including the root task itself). cycle_state Cycle state: todo → active → done → todo delete_task “Delete” a task by marking it done and adding #wontdo tag. edit_title Edit a task’s title. find_max_id_in_track Scan a track for the highest ID number with the given prefix (e.g. “T-”).
Updates max if a higher number is found. find_task_in_track Find a task by ID anywhere in a track (immutable). find_task_location Find a task’s location (parent and sibling index) within a track. find_task_location_any_section Find a task’s location across all sections of a track. find_task_mut_in_track Find a task by ID anywhere in a track (including subtasks), return mutable ref. hard_delete_task Physically remove a task (and its entire subtree) from a track.
Returns the deleted task data for undo/recovery, or an error if not found. insert_task_subtree Insert a task subtree at a specific location in a track. is_descendant_of Check if candidate_id is a descendant of ancestor_id in the given track. is_top_level_in_section Check if a task ID is a top-level task in the given section. max_subtree_depth Get the maximum relative depth of any descendant in a task’s subtree.
A task with no children returns 0. A task with children returns 1 + max of children. move_task Move a task within the same track’s backlog (reorder). move_task_between_sections Move a top-level task (with its entire subtree) from one section to another.
Returns the original index in the source section, or None if the task is not
found as a top-level task in the source section (subtasks are not moved independently). move_task_to_track Move a task to a different track. Reassigns the task ID using the target
track’s prefix. Updates dependency references across all provided tracks. next_id_number Find the next available ID number for a given prefix in a track. reinsert_task Reinsert a previously deleted task at its original position. rekey_subtree Assign new IDs to a task and all its descendants.
Returns the list of (old_id, new_id) mappings. remove_dep remove_tag remove_task_subtree Remove a task (with its entire subtree) from its current position.
Returns the task and its original location. renumber_subtasks Recursively renumber subtask IDs based on the new parent ID. reparent_task Main reparent operation: move a task to a new parent (or promote to top-level). set_blocked Set blocked: any → blocked, blocked → todo set_done Set done: any → done (adds resolved date) set_note set_parked Set parked: any → parked, parked → todo set_spec set_state Direct state set — handles resolved/added date bookkeeping set_subtree_depth Recursively set the depth of a task and all its subtasks. update_dep_references Update all dep references across tracks from old_id to new_id. update_dep_references_in_track Update all dep references within a single track from old_id to new_id.