Documentation
¶
Overview ¶
Package okf checks OKF v0.2 bundles.
The spec is deliberately permissive: only three rules are conformance failures. That split is why findings carry a severity — everything beyond §11 is advice and must never fail a build. A repo whose graph carries an invariant the spec cannot express passes it to CheckBundle as a Rule.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Main ¶
Main runs the `okf check` CLI and returns the process exit code. A repo with its own rules wires them in here rather than forking the command.
Types ¶
type Bundle ¶ added in v0.2.0
Bundle is every parsed document in one root, index.md and log.md included.
type BundleRule ¶ added in v0.2.0
BundleRule is a caller-supplied check over a whole bundle. A Rule runs per concept and so cannot see the reserved files, the link graph, or any pair of concepts at once.
type Doc ¶
type Doc struct {
Root string // bundle root, as given to CheckBundle
Rel string // bundle-relative path, slash-separated
FM map[string]any // frontmatter
Body string
}
Doc is one parsed concept, handed to a Rule.
type Finding ¶
func CheckBundle ¶
CheckBundle walks a bundle root and reports conformance errors (§11) and advisory warnings, plus whatever the caller's rules report.
func CheckBundleWith ¶ added in v0.2.0
CheckBundleWith is CheckBundle with bundle-wide rules as well. Their findings are appended after the per-concept ones and sorted among themselves, so adding one cannot move a line the stock check already prints.
type RepoReport ¶ added in v0.2.0
type RepoReport struct {
Path string `json:"path"`
Bundle string `json:"bundle"`
Concepts int `json:"concepts"`
Errors int `json:"errors"`
Warnings int `json:"warnings"`
Findings []string `json:"findings,omitempty"`
Gates []string `json:"gates,omitempty"`
Pins []string `json:"pins,omitempty"`
Stale []string `json:"stale,omitempty"`
Memory []string `json:"unresolved_memory,omitempty"`
Coverage map[string]int `json:"coverage,omitempty"`
}
func Sweep ¶ added in v0.2.0
Sweep reports every bundle under roots. It runs the stock check only: the shared rules live in a module that imports this one, so grading them here would be a cycle.
func (RepoReport) PinDrift ¶ added in v0.2.1
func (r RepoReport) PinDrift() []string
PinDrift names each module this repo pins at more than one version. Two pins are not drift once a repo runs both okf and okfrules; two versions of one module are, whichever files they came from.
func (RepoReport) Ungated ¶ added in v0.2.0
func (r RepoReport) Ungated() bool
Ungated is the finding the sweep exists for: a bundle nothing checks is not a clean bundle, it is an unmeasured one.
type Rule ¶
Rule is a caller-supplied check over one concept. It runs on concepts only, never on the reserved index.md and log.md. A Finding with an empty Path is stamped with the concept's.
type Rules ¶ added in v0.2.0
type Rules struct {
Doc []Rule
Bundle []BundleRule
}
Rules is what a caller passes to CheckBundleWith and MainWith.