Repository navigation
fix(import): keep rule scopes, split hook matchers, keep UTF-8 text - #490
Merged
Merged
Conversation
Three ways importing another tool's settings changed their meaning: - Permission rules lost their scope: an allow for `Bash(npm test)` became `bash = allow`, auto-running every shell command, and a deny for `Read(./.env)` denied every read. Scoped rules now map to the scoped keys core already understands (`bash(npm test)`, `read(./.env)`); a scope on a tool without scoped rules is reported as not mapped instead of widened. - Hook matchers are regexes. `Edit|Write` became one tool name that never matched, so the hook was silently dead. Alternatives now become one hook each, `.*` suffixes become `*`, and any other regex syntax is reported as skipped. - strip_jsonc pushed each UTF-8 byte as a char, so every non-ASCII string (paths with `Çağrı`, for one) came out garbled. It now copies bytes, and also drops a trailing comma that a comment separates from the closing bracket. Co-Authored-By: Claude Opus 5.5 <[email protected]>
mrnasil
enabled auto-merge (squash)
November 25, 2026 15:00
Merged
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.
Importing another tool's settings could change what they meant in three ways.
Permission scopes were dropped. An allow for
Bash(npm test)becamebash = allow, which auto-runs every shell command. A deny forRead(./.env)became a deny on every read. Scoped rules now map to the scoped keys core already understands (bash(npm test),read(./.env),edit(src/**)). A scope on a tool that has no scoped rules (WebFetch(domain:…)) is reported as not mapped instead of being widened.Read(*)still maps to plainread.Hook matchers are regexes.
Edit|Writebecame one tool name that never matched anything, so the hook was silently dead. Each alternative now becomes its own hook, and duplicates are removed (Edit|Write|MultiEditgives oneedithook). A trailing.*becomes*, and an empty matcher or*matches every tool. Any other regex syntax is reported as skipped instead of producing a hook that never fires.Non-ASCII text was garbled.
strip_jsoncpushed each UTF-8 byte as achar, so a path likeC:/Users/Çağrı/x.pywas imported garbled, and the imported MCP server or hook failed to start. It now copies bytes. It also drops a trailing comma when a comment sits between it and the closing bracket.Tests: each case has a test, and two existing assertions that encoded the widening were updated.
parse.rshas 100% line coverage.🤖 Generated with Claude Code