todo

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

SPDX-License-Identifier: MIT Purpose: sin-code todo hook — manage pre/post event shell commands.

SPDX-License-Identifier: MIT Purpose: todo event hooks — pre/post shell command execution, TOML config, timeout, env-var injection. Inspired by beads (gastownhall/beads).

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("todo: not found")
	ErrInvalid  = errors.New("todo: invalid argument")
)
View Source
var TodoCmd = &cobra.Command{
	Use:          "todo",
	Short:        "Issue tracker with dependencies, audit log, and project namespaces",
	Long:         "todo is the SIN-Code issue tracker, matching the UX of `bd` and opencode's todo system. Backed by bbolt for durability, append-only audit log for history, and project namespaces for multi-repo work.\n\nCommon workflows:\n  sin-code todo add --title \"...\" --priority P0 --type feature\n  sin-code todo ready\n  sin-code todo dep add st-1234 st-5678 --type blocks\n  sin-code todo compact --older-than 30d",
	SilenceUsage: true,
}

Functions

func DefaultHooksPath

func DefaultHooksPath() string

func GenerateID

func GenerateID() string

func IsValidID

func IsValidID(id string) bool

Types

type AuditEntry

type AuditEntry struct {
	ID        string    `json:"id"`
	TodoID    string    `json:"todo_id"`
	Timestamp time.Time `json:"timestamp"`
	Actor     string    `json:"actor"`
	Action    string    `json:"action"`
	From      string    `json:"from,omitempty"`
	To        string    `json:"to,omitempty"`
	Note      string    `json:"note,omitempty"`
}

type CompactOptions

type CompactOptions struct {
	OlderThan    time.Duration
	OnlyStatuses []Status
	DryRun       bool
}

type CompactResult

type CompactResult struct {
	Compacted int      `json:"compacted"`
	Skipped   int      `json:"skipped"`
	IDs       []string `json:"ids,omitempty"`
}

type DepType

type DepType string
const (
	DepBlocks         DepType = "blocks"
	DepParentChild    DepType = "parent-child"
	DepRelated        DepType = "related"
	DepDiscoveredFrom DepType = "discovered-from"
	DepDuplicates     DepType = "duplicates"
	DepSupersedes     DepType = "supersedes"
)

func (DepType) IsBlocking

func (d DepType) IsBlocking() bool

func (DepType) Valid

func (d DepType) Valid() bool

type Dependency

type Dependency struct {
	From string  `json:"from"`
	To   string  `json:"to"`
	Type DepType `json:"type"`
}

type Hook

type Hook struct {
	Command string        `toml:"command"`
	Timeout time.Duration `toml:"timeout"`
	OnError string        `toml:"on_error"`
}

func (Hook) Validate

func (h Hook) Validate() error

type HookConfig

type HookConfig struct {
	Hooks map[HookEvent][]Hook `toml:"hooks"`
	// contains filtered or unexported fields
}

func LoadHooksConfig

func LoadHooksConfig(path string) (*HookConfig, error)

func (*HookConfig) Add

func (c *HookConfig) Add(event HookEvent, h Hook) error

func (*HookConfig) Fire

func (c *HookConfig) Fire(ctx HookContext) []HookResult

func (*HookConfig) Get

func (c *HookConfig) Get(event HookEvent) []Hook

func (*HookConfig) Path

func (c *HookConfig) Path() string

func (*HookConfig) Remove

func (c *HookConfig) Remove(event HookEvent, index int) error

type HookContext

type HookContext struct {
	Event HookEvent
	Todo  *Todo
	From  string
	To    string
	Note  string
	Actor string
}

type HookEvent

type HookEvent string
const (
	EventPreAdd       HookEvent = "pre_add"
	EventPostAdd      HookEvent = "post_add"
	EventPreUpdate    HookEvent = "pre_update"
	EventPostUpdate   HookEvent = "post_update"
	EventPreClaim     HookEvent = "pre_claim"
	EventPostClaim    HookEvent = "post_claim"
	EventPreComplete  HookEvent = "pre_complete"
	EventPostComplete HookEvent = "post_complete"
	EventPreCancel    HookEvent = "pre_cancel"
	EventPostCancel   HookEvent = "post_cancel"
	EventPreDelete    HookEvent = "pre_delete"
	EventPostDelete   HookEvent = "post_delete"
	EventPreDepAdd    HookEvent = "pre_dep_add"
	EventPostDepAdd   HookEvent = "post_dep_add"
)

func AllEvents

func AllEvents() []HookEvent

func (HookEvent) Valid

func (e HookEvent) Valid() bool

type HookResult

type HookResult struct {
	Hook    Hook
	Event   HookEvent
	Stdout  string
	Stderr  string
	Err     error
	Elapsed time.Duration
}

func (HookResult) OK

func (r HookResult) OK() bool

type ListFilter

type ListFilter struct {
	Status   Status
	Priority Priority
	Type     TodoType
	Tag      string
	Assignee string
	Project  string
	Search   string
}

type Memory

type Memory struct {
	ID        string    `json:"id"`
	Insight   string    `json:"insight"`
	CreatedAt time.Time `json:"created_at"`
	Actor     string    `json:"actor"`
}

type Priority

type Priority string
const (
	PriorityP0 Priority = "P0"
	PriorityP1 Priority = "P1"
	PriorityP2 Priority = "P2"
	PriorityP3 Priority = "P3"
)

func (Priority) Rank

func (p Priority) Rank() int

func (Priority) Valid

func (p Priority) Valid() bool

type Stats

type Stats struct {
	Total      int            `json:"total"`
	ByStatus   map[string]int `json:"by_status"`
	ByPriority map[string]int `json:"by_priority"`
	ByType     map[string]int `json:"by_type"`
	ByAssignee map[string]int `json:"by_assignee"`
	Ready      int            `json:"ready"`
	Blocked    int            `json:"blocked"`
}

type Status

type Status string
const (
	StatusOpen       Status = "open"
	StatusInProgress Status = "in_progress"
	StatusDone       Status = "done"
	StatusCancelled  Status = "cancelled"
	StatusBlocked    Status = "blocked"
)

func (Status) Valid

func (s Status) Valid() bool

type Store

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

func Open

func Open(path string) (*Store, error)

func (*Store) Add

func (s *Store) Add(t *Todo) error

func (*Store) AddDep

func (s *Store) AddDep(dep Dependency) error

func (*Store) AddMemory

func (s *Store) AddMemory(m *Memory) error

func (*Store) AppendAudit

func (s *Store) AppendAudit(e AuditEntry) error

func (*Store) Blocked

func (s *Store) Blocked() ([]*Todo, error)

func (*Store) BlockingDepsOf

func (s *Store) BlockingDepsOf(id string) ([]Dependency, error)

func (*Store) ByProject

func (s *Store) ByProject(project string) ([]*Todo, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Compact

func (s *Store) Compact(opts CompactOptions) (*CompactResult, error)

func (*Store) ComputeStats

func (s *Store) ComputeStats() (*Stats, error)

func (*Store) CountAudit

func (s *Store) CountAudit() (int, error)

func (*Store) DB

func (s *Store) DB() *bolt.DB

func (*Store) Delete

func (s *Store) Delete(id string, hard bool) error

func (*Store) DependencyTree

func (s *Store) DependencyTree(root string, maxDepth int) (map[string][]Dependency, error)

func (*Store) Get

func (s *Store) Get(id string) (*Todo, error)

func (*Store) GetDeps

func (s *Store) GetDeps(id string) ([]Dependency, error)

func (*Store) GetMeta

func (s *Store) GetMeta(key string) (string, error)

func (*Store) GetReverseDeps

func (s *Store) GetReverseDeps(id string) ([]Dependency, error)

func (*Store) IndexKeys

func (s *Store) IndexKeys(bucketName, key string) ([]string, error)

func (*Store) List

func (s *Store) List() ([]*Todo, error)

func (*Store) ListAudit

func (s *Store) ListAudit(todoID string) ([]*AuditEntry, error)

func (*Store) ListFiltered

func (s *Store) ListFiltered(f ListFilter) ([]*Todo, error)

func (*Store) ListMemories

func (s *Store) ListMemories() ([]*Memory, error)

func (*Store) Mine

func (s *Store) Mine(assignee string) ([]*Todo, error)

func (*Store) Path

func (s *Store) Path() string

func (*Store) Ready

func (s *Store) Ready() ([]*Todo, error)

func (*Store) RemoveDep

func (s *Store) RemoveDep(from, to string) error

func (*Store) Search

func (s *Store) Search(query string) ([]*Todo, error)

func (*Store) SetMeta

func (s *Store) SetMeta(key, value string) error

func (*Store) Update

func (s *Store) Update(t *Todo) error

type Todo

type Todo struct {
	ID          string     `json:"id"`
	Title       string     `json:"title"`
	Description string     `json:"description,omitempty"`
	Status      Status     `json:"status"`
	Priority    Priority   `json:"priority"`
	Type        TodoType   `json:"type"`
	Tags        []string   `json:"tags,omitempty"`
	Assignee    string     `json:"assignee,omitempty"`
	Parent      string     `json:"parent,omitempty"`
	ExternalRef string     `json:"external_ref,omitempty"`
	Project     string     `json:"project,omitempty"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
	ClosedAt    *time.Time `json:"closed_at,omitempty"`
	DueAt       *time.Time `json:"due_at,omitempty"`
	Estimate    int        `json:"estimate_minutes,omitempty"`
	Notes       string     `json:"notes,omitempty"`
	Compacted   bool       `json:"compacted,omitempty"`
	Summary     string     `json:"summary,omitempty"`
}

func (*Todo) IsClosed

func (t *Todo) IsClosed() bool

func (*Todo) IsOpen

func (t *Todo) IsOpen() bool

type TodoType

type TodoType string
const (
	TypeTask     TodoType = "task"
	TypeBug      TodoType = "bug"
	TypeFeature  TodoType = "feature"
	TypeChore    TodoType = "chore"
	TypeEpic     TodoType = "epic"
	TypeQuestion TodoType = "question"
)

func (TodoType) Valid

func (t TodoType) Valid() bool

Jump to

Keyboard shortcuts

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