Repository navigation
Releases
v2.31.5
Fixes
- hostscli suggestions now correct the misspelled command. The rule passed the whole
Error: No such command "..."line to the replacement helper, so the broken command was never found in the command line: every suggestion was the original command, repeated once per candidate. The command name is now captured and replaced, sohostscli blok example.comsuggestshostscli block example.com. - grep_arguments_order no longer suggests an unchanged command. It moved the file argument to the end even when it was already there, so
grep -r foo .was offered unchanged. - Corrections that change nothing are dropped for every rule. The shared replacement helper now removes suggestions that equal the original command and duplicates. A correction that returns the same command is useless and makes
--repeatrun the failing command forever. - New regression test across all rules. It runs every rule against the shared realistic corpus and fails when a rule suggests the original command or an empty command, so this class of bug cannot come back silently.
Verification
- Full test suite,
gofmt,go vet,staticcheckand the rule list check pass; the new regression test covers all 251 rules against the corpus. - CI is green on Linux, macOS and Windows with lint and the 94% coverage gate.
- Distribution manifests are regenerated for 2.31.5 and the AUR package is published as 2.31.5-1.
Upgrade
Homebrew, Scoop and AUR update through their package managers; go install github.com/leafevans/go-fuck/v2/cmd/go-fuck@latest picks up 2.31.5.
Changelog
- 3179318: fix(rules): stop suggesting corrections that change nothing (@leafevans)
Full Changelog: v2.31.4...v2.31.5
v2.31.4
Fixes
-
The tcsh alias passes the failed command to go-fuck unchanged. The alias captured the previous command with an unquoted command substitution, so csh split it on blanks and expanded globs before go-fuck saw it:
false *reached go-fuck as the listing of the working directory, so the correction was based on the wrong command.- Quoted arguments were split into several words, and repeated blanks were collapsed.
- The final
evalreceived the words separately and could change the command as well.
The alias now captures the history and the correction inside double quotes and hands the raw command over in
TF_HISTORY, the same way the bash and zsh aliases do; the variable is cleared after the run. This also removes the need for an extra shell quoting round trip. -
The tcsh alias now has a behavior test. It runs a real tcsh in a temporary directory with a stub go-fuck and checks that a glob, double quotes and single quotes arrive unchanged; it fails on the previous alias. The shell integration CI job runs it next to the alias syntax checks.
Verification
- Full test suite,
gofmt,go vet,staticcheckand the rule list check pass. - CI is green on Linux, macOS and Windows with lint, the 94% coverage gate and the new tcsh alias test against a real tcsh.
- The quote round trip tests for bash, zsh, fish and tcsh from the previous release still pass.
- Distribution manifests are regenerated for 2.31.4 and the AUR package is published as 2.31.4-1.
Upgrade
Homebrew, Scoop and AUR update through their package managers; go install github.com/leafevans/go-fuck/v2/cmd/go-fuck@latest picks up 2.31.4.
Changelog
- 23226e7: fix(tcsh): quote the history the alias hands to go-fuck (@leafevans)
Full Changelog: v2.31.3...v2.31.4
v2.31.3
Fixes
-
fish and tcsh command lines are quoted with their own rules. Both shells used the POSIX quoting of the generic shell, which broke values that are legal in them:
- fish treats a backslash before a single quote as an escape, so the POSIX
'"'"'trick left the closing quote escaped anda\'bwas a syntax error. fish now doubles backslashes and escapes single quotes inside one single quoted string. - csh performs history substitution even inside single quotes, and a plain newline ends the quoted string:
a!bfailed with "Event not found" and a multi line value was an unmatched quote. Exclamation marks, newlines and single quotes are now escaped individually.
- fish treats a backslash before a single quote as an escape, so the POSIX
-
Round-trip tests cover every shell. The new tests run bash, zsh, fish and tcsh when they are installed and compare the argument the shell passes with the original bytes; the shell integration CI job now runs them for all four shells. This is how the fish and tcsh defects were found.
-
The output tests tolerate a loaded machine: the suite runs packages in parallel and a healthy
echois no longer reported as a timeout.
Verification
- Full test suite,
gofmt,go vet,staticcheckand the rule list check pass. - CI is green on Linux, macOS and Windows with lint and the 94% coverage gate, including the new quote round-trip step against real bash, zsh, fish and tcsh.
- Local round-trip runs with the extracted shell binaries: 40/40 quoted words (10 values x 4 shells) reach the shell unchanged.
- Distribution manifests are regenerated for 2.31.3 and the AUR package is published as 2.31.3-1.
Upgrade
Homebrew, Scoop and AUR update through their package managers; go install github.com/leafevans/go-fuck/v2/cmd/go-fuck@latest picks up 2.31.3.
Changelog
- cdf68e6: fix(shells): quote fish and tcsh command lines with their own rules (@leafevans)
- 1821c36: test: tolerate a loaded machine in the output tests (@leafevans)
Full Changelog: v2.31.2...v2.31.3
v2.31.2
Fixes
-
PowerShell command lines are quoted and split with PowerShell rules. The PowerShell shell inherited the POSIX quoting and splitting of the generic shell, which broke single quotes and absolute Windows paths:
- Quoting a corrected command for
--repeator a git alias expansion used the shlex'"'"'escape. PowerShell does not concatenate adjacent string literals, so it parsed that as several arguments and a correction such asgit commit -m 'hello'was broken. PowerShell single quoted strings with doubled quotes now round-trip exactly. - Splitting treated the backslash as an escape character, so a Windows path lost its backslashes. Rules that compare the path of the command line with the path in the error message never matched an absolute path:
cat C:\Windowsreported no suggestion instead ofls C:\Windows.cat,gc,typeandGet-Contenton absolute Windows paths (quoted or not) now get thelssuggestion, and the same fix covers the other rules that parse arguments, including the history based rules.
- Quoting a corrected command for
Verification
- Full test suite,
gofmt,go vet,staticcheckand the rule list check pass; the new tests compare the splitter and the quoting round-trip against a real Windows PowerShell 5.1, and the rule test covers an absolute Windows path. - CI is green on Linux, macOS and Windows with lint and the 94% coverage gate; live checks with an isolated configuration directory confirm the four absolute path scenarios and that relative paths still work.
- Distribution manifests are regenerated for 2.31.2 and the AUR package is published as 2.31.2-1.
Upgrade
Homebrew, Scoop and AUR update through their package managers; go install github.com/leafevans/go-fuck/v2/cmd/go-fuck@latest picks up 2.31.2.
Changelog
- cf3fef0: fix(powershell): quote and split command lines with PowerShell rules (@leafevans)
Full Changelog: v2.31.1...v2.31.2
v2.31.1
Fixes
-
Equals forms of the information options are passed through the shell function.
--alias=NAMEand--shell-logger=FILEwere not matched by the pass-through guard, so the shell function evaluated their output as a corrected command:fuck --alias=myfuckexecuted the printed alias code andfuck --shell-logger=FILEstarted the logger inside the evaluation. The bash, zsh, fish and PowerShell guards now match the equals forms as well. -
Out-of-range settings values are replaced and reported. A zero or negative
wait_commandkilled the re-run command before it printed anything, so every rule that needs the output silently stopped working, and a huge value overflowed thetime.Durationconversion and turned the wait into an immediate timeout.wait_commandandwait_slow_commandare now limited to 1–3600 seconds, a negativehistory_limitornum_close_matchesfalls back to the defaults too, and the replaced values are reported by a correction run and bygo-fuck --doctorinstead of being applied silently.
Performance
- The shell is detected only by the commands that need it.
--helpand--list-rulesnever touch the shell, so they no longer walk the process tree, which is a process snapshot on Windows. Local startup comparisons measured a few milliseconds saved per invocation for those commands and no change for--version,--doctor,--alias,--setupand the correction flow, which detect the shell right before they need it.
Verification
- Full test suite,
gofmt,go vet,staticcheckand the rule list check pass; CI is green on Linux, macOS and Windows with lint and the 94% coverage gate. - The PowerShell integration script (Windows PowerShell 5.1) and the bash/zsh part of the shell integration script pass locally, including the new pass-through guard and the instant mode aliases.
- Distribution manifests are regenerated for 2.31.1 and the AUR package is published as 2.31.1-1.
Upgrade
Homebrew, Scoop and AUR update through their package managers; go install github.com/leafevans/go-fuck/v2/cmd/go-fuck@latest picks up 2.31.1.
Changelog
- 100ee08: perf(cli): detect the shell only for commands that need it (@leafevans)
- 950c9f8: fix(alias): pass the equals form of the information options through (@leafevans)
- 808a85f: fix(settings): replace out-of-range wait and history values (@leafevans)
Full Changelog: v2.31.0...v2.31.1
v2.31.0
Features
-
Contradictory rule settings are reported.
exclude_ruleswins overrulesandpriority, so a rule that appears in bothrulesandexclude_rulesis either redundant or silently ignored, and apriorityoverride for an excluded or disabled rule never applies. A correction run now warns about these contradictions, andgo-fuck --doctorhas a newrulescheck that lists them:rules "git_push" also appears in exclude_rulespriority "git_push" is ignored because the rule is excludedpriority "git_push" is ignored because the rule is not enabled
Consistent settings stay silent, and unknown names keep the dedicated warning from 2.30.0.
Verification
- Full test suite,
gofmt,go vetand the rule list check pass; CI is green on Linux, macOS and Windows with lint and the 94% coverage gate. - Live checks with an isolated configuration directory: contradictory settings produce the warning during a correction run and the
ruleswarning line ingo-fuck --doctor; the default settings and a consistent configuration stay silent. - Distribution manifests are regenerated for 2.31.0 and the AUR package is published as 2.31.0-1.
Upgrade
Homebrew, Scoop and AUR update through their package managers; go install github.com/leafevans/go-fuck/v2/cmd/go-fuck@latest picks up 2.31.0.
Changelog
- e274952: feat(settings): report contradictory rule settings (@leafevans)
- cee4570: fix(settings): apply De Morgan's law to the enabled check
Full Changelog: v2.30.0...v2.31.0
v2.30.0
Features
- Unknown rule names in the settings are reported. A typo in
rules,exclude_rulesorprioritysilently changed the behavior: an excluded rule kept running, a rule listed inruleswas never enabled, and a priority override was never applied. The names are now validated against the built-in rules, so a correction run prints a warning next to the unknown settings keys, andgo-fuck --doctorlists them in the config check with the setting and the name (for exampleexclude_rules "git_pushh"). The check covers therules,exclude_rulesandprioritysettings.
Verification
- Full test suite,
gofmt,go vetand the rule list check pass; CI is green on Linux, macOS and Windows with lint and the 94% coverage gate. - Live checks with an isolated configuration directory: a settings file with
exclude_rules: ["git_pushh"]produces the warning during a correction run and a warning line ingo-fuck --doctor, while the built-in rule names andAll rules enabledstay silent. - Distribution manifests are regenerated for 2.30.0 and the AUR package is published as 2.30.0-1.
Upgrade
Homebrew, Scoop and AUR update through their package managers; go install github.com/leafevans/go-fuck/v2/cmd/go-fuck@latest picks up 2.30.0.
Changelog
- 22bfa6c: feat(settings): report unknown rule names in the settings (@leafevans)
Full Changelog: v2.29.0...v2.30.0
v2.29.0
Fixes
fuck --list-rulesand the other information commands work through the shell function. The shell function evaluates go-fuck's standard output as the corrected command, and the information commands print their result there.fuck --list-rulestherefore captured the rule list and executed every rule name as a command (the list contains names such asjava,history,man,openandsudothat are real commands), andfuck --jsonexecuted the JSON report. The bash, zsh, fish and PowerShell aliases now pass--help,--version,--doctor,--list-rules,--json,--setup,--aliasand--shell-loggerthrough to go-fuck, so their output stays on the terminal.
Updating the alias
The alias format version moves to 3. An alias generated by go-fuck 2.28 and older keeps working for corrections, but it still evaluates the information commands. The next shell start replaces it because the configuration file evaluates go-fuck --alias; to update a running shell, evaluate the alias again (eval "$(go-fuck --alias)" in bash and zsh, iex "$(go-fuck --alias)" in PowerShell) or run go-fuck --setup. go-fuck now warns when it detects an older alias, including the PowerShell reload command.
Verification
- Full test suite (including behavior tests that run the generated bash and PowerShell aliases against a stub go-fuck),
gofmt,go vetand the rule list check pass; CI is green on Linux, macOS and Windows with lint and the 94% coverage gate. - Live checks in WSL bash, WSL zsh and PowerShell:
fuck --list-rules,fuck --jsonandfuck --doctorprint their output without evaluating it, whilefuckstill evaluates a correction. - Distribution manifests are regenerated for 2.29.0 and the AUR package is published as 2.29.0-1.
Upgrade
Homebrew, Scoop and AUR update through their package managers; go install github.com/leafevans/go-fuck/v2/cmd/go-fuck@latest picks up 2.29.0.
Changelog
- dd7c9f1: feat(alias): pass the information commands through the shell function (@leafevans)
- 9ea3511: test: check the shell logger invocation in the fallback alias (test-only fix, omitted by the changelog filter)
Full Changelog: v2.28.0...v2.29.0
v2.28.0
Features
-
--output-from FILEfixes a command without re-running it. Editor plugins, terminal integrations and AI agents usually captured the output of the failed command already, but go-fuck re-ran the command to get it. The new option (or-for standard input) takes the output from the caller instead: side effects are not repeated and a command that can no longer be run can still be fixed. The text is normalized like captured output (a UTF-8 byte order mark is dropped and CRLF endings become LF) and the option requires--force-command:$ go-fuck --json --force-command "git push" --output-from failed-output.log $ cat failed-output.log | go-fuck --json --force-command "git push" --output-from -
-
Command line errors are printed before the usage line. A misuse such as
--output-fromwithout--force-commandnow explains itself instead of printing only the short usage text.
Verification
- Full test suite,
gofmt,go vetand the rule list check pass; CI is green on Linux, macOS and Windows with lint and the 94% coverage gate (94.9% measured). - Distribution manifests are regenerated for 2.28.0 and the AUR package is published as 2.28.0-1.
- Live checks: the supplied output of
cat internal("Is a directory") produces thels internalsuggestion from thecat_dirrule through both a file and standard input, without re-running the command; a missing file and a missing--force-commandreport clear errors.
Upgrade
Homebrew, Scoop and AUR update through their package managers; go install github.com/leafevans/go-fuck/v2/cmd/go-fuck@latest picks up 2.28.0.
Changelog
- dcf576e: feat(cli): add --output-from to fix a command without re-running it (@leafevans)
Full Changelog: v2.27.0...v2.28.0
v2.27.0
Features
- Rule provenance in the JSON report. Every suggestion of the
--jsoncorrection report now names the rule that produced it ("rule": "git_not_command"), so editor plugins and scripts can filter, group or debug suggestions. The field is optional, theschema_versionstays1, and the interactive mode is unchanged. - Rule metadata with
--list-rules --json. The JSON form of--list-rulesnow prints one object per rule with itsname,priority,enabled_by_default,requires_outputandside_effectfields instead of a bare array of names, which makes it usable for generating settings files and documentation. The plain text listing is unchanged.
Verification
- Full test suite,
gofmt,go vetand the rule list check pass; CI is green on Linux, macOS and Windows with lint and the 94% coverage gate (94.9% measured). - Distribution manifests are regenerated for 2.27.0 and the AUR package is published as 2.27.0-1.
- Live checks:
go-fuck --json --force-command "git brnch"reports"rule": "git_not_command", andgo-fuck --list-rules --jsonlists the metadata of all 251 rules.
Upgrade
Homebrew, Scoop and AUR update through their package managers; go install github.com/leafevans/go-fuck/v2/cmd/go-fuck@latest picks up 2.27.0.
Changelog
- 5e8318f: feat(json): report rule provenance and rule metadata (@leafevans)
Full Changelog: v2.26.1...v2.27.0