aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-07-03 23:16:26 +0900
committernsfisis <nsfisis@gmail.com>2025-07-03 23:16:26 +0900
commit3ed563d1575b9b912d20caf43764c5caf2c4b050 (patch)
tree1b46bbf2e3a5e74e69853cc0437d726a26165c0f
parent270a36cedc632241cd9dc5fc09f88aba983c4195 (diff)
downloaddotfiles-3ed563d1575b9b912d20caf43764c5caf2c4b050.tar.gz
dotfiles-3ed563d1575b9b912d20caf43764c5caf2c4b050.tar.zst
dotfiles-3ed563d1575b9b912d20caf43764c5caf2c4b050.zip
claude-code: support zsh
-rw-r--r--home-manager/config/bash/.bashrc45
-rw-r--r--home-manager/config/sh/claude-code.sh44
-rw-r--r--home-manager/config/zsh/.zshrc1
-rw-r--r--home-manager/modules/common.nix2
4 files changed, 48 insertions, 44 deletions
diff --git a/home-manager/config/bash/.bashrc b/home-manager/config/bash/.bashrc
index 39d2837..439e34c 100644
--- a/home-manager/config/bash/.bashrc
+++ b/home-manager/config/bash/.bashrc
@@ -1,44 +1 @@
-# Safe wrappers for Claude Code
-if [[ -n "$CLAUDECODE" ]]; then
- # Safe wrapper for find command
- find() {
- local has_dangerous=0
-
- for arg in "$@"; do
- case "$arg" in
- -delete|-exec|-execdir|-fls|-fprint|-fprint0|-fprintf|-ok|-okdir)
- has_dangerous=1
- break
- ;;
- esac
- done
-
- if [[ $has_dangerous == 1 ]]; then
- echo "Error: dangerous actions, -delete/-exec/-execdir/-fls/-fprint/-fprint0/-fprintf/-ok/-okdir, are not allowed in Claude Code environment" >&2
- return 1
- fi
-
- command find "$@"
- }
-
- # Safe wrapper for fd command
- fd() {
- local has_dangerous=0
-
- for arg in "$@"; do
- case "$arg" in
- -x|--exec|-X|--exec-batch)
- has_dangerous=1
- break
- ;;
- esac
- done
-
- if [[ $has_dangerous == 1 ]]; then
- echo "Error: dangerous actions, -x/--exec/-X/--exec-batch, are not allowed in Claude Code environment" >&2
- return 1
- fi
-
- command fd "$@"
- }
-fi
+source "${XDG_CONFIG_HOME:-$HOME/.config}"/sh/claude-code.sh
diff --git a/home-manager/config/sh/claude-code.sh b/home-manager/config/sh/claude-code.sh
new file mode 100644
index 0000000..0b467bb
--- /dev/null
+++ b/home-manager/config/sh/claude-code.sh
@@ -0,0 +1,44 @@
+# Safe wrappers for Claude Code
+if [ -n "$CLAUDECODE" ]; then
+ # Safe wrapper for find command
+ find() {
+ has_dangerous=0
+
+ for arg in "$@"; do
+ case "$arg" in
+ -delete|-exec|-execdir|-fls|-fprint|-fprint0|-fprintf|-ok|-okdir)
+ has_dangerous=1
+ break
+ ;;
+ esac
+ done
+
+ if [ $has_dangerous = 1 ]; then
+ echo "Error: dangerous actions, -delete/-exec/-execdir/-fls/-fprint/-fprint0/-fprintf/-ok/-okdir, are not allowed in Claude Code environment" >&2
+ return 1
+ fi
+
+ command find "$@"
+ }
+
+ # Safe wrapper for fd command
+ fd() {
+ has_dangerous=0
+
+ for arg in "$@"; do
+ case "$arg" in
+ -x|--exec|-X|--exec-batch)
+ has_dangerous=1
+ break
+ ;;
+ esac
+ done
+
+ if [ $has_dangerous = 1 ]; then
+ echo "Error: dangerous actions, -x/--exec/-X/--exec-batch, are not allowed in Claude Code environment" >&2
+ return 1
+ fi
+
+ command fd "$@"
+ }
+fi \ No newline at end of file
diff --git a/home-manager/config/zsh/.zshrc b/home-manager/config/zsh/.zshrc
new file mode 100644
index 0000000..439e34c
--- /dev/null
+++ b/home-manager/config/zsh/.zshrc
@@ -0,0 +1 @@
+source "${XDG_CONFIG_HOME:-$HOME/.config}"/sh/claude-code.sh
diff --git a/home-manager/modules/common.nix b/home-manager/modules/common.nix
index 887fb5d..267ceae 100644
--- a/home-manager/modules/common.nix
+++ b/home-manager/modules/common.nix
@@ -90,6 +90,8 @@ in
home.file = {
".config/skk/jisyo.L".source = "${pkgs.skkDictionaries.l}/share/skk/SKK-JISYO.L";
+ ".config/sh/claude-code.sh".source = ../config/sh/claude-code.sh;
+ ".zshrc".source = ../config/zsh/.zshrc;
};
home.sessionVariables = rec {