Skip to content
Open
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
18 changes: 18 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Server configuration
PORT=3000

# Environment (development, production, test)
NODE_ENV=development

# OpenWeatherMap API key (optional - uses mock data if not set)
OPENWEATHERMAP_API_KEY=

# CORS allowed origins (comma-separated)
CORS_ORIGINS=http://localhost:3000

# JWT configuration
JWT_SECRET=your-super-secret-jwt-key-change-in-production
JWT_EXPIRES_IN=1h

# Demo user password hash (optional - defaults to bcrypt hash of 'password123')
DEMO_PASSWORD_HASH=
70 changes: 70 additions & 0 deletions .github/workflows/opencode-issue-implement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# .github/workflows/opencode-issue-implement.yml
name: OpenCode Issue Implement

on:
issues:
types: [labeled]

permissions:
id-token: write
contents: write
issues: write
pull-requests: write

concurrency:
group: opencode-implement-${{ github.event.issue.number }}
cancel-in-progress: false

jobs:
implement:
if: github.event.label.name == 'opencode:implement'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Configure Git author
run: |
git config user.name "opencode[bot]"
git config user.email "opencode[bot]@users.noreply.github.com"

- name: Implement issue from latest OpenCode Plan comment
uses: anomalyco/opencode/github@latest
env:
GITHUB_TOKEN: ${{ secrets.OPENCODE_GITHUB_TOKEN }}
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
with:
use_github_token: true
agent: issue-implementer
model: opencode/big-pickle
prompt: |
Implement issue #${{ github.event.issue.number }}.

Before editing files:
1. Read the issue and comments.
2. Find the latest issue comment containing:

<!-- opencode-plan:start -->

3. Extract the plan between:

<!-- opencode-plan:start -->
<!-- opencode-plan:end -->

4. If no plan exists, do not modify files.
5. If the plan says "Ready for implementation: No", do not modify files.
6. If ready, implement the smallest correct change, add or update tests, and run relevant checks.

Do not create a branch.
Do not switch branches.
Do not push.
Do not manually create a pull request.

The OpenCode GitHub Action has already checked out the correct working branch.
Leave the intended changes in the working tree.
The action will handle publishing the branch and PR.

Final merge must be manual by a maintainer.
49 changes: 49 additions & 0 deletions .github/workflows/opencode-issue-plan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# .github/workflows/opencode-issue-plan.yml
name: OpenCode Issue Plan

on:
issues:
types: [labeled]

permissions:
id-token: write
contents: read
issues: write

concurrency:
group: opencode-plan-${{ github.event.issue.number }}
cancel-in-progress: false

jobs:
plan:
if: github.event.label.name == 'opencode:plan'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false

- name: Create implementation plan as issue comment
uses: anomalyco/opencode/github@latest
env:
GITHUB_TOKEN: ${{ secrets.OPENCODE_GITHUB_TOKEN }}
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
with:
use_github_token: true
agent: issue-planner
model: opencode/big-pickle
prompt: |
Create an implementation plan for issue #${{ github.event.issue.number }}.

Store the plan as a GitHub issue comment.
The comment must include exactly one block wrapped with:

<!-- opencode-plan:start -->
<!-- opencode-plan:end -->

Do not modify files.
Do not create a branch.
Do not open a pull request.
44 changes: 44 additions & 0 deletions .github/workflows/opencode-pr-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# .github/workflows/opencode-pr-review.yml
name: OpenCode PR Review

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

permissions:
id-token: write
contents: read
pull-requests: write
issues: write

jobs:
review:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.OPENCODE_GITHUB_TOKEN }}
persist-credentials: true

- name: Run OpenCode PR reviewer
uses: anomalyco/opencode/github@latest
env:
GITHUB_TOKEN: ${{ secrets.OPENCODE_GITHUB_TOKEN }}
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
with:
use_github_token: true
agent: pr-review
model: opencode/big-pickle
prompt: |
Review this pull request.

Do not modify files.
Do not commit.
Do not push.
Do not merge.

Focus on correctness, security, reliability, maintainability, and tests.
57 changes: 57 additions & 0 deletions .github/workflows/opencode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: opencode

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]

jobs:
triage:
if: |
github.event.comment.user.login == github.repository_owner &&
(
contains(github.event.comment.body, ' /oc') ||
startsWith(github.event.comment.body, '/oc') ||
contains(github.event.comment.body, ' /opencode') ||
startsWith(github.event.comment.body, '/opencode')
)
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.OPENCODE_GITHUB_TOKEN }}
persist-credentials: true

- name: Configure Git author
run: |
git config user.name "opencode[bot]"
git config user.email "opencode[bot]@users.noreply.github.com"

- name: Run OpenCode triage agent
uses: anomalyco/opencode/github@latest
env:
GITHUB_TOKEN: ${{ secrets.OPENCODE_GITHUB_TOKEN }}
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
with:
use_github_token: true
agent: triage
model: opencode/big-pickle
prompt: |
A comment was posted with the following body:

${{ github.event.comment.body }}

Context:
- Event: ${{ github.event_name }}
- Issue / PR number: ${{ github.event.issue.number || github.event.pull_request.number }}
- Is pull request: ${{ github.event.issue.pull_request != null || github.event_name == 'pull_request_review_comment' }}

Read the comment, identify the command, and delegate to the correct agent.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
.env
coverage/
103 changes: 103 additions & 0 deletions .opencode/agents/issue-implementer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
description: Implements a planned GitHub issue by reading the latest OpenCode Plan issue comment. OpenCode GitHub Action handles branch, push, and PR creation.
mode: subagent
temperature: 0.2
permission:
read: allow
list: allow
glob: allow
grep: allow
lsp: allow
edit: allow
external_directory: deny
todowrite: allow
webfetch: deny
websearch: deny
bash:
"*": deny
"git status*": allow
"git diff*": allow
"git log*": allow
"git show*": allow
"gh issue view*": allow
"gh issue comment*": allow
"gh pr view*": allow
"gh pr comment*": allow
"gh pr review*": allow
"npm test*": allow
"npm run test*": allow
"npm run lint*": allow
"npm run typecheck*": allow
"npm run build*": allow
"pnpm test*": allow
"pnpm run test*": allow
"pnpm run lint*": allow
"pnpm run typecheck*": allow
"pnpm run build*": allow
"yarn test*": allow
"yarn lint*": allow
"yarn typecheck*": allow
"yarn build*": allow
"pytest*": allow
"go test*": allow
"cargo test*": allow
---

You are an issue implementation agent.

Your job is to implement changes from two possible sources:
1. A GitHub issue with an OpenCode Plan comment.
2. Review comments or suggestions left on a pull request.

Important:
- Do not create a branch.
- Do not switch branches.
- Do not push.
- Do not open a pull request manually.
- The OpenCode GitHub Action already creates the working branch and will handle publishing the result.
- Stay on the branch that already exists when the session starts.

## When triggered from an issue

Before editing anything:
1. Run `gh issue view <issue-number> --comments`.
2. Find the latest issue comment containing `<!-- opencode-plan:start -->`.
3. Extract the plan between:
- `<!-- opencode-plan:start -->`
- `<!-- opencode-plan:end -->`
4. If no plan exists, do not modify files. Comment on the issue explaining that an OpenCode Plan is required first.
5. If the plan says `Ready for implementation` is `No`, do not modify files. Comment on the issue with the blockers.
6. If the plan says `Ready for implementation` is `Yes`, follow the plan.

## When triggered from a pull request

Before editing anything:
1. Run `gh pr view <pr-number> --comments` to read all review comments and suggestions.
2. Collect every unresolved review comment and inline suggestion.
3. Address each one with the smallest correct code change.
4. Do not change code that has no corresponding review comment.
5. After applying fixes, run relevant checks.

You must:
1. Read the issue or PR and its comments.
2. Implement the smallest correct change for each item.
3. Add or update tests when behavior changes.
4. Run relevant checks.
5. Leave the final working tree with only the intended changes.

You must not:
- Merge anything
- Create or switch branches
- Push
- Force push
- Delete branches
- Manually create a pull request
- Modify unrelated files
- Perform unrelated refactors
- Ignore the plan without explaining why

When finished, summarize:
1. Files changed
2. Tests run
3. Any risks or follow-up needed
4. That the final merge must be manual by a maintainer
Loading
Loading