* docs: update AGENTS.md, README.md, and CONTRIBUTING.md Sync all three docs with current codebase state: Kotlin 2.4.10, Kotlinx Serialization, 28 screens, 6 theme presets, CI instrumented-tests job, color guard. * docs: missed control
3.9 KiB
3.9 KiB
Contributing to Hermes Mobile
Thank you for your interest in contributing to Hermes Mobile! To maintain high code quality and consistency, we ask all contributors to follow the workflow and guidelines outlined below.
PR Workflow
All code changes must go through a pull request (PR). Directly pushing to main is not allowed.
- Pick or open an issue to discuss the changes you want to make.
- Create a branch off
mainusing the following naming convention:- Features:
feat/issue-N-description - Bug fixes:
fix/issue-N-description
- Features:
- Implement your changes and format them locally.
- Submit a PR targeting the
mainbranch. - Ensure all CI checks pass (formatting, linting, and unit tests).
- Maintainers will squash-merge your PR into
main.
Commit Messages
We follow Conventional Commits to keep the history scannable:
feat:— New feature for the userfix:— Bug fixrefactor:— Code change with no functional changedocs:— Documentation onlytest:— Adding or fixing testsci:— CI configuration or scriptschore:— Maintenance, deps, tooling
Keep commits atomic: one subject line (≤72 chars) + max 2 lines of body. If it needs more, split into multiple commits.
fix(#431): resume last session from Room cache on cold start
Reorders init to show cached messages before WS connects,
and resumes the last session on GatewayReady instead of
always creating a blank new one.
AI Tool Usage
If you use AI coding tools (including agents) to contribute:
- Never add the AI tool as author, co-author, or
Co-Authored-Byin commit metadata. - Direct AI agents to
AGENTS.mdin the repo root — it contains agent-specific guidance on project conventions, build quirks, and security considerations that complement this guide.
Code Style
We enforce Kotlin coding conventions and Jetpack Compose best practices.
Kotlin Formatting
- Code formatting is checked and enforced by ktlint 1.2.1.
- Run formatting check locally before committing:
./ktlint <file> # Check one file ./ktlint --format <file> # Auto-fix formatting issues - Import ordering is strictly ASCII-lexicographic (uppercase before lowercase: e.g.,
LaunchedEffectbeforecollectAsState).
Compose Guidelines
- Standard screen structures must use
HermesScaffoldrather than raw Material3Scaffold. - Composable parameters must follow the standard order:
modifierfirst, then event callbacks, and finally children content. - Do not apply
paddingValueson inner content insideHermesScaffold— the scaffold already handles top bar padding. SeeAGENTS.mdfor the full breakdown of this recurring bug. - Every data screen must implement
LoadingState,ErrorState, andEmptyStatebranches in itswhen { }block.
Color Usage
- No hardcoded
Color(0x...)literals outsidetheme/,*Preview.kt, and auth screens. A Gradle task (checkColorLiterals) enforces this in CI. - Use
MaterialTheme.colorScheme.<token>orLocalHermesStatusColors.current.<semantic>instead. Color.TransparentandColor.Unspecifiedare allowed.
PR Checklist
Before submitting your PR, please verify:
- Your branch is up-to-date with
main. - Local build and
ktlintchecks pass successfully. checkColorLiteralspasses (no hardcoded Color literals outside theme/).- No unused imports, unused parameters, or dead code.
- Every
ImageandIconelement has a descriptivecontentDescriptionfor accessibility. - New screens use
HermesScaffoldand implement Loading/Error/Empty states. - New components match the UI/UX style of similar existing screens (28+ screens for reference).
- Commit messages follow Conventional Commits and are atomic (subject + ≤2 lines body).