docs new creates ADRs and plans from embedded templates; docs check reports path:line: message problems per docs/docs-format.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
24 lines
767 B
Go
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)
|
|
}
|
|
}
|