-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (94 loc) · 3.43 KB
/
Makefile
File metadata and controls
119 lines (94 loc) · 3.43 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
.PHONY: init dev dev-docker test test-backend test-frontend test-cli test-init migrate migrate-new build lint clean setup deploy-init deploy preflight types seed worker ui verify persistent
init:
python3 scripts/init.py
dev:
docker compose up -d postgres redis
@echo "Waiting for postgres..."
@until docker compose exec postgres pg_isready > /dev/null 2>&1; do sleep 1; done
@echo "Running migrations..."
cd backend && uv run alembic upgrade head
@echo "Postgres ready. Starting backend and frontend..."
$(MAKE) -j2 _dev-backend _dev-frontend
_dev-backend:
cd backend && uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
_dev-frontend:
cd frontend && npm run dev
dev-docker:
docker compose up --build
test: test-backend test-frontend test-cli test-init
test-backend:
cd backend && uv run pytest
test-frontend:
cd frontend && npm test
test-cli:
node --test cli/test/cli.test.js
test-init:
python3 -m pytest tests/test_init.py -v
migrate:
cd backend && uv run alembic upgrade head
migrate-new:
cd backend && uv run alembic revision --autogenerate -m "$(name)"
build:
docker compose build
lint:
cd backend && uv run ruff check . && uv run ruff format --check .
cd frontend && npm run lint
clean:
docker compose down -v --remove-orphans
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .mypy_cache -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .ruff_cache -exec rm -rf {} + 2>/dev/null || true
rm -rf backend/.venv frontend/node_modules
setup:
cd backend && uv sync
cd frontend && npm install
@cp -n .env.example .env 2>/dev/null || true
@echo "Setup complete. Edit .env if needed, then run 'make dev'"
deploy-init:
./scripts/deploy-init.sh
deploy:
./scripts/deploy.sh $(env)
preflight:
./scripts/preflight.sh $(env)
seed:
cd backend && uv run python -m app.cli.seed
worker:
cd backend && uv run arq app.worker.settings.WorkerSettings
ui:
@cd frontend && npx shadcn@latest add $(component)
verify:
@echo "── Lint (backend) ──"
cd backend && uv run ruff check . && uv run ruff format --check .
@echo "── Lint (frontend) ──"
cd frontend && npm run lint
@echo "── Type check (frontend) ──"
cd frontend && npx tsc --noEmit
@echo "── Tests (backend) ──"
cd backend && uv run pytest --tb=short -q
@echo "── Tests (frontend) ──"
cd frontend && npm test
@echo "── Tests (CLI) ──"
node --test cli/test/cli.test.js
@echo "── Tests (init script) ──"
python3 -m pytest tests/test_init.py -q
@echo ""
@echo "✅ All checks passed."
types:
@echo "Generating TypeScript types from OpenAPI spec..."
@cd backend && uv run python scripts/export_openapi.py > ../frontend/src/types/openapi.json
@cd frontend && ./node_modules/.bin/openapi-typescript src/types/openapi.json -o src/types/api.generated.ts
@rm -f frontend/src/types/openapi.json
@echo "Types written to frontend/src/types/api.generated.ts"
persistent:
@echo "── Setting up persistent agent (OpenClaw) ──"
@if ! command -v openclaw >/dev/null 2>&1; then \
echo "OpenClaw not found. Installing..."; \
npm install -g openclaw@latest; \
fi
@echo "Starting persistent agent with project workspace..."
@echo " SOUL.md: .openclaw/SOUL.md"
@echo " HEARTBEAT.md: .openclaw/HEARTBEAT.md"
@echo " AGENTS.md: .openclaw/AGENTS.md"
@echo ""
openclaw start --workspace .openclaw/