Skip to content

feat: refactor bash tool with shell-aware prompts for bash, pwsh+powershell, and cmd#20039

Merged
Hona merged 51 commits intoanomalyco:devfrom
Hona:refactor-shells
May 2, 2026
Merged

feat: refactor bash tool with shell-aware prompts for bash, pwsh+powershell, and cmd#20039
Hona merged 51 commits intoanomalyco:devfrom
Hona:refactor-shells

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented Mar 30, 2026

renames bash tool to shell, keeps legacy bash calls working, and adds shell-specific prompts for pwsh/powershell/cmd so agents get the right instructions.
also keeps the bash prompt effectively the same as before, aside from the tool rename.

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.
opencode-agent Bot added a commit that referenced this pull request Apr 27, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 27, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 27, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 27, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 27, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 27, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 27, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 27, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 28, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 28, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 28, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 28, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 28, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 28, 2026
…ecific tool definitions so agents work better
opencode-agent Bot added a commit that referenced this pull request Apr 28, 2026
…ecific tool definitions so agents work better
@opencode-agent
Copy link
Copy Markdown
Contributor

⚠️ Blocking Beta Release

This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch

Please resolve this issue to include this PR in the next beta release.

@opencode-agent
Copy link
Copy Markdown
Contributor

opencode-agent Bot commented May 1, 2026

⚠️ Blocking Beta Release

This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch

Please resolve this issue to include this PR in the next beta release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants