Manages TODO lists for z3ed agent task execution. More...
#include <todo_manager.h>
Public Member Functions | |
TodoManager () | |
TodoManager (const std::string &data_dir) | |
absl::Status | Initialize () |
Initialize the TODO manager and load persisted data. | |
absl::StatusOr< TodoItem > | CreateTodo (const std::string &description, const std::string &category="", int priority=0) |
Create a new TODO item. | |
absl::Status | UpdateTodo (const std::string &id, const TodoItem &item) |
Update an existing TODO item. | |
absl::Status | UpdateStatus (const std::string &id, TodoItem::Status status) |
Update TODO status. | |
absl::StatusOr< TodoItem > | GetTodo (const std::string &id) const |
Get a TODO item by ID. | |
std::vector< TodoItem > | GetAllTodos () const |
Get all TODO items. | |
std::vector< TodoItem > | GetTodosByStatus (TodoItem::Status status) const |
Get TODO items by status. | |
std::vector< TodoItem > | GetTodosByCategory (const std::string &category) const |
Get TODO items by category. | |
absl::StatusOr< TodoItem > | GetNextActionableTodo () const |
Get the next actionable TODO (respecting dependencies and priority) | |
absl::Status | DeleteTodo (const std::string &id) |
Delete a TODO item. | |
absl::Status | ClearCompleted () |
Clear all completed TODOs. | |
absl::Status | Save () |
Save TODOs to persistent storage. | |
absl::Status | Load () |
Load TODOs from persistent storage. | |
absl::StatusOr< std::vector< TodoItem > > | GenerateExecutionPlan () const |
Generate an execution plan based on dependencies. | |
std::string | ExportAsJson () const |
Export TODOs as JSON string. | |
absl::Status | ImportFromJson (const std::string &json) |
Import TODOs from JSON string. | |
Private Member Functions | |
std::string | GenerateId () |
std::string | GetTimestamp () const |
bool | CanExecute (const TodoItem &item) const |
Private Attributes | |
std::string | data_dir_ |
std::string | todos_file_ |
std::vector< TodoItem > | todos_ |
int | next_id_ = 1 |
Manages TODO lists for z3ed agent task execution.
Enables the AI agent to:
Definition at line 53 of file todo_manager.h.
yaze::cli::agent::TodoManager::TodoManager | ( | ) |
Definition at line 53 of file todo_manager.cc.
References data_dir_, yaze::util::PlatformPaths::GetAppDataSubdirectory(), and todos_file_.
|
explicit |
Definition at line 63 of file todo_manager.cc.
absl::Status yaze::cli::agent::TodoManager::Initialize | ( | ) |
Initialize the TODO manager and load persisted data.
Definition at line 67 of file todo_manager.cc.
References data_dir_, yaze::util::PlatformPaths::EnsureDirectoryExists(), yaze::util::PlatformPaths::Exists(), Load(), and todos_file_.
Referenced by yaze::cli::tui::ChatTUI::ChatTUI(), yaze::cli::handlers::anonymous_namespace{todo_commands.cc}::GetTodoManager(), and yaze::cli::anonymous_namespace{tui.cc}::TodoManagerComponent().
absl::StatusOr< TodoItem > yaze::cli::agent::TodoManager::CreateTodo | ( | const std::string & | description, |
const std::string & | category = "" , |
||
int | priority = 0 |
||
) |
Create a new TODO item.
Definition at line 89 of file todo_manager.cc.
References yaze::cli::agent::TodoItem::category, yaze::cli::agent::TodoItem::created_at, yaze::cli::agent::TodoItem::description, GenerateId(), GetTimestamp(), yaze::cli::agent::TodoItem::id, yaze::cli::agent::TodoItem::PENDING, yaze::cli::agent::TodoItem::priority, Save(), yaze::cli::agent::TodoItem::status, todos_, and yaze::cli::agent::TodoItem::updated_at.
absl::Status yaze::cli::agent::TodoManager::UpdateTodo | ( | const std::string & | id, |
const TodoItem & | item | ||
) |
Update an existing TODO item.
Definition at line 113 of file todo_manager.cc.
References GetTimestamp(), yaze::cli::agent::TodoItem::id, Save(), todos_, and yaze::cli::agent::TodoItem::updated_at.
absl::Status yaze::cli::agent::TodoManager::UpdateStatus | ( | const std::string & | id, |
TodoItem::Status | status | ||
) |
Update TODO status.
Definition at line 129 of file todo_manager.cc.
References GetTimestamp(), Save(), and todos_.
absl::StatusOr< TodoItem > yaze::cli::agent::TodoManager::GetTodo | ( | const std::string & | id | ) | const |
Get a TODO item by ID.
Definition at line 143 of file todo_manager.cc.
References todos_.
Referenced by CanExecute().
std::vector< TodoItem > yaze::cli::agent::TodoManager::GetAllTodos | ( | ) | const |
Get all TODO items.
Definition at line 154 of file todo_manager.cc.
References todos_.
Referenced by yaze::cli::tui::ChatTUI::CreateTodoPopup(), and yaze::cli::anonymous_namespace{tui.cc}::TodoManagerComponent().
std::vector< TodoItem > yaze::cli::agent::TodoManager::GetTodosByStatus | ( | TodoItem::Status | status | ) | const |
std::vector< TodoItem > yaze::cli::agent::TodoManager::GetTodosByCategory | ( | const std::string & | category | ) | const |
absl::StatusOr< TodoItem > yaze::cli::agent::TodoManager::GetNextActionableTodo | ( | ) | const |
Get the next actionable TODO (respecting dependencies and priority)
Definition at line 186 of file todo_manager.cc.
References yaze::cli::agent::TodoItem::BLOCKED, CanExecute(), yaze::cli::agent::TodoItem::PENDING, and todos_.
absl::Status yaze::cli::agent::TodoManager::DeleteTodo | ( | const std::string & | id | ) |
Delete a TODO item.
Definition at line 210 of file todo_manager.cc.
References Save(), and todos_.
absl::Status yaze::cli::agent::TodoManager::ClearCompleted | ( | ) |
Clear all completed TODOs.
Definition at line 222 of file todo_manager.cc.
References Save(), and todos_.
absl::Status yaze::cli::agent::TodoManager::Save | ( | ) |
Save TODOs to persistent storage.
Definition at line 283 of file todo_manager.cc.
References todos_, and todos_file_.
Referenced by ClearCompleted(), CreateTodo(), DeleteTodo(), ImportFromJson(), UpdateStatus(), and UpdateTodo().
absl::Status yaze::cli::agent::TodoManager::Load | ( | ) |
Load TODOs from persistent storage.
Definition at line 316 of file todo_manager.cc.
References yaze::cli::agent::TodoItem::category, yaze::cli::agent::TodoItem::created_at, yaze::cli::agent::TodoItem::dependencies, yaze::cli::agent::TodoItem::description, yaze::cli::agent::TodoItem::id, next_id_, yaze::cli::agent::TodoItem::notes, yaze::cli::agent::TodoItem::priority, yaze::cli::agent::TodoItem::status, yaze::cli::agent::TodoItem::StringToStatus(), todos_, todos_file_, yaze::cli::agent::TodoItem::tools_needed, and yaze::cli::agent::TodoItem::updated_at.
Referenced by Initialize().
absl::StatusOr< std::vector< TodoItem > > yaze::cli::agent::TodoManager::GenerateExecutionPlan | ( | ) | const |
Generate an execution plan based on dependencies.
Definition at line 231 of file todo_manager.cc.
References todos_.
std::string yaze::cli::agent::TodoManager::ExportAsJson | ( | ) | const |
absl::Status yaze::cli::agent::TodoManager::ImportFromJson | ( | const std::string & | json | ) |
Import TODOs from JSON string.
Definition at line 389 of file todo_manager.cc.
References yaze::cli::agent::TodoItem::category, yaze::cli::agent::TodoItem::created_at, yaze::cli::agent::TodoItem::dependencies, yaze::cli::agent::TodoItem::description, yaze::cli::agent::TodoItem::id, yaze::cli::agent::TodoItem::notes, yaze::cli::agent::TodoItem::priority, Save(), yaze::cli::agent::TodoItem::status, yaze::cli::agent::TodoItem::StringToStatus(), todos_, yaze::cli::agent::TodoItem::tools_needed, and yaze::cli::agent::TodoItem::updated_at.
|
private |
|
private |
Definition at line 85 of file todo_manager.cc.
Referenced by CreateTodo(), UpdateStatus(), and UpdateTodo().
|
private |
Definition at line 172 of file todo_manager.cc.
References yaze::cli::agent::TodoItem::COMPLETED, yaze::cli::agent::TodoItem::dependencies, and GetTodo().
Referenced by GetNextActionableTodo().
|
private |
Definition at line 142 of file todo_manager.h.
Referenced by Initialize(), and TodoManager().
|
private |
Definition at line 143 of file todo_manager.h.
Referenced by Initialize(), Load(), Save(), and TodoManager().
|
private |
Definition at line 144 of file todo_manager.h.
Referenced by ClearCompleted(), CreateTodo(), DeleteTodo(), ExportAsJson(), GenerateExecutionPlan(), GetAllTodos(), GetNextActionableTodo(), GetTodo(), GetTodosByCategory(), GetTodosByStatus(), ImportFromJson(), Load(), Save(), UpdateStatus(), and UpdateTodo().
|
private |
Definition at line 145 of file todo_manager.h.
Referenced by GenerateId(), and Load().