Documentation
¶
Overview ¶
Package afterupdate is the moment after an abcd update (spc-2610170635097509, step 6): the one line per release saying what changed, from the digest inside the binary, and the offer to run setup again where the update brings something this repository needs; and the record of what was shown and answered.
The record lives in abcd's user-level home, never in the repository:
~/.abcd.noindex/after-update/<root-sha>/<tag>.json this repository's answer for one release ~/.abcd.noindex/after-update/news-seen the newest release whose news this computer was shown
An answer is created exclusively, so of two sessions answering together the first wins; news-seen is replaced atomically under a lock and only ever raised. Only Record and MarkSeen write. Pending, Moment and Full read, so a session with no person to answer it (which runs neither) records nothing.
Nothing here reaches the network, and no word of the repository's tracked files reaches a line: versions pass launch.ParseReleaseTag, counts are numbers, titles are core's, and change lines come from the digest alone. The package returns values and never prints.
Index ¶
- Constants
- Variables
- func Answers() []string
- func MarkSeen() error
- func RenderChange(c ChangeDetail, st Style) []string
- func RenderFull(f FullSummary, st Style) []string
- type ActItem
- type Answer
- type ChangeDetail
- type CitedChange
- type FullSummary
- type MomentLines
- type Offer
- type PendingState
- type Style
Constants ¶
const ( ActNeedsYou = "needs-you" ActFineHere = "fine-here" ActNothingToCheck = "nothing-to-check" ActUnchecked = "unchecked" )
The states an act item takes: the check found something to do here, found nothing to do here, had nothing it could check here (a change that asks nothing of any file, or a place abcd passes over unread), or could not be run (an unreadable file, or the checks' budget spent).
const ( AnswerYes = "yes" AnswerNotNow = "not-now" )
The answers the offer takes.
const ChangeCommand = "abcd update news --change <record-id>"
ChangeCommand is the command that shows one change whole, named under the full summary.
const FullCommand = "abcd update news --full"
FullCommand is the command that shows the full summary, named on every news line.
Variables ¶
var ( // ErrNotRelease is the refusal of a running binary that is not a release // (a dev build): it takes no part in the moment. ErrNotRelease = errors.New("this abcd is not a release build, so there is no update to record") // ErrNoOffer is Record's refusal where no offer applies: the repository's // setup version is not an older release than the running one, or the // repository has no root commit to key the answer on. ErrNoOffer = errors.New("no setup offer applies to this repository for this release") // ErrAlreadyAnswered is Record's refusal of a second answer for one // repository and release: the first stands. ErrAlreadyAnswered = errors.New("the offer for this release was already answered in this repository") // ErrBadAnswer is Record's refusal of an answer that is neither yes nor not-now. ErrBadAnswer = errors.New("the answer is yes or not-now") )
var ( // ErrNotRecordID is Change's refusal of a word that is not a record id. ErrNotRecordID = errors.New("a change is named by a record id it cites, itd-N or iss-N (the value given is not repeated here)") // ErrNoSuchChange is Change's refusal of a record no change in the range cites. ErrNoSuchChange = errors.New("no change in the releases since the last update cites that record") )
Functions ¶
func Answers ¶ added in v0.17.0
func Answers() []string
Answers returns the answers the offer takes: the one list Record checks an answer against and `update news --answer` declares.
func MarkSeen ¶
func MarkSeen() error
MarkSeen records that this computer was shown the news up to the running release, raising news-seen and never lowering it.
func RenderChange ¶
func RenderChange(c ChangeDetail, st Style) []string
RenderChange draws each change of c whole in the style st: the release and the records it cites with their impact, then its whole text with its markdown drawn as styling, wrapped to the window at up to 80 columns (one line where st has no width).
func RenderFull ¶
func RenderFull(f FullSummary, st Style) []string
RenderFull draws the full summary in the style st: per release, its line, what needs the person here, what they check themselves, the headline changes, then the rest by area (what is new, what is fixed), one line per change with its record id; then the way to read one change whole, the releases not described, and what waits here. Full's Lines are this drawing in the plain style.
What needs the person, and what is theirs to check, come from f.Act, the checked items the short lines (newsLines) count, never from a record's impact alone, so the counts here and there agree: an item that needs the person is drawn as its action and the places it names, an unchecked one as its change, and a change the check found nothing to do for is drawn with the rest. actItems gives every breaking entry an item, one per entry key within a release, so a second entry under the same key is the same item, drawn once (the records it names lead to both through ChangeCommand). An entry no item covers (a summary built without its check) is drawn with the rest, as newsLines counts it nowhere.
Types ¶
type ActItem ¶
type ActItem struct {
Release string `json:"release"`
Records []string `json:"records"`
State string `json:"state"`
Action string `json:"action"`
Where []string `json:"where,omitempty"`
Line string `json:"line"`
}
ActItem is one change that can need the person, as checked here: the release and records it comes from, what the check found, the one thing the person does (Action, naming the file or command where the check found something), the places it found, and the line the news shows.
type Answer ¶
type Answer struct {
SchemaVersion int `json:"schema_version"`
Release string `json:"release"`
Answer string `json:"answer"`
}
Answer is one repository's recorded answer for one release.
func Record ¶
Record records the person's answer to the offer for the repository at cwd and the running release, and raises news-seen to that release, since the answer was given to the moment that showed it. The answer is created exclusively: a second answer for the same repository and release is ErrAlreadyAnswered and changes nothing.
type ChangeDetail ¶
type ChangeDetail struct {
ID string `json:"id"`
Changes []CitedChange `json:"changes"`
Lines []string `json:"lines"`
}
ChangeDetail is one record's changes in the range, shown whole.
func Change ¶
func Change(cwd, id string) (ChangeDetail, error)
Change finds the changes citing the record id in the releases Full lists by default, reading only, and returns them whole.
type CitedChange ¶
type CitedChange struct {
Release string `json:"release"`
Entry releasedigest.Entry `json:"entry"`
}
CitedChange is one change citing the record a ChangeDetail names, with the release that made it.
type FullSummary ¶
type FullSummary struct {
Summary releasedigest.Summary `json:"summary"`
Waiting ahoy.WaitingSet `json:"waiting"`
Lines []string `json:"lines"`
Partial bool `json:"partial"`
// Act is each change that can need the person, checked here.
Act []ActItem `json:"act"`
}
FullSummary is the full summary: every release in the range, each entry needing action first with the record ids to read more, the releases the digest cannot describe, and what waits here.
func Full ¶
func Full(cwd, from string) (FullSummary, error)
Full composes the full summary for the repository at cwd, reading only, so it can be shown again at any time. from is the release the range starts after; "" starts it at the binary record's previous release, else the repository's setup version, else the running release alone. What waits is listed where the repository's setup version is an older release.
type MomentLines ¶
type MomentLines struct {
News *releasedigest.Summary `json:"news,omitempty"`
Lines []string `json:"lines"`
Act []ActItem `json:"act,omitempty"`
Offer *Offer `json:"offer,omitempty"`
Partial bool `json:"partial"`
}
MomentLines is what the agent relays in its first reply: a line per release whose news is unseen on this computer, each followed by a line per change that can need the person as checked here (Act), and one naming any release the digest cannot describe, then the offer line, if one is due here.
func Moment ¶
func Moment(cwd string) (MomentLines, error)
Moment composes the moment for the repository at cwd, reading only.
type Offer ¶
type Offer struct {
From string `json:"from"`
To string `json:"to"`
Waiting ahoy.WaitingSet `json:"waiting"`
Line string `json:"line"`
}
Offer is the offer to run setup again: the release the repository was set up with, the one running, and what waits.
type PendingState ¶
PendingState says what an after-update moment holds here: News, that this computer has not been shown what changed up to the running release; Offer, that setup should be offered in this repository for it.
func Pending ¶
func Pending(cwd string, det ahoy.DetectionResult) (PendingState, error)
Pending reports, reading only, what the moment holds for the repository at cwd, whose detection the caller already holds (the session start runs one): Pending runs none of its own. A dev build holds nothing.
func (PendingState) Any ¶
func (p PendingState) Any() bool
Any reports whether the moment holds anything.