6858a5f13e
Se separan los scripts de gestión en dos categorías claras: - dev-scripts/server/ — operaciones del launcher (start, stop, restart, ps, logs, dashboard) - dev-scripts/agent/ — operaciones de agentes (new, register, verify, avatar, remove, list) Se añade create-full.sh como script unificado que ejecuta scaffold + build + register + verify. Se incluyen READMEs en cada subdirectorio documentando los scripts disponibles. Los scripts originales en la raíz de dev-scripts/ se eliminan. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
1.4 KiB
Bash
Executable File
52 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# start.sh — inicia el launcher unificado (todos los agentes habilitados)
|
|
#
|
|
# Uso:
|
|
# ./dev-scripts/server/start.sh # inicia el launcher unificado
|
|
|
|
source "$(dirname "$0")/../_common.sh"
|
|
load_env
|
|
|
|
if is_launcher_running; then
|
|
pid="$(read_launcher_pid)"
|
|
fail "El launcher ya está corriendo (PID $pid). Usa restart.sh para reiniciar."
|
|
fi
|
|
|
|
BIN="$REPO_ROOT/bin/launcher"
|
|
LOG="$(launcher_log_file)"
|
|
PID_F="$(launcher_pid_file)"
|
|
|
|
# Build if needed
|
|
if [[ ! -x "$BIN" ]] || [[ "$(find ./cmd/launcher -newer "$BIN" 2>/dev/null | head -1)" ]]; then
|
|
info "Ejecutando tests..."
|
|
"$GO" test -tags goolm ./... || fail "Tests fallaron — corrige antes de compilar"
|
|
|
|
info "Compilando launcher..."
|
|
mkdir -p "$(dirname "$BIN")"
|
|
"$GO" build -tags goolm -o "$BIN" ./cmd/launcher || fail "Error de compilación"
|
|
fi
|
|
|
|
info "Iniciando launcher unificado..."
|
|
|
|
nohup "$BIN" --log-level "${LOG_LEVEL:-info}" \
|
|
>> "$LOG" 2>&1 &
|
|
|
|
pid=$!
|
|
echo "$pid" > "$PID_F"
|
|
|
|
sleep 1
|
|
if kill -0 "$pid" 2>/dev/null; then
|
|
# Count enabled agents
|
|
enabled=0
|
|
total=0
|
|
while IFS='|' read -r _id _v en _d _c; do
|
|
((total++)) || true
|
|
[[ "$en" == "true" ]] && ((enabled++)) || true
|
|
done < <(list_agents_raw)
|
|
|
|
ok "Launcher PID $pid ($enabled/$total agentes habilitados) → logs: $LOG"
|
|
else
|
|
rm -f "$PID_F"
|
|
fail "Launcher arrancó pero murió — revisa: tail -f $LOG"
|
|
fi
|