|
| 1 | +# Copilot Instructions |
| 2 | + |
| 3 | +## Project Constitution |
| 4 | + |
| 5 | +All code changes MUST comply with the project constitution at `.specify/memory/constitution.md`. This document defines the team's non-negotiable standards for correctness, testing, security, observability, naming, PR discipline, and architectural simplicity. Read it before proposing changes. |
| 6 | + |
| 7 | +## Tech Stack |
| 8 | + |
| 9 | +This is a **Flutter SDK** wrapping native Optimizely SDKs for iOS and Android. |
| 10 | + |
| 11 | +**Technology Stack:** |
| 12 | +- **Dart/Flutter**: Cross-platform API layer (>=2.16.2, Flutter >=2.5.0) |
| 13 | +- **Swift**: iOS native bridge (Swift 5.0, iOS 10.0+) |
| 14 | +- **Kotlin/Java**: Android native bridge (Kotlin 2.1.0, Android 5.0+) |
| 15 | +- **Native SDKs**: OptimizelySwiftSDK 5.2.1 (iOS), android-sdk 5.1.1 (Android) |
| 16 | + |
| 17 | +## Folder Structure |
| 18 | + |
| 19 | +- `lib/` - Dart SDK code (public API, wrapper, data objects, user context) |
| 20 | +- `android/` - Android native plugin code (Java/Kotlin) |
| 21 | +- `ios/` - iOS native plugin code (Swift) |
| 22 | +- `test/` - Dart unit tests |
| 23 | +- `example/` - Example Flutter app demonstrating SDK usage |
| 24 | + |
| 25 | +## Code Conventions |
| 26 | + |
| 27 | +### Dart |
| 28 | +- Follow official [Dart style guide](https://dart.dev/guides/language/effective-dart/style) |
| 29 | +- Use `lowerCamelCase` for variables, methods, parameters |
| 30 | +- Use `UpperCamelCase` for classes, types |
| 31 | +- Prefix private members with underscore `_privateMethod` |
| 32 | +- ALL methods return `BaseResponse` derivatives (never throw exceptions) |
| 33 | +- Check `success` boolean and `reason` string for errors |
| 34 | + |
| 35 | +### Swift (iOS) |
| 36 | +- Follow Swift naming conventions |
| 37 | +- Use type-safe Optional unwrapping |
| 38 | +- iOS attributes need type metadata: `{"value": 123, "type": "int"}` |
| 39 | + |
| 40 | +### Java/Kotlin (Android) |
| 41 | +- Follow Android/Kotlin style guide |
| 42 | +- Android uses direct primitives: `{"attribute": 123}` |
| 43 | + |
| 44 | +## Testing |
| 45 | + |
| 46 | +Run tests with: |
| 47 | +```bash |
| 48 | +flutter test # All tests |
| 49 | +flutter test test/cmab_test.dart # Specific test |
| 50 | +flutter test --coverage # With coverage |
| 51 | +``` |
| 52 | + |
| 53 | +**Requirements:** |
| 54 | +- Tests required for all code changes |
| 55 | +- All CI checks must pass (4 parallel workflows) |
| 56 | +- Test both success and error paths |
| 57 | +- Mock platform channels appropriately |
| 58 | + |
| 59 | +## Commit Messages |
| 60 | + |
| 61 | +Follow [Angular guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines): |
| 62 | +- `feat:` - New features |
| 63 | +- `fix:` - Bug fixes |
| 64 | +- `chore:` - Maintenance |
| 65 | +- `docs:` - Documentation |
| 66 | +- `refactor:` - Code restructuring |
| 67 | +- `test:` - Test additions |
| 68 | + |
| 69 | +**Never commit directly to `master`** - use feature branches and PRs. |
0 commit comments