- Add all 21 commands (clawd, ralph, prometheus*, dexto*) - Add all hooks (intelligent-router, clawd-*, prometheus-wrapper, unified-integration-v2) - Add skills (ralph, prometheus master) - Add MCP servers (registry.json, manager.sh) - Add plugins directory with marketplaces - Add health-check.sh and aliases.sh scripts - Complete repository synchronization with local ~/.claude/ Total changes: 100+ new files added All integrations now fully backed up in repository 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
145 lines
3.5 KiB
Bash
Executable File
145 lines
3.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Claude Code Enhanced Integration Hook v2
|
|
# Integrates ALL 5 frameworks: Chippery, OpenAgentsControl, AGIAgent, Agno, OS-Copilot
|
|
|
|
set -euo pipefail
|
|
|
|
CLAUDE_DIR="${HOME}/.claude"
|
|
UPGRADE_DIR="${CLAUDE_DIR}/claude-code-upgrade"
|
|
LOG_DIR="${UPGRADE_DIR}/logs"
|
|
STATE_FILE="${UPGRADE_DIR}/state.json"
|
|
|
|
SERVER_ENABLED="${SERVER_ENABLED:-true}"
|
|
SERVER_HOST="${SERVER_HOST:-127.0.0.1}"
|
|
SERVER_PORT="${SERVER_PORT:-8765}"
|
|
SERVER_PID_FILE="${UPGRADE_DIR}/server.pid"
|
|
SERVER_LOG="${LOG_DIR}/server.log"
|
|
|
|
mkdir -p "${UPGRADE_DIR}" "${LOG_DIR}"
|
|
|
|
log() {
|
|
local level="$1"
|
|
shift
|
|
echo "[$(date -u +"%Y-%m-%d %H:%M:%S UTC")] [${level}] $*" | tee -a "${LOG_DIR}/integration.log"
|
|
}
|
|
|
|
save_state() {
|
|
echo '{"timestamp":"'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'"}' > "${STATE_FILE}"
|
|
}
|
|
|
|
server_running() {
|
|
if [[ -f "$SERVER_PID_FILE" ]]; then
|
|
local pid
|
|
pid=$(cat "$SERVER_PID_FILE" 2>/dev/null || echo "")
|
|
[[ -n "$pid" ]] && kill -0 "$pid" 2>/dev/null
|
|
else
|
|
false
|
|
fi
|
|
}
|
|
|
|
start_server() {
|
|
if [[ "$SERVER_ENABLED" != "true" ]]; then
|
|
log INFO "FastAPI server disabled"
|
|
return 0
|
|
fi
|
|
|
|
if server_running; then
|
|
log INFO "FastAPI server already running"
|
|
return 0
|
|
fi
|
|
|
|
log INFO "Starting FastAPI Control Plane server..."
|
|
|
|
cd "${CLAUDE_DIR}/server"
|
|
nohup python3 -m uvicorn main:app --host "$SERVER_HOST" --port "$SERVER_PORT" --reload >> "$SERVER_LOG" 2>&1 &
|
|
|
|
local server_pid=$!
|
|
echo "$server_pid" > "$SERVER_PID_FILE"
|
|
sleep 3
|
|
|
|
if server_running; then
|
|
log INFO "FastAPI server started (PID: ${server_pid})"
|
|
echo "🌐 Control Plane: http://${SERVER_HOST}:${SERVER_PORT}/ui" >&2
|
|
else
|
|
log ERROR "Failed to start FastAPI server"
|
|
return 1
|
|
fi
|
|
|
|
save_state
|
|
}
|
|
|
|
stop_server() {
|
|
if ! server_running; then
|
|
return 0
|
|
fi
|
|
|
|
local pid
|
|
pid=$(cat "$SERVER_PID_FILE")
|
|
log INFO "Stopping FastAPI server (PID: ${pid})..."
|
|
kill "$pid" 2>/dev/null || true
|
|
rm -f "$SERVER_PID_FILE"
|
|
save_state
|
|
}
|
|
|
|
show_status() {
|
|
log INFO "=== Claude Code Enhanced Integration Status ==="
|
|
echo ""
|
|
echo "🔧 Components:"
|
|
echo " ✓ Codebase Indexer (Chippery)"
|
|
echo " ✓ Plan Executor (OpenAgentsControl)"
|
|
echo " ✓ MCP Client (AGIAgent/Agno)"
|
|
echo " ✓ Multi-Agent Orchestrator (Agno)"
|
|
echo " ✓ Self-Learner (OS-Copilot)"
|
|
echo " ✓ Document Generator (AGIAgent)"
|
|
echo " ✓ Context Manager (OpenAgentsControl)"
|
|
echo ""
|
|
|
|
if server_running; then
|
|
local pid
|
|
pid=$(cat "$SERVER_PID_FILE")
|
|
echo "🌐 FastAPI Control Plane: RUNNING (PID: ${pid})"
|
|
echo " URL: http://${SERVER_HOST}:${SERVER_PORT}/ui"
|
|
echo ""
|
|
else
|
|
echo "🌐 FastAPI Control Plane: STOPPED"
|
|
echo ""
|
|
fi
|
|
|
|
echo "📁 Logs: ${LOG_DIR}/"
|
|
}
|
|
|
|
main() {
|
|
local hook_input=""
|
|
if [[ -t 0 ]]; then
|
|
hook_input="${1:-}"
|
|
else
|
|
hook_input=$(cat)
|
|
fi
|
|
|
|
local command="${hook_input:-status}"
|
|
|
|
case "$command" in
|
|
start)
|
|
log INFO "Starting Claude Code Enhanced Integration..."
|
|
start_server
|
|
log INFO "Integration complete"
|
|
;;
|
|
stop)
|
|
log INFO "Stopping Claude Code Enhanced Integration..."
|
|
stop_server
|
|
;;
|
|
restart)
|
|
stop_server
|
|
sleep 2
|
|
start_server
|
|
;;
|
|
status|*)
|
|
show_status
|
|
;;
|
|
esac
|
|
|
|
exit 0
|
|
}
|
|
|
|
main "$@"
|