Skip to content
prod e051e98
Browse

Doc guardrails

Linters · hooks · rules · CI

This page is the runtime inventory of the doc-guardrail layer — the automation that prevents the three recurring documentation bug-classes a full CodeCanyon-playbook audit surfaced (2026-06-12). For how to author, see Site Authoring Capabilities.

Bug-class (real examples)Guard
Fragile shell in prose — commented-line greps, ** globstar off, missing --no-ansi, non-idempotent >>/crontab, indented heredoc EOF inside ssh "…", ssh -T exit-gating, inline -pPASSlint-mdx-shell.mjs
Doc ↔ reality drift — hardcoded git SHAs / php8.x copied as a fixed truth / VERSION="x.y.z" replaced with a real vendor number, security-header count 5-vs-6, grade A vs A+check-doc-drift.mjs
”Done” claimed without buildingverify-before-done hook + CI gate
ScriptWhat it flagsnpm
lint-mdx-shell.mjsExtracts fenced bash/sh blocks; flags the footguns above (errors = inline secrets / placeholder secrets; warnings = the rest). Runs actionlint on yaml GitHub-Actions blocks. --shellcheck adds a syntax pass (noisy on doc placeholders — opt-in).npm run lint:mdx
check-doc-drift.mjsHardcoded SHAs/versions + cross-page contradictions (header count, grade word).npm run lint:drift
bothnpm run doc:lint

Both default to exit-1 on error (CI) and take --warn to stay advisory (hooks). They take file args or default to the whole src/content/docs corpus.

Agent hooks (.agents/scripts/, mirrored to .claude / .cursor / .codex)

Section titled “Agent hooks (.agents/scripts/, mirrored to .claude / .cursor / .codex)”
HookEventBehavior
guard-git-revert.shPreToolUse (Bash)Blocks git checkout -- / restore / reset --hard / stash / clean — these discard work git never stored, and a parallel agent or Malek may have authored it. Override per-command: ZAJ_ALLOW_REVERT=1.
lint-mdx-on-edit.shPostToolUse (Write/Edit)Advisory — runs the linters on the edited .mdx, prints findings, never blocks.
verify-before-done.shStop / SubagentStopNudges npm run build + npm run doc:lint when uncommitted .mdx has no fresh build (marker: app/.zaj/verify/last-build, written by postbuild). Advisory; ZAJ_VERIFY_STRICT=1 hard-blocks.

05-mdx-shell-blocks · 06-no-hardcoded-reality · 07-single-source-of-truth · 08-docs-secrets-and-destructive · 09-verify-before-done (and 04-no-clobber-parallel-edits — never revert another session’s work).

  • doc-checks.yml (PR gate) — npm run build + lint:mdx + lint:drift required; step-contract advisory. Make it blocking via branch-protection required checks.
  • link-check.yml (weekly + manual) — lychee for external link rot (internal links already covered at build).

Run /doc-lint [scope] or npm run doc:lint before declaring a doc done. The doc-build-verifier agent runs the build and the lint pass. Fix errors (CI-blocking); warnings are advisory.