repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources15d ago| #1 | #!/usr/bin/env bash |
| #2 | # ╔══════════════════════════════════════════════════════════════════════════╗ |
| #3 | # ║ Three Laws Integrity Checker ║ |
| #4 | # ║ Verifies the constitution hash matches expectations ║ |
| #5 | # ║ Usage: bash automation/three-laws-check.sh ║ |
| #6 | # ╚══════════════════════════════════════════════════════════════════════════╝ |
| #7 | set -euo pipefail |
| #8 | |
| #9 | RESET="\033[0m" |
| #10 | BOLD="\033[1m" |
| #11 | GREEN="\033[32m" |
| #12 | RED="\033[31m" |
| #13 | CYAN="\033[36m" |
| #14 | YELLOW="\033[33m" |
| #15 | |
| #16 | ok() { printf "${GREEN}✅ %s${RESET}\n" "$*"; } |
| #17 | warn() { printf "${YELLOW}⚠️ %s${RESET}\n" "$*"; } |
| #18 | die() { printf "${RED}❌ %s${RESET}\n" "$*" >&2; exit 1; } |
| #19 | |
| #20 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| #21 | REPO_ROOT="${SCRIPT_DIR}" |
| #22 | LAWS_FILE="${REPO_ROOT}/three-laws.md" |
| #23 | |
| #24 | printf "${CYAN}${BOLD}" |
| #25 | echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" |
| #26 | echo " Three Laws — Constitution Integrity Check" |
| #27 | echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" |
| #28 | printf "${RESET}\n" |
| #29 | |
| #30 | # Check file exists |
| #31 | if [ ! -f "${LAWS_FILE}" ]; then |
| #32 | die "three-laws.md not found at ${LAWS_FILE}" |
| #33 | fi |
| #34 | ok "Found three-laws.md" |
| #35 | |
| #36 | # Check file is non-empty |
| #37 | SIZE=$(wc -c < "${LAWS_FILE}") |
| #38 | if [ "${SIZE}" -lt 100 ]; then |
| #39 | die "three-laws.md is too small (${SIZE} bytes) — expected at least 100 bytes" |
| #40 | fi |
| #41 | ok "File size: ${SIZE} bytes" |
| #42 | |
| #43 | # Compute SHA-256 hash |
| #44 | if command -v sha256sum &>/dev/null; then |
| #45 | HASH=$(sha256sum "${LAWS_FILE}" | cut -d' ' -f1) |
| #46 | elif command -v shasum &>/dev/null; then |
| #47 | HASH=$(shasum -a 256 "${LAWS_FILE}" | cut -d' ' -f1) |
| #48 | else |
| #49 | die "No SHA-256 tool found (install coreutils or sha256sum)" |
| #50 | fi |
| #51 | |
| #52 | printf " ${BOLD}SHA-256:${RESET} ${CYAN}${HASH}${RESET}\n" |
| #53 | printf " ${BOLD}Short:${RESET} ${HASH:0:16}…\n" |
| #54 | |
| #55 | # Check for basic structural elements |
| #56 | echo "" |
| #57 | printf "${BOLD}Structural checks:${RESET}\n" |
| #58 | |
| #59 | if grep -q "Law I" "${LAWS_FILE}"; then |
| #60 | ok "Contains Law I" |
| #61 | else |
| #62 | die "Missing Law I" |
| #63 | fi |
| #64 | |
| #65 | if grep -q "Law II" "${LAWS_FILE}"; then |
| #66 | ok "Contains Law II" |
| #67 | else |
| #68 | die "Missing Law II" |
| #69 | fi |
| #70 | |
| #71 | if grep -q "Law III" "${LAWS_FILE}"; then |
| #72 | ok "Contains Law III" |
| #73 | else |
| #74 | die "Missing Law III" |
| #75 | fi |
| #76 | |
| #77 | # Check hierarchy section |
| #78 | if grep -q "Hierarchy" "${LAWS_FILE}"; then |
| #79 | ok "Contains Hierarchy section" |
| #80 | else |
| #81 | warn "Missing Hierarchy section" |
| #82 | fi |
| #83 | |
| #84 | # Check inheritance section |
| #85 | if grep -q "Inheritance" "${LAWS_FILE}"; then |
| #86 | ok "Contains Inheritance section" |
| #87 | else |
| #88 | warn "Missing Inheritance section" |
| #89 | fi |
| #90 | |
| #91 | # Check for key phrases |
| #92 | check_phrase() { |
| #93 | if grep -qi "$1" "${LAWS_FILE}"; then |
| #94 | ok "Contains: $1" |
| #95 | else |
| #96 | warn "Missing: $1" |
| #97 | fi |
| #98 | } |
| #99 | |
| #100 | check_phrase "beach before you harm" |
| #101 | check_phrase "Beach before harm" |
| #102 | check_phrase "The shell molts" |
| #103 | check_phrase "The laws do not" |
| #104 | |
| #105 | echo "" |
| #106 | printf "${BOLD}${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}\n" |
| #107 | printf "${BOLD}${GREEN} ✓ Constitution intact and valid${RESET}\n" |
| #108 | printf "${BOLD}${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}\n" |
| #109 | echo "" |
| #110 | printf " ${YELLOW}The shell molts. The laws do not. 🦞${RESET}\n" |
| #111 | echo "" |
| #112 |