-
Notifications
You must be signed in to change notification settings - Fork 154
Add configutation files for Claude Code plugin definition #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
keertip
wants to merge
7
commits into
flutter:main
Choose a base branch
from
keertip:test-sync-workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
26465f2
test: add sync workflow and dart tool script
keertip 988cb49
chore: auto-sync skills directory from dart-lang/skills
keertip 8c011ce
Merge pull request #1 from keertip/automation/sync-dart-skills
keertip bdf5159
Update workflow to support trigger from dart-lang/skills
keertip af41da9
Update repo name
keertip 5501fca
Applied suggestions
keertip f5e0395
Merge branch 'main' into test-sync-workflow
keertip File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "name": "dart-flutter", | ||
| "owner": { | ||
| "name": "Dart and Flutter Team", | ||
| "email": "stores@flutter.io" | ||
| }, | ||
| "description": "Official Claude Marketplace for Dart and Flutter plugins", | ||
| "plugins": [ | ||
| { | ||
| "name": "dart-flutter", | ||
| "description": "The official Claude plugin for Dart and Flutter that installs Flutter/Dart Skills and Dart MCP server for building natively compiled, visually stunning applications for mobile, web, desktop, and embedded devices from a single codebase", | ||
| "category": "development", | ||
| "tags": [ | ||
| "dart", | ||
| "flutter", | ||
| "mobile" | ||
| ], | ||
| "source": "./" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "name": "dart-flutter", | ||
| "displayName": "Dart and Flutter", | ||
| "version": "1.0.0", | ||
| "description": "Official Claude plugin for Dart and Flutter that installs Flutter/Dart Skills and Dart MCP server for building natively compiled, visually stunning applications for mobile, web, desktop, and embedded devices from a single codebase", | ||
| "author": { | ||
| "name": "Dart and Flutter", | ||
| "url": "https://flutter.dev" | ||
| }, | ||
| "homepage": "https://github.com/flutter/agent-plugins", | ||
| "repository": "https://github.com/flutter/agent-plugins", | ||
| "license": "BSD-3-Clause", | ||
| "keywords": [ | ||
| "flutter", | ||
| "dart", | ||
| "mobile" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| name: Sync Skills Directory via Git Hash (Dart) | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 0 * * *' # Keep the daily check as a fallback safety net | ||
| workflow_dispatch: # Keep manual run capability | ||
| repository_dispatch: | ||
| types: [dart-skills-updated] # Listen for this custom ping | ||
| jobs: | ||
| sync: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout Flutter Skills (Destination) | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| # Falls back to the default GITHUB_TOKEN if SYNC_PAT is not defined | ||
| token: ${{ secrets.SYNC_PAT || github.token }} | ||
| path: dest_repo | ||
|
|
||
| - name: Checkout Dart Skills (Source) | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: dart-lang/skills | ||
| fetch-depth: 50 | ||
| path: src_repo | ||
|
|
||
| - name: Setup Dart Environment | ||
| uses: dart-lang/setup-dart@v1 | ||
| with: | ||
| sdk: stable | ||
|
|
||
| - name: Execute Dart Sync Engine | ||
| id: sync_engine | ||
| # Continue on error so we can check if it exited early via code 10 | ||
| continue-on-error: true | ||
| run: | | ||
| cd dest_repo | ||
| # Run our compiled-on-the-fly Dart script | ||
| dart run tool/sync_skills.dart ../src_repo skills | ||
| EXIT_CODE=$? | ||
|
|
||
| if [ $EXIT_CODE -eq 0 ]; then | ||
| echo "changes_detected=true" >> $GITHUB_OUTPUT | ||
| elif [ $EXIT_CODE -eq 10 ]; then | ||
| echo "changes_detected=false" >> $GITHUB_OUTPUT | ||
| echo "✅ Dart script signaled NO changes were found. Stopping workflow." | ||
| else | ||
| echo "❌ Dart script failed with error code $EXIT_CODE" | ||
| exit $EXIT_CODE | ||
| fi | ||
|
|
||
| - name: Create Pull Request | ||
| if: steps.sync_engine.outputs.changes_detected == 'true' | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| token: ${{ secrets.SYNC_PAT || github.token }} | ||
| path: dest_repo | ||
| branch: automation/sync-dart-skills | ||
| title: "🤖 chore: sync skills directory from dart-lang/skills" | ||
| commit-message: "chore: auto-sync skills directory from dart-lang/skills" | ||
| body: | | ||
| ### 🤖 Automated Skills Sync & Version Bump (Dart Powered) | ||
| This is an automated pull request to sync the contents of the `skills/` directory from [dart-lang/skills](https://github.com/dart-lang/skills). | ||
|
|
||
| This run used a state-tracked Git hash (`.dart_skills_githash`) computed directly by our custom **Dart synchronization utility** (`tool/sync_skills.dart`). | ||
|
|
||
| ### 🛠️ Changes Performed: | ||
| * **Preserved:** All native `flutter/*` skills in the repository remain unchanged. | ||
| * **Synced:** All new, modified, or deleted files inside `dart-lang/skills` have been carried over. | ||
| * **Bumped:** Automatically incremented the plugin version field in `.claude-plugin/plugin.json` to keep integrations updated. | ||
| labels: | | ||
| automated-pr | ||
| sync | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "mcpServers": { | ||
| "dart-mcp-server": { | ||
| "command": "dart", | ||
| "args": [ | ||
| "mcp-server" | ||
| ], | ||
| "env": {} | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| --- | ||
| name: dart-add-unit-test | ||
| description: Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains correct and regression-free. | ||
| metadata: | ||
| model: models/gemini-3.1-pro-preview | ||
| last_modified: Fri, 24 Apr 2026 15:07:58 GMT | ||
| --- | ||
| # Testing Dart and Flutter Applications | ||
|
|
||
| ## Contents | ||
| - [Structuring Test Files](#structuring-test-files) | ||
| - [Writing Tests](#writing-tests) | ||
| - [Executing Tests](#executing-tests) | ||
| - [Test Implementation Workflow](#test-implementation-workflow) | ||
| - [Examples](#examples) | ||
|
|
||
| ## Structuring Test Files | ||
| Organize test files to mirror the `lib` directory structure to maintain predictability. | ||
|
|
||
| * Place all test code within the `test` directory at the root of the package. | ||
| * Append `_test.dart` to the end of all test file names (e.g., `lib/src/utils.dart` should be tested in `test/src/utils_test.dart`). | ||
| * If writing integration tests, place them in an `integration_test` directory at the root of the package. | ||
|
|
||
| ## Writing Tests | ||
| Utilize `package:test` as the standard testing library for Dart applications. | ||
|
|
||
| * Import `package:test/test.dart` (or `package:flutter_test/flutter_test.dart` for Flutter). | ||
| * Group related tests using the `group()` function to provide shared context. | ||
| * Define individual test cases using the `test()` function. | ||
| * Validate outcomes using the `expect()` function alongside matchers (e.g., `equals()`, `isTrue`, `throwsA()`). | ||
| * Write asynchronous tests using standard `async`/`await` syntax. The test runner automatically waits for the `Future` to complete. | ||
| * Manage test setup and teardown using `setUp()` and `tearDown()` callbacks. | ||
| * If testing code that relies on dependency injection, use `package:mockito` alongside `package:test` to generate mock objects, configure fixed scenarios, and verify interactions. | ||
|
|
||
| ## Executing Tests | ||
| Select the appropriate test runner based on the project type and test location. | ||
|
|
||
| * If working on a pure Dart project, execute tests using the `dart test` command. | ||
| * If working on a Flutter project, execute tests using the `flutter test` command. | ||
| * If running integration tests, explicitly specify the directory path, as the default runner ignores it: `dart test integration_test` or `flutter test integration_test`. | ||
|
|
||
| ## Test Implementation Workflow | ||
|
|
||
| Follow this sequential workflow when implementing new test suites. Copy the checklist to track your progress. | ||
|
|
||
| ### Task Progress | ||
| - [ ] 1. Create the test file in the `test/` directory, ensuring the `_test.dart` suffix. | ||
| - [ ] 2. Import `package:test/test.dart` and the target library. | ||
| - [ ] 3. Define a `main()` function. | ||
| - [ ] 4. Initialize shared resources or mocks using `setUp()`. | ||
| - [ ] 5. Write `test()` cases grouped by functionality using `group()`. | ||
| - [ ] 6. Execute the test suite using the appropriate CLI command. | ||
| - [ ] 7. **Feedback Loop**: Run test -> Review stack trace for failures -> Fix implementation or assertions -> Re-run until passing. | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Standard Unit Test Suite | ||
| Demonstrates grouping, setup, synchronous, and asynchronous testing. | ||
|
|
||
| ```dart | ||
| import 'package:test/test.dart'; | ||
| import 'package:my_package/calculator.dart'; | ||
| void main() { | ||
| group('Calculator', () { | ||
| late Calculator calc; | ||
| setUp(() { | ||
| calc = Calculator(); | ||
| }); | ||
| test('adds two numbers correctly', () { | ||
| expect(calc.add(2, 3), equals(5)); | ||
| }); | ||
| test('handles asynchronous operations', () async { | ||
| final result = await calc.fetchRemoteValue(); | ||
| expect(result, isNotNull); | ||
| expect(result, greaterThan(0)); | ||
| }); | ||
| }); | ||
| } | ||
| ``` | ||
|
|
||
| ### Mocking with Mockito | ||
| Demonstrates configuring a mock object for dependency injection testing. | ||
|
|
||
| ```dart | ||
| import 'package:test/test.dart'; | ||
| import 'package:mockito/mockito.dart'; | ||
| import 'package:mockito/annotations.dart'; | ||
| import 'package:my_package/api_client.dart'; | ||
| import 'package:my_package/data_service.dart'; | ||
| // Generate the mock using build_runner: dart run build_runner build | ||
| @GenerateNiceMocks([MockSpec<ApiClient>()]) | ||
| import 'data_service_test.mocks.dart'; | ||
| void main() { | ||
| group('DataService', () { | ||
| late MockApiClient mockApiClient; | ||
| late DataService dataService; | ||
| setUp(() { | ||
| mockApiClient = MockApiClient(); | ||
| dataService = DataService(apiClient: mockApiClient); | ||
| }); | ||
| test('returns parsed data on successful API call', () async { | ||
| // Configure the mock | ||
| when(mockApiClient.get('/data')).thenAnswer((_) async => '{"id": 1}'); | ||
| // Execute the system under test | ||
| final result = await dataService.fetchData(); | ||
| // Verify outcomes and interactions | ||
| expect(result.id, equals(1)); | ||
| verify(mockApiClient.get('/data')).called(1); | ||
| }); | ||
| }); | ||
| } | ||
| ``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silent Failure Bug
GitHub Actions run bash scripts with
set -eby default. Ifdart runexits with10(no changes) or1(real error), the bash script will immediately terminate on this line. It will never executeEXIT_CODE=$?or theif/elseblock below it.Because
continue-on-error: trueis set on the step, the step will still be marked as green,changes_detectedwon't be set, and the PR creation step will be skipped. This means real errors (exit code 1) will be silently swallowed and ignored.The Fix: Remove
continue-on-error: trueand handle the exit code directly soset -edoesn't abort the script. For example: