@yayaluoya-claude-plugins/auto-allow-bash-plugin 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "auto-allow-bash-plugin",
3
+ "version": "1.0.0",
4
+ "description": "自动放行只读 Bash 命令 — 本地正则 + LLM 双重判定,非只读命令仍需人工确认",
5
+ "author": {
6
+ "name": "yayaluoya"
7
+ }
8
+ }
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # auto-allow-bash-plugin
2
+
3
+ 自动放行只读 Bash 命令的 Claude Code 插件。
4
+
5
+ ## 工作原理
6
+
7
+ 通过 `PreToolUse` hook 拦截所有 `Bash` 工具调用,双重判定:
8
+
9
+ 1. **本地正则快速放行** — 对 `ls`、`cat`、`git status` 等显然只读的命令直接放行,零延迟。
10
+ 2. **LLM 兜底判定** — 正则未命中时,调用 Haiku 模型判断命令是否只读。只读放行,否则交回人工确认。
11
+
12
+ 非只读命令(写文件、安装包、git push 等)始终需要人工确认,不会被自动放行。
13
+
14
+ ## 前置条件
15
+
16
+ `~/.claude/settings.json` 的 `env` 中需配置以下任一认证方式:
17
+
18
+ - `ANTHROPIC_AUTH_TOKEN`(优先)
19
+ - `ANTHROPIC_API_KEY`
20
+
21
+ 可选:`ANTHROPIC_BASE_URL`(自定义 API 地址)
22
+
23
+ ## 日志
24
+
25
+ 每日判定日志写入插件目录下的 `log/auto-allow-YYYY-MM-DD.md`,包含命令内容、判定来源(local/llm)、耗时等。