mirror of
https://github.com/Permissionless-Software-Foundation/psf-memo.git
synced 2026-09-21 16:52:01 -07:00
Add consolidated architect startup verification script
By architect.
This commit is contained in:
Executable
+78
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
# Consolidated architect startup verification.
|
||||
#
|
||||
# Verifies every SwarmForge tool the architect needs is present, at the latest
|
||||
# upstream version, and runnable — in a single command. Run this once at startup
|
||||
# instead of issuing many separate checks. It is read-only: it never reinstalls
|
||||
# or rebuilds tools, it only confirms they are ready.
|
||||
#
|
||||
# Usage: swarmforge/scripts/architect-startup.sh
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
pass=0; fail=0
|
||||
ok() { echo " [ok] $1"; pass=$((pass+1)); }
|
||||
bad() { echo " [FAIL] $1"; fail=$((fail+1)); }
|
||||
|
||||
echo "== Tool repos at latest upstream =="
|
||||
for d in tmp/aps-spec tmp/crap4javascript tmp/dry4javascript tmp/mutate4javascript; do
|
||||
if [ ! -d "$d/.git" ]; then
|
||||
bad "$d missing (reinstall per constitution)"; continue
|
||||
fi
|
||||
if ! git -C "$d" fetch --quiet origin 2>/dev/null; then
|
||||
bad "$d fetch failed"; continue
|
||||
fi
|
||||
head=$(git -C "$d" rev-parse HEAD)
|
||||
up=$(git -C "$d" rev-parse origin/HEAD 2>/dev/null \
|
||||
|| git -C "$d" rev-parse origin/master 2>/dev/null \
|
||||
|| git -C "$d" rev-parse origin/main 2>/dev/null || true)
|
||||
if [ -n "$up" ] && [ "$head" = "$up" ]; then
|
||||
ok "$d at latest"
|
||||
else
|
||||
bad "$d behind upstream (reinstall per constitution)"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "== Language tools (JavaScript) =="
|
||||
if grep -q "Missing source file argument" \
|
||||
<<< "$(psf-memo-client/node_modules/.bin/mutate4javascript 2>&1)"; then
|
||||
ok "mutate4javascript"
|
||||
else
|
||||
bad "mutate4javascript"
|
||||
fi
|
||||
if psf-memo-client/node_modules/.bin/dry4javascript >/dev/null 2>&1; then
|
||||
ok "dry4javascript"
|
||||
else
|
||||
bad "dry4javascript"
|
||||
fi
|
||||
if psf-memo-client/node_modules/.bin/crap4javascript >/dev/null 2>&1; then
|
||||
ok "crap4javascript"
|
||||
else
|
||||
bad "crap4javascript"
|
||||
fi
|
||||
|
||||
echo "== APS Babashka tools =="
|
||||
if grep -q "usage: gherkin-parser" \
|
||||
<<< "$(cd tmp/aps-spec && bb gherkin-parser 2>&1)"; then
|
||||
ok "gherkin-parser"
|
||||
else
|
||||
bad "gherkin-parser"
|
||||
fi
|
||||
if grep -qF -- "--runner-worker is required" \
|
||||
<<< "$(cd tmp/aps-spec && bb gherkin-mutator 2>&1)"; then
|
||||
ok "gherkin-mutator"
|
||||
else
|
||||
bad "gherkin-mutator"
|
||||
fi
|
||||
|
||||
echo "== Runner adapters =="
|
||||
for c in psf-memo-client psf-memo-db psf-memo-indexer; do
|
||||
[ -f "$c/acceptance/lib/runner-worker.js" ] \
|
||||
&& ok "$c runner-worker" || bad "$c runner-worker"
|
||||
done
|
||||
|
||||
echo
|
||||
echo "Result: $pass ok, $fail fail"
|
||||
[ "$fail" -eq 0 ]
|
||||
Reference in New Issue
Block a user