AGENTS.md
Guidance for coding agents working in this repository.
Project intent
Build a reusable Android Java library that translates Markdown with Google ML Kit while preserving Markdown structure.
Primary roadmap source: current docs under docs/ (API, architecture, performance).
Repository layout
library/— core Android library module (main deliverable)sample/— Android app used for manual verificationdocs/api.md— public API referencedocs/architecture.md— AST/token translation architecture
Build, test, format
Use Gradle wrapper from repo root.
- Build sample app:
./gradlew :sample:assembleDebug
- Run library unit tests:
./gradlew :library:testDebugUnitTest
- Run formatting checks:
./gradlew spotlessCheck
- Auto-format Java + XML:
./gradlew spotlessApply
Formatting rules
- Java formatting is enforced by Spotless +
googleJavaFormat(AOSP style). - XML formatting is enforced by Spotless (
eclipseWtp('xml')). - Run
spotlessApplybefore finalizing changes.
Implementation expectations
- Keep library API small and stable.
- Prefer AST/token-stream Markdown processing over regex-only logic.
- Use regex fallback only for robustness/edge cases.
- Preserve Markdown structure (headings, lists, quotes, code, links, spacing).
- Keep Android/ML Kit integration separated from pure Java markdown logic where possible.
Language/SDK constraints
- Java 17
- Android minSdk 24
- compileSdk 34
Safety notes for changes
- Avoid introducing app-specific UI/business logic into
library/. - Keep sample UI behavior aligned with current UX requirements (toggle raw/rendered mode, model download/delete flow, etc.).
- Prefer additive/refactoring-safe changes with tests when modifying translation pipeline behavior.
Validation checklist before handoff
./gradlew spotlessCheck./gradlew :library:testDebugUnitTest./gradlew :sample:assembleDebug
If device testing is requested:
adb install -r sample/build/outputs/apk/debug/sample-debug.apk
Release process (JitPack)
Use this flow to publish a new version on JitPack.
- Update version references in docs/sample as needed (for example,
README.mdandsample/build.gradle). - Run validation from repo root:
./gradlew spotlessCheck./gradlew :library:testDebugUnitTest./gradlew :sample:assembleDebug
- Ensure JitPack publishing config is present:
library/build.gradleincludesid 'maven-publish'- release publication exists (
from components.release, with sources jar) jitpack.ymlruns./gradlew clean :library:publishReleasePublicationToMavenLocal
- Commit release-related changes to
mainand push. - Create and push a new tag:
git tag -a X.Y.Z -m "Release X.Y.Z"git push origin X.Y.Z
- Trigger/verify JitPack build:
- Open
https://jitpack.io/#godsarmy/mlkit-markdown-translator-android - Select tag
X.Y.Zand wait for success - Optional log URL:
https://jitpack.io/com/github/godsarmy/mlkit-markdown-translator-android/X.Y.Z/build.log
- Open
Notes:
- Prefer creating a new tag (for example
0.8.2) instead of reusing/moving an existing tag. - JitPack tags are effectively immutable for consumers; retagging can cause confusion/caching issues.