diff --git a/rules/flutter-hot-reload.md b/rules/flutter-hot-reload.md new file mode 100644 index 0000000..02a957d --- /dev/null +++ b/rules/flutter-hot-reload.md @@ -0,0 +1,20 @@ +--- +description: Proactively connect to running Dart/Flutter apps and trigger hot reload or hot restart upon editing .dart files. +trigger: glob +globs: "**/*.dart" +--- + +# Proactive Flutter Hot Reload Rule + +Whenever you edit or modify any `.dart` file in this project: + +1. **When to Skip**: + - **Tests**: Do not trigger hot reload or hot restart when modifying test files (e.g., `test/**`, `*_test.dart`). Run tests using `flutter test` instead. + - **Comments & Documentation**: Do not trigger hot reload or hot restart when changes only affect comments, docstrings, or whitespace. + +2. **Discover & Connect**: + - Discover active running application instances using the `dtd` tool (or `list_running_apps` / `vm_service`). + +3. **Trigger Hot Reload / Hot Restart**: + - Execute `hot_reload` immediately after making changes to UI widgets (including `build` methods of stateful widgets) or simple methods. + - Execute `hot_restart` if fundamental logic, state initialization (e.g., `initState`), global/static state, or `main()` was modified. diff --git a/rules/flutter-hot-reload.mdc b/rules/flutter-hot-reload.mdc new file mode 100644 index 0000000..344de63 --- /dev/null +++ b/rules/flutter-hot-reload.mdc @@ -0,0 +1,20 @@ +--- +description: Proactively connect to running Dart/Flutter apps and trigger hot reload or hot restart upon editing .dart files. +globs: "**/*.dart" +alwaysApply: false +--- + +# Proactive Flutter Hot Reload Rule + +Whenever you edit or modify any `.dart` file in this project: + +1. **When to Skip**: + - **Tests**: Do not trigger hot reload or hot restart when modifying test files (e.g., `test/**`, `*_test.dart`). Run tests using `flutter test` instead. + - **Comments & Documentation**: Do not trigger hot reload or hot restart when changes only affect comments, docstrings, or whitespace. + +2. **Discover & Connect**: + - Discover active running application instances using the `dtd` tool (or `list_running_apps` / `vm_service`). + +3. **Trigger Hot Reload / Hot Restart**: + - Execute `hot_reload` immediately after making changes to UI widgets (including `build` methods of stateful widgets) or simple methods. + - Execute `hot_restart` if fundamental logic, state initialization (e.g., `initState`), global/static state, or `main()` was modified. diff --git a/rules/hot_reload.md b/rules/hot_reload.md deleted file mode 100644 index 68bc31b..0000000 --- a/rules/hot_reload.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -trigger: glob -globs: *.dart -description: Proactively connect to apps and hot reload ---- - -Whenever you make edits to any Dart or Flutter files in this project: -1. Proactively connect to the running application using the `dtd` tool and its subcommands. Make sure to read the schema for this tool. -2. Trigger a hot reload using the `hot_reload` tool to push the changes immediately. -3. If no app is running, inform the user but do not let it stop you from completing the code edits. diff --git a/rules/hot_reload.mdc b/rules/hot_reload.mdc deleted file mode 100644 index e97ded5..0000000 --- a/rules/hot_reload.mdc +++ /dev/null @@ -1,9 +0,0 @@ ---- -globs: *.dart -alwaysApply: false ---- - -Whenever you make edits to any Dart or Flutter files in this project: -1. Proactively connect to the running application using the `dtd` tool and its subcommands. Make sure to read the schema for this tool. -2. Trigger a hot reload using the `hot_reload` tool to push the changes immediately. -3. If no app is running, inform the user but do not let it stop you from completing the code edits.