data

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultColors = []string{
	"#8b5cf6",
	"#3b82f6",
	"#10b981",
	"#f59e0b",
	"#ef4444",
	"#ec4899",
	"#06b6d4",
	"#84cc16",
}

DefaultColors provides preset colors for groups

Functions

func GetTaskGroup

func GetTaskGroup(task Task) string

GetTaskGroup returns the group name from task metadata

func SetTaskGroup

func SetTaskGroup(task *Task, group string)

SetTaskGroup sets the group name in task metadata

func StatusIcon

func StatusIcon(status string) string

StatusIcon returns the icon for a task status

Types

type GroupStore

type GroupStore struct {
	ProjectName string
	Groups      []TaskGroup
	// contains filtered or unexported fields
}

GroupStore handles group persistence

func LoadGroups

func LoadGroups(projectName string) (*GroupStore, error)

LoadGroups loads groups from a project's _groups.json

func NewGroupStoreForTest added in v1.2.0

func NewGroupStoreForTest(dir string, groups []TaskGroup) (*GroupStore, error)

NewGroupStoreForTest creates a GroupStore for testing with a custom directory

func (*GroupStore) AddGroup

func (s *GroupStore) AddGroup(group TaskGroup)

AddGroup adds a new group

func (*GroupStore) DeleteGroup

func (s *GroupStore) DeleteGroup(name string) bool

DeleteGroup removes a group by name

func (*GroupStore) EnsureGroupExists

func (s *GroupStore) EnsureGroupExists(name string)

EnsureGroupExists creates a group if it doesn't exist

func (*GroupStore) GetGroup

func (s *GroupStore) GetGroup(name string) *TaskGroup

GetGroup returns a group by name

func (*GroupStore) GetGroupColor

func (s *GroupStore) GetGroupColor(name string) string

GetGroupColor returns the color for a group name

func (*GroupStore) GetGroupNames

func (s *GroupStore) GetGroupNames() []string

GetGroupNames returns just the group names in order

func (*GroupStore) MoveGroupDown

func (s *GroupStore) MoveGroupDown(name string) bool

MoveGroupDown moves a group down in order

func (*GroupStore) MoveGroupUp

func (s *GroupStore) MoveGroupUp(name string) bool

MoveGroupUp moves a group up in order

func (*GroupStore) NeedsReload

func (s *GroupStore) NeedsReload() bool

NeedsReload checks if the groups file has been modified since last load

func (*GroupStore) Save

func (s *GroupStore) Save() error

Save saves groups to the project's _groups.json

func (*GroupStore) UpdateGroup

func (s *GroupStore) UpdateGroup(name string, updated TaskGroup) bool

UpdateGroup updates an existing group

type Project

type Project struct {
	Name      string
	TaskCount int
}

Project represents a project with task count

func ListProjects

func ListProjects() ([]Project, error)

ListProjects returns all projects in the tasks directory

type Task

type Task struct {
	ID          string                 `json:"id"`
	Subject     string                 `json:"subject"`
	Description string                 `json:"description"`
	ActiveForm  string                 `json:"activeForm,omitempty"`
	Status      string                 `json:"status"` // pending, in_progress, completed
	Blocks      []string               `json:"blocks"`
	BlockedBy   []string               `json:"blockedBy"`
	Owner       string                 `json:"owner,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

Task represents a task item

type TaskGroup

type TaskGroup struct {
	Name  string `json:"name"`
	Order int    `json:"order"`
	Color string `json:"color"`
}

TaskGroup represents a task group with styling

type TaskStore

type TaskStore struct {
	ProjectName string
	Tasks       []Task
	// contains filtered or unexported fields
}

TaskStore handles task persistence

func LoadTasks

func LoadTasks(projectName string) (*TaskStore, error)

LoadTasks loads tasks from individual JSON files in the project directory

func NewTaskStoreForTest added in v1.3.0

func NewTaskStoreForTest(dir string, tasks []Task) (*TaskStore, error)

NewTaskStoreForTest creates a TaskStore for testing with a custom directory

func (*TaskStore) AddTask

func (s *TaskStore) AddTask(task Task) string

AddTask adds a new task and returns the assigned ID

func (*TaskStore) DeleteTask

func (s *TaskStore) DeleteTask(id string) error

DeleteTask removes a task by ID

func (*TaskStore) GetAllGroups

func (s *TaskStore) GetAllGroups() []string

GetAllGroups returns all unique group names from tasks

func (*TaskStore) GetTask

func (s *TaskStore) GetTask(id string) *Task

GetTask returns a task by ID

func (*TaskStore) GetTasksByGroup

func (s *TaskStore) GetTasksByGroup(group string) []Task

GetTasksByGroup returns tasks filtered by group (from metadata)

func (*TaskStore) GetTasksByStatus

func (s *TaskStore) GetTasksByStatus(status string) []Task

GetTasksByStatus returns tasks filtered by status

func (*TaskStore) NeedsReload

func (s *TaskStore) NeedsReload() bool

NeedsReload checks if the project directory has been modified since last load

func (*TaskStore) Save

func (s *TaskStore) Save() error

Save saves all tasks to individual JSON files

func (*TaskStore) SearchTasks

func (s *TaskStore) SearchTasks(query string) []Task

SearchTasks returns tasks matching the search query in subject or description

func (*TaskStore) UpdateTask

func (s *TaskStore) UpdateTask(task Task) error

UpdateTask updates an existing task

Jump to

Keyboard shortcuts

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