backlog

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package backlog decides what becomes of a role's acts on a project's issues (docs/spec/backlog-acts.md): each is checked against the code and the forge, then done, proposed to a person, or dropped. Closing is the first act built.

Index

Constants

View Source
const (
	Act     = "act"
	Propose = "propose"
	Off     = "off"
)

Modes of an act.

Variables

View Source
var Kinds = []string{"open", "close", "sources", "milestone"}

Kinds are the intentions that are acts on the backlog.

Functions

func ClosedByRole

func ClosedByRole(f forge.Backlog, role string, open []forge.Issue) []int

ClosedByRole lists the issues the role's record says it closed, read from its report issue's comments; nil when there is none or it does not read.

func Comment

func Comment(c Proposal, role string) string

Comment is what the closed issue is told.

func FormatRecord

func FormatRecord(r Record) string

FormatRecord is the body of the report's record comment.

func FormatState

func FormatState(s State) string

FormatState is the body of an issue's state comment, its marker left to the forge's Sticky.

func ImportKey

func ImportKey(q Quote) string

ImportKey is the marker key of an issue opened from a file's text: the file and a digest of the text, so the same text is never opened twice.

func Locate

func Locate(repo, path, text string) (from, to int, original string, ok bool)

Locate finds a quote in a file, as written but for spaces: the lines it spans, from 1, and those lines as the file has them.

func PeopleComments

func PeopleComments(comments []string) int

PeopleComments counts an issue's comments that are not the engine's.

func RecordMarker

func RecordMarker(role string) string

RecordMarker marks the report's comment holding what the role did.

func ReportTitle

func ReportTitle(role string) string

ReportTitle is the title of the role's report issue.

func Settings

func Settings(settings map[string]any) map[string]Setting

Settings reads the role's `acts` setting.

func StateMarker

func StateMarker(role string) string

StateMarker marks the comment holding an issue's state.

Types

type Closing

type Closing struct {
	Issue int    `yaml:"issue"`
	Act   string `yaml:"act"`
}

Closing is one issue the role closed.

type Decision

type Decision struct {
	Index int      `yaml:"index"` // the intention's place in the run
	Mode  string   `yaml:"mode"`  // act, propose, or off (dropped)
	Act   Proposal `yaml:"act"`
}

Decision is what becomes of one act.

type Pending

type Pending struct {
	Issue int    `yaml:"issue"`
	Act   string `yaml:"act"`
	Line  string `yaml:"line"`
}

Pending is an act proposed to a person, as the report says it.

type Plan

type Plan struct {
	Decisions []Decision        `yaml:"decisions"`
	Findings  []verdict.Finding `yaml:"findings"`
	Record    Record            `yaml:"record"`
	Report    int               `yaml:"report"`  // the report issue, 0 when none is open yet
	Changed   bool              `yaml:"changed"` // the record changed: wrong closings found, proposals settled
	// contains filtered or unexported fields
}

Plan is what a run does with its acts, decided once, so a resumed run does the same.

func Decide

func Decide(f forge.Backlog, repo, role string, settings map[string]Setting, closes map[int]Proposal) (*Plan, error)

Decide plans the acts proposed, given at their place in the run.

func (*Plan) Acts

func (p *Plan) Acts(i int) bool

Acts says whether the act at index i is done, not proposed nor dropped.

func (*Plan) Decision

func (p *Plan) Decision(i int) *Decision

Decision is what becomes of the act at index i, nil when it is none.

func (*Plan) ReportBody

func (p *Plan) ReportBody() string

ReportBody is the report issue's body: what the run did and proposes.

type Proposal

type Proposal struct {
	Do          string   `yaml:"do"` // close or sources: the intention's kind
	Issue       int      `yaml:"issue"`
	Reason      string   `yaml:"reason,omitempty"`
	DuplicateOf int      `yaml:"duplicate-of,omitempty"`
	Sources     []string `yaml:"sources,omitempty"`
	Milestone   string   `yaml:"milestone,omitempty"`
	Title       string   `yaml:"title,omitempty"` // an issue to open
	Quote       *Quote   `yaml:"quote"`
	Why         string   `yaml:"why"`
}

Proposal is an act on an issue the agent proposed: a closing, or the code it is about named as its sources.

func (Proposal) Kind

func (c Proposal) Kind() string

Kind is the kind of act, as settings name it.

type Quote

type Quote struct {
	Path  string `yaml:"path"`
	Issue int    `yaml:"issue"`
	Text  string `yaml:"text"`
}

Quote is the evidence an act cites: a text in a file, or in an issue.

type Record

type Record struct {
	Closed   []Closing `yaml:"closed,omitempty"`
	Wrong    []Closing `yaml:"wrong,omitempty"`        // closings found wrong: their issue open again
	Propose  []string  `yaml:"propose,flow,omitempty"` // kinds of act back to propose, until the person says
	Proposed []Pending `yaml:"proposed,omitempty"`     // acts proposed, kept until their issue is closed or proposed again
}

Record is what the role did, kept on its report issue.

type Setting

type Setting struct {
	Mode string
	Max  int
}

Setting is a kind of act's mode and cap.

type State

type State struct {
	Sources   []string `yaml:"sources"`
	Confirmed string   `yaml:"confirmed"`
	Judged    string   `yaml:"judged,omitempty"`   // the commit the role last read it at
	Comments  int      `yaml:"comments,omitempty"` // people's comments when it was last read
}

State is what the engine knows of an issue, kept in one comment on it.

func ReadState

func ReadState(comments []string, role string) (*State, bool, error)

ReadState reads an issue's state from its comments.

Jump to

Keyboard shortcuts

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