v0.7.0 cli client with readline added, directory structure updated

This commit is contained in:
2025-11-13 08:55:06 -05:00
parent 52868af4ea
commit 6bdc061508
52 changed files with 2260 additions and 157 deletions

View File

@ -1,12 +1,12 @@
#!/usr/bin/env bash
# FILE: test/run-test-server.sh
# FILE: lixenwraith/chess/test/run-test-server.sh
set -e
# Configuration
CHESSD_EXEC=${1:-"./chessd"}
CHESS_SERVER_EXEC=${1:-"bin/chess-server"}
TEST_DB="test.db"
PID_FILE="/tmp/chessd_test.pid"
PID_FILE="/tmp/chess-server_test.pid"
API_PORT=${API_PORT:-8080}
# Colors for output
@ -17,10 +17,10 @@ CYAN='\033[0;36m'
NC='\033[0m'
# Check executable
if [ ! -x "$CHESSD_EXEC" ]; then
echo -e "${RED}Error: chessd executable not found or not executable: $CHESSD_EXEC${NC}"
echo "Provide the path to chessd binary as first argument or place it in the current directory."
echo "Build the binary if not available: go build ./cmd/chessd"
if [ ! -x "$CHESS_SERVER_EXEC" ]; then
echo -e "${RED}Error: chess-server executable not found or not executable: $CHESS_SERVER_EXEC${NC}"
echo "Provide the path to chess-server binary as first argument or place it in the current directory."
echo "Build the binary if not available: go build ./cmd/chess-server"
exit 1
fi
@ -32,7 +32,7 @@ cleanup() {
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
if kill -0 "$PID" 2>/dev/null; then
echo "Stopping chessd server (PID: $PID)"
echo "Stopping chess-server server (PID: $PID)"
kill "$PID" 2>/dev/null || true
sleep 0.5
kill -9 "$PID" 2>/dev/null || true
@ -56,7 +56,7 @@ rm -f "$TEST_DB" "${TEST_DB}-wal" "${TEST_DB}-shm" "$PID_FILE"
# Initialize database
echo -e "${CYAN}Initializing test database...${NC}"
"$CHESSD_EXEC" db init -path "$TEST_DB"
"$CHESS_SERVER_EXEC" db init -path "$TEST_DB"
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to initialize database${NC}"
exit 1
@ -64,14 +64,14 @@ fi
# Add test users
echo -e "${CYAN}Adding test users...${NC}"
"$CHESSD_EXEC" db user add -path "$TEST_DB" \
"$CHESS_SERVER_EXEC" db user add -path "$TEST_DB" \
-username alice -email alice@test.com -password AlicePass123
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to create user alice${NC}"
exit 1
fi
"$CHESSD_EXEC" db user add -path "$TEST_DB" \
"$CHESS_SERVER_EXEC" db user add -path "$TEST_DB" \
-username bob -email bob@test.com -password BobSecure456
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to create user bob${NC}"
@ -84,15 +84,15 @@ echo " • bob / BobSecure456"
# Start server
echo -e "${CYAN}╔══════════════════════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ Chess API Test Server with User Management ║${NC}"
echo -e "${GREEN}║ Chess API Test Server with User Management ${NC}"
echo -e "${CYAN}╚══════════════════════════════════════════════════════════╝${NC}"
echo ""
echo "Configuration:"
echo " Executable: $CHESSD_EXEC"
echo " Executable: $CHESS_SERVER_EXEC"
echo " Database: $TEST_DB"
echo " Port: $API_PORT"
echo " Mode: Development (WAL enabled, relaxed rate limits)"
echo " Purpose: Backend for chessd tests"
echo " Purpose: Backend for chess-server tests"
echo " PID File: $PID_FILE"
echo ""
echo -e "${YELLOW}Instructions:${NC}"
@ -104,8 +104,8 @@ echo -e "${CYAN}─────────────────────
echo "Starting server..."
echo ""
# Start chessd in foreground with dev mode and storage
"$CHESSD_EXEC" \
# Start chess-server in foreground with dev mode and storage
"$CHESS_SERVER_EXEC" \
-dev \
-storage-path "$TEST_DB" \
-api-port "$API_PORT" \