Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 55 additions & 23 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,46 +173,78 @@ interface Message {

## Development Commands

This project uses [just](https://github.com/casey/just) as a command runner. Run `just --list` to see all available commands.

```bash
# Backend (from service/)
uv run pytest # Run tests
uv run pytest --cov # Run tests with coverage
uv run pyright . # Type checking
uv run ruff check . # Lint code
uv run ruff format . # Format code (auto-applied on save in VSCode)

# Frontend (from web/)
yarn dev # Dev server
yarn type-check # TypeScript check
yarn lint # ESLint
yarn test # Vitest

# Full stack (from root)
./launch/dev.sh -d # Start all services
# Development environment
just dev # Start all services in background
just stop # Stop containers (without removing)
just down # Stop and remove all containers

# Backend (runs in service/ directory)
just test-backend # uv run pytest
just test-backend-cov # uv run pytest --cov
just type-backend # uv run pyright .
just lint-backend # uv run ruff check .
just fmt-backend # uv run ruff format .
just check-backend # Run all backend checks

# Frontend (runs in web/ directory)
just dev-web # yarn dev
just type-web # yarn type-check
just lint-web # yarn lint
just test-web # yarn test
just check-web # Run all frontend checks

# Full stack
just lint # Run all linters
just test # Run all tests
just check # Run all checks
```

## Database Migrations

When creating or running migrations, use `docker exec` to access the container:
Migrations run inside the `sciol-xyzen-service-1` container via `docker exec`:

```bash
# Generate migration
docker exec -it sciol-xyzen-service-1 sh -c "uv run alembic revision --autogenerate -m 'Description'"
# Apply migrations
docker exec -it sciol-xyzen-service-1 sh -c "uv run alembic upgrade head"
just migrate "Description" # alembic revision --autogenerate -m "..."
just migrate-up # alembic upgrade head
just migrate-down # alembic downgrade -1
just migrate-history # alembic history
just migrate-current # alembic current
```

**Note**: Register new models in `models/__init__.py` before generating migrations.

## Database Queries

Query PostgreSQL directly for debugging (credentials: `postgres/postgres`, database: `postgres`):
Database commands run against `sciol-xyzen-postgresql-1` container (credentials: `postgres/postgres`, database: `postgres`):

```bash
# List tables
docker exec sciol-xyzen-postgresql-1 psql -U postgres -d postgres -c "\dt"
just db-tables # psql -c "\dt"
just db-query "SELECT ..." # psql -c "SELECT ..."
just db-shell # Interactive psql shell
```

## Docker Commands

Docker compose uses `docker/docker-compose.base.yaml` + `docker/docker-compose.dev.yaml` with `docker/.env.dev`:

```bash
# Commonly used - check API server and Celery worker logs
just logs-f service # Follow FastAPI server logs
just logs-f worker # Follow Celery worker logs

# Other commands
just logs # View all service logs
just ps # Show running containers
just restart <service> # Restart a service
just rebuild <service> # Rebuild and restart service
just exec <service> # Shell into container
```

**Container names**: `sciol-xyzen-{service}-1` (e.g., `sciol-xyzen-service-1`, `sciol-xyzen-worker-1`)

## Code Style

**Python**: Use `list[T]`, `dict[K,V]`, `str | None` (not `List`, `Dict`, `Optional`)
Expand Down
203 changes: 203 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
# Xyzen Development Commands
# Run `just --list` to see all available commands

# Default recipe: show available commands
default:
@just --list

# =============================================================================
# Development Environment
# =============================================================================

# Start all services in background (docker)
dev:
./launch/dev.sh -d

# Start all services in foreground
dev-fg:
./launch/dev.sh

# Stop all containers (without removing)
stop:
./launch/dev.sh -s

# Stop and remove all containers
down:
./launch/dev.sh -e

# Start only infrastructure services (postgres, redis, etc.)
infra:
./launch/middleware.sh

# =============================================================================
# Backend (service/)
# =============================================================================

# Run backend tests
test-backend *args='':
cd service && uv run pytest {{ args }}

# Run backend tests with coverage
test-backend-cov:
cd service && uv run pytest --cov

# Type check backend code
type-backend:
cd service && uv run pyright .

# Lint backend code
lint-backend:
cd service && uv run ruff check .

# Format backend code
fmt-backend:
cd service && uv run ruff format .

# Run all backend checks (lint + type + test)
check-backend: lint-backend type-backend test-backend

# =============================================================================
# Frontend (web/)
# =============================================================================

# Start frontend dev server
dev-web:
cd web && yarn dev

# Run frontend tests
test-web *args='':
cd web && yarn test {{ args }}

# Type check frontend code
type-web:
cd web && yarn type-check

# Lint frontend code
lint-web:
cd web && yarn lint

# Format frontend code
fmt-web:
cd web && yarn prettier

# Build frontend for production
build-web:
cd web && yarn build

# Build frontend as library
build-lib:
cd web && yarn build:lib

# Run all frontend checks (lint + type + test)
check-web: lint-web type-web test-web

# =============================================================================
# Full Stack
# =============================================================================

# Run all linters
lint: lint-backend lint-web

# Run all type checks
type-check: type-backend type-web

# Run all tests
test: test-backend test-web

# Run all formatters
fmt: fmt-backend fmt-web

# Run all checks (lint + type + test)
check: check-backend check-web

# =============================================================================
# Database & Migrations
# =============================================================================

# Generate a new migration
migrate message:
docker exec -it sciol-xyzen-service-1 sh -c "uv run alembic revision --autogenerate -m '{{ message }}'"

# Apply all pending migrations
migrate-up:
docker exec -it sciol-xyzen-service-1 sh -c "uv run alembic upgrade head"

# Rollback one migration
migrate-down:
docker exec -it sciol-xyzen-service-1 sh -c "uv run alembic downgrade -1"

# Show migration history
migrate-history:
docker exec -it sciol-xyzen-service-1 sh -c "uv run alembic history"

# Show current migration version
migrate-current:
docker exec -it sciol-xyzen-service-1 sh -c "uv run alembic current"

# List all database tables
db-tables:
docker exec sciol-xyzen-postgresql-1 psql -U postgres -d postgres -c "\dt"

# Run a SQL query against the database
db-query query:
docker exec sciol-xyzen-postgresql-1 psql -U postgres -d postgres -c "{{ query }}"

# Open psql shell
db-shell:
docker exec -it sciol-xyzen-postgresql-1 psql -U postgres -d postgres

# =============================================================================
# Docker
# =============================================================================

# View service logs (all services)
logs *args='':
docker compose -f docker/docker-compose.base.yaml -f docker/docker-compose.dev.yaml --env-file docker/.env.dev logs {{ args }}

# View service logs and follow
logs-f *args='':
docker compose -f docker/docker-compose.base.yaml -f docker/docker-compose.dev.yaml --env-file docker/.env.dev logs -f {{ args }}

# Show running containers
ps:
docker compose -f docker/docker-compose.base.yaml -f docker/docker-compose.dev.yaml --env-file docker/.env.dev ps

# Restart a specific service
restart service:
docker compose -f docker/docker-compose.base.yaml -f docker/docker-compose.dev.yaml --env-file docker/.env.dev restart {{ service }}

# Rebuild and restart services
rebuild *services='':
docker compose -f docker/docker-compose.base.yaml -f docker/docker-compose.dev.yaml --env-file docker/.env.dev up -d --build {{ services }}

# Execute command in service container
exec service *cmd='sh':
docker exec -it sciol-xyzen-{{ service }}-1 {{ cmd }}

# =============================================================================
# Git & Maintenance
# =============================================================================

# Clean stale local branches (interactive)
clean-branches:
./launch/clean.sh

# Run pre-commit on all files
pre-commit:
pre-commit run --all-files

# Run pre-commit on staged files only
pre-commit-staged:
pre-commit run

# =============================================================================
# Build & Release
# =============================================================================

# Build development images
build-dev:
./launch/buildx-dev.sh

# Build production images
build-prod:
./launch/buildx-prod.sh
4 changes: 4 additions & 0 deletions service/app/agents/builtin/react.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
NodeType,
ToolNodeConfig,
)
from app.schemas.prompt_config import PromptConfig

# ReAct Agent configuration using direct LLM and TOOL nodes (NOT subgraph)
# This ensures proper streaming support through LangGraph's messages mode
Expand Down Expand Up @@ -62,6 +63,9 @@
GraphEdgeConfig(from_node="tools", to_node="agent"),
],
entry_point="agent",
prompt_config=PromptConfig(
custom_instructions="", # User should set their instructions here
),
metadata={
"builtin_key": "react",
"display_name": "ReAct Agent",
Expand Down
Loading
Loading