feat: add docs checker and record templates
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>
This commit is contained in:
1 parent
b0428256bd
commit
750b7449b0
15 files changed
+1856
No files matched your search
@@ -0,0 +1,23 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user