Skip to content

Promote env detection to chunk env init, remove sidecar env/build - #438

Draft
schurchleycci wants to merge 3 commits into
mainfrom
env-detect-top-level
Draft

Promote env detection to chunk env init, remove sidecar env/build#438
schurchleycci wants to merge 3 commits into
mainfrom
env-detect-top-level

Conversation

@schurchleycci

@schurchleycci schurchleycci commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The thinking here: if we want to use dockerfiles as the basis for spinning up lots of sidecars, having a command to generate the dockerfile directly, rather than as a side effect of chunk sidecar env | chunk sidecar build --dir, may be a smoother experience.

  • Adds chunk env init as a new top-level command that detects a repository's tech stack and writes Dockerfile.test to --dir (default), or prints the environment spec as JSON (--format json). The detected spec is saved to .chunk/config.json for reuse by chunk sidecar setup.
  • Fixes a stale error message in validate.go that referenced chunk sidecar env build (a command that never existed); it now correctly suggests chunk sidecar sync.

Before / after

# Before
chunk sidecar env | chunk sidecar build --dir .

# After
chunk env init --dir .
docker build -f Dockerfile.test -t myapp:test .

Test plan

  • task test passes (acceptance + unit)
  • chunk env init writes Dockerfile.test and prints its path
  • chunk env init --format json prints the env spec to stdout
  • chunk env init --no-save skips writing .chunk/config.json
  • chunk sidecar setup still works (reuses cached spec from config)

🤖 Generated with Claude Code

schurchleycci and others added 2 commits July 14, 2026 15:29
Moves chunk sidecar env and chunk sidecar build into a new top-level
chunk env detect command with --format json|dockerfile. Detection is
no longer a sidecar-specific concern, and the docker build step is
removed from the CLI — callers run docker themselves.

Acceptance test renamed from sidecars_build_e2e_test.go to
env_detect_e2e_test.go; e2eRunBuild split into e2eRenderDockerfile
and e2eDockerBuild to make the two-step flow explicit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
chunk env init now writes Dockerfile.test by default; --format json opts
into the JSON spec. This better reflects the intended use as a project
initialization step (detect stack, produce Dockerfile, cache to config)
rather than a pure inspection command.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@schurchleycci schurchleycci changed the title Add chunk env init command Promote env detection to chunk env init, remove sidecar env/build Jul 14, 2026
Comment thread internal/cmd/sidecar.go
Example:
chunk sidecar env --dir . | chunk sidecar build --dir .`,
RunE: func(cmd *cobra.Command, _ []string) error {
if tag != "" && !validDockerTag.MatchString(tag) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're dropping chunk's tag validation here now that docker build is run by the user instead of by chunk. it'll still reject a bad tag, with its own error - but wasn't sure if it was intentional - just a ux thing i guess!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this was intentional - under the assumption we may as well just have the user run docker build themselves

Comment thread harness/environment.py Outdated
prompt = f"""You are debugging an environment detection tool inside the chunk CLI.

`chunk sidecar env` analyses a repository, detects its tech stack, and writes a
`chunk env detect` analyses a repository, detects its tech stack, and writes a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err i might be missing this but i can not find the detect subcommand. naming mismatch?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, this was a naming mismatch - fixed now!

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jesseworld22 added a commit that referenced this pull request Aug 13, 2026
The getting-started guide walked new users through build-prompt and code
review as its numbered path, with sidecars below it under a heading still
marked '(preview)'. Someone following the steps in order never touched a
sidecar. README framed the two as co-equal capabilities.

Restructure so the sidecar loop is the primary path:

- GETTING_STARTED: sidecar creation and the dev loop become Steps 3 and 4,
  skills become Step 5, and build-prompt/review move below the sidecar
  material as 'Team review context'. Drop the '(preview)' label. Group the
  detail sections under a 'Sidecar reference' heading. Lead the auth step
  with CircleCI, since that is what sidecars need.
- README: drop the 'two main capabilities' framing, move context generation
  below the sidecar quick start.
- AGENTS.md: describe sidecars as the primary capability.
- SKILLS.md: lead the intro with sidecar setup and the dev loop, and point
  first-time readers at chunk-sidecar-setup.

Also adds the chunk-sidecar-setup skill to the getting-started skills table,
which listed only four of the five installed skills.

Command-level details in 'Environment setup', 'Syncing', 'First-time sidecar
setup', and 'Hook behavior' are left alone pending #438, #462, #491, and #501,
which change those commands.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants