-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (84 loc) · 4.91 KB
/
Makefile
File metadata and controls
117 lines (84 loc) · 4.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# LLMProxy — Common development tasks
# Usage: make <target>
.PHONY: setup run test bench lint typecheck docker-up docker-build docs clean help \
build-ui dev-ui lint-ui test-ui e2e-ui ui-deps
# Default target
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-18s\033[0m %s\n", $$1, $$2}'
# ── Setup ──────────────────────────────────────────────────────
setup: ## Install deps, create .env from template
python -m venv venv || true
. venv/bin/activate && pip install -r requirements.txt
@if [ ! -f .env ]; then \
cp .env.example .env; \
echo "\n\033[33m>>> Edit .env with your API keys before starting\033[0m"; \
fi
@echo "\033[32m>>> Setup complete. Run: make run\033[0m"
# ── Run ────────────────────────────────────────────────────────
run: ## Start the proxy (local)
@if [ ! -f .env ]; then echo "\033[31mERROR: .env not found. Run: make setup\033[0m"; exit 1; fi
. venv/bin/activate && python main.py
run-minimal: ## Start with minimal config (single provider)
@if [ ! -f .env ]; then echo "\033[31mERROR: .env not found. Run: make setup\033[0m"; exit 1; fi
. venv/bin/activate && CONFIG_FILE=config.minimal.yaml python main.py
# ── Testing ────────────────────────────────────────────────────
test: ## Run test suite
. venv/bin/activate && python -m pytest tests/ \
--ignore=tests/test_e2e.py \
--ignore=tests/integrated_test.py \
--ignore=tests/test_store.py \
--ignore=tests/test_openapi_contracts.py \
--ignore=tests/test_firewall_fuzz.py \
--ignore=tests/test_pii_hypothesis.py \
--ignore=tests/test_benchmarks.py \
-q --tb=short
test-all: ## Run all tests including optional deps
. venv/bin/activate && python -m pytest tests/ -q --tb=short
bench: ## Run performance benchmarks
. venv/bin/activate && python -m pytest tests/test_benchmarks.py \
--benchmark-only --benchmark-disable-gc -v
# ── Code Quality ───────────────────────────────────────────────
lint: ## Run linter (ruff)
. venv/bin/activate && ruff check . --fix
typecheck: ## Run type checker (mypy)
. venv/bin/activate && mypy core/ proxy/ --ignore-missing-imports
syntax: ## Verify all Python files parse
python -m compileall -q core/ proxy/ plugins/ store/ main.py models.py
# ── Docker ─────────────────────────────────────────────────────
docker-build: ## Build Docker image
docker build -t llmproxy .
docker-up: ## Start with Docker Compose
@if [ ! -f .env ]; then cp .env.example .env; echo "\033[33m>>> Edit .env with your API keys\033[0m"; fi
docker compose up -d
@echo "\033[32m>>> LLMProxy running at http://localhost:8090\033[0m"
@echo " Health: curl http://localhost:8090/health"
@echo " Logs: docker compose logs -f llmproxy"
docker-down: ## Stop Docker Compose
docker compose down
docker-logs: ## Tail Docker logs
docker compose logs -f llmproxy
# ── Frontend ──────────────────────────────────────────────────
ui-deps: ## Install UI dependencies (npm)
cd ui && npm install --no-audit --no-fund
build-ui: ## Build the UI bundle into ui/dist/
cd ui && npm install --no-audit --no-fund && npm run build
dev-ui: ## Run Vite dev server with HMR (proxies /v1, /admin, ... to localhost:8090)
cd ui && npm run dev
lint-ui: ## Lint frontend (ESLint + Prettier)
cd ui && npm run lint && npm run format:check
test-ui: ## Run frontend unit tests (Vitest)
cd ui && npm test
e2e-ui: ## Run end-to-end tests (Playwright). Requires the backend on :8090.
cd ui && npm run e2e
# ── Documentation ──────────────────────────────────────────────
docs: ## Serve documentation locally
cd docs && npm install && npm run docs:dev
# ── Utilities ──────────────────────────────────────────────────
health: ## Check proxy health
@curl -sf http://localhost:8090/health | python -m json.tool || echo "\033[31mProxy not running\033[0m"
verify-deps: ## Run supply chain verification
. venv/bin/activate && python scripts/verify_deps.py
clean: ## Remove caches and temp files
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
rm -rf .pytest_cache .mypy_cache .ruff_cache
@echo "\033[32m>>> Cleaned\033[0m"