From bfcdbeb79817bff03f21bbe821511d15ee346251 Mon Sep 17 00:00:00 2001 From: sgo <227344+sgo@users.noreply.github.com> Date: Tue, 1 Sep 2026 00:52:47 +0200 Subject: [PATCH 1/2] Add script to approve pending handoffs from CLI Adds a helper that approves all pending specifier handoffs through the local dashboard API, avoiding browser-based approval. --- .../scripts/approve_pending_handoffs.sh | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 swarmforge/scripts/approve_pending_handoffs.sh diff --git a/swarmforge/scripts/approve_pending_handoffs.sh b/swarmforge/scripts/approve_pending_handoffs.sh new file mode 100755 index 00000000..fee0354c --- /dev/null +++ b/swarmforge/scripts/approve_pending_handoffs.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Approve all pending SwarmForge specifier handoffs through the local +# dashboard API instead of the browser. Usage: approve_pending_handoffs.sh +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" + +url_file="$ROOT/.swarmforge/dashboard-url" +if [ ! -f "$url_file" ]; then + echo "No dashboard URL found at $url_file" >&2 + exit 1 +fi +dashboard_url="$(cat "$url_file")" + +pending_dir="$ROOT/.swarmforge/handoffs/pending_approval" +if [ ! -d "$pending_dir" ]; then + echo "No pending approvals." + exit 0 +fi + +approved=0 +for file in "$pending_dir"/*.handoff; do + [ -f "$file" ] || continue + id="$(basename "$file" .handoff)" + echo "Approving $id" + curl -fsS --max-time 15 -X POST \ + "$dashboard_url/api/approvals/$id/approve" || { + echo "Failed to approve $id" >&2 + exit 1 + } + approved=$((approved + 1)) +done + +if [ "$approved" -eq 0 ]; then + echo "No pending approvals." +else + echo "Approved $approved pending handoff(s)." +fi From 470ba5fc8fe2c41b7565c30846b3ec65fa40092e Mon Sep 17 00:00:00 2001 From: sgo <227344+sgo@users.noreply.github.com> Date: Tue, 1 Sep 2026 09:18:30 +0200 Subject: [PATCH 2/2] Approve handoffs via pack-web logic --- swarmforge/scripts/approve_pending_handoffs.sh | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/swarmforge/scripts/approve_pending_handoffs.sh b/swarmforge/scripts/approve_pending_handoffs.sh index fee0354c..b1d94502 100755 --- a/swarmforge/scripts/approve_pending_handoffs.sh +++ b/swarmforge/scripts/approve_pending_handoffs.sh @@ -1,18 +1,12 @@ #!/usr/bin/env bash # Approve all pending SwarmForge specifier handoffs through the local -# dashboard API instead of the browser. Usage: approve_pending_handoffs.sh +# pack-web approval logic instead of the browser. Usage: +# approve_pending_handoffs.sh set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" -url_file="$ROOT/.swarmforge/dashboard-url" -if [ ! -f "$url_file" ]; then - echo "No dashboard URL found at $url_file" >&2 - exit 1 -fi -dashboard_url="$(cat "$url_file")" - pending_dir="$ROOT/.swarmforge/handoffs/pending_approval" if [ ! -d "$pending_dir" ]; then echo "No pending approvals." @@ -24,11 +18,7 @@ for file in "$pending_dir"/*.handoff; do [ -f "$file" ] || continue id="$(basename "$file" .handoff)" echo "Approving $id" - curl -fsS --max-time 15 -X POST \ - "$dashboard_url/api/approvals/$id/approve" || { - echo "Failed to approve $id" >&2 - exit 1 - } + bb -e "(load-file \"$ROOT/swarmforge/scripts/pack_web.bb\") (pack-web/approve! \"$ROOT\" \"$id\")" approved=$((approved + 1)) done