Files
go/internal/docs/plan.go
endandClaude Opus 5.5 cc482d9a9b
release / release (push) Successful in 17s
ci / check (push) Successful in 18s
feat: add docs checker for ADRs and implementation plans (#1)
Add cmd/docs, the first corestack component: `docs new adr|plan "Title"`
writes records from embedded templates, and `docs check` validates them
against the public format spec in docs/docs-format.md (timestamp IDs,
frontmatter keys and enums, separate decision and implementation status,
supersession symmetry, MADR 4 layout with required Consequences, plan
sections, and repo-root/durable references), reporting path:line errors.

Also adds the module skeleton (go.auvem.com/corestack, BSD-3-Clause,
README, AGENTS.md, CLAUDE.md), Gitea CI running tests and docs check,
a tag-triggered goreleaser release for darwin/linux binaries, and the
accepted ADR adopting the format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-23 15:56:03 -07:00

24 lines
767 B
Go

package docs
var planRefs = []refSpec{{"tracking", kURL}, {"adrs", kAdr}, {"completion", kURL | kFile}}
func (c *checker) plan(r *record, m *fm) {
m.keys("status", "tracking", "adrs", "completion")
status, ok := m.enum("status", "draft", "active", "completed", "cancelled")
m.refs(planRefs...)
r.status = status
if !ok {
return
}
closed := status == "completed" || status == "cancelled"
if status == "active" && len(r.lists["tracking"]) == 0 {
m.problemf("status", "status active requires tracking")
}
if closed && len(r.lists["completion"]) == 0 {
m.problemf("status", "status %s requires completion", status)
}
if !closed && len(r.lists["completion"]) > 0 {
m.problemf("completion", "completion must be empty while status is %s", status)
}
}