A fast, minimal shell prompt for PowerShell, written in Rust.
Pre-built binaries support Windows and Linux. macOS is supported when built from source.
- Lightning fast: Compiled to a small native binary with zero startup delay
- Git integration: Shows current branch and PR number with status icons (open, draft, closed) and smart caching
- Path display: Intelligently truncates long paths to fit terminal width
- Command feedback: Displays exit codes and execution duration
- System info: Shows OS and shell information
- Simple mode: Minimal prompt option for even faster rendering
- Windows Terminal integration: Shell integration escape sequences for new-tab-same-directory, scrollbar marks, and command navigation
scoop bucket add lucaspimentel https://github.com/lucaspimentel/scoop-bucket
scoop install pwsh-promptNo build tools or .NET SDK required:
irm https://raw.githubusercontent.com/lucaspimentel/pwsh-prompt/main/install-remote.ps1 | iexOr to install a specific version:
$version = "1.0.0"; irm https://raw.githubusercontent.com/lucaspimentel/pwsh-prompt/main/install-remote.ps1 | iexClone the repository and run the installation script:
./install-local.ps1This will build the native binary (Rust toolchain required) and install it to ~/.local/bin/pwsh-prompt.
Options:
-Force— skip confirmation prompts and overwrite existing installation-Update— pull latest changes from the remote before building
# Pull latest and install without prompts
./install-local.ps1 -Update -ForceAdd this line to your PowerShell profile ($PROFILE):
Invoke-Expression (& ~/.local/bin/pwsh-prompt init)For a minimal prompt with just path, git, and host information:
# Edit the init output or modify your profile to use --simple
pwsh-prompt prompt --simpleTo check the installed version:
pwsh-prompt --versionThe Rust implementation in src/pwsh-prompt-rs is a byte-compatible port of
the C# tool and is the build target for releases and install-local.ps1.
# Rust build (release)
cargo build --release --manifest-path src/pwsh-prompt-rs/Cargo.toml
# Rust tests
cargo test --manifest-path src/pwsh-prompt-rs/Cargo.tomlThe original C# project is kept intact for side-by-side comparison:
# Quick build test
dotnet build src/pwsh-prompt -c Release -f net10.0
# Publish for Windows
dotnet publish src/pwsh-prompt -c Release -r win-x64 --output ./publish
# Publish for Linux
dotnet publish src/pwsh-prompt -c Release -r linux-x64 --output ./publish
# Or build via solution
dotnet build pwsh-prompt.slnxCompare end-to-end performance (process startup plus a full render) of the Rust and C# binaries across repo, non-repo, truncation, simple mode, and PR scenarios:
pwsh -File src/pwsh-prompt-rs/bench.ps1 # 100 timed runs per scenario
pwsh -File src/pwsh-prompt-rs/bench.ps1 -RustOnly # skip the C# comparisonThe script builds either binary if it is missing, cleans the inherited
PROMPT_* environment, and reports median/min plus the rust-to-c# ratio.
pwsh-prompt/
├── src/
│ ├── pwsh-prompt/ # Main C# project (reference implementation)
│ │ ├── Segments/ # Segment implementations (ISegment)
│ │ ├── Program.cs # Entry point and mode routing
│ │ ├── Arguments.cs # Command-line argument parsing
│ │ ├── GitInfo.cs # Git repository detection and caching
│ │ ├── Init.cs # PowerShell initialization script generator
│ │ └── ... # Other core files
│ └── pwsh-prompt-rs/ # Rust port (byte-compatible, release target)
│ ├── src/ # One module per C# file, plus path/ANSI helpers
│ ├── init.ps1 # Init script template (extracted from the C#)
│ └── parity.ps1 # Byte-parity harness against the C# binary
├── install-local.ps1 # Build from source and install
├── install-remote.ps1 # Download from GitHub releases and install
└── pwsh-prompt.slnx # Solution file
The prompt uses a modular segment system where each visual element (path, git branch, exit code, etc.) implements the ISegment interface. The application runs in two modes:
- init mode: Generates PowerShell initialization code to install the prompt
- prompt mode: Renders the actual prompt on every invocation
Since this runs on every prompt render, performance is critical:
- Native AOT compilation eliminates JIT overhead for instant startup
- Environment variable caching avoids repeated git file I/O and
gh pr viewsubprocess calls (cache invalidates when the discovered.gitdirectory changes or.git/HEADis modified —cdwithin the same repo reuses the cache) - Per-branch PR cache keeps PR info for every branch visited in the current shell session, so toggling between branches doesn't re-run
gh pr view - Non-blocking PR lookup: on the first visit to a new branch,
gh pr viewruns in a background job so the prompt renders immediately; the PR number appears on the next prompt - Stack-allocated buffers minimize heap allocations via
ValueStringBuilder - Smart truncation calculates exact widths for optimal path display
The PowerShell profile caches git information between prompts, avoiding file system operations when the branch hasn't changed.
MIT License - see LICENSE file for details.
Copyright (c) 2025 Lucas Pimentel