task

package
v0.0.0-...-5a29e4d Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package task provides task management via Beads.

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("task",
	fx.Provide(
		func() *BeadsTracker {
			return NewBeadsTracker("")
		},
	),
)

Module is the Fx module for task management.

Functions

This section is empty.

Types

type AcceptanceCriterion

type AcceptanceCriterion struct {
	ID          string   `json:"id"`
	Text        string   `json:"text"`
	VerifyHints []string `json:"verify_hints,omitempty"`
}

AcceptanceCriterion describes a single acceptance criterion for a task.

type BeadsIssue

type BeadsIssue struct {
	ID                 string   `json:"id"`
	Type               string   `json:"type"`
	IssueType          string   `json:"issue_type"`
	ParentID           string   `json:"parent,omitempty"`
	Title              string   `json:"title"`
	Description        string   `json:"description"`
	AcceptanceCriteria string   `json:"acceptance_criteria"`
	Status             string   `json:"status"` // open, in_progress, closed, etc.
	Priority           int      `json:"priority"`
	Assignee           string   `json:"assignee"`
	Owner              string   `json:"owner"`
	Labels             []string `json:"labels"`
	Notes              string   `json:"notes"`
	CreatedAt          string   `json:"created_at"`
	UpdatedAt          string   `json:"updated_at"`
	ExternalRef        string   `json:"external_ref,omitempty"`
}

BeadsIssue represents the JSON structure of a beads issue.

type BeadsTracker

type BeadsTracker struct {
	// Optional: path to bd executable. If empty, uses "bd" from PATH.
	BinPath string
	// Optional: working directory used for bd execution. If empty, uses ".".
	WorkingDir string
}

BeadsTracker implements Tracker using the beads CLI tool.

func NewBeadsTracker

func NewBeadsTracker(binPath string) *BeadsTracker

NewBeadsTracker creates a new beads tracker.

func (*BeadsTracker) Add

func (t *BeadsTracker) Add(ctx context.Context, title, goal string, criteria []AcceptanceCriterion, runID *string) (string, error)

Add creates a task via bd create.

func (*BeadsTracker) AddDependency

func (t *BeadsTracker) AddDependency(ctx context.Context, taskID, dependsOnID string) error

AddDependency adds a dependency.

func (*BeadsTracker) AddEpic

func (t *BeadsTracker) AddEpic(ctx context.Context, title, goal string) (string, error)

AddEpic creates an epic via bd create.

func (*BeadsTracker) AddFeature

func (t *BeadsTracker) AddFeature(ctx context.Context, epicID, title, goal string) (string, error)

AddFeature creates a feature via bd create with parent epic.

func (*BeadsTracker) AddFollowUp

func (t *BeadsTracker) AddFollowUp(ctx context.Context, parentID, title, goal string, criteria []AcceptanceCriterion) (string, error)

AddFollowUp creates a follow-up task with parent context.

func (*BeadsTracker) AddLabel

func (t *BeadsTracker) AddLabel(ctx context.Context, id string, label string) error

AddLabel adds a label to a task.

func (t *BeadsTracker) AddRelatedLink(ctx context.Context, id1, id2 string) error

AddRelatedLink creates a bidirectional relates_to link between two issues.

func (*BeadsTracker) AddTaskDetailed

func (t *BeadsTracker) AddTaskDetailed(
	ctx context.Context,
	parentID, title, goal string,
	criteria []AcceptanceCriterion,
	runID *string,
) (string, error)

AddTaskDetailed creates a task via bd create and optionally sets its parent.

func (*BeadsTracker) Children

func (t *BeadsTracker) Children(ctx context.Context, parentID string) ([]Task, error)

Children lists child issues for a given parent.

func (*BeadsTracker) CloseWithReason

func (t *BeadsTracker) CloseWithReason(ctx context.Context, id string, reason string) error

CloseWithReason closes a task with an explicit close reason.

func (*BeadsTracker) Delete

func (t *BeadsTracker) Delete(ctx context.Context, id string) error

Delete deletes a task.

func (*BeadsTracker) LeafTasks

func (t *BeadsTracker) LeafTasks(ctx context.Context) ([]Task, error)

LeafTasks returns ready tasks.

func (*BeadsTracker) List

func (t *BeadsTracker) List(ctx context.Context, status *string) ([]Task, error)

List lists tasks via bd list.

func (*BeadsTracker) ListBlockedDependents

func (t *BeadsTracker) ListBlockedDependents(ctx context.Context, id string) ([]Task, error)

ListBlockedDependents returns issues that depend on the given issue.

func (*BeadsTracker) ListFeatures

func (t *BeadsTracker) ListFeatures(ctx context.Context, epicID string) ([]Task, error)

ListFeatures lists features for a given epic.

func (*BeadsTracker) MarkDone

func (t *BeadsTracker) MarkDone(ctx context.Context, id string) error

MarkDone marks a task as done (closed) and removes workflow labels.

func (*BeadsTracker) MarkStatus

func (t *BeadsTracker) MarkStatus(ctx context.Context, id string, status string) error

MarkStatus updates task status.

func (*BeadsTracker) RemoveLabel

func (t *BeadsTracker) RemoveLabel(ctx context.Context, id string, label string) error

RemoveLabel removes a label from a task.

func (*BeadsTracker) SetAssignee

func (t *BeadsTracker) SetAssignee(ctx context.Context, id string, assignee string) error

SetAssignee updates the assignee field of a task.

func (*BeadsTracker) SetNotes

func (t *BeadsTracker) SetNotes(ctx context.Context, id string, notes string) error

SetNotes updates the notes field of a task.

func (*BeadsTracker) SetRun

func (t *BeadsTracker) SetRun(ctx context.Context, id string, runID string) error

SetRun sets the run ID (as external ref).

func (*BeadsTracker) Task

func (t *BeadsTracker) Task(ctx context.Context, id string) (Task, error)

Task fetches a task via bd show.

func (*BeadsTracker) Update

func (t *BeadsTracker) Update(ctx context.Context, id string, title, goal string) error

Update updates title and goal.

func (*BeadsTracker) UpdateWorkflowState

func (t *BeadsTracker) UpdateWorkflowState(ctx context.Context, id string, state string) error

UpdateWorkflowState updates the granular workflow state using labels.

type SelectionPolicy

type SelectionPolicy struct {
	ActiveFeatureID string
	ActiveEpicID    string
}

SelectionPolicy defines how the orchestrator chooses the next issue.

type Task

type Task struct {
	ID        string
	Type      string // task, epic, feature
	ParentID  string
	Title     string
	Goal      string
	Criteria  []AcceptanceCriterion
	Status    string
	RunID     *string
	Priority  int
	Assignee  string
	Owner     string
	Labels    []string
	Notes     string
	CreatedAt string
	UpdatedAt string
}

Task describes a task record.

func SelectNextReady

func SelectNextReady(ctx context.Context, tracker Tracker, ready []Task, policy SelectionPolicy) (Task, string, error)

SelectNextReady chooses the next issue from a ready list and returns a selection reason.

type Tracker

type Tracker interface {
	Add(ctx context.Context, title, goal string, criteria []AcceptanceCriterion, runID *string) (string, error)
	AddEpic(ctx context.Context, title, goal string) (string, error)
	AddFeature(ctx context.Context, epicID, title, goal string) (string, error)
	List(ctx context.Context, status *string) ([]Task, error)
	ListFeatures(ctx context.Context, epicID string) ([]Task, error)
	Children(ctx context.Context, parentID string) ([]Task, error)
	Task(ctx context.Context, id string) (Task, error)
	MarkDone(ctx context.Context, id string) error
	MarkStatus(ctx context.Context, id string, status string) error
	Update(ctx context.Context, id string, title, goal string) error
	Delete(ctx context.Context, id string) error
	SetRun(ctx context.Context, id string, runID string) error
	AddDependency(ctx context.Context, taskID, dependsOnID string) error
	LeafTasks(ctx context.Context) ([]Task, error)
	UpdateWorkflowState(ctx context.Context, id string, state string) error
	AddLabel(ctx context.Context, id string, label string) error
	RemoveLabel(ctx context.Context, id string, label string) error
	SetAssignee(ctx context.Context, id string, assignee string) error
	SetNotes(ctx context.Context, id string, notes string) error
	CloseWithReason(ctx context.Context, id string, reason string) error
	AddRelatedLink(ctx context.Context, id1, id2 string) error
	ListBlockedDependents(ctx context.Context, id string) ([]Task, error)
	AddFollowUp(ctx context.Context, parentID, title, goal string, criteria []AcceptanceCriterion) (string, error)
}

Tracker defines the interface for task management.

Jump to

Keyboard shortcuts

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