Repository navigation
test(scripts): check relative links and anchors in the docs (#228) - #251
Merged
juancguerrerodev merged 10 commits intoDec 6, 2026
Merged
Conversation
10 of 16 tasks
Contributor
|
Ready to merge once the pull request template is filled in, including the "I read and ran everything" box (details on #234). 🦀 |
juancguerrerodev
force-pushed
the
test/docs-links-228
branch
from
December 6, 2026 07:57
e6b45b2 to
e293cae
Compare
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 #228
The docs link to each other a lot, and every relative link pointed at a file that exists and every
#anchormatched aheading, but nothing checked it. A broken link in a contributor doc is the first thing a new contributor trips on.
What this PR does
scripts/docs-links.mjswith two pure functions:linksIn(markdown), the targets of the inline links[text](target)in a Markdown text, skipping fenced code blocks and inline code; andslug(heading), the GitHubanchor for a heading (lower case, punctuation dropped, spaces as
-, accents kept).scripts/docs-links.test.mjs(node:test, likescripts/check-privacy.test.mjs): unit tests of both helpers onmade-up Markdown (a link in a code block or inline code is skipped,
https:andmailto:links are returned for thecaller to skip,
slug("How to propose work")ishow-to-propose-work,slug("Qué hace")isqué-hace), plus awalk over every
.mdfile tracked by git (git ls-files "*.md") checking that each relative link's file exists and,when there is an
#anchorand the target is Markdown, that a heading in it has that slug (repeated headings get the-1,-2suffixes GitHub gives them). Each failure names the file, the link and the reason.http:,https:,mailto:, and the like) are skipped; nothing is fetched.Verification note
Proven to fail on purpose, then undone: pointing a link in
CONTRIBUTING.mdatdocs/devices-missing.mdfailed withCONTRIBUTING.md: link "docs/devices-missing.md" does not point at an existing file, and a wrong anchor failed withCONTRIBUTING.md: link "docs/devices.md#run-it-on-an-iphone-wrong" points at an anchor no heading in docs/devices.md has.No real broken link was found in the 84 tracked Markdown files, so no doc changes here.
In this Windows checkout the root scripts glob also shows one pre-existing failure in the devices table check
(
docs/devices.md holds the table), untouched by this change; the new tests pass in that same run.How to check
node --test scripts/docs-links.test.mjs pnpm testKeep in mind
Pull request template
What and why
Closes #228.
Adds a test that every relative link and anchor in the tracked Markdown resolves.
Vision fit
Principle 4, honest about limits: a moved file or renamed heading in the contributor docs now fails a test instead of shipping.
Non-negotiables
Checklist
acceptedproposal.pnpm check:privacy,pnpm typecheck,pnpm lint,pnpm testandnode scripts/guard/check.mjs --patterns scripts/guard/patterns.txt. Gate note: privacy and guard pass on this checkout today; the rest was run per package as listed under AI agents, not as one root gate on this Windows machine, where unrelated pre-existing failures appear in the site badges, the devices table and mobile source scans.packages/copy, in es-419 and en, with matching keys and placeholders, and no em or en dashes.Model path
packages/model,agent,skillsoreval, the prompt, the router, tool descriptions, normalizers, examples or the model file.Screenshots
New dependencies and network calls
None. No new dependency and no new network call.
AI agents
What was run: node --test scripts/docs-links.test.mjs (8/8 over all 84 tracked Markdown files); the root scripts test glob (92 pass, 1 pre-existing devices-table failure in this Windows checkout).