Skip to content

Commit aebb2a3

Browse files
committed
Fix CodeRabbit review issues and update stale documentation
- CHANGELOG: split entries into Changed (user outcomes) and Fixed (script fixes) - install.sh: require curl explicitly, add semver validation, quote TARGET in su command, remove dead if/else - setup-update-claude.sh: use PIPESTATUS[0] to capture timeout exit code instead of tee - setup.sh: pin update log to /workspaces/.tmp/claude-update.log with override support - notify-hook, mcp-qdrant: update installsAfter from old npm feature to ./features/claude-code-native - check-setup.sh: remove stale /usr/local/bin/claude fallback
1 parent 324a5a3 commit aebb2a3

7 files changed

Lines changed: 30 additions & 19 deletions

File tree

.devcontainer/CHANGELOG.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@
1313
### Changed
1414

1515
#### Claude Code Installation
16-
- **Replaced npm installation with native binary** — swapped `ghcr.io/anthropics/devcontainer-features/claude-code:1.0.5` (npm-based) for new `./features/claude-code-native` feature that installs via Anthropic's official native installer (`https://claude.ai/install.sh`)
17-
- **In-session auto-updater now works** — native binary installs to `~/.local/bin/claude` owned by the container user, so `claude update` can write freely without root permission issues
18-
- **setup-update-claude.sh** — stripped all npm fallback and `claude install` bootstrap code; now native-binary-only with 60s timeout and transitional npm cleanup
19-
- **setup-aliases.sh** — simplified `_CLAUDE_BIN` resolution to native binary path only (removed npm and `/usr/local/bin` fallbacks)
20-
- **setup.sh** — fixed background update script invocation to capture all output to log file instead of discarding via `&>/dev/null`
16+
- **Claude Code now installs as a native binary** — uses Anthropic's official installer (`https://claude.ai/install.sh`) via new `./features/claude-code-native` feature, replacing the npm-based `ghcr.io/anthropics/devcontainer-features/claude-code:1.0.5`
17+
- **In-session auto-updater now works without root** — native binary at `~/.local/bin/claude` is owned by the container user, so `claude update` succeeds without permission issues
18+
19+
### Fixed
20+
21+
#### Claude Code Installation
22+
- **Update script no longer silently discards errors** — background update output now captured to log file instead of being discarded via `&>/dev/null`
23+
- **Update script simplified to native-binary-only** — removed npm fallback and `claude install` bootstrap code; added 60s timeout and transitional npm cleanup
24+
- **Alias resolution simplified**`_CLAUDE_BIN` now resolves directly to native binary path (removed npm and `/usr/local/bin` fallbacks)
2125

2226
#### System Prompt
2327
- **`<git_worktrees>` section** — Updated to document Claude Code native worktree convention (`<repo>/.claude/worktrees/`) as the recommended approach alongside the legacy `.worktrees/` convention. Added `EnterWorktree` tool guidance, `.worktreeinclude` file documentation, and path convention comparison table.

.devcontainer/features/claude-code-native/install.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ echo "[claude-code-native] Starting installation..."
1414
echo "[claude-code-native] Version: ${VERSION}"
1515

1616
# === VALIDATE DEPENDENCIES ===
17-
if ! command -v curl &>/dev/null && ! command -v wget &>/dev/null; then
18-
echo "[claude-code-native] ERROR: curl or wget is required"
17+
# The official installer (claude.ai/install.sh) requires curl internally
18+
if ! command -v curl &>/dev/null; then
19+
echo "[claude-code-native] ERROR: curl is required"
1920
echo " Ensure common-utils feature is installed first"
2021
exit 1
2122
fi
@@ -50,11 +51,13 @@ chown -R "${USERNAME}:" "${USER_HOME}/.local/bin" "${USER_HOME}/.local/share/cla
5051

5152
# === DETERMINE TARGET ===
5253
# The official installer accepts: stable, latest, or a specific semver
53-
TARGET=""
54-
if [ "${VERSION}" != "latest" ] && [ "${VERSION}" != "stable" ]; then
55-
TARGET="${VERSION}"
56-
else
57-
TARGET="${VERSION}"
54+
TARGET="${VERSION}"
55+
if [ "${TARGET}" != "latest" ] && [ "${TARGET}" != "stable" ]; then
56+
if ! echo "${TARGET}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
57+
echo "[claude-code-native] ERROR: Invalid version '${TARGET}'"
58+
echo " Use 'latest', 'stable', or a semver (e.g., 2.1.52)"
59+
exit 1
60+
fi
5861
fi
5962

6063
# === INSTALL ===
@@ -67,7 +70,7 @@ echo "[claude-code-native] Downloading official installer..."
6770
if [ "${USERNAME}" = "root" ]; then
6871
curl -fsSL https://claude.ai/install.sh | sh -s -- "${TARGET}"
6972
else
70-
su - "${USERNAME}" -c "curl -fsSL https://claude.ai/install.sh | sh -s -- ${TARGET}"
73+
su - "${USERNAME}" -c "curl -fsSL https://claude.ai/install.sh | sh -s -- \"${TARGET}\""
7174
fi
7275

7376
# === VERIFICATION ===

.devcontainer/features/mcp-qdrant/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@
5050
"installsAfter": [
5151
"ghcr.io/devcontainers/features/python:1",
5252
"ghcr.io/devcontainers/features/common-utils:2",
53-
"ghcr.io/anthropics/devcontainer-features/claude-code:1"
53+
"./features/claude-code-native"
5454
]
5555
}

.devcontainer/features/notify-hook/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
},
2424
"installsAfter": [
2525
"ghcr.io/devcontainers/features/common-utils:2",
26-
"ghcr.io/anthropics/devcontainer-features/claude-code:1"
26+
"./features/claude-code-native"
2727
]
2828
}

.devcontainer/scripts/check-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ warn_check() {
3434
echo ""
3535
echo "Core:"
3636
check "Claude Code installed" "command -v claude"
37-
warn_check "Claude native binary" "[ -x ~/.local/bin/claude ] || [ -x /usr/local/bin/claude ]"
37+
warn_check "Claude native binary" "[ -x ~/.local/bin/claude ]"
3838
check "cc alias configured" "grep -q 'alias cc=' ~/.bashrc 2>/dev/null || grep -q 'alias cc=' ~/.zshrc 2>/dev/null"
3939
check "Config directory exists" "[ -d '${CLAUDE_CONFIG_DIR:-$HOME/.claude}' ]"
4040
check "Settings file exists" "[ -f '${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json' ]"

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ CURRENT_VERSION=$("$NATIVE_BIN" --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+
5555
log "Current version: ${CURRENT_VERSION}"
5656

5757
# Use the official update command with timeout (handles download, verification, and versioned install)
58-
if timeout 60 "$NATIVE_BIN" update 2>&1 | tee -a "$LOG_FILE"; then
58+
timeout 60 "$NATIVE_BIN" update 2>&1 | tee -a "$LOG_FILE"
59+
UPDATE_STATUS=${PIPESTATUS[0]}
60+
if [ "$UPDATE_STATUS" -eq 0 ]; then
5961
UPDATED_VERSION=$("$NATIVE_BIN" --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || echo "unknown")
6062
if [ "$CURRENT_VERSION" != "$UPDATED_VERSION" ]; then
6163
log "Updated Claude Code: ${CURRENT_VERSION}${UPDATED_VERSION}"
6264
else
6365
log "Already up to date (${CURRENT_VERSION})"
6466
fi
6567
else
66-
log "WARNING: 'claude update' failed or timed out"
68+
log "WARNING: 'claude update' failed or timed out (exit ${UPDATE_STATUS})"
6769
fi

.devcontainer/scripts/setup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ run_script "$SCRIPT_DIR/setup-terminal.sh" "$SETUP_TERMINAL"
118118

119119
# Background the update to avoid blocking container start
120120
if [ "$SETUP_UPDATE_CLAUDE" = "true" ] && [ -f "$SCRIPT_DIR/setup-update-claude.sh" ]; then
121-
bash "$SCRIPT_DIR/setup-update-claude.sh" >>"${TMPDIR:-/tmp}/claude-update.log" 2>&1 &
121+
CLAUDE_UPDATE_LOG="${CLAUDE_UPDATE_LOG:-/workspaces/.tmp/claude-update.log}"
122+
mkdir -p "$(dirname "$CLAUDE_UPDATE_LOG")"
123+
bash "$SCRIPT_DIR/setup-update-claude.sh" >>"$CLAUDE_UPDATE_LOG" 2>&1 &
122124
disown
123125
SETUP_RESULTS+=("setup-update-claude:background")
124126
else

0 commit comments

Comments
 (0)