Skip to content

feat(workspace): multi-root support via a ws command - #2

Merged
grinidx merged 1 commit into
mainfrom
feat/multi-root-workspace
Aug 9, 2026
Merged

feat(workspace): multi-root support via a ws command#2
grinidx merged 1 commit into
mainfrom
feat/multi-root-workspace

Conversation

@grinidx

@grinidx grinidx commented Aug 9, 2026

Copy link
Copy Markdown
Member

What

Adds multi-root workspace support: one container, several repositories open in one VS Code window.

  • ws command at /usr/local/bin/ws - init, add, rm, list
  • postCreateCommand runs ws init, so a fresh container is multi-root-capable with no setup
  • README rewritten around the capability, plus a ws entry in validate-tools.sh and a CHANGELOG note

Why this works here

/workspace was already a named volume rather than a bind mount of one folder, so anything cloned under it is a sub-folder of the workspace file. That is exactly what VS Code requires: a multi-root workspace may only reference "relative paths to sub-folders of the folder the .code-workspace file is in". Parent-relative paths (../other-repo) do not open, which is why the usual sibling-folders-on-the-host layout fails.

So the architecture was already right - the workspace file and a way to manage it were the missing pieces.

The sales point

A DevOps change is rarely one repository: the Terraform module, the environment consuming it, the Ansible role, the pipeline shipping it. Today that is four windows and four containers. This makes it one Source Control panel across every repo, one search, one toolchain.

Known limitation, documented in the README

All roots share the one container - VS Code cannot run a container per folder in a single window, and that is an open upstream feature request. Suits a team on one toolchain; does not suit polyglot repos needing different runtimes.

Verification

  • shellcheck .devcontainer/files/workspace/ws - clean
  • markdownlint-cli@0.38.0 (the pinned pre-commit version) on README and CHANGELOG - clean
  • devcontainer.json parses after comment stripping; postCreateCommand verified
  • ws exercised end to end outside the container: init on empty and populated roots, add via URL clone and existing directory, idempotent re-add, rm, list, and the error paths (add before init, rm of a non-root)

Not yet run inside a built image - CI builds both architectures and runs validate-tools.sh, which now covers ws.

The container already mounted /workspace as a named volume rather than a
bind mount of a single folder, which makes every repository cloned under
it a sub-folder of the workspace file - the layout VS Code requires for a
multi-root workspace. What was missing was the workspace file itself and
a way to manage it.

`ws` clones repositories into /workspace and maintains the folders array
in /workspace/devops.code-workspace. postCreateCommand runs `ws init` so
a fresh container comes up multi-root-capable with no setup.

Also rewrites the README opening around the multi-root capability, which
is the thing that distinguishes this image from a stock devcontainer.
@grinidx
grinidx merged commit 198010a into main Aug 9, 2026
3 checks passed
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.

1 participant