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)
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the Agent Skills CLI tool to improve YAML parsing, validation, and text metrics. It introduces a centralized text_metrics.dart utility for efficient word, line, and token count calculations, replaces direct exit() calls with exitCode assignments, and ensures proper cleanup of logging subscriptions. It also enhances YAML validation by checking types and required fields via SkillParams.fromYamlMap, refactors regular expressions into static constants, and updates command-line options to support dry runs without an API key. I have no feedback to provide on this pull request.
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)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Skill commands duplicated
RegExpword, line, and1.3xtoken counts,validate-skillread and parsed YAML configs twice via JSON round-trips, and loggedSEVEREerrors exited0whileexit()skipped HTTP client cleanup.Extract shared
RegExpMatchCountandStringMetricsextensions intotext_metrics.dart(with documented1.3subword token estimation and zero-allocation line counting), validate and constructSkillParamsin a single YAML pass, allow--dry-runwithoutGEMINI_API_KEY, and setexitCodeonSEVEREandUsageExceptionpaths sofinallyalways closeshttpClient.Refs: #267 (Gemini 4 generator follow-up, part 1 of 3)
Tested:
dart format,dart analyze --fatal-infos --fatal-warnings,dart test(126 passed)