diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 5bf8ce5..67c6a6f 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -3,28 +3,20 @@ name: Claude Code Review on: pull_request: types: [opened, synchronize] - # Optional: Only run on specific file changes - # paths: - # - "src/**/*.ts" - # - "src/**/*.tsx" - # - "src/**/*.js" - # - "src/**/*.jsx" + +concurrency: + group: claude-review-${{ github.event.pull_request.number }} + cancel-in-progress: true jobs: claude-review: - # Optional: Filter by PR author - # if: | - # github.event.pull_request.user.login == 'external-contributor' || - # github.event.pull_request.user.login == 'new-developer' || - # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' - runs-on: ubuntu-latest permissions: contents: read - pull-requests: read + pull-requests: write issues: read id-token: write - + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -33,46 +25,16 @@ jobs: - name: Run Claude Code Review id: claude-review - uses: anthropics/claude-code-action@beta + uses: anthropics/claude-code-action@v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) - # model: "claude-opus-4-20250514" - - # Direct prompt for automated review (no @claude mention needed) - direct_prompt: | + prompt: | Please review this pull request and provide feedback on: - Code quality and best practices - Potential bugs or issues - - Performance considerations - - Security concerns - - Test coverage - - Be constructive and helpful in your feedback. + - Whether template files are consistent with the repo's own workflow files - # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR - # use_sticky_comment: true - - # Optional: Customize review based on file types - # direct_prompt: | - # Review this PR focusing on: - # - For TypeScript files: Type safety and proper interface usage - # - For API endpoints: Security, input validation, and error handling - # - For React components: Performance, accessibility, and best practices - # - For tests: Coverage, edge cases, and test quality - - # Optional: Different prompts for different authors - # direct_prompt: | - # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' && - # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' || - # 'Please provide a thorough code review focusing on our coding standards and best practices.' }} - - # Optional: Add specific tools for running tests or linting - # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)" - - # Optional: Skip review for certain conditions - # if: | - # !contains(github.event.pull_request.title, '[skip-review]') && - # !contains(github.event.pull_request.title, '[WIP]') + Be constructive and helpful in your feedback. + use_sticky_comment: true diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index e1d4a43..1d64e1d 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -32,15 +32,15 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v5 - + - name: Install python tools run: | uv sync - name: Run Claude Code id: claude - uses: anthropics/claude-code-action@beta - + uses: anthropics/claude-code-action@v1 + with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} mcp_config: | @@ -51,40 +51,9 @@ jobs: "args": [ "ols-mcp" ] - }, - "sequential-thinking": { - "command": "npx", - "args": [ - "-y", - "@modelcontextprotocol/server-sequential-thinking" - ] } } } - # This is an optional setting that allows Claude to read CI results on PRs - additional_permissions: | - actions: read - - # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1) - # model: "claude-opus-4-1-20250805" - - # Optional: Customize the trigger phrase (default: @claude) - # trigger_phrase: "/claude" - - # Optional: Trigger when specific user is assigned to an issue - # assignee_trigger: "claude-bot" - - # Optional: Allow Claude to run specific commands - allowed_tools: "Bash(*),FileEdit,Edit,MultiEdit,WebSearch,WebFetch,mcp__ols_mcp__search_all_ontologies,mcp__ols_mcp__get_terms_from_ontology" - - # Optional: Add custom instructions for Claude to customize its behavior for your project - # custom_instructions: | - # Follow our coding standards - # Ensure all new code has tests - # Use TypeScript for new files - - # Optional: Custom environment variables for Claude - # claude_env: | - # NODE_ENV: test - + claude_args: | + --permission-mode bypassPermissions diff --git a/template/.github/workflows/claude-code-review.yml b/template/.github/workflows/claude-code-review.yml index 5bf8ce5..95908b4 100644 --- a/template/.github/workflows/claude-code-review.yml +++ b/template/.github/workflows/claude-code-review.yml @@ -7,24 +7,25 @@ on: # paths: # - "src/**/*.ts" # - "src/**/*.tsx" - # - "src/**/*.js" - # - "src/**/*.jsx" + +concurrency: + group: claude-review-${{ github.event.pull_request.number }} + cancel-in-progress: true jobs: claude-review: # Optional: Filter by PR author # if: | # github.event.pull_request.user.login == 'external-contributor' || - # github.event.pull_request.user.login == 'new-developer' || # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' - + runs-on: ubuntu-latest permissions: contents: read - pull-requests: read + pull-requests: write issues: read id-token: write - + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -33,46 +34,22 @@ jobs: - name: Run Claude Code Review id: claude-review - uses: anthropics/claude-code-action@beta + uses: anthropics/claude-code-action@v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) # model: "claude-opus-4-20250514" - - # Direct prompt for automated review (no @claude mention needed) - direct_prompt: | + + prompt: | Please review this pull request and provide feedback on: - Code quality and best practices - Potential bugs or issues - Performance considerations - Security concerns - Test coverage - - Be constructive and helpful in your feedback. - # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR - # use_sticky_comment: true - - # Optional: Customize review based on file types - # direct_prompt: | - # Review this PR focusing on: - # - For TypeScript files: Type safety and proper interface usage - # - For API endpoints: Security, input validation, and error handling - # - For React components: Performance, accessibility, and best practices - # - For tests: Coverage, edge cases, and test quality - - # Optional: Different prompts for different authors - # direct_prompt: | - # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' && - # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' || - # 'Please provide a thorough code review focusing on our coding standards and best practices.' }} - - # Optional: Add specific tools for running tests or linting - # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)" - - # Optional: Skip review for certain conditions - # if: | - # !contains(github.event.pull_request.title, '[skip-review]') && - # !contains(github.event.pull_request.title, '[WIP]') + Be constructive and helpful in your feedback. + # Reuse same comment on subsequent pushes (avoids review pile-ons) + use_sticky_comment: true diff --git a/template/.github/workflows/claude-ontology-review.yml b/template/.github/workflows/claude-ontology-review.yml new file mode 100644 index 0000000..3094dd8 --- /dev/null +++ b/template/.github/workflows/claude-ontology-review.yml @@ -0,0 +1,89 @@ +# This action invokes claude to review a PR. +# This is a generic action - you can customize, or delete in favor of the ontology review PR. +# -- +# This github action is from the copier template in https://github.com/ai4curation/github-ai-integrations, donated by the Monarch Initiative +# For more documentation, see https://ai4curation.github.io/aidocs/how-tos/set-up-github-actions/ +# Author: Chris Mungall (@cmungall) +name: Claude Code Ontology Review + +on: + pull_request: + types: [opened, synchronize] + paths: + - "src/ontology" + +concurrency: + group: claude-ontology-review-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + claude-review: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + issues: read + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code Ontology Review + id: claude-review + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + # Use Opus for ontology review (needs deeper reasoning) + model: "claude-opus-4-1-20250805" + + prompt: | + REPO: ${{ github.repository }} + PR NUMBER: ${{ github.event.pull_request.number }} + + This PR modifies critical ontology files. + + Review this PR against our team checklist: + + ## Issue alignment + - [ ] The PR aligns with the source issue, and only closes it if all components of the issue addressed + - [ ] The PR summary gives sufficient context for any decisions made, attributing them to issue authors where appropriate + + ## Ontology Metadata + - [ ] PR is linked to source issue(s) via appropriate annotation property + - [ ] any added definitions have provenance + + ## Identifiers and hallucinations + - [ ] all identifiers are CURIEs (or URLs), with standard prefixes + - [ ] I have looked up term identifiers and confirm that they denote what is intended + - [ ] all PMIDs and publication references resolve to the appropriate article/title + + ## Design patterns (DPs) + - [ ] any new terms conform to documented DPs for this ontology + - [ ] if the term fits into a DP, then the label is constructed in a standard way (although scientific norms prevail) + - [ ] if the term is compositional in nature, then it should conform to a DP, and have a relevant logical definition + + ## Definitions (if the PR adds or updates a definition) + - [ ] Definitions are present for any new term + - [ ] Definitions conform to the style guide for this ontology + - [ ] Definitions follows genus-differentia form (while prioritizing normal scientific phrasing over awkward ontology language) + - [ ] The genus of the definition is an ancestor of the term + - [ ] The differentia of the definition are necessary and sufficient for distinguishing from the genus + - [ ] The definition has appropriate provenance + - [ ] I have looked up the provenance, and it is correct and relevant + - [ ] The label, definition, and logical definition (when present) are largely consistent + + ## Relationships and logical axioms + - [ ] If a logical definition is not present, then there should be at least one is_a (subClassOf) to the most precise parent term + - [ ] If a logical definition is present, then there is reasonable expectation the term should classify precisely + - [ ] Other relationships are present to a reasonable degree and as dictated by the general ontology stye (e.g part-ofs for anatomy) + - [ ] Additional logical axioms (such as disjointness) are added as appropriate, depending on ontology style, and design patterns + - [ ] Additional logical axioms make sense and do not over-constrain + + Be constructive and helpful in your feedback. + + # Reuse same comment on subsequent pushes (avoids review pile-ons) + use_sticky_comment: true diff --git a/template/.github/workflows/claude.yml b/template/.github/workflows/claude.yml index e1d4a43..ac9788c 100644 --- a/template/.github/workflows/claude.yml +++ b/template/.github/workflows/claude.yml @@ -32,15 +32,15 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v5 - + - name: Install python tools run: | uv sync - name: Run Claude Code id: claude - uses: anthropics/claude-code-action@beta - + uses: anthropics/claude-code-action@v1 + with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} mcp_config: | @@ -62,29 +62,13 @@ jobs: } } - # This is an optional setting that allows Claude to read CI results on PRs - additional_permissions: | - actions: read - - # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1) - # model: "claude-opus-4-1-20250805" - - # Optional: Customize the trigger phrase (default: @claude) - # trigger_phrase: "/claude" - - # Optional: Trigger when specific user is assigned to an issue - # assignee_trigger: "claude-bot" - + # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) + # model: "claude-opus-4-20250514" + # Optional: Allow Claude to run specific commands allowed_tools: "Bash(*),FileEdit,Edit,MultiEdit,WebSearch,WebFetch,mcp__ols_mcp__search_all_ontologies,mcp__ols_mcp__get_terms_from_ontology" - + # Optional: Add custom instructions for Claude to customize its behavior for your project # custom_instructions: | # Follow our coding standards # Ensure all new code has tests - # Use TypeScript for new files - - # Optional: Custom environment variables for Claude - # claude_env: | - # NODE_ENV: test -