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
25 changes: 25 additions & 0 deletions .cascade/ensure-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,29 @@ else
fi
fi

# Verify test database exists (needed for integration tests)
if pg_isready -q 2>/dev/null; then
# OS-aware psql command (macOS uses peer auth, Linux uses -U postgres)
case "$(uname -s)" in
Linux*) PSQL_CMD="psql -U postgres" ;;
*) PSQL_CMD="psql" ;;
esac

if $PSQL_CMD -lqt 2>/dev/null | cut -d \| -f 1 | grep -qw cascade_test; then
echo "Test database (cascade_test): exists"
else
echo "Test database (cascade_test): missing - creating..."
if [ "$(uname -s)" = "Linux" ]; then
$PSQL_CMD -c "CREATE DATABASE cascade_test;" 2>/dev/null || true
else
createdb cascade_test 2>/dev/null || true
fi
if $PSQL_CMD -lqt 2>/dev/null | cut -d \| -f 1 | grep -qw cascade_test; then
echo "Test database (cascade_test): created"
else
echo "Test database (cascade_test): FAILED TO CREATE (integration tests will not work)"
fi
fi
fi

echo "=== All services running ==="
1 change: 1 addition & 0 deletions .cascade/env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CI=true
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/cascade
DATABASE_SSL=false
TEST_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/cascade_test
32 changes: 28 additions & 4 deletions .cascade/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ if pg_isready -q 2>/dev/null; then
PSQL_CMD="sudo -u postgres psql"
fi

# Create cascade database
# Create cascade database (development)
if ! $PSQL_CMD -lqt 2>/dev/null | cut -d \| -f 1 | grep -qw cascade; then
log_info "Creating cascade database..."
if [ "$OS" = "linux" ]; then
Expand All @@ -236,6 +236,18 @@ if pg_isready -q 2>/dev/null; then
log_info "Database cascade already exists"
fi

# Create cascade_test database (integration tests)
if ! $PSQL_CMD -lqt 2>/dev/null | cut -d \| -f 1 | grep -qw cascade_test; then
log_info "Creating cascade_test database..."
if [ "$OS" = "linux" ]; then
$PSQL_CMD -c "CREATE DATABASE cascade_test;" 2>/dev/null || true
else
createdb cascade_test 2>/dev/null || true
fi
else
log_info "Database cascade_test already exists"
fi

# On Linux, ensure postgres user has a known password for app connections
if [ "$OS" = "linux" ]; then
$PSQL_CMD -c "ALTER USER postgres WITH PASSWORD 'postgres';" 2>/dev/null || true
Expand Down Expand Up @@ -266,9 +278,21 @@ echo ""
echo "--- Database Migrations ---"

if pg_isready -q 2>/dev/null; then
log_info "Running migrations..."
DATABASE_SSL=false npm run db:migrate 2>&1 || \
log_warn "Migration failed - may need manual intervention"
if [ "$OS" = "linux" ]; then
DEV_DB_URL="postgresql://postgres:postgres@localhost:5432/cascade"
TEST_DB_URL="postgresql://postgres:postgres@localhost:5432/cascade_test"
else
DEV_DB_URL="postgresql://localhost:5432/cascade"
TEST_DB_URL="postgresql://localhost:5432/cascade_test"
fi

log_info "Running migrations on cascade (dev)..."
DATABASE_URL="$DEV_DB_URL" DATABASE_SSL=false npm run db:migrate 2>&1 || \
log_warn "Migration failed on cascade - may need manual intervention"

log_info "Running migrations on cascade_test..."
DATABASE_URL="$TEST_DB_URL" DATABASE_SSL=false npm run db:migrate 2>&1 || \
log_warn "Migration failed on cascade_test - may need manual intervention"
else
log_warn "PostgreSQL not ready, skipping migrations"
fi
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,44 @@ jobs:
- name: Validate PR commits
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

integration-tests:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: cascade_test
POSTGRES_PASSWORD: cascade_test
POSTGRES_DB: cascade_test
ports:
- 5433:5432
options: >-
--health-cmd "pg_isready -U cascade_test -d cascade_test"
--health-interval 2s
--health-timeout 5s
--health-retries 10

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build backend
run: npm run build

- name: Run integration tests
run: npm run test:integration
env:
TEST_DATABASE_URL: postgresql://cascade_test:cascade_test@localhost:5433/cascade_test

docker-build-check:
name: Validate Docker builds
runs-on: ubuntu-latest
Expand Down
26 changes: 13 additions & 13 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Trello/GitHub Webhook → TriggerRegistry → Agent → Code Changes → PR
```

- `src/triggers/` - Event handlers (Trello card moves, labels, GitHub PRs, attachments)
- `src/agents/` - AI agents (briefing, planning, implementation, review, debug)
- `src/agents/` - AI agents (splitting, planning, implementation, review, debug)
- `src/gadgets/` - Tools agents can use (Trello API, Git operations, file system)

### Multi-Project Support
Expand Down Expand Up @@ -156,7 +156,7 @@ npm run credentials:rotate-key # Re-encrypt with CREDENTIAL_MASTER_
CASCADE uses two dedicated GitHub bot accounts per project to prevent feedback loops:

- **Implementer** (`GITHUB_TOKEN_IMPLEMENTER`) — writes code, creates PRs, responds to review comments
- Agents: `implementation`, `respond-to-review`, `respond-to-ci`, `respond-to-pr-comment`, `briefing`, `planning`, `respond-to-planning-comment`
- Agents: `implementation`, `respond-to-review`, `respond-to-ci`, `respond-to-pr-comment`, `splitting`, `planning`, `respond-to-planning-comment`
- **Reviewer** (`GITHUB_TOKEN_REVIEWER`) — reviews PRs, can approve or request changes
- Agents: `review`

Expand Down Expand Up @@ -246,13 +246,13 @@ When `reviewTrigger` is absent, the system falls back to legacy booleans:

### PM Agent Trigger Modes

Briefing, planning, and implementation agents each have independent toggles for their PM triggers. **All modes default to `true`** for backward compatibility.
Splitting, planning, and implementation agents each have independent toggles for their PM triggers. **All modes default to `true`** for backward compatibility.

#### Trello card-moved triggers

| Flag | Description |
|------|-------------|
| `cardMovedToBriefing` | Trigger briefing agent when a card is moved to the Briefing list |
| `cardMovedToSplitting` | Trigger splitting agent when a card is moved to the Splitting list |
| `cardMovedToPlanning` | Trigger planning agent when a card is moved to the Planning list |
| `cardMovedToTodo` | Trigger implementation agent when a card is moved to the Todo list |

Expand All @@ -262,35 +262,35 @@ The `issueTransitioned` field supports both a legacy boolean (applies to all age

| Agent | Field | Description |
|-------|-------|-------------|
| briefing | `issueTransitioned.briefing` | Trigger briefing when issue transitions to Briefing status |
| splitting | `issueTransitioned.splitting` | Trigger splitting when issue transitions to Splitting status |
| planning | `issueTransitioned.planning` | Trigger planning when issue transitions to Planning status |
| implementation | `issueTransitioned.implementation` | Trigger implementation when issue transitions to Todo status |

#### Setting via CLI

```bash
# Disable Trello card-moved trigger for briefing agent
cascade projects pm-trigger-set <project-id> --no-card-moved-to-briefing
# Disable Trello card-moved trigger for splitting agent
cascade projects pm-trigger-set <project-id> --no-card-moved-to-splitting

# Disable JIRA issue-transitioned for implementation agent only
cascade projects pm-trigger-set <project-id> --no-issue-transitioned-implementation

# Enable JIRA triggers for briefing and planning, disable for implementation
# Enable JIRA triggers for splitting and planning, disable for implementation
cascade projects pm-trigger-set <project-id> \
--issue-transitioned-briefing \
--issue-transitioned-splitting \
--issue-transitioned-planning \
--no-issue-transitioned-implementation

# Disable all Trello card-moved triggers
cascade projects pm-trigger-set <project-id> \
--no-card-moved-to-briefing \
--no-card-moved-to-splitting \
--no-card-moved-to-planning \
--no-card-moved-to-todo
```

#### Setting via Dashboard

In the **Agent Configs** tab, the briefing, planning, and implementation agent sections each show:
In the **Agent Configs** tab, the splitting, planning, and implementation agent sections each show:
- **Card moved to [list]** — Trello card-moved toggle (Trello projects only)
- **Issue Transitioned** — JIRA per-agent transition toggle (JIRA projects only)
- **Ready to Process label** — label-based trigger toggle
Expand All @@ -301,7 +301,7 @@ In the **Agent Configs** tab, the briefing, planning, and implementation agent s
# Disable JIRA issue-transitioned for implementation only
cascade projects integration-set <project-id> \
--category pm --provider jira --config '{"projectKey":"PROJ","statuses":{...}}' \
--triggers '{"issueTransitioned":{"briefing":true,"planning":true,"implementation":false}}'
--triggers '{"issueTransitioned":{"splitting":true,"planning":true,"implementation":false}}'
```

#### Backward Compatibility
Expand Down Expand Up @@ -603,7 +603,7 @@ CASCADE includes a debug agent that automatically analyzes agent session logs:
{
"trello": {
"lists": {
"briefing": "...",
"splitting": "...",
"planning": "...",
"todo": "...",
"debug": "YOUR_DEBUG_LIST_ID"
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.dashboard
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ COPY --from=builder /app/dist ./dist

# Copy .eta prompt templates (loaded at runtime by agents/prompts via readFileSync)
COPY --from=builder /app/src/agents/prompts/templates ./dist/agents/prompts/templates
COPY --from=builder /app/src/agents/prompts/task-templates ./dist/agents/prompts/task-templates

ENV PORT=3001
EXPOSE 3001
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.worker
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ RUN sudo ln -sf /app/bin/cascade-tools.js /usr/local/bin/cascade-tools

# Copy Eta template files (not handled by TypeScript compiler)
COPY --chown=node:node src/agents/prompts/templates ./dist/agents/prompts/templates
COPY --chown=node:node src/agents/prompts/task-templates ./dist/agents/prompts/task-templates

# Copy config
COPY --chown=node:node config ./config
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# CASCADE

Multi-project Trello-to-code automation platform. CASCADE reacts to Trello card movements and triggers AI agents to handle briefing, planning, and implementation tasks.
Multi-project Trello-to-code automation platform. CASCADE reacts to Trello card movements and triggers AI agents to handle splitting, planning, and implementation tasks.

## Features

- **Multi-project support** - Single deployment handles multiple repos/Trello boards
- **Extensible trigger system** - Easy to add new triggers (card moved, label added, PR ready, etc.)
- **AI-powered agents** - Briefing, planning, implementation, review, and debug agents using llmist
- **AI-powered agents** - Splitting, planning, implementation, review, and debug agents using llmist
- **Git workflow** - Automatic branch creation, commits, and PR creation
- **Trello integration** - Full card management (labels, comments, attachments)
- **GitHub integration** - PR review webhooks, automatic card movement, CI check monitoring
Expand Down Expand Up @@ -102,7 +102,7 @@ Edit `config/projects.json` to add your projects:
"trello": {
"boardId": "your_board_id",
"lists": {
"briefing": "list_id_for_briefing",
"splitting": "list_id_for_splitting",
"planning": "list_id_for_planning",
"todo": "list_id_for_todo",
"inProgress": "list_id_for_in_progress",
Expand All @@ -124,7 +124,7 @@ Edit `config/projects.json` to add your projects:

| List | Purpose |
|------|---------|
| `briefing` | Cards here trigger the briefing agent (refines requirements) |
| `splitting` | Cards here trigger the splitting agent (splits plan into work items) |
| `planning` | Cards here trigger the planning agent (creates implementation plan) |
| `todo` | Cards here trigger the implementation agent (writes code, creates PR) |
| `inProgress` | Cards being actively worked on |
Expand Down Expand Up @@ -215,7 +215,7 @@ export class MyCustomTrigger implements TriggerHandler {

async handle(ctx: TriggerContext): Promise<TriggerResult> {
return {
agentType: 'implementation', // or 'briefing', 'planning'
agentType: 'implementation', // or 'splitting', 'planning'
agentInput: { /* data for the agent */ },
cardId: 'optional-card-id',
};
Expand Down
8 changes: 4 additions & 4 deletions config/projects.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"agentIterations": {
"planning": 50,
"briefing": 50
"splitting": 50
},
"watchdogTimeoutMs": 2700000,
"selfDestructTimeoutMs": 1800000,
Expand All @@ -27,7 +27,7 @@
"trello": {
"boardId": "694ec393370da080b52eb64c",
"lists": {
"briefing": "694fc5e57256ac0717c3dfea",
"splitting": "694fc5e57256ac0717c3dfea",
"stories": "69541b4151734a3cebab38c4",
"planning": "694ec39e91e3487c1351a491",
"todo": "694ec3a365a4c75df2493504",
Expand Down Expand Up @@ -72,7 +72,7 @@
"trello": {
"boardId": "698db5df2b873930c7c38bc0",
"lists": {
"briefing": "698db5df2b873930c7c38bbb",
"splitting": "698db5df2b873930c7c38bbb",
"stories": "698db5df2b873930c7c38bbd",
"planning": "698db5df2b873930c7c38bb6",
"todo": "698db5df2b873930c7c38bb7",
Expand Down Expand Up @@ -102,7 +102,7 @@
"trello": {
"boardId": "6970fa9aab0e56304a15fbac",
"lists": {
"briefing": "6970faa01757ddb3286e7bae",
"splitting": "6970faa01757ddb3286e7bae",
"planning": "6970fa9d48b639dad13dc8f7"
},
"labels": {
Expand Down
17 changes: 17 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
postgres-test:
container_name: cascade-postgres-test
image: postgres:16-alpine
ports:
- "5433:5432"
environment:
POSTGRES_USER: cascade_test
POSTGRES_PASSWORD: cascade_test
POSTGRES_DB: cascade_test
tmpfs:
- /var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cascade_test -d cascade_test"]
interval: 2s
timeout: 5s
retries: 10
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading