Spaces:
Runtime error
Runtime error
| # Makefile for Chat Agent Application | |
| .PHONY: help install setup test clean run docker-build docker-run docker-dev migrate seed | |
| # Default target | |
| help: | |
| @echo "Available commands:" | |
| @echo " install - Install dependencies" | |
| @echo " setup - Set up development environment" | |
| @echo " setup-prod - Set up production environment" | |
| @echo " test - Run tests" | |
| @echo " test-cov - Run tests with coverage" | |
| @echo " clean - Clean up temporary files" | |
| @echo " run - Run development server" | |
| @echo " run-prod - Run production server" | |
| @echo " migrate - Run database migrations" | |
| @echo " seed - Seed database with sample data" | |
| @echo " reset-db - Reset database (development only)" | |
| @echo " docker-build - Build Docker image" | |
| @echo " docker-run - Run with Docker Compose" | |
| @echo " docker-dev - Run development environment with Docker" | |
| @echo " docker-stop - Stop Docker containers" | |
| @echo " lint - Run code linting" | |
| @echo " format - Format code" | |
| # Installation and setup | |
| install: | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| setup: | |
| python scripts/setup_environment.py --environment development | |
| setup-prod: | |
| python scripts/setup_environment.py --environment production | |
| setup-test: | |
| python scripts/setup_environment.py --environment testing | |
| # Testing | |
| test: | |
| python -m pytest tests/ -v | |
| test-cov: | |
| python -m pytest tests/ --cov=chat_agent --cov-report=html --cov-report=term | |
| test-integration: | |
| python -m pytest tests/integration/ -v | |
| test-unit: | |
| python -m pytest tests/unit/ -v | |
| # Database operations | |
| migrate: | |
| python scripts/init_db.py init --config development | |
| migrate-prod: | |
| python scripts/init_db.py init --config production | |
| seed: | |
| python scripts/init_db.py seed --config development | |
| reset-db: | |
| python scripts/init_db.py reset --config development | |
| db-status: | |
| python scripts/init_db.py status --config development | |
| # Application running | |
| run: | |
| python app.py | |
| run-prod: | |
| gunicorn --bind 0.0.0.0:5000 --workers 4 --worker-class eventlet app:app | |
| run-debug: | |
| FLASK_DEBUG=True python app.py | |
| # Docker operations | |
| docker-build: | |
| docker build -t chat-agent . | |
| docker-run: | |
| docker-compose up -d | |
| docker-dev: | |
| docker-compose -f docker-compose.dev.yml up -d | |
| docker-stop: | |
| docker-compose down | |
| docker-compose -f docker-compose.dev.yml down | |
| docker-logs: | |
| docker-compose logs -f chat-agent | |
| docker-clean: | |
| docker-compose down -v | |
| docker system prune -f | |
| # Code quality | |
| lint: | |
| flake8 chat_agent/ --max-line-length=100 --ignore=E203,W503 | |
| flake8 tests/ --max-line-length=100 --ignore=E203,W503 | |
| format: | |
| black chat_agent/ tests/ --line-length=100 | |
| isort chat_agent/ tests/ | |
| type-check: | |
| mypy chat_agent/ --ignore-missing-imports | |
| # Cleanup | |
| clean: | |
| find . -type f -name "*.pyc" -delete | |
| find . -type d -name "__pycache__" -delete | |
| find . -type d -name "*.egg-info" -exec rm -rf {} + | |
| rm -rf .coverage htmlcov/ .pytest_cache/ .mypy_cache/ | |
| rm -rf logs/*.log | |
| clean-all: clean | |
| rm -rf venv/ | |
| rm -rf instance/ | |
| rm -rf flask_session/ | |
| # Health checks | |
| health: | |
| curl -s http://localhost:5000/health/ | python -m json.tool | |
| health-detailed: | |
| curl -s http://localhost:5000/health/detailed | python -m json.tool | |
| # Development helpers | |
| dev-install: | |
| pip install -r requirements.txt | |
| pip install flask-debugtoolbar ipdb watchdog black flake8 isort mypy | |
| logs: | |
| tail -f logs/chat_agent.log | |
| logs-error: | |
| tail -f logs/chat_agent.log | grep ERROR | |
| # Production deployment helpers | |
| deploy-check: | |
| @echo "Pre-deployment checklist:" | |
| @echo "- [ ] Environment variables configured" | |
| @echo "- [ ] Database migrations applied" | |
| @echo "- [ ] SSL certificates installed" | |
| @echo "- [ ] Firewall configured" | |
| @echo "- [ ] Monitoring set up" | |
| @echo "- [ ] Backups configured" | |
| backup-db: | |
| pg_dump $(DATABASE_URL) > backups/backup_$(shell date +%Y%m%d_%H%M%S).sql | |
| restore-db: | |
| @echo "Warning: This will overwrite the current database!" | |
| @read -p "Enter backup file path: " backup_file; \ | |
| psql $(DATABASE_URL) < $$backup_file | |
| # Monitoring | |
| monitor: | |
| watch -n 5 'curl -s http://localhost:5000/health/detailed | python -m json.tool' | |
| # Documentation | |
| docs: | |
| @echo "Documentation available:" | |
| @echo "- README.md - Project overview" | |
| @echo "- docs/DEPLOYMENT.md - Deployment guide" | |
| @echo "- docs/ENVIRONMENT_SETUP.md - Environment setup" | |
| @echo "- .kiro/specs/multi-language-chat-agent/ - Feature specifications" |