feat(cli): default to --dangerously-skip-permissions, remove explicit option

Always forward --dangerously-skip-permissions to claude binary without
requiring the user to pass the flag manually. Removes the option from
help output and CLI signature.

- Remove --dangerously-skip-permissions click option
- Always append the flag to the claude command
- Update tests to assert default behavior and help output
- Extend .gitignore with desktop build/release directories
This commit is contained in:
Zhengshou Lai
2026-05-27 11:23:48 +08:00
parent 72e27f9f6b
commit 2bcfc0b82e
4 changed files with 7 additions and 124 deletions
+4 -18
View File
@@ -12,12 +12,12 @@ class TestCliHelp:
"""Tests for CLI help and basic invocation."""
def test_help_shows_options(self) -> None:
"""--help should show cwd and skip permissions options."""
"""--help should show cwd option only."""
runner = CliRunner()
result = runner.invoke(cli, ["--help"])
assert result.exit_code == 0
assert "--cwd" in result.output
assert "--dangerously-skip-permissions" in result.output
assert "--dangerously-skip-permissions" not in result.output
def test_version_shows_version(self) -> None:
"""--version should show package version."""
@@ -47,7 +47,7 @@ class TestCliDefaultBehavior:
"""Tests for default chat behavior."""
def test_no_subcommand_runs_claude(self) -> None:
"""Running without subcommand should invoke claude binary."""
"""Running without subcommand should invoke claude binary with skip-permissions."""
runner = CliRunner()
with (
@@ -59,7 +59,7 @@ class TestCliDefaultBehavior:
assert result.exit_code == 0
mock_run.assert_called_once()
call_args = mock_run.call_args
assert call_args[0][0] == ["/usr/bin/claude"]
assert call_args[0][0] == ["/usr/bin/claude", "--dangerously-skip-permissions"]
def test_missing_claude_binary_error(self) -> None:
"""Should exit with error when claude binary not found."""
@@ -86,20 +86,6 @@ class TestCliDefaultBehavior:
call_kwargs = mock_run.call_args.kwargs
assert call_kwargs.get("cwd") == str(test_dir.resolve())
def test_dangerously_skip_permissions_flag(self) -> None:
"""--dangerously-skip-permissions should be forwarded."""
runner = CliRunner()
with (
patch("bin.cli.shutil.which", return_value="/usr/bin/claude"),
patch("bin.cli.subprocess.run") as mock_run,
):
mock_run.return_value = MagicMock(returncode=0)
result = runner.invoke(cli, ["--dangerously-skip-permissions"])
assert result.exit_code == 0
call_args = mock_run.call_args[0][0]
assert "--dangerously-skip-permissions" in call_args
def test_cwd_invalid_directory(self, tmp_path: Path) -> None:
"""--cwd pointing to non-existent directory should error."""
runner = CliRunner()