Skip to content

refactor: split bash tool into bash/pwsh/powershell#20039

Draft
Hona wants to merge 26 commits intoanomalyco:devfrom
Hona:refactor-shells
Draft

refactor: split bash tool into bash/pwsh/powershell#20039
Hona wants to merge 26 commits intoanomalyco:devfrom
Hona:refactor-shells

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented Mar 30, 2026

Split monolithic shell tool into distinct tools per shell runtime.

Hona added 17 commits March 30, 2026 20:08
Keep legacy tools.bash migration mapped to the single bash permission since the permission layer already expands it to pwsh and powershell. This preserves the backward-compatible config shape while retaining shell compatibility.
This fixes regressions from splitting the shell tools where powershell commands were missing their native exit codes and their correct UI rendering.
Use a multiline PowerShell trailer so native Windows commands keep their actual exit status without masking cmdlet failures, and add focused regression coverage. Remove the accidentally committed .opencode package-lock to keep generated state out of the branch.
Make the shell exit assertions typecheck cleanly while keeping the PowerShell regression coverage. Remove the accidentally committed .opencode package-lock so generated state does not ship in the branch.
Move shell tool ID checks behind shared helpers so runtime code and tests stop duplicating bash, pwsh, and powershell branches. This keeps shell-specific behavior aligned across consumers and makes follow-on shell changes less error-prone.
Treat shell access as one logical toggle during agent creation and apply bash compatibility rules before explicit per-shell overrides. This avoids disabling the active Windows shell unexpectedly and keeps pwsh and powershell overrides deterministic.
Attach shell process listeners before handling already-aborted tool signals so canceled runs always settle, and decode shell output as UTF-8 to preserve multibyte characters across chunk boundaries. Also lazy-load shell-specific parsers and hoist command sets so parsing work stays focused on the active shell.
# Conflicts:
#	packages/app/e2e/prompt/prompt-shell.spec.ts
#	packages/opencode/src/tool/bash.ts
#	packages/opencode/src/tool/registry.ts
Keep mixed shell/bash permission configs ordered correctly and treat --tools bash as the legacy alias during agent creation.
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