Documentation
¶
Overview ¶
Package facts interprets the declared project.md layers, merges them with the detection probes and the contract's defaults, and attributes every effective value to its origin. It is the one component of f10 allowed to interpret instruction prose - bin/f10-load-project.sh stays a concatenator.
Interpretation stays shallow: only the sub-facts with a fixed vocabulary (Layering, Visibility, Storage, the tracker kind and its id prefix, the remote review's four facts) become structure; everything else is shown as the declared prose, attributed but unparsed. The binary may be incomplete, never wrong - what it cannot place it shows as-is instead of guessing.
It writes that prose too, in scaffold.go: `f10 init` renders detection as a project.md. Reader and writer share a package so the vocabulary one keys on and the words the other emits cannot drift apart.
Index ¶
Constants ¶
const ( OriginDetected = "detected" OriginDefault = "default" OriginAbsent = "absent" )
Origins an effective value can have. Declared origins are qualified by the layer label at build time: "declared (main)", "declared (worktree)".
const ( ReviewerBot = "bot" ReviewerHuman = "human" ReviewerCheck = "check" ArrivesComment = "issue comment" ArrivesInline = "inline review" ArrivesCheck = "check run" TriggerAutomatic = "automatic" TriggerManual = "manual" DonePosted = "posted" DoneMarker = "marker" DoneSubmitted = "submitted" DoneConcluded = "concluded" HandledReaction = "reaction" HandledMarker = "marker" HandledCheckbox = "checkbox" HandledThread = "thread resolved" )
The vocabularies, as the words the parser looks for.
const ( ManualComment = "comment" ManualRequest = "request" )
The manual triggers `f10 review trigger` can perform: a comment on the request, or a review requested from a login.
const DefaultDriveChain = "plan → judge → ship → review → resolve → finish"
DefaultDriveChain is the chain `f10 drive` runs each task through when project.md declares none: review after ship reviews the shipment, and resolve settles it before finish merges.
Variables ¶
var ErrHasFrontmatter = errors.New("already has a frontmatter block and nothing left to migrate")
ErrHasFrontmatter refuses a second migration.
Functions ¶
func ProjectPrefix ¶ added in v0.38.0
ProjectPrefix derives a task id prefix from the project's name, for a project that declares no id format. The host's letters would name every GitLab project GL; the project's own name says which project in a branch or a plan filename. A short name with a digit keeps its letters (f10 -> F10, r3 -> R3), several segments give initials (git-undo -> GU), one word gives its first three characters (herdr -> HER). A name that yields nothing usable (one letter, a leading digit) derives no prefix, so only explicit ids are accepted and f10 init leaves the Tracker section to a human.
Types ¶
type Declared ¶ added in v0.29.0
type Declared struct {
Visibility string `yaml:"visibility,omitempty"`
Storage string `yaml:"storage,omitempty"`
Layering string `yaml:"layering,omitempty"`
Tracker TrackerDecl `yaml:"tracker,omitempty"`
MergeMethod string `yaml:"merge_method,omitempty"`
Catchup string `yaml:"catchup,omitempty"`
Traces string `yaml:"traces,omitempty"`
Lore string `yaml:"lore,omitempty"`
ReviewTraces string `yaml:"review_traces,omitempty"` // the old spelling of traces, read and folded in
Pipelines map[string]Steps `yaml:"pipelines,omitempty"`
Planless []string `yaml:"planless,omitempty"`
DriveChain Steps `yaml:"drive_chain,omitempty"`
Review ReviewDecl `yaml:"review,omitempty"`
Standup StandupDecl `yaml:"standup,omitempty"`
}
Declared is one layer's frontmatter.
type Draft ¶
A Draft is one rendered project.md: the markdown, the frontmatter keys and prose sections it carries, and the sections left out because nothing detected them.
type Effective ¶
type Effective struct {
Fields []Field `json:"fields"`
Unrecognized []Field `json:"unrecognized,omitempty"`
// The fixed-vocabulary sub-facts.
Layering string `json:"layering"`
Visibility string `json:"visibility"`
Storage string `json:"storage"`
TrackerKind string `json:"trackerKind,omitempty"`
IDPrefix string `json:"idPrefix,omitempty"` // "ABC", "F10" - the task id format's letters
IDPrefixOrigin string `json:"idPrefixOrigin,omitempty"` // "declared (<layer>)" or "derived from project name <name>"
IDPrefixDerived bool `json:"idPrefixDerived,omitempty"` // the prefix came from the project's name, not a declaration
// PriorityLabels is tracker.priority inverted: a lower-cased host label
// to the level it carries; nil when none is declared.
PriorityLabels map[string]string `json:"priorityLabels,omitempty"`
// The remote review's four facts (review.go); zero when Review declares
// no remote reviewer.
Review Review `json:"review"`
// The rest of the typed facts (resolve.go). MergeMethod "" means none
// declared: finish asks the repo.
MergeMethod string `json:"mergeMethod,omitempty"`
Catchup string `json:"catchup"`
Traces bool `json:"traces"` // traces: on; a step's commits carry trailers, the squash commit keeps the task, a review or judge after the PR leaves a status and a comment
Lore string `json:"lore"` // local: lore under the storage root; committed: .lore/ at the checkout root
Pipelines map[string][]string `json:"pipelines"`
Planless []string `json:"planless,omitempty"`
DriveChain []string `json:"driveChain"`
UpkeepPaths []string `json:"upkeepPaths,omitempty"` // standup.upkeep: globs on top of the defaults
// Facts is every typed value with its origin; Problems what is wrong
// with how they were declared.
Facts []Fact `json:"facts"`
Problems []Problem `json:"problems,omitempty"`
// contains filtered or unexported fields
}
Effective is the merged, attributed view of a project's configuration.
type Fact ¶ added in v0.29.0
type Fact struct {
Key string `json:"key"`
Value string `json:"value"`
Origin string `json:"origin"`
}
A Fact is one typed value and where it came from.
type Field ¶
type Field struct {
Name string `json:"name"`
Value string `json:"value"`
Prose bool `json:"prose,omitempty"` // multi-line prose, not a scalar
Origin string `json:"origin"` // "detected", "declared (<layer>)", "default", "absent"
Source string `json:"source,omitempty"` // file for declared, evidence for detected
}
A Field is one effective configuration value with its provenance.
type Labels ¶ added in v0.38.0
type Labels []string
Labels is a list of label names, written as a YAML list or as one string.
type Migration ¶ added in v0.29.0
type Migration struct {
Content string
Moved []string // the frontmatter keys written
Superseded []string // "<key>: <where in the prose>"
}
A Migration is what `f10 init --migrate` makes of one prose-only project.md: the file with a frontmatter block on top, and the prose each moved fact came from, for the user to delete.
func Migrate ¶ added in v0.29.0
Migrate reads the facts one project.md declares in prose, with the same readers the fallback uses, and puts them in a frontmatter block above the untouched file. Only what the file declares moves: defaults and detection stay out, so the block says no more than the prose did. A file that already has a block gets its one renamed key, review_traces, moved to traces.
type Problem ¶ added in v0.29.0
A Problem is something wrong with the declaration. An error stops the commands that act on facts; a warning is shown and nothing else.
type Review ¶ added in v0.26.0
type Review struct {
Reviewer string `json:"reviewer,omitempty"` // the identity: a login, or a check's name
ReviewerKind string `json:"reviewerKind,omitempty"` // bot | human | check
Arrives string `json:"arrives,omitempty"` // issue comment | inline review | check run
Trigger string `json:"trigger,omitempty"` // automatic | manual | automatic, manual
TriggerHow string `json:"triggerHow,omitempty"` // the rest of the line: how a human fires it
Done string `json:"done,omitempty"` // posted | marker | submitted | concluded
DoneText string `json:"doneText,omitempty"` // the marker's text
Handled string `json:"handled,omitempty"` // reaction | marker | checkbox | thread resolved
HandledText string `json:"handledText,omitempty"` // the reaction's emoji, or the marker's text
Settled string `json:"settled,omitempty"` // reaction | marker
SettledText string `json:"settledText,omitempty"` // the reaction's emoji, or the marker's text
// contains filtered or unexported fields
}
A Review is the parsed remote-review contract. The zero value means the section declares no remote reviewer, which is the common case.
func (Review) ManualAction ¶ added in v0.38.0
ManualAction reads the manual how as the kind and its text: a comment posting the first code span (`comment `@claude review“), or a review requested from the span's login. Both need the code span: a request to a word guessed from prose would reach a real account. false when the trigger is not manual or the how reads as neither.
type ReviewDecl ¶ added in v0.29.0
type ReviewDecl struct {
Reviewer string `yaml:"reviewer,omitempty"`
Arrives string `yaml:"arrives,omitempty"`
Trigger string `yaml:"trigger,omitempty"`
Done string `yaml:"done,omitempty"`
Settled string `yaml:"settled,omitempty"`
}
ReviewDecl is the remote review's four facts and the optional settled mark, in the vocabulary the prose items use, so the same sub-parsers read both.
type StandupDecl ¶ added in v0.33.0
type StandupDecl struct {
Upkeep []string `yaml:"upkeep,omitempty"`
}
StandupDecl is what `f10 standup` reads: the paths that, alone in a commit, make it upkeep, on top of the lockfiles, generated files and snapshots it knows (schema dumps, a project's own codegen output).
type Steps ¶ added in v0.29.0
type Steps []string
Steps is an ordered list of names, written as a YAML list or as one `a → b → c` string.
type TrackerDecl ¶ added in v0.29.0
type TrackerDecl struct {
Kind string `yaml:"kind,omitempty"`
ID string `yaml:"id,omitempty"`
Priority map[string]Labels `yaml:"priority,omitempty"`
}
TrackerDecl is the tracker's kind, its task id format (`FT-###`) and the priority map for host issues, which have no priority field of their own: a level of the driver contract's vocabulary to the labels that carry it.