|
| 1 | +# Copilot Instructions |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +**Disco** is a Flutter library providing scoped dependency injection that is independent of any specific state management solution. It is organized as a Dart workspace (monorepo). |
| 6 | + |
| 7 | +Key packages: |
| 8 | +- `packages/disco` — the main library published to pub.dev. |
| 9 | +- `packages/disco_lint` — a custom lint plugin for Disco-specific lint rules. |
| 10 | +- `examples/` — runnable Flutter example apps. |
| 11 | + |
| 12 | +## Repository Structure |
| 13 | + |
| 14 | +``` |
| 15 | +disco/ |
| 16 | +├── packages/ |
| 17 | +│ ├── disco/ # Main library (lib/, test/, benchmark/, example/) |
| 18 | +│ └── disco_lint/ # Custom lint plugin (lib/, example/) |
| 19 | +├── examples/ # Example Flutter apps |
| 20 | +├── pubspec.yaml # Workspace root — links all packages together |
| 21 | +└── analysis_options.yaml |
| 22 | +``` |
| 23 | + |
| 24 | +## Build & Dependency Installation |
| 25 | + |
| 26 | +Install dependencies from the workspace root: |
| 27 | + |
| 28 | +```bash |
| 29 | +flutter pub get |
| 30 | +``` |
| 31 | + |
| 32 | +## Testing |
| 33 | + |
| 34 | +Run the test suite for the main library: |
| 35 | + |
| 36 | +```bash |
| 37 | +cd packages/disco |
| 38 | +flutter test |
| 39 | +``` |
| 40 | + |
| 41 | +Run with coverage: |
| 42 | + |
| 43 | +```bash |
| 44 | +cd packages/disco |
| 45 | +flutter test --coverage |
| 46 | +``` |
| 47 | + |
| 48 | +## Linting & Static Analysis |
| 49 | + |
| 50 | +Run Dart static analysis from the workspace root: |
| 51 | + |
| 52 | +```bash |
| 53 | +dart analyze |
| 54 | +``` |
| 55 | + |
| 56 | +The project uses [`very_good_analysis`](https://pub.dev/packages/very_good_analysis) (strict lint rules). All lint warnings must be resolved before merging. |
| 57 | + |
| 58 | +## Code Style |
| 59 | + |
| 60 | +- Follow the [Dart style guide](https://dart.dev/effective-dart/style). |
| 61 | +- Comply with `very_good_analysis` rules — treat all lint warnings as errors. |
| 62 | +- **Do NOT use `const` constructors on `Provider` subclasses.** Providers are used as identity keys; `const` would cause providers with the same signature to share the same hash code, making them indistinguishable. The `prefer_const_constructors_in_immutables` lint rule is intentionally disabled. |
| 63 | +- Keep the public API minimal and well-documented with DartDoc comments. |
| 64 | +- New features or breaking changes require a motivation/discussion before implementation. |
| 65 | + |
| 66 | +## Adding / Changing Dependencies |
| 67 | + |
| 68 | +- Add dependencies only to the relevant `pubspec.yaml` (e.g. `packages/disco/pubspec.yaml`), not the workspace root. |
| 69 | +- Prefer Flutter/Dart SDK packages and packages already in use before introducing new ones. |
| 70 | +- Run `flutter pub get` after any `pubspec.yaml` change. |
| 71 | + |
| 72 | +## Pull Request Guidelines |
| 73 | + |
| 74 | +- Include tests for any new behaviour in `packages/disco/test/`. |
| 75 | +- Update `CHANGELOG.md` in `packages/disco/` for user-facing changes. |
| 76 | +- Documentation lives at <https://disco.mariuti.com>; update the `docs/` folder if the public API changes. |
| 77 | +- PRs that only touch `**.md` files skip CI automatically (see `flutter-test.yaml`). |
0 commit comments