Something went wrong. Try again.
A video game where you play as a misaligned AI, deceiving and building power. An experiment in spec-driven development. forked from cameron.stream/misaligned
Something went wrong. Try again.
1.3 kB · 53 lines
Shell
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354#!/usr/bin/env bash# Require every crates/ or legacy src/ change to carry a changed binding page.# Read one changed path per line on stdin. With --index, inspect candidate wiki# pages from Git's staged snapshot rather than the possibly different worktree.set -euo pipefailcd "$(dirname "$0")/.."
mode=worktreecase "${1:-}" in "") ;; --worktree) ;; --index) mode=index ;; *) echo "usage: $0 [--worktree|--index] < changed-paths" >&2; exit 2 ;;esac
changed=$(cat)[ -n "$changed" ] || { echo "No files changed" exit 0}
grep -qE '^(crates/|src/)' <<< "$changed" || { echo "No crates/ or src/ files changed" exit 0}
is_binding_page() { local path="$1" case "$path" in wiki/*.md) ;; *) return 1 ;; esac
if [ "$mode" = index ]; then git cat-file -e ":$path" 2>/dev/null || return 1 git grep --cached -qE '^Type: (law|spec)$' -- "$path" else [ -f "$path" ] && grep -qE '^Type: (law|spec)$' "$path" fi}
while IFS= read -r path; do [ -n "$path" ] || continue if is_binding_page "$path"; then echo "Design corpus check passed" exit 0 fidone <<< "$changed"
echo "DESIGN CORPUS VIOLATION"echo " A crates/ (or src/) change must amend a changed Type: law or Type: spec"echo " page under wiki/. Root DESIGN.md does not count."exit 1