Repository navigation
Conversation
|
nice! |
GillMacedo
left a comment
There was a problem hiding this comment.
Thanks for adding Read and Edit support. One fix is needed before this can merge.
Lint now reports Bash allow rules as shadowed by Read and Edit deny rules. Read and Edit rules used to get pattern=None. Now they get a real pattern, but the PW007 check in lint() still checks every deny rule against Bash allow patterns (other.kind == "deny" and other.pattern and pattern_matches(...)). To reproduce: put Bash(git status) in allow and Read(*) in deny, then run lint. It reports PW007 Shadowed by deny rule Read(*), which is wrong, because a Read rule can't block a Bash command. To fix it, skip other rules with other.tool != "Bash" in that loop, and add a test for this case.
Smaller points you can fix in the same commit: the Read and Edit explanations say "Every subcommand matches an allow rule" or "A subcommand matches...", and they should talk about the file path. The README also needs a blank line before Which rules have problems?.
What passed: make test (75 tests). explain --tool Read src/main.py against examples/settings.json returns ALLOW with Read(src/**). --tool Write exits with code 2 and a usage error. Bash explain still behaves as before.
— Giulliano
Issue
Closes #2
What changed
Read(...)andEdit(...)permission rules.--tooloption while keepingBashas the default.Credit
Continued from the initial implementation shared by @Mohammadjavadfakhri in the
feat/explain-read-edit-rulesbranch, with additional verification and documentation updates.Validation
python -m pytest -q— 75 passed, 3 subtests passed.git diff --check— no whitespace errors.