You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move .claude config from /workspaces to home directory with named volume
- Change CLAUDE_CONFIG_DIR from /workspaces/.claude to ~/.claude
- Add Docker named volume (per-instance via ${devcontainerId}) for persistence
- Add CLAUDE_AUTH_TOKEN secret support with auto .credentials.json creation
- Replace setup-symlink-claude.sh with setup-migrate-claude.sh (one-time migration)
- Fix named volume root ownership via sudo chown on startup
- Update scope guard allowlist to resolve $HOME dynamically
- Update protected-files guard regex to cover .credentials.json
- Update all feature heredocs, poststart hooks, and docs
Config files deploy via `file-manifest.json` on every container start. Most deploy to `/workspaces/.claude/`; ccstatusline config deploys to `~/.config/ccstatusline/`. Each entry supports `overwrite`: `"if-changed"` (default, sha256), `"always"`, or `"never"`. Supported variables: `${CLAUDE_CONFIG_DIR}`, `${WORKSPACE_ROOT}`, `${HOME}`.
34
+
Config files deploy via `file-manifest.json` on every container start. Most deploy to `~/.claude/`; ccstatusline config deploys to `~/.config/ccstatusline/`. Each entry supports `overwrite`: `"if-changed"` (default, sha256), `"always"`, or `"never"`. Supported variables: `${CLAUDE_CONFIG_DIR}`, `${WORKSPACE_ROOT}`, `${HOME}`.
35
35
36
36
## Commands
37
37
@@ -76,7 +76,7 @@ Rules in `config/defaults/rules/` deploy to `.claude/rules/` on every container
Copy file name to clipboardExpand all lines: .devcontainer/README.md
+18-3Lines changed: 18 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,20 @@ Get an API key from [console.anthropic.com](https://console.anthropic.com/).
40
40
41
41
### Credential Persistence
42
42
43
-
Authentication credentials are stored in `/workspaces/.claude/` and persist across container rebuilds.
43
+
Authentication credentials are stored in `~/.claude/` and persist across container rebuilds via a Docker named volume.
44
+
45
+
### Long-Lived Token Authentication
46
+
47
+
For headless or automated environments, you can use a long-lived auth token instead of browser login:
48
+
49
+
1. Generate a token: `claude setup-token`
50
+
2. Add to `.devcontainer/.secrets`:
51
+
```bash
52
+
CLAUDE_AUTH_TOKEN=sk-ant-oat01-your-token-here
53
+
```
54
+
3. On next container start, `setup-auth.sh` will create `~/.claude/.credentials.json` automatically.
55
+
56
+
You can also set `CLAUDE_AUTH_TOKEN` as a Codespaces secret for cloud environments.
44
57
45
58
For more options, see the [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code).
46
59
@@ -111,7 +124,7 @@ Expected output shows your authenticated account and token scopes.
111
124
112
125
### Credential Persistence
113
126
114
-
GitHub CLI credentials are automatically persisted across container rebuilds. The container is configured to store credentials in `/workspaces/.gh/` (via `GH_CONFIG_DIR`), which is part of the bind-mounted workspace.
127
+
GitHub CLI credentials are automatically persisted across container rebuilds. The container is configured to store credentials in `/workspaces/.gh/` (via `GH_CONFIG_DIR`), which is part of the bind-mounted workspace. Claude Code credentials persist via a Docker named volume mounted at `~/.claude/`.
115
128
116
129
**You only need to authenticate once.** After running `gh auth login` or configuring `.secrets`, your credentials will survive container rebuilds and be available in future sessions.
117
130
@@ -199,7 +212,7 @@ Copy `.devcontainer/.env.example` to `.devcontainer/.env` and customize:
199
212
200
213
| Variable | Default | Description |
201
214
|----------|---------|-------------|
202
-
|`CLAUDE_CONFIG_DIR`|`/workspaces/.claude`| Claude configuration directory |
215
+
|`CLAUDE_CONFIG_DIR`|`/home/vscode/.claude`| Claude configuration directory |
203
216
|`SETUP_CONFIG`|`true`| Copy config files during setup (per `file-manifest.json`) |
204
217
|`SETUP_ALIASES`|`true`| Add `cc`/`claude`/`ccraw` aliases to shell |
205
218
|`SETUP_AUTH`|`true`| Configure Git/NPM auth from `.secrets`|
@@ -301,6 +314,8 @@ Three methods for providing GitHub/NPM credentials, in order of precedence:
301
314
302
315
All methods persist across container rebuilds via the bind-mounted `/workspaces/.gh/` directory.
303
316
317
+
4.**`.secrets` file with `CLAUDE_AUTH_TOKEN`** — Long-lived Claude auth token from `claude setup-token`. Auto-creates `~/.claude/.credentials.json` on container start.
318
+
304
319
## Agents & Skills
305
320
306
321
Agents and skills are distributed across focused plugins (replacing the former `code-directive` monolith).
|`CLAUDECODE`|`null` (unset) | Unsets the variable to allow nested Claude Code sessions (claude-in-claude) |
@@ -88,6 +88,9 @@ GH_TOKEN=ghp_your_token_here
88
88
GH_USERNAME=your-github-username
89
89
GH_EMAIL=your-email@example.com
90
90
NPM_TOKEN=npm_your_token_here
91
+
CLAUDE_AUTH_TOKEN=sk-ant-oat01-your-token-here
91
92
```
92
93
94
+
The `CLAUDE_AUTH_TOKEN` is a long-lived token from `claude setup-token`. When set, `setup-auth.sh` creates `~/.claude/.credentials.json` on container start (skips if already exists).
95
+
93
96
Environment variables with the same names take precedence over `.secrets` file values (useful for Codespaces).
Copy file name to clipboardExpand all lines: .devcontainer/docs/troubleshooting.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,11 @@ Common issues and solutions for the CodeForge devcontainer.
32
32
- Or configure `.devcontainer/.secrets` with `GH_TOKEN` for automatic auth on container start.
33
33
- Credentials persist in `/workspaces/.gh/` across rebuilds.
34
34
35
+
**Problem**: Claude auth token not taking effect in Codespaces.
36
+
37
+
- When `CLAUDE_AUTH_TOKEN` is set via Codespaces secrets, it persists as an environment variable for the entire container lifetime. The `unset` in `setup-auth.sh` only clears it in the child process. This is a Codespaces platform limitation.
38
+
- If `.credentials.json` already exists, the token injection is skipped (idempotent). Delete `~/.claude/.credentials.json` to force re-creation from the token.
39
+
35
40
**Problem**: Git push fails with permission error.
36
41
37
42
- Run `gh auth status` to verify authentication.
@@ -119,7 +124,7 @@ Common issues and solutions for the CodeForge devcontainer.
119
124
120
125
## How to Reset to Defaults
121
126
122
-
1.**Reset config files**: Delete `/workspaces/.claude/` and restart the container. `setup-config.sh` will recopy all files from `config/defaults/`.
127
+
1.**Reset config files**: Delete `~/.claude/` and restart the container. `setup-config.sh` will recopy all files from `config/defaults/`.
123
128
124
129
2.**Reset aliases**: Delete the `# Claude Code environment and aliases` block from `~/.bashrc` and `~/.zshrc`, then run `bash /workspaces/.devcontainer/scripts/setup-aliases.sh`.
0 commit comments