chore: add markdown link checking (hk pre-commit hook + CI job)#38
Conversation
Validate markdown links on staged *.md files before each commit using tcort/markdown-link-check, orchestrated by the hk git hook manager. - hk.pkl: pre-commit + check hooks running markdown-link-check - .markdown-link-check.json: timeouts, 429 retries, ignored hosts, UA - mise.toml: provision markdown-link-check; add lint:links task - dev-docs/GIT_HOOKS.md: setup + usage (hk install required per clone) CHANGELOG.md and node_modules are excluded from checks.
Run markdown-link-check on all *.md files on push/PR to main, reusing the same hk.pkl globs/excludes as the local pre-commit hook for a single source of truth. hk is installed on the fly (mise exec hk@1.48.0) since it has no Intel-Mac binary and is not in mise.toml [tools]; CI runs linux.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds markdown link validation infrastructure via hk and markdown-link-check, integrates into mise tasks and CI lint job, and documents git hook setup. Updates repository references across English and Korean docs from amondnet/asana to pleaseai/asana. Fixes Bun module mock leakage in two test files by capturing and restoring real modules in afterAll hooks. ChangesMarkdown link-check setup
Test module mock leak prevention
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request configures markdown link validation using markdown-link-check and the Git hook manager hk, adding configuration files, documentation, and a lint:links task in mise.toml. The review feedback suggests decoupling the lint:links task from hk by using find to run markdown-link-check directly, which improves compatibility for Intel Mac users who cannot easily install hk, and updating the documentation accordingly.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 84-87: Replace the mutable version tags in the GitHub Actions
workflow with pinned SHAs to prevent supply chain drift. Update the
actions/checkout action from `@v4` to use a specific commit SHA, and update the
jdx/mise-action from `@v2` to use a specific commit SHA. Additionally, add
persist-credentials: false to the actions/checkout step to strengthen token
handling security by preventing the action from persisting authentication
credentials after the job completes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 90e7ea0e-c7e7-441b-81f4-0c5e1eb56161
⛔ Files ignored due to path filters (1)
hk.pklis excluded by!**/*.pkl
📒 Files selected for processing (4)
.github/workflows/ci.yml.markdown-link-check.jsondev-docs/GIT_HOOKS.mdmise.toml
There was a problem hiding this comment.
1 issue found across 5 files
Architecture diagram
sequenceDiagram
participant Dev as Developer
participant Git as Git (commit)
participant Hk as hk (hook manager)
participant MLC as markdown-link-check
participant Config as Config (hk.pkl + .markdown-link-check.json)
participant CI as CI (GitHub Actions)
participant External as External URLs
Note over Dev,External: NEW: Markdown link check flow
Dev->>Git: git commit staging
Git->>Hk: NEW: invoke pre-commit hook (hk)
Hk->>Config: read hk.pkl, parse steps
Config-->>Hk: markdown-link-check step definition
Hk->>Hk: NEW: filter staged *.md files, exclude CHANGELOG.md & node_modules/**
Hk->>MLC: NEW: markdown-link-check --config .markdown-link-check.json --quiet <files>
MLC->>External: HTTP HEAD/GET requests for each link
alt All links valid
External-->>MLC: 200/206 (or 2xx)
MLC-->>Hk: exit 0
Hk-->>Git: allow commit
Git-->>Dev: commit success
else Broken link or timeout
External-->>MLC: 4xx/5xx / timeout
MLC-->>Hk: exit non-zero
Hk-->>Git: block commit
Git-->>Dev: commit blocked with error
end
Note over CI,External: CI job on push/PR to main
CI->>Git: checkout code
CI->>CI: setup mise (node + markdown-link-check)
CI->>Hk: NEW: mise exec hk@1.48.0 -- hk check --all
Hk->>Config: read same hk.pkl config
Config-->>Hk: steps for "check" hook (same as pre-commit)
Hk->>Hk: NEW: glob all *.md (excluding CHANGELOG.md & node_modules/**)
Hk->>MLC: same command, with all files
MLC->>External: check links
alt All valid
External-->>MLC: success
MLC-->>Hk: exit 0
Hk-->>CI: pass
CI-->>CI: job success
else Links broken
External-->>MLC: error
MLC-->>Hk: exit non-zero
Hk-->>CI: fail
CI-->>CI: job failure (strict/blocking)
end
Note over Hk,CI: hk not in mise.toml (no Intel Mac binary)<br/>CI installs hk via mise exec
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Bun's mock.restore() does not revert mock.module() registrations, so the config/asana-client module mocks in these command tests leaked into later files. Depending on filesystem-dependent test file ordering (sorted on macOS, inode order on Linux CI), a stubbed loadConfig made the refreshTokenIfNeeded tests in asana-client.test.ts early-return, failing 3 tests on CI only. Capture the real modules by value and re-install them in afterAll so each file leaves global module state clean.
- Point repo links at github.com/pleaseai/asana (amondnet/asana 404s) - Ignore Nuxt Content internal routes (rendered, not file-checkable) and bot-blocked hosts (app.asana.com, npmjs.com, npm.im return 403 to the checker UA) in .markdown-link-check.json
- lint:links task no longer depends on hk (not in mise [tools]); run markdown-link-check directly via find so 'mise run lint:links' works without a separate hk install (gemini-code-assist) - update GIT_HOOKS.md to reflect that lint:links runs markdown-link-check directly rather than via hk (gemini-code-assist)
There was a problem hiding this comment.
🧹 Nitpick comments (1)
mise.toml (1)
26-26: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winPrune
node_modulesduring traversal to avoid unnecessary filesystem scans.At Line 26,
-not -pathexcludes output but still traversesnode_modules/**, which can makelint:linksmuch slower on large workspaces.Suggested change
-run = "find . -name '*.md' -not -path '*/node_modules/*' -not -name 'CHANGELOG.md' -exec markdown-link-check --config .markdown-link-check.json --quiet {} +" +run = "find . -type d -name node_modules -prune -o -type f -name '*.md' -not -name 'CHANGELOG.md' -exec markdown-link-check --config .markdown-link-check.json --quiet {} +"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@mise.toml` at line 26, The find command in the run field at line 26 uses -not -path to exclude node_modules from results, but still traverses into those directories, causing unnecessary filesystem scans. Replace the -not -path '*/node_modules/*' exclusion with -path '*/node_modules' -prune to prevent find from descending into node_modules directories entirely during traversal. This requires restructuring the find command to use the -prune action before the -name and other conditions so that matching directories are skipped at traversal time rather than just filtered from results.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@mise.toml`:
- Line 26: The find command in the run field at line 26 uses -not -path to
exclude node_modules from results, but still traverses into those directories,
causing unnecessary filesystem scans. Replace the -not -path '*/node_modules/*'
exclusion with -path '*/node_modules' -prune to prevent find from descending
into node_modules directories entirely during traversal. This requires
restructuring the find command to use the -prune action before the -name and
other conditions so that matching directories are skipped at traversal time
rather than just filtered from results.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 84224baf-ebd5-431d-8e44-7650be6ced6d
📒 Files selected for processing (2)
dev-docs/GIT_HOOKS.mdmise.toml
✅ Files skipped from review due to trivial changes (1)
- dev-docs/GIT_HOOKS.md
Summary
Add markdown link validation using
markdown-link-check, wired in at two layers with a single shared config (hk.pkl):hk) — checks staged*.mdfiles before each commit*.mdfiles on push/PR tomainChanges
hk.pkl—pre-commit+checkhooks runningmarkdown-link-check.markdown-link-check.json— timeouts, 429 retries, ignored hosts (localhost), browser UAmise.toml— provisionmarkdown-link-check; addlint:linkstask (file written in English).github/workflows/ci.yml—Markdown Link Checkjob reusing the samehk.pklglobs/excludesdev-docs/GIT_HOOKS.md— setup & usage docsCHANGELOG.md(auto-generated) andnode_modules/**are excluded from checks.Notes
hk installrequired per clone — the pre-commit hook lives in.git/hooks/and is not committed.hkis not inmise.toml [tools]— it ships nodarwin/amd64(Intel Mac) binary. Install viamise use -g hk(linux / Apple Silicon) orbrew install hk(Intel Mac). CI installs it on the fly (mise exec hk@1.48.0).Verification
hk check --all --plan→ 47 files matched (CHANGELOG.mdexcluded as expected).Summary by cubic
Add Markdown link checking with
markdown-link-checkinhkpre-commit and CI to catch broken links early. Also fixes broken docs links and stabilizes tests that were flaky due to leaked module mocks.New Features
hkpre-commit checks staged*.md; excludesCHANGELOG.mdandnode_modules/**.mainusinghk.pklglobs..markdown-link-check.jsonsets timeouts, 429 retries, browser UA; ignores localhost, Nuxt internal routes, and bot-blocked hosts (app.asana.com,npmjs.com,npm.im).mise.tomlprovisionsnpm:markdown-link-checkand addslint:linksthat runs the checker directly (nohkneeded); docs indev-docs/GIT_HOOKS.md.Bug Fixes
https://github.com/pleaseai/asana.afterAllto avoidmock.module()leaks and order-dependent CI failures.Written for commit b366bff. Summary will update on new commits.
Summary by CodeRabbit