Skip to content

Commit 5dfcf93

Browse files
committed
Update claude-code feature references and installation process
1 parent db0af47 commit 5dfcf93

10 files changed

Lines changed: 80 additions & 59 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1 @@
11
FROM debian:trixie-slim
2-
3-
# Preinstall nvm + Node LTS system-wide because Coder's envbuilder does not yet
4-
# honor `overrideFeatureInstallOrder`, so the claude-code feature runs before
5-
# our nvm feature and fails when `node` is not on PATH.
6-
# Remove this block once https://github.com/coder/envbuilder/pull/500 is
7-
# merged and released (tracks `overrideFeatureInstallOrder` support).
8-
ENV NVM_DIR=/usr/local/share/nvm
9-
ENV NVM_VERSION=0.40.4
10-
SHELL ["/bin/bash", "-c"]
11-
RUN set -eux; \
12-
apt-get update; \
13-
apt-get install -y --no-install-recommends curl ca-certificates; \
14-
rm -rf /var/lib/apt/lists/*; \
15-
mkdir -p "$NVM_DIR"; \
16-
curl -fsSL "https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh" | PROFILE=/dev/null bash; \
17-
. "$NVM_DIR/nvm.sh"; \
18-
nvm install --lts; \
19-
nvm alias default 'lts/*'; \
20-
NODE_BIN_DIR="$(dirname "$(nvm which default)")"; \
21-
for bin in node npm npx corepack; do \
22-
[ -x "$NODE_BIN_DIR/$bin" ] && ln -sf "$NODE_BIN_DIR/$bin" "/usr/local/bin/$bin"; \
23-
done; \
24-
printf 'export NVM_DIR="%s"\n[ -s "$NVM_DIR/nvm.sh" ] && \\. "$NVM_DIR/nvm.sh"\n[ -s "$NVM_DIR/bash_completion" ] && \\. "$NVM_DIR/bash_completion"\n' "$NVM_DIR" >/etc/profile.d/nvm.sh; \
25-
chmod 644 /etc/profile.d/nvm.sh

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dockerfile": "Dockerfile"
55
},
66
"features": {
7-
"ghcr.io/anthropics/devcontainer-features/claude-code:1": {},
7+
"ghcr.io/sourecode/devcontainer-features/claude-code:1": {},
88
"ghcr.io/sourecode/devcontainer-features/rtk:1": {},
99
"ghcr.io/sourecode/devcontainer-features/context-mode:1": {}
1010
}

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
# SoureCode Devcontainer Features
22

33
A small collection of [Dev Container Features](https://containers.dev/implementors/features/)
4-
that extend the official [`anthropics/devcontainer-features/claude-code`](https://github.com/anthropics/devcontainer-features/tree/main/src/claude-code)
5-
feature, plus a lightweight `nvm` feature.
4+
for Claude Code and friends, plus a lightweight `nvm` feature.
65

76
Published to GHCR under the `sourecode/devcontainer-features` namespace.
87

98
## Features
109

1110
| Feature | OCI reference | Summary |
1211
|---|---|---|
13-
| `nvm` | `ghcr.io/sourecode/devcontainer-features/nvm:2` | Installs [nvm](https://github.com/nvm-sh/nvm) system-wide and optionally a Node version (defaults to LTS), with `node`/`npm`/`npx` symlinked into `/usr/local/bin`. No yarn. |
12+
| `claude-code` | `ghcr.io/sourecode/devcontainer-features/claude-code:1` | Installs the Claude Code CLI via the official native installer (no Node.js required). **Temporary** — will be retired once [anthropics/devcontainer-features#37](https://github.com/anthropics/devcontainer-features/pull/37) is merged. |
1413
| `rtk` | `ghcr.io/sourecode/devcontainer-features/rtk:1` | Installs [rtk](https://github.com/rtk-ai/rtk), an LLM token-reducing CLI proxy; auto-patches Claude Code if present. |
1514
| `context-mode` | `ghcr.io/sourecode/devcontainer-features/context-mode:1` | Installs the [`context-mode`](https://github.com/mksglu/context-mode) Claude Code plugin. |
15+
| `nvm` | `ghcr.io/sourecode/devcontainer-features/nvm:2` | Installs [nvm](https://github.com/nvm-sh/nvm) system-wide and optionally a Node version (defaults to LTS), with `node`/`npm`/`npx` symlinked into `/usr/local/bin`. No yarn. |
1616

17-
`rtk` and `context-mode` depend on the Claude Code CLI, which they declare via
18-
`installsAfter: ghcr.io/anthropics/devcontainer-features/claude-code` so the
19-
runtime orders installations automatically when Anthropic's feature is also
20-
requested.
17+
`rtk` and `context-mode` declare `installsAfter` for both `ghcr.io/sourecode/devcontainer-features/claude-code` and `ghcr.io/anthropics/devcontainer-features/claude-code`, so the runtime orders them after whichever claude-code feature is present.
2118

2219
## Using the features
2320

@@ -28,10 +25,7 @@ image you already use:
2825
{
2926
"image": "debian:trixie-slim",
3027
"features": {
31-
"ghcr.io/sourecode/devcontainer-features/nvm:2": {
32-
"node": "lts"
33-
},
34-
"ghcr.io/anthropics/devcontainer-features/claude-code:1": {},
28+
"ghcr.io/sourecode/devcontainer-features/claude-code:1": {},
3529
"ghcr.io/sourecode/devcontainer-features/rtk:1": {
3630
"autoPatchClaude": true
3731
},
@@ -46,12 +40,9 @@ user's `PATH`.
4640

4741
### Feature options
4842

49-
#### `nvm`
43+
#### `claude-code`
5044

51-
| Option | Type | Default | Purpose |
52-
|---|---|---|---|
53-
| `version` | string | `0.40.4` | nvm release tag to install (without the leading `v`). |
54-
| `node` | string | `lts` | Node version to install via nvm. `lts` uses `nvm install --lts`. `none` skips node install. Anything else is passed as-is to `nvm install`. |
45+
No options. Always installs the latest release.
5546

5647
#### `rtk`
5748

@@ -61,10 +52,16 @@ user's `PATH`.
6152

6253
#### `context-mode`
6354

64-
No options. Fails if the `claude` CLI is not on the user's PATH — add the
65-
official `ghcr.io/anthropics/devcontainer-features/claude-code` feature as
66-
well (the `installsAfter` hint then makes the CLI resolve the correct install
67-
order automatically).
55+
No options. Fails if the `claude` CLI is not on the user's PATH — add a
56+
claude-code feature as well (the `installsAfter` hint then makes the CLI
57+
resolve the correct install order automatically).
58+
59+
#### `nvm`
60+
61+
| Option | Type | Default | Purpose |
62+
|---|---|---|---|
63+
| `version` | string | `0.40.4` | nvm release tag to install (without the leading `v`). |
64+
| `node` | string | `lts` | Node version to install via nvm. `lts` uses `nvm install --lts`. `none` skips node install. Anything else is passed as-is to `nvm install`. |
6865

6966
### Persisting Claude Code state
7067

@@ -81,13 +78,16 @@ bind mount, per-project credentials, or a shared named volume).
8178
.github/workflows/
8279
publish-features.yml # publishes every src/<id>/ to GHCR
8380
src/
84-
nvm/
81+
claude-code/
8582
devcontainer-feature.json
8683
install.sh
87-
rtk/
84+
context-mode/
8885
devcontainer-feature.json
8986
install.sh
90-
context-mode/
87+
nvm/
88+
devcontainer-feature.json
89+
install.sh
90+
rtk/
9191
devcontainer-feature.json
9292
install.sh
9393
docs/
@@ -112,8 +112,8 @@ that runs as `root` inside the container during the build.
112112
`ca-certificates`, etc. from `apt-get` if absent. Keep installs idempotent
113113
where reasonable.
114114
- Declare dependencies with `installsAfter` so the runtime orders features
115-
correctly (e.g. `rtk` and `context-mode` both list
116-
`ghcr.io/anthropics/devcontainer-features/claude-code`).
115+
correctly (e.g. `rtk` and `context-mode` list both the `sourecode` and
116+
`anthropics` claude-code feature IDs so either ordering target works).
117117

118118
### Testing a feature locally
119119

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"id": "claude-code",
3+
"version": "1.0.0",
4+
"name": "claude-code",
5+
"description": "TEMPORARY: Installs the latest Claude Code CLI via the official native installer (no Node.js required). Drop this feature in favor of `ghcr.io/anthropics/devcontainer-features/claude-code` once https://github.com/anthropics/devcontainer-features/pull/37 is merged.",
6+
"documentationURL": "https://github.com/SoureCode/devcontainer-features/tree/master/src/claude-code"
7+
}

src/claude-code/install.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
# claude-code feature installer. TEMPORARY — remove this feature in favor of
3+
# ghcr.io/anthropics/devcontainer-features/claude-code once
4+
# https://github.com/anthropics/devcontainer-features/pull/37 is merged.
5+
set -e
6+
7+
USER_NAME="${_REMOTE_USER:-${USERNAME:-root}}"
8+
if [ "$USER_NAME" = "root" ]; then
9+
USER_HOME="/root"
10+
else
11+
USER_HOME="$(getent passwd "$USER_NAME" | cut -d: -f6)"
12+
fi
13+
14+
if ! command -v curl >/dev/null 2>&1; then
15+
apt-get update
16+
apt-get install -y --no-install-recommends curl ca-certificates
17+
rm -rf /var/lib/apt/lists/*
18+
fi
19+
20+
run_as_user() {
21+
if [ "$USER_NAME" = "root" ]; then
22+
bash -c "$1"
23+
else
24+
su - "$USER_NAME" -c "$1"
25+
fi
26+
}
27+
28+
run_as_user 'curl -fsSL https://claude.ai/install.sh | bash'
29+
30+
CLAUDE_BIN="$USER_HOME/.local/bin/claude"
31+
if [ -x "$CLAUDE_BIN" ]; then
32+
ln -sf "$CLAUDE_BIN" /usr/local/bin/claude
33+
else
34+
echo "claude-code feature: expected $CLAUDE_BIN after install, but it was not found." >&2
35+
exit 1
36+
fi
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"id": "context-mode",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"name": "context-mode (Claude Code plugin)",
5-
"description": "Installs the context-mode Claude Code plugin from the mksglu/context-mode marketplace. Requires the anthropics/claude-code feature.",
6-
"documentationURL": "https://github.com/SoureCode/devcontainer-templates/tree/master/src/context-mode",
5+
"description": "Installs the context-mode Claude Code plugin from the mksglu/context-mode marketplace. Requires a claude-code feature.",
6+
"documentationURL": "https://github.com/SoureCode/devcontainer-features/tree/master/src/context-mode",
77
"options": {},
88
"installsAfter": [
9+
"ghcr.io/sourecode/devcontainer-features/claude-code",
910
"ghcr.io/anthropics/devcontainer-features/claude-code"
1011
]
1112
}

src/context-mode/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ run_as_user() {
1414
}
1515

1616
if ! run_as_user 'command -v claude >/dev/null 2>&1'; then
17-
echo "context-mode feature: claude CLI not found. Install ghcr.io/anthropics/devcontainer-features/claude-code first." >&2
17+
echo "context-mode feature: claude CLI not found. Install a claude-code feature (e.g. ghcr.io/sourecode/devcontainer-features/claude-code) first." >&2
1818
exit 1
1919
fi
2020

src/nvm/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "2.0.0",
44
"name": "nvm",
55
"description": "Installs nvm (Node Version Manager) system-wide at /usr/local/share/nvm and optionally a Node version (defaults to LTS), with node/npm/npx symlinked into /usr/local/bin so every shell and subsequent feature sees them. No yarn.",
6-
"documentationURL": "https://github.com/SoureCode/devcontainer-templates/tree/master/src/nvm",
6+
"documentationURL": "https://github.com/SoureCode/devcontainer-features/tree/master/src/nvm",
77
"options": {
88
"version": {
99
"type": "string",

src/rtk/devcontainer-feature.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"id": "rtk",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"name": "rtk",
55
"description": "Installs rtk, an LLM token-reducing CLI proxy, and optionally wires its auto-rewrite hook into Claude Code.",
6-
"documentationURL": "https://github.com/SoureCode/devcontainer-templates/tree/master/src/rtk",
6+
"documentationURL": "https://github.com/SoureCode/devcontainer-features/tree/master/src/rtk",
77
"options": {
88
"autoPatchClaude": {
99
"type": "boolean",
1010
"default": true,
11-
"description": "Run `rtk init -g --auto-patch` to wire the auto-rewrite hook into Claude Code (requires the anthropics/claude-code feature)."
11+
"description": "Run `rtk init -g --auto-patch` to wire the auto-rewrite hook into Claude Code (requires a claude-code feature)."
1212
}
1313
},
1414
"installsAfter": [
15+
"ghcr.io/sourecode/devcontainer-features/claude-code",
1516
"ghcr.io/anthropics/devcontainer-features/claude-code"
1617
]
1718
}

src/rtk/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ if [ "$AUTO_PATCH_CLAUDE" = "true" ]; then
3535
if run_as_user 'command -v claude >/dev/null 2>&1'; then
3636
run_as_user 'rtk init -g --auto-patch'
3737
else
38-
echo "rtk feature: claude CLI not on PATH, skipping auto-patch. Install ghcr.io/anthropics/devcontainer-features/claude-code to enable it." >&2
38+
echo "rtk feature: claude CLI not on PATH, skipping auto-patch. Install a claude-code feature (e.g. ghcr.io/sourecode/devcontainer-features/claude-code) to enable it." >&2
3939
fi
4040
fi

0 commit comments

Comments
 (0)