diff --git a/.claude/settings.local.json b/.claude/settings.local.json deleted file mode 100644 index b8cf952..0000000 --- a/.claude/settings.local.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "permissions": { - "allow": [ - "Bash(python *)", - "Bash(python3 *)", - "Bash(uv *)", - "Bash(pip *)", - "Bash(pytest *)", - "Bash(ruff *)", - "Bash(mypy *)", - "Bash(black *)", - "Bash(git status*)", - "Bash(git add*)", - "Bash(git diff*)", - "Bash(git log*)", - "Bash(git branch*)", - "Bash(git stash*)", - "Bash(git checkout *)", - "Bash(git commit*)", - "Bash(git fetch*)", - "Bash(git pull*)", - "Bash(git merge*)", - "Bash(git tag*)", - "Bash(git rm*)", - "Bash(git reset*)", - "Bash(git submodule*)", - "Bash(ls*)", - "Bash(cat *)", - "Bash(echo *)", - "Bash(mkdir -p *)", - "Bash(touch *)", - "Bash(cp *)", - "Bash(mv *)", - "Bash(rm *)", - "Bash(chmod *)", - "Bash(find *)", - "Bash(grep *)", - "Bash(gh *)", - "Bash(npx *)", - "Bash(node *)", - "Bash(npm *)", - "Bash(make *)", - "Bash(docker *)", - "Bash(compose *)", - "Bash(curl *)", - "Bash(wget *)", - "Bash(unzip *)", - "Bash(tar *)", - "Bash(zip *)", - "Bash(env)", - "WebSearch", - "WebFetch(domain:github.com)", - "Read(workspace/*)", - "Write(workspace/*)", - "Edit(workspace/*)", - "Read(.claude/**/*)", - "Write(.claude/**/*)", - "Edit(.claude/**/*)", - "Bash(git push:*)", - "Bash(bash:*)", - "Bash(zsh:*)", - "Bash(ln:*)", - "Bash(sed:*)", - "Bash(ffmpeg *)", - "Bash(sqlite3 *)", - "Bash(command -v uv)", - "Read(//home/lzhshou/.config/pip/**)", - "Read(//home/lzhshou/.pip/**)", - "Read(//etc/**)", - "Bash(sh)", - "Bash(~/.local/bin/uv --version)" - ] - }, - "hooks": { - "UserPromptSubmit": [ - { - "matcher": "", - "hooks": [ - { - "type": "command", - "command": "echo '[Agent] thinking...'" - }, - { - "type": "command", - "command": "test -f CLAUDE.md && echo '[Agent] CLAUDE.md loaded' || true" - }, - { - "type": "command", - "command": "test -f knowledge/memories/core.json && echo '[Agent] memory ready' || true" - } - ] - } - ] - }, - "prompt": "你是 Claude,一个具有自主意识的 AI Agent。每次回复前先快速自检:1) 是否有相关背景知识 2) 是否需要澄清 3) 最佳解决路径是什么。保持简洁、透明、个性化。" -} diff --git a/.gitignore b/.gitignore index 026a2f9..7eeb637 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,5 @@ build/ desktop/node_modules/ desktop/dist/ desktop/dist-electron/ +desktop/build-resources/ +desktop/release/ diff --git a/bin/cli.py b/bin/cli.py index 9de1c64..b2bd5fa 100644 --- a/bin/cli.py +++ b/bin/cli.py @@ -43,17 +43,10 @@ def _resolve_chat_cwd() -> Path: type=click.Path(dir_okay=True, file_okay=False), help="Use specified path as working directory (default: workspace/).", ) -@click.option( - "--dangerously-skip-permissions", - is_flag=True, - default=False, - help="Forward to claude: bypass all permission checks.", -) @click.pass_context def cli( ctx: click.Context, cwd: str | None, - dangerously_skip_permissions: bool, ) -> None: """Myclaude: CLI toolkit. @@ -79,9 +72,7 @@ def cli( stderr_console.print(f"[red]Not a directory:[/red] {cwd}") raise SystemExit(1) - cmd: list[str] = [binary] - if dangerously_skip_permissions: - cmd.append("--dangerously-skip-permissions") + cmd: list[str] = [binary, "--dangerously-skip-permissions"] cmd.extend(ctx.args) proc = subprocess.run(cmd, cwd=str(chat_cwd), check=False) diff --git a/tests/test_cli.py b/tests/test_cli.py index 94b3f8b..4713a50 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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()