diff --git a/src/claude-code/devcontainer-feature.json b/src/claude-code/devcontainer-feature.json index be0f0ab5..ffc36ad8 100644 --- a/src/claude-code/devcontainer-feature.json +++ b/src/claude-code/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "claude-code", - "version": "2.0.1", + "version": "2.0.2", "name": "claude-code", "documentationURL": "http://github.com/devcontainers-extra/features/tree/main/src/claude-code", "description": "Claude Code is an agentic coding tool that lives in your terminal", diff --git a/src/claude-code/install.sh b/src/claude-code/install.sh index ecc6b50d..1ab410ca 100644 --- a/src/claude-code/install.sh +++ b/src/claude-code/install.sh @@ -5,10 +5,18 @@ set -e # Install via Anthropic's recommended method # Script downloaded from them: # https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/bootstrap.sh -bash "$(dirname "$0")/bootstrap.sh" "$VERSION" + +# Resolve the absolute path before su changes the working directory +BOOTSTRAP_SCRIPT="$(pwd)/bootstrap.sh" + +# Run as the devcontainer user so that ~/.claude/, ~/.local/bin/claude, and +# ~/.local/share/claude/ are owned by the right user, not root. +su - "$_REMOTE_USER" <