TaskManager

Struct TaskManager 

Source
pub struct TaskManager<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> TaskManager<'a>

Source

pub fn new(pool: &'a SqlitePool) -> Self

Source

pub async fn add_task( &self, name: &str, spec: Option<&str>, parent_id: Option<i64>, ) -> Result<Task>

Add a new task

Source

pub async fn get_task(&self, id: i64) -> Result<Task>

Get a task by ID

Source

pub async fn get_task_with_events(&self, id: i64) -> Result<TaskWithEvents>

Get a task with events summary

Source

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

Source

pub async fn delete_task(&self, id: i64) -> Result<()>

Delete a task

Source

pub async fn find_tasks( &self, status: Option<&str>, parent_id: Option<Option<i64>>, ) -> Result<Vec<Task>>

Find tasks with optional filters

Source

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

Source

pub async fn start_task( &self, id: i64, with_events: bool, ) -> Result<TaskWithEvents>

Start a task (atomic: update status + set current)

Source

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

Source

pub async fn switch_to_task(&self, id: i64) -> Result<TaskWithEvents>

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’

Source

pub async fn spawn_subtask( &self, name: &str, spec: Option<&str>, ) -> Result<Task>

Create a subtask under the current task and switch to it (atomic operation) Returns error if there is no current task

Source

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 pick
  • capacity_limit - Maximum total number of tasks allowed in ‘doing’ status
§Logic
  1. Check current ‘doing’ task count
  2. Calculate available capacity
  3. Select tasks from ‘todo’ (prioritized by: priority DESC, complexity ASC)
  4. Transition selected tasks to ‘doing’
Source

pub async fn pick_next(&self) -> Result<PickNextResponse>

Intelligently recommend the next task to work on based on context-aware priority model.

Priority logic:

  1. First priority: Subtasks of the current focused task (depth-first)
  2. Second priority: Top-level tasks (breadth-first)
  3. 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more