Skip to content

docs-lint: detect frontmatter links: pointing at non-existent files in the repo #117

@IgorShevchik

Description

@IgorShevchik

Context

In PR #116 we discovered that the docs site shipped 43 broken GitHub links pointing at .claude/skills/... for ~24 hours after PR #114 relocated skills to skills/. Neither lint script caught it:

  • scripts/docs-lint.mjscheckAuditFreshness silently skips when the linked file doesn't exist locally (scripts/docs-lint.mjs:68-70).
  • scripts/docs-link-check.mjs — only resolves internal /docs/... paths; external https://github.com/... URLs are ignored entirely.

The breakage was discovered manually during release prep, not by CI. Without a guard, the next file relocation will reintroduce the problem.

Proposal

Add a lint rule that fails (or warns) when a frontmatter links: entry of the form https://github.com/bitrix24/b24jssdk/blob/main/<path> (or tree/main/<path>) points to a <path> that does NOT exist in the working tree.

Approaches in increasing rigor:

  1. Extend docs-lint.mjs: in checkAuditFreshness (or a new checkGithubPathsExist function), turn the silent skip into a warn (or error under --strict). One-line change at scripts/docs-lint.mjs:68-70.
  2. Extend docs-link-check.mjs: parse to: fields in frontmatter, detect the github.com/bitrix24/b24jssdk/(blob|tree)/main/<path> shape, verify <path> exists via statSync or git ls-tree. Add to the existing 0 broken link(s), 0 warning(s) report.

Approach 1 is cheaper and lives next to the existing audit-freshness logic, so failures share the same --strict switch with the rest of the docs-lint pipeline. Approach 2 is more thorough — it also catches links in body Markdown — but a larger surface.

Acceptance criteria

Out of scope

  • Catching link rot in plain Markdown link syntax ([label](url)) — useful but a wider net; start narrow.
  • Re-validating after a relocation — the lint will catch stale paths next time around, that's the point.

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions