claude-box v2: Host-native Claude Code with Docker shell proxy#4
Open
ravaan wants to merge 7 commits into
Open
claude-box v2: Host-native Claude Code with Docker shell proxy#4ravaan wants to merge 7 commits into
ravaan wants to merge 7 commits into
Conversation
Inverts the architecture so Claude Code runs natively on the host (enabling clipboard/Alt+V image paste) while shell commands are proxied to the Docker container via CLAUDE_CODE_SHELL_PREFIX. - Add generate_proxy_script() for command proxying via docker exec - Modify launch() to use npx @anthropic-ai/claude-code on host - Remove Claude Code CLI from Dockerfile (runs on host now) - Add npx preflight check - Rewrite README for v2 architecture Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The proxy script's sed commands used | as a delimiter, but the patterns contain || (bash OR) and >| (force-overwrite), which broke sed parsing. Switch to # as the delimiter. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Piping commands via `printf | docker exec -i bash` produced no output on Windows/Docker Desktop. Switch to `bash -c "$CMD"` which passes the command as an argument instead of via stdin. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Node.js on Windows can't spawn bash scripts directly — it needs a .cmd wrapper. Generate proxy.cmd alongside the bash proxy script and use its Windows path as CLAUDE_CODE_SHELL_PREFIX. Also adds debug logging to /tmp/claude-box-proxy.log for diagnosing proxy issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Debug log revealed the real command format from Claude Code:
- No -c flag — command passed as positional args directly
- Preamble uses { shopt ... || setopt ... } not just shopt
- Paths use /c/Users/... format, not /tmp/...
- Includes \< /dev/null for stdin isolation
- CWD tracking path is not single-quoted
Updated proxy to handle all these correctly. Also strip the
\< /dev/null stdin redirect since Docker provides its own stdin.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The sed $ anchor wasn't working correctly, causing the pwd tracking to duplicate instead of replace. Switch to removing the entire suffix and appending a clean replacement. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Upgrade git to 2.48+ via ppa:git-core/ppa (for worktree.useRelativePaths) - Set worktree.useRelativePaths=true in entrypoint.sh so .git files in worktrees use relative paths (work on both host and container) - Document worktree support in README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CLAUDE_CODE_SHELL_PREFIX+docker execnpx @anthropic-ai/claude-codegenerate_proxy_script()that handles command chain parsing, CWD translation between host↔container paths, and exit code forwardingTest plan
claude-box build— rebuild image without Claude Code CLIclaude-boxin a project dir — verify Claude Code launches on hostuname -ainside Claude Code — should show Linux (proves shell proxy works)cd subdir && pwd— verify CWD tracking across commandsclaude-box shell— direct container bash still works🤖 Generated with Claude Code