Repository navigation
Conversation
Skill commands duplicated RegExp word, line, and 1.3x token counts, validate-skill read and parsed YAML configs twice via JSON round-trips, and logged SEVERE errors exited 0 while exit() skipped client cleanup. Extract shared RegExpMatchCount and StringMetrics extensions into text_metrics.dart, validate and construct SkillParams in a single YAML pass, allow --dry-run without GEMINI_API_KEY, and set exitCode on SEVERE and UsageException paths so finally always closes httpClient. Refs: flutter#267 (Gemini 4 generator follow-up) Tested: dart format, dart analyze --fatal-infos --fatal-warnings, dart test (126 passed)
There was a problem hiding this comment.
Code Review
This pull request enhances the Agent Skills generator tool by adding support for Gemini 3 and Gemini 4 models, introducing a new --thinking-level option, and refactoring thinking budget configuration and validation. It also improves YAML configuration parsing and validation, refactors text metrics calculations into a dedicated utility file, and refines content cleaning to safely strip code fences and frontmatter. The review feedback suggests further improving configuration validation by checking for duplicate skill names.
| bool validateYamlList(YamlList yamlList, String fileName) { | ||
| if (yamlList.isEmpty) { | ||
| logger.severe('Configuration list must not be empty.'); | ||
| return false; | ||
| } | ||
|
|
||
| var isValid = true; | ||
| final kabobCase = RegExp(r'^[a-z0-9]+(-[a-z0-9]+)*$'); | ||
|
|
There was a problem hiding this comment.
Consider validating that there are no duplicate skill names in the configuration file. We can define a Set<String> seenNames at the start of validateYamlList and track the names as we iterate through the list.
| bool validateYamlList(YamlList yamlList, String fileName) { | |
| if (yamlList.isEmpty) { | |
| logger.severe('Configuration list must not be empty.'); | |
| return false; | |
| } | |
| var isValid = true; | |
| final kabobCase = RegExp(r'^[a-z0-9]+(-[a-z0-9]+)*$'); | |
| bool validateYamlList(YamlList yamlList, String fileName) { | |
| if (yamlList.isEmpty) { | |
| logger.severe('Configuration list must not be empty.'); | |
| return false; | |
| } | |
| var isValid = true; | |
| final seenNames = <String>{}; |
There was a problem hiding this comment.
Duplicate skill names in YAML configuration files previously passed validation silently, causing subsequent commands to overwrite earlier SKILL.md files or emit duplicate README table rows. Track seen skill names in ValidateSkillCommand.validateYamlList and log a SEVERE error whenever a duplicate name appears. Refs: flutter#267 (Gemini 4 generator follow-up) Tested: dart format, dart analyze --fatal-infos --fatal-warnings, dart test (127 passed)
Naive indexOf('---') stripping truncated Markdown horizontal rules,
while MAX_TOKENS or frontmatter-only responses bypassed retry checks
and overwrote SKILL.md with incomplete or body-less output.
Parse leading YAML frontmatter via package:yaml (including camelCase
keys and block scalars), strip 3+/4-backtick outer fences, reject
non-STOP finishReason and empty cleaned bodies inside retry loops,
and add close() to release internally owned HTTP clients.
Refs: flutter#267 (Gemini 4 generator follow-up)
Tested: dart format, dart analyze --fatal-infos --fatal-warnings, dart test (125 passed)
Gemini 4 Carbon succeeds Argon as Google's strongest reasoning model at the same token cost, while bare --model IDs 404ed against v1beta and incompatible thinking parameters failed only after 3 HTTP retries. Set defaultModel to models/gemini-4-carbon alongside Neon, Argon, and Hydrogen constants, normalize bare model IDs, omit temperature on Gemini 3/4, and add --thinking-level with upfront model-compatibility validation across Gemini 4, Gemini 3, legacy, and tuned models. Refs: flutter#267 (Gemini 4 generator follow-up) Tested: dart format, dart analyze --fatal-infos --fatal-warnings, dart test (149 passed)
715d80c to
59349e0
Compare
Note
Stacked on #268 and #269 — once both land on
main, rebasing drops the base commits so only theGemini 4 Carbon/--thinking-levelcommit (59349e0) remains.Gemini 4 Carbon succeeds Argon as Google's strongest reasoning model at the same token cost, while bare
--modelIDs 404ed againstv1betaand incompatible thinking parameters failed only after 3 HTTP retries.Set
defaultModeltomodels/gemini-4-carbonalongsideNeon,Argon, andHydrogenconstants, normalize bare model IDs, omittemperatureon Gemini 3/4, and add--thinking-levelwith upfront model-compatibility validation across Gemini 4, Gemini 3, legacy, and tuned models.Refs: #267 (Gemini 4 generator follow-up, part 3 of 3)
Tested:
dart format,dart analyze --fatal-infos --fatal-warnings,dart test(150 passed)