diff --git a/.claude/settings.json b/.claude/settings.json index 4090b14..8397773 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -11,6 +11,8 @@ "Bash(git branch *)", "Bash(git checkout *)", "Bash(git status *)", "Bash(git diff *)", "Bash(git log *)", "Bash(git show *)", "Bash(git merge *)", "Bash(git stash *)", + "Bash(git restore *)", "Bash(git reset *)", "Bash(git rm *)", + "Bash(git mv *)", "Bash(git worktree *)", "Bash(git remote *)", "Bash(git submodule *)", "Bash(git tag *)", "Bash(git switch *)", "Bash(git rev-parse *)", "Bash(git cherry-pick *)", "Bash(git blame *)", "Bash(git reflog *)", "Bash(git ls-files *)", @@ -41,8 +43,7 @@ "Bash(gh workflow enable *)", "Bash(gh workflow disable *)", "Bash(gh issue create *)", "Bash(gh issue comment *)", "Bash(gh issue close *)", "Bash(gh issue edit *)", - "Bash(git reset *)", "Bash(git init *)", "Bash(git clone *)", - "Bash(git rm *)", "Bash(git mv *)", "Bash(git restore *)", "Bash(git worktree *)", + "Bash(git init *)", "Bash(git clone *)", "Bash(uv remove *)", "Bash(uv cache *)", "Bash(uv init *)", "WebFetch" ] diff --git a/tests/test_permissions.py b/tests/test_permissions.py index 683e466..00ed40e 100644 --- a/tests/test_permissions.py +++ b/tests/test_permissions.py @@ -328,17 +328,21 @@ def test_pr_merge_requires_confirmation(self, settings: dict[str, Any]) -> None: def test_workflow_run_requires_confirmation(self, settings: dict[str, Any]) -> None: assert evaluate("Bash(gh workflow run deploy.yml)", settings) == "ask" - def test_git_reset_requires_confirmation(self, settings: dict[str, Any]) -> None: - assert evaluate("Bash(git reset --hard HEAD~1)", settings) == "ask" - assert evaluate("Bash(git reset HEAD file.py)", settings) == "ask" + def test_git_reset_is_allowed(self, settings: dict[str, Any]) -> None: + assert evaluate("Bash(git reset --hard HEAD~1)", settings) == "allow" + assert evaluate("Bash(git reset HEAD file.py)", settings) == "allow" - def test_git_destructive_operations_require_confirmation(self, settings: dict[str, Any]) -> None: - for cmd in ["git init", "git clone https://github.com/repo", "git rm file.py", "git mv a.py b.py"]: + def test_git_init_clone_require_confirmation(self, settings: dict[str, Any]) -> None: + for cmd in ["git init", "git clone https://github.com/repo"]: assert evaluate(f"Bash({cmd})", settings) == "ask", f"{cmd} should require confirmation" - def test_git_restore_requires_confirmation(self, settings: dict[str, Any]) -> None: - assert evaluate("Bash(git restore file.py)", settings) == "ask" - assert evaluate("Bash(git restore --staged file.py)", settings) == "ask" + def test_git_rm_mv_are_allowed(self, settings: dict[str, Any]) -> None: + for cmd in ["git rm file.py", "git mv a.py b.py"]: + assert evaluate(f"Bash({cmd})", settings) == "allow", f"{cmd} should be allowed" + + def test_git_restore_is_allowed(self, settings: dict[str, Any]) -> None: + assert evaluate("Bash(git restore file.py)", settings) == "allow" + assert evaluate("Bash(git restore --staged file.py)", settings) == "allow" def test_gh_issue_mutations_require_confirmation(self, settings: dict[str, Any]) -> None: for cmd in [ @@ -359,8 +363,8 @@ def test_gh_workflow_enable_disable_requires_confirmation(self, settings: dict[s assert evaluate("Bash(gh workflow enable deploy.yml)", settings) == "ask" assert evaluate("Bash(gh workflow disable deploy.yml)", settings) == "ask" - def test_git_worktree_requires_confirmation(self, settings: dict[str, Any]) -> None: - assert evaluate("Bash(git worktree add ../feature)", settings) == "ask" + def test_git_worktree_is_allowed(self, settings: dict[str, Any]) -> None: + assert evaluate("Bash(git worktree add ../feature)", settings) == "allow" def test_uv_init_requires_confirmation(self, settings: dict[str, Any]) -> None: assert evaluate("Bash(uv init my-project)", settings) == "ask"