CommandFixer is a small Go binary that corrects common typing mistakes in PowerShell before the command executes.

Type git sattus, press Enter and CommandFixer offers git status instead. Approve it and the corrected command runs.

PS> git sattus
CommandFixer: did you mean: git status [Y/n]
On branch main ...

The source lives at CommandFixer.


Problem → System → Outcome

Problem. Command-line muscle memory produces the same small typos hundreds of times: git sattus, docker pss, transposed letters in commands typed dozens of times a day. Each one costs a failed run, a re-type and a broken train of thought.

System. A PSReadLine hook that intercepts Enter, hands the buffer to a fast Go binary, applies user-defined correction rules from a JSON config and asks for confirmation when a correction changes the command. No keyboard hooks, no background service.

Outcome. The typo tax disappears. Corrections happen at the exact moment of failure, cost one keypress to accept and are logged so the rule set can grow from real behaviour.


How it works

CommandFixer hooks into PSReadLine, which is built into both PowerShell 7 and Windows PowerShell 5. When you press Enter:

  1. PSReadLine captures the current buffer.
  2. The hook calls commandfixer suggest <your-command>.
  3. CommandFixer loads the rules, applies them and prints the corrected form.
  4. If the command changed, PowerShell prompts for confirmation.
  5. The corrected command executes.

The binary runs in milliseconds. There is no system-wide keyboard hook and no persistent service; the tool exists only for the instant between Enter and execution.

Corrections are user-defined rules in a JSON config:

{
  "typos": [
    { "from": "git sattus", "to": "git status" },
    { "from": "docker pss", "to": "docker ps" }
  ]
}

Deliberate boundaries

The design is defined as much by refusals as by features:

  • Consent per correction. A changed command never runs silently; the confirmation prompt is the contract.
  • Your rules, not a model. Corrections come from an explicit config you own, so the tool never surprises you with a guess.
  • Uninstall keeps your data. Removing the tool removes the hook and the binary; the config and the corrections log stay yours unless you ask for them to go.
  • Small surface. A handful of CLI verbs (suggest, correct, install, uninstall, stats, version) and nothing else.

A JSONL log records every correction, and commandfixer stats shows the count and rule breakdown, which is exactly the feedback loop needed to decide which typos deserve rules.


CommandFixer at a glance

Capabilities

  • Corrects typos at the Enter keypress
  • Confirmation before any changed command runs
  • User-defined JSON rule set
  • PowerShell 7 and Windows PowerShell 5
  • Correction stats and JSONL log
  • Idempotent installer and clean uninstall

Technology

  • Go, single native binary
  • PSReadLine Enter-key hook
  • JSON configuration
  • Millisecond execution, no service
  • Per-user install, no admin rights
  • Open source

What this taught me

The best tools live at the moment of failure.

A spelling corrector that runs after the error message has already scrolled past is documentation. One that runs in the gap between Enter and execution is infrastructure.

The other lesson is restraint. The obvious upgrade path (fuzzy matching everything, learning rules automatically, correcting silently) leads to a tool you no longer trust at a prompt that can delete things.

A tool that asks first gets to stay installed.