| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
OpenCode plugin for isolated branch workspaces using devcontainers or git worktrees.
Note: This is a community project and is not built by or affiliated with the OpenCode team.
Version 0.x - Pre-1.0 software. Minor versions may contain breaking changes.
When working on multiple branches, you need isolated development environments:
This plugin provides both options with:
Add to your ~/.config/opencode/opencode.json:
{
"plugin": ["opencode-devcontainers"]
}OpenCode automatically installs npm plugins on startup.
/devcontainer feature-x # Start/target a devcontainer for this branch /devcontainer myapp/main # Target specific repo/branch /devcontainer # Show current status /devcontainer off # Disable, run commands on host
When a devcontainer is targeted:
/worktree feature-x # Create/target a worktree for this branch /worktree myapp/main # Target specific repo/branch /worktree # Show current status /worktree off # Disable, run commands in original directory
When a worktree is targeted:
/workspaces # List all workspaces (clones + worktrees) /workspaces cleanup # Find stale workspaces (not used in 7+ days)
| Use Case | Recommendation |
|---|---|
| Project has devcontainer.json | /devcontainer |
| Different dependencies per branch | /devcontainer |
| Quick branch work, same deps | /worktree |
| No Docker or Podman available | /worktree |
| Testing migrations/databases | /devcontainer |
~/.config/opencode/devcontainers/config.json:
{
"portRangeStart": 13000,
"portRangeEnd": 13099,
"dockerPath": "podman",
"dockerComposePath": "podman-compose"
}dockerPath and dockerComposePath are optional. When unset, the plugin uses Docker when available, otherwise Podman. A Podman runtime requires either podman-compose or docker-compose; the plugin detects one automatically and reports an unsupported configuration when neither is available. Set both paths explicitly to use nonstandard executable locations.
For worktrees, you can configure your .envrc to derive PORT and database settings from the worktree name to avoid conflicts:
# .envrc
export BRANCH_NAME=$(basename $(pwd))
export PORT=$((3000 + $(echo "$BRANCH_NAME" | cksum | cut -d' ' -f1) % 1000))
export DATABASE_URL="postgres://localhost/${BRANCH_NAME//-/_}_development"When using opencode-pilot for automated issue processing, configure your repos.yaml:
repos:
myorg/myrepo:
session:
prompt_template: |
/devcontainer issue-{number}
{title}
{body}This starts an isolated devcontainer for each issue automatically.
When switching workspaces with /devcontainer or /worktree, OpenCode's internal directory context doesn't update. The "Session changes" panel continues showing diffs from the original directory.
Workaround: Start OpenCode directly in the target directory, or use separate terminal sessions per workspace.
Upstream issue: anomalyco/opencode#6697
Override default paths:
MIT
| Back | FazBrowse Home | New Git URL |