Skip to content

feat: add fish shell and PowerShell Core plugins#2563

Open
arvindcr4 wants to merge 3 commits intoantinomyhq:mainfrom
arvindcr4:feat/fish-shell-plugin
Open

feat: add fish shell and PowerShell Core plugins#2563
arvindcr4 wants to merge 3 commits intoantinomyhq:mainfrom
arvindcr4:feat/fish-shell-plugin

Conversation

@arvindcr4
Copy link

@arvindcr4 arvindcr4 commented Mar 14, 2026

Summary

Ports the ForgeCode ZSH shell plugin to fish shell and PowerShell Core (pwsh 7+), providing the same : command interface across all major shells.

Fish Shell Plugin

  • Full feature parity: all 30+ commands with aliases
  • fzf-powered tab completion for :commands and @file references
  • Right prompt theme with zsh→fish color escape conversion
  • Uses fish bind + commandline builtins, string collect for safe multi-line handling
  • Auto-loads via conf.d/

PowerShell Core Plugin

  • Full feature parity: all 30+ commands with aliases
  • PSReadLine Enter/Tab key handlers (RevertLine+Insert+AcceptLine pattern)
  • fzf-powered command and file completion
  • Right prompt via ANSI cursor positioning
  • Cross-platform: Windows, macOS, Linux (pwsh 7+)
  • Background sync/update via Start-Job
  • Cross-platform clipboard via Set-Clipboard with fallbacks

Files

File Lines Description
shell-plugin/fish/forge.fish ~1115 Fish: main plugin (47 functions, keybindings, dispatcher)
shell-plugin/fish/fish_right_prompt.fish ~98 Fish: right prompt with color escape conversion
shell-plugin/fish/README.md ~95 Fish: installation and usage docs
shell-plugin/powershell/ForgeCode.psm1 ~1547 PowerShell: main module (all functions, PSReadLine handlers)
shell-plugin/powershell/ForgeCode.psd1 ~72 PowerShell: module manifest
shell-plugin/powershell/README.md ~289 PowerShell: installation, usage, troubleshooting

Installation

Fish

cp shell-plugin/fish/forge.fish ~/.config/fish/conf.d/forge.fish
cp shell-plugin/fish/fish_right_prompt.fish ~/.config/fish/functions/fish_right_prompt.fish

PowerShell

# Copy to module path
Copy-Item -Recurse shell-plugin/powershell $HOME/.local/share/powershell/Modules/ForgeCode
# Add to $PROFILE
Add-Content $PROFILE 'Import-Module ForgeCode; Enable-ForgePlugin'

Notes

  • Both plugins call `forge zsh doctor` and `forge zsh keyboard` since forge doesn't yet expose shell-agnostic subcommands — a follow-up could add generic alternatives
  • The fish rprompt converter translates zsh `%F{...}`/`%f`/`%B`/`%b` escapes to fish `set_color` / PowerShell ANSI equivalents

Test plan

  • Fish: verify `:` commands dispatch correctly
  • Fish: verify tab completion for `:commands` and `@file`
  • Fish: verify right prompt shows model/agent info
  • Fish: test with vi-mode keybindings
  • PowerShell: verify `Import-Module ForgeCode; Enable-ForgePlugin` loads cleanly
  • PowerShell: verify `:` commands dispatch via PSReadLine
  • PowerShell: verify tab completion with fzf
  • PowerShell: test on Windows and Linux
  • Both: test conversation switching with `:conversation -`

🤖 Generated with claude-flow

arvindcr4 and others added 2 commits March 14, 2026 21:26
Port the ForgeCode ZSH plugin to fish shell, providing the same
`:` command interface for interacting with Forge from fish.

Includes:
- forge.fish: main plugin with 47 functions covering all commands
  (new, agent, model, provider, conversation, commit, suggest, etc.)
- fish_right_prompt.fish: right prompt showing active model/agent
- README.md: installation and usage documentation

Uses fish-native idioms (commandline, bind, set, string match)
instead of ZLE widgets. Auto-loads via conf.d/.

Co-Authored-By: claude-flow <ruv@ruv.net>
- Use `string collect` to preserve blank lines in editor content,
  commit messages, and suggest output (prevents list-splitting)
- Unquote $filtered in provider selection so all matching providers
  are written back, not just the first
- Escape workspace_path and _FORGE_BIN in background fish -c strings
  to handle paths with special characters
- Use `string collect` on rprompt output to prevent list-splitting
- Use idiomatic fish [2] indexing instead of tail -1 for regex groups
- Use $fish_key_bindings check for vi-mode instead of fragile bind test
- Use `string escape --style=script` for commit message shell safety
- Add comments explaining zsh subcommand usage from fish plugin

Co-Authored-By: claude-flow <ruv@ruv.net>
@CLAassistant
Copy link

CLAassistant commented Mar 14, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Mar 14, 2026
Comment on lines +93 to +96
if not test -s "$_FORGE_COMMANDS_CACHE"
CLICOLOR_FORCE=0 command $_FORGE_BIN list commands --porcelain 2>/dev/null >"$_FORGE_COMMANDS_CACHE"
end
command cat "$_FORGE_COMMANDS_CACHE"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Race condition in commands cache initialization. Multiple fish sessions for the same user could simultaneously detect the cache file as missing/empty and attempt to write to it concurrently, potentially corrupting the cache file.

function _forge_get_commands --description "Lazy-load command list from forge (outputs to stdout)"
    if not test -s "$_FORGE_COMMANDS_CACHE"
        set -l tmpfile (mktemp "$_FORGE_COMMANDS_CACHE.XXXXXX")
        CLICOLOR_FORCE=0 command $_FORGE_BIN list commands --porcelain 2>/dev/null >"$tmpfile"
        command mv -f "$tmpfile" "$_FORGE_COMMANDS_CACHE" 2>/dev/null
    end
    command cat "$_FORGE_COMMANDS_CACHE"
end

Use atomic write via temporary file + move to prevent corruption when multiple sessions initialize simultaneously.

Suggested change
if not test -s "$_FORGE_COMMANDS_CACHE"
CLICOLOR_FORCE=0 command $_FORGE_BIN list commands --porcelain 2>/dev/null >"$_FORGE_COMMANDS_CACHE"
end
command cat "$_FORGE_COMMANDS_CACHE"
if not test -s "$_FORGE_COMMANDS_CACHE"
set -l tmpfile (mktemp "$_FORGE_COMMANDS_CACHE.XXXXXX")
CLICOLOR_FORCE=0 command $_FORGE_BIN list commands --porcelain 2>/dev/null >"$tmpfile"
command mv -f "$tmpfile" "$_FORGE_COMMANDS_CACHE" 2>/dev/null
end
command cat "$_FORGE_COMMANDS_CACHE"

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Port the ForgeCode shell plugin to PowerShell Core (pwsh 7+),
providing the same `:` command interface on Windows, macOS, and Linux.

Includes:
- ForgeCode.psm1: 1547 lines, all 30+ commands with aliases, fzf
  pickers, PSReadLine Enter/Tab handlers, right prompt, background
  sync/update via Start-Job
- ForgeCode.psd1: module manifest (PowerShell 7.0+)
- README.md: installation, usage, command reference, troubleshooting

Uses PSReadLine RevertLine+Insert+AcceptLine pattern for Enter key
interception. Cross-platform clipboard via Set-Clipboard with
fallbacks. Script-scoped state variables for conversation/agent
tracking.

Co-Authored-By: claude-flow <ruv@ruv.net>
@arvindcr4 arvindcr4 changed the title feat: add fish shell plugin feat: add fish shell and PowerShell Core plugins Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants