Files
hermes-agent/website/scripts/check_generated_skill_docs.sh
alt-glitch 05d92d3350 fix(dev): just docs-check ignores hand edits and leaves the real index alone
docs-check-generated compared the working tree with the index, so on a
laptop any unstaged docs edit failed as generator drift, just stopped before
the links and diagram checks, and `git add -N` left untracked drafts
intent-to-add in the real index. The check now works in a scratch copy of
the index, and given a generator command it snapshots the docs before
running it. CI's no-argument call compares against the committed docs as
before.

Co-authored-by: Bear Huddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-09 19:16:36 +05:30

28 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Fail when website/scripts/generate-skill-docs.py output differs from the committed docs.
#
# GitHub renders the committed copies, so a regeneration that changes anything
# means the published catalogs/pages are stale. Fix: run the generator and commit.
#
# Usage: check_generated_skill_docs.sh [generator command...]
# With a command (`just docs-check`), the docs are snapshotted before it runs, so
# uncommitted hand edits are not reported as generator drift. A scratch index
# keeps the snapshot and `git add -N` (which makes newly generated pages visible
# to `git diff`) out of the real index.
set -euo pipefail
paths=(website/docs website/sidebars.ts website/i18n)
index="$(mktemp)"
trap 'rm -f "$index"' EXIT
cp "$(git rev-parse --git-path index)" "$index"
export GIT_INDEX_FILE="$index"
if [ "$#" -gt 0 ]; then
git add -A -- "${paths[@]}"
"$@"
fi
git add -N website/docs website/sidebars.ts
if ! git diff --exit-code --stat -- "${paths[@]}"; then
echo "::error::website/scripts/generate-skill-docs.py output differs from the committed docs; run it and commit the result"
exit 1
fi