Repository navigation
fix: validate empty-text links and /assets/ links to the project root - #256
Merged
Merged
Conversation
validateLinks required at least one character of link text, so links like [](./image.jpg) were never checked (docmd-io#251). Absolute /assets/... links were only resolved under docs/, although the build copies the project-root assets/ directory to /assets/, so valid links were reported as broken (docmd-io#250). Fixes docmd-io#251 Fixes docmd-io#250
Member
|
Thank you @Aryan007-dev for the thorough fix and the test coverage! 🐛 Both bugs are now resolved — the empty alt-text regex and the |
This was referenced Oct 14, 2026
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.
Description
Fixes #251
Fixes #250
Two bugs in
validateLinks(packages/core/src/commands/mcp.ts), used by bothdocmd validateand the MCPvalidate_docstool.#251: links with empty text were never checked. The link regex was
/\[([^\]]+)\]\(([^)]+)\)/, which requires at least one character between the brackets.[](./missing.jpg)therefore never matched, andvalidatereported success. The text part is now matched with*.#250:
/assets/...links were reported as broken. Absolute links were resolved only under the docs directory, e.g.docs/assets/images/screenshot.jpg. The build copies the project-rootassets/directory to/assets/in the site (engine/assets.ts), so a link to a file inassets/is valid. A/assets/...link is now also accepted when the file exists under the project-rootassets/. Docs-relative resolution is unchanged and still checked first, and a missing file is still reported.Type of change
Tests
I added four cases to
tests/cli-contracts/validate-workspace.test.js, using the same pattern as the existing M-1 checks:#251: a broken link with empty text exits 1. Fails before the fix.#251: a valid link with empty text exits 0.#250: a/assets/...link to a file in the project-rootassets/exits 0. Fails before the fix.#250: a/assets/...link to a missing file still exits 1.pnpm verifypasses (node tests/runner.js: 851 passed, 0 failed across 25 files).eslintreports no new warnings formcp.ts(25 before, 25 after).Not covered: workspace builds copy the shared
assets/into each project's output too. I only checked the single-projectdocmd validatepath, which is what both issues report.Checklist: