【开源自荐】claude-bulkhead:在命令执行前拦截编程 Agent 破坏性操作的钩子

未關閉
#205 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
5/100
Issue 類型
功能
描述清晰度
需要釐清
活躍度
活躍
技術堆疊
shell
領域
devtools

研究方向

This is a self-promotion post in a weekly newsletter list, not a request for a code change, so there is no file or test to start from. The linked repository dooly6276/claude-bulkhead holds the PreToolUse hooks; a newcomer who wants to help would need the maintainer to state a specific task first. Done would mean the issue is closed or a concrete change is agreed, and it should not be picked up as a first contribution.

由索引模型根據 Issue 內容生成。

描述

claude-bulkhead:在命令执行前拦截编程 Agent 的破坏性操作

claude-bulkhead 是一个开源项目(MIT 协议,零依赖),是一组 PreToolUse 钩子,适用于 Claude Code,也支持 Codex、Gemini CLI、Copilot CLI、Cursor 和 opencode。它在 Agent 执行 shell 命令之前做检查,命中危险操作就直接拦下。

项目地址:https://github.com/dooly6276/claude-bulkhead

几个特点

  • 拦截变量为空时的 rm -rf(例如 rm -rf "$VAR/" 实际删到根目录),以及 rm -rf .git。
  • 拦截会误伤其他会话或桌面应用的 pkill / killall,也拦截抢占其他会话正在使用的端口。
  • 拦截 git add -A 把其他会话还没提交的改动一起提交进去。
  • 每次拦截都会在提示里告诉 Agent 应该改用哪条安全的命令,Agent 可以直接重试,不需要人工介入。
  • 零依赖,不需要额外安装运行库。

怎么用

按仓库 README 里的说明,把钩子配置到你使用的 Agent 即可,安装步骤和各个 Agent 的配置写法都在 README 里。

我是 claude-bulkhead 的维护者。

主要語言
沒有語言資料
星號
1.9k
分支
74
平均合併
2 分鐘
30 天內合併 PR
1

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

OpenGithubs/weekly 的其他 Issue

查看 OpenGithubs/weekly 的全部 Issue

相似的 Issue

更多 DevTools Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。