Skip to content

docs: add staged Markdown pre-commit hook recipe - #11

Draft
vku2018 wants to merge 1 commit into
getdocrot:mainfrom
vku2018:codex/add-pre-commit-hook-docs
Draft

vku2018 wants to merge 1 commit into
getdocrot:mainfrom
vku2018:codex/add-pre-commit-hook-docs

Conversation

@vku2018

@vku2018 vku2018 commented Jul 3, 2026

Copy link
Copy Markdown

Fixes #9

Summary:

  • document a copy-paste Husky pre-commit hook for staged Markdown files
  • run docrot-cli --only links,pkg on the unique directories containing staged Markdown, while keeping the full repo scan in CI
  • add a README regression test so the recipe stays discoverable

Validation:

  • git diff --check
  • npm test -- test/readme.test.ts
  • npm run typecheck
  • npm run build
  • npm run dev -- --only links,pkg --fail-on=never

Note: full npm test still fails for existing Windows-specific issues unrelated to this docs change: test/mcp.test.ts cannot spawn node_modules/.bin/tsx, test/fix.test.ts expects LF-only text, and test/scan.test.ts misses missing-export in this local Windows run.

@getdocrot

Copy link
Copy Markdown
Owner

CI approved. The recipe checks out against 0.2.4:

  • --only links,pkg is a valid subset (examples,links,pkg)
  • per-directory runs resolve relative link targets outside the scanned directory, so the narrower scope doesn't create false positives
  • exit code is 1 on hard errors, so the hook blocks the commit as intended

One edge worth a sentence in the recipe: a staged file at the repo root makes dirname return ., so that commit runs a full-repo scan — still correct, just no longer the fast path. With that noted, happy to take this. Mark it ready for review when you're done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pre-commit / husky recipe

3 participants