Add multi-container devcontainer workspace support#25
Merged
Conversation
Support the VS Code multi-container pattern where a workspace has
multiple .devcontainer/<name>/devcontainer.json files referencing
shared services in a single docker-compose.yml.
Core changes:
- New devcontainer_config module: discovers all configs in a workspace
(root + .devcontainer/devcontainer.json + .devcontainer/*/devcontainer.json),
parses them via jsonc-parser (handles comments + trailing commas per
the devcontainer.json spec), and resolves abs paths + compose service
+ dockerComposeFile paths relative to each config's directory.
- Reliable container lookup in docker.rs: matches compose configs via
com.docker.compose.service + com.docker.compose.project.config_files
rather than the devcontainer.local_folder label, which the CLI only
stamps on the first container of a compose stack. The no-config path
unions devcontainer.local_folder and com.docker.compose.project.working_dir
matches so sibling containers are visible. Canonicalizes paths to
survive macOS /private/var/... aliasing.
- All devcontainer tools (up, exec, build, stop, remove, status,
read_config, file_*) now accept an optional config parameter. Single-
container workflows are unchanged.
- exec passes the resolved container id to the CLI via --container-id,
which lets it reach sibling compose containers that the CLI's own
workspace-folder lookup can't see.
- Ambiguity is surfaced as structured output: status returns
{state:'Ambiguous',candidates:[...],hint:'...'} and lookup-style
tools return errors listing every candidate so the agent can retry
with the right config.
- New devcontainer_list_configs MCP tool exposes the discovery output.
Drive-by: narrow the cfg gate on process_tree.rs signal_all,
any_alive, and libc_signal from cfg(unix) to cfg(target_os = 'linux')
to match their only call site (reap_linux). The cfg(not(unix)) stubs
were unreachable and silenced spurious dead_code warnings on macOS.
README: new Multi-container workspaces section + tool count 45->46.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support the VS Code multi-container pattern where a workspace has multiple .devcontainer//devcontainer.json files referencing shared services in a single docker-compose.yml.
Core changes:
New devcontainer_config module: discovers all configs in a workspace (root + .devcontainer/devcontainer.json + .devcontainer/*/devcontainer.json), parses them via jsonc-parser (handles comments + trailing commas per the devcontainer.json spec), and resolves abs paths + compose service
Reliable container lookup in docker.rs: matches compose configs via com.docker.compose.service + com.docker.compose.project.config_files rather than the devcontainer.local_folder label, which the CLI only stamps on the first container of a compose stack. The no-config path unions devcontainer.local_folder and com.docker.compose.project.working_dir matches so sibling containers are visible. Canonicalizes paths to survive macOS /private/var/... aliasing.
All devcontainer tools (up, exec, build, stop, remove, status, read_config, file_*) now accept an optional config parameter. Single- container workflows are unchanged.
exec passes the resolved container id to the CLI via --container-id, which lets it reach sibling compose containers that the CLI's own workspace-folder lookup can't see.
Ambiguity is surfaced as structured output: status returns {state:'Ambiguous',candidates:[...],hint:'...'} and lookup-style tools return errors listing every candidate so the agent can retry with the right config.
New devcontainer_list_configs MCP tool exposes the discovery output.
Drive-by: narrow the cfg gate on process_tree.rs signal_all, any_alive, and libc_signal from cfg(unix) to cfg(target_os = 'linux') to match their only call site (reap_linux). The cfg(not(unix)) stubs were unreachable and silenced spurious dead_code warnings on macOS.
README: new Multi-container workspaces section + tool count 45->46.