# ═══════════════════════════════════════════════════════════════ # AI Company Saudi — Makefile # الأوامر الشائعة # ═══════════════════════════════════════════════════════════════ .PHONY: help install install-dev setup test test-unit test-integration \ lint format type-check security clean run demo \ docker-build docker-up docker-down docker-logs \ pre-commit-install pre-commit-run db-init requirements # Python binary (override with PYTHON=python3.12 make ...) PYTHON ?= python3 PIP ?= $(PYTHON) -m pip help: ## Show this help @echo "🏢 AI Company Saudi — Available commands:" @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-25s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) # ── Environment setup ────────────────────────────────────────── install: ## Install production dependencies $(PIP) install -e . install-dev: ## Install dev dependencies (tests, lint, etc.) $(PIP) install -e ".[dev]" setup: install-dev pre-commit-install ## One-time dev setup @test -f .env || (cp .env.example .env && echo "✅ Created .env from template — edit it now") requirements: ## Export requirements.txt from pyproject $(PIP) install pip-tools $(PIP) compile pyproject.toml -o requirements.txt $(PIP) compile --extra dev pyproject.toml -o requirements-dev.txt # ── Quality ──────────────────────────────────────────────────── lint: ## Run ruff + black checks ruff check . black --check . format: ## Auto-format with ruff + black ruff check --fix . black . type-check: ## Run mypy mypy core auto_client_acquisition autonomous_growth integrations api security: ## Run security scans bandit -c pyproject.toml -r core auto_client_acquisition autonomous_growth integrations api detect-secrets scan --baseline .secrets.baseline || true # ── Tests ────────────────────────────────────────────────────── test: ## Run full test suite with coverage pytest -v test-unit: ## Unit tests only pytest -v -m "not integration" tests/unit test-integration: ## Integration tests only pytest -v tests/integration # ── Pre-commit ───────────────────────────────────────────────── pre-commit-install: ## Install pre-commit hooks pre-commit install pre-commit-run: ## Run pre-commit on all files pre-commit run --all-files # ── Run locally ──────────────────────────────────────────────── run: ## Run API server (dev mode, reload on changes) uvicorn api.main:app --host 0.0.0.0 --port 8000 --reload demo: ## Run interactive CLI demo $(PYTHON) cli.py # ── Database ─────────────────────────────────────────────────── db-init: ## Initialize database tables (dev only) $(PYTHON) -c "import asyncio; from db.session import init_db; asyncio.run(init_db())" # ── Docker ───────────────────────────────────────────────────── docker-build: ## Build Docker image docker build -t dealix:latest . docker-up: ## Start full stack (app + postgres + redis + mongo) docker compose up -d --build docker-down: ## Stop and remove containers docker compose down docker-logs: ## Tail application logs docker compose logs -f app # ── Cleanup ──────────────────────────────────────────────────── clean: ## Remove build artifacts, caches rm -rf build dist *.egg-info .pytest_cache .mypy_cache .ruff_cache htmlcov .coverage coverage.xml find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true find . -type f -name "*.pyc" -delete