task

package
v2.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 13 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

Package task reads and writes task files (docs/spec/workflow.md §4).

Index

Constants

View Source
const (
	Todo        = "todo"
	InProgress  = "in_progress"
	Implemented = "implemented"
	InReview    = "in_review"
	Done        = "done"
	Blocked     = "blocked"
	Cancelled   = "cancelled"
)

Statuses.

View Source
const RiskPlaceholder = "(Required for strict profile. Impact:, Security (STRIDE):, Rollback:, Validation:)"

RiskPlaceholder marks an unfilled risk section.

Variables

View Source
var IDPattern = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9-]{0,31}$`)

IDPattern matches task IDs (ADR-0009).

Statuses lists valid statuses.

Functions

func NewBody

func NewBody(objective string, criteria []string) string

NewBody renders the body template for a new task.

func NewID

func NewID(p *project.Project) string

NewID returns an unused random ID: T- plus 4+ Crockford base32 characters.

func Now

func Now() string

Now returns the current UTC time in the canonical format.

func Save

func Save(p *project.Project, t *Task) error

Save validates and writes the task atomically.

Types

type Acceptance

type Acceptance struct {
	Total int `yaml:"total" json:"total"`
	Done  int `yaml:"done" json:"done"`
}

Acceptance counts criteria.

type Audit added in v2.2.0

type Audit struct {
	At      string        `yaml:"at" json:"at"`
	Passed  bool          `yaml:"passed" json:"passed"`
	Tree    string        `yaml:"tree,omitempty" json:"tree,omitempty"`
	Results []AuditResult `yaml:"results,omitempty" json:"results,omitempty"`
}

Audit records the last security scan of the code.

type AuditResult added in v2.2.0

type AuditResult struct {
	Name     string `yaml:"name" json:"name"`
	ExitCode int    `yaml:"exit_code" json:"exit_code"`
	Summary  string `yaml:"summary,omitempty" json:"summary,omitempty"`
}

AuditResult is one scanner's outcome.

type Check

type Check struct {
	Cmd        string `yaml:"cmd" json:"cmd"`
	ExitCode   int    `yaml:"exit_code" json:"exit_code"`
	DurationMs int64  `yaml:"duration_ms,omitempty" json:"duration_ms,omitempty"`
	Summary    string `yaml:"summary,omitempty" json:"summary,omitempty"`
	At         string `yaml:"at" json:"at"`
	Tree       string `yaml:"tree,omitempty" json:"tree,omitempty"`
}

Check is evidence of one check run.

type Criterion

type Criterion struct {
	Text string `json:"text"`
	Done bool   `json:"done"`
}

Criterion is one acceptance criterion line.

type Evidence

type Evidence struct {
	Check         *Check      `yaml:"check,omitempty" json:"check,omitempty"`
	Commits       []string    `yaml:"commits,omitempty" json:"commits,omitempty"`
	Acceptance    *Acceptance `yaml:"acceptance,omitempty" json:"acceptance,omitempty"`
	CheckFailures int         `yaml:"check_failures,omitempty" json:"check_failures,omitempty"`
	UAT           *UAT        `yaml:"uat,omitempty" json:"uat,omitempty"`
	Audit         *Audit      `yaml:"audit,omitempty" json:"audit,omitempty"`
	// RegressionTests: test files changed with a bug fix, recorded when the gate first passes.
	RegressionTests []string `yaml:"regression_tests,omitempty" json:"regression_tests,omitempty"`
}

Evidence is written by check and close.

type Meta

type Meta struct {
	ID            string         `yaml:"id" json:"id"`
	Title         string         `yaml:"title" json:"title"`
	Status        string         `yaml:"status" json:"status"`
	Profile       string         `yaml:"profile" json:"profile"`
	ProfilePinned bool           `yaml:"profile_pinned,omitempty" json:"profile_pinned,omitempty"`
	Goal          string         `yaml:"goal,omitempty" json:"goal,omitempty"`
	Tags          []string       `yaml:"tags,omitempty" json:"tags,omitempty"`
	DependsOn     []string       `yaml:"depends_on,omitempty" json:"depends_on,omitempty"`
	Created       string         `yaml:"created" json:"created"`
	Updated       string         `yaml:"updated" json:"updated"`
	Closed        string         `yaml:"closed,omitempty" json:"closed,omitempty"`
	CreatedBy     string         `yaml:"created_by,omitempty" json:"created_by,omitempty"`
	Workers       []string       `yaml:"workers,omitempty" json:"workers,omitempty"`
	Branch        string         `yaml:"branch,omitempty" json:"branch,omitempty"`
	Base          string         `yaml:"base,omitempty" json:"base,omitempty"`
	Paths         []string       `yaml:"paths,omitempty" json:"paths,omitempty"`
	Review        *Review        `yaml:"review,omitempty" json:"review,omitempty"`
	Evidence      *Evidence      `yaml:"evidence,omitempty" json:"evidence,omitempty"`
	Legacy        map[string]any `yaml:"legacy,omitempty" json:"legacy,omitempty"`
}

Meta is the frontmatter (schemas/task.schema.json).

type Pass

type Pass struct {
	N        int    `yaml:"n" json:"n"`
	By       string `yaml:"by" json:"by"`
	Session  string `yaml:"session,omitempty" json:"session,omitempty"`
	At       string `yaml:"at" json:"at"`
	Findings int    `yaml:"findings" json:"findings"`
	Tree     string `yaml:"tree,omitempty" json:"tree,omitempty"` // working tree the pass reviewed
}

Pass is one review pass.

type Review

type Review struct {
	Passes []Pass `yaml:"passes,omitempty" json:"passes,omitempty"`
}

Review holds bug-hunt passes.

type Task

type Task struct {
	Meta
	Body string `yaml:"-" json:"body,omitempty"`
	File string `yaml:"-" json:"file"` // repository-relative
}

Task is a parsed task file.

func Find

func Find(p *project.Project, id string) (*Task, error)

Find returns the task with id.

func List

func List(p *project.Project) (tasks []*Task, errs []error)

List loads every task, sorted by updated (newest first). Unreadable files are returned in errs.

func Load

func Load(p *project.Project, rel string) (*Task, error)

Load reads one task file.

func (*Task) AddCriteria added in v2.1.0

func (t *Task) AddCriteria(texts []string)

AddCriteria appends criteria after the last existing one (creating the section if needed).

func (*Task) AddWorker added in v2.1.0

func (t *Task) AddWorker(tool string)

AddWorker records that tool worked on the task (ignores unknown tools).

func (*Task) Criteria

func (t *Task) Criteria() []Criterion

Criteria parses the top-level checkboxes of the "Acceptance criteria" section.

func (*Task) MarkCriteria added in v2.1.0

func (t *Task) MarkCriteria(nums []int) error

MarkCriteria checks the given 1-based criteria, editing only their checkbox.

func (*Task) RiskFilled

func (t *Task) RiskFilled() bool

RiskFilled reports whether the Risk section contains real analysis.

type UAT added in v2.2.0

type UAT struct {
	Status string `yaml:"status" json:"status"` // accepted | rejected
	By     string `yaml:"by,omitempty" json:"by,omitempty"`
	At     string `yaml:"at" json:"at"`
	Note   string `yaml:"note,omitempty" json:"note,omitempty"`
}

UAT records a person's acceptance or rejection.

Jump to

Keyboard shortcuts

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