From 14cd503e3745468cb57bfa3aa6b067ec13a3adef Mon Sep 17 00:00:00 2001 From: Thomas Taschauer <128734+TomTasche@users.noreply.github.com> Date: Sun, 20 Jul 2025 08:30:21 +0200 Subject: [PATCH 1/3] Claude PR Assistant workflow --- .github/workflows/claude.yml | 64 ++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/claude.yml diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 000000000000..64a3e5b14b3d --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,64 @@ +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_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + 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" + + # Optional: Allow Claude to run specific commands + # allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)" + + # 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 + From 965600861498bcf1b99c5a6a2bc448d20dfc3a6d Mon Sep 17 00:00:00 2001 From: Thomas Taschauer <128734+TomTasche@users.noreply.github.com> Date: Sun, 20 Jul 2025 08:30:22 +0200 Subject: [PATCH 2/3] Claude Code Review workflow --- .github/workflows/claude-code-review.yml | 78 ++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/claude-code-review.yml diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml new file mode 100644 index 000000000000..5bf8ce595152 --- /dev/null +++ b/.github/workflows/claude-code-review.yml @@ -0,0 +1,78 @@ +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" + +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 + 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" + + # Direct prompt for automated review (no @claude mention needed) + direct_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]') + From 7c20decca59bcd8c886c4261b7aaa9abe1e48a1c Mon Sep 17 00:00:00 2001 From: Thomas Taschauer <128734+TomTasche@users.noreply.github.com> Date: Sun, 20 Jul 2025 08:32:39 +0200 Subject: [PATCH 3/3] improve claude --- .github/workflows/claude-code-review.yml | 2 +- .github/workflows/claude.yml | 2 +- CLAUDE.md | 98 ++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 CLAUDE.md diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 5bf8ce595152..ce8461a38436 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -38,7 +38,7 @@ jobs: 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" + model: "claude-opus-4-20250514" # Direct prompt for automated review (no @claude mention needed) direct_prompt: | diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 64a3e5b14b3d..3cec85c50f7e 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -41,7 +41,7 @@ jobs: actions: read # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) - # model: "claude-opus-4-20250514" + model: "claude-opus-4-20250514" # Optional: Customize the trigger phrase (default: @claude) # trigger_phrase: "/claude" diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000000..575927d72f05 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,98 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Development Commands + +### Building +- `./gradlew assembleProDebug` - Build the Pro debug variant +- `./gradlew assembleProDebugAndroidTest` - Build the Pro debug test APK +- `./gradlew assembleLiteDebug` - Build the Lite debug variant +- `./gradlew bundleProRelease` - Build Pro release bundle for Play Store +- `./gradlew bundleLiteRelease` - Build Lite release bundle for Play Store +- `./build-test.sh` - Convenience script to build Pro debug and test APKs + +### Testing +- `./gradlew connectedAndroidTest` - Run instrumented tests on connected device +- `fastlane android tests` - Alternative way to run connected tests + +### Linting +- `./gradlew lint` - Run Android lint checks (configured to not abort on errors) + +### Deployment +- `fastlane android deployPro` - Deploy Pro version to Google Play internal track +- `fastlane android deployLite` - Deploy Lite version to Google Play internal track + +### Clean +- `./gradlew clean` - Clean build artifacts (includes custom .cxx directory cleanup) + +## Architecture Overview + +### Core Components + +**Document Processing Pipeline:** +- `CoreLoader` - Primary document processor using the native C++ ODR core library +- `WvwareDocLoader` - MS Word document processor using wvware library +- `RawLoader` - Plain text and other raw file processor +- `OnlineLoader` - Remote document fetcher +- `MetadataLoader` - Document metadata extractor + +**Service Architecture:** +- `LoaderService` - Background service managing all document loading operations +- `LoaderServiceQueue` - Queue management for multiple document loading requests +- Document loaders implement `FileLoaderListener` interface for async communication + +**UI Architecture:** +- `MainActivity` - Main activity with service binding and menu management +- `DocumentFragment` - Primary document display fragment using WebView +- `PageView` - Custom WebView for document rendering +- Action mode callbacks for edit, find, and TTS functionality + +### Build System + +**Multi-flavor Android App:** +- **Lite flavor**: Free version with ads and tracking enabled +- **Pro flavor**: Paid version with ads disabled and tracking disabled + +**Native Dependencies:** +- Uses Conan package manager for C++ dependencies +- CMake build system for native C++ core library (`odr-core`) +- NDK version 26.3.11579264 required +- C++20 standard + +**Core Library Integration:** +- Native C++ wrapper (`CoreWrapper.cpp`) provides JNI interface +- Supports multiple architectures: armv8, armv7, x86, x86_64 +- Assets deployed to `assets/core` directory via custom Conan deployer + +### Key Directories + +- `app/src/main/java/at/tomtasche/reader/background/` - Document processing services +- `app/src/main/java/at/tomtasche/reader/ui/` - UI components and activities +- `app/src/main/java/at/tomtasche/reader/nonfree/` - Analytics, billing, and ads +- `app/src/main/cpp/` - Native C++ JNI wrapper +- `app/src/main/assets/` - HTML templates and fonts for document rendering + +### Dependencies + +**Core Android:** +- AndroidX libraries (AppCompat, Core, Material, WebKit) +- Firebase (Analytics, Crashlytics, Storage, Auth, Remote Config) +- Google Play Services (Ads, Review, User Messaging Platform) + +**Document Processing:** +- `app.opendocument:wvware-android` - MS Word document support +- Custom ODR core library via Conan + +**Testing:** +- Espresso for UI testing +- JUnit for unit testing +- Test APKs require connected device/emulator + +### Configuration Notes + +- Minimum SDK: 23, Target SDK: 34 +- MultiDex enabled for large dependency set +- R8/ProGuard enabled for release builds with resource shrinking +- Configuration cache enabled for parallel Conan installs +- Custom lint configuration allows non-fatal errors \ No newline at end of file