Skip to content

claude-code template: waitFor points at an undefined postCreateCommand, and updateContentCommand's unguarded bun install breaks package.json-less consumers #107

Closed

Description

@gatezh

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

  • waitFor names 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 postCreateCommand is absent from this template (unlike the
    claude-sandbox sibling), init-plugins.sh never runs on container creation for a consumer
    who copies the template verbatim — so Claude Code marketplaces/plugins are never registered and
    patch-playwright-mcp isn't invoked at create time (only postStartCommand saves 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.sh is 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 $?
1

Because 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_modules dirs. claude-code/.devcontainer/Dockerfile:84-89 pre-creates
    services/{api,app,www} and packages/{shared,database} node_modules mount 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’s devcontainer.json).

Environment

  • Reference: gatezh/devcontainers, claude-code template (cloned main).
  • bun 1.3.14 (via mise), node:24-trixie-slim base.
  • Reproductions run inside a container built from a fork of this template.

Activity

  1. changed the title [-]`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[/+] on May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions