Repository navigation
Description
Context
The claude-code/ directory is consumed as a project template (its docker-compose.yml pulls
ghcr.io/gatezh/devcontainers/claude-code:latest; init-plugins.sh and devcontainer.json are
copied per-project). Two issues in that template bite a fresh consumer. A downstream fork hit and
fixed both; reporting upstream so other consumers don't.
Finding 1 — waitFor references a postCreateCommand that the template never defines
claude-code/.devcontainer/devcontainer.json sets:
// line 118-119
"postStartCommand": "/usr/local/bin/patch-playwright-mcp",
"waitFor": "postCreateCommand"…but the file defines no postCreateCommand. Yet every other artifact in the template treats
init-plugins.sh as the postCreateCommand:
claude-code/README.md:88— documents the line to add:"postCreateCommand": "bash .devcontainer/init-plugins.sh"claude-code/.devcontainer/init-plugins.sh:6— header comment:"postCreateCommand": "bash .devcontainer/init-plugins.sh"claude-code/.devcontainer/Dockerfile:142-143— “Invoked from postCreateCommand (init-plugins.sh)…”.devcontainer/claude-sandbox/devcontainer.json:72(sibling variant) — does define it:"postCreateCommand": "… && bash /workspace/.devcontainer/init-plugins.sh"
Why it matters
waitFornames the lifecycle phase the tooling blocks on before connecting. Pointing it at an
undefined command makes it dead configuration — it waits on a phase that never runs.- More importantly, because
postCreateCommandis absent from this template (unlike the
claude-sandboxsibling),init-plugins.shnever runs on container creation for a consumer
who copies the template verbatim — so Claude Code marketplaces/plugins are never registered and
patch-playwright-mcpisn't invoked at create time (onlypostStartCommandsaves it). That
contradicts the README, the script header, and the Dockerfile comment, all of which assume it runs.
Suggested fix
Make the template internally consistent — preferably (a):
- (a) Add the line the docs already prescribe:
"postCreateCommand": "bash .devcontainer/init-plugins.sh", "waitFor": "postCreateCommand"
- (b) If
init-plugins.shis intended to be strictly opt-in, then don't ship a dangling
waitFor: set"waitFor": "updateContentCommand"(the spec default) until the consumer wires
postCreateCommand.
Finding 2 — updateContentCommand runs bun install unguarded, failing for consumers without a package.json
claude-code/.devcontainer/devcontainer.json:113:
"updateContentCommand": "sudo find /workspace -maxdepth 4 -name node_modules -type d -exec chown node {} + && sudo chown -R node /home/node/.claude && mise install && bun install"bun install requires a package.json. A fresh consumer (static site, a not-yet-scaffolded repo,
or any project that simply has no root package.json) will fail this step.
Reproduction
$ cd /tmp/empty # mise.toml present so the bun version resolves; no package.json anywhere up-tree
$ bun install
error: Bun could not find a package.json file to install from
note: Run "bun init" to initialize a project
$ echo $?
1Because updateContentCommand then exits non-zero, the dev-containers CLI logs
updateContentCommand … failed with exit code 127. Skipping any further user-provided commands.
and the rest of container setup is skipped.
Suggested fix
Guard the install so it’s a no-op until a package.json exists:
"updateContentCommand": "sudo find /workspace -maxdepth 4 -name node_modules -type d -exec chown node {} + && sudo chown -R node /home/node/.claude && mise install && if [ -f package.json ]; then bun install; fi"This keeps the “install deps on create” behavior for projects that have a package.json while not
breaking those that don’t.
Minor / for consideration
- Baked monorepo
node_modulesdirs.claude-code/.devcontainer/Dockerfile:84-89pre-creates
services/{api,app,www}andpackages/{shared,database}node_modulesmount points in the
published image. Harmless, but single-app consumers inherit empty cruft dirs. Could be moved to
a documented per-project step (the volume-population trick only needs the dirs that have a
matching mount in the consumer’sdevcontainer.json).
Environment
- Reference:
gatezh/devcontainers,claude-codetemplate (clonedmain). bun1.3.14 (via mise),node:24-trixie-slimbase.- Reproductions run inside a container built from a fork of this template.
Activity
[-]`claude-code template: waitFor points at an undefined postCreateCommand, and updateContentCommand's unguarded bun install breaks package.json-less consumers`[/-][+]claude-code template: waitFor points at an undefined postCreateCommand, and updateContentCommand's unguarded bun install breaks package.json-less consumers[/+]fix(claude-code): keep init-plugins.sh out of the default postCreateC…