Skip to content

feat: Native PowerShell integration with shared shell abstraction#2839

Closed
stier1ba wants to merge 3 commits intotailcallhq:mainfrom
stier1ba:feat/powershell-integration
Closed

feat: Native PowerShell integration with shared shell abstraction#2839
stier1ba wants to merge 3 commits intotailcallhq:mainfrom
stier1ba:feat/powershell-integration

Conversation

@stier1ba
Copy link
Copy Markdown
Contributor

@stier1ba stier1ba commented Apr 4, 2026

Summary

  • Add full native PowerShell shell integration mirroring all zsh features: : text interactive chat, :command dispatch (50+ commands), right-aligned RPROMPT, tab completion, diagnostics, and session state management
  • Create shared shell abstraction layer (shell/) eliminating duplication between zsh and PowerShell — ShellPromptData, AnsiStyled, and marker-based profile setup are reusable for future shells (fish, nushell, etc.)
  • Refactor existing zsh integration to delegate to the shared layer
  • Fix Windows compatibility issues: path normalization, test fixes, encoding

PowerShell Features

  • forge powershell plugin / theme / setup / doctor / keyboard / rprompt subcommands
  • : text chat via PreCommandLookupAction (works on PSReadLine 2.0+ and 2.3+)
  • Right-aligned prompt info (agent, model, tokens, cost) like zsh RPROMPT
  • 17 .ps1 shell scripts under shell-plugin/pwsh/
  • Compatible with Windows PowerShell 5.1 and PowerShell 7+
  • Auto-detects nerd font support and console encoding

Shared Abstraction Layer

  • shell/prompt.rsShellPromptData + fetch_prompt_data() shared by all shells
  • shell/style.rsAnsiStyled with basic 4-bit ANSI colors (universal compatibility)
  • shell/setup.rs — Marker-based profile editing reused by zsh and PowerShell

Test plan

  • cargo test -p forge_main — 268 tests pass
  • forge pwsh rprompt / plugin / theme / doctor / keyboard — all CLI subcommands work
  • Plugin + theme load cleanly in both PS 5.1 and PS 7
  • : hello sends prompt to LLM and gets response
  • :info, :env, :new dispatch correctly
  • Right-aligned RPROMPT renders with proper ANSI colors
  • Nerd font glyphs render in PS 7 with UTF-8 encoding
  • Nerd fonts auto-disabled in PS 5.1
  • Token count updates in prompt after chat
  • Existing zsh integration unaffected (byte-identical rprompt output)

🤖 Generated with Claude Code

… layer

Add full PowerShell shell integration mirroring the existing zsh feature set:
- `: text` interactive chat mode via PreCommandLookupAction
- `:command` dispatch for 50+ commands (agent, model, conversation, git, etc.)
- Right-aligned RPROMPT with agent, model, token count, and cost
- Tab completion for :commands and @files via fzf
- Plugin/theme generation, setup wizard, doctor diagnostics, keyboard shortcuts
- Session state management (conversation ID, model overrides, etc.)

Create shared shell abstraction layer (`shell/`) to eliminate duplication:
- `shell/prompt.rs`: ShellPromptData + fetch_prompt_data() shared by all shells
- `shell/style.rs`: AnsiStyled with basic 4-bit ANSI colors (PS 5.1 compatible)
- `shell/setup.rs`: Marker-based profile editing reused by zsh and PowerShell

Refactor existing zsh integration to use the shared layer:
- ZshRPrompt::from_prompt_data() replaces inline data fetching
- setup_zsh_integration() delegates to shared setup_shell_integration()

Fix Windows compatibility issues:
- Normalize paths to forward slashes in walker and workspace_status
- Platform-appropriate test paths for Windows
- Fix executor test expectations for cmd.exe quoting
- Gate Unix-only path tests with #[cfg(not(windows))]
- Fix SummaryMessage -> SummaryBlock rename in Windows cfg test blocks

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Apr 4, 2026
@tusharmath
Copy link
Copy Markdown
Collaborator

@stier1ba How about we keep the powershell UI as an external unofficial plugin that users can install?

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