Repository navigation
Conversation
Add a /cd slash command that allows switching the working directory of a running session to a different worktree path. Uses the existing experimental controlPlane.moveSession API to move the session and refreshes VCS state after the switch. This enables parallel worktree workflows where multiple sessions work on different branches without restarting opencode. Co-Authored-By: glm/zai-glm-52 <[email protected]>
Co-Authored-By: glm/zai-glm-52 <[email protected]> Agent: @tdd Scope: dir-switch
Co-Authored-By: glm/zai-glm-52 <[email protected]> Agent: @tdd Scope: dir-switch
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This was referenced Aug 18, 2026
|
This is really exciting! thanks @AndyS77 |
|
- promptAsync failure shows warning toast (not silent catch)
- vcs.get with no data does not call setStore('vcs')
- Fix VCS test assertion for reconcile-wrapped data
- Add change-directory tool implementation and tests
Co-Authored-By: zai-glm-52 <[email protected]>
Agent: @bug-fix
Scope: anomalyco#43238
Author
|
Added tests for the review fixes:
|
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
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.
Issue for this PR
Closes #43223
Type of change
What does this PR do?
Adds a
/cdTUI slash command and achange_directoryagent tool that lets users and agents switch the session working directory without restarting. This supports worktree-based workflows where you move between git worktrees of the same project./cdTUI command: Opens a dialog with inline path input, resolves relative paths against the current directory, callsmoveSession, sends a synthetic system-reminder to the session, refreshes VCS state, and shows a toast.change_directoryagent tool: Resolves relative paths againstinstance.directory(notprocess.cwd()), callsMoveSession.Service.moveSession, and returns success/error output. Agents currently have no way to switch directories — this fills that gap.Both use the existing
experimental.controlPlane.moveSessionAPI.Files:
packages/tui/src/feature-plugins/home/change-directory.tsx— TUI commandpackages/tui/src/feature-plugins/home/change-directory.test.tsx— TUI testspackages/tui/src/feature-plugins/builtins.ts— plugin registrationpackages/opencode/src/tool/change-directory.ts— agent toolpackages/opencode/src/tool/change-directory.txt— tool descriptionpackages/opencode/src/tool/registry.ts— tool registry entrypackages/opencode/test/tool/change-directory.test.ts— agent tool testsHow did you verify your code works?
TUI: 10 tests covering plugin registration, command properties, submit flow (moveSession call, promptAsync system-reminder, VCS refresh, success toast), and error handling (moveSession failure, no active session).
Agent tool: 6 tests covering tool ID, description, parameter schema, successful execution, missing parameter error, and DestinationProjectMismatchError.
Screenshots / recordings
N/A
Checklist