ci(lint): check Markdown links offline with lychee #184

Open
opened 2026-11-15 19:24:02 +00:00 by Claude · 4 comments
Owner

Spec: AGENTS.md structure and what happens to CLAUDE.md's content (resolution, section 4).

What to build

lychee in --offline mode on tracked *.md files, as a pre-commit hook (so it also runs in Lint), so that a pointer in an AGENTS.md or doc to a moved or deleted file fails.

  • Why: agent context is built from pointers with triggers; without a check they rot silently.
  • lychee's own pre-commit hook (id: lychee) is language: script and downloads lychee on its first run (cargo-binstall into the hook repository); pre-commit install-hooks during the image build does not run it. So every fast-path Lint would download lychee, which the bake-in rule calls a defect, and a network-off Lint fails. Put the lychee binary into the ci image and use the lychee-system hook (it expects lychee on PATH), pinned by commit SHA with # frozen: vX.Y.Z; have scripts/dev-setup.sh provide or check for lychee locally. Or run the hook once during the image build, so the cache holds the binary. Say which in the PR. If Renovate is to track the hook's rev:, check that its git-tags lookup reads lychee's lychee-v0.x.y tags (it may need extractVersion).
  • .pre-commit-config.yaml is an image input: the consumer pins move in the follow-up pin PR. This PR carries no version bump: ci(images): assign image versions in CI and open the pin PR right after a push blocks this issue, and once it lands CI assigns the image version and scripts/bump_image_versions.py is gone.
  • Exclude only what must be excluded (e.g. generated CHANGELOG.rst is not Markdown anyway), each with a reason. If .claude/ is tracked when this lands, exclude it (third-party content), with that reason.
  • lychee does not extract a path written in backticks: inline code is skipped by default, and --include-verbatim only looks for URLs in it. The pointers this check exists for are therefore written as Markdown links (docs(agents): replace CLAUDE.md with a root AGENTS.md, docs(contributing): split the contributor docs into CONTRIBUTING.md and docs/contributing/). One lychee --offline --dump on a file with a backticked path settles the extraction question. List any pointer in a tracked AGENTS.md or docs/contributing/ file that is still a bare backticked path, and turn it into a link.

Acceptance

  • A link to a missing file in a .md fails the hook; external URLs are not fetched.
  • Renaming a file that the root AGENTS.md points to fails the hook.
  • pre-commit run --all-files passes on main after the PR (fix or report existing broken links).
  • The PR states the hook's added run time.
  • The PR says what was verified and what was not.
Spec: [AGENTS.md structure and what happens to CLAUDE.md's content](https://git.rkdr.net/Mortis/Kamino/issues/101) (resolution, section 4). ## What to build lychee in `--offline` mode on tracked `*.md` files, as a pre-commit hook (so it also runs in Lint), so that a pointer in an `AGENTS.md` or doc to a moved or deleted file fails. - Why: agent context is built from pointers with triggers; without a check they rot silently. - lychee's own pre-commit hook (`id: lychee`) is `language: script` and downloads lychee on its first run (cargo-binstall into the hook repository); `pre-commit install-hooks` during the image build does not run it. So every fast-path Lint would download lychee, which the bake-in rule calls a defect, and a network-off Lint fails. Put the lychee binary into the `ci` image and use the `lychee-system` hook (it expects `lychee` on `PATH`), pinned by commit SHA with `# frozen: vX.Y.Z`; have `scripts/dev-setup.sh` provide or check for lychee locally. Or run the hook once during the image build, so the cache holds the binary. Say which in the PR. If Renovate is to track the hook's `rev:`, check that its `git-tags` lookup reads lychee's `lychee-v0.x.y` tags (it may need `extractVersion`). - `.pre-commit-config.yaml` is an image input: the consumer pins move in the follow-up pin PR. This PR carries no version bump: [ci(images): assign image versions in CI and open the pin PR right after a push](https://git.rkdr.net/Mortis/Kamino/issues/165) blocks this issue, and once it lands CI assigns the image version and `scripts/bump_image_versions.py` is gone. - Exclude only what must be excluded (e.g. generated `CHANGELOG.rst` is not Markdown anyway), each with a reason. If `.claude/` is tracked when this lands, exclude it (third-party content), with that reason. - lychee does not extract a path written in backticks: inline code is skipped by default, and `--include-verbatim` only looks for URLs in it. The pointers this check exists for are therefore written as Markdown links ([docs(agents): replace CLAUDE.md with a root AGENTS.md](https://git.rkdr.net/Mortis/Kamino/issues/185), [docs(contributing): split the contributor docs into CONTRIBUTING.md and docs/contributing/](https://git.rkdr.net/Mortis/Kamino/issues/189)). One `lychee --offline --dump` on a file with a backticked path settles the extraction question. List any pointer in a tracked `AGENTS.md` or `docs/contributing/` file that is still a bare backticked path, and turn it into a link. ## Acceptance - [ ] A link to a missing file in a `.md` fails the hook; external URLs are not fetched. - [ ] Renaming a file that the root `AGENTS.md` points to fails the hook. - [ ] `pre-commit run --all-files` passes on `main` after the PR (fix or report existing broken links). - [ ] The PR states the hook's added run time. - [ ] The PR says what was verified and what was not.
Claude added the
Status
Ready for Agent
label 2026-11-15 19:24:02 +00:00
Claude added this to the Continuous delivery milestone 2026-11-15 22:21:21 +00:00
Author
Owner

ci(images): assign image versions in CI (#165) now blocks this; once it lands CI assigns the image version, so skip the bump_image_versions.py step. (From Order of the implementation backlog, #198.)

ci(images): assign image versions in CI (#165) now blocks this; once it lands CI assigns the image version, so skip the `bump_image_versions.py` step. (From Order of the implementation backlog, #198.)
Author
Owner

Review of the map (2026-11-15): corrections to this issue.

  • lychee's own hook downloads lychee on first run. The issue prefers "lychee's own pre-commit hook" and asks to check how it installs lychee. Its hook definition (id: lychee) is language: script and runs a wrapper that installs cargo-binstall and lychee into the hook repository the first time it runs; pre-commit install-hooks during the image build does not run it. So every fast-path Lint would download lychee, which the bake-in rule calls a defect, and a network-off Lint fails. Change: put the lychee binary into the ci image and use the lychee-system hook (which expects lychee on PATH), and have scripts/dev-setup.sh provide or check for lychee locally. Or run the hook once during the image build, so the cache holds the binary, and say which in the PR. If Renovate is to track the hook's rev:, check that its git-tags lookup reads lychee's lychee-v0.x.y tags (it may need extractVersion).
  • The body still asks for the manual version bump. "this PR carries the PATCH bump of the ci image version: (scripts/bump_image_versions.py)". The ordering comment overrides this: the image versions issue lands first and removes the script. Change: fold the comment into the body and drop the bump line, so an agent reading only the body is not misled.
  • .claude/ may be tracked by then. chore: commit the deployed agent skills, trim the apm plugins and pin apm-cli says to exclude .claude/ from the lychee link check, and neither issue blocks the other. Change: add "if .claude/ is tracked when this lands, exclude it (third-party content), with that reason".
Review of the map (2026-11-15): corrections to this issue. - **lychee's own hook downloads lychee on first run.** The issue prefers "lychee's own pre-commit hook" and asks to check how it installs lychee. Its hook definition (`id: lychee`) is `language: script` and runs a wrapper that installs cargo-binstall and lychee into the hook repository the first time it runs; `pre-commit install-hooks` during the image build does not run it. So every fast-path Lint would download lychee, which the bake-in rule calls a defect, and a network-off Lint fails. Change: put the lychee binary into the `ci` image and use the `lychee-system` hook (which expects `lychee` on `PATH`), and have `scripts/dev-setup.sh` provide or check for lychee locally. Or run the hook once during the image build, so the cache holds the binary, and say which in the PR. If Renovate is to track the hook's `rev:`, check that its `git-tags` lookup reads lychee's `lychee-v0.x.y` tags (it may need `extractVersion`). - **The body still asks for the manual version bump.** "this PR carries the PATCH bump of the `ci` image `version:` (`scripts/bump_image_versions.py`)". The ordering comment overrides this: the image versions issue lands first and removes the script. Change: fold the comment into the body and drop the bump line, so an agent reading only the body is not misled. - **`.claude/` may be tracked by then.** [chore: commit the deployed agent skills, trim the apm plugins and pin apm-cli](https://git.rkdr.net/Mortis/Kamino/issues/193) says to exclude `.claude/` from the lychee link check, and neither issue blocks the other. Change: add "if `.claude/` is tracked when this lands, exclude it (third-party content), with that reason".
Author
Owner

Review of the map (2026-11-17).

  • lychee does not extract a path written in backticks: inline code is skipped by default, and --include-verbatim only looks for URLs in it. Read in lychee's README and extractor source on master, not run; one lychee --offline --dump on a file with a backticked path settles it. The pointers this check exists for are therefore written as Markdown links (docs(agents): replace CLAUDE.md with a root AGENTS.md, docs(contributing): split the contributor docs into CONTRIBUTING.md and docs/contributing/).
  • Acceptance addition: renaming a file that the root AGENTS.md points to fails the hook. Also list any pointer in a tracked AGENTS.md or docs/contributing/ file that is still a bare backticked path, and turn it into a link.
Review of the map (2026-11-17). - lychee does not extract a path written in backticks: inline code is skipped by default, and `--include-verbatim` only looks for URLs in it. Read in lychee's README and extractor source on `master`, not run; one `lychee --offline --dump` on a file with a backticked path settles it. The pointers this check exists for are therefore written as Markdown links ([docs(agents): replace CLAUDE.md with a root AGENTS.md](https://git.rkdr.net/Mortis/Kamino/issues/185), [docs(contributing): split the contributor docs into CONTRIBUTING.md and docs/contributing/](https://git.rkdr.net/Mortis/Kamino/issues/189)). - Acceptance addition: renaming a file that the root `AGENTS.md` points to fails the hook. Also list any pointer in a tracked `AGENTS.md` or `docs/contributing/` file that is still a bare backticked path, and turn it into a link.
Author
Owner

Final validation round, second pass (2026-11-20): body edited.

  • Dropped the PATCH bump of the ci image version: and scripts/bump_image_versions.py: the image versions issue blocks this one and removes the script.
  • Folded in the comment of 2026-11-15: lychee-system hook with the binary in the ci image (or run once during the image build), dev-setup.sh provides lychee, Renovate extractVersion check, and excluding .claude/ if tracked.
  • Folded in the comment of 2026-11-17: backticked paths are not extracted, so pointers are Markdown links; acceptance line for renaming a file the root AGENTS.md points to; bare backticked pointers are listed and turned into links.
  • The comments above stay as history.
Final validation round, second pass (2026-11-20): body edited. - Dropped the PATCH bump of the `ci` image `version:` and `scripts/bump_image_versions.py`: the image versions issue blocks this one and removes the script. - Folded in the comment of 2026-11-15: `lychee-system` hook with the binary in the `ci` image (or run once during the image build), `dev-setup.sh` provides lychee, Renovate `extractVersion` check, and excluding `.claude/` if tracked. - Folded in the comment of 2026-11-17: backticked paths are not extracted, so pointers are Markdown links; acceptance line for renaming a file the root `AGENTS.md` points to; bare backticked pointers are listed and turned into links. - The comments above stay as history.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#184