Skip to content

Commit a743ac5

Browse files
[tool] Exempt AGENTS.md from version and changelog checks (flutter#12681)
This came up as part of flutter/packages#12668 which needed the labels. This pr excludes AGENTS.md from both pub publishing and from needing changelog/version requirements. - @reidbaker Agent authored description --- Exempts `AGENTS.md` from requiring CHANGELOG updates and version bumps in package validation, adds `AGENTS.md` as a package support file in repo tooling, and adds `AGENTS.md` to `.pubignore` in `camera_android_camerax`. ## Summary - **Repository Tooling**: - `script/tool/lib/src/common/package_state_utils.dart`: Added `pathComponents.last == 'AGENTS.md'` to `_isDevChange` so developer/agent guidelines in `AGENTS.md` do not trigger missing CHANGELOG or version bump errors. - `script/tool/lib/src/common/file_filters.dart`: Added `path.endsWith('/AGENTS.md')` to `isPackageSupportFile`. - `script/tool/CHANGELOG.md`: Added changelog entry under `## NEXT`. - **Package `.pubignore`**: - `packages/camera/camera_android_camerax/.pubignore`: Added `AGENTS.md` to prevent publishing agent guidelines to pub.dev. - **Tests**: - Added unit tests in `script/tool/test/common/package_state_utils_test.dart`, `script/tool/test/common/file_filters_test.dart`, and `script/tool/test/validate_command_version_test.dart`. ## Pre-Review Checklist
1 parent d642322 commit a743ac5

7 files changed

Lines changed: 39 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.agents/
2+
AGENTS.md
23
evals/

‎script/tool/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## NEXT
22

33
* Adds support for batch release of pre-1.0 packages.
4+
* Exempts `AGENTS.md` from requiring version and changelog changes.
45

56
## 0.14.4
67

‎script/tool/lib/src/common/file_filters.dart‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@ bool isPackageSupportFile(String path) {
5555
return path.endsWith('/AUTHORS') ||
5656
path.endsWith('/CHANGELOG.md') ||
5757
path.endsWith('/CONTRIBUTING.md') ||
58-
path.endsWith('/README.md');
58+
path.endsWith('/README.md') ||
59+
path.endsWith('/AGENTS.md');
5960
}

‎script/tool/lib/src/common/package_state_utils.dart‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ Future<bool> _isDevChange(
206206
pathComponents.first == 'run_tests.sh' ||
207207
// CONTRIBUTING.md is dev-facing.
208208
pathComponents.last == 'CONTRIBUTING.md' ||
209+
// AGENTS.md is dev/agent-facing.
210+
pathComponents.last == 'AGENTS.md' ||
209211
// The top-level "pending_changelogs" directory is the repo convention for storing
210212
// pending changelog files.
211213
pathComponents.first == 'pending_changelogs' ||

‎script/tool/test/common/file_filters_test.dart‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,19 @@ void main() {
3636
expect(isRepoLevelNonCodeImpactingFile('lib/main.dart'), isFalse);
3737
});
3838
});
39+
40+
group('isPackageSupportFile', () {
41+
test('returns true for known package support files', () {
42+
expect(isPackageSupportFile('packages/foo/AUTHORS'), isTrue);
43+
expect(isPackageSupportFile('packages/foo/CHANGELOG.md'), isTrue);
44+
expect(isPackageSupportFile('packages/foo/CONTRIBUTING.md'), isTrue);
45+
expect(isPackageSupportFile('packages/foo/README.md'), isTrue);
46+
expect(isPackageSupportFile('packages/foo/AGENTS.md'), isTrue);
47+
});
48+
49+
test('returns false for other files', () {
50+
expect(isPackageSupportFile('packages/foo/pubspec.yaml'), isFalse);
51+
expect(isPackageSupportFile('packages/foo/lib/main.dart'), isFalse);
52+
});
53+
});
3954
}

‎script/tool/test/common/package_state_utils_test.dart‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ void main() {
5757
'packages/a_plugin/CHANGELOG.md',
5858
// Dev-facing docs.
5959
'packages/a_plugin/CONTRIBUTING.md',
60+
'packages/a_plugin/AGENTS.md',
6061
// Analysis.
6162
'packages/a_plugin/example/android/lint-baseline.xml',
6263
// Tests.
@@ -133,6 +134,22 @@ void main() {
133134
expect(state.needsChangelogChange, false);
134135
});
135136

137+
test('does not require version or changelog change for AGENTS.md changes', () async {
138+
final RepositoryPackage package = createFakePlugin('a_plugin', packagesDir);
139+
140+
const changedFiles = <String>['packages/a_plugin/AGENTS.md'];
141+
142+
final PackageChangeState state = await checkPackageChangeState(
143+
package,
144+
changedPaths: changedFiles,
145+
relativePackagePath: 'packages/a_plugin/',
146+
);
147+
148+
expect(state.hasChanges, true);
149+
expect(state.needsVersionChange, false);
150+
expect(state.needsChangelogChange, false);
151+
});
152+
136153
test('only considers a root "tool" folder to be special', () async {
137154
final RepositoryPackage package = createFakePlugin('a_plugin', packagesDir);
138155

‎script/tool/test/validate_command_version_test.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,7 @@ packages/plugin/example/ios/RunnerTests/Foo.m
982982
packages/plugin/example/ios/RunnerUITests/info.plist
983983
packages/plugin/darwin/Tests/Foo.swift
984984
packages/plugin/analysis_options.yaml
985+
packages/plugin/AGENTS.md
985986
packages/plugin/CHANGELOG.md
986987
''',
987988
),

0 commit comments

Comments
 (0)