aboutsummaryrefslogtreecommitdiffhomepage
path: root/home-manager/config/sh/claude-code.sh
blob: 8ba9ea7a400c8798fdf3013dbd291d744791b210 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if [ -n "$CLAUDECODE" ]; then
    # 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