Documentation
¶
Overview ¶
Package mdcheck holds the Markdown checks that tools/readmegen (the README) and tools/launchrender (the launch files under docs/launch/) share: line and fence splitting, the hook-claims check against docs/hooks/policy.md wording, and the AD-3 leak check. Messages name a file, a line and a detector, never key text.
Index ¶
- Constants
- Variables
- func HookClaims(file, page string, skip func(line int) bool) []string
- func HookClaimsWith(verbs *regexp.Regexp, file, page string, skip func(line int) bool) []string
- func Leaks(files map[string][]byte) []string
- func Lines(page string) ([]string, []bool)
- func Sentences(text string) []string
- type Unit
Constants ¶
const GitHooksFile = "docs/hooks/git.md"
GitHooksFile documents what the git hooks fail on: fail_on, by default a live key.
const PolicyFile = "docs/hooks/policy.md"
PolicyFile is the hook policy every prevention claim must stay within.
const PolicyKeys = "live and high-confidence keys"
PolicyKeys is the policy's wording of what the hook blocks. A sentence that says something blocks or prevents keys must say it, unless it is negated.
Variables ¶
var HeadingRE = regexp.MustCompile(`^(#{1,6})\s+(.*?)\s*#*\s*$`)
HeadingRE matches an ATX heading line.
var LaunchClaimVerbRE = regexp.MustCompile(`(?i)\b(block|blocks|blocked|blocking|prevent|prevents|prevented|preventing|stop|stops|deny|denies|protect|protects)\b`)
LaunchClaimVerbRE is the wider verb set of launch copy (tools/launchrender): the README's block and prevent plus stop, deny and protect. The README keeps the narrower set, since its pitch says the tool helps "stop them going public".
Functions ¶
func HookClaims ¶
HookClaims checks every clause of page (paragraphs, list items, table cells and fenced lines, split into sentences, then at semicolons and at ", and" before another mechanism) that says something blocks or prevents keys, unless it is negated. Code spans are left out before matching. Such a clause must say PolicyKeys and name the Claude Code hook: the subject itself, or for a pronoun or "the hook" the last mechanism named before it in the same paragraph or table row (a table cell without one takes the row's). Generic "hooks", git hooks, commits, pushes, pull requests, husky, lefthook, the GitHub Action and CI fail it: they fail on fail_on, live keys by default. skip reports 1-based lines to leave out (for example a section that restates the policy and is checked against it); nil skips nothing. Messages are "file:line: ...".
func HookClaimsWith ¶
HookClaimsWith is HookClaims with another set of claim verbs.
func Leaks ¶
Leaks is the AD-3 leak check: it scans each file with the embedded registry, verification off, test keys and inline allow markers included, and reports every key-shaped match by file, line and detector, never by its text. Only redacted forms such as "sk-pro...a1b2 (51)" may appear, and the registry patterns never match those. Messages are sorted.