Documentation
¶
Overview ¶
Package task reads and writes task files (docs/spec/workflow.md §4).
Index ¶
- Constants
- Variables
- func NewBody(objective string, criteria []string) string
- func NewID(p *project.Project) string
- func Now() string
- func Save(p *project.Project, t *Task) error
- type Acceptance
- type Audit
- type AuditResult
- type Check
- type Criterion
- type Evidence
- type Meta
- type Pass
- type Review
- type Task
- type UAT
Constants ¶
const ( Todo = "todo" InProgress = "in_progress" Implemented = "implemented" InReview = "in_review" Done = "done" Blocked = "blocked" Cancelled = "cancelled" )
Statuses.
const RiskPlaceholder = "(Required for strict profile. Impact:, Security (STRIDE):, Rollback:, Validation:)"
RiskPlaceholder marks an unfilled risk section.
Variables ¶
var IDPattern = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9-]{0,31}$`)
IDPattern matches task IDs (ADR-0009).
var Statuses = []string{Todo, InProgress, Implemented, InReview, Done, Blocked, Cancelled}
Statuses lists valid statuses.
Functions ¶
Types ¶
type Acceptance ¶
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 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 List ¶
List loads every task, sorted by updated (newest first). Unreadable files are returned in errs.
func (*Task) AddCriteria ¶ added in v2.1.0
AddCriteria appends criteria after the last existing one (creating the section if needed).
func (*Task) AddWorker ¶ added in v2.1.0
AddWorker records that tool worked on the task (ignores unknown tools).
func (*Task) Criteria ¶
Criteria parses the top-level checkboxes of the "Acceptance criteria" section.
func (*Task) MarkCriteria ¶ added in v2.1.0
MarkCriteria checks the given 1-based criteria, editing only their checkbox.
func (*Task) RiskFilled ¶
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.