Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / travel / AGENTS.md
| 1 | # AGENTS.md — travel/ (':travel') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `travel/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install travel (dev by default)._ |
| 6 | <!-- last-reviewed: 2026-10-16 --> |
| 7 | - Gradle: :travel / dir: travel/ |
| 8 | - Package roots present: ui, data, network |
| 9 | - Entry files: MainActivity.kt (no Route.kt — search/results/booking/manage flow with pages) |
| 10 | - Deps: :library:room, :library:network, :library:image, Stripe Android SDK (payment sheet) |
| 11 | - Metadata: metadata_data/travel.md (present) |
| 12 | - Rust: no / screenshotTest: yes |
| 13 | |
| 14 | ### Relay server note (backend, outside this repo) |
| 15 | `travel` does not use the relay directly, but `NetworkClient.init(FIRST_PARTY)` covers `api.maproj.org`. Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Full details: root `AGENTS.md` → "Backend server (outside this repo)". |
| 16 | |
| 17 | ## Overview |
| 18 | **Purpose:** Flight + hotel booking — search/comparison, seat maps, ancillaries/offers, trip management with in-app card payment; trips persist on-device so plans stay readable offline. |
| 19 | **Key features:** |
| 20 | - Flight search form (one-way / round-trip) → results → offer review → passengers → trip → ancillaries → payment sheet → confirm → confirmation; cancel/manage on booked trips (online changes are not offered — server sends `canChange=false`) |
| 21 | - Round-trip step-by-step (grouped on-device); stays search → detail → guests → payment sheet → confirm → confirmation; seat-map picker |
| 22 | - `data/` Room (trips, local booking profiles, frequent-flyer, recent searches) + `domain/` on-device grouping/status + `network/` trip/stays DTOs + APIs |
| 23 | **Architecture / data-flow:** `ui/` search/results/booking pages → `util/TravelViewModel` (+ `TravelUiContract`/`TravelUiState`, per-area `Travel*Ops`) → `domain/` grouping + `data/TravelRepository` over Room + `network/TravelApi`/`StaysApi`; booked trips stay readable from Room when offline. |
| 24 | **Entry points + reading order:** `MainActivity.kt` → `ui/HomePage.kt` → `ui/FlightSearchForm.kt` → `util/TravelViewModel.kt` → `util/TravelSearchOps.kt` → `network/TravelApi.kt`. |
| 25 | **Gotchas:** |
| 26 | - `util/` is NOT a closed package root — pending migration; don't add more files there |
| 27 | - Booking is money-moving — price/availability must be re-confirmed server-side before payment, never trusted from cached offers |
| 28 | - Offline readability is a feature (stored trips), offline booking is not — gate write paths on connectivity |
| 29 | - Payment: `POST /trips/:id/checkout` returns a payment-intent `clientSecret` + `publishableKey` (the provider's processor account, per environment); present it with `platform/StripeCheckout.kt`, then `POST /trips/:id/confirm` books it. Never book before the sheet reports Completed |
| 30 | |
| 31 | ## Key files |
| 32 | ### Root — entry (no Route.kt) |
| 33 | - com/vayunmathur/travel/MainActivity.kt |
| 34 | ### data/ — Room trips + profiles |
| 35 | - com/vayunmathur/travel/data/TravelDatabase.kt |
| 36 | - com/vayunmathur/travel/data/TravelRepository.kt |
| 37 | - com/vayunmathur/travel/data/BookedTrip.kt |
| 38 | - com/vayunmathur/travel/data/Customer.kt |
| 39 | - com/vayunmathur/travel/data/FrequentFlyer.kt |
| 40 | - com/vayunmathur/travel/data/RecentSearch.kt |
| 41 | ### domain/ — on-device offer + trip logic |
| 42 | - com/vayunmathur/travel/domain/OfferGrouping.kt |
| 43 | - com/vayunmathur/travel/domain/TripStatus.kt |
| 44 | ### platform/ — in-app card payment (Stripe payment sheet) |
| 45 | - com/vayunmathur/travel/platform/StripeCheckout.kt |
| 46 | ### network/ — airline + stays APIs |
| 47 | - com/vayunmathur/travel/network/TravelApi.kt |
| 48 | - com/vayunmathur/travel/network/OfferDto.kt |
| 49 | - com/vayunmathur/travel/network/OrderDto.kt |
| 50 | - com/vayunmathur/travel/network/ManageDto.kt |
| 51 | - com/vayunmathur/travel/network/AirlineDto.kt |
| 52 | - com/vayunmathur/travel/network/AncillaryDto.kt |
| 53 | - com/vayunmathur/travel/network/PlaceDto.kt |
| 54 | - com/vayunmathur/travel/network/StaysApi.kt |
| 55 | - com/vayunmathur/travel/network/StaysDto.kt |
| 56 | ### util/ — ViewModel + booking ops (pending migration to closed roots) |
| 57 | - com/vayunmathur/travel/util/TravelViewModel.kt |
| 58 | - com/vayunmathur/travel/util/TravelUiContract.kt |
| 59 | - com/vayunmathur/travel/util/TravelUiState.kt |
| 60 | - com/vayunmathur/travel/util/TravelSearchOps.kt |
| 61 | - com/vayunmathur/travel/util/TravelBookingOps.kt |
| 62 | - com/vayunmathur/travel/util/TravelOrderOps.kt |
| 63 | - com/vayunmathur/travel/util/TravelCustomerOps.kt |
| 64 | - com/vayunmathur/travel/util/TravelStayOps.kt |
| 65 | - com/vayunmathur/travel/util/ContactAutofill.kt |
| 66 | ### ui/ — search, results, booking, trips, stays |
| 67 | - com/vayunmathur/travel/ui/HomePage.kt |
| 68 | - com/vayunmathur/travel/ui/FlightSearchForm.kt |
| 69 | - com/vayunmathur/travel/ui/FlightResultsPage.kt |
| 70 | - com/vayunmathur/travel/ui/OfferReviewPage.kt |
| 71 | - com/vayunmathur/travel/ui/PartialOffersPages.kt |
| 72 | - com/vayunmathur/travel/ui/PassengersPage.kt |
| 73 | - com/vayunmathur/travel/ui/PassengersFields.kt |
| 74 | - com/vayunmathur/travel/ui/PaymentPage.kt |
| 75 | - com/vayunmathur/travel/ui/SeatMapPage.kt |
| 76 | - com/vayunmathur/travel/ui/AncillariesPage.kt |
| 77 | - com/vayunmathur/travel/ui/ConfirmationPage.kt |
| 78 | - com/vayunmathur/travel/ui/OrderDetailPage.kt |
| 79 | - com/vayunmathur/travel/ui/ChangePage.kt |
| 80 | - com/vayunmathur/travel/ui/CancellationPage.kt |
| 81 | - com/vayunmathur/travel/ui/TripsPage.kt |
| 82 | - com/vayunmathur/travel/ui/StaySearchForm.kt |
| 83 | - com/vayunmathur/travel/ui/StayResultsScreen.kt |
| 84 | - com/vayunmathur/travel/ui/StayDetailPage.kt |
| 85 | - com/vayunmathur/travel/ui/StayGuestsPage.kt |
| 86 | - com/vayunmathur/travel/ui/StayConfirmationPage.kt |
| 87 | - com/vayunmathur/travel/ui/StaysPages.kt |
| 88 | - com/vayunmathur/travel/ui/StayLabels.kt |
| 89 | - com/vayunmathur/travel/ui/SettingsPage.kt |
| 90 | - com/vayunmathur/travel/ui/Common.kt |
| 91 | - com/vayunmathur/travel/ui/TravelFormat.kt |
| 92 | |
| 93 | ## Verify (this module only) |
| 94 | ``` |
| 95 | ./gradlew :travel:compileDevKotlin |
| 96 | ./gradlew :travel:lint |
| 97 | ./gradlew :travel:checkMetadata |
| 98 | ``` |