* chore: add CLAUDE.md * chore: pr feedback * chore: contributing guideline rules * chore: pr feedback (cherry picked from commit fc30140e6ec313c94405e7ca4fbab8096dc1c6c7)
2.3 KiB
2.3 KiB
mobile/AGENTS.md
Flutter app with Riverpod, Drift (SQLite), auto_route, pigeon and a Rust core in ../native/.
Rules
- Run
mise //mobile:checkoutafter switching branches. All generated Dart is git-ignored; never edit it. - New code follows
lib/domain/(models, services, utils; no dependency on presentation or infrastructure) →lib/infrastructure/repositories/→lib/presentation/, wired by providers inlib/providers/. New data access goes inlib/data/(lib/data/db/main/holds the Drift database,dao/,query/,table/;lib/data/server/the API base). - Top-level
lib/pages,lib/widgets,lib/services,lib/repositories,lib/entitiesare legacy; do not add to them. - Shared design-system widgets live in
packages/ui/(immich_ui), with a preview per component inlib/src/previews/.
Skills
- Run codegen:
mise //mobile:codegenruns the Dart OpenAPI client, build_runner (*.g.dart,*.freezed.dart,router.gr.dart), Drift migrations and schema, ffigen, pigeon and translations. Run it after changing Drift tables, routes, pigeon definitions or freezed classes;mise //mobile:codegen:watchkeeps build_runner running. CI job "Unit Test Mobile" regenerates and fails if the code does not compile. - Change the local database: edit tables in
lib/data/db/main/table/and the@DriftDatabaseinlib/data/db/main/database.dart, bump the schema version, thenmise //mobile:codegen:drift:migrationwritesdatabase.steps.dartand a snapshot indrift_schemas/main/. Add a step migration and a test intest/drift/main/. - Add a platform channel: define the API in
pigeon/<name>.dart, runmise //mobile:codegen:pigeonto generatelib/platform/<name>.g.dartplus the Swift and Kotlin interfaces, then implement them inios/andandroid/. - Tests and lint:
mise //mobile:test; one file withflutter test test/path/foo_test.dart. Tests live undertest/{unit,medium,domain,infrastructure,drift,presentation}/;test/medium/hasrepository_context.dartandservice_context.dartfor tests against a real Drift database.mise //mobile:lintruns the analyzer and DCM;mise //mobile:lint-fixfixes what it can. - Preview a UI component:
cd packages/ui && flutter widget-preview startshows components fromlib/src/previews/with a light/dark toggle.