Documentation
¶
Overview ¶
Package mapfile reads a product's map from its .physa directory: the product's folder, each capability's folder and the glossary. A folder is read whole: index.md for the promise, stewards, title and overview, then rules.md, decisions.md and questions.md for its entries. It turns them into entries (rules, decisions and questions), anchors and terms, describes each file it read so the checks can judge the folder's format, and reports every spot where the map is malformed, with its file and line. It judges form only: what an entry of each kind must carry, whether anchors point anywhere, and whether a folder's contents match its entries are questions for the checks built on top of it.
Index ¶
Constants ¶
const ( Rule = mapfolder.Rule Decision = mapfolder.Decision Question = mapfolder.Question )
The entry kinds, one per kind file of a folder.
const OldLayout = "the map is in the old single-file format; convert it to folders (docs/architecture/09-capability-folders.md)"
OldLayout is the message for each file of a map still in the single-file layout.
Variables ¶
This section is empty.
Functions ¶
func Read ¶
Read reads the map in root/.physa. The error is for I/O failure, such as a missing .physa directory; every fault in the format is a Problem, and reading goes on past each one. A missing capabilities directory means the map has no capabilities yet and is not a Problem; a capabilities path that is not a directory is one. A map in the old single-file layout gives one Problem per old file, saying to convert it.
Types ¶
type Anchor ¶
type Anchor struct {
Kind AnchorKind
Value string // "1102", "a1b2c3d" or "docs/vision.md"
}
Anchor links an entry to the change or document that made it real.
type AnchorKind ¶
type AnchorKind int
AnchorKind says what an anchor points at.
const ( PR AnchorKind = iota + 1 Commit Doc )
The anchor kinds: a pull request, a commit, or a document in the repo.
type Entry ¶
type Entry struct {
Kind Kind
Heading string
Path string // the kind file it sits in, e.g. ".physa/capabilities/init/rules.md"
Line int // line of the heading in that file
Slug string
Role string // "decided" or "raised", empty without a person
Person string
How string // text after the person's comma, e.g. "accepting a proposal"
Date string
Anchors []Anchor
Body string // prose between the meta line and Because:/Rejected:, blank lines dropped
Because string
Rejected []string
MetaHas Meta
// contains filtered or unexported fields
}
Entry is one rule, decision or question.
type File ¶
type File struct {
Path string // the folder, slash-separated, relative to the root
Name string // the folder's name, the capability's slug; "product" for the product
Lines int // lines of index.md, as wc -l counts them
Promise string
Stewards []string
Title string
Overview string // index.md's overview paragraph, its lines joined by "\n"
OverviewLine int // line of the overview's first line in index.md; 0 without one
Entries []Entry // rules, then decisions, then questions, each in file order
Parts []Part // index.md first, then each kind file the folder has
}
File is the product or one capability: its folder, read whole.
type Map ¶
type Map struct {
Product *File // nil when the product's folder is missing
Capabilities []*File // sorted by Name
Glossary []Term
HasReadme bool
}
Map is everything read from a product's .physa directory.
type Meta ¶
type Meta struct {
Slug, Person, Date, Anchors bool
}
Meta says which parts of an entry's meta line were present.
type Part ¶
type Part struct {
Path string // slash-separated, relative to the root
Kind Kind // 0 for index.md
Lines int // as wc -l counts them
Title string // the text after "# ", empty without a title
TitleLine int
// Contents are the "- " lines under ## Contents in a kind file, or the
// link lines of index.md, as written.
Contents []Line
// Headings are every heading outside a fenced block, "#" marks included.
Headings []Line
// OutsideEntries are the lines of "###" headings outside ## Entries; in
// index.md, every "###" heading.
OutsideEntries []int
// Text is index.md's text as read, for the checks to judge its grammar;
// empty in a kind file.
Text string
}
Part is one file of a folder as it was read, for the checks to judge its format without reading it again.