#!/bin/sh # Tests for bin/check-index. # # The regression these exist for: SKILLS_INDEX.md is maintained by hand, and # two skills (`dream`, `experiment-spec`) shipped without a row — the index # rows lived on feature branches that were squash-merged after a directory # reorg, so the SKILL.md landed and the row did not (#15, #22). Nothing # errored; the index just quietly under-reported the library. set -u ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) SUT="$ROOT/bin/check-index" pass=0 fail=0 WORK=${TMPDIR:-/tmp}/check_index_test.$$ if [ ! -f "$SUT" ]; then printf 'FAIL: %s does not exist\n' "$SUT" exit 1 fi cleanup() { rm -rf "$WORK"; } trap cleanup EXIT INT TERM # new_fixture — a checkout with skills/alpha and skills/beta. new_fixture() { _f="$WORK/$1" mkdir -p "$_f/skills/alpha" "$_f/skills/beta" printf -- '---\nname: alpha\ndescription: a\n---\n' > "$_f/skills/alpha/SKILL.md" printf -- '---\nname: beta\ndescription: b\n---\n' > "$_f/skills/beta/SKILL.md" printf '%s' "$_f" } index() { _dir=$1; shift printf '# Engineering Skills Index\n\n| Skill | Description | Use when |\n|---|---|---|\n' > "$_dir/SKILLS_INDEX.md" for _n in "$@"; do printf '| `%s` | desc | when |\n' "$_n" >> "$_dir/SKILLS_INDEX.md" done } # expect <0|1>