chore(agents): add AI rule files, Gemini styleguide, Copilot wiring#156
chore(agents): add AI rule files, Gemini styleguide, Copilot wiring#156vladjerca wants to merge 1 commit into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a structured AI-coding and review stack to the Android monorepo, mirroring the architecture and principles used in other internal projects. By providing a centralized set of rules for architecture, state management, networking, and testing, it ensures that both human developers and AI agents share a consistent vocabulary and set of best practices. The changes are purely documentation and configuration-based, intended to guide future development without modifying existing source code. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive suite of documentation and rules for AI agents in the .agents/ directory, detailing the project's architecture, design principles, and technical constraints for the Trakt Android application. The review feedback correctly identifies a naming convention for acronyms that conflicts with standard Kotlin style, points out the presence of placeholder version numbers that may cause AI hallucinations, and flags an architectural inconsistency in a localization example that incorrectly uses Context.
|
Won't hurt anyone probably but will check later : |
That's why I drafted it's still under review for me I want to get more things ironed out. |
|
Second pass landed in Highlights:
Also applied Gemini's three review comments (acronyms → official Kotlin style, episodeTypeLabel → Out-of-scope for this PR, but called out in the rules as follow-ups:
Ready to undraft. 👀 |
Introduces a `.agents/rules/*.md` set (13 files), root `AGENTS.md` + `CLAUDE.md`, a Gemini styleguide alongside the existing config, and a `.github/copilot-instructions.md` symlink to `AGENTS.md` so GitHub Copilot picks up the same rules. Tailored to this stack: Compose-only, Koin DI, Ktor + OpenAPI-generated client, Coil 3, DataStore, ktlint. Reference projects synthesised: - android/nowinandroid - Google's canonical modular Compose sample. - chrisbanes/tivi - Trakt-domain match (TV/movie tracking, KMP). - DroidKaigi/conference-app-2024 - modern community patterns. - element-hq/element-x-android - enterprise Compose Matrix client. Direction the rules describe (for new code): - MVVM + UDF. ViewModels expose `StateFlow<UiState>` via `stateIn(viewModelScope, WhileSubscribed(5_000), Initial)`. - Sealed `UiState` (Loading / Loaded / Error), Screen + Content split. - Compose Navigation 2.9+ with `@Serializable` typed routes. - Koin DI with constructor injection. No Hilt, no Dagger. - Repositories: `Flow<T>` reads, `suspend` writes returning `Result`. Local-write-first invariant (offline-first). - OpenAPI client generated; mappers translate DTOs to domain models. - Status 204 is success. - DataStore for prefs; no `SharedPreferences` in new code. - All visuals via `TraktTheme.*` tokens. - Conventional Commits with android-scoped enum. Forward-only posture: rules govern new code and substantially rewritten files. Generated paths (`build/`, `external/`, OpenAPI output, Crowdin-managed translation files) are out-of-scope per `legacy-zones.md`. Includes: - YAML frontmatter (`trigger: glob`, `applyTo: <glob>`) on every rule file so tools that support glob-based lazy loading only pull a rule when an edited file matches its scope. AGENTS.md still `@`-includes the full set for tools that need the complete context. - Per-subproject `CLAUDE.md` shells for `app/`, `tv/`, `common/`, `resources/` matching the apple sibling's layout. - `compose-stability.conf` at repo root listing Trakt domain types and stable third-party types for the Compose compiler. - Architecture deep-dive material from the second-pass review of NIA, Tivi, and element-x-android (invariants block, background sync, adaptive layouts, Compose stability, convention plugins, per-module lint baselines, MainDispatcherRule, multi-config previews, screenshot tests via Paparazzi + ComposablePreviewScanner, Konsist, baseline profiles, Coil 3 specifics, typed IDs, alternatives evaluated, logging discipline). Adopts Gemini's review feedback: - Acronyms follow official Kotlin style (Url / Id / Json). - `episodeTypeLabel` returns `@StringRes Int?` rather than taking `Context` - keeps the mapper pure and ViewModel-safe.
2db1898 to
da83e96
Compare
Summary
Ports the AI-coding / review stack from
trakt-apple-internalto the Android monorepo, tailored to this stack (Compose + Koin + Ktor + OpenAPI + DataStore + Coil 3 + ktlint). Mirrors the structure we already use ontrakt-web.What lands:
.agents/rules/*.md(13 files) - project, code-principles, implementation, architecture, state-management, networking, persistence, theming, localization, testing, packages, legacy-zones, commits.AGENTS.mdat the root -@-includes the rule files in order.CLAUDE.md- symlink toAGENTS.md, so Claude Code loads the same stack..gemini/styleguide.md- Gemini-flavoured digest of the same rules. The existing.gemini/config.yamlignore_patterns grew to skipbuild/,external/, generated OpenAPI sources, and Crowdin-managed translation files..github/copilot-instructions.md- symlink to../AGENTS.mdso GitHub Copilot picks up the same rules.No source code touched. No
build.gradle.kts,.editorconfig, or workflow changes - those stay as-is.Reference projects synthesised
android/nowinandroid- Google's canonical Compose sample. Modular layout (:feature:foo:{api,impl}+:core:foo), Hilt-based but the architecture and testing rules (no mocking libs, screenshot tests via Roborazzi) carry over.chrisbanes/tivi- Trakt-domain match (TV/movie tracking, archived Nov 2024). Confirmed many of our existing choices (Coil 3, Ktor, per-entity data slicing).DroidKaigi/conference-app-2024- modern community patterns; provided the testing direction (Robolectric + Roborazzi + Robot pattern), detekt as a possible secondary linter, and the Compose-presenter experiment we deliberately do not adopt.Direction the rules describe (for new code)
StateFlow<UiState>built viastateIn(viewModelScope, WhileSubscribed(5_000), Initial).UiState(Loading/Loaded(...)/Error(...)) - not flat data classes with three nullable fields.StateFlowonly inside ViewModels. NomutableStateOfin ViewModels (Compose-coupled, hard to test).Screen(stateful) +Content(stateless) split. Previews target theContentvariant.@Serializabletyped routes. No string-route DSL for new screens.single/factory/viewModelscopes per the rules. No third-party DI library switch planned.Flow<T>reads +suspend funwrites returningResult<T>.TraktTheme.*tokens - no rawColor(0xFF...), noModifier.padding(16.dp)magic numbers.app,tv,common,resources,openapi,widget,i18n,ci,deps,gradle,agents,gemini).Forward-only posture
The codebase is already in much better shape than the apple side - Compose-only, no XML/Fragments/LiveData/RxJava, conventional commits in use, ktlint wired into CI. Rules document the modern path; the only "legacy zones" worth carving out are generated paths (
build/generate-resources/, Crowdin-managedvalues-*/strings.xml,external/).What this PR does NOT do
build.gradle.kts, the version catalogue, or.editorconfig.These are all deliberate follow-ups. The goal here is to land docs + configs so reviewers and AI agents share a vocabulary.
Test plan
.gemini/config.yamlparses (YAML.load_file).CLAUDE.mdand.github/copilot-instructions.mdsymlinks resolve toAGENTS.md..agents/rules/..gemini/styleguide.md+ignore_patterns.Relation to trakt-apple-internal
Parallels trakt/trakt-apple-internal#132. Architecture choices diverge on: