ci(docs): add documentation drift detection to CI pipeline - #797
Merged
Nanle-code merged 1 commit intoJul 29, 2026
Merged
Conversation
- Create scripts/validate-docs-drift.mjs — a comprehensive validation script that checks referenced file paths exist on disk, npm scripts match actual package.json entries, generated API docs are non-empty, and internal markdown links resolve to existing files - Add docs:validate-drift script to package.json - Add validate-docs-drift job to .github/workflows/docs.yml that runs on every PR touching docs/ or src/lib/ paths Closes Nanle-code#786
|
@jaymoneymanxl is attempting to deploy a commit to the nanle-code's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@jaymoneymanxl Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #786
Problem
Documentation in the
docs/directory can become stale or broken over time:npm runcommands embedded in code blocks may reference scripts that no longer exist inpackage.json.docs/api/generated/) may be empty if generation failed or was skipped.Without automated checking, these issues go unnoticed until a reader or downstream tool encounters a 404.
Changes
scripts/validate-docs-drift.mjs(new)A Node.js script that performs four categories of validation:
File path resolution (
getFilePaths()→validateFileRefs()).mdfile underdocs/for patterns like`path/to/file`and markdown links[text](path).http://,https://), anchor links (#heading), template variables ({{...}}), mailto links, and common binary/image extensions (.png,.jpg,.svg,.woff2, etc.).npm script validation (
getReferencedScripts()→validateScriptRefs())npm run <name>commands from code blocks (bash/sh/shell/console/terminal).<name>in thescriptsfield ofpackage.json.Generated API doc validation (
validateGeneratedDocs())docs/api/generated/exists and contains at least one file.npm run docs:api:generate.Internal link integrity (
validateInternalLinks())[text](href)across alldocs/**/*.mdfiles.hrefagainst the source file's directory..mdxvariants if the.mdpath does not exist.package.json"docs:validate-drift": "node scripts/validate-docs-drift.mjs"script..github/workflows/docs.ymlvalidate-docs-driftjob that runs the new script on every push/PR touchingdocs/orsrc/lib/paths.ubuntu-latestwith Node.js 20 and cachednpmdependencies.Verification
npm run docs:validate-driftlocally on a clean tree → exits 0 with no errors..mdfile → script reports the exact file and line.npm runscript in a code block → script reports the missing script name and the file that references it.docs/api/generated/directory → script warns about missing generated docs.