-
Notifications
You must be signed in to change notification settings - Fork 390
Add dart_skills_lint to devtools and configure it to run in the cli and in tests #9770
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
base: master
Are you sure you want to change the base?
Changes from all commits
2661c38
fed7a84
9c290a1
eb5547b
92e8b56
cbc4b02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <!-- | ||
| Copyright 2026 The Flutter Authors | ||
| Use of this source code is governed by a BSD-style license that can be | ||
| found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. | ||
| --> | ||
|
|
||
| # Agent Skills | ||
|
|
||
| This directory contains AI agent skills for this repository. | ||
|
|
||
| ## Validation | ||
|
|
||
| To ensure skills meet the required specification, they are automatically validated in pre-submit checks. | ||
| You should also validate your skills locally before submitting a review. | ||
|
|
||
| ### Running the Linter Locally | ||
|
|
||
| To validate skills locally before review, run the linter from the root of the repository: | ||
|
|
||
| ```bash | ||
| dart run dart_skills_lint:cli | ||
| ``` | ||
|
|
||
| This will use the configuration in `dart_skills_lint.yaml` to validate all skills in the `.agents/skills` directory. | ||
|
|
||
| Or for a single skill: | ||
|
|
||
| ```bash | ||
| dart run dart_skills_lint:cli --skill .agents/skills/my-skill | ||
| ``` | ||
|
|
||
| ### Running via Dart Test | ||
|
|
||
| Alternatively, you can run the validation as a test from the `tool` directory: | ||
|
|
||
| ```bash | ||
| cd tool && dart test test/validate_skills_test.dart | ||
| ``` | ||
|
|
||
| This ensures that the validation logic is executed in the same way as in CI. | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are required because of flutter/skills#83 which will be addressed by flutter/skills#84
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now that this has been merged, can we update this PR? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "skills": { | ||
| "adding-release-notes": [ | ||
| { | ||
| "rule_id": "check-relative-paths", | ||
| "file_name": "SKILL.md" | ||
| } | ||
| ], | ||
| "preparing-pr": [ | ||
| { | ||
| "rule_id": "check-relative-paths", | ||
| "file_name": "SKILL.md" | ||
| } | ||
| ] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Copyright 2026 The Flutter Authors | ||
| # Use of this source code is governed by a BSD-style license that can be | ||
| # found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. | ||
| dart_skills_lint: | ||
| rules: | ||
| check-relative-paths: error | ||
| check-absolute-paths: error | ||
| check-trailing-whitespace: error | ||
| directories: | ||
| - path: ".agents/skills" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -15,3 +15,9 @@ workspace: | |||||
| dev_dependencies: | ||||||
| build_runner: ^2.5.4 | ||||||
| flutter_lints: ^5.0.0 | ||||||
| # Update to published version tracked in https://github.com/flutter/devtools/issues/9771 | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| dart_skills_lint: | ||||||
|
reidbaker marked this conversation as resolved.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need the dep here and in tool/pubspec.yaml? |
||||||
| git: | ||||||
| url: https://github.com/flutter/skills | ||||||
| path: tool/dart_skills_lint | ||||||
| ref: 9eff6bbcfa27c2724ea9ad67a611c19fe77057ea | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -21,6 +21,13 @@ dependencies: | |||||
| meta: ^1.18.0 | ||||||
| path: ^1.9.0 | ||||||
| yaml: ^3.1.2 | ||||||
|
|
||||||
| dev_dependencies: | ||||||
| # Update to published version tracked in https://github.com/flutter/devtools/issues/9771 | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| dart_skills_lint: | ||||||
| git: | ||||||
| url: https://github.com/flutter/skills | ||||||
| path: tool/dart_skills_lint | ||||||
| ref: 9eff6bbcfa27c2724ea9ad67a611c19fe77057ea | ||||||
| logging: ^1.1.1 | ||||||
| test: ^1.25.8 | ||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,35 @@ | ||||||||||
| // Copyright 2026 The Flutter Authors | ||||||||||
| // Use of this source code is governed by a BSD-style license that can be | ||||||||||
| // found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. | ||||||||||
|
|
||||||||||
| import 'dart:async'; | ||||||||||
|
reidbaker marked this conversation as resolved.
|
||||||||||
| import 'package:dart_skills_lint/dart_skills_lint.dart'; | ||||||||||
| import 'package:logging/logging.dart'; | ||||||||||
| import 'package:test/test.dart'; | ||||||||||
|
|
||||||||||
| void main() { | ||||||||||
| test('Validate DevTools Skills', () async { | ||||||||||
| final Level oldLevel = Logger.root.level; | ||||||||||
| Logger.root.level = Level.ALL; | ||||||||||
| final StreamSubscription<LogRecord> subscription = Logger.root.onRecord.listen((record) { | ||||||||||
| print(record.message); | ||||||||||
| }); | ||||||||||
|
|
||||||||||
| try { | ||||||||||
| // Update test to use dart_skills_lint.yaml for config when available. | ||||||||||
| // See https://github.com/flutter/skills/issues/85. | ||||||||||
|
Comment on lines
+19
to
+20
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| final bool isValid = await validateSkills( | ||||||||||
| skillDirPaths: ['../.agents/skills'], | ||||||||||
| resolvedRules: { | ||||||||||
| 'check-relative-paths': AnalysisSeverity.error, | ||||||||||
| 'check-absolute-paths': AnalysisSeverity.error, | ||||||||||
| 'check-trailing-whitespace': AnalysisSeverity.error, | ||||||||||
|
reidbaker marked this conversation as resolved.
|
||||||||||
| }, | ||||||||||
| ); | ||||||||||
| expect(isValid, isTrue, reason: 'Skills validation failed. See above for details.'); | ||||||||||
| } finally { | ||||||||||
| Logger.root.level = oldLevel; | ||||||||||
| await subscription.cancel(); | ||||||||||
| } | ||||||||||
| }); | ||||||||||
| } | ||||||||||
Uh oh!
There was an error while loading. Please reload this page.