beads

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package beads is a thin wrapper around the `bd` CLI from github.com/gastownhall/beads. It is used by the PM/TaskRunner to register negotiated task specs as durable issues so multi-session work survives.

All operations are best-effort: if the binary is missing or the command fails, callers should log and continue rather than abort the pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDependency

func AddDependency(ctx context.Context, root, child, parent string) error

AddDependency records that `child` depends on `parent` — parent must be closed before `child` becomes ready. Implemented via `bd dep add <child> <parent>`, which is the standard subcommand of the beads CLI.

func Available

func Available() bool

Available reports whether the `bd` binary is on PATH.

func Claim

func Claim(ctx context.Context, root, id string) error

Claim transitions an issue to in-progress for the current actor.

func Close

func Close(ctx context.Context, root, id, reason string) error

Close marks an issue as done with the given reason.

func Create

func Create(ctx context.Context, root, title, description string, priority int, labels ...string) (string, error)

Create registers a new issue and returns its ID. Output is parsed from `bd q` (quick capture) which prints only the issue ID. labels are attached at creation time (may be empty).

func Link(ctx context.Context, root, child, parent, linkType string) error

Link records a typed relationship between two issues, e.g. parent-child:

bd link <child> <parent> --type parent-child

Best-effort: a no-op when bd is unavailable or an id is empty.

func SetMetadata

func SetMetadata(ctx context.Context, root, id string, kv map[string]string) error

SetMetadata attaches custom key/value metadata to an issue via `bd update <id> --set-metadata k=v`. Best-effort.

Types

type Issue

type Issue struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Status      string `json:"status"`
	Priority    int    `json:"priority"`
	Type        string `json:"type"`
}

Issue is the minimal subset of `bd` issue fields DECSR cares about.

func ActiveTasks

func ActiveTasks(ctx context.Context, root, label string) ([]Issue, error)

ActiveTasks lists top-level decsr task beads that are currently in_progress, i.e. resumable runs. Uses `bd list --no-parent --label decsr-task --status in_progress --json`. Returns nil when bd is unavailable.

func Children

func Children(ctx context.Context, root, parent string, statuses ...string) ([]Issue, error)

(e.g. "in_progress", "open"). Returns nil when bd is unavailable or parent is empty.

func ClosedTasks

func ClosedTasks(ctx context.Context, root, label string) ([]Issue, error)

ClosedTasks lists completed top-level decsr task beads (history). Uses `bd list --no-parent --label decsr-task --status closed --json`.

func Ready

func Ready(ctx context.Context, root, parent string) ([]Issue, error)

Ready returns issues that are unblocked and ready to be picked up. When parent is non-empty, results are scoped to descendants of that bead/epic (`bd ready --parent`). Note: `bd ready` excludes in_progress issues, so an interrupted (claimed-but-open) sub-task will NOT appear here — callers that need to resume such work should use Children(..., "in_progress").

Jump to

Keyboard shortcuts

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