fix: harden docs checker heading lines, definitions and docs symlinks
ci / check (push) Successful in 59s
ci / check (pull_request) Successful in 58s

- N1: never call Lines() on inline nodes; locate empty ATX headings after the
  end of all preceding blocks (no panic, correct line after `***`)
- N2: take reference definition lines from ast.LinkReferenceDefinition and
  drop refCtx/defRe
- N3: reject docs/adr and docs/plans that resolve outside the repository

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
endandClaude Sonnet 5.5 committed 2026-10-23 15:03:26 -07:00
1 parent 9eec1d1016
commit 694c43051e
6 files changed
+59 -62

No files matched your search

+3
View File
@@ -62,6 +62,9 @@ func Check(root string) (Result, error) {
} else if err == nil && !st.IsDir() {
c.add(d.dir, 1, "must be a real directory (symlinks are not allowed)")
continue
} else if r, err := filepath.EvalSymlinks(filepath.Join(root, d.dir)); err == nil && !within(real, r) {
c.add(d.dir, 1, "must be inside the repository (a symlinked parent directory is not allowed)")
continue
}
entries, err := os.ReadDir(filepath.Join(root, d.dir))
if err != nil {