From 90d547e24fd92e63c5d9db234b61f6ac15cd01cb Mon Sep 17 00:00:00 2001 From: Eric Wang Date: Mon, 23 Jun 2025 01:22:21 -0700 Subject: [PATCH 1/3] docs: improve usage examples across all documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove incorrect '.' directory arguments from all help messages - Emphasize claude-yolo as primary interface in install.sh examples - Add practical example: --trace -v ~/.ssh:/root/.ssh:ro --continue - Update README.md with corrected usage patterns - Add bright yellow warning color in install.sh - Show argument pass-through capabilities in claude-yolo 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- README.md | 42 ++++++++++++++++++++++++++---------------- claude-yolo | 8 ++++---- claude.sh | 18 +++++++++--------- install.sh | 48 +++++++++++++++++++++++++++++------------------- 4 files changed, 68 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index ac11af7..e496a12 100644 --- a/README.md +++ b/README.md @@ -8,19 +8,26 @@ Docker-based Claude Code CLI with full development capabilities and host isolati # One-line install curl -fsSL https://raw.githubusercontent.com/lroolle/claude-code-yolo/main/install.sh | bash +``` + + +```bash # Navigate to your project and run cd ~/projects/my-project -claude-yolo . +claude-yolo ``` ## ⚠️ CRITICAL SAFETY WARNING +Claude will have **FULL ACCESS** to the current workspace and ALL subdirectories. + +Always `cd` to a specific project directory first! + **NEVER run `--yolo` mode in:** - Your home directory (`$HOME`) - System directories (`/`, `/etc`, `/usr`, etc.) - Any directory containing sensitive data -Claude will have **FULL ACCESS** to the current directory and ALL subdirectories. Always `cd` to a specific project directory first! ## How It Works @@ -42,14 +49,14 @@ The installer provides two commands: ```bash # YOLO mode (Docker) - recommended -claude-yolo . # Run in current directory +claude-yolo # Run in current directory # Using claude.sh for more control -claude.sh --yolo . # YOLO mode -claude.sh . # Local mode (no Docker) -claude.sh --auth-with api-key . # Use API key -claude.sh --auth-with bedrock . # Use AWS Bedrock -claude.sh --auth-with vertex . # Use Google Vertex AI +claude.sh --yolo # YOLO mode +claude.sh # Local mode (no Docker) +claude.sh --auth-with api-key # Use API key(may have to rerun `/login`) +claude.sh --auth-with bedrock # Use AWS Bedrock +claude.sh --auth-with vertex # Use Google Vertex AI claude.sh --shell # Open shell in container claude.sh --help # Show all options ``` @@ -57,6 +64,7 @@ claude.sh --help # Show all options ## Authentication Methods - **Claude App** (default): Uses `~/.claude` OAuth - `--auth-with claude` + - Run `/login` in claude-code, open the oauth link, then paste the code back in the terminal - **API Key**: Set `ANTHROPIC_API_KEY` environment variable - `--auth-with api-key` - If OAuth exists, use `/login` in Claude to switch to API key auth - **AWS Bedrock**: Uses `~/.aws` credentials - `--auth-with bedrock` @@ -71,7 +79,7 @@ For GitHub operations (creating PRs, managing repos), set the `GH_TOKEN` environ export GH_TOKEN="ghp_xxxxxxxxxxxx" # Now gh commands work in containers -claude-yolo . +claude-yolo # Inside container: gh pr create, gh issue list, etc. ``` @@ -83,17 +91,20 @@ You can mount additional configuration files or directories using the `-v` flag: ```bash # Mount Git configuration -claude-yolo -v ~/.gitconfig:/root/.gitconfig . +claude-yolo -v ~/.gitconfig:/root/.gitconfig # Mount SSH keys (read-only) -claude-yolo -v ~/.ssh:/root/.ssh:ro . +claude-yolo -v ~/.ssh:/root/.ssh:ro + +# Resume with SSH keys and tracing enabled +claude-yolo -v ~/.ssh:/root/.ssh:ro --trace --continue # Multiple mounts -claude-yolo -v ~/tools:/tools -v ~/data:/data . +claude-yolo -v ~/tools:/tools -v ~/data:/data # Mount custom tool configs -claude-yolo -v ~/.config/gh:/root/.config/gh . -claude-yolo -v ~/.terraform.d:/root/.terraform.d . +claude-yolo -v ~/.config/gh:/root/.config/gh +claude-yolo -v ~/.terraform.d:/root/.terraform.d ``` **Note**: Volumes mounted to `/root/*` are automatically symlinked to `/home/claude/*` for non-root user access. @@ -117,7 +128,7 @@ cd claude-code-yolo make build # Run directly -./claude.sh --yolo . +./claude.sh --yolo ``` ## Inspired by @@ -126,4 +137,3 @@ make build - **[meal/claude-code-cli](https://github.com/meal/claude-code-cli)** - Containerized Claude Code with ready-to-use Docker setup - **[gagarinyury/claude-code-root-runner](https://github.com/gagarinyury/claude-code-root-runner)** - Root privilege bypass for Claude Code using temporary users - **[textcortex/claude-code-sandbox](https://github.com/textcortex/claude-code-sandbox)** - Full sandbox environment with web UI and autonomous workflows - diff --git a/claude-yolo b/claude-yolo index 87d149b..2b9cdcd 100755 --- a/claude-yolo +++ b/claude-yolo @@ -104,12 +104,12 @@ parse_args() { echo " Can be used multiple times" echo "" echo "Examples:" - echo " claude-yolo . # Run Claude in YOLO mode" + echo " claude-yolo # Run Claude in YOLO mode" echo " claude-yolo --inspect # Quick access to running container" echo " claude-yolo --ps # See project containers" - echo " claude-yolo -v ~/.gitconfig:/root/.gitconfig . # Mount git config" - echo " claude-yolo -v ~/.ssh:/root/.ssh:ro . # Mount SSH keys read-only" - echo " claude-yolo -v ~/tools:/tools -v ~/data:/data . # Multiple mounts" + echo " claude-yolo -v ~/.gitconfig:/root/.gitconfig # Mount git config" + echo " claude-yolo -v ~/.ssh:/root/.ssh:ro # Mount SSH keys read-only" + echo " claude-yolo -v ~/tools:/tools -v ~/data:/data # Multiple mounts" exit 0 ;; *) diff --git a/claude.sh b/claude.sh index f5a8547..ba4d7b0 100755 --- a/claude.sh +++ b/claude.sh @@ -69,15 +69,15 @@ show_help() { echo "Available models: sonnet-4, opus-4, sonnet-3-7, sonnet-3-5, haiku-3-5, sonnet-3, opus-3, haiku-3, deepseek-r1" echo "" echo "Examples:" - echo " $0 . # Claude app auth (default)" - echo " $0 --auth-with api-key . # Use API key" - echo " $0 --auth-with bedrock . # Use AWS Bedrock" - echo " $0 --auth-with vertex . # Use Google Vertex AI" - echo " $0 --yolo . # YOLO mode with default auth" - echo " $0 --yolo --auth-with bedrock . # YOLO mode with Bedrock" - echo " $0 --yolo -v ~/.ssh:/root/.ssh:ro . # YOLO mode with volume mount" - echo " ANTHROPIC_MODEL=opus-4 $0 . # Use Opus 4 with default auth" - echo " GH_TOKEN=ghp_xxx $0 --yolo . # YOLO mode with GitHub CLI auth" + echo " $0 # Claude app auth (default)" + echo " $0 --auth-with api-key # Use API key" + echo " $0 --auth-with bedrock # Use AWS Bedrock" + echo " $0 --auth-with vertex # Use Google Vertex AI" + echo " $0 --yolo # YOLO mode with default auth" + echo " $0 --yolo --auth-with bedrock # YOLO mode with Bedrock" + echo " $0 --yolo -v ~/.ssh:/root/.ssh:ro # YOLO mode with volume mount" + echo " ANTHROPIC_MODEL=opus-4 $0 # Use Opus 4 with default auth" + echo " GH_TOKEN=ghp_xxx $0 --yolo # YOLO mode with GitHub CLI auth" echo "" } diff --git a/install.sh b/install.sh index 4dec5fe..4791e2f 100755 --- a/install.sh +++ b/install.sh @@ -3,7 +3,6 @@ set -e # Claude Code YOLO Quick Installer -INSTALL_DIR="$HOME/.local/bin" SCRIPT_NAME="claude.sh" YOLO_WRAPPER="claude-yolo" DOCKER_IMAGE="lroolle/claude-code-yolo:latest" @@ -13,18 +12,25 @@ echo "Claude Code YOLO Installer" echo "==========================" echo "" -# Create install directory if it doesn't exist -if [ ! -d "$INSTALL_DIR" ]; then +if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then + INSTALL_DIR="$HOME/.local/bin" + echo "Installing to: $INSTALL_DIR (user directory)" +elif [ -w "/usr/local/bin" ]; then + INSTALL_DIR="/usr/local/bin" + echo "Installing to: $INSTALL_DIR (system directory)" +else + INSTALL_DIR="$HOME/.local/bin" + echo "Installing to: $INSTALL_DIR (user directory)" echo "Creating $INSTALL_DIR..." mkdir -p "$INSTALL_DIR" -fi -# Check if ~/.local/bin is in PATH -if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then - echo "warning: $INSTALL_DIR is not in PATH" - echo "Add this to your shell profile:" - echo " export PATH=\"\$HOME/.local/bin:\$PATH\"" - echo "" + # Check if ~/.local/bin is in PATH + if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then + echo "warning: $INSTALL_DIR is not in PATH" + echo "Add this to your shell profile:" + echo " export PATH=\"\$HOME/.local/bin:\$PATH\"" + echo "" + fi fi # Download claude.sh @@ -46,6 +52,8 @@ docker pull "$DOCKER_IMAGE" echo "" echo "✓ Installation complete!" echo "" +echo "Scripts installed to: $INSTALL_DIR" +echo "" echo "Commands available:" echo "==================" echo "" @@ -60,15 +68,17 @@ echo "" echo "2. Navigate to your project directory:" echo " cd ~/projects/my-project" echo "" -echo "3. Run Claude in YOLO mode:" -echo " claude-yolo ." +echo "3. Start with Claude YOLO:" +echo " claude-yolo # Run Claude with full permissions" echo "" -echo "4. Or use claude.sh for more options:" -echo " claude.sh --help # Show all options" -echo " claude.sh . # Local mode" -echo " claude.sh --yolo . # YOLO mode" -echo " claude.sh -a . # API key mode" -echo " claude.sh --shell # Docker shell" +echo "4. Claude-yolo handles all features:" +echo " claude-yolo --auth-with bedrock # Use AWS Bedrock" +echo " claude-yolo --auth-with api-key # Use API key(may have to rerun \`/login\`)" +echo " claude-yolo --trace # Enable request tracing" +echo " claude-yolo -v ~/.ssh:/root/.ssh:ro # Mount SSH keys" +echo " claude-yolo --continue/--resume # Resume conversation" +echo " claude-yolo --inspect # Enter running container" +echo " claude.sh --help # Advanced options reference" echo "" -echo "WARNING: Never run --yolo in your home directory or system directories!" +echo -e "\033[93mWARNING: Never run --yolo in your home directory or system directories!\033[0m" echo "" From 4acb3d2a4f1dd6433fba028402a26cb4a53c7a35 Mon Sep 17 00:00:00 2001 From: Eric Wang Date: Mon, 23 Jun 2025 16:29:56 +0800 Subject: [PATCH 2/3] feat: update Docker image to ghcr.io and add fallback in installer - Set default Docker image to GitHub Container Registry in scripts - Add fallback to Docker Hub in install.sh if GHCR pull fails - Document available Docker images and usage in README --- README.md | 15 +++++++++++++++ claude.sh | 4 ++-- install.sh | 8 ++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e496a12..d74b2ce 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,21 @@ claude-yolo -v ~/.terraform.d:/root/.terraform.d - **Request Tracing**: Debug with `--trace` flag using claude-trace - **Docker Socket**: Optional mounting with `CLAUDE_YOLO_DOCKER_SOCKET=true` +## Docker Images + +Claude Code YOLO is available from multiple container registries: + +```bash +# GitHub Container Registry (recommended, primary) +docker pull ghcr.io/lroolle/claude-code-yolo:latest + +# Docker Hub (fallback) +docker pull lroolle/claude-code-yolo:latest + +# Use specific registry +DOCKER_IMAGE=lroolle/claude-code-yolo claude-yolo +``` + ## Manual Setup ```bash diff --git a/claude.sh b/claude.sh index ba4d7b0..8689795 100755 --- a/claude.sh +++ b/claude.sh @@ -4,8 +4,8 @@ set -e # Claude Starter Script with Docker Support # Runs Claude Code CLI locally or in a Docker container for safe execution -VERSION="0.2.0" -DOCKER_IMAGE="${DOCKER_IMAGE:-lroolle/claude-code-yolo}" +VERSION="0.2.2" +DOCKER_IMAGE="${DOCKER_IMAGE:-ghcr.io/lroolle/claude-code-yolo}" DOCKER_TAG="${DOCKER_TAG:-latest}" DEFAULT_ANTHROPIC_MODEL="sonnet-4" diff --git a/install.sh b/install.sh index 4791e2f..99090ba 100755 --- a/install.sh +++ b/install.sh @@ -5,7 +5,7 @@ set -e SCRIPT_NAME="claude.sh" YOLO_WRAPPER="claude-yolo" -DOCKER_IMAGE="lroolle/claude-code-yolo:latest" +DOCKER_IMAGE="ghcr.io/lroolle/claude-code-yolo:latest" GITHUB_RAW="https://raw.githubusercontent.com/lroolle/claude-code-yolo/main" echo "Claude Code YOLO Installer" @@ -46,7 +46,11 @@ chmod +x "$INSTALL_DIR/$YOLO_WRAPPER" # Pull Docker image echo "" echo "Pulling Docker image..." -docker pull "$DOCKER_IMAGE" +if ! docker pull "$DOCKER_IMAGE"; then + echo "Failed to pull from GitHub Container Registry, trying Docker Hub..." + DOCKER_IMAGE_FALLBACK="lroolle/claude-code-yolo:latest" + docker pull "$DOCKER_IMAGE_FALLBACK" +fi # Success message echo "" From 4261da35db9da053c5755a97a72a0dff65015c69 Mon Sep 17 00:00:00 2001 From: Eric Wang Date: Mon, 23 Jun 2025 16:42:16 +0800 Subject: [PATCH 3/3] feat(install): add note when falling back to Docker Hub image --- install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install.sh b/install.sh index 99090ba..4b29bc3 100755 --- a/install.sh +++ b/install.sh @@ -50,6 +50,10 @@ if ! docker pull "$DOCKER_IMAGE"; then echo "Failed to pull from GitHub Container Registry, trying Docker Hub..." DOCKER_IMAGE_FALLBACK="lroolle/claude-code-yolo:latest" docker pull "$DOCKER_IMAGE_FALLBACK" + echo "" + echo -e "\033[93mNOTE: Using Docker Hub fallback image\033[0m" + echo "To use Docker Hub by default, set: export DOCKER_IMAGE=lroolle/claude-code-yolo" + echo "Add this to your shell profile (.bashrc, .zshrc) to make it permanent" fi # Success message