chore(dev): validate markdown links

This commit is contained in:
Guillaume ARM 2026-06-09 02:34:40 +02:00
parent 6ac86ef1e2
commit 25ca189e49
4 changed files with 21 additions and 5 deletions

View File

@ -16,7 +16,7 @@ Use `docs/README.md` as the entrypoint for CC:Tweaked, CraftOS-PC, Advanced Peri
- Use `/apis/libtest.lua` for test scripts under `tests/`; `/programs/runtest.lua` prints `__TRAPOS_TEST_OK__` only after the suite passes.
- `libtest` cancels each case after `3`s (`--timeout <s>` / `--no-timeout` to override); never commit a hanging test to `tests/`. Slow harness fixtures go in `tests/harness/` behind dedicated recipes. See `docs/adrs/adr-0009-layered-test-timeouts.md`.
- Git hooks own commit/push verification: pre-commit runs `just check test`, and pre-push runs `just ci`. When explicitly asked to commit and/or push, do not run `just test` manually first; rely on the hooks. See `docs/adrs/adr-0011-git-hooks-own-commit-push-verification.md`.
- After editing Lua, run `just check` and fix all `luacheck` warnings.
- After editing Lua or Markdown, run `just check` and fix all `luacheck` warnings and `lychee` broken-link reports (markdown link validation is offline-only via `just lint-markdown`).
- Use 2-space indent, semicolons, and `local function`.
- `require` paths are absolute ComputerCraft paths, for example `require('/apis/net')()`.
- Most API modules return factories; call the required module once before use.

View File

@ -2,7 +2,7 @@
## Installation
Install `just`, `jq`, `luacheck`, `openssl`, and [CraftOS-PC v2.8.3+](docs/install-craftos-pc.md), then run:
Install `just`, `jq`, `luacheck`, `openssl`, `lychee` (`brew install lychee`, or `cargo install lychee` if you already have a Rust toolchain), and [CraftOS-PC v2.8.3+](docs/install-craftos-pc.md), then run:
```sh
just install trapos-install && echo ok

View File

@ -82,8 +82,15 @@ check-openssl:
exit 1; \
}
# Verify lychee is installed.
check-lychee:
@command -v lychee >/dev/null 2>&1 || { \
printf '%s\n' 'lychee not found on $PATH. See DEVELOPMENT.md.' >&2; \
exit 1; \
}
# Verify tools needed for local installation and CraftOS-PC launch recipes.
check-install: check-craftos check-jq check-luacheck check-openssl
check-install: check-craftos check-jq check-luacheck check-openssl check-lychee
# Generate local secrets on first install.
generate-env:
@ -356,6 +363,11 @@ test-timeout-shell: (_timeout-fixture "/tests/harness/slow-case.lua" "${TRAP_CCL
# Fast regression guard for both timeout layers. Wired into `ci`.
test-timeout: test-timeout-lua test-timeout-shell
# Lint all Lua source with luacheck.
check: check-luacheck
# Lint all Lua source with luacheck and validate markdown links.
check: check-luacheck check-lychee
luacheck --quiet .
@just lint-markdown
# Validate local markdown links and heading anchors with lychee.
lint-markdown: check-lychee
lychee --config lychee.toml .

4
lychee.toml Normal file
View File

@ -0,0 +1,4 @@
offline = true
include_fragments = "full"
include_verbatim = false
extensions = ["md"]