Documentation
¶
Overview ¶
Package tasks provides a standalone task tracking system. It can be used independently or as part of plan mode.
Index ¶
- func NewTool(store *Store) core.Tool
- type State
- type Store
- func (s *Store) AllDone() bool
- func (s *Store) Create(title, description string, dependsOn []int) Task
- func (s *Store) Get(id int) (Task, bool)
- func (s *Store) GetWidgetMode() WidgetMode
- func (s *Store) MarkDone(id int) bool
- func (s *Store) MarkDoneErr(id int) error
- func (s *Store) Progress() (done, total int)
- func (s *Store) Reset()
- func (s *Store) RestoreFromMetadata(meta map[string]any)
- func (s *Store) RestoreState(st State)
- func (s *Store) SaveState() State
- func (s *Store) SaveToMetadata() map[string]any
- func (s *Store) SetWidgetMode(mode WidgetMode)
- func (s *Store) Tasks() []Task
- func (s *Store) Update(id int, title, description *string, dependsOn *[]int) bool
- type Task
- type WidgetMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type State ¶
type State struct {
Tasks []Task `json:"tasks"`
NextTaskID int `json:"next_task_id"`
WidgetMode WidgetMode `json:"widget_mode,omitempty"`
}
State is the serializable snapshot of the task store.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages tasks with thread-safe access.
func (*Store) AllDone ¶
AllDone returns true if all tasks are complete and there's at least one task.
func (*Store) GetWidgetMode ¶
func (s *Store) GetWidgetMode() WidgetMode
WidgetMode returns the current widget display mode.
func (*Store) MarkDoneErr ¶
MarkDoneErr marks a task as done. Returns an error if the task is not found.
func (*Store) RestoreFromMetadata ¶
RestoreFromMetadata loads task state from session.Metadata.
func (*Store) RestoreState ¶
RestoreState loads state from a saved snapshot.
func (*Store) SaveToMetadata ¶
SaveToMetadata serializes task state for session.Metadata.
func (*Store) SetWidgetMode ¶
func (s *Store) SetWidgetMode(mode WidgetMode)
SetWidgetMode changes the widget display mode.
type Task ¶
type Task struct {
ID int `json:"id"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Status string `json:"status"` // "pending", "in_progress", "done"
DependsOn []int `json:"depends_on,omitempty"`
CreatedAt int64 `json:"created_at,omitempty"` // unix millis
CompletedAt int64 `json:"completed_at,omitempty"` // unix millis
}
Task tracks a unit of work.
type WidgetMode ¶
type WidgetMode string
WidgetMode controls how the task widget is displayed.
const ( WidgetAll WidgetMode = "all" WidgetCurrent WidgetMode = "current" WidgetHidden WidgetMode = "hidden" )