diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml new file mode 100644 index 00000000..73402671 --- /dev/null +++ b/.github/workflows/claude-code-review.yml @@ -0,0 +1,82 @@ +name: Claude Code Review + +on: + pull_request: + types: [opened, synchronize] + # Run on Kotlin/Android files since this is a Kotlin Multiplatform project + paths: + - "shared/**/*.kt" + - "core/**/*.kt" + - "lib/**/*.kt" + - "iosApp/**/*.swift" + - "androidApp/**/*.kt" + - "build.gradle.kts" + - "gradle/**" + +jobs: + claude-review: + # Only run for PRs created by the repository owner + if: github.event.pull_request.user.login == 'stanvx' + + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code Review + id: claude-review + uses: anthropics/claude-code-action@beta + 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" + + # Customized prompt for Kotlin Multiplatform project + direct_prompt: | + Please review this Kotlin Multiplatform pull request and provide feedback on: + - Kotlin code quality and best practices + - Proper use of expect/actual patterns for platform-specific code + - Compose Multiplatform UI patterns and performance + - Clean Architecture layer boundaries (UI → Presentation → Domain → Data) + - Coroutines and StateFlow usage + - Dependency injection with Koin + - Potential bugs or issues + - Security concerns (especially for audio processing and file I/O) + - 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]') + diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 00000000..d7884654 --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,72 @@ +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.user.login == 'stanvx') || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') && github.event.comment.user.login == 'stanvx') || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') && github.event.review.user.login == 'stanvx') || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) && github.event.issue.user.login == 'stanvx') + ) + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + actions: read # Required for Claude to read CI results on PRs + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@beta + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + # 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) + # model: "claude-opus-4-20250514" + + # Optional: Customize the trigger phrase (default: @claude) + # trigger_phrase: "/claude" + + # Optional: Trigger when specific user is assigned to an issue + # assignee_trigger: "claude-bot" + + # Allow Claude to run Gradle and Android-specific commands + allowed_tools: "Bash(./gradlew build),Bash(./gradlew testDebug),Bash(./gradlew assembleDebug),Bash(./gradlew clean)" + + # Custom instructions for Kotlin Multiplatform project + custom_instructions: | + This is a Kotlin Multiplatform project (Notely Capture) with the following guidelines: + - Follow Clean Architecture patterns (UI → Presentation → Domain → Data) + - Use expect/actual for platform-specific code + - Prefer Compose Multiplatform for UI + - Use Koin for dependency injection + - Follow immutable data patterns with StateFlow + - Write tests for business logic in use cases + - Respect layer boundaries and use explicit mappers + - Focus on Android development primarily + + # Optional: Custom environment variables for Claude + # claude_env: | + # NODE_ENV: test +