-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclaude-aliases.bashrc
More file actions
45 lines (40 loc) · 1.72 KB
/
Copy pathclaude-aliases.bashrc
File metadata and controls
45 lines (40 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Bash aliases for docker-claude-code
#
# Configure profiles and pin to a version tag:
# echo 'export CLAUDE_IMAGE=ghcr.io/gw0/docker-claude-code:v0.5.0' >> ~/.bashrc
# echo 'export CLAUDE_PROFILES="cc1 ccpersonal claudeapi"' >> ~/.bashrc
# echo 'source /path/to/claude-aliases.bashrc' >> ~/.bashrc
CLAUDE_IMAGE=${CLAUDE_IMAGE:-ghcr.io/gw0/docker-claude-code:main}
CLAUDE_PROFILES=${CLAUDE_PROFILES:-cc1 cc2 ccapi}
_claude_run() {
local profile="$1"; shift
local script_dir="${BASH_SOURCE[0]:-$0}"; script_dir="${script_dir%/*}"
local vol_opts=":rslave"
[[ "$(uname)" == "Darwin" ]] && vol_opts=""
# Run container (DOCKER_EXTRA_ARGS for user-controlled extra arguments)
docker run -it --rm \
-u "$(id -u):$(id -g)" \
-e HOME=/home/agent \
-e ANTHROPIC_API_KEY="${ANTHROPIC_API_KEY:-}" \
-e CLAUDE_PROFILE="${profile}" \
-e ENABLE_PLUGINS="${ENABLE_PLUGINS:-}" \
-e FORCE_RESET_SESSIONS="${FORCE_RESET_SESSIONS:-}" \
-e DISABLE_SECURITY_SCAN="${DISABLE_SECURITY_SCAN:-}" \
-e DISABLE_RTK="${DISABLE_RTK:-}" \
${DOCKER_EXTRA_ARGS:-} \
--cap-drop ALL \
--security-opt=no-new-privileges:true \
--security-opt seccomp=${script_dir}/claude-seccomp.json \
-v "${HOME}/.claude-${profile}:/home/agent/.claude" \
-v "${PWD}:${PWD}${vol_opts}" \
-w "${PWD}" \
${CLAUDE_IMAGE} claude "$@"
}
# Set up per-profile aliases
for profile in ${CLAUDE_PROFILES}; do
mkdir -vp "${HOME}/.claude-${profile}"
alias ${profile}="_claude_run ${profile}"
alias ${profile}-yolo="DISABLE_SECURITY_SCAN=1 _claude_run ${profile} --allow-dangerously-skip-permissions"
alias ${profile}-advisor="DISABLE_SECURITY_SCAN=1 _claude_run ${profile} --permission-mode default --agent advisor"
done