forgot to add stuff

This commit is contained in:
2026-04-15 18:02:25 -06:00
parent 17874587a4
commit 7479acd3ee
10 changed files with 940 additions and 1 deletions

63
scripts/check-feature-spec.sh Executable file
View File

@ -0,0 +1,63 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"
log() {
printf '[check-feature-spec] %s\n' "$1"
}
BASE_SHA="${BASE_SHA:-}"
if [[ -z "$BASE_SHA" ]]; then
if git rev-parse --verify origin/main >/dev/null 2>&1; then
BASE_SHA="$(git merge-base origin/main HEAD)"
else
log "No BASE_SHA and origin/main unavailable; skipping check."
exit 0
fi
fi
if ! git rev-parse --verify "$BASE_SHA" >/dev/null 2>&1; then
log "BASE_SHA '$BASE_SHA' not found; skipping check."
exit 0
fi
changed_files="$(git diff --name-only "$BASE_SHA"...HEAD)"
if [[ -z "$changed_files" ]]; then
log "No changed files; nothing to enforce."
exit 0
fi
code_changed=0
spec_changed=0
while IFS= read -r path; do
[[ -z "$path" ]] && continue
case "$path" in
frontend/src/*|backend/*|src-tauri/src/*|shared/project-schema.json)
code_changed=1
;;
esac
case "$path" in
docs/specs/*.md)
spec_changed=1
;;
esac
done <<< "$changed_files"
if [[ "$code_changed" -eq 0 ]]; then
log "No app code changes detected; spec file not required."
exit 0
fi
if [[ "$spec_changed" -eq 1 ]]; then
log "Spec requirement satisfied."
exit 0
fi
log "Code changes detected without spec update in docs/specs/."
log "Add or update at least one spec file using docs/spec-template.md."
exit 1