Documentation
¶
Overview ¶
Package archive keeps what a finished task leaves behind: archived plans and findings, the review and verdict series, and the handoff file.
Index ¶
- Constants
- func ArchivePlan(root storage.Root, id string) (string, string, error)
- func ArchiveReviews(dir string, end SeriesEnd) (string, error)
- func BranchTip(ctx context.Context, main, branch string, p forge.PR) func() string
- func ChangeOf(dir string) string
- func ClosedPRs(dir string) []string
- func ExcludeF10(ctx context.Context, root string) (string, error)
- func FreeArchiveName(dir, id string) string
- func HandoffLines(path, id string, tip func() string) []string
- func HandoffTarget(root storage.Root, id string) (string, string)
- func LoreSeries(changes []string, id string) []string
- func ModTime(path string) time.Time
- func MoveHandoff(src, target string) error
- func NewestArchived(dir, id string) string
- func NextSeries(archived, id string) string
- func SeriesChange(id string, n int) string
- func SeriesEndAt(dir string) time.Time
- func SeriesNumbers(archived, id string) []int
- func SeriesStart(dir string) time.Time
- func TaskHandoff(root storage.Root, id string) string
- func WriteHandoff(w io.Writer, lines []string) error
- type JudgeOutcome
- type SeriesEnd
- type VerdictFile
Constants ¶
const ExcludeLine = storage.DirName + "/"
ExcludeLine is spelled as a repo that did it by hand would, so an existing entry is found.
Variables ¶
This section is empty.
Functions ¶
func ArchivePlan ¶
ArchivePlan moves the plan into the shared archive. A missing plan is a note, since a task shipped without one still needs cleaning up; one that cannot move is an error, since removing the worktree would delete it.
func ArchiveReviews ¶
ArchiveReviews moves a findings directory to reviews/archive/<id>.<N>/, so the task's next PR starts its own series of rounds. N always counts from 1, since a bare <id>/ under archive would read as a live directory.
func BranchTip ¶
BranchTip is the local branch's commit, which the handoff step records as head; without the branch, the PR's head.
func ChangeOf ¶
ChangeOf is the lore change of the task's open series: the task id for its first PR, <id>.<n> for its n-th, counted from the PRs archived.
func ClosedPRs ¶
ClosedPRs is the archived series that each ended a PR, oldest first: a restart is left out.
func ExcludeF10 ¶
ExcludeF10 appends the entry to info/exclude rather than .gitignore, so the ignore itself is never committed.
func FreeArchiveName ¶
FreeArchiveName numbers `<id>.<N>.md` the way steps/plan.md does.
func HandoffLines ¶
HandoffLines is what finish prints under its report. It prints after the merge, when the branch is gone, so a stale or missing handoff names what to check rather than a command to rerun. tip runs only when the file exists, so a finish without one runs no extra git.
func HandoffTarget ¶
HandoffTarget names where the handoff will be archived, "" with none. Finish names it for its report and moves the file only after printing it, so a failure before the report leaves the file for the rerun to print.
func LoreSeries ¶
LoreSeries is the changes a show of id reads: every <id>.<n> newest first, then id itself; a change named with its number, or a task with one PR, is that change alone.
func MoveHandoff ¶
func NewestArchived ¶ added in v0.60.0
NewestArchived is the most recently written of `<id>.md` and `<id>.<N>.md` in an archive dir, "" for none. FreeArchiveName takes the lowest free name, so the number does not order them and the file's time does.
func NextSeries ¶
func SeriesChange ¶
func SeriesEndAt ¶ added in v0.60.0
SeriesEndAt is when an archived series closed: its closed file's time, else the directory's, for a series archived before the file recorded one.
func SeriesNumbers ¶
SeriesNumbers is the archived series of id, ascending.
func SeriesStart ¶
SeriesStart is when the task's open series began, the newest archived PR's end; zero for a first series.
func TaskHandoff ¶
TaskHandoff is the task's handoff file.
Types ¶
type JudgeOutcome ¶
type JudgeOutcome struct {
Verdict string `json:"verdict"`
Reason string `json:"reason,omitempty"`
Decision string `json:"decision,omitempty"`
Changes int `json:"changes,omitempty"`
}
JudgeOutcome is a verdict and, from its file, what the ship run did with it: the decision line and how many changes it listed.
func (*JudgeOutcome) Done ¶
func (j *JudgeOutcome) Done() string
Done is what the ship run did with the verdict, from the decision line; continue and a file with no line say nothing, and a new word shows as is.
type SeriesEnd ¶
A SeriesEnd is what an archived series records in its closed file: the PR (#204, or none), the commit it ended at, and when. A restart is rounds ended by a rebase before any PR existed: still the same PR, so it counts for no lore change.
func ReadSeriesEnd ¶
ReadSeriesEnd is zero for a series archived before the file existed.
type VerdictFile ¶
type VerdictFile struct {
Outcome JudgeOutcome
Judged string // task or plan when its subject is one, else change
At time.Time
Path string
}
VerdictFile is one verdict file that judges the task, not an idea.
func JudgeFiles ¶
func JudgeFiles(storageRoot, task string) []VerdictFile
JudgeFiles is the task's verdict files that parse, oldest first.