Documentation
¶
Overview ¶
Package adr parses ADR files under docs/decisions, renders the ACTIVE.md index, and scaffolds new ADR files from the rendered template (awf new adr). Generated by awf sync (regenerates docs/decisions/ACTIVE.md).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FilenameRe = regexp.MustCompile(`^(\d{4})-.+\.md$`)
FilenameRe matches an ADR filename (NNNN-slug.md); group 1 is the 4-digit number.
Functions ¶
func NewFile ¶ added in v0.6.0
NewFile scaffolds a new ADR under dir: the next sequential number, the rendered template.md with every marker comment stripped and its date and title heading filled in, named NNNN-slug.md. Refuses to overwrite an existing file at that path. invariant: adr-new-strips-markers invariant: adr-new-heading-matches-file invariant: adr-new-no-overwrite
func NextNumber ¶ added in v0.6.0
NextNumber returns the next available 4-digit ADR number for dir: one more than the highest number ParseDir finds, or "0001" for an ADR-less dir. invariant: adr-new-sequential-numbering
func RenderActiveMD ¶
RenderActiveMD renders the ACTIVE.md index for dir, grouped by status. It returns a placeholder index when dir holds no ADRs (ADR-0020). The content carries no generated-by banner — like RenderDomainIndex, that is the caller's job (internal/project's generateActiveMD, via injectBanner) so every rendered artifact's banner comes from the one canonical source.
func RenderDomainIndex ¶
RenderDomainIndex renders the per-domain ADR index for the decisions directory dir: every ADR whose domains frontmatter includes domain, grouped by status in the same order as ACTIVE.md, with links relative to docs/domains/ (one dir over) and each superseded entry annotated with its successor. Returns a placeholder line when no ADR matches, so the rendered section is never empty.
Types ¶
type ADR ¶
type ADR struct {
Number string // e.g. "0001"
Title string // e.g. "ADR-0001: Template Overlay Rendering Engine"
Status string // e.g. "Accepted"
Filename string // e.g. "0001-template-overlay-rendering-engine.md"
Path string // path as globbed
Domains []string // `domains:` frontmatter (ADR-0014)
SupersededBy string // `superseded_by:` frontmatter (e.g. "0008", or "")
RetiresInvariants []string // `retires_invariants:` frontmatter (ADR-0031)
Sections map[string]string // `## ` heading -> section body
}
ADR is a parsed ADR record.