From 5b9627285f4b8072eeb84df18ac876a8d4564936 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Wed, 17 Jun 2026 12:26:07 -0700 Subject: [PATCH 01/19] first pass --- .../skills/flutter_packages_pre_push/SKILL.md | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 .agents/skills/flutter_packages_pre_push/SKILL.md diff --git a/.agents/skills/flutter_packages_pre_push/SKILL.md b/.agents/skills/flutter_packages_pre_push/SKILL.md new file mode 100644 index 000000000000..55343889438e --- /dev/null +++ b/.agents/skills/flutter_packages_pre_push/SKILL.md @@ -0,0 +1,180 @@ +--- +name: "flutter_packages_pre_push" +description: "A comprehensive pre-push checklist and validation script for developers and AI agents contributing to the flutter/packages repository. Directly answers the question: 'Am I ready to push?'" +--- + +# Pre-Push Skill: `flutter/packages` + +This skill provides a fully automated pre-push validation script and a mental checklist. It directly answers the question: **"Am I ready to push?"** + +AI Agents: Run the bash script below before completing any pull request or commit task. If it outputs `๐Ÿ›‘ NO. You are not ready to push`, you must fix the errors before concluding your task. + +Human Developers: You can save the bash script below as `.git/hooks/pre-push` to enforce these rules locally, or simply run it manually before opening a PR! + +## Automated Validation Script + +Run this script from the root of the repository. It identifies exactly which packages you modified and runs the repository's native `flutter_plugin_tools` on them. It does NOT stop on the first error, so you get a complete list of everything needed to be ready! + +```bash +#!/bin/bash + +# Ensure we are at the repository root +REPO_ROOT=$(git rev-parse --show-toplevel) +cd "$REPO_ROOT" + +echo "๐Ÿ“ฆ 1. Checking for uncommitted changes..." +if [[ -n $(git status --porcelain) ]]; then + echo "โŒ You have uncommitted changes in your working directory!" + echo "Please commit or stash your changes before running this script," + echo "so we can safely pull the latest changes from main." + exit 1 +else + echo "โœ… Working directory is clean." +fi + +echo "=========================================" +echo "๐Ÿ”„ 2. Pulling latest changes from main..." +git fetch origin main 2>/dev/null || true +if ! git merge origin/main --no-edit; then + echo "โŒ Merge conflict detected!" + echo "Please resolve the merge conflicts, commit the result, and run this script again." + exit 1 +else + echo "โœ… Successfully pulled latest changes (no conflicts)." +fi + +# Ensure the repository tool dependencies are fetched +dart pub get -C "$REPO_ROOT/script/tool" > /dev/null + +echo "=========================================" +echo "๐Ÿ” 3. Identifying changed packages..." +# Diff against main. Adjust origin/main to upstream/main if needed. +CHANGED_FILES=$(git diff --name-only origin/main...HEAD || git diff --name-only origin/main) + +# Find unique packages containing pubspec.yaml +PACKAGES="" +for file in $CHANGED_FILES; do + dir=$(dirname "$file") + while [ "$dir" != "." ] && [ "$dir" != "/" ]; do + if [ -f "$dir/pubspec.yaml" ]; then + # Ignore example directories as per repository guidelines + if [[ ! "$dir" == *"example"* ]]; then + PACKAGE_NAME=$(basename "$dir") + PACKAGES="$PACKAGES,$PACKAGE_NAME" + fi + break + fi + dir=$(dirname "$dir") + done +done + +# Clean up trailing/leading commas and deduplicate +PACKAGES=$(echo "$PACKAGES" | tr ',' '\n' | sort -u | paste -sd, - | sed 's/^,//') + +if [ -z "$PACKAGES" ]; then + echo "โœ… No package changes detected. Continuing." + exit 0 +fi + +echo "๐Ÿ“ฆ Changed packages detected: $PACKAGES" +READY=true + +echo "=========================================" +echo "๐Ÿงน 4. Running auto-formatters..." +echo "Note: This runs dart format, clang-format, ktfmt, etc." +if ! dart run script/tool/bin/flutter_plugin_tools.dart format --packages="$PACKAGES"; then + echo "โŒ Formatter found issues." + READY=false +else + echo "โœ… Format complete." +fi + +echo "=========================================" +echo "๐Ÿ” 5. Running static analysis..." +echo "Note: This runs dart analyze --fatal-infos internally." +if ! dart run script/tool/bin/flutter_plugin_tools.dart analyze --packages="$PACKAGES"; then + echo "โŒ Analysis failed." + READY=false +else + echo "โœ… Analysis passed." +fi + +echo "=========================================" +echo "๐Ÿงช 6. Running unit tests..." +if ! dart run script/tool/bin/flutter_plugin_tools.dart dart-test --packages="$PACKAGES"; then + echo "โŒ Tests failed." + READY=false +else + echo "โœ… Tests passed." +fi + +echo "=========================================" +echo "๐Ÿ“ 7. Validating package structure..." +if ! dart run script/tool/bin/flutter_plugin_tools.dart validate --packages="$PACKAGES"; then + echo "โŒ Structure validation failed." + READY=false +else + echo "โœ… Structure validation passed." +fi + +echo "=========================================" +echo "๐Ÿท๏ธ 8. Checking versions and CHANGELOGs..." +if ! dart run script/tool/bin/flutter_plugin_tools.dart publish-check --packages="$PACKAGES"; then + echo "โŒ Version and Changelog validation failed." + READY=false +else + echo "โœ… Version and Changelog validation passed." +fi + +echo "=========================================" +echo "โš–๏ธ 9. Checking license headers..." +if ! dart run script/tool/bin/flutter_plugin_tools.dart license-check; then + echo "โŒ License check failed." + READY=false +else + echo "โœ… License check passed." +fi + +echo "=========================================" +echo "๐Ÿ“ฆ 10. Checking for new uncommitted changes..." +if [[ -n $(git status --porcelain) ]]; then + echo "โŒ You have uncommitted changes in your working directory!" + echo " (Did the auto-formatter modify files in step 4?)" + READY=false +else + echo "โœ… Working directory is still clean." +fi + +echo "=========================================" +if [ "$READY" = "true" ]; then + echo "๐Ÿš€ YES! You are ready to push!" + echo "" + echo "๐Ÿ›‘ MANUAL PRE-REVIEW CHECKLIST ๐Ÿ›‘" + echo "Please verify the following PR requirements before submitting:" + echo "- [ ] I read the Contributor Guide and AI contribution guidelines." + echo "- [ ] I signed the CLA." + echo "- [ ] PR Title starts with the package name in brackets, e.g. [${PACKAGES%%,*}]" + echo "- [ ] Linked to at least one issue (or noted it's a new feature)." + echo "- [ ] Updated any relevant doc comments (///)." + echo "- [ ] Added new tests for the change made (Critical for PR acceptance!)." + exit 0 +else + echo "๐Ÿ›‘ NO. You are not ready to push. Please fix the errors above." + echo "" + echo "๐Ÿ’ก TIP: If you failed step 8 (publish-check), run:" + echo " dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \\" + echo " --version=minimal --base-branch=origin/main --changelog=\"\"" + echo "" + echo "๐Ÿ’ก TIP: If you failed step 10, run 'git commit' to commit the formatter's changes!" + exit 1 +fi +``` + +## How to use this skill (For Agents) +1. Whenever a user asks you to implement a fix, feature, or refactor in `flutter/packages`, make your edits. +2. Before you announce that the work is finished, **you MUST run the script above**. +3. If step 1 (`format`) modifies files, step 7 will fail! You must commit the formatter's modifications so the working tree is clean. +4. If step 2 (`analyze`) fails, you must read the analyzer errors and fix them in the source code. +5. If step 5 (`publish-check`) fails because of missing `CHANGELOG.md` or `pubspec.yaml` version bumps, use the `update-release-info` command (shown in the TIP) to automatically generate them. +6. If the script says `๐Ÿ›‘ NO. You are not ready to push`, fix all issues and run the script again. Do not finish the task until you see `๐Ÿš€ YES! You are ready to push!`. +7. Once you are ready, review the "Manual Pre-Review Checklist". If you did not add tests or write doc comments, proactively ask the user if they would like you to do so! From 7b56f17b92839cf7dcd4ad88f505fea0f25de2b0 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Wed, 17 Jun 2026 13:08:32 -0700 Subject: [PATCH 02/19] Bad format test --- packages/camera/camera/lib/camera.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/camera/camera/lib/camera.dart b/packages/camera/camera/lib/camera.dart index 1558dbf687d0..fc1e464c9f2a 100644 --- a/packages/camera/camera/lib/camera.dart +++ b/packages/camera/camera/lib/camera.dart @@ -19,3 +19,6 @@ export 'package:camera_platform_interface/camera_platform_interface.dart' export 'src/camera_controller.dart'; export 'src/camera_image.dart'; export 'src/camera_preview.dart'; +void badFormat() { + int x= 1; +} From 5d7c78a9c6cbc85346260cb0637f5d84950dab42 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 06:26:51 -0700 Subject: [PATCH 03/19] rename skill and edit first two sections --- .agents/skills/pre-push-skill/SKILL.md | 177 +++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 .agents/skills/pre-push-skill/SKILL.md diff --git a/.agents/skills/pre-push-skill/SKILL.md b/.agents/skills/pre-push-skill/SKILL.md new file mode 100644 index 000000000000..d6a316037a38 --- /dev/null +++ b/.agents/skills/pre-push-skill/SKILL.md @@ -0,0 +1,177 @@ +--- +name: "pre-push-skill" +description: "A comprehensive pre-push checklist and validation script for developers and AI agents contributing to the flutter/packages repository. Directly answers the question: 'Am I ready to push?'" +--- + +# Pre-Push Skill + +This skill provides a fully automated pre-push validation script and a mental checklist for developers attempting to push code changes to the flutter/packages repository. It directly answers the question: **"Am I ready to push?"** + +Run the bash script [below](#automated-validation-script) before pushing any committed code upstream via `git push`. If it outputs `๐Ÿ›‘ NO. You are not ready to push`, you must fix the errors before concluding your task. + +## Automated Validation Script + +Run this script from the root of the repository. It identifies exactly which packages you modified and runs the repository's native `flutter_plugin_tools` on them to verify that code changes are ready to be made into a pull request according to the standards of the flutter/packages respository. It does NOT stop on the first error, so you get a complete list of everything needed to be fixed. + +```bash +#!/bin/bash + +# Ensure we are at the repository root +REPO_ROOT=$(git rev-parse --show-toplevel) +cd "$REPO_ROOT" + +echo "๐Ÿ“ฆ 1. Checking for uncommitted changes..." +if [[ -n $(git status --porcelain) ]]; then + echo "โŒ You have uncommitted changes in your working directory!" + echo "Please commit or stash your changes before running this script," + echo "so we can safely pull the latest changes from main." + exit 1 +else + echo "โœ… Working directory is clean." +fi + +echo "=========================================" +echo "๐Ÿ”„ 2. Pulling latest changes from main..." +git fetch origin main 2>/dev/null || true +if ! git merge origin/main --no-edit; then + echo "โŒ Merge conflict detected!" + echo "Please resolve the merge conflicts, commit the result, and run this script again." + exit 1 +else + echo "โœ… Successfully pulled latest changes (no conflicts)." +fi + +# Ensure the repository tool dependencies are fetched +dart pub get -C "$REPO_ROOT/script/tool" > /dev/null + +echo "=========================================" +echo "๐Ÿ” 3. Identifying changed packages..." +# Diff against main. Adjust origin/main to upstream/main if needed. +CHANGED_FILES=$(git diff --name-only origin/main...HEAD || git diff --name-only origin/main) + +# Find unique packages containing pubspec.yaml +PACKAGES="" +for file in $CHANGED_FILES; do + dir=$(dirname "$file") + while [ "$dir" != "." ] && [ "$dir" != "/" ]; do + if [ -f "$dir/pubspec.yaml" ]; then + # Ignore example directories as per repository guidelines + if [[ ! "$dir" == *"example"* ]]; then + PACKAGE_NAME=$(basename "$dir") + PACKAGES="$PACKAGES,$PACKAGE_NAME" + fi + break + fi + dir=$(dirname "$dir") + done +done + +# Clean up trailing/leading commas and deduplicate +PACKAGES=$(echo "$PACKAGES" | tr ',' '\n' | sort -u | paste -sd, - | sed 's/^,//') + +if [ -z "$PACKAGES" ]; then + echo "โœ… No package changes detected. Continuing." + exit 0 +fi + +echo "๐Ÿ“ฆ Changed packages detected: $PACKAGES" +READY=true + +echo "=========================================" +echo "๐Ÿงน 4. Running auto-formatters..." +echo "Note: This runs dart format, clang-format, ktfmt, etc." +if ! dart run script/tool/bin/flutter_plugin_tools.dart format --packages="$PACKAGES"; then + echo "โŒ Formatter found issues." + READY=false +else + echo "โœ… Format complete." +fi + +echo "=========================================" +echo "๐Ÿ” 5. Running static analysis..." +echo "Note: This runs dart analyze --fatal-infos internally." +if ! dart run script/tool/bin/flutter_plugin_tools.dart analyze --packages="$PACKAGES"; then + echo "โŒ Analysis failed." + READY=false +else + echo "โœ… Analysis passed." +fi + +echo "=========================================" +echo "๐Ÿงช 6. Running unit tests..." +if ! dart run script/tool/bin/flutter_plugin_tools.dart dart-test --packages="$PACKAGES"; then + echo "โŒ Tests failed." + READY=false +else + echo "โœ… Tests passed." +fi + +echo "=========================================" +echo "๐Ÿ“ 7. Validating package structure..." +if ! dart run script/tool/bin/flutter_plugin_tools.dart validate --packages="$PACKAGES"; then + echo "โŒ Structure validation failed." + READY=false +else + echo "โœ… Structure validation passed." +fi + +echo "=========================================" +echo "๐Ÿท๏ธ 8. Checking versions and CHANGELOGs..." +if ! dart run script/tool/bin/flutter_plugin_tools.dart publish-check --packages="$PACKAGES"; then + echo "โŒ Version and Changelog validation failed." + READY=false +else + echo "โœ… Version and Changelog validation passed." +fi + +echo "=========================================" +echo "โš–๏ธ 9. Checking license headers..." +if ! dart run script/tool/bin/flutter_plugin_tools.dart license-check; then + echo "โŒ License check failed." + READY=false +else + echo "โœ… License check passed." +fi + +echo "=========================================" +echo "๐Ÿ“ฆ 10. Checking for new uncommitted changes..." +if [[ -n $(git status --porcelain) ]]; then + echo "โŒ You have uncommitted changes in your working directory!" + echo " (Did the auto-formatter modify files in step 4?)" + READY=false +else + echo "โœ… Working directory is still clean." +fi + +echo "=========================================" +if [ "$READY" = "true" ]; then + echo "๐Ÿš€ YES! You are ready to push!" + echo "" + echo "๐Ÿ›‘ MANUAL COMMIT CHECKLIST ๐Ÿ›‘" + echo "Please verify the following before pushing:" + echo "- [ ] Updated any relevant doc comments (///)." + echo "- [ ] Added new tests for the change made (Critical for PR acceptance!)." + echo "" + echo "For instructions on opening your Pull Request (CLA, PR Title format, Issue linking)," + echo "please refer to the official Contributor Guide: https://github.com/flutter/packages/blob/main/CONTRIBUTING.md" + exit 0 +else + echo "๐Ÿ›‘ NO. You are not ready to push. Please fix the errors above." + echo "" + echo "๐Ÿ’ก TIP: If you failed step 8 (publish-check), run:" + echo " dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \\" + echo " --version=minimal --base-branch=origin/main --changelog=\"\"" + echo "" + echo "๐Ÿ’ก TIP: If you failed step 10, run 'git commit' to commit the formatter's changes!" + exit 1 +fi +``` + +## How to use this skill (For Agents) +1. Whenever a user asks you to implement a fix, feature, or refactor in `flutter/packages`, make your edits. +2. Before you announce that the work is finished, **you MUST run the script above**. +3. If step 1 (`format`) modifies files, step 7 will fail! You must commit the formatter's modifications so the working tree is clean. +4. If step 2 (`analyze`) fails, you must read the analyzer errors and fix them in the source code. +5. If step 5 (`publish-check`) fails because of missing `CHANGELOG.md` or `pubspec.yaml` version bumps, use the `update-release-info` command (shown in the TIP) to automatically generate them. +6. If the script says `๐Ÿ›‘ NO. You are not ready to push`, fix all issues and run the script again. Do not finish the task until you see `๐Ÿš€ YES! You are ready to push!`. +7. Once you are ready, review the "Manual Pre-Review Checklist". If you did not add tests or write doc comments, proactively ask the user if they would like you to do so! From 21ab658a3291215fe33ddd5a3753756e10d58d82 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 07:05:01 -0700 Subject: [PATCH 04/19] split up sections and expand on manual verification --- .agents/skills/pre-push-skill/SKILL.md | 247 +++++++++---------------- 1 file changed, 83 insertions(+), 164 deletions(-) diff --git a/.agents/skills/pre-push-skill/SKILL.md b/.agents/skills/pre-push-skill/SKILL.md index d6a316037a38..017787b82c29 100644 --- a/.agents/skills/pre-push-skill/SKILL.md +++ b/.agents/skills/pre-push-skill/SKILL.md @@ -1,177 +1,96 @@ --- name: "pre-push-skill" -description: "A comprehensive pre-push checklist and validation script for developers and AI agents contributing to the flutter/packages repository. Directly answers the question: 'Am I ready to push?'" +description: "A comprehensive pre-push checklist for contributing to the flutter/packages repository." --- # Pre-Push Skill -This skill provides a fully automated pre-push validation script and a mental checklist for developers attempting to push code changes to the flutter/packages repository. It directly answers the question: **"Am I ready to push?"** +This skill provides a fully automated pre-push validation script and a mental checklist for developers attempting to push code changes to any of the packages in the flutter/packages repository. It directly answers the question: **"Am I ready to push?"** -Run the bash script [below](#automated-validation-script) before pushing any committed code upstream via `git push`. If it outputs `๐Ÿ›‘ NO. You are not ready to push`, you must fix the errors before concluding your task. +Follow the steps below before pushing any committed code upstream via `git push` to a package or finishing your task. If any step fails, continue with the following steps to provide a comprehensive list of required fixes for the user. -## Automated Validation Script +## 1. Format Code -Run this script from the root of the repository. It identifies exactly which packages you modified and runs the repository's native `flutter_plugin_tools` on them to verify that code changes are ready to be made into a pull request according to the standards of the flutter/packages respository. It does NOT stop on the first error, so you get a complete list of everything needed to be fixed. +Consistent code style is required for all pull requests. The repository uses auto-formatters (like `dart format`, `clang-format`, `ktfmt`) to enforce this. Command to run: ```bash -#!/bin/bash - -# Ensure we are at the repository root -REPO_ROOT=$(git rev-parse --show-toplevel) -cd "$REPO_ROOT" - -echo "๐Ÿ“ฆ 1. Checking for uncommitted changes..." -if [[ -n $(git status --porcelain) ]]; then - echo "โŒ You have uncommitted changes in your working directory!" - echo "Please commit or stash your changes before running this script," - echo "so we can safely pull the latest changes from main." - exit 1 -else - echo "โœ… Working directory is clean." -fi - -echo "=========================================" -echo "๐Ÿ”„ 2. Pulling latest changes from main..." -git fetch origin main 2>/dev/null || true -if ! git merge origin/main --no-edit; then - echo "โŒ Merge conflict detected!" - echo "Please resolve the merge conflicts, commit the result, and run this script again." - exit 1 -else - echo "โœ… Successfully pulled latest changes (no conflicts)." -fi - -# Ensure the repository tool dependencies are fetched -dart pub get -C "$REPO_ROOT/script/tool" > /dev/null - -echo "=========================================" -echo "๐Ÿ” 3. Identifying changed packages..." -# Diff against main. Adjust origin/main to upstream/main if needed. -CHANGED_FILES=$(git diff --name-only origin/main...HEAD || git diff --name-only origin/main) - -# Find unique packages containing pubspec.yaml -PACKAGES="" -for file in $CHANGED_FILES; do - dir=$(dirname "$file") - while [ "$dir" != "." ] && [ "$dir" != "/" ]; do - if [ -f "$dir/pubspec.yaml" ]; then - # Ignore example directories as per repository guidelines - if [[ ! "$dir" == *"example"* ]]; then - PACKAGE_NAME=$(basename "$dir") - PACKAGES="$PACKAGES,$PACKAGE_NAME" - fi - break - fi - dir=$(dirname "$dir") - done -done - -# Clean up trailing/leading commas and deduplicate -PACKAGES=$(echo "$PACKAGES" | tr ',' '\n' | sort -u | paste -sd, - | sed 's/^,//') - -if [ -z "$PACKAGES" ]; then - echo "โœ… No package changes detected. Continuing." - exit 0 -fi - -echo "๐Ÿ“ฆ Changed packages detected: $PACKAGES" -READY=true - -echo "=========================================" -echo "๐Ÿงน 4. Running auto-formatters..." -echo "Note: This runs dart format, clang-format, ktfmt, etc." -if ! dart run script/tool/bin/flutter_plugin_tools.dart format --packages="$PACKAGES"; then - echo "โŒ Formatter found issues." - READY=false -else - echo "โœ… Format complete." -fi - -echo "=========================================" -echo "๐Ÿ” 5. Running static analysis..." -echo "Note: This runs dart analyze --fatal-infos internally." -if ! dart run script/tool/bin/flutter_plugin_tools.dart analyze --packages="$PACKAGES"; then - echo "โŒ Analysis failed." - READY=false -else - echo "โœ… Analysis passed." -fi - -echo "=========================================" -echo "๐Ÿงช 6. Running unit tests..." -if ! dart run script/tool/bin/flutter_plugin_tools.dart dart-test --packages="$PACKAGES"; then - echo "โŒ Tests failed." - READY=false -else - echo "โœ… Tests passed." -fi - -echo "=========================================" -echo "๐Ÿ“ 7. Validating package structure..." -if ! dart run script/tool/bin/flutter_plugin_tools.dart validate --packages="$PACKAGES"; then - echo "โŒ Structure validation failed." - READY=false -else - echo "โœ… Structure validation passed." -fi - -echo "=========================================" -echo "๐Ÿท๏ธ 8. Checking versions and CHANGELOGs..." -if ! dart run script/tool/bin/flutter_plugin_tools.dart publish-check --packages="$PACKAGES"; then - echo "โŒ Version and Changelog validation failed." - READY=false -else - echo "โœ… Version and Changelog validation passed." -fi - -echo "=========================================" -echo "โš–๏ธ 9. Checking license headers..." -if ! dart run script/tool/bin/flutter_plugin_tools.dart license-check; then - echo "โŒ License check failed." - READY=false -else - echo "โœ… License check passed." -fi - -echo "=========================================" -echo "๐Ÿ“ฆ 10. Checking for new uncommitted changes..." -if [[ -n $(git status --porcelain) ]]; then - echo "โŒ You have uncommitted changes in your working directory!" - echo " (Did the auto-formatter modify files in step 4?)" - READY=false -else - echo "โœ… Working directory is still clean." -fi - -echo "=========================================" -if [ "$READY" = "true" ]; then - echo "๐Ÿš€ YES! You are ready to push!" - echo "" - echo "๐Ÿ›‘ MANUAL COMMIT CHECKLIST ๐Ÿ›‘" - echo "Please verify the following before pushing:" - echo "- [ ] Updated any relevant doc comments (///)." - echo "- [ ] Added new tests for the change made (Critical for PR acceptance!)." - echo "" - echo "For instructions on opening your Pull Request (CLA, PR Title format, Issue linking)," - echo "please refer to the official Contributor Guide: https://github.com/flutter/packages/blob/main/CONTRIBUTING.md" - exit 0 -else - echo "๐Ÿ›‘ NO. You are not ready to push. Please fix the errors above." - echo "" - echo "๐Ÿ’ก TIP: If you failed step 8 (publish-check), run:" - echo " dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \\" - echo " --version=minimal --base-branch=origin/main --changelog=\"\"" - echo "" - echo "๐Ÿ’ก TIP: If you failed step 10, run 'git commit' to commit the formatter's changes!" - exit 1 -fi +dart run script/tool/bin/flutter_plugin_tools.dart format --run-on-changed-packages ``` -## How to use this skill (For Agents) -1. Whenever a user asks you to implement a fix, feature, or refactor in `flutter/packages`, make your edits. -2. Before you announce that the work is finished, **you MUST run the script above**. -3. If step 1 (`format`) modifies files, step 7 will fail! You must commit the formatter's modifications so the working tree is clean. -4. If step 2 (`analyze`) fails, you must read the analyzer errors and fix them in the source code. -5. If step 5 (`publish-check`) fails because of missing `CHANGELOG.md` or `pubspec.yaml` version bumps, use the `update-release-info` command (shown in the TIP) to automatically generate them. -6. If the script says `๐Ÿ›‘ NO. You are not ready to push`, fix all issues and run the script again. Do not finish the task until you see `๐Ÿš€ YES! You are ready to push!`. -7. Once you are ready, review the "Manual Pre-Review Checklist". If you did not add tests or write doc comments, proactively ask the user if they would like you to do so! +If this command modifies any files, the code WAS NOT ready to push. You must commit those changes before proceeding to ensure your working tree is clean. + +## 2. Static Analysis + +Static analysis catches potential bugs, type errors, and style violations without needing to run the code. All code must pass the analyzer without any warnings or errors. Command to run: + +```bash +dart run script/tool/bin/flutter_plugin_tools.dart analyze --run-on-changed-packages +``` + +If this command fails, the code WAS NOT ready to push. You must fix the analyzer errors and commit those changes before proceeding. + +## 3. Unit Tests + +Tests ensure that your changes do not break existing functionality and that new features work as expected. All unit tests must pass before code can be merged. Command to run: + +```bash +dart run script/tool/bin/flutter_plugin_tools.dart dart-test --run-on-changed-packages +``` + +If this command fails, the code WAS NOT ready to push. You must note that the errors must be fixed and offer guidance to resolve them. + +## 4. Publish Check (Versioing and CHANGELOG updates) + +Any pull request that changes non-test code must increment the package version in `pubspec.yaml` and add a corresponding entry describing the change in `CHANGELOG.md`. Command to run: + +```bash +dart run script/tool/bin/flutter_plugin_tools.dart publish-check --run-on-changed-packages +``` + +If this command fails, the code WAS NOT ready to push. You can automatically generate the required bumps by running: + +```bash +dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \ + --version=minimal --base-branch=origin/main --changelog="" +``` + +## 5. License Headers + +All source files in this repository must include the standard copyright and license header. Command to run: + +```bash +dart run script/tool/bin/flutter_plugin_tools.dart license-check +``` + +If this command fails, the code WAS NOT ready to push. Based on the output, you can offer guidance on fixing the errors. + +## 6. Final Clean Working Tree Check + +Before pushing, ensure that all your fixes, formatting changes, and version bumps are committed. Command to run: + +```bash +git status --porcelain +``` + +If this command fails, the code WAS NOT ready to push. Prompt the user to ensure these changes were intended to be left uncommitted before pushing. + +--- + +## Final Review + +Before declaring the task complete, verify the final requirements for creating a pull request in the flutter/packages repository. + +**What you MUST verify automatically:** +- **Documentation:** Check if the modified or newly added public APIs include Dart doc comments (`///`). If any are missing, proactively fix them or ask the user if they'd like you to add them. +- **Tests:** Check if any test files were added or modified alongside the source code changes. If not, proactively ask the user if they'd like you to generate tests (Critical for PR acceptance!). + +**What you MUST NOT hold against the developer:** +Do NOT penalize or block the developer for administrative checklist items that are unverifiable by an agent (e.g., signing the CLA, reading the Contributor Guide). + +**Action to take:** +Provide the developer with a brief summary of what you verified automatically. Then, provide them with this short checklist of items they will need to handle when opening their Pull Request: +- Ensure the PR title starts with the package name in brackets (e.g., `[camera_android] Fix crash`). +- Ensure the PR description links to at least one issue that is being fixed. +- Ensure they have signed the CLA. + +Once all of the automated checks pass and you have provided this final summary and checklist to the user, the code is ready to push! From 68d3fa55067c0a7bfe07c4210d2cbee5d4498d93 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 07:06:38 -0700 Subject: [PATCH 05/19] add merge conflict note --- .agents/skills/pre-push-skill/SKILL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.agents/skills/pre-push-skill/SKILL.md b/.agents/skills/pre-push-skill/SKILL.md index 017787b82c29..25890c1d68b3 100644 --- a/.agents/skills/pre-push-skill/SKILL.md +++ b/.agents/skills/pre-push-skill/SKILL.md @@ -92,5 +92,6 @@ Provide the developer with a brief summary of what you verified automatically. T - Ensure the PR title starts with the package name in brackets (e.g., `[camera_android] Fix crash`). - Ensure the PR description links to at least one issue that is being fixed. - Ensure they have signed the CLA. +- Ensure the branch is up to date with the main branch and has no merge conflicts. Once all of the automated checks pass and you have provided this final summary and checklist to the user, the code is ready to push! From aa81a3f9745b576b94813387aeb228cc8cfbd2ec Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 07:26:32 -0700 Subject: [PATCH 06/19] skill updates + fake commit --- .agents/skills/pre-push-skill/SKILL.md | 36 ++++++++++++------- .../lib/src/android_camera_camerax.dart | 2 ++ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.agents/skills/pre-push-skill/SKILL.md b/.agents/skills/pre-push-skill/SKILL.md index 25890c1d68b3..956230f2a4c3 100644 --- a/.agents/skills/pre-push-skill/SKILL.md +++ b/.agents/skills/pre-push-skill/SKILL.md @@ -7,9 +7,19 @@ description: "A comprehensive pre-push checklist for contributing to the flutter This skill provides a fully automated pre-push validation script and a mental checklist for developers attempting to push code changes to any of the packages in the flutter/packages repository. It directly answers the question: **"Am I ready to push?"** -Follow the steps below before pushing any committed code upstream via `git push` to a package or finishing your task. If any step fails, continue with the following steps to provide a comprehensive list of required fixes for the user. +Follow the steps below before pushing any current code changes can be pushed upstream via `git push` to a package or finishing your task. If any step fails, continue with the following steps to provide a comprehensive list of required fixes for the user. -## 1. Format Code +## 1. Initial Clean Working Tree Check + +Because the tooling natively relies on `git diff` to determine which packages have changed, it **completely ignores uncommitted changes**. You must ensure the working tree is clean before running any checks. Command to run: + +```bash +git status --porcelain +``` + +If this command outputs anything, the code WAS NOT ready to push. The developer must commit or stash their changes before you can proceed with the remaining validation steps. Do not continue if there are uncommitted changes. + +## 2. Format Code Consistent code style is required for all pull requests. The repository uses auto-formatters (like `dart format`, `clang-format`, `ktfmt`) to enforce this. Command to run: @@ -17,9 +27,9 @@ Consistent code style is required for all pull requests. The repository uses aut dart run script/tool/bin/flutter_plugin_tools.dart format --run-on-changed-packages ``` -If this command modifies any files, the code WAS NOT ready to push. You must commit those changes before proceeding to ensure your working tree is clean. +If this command modifies any files, the code WAS NOT ready to push. Those changes must be committed before the developer can push. -## 2. Static Analysis +## 3. Static Analysis Static analysis catches potential bugs, type errors, and style violations without needing to run the code. All code must pass the analyzer without any warnings or errors. Command to run: @@ -27,9 +37,9 @@ Static analysis catches potential bugs, type errors, and style violations withou dart run script/tool/bin/flutter_plugin_tools.dart analyze --run-on-changed-packages ``` -If this command fails, the code WAS NOT ready to push. You must fix the analyzer errors and commit those changes before proceeding. +If this command fails, the code WAS NOT ready to push. Those analyzer errors must be fixed and committed before the developer can push. -## 3. Unit Tests +## 4. Unit Tests Tests ensure that your changes do not break existing functionality and that new features work as expected. All unit tests must pass before code can be merged. Command to run: @@ -37,9 +47,9 @@ Tests ensure that your changes do not break existing functionality and that new dart run script/tool/bin/flutter_plugin_tools.dart dart-test --run-on-changed-packages ``` -If this command fails, the code WAS NOT ready to push. You must note that the errors must be fixed and offer guidance to resolve them. +If this command fails, the code WAS NOT ready to push. Those test errors must be fixed and committed before the developer can push. -## 4. Publish Check (Versioing and CHANGELOG updates) +## 5. Publish Check (Version and CHANGELOG updates) Any pull request that changes non-test code must increment the package version in `pubspec.yaml` and add a corresponding entry describing the change in `CHANGELOG.md`. Command to run: @@ -47,14 +57,14 @@ Any pull request that changes non-test code must increment the package version i dart run script/tool/bin/flutter_plugin_tools.dart publish-check --run-on-changed-packages ``` -If this command fails, the code WAS NOT ready to push. You can automatically generate the required bumps by running: +If this command fails, the code WAS NOT ready to push. The required version bump and changelog entry must be made and committed before the developer can push. This can be done automatically by running: ```bash dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \ --version=minimal --base-branch=origin/main --changelog="" ``` -## 5. License Headers +## 6. License Headers All source files in this repository must include the standard copyright and license header. Command to run: @@ -62,9 +72,9 @@ All source files in this repository must include the standard copyright and lice dart run script/tool/bin/flutter_plugin_tools.dart license-check ``` -If this command fails, the code WAS NOT ready to push. Based on the output, you can offer guidance on fixing the errors. +If this command fails, the code WAS NOT ready to push. Those license errors must be fixed and committed before the developer can push. -## 6. Final Clean Working Tree Check +## 7. Final Clean Working Tree Check Before pushing, ensure that all your fixes, formatting changes, and version bumps are committed. Command to run: @@ -72,7 +82,7 @@ Before pushing, ensure that all your fixes, formatting changes, and version bump git status --porcelain ``` -If this command fails, the code WAS NOT ready to push. Prompt the user to ensure these changes were intended to be left uncommitted before pushing. +If this command outputs anything, the code WAS NOT ready to push. The changes must be cleaned up before the developer can push. --- diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 0c84bdf2f2e5..4cd70669f99e 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -24,6 +24,8 @@ class AndroidCameraCameraX extends CameraPlatform { CameraPlatform.instance = AndroidCameraCameraX(); } + int whatever = 3; + /// The [ProcessCameraProvider] instance used to access camera functionality. @visibleForTesting ProcessCameraProvider? processCameraProvider; From 241121bb40ea33f00db2824ede9e3486d1d7d240 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 07:31:07 -0700 Subject: [PATCH 07/19] remove bad stuff --- packages/camera/camera/lib/camera.dart | 3 --- .../camera_android_camerax/lib/src/android_camera_camerax.dart | 2 -- 2 files changed, 5 deletions(-) diff --git a/packages/camera/camera/lib/camera.dart b/packages/camera/camera/lib/camera.dart index fc1e464c9f2a..1558dbf687d0 100644 --- a/packages/camera/camera/lib/camera.dart +++ b/packages/camera/camera/lib/camera.dart @@ -19,6 +19,3 @@ export 'package:camera_platform_interface/camera_platform_interface.dart' export 'src/camera_controller.dart'; export 'src/camera_image.dart'; export 'src/camera_preview.dart'; -void badFormat() { - int x= 1; -} diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 4cd70669f99e..0c84bdf2f2e5 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -24,8 +24,6 @@ class AndroidCameraCameraX extends CameraPlatform { CameraPlatform.instance = AndroidCameraCameraX(); } - int whatever = 3; - /// The [ProcessCameraProvider] instance used to access camera functionality. @visibleForTesting ProcessCameraProvider? processCameraProvider; From 437dced3d162989dc30f667cdd22848893878740 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 07:43:00 -0700 Subject: [PATCH 08/19] ensure package changes --- .agents/skills/pre-push-skill/SKILL.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.agents/skills/pre-push-skill/SKILL.md b/.agents/skills/pre-push-skill/SKILL.md index 956230f2a4c3..629dc63eacc6 100644 --- a/.agents/skills/pre-push-skill/SKILL.md +++ b/.agents/skills/pre-push-skill/SKILL.md @@ -19,7 +19,17 @@ git status --porcelain If this command outputs anything, the code WAS NOT ready to push. The developer must commit or stash their changes before you can proceed with the remaining validation steps. Do not continue if there are uncommitted changes. -## 2. Format Code +## 2. Check for Changed Packages + +Because `--run-on-changed-packages` defaults to checking the entire repository if zero packages have changed, you must verify that there are actually package changes to test. Command to run: + +```bash +git diff --name-only origin/main...HEAD | grep '^packages/' +``` + +If this command outputs nothing, then no packages were modified in this branch. You can skip all remaining validation steps and proceed directly to the Final Review. If it outputs file paths, continue to the next step. + +## 3. Format Code Consistent code style is required for all pull requests. The repository uses auto-formatters (like `dart format`, `clang-format`, `ktfmt`) to enforce this. Command to run: @@ -29,7 +39,7 @@ dart run script/tool/bin/flutter_plugin_tools.dart format --run-on-changed-packa If this command modifies any files, the code WAS NOT ready to push. Those changes must be committed before the developer can push. -## 3. Static Analysis +## 4. Static Analysis Static analysis catches potential bugs, type errors, and style violations without needing to run the code. All code must pass the analyzer without any warnings or errors. Command to run: @@ -39,7 +49,7 @@ dart run script/tool/bin/flutter_plugin_tools.dart analyze --run-on-changed-pack If this command fails, the code WAS NOT ready to push. Those analyzer errors must be fixed and committed before the developer can push. -## 4. Unit Tests +## 5. Unit Tests Tests ensure that your changes do not break existing functionality and that new features work as expected. All unit tests must pass before code can be merged. Command to run: @@ -49,7 +59,7 @@ dart run script/tool/bin/flutter_plugin_tools.dart dart-test --run-on-changed-pa If this command fails, the code WAS NOT ready to push. Those test errors must be fixed and committed before the developer can push. -## 5. Publish Check (Version and CHANGELOG updates) +## 6. Publish Check (Version and CHANGELOG updates) Any pull request that changes non-test code must increment the package version in `pubspec.yaml` and add a corresponding entry describing the change in `CHANGELOG.md`. Command to run: @@ -64,7 +74,7 @@ dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \ --version=minimal --base-branch=origin/main --changelog="" ``` -## 6. License Headers +## 7. License Headers All source files in this repository must include the standard copyright and license header. Command to run: @@ -74,7 +84,7 @@ dart run script/tool/bin/flutter_plugin_tools.dart license-check If this command fails, the code WAS NOT ready to push. Those license errors must be fixed and committed before the developer can push. -## 7. Final Clean Working Tree Check +## 8. Final Clean Working Tree Check Before pushing, ensure that all your fixes, formatting changes, and version bumps are committed. Command to run: From 23ae1ac3766e2f67c14749938c524dc2d9405bdc Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 07:48:14 -0700 Subject: [PATCH 09/19] fix origin/main comparison --- .agents/skills/pre-push-skill/SKILL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.agents/skills/pre-push-skill/SKILL.md b/.agents/skills/pre-push-skill/SKILL.md index 629dc63eacc6..2546e838de11 100644 --- a/.agents/skills/pre-push-skill/SKILL.md +++ b/.agents/skills/pre-push-skill/SKILL.md @@ -24,7 +24,7 @@ If this command outputs anything, the code WAS NOT ready to push. The developer Because `--run-on-changed-packages` defaults to checking the entire repository if zero packages have changed, you must verify that there are actually package changes to test. Command to run: ```bash -git diff --name-only origin/main...HEAD | grep '^packages/' +git diff --name-only main...HEAD | grep '^packages/' ``` If this command outputs nothing, then no packages were modified in this branch. You can skip all remaining validation steps and proceed directly to the Final Review. If it outputs file paths, continue to the next step. @@ -71,7 +71,7 @@ If this command fails, the code WAS NOT ready to push. The required version bump ```bash dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \ - --version=minimal --base-branch=origin/main --changelog="" + --version=minimal --base-branch=main --changelog="" ``` ## 7. License Headers From 7f41a5032947722c3a7a1c161380c027bb2c5bbc Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 07:51:19 -0700 Subject: [PATCH 10/19] fake commit --- .../lib/src/android_camera_camerax.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 0c84bdf2f2e5..9d7e2129ebd1 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -59,7 +59,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// The [PendingRecording] instance used to create an active [Recording]. @visibleForTesting - PendingRecording? pendingRecording; + PendingRecording? pendingRecordingg; /// The [Recording] instance representing the current recording. @visibleForTesting @@ -1120,21 +1120,21 @@ class AndroidCameraCameraX extends CameraPlatform { } videoOutputPath = await systemServicesManager.getTempFilePath(videoPrefix, '.mp4'); - pendingRecording = await recorder!.prepareRecording(videoOutputPath!); + pendingRecordingg = await recorder!.prepareRecording(videoOutputPath!); if (options.enablePersistentRecording) { - pendingRecording = await pendingRecording?.asPersistentRecording(); + pendingRecordingg = await pendingRecordingg?.asPersistentRecording(); } // Enable/disable recording audio as requested. If enabling audio is requested // and permission was not granted when the camera was created, then recording // audio will be disabled to respect the denied permission. - pendingRecording = await pendingRecording!.withAudioEnabled( + pendingRecordingg = await pendingRecordingg!.withAudioEnabled( /* initialMuted */ !enableRecordingAudio, ); - recording = await pendingRecording!.start(_videoRecordingEventListener); + recording = await pendingRecordingg!.start(_videoRecordingEventListener); if (streamCallback != null) { onStreamedFrameAvailable(options.cameraId).listen(streamCallback); @@ -1170,7 +1170,7 @@ class AndroidCameraCameraX extends CameraPlatform { event = await videoRecordingEventStreamQueue.next; } recording = null; - pendingRecording = null; + pendingRecordingg = null; if (videoOutputPath == null) { // Handle any errors with finalizing video recording. From ca8d5a13d7a2a1096cf70ba32427e8084a82f1fa Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 07:54:10 -0700 Subject: [PATCH 11/19] fake commit x 2 --- .../test/android_camera_camerax_test.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart index afc297894d29..d98db804d5f3 100644 --- a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart +++ b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart @@ -2280,7 +2280,7 @@ void main() { ); // Verify recording is started. - expect(camera.pendingRecording, equals(mockPendingRecordingWithAudio)); + expect(camera.pendingRecordingg, equals(mockPendingRecordingWithAudio)); expect(camera.recording, mockRecording); }, ); @@ -2369,7 +2369,7 @@ void main() { camera.videoCapture!, ]), ); - expect(camera.pendingRecording, equals(mockPendingRecording)); + expect(camera.pendingRecordingg, equals(mockPendingRecording)); expect(camera.recording, mockRecording); await camera.startVideoCapturing(const VideoCaptureOptions(cameraId)); From c56dadf565dcd0a4e01eb405026f953b151b8cc7 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 08:01:39 -0700 Subject: [PATCH 12/19] delete old skill and add clear results --- .../skills/flutter_packages_pre_push/SKILL.md | 180 ------------------ .agents/skills/pre-push-skill/SKILL.md | 10 +- 2 files changed, 7 insertions(+), 183 deletions(-) delete mode 100644 .agents/skills/flutter_packages_pre_push/SKILL.md diff --git a/.agents/skills/flutter_packages_pre_push/SKILL.md b/.agents/skills/flutter_packages_pre_push/SKILL.md deleted file mode 100644 index 55343889438e..000000000000 --- a/.agents/skills/flutter_packages_pre_push/SKILL.md +++ /dev/null @@ -1,180 +0,0 @@ ---- -name: "flutter_packages_pre_push" -description: "A comprehensive pre-push checklist and validation script for developers and AI agents contributing to the flutter/packages repository. Directly answers the question: 'Am I ready to push?'" ---- - -# Pre-Push Skill: `flutter/packages` - -This skill provides a fully automated pre-push validation script and a mental checklist. It directly answers the question: **"Am I ready to push?"** - -AI Agents: Run the bash script below before completing any pull request or commit task. If it outputs `๐Ÿ›‘ NO. You are not ready to push`, you must fix the errors before concluding your task. - -Human Developers: You can save the bash script below as `.git/hooks/pre-push` to enforce these rules locally, or simply run it manually before opening a PR! - -## Automated Validation Script - -Run this script from the root of the repository. It identifies exactly which packages you modified and runs the repository's native `flutter_plugin_tools` on them. It does NOT stop on the first error, so you get a complete list of everything needed to be ready! - -```bash -#!/bin/bash - -# Ensure we are at the repository root -REPO_ROOT=$(git rev-parse --show-toplevel) -cd "$REPO_ROOT" - -echo "๐Ÿ“ฆ 1. Checking for uncommitted changes..." -if [[ -n $(git status --porcelain) ]]; then - echo "โŒ You have uncommitted changes in your working directory!" - echo "Please commit or stash your changes before running this script," - echo "so we can safely pull the latest changes from main." - exit 1 -else - echo "โœ… Working directory is clean." -fi - -echo "=========================================" -echo "๐Ÿ”„ 2. Pulling latest changes from main..." -git fetch origin main 2>/dev/null || true -if ! git merge origin/main --no-edit; then - echo "โŒ Merge conflict detected!" - echo "Please resolve the merge conflicts, commit the result, and run this script again." - exit 1 -else - echo "โœ… Successfully pulled latest changes (no conflicts)." -fi - -# Ensure the repository tool dependencies are fetched -dart pub get -C "$REPO_ROOT/script/tool" > /dev/null - -echo "=========================================" -echo "๐Ÿ” 3. Identifying changed packages..." -# Diff against main. Adjust origin/main to upstream/main if needed. -CHANGED_FILES=$(git diff --name-only origin/main...HEAD || git diff --name-only origin/main) - -# Find unique packages containing pubspec.yaml -PACKAGES="" -for file in $CHANGED_FILES; do - dir=$(dirname "$file") - while [ "$dir" != "." ] && [ "$dir" != "/" ]; do - if [ -f "$dir/pubspec.yaml" ]; then - # Ignore example directories as per repository guidelines - if [[ ! "$dir" == *"example"* ]]; then - PACKAGE_NAME=$(basename "$dir") - PACKAGES="$PACKAGES,$PACKAGE_NAME" - fi - break - fi - dir=$(dirname "$dir") - done -done - -# Clean up trailing/leading commas and deduplicate -PACKAGES=$(echo "$PACKAGES" | tr ',' '\n' | sort -u | paste -sd, - | sed 's/^,//') - -if [ -z "$PACKAGES" ]; then - echo "โœ… No package changes detected. Continuing." - exit 0 -fi - -echo "๐Ÿ“ฆ Changed packages detected: $PACKAGES" -READY=true - -echo "=========================================" -echo "๐Ÿงน 4. Running auto-formatters..." -echo "Note: This runs dart format, clang-format, ktfmt, etc." -if ! dart run script/tool/bin/flutter_plugin_tools.dart format --packages="$PACKAGES"; then - echo "โŒ Formatter found issues." - READY=false -else - echo "โœ… Format complete." -fi - -echo "=========================================" -echo "๐Ÿ” 5. Running static analysis..." -echo "Note: This runs dart analyze --fatal-infos internally." -if ! dart run script/tool/bin/flutter_plugin_tools.dart analyze --packages="$PACKAGES"; then - echo "โŒ Analysis failed." - READY=false -else - echo "โœ… Analysis passed." -fi - -echo "=========================================" -echo "๐Ÿงช 6. Running unit tests..." -if ! dart run script/tool/bin/flutter_plugin_tools.dart dart-test --packages="$PACKAGES"; then - echo "โŒ Tests failed." - READY=false -else - echo "โœ… Tests passed." -fi - -echo "=========================================" -echo "๐Ÿ“ 7. Validating package structure..." -if ! dart run script/tool/bin/flutter_plugin_tools.dart validate --packages="$PACKAGES"; then - echo "โŒ Structure validation failed." - READY=false -else - echo "โœ… Structure validation passed." -fi - -echo "=========================================" -echo "๐Ÿท๏ธ 8. Checking versions and CHANGELOGs..." -if ! dart run script/tool/bin/flutter_plugin_tools.dart publish-check --packages="$PACKAGES"; then - echo "โŒ Version and Changelog validation failed." - READY=false -else - echo "โœ… Version and Changelog validation passed." -fi - -echo "=========================================" -echo "โš–๏ธ 9. Checking license headers..." -if ! dart run script/tool/bin/flutter_plugin_tools.dart license-check; then - echo "โŒ License check failed." - READY=false -else - echo "โœ… License check passed." -fi - -echo "=========================================" -echo "๐Ÿ“ฆ 10. Checking for new uncommitted changes..." -if [[ -n $(git status --porcelain) ]]; then - echo "โŒ You have uncommitted changes in your working directory!" - echo " (Did the auto-formatter modify files in step 4?)" - READY=false -else - echo "โœ… Working directory is still clean." -fi - -echo "=========================================" -if [ "$READY" = "true" ]; then - echo "๐Ÿš€ YES! You are ready to push!" - echo "" - echo "๐Ÿ›‘ MANUAL PRE-REVIEW CHECKLIST ๐Ÿ›‘" - echo "Please verify the following PR requirements before submitting:" - echo "- [ ] I read the Contributor Guide and AI contribution guidelines." - echo "- [ ] I signed the CLA." - echo "- [ ] PR Title starts with the package name in brackets, e.g. [${PACKAGES%%,*}]" - echo "- [ ] Linked to at least one issue (or noted it's a new feature)." - echo "- [ ] Updated any relevant doc comments (///)." - echo "- [ ] Added new tests for the change made (Critical for PR acceptance!)." - exit 0 -else - echo "๐Ÿ›‘ NO. You are not ready to push. Please fix the errors above." - echo "" - echo "๐Ÿ’ก TIP: If you failed step 8 (publish-check), run:" - echo " dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \\" - echo " --version=minimal --base-branch=origin/main --changelog=\"\"" - echo "" - echo "๐Ÿ’ก TIP: If you failed step 10, run 'git commit' to commit the formatter's changes!" - exit 1 -fi -``` - -## How to use this skill (For Agents) -1. Whenever a user asks you to implement a fix, feature, or refactor in `flutter/packages`, make your edits. -2. Before you announce that the work is finished, **you MUST run the script above**. -3. If step 1 (`format`) modifies files, step 7 will fail! You must commit the formatter's modifications so the working tree is clean. -4. If step 2 (`analyze`) fails, you must read the analyzer errors and fix them in the source code. -5. If step 5 (`publish-check`) fails because of missing `CHANGELOG.md` or `pubspec.yaml` version bumps, use the `update-release-info` command (shown in the TIP) to automatically generate them. -6. If the script says `๐Ÿ›‘ NO. You are not ready to push`, fix all issues and run the script again. Do not finish the task until you see `๐Ÿš€ YES! You are ready to push!`. -7. Once you are ready, review the "Manual Pre-Review Checklist". If you did not add tests or write doc comments, proactively ask the user if they would like you to do so! diff --git a/.agents/skills/pre-push-skill/SKILL.md b/.agents/skills/pre-push-skill/SKILL.md index 2546e838de11..0abb6f9a81ff 100644 --- a/.agents/skills/pre-push-skill/SKILL.md +++ b/.agents/skills/pre-push-skill/SKILL.md @@ -108,10 +108,14 @@ Before declaring the task complete, verify the final requirements for creating a Do NOT penalize or block the developer for administrative checklist items that are unverifiable by an agent (e.g., signing the CLA, reading the Contributor Guide). **Action to take:** -Provide the developer with a brief summary of what you verified automatically. Then, provide them with this short checklist of items they will need to handle when opening their Pull Request: +First, explicitly state the final verdict to the user at the very beginning of your response using a large heading: + +- If ANY step failed: Start your response with a clear "# NO, you are not ready to push." followed by a summary of what failed and what needs to be fixed. +- If ALL steps passed: Start your response with a clear "# YES, you are ready to push!" + +Then, provide the developer with a brief summary of what you verified automatically. If the code is ready to push, provide them with this short checklist of items they will need to handle when opening their pull request: + - Ensure the PR title starts with the package name in brackets (e.g., `[camera_android] Fix crash`). - Ensure the PR description links to at least one issue that is being fixed. - Ensure they have signed the CLA. - Ensure the branch is up to date with the main branch and has no merge conflicts. - -Once all of the automated checks pass and you have provided this final summary and checklist to the user, the code is ready to push! From 2d38f9b1891c76d7a7e04378fd6d3d43915b47a3 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 08:02:13 -0700 Subject: [PATCH 13/19] undo camera changes --- .../lib/src/android_camera_camerax.dart | 12 ++++++------ .../test/android_camera_camerax_test.dart | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 9d7e2129ebd1..0c84bdf2f2e5 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -59,7 +59,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// The [PendingRecording] instance used to create an active [Recording]. @visibleForTesting - PendingRecording? pendingRecordingg; + PendingRecording? pendingRecording; /// The [Recording] instance representing the current recording. @visibleForTesting @@ -1120,21 +1120,21 @@ class AndroidCameraCameraX extends CameraPlatform { } videoOutputPath = await systemServicesManager.getTempFilePath(videoPrefix, '.mp4'); - pendingRecordingg = await recorder!.prepareRecording(videoOutputPath!); + pendingRecording = await recorder!.prepareRecording(videoOutputPath!); if (options.enablePersistentRecording) { - pendingRecordingg = await pendingRecordingg?.asPersistentRecording(); + pendingRecording = await pendingRecording?.asPersistentRecording(); } // Enable/disable recording audio as requested. If enabling audio is requested // and permission was not granted when the camera was created, then recording // audio will be disabled to respect the denied permission. - pendingRecordingg = await pendingRecordingg!.withAudioEnabled( + pendingRecording = await pendingRecording!.withAudioEnabled( /* initialMuted */ !enableRecordingAudio, ); - recording = await pendingRecordingg!.start(_videoRecordingEventListener); + recording = await pendingRecording!.start(_videoRecordingEventListener); if (streamCallback != null) { onStreamedFrameAvailable(options.cameraId).listen(streamCallback); @@ -1170,7 +1170,7 @@ class AndroidCameraCameraX extends CameraPlatform { event = await videoRecordingEventStreamQueue.next; } recording = null; - pendingRecordingg = null; + pendingRecording = null; if (videoOutputPath == null) { // Handle any errors with finalizing video recording. diff --git a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart index d98db804d5f3..afc297894d29 100644 --- a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart +++ b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart @@ -2280,7 +2280,7 @@ void main() { ); // Verify recording is started. - expect(camera.pendingRecordingg, equals(mockPendingRecordingWithAudio)); + expect(camera.pendingRecording, equals(mockPendingRecordingWithAudio)); expect(camera.recording, mockRecording); }, ); @@ -2369,7 +2369,7 @@ void main() { camera.videoCapture!, ]), ); - expect(camera.pendingRecordingg, equals(mockPendingRecording)); + expect(camera.pendingRecording, equals(mockPendingRecording)); expect(camera.recording, mockRecording); await camera.startVideoCapturing(const VideoCaptureOptions(cameraId)); From f72fcf04b9a07c058c0a9224d8fcd5de242653d7 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 08:05:05 -0700 Subject: [PATCH 14/19] reformat --- .agents/skills/pre-push-skill/SKILL.md | 135 ++++++++++++++++++------- 1 file changed, 99 insertions(+), 36 deletions(-) diff --git a/.agents/skills/pre-push-skill/SKILL.md b/.agents/skills/pre-push-skill/SKILL.md index 0abb6f9a81ff..c427b9693262 100644 --- a/.agents/skills/pre-push-skill/SKILL.md +++ b/.agents/skills/pre-push-skill/SKILL.md @@ -5,117 +5,180 @@ description: "A comprehensive pre-push checklist for contributing to the flutter # Pre-Push Skill -This skill provides a fully automated pre-push validation script and a mental checklist for developers attempting to push code changes to any of the packages in the flutter/packages repository. It directly answers the question: **"Am I ready to push?"** +This skill provides a fully automated pre-push validation script +and a mental checklist for developers attempting to push code changes +to any of the packages in the flutter/packages repository. +It directly answers the question: **"Am I ready to push?"** -Follow the steps below before pushing any current code changes can be pushed upstream via `git push` to a package or finishing your task. If any step fails, continue with the following steps to provide a comprehensive list of required fixes for the user. +Follow the steps below before pushing any current code changes upstream +via `git push` to a package or finishing your task. +If any step fails, continue with the following steps +to provide a comprehensive list of required fixes for the user. ## 1. Initial Clean Working Tree Check -Because the tooling natively relies on `git diff` to determine which packages have changed, it **completely ignores uncommitted changes**. You must ensure the working tree is clean before running any checks. Command to run: +Because the tooling natively relies on `git diff` +to determine which packages have changed, +it **completely ignores uncommitted changes**. +You must ensure the working tree is clean before running any checks. +Command to run: ```bash git status --porcelain ``` -If this command outputs anything, the code WAS NOT ready to push. The developer must commit or stash their changes before you can proceed with the remaining validation steps. Do not continue if there are uncommitted changes. +If this command outputs anything, the code WAS NOT ready to push. +The developer must commit or stash their changes +before you can proceed with the remaining validation steps. +Do not continue if there are uncommitted changes. ## 2. Check for Changed Packages -Because `--run-on-changed-packages` defaults to checking the entire repository if zero packages have changed, you must verify that there are actually package changes to test. Command to run: +Because `--run-on-changed-packages` defaults to checking the entire repository +if zero packages have changed, you must verify +that there are actually package changes to test. +Command to run: ```bash git diff --name-only main...HEAD | grep '^packages/' ``` -If this command outputs nothing, then no packages were modified in this branch. You can skip all remaining validation steps and proceed directly to the Final Review. If it outputs file paths, continue to the next step. +If this command outputs nothing, then no packages were modified in this branch. +You can skip all remaining validation steps +and proceed directly to the Final Review. +If it outputs file paths, continue to the next step. ## 3. Format Code -Consistent code style is required for all pull requests. The repository uses auto-formatters (like `dart format`, `clang-format`, `ktfmt`) to enforce this. Command to run: +Consistent code style is required for all pull requests. +The repository uses auto-formatters (like `dart format`, `clang-format`) +to enforce this. Command to run: ```bash -dart run script/tool/bin/flutter_plugin_tools.dart format --run-on-changed-packages +dart run script/tool/bin/flutter_plugin_tools.dart \ + format --run-on-changed-packages ``` -If this command modifies any files, the code WAS NOT ready to push. Those changes must be committed before the developer can push. +If this command modifies any files, the code WAS NOT ready to push. +Those changes must be committed before the developer can push. ## 4. Static Analysis -Static analysis catches potential bugs, type errors, and style violations without needing to run the code. All code must pass the analyzer without any warnings or errors. Command to run: +Static analysis catches potential bugs, type errors, +and style violations without needing to run the code. +All code must pass the analyzer without any warnings or errors. +Command to run: ```bash -dart run script/tool/bin/flutter_plugin_tools.dart analyze --run-on-changed-packages +dart run script/tool/bin/flutter_plugin_tools.dart \ + analyze --run-on-changed-packages ``` -If this command fails, the code WAS NOT ready to push. Those analyzer errors must be fixed and committed before the developer can push. +If this command fails, the code WAS NOT ready to push. +Those analyzer errors must be fixed and committed before the developer can push. ## 5. Unit Tests -Tests ensure that your changes do not break existing functionality and that new features work as expected. All unit tests must pass before code can be merged. Command to run: +Tests ensure that your changes do not break existing functionality +and that new features work as expected. +All unit tests must pass before code can be merged. +Command to run: ```bash -dart run script/tool/bin/flutter_plugin_tools.dart dart-test --run-on-changed-packages +dart run script/tool/bin/flutter_plugin_tools.dart \ + dart-test --run-on-changed-packages ``` -If this command fails, the code WAS NOT ready to push. Those test errors must be fixed and committed before the developer can push. +If this command fails, the code WAS NOT ready to push. +Those test errors must be fixed and committed before the developer can push. ## 6. Publish Check (Version and CHANGELOG updates) -Any pull request that changes non-test code must increment the package version in `pubspec.yaml` and add a corresponding entry describing the change in `CHANGELOG.md`. Command to run: +Any pull request that changes non-test code +must increment the package version in `pubspec.yaml` +and add a corresponding entry describing the change in `CHANGELOG.md`. +Command to run: ```bash -dart run script/tool/bin/flutter_plugin_tools.dart publish-check --run-on-changed-packages +dart run script/tool/bin/flutter_plugin_tools.dart \ + publish-check --run-on-changed-packages ``` -If this command fails, the code WAS NOT ready to push. The required version bump and changelog entry must be made and committed before the developer can push. This can be done automatically by running: +If this command fails, the code WAS NOT ready to push. +The required version bump and changelog entry must be made +and committed before the developer can push. +This can be done automatically by running: ```bash dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \ - --version=minimal --base-branch=main --changelog="" + --version=minimal --base-branch=main \ + --changelog="" ``` ## 7. License Headers -All source files in this repository must include the standard copyright and license header. Command to run: +All source files in this repository must include +the standard copyright and license header. +Command to run: ```bash dart run script/tool/bin/flutter_plugin_tools.dart license-check ``` -If this command fails, the code WAS NOT ready to push. Those license errors must be fixed and committed before the developer can push. +If this command fails, the code WAS NOT ready to push. +Those license errors must be fixed and committed before the developer can push. ## 8. Final Clean Working Tree Check -Before pushing, ensure that all your fixes, formatting changes, and version bumps are committed. Command to run: +Before pushing, ensure that all your fixes, formatting changes, +and version bumps are committed. Command to run: ```bash git status --porcelain ``` -If this command outputs anything, the code WAS NOT ready to push. The changes must be cleaned up before the developer can push. +If this command outputs anything, the code WAS NOT ready to push. +The changes must be cleaned up before the developer can push. --- ## Final Review -Before declaring the task complete, verify the final requirements for creating a pull request in the flutter/packages repository. +Before declaring the task complete, +verify the final requirements for creating a pull request +in the flutter/packages repository. **What you MUST verify automatically:** -- **Documentation:** Check if the modified or newly added public APIs include Dart doc comments (`///`). If any are missing, proactively fix them or ask the user if they'd like you to add them. -- **Tests:** Check if any test files were added or modified alongside the source code changes. If not, proactively ask the user if they'd like you to generate tests (Critical for PR acceptance!). +- **Documentation:** Check if the modified or newly added public APIs + include Dart doc comments (`///`). If any are missing, proactively fix them + or ask the user if they'd like you to add them. +- **Tests:** Check if any test files were added or modified + alongside the source code changes. If not, proactively ask the user + if they'd like you to generate tests (Critical for PR acceptance!). **What you MUST NOT hold against the developer:** -Do NOT penalize or block the developer for administrative checklist items that are unverifiable by an agent (e.g., signing the CLA, reading the Contributor Guide). +Do NOT penalize or block the developer for administrative checklist items +that are unverifiable by an agent +(e.g., signing the CLA, reading the Contributor Guide). **Action to take:** -First, explicitly state the final verdict to the user at the very beginning of your response using a large heading: - -- If ANY step failed: Start your response with a clear "# NO, you are not ready to push." followed by a summary of what failed and what needs to be fixed. -- If ALL steps passed: Start your response with a clear "# YES, you are ready to push!" - -Then, provide the developer with a brief summary of what you verified automatically. If the code is ready to push, provide them with this short checklist of items they will need to handle when opening their pull request: - -- Ensure the PR title starts with the package name in brackets (e.g., `[camera_android] Fix crash`). +First, explicitly state the final verdict to the user +at the very beginning of your response using a large heading: + +- If ANY step failed: Start your response with a clear + "# NO, you are not ready to push." + followed by a summary of what failed and what needs to be fixed. +- If ALL steps passed: Start your response with a clear + "# YES, you are ready to push!" + +Then, provide the developer with a brief summary +of what you verified automatically. +If the code is ready to push, provide them with this short checklist +of items they will need to handle when opening their pull request: + +- Ensure the PR title starts with the package name in brackets + (e.g., `[camera_android] Fix crash`). - Ensure the PR description links to at least one issue that is being fixed. - Ensure they have signed the CLA. -- Ensure the branch is up to date with the main branch and has no merge conflicts. +- Ensure the branch is up to date with the main branch + and has no merge conflicts. From 7cc1c56cfcb94eb90fc9ee3246d792cda18a7901 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Thu, 18 Jun 2026 12:35:46 -0700 Subject: [PATCH 15/19] rework description --- .agents/skills/pre-push-skill/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/skills/pre-push-skill/SKILL.md b/.agents/skills/pre-push-skill/SKILL.md index c427b9693262..295e0f48780c 100644 --- a/.agents/skills/pre-push-skill/SKILL.md +++ b/.agents/skills/pre-push-skill/SKILL.md @@ -1,6 +1,6 @@ --- name: "pre-push-skill" -description: "A comprehensive pre-push checklist for contributing to the flutter/packages repository." +description: "Executes the required pre-push steps for the flutter/packages repository. Call this tool immediately whenever the user asks to push, requests a code review before committing, or wants to validate their local changes can become a pull request. Do NOT use this tool if the user is working in flutter/flutter or flutter/engine." --- # Pre-Push Skill From 0d967b4005eeebfb4dddc448a20af8c93cb54549 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Tue, 23 Jun 2026 15:22:12 -0700 Subject: [PATCH 16/19] address review --- .agents/skills/pre-push-skill/SKILL.md | 184 ------------------ .../.agents/skills/pre-push-skill/SKILL.md | 126 ++++++++++++ 2 files changed, 126 insertions(+), 184 deletions(-) delete mode 100644 .agents/skills/pre-push-skill/SKILL.md create mode 100644 packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md diff --git a/.agents/skills/pre-push-skill/SKILL.md b/.agents/skills/pre-push-skill/SKILL.md deleted file mode 100644 index 295e0f48780c..000000000000 --- a/.agents/skills/pre-push-skill/SKILL.md +++ /dev/null @@ -1,184 +0,0 @@ ---- -name: "pre-push-skill" -description: "Executes the required pre-push steps for the flutter/packages repository. Call this tool immediately whenever the user asks to push, requests a code review before committing, or wants to validate their local changes can become a pull request. Do NOT use this tool if the user is working in flutter/flutter or flutter/engine." ---- - -# Pre-Push Skill - -This skill provides a fully automated pre-push validation script -and a mental checklist for developers attempting to push code changes -to any of the packages in the flutter/packages repository. -It directly answers the question: **"Am I ready to push?"** - -Follow the steps below before pushing any current code changes upstream -via `git push` to a package or finishing your task. -If any step fails, continue with the following steps -to provide a comprehensive list of required fixes for the user. - -## 1. Initial Clean Working Tree Check - -Because the tooling natively relies on `git diff` -to determine which packages have changed, -it **completely ignores uncommitted changes**. -You must ensure the working tree is clean before running any checks. -Command to run: - -```bash -git status --porcelain -``` - -If this command outputs anything, the code WAS NOT ready to push. -The developer must commit or stash their changes -before you can proceed with the remaining validation steps. -Do not continue if there are uncommitted changes. - -## 2. Check for Changed Packages - -Because `--run-on-changed-packages` defaults to checking the entire repository -if zero packages have changed, you must verify -that there are actually package changes to test. -Command to run: - -```bash -git diff --name-only main...HEAD | grep '^packages/' -``` - -If this command outputs nothing, then no packages were modified in this branch. -You can skip all remaining validation steps -and proceed directly to the Final Review. -If it outputs file paths, continue to the next step. - -## 3. Format Code - -Consistent code style is required for all pull requests. -The repository uses auto-formatters (like `dart format`, `clang-format`) -to enforce this. Command to run: - -```bash -dart run script/tool/bin/flutter_plugin_tools.dart \ - format --run-on-changed-packages -``` - -If this command modifies any files, the code WAS NOT ready to push. -Those changes must be committed before the developer can push. - -## 4. Static Analysis - -Static analysis catches potential bugs, type errors, -and style violations without needing to run the code. -All code must pass the analyzer without any warnings or errors. -Command to run: - -```bash -dart run script/tool/bin/flutter_plugin_tools.dart \ - analyze --run-on-changed-packages -``` - -If this command fails, the code WAS NOT ready to push. -Those analyzer errors must be fixed and committed before the developer can push. - -## 5. Unit Tests - -Tests ensure that your changes do not break existing functionality -and that new features work as expected. -All unit tests must pass before code can be merged. -Command to run: - -```bash -dart run script/tool/bin/flutter_plugin_tools.dart \ - dart-test --run-on-changed-packages -``` - -If this command fails, the code WAS NOT ready to push. -Those test errors must be fixed and committed before the developer can push. - -## 6. Publish Check (Version and CHANGELOG updates) - -Any pull request that changes non-test code -must increment the package version in `pubspec.yaml` -and add a corresponding entry describing the change in `CHANGELOG.md`. -Command to run: - -```bash -dart run script/tool/bin/flutter_plugin_tools.dart \ - publish-check --run-on-changed-packages -``` - -If this command fails, the code WAS NOT ready to push. -The required version bump and changelog entry must be made -and committed before the developer can push. -This can be done automatically by running: - -```bash -dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \ - --version=minimal --base-branch=main \ - --changelog="" -``` - -## 7. License Headers - -All source files in this repository must include -the standard copyright and license header. -Command to run: - -```bash -dart run script/tool/bin/flutter_plugin_tools.dart license-check -``` - -If this command fails, the code WAS NOT ready to push. -Those license errors must be fixed and committed before the developer can push. - -## 8. Final Clean Working Tree Check - -Before pushing, ensure that all your fixes, formatting changes, -and version bumps are committed. Command to run: - -```bash -git status --porcelain -``` - -If this command outputs anything, the code WAS NOT ready to push. -The changes must be cleaned up before the developer can push. - ---- - -## Final Review - -Before declaring the task complete, -verify the final requirements for creating a pull request -in the flutter/packages repository. - -**What you MUST verify automatically:** -- **Documentation:** Check if the modified or newly added public APIs - include Dart doc comments (`///`). If any are missing, proactively fix them - or ask the user if they'd like you to add them. -- **Tests:** Check if any test files were added or modified - alongside the source code changes. If not, proactively ask the user - if they'd like you to generate tests (Critical for PR acceptance!). - -**What you MUST NOT hold against the developer:** -Do NOT penalize or block the developer for administrative checklist items -that are unverifiable by an agent -(e.g., signing the CLA, reading the Contributor Guide). - -**Action to take:** -First, explicitly state the final verdict to the user -at the very beginning of your response using a large heading: - -- If ANY step failed: Start your response with a clear - "# NO, you are not ready to push." - followed by a summary of what failed and what needs to be fixed. -- If ALL steps passed: Start your response with a clear - "# YES, you are ready to push!" - -Then, provide the developer with a brief summary -of what you verified automatically. -If the code is ready to push, provide them with this short checklist -of items they will need to handle when opening their pull request: - -- Ensure the PR title starts with the package name in brackets - (e.g., `[camera_android] Fix crash`). -- Ensure the PR description links to at least one issue that is being fixed. -- Ensure they have signed the CLA. -- Ensure the branch is up to date with the main branch - and has no merge conflicts. diff --git a/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md b/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md new file mode 100644 index 000000000000..09bda3b068bc --- /dev/null +++ b/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md @@ -0,0 +1,126 @@ +--- +name: "pre-push-skill" +description: "Executes the required pre-push steps for the flutter/packages repository. Call this tool immediately whenever the user asks to push, asks if we/you are ready to push, or wants to validate their local changes can become a pull request." +--- + +# Pre-Push Skill Checks to Verify + +## 1. Initial Clean Working Tree Check + +The first step is ensuring that all changes are committed and there are no tracked files with lingering non committed state. Command to run: + +```bash +git status --porcelain +``` + +If this command outputs anything, then there are uncommitted git changes, the code is not ready to push. + +## 2. Check for Changed Files + +You must verify that there are actually changed files to test. +Command to run: + +// TODO(camsim99): check this grep +```bash +git diff --name-only main...HEAD | grep '^packages/camera/camera_android_camerax' +``` + +If this command outputs nothing, then no relevant files were modified in this branch. +There is no code to push and you can skip all remaining validation steps. + +## 3. Check Merge Conflicts + +Ensure the current branch is up to date with the main branch and has no merge conflicts. You can verify this by checking if the upstream `main` branch is an ancestor of your current `HEAD`. +Command to run: + +```bash +git fetch origin main +git merge-base --is-ancestor origin/main HEAD +``` + +If this command fails (exits with a non-zero code), the branch is behind `origin/main`. The code is NOT ready to push. The developer must pull the latest changes from `main` and resolve any merge conflicts before proceeding. + +## 4. Unit Tests + +Tests ensure that your changes do not break existing functionality +and that new features work as expected. +All unit tests must pass before code can be merged. +Command to run: + +```bash +dart run script/tool/bin/flutter_plugin_tools.dart \ + dart-test --packages camera_android_camerax +``` + +If this command fails, the code is likely not ready to push. The tests +might have been failing prior to any changes being made, so prompt the +user to review all found errors and fix the newly introduced failures +before pushing any code. + +## 5. Publish Check (Version and CHANGELOG updates) + +Any pull request that changes non-test code +must increment the package version in `pubspec.yaml` +and add a corresponding entry describing the change in `CHANGELOG.md`. +Command to run: + +```bash +dart run script/tool/bin/flutter_plugin_tools.dart \ + publish-check --pacakges camera_android_camerax +``` + +If this command fails, the code WAS NOT ready to push. +The required version bump and changelog entry must be made +and committed before code can be pushed. + +## 6. License Headers + +All source files in this repository must include +the standard copyright and license header. +Command to run: + +```bash +dart run script/tool/bin/flutter_plugin_tools.dart license-check --packages camera_android_camerax +``` + +If this command fails, the code WAS NOT ready to push. +Those license errors must be fixed and committed before code is pushed. + + +## 6. Non-mechanical Steps + +Before declaring the task complete, +verify the requirements for creating a pull request +in the flutter/packages repository are met: + +**What you MUST verify automatically:** +- **Documentation:** Check if the modified or newly added public APIs + include Dart doc comments (`///`). If not, the code IS NOT ready to + be pushed. +- **Tests:** Virtually all changes required a test see [Test Documentation](https://github.com/flutter/flutter/blob/master/docs/ecosystem/testing/Plugin-Tests.md). Evaluate the change against that testing rubric. Based on the rubric, if the change requires a test, give the user a quote from the testing documentation on what type of test is required for their changes. Beyond the rubric, if you think the change does not meet the documented quality bar, tell the user and only push if they approve the test coverage. + +# Take Action +First, explicitly state the final verdict to the user +at the very beginning of your response using a large heading: + +- If ANY step failed: Start your response with a clear + "# NO, you are not ready to push." + followed by a summary of what failed and what needs to be fixed. +- If ALL steps passed: Start your response with a clear + "# YES, you are ready to push!" + +Then, provide the developer with a brief summary +of what you verified automatically. For example, in the case of failure, if unit tests are failing, point to the exact tests and the exact errors. For example, in the case of success, if all tests passed, communicate that the code is ready to push because unit tests passed, the licenses look good, and all +required publishing steps have been completed. + +If the code is ready to push, provide them with the command to create the PR: + +```bash +gh pr create -t "TITLE" -b "BODY" +``` + +where + +- TITLE is the title of the PR that starts with the package name in brackets + (for example, `[camera_android] Fix crash` or `[camera_android, camera_android_camerax] Fix crash` if both `camera_android` and `camera_android_camerax` were modified). +- BODY is the PR description that should contain a link to at least one issue that is being fixed. From e641398ac037ee2b00ce2e61d899628af21417f0 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Tue, 23 Jun 2026 15:42:21 -0700 Subject: [PATCH 17/19] 80 chars --- .../.agents/skills/pre-push-skill/SKILL.md | 63 ++++++++++++++----- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md b/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md index 09bda3b068bc..3599e5f4d7ce 100644 --- a/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md +++ b/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md @@ -7,30 +7,38 @@ description: "Executes the required pre-push steps for the flutter/packages repo ## 1. Initial Clean Working Tree Check -The first step is ensuring that all changes are committed and there are no tracked files with lingering non committed state. Command to run: +The first step is ensuring that all changes are committed +and there are no tracked files with lingering non committed state. +Command to run: ```bash git status --porcelain ``` -If this command outputs anything, then there are uncommitted git changes, the code is not ready to push. +If this command outputs anything, +then there are uncommitted git changes. +The code is not ready to push. ## 2. Check for Changed Files You must verify that there are actually changed files to test. Command to run: -// TODO(camsim99): check this grep ```bash git diff --name-only main...HEAD | grep '^packages/camera/camera_android_camerax' ``` -If this command outputs nothing, then no relevant files were modified in this branch. -There is no code to push and you can skip all remaining validation steps. +If this command outputs nothing, +then no relevant files were modified in this branch. +There is no code to push, +and you can skip all remaining validation steps. ## 3. Check Merge Conflicts -Ensure the current branch is up to date with the main branch and has no merge conflicts. You can verify this by checking if the upstream `main` branch is an ancestor of your current `HEAD`. +Ensure the current branch is up to date with the main branch +and has no merge conflicts. +You can verify this by checking if the upstream `main` branch +is an ancestor of your current `HEAD`. Command to run: ```bash @@ -38,7 +46,11 @@ git fetch origin main git merge-base --is-ancestor origin/main HEAD ``` -If this command fails (exits with a non-zero code), the branch is behind `origin/main`. The code is NOT ready to push. The developer must pull the latest changes from `main` and resolve any merge conflicts before proceeding. +If this command fails (exits with a non-zero code), +the branch is behind `origin/main`. +The code is NOT ready to push. +The developer must pull the latest changes from `main` +and resolve any merge conflicts before proceeding. ## 4. Unit Tests @@ -52,10 +64,10 @@ dart run script/tool/bin/flutter_plugin_tools.dart \ dart-test --packages camera_android_camerax ``` -If this command fails, the code is likely not ready to push. The tests -might have been failing prior to any changes being made, so prompt the -user to review all found errors and fix the newly introduced failures -before pushing any code. +If this command fails, the code is likely not ready to push. +The tests might have been failing prior to any changes being made, +so prompt the user to review all found errors +and fix the newly introduced failures before pushing any code. ## 5. Publish Check (Version and CHANGELOG updates) @@ -97,7 +109,15 @@ in the flutter/packages repository are met: - **Documentation:** Check if the modified or newly added public APIs include Dart doc comments (`///`). If not, the code IS NOT ready to be pushed. -- **Tests:** Virtually all changes required a test see [Test Documentation](https://github.com/flutter/flutter/blob/master/docs/ecosystem/testing/Plugin-Tests.md). Evaluate the change against that testing rubric. Based on the rubric, if the change requires a test, give the user a quote from the testing documentation on what type of test is required for their changes. Beyond the rubric, if you think the change does not meet the documented quality bar, tell the user and only push if they approve the test coverage. +- **Tests:** Virtually all changes required a test. + See [Test Documentation](https://github.com/flutter/flutter/blob/master/docs/ecosystem/testing/Plugin-Tests.md). + Evaluate the change against that testing rubric. + Based on the rubric, if the change requires a test, + give the user a quote from the testing documentation + on what type of test is required for their changes. + Beyond the rubric, if you think the change does not meet + the documented quality bar, tell the user + and only push if they approve the test coverage. # Take Action First, explicitly state the final verdict to the user @@ -110,10 +130,16 @@ at the very beginning of your response using a large heading: "# YES, you are ready to push!" Then, provide the developer with a brief summary -of what you verified automatically. For example, in the case of failure, if unit tests are failing, point to the exact tests and the exact errors. For example, in the case of success, if all tests passed, communicate that the code is ready to push because unit tests passed, the licenses look good, and all -required publishing steps have been completed. +of what you verified automatically. +For example, in the case of failure, +if unit tests are failing, point to the exact tests and the exact errors. +For example, in the case of success, if all tests passed, +communicate that the code is ready to push +because unit tests passed, the licenses look good, +and all required publishing steps have been completed. -If the code is ready to push, provide them with the command to create the PR: +If the code is ready to push, +provide them with the command to create the PR: ```bash gh pr create -t "TITLE" -b "BODY" @@ -122,5 +148,8 @@ gh pr create -t "TITLE" -b "BODY" where - TITLE is the title of the PR that starts with the package name in brackets - (for example, `[camera_android] Fix crash` or `[camera_android, camera_android_camerax] Fix crash` if both `camera_android` and `camera_android_camerax` were modified). -- BODY is the PR description that should contain a link to at least one issue that is being fixed. + (for example, `[camera_android] Fix crash` + or `[camera_android, camera_android_camerax] Fix crash` + if both `camera_android` and `camera_android_camerax` were modified). +- BODY is the PR description that should contain a link + to at least one issue that is being fixed. From d4bd26aaa26ef861c725a5bead0f41a61e429c24 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Tue, 23 Jun 2026 15:55:47 -0700 Subject: [PATCH 18/19] nits about developer and sections + make sure commands run from root --- .../.agents/skills/pre-push-skill/SKILL.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md b/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md index 3599e5f4d7ce..fca69e5ba9f0 100644 --- a/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md +++ b/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md @@ -49,8 +49,8 @@ git merge-base --is-ancestor origin/main HEAD If this command fails (exits with a non-zero code), the branch is behind `origin/main`. The code is NOT ready to push. -The developer must pull the latest changes from `main` -and resolve any merge conflicts before proceeding. +The latest changes from `main` must be pulled first, +and then merge conflicts must be resolved. ## 4. Unit Tests @@ -60,6 +60,7 @@ All unit tests must pass before code can be merged. Command to run: ```bash +cd $(git rev-parse --show-toplevel) dart run script/tool/bin/flutter_plugin_tools.dart \ dart-test --packages camera_android_camerax ``` @@ -77,8 +78,9 @@ and add a corresponding entry describing the change in `CHANGELOG.md`. Command to run: ```bash +cd $(git rev-parse --show-toplevel) dart run script/tool/bin/flutter_plugin_tools.dart \ - publish-check --pacakges camera_android_camerax + publish-check --packages camera_android_camerax ``` If this command fails, the code WAS NOT ready to push. @@ -92,20 +94,19 @@ the standard copyright and license header. Command to run: ```bash +cd $(git rev-parse --show-toplevel) dart run script/tool/bin/flutter_plugin_tools.dart license-check --packages camera_android_camerax ``` If this command fails, the code WAS NOT ready to push. Those license errors must be fixed and committed before code is pushed. - ## 6. Non-mechanical Steps Before declaring the task complete, verify the requirements for creating a pull request in the flutter/packages repository are met: -**What you MUST verify automatically:** - **Documentation:** Check if the modified or newly added public APIs include Dart doc comments (`///`). If not, the code IS NOT ready to be pushed. @@ -129,7 +130,7 @@ at the very beginning of your response using a large heading: - If ALL steps passed: Start your response with a clear "# YES, you are ready to push!" -Then, provide the developer with a brief summary +Then, provide the user with a brief summary of what you verified automatically. For example, in the case of failure, if unit tests are failing, point to the exact tests and the exact errors. From b3cb4a44971354918d79b9ae31b6afe43e50cf37 Mon Sep 17 00:00:00 2001 From: Camille Simon Date: Tue, 23 Jun 2026 15:59:08 -0700 Subject: [PATCH 19/19] agent review --- .../.agents/skills/pre-push-skill/SKILL.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md b/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md index fca69e5ba9f0..7ac1ff123bc4 100644 --- a/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md +++ b/packages/camera/camera_android_camerax/.agents/skills/pre-push-skill/SKILL.md @@ -25,7 +25,8 @@ You must verify that there are actually changed files to test. Command to run: ```bash -git diff --name-only main...HEAD | grep '^packages/camera/camera_android_camerax' +git fetch origin main +git diff --name-only origin/main...HEAD | grep '^packages/camera/camera_android_camerax' ``` If this command outputs nothing, @@ -42,7 +43,6 @@ is an ancestor of your current `HEAD`. Command to run: ```bash -git fetch origin main git merge-base --is-ancestor origin/main HEAD ``` @@ -101,7 +101,7 @@ dart run script/tool/bin/flutter_plugin_tools.dart license-check --packages came If this command fails, the code WAS NOT ready to push. Those license errors must be fixed and committed before code is pushed. -## 6. Non-mechanical Steps +## 7. Check for Required Documentation and Tests Before declaring the task complete, verify the requirements for creating a pull request