|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +Guidance for Claude Code when working in this repository. |
| 4 | + |
| 5 | +## Project overview |
| 6 | + |
| 7 | +Android app (Kotlin) showing recent earthquakes in Chile. Single Gradle module `:app`. |
| 8 | + |
| 9 | +- **DI:** Koin (not Hilt) |
| 10 | +- **Networking:** Retrofit + Moshi + Sandwich (`ApiResponse`) |
| 11 | +- **Persistence:** Room (KSP codegen) |
| 12 | +- **Images:** Coil · **Maps:** Google Maps + android-maps-utils (marker clustering) |
| 13 | +- **Backend services:** Firebase (Crashlytics, Performance, FCM) |
| 14 | +- **UI:** XML views, with an incremental XML → Compose migration in progress (see PR #80) |
| 15 | + |
| 16 | +### Architecture |
| 17 | + |
| 18 | +Feature-based packages under `app/src/main/java/cl/figonzal/lastquakechile/`: |
| 19 | + |
| 20 | +- `core/` — shared infra: DI modules, networking, DB, utils, `DomainResult`/`DomainError` |
| 21 | +- `quake_feature/` — earthquake list, detail, and map (data/domain/ui) |
| 22 | +- `reports_feature/` — reports feature (data/domain/ui) |
| 23 | + |
| 24 | +Data flow: remote/local data sources return domain models via mappers; repositories |
| 25 | +expose `DomainResult<T>` (success/error), surfaced to ViewModels as a single `uiState`. |
| 26 | + |
| 27 | +## Commands |
| 28 | + |
| 29 | +Build uses product flavors `dev` / `beta` / `prod` (dimension `version`) and build types `debug` / `release`. |
| 30 | + |
| 31 | +```bash |
| 32 | +./gradlew assembleDevDebug # build dev/debug APK |
| 33 | +./gradlew test # all unit tests |
| 34 | +./gradlew :app:connectedDevDebugAndroidTest # instrumentation tests (device/emulator) |
| 35 | +./gradlew bundleProdRelease # production AAB |
| 36 | + |
| 37 | +# fastlane wrappers (bundle exec): |
| 38 | +bundle exec fastlane unit_test # unit tests |
| 39 | +bundle exec fastlane ui_test # instrumentation tests (DevDebug) |
| 40 | +bundle exec fastlane prod_googleplay # build prod AAB + upload to Google Play |
| 41 | +``` |
| 42 | + |
| 43 | +## Gotchas |
| 44 | + |
| 45 | +- Requires `secrets.properties` (Maps API key via Secrets Gradle plugin) and signing material |
| 46 | + under `keys/` — both untracked; builds fail without them. |
| 47 | +- Destructive Room migration and HTTP logging are gated to debug builds only. |
| 48 | +- `versionCode` is derived from the version managed by release-please — do not hardcode it. |
| 49 | + |
| 50 | +## Release process (release-please + fastlane + Google Play) |
| 51 | + |
| 52 | +This project releases through [release-please](https://github.com/googleapis/release-please) |
| 53 | +(`release-type: simple`) and ships to Google Play via fastlane. |
| 54 | + |
| 55 | +### Branch rules |
| 56 | + |
| 57 | +- `main` has an **active ruleset** (`pull_request` required, `non_fast_forward`). |
| 58 | + Direct pushes to `main` are **blocked for everyone** — all changes land via PR. |
| 59 | +- `required_approving_review_count: 0`, so the owner can **self-merge** PRs without approval. |
| 60 | +- Only `main` is protected; feature and release-please branches are unrestricted. |
| 61 | + |
| 62 | +### How release-please behaves |
| 63 | + |
| 64 | +- The workflow `.github/workflows/release-please.yml` runs on **every push to `main`** |
| 65 | + (and supports `workflow_dispatch` for manual runs). |
| 66 | +- It does **not** cut a release on each run. It maintains a **single rolling release PR** |
| 67 | + on the branch `release-please--branches--main`. |
| 68 | +- The git tag, GitHub Release, and `versionCode` bump happen **only when that release PR is merged**. |
| 69 | +- `chore`, `refactor`, `ci`, `docs`, etc. do **not** bump the version — only `feat`/`fix` do. |
| 70 | + Adding such commits just refreshes the open release PR; it never spawns a second release. |
| 71 | + |
| 72 | +### Fastlane changelogs — when and where |
| 73 | + |
| 74 | +Use the `/fastlane-changelog` command (see `.claude/commands/fastlane-changelog.md`). |
| 75 | + |
| 76 | +- **Timing:** generate the changelogs **before merging the release PR**, while the latest git |
| 77 | + tag is still the **previous** version. The command diffs `git describe --tags --abbrev=0..HEAD`; |
| 78 | + if run after the release PR merges, the new tag already exists and the diff is empty. |
| 79 | +- Changelogs are always written to `default.txt` (locales `es-419` and `en-US`), which fastlane |
| 80 | + uses as a fallback when no versionCode-specific file exists. |
| 81 | +- **Convention (owner's preference):** commit the `default.txt` changelogs as the **last commit |
| 82 | + directly onto the `release-please--branches--main` branch**, so they ship inside that same |
| 83 | + release PR. Only do this when no further pushes to `main` are expected before the merge — a later |
| 84 | + release-please run can regenerate/force-push that branch and drop the commit. |
| 85 | + |
| 86 | +### End-to-end release flow |
| 87 | + |
| 88 | +1. Wait for release-please to open/update the release PR (`release-please--branches--main`). |
| 89 | +2. Run `/fastlane-changelog` (previous tag still latest) → writes `default.txt` for `es-419` + `en-US`. |
| 90 | +3. Commit those `default.txt` files as the final commit onto the release PR branch. |
| 91 | +4. **Merge the release PR** (`gh pr merge <n> --merge` or the GitHub UI) → creates the tag, |
| 92 | + GitHub Release, and `versionCode` bump. |
| 93 | +5. Build and upload: `fastlane prod_googleplay` (or `beta_googleplay`) — reads `default.txt`. |
| 94 | + |
| 95 | +## Conventions |
| 96 | + |
| 97 | +- Write GitHub issues in **English**, regardless of conversation language. |
0 commit comments