#!/usr/bin/env bash # init-audit.sh # Initializes local audit scaffolding used by process gates. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" AUDIT_DIR="$PROJECT_ROOT/audit" mkdir -p "$AUDIT_DIR" if [[ ! -f "$AUDIT_DIR/requirements.json" ]]; then cat >"$AUDIT_DIR/requirements.json" <<'JSON' { "version": 1, "lastUpdated": "2026-02-21", "requirements": [ { "id": "R-CI-SELF-HOSTED", "description": "CI jobs run on self-hosted runner labels with documented fallback." }, { "id": "R-DEV-SETUP", "description": "Repository provides idempotent bootstrap script and verification commands." }, { "id": "R-DEV-GUIDE", "description": "Developer guide is aligned with README, scripts, and local workflow." } ] } JSON echo "[init-audit] Created audit/requirements.json" else echo "[init-audit] Found audit/requirements.json" fi if [[ ! -f "$AUDIT_DIR/test-runs.json" ]]; then cat >"$AUDIT_DIR/test-runs.json" <<'JSON' { "version": 1, "runs": [] } JSON echo "[init-audit] Created audit/test-runs.json" else echo "[init-audit] Found audit/test-runs.json" fi if [[ ! -f "$PROJECT_ROOT/CODEX-REPORT.md" ]]; then cat >"$PROJECT_ROOT/CODEX-REPORT.md" <<'MD' # CODEX Report ## Requirements Mapping - R-CI-SELF-HOSTED: pending - R-DEV-SETUP: pending - R-DEV-GUIDE: pending ## Constitution Compliance Matrix | Principle | Status | Notes | |-----------|--------|-------| | I | pending | | | X | pending | | | XX | pending | | ## Evidence - Add command outputs and CI links. ## Risks - Add known risks and mitigations. MD echo "[init-audit] Created CODEX-REPORT.md template" else echo "[init-audit] Found CODEX-REPORT.md" fi echo "[init-audit] Audit scaffolding ready."