store

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFrontmatter

func ParseFrontmatter(content string) (frontmatter, body string, err error)

ParseFrontmatter extracts YAML frontmatter and body from markdown content

Types

type BurndownPoint

type BurndownPoint struct {
	Date      time.Time
	Remaining int
}

type ChangeListener

type ChangeListener func()

ChangeListener is called when the store's data changes

type InMemoryStore

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

InMemoryStore is an in-memory task repository

func NewInMemoryStore

func NewInMemoryStore() *InMemoryStore

NewInMemoryStore creates a new in-memory task store

func (*InMemoryStore) AddComment

func (s *InMemoryStore) AddComment(taskID string, comment task.Comment) bool

AddComment adds a comment to a task

func (*InMemoryStore) AddListener

func (s *InMemoryStore) AddListener(listener ChangeListener) int

AddListener registers a callback for change notifications. returns a listener ID that can be used to remove the listener.

func (*InMemoryStore) CreateTask

func (s *InMemoryStore) CreateTask(task *task.Task) error

CreateTask adds a new task to the store

func (*InMemoryStore) DeleteTask

func (s *InMemoryStore) DeleteTask(id string)

DeleteTask removes a task from the store

func (*InMemoryStore) GetAllTasks

func (s *InMemoryStore) GetAllTasks() []*task.Task

GetAllTasks returns all tasks

func (*InMemoryStore) GetAllUsers

func (s *InMemoryStore) GetAllUsers() ([]string, error)

GetAllUsers returns a placeholder user list for MemoryStore

func (*InMemoryStore) GetBacklogTasks

func (s *InMemoryStore) GetBacklogTasks() []*task.Task

GetBacklogTasks returns tasks with backlog status

func (*InMemoryStore) GetBurndown

func (s *InMemoryStore) GetBurndown() []BurndownPoint

GetBurndown returns nil for MemoryStore (no history tracking)

func (*InMemoryStore) GetCurrentUser

func (s *InMemoryStore) GetCurrentUser() (name string, email string, err error)

GetCurrentUser returns a placeholder user (MemoryStore has no git integration)

func (*InMemoryStore) GetGitOps

func (s *InMemoryStore) GetGitOps() git.GitOps

GetGitOps returns nil for in-memory store (no git operations)

func (*InMemoryStore) GetStats

func (s *InMemoryStore) GetStats() []Stat

GetStats returns placeholder statistics for the header

func (*InMemoryStore) GetTask

func (s *InMemoryStore) GetTask(id string) *task.Task

GetTask retrieves a task by ID

func (*InMemoryStore) GetTasksByStatus

func (s *InMemoryStore) GetTasksByStatus(status task.Status) []*task.Task

GetTasksByStatus returns tasks filtered by status

func (*InMemoryStore) NewTaskTemplate

func (s *InMemoryStore) NewTaskTemplate() (*task.Task, error)

NewTaskTemplate returns a new task with hardcoded defaults. MemoryStore doesn't load templates from files.

func (*InMemoryStore) Reload

func (s *InMemoryStore) Reload() error

Reload is a no-op for in-memory store (no disk backing)

func (*InMemoryStore) ReloadTask

func (s *InMemoryStore) ReloadTask(taskID string) error

ReloadTask reloads a single task (no-op for memory store)

func (*InMemoryStore) RemoveListener

func (s *InMemoryStore) RemoveListener(id int)

RemoveListener removes a previously registered listener by ID

func (*InMemoryStore) Search

func (s *InMemoryStore) Search(query string, filterFunc func(*task.Task) bool) []task.SearchResult

Search searches tasks with optional filter function (simplified in-memory version)

func (*InMemoryStore) SearchBacklog

func (s *InMemoryStore) SearchBacklog(query string) []task.SearchResult

SearchBacklog searches backlog tasks by title (case-insensitive). Returns results with Score for relevance (currently all 1.0).

func (*InMemoryStore) UpdateStatus

func (s *InMemoryStore) UpdateStatus(taskID string, newStatus task.Status) bool

UpdateStatus changes a task's status (with validation)

func (*InMemoryStore) UpdateTask

func (s *InMemoryStore) UpdateTask(task *task.Task) error

UpdateTask updates an existing task

type Stat

type Stat struct {
	Name  string
	Value string
	Order int
}

Stat represents a statistic to be displayed in the header

type StatusChange

type StatusChange struct {
	TaskID string
	From   task.Status
	To     task.Status
	At     time.Time
	Commit string
}

type Store

type Store interface {
	// AddListener registers a callback for change notifications.
	// returns a listener ID that can be used to remove the listener.
	AddListener(listener ChangeListener) int

	// RemoveListener removes a previously registered listener by ID
	RemoveListener(id int)

	// CreateTask adds a new task to the store.
	// Returns error if save fails (IO error, ErrConflict).
	CreateTask(task *task.Task) error

	// GetTask retrieves a task by ID
	GetTask(id string) *task.Task

	// UpdateTask updates an existing task.
	// Returns error if save fails (IO error, ErrConflict).
	UpdateTask(task *task.Task) error

	// UpdateStatus changes a task's status (with validation)
	UpdateStatus(taskID string, newStatus task.Status) bool

	// DeleteTask removes a task from the store
	DeleteTask(id string)

	// GetAllTasks returns all tasks
	GetAllTasks() []*task.Task

	// GetTasksByStatus returns tasks filtered by status
	GetTasksByStatus(status task.Status) []*task.Task

	// GetBacklogTasks returns tasks with backlog status
	GetBacklogTasks() []*task.Task

	// SearchBacklog searches backlog tasks by title (case-insensitive).
	// Returns results in relevance order (Score for future use).
	// Deprecated: Use Search() instead for more flexible searching.
	SearchBacklog(query string) []task.SearchResult

	// Search searches tasks with optional filter function.
	// query: case-insensitive search term (searches task titles)
	// filterFunc: optional filter function to pre-filter tasks (nil = all tasks)
	// Returns matching tasks sorted by ID with relevance scores.
	Search(query string, filterFunc func(*task.Task) bool) []task.SearchResult

	// AddComment adds a comment to a task
	AddComment(taskID string, comment task.Comment) bool

	// Reload reloads all data from the backing store
	Reload() error

	// ReloadTask reloads a single task from disk by ID
	ReloadTask(taskID string) error

	// GetCurrentUser returns the current git user name and email
	GetCurrentUser() (name string, email string, err error)

	// GetStats returns statistics for the header (user, branch, etc.)
	GetStats() []Stat

	// GetBurndown returns the burndown chart data
	GetBurndown() []BurndownPoint

	// GetAllUsers returns list of all git users for assignee selection
	GetAllUsers() ([]string, error)

	// NewTaskTemplate returns a new task populated with template defaults from new.md.
	// The task will have an auto-generated ID, git author, and all fields from the template.
	NewTaskTemplate() (*task.Task, error)
}

Store is the interface for task storage engines. Implementations must be thread-safe and notify listeners on changes.

type TaskHistory

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

func NewTaskHistory

func NewTaskHistory(taskDir string, gitOps git.GitOps) *TaskHistory

func (*TaskHistory) Build

func (h *TaskHistory) Build() error

func (*TaskHistory) Burndown

func (h *TaskHistory) Burndown() []BurndownPoint

func (*TaskHistory) Transitions

func (h *TaskHistory) Transitions() map[string][]StatusChange

Directories

Path Synopsis
internal
git

Jump to

Keyboard shortcuts

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