# Makefile for Agentic RAG System # Usage: make [target] .PHONY: help install start start-bg stop restart status clean test test-unit test-integration dev-web dev-backend logs health port-check port-kill # Default target help: @echo "๐Ÿš€ Agentic RAG System - Makefile Commands" @echo "========================================" @echo "" @echo "๐Ÿ“ฆ Setup & Installation:" @echo " make install - Install all dependencies" @echo "" @echo "๐Ÿš€ Service Management:" @echo " make start - Start backend service (foreground)" @echo " make start-bg - Start backend service (background)" @echo " make stop - Stop backend service" @echo " make restart - Restart backend service" @echo " make status - Check service status" @echo "" @echo "๐Ÿ’ป Development:" @echo " make dev-web - Start frontend development server" @echo " make dev-backend - Start backend in development mode" @echo " make dev - Start both frontend and backend" @echo "" @echo "๐Ÿงช Testing:" @echo " make test - Run all tests" @echo " make test-unit - Run unit tests only" @echo " make test-integration - Run integration tests only" @echo " make test-e2e - Run end-to-end tests" @echo "" @echo "๐Ÿ”ง Utilities:" @echo " make logs - Show service logs" @echo " make health - Check service health" @echo " make port-check - Check common development ports" @echo " make port-kill - Kill processes on common ports" @echo " make clean - Clean temporary files and caches" # Installation install: @echo "๐Ÿ“ฆ Installing dependencies..." uv sync @echo "๐Ÿ“ฆ Installing web dependencies..." cd web && npm install @echo "โœ… All dependencies installed" # Service management start: @echo "๐Ÿš€ Starting backend service in foreground..." @echo "๐Ÿ’ก Use 'make start-bg' to run in background" @echo "โš ๏ธ Press Ctrl+C to stop the service" ./scripts/start_service.sh start-bg: @echo "๐Ÿš€ Starting backend service in background..." ./scripts/start_service.sh --background stop: @echo "๐Ÿ›‘ Stopping backend service..." ./scripts/stop_service.sh restart: stop start status: @echo "๐Ÿ“Š Service Status:" @scripts/port_manager.sh check 8000 # Development dev-web: @echo "๐Ÿ’ป Starting web development server..." cd web && npm run dev dev-backend: @echo "๐Ÿ’ป Starting backend in development mode..." ./scripts/start_service.sh --dev dev: @echo "๐Ÿ’ป Starting both frontend and backend for development..." @echo "Backend will start on http://localhost:8000" @echo "Frontend will start on http://localhost:3000" @make -j2 dev-backend dev-web # Testing test: @echo "๐Ÿงช Running all tests..." uv run pytest -v test-unit: @echo "๐Ÿงช Running unit tests..." uv run pytest tests/unit/ -v test-integration: @echo "๐Ÿงช Running integration tests..." uv run pytest tests/integration/ -v test-e2e: @echo "๐Ÿงช Running end-to-end tests..." uv run python tests/integration/test_e2e_tool_ui.py # Utilities logs: @echo "๐Ÿ“‹ Service logs:" @if [ -f server.log ]; then tail -f server.log; else echo "No server.log found. Is the service running?"; fi health: @echo "๐Ÿฅ Checking service health..." @curl -s http://localhost:8000/health | jq . 2>/dev/null || curl -s http://localhost:8000/health || echo "โŒ Service not responding" port-check: @echo "๐Ÿ” Checking development ports..." @scripts/port_manager.sh check 3000 @scripts/port_manager.sh check 3001 @scripts/port_manager.sh check 8000 port-kill: @echo "๐Ÿ’€ Killing processes on common development ports..." @scripts/port_manager.sh clear clean: @echo "๐Ÿงน Cleaning temporary files..." rm -rf .pytest_cache rm -rf .tmp/* find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true find . -type f -name "*.pyc" -delete 2>/dev/null || true rm -f server.log.* 2>/dev/null || true @echo "โœ… Cleanup complete" # Advanced targets demo: @echo "๐ŸŽญ Running demo workflow..." uv run python scripts/demo.py api-docs: @echo "๐Ÿ“– Opening API documentation..." @echo "API docs available at: http://localhost:8000/docs" @command -v xdg-open >/dev/null && xdg-open http://localhost:8000/docs || echo "Open http://localhost:8000/docs in your browser" web-url: @echo "๐ŸŒ Web interface available at: http://localhost:3000" @command -v xdg-open >/dev/null && xdg-open http://localhost:3000 || echo "Open http://localhost:3000 in your browser" # Debug targets debug-config: @echo "๐Ÿ”ง Configuration check:" @echo "Config file: $(shell ls -la config.yaml 2>/dev/null || echo 'Not found')" @echo "Virtual env: $(shell echo $$VIRTUAL_ENV || echo 'Not activated')" @echo "Python path: $(shell which python || echo 'Not found')" @echo "UV version: $(shell uv --version 2>/dev/null || echo 'Not installed')" debug-deps: @echo "๐Ÿ“ฆ Dependency status:" @echo "Backend dependencies:" @uv pip list | head -10 @echo "Frontend dependencies:" @cd web && npm list --depth=0 | head -10 # Installation checks check-install: @echo "โœ… Checking installation..." @command -v uv >/dev/null || (echo "โŒ uv not installed" && exit 1) @command -v node >/dev/null || (echo "โŒ Node.js not installed" && exit 1) @command -v npm >/dev/null || (echo "โŒ npm not installed" && exit 1) @[ -f config.yaml ] || (echo "โŒ config.yaml not found" && exit 1) @[ -d .venv ] || (echo "โŒ Virtual environment not found, run 'make install'" && exit 1) @echo "โœ… All dependencies are installed"