Files
loki/scripts/fleet
T
Mao NakamotoandClaude Opus 4.8 4b7ee8d63a fix(control+brand): purge dead Vercel refs, real favicon, honest badges/counts
Thorough cleanup after a full investigation of "so many things are wrong".

DEPLOYMENT — the "This deployment is temporarily paused" ghost. The canonical
host already moved to fleetcrown.orangecat.ch (Hetzner); the message came from
leftover references to the paused fleetcrown.vercel.app deployment:
- vercel.json: drop the `alias: ["fleetcrown.vercel.app"]` (the paused domain).
- scripts/fleet: install-cli POSTs to fleetcrown.orangecat.ch, not the dead URL.
- package.json: `ship` just pushes (the pre-push hook deploys to Hetzner);
  replace `wait:vercel` with `deploy` → scripts/deploy-hetzner.sh.
- delete scripts/wait-for-vercel.sh and orphaned desktop/.vercel/.
- repoint stale Vercel URLs in scripts/db/*.md and the local VAPID_SUBJECT.
(Fleet Runner already targets orangecat.ch in source — the user's "paused"
view is a stale installed build; the current v0.8.0 build/.deb is in desktop/dist.)

ICON — the browser-tab icon was blank/wrong:
- public/icon.svg drew the spiral at ~23% of the canvas with 0.7/0.95 opacity,
  so it vanished at 16px. Rescaled to fill ~62% at full contrast (shape
  unchanged, matches BrandMark.tsx).
- delete the stale src/app/favicon.ico (still the Next.js starter triangle);
  metadata already declares /icon.svg, so browsers now show the brand mark.

CONTROL honesty:
- Autopilot badge no longer shows a pulsing "Building" on every autopilot-on
  project (the default), which made idle projects look actively worked. It's now
  a static "Auto"/"Paused" policy chip; the pulse is reserved for real `working`.
- /activity stats (promptsSent/runsStarted) now come from real count(*)
  aggregates instead of the 200-capped row arrays (showed "200" when the true
  30-day count was 277).
- "Previous automated run" shows a crashed `running` row (no terminal write,
  >30min old) as "interrupted" instead of a live-looking "running" tag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 14:21:26 +02:00

161 lines
5.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# fleet — Friendly local wrapper for FleetCrown development and daily use.
# Valid both in a checkout's scripts/ directory and when extracted flat into
# ~/.local/share/fleetcrown/ by the hosted installer.
#
# Recommended: symlink as "fc" (or keep "cpit" during transition):
# ln -s /home/g/dev/cockpit/scripts/fleet ~/bin/fc
#
# Examples:
# fc daemon start
# fc install-agent grok
# fc status
# fc pause
# fc resume
set -euo pipefail
RUNTIME_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ ! -x "$RUNTIME_DIR/fleetcrown-daemon.sh" ]; then
echo "FleetCrown helper is incomplete at $RUNTIME_DIR. Re-run the installer from Settings." >&2
exit 1
fi
DAEMON_SCRIPT="$RUNTIME_DIR/fleetcrown-daemon.sh"
INSTALL_SCRIPT="$RUNTIME_DIR/install-fleetcrown-daemon.sh"
# Load env if present (the one from the installer). Support both the new
# FLEETCROWN_ layout and legacy COCKPIT_ location during transition.
if [ -f "$HOME/.config/fleetcrown/daemon.env" ]; then
set -a
source "$HOME/.config/fleetcrown/daemon.env"
set +a
elif [ -f "$HOME/.config/fleetcrown/daemon.env" ]; then
set -a
source "$HOME/.config/fleetcrown/daemon.env"
set +a
fi
# Force remote for production Control when you also run a local dev server
export APP_DAEMON_FORCE_REMOTE=1
export FLEETCROWN_DAEMON_FORCE_REMOTE=1
export COCKPIT_DAEMON_FORCE_REMOTE=1
case "${1:-help}" in
daemon|d)
shift
case "${1:-start}" in
start)
if systemctl --user is-enabled fleetcrown-daemon >/dev/null 2>&1; then
echo "Starting via systemd (recommended)…"
bash "$INSTALL_SCRIPT" --restart 2>/dev/null || systemctl --user restart fleetcrown-daemon
else
echo "Starting daemon (no systemd service — run: fleet service enable)…"
pkill -f 'fleetcrown-daemon.sh' 2>/dev/null || true
sleep 0.5
nohup bash "$DAEMON_SCRIPT" >> "${HOME}/.local/state/fleetcrown/daemon.log" 2>&1 &
sleep 1
pgrep -f 'fleetcrown-daemon.sh' >/dev/null && echo "Daemon started." || echo "Daemon failed to start — check log."
fi
;;
stop)
if systemctl --user is-enabled fleetcrown-daemon >/dev/null 2>&1; then
systemctl --user stop fleetcrown-daemon
fi
pkill -f 'fleetcrown-daemon.sh' 2>/dev/null || true
echo "Daemon stopped."
;;
restart)
if systemctl --user is-enabled fleetcrown-daemon >/dev/null 2>&1; then
bash "$INSTALL_SCRIPT" --restart
else
$0 daemon stop
sleep 1
$0 daemon start
fi
;;
*)
echo "Usage: fleet daemon {start|stop|restart}"
;;
esac
;;
install-agent|ia)
agent="${2:-}"
if [ -z "$agent" ]; then
echo "Usage: fleet install-agent <grok|claude|cursor|gemini>"
exit 1
fi
echo "Triggering one-click install for $agent (will open a tab if daemon running)..."
# This calls the production API — requires the daemon token (prefer new FLEETCROWN_, fall back)
TOKEN="${FLEETCROWN_DAEMON_TOKEN:-${COCKPIT_DAEMON_TOKEN:-}}"
if [ -z "$TOKEN" ]; then
echo "No FLEETCROWN_DAEMON_TOKEN (or legacy COCKPIT_DAEMON_TOKEN) found. Source your daemon.env first."
exit 1
fi
auth_header="$(mktemp)"
chmod 600 "$auth_header"
printf 'Authorization: Bearer %s\n' "$TOKEN" > "$auth_header"
trap 'rm -f "$auth_header"' EXIT
curl -s -X POST "https://fleetcrown.orangecat.ch/api/agent/install-cli" \
-H "@$auth_header" \
-H "Content-Type: application/json" \
-d "{\"agent\":\"$agent\"}" | jq .
echo "Check your zellij for a new 'Install $agent' tab."
;;
status|s)
echo "=== Running daemons ==="
pgrep -f 'fleetcrown-daemon.sh' -a || echo "None"
echo ""
echo "=== Systemd user service ==="
systemctl --user status fleetcrown-daemon 2>/dev/null || echo "Service not installed (run: ./scripts/install-fleetcrown-daemon.sh)"
echo ""
echo "=== Recent runtime state (if any) ==="
ls -lt /tmp/agent-current-prompt-* /tmp/agent-ready-* 2>/dev/null | head -5 || echo "No recent sentinels"
echo "=== Your projects ==="
grep -E '^(FleetCrown|revamp|OrangeCat)' "$HOME/.config/agent-projects.conf" 2>/dev/null || echo "No conf"
;;
service)
shift
case "${1:-status}" in
enable|install)
echo "Installing/enabling background service..."
bash "$INSTALL_SCRIPT"
;;
disable)
echo "Disabling service..."
systemctl --user disable --now fleetcrown-daemon 2>/dev/null || true
;;
status)
systemctl --user status fleetcrown-daemon 2>/dev/null || echo "Not installed"
;;
*)
echo "Usage: fleet service {enable|disable|status}"
;;
esac
;;
pause)
touch "/tmp/fleetcrown-pause"
echo "Fleet paused (daemon will respect this on next cycle)."
;;
resume)
rm -f "/tmp/fleetcrown-pause"
echo "Fleet resumed."
;;
help|*)
echo "fleet — your friendly local FleetCrown helper"
echo ""
echo "Recommended name: fc (or cpit during transition to avoid conflicts)"
echo ""
echo "Commands:"
echo " fc daemon start # Clean start against production"
echo " fc daemon stop"
echo " fc install-agent grok # Opens a tab and injects the installer"
echo " fc status"
echo " fc pause / resume # Low-power mode"
echo ""
echo "Setup (recommended):"
echo " ln -s /home/g/dev/cockpit/scripts/fleet ~/bin/fc"
echo ""
echo "Then just use: fc daemon start"
;;
esac