feat: add collectors and rules

This commit is contained in:
Vault Sovereign
2025-12-27 00:59:13 +00:00
parent b654462586
commit d1980ec714
14 changed files with 493 additions and 32 deletions

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
OUT_DIR="${1:?usage: collect_constitution_hash.sh <out_dir>}"
mkdir -p "$OUT_DIR"
LOCK_PATH="../vm-mcp/governance/constitution.lock"
hash_file() {
local file="$1"
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "$file" | awk '{print $1}'
else
shasum -a 256 "$file" | awk '{print $1}'
fi
}
if [[ -f "$LOCK_PATH" ]]; then
HASH="$(hash_file "$LOCK_PATH")"
cat > "$OUT_DIR/constitution_hash.json" <<JSON
{"collected": true, "path": "$LOCK_PATH", "sha256": "$HASH"}
JSON
else
cat > "$OUT_DIR/constitution_hash.json" <<'JSON'
{"collected": false, "reason": "constitution.lock not found at expected path"}
JSON
fi