A lightweight Go binary that auto-corrects your common typing mistakes in PowerShell before commands execute.
Type git sattus, press Enter and CommandFixer silently swaps it for git status - then runs it, if you approve.
Works in both PowerShell 7 (pwsh) and Windows PowerShell 5 (powershell.exe).
It is for someone who lives in PowerShell on Windows and mistypes the same handful of commands often enough to want them corrected in place. Suggestions arrive through a PSReadLine hook and nothing is rewritten behind your back: you confirm before the corrected command runs.
It is not a shell, not a replacement for tab completion and not a command generator. It matches against a database of common CLI tools using a similarity threshold, so it corrects spelling rather than intent: it will turn a misspelt command into the one you meant to type, never a wrong command into the right one. It works by hooking PowerShell profiles on Windows and has no meaning outside that environment.
git clone https://github.com/oernster/commandfixer
cd commandfixer
.\build.ps1 -Test # run tests then buildOr with go directly:
go build -o commandfixer.exe ..\install.ps1The installer:
- Copies
commandfixer.exeto%LOCALAPPDATA%\CommandFixer\ - Adds that directory to your user
PATH - Copies
config.example.jsonto%USERPROFILE%\.typo-fixer\config.json - Hooks into your PowerShell profile for both PS7 and PS5
Then restart PowerShell (both pwsh and powershell.exe will have the hook).
.\uninstall.ps1The uninstaller:
- Removes the hook from both PS7 (
Documents\PowerShell\profile.ps1) and PS5 (Documents\WindowsPowerShell\profile.ps1) - Removes the binary from
%LOCALAPPDATA%\CommandFixer\ - Removes that directory from your user
PATH - Keeps your config and log at
%USERPROFILE%\.typo-fixer\(data is yours)
To also delete config and log:
.\uninstall.ps1 -RemoveConfigThen restart PowerShell to complete removal.
You can also uninstall via the binary directly (if it is on your PATH):
commandfixer uninstall # removes profile hooks only; does not touch binary or PATH
To upgrade to a new build (or reinstall after code changes), rebuild and re-run the installer. install.ps1 is idempotent: it overwrites the existing binary with -Force, leaves your PATH entry and your config/log untouched and refreshes the PowerShell profile hook for both PS7 and PS5.
.\build.ps1 -Test # rebuild commandfixer.exe (runs tests first)
.\install.ps1 # overwrite the installed binary and refresh the hookThen restart PowerShell so the new binary is picked up.
For a clean reinstall that also resets your config and log, uninstall with -RemoveConfig first, then install:
.\uninstall.ps1 -RemoveConfig
.\build.ps1
.\install.ps1There is nothing you have to configure. Corrections come from a database built into the binary, so it is useful the moment it is installed.
If you want to tune it, edit %USERPROFILE%\.typo-fixer\config.json:
{
"settings": {
"log_file": "",
"max_log_lines": 10000,
"similarity_threshold": 0.6
}
}similarity_threshold is how close a typo must be to a known command before it
is offered, in the range (0.0, 1.0]. Lower catches more typos and starts
offering corrections you did not want. log_file empty means the default
location below.
Type any misconfigured command and press Enter:
PS> git sattus
CommandFixer: did you mean: git status [Y/n]
On branch main ...
CommandFixer hooks into PSReadLine (built into both PowerShell 7 and Windows PowerShell 5) and intercepts the Enter key. When you press Enter:
- PSReadLine captures the current buffer.
- It calls
commandfixer suggest <your-command>. - CommandFixer fuzzy-matches it against a built-in database of CLI tools, their subcommands and the standard Windows commands and prints a suggestion when one is close enough. Nothing is printed when it has nothing to offer.
- If there is a suggestion, PowerShell shows it and waits for you to confirm.
- The corrected command executes only if you accept it.
No system-wide keyboard hooks. No persistent service required. The binary runs in milliseconds.
commandfixer suggest <cmd> Fuzzy-match and print correction (used by hook)
commandfixer correct <cmd> Like suggest but also logs the correction
commandfixer log <from> <to> Record a correction you accepted (used by hook)
commandfixer install [profile] Add PSReadLine hook to your profile(s)
commandfixer uninstall [profile] Remove the hook from your profile(s)
commandfixer stats Show correction count and rule breakdown
commandfixer version Print version
commandfixer help Show help
Without a [profile] argument, install and uninstall target both PS7 and PS5 profiles simultaneously.
commandfixer correct "git sattus"
# Prints: git status| Path | Purpose |
|---|---|
%USERPROFILE%\.typo-fixer\config.json |
Settings: log location and match sensitivity |
%USERPROFILE%\.typo-fixer\corrections.log |
JSONL corrections log |
%LOCALAPPDATA%\CommandFixer\commandfixer.exe |
Installed binary |
Documents\PowerShell\profile.ps1 |
PS7 profile (hook appended here) |
Documents\WindowsPowerShell\profile.ps1 |
PS5 profile (hook appended here) |
- DEVELOPMENT.md - build steps, local dev workflow, debugging
- ARCHITECTURE.md - system design, module breakdown, data flow
- TESTING.md - testing strategy, coverage requirements, how to run tests
- TECH_DEBT.md - what is still open, what is deliberately left and what only looks like debt