aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-04 22:57:11 +0900
committernsfisis <nsfisis@gmail.com>2026-05-04 22:57:11 +0900
commit491d9302662e0e8dbaac9db3406139d89df14bdd (patch)
tree721f18b4b7ef62fd8611e79b4288f6bac1ee29fd
parentbc51d43683af248701308bc0e17cfe8d270ff8e1 (diff)
downloaddotfiles-491d9302662e0e8dbaac9db3406139d89df14bdd.tar.gz
dotfiles-491d9302662e0e8dbaac9db3406139d89df14bdd.tar.zst
dotfiles-491d9302662e0e8dbaac9db3406139d89df14bdd.zip
claude: __claude-code-block-bash-tool
-rw-r--r--.config/claude/settings.json15
-rw-r--r--bin/__claude-code-block-bash-tool8
-rw-r--r--home-manager/modules/common.nix1
3 files changed, 23 insertions, 1 deletions
diff --git a/.config/claude/settings.json b/.config/claude/settings.json
index 98d819f..1dc9b1e 100644
--- a/.config/claude/settings.json
+++ b/.config/claude/settings.json
@@ -15,7 +15,8 @@
"Bash(rg:*)",
"Bash(touch:*)",
"Bash(tree:*)",
- "Bash(wc:*)"
+ "Bash(wc:*)",
+ "Skill(conventional-commit)"
],
"deny": [
"Bash(git push:*)",
@@ -27,6 +28,18 @@
"disableBypassPermissionsMode": "disable"
},
"hooks": {
+ "PreToolUse": [
+ {
+ "matcher": "Bash",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "__claude-code-block-bash-tool rm",
+ "if": "Bash(rm *)"
+ }
+ ]
+ }
+ ],
"Notification": [
{
"hooks": [
diff --git a/bin/__claude-code-block-bash-tool b/bin/__claude-code-block-bash-tool
new file mode 100644
index 0000000..b95771f
--- /dev/null
+++ b/bin/__claude-code-block-bash-tool
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+case "$1" in
+ rm)
+ echo "The command 'rm' is denied. Use 'git rm' if the file or the directory is tracked by git. If not, request deletion to user.";;
+esac
+
+exit 2
diff --git a/home-manager/modules/common.nix b/home-manager/modules/common.nix
index 63e8ab4..edbcf3c 100644
--- a/home-manager/modules/common.nix
+++ b/home-manager/modules/common.nix
@@ -150,6 +150,7 @@ in
".local/share/fonts/BIZUDPGothic-Regular.ttf".source =
"${pkgs.biz-ud-gothic}/share/fonts/truetype/BIZUDPGothic-Regular.ttf";
".zshrc".source = ../config/zsh/.zshrc;
+ "bin/__claude-code-block-bash-tool".source = ../../bin/__claude-code-block-bash-tool;
"bin/__claude-code-notify".source = ../../bin/__claude-code-notify;
"bin/__claude-code-statusline".source = ../../bin/__claude-code-statusline;
"bin/tmux-pane-idx".source = ../../bin/tmux-pane-idx;