fix: symlink ~/.claude to ~/.claudebox instead of renaming mount

Both paths now resolve inside the sandbox, so hook paths
and settings referencing ~/.claude work without fixups.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Christopher Mühl 2026-04-09 21:44:54 +02:00
parent d4cfa7a537
commit e43d33602d
No known key found for this signature in database
GPG key ID: 925AC7D69955293F

View file

@ -109,7 +109,8 @@ cat > "$HOME/.claudebox/SANDBOX.md" << 'SANDBOXEOF'
You are running inside a bubblewrap (bwrap) sandbox managed by claudebox. You are running inside a bubblewrap (bwrap) sandbox managed by claudebox.
Your filesystem is isolated -- only the current working directory and Your filesystem is isolated -- only the current working directory and
essential system paths are mounted. essential system paths are mounted. Both ~/.claude and ~/.claudebox
point to the same directory inside the sandbox.
## Installing Tools ## Installing Tools
@ -313,7 +314,8 @@ if [[ "$DRY_RUN" == true ]]; then
echo " --ro-bind /etc/nix /etc/nix \\" echo " --ro-bind /etc/nix /etc/nix \\"
printf ' --symlink %q /usr/bin/env \\\n' "$(readlink -f "$(command -v env)")" printf ' --symlink %q /usr/bin/env \\\n' "$(readlink -f "$(command -v env)")"
echo " --tmpfs $HOME \\" echo " --tmpfs $HOME \\"
echo " --bind $HOME/.claudebox $HOME/.claude \\" echo " --bind $HOME/.claudebox $HOME/.claudebox \\"
echo " --symlink $HOME/.claudebox $HOME/.claude \\"
printf ' --ro-bind %q %s/.gitconfig \\\n' "$GITCONFIG_TMP" "$HOME" printf ' --ro-bind %q %s/.gitconfig \\\n' "$GITCONFIG_TMP" "$HOME"
echo " --bind $CWD $CWD \\" echo " --bind $CWD $CWD \\"
echo " --chdir $CWD \\" echo " --chdir $CWD \\"
@ -342,7 +344,8 @@ exec bwrap \
--ro-bind /etc/nix /etc/nix \ --ro-bind /etc/nix /etc/nix \
--symlink "$(readlink -f "$(command -v env)")" /usr/bin/env \ --symlink "$(readlink -f "$(command -v env)")" /usr/bin/env \
--tmpfs "$HOME" \ --tmpfs "$HOME" \
--bind "$HOME/.claudebox" "$HOME/.claude" \ --bind "$HOME/.claudebox" "$HOME/.claudebox" \
--symlink "$HOME/.claudebox" "$HOME/.claude" \
--ro-bind "$GITCONFIG_TMP" "$HOME/.gitconfig" \ --ro-bind "$GITCONFIG_TMP" "$HOME/.gitconfig" \
--bind "$CWD" "$CWD" \ --bind "$CWD" "$CWD" \
--chdir "$CWD" \ --chdir "$CWD" \