feat(fix): auto-fix deprecated-tools-field by renaming tools: to allowed-tools: - #45
Conversation
…wed-tools: When the deprecated-tools-field warning fires (only the legacy tools: key is present, with no allowed-tools:), applyFixes now rewrites the key in place to allowed-tools:, preserving all list items, surrounding fields, and formatting. Block and inline YAML forms are both handled. Dry-run mode and notes output follow the same pattern as the other fix rules. Adds 6 tests covering block form, inline form, field preservation, dry run, no-op when the key is absent, and notes content.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34a03db5de
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Match only the `tools:` key line itself; leave indented list items alone. | ||
| const toolsKeyRe = /^([ \t]*)tools([ \t]*:)/m; | ||
| if (!toolsKeyRe.test(block)) return raw; | ||
| const newBlock = block.replace(toolsKeyRe, "$1allowed-tools$2"); |
There was a problem hiding this comment.
Serialize tools arrays before renaming
When a legacy tools: value is a YAML array (both block lists and [Read, Write], which LegacyToolsField accepts), this replacement leaves the value as a YAML sequence under allowed-tools:. The schema parses allowed-tools as a string-only field in src/schema.ts, so a file that previously only had a deprecated-tools-field warning is rewritten into one that fails frontmatter-schema on the next lint/run. The fixer should serialize array values to the allowed-tools string form instead of just replacing the key.
Useful? React with 👍 / 👎.
Why
--fixmode currently skips thedeprecated-tools-fieldwarning: when askill uses only the legacy
tools:key (instead of the spec-supportedallowed-tools:), runningskillcheck --fixdetects the problem but makesno change. Authors are left to rename the key by hand.
The rename is unambiguous and safe - it is the only correct resolution when
tools:is the sole tool-list key - so it qualifies for auto-fix.What
src/fix.ts: newdeprecated-tools-fieldbranch inapplyFixes; newhelper
rewriteFrontmatterRenameToolsToAllowedToolsthat rewrites thetools:key toallowed-tools:in place, preserving all list items,surrounding fields, and formatting. Handles both block and inline YAML
forms.
applyFixesdoc comment to listdeprecated-tools-fieldalongside the other supported fixes.
test/fix.test.ts: 6 new tests covering block form, inline form, fieldpreservation, dry run, no-op when the key is absent, and notes content.
Tests
npm test- 192 tests pass (186 existing + 6 new)npm run lint- cleannpm run build- cleanSelf-merge gate
Generated by Claude Code