Documentation
¶
Overview ¶
Package intent reads the proposals an agent writes and checks them against the closed catalogue (docs/spec/role-contract.md, "Intentions").
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Catalogue = map[string]bool{ "commit-message": true, "patch": true, "comment": true, "label": true, "issue": true, "handoff": true, "note": true, "open": true, "skip": true, "milestone": true, "order": true, "sources": true, "close": true, "keep": true, "refine": true, "ready": true, "unready": true, "ask": true, "split": true, "rename": true, "depend": true, "finding": true, "claim": true, }
Catalogue is every kind of intention the engine knows how to apply.
Functions ¶
func Marshal ¶ added in v0.9.0
Marshal writes proposals as Read reads them: YAML, or JSON — which YAML reads too — when the YAML written would not read back: the YAML library writes a text starting with a tab as a block it then refuses ("found a tab character where an indentation space is expected"), and code quoted from a file often starts with one.
func NormalizeDiff ¶
NormalizeDiff adds the `diff --git` line each file of a diff needs, when an agent left it out. git apply --recount relies on it to tell where a file ends: without it, a new file's `--- /dev/null` is read as a line removed from the file before. A file created or deleted also gets its mode line.
func PatchFiles ¶
PatchFiles lists the files a patch names: its `file`, or the `+++` lines of its diff. It reads names only; whether the diff applies is checked later.
func SortForApply ¶
func SortForApply(in []Intention)
SortForApply puts intentions in apply order, keeping the proposed order within a kind.
Types ¶
type Intention ¶
Intention is one proposal: its kind and its value.
func Merge ¶
Merge returns the fallback proposals with the agent's in place of those of the same kind (docs/spec/role-contract.md, "One run"). A patch replaces only the fallback patches of the files it touches: the agent fixing one doc does not drop what the role regenerated in another. A fallback patch given as a diff replaces nothing and is never replaced: it holds only the lines it changes, and is applied after the agent's, beside them.