-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathMakefile
More file actions
243 lines (198 loc) · 7.9 KB
/
Makefile
File metadata and controls
243 lines (198 loc) · 7.9 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# AgentUp Development Makefile
# Useful commands for testing, template generation, and development
.DEFAULT_GOAL := help
.PHONY: help install install-dev check-deps pre-commit-install
.PHONY: test test-unit test-unit-coverage test-unit-fast test-unit-watch test-integration
.PHONY: lint lint-fix format format-check
.PHONY: security security-report security-full
.PHONY: validate-code validate-ci validate-all
.PHONY: template-test-syntax
.PHONY: pre-commit
.PHONY: agent-init agent-init-minimal agent-init-advanced agent-test
.PHONY: dev-server dev-server-test
.PHONY: docs-serve
.PHONY: build build-check
.PHONY: clean clean-agents clean-all
.PHONY: ci-deps ci-test
.PHONY: version env-info
.PHONY: dev-setup dev-test dev-full
# Default target
help: ## Show this help message
@echo "AgentUp Development Commands"
@echo "=========================="
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@echo ""
@echo "Useful commands:"
@echo " make dev-setup # Install and configure everything"
@echo " make pre-commit # Run all quality checks"
@echo " make dev-test # Quick test & lint cycle"
@echo " make pre-commit-install # Install pre-commit hooks"
# Environment setup
install: ## Install dependencies with uv
uv sync --all-extras
@echo "Dependencies installed"
install-dev: ## Install development dependencies
uv sync --all-extras --dev
uv pip install -e .
@echo "Development environment ready"
check-deps: ## Check for missing dependencies
uv pip check
@echo "All dependencies satisfied"
pre-commit-install: ## Install and configure pre-commit
uv pip install pre-commit
pre-commit install
pre-commit autoupdate
@echo "✓ pre-commit installed and configured"
# Testing commands
test: ## Run all tests (unit + integration + e2e)
@echo "Running comprehensive test suite..."
uv run pytest tests/ -v
test-unit: ## Run unit tests only (fast)
uv run pytest tests/test_*.py tests/test_core/ tests/test_cli/ tests/thirdparty -v -m "not integration and not e2e and not performance"
test-unit-coverage: ## Run unit tests with coverage report
uv run pytest tests/test_*.py tests/test_core/ tests/test_cli/ --cov=src --cov-report=html --cov-report=term-missing -m "not integration and not e2e and not performance"
@echo "Coverage report generated in htmlcov/"
test-unit-fast: ## Run unit tests with minimal output
uv run pytest tests/test_*.py tests/test_core/ tests/test_cli/ -q --tb=short -m "not integration and not e2e and not performance"
test-unit-watch: ## Run unit tests in watch mode
uv run pytest-watch --runner "uv run pytest tests/test_*.py tests/test_core/ tests/test_cli/ -m 'not integration and not e2e and not performance'"
test-integration: ## Run bash integration tests only
chmod +x tests/integration/int.sh
./tests/integration/int.sh
# Template validation
template-test-syntax: ## Test template syntax only (quick)
uv run python -c "from jinja2 import Environment, FileSystemLoader; env = Environment(loader=FileSystemLoader('src/agent/templates')); [env.get_template(t) for t in ['config/agentup_minimal.yml.j2', 'config/agentup_full.yml.j2']]"
@echo "Template syntax validated"
# Code quality
lint: ## Run linting checks (parallel)
uv run ruff check src/ tests/
lint-fix: ## Fix linting issues automatically
uv run ruff check --fix src/ tests/
uv run ruff format src/ tests/
format: ## Format code with ruff (parallel)
uv run ruff format src/ tests/
format-check: ## Check code formatting
uv run ruff format --check src/ tests/
type:
uv run mypy --show-error-codes --ignore-missing-imports
# Security scanning
security: ## Run bandit security scan
uv run bandit -r src/ -ll
security-report: ## Generate bandit security report in JSON
uv run bandit -r src/ -f json -o bandit-report.json
security-full: ## Run full security scan with medium severity
uv run bandit -r src/ -l
# Combined validation
validate-code: ## Run format, lint, and security checks
make format
make lint
make security
@echo "✓ Code quality checks passed"
validate-ci: validate-code test-unit template-test-syntax format lint security ## Run full CI checks
@echo "✓ All CI validation passed"
validate-all: lint test template-test-syntax ## Run all validation checks
@echo "✓ All validation checks passed"
# CI-specific
ci-deps: ## Check dependencies for CI
uv pip check
uv pip freeze > requirements-ci.txt
ci-test: ## Run CI test suite
uv run pytest --cov=src --cov-report=xml --cov-report=term
uv run ruff check src/ tests/
# Pre-commit
pre-commit: ## Run pre-commit hooks
uv run pre-commit run --all-files
# Agent creation and testing
agent-init: ## Create a test agent (interactive)
uv run agentup init --no-git
agent-init-minimal: ## Create minimal test agent
@echo "Creating minimal test agent..."
uv run agentup init \
--quick test-minimal \
--no-git \
--output-dir ./test-agents/minimal
@echo "Minimal agent created in ./test-agents/minimal"
agent-init-advanced: ## Create advanced test agent
@echo "Creating advanced test agent..."
uv run agentup init \
--quick test-advanced \
--no-git \
--output-dir ./test-agents/advanced
@echo "Advanced agent created in ./test-agents/advanced"
agent-test: ## Test a generated agent
@if [ -d "./test-agents/minimal" ]; then \
echo "Testing minimal agent..."; \
cd ./test-agents/minimal && \
uv run python -m pytest tests/ -v 2>/dev/null || echo "Tests not available"; \
echo "Agent test completed"; \
else \
echo "✗ No test agent found. Run 'make agent-init-minimal' first"; \
fi
# Development server
dev-server: ## Start development server for reference implementation
uv run uvicorn src.agent.main:app --reload --port 8000
dev-server-test: ## Start test agent server
@if [ -d "./test-agents/minimal" ]; then \
echo "Starting test agent server..."; \
cd ./test-agents/minimal && \
uv run uvicorn agentup.api.app:app --reload --port 8001; \
else \
echo "✗ No test agent found. Run 'make agent-init-minimal' first"; \
fi
# Docs
docs-serve: ## Serve documentation locally
@if command -v mkdocs >/dev/null 2>&1; then \
mkdocs serve; \
else \
echo "📚 Opening documentation files..."; \
open docs/routing-and-function-calling.md; \
fi
# Build & Release
build: ## Build package
uv build
@echo "Package built in dist/"
build-check: ## Check package build
uv run twine check dist/*
# Cleanup
clean: ## Clean temporary files
rm -rf build/ dist/ *.egg-info/ .pytest_cache/ htmlcov/ .coverage test-render/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
@echo "Cleaned temporary files"
clean-agents: ## Clean test agents
rm -rf test-agents/
@echo "Cleaned test agents"
clean-all: clean clean-agents ## Clean everything
@echo "Cleaned everything"
# Utility
version: ## Show current version
@python -c "import toml; print('AgentUp version:', toml.load('pyproject.toml')['project']['version'])"
env-info: ## Show environment information
@echo "Environment Information"
@echo "====================="
@echo "Python version: $$(python --version)"
@echo "UV version: $$(uv --version)"
@echo "Working directory: $$(pwd)"
@echo "Git branch: $$(git branch --show-current 2>/dev/null || echo 'Not a git repo')"
@echo "Git status: $$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ') files changed"
# Dev workflows
dev-setup: install-dev pre-commit-install ## Complete development setup
@echo "Running complete development setup..."
make check-deps
make test-unit-fast
@echo "Development environment ready!"
dev-test: ## Quick development test cycle
@echo "Running development test cycle..."
make lint-fix
make test-unit-fast
make template-test-syntax
@echo "Development tests passed!"
dev-full: ## Full development validation
@echo "Running full development validation..."
make clean
make dev-setup
make validate-all
make agent-init-minimal
make agent-test
@echo "Full development validation completed!"