|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Cursor Cloud specific instructions |
| 4 | + |
| 5 | +### What this repo is |
| 6 | + |
| 7 | +Flutter/Dart monorepo for the **home_widget** plugin ecosystem (plugin, generator, CLI, and example apps). There is no backend or database — development is Flutter + Melos + platform SDKs. |
| 8 | + |
| 9 | +### Toolchain (pre-installed on the VM snapshot) |
| 10 | + |
| 11 | +- **Flutter**: `~/flutter` (stable channel). Ensure `$HOME/flutter/bin` is on `PATH`. |
| 12 | +- **Melos**: activated globally via `dart pub global activate melos`. Ensure `$HOME/.pub-cache/bin` is on `PATH` so `melos run …` scripts work (they invoke `melos` internally). |
| 13 | +- **Android SDK**: `$HOME/Android/Sdk` with platforms 33/35/36, build-tools, emulator, and an x86_64 system image. Set `ANDROID_HOME` and point Flutter at it with `flutter config --android-sdk "$ANDROID_HOME"`. |
| 14 | +- **JDK 21**: OpenJDK 21 (`JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64`). |
| 15 | + |
| 16 | +### Bootstrap (after `git pull`) |
| 17 | + |
| 18 | +From repo root: |
| 19 | + |
| 20 | +```bash |
| 21 | +dart pub get |
| 22 | +melos bootstrap |
| 23 | +``` |
| 24 | + |
| 25 | +The VM update script runs the dependency refresh steps above automatically. |
| 26 | + |
| 27 | +### Common commands |
| 28 | + |
| 29 | +| Task | Command | |
| 30 | +|------|---------| |
| 31 | +| Analyze all packages | `melos analyze` | |
| 32 | +| Unit tests (all packages) | `melos run test` | |
| 33 | +| Flutter tests (one package) | `cd packages/home_widget && flutter test` | |
| 34 | +| Dart tests (CLI/generator) | `cd packages/home_widget_cli && dart test` | |
| 35 | +| Build Android example APK | `cd examples/generator_basics && flutter build apk --debug` | |
| 36 | +| Generate native widget code | `cd examples/generator_basics && dart run home_widget_cli:home_widget generate` | |
| 37 | + |
| 38 | +Melos script definitions live in root `pubspec.yaml` under the `melos:` key. |
| 39 | + |
| 40 | +### Non-obvious gotchas |
| 41 | + |
| 42 | +- **CLI executable name**: The CLI package is `home_widget_cli`, but its executable is `home_widget`. In this workspace, `dart run home_widget` resolves to the *plugin* package and fails. Use `dart run home_widget_cli:home_widget <command>` from example apps. |
| 43 | +- **Android emulator**: `/dev/kvm` is not available in this cloud VM, so `flutter run` on an emulator will not work. Validate Android with `flutter build apk` or CI-style Gradle builds instead. |
| 44 | +- **iOS builds/tests**: Require macOS + Xcode; not available on Linux cloud agents. |
| 45 | +- **Full `melos format:all`**: Needs `ktfmt` and `swift-format` (installed via Homebrew on macOS in CI). `melos analyze` and `melos run test` are sufficient for Linux validation. |
| 46 | +- **First Android build**: Gradle may download NDK/CMake on first run; subsequent builds are much faster. |
| 47 | + |
| 48 | +### Example apps |
| 49 | + |
| 50 | +Runnable demos under `examples/` (`generator_basics` is the smallest). Typical flow: generate native code with the CLI, then build or run on a device/emulator. |
0 commit comments