task

package
v1.3.29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidStatus

func IsValidStatus(s string) bool

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager tracks tasks within a single session (in-memory, no persistence).

func NewManager

func NewManager() *Manager

NewManager creates an empty task manager.

func (*Manager) Create

func (m *Manager) Create(subject, description, activeForm string, metadata map[string]string) Task

Create adds a new task and returns a snapshot.

func (*Manager) Delete

func (m *Manager) Delete(taskID string) bool

Delete removes a task by ID and cleans up dangling block references in other tasks.

func (*Manager) Get

func (m *Manager) Get(taskID string) (Task, bool)

Get retrieves a task by ID. Returns the snapshot and whether it was found.

func (*Manager) List

func (m *Manager) List() []Task

List returns snapshots of all tasks.

func (*Manager) Update

func (m *Manager) Update(taskID string, opts UpdateOptions) (Task, error)

Update modifies a task according to opts. Returns the updated snapshot.

type Task

type Task struct {
	ID          string
	Subject     string
	Description string
	ActiveForm  string
	Status      TaskStatus
	Owner       string
	Blocks      []string
	BlockedBy   []string
	Metadata    map[string]string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

Task represents a single tracked task in the session.

func (*Task) Snapshot

func (t *Task) Snapshot() Task

Snapshot returns a copy of the task safe for external use.

type TaskStatus

type TaskStatus string
const (
	StatusPending    TaskStatus = "pending"
	StatusInProgress TaskStatus = "in_progress"
	StatusCompleted  TaskStatus = "completed"
)

func ValidStatuses

func ValidStatuses() []TaskStatus

type UpdateOptions

type UpdateOptions struct {
	Status         *TaskStatus
	ExpectedStatus *TaskStatus // if set, the update fails if current status doesn't match
	Subject        *string
	Description    *string
	ActiveForm     *string
	Owner          *string
	AddBlocks      []string
	AddBlockedBy   []string
	Metadata       map[string]string // merged; nil values are ignored
}

UpdateOptions specifies which fields to change on a task.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL