Conversation
Provides development guidelines for AI agents working with this repository, including: - Project overview and React Native/TypeScript structure - Common development commands (yarn) - Browser fallback architecture for Expo Go - Public API stability guidelines - PR labeling conventions - Code guardrails Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42ee7eb to
83c4a63
Compare
ajpallares
left a comment
There was a problem hiding this comment.
Looks good overall. But I believe the web support should be mentioned as well?
- Add explicit mention of web support in project overview - Remove (~2,000+ lines) from purchases.ts description to avoid staleness Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ajpallares
left a comment
There was a problem hiding this comment.
The PR description still mentions "Add CLAUDE.md as a symlink to AGENTS.md for Claude Code compatibility" but CLAUDE.md isn't in the diff anymore. We should probably update the description to match the current state of the branch.
|
|
||
| ### Main Entry Point: `src/purchases.ts` | ||
| - **Core Class**: `Purchases` with static methods | ||
| - **Dual Mode**: Native module OR browser mode (Expo Go) |
There was a problem hiding this comment.
Browser mode actually covers three environments — Expo Go, Rork Sandbox, and web (Platform.OS === 'web') — but this line only says "Expo Go". We should probably update to something like:
| - **Dual Mode**: Native module OR browser mode (Expo Go) | |
| - **Dual Mode**: Native module OR browser mode (web, Expo Go, Rork Sandbox) |
Same applies to a few other spots:
- Line 106: "For web/Expo Go environments" → include Rork
- Line 195 (Guardrails): "ensure Expo Go fallback works" → "ensure web/Expo Go/Rork fallback works"
This is important because an agent that doesn't realize the SDK runs on web might introduce web-incompatible changes.
| │ ├── errors.ts # Re-exports from typescript-internal | ||
| │ ├── browser/ # Browser/Expo Go fallback implementation | ||
| │ │ ├── nativeModule.ts # Browser implementation of native module | ||
| │ │ └── simulatedstore/ # Simulated purchase helpers |
There was a problem hiding this comment.
The tree under src/browser/ is missing typeGuards.ts and utils.ts. The latter contains methodNotSupportedOnWeb() which is pretty important for agents to know about when working on the browser path — it's how unsupported APIs fail at runtime. We should probably add them:
| │ │ └── simulatedstore/ # Simulated purchase helpers | |
| │ │ ├── nativeModule.ts # Browser implementation of native module | |
| │ │ ├── typeGuards.ts # Runtime type validation for browser responses | |
| │ │ ├── utils.ts # Browser helpers (e.g. methodNotSupportedOnWeb) | |
| │ │ └── simulatedstore/ # Simulated purchase helpers |
| - `index.test.js` — Main integration tests | ||
| - `alertHelper.test.ts` — Browser alert tests | ||
| - `offeringsLoader.test.ts` — Offerings tests | ||
| - `purchaseSimulatedPackageHelper.test.ts` — Simulated purchase tests |
There was a problem hiding this comment.
The test listing is missing nativeModuleNull.test.js and the ApiKeyValidation/ directory (contains ExpoGo.test.js and RorkSandbox.test.js). These cover browser-mode scenarios and would be useful for agents to know about — especially if they're modifying environment detection or the browser fallback. We should probably add them:
| - `purchaseSimulatedPackageHelper.test.ts` — Simulated purchase tests | |
| - `purchaseSimulatedPackageHelper.test.ts` — Simulated purchase tests | |
| - `nativeModuleNull.test.js` — Null native module handling | |
| - `ApiKeyValidation/ExpoGo.test.js` — Expo Go API key validation | |
| - `ApiKeyValidation/RorkSandbox.test.js` — Rork Sandbox API key validation |
| 3. Make changes in `src/` (TypeScript) or native code (`ios/`, `android/`) | ||
| 4. Run tests: `yarn test` | ||
| 5. Type check: `yarn typecheck` | ||
| 6. Test in example app: `yarn example ios` or `yarn example android` |
There was a problem hiding this comment.
The development workflow covers iOS and Android testing but doesn't explain how to test browser/web mode changes. Even a brief mention of how to use yarn prepare-expo or how to run the Expo test app in web mode would help agents know how to verify their changes for that path.
| | React Native | >= 0.73.0 | | ||
| | iOS | 13.0+ | | ||
| | Android | API 21+ | | ||
| | TypeScript | 5.2.2 | |
There was a problem hiding this comment.
Since the SDK supports web through browser mode, we should probably add a Web row to the Constraints / Support Policy table so agents treat it as a first-class target:
| | TypeScript | 5.2.2 | | |
| | TypeScript | 5.2.2 | | |
| | Web | Supported (via browser mode) | |
Summary
AGENTS.mdwith guidelines for AI coding agents working on this SDKCLAUDE.mdas a symlink toAGENTS.mdfor Claude Code compatibility.claude/to.gitignoreThe file includes:
Based on Callstack's agent-skills recommendations.