| 1 | #!/usr/bin/env bash |
| 2 | set -euo pipefail |
| 3 | |
| 4 | ROOT_DIR="${1:-..}" |
| 5 | FAILURES=0 |
| 6 | WARNINGS=0 |
| 7 | |
| 8 | pass() { |
| 9 | echo "PASS: $1" |
| 10 | } |
| 11 | |
| 12 | fail() { |
| 13 | echo "FAIL: $1" |
| 14 | FAILURES=$((FAILURES + 1)) |
| 15 | } |
| 16 | |
| 17 | warn() { |
| 18 | echo "WARN: $1" |
| 19 | WARNINGS=$((WARNINGS + 1)) |
| 20 | } |
| 21 | |
| 22 | require_pattern() { |
| 23 | local path="$1" |
| 24 | local pattern="$2" |
| 25 | local label="$3" |
| 26 | if [[ ! -f "${path}" ]]; then |
| 27 | fail "${label} (missing: ${path})" |
| 28 | return |
| 29 | fi |
| 30 | |
| 31 | if grep -Eq "${pattern}" "${path}"; then |
| 32 | pass "${label}" |
| 33 | else |
| 34 | fail "${label} (pattern not found in ${path})" |
| 35 | fi |
| 36 | } |
| 37 | |
| 38 | optional_pattern() { |
| 39 | local path="$1" |
| 40 | local pattern="$2" |
| 41 | local label="$3" |
| 42 | if [[ ! -f "${path}" ]]; then |
| 43 | warn "${label} (missing: ${path})" |
| 44 | return |
| 45 | fi |
| 46 | |
| 47 | if grep -Eq "${pattern}" "${path}"; then |
| 48 | pass "${label}" |
| 49 | else |
| 50 | warn "${label} (pattern not found in ${path})" |
| 51 | fi |
| 52 | } |
| 53 | |
| 54 | echo "Sprint 08 integration certification checks against: ${ROOT_DIR}" |
| 55 | |
| 56 | require_pattern "${ROOT_DIR}/config/gar/init.lua" 'gar\.exec_once\("garcard daemon"\)' \ |
| 57 | "Gar startup defaults autostart garcard" |
| 58 | require_pattern "${ROOT_DIR}/install.sh" 'garcard\.service' \ |
| 59 | "Installer wires garcard user service unit" |
| 60 | require_pattern "${ROOT_DIR}/install.sh" 'garcardctl status' \ |
| 61 | "Installer docs include garcardctl status guidance" |
| 62 | |
| 63 | require_pattern "${ROOT_DIR}/gargears/gargears/src/ipc/discovery.rs" 'garcard\.sock' \ |
| 64 | "gargears discovery includes garcard socket" |
| 65 | require_pattern "${ROOT_DIR}/gargears/gargears/src/panels/mod.rs" 'Component::Garcard' \ |
| 66 | "gargears panel registry includes garcard component" |
| 67 | require_pattern "${ROOT_DIR}/gargears/gargears/src/ipc/adapters/garcard.rs" 'pub struct GarcardAdapter' \ |
| 68 | "gargears has garcard IPC adapter" |
| 69 | |
| 70 | optional_pattern "${ROOT_DIR}/install.sh" 'garcardctl diagnose' \ |
| 71 | "Installer docs surface diagnostics command" |
| 72 | optional_pattern "${ROOT_DIR}/gargears/gargears/src/ipc/adapters/garcard.rs" 'diagnose|temp-list|temp-revoke' \ |
| 73 | "gargears adapter exposes lifecycle control methods" |
| 74 | |
| 75 | if [[ "${FAILURES}" -gt 0 ]]; then |
| 76 | echo "Integration certification checks failed: ${FAILURES} failure(s), ${WARNINGS} warning(s)." |
| 77 | exit 1 |
| 78 | fi |
| 79 | |
| 80 | echo "Integration certification checks passed with ${WARNINGS} warning(s)." |
| 81 | exit 0 |