pub struct TaskManager<'a> { /* private fields */ }Implementations§
Source§impl<'a> TaskManager<'a>
impl<'a> TaskManager<'a>
pub fn new(pool: &'a SqlitePool) -> Self
Sourcepub async fn add_task(
&self,
name: &str,
spec: Option<&str>,
parent_id: Option<i64>,
) -> Result<Task>
pub async fn add_task( &self, name: &str, spec: Option<&str>, parent_id: Option<i64>, ) -> Result<Task>
Add a new task
Sourcepub async fn get_task_with_events(&self, id: i64) -> Result<TaskWithEvents>
pub async fn get_task_with_events(&self, id: i64) -> Result<TaskWithEvents>
Get a task with events summary
Sourcepub async fn update_task(
&self,
id: i64,
name: Option<&str>,
spec: Option<&str>,
parent_id: Option<Option<i64>>,
status: Option<&str>,
complexity: Option<i32>,
priority: Option<i32>,
) -> Result<Task>
pub async fn update_task( &self, id: i64, name: Option<&str>, spec: Option<&str>, parent_id: Option<Option<i64>>, status: Option<&str>, complexity: Option<i32>, priority: Option<i32>, ) -> Result<Task>
Update a task
Sourcepub async fn delete_task(&self, id: i64) -> Result<()>
pub async fn delete_task(&self, id: i64) -> Result<()>
Delete a task
Sourcepub async fn find_tasks(
&self,
status: Option<&str>,
parent_id: Option<Option<i64>>,
) -> Result<Vec<Task>>
pub async fn find_tasks( &self, status: Option<&str>, parent_id: Option<Option<i64>>, ) -> Result<Vec<Task>>
Find tasks with optional filters
Sourcepub async fn search_tasks(&self, query: &str) -> Result<Vec<TaskSearchResult>>
pub async fn search_tasks(&self, query: &str) -> Result<Vec<TaskSearchResult>>
Search tasks using full-text search (FTS5) Returns tasks with match snippets showing highlighted keywords
Sourcepub async fn start_task(
&self,
id: i64,
with_events: bool,
) -> Result<TaskWithEvents>
pub async fn start_task( &self, id: i64, with_events: bool, ) -> Result<TaskWithEvents>
Start a task (atomic: update status + set current)
Sourcepub async fn done_task(&self) -> Result<DoneTaskResponse>
pub async fn done_task(&self) -> Result<DoneTaskResponse>
Complete the current focused task (atomic: check children + update status + clear current) This command only operates on the current_task_id. Prerequisites: A task must be set as current
Sourcepub async fn switch_to_task(&self, id: i64) -> Result<SwitchTaskResponse>
pub async fn switch_to_task(&self, id: i64) -> Result<SwitchTaskResponse>
Switch to a specific task (atomic: update status to doing + set as current) If the task is not in ‘doing’ status, it will be transitioned to ‘doing’ Returns response with previous task info (if any) and current task info
Sourcepub async fn spawn_subtask(
&self,
name: &str,
spec: Option<&str>,
) -> Result<SpawnSubtaskResponse>
pub async fn spawn_subtask( &self, name: &str, spec: Option<&str>, ) -> Result<SpawnSubtaskResponse>
Create a subtask under the current task and switch to it (atomic operation) Returns error if there is no current task Returns response with subtask info and parent task info
Sourcepub async fn pick_next_tasks(
&self,
max_count: usize,
capacity_limit: usize,
) -> Result<Vec<Task>>
pub async fn pick_next_tasks( &self, max_count: usize, capacity_limit: usize, ) -> Result<Vec<Task>>
Intelligently pick tasks from ‘todo’ and transition them to ‘doing’ Returns tasks that were successfully transitioned
§Arguments
max_count- Maximum number of tasks to pickcapacity_limit- Maximum total number of tasks allowed in ‘doing’ status
§Logic
- Check current ‘doing’ task count
- Calculate available capacity
- Select tasks from ‘todo’ (prioritized by: priority DESC, complexity ASC)
- Transition selected tasks to ‘doing’
Sourcepub async fn pick_next(&self) -> Result<PickNextResponse>
pub async fn pick_next(&self) -> Result<PickNextResponse>
Intelligently recommend the next task to work on based on context-aware priority model.
Priority logic:
- First priority: Subtasks of the current focused task (depth-first)
- Second priority: Top-level tasks (breadth-first)
- No recommendation: Return appropriate empty state
This command does NOT modify task status.
Auto Trait Implementations§
impl<'a> Freeze for TaskManager<'a>
impl<'a> !RefUnwindSafe for TaskManager<'a>
impl<'a> Send for TaskManager<'a>
impl<'a> Sync for TaskManager<'a>
impl<'a> Unpin for TaskManager<'a>
impl<'a> !UnwindSafe for TaskManager<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more