Add Antigravity fleet tools: af (fleet connector), agy-mode (mode switcher), aa (act), ap (plan)

This commit is contained in:
Kryštof Pešek
2026-10-30 19:34:34 +01:00
parent dc84a14bd2
commit 0e7918c4a3
4 changed files with 83 additions and 0 deletions
Executable
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# ~/bin/aa - Switch to accept-edits mode and connect to fleet session
"$HOME/bin/agy-mode" act
exec "$HOME/bin/af" "$@"
Executable
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# ~/bin/af - Antigravity Fleet Unified Session Connector
# Attaches to the central persistent Antigravity CLI session on boxC.
SESSION_NAME="agy"
CENTRAL_IP="10.0.0.14"
CENTRAL_HOST="boxC"
REMOTE_PORT="2222"
EXTERNAL_HOST="home"
# Determine current hostname
CURRENT_HOST="$(hostname)"
if [[ "$CURRENT_HOST" == "boxC" || "$CURRENT_HOST" == "B" ]]; then
# Already on central node: attach or create local tmux session
exec tmux new-session -A -s "$SESSION_NAME" agy "$@"
else
# Remote node (bazina, t520, chromebook, or phone)
# 1. Try local LAN first
if ping -c 1 -W 1 "$CENTRAL_IP" &>/dev/null; then
exec ssh -t "$CENTRAL_HOST" "tmux new-session -A -s '$SESSION_NAME' agy $*"
else
# 2. Fallback to external SSH via home gateway
echo "LAN connection to $CENTRAL_HOST unreachable, attempting external fallback..."
exec ssh -p "$REMOTE_PORT" -t "$EXTERNAL_HOST" "tmux new-session -A -s '$SESSION_NAME' agy $*"
fi
fi
Executable
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# ~/bin/agy-mode - Toggle Antigravity execution mode fleet-wide
# Usage: agy-mode <act|plan|default>
CONFIG="$HOME/.gemini/antigravity-cli/settings.json"
if [[ ! -f "$CONFIG" ]]; then
echo "Error: $CONFIG not found." >&2
exit 1
fi
apply_mode() {
local target_mode="$1"
# Local update
sed -i -E "s/\"agentMode\": *\"[^\"]*\"/\"agentMode\": \"$target_mode\"/" "$CONFIG"
echo "✓ Local boxC agy mode set to: $target_mode"
# Propagate to reachable fleet nodes (bazina, t520) in background / quick ssh
for node in 10.0.0.15 10.0.0.18; do
if ping -c 1 -W 1 "$node" &>/dev/null; then
ssh -o ConnectTimeout=2 -o BatchMode=yes "$node" \
"test -f $CONFIG && sed -i -E 's/\"agentMode\": *\"[^\"]*\"/\"agentMode\": \"$target_mode\"/' $CONFIG" 2>/dev/null && \
echo "✓ Synced mode to $node" || true
fi
done
}
case "$1" in
plan|p)
apply_mode "plan"
;;
act|accept-edits|a)
apply_mode "accept-edits"
;;
default|d)
apply_mode "default"
;;
status|"")
CURRENT=$(grep '"agentMode"' "$CONFIG" 2>/dev/null | tr -d '", ' | awk -F: '{print $2}')
echo "Current agy agentMode: ${CURRENT:-unknown}"
echo "Usage: agy-mode <act|plan|default>"
;;
*)
echo "Unknown mode: $1" >&2
echo "Usage: agy-mode <act|plan|default>" >&2
exit 1
;;
esac
Executable
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# ~/bin/ap - Switch to plan mode and connect to fleet session
"$HOME/bin/agy-mode" plan
exec "$HOME/bin/af" "$@"