-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
187 lines (144 loc) · 7.59 KB
/
Makefile
File metadata and controls
187 lines (144 loc) · 7.59 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
.PHONY: help install install-web install-backend dev dev-web dev-backend dev-all build build-web start-web lint lint-web lint-backend format-backend type-check test test-backend clean migrate migrate-down migrate-new migrate-status health eval eval-routing eval-tools eval-quality eval-langsmith eval-reliability gate-reliability sandbox-pull-images sandbox-build-app-image
# Colors
CYAN := \033[36m
GREEN := \033[32m
YELLOW := \033[33m
RESET := \033[0m
help: ## Show this help message
@echo "$(CYAN)HyperAgent$(RESET) - AI Agent Platform"
@echo ""
@echo "$(GREEN)Usage:$(RESET)"
@echo " make $(YELLOW)<target>$(RESET)"
@echo ""
@echo "$(GREEN)Targets:$(RESET)"
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*##/ { printf " $(YELLOW)%-15s$(RESET) %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
# =============================================================================
# Installation
# =============================================================================
install: install-web install-backend ## Install all dependencies
install-web: ## Install frontend dependencies
@echo "$(CYAN)Installing frontend dependencies...$(RESET)"
cd web && npm install
install-backend: ## Install backend dependencies
@echo "$(CYAN)Installing backend dependencies...$(RESET)"
cd backend && uv sync --all-extras
# =============================================================================
# Development
# =============================================================================
dev: ## Start both frontend and backend (requires tmux or run in separate terminals)
@echo "$(CYAN)Starting development servers...$(RESET)"
@echo "$(YELLOW)Run 'make dev-web' and 'make dev-backend' in separate terminals$(RESET)"
dev-web: ## Start frontend development server
@echo "$(CYAN)Starting frontend on http://localhost:5000$(RESET)"
cd web && npm run dev -- -p 5000
dev-backend: ## Start backend development server
@echo "$(CYAN)Starting backend on http://localhost:8080$(RESET)"
cd backend && uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8080
dev-all: ## Start all services concurrently (frontend, backend)
@echo "$(CYAN)Starting all services...$(RESET)"
@echo "$(YELLOW)Note: Ensure PostgreSQL and Redis are running$(RESET)"
$(MAKE) dev-backend &
$(MAKE) dev-web
# =============================================================================
# Build
# =============================================================================
build: build-web ## Build all projects
build-web: ## Build frontend for production
@echo "$(CYAN)Building frontend...$(RESET)"
cd web && npm run build
start-web: ## Start production server (requires build first)
@echo "$(CYAN)Starting production server on http://localhost:3000$(RESET)"
cd web && npm start
# =============================================================================
# Linting & Testing
# =============================================================================
lint: lint-web lint-backend ## Run all linters
lint-web: ## Lint frontend code
@echo "$(CYAN)Linting frontend...$(RESET)"
cd web && npm run lint
type-check: ## Type-check frontend code
@echo "$(CYAN)Type-checking frontend...$(RESET)"
cd web && npx tsc --noEmit
lint-backend: ## Lint backend code
@echo "$(CYAN)Linting backend...$(RESET)"
cd backend && uv run ruff check . && uv run ruff format --check .
format-backend: ## Format backend code
@echo "$(CYAN)Formatting backend...$(RESET)"
cd backend && uv run ruff format .
test: test-backend ## Run all tests
test-backend: ## Run backend tests
@echo "$(CYAN)Running backend tests...$(RESET)"
cd backend && uv run pytest -v
# =============================================================================
# Agent Evaluations
# =============================================================================
eval: eval-routing eval-tools eval-quality ## Run all agent evaluations
eval-routing: ## Run routing accuracy evaluations
@echo "$(CYAN)Running routing evaluations...$(RESET)"
cd backend && uv run pytest evals/test_routing.py -v --tb=short
eval-tools: ## Run tool/skill selection evaluations
@echo "$(CYAN)Running tool selection evaluations...$(RESET)"
cd backend && uv run pytest evals/test_tool_selection.py -v --tb=short
eval-quality: ## Run response quality evaluations
@echo "$(CYAN)Running response quality evaluations...$(RESET)"
cd backend && uv run pytest evals/test_response_quality.py -v --tb=short
eval-langsmith: ## Run evals with LangSmith tracking
@echo "$(CYAN)Running evaluations with LangSmith...$(RESET)"
cd backend && LANGCHAIN_TRACING_V2=true uv run pytest evals/ -v -m langsmith_integration
eval-reliability: ## Generate reliability report from run ledger
@echo "$(CYAN)Generating reliability report...$(RESET)"
cd backend && uv run python scripts/reliability_report.py --days 7 --markdown-out ../docs/reliability-report.md
gate-reliability: ## Enforce reliability gate (TSR + stream correctness)
@echo "$(CYAN)Running reliability gate...$(RESET)"
cd web && npm run replay:check
cd backend && uv run python scripts/reliability_report.py --days 7 --gate --min-tsr 0.50 --max-duplicate-rate 0.003 --max-missing-complete-rate 0.001
# =============================================================================
# Migrations
# =============================================================================
migrate: ## Apply all pending database migrations
@echo "$(CYAN)Applying database migrations...$(RESET)"
cd backend && uv run alembic upgrade head
migrate-down: ## Rollback last database migration
@echo "$(CYAN)Rolling back last migration...$(RESET)"
cd backend && uv run alembic downgrade -1
migrate-new: ## Create new migration (usage: make migrate-new msg='description')
@if [ -z "$(msg)" ]; then \
echo "$(YELLOW)Usage: make migrate-new msg='migration description'$(RESET)"; \
exit 1; \
fi
@echo "$(CYAN)Creating new migration: $(msg)$(RESET)"
cd backend && uv run alembic revision --autogenerate -m "$(msg)"
migrate-status: ## Show current migration status
@echo "$(CYAN)Migration status:$(RESET)"
cd backend && uv run alembic current
@echo ""
@echo "$(CYAN)Migration history:$(RESET)"
cd backend && uv run alembic history
# =============================================================================
# Utilities
# =============================================================================
clean: ## Clean build artifacts and caches
@echo "$(CYAN)Cleaning build artifacts...$(RESET)"
rm -rf web/.next
rm -rf web/node_modules/.cache
rm -rf backend/__pycache__
rm -rf backend/.pytest_cache
rm -rf backend/.ruff_cache
find backend -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
health: ## Check health of all services
@echo "$(CYAN)Checking service health...$(RESET)"
@echo -n "Backend API: "
@curl -s http://localhost:8080/api/v1/health | jq -r '.status' 2>/dev/null || echo "$(YELLOW)Not running$(RESET)"
@echo -n "Frontend: "
@curl -s -o /dev/null -w "%{http_code}" http://localhost:5000 2>/dev/null && echo "$(GREEN)Running$(RESET)" || echo "$(YELLOW)Not running$(RESET)"
# =============================================================================
# Sandbox Management
# =============================================================================
sandbox-pull-images: ## Pull all Docker images required by BoxLite local sandbox
@echo "$(CYAN)Pulling BoxLite Docker images...$(RESET)"
cd backend && python3 scripts/pull_boxlite_images.py
sandbox-build-app-image: ## Build the pre-cached app sandbox Docker image
@echo "$(CYAN)Building app sandbox image with pre-cached templates...$(RESET)"
docker build -f backend/docker/app-sandbox.Dockerfile -t hyperagent/app-sandbox:latest backend/docker/
# Default target
.DEFAULT_GOAL := help