add git diffs and permission support

This commit is contained in:
2026-01-19 23:45:03 -05:00
parent 313ac44337
commit 61a2e9b8af
44 changed files with 2051 additions and 267 deletions
+47 -10
View File
@@ -1,7 +1,5 @@
#!/bin/bash
# Development script - runs backend and frontend concurrently
set -e
# Development script - runs backend REPL with auto-reload and frontend
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
@@ -13,21 +11,56 @@ YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
BACKEND_PID=""
FRONTEND_PID=""
NREPL_PORT=7888
cleanup() {
echo -e "\n${YELLOW}Shutting down...${NC}"
kill $BACKEND_PID 2>/dev/null || true
kill $FRONTEND_PID 2>/dev/null || true
# Kill backend and all its children
if [ -n "$BACKEND_PID" ]; then
pkill -P $BACKEND_PID 2>/dev/null || true
kill $BACKEND_PID 2>/dev/null || true
fi
# Kill frontend and all its children
if [ -n "$FRONTEND_PID" ]; then
pkill -P $FRONTEND_PID 2>/dev/null || true
kill $FRONTEND_PID 2>/dev/null || true
fi
# Also kill any orphaned processes on our ports
fuser -k 3000/tcp 2>/dev/null || true
fuser -k 5173/tcp 2>/dev/null || true
fuser -k $NREPL_PORT/tcp 2>/dev/null || true
wait 2>/dev/null || true
echo -e "${GREEN}Stopped${NC}"
# Restore terminal
stty sane 2>/dev/null || true
exit 0
}
trap cleanup SIGINT SIGTERM
trap cleanup SIGINT SIGTERM SIGHUP EXIT
echo -e "${BLUE}=== Starting Spiceflow Development Environment ===${NC}\n"
# Start backend
echo -e "${GREEN}Starting backend server...${NC}"
# Start backend REPL with auto-reload
echo -e "${GREEN}Starting backend REPL with auto-reload...${NC}"
cd "$ROOT_DIR/server"
clj -M:run &
# Start nREPL server and run (go) to start app with file watcher
clj -M:dev -e "
(require 'nrepl.server)
(def server (nrepl.server/start-server :port $NREPL_PORT))
(println \"nREPL server started on port $NREPL_PORT\")
(require 'user)
(user/go)
;; Block forever to keep the process running
@(promise)
" &
BACKEND_PID=$!
# Wait for backend to be ready
@@ -36,6 +69,8 @@ until curl -s http://localhost:3000/api/health > /dev/null 2>&1; do
sleep 1
done
echo -e "${GREEN}Backend ready on http://localhost:3000${NC}"
echo -e "${GREEN}nREPL available on port $NREPL_PORT${NC}"
echo -e "${GREEN}Auto-reload enabled - editing .clj files will trigger reload${NC}"
# Start frontend
echo -e "${GREEN}Starting frontend server...${NC}"
@@ -55,9 +90,11 @@ LOCAL_IP=$(hostname -I | awk '{print $1}')
echo -e "\n${BLUE}=== Spiceflow Development Environment Ready ===${NC}"
echo -e "${GREEN}Backend:${NC} http://localhost:3000"
echo -e "${GREEN}nREPL:${NC} localhost:$NREPL_PORT"
echo -e "${GREEN}Frontend:${NC} https://localhost:5173"
echo -e "${GREEN}Phone:${NC} https://${LOCAL_IP}:5173"
echo -e "\nPress Ctrl+C to stop\n"
echo -e "\n${YELLOW}Auto-reload is active. Edit any .clj file to trigger reload.${NC}"
echo -e "Press Ctrl+C to stop\n"
# Wait for processes
wait
+10 -6
View File
@@ -39,31 +39,35 @@ echo -e "${BLUE}=== Starting Spiceflow Test Environment ===${NC}\n"
# Clean up old test database
rm -f "$ROOT_DIR/server/test-e2e.db"
# Use different ports for e2e tests (matching playwright.config.ts)
E2E_BACKEND_PORT=3001
E2E_FRONTEND_PORT=5174
# Start backend with test database
echo -e "${GREEN}Starting backend server with test database...${NC}"
cd "$ROOT_DIR/server"
SPICEFLOW_DB="test-e2e.db" clj -M:run &
SPICEFLOW_DB="test-e2e.db" SPICEFLOW_PORT=$E2E_BACKEND_PORT clj -M:run &
BACKEND_PID=$!
# Wait for backend to be ready
echo -e "${YELLOW}Waiting for backend...${NC}"
until curl -s http://localhost:3000/api/health > /dev/null 2>&1; do
until curl -s http://localhost:$E2E_BACKEND_PORT/api/health > /dev/null 2>&1; do
sleep 1
done
echo -e "${GREEN}Backend ready on http://localhost:3000${NC}"
echo -e "${GREEN}Backend ready on http://localhost:$E2E_BACKEND_PORT${NC}"
# Start frontend
echo -e "${GREEN}Starting frontend server...${NC}"
cd "$ROOT_DIR/client"
npm run dev -- --port 5173 &
VITE_API_URL="http://localhost:$E2E_BACKEND_PORT" npm run dev -- --port $E2E_FRONTEND_PORT &
FRONTEND_PID=$!
# Wait for frontend to be ready
echo -e "${YELLOW}Waiting for frontend...${NC}"
until curl -sk https://localhost:5173 > /dev/null 2>&1; do
until curl -sk https://localhost:$E2E_FRONTEND_PORT > /dev/null 2>&1; do
sleep 1
done
echo -e "${GREEN}Frontend ready on https://localhost:5173${NC}\n"
echo -e "${GREEN}Frontend ready on https://localhost:$E2E_FRONTEND_PORT${NC}\n"
# Run e2e tests
echo -e "${BLUE}=== Running E2E Tests ===${NC}\n"