Skip to content

Commit 6a8ba62

Browse files
committed
Address remaining CodeRabbit review findings (3, 4, 5, 8, 9, 10)
- Fix hardcoded /home/vscode/.claude in changelog, use portable ~/.claude - Remove implementation detail "(leading dot)" from changelog entry - Set AUTH_CONFIGURED=true when credentials already exist (fixes false "No tokens provided" summary) - Update docs site settings.json deployment path to ~/.claude - Harden $HOME fallback across all scripts: resolve target user's home via SUDO_USER/USER/vscode chain instead of relying on $HOME (guards against root context in feature installs and hooks) - Add CLAUDE_CONFIG_DIR documentation to ccstatusline and mcp-qdrant feature READMEs - Fix stale .claude/settings.json references in ccstatusline README
1 parent d5c2fe2 commit 6a8ba62

9 files changed

Lines changed: 28 additions & 12 deletions

File tree

.devcontainer/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
#### Configuration
88
- Moved `.claude` directory from `/workspaces/.claude` to `~/.claude` (home directory)
99
- Added Docker named volume for persistence across rebuilds (per-instance isolation via `${devcontainerId}`)
10-
- `CLAUDE_CONFIG_DIR` now defaults to `/home/vscode/.claude`
10+
- `CLAUDE_CONFIG_DIR` now defaults to `~/.claude`
1111

1212
#### Authentication
1313
- Added `CLAUDE_AUTH_TOKEN` support in `.secrets` for long-lived tokens from `claude setup-token`
1414
- Auto-creates `.credentials.json` from token on container start (skips if already exists)
1515
- Added `CLAUDE_AUTH_TOKEN` to devcontainer.json secrets declaration
1616

1717
#### Security
18-
- Protected-files-guard now covers `.credentials.json` (leading dot)
18+
- Protected-files-guard now blocks modifications to `.credentials.json`
1919

2020
#### Scripts
2121
- Replaced `setup-symlink-claude.sh` with `setup-migrate-claude.sh` (one-time migration)

.devcontainer/features/ccstatusline/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ All widgets connected with powerline arrows (monokai theme).
4545

4646
- **ccstatusline npm package**: Installed on-demand via `npx` (not globally)
4747
- **Configuration file**: `~/.config/ccstatusline/settings.json` with powerline theme
48-
- **Claude Code integration**: Automatically updates `.claude/settings.json`
48+
- **Claude Code integration**: Automatically updates `~/.claude/settings.json`
4949
- **Disk Usage**: Minimal (~2MB when cached by npx)
5050

5151
## Requirements
@@ -75,17 +75,18 @@ The feature will validate these are present and exit with an error if missing.
7575
-**Session Resume**: Copyable `cc --resume {sessionId}` command via custom-command widget
7676
-**Burn Rate Tracking**: Live ccburn compact output showing pace indicators (🧊/🔥/🚨)
7777
-**ANSI Colors**: High-contrast colors optimized for dark terminals
78-
-**Automatic Integration**: Auto-configures `.claude/settings.json`
78+
-**Automatic Integration**: Auto-configures `~/.claude/settings.json`
7979
-**Idempotent**: Safe to run multiple times
8080
-**Multi-user**: Automatically detects container user
81+
-**Config-aware**: Respects `CLAUDE_CONFIG_DIR` environment variable (defaults to `~/.claude`)
8182

8283
## Post-Installation Steps
8384

8485
### ✅ Configuration is Automatic
8586

8687
This feature automatically:
8788
1. Creates `~/.config/ccstatusline/settings.json` with powerline configuration
88-
2. Configures `.claude/settings.json` to use ccstatusline
89+
2. Configures `~/.claude/settings.json` to use ccstatusline
8990

9091
**No manual steps required!**
9192

@@ -258,7 +259,7 @@ configure-ccstatusline-auto
258259
npm install -g ccstatusline@latest
259260
```
260261

261-
Then update `.claude/settings.json`:
262+
Then update `~/.claude/settings.json`:
262263
```json
263264
{
264265
"statusLine": {

.devcontainer/features/ccstatusline/install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ if ! command -v jq &>/dev/null; then
190190
exit 1
191191
fi
192192
193-
SETTINGS_FILE="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json"
194193
# Use SUDO_USER since _REMOTE_USER isn't set in post-start hooks
195194
USERNAME="${SUDO_USER:-vscode}"
195+
_USER_HOME=$(eval echo "~${USERNAME}")
196+
SETTINGS_FILE="${CLAUDE_CONFIG_DIR:-${_USER_HOME}/.claude}/settings.json"
196197
197198
# Ensure directory exists
198199
mkdir -p "$(dirname "${SETTINGS_FILE}")"

.devcontainer/features/mcp-qdrant/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ The feature will validate these are present and exit with an error if missing.
154154
-**Cloud or Local**: Supports both Qdrant Cloud and local instances
155155
-**Idempotent**: Safe to run multiple times
156156
-**Multi-user**: Automatically detects container user
157+
-**Config-aware**: Respects `CLAUDE_CONFIG_DIR` environment variable (defaults to `~/.claude`)
157158
-**Native mcpServers**: Uses VS Code's native devcontainer mcpServers support (declarative configuration)
158159
-**Dynamic Configuration**: Environment variables loaded from `/workspaces/.qdrant-mcp.env` file
159160
-**Secure**: API keys protected with 600 permissions on env file

.devcontainer/features/mcp-qdrant/install.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,12 @@ else
188188
QDRANT_LOCAL_PATH="${QDRANT_LOCAL_PATH:-/workspaces/.qdrant/storage}"
189189
fi
190190
191+
# Resolve target user's home (guards against $HOME=/root during feature install)
192+
_USERNAME="${SUDO_USER:-${USER:-vscode}}"
193+
_USER_HOME=$(eval echo "~${_USERNAME}")
194+
191195
# Ensure settings.json exists
192-
SETTINGS_FILE="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json"
196+
SETTINGS_FILE="${CLAUDE_CONFIG_DIR:-${_USER_HOME}/.claude}/settings.json"
193197
if [ ! -f "$SETTINGS_FILE" ]; then
194198
echo "[mcp-qdrant] ERROR: $SETTINGS_FILE not found"
195199
exit 1

.devcontainer/features/mcp-qdrant/poststart-hook.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ else
5656
QDRANT_LOCAL_PATH="${QDRANT_LOCAL_PATH:-/workspaces/.qdrant/storage}"
5757
fi
5858

59+
# Resolve target user's home (guards against $HOME=/root when hook runs as root)
60+
_USERNAME="${SUDO_USER:-${USER:-vscode}}"
61+
_USER_HOME=$(eval echo "~${_USERNAME}")
62+
5963
# Ensure settings.json exists
60-
SETTINGS_FILE="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json"
64+
SETTINGS_FILE="${CLAUDE_CONFIG_DIR:-${_USER_HOME}/.claude}/settings.json"
6165
if [ ! -f "$SETTINGS_FILE" ]; then
6266
echo "[mcp-qdrant] ERROR: $SETTINGS_FILE not found"
6367
exit 1

.devcontainer/scripts/setup-auth.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ fi
6969
# Long-lived tokens only — generated via: claude setup-token
7070
# Note: After unset, the token remains visible in /proc/<pid>/environ for the
7171
# lifetime of this process. This is a platform limitation of environment variables.
72-
CLAUDE_CRED_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
72+
_USERNAME="${SUDO_USER:-${USER:-vscode}}"
73+
_USER_HOME=$(eval echo "~${_USERNAME}")
74+
CLAUDE_CRED_DIR="${CLAUDE_CONFIG_DIR:-${_USER_HOME}/.claude}"
7375
CLAUDE_CRED_FILE="$CLAUDE_CRED_DIR/.credentials.json"
7476
if [ -n "$CLAUDE_AUTH_TOKEN" ]; then
7577
# Validate token format (claude setup-token produces sk-ant-* tokens)
@@ -83,6 +85,7 @@ if [ -n "$CLAUDE_AUTH_TOKEN" ]; then
8385
echo "[setup-auth] WARNING: .credentials.json has permissions $perms (expected 600), fixing"
8486
chmod 600 "$CLAUDE_CRED_FILE"
8587
fi
88+
AUTH_CONFIGURED=true
8689
else
8790
echo "[setup-auth] Creating .credentials.json from CLAUDE_AUTH_TOKEN..."
8891
mkdir -p "$CLAUDE_CRED_DIR"

.devcontainer/scripts/setup-migrate-claude.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
# prevent overwriting files already in the destination.
88

99
OLD_DIR="/workspaces/.claude"
10-
NEW_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
10+
_USERNAME="${SUDO_USER:-${USER:-vscode}}"
11+
_USER_HOME=$(eval echo "~${_USERNAME}")
12+
NEW_DIR="${CLAUDE_CONFIG_DIR:-${_USER_HOME}/.claude}"
1113

1214
# Nothing to migrate if old directory doesn't exist
1315
if [ ! -d "$OLD_DIR" ]; then

docs/src/content/docs/customization/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CodeForge configuration is spread across three files that each control a differe
99

1010
## settings.json
1111

12-
The primary configuration file lives at `.devcontainer/config/defaults/settings.json`. It is deployed to `.claude/settings.json` on every container start and controls Claude Code's runtime behavior.
12+
The primary configuration file lives at `.devcontainer/config/defaults/settings.json`. It is deployed to `~/.claude/settings.json` on every container start and controls Claude Code's runtime behavior.
1313

1414
### Core Settings
1515

0 commit comments

Comments
 (0)