Documentation
¶
Overview ¶
Package okf implements an Open Knowledge Format (OKF) v0.1 conformance validator. It walks a bundle directory and reports structural violations as errors (which break conformance) and recommended-practice gaps as warnings. The logic is pure: it depends only on internal/model and internal/parse and never opens a store, so callers can validate a bundle without a database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendLog ¶
AppendLog records a concept change in dirAbs/log.md, the reserved per-directory changelog. It maintains a newest-first list of ISO-8601 (YYYY-MM-DD) date sections, each holding "- **<Kind>** [name](link)" bullets.
The file is created with a "# Log" title and NO YAML frontmatter (E3 forbids frontmatter in a reserved file). A new bullet is inserted at the top of today's section; when today's section is absent it is created immediately after the title, above any older sections, so the date headings stay newest-first (W5). Existing content is never reordered. The write is atomic.
func IsReservedOKFFile ¶
IsReservedOKFFile reports whether base is an OKF reserved file (log.md or index.md), which must never get its own log entry.
Types ¶
type Issue ¶
type Issue struct {
Code string `json:"code"`
Severity Severity `json:"severity"`
File string `json:"file"`
Message string `json:"message"`
}
Issue is a single validation finding. File is bundle-relative with forward-slash separators, or "" for a bundle-level issue.
type LogKind ¶
type LogKind string
LogKind is the leading bold word of a log.md bullet: the lifecycle event a concept entry records.
type Report ¶
type Report struct {
Bundle string `json:"bundle"`
Files int `json:"files"`
Issues []Issue `json:"issues"`
Errors int `json:"errors"`
Warnings int `json:"warnings"`
}
Report is the outcome of validating a bundle: the issues found and their tallies. A bundle is OKF v0.1 conformant when it has zero errors.
func Validate ¶
Validate walks bundle and checks OKF v0.1 conformance. It classifies each markdown file as a reserved file (index.md, log.md) or a concept file and applies the rule set, returning a Report. It returns a non-nil error only on a filesystem I/O failure (WalkDir or ReadFile); non-conformance is reported through the Report, not as an error.