Repository navigation
Closed
Labels
area:workspaceWorkspace tooling, justfile, templatesfeatureNew feature or requestpriority:mediumImportant but not urgentsemver:minorNew feature, backward-compatible
Description
Description
Replace the current Claude Code injection path (setup-claude.sh + inject_claude_auth in devc-remote.sh) with a slim, robust forwarding mechanism. Depends on #545 (Claude Code baked into image + IS_SANDBOX=1).
Problem Statement
PR #166 ships two pieces for in-container Claude Code:
assets/workspace/.devcontainer/scripts/setup-claude.sh(~200 lines) — installs Node.js via apt with clock-skew workarounds,npm install -g @anthropic-ai/claude-code, creates a non-rootclaudeuser, ACLs the workspace, wrapsclaudeso root invocationsrunuserinto that user.scripts/devc-remote.sh:386-440inject_claude_auth— readsCLAUDE_CODE_OAUTH_TOKENfrom env or macOS Keychain, then sed-editsdocker-compose.local.yamlwith several heuristic branches (grep -q 'services: {}',grep -q 'environment:', etc.) to inject the env var.
Both have problems:
- Container-side install is redundant once Claude Code is baked into the image ([FEATURE] Bake agent-CLI toolkit + Claude Code into image (rg/fd/bat/eza/delta/lazygit/zoxide/starship/freeze/expect/nvim + IS_SANDBOX=1) #545).
- The non-root
claudeuser + runuser wrapper + ACLs is ~80 lines of complexity to dodge the uid-0 refusal.IS_SANDBOX=1([FEATURE] Bake agent-CLI toolkit + Claude Code into image (rg/fd/bat/eza/delta/lazygit/zoxide/starship/freeze/expect/nvim + IS_SANDBOX=1) #545) makes all of this unnecessary. - Sed-on-YAML editing is fragile. Multiple branches based on
greppatterns; anydocker-compose.local.yamlthe user has customized in unexpected ways will get mangled. No round-trip-safe parser. - Mac-side keychain read (
security find-generic-password -s devc-remote -a CLAUDE_CODE_OAUTH_TOKEN) duplicatesclaude-switchslot logic. A user managing multiple Anthropic accounts viaclaude-switchhas no way to pick which one ships to the container.
Proposed Solution
A ~50-line replacement that:
- Drops
setup-claude.shentirely. Image bake handles install;IS_SANDBOX=1env handles uid check; no separate user needed. - Drops sed-on-YAML in
inject_claude_auth. Uses one of:compose exec -e CLAUDE_CODE_OAUTH_TOKEN=$value ...— per-exec env injection, no compose file edits at all- bind-mount of
~/.claude/.credentials.json(file or via per-user dir) — auth state synced from host, container reads it directly
- Sources the token from a defined chain:
--account <slot>flag →~/.claude-creds-mac/<slot>/cred(claude-switch slot)~/.claude-creds-mac/.active→ that slot- macOS Keychain
Claude Code-credentials/$USER→ live (auto-refreshed) value - Linux
~/.claude/.credentials.json
- Warns when the credential's
expiresAtis in the past so users know to refresh before deployment fails inside the container with HTTP 401.
Out of Scope
- The image bake itself ([FEATURE] Bake agent-CLI toolkit + Claude Code into image (rg/fd/bat/eza/delta/lazygit/zoxide/starship/freeze/expect/nvim + IS_SANDBOX=1) #545)
- Tailscale ([FEATURE] Add Tailscale support for remote SSH access to devcontainer #85)
devc-remote.shbroader refactor (separate, larger issue)
Changelog Category
Changed (replaces existing flow)
Metadata
Metadata
Assignees
Labels
area:workspaceWorkspace tooling, justfile, templatesfeatureNew feature or requestpriority:mediumImportant but not urgentsemver:minorNew feature, backward-compatible
Activity
c-vigo commentedon Jun 23, 2026
Cross-link: overlaps the editor/auth scripts touched by #629 in the Nix/Claude migration (#625). Mostly independent (remote-devcontainer OAuth forwarding), but coordinate the
setup-claude.sh/ non-root-user removal with #629.feat(home): vigos.claude — ~/.claude policy + container secrets path (#…
c-vigo commentedon Jul 4, 2026
The slim token path landed as part of B2 (#823, PR #844, draft PR #846): the devcontainer scaffold bind-mounts the canonical per-user secrets dir (
~/.config/vigos/secrets, read-only) and a post-create hook exports each file as an env var in the container shell — no YAML editing, no setup-claude.sh. Claude picks upCLAUDE_CODE_OAUTH_TOKENfrom the environment. Suggest closing this issue pointing at #823 once #846 merges.feat(home): vigos.claude + wave-3 modules (waves 2/3) (#846)
c-vigo commentedon Jul 4, 2026
Superseded/implemented by #823 (merged to dev in #846): the devcontainer scaffold bind-mounts the canonical per-user secrets dir read-only and a post-create hook exports the files as env vars — no setup-claude.sh, no YAML editing.
chore: release 0.4.1 (#202)
chore: release 0.4.1 (#898)