diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml new file mode 100644 index 000000000..c5e40547a --- /dev/null +++ b/.github/workflows/claude-code-review.yml @@ -0,0 +1,58 @@ +name: Claude Code Review + +on: + pull_request: + types: [opened, synchronize, ready_for_review, reopened] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + claude-review: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + issues: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Minimize old Claude comments + uses: actions/github-script@v7 + with: + script: | + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + per_page: 100, + }); + const claudeComments = comments.filter(c => + c.user?.login === 'claude[bot]' || c.user?.login === 'github-actions[bot]' + ); + for (const comment of claudeComments) { + await github.graphql(` + mutation MinimizeComment($id: ID!) { + minimizeComment(input: { subjectId: $id, classifier: OUTDATED }) { + minimizedComment { isMinimized } + } + } + `, { id: comment.node_id }); + } + + - name: Run Claude Code Review + id: claude-review + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' + plugins: 'code-review@claude-code-plugins' + prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}' + allowed_bots: 'claude[bot]' + claude_args: '--allowed-tools Bash(gh:*) WebFetch' diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 000000000..68f312f54 --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,45 @@ +name: Claude Code + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + claude: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && + (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') && + (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') && + (github.event.review.author_association == 'OWNER' || github.event.review.author_association == 'MEMBER' || github.event.review.author_association == 'COLLABORATOR')) || + (github.event_name == 'issues' && + (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) && + (github.event.issue.author_association == 'OWNER' || github.event.issue.author_association == 'MEMBER' || github.event.issue.author_association == 'COLLABORATOR')) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + actions: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + use_api_for_commits: true + additional_permissions: | + actions: read diff --git a/AGENTS.md b/AGENTS.md index c74bd951e..52aafcc52 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ # CLAUDE.md -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. +This file provides guidance to AI agents like Cursor/Claude Code/Codex/WARP when working with code in this repository. ## Overview @@ -191,6 +191,8 @@ If anything is missing or cannot be verified, you must fix it before declaring s --- ## RULES +- ALWAYS edit AGENTS.md directly — CLAUDE.md, GEMINI.md, and WARP.md are symlinks and must not be edited or replaced with regular files +- NEVER delete or recreate symlinks (CLAUDE.md, GEMINI.md, WARP.md) — they are committed to git as mode 120000 - NEVER suggest manually adding @Serializable annotations to generated Kotlin bindings - ALWAYS run `cargo fmt` before committing to ensure consistent code formatting - ALWAYS move imports to the top of the file when applicable (no inline imports in functions)