-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathjustfile
More file actions
186 lines (160 loc) · 5.25 KB
/
Copy pathjustfile
File metadata and controls
186 lines (160 loc) · 5.25 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
# A2A Registry - Development Commands
# Install just: https://github.com/casey/just
# List available commands
default:
@just --list
# Setup everything (first time)
setup:
@echo "🚀 Setting up A2A Registry development environment..."
@echo ""
@echo "📦 Installing backend dependencies..."
cd backend && uv sync
@echo ""
@echo "📦 Installing frontend dependencies..."
cd website && npm install
@echo ""
@echo "📝 Creating environment files..."
@just env-setup
@echo ""
@echo "✅ Setup complete!"
@echo ""
@echo "Next steps:"
@echo " 1. Edit backend/.env with your DATABASE_URL and POSTHOG_API_KEY"
@echo " 2. Edit website/.env with your VITE_POSTHOG_KEY"
@echo " 3. Run: just db-setup"
@echo " 4. Run: just dev"
# Create environment files if they don't exist
env-setup:
@test -f backend/.env || cp backend/.env.example backend/.env
@test -f website/.env || cp website/.env.example website/.env
@echo "✅ Environment files created (edit them with your values)"
# Setup database (create + migrate)
db-setup:
@echo "🗄️ Setting up database..."
createdb a2a_registry || echo "Database already exists"
psql a2a_registry < backend/migrations/versions/001_initial_schema.sql
@echo "✅ Database ready!"
# Migrate existing agents from JSON to database
db-migrate:
@echo "📦 Migrating agents to database..."
uv run python scripts/sync_to_db.py
@echo "✅ Migration complete!"
# Start all services with docker-compose
up:
@echo "🚀 Starting all services..."
docker-compose up
# Start services in background
up-bg:
@echo "🚀 Starting all services in background..."
docker-compose up -d
# Stop all services
down:
@echo "🛑 Stopping all services..."
docker-compose down
# View logs
logs service="":
#!/usr/bin/env bash
if [ -z "{{service}}" ]; then
docker-compose logs -f
else
docker-compose logs -f {{service}}
fi
# Development mode (local, no docker)
dev:
@echo "🔧 Starting development servers..."
@echo ""
@echo "Starting in 3 terminals:"
@echo " Terminal 1: Backend API (port 8000)"
@echo " Terminal 2: Health Worker"
@echo " Terminal 3: Frontend (port 5173)"
@echo ""
@just -f justfile dev-backend & just -f justfile dev-worker & just -f justfile dev-frontend
# Start backend API only
dev-backend:
@echo "🚀 Starting backend API..."
cd backend && uv run python run.py
# Start health worker only
dev-worker:
@echo "🏥 Starting health check worker..."
cd backend && uv run python worker.py
# Start frontend only
dev-frontend:
@echo "⚛️ Starting frontend..."
cd website && npm run dev
# Build frontend for production
build-frontend:
@echo "📦 Building frontend..."
cd website && npm run build
@echo "✅ Build complete! Output in docs/"
# Build backend container
build-backend:
@echo "🐳 Building backend container..."
docker build -t a2a-registry-backend:latest backend/
@echo "✅ Container built!"
# Run backend tests
test-backend:
@echo "🧪 Running backend tests..."
cd backend && uv run pytest
# Run Python SDK tests
test-sdk:
@echo "🧪 Running SDK tests..."
cd client-python && uv run pytest tests/
# Lint backend code
lint-backend:
@echo "🔍 Linting backend..."
cd backend && uv run ruff check .
# Format backend code
fmt-backend:
@echo "✨ Formatting backend..."
cd backend && uv run ruff format .
# Validate an agent file
validate-agent file:
@echo "🔍 Validating {{file}}..."
uv run python scripts/validate_agent.py {{file}}
# Check database connection
db-check:
@echo "🔍 Checking database connection..."
cd backend && uv run python -c "import asyncio; from app.database import db; asyncio.run(db.connect()); print('✅ Database connection successful!')"
# Reset database (WARNING: deletes all data)
db-reset:
@echo "⚠️ This will delete ALL data!"
@read -p "Are you sure? (yes/no) " confirm && [ "$$confirm" = "yes" ]
dropdb a2a_registry || true
@just db-setup
@echo "✅ Database reset complete!"
# View database stats
db-stats:
@echo "📊 Database statistics:"
psql a2a_registry -c "SELECT COUNT(*) as agents FROM agents;"
psql a2a_registry -c "SELECT COUNT(*) as health_checks FROM health_checks;"
psql a2a_registry -c "SELECT COUNT(*) as flags FROM agent_flags;"
# Clean build artifacts
clean:
@echo "🧹 Cleaning build artifacts..."
rm -rf backend/__pycache__
rm -rf backend/app/__pycache__
rm -rf website/dist
rm -rf website/node_modules/.cache
@echo "✅ Clean complete!"
# Install just (if not already installed)
install-just:
@echo "📦 Installing just..."
cargo install just || curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
@echo "✅ just installed!"
# Show environment info
info:
@echo "📋 Environment Information:"
@echo ""
@echo "Backend:"
@cd backend && uv run python --version
@echo ""
@echo "Frontend:"
@cd website && node --version
@cd website && npm --version
@echo ""
@echo "Database:"
@psql --version | head -n1
@echo ""
@echo "Docker:"
@docker --version
@docker-compose --version