name: Development Agent
on:
issues:
types: [labeled, edited]
issue_comment:
types: [created]
pull_request_review:
types: [submitted]
pull_request:
types: [closed]
permissions:
contents: write
pull-requests: write
issues: write
models: read
env:
AI_PROVIDER: "anthropic"
DEFAULT_MODEL: "claude-opus-4-6"
jobs:
triage-analysis:
name: "Triage — Analyze Issue Requirements"
if: >
(
github.event_name == 'issues'
&& github.event.action == 'labeled'
&& github.event.label.name == 'selected for development'
) || (
github.event_name == 'issues'
&& github.event.action == 'edited'
&& contains(join(github.event.issue.labels.*.name, ','), 'selected for development')
) || (
github.event_name == 'issue_comment'
&& github.event.action == 'created'
&& contains(join(github.event.issue.labels.*.name, ','), 'selected for development')
&& github.event.issue.pull_request == null
&& github.event.sender.type != 'Bot'
)
runs-on: ubuntu-latest
concurrency:
group: triage-${{ github.event.issue.number }}
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install dependencies
run: npm ci
working-directory: .github/scripts/development
- name: Run Triage Analysis
id: triage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AI_PROVIDER: ${{ env.AI_PROVIDER }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
DEFAULT_MODEL: ${{ env.DEFAULT_MODEL }}
TRIAGE_MODEL: ${{ env.TRIAGE_MODEL }}
REPO: ${{ github.repository }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: npx tsx src/triage.ts
working-directory: .github/scripts/development
prepare-branch:
name: "Prepare — Create Branch"
if: >
github.event_name == 'issues'
&& github.event.action == 'labeled'
&& github.event.label.name == 'in progress'
runs-on: ubuntu-latest
concurrency:
group: development-${{ github.event.issue.number }}
cancel-in-progress: false
outputs:
branch_created: ${{ steps.prepare.outputs.branch_created }}
branch_name: ${{ steps.prepare.outputs.branch_name }}
base_branch: ${{ steps.prepare.outputs.base_branch }}
branch_type: ${{ steps.prepare.outputs.branch_type }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install dependencies
run: npm ci
working-directory: .github/scripts/development
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Run Prepare Branch
id: prepare
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: npx tsx src/prepare-branch.ts
working-directory: .github/scripts/development
- name: Upload triage result
if: steps.prepare.outputs.branch_created == 'true'
uses: actions/upload-artifact@v4
with:
name: triage-result
path: .github/scripts/development/triage-result.json
retention-days: 1
architect:
name: "Architect — Plan File Changes"
needs: prepare-branch
if: needs.prepare-branch.outputs.branch_created == 'true'
runs-on: ubuntu-latest
concurrency:
group: development-${{ github.event.issue.number }}
cancel-in-progress: false
outputs:
architect_passed: ${{ steps.architect.outputs.architect_passed }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install dependencies
run: npm ci
working-directory: .github/scripts/development
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Download triage result
uses: actions/download-artifact@v4
with:
name: triage-result
path: .github/scripts/development
- name: Checkout feature branch
env:
BRANCH_NAME: ${{ needs.prepare-branch.outputs.branch_name }}
run: |
git fetch origin
git checkout "$BRANCH_NAME" || git checkout -b "$BRANCH_NAME" "origin/$BRANCH_NAME"
- name: Run Architect Agent
id: architect
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AI_PROVIDER: ${{ env.AI_PROVIDER }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
DEFAULT_MODEL: ${{ env.DEFAULT_MODEL }}
ARCHITECT_MODEL: ${{ env.ARCHITECT_MODEL }}
REPO: ${{ github.repository }}
run: npx tsx src/architect.ts
working-directory: .github/scripts/development
- name: Upload architecture plan
uses: actions/upload-artifact@v4
with:
name: architecture-plan
path: .github/scripts/development/architecture-plan.json
retention-days: 1
write-and-review:
name: "Write Code & Review Quality"
needs: [prepare-branch, architect]
if: needs.architect.outputs.architect_passed == 'true'
runs-on: ubuntu-latest
concurrency:
group: development-${{ github.event.issue.number }}
cancel-in-progress: false
outputs:
writer_passed: ${{ steps.writer.outputs.writer_passed }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install dependencies
run: npm ci
working-directory: .github/scripts/development
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: .github/scripts/development
merge-multiple: true
- name: Checkout feature branch
env:
BRANCH_NAME: ${{ needs.prepare-branch.outputs.branch_name }}
run: |
git fetch origin
git checkout "$BRANCH_NAME" || git checkout -b "$BRANCH_NAME" "origin/$BRANCH_NAME"
- name: Run Writer Agent (with Reviewer loop)
id: writer
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AI_PROVIDER: ${{ env.AI_PROVIDER }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
DEFAULT_MODEL: ${{ env.DEFAULT_MODEL }}
WRITER_MODEL: ${{ env.WRITER_MODEL }}
REVIEWER_MODEL: ${{ env.REVIEWER_MODEL }}
REPO: ${{ github.repository }}
run: npx tsx src/writer.ts
working-directory: .github/scripts/development
- name: Upload writer result
uses: actions/upload-artifact@v4
with:
name: writer-result
path: .github/scripts/development/writer-result.json
retention-days: 1
pull-request:
name: "Create Pull Request"
needs: [prepare-branch, architect, write-and-review]
if: needs.write-and-review.outputs.writer_passed == 'true'
runs-on: ubuntu-latest
concurrency:
group: development-${{ github.event.issue.number }}
cancel-in-progress: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install dependencies
run: npm ci
working-directory: .github/scripts/development
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: .github/scripts/development
merge-multiple: true
- name: Run Pull Request Agent
id: pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AI_PROVIDER: ${{ env.AI_PROVIDER }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
DEFAULT_MODEL: ${{ env.DEFAULT_MODEL }}
PULL_REQUEST_MODEL: ${{ env.PULL_REQUEST_MODEL }}
REPO: ${{ github.repository }}
run: npx tsx src/pull-request.ts
working-directory: .github/scripts/development
handle-review:
name: "Handle PR Review — Apply Fixes"
if: >
github.event_name == 'pull_request_review'
&& github.event.action == 'submitted'
&& github.event.review.state != 'approved'
&& github.event.sender.type != 'Bot'
runs-on: ubuntu-latest
concurrency:
group: review-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install dependencies
run: npm ci
working-directory: .github/scripts/development
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Run Handle Review
id: review
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AI_PROVIDER: ${{ env.AI_PROVIDER }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
DEFAULT_MODEL: ${{ env.DEFAULT_MODEL }}
WRITER_MODEL: ${{ env.WRITER_MODEL }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: npx tsx src/handle-review.ts
working-directory: .github/scripts/development
handle-merge:
name: "Handle PR Merge — Close Issue"
if: >
github.event_name == 'pull_request'
&& github.event.action == 'closed'
&& github.event.pull_request.merged == true
runs-on: ubuntu-latest
concurrency:
group: merge-${{ github.event.pull_request.number }}
cancel-in-progress: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install dependencies
run: npm ci
working-directory: .github/scripts/development
- name: Run Handle Merge
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: npx tsx src/handle-merge.ts
working-directory: .github/scripts/development