|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +Project conventions for AI coding agents working in this repo. Read this |
| 4 | +before making changes — most of it is not derivable from the code alone. |
| 5 | + |
| 6 | +## What this repo is |
| 7 | + |
| 8 | +A React Native Turbo Module (`@panter/react-native-motiontag`) wrapping |
| 9 | +the MotionTag tracking SDKs (iOS 6.5.x, Android 7.2.x). New architecture |
| 10 | +only. JS surface mirrors the official Flutter SDK so payloads stay |
| 11 | +interchangeable. |
| 12 | + |
| 13 | +Repo layout: see [README.md → Repo layout](README.md#repo-layout). |
| 14 | + |
| 15 | +## Commit conventions |
| 16 | + |
| 17 | +This repo uses [Conventional Commits](https://www.conventionalcommits.org/), |
| 18 | +enforced by release-please. **Every commit subject to `main` must follow the |
| 19 | +format** or it won't appear in the changelog and may break automated |
| 20 | +versioning. |
| 21 | + |
| 22 | +| Prefix | Meaning | Version bump | |
| 23 | +| --- | --- | --- | |
| 24 | +| `feat:` | New user-facing feature | minor | |
| 25 | +| `fix:` | Bug fix | patch | |
| 26 | +| `feat!:` / `fix!:` / `BREAKING CHANGE:` body | Breaking change | major | |
| 27 | +| `chore:` | Tooling, deps, internal cleanup | none | |
| 28 | +| `docs:` | Documentation only | none | |
| 29 | +| `refactor:` | Internal restructure, no behaviour change | none | |
| 30 | +| `test:` | Test-only changes | none | |
| 31 | +| `ci:` | CI / workflow changes | none | |
| 32 | +| `build:` | Build system changes | none | |
| 33 | + |
| 34 | +Optional scope in parentheses: `feat(plugin): add channelId option`, |
| 35 | +`fix(android): handle null permission result`. |
| 36 | + |
| 37 | +Do **not** add a trailing summary paragraph in commit bodies that repeats |
| 38 | +the subject. Body explains *why*; subject already says *what*. |
| 39 | + |
| 40 | +## Release flow |
| 41 | + |
| 42 | +Releases are automated — agents must not run `npm publish` directly or |
| 43 | +push tags manually. See [README → Releasing](README.md#releasing) for the |
| 44 | +full flow. TL;DR: commit with Conventional Commits → release-please opens |
| 45 | +a release PR → merging it tags + publishes via GitHub Actions OIDC. |
| 46 | + |
| 47 | +## Working with the code |
| 48 | + |
| 49 | +- **Library source**: `src/` — TypeScript, no transpilation in the example |
| 50 | + (uses the `react-native` field in `package.json` to consume `src/` directly). |
| 51 | +- **Native modules**: `android/` (Kotlin) and `ios/` (Swift + ObjC++). |
| 52 | + Changing the TS spec (`src/NativeMotionTag.ts`) regenerates the codegen |
| 53 | + contract — both native sides must be updated to match. |
| 54 | +- **Expo config plugin**: `plugin/` (plain JS, no build). Injected blocks |
| 55 | + are wrapped in `@generated` markers and de-duplicated on `expo prebuild` |
| 56 | + re-runs. |
| 57 | +- **Example app**: `example/` is a Standalone Expo dev-client app. It |
| 58 | + declares the library via `"file:.."` so edits to `src/` hot-reload via |
| 59 | + Fast Refresh. Metro config in `example/metro.config.js` blocks duplicate |
| 60 | + `react` / `react-native` copies — do not change without understanding |
| 61 | + why. |
| 62 | + |
| 63 | +## Build / verify |
| 64 | + |
| 65 | +- TypeScript build: `yarn prepare` (runs `react-native-builder-bob`, |
| 66 | + outputs `lib/{commonjs,module,typescript}`). |
| 67 | +- Typecheck only: `npx tsc -p tsconfig.build.json --noEmit`. |
| 68 | +- Lint: none configured yet. Don't add one without asking. |
| 69 | +- Tests: none yet. Don't add a test framework speculatively. |
| 70 | +- The CI workflow (`.github/workflows/ci.yml`) runs `yarn prepare` on PRs; |
| 71 | + if your change touches `src/`, make sure it builds cleanly locally first. |
| 72 | + |
| 73 | +## What to avoid |
| 74 | + |
| 75 | +- Don't bump `version` in `package.json` by hand — release-please owns it. |
| 76 | +- Don't edit `CHANGELOG.md` by hand — release-please owns it. |
| 77 | +- Don't edit `.release-please-manifest.json` unless intentionally |
| 78 | + bootstrapping (extremely rare). |
| 79 | +- Don't add a `prepublishOnly` or other publish-side hook that would race |
| 80 | + with `prepare` in the GitHub Actions workflow. |
| 81 | +- Don't add Expo Go support — the library has native code and requires a |
| 82 | + development client build. Documentation that suggests otherwise is wrong. |
| 83 | +- Don't align the iOS and Android SDK versions opportunistically. Version |
| 84 | + drift is intentional pending a separate evaluation (tracked as a |
| 85 | + follow-up). Touch only when explicitly asked. |
| 86 | +- Don't introduce a monorepo tool (Lerna, Nx, Turborepo). The |
| 87 | + library + `example/` two-package layout is deliberate. |
| 88 | + |
| 89 | +## Native dependency versions |
| 90 | + |
| 91 | +Hard-coded; see [README → Native dependency versions](README.md#native-dependency-versions). |
| 92 | +Bumping these is a feature change with cross-platform implications — |
| 93 | +treat as a `feat:` (or `feat!:` if API-incompatible) and update both |
| 94 | +platforms in the same PR. |
| 95 | + |
| 96 | +## When in doubt |
| 97 | + |
| 98 | +Ask. The MotionTag SDK has thin, sometimes surprising native contracts |
| 99 | +(pre-RN init requirements, background task identifiers, foreground-service |
| 100 | +ownership) that aren't obvious from the JS surface — better to confirm |
| 101 | +than to guess. |
0 commit comments