Skip to content

Releases

v2.31.5

Choose a tag to compare

@github-actions github-actions released this 15 Nov 08:50

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, so hostscli blok example.com suggests hostscli 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 --repeat run 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, staticcheck and 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

Full Changelog: v2.31.4...v2.31.5

v2.31.4

Choose a tag to compare

@github-actions github-actions released this 15 Nov 08:14

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 eval received 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, staticcheck and 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

Full Changelog: v2.31.3...v2.31.4

v2.31.3

Choose a tag to compare

@github-actions github-actions released this 15 Nov 06:53

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 and a\'b was 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!b failed with "Event not found" and a multi line value was an unmatched quote. Exclamation marks, newlines and single quotes are now escaped individually.
  • 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 echo is no longer reported as a timeout.

Verification

  • Full test suite, gofmt, go vet, staticcheck and 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

Full Changelog: v2.31.2...v2.31.3

v2.31.2

Choose a tag to compare

@github-actions github-actions released this 15 Nov 06:11

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 --repeat or 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 as git 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:\Windows reported no suggestion instead of ls C:\Windows. cat, gc, type and Get-Content on absolute Windows paths (quoted or not) now get the ls suggestion, and the same fix covers the other rules that parse arguments, including the history based rules.

Verification

  • Full test suite, gofmt, go vet, staticcheck and 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

Choose a tag to compare

@github-actions github-actions released this 15 Nov 05:40

Fixes

  • Equals forms of the information options are passed through the shell function. --alias=NAME and --shell-logger=FILE were not matched by the pass-through guard, so the shell function evaluated their output as a corrected command: fuck --alias=myfuck executed the printed alias code and fuck --shell-logger=FILE started 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_command killed the re-run command before it printed anything, so every rule that needs the output silently stopped working, and a huge value overflowed the time.Duration conversion and turned the wait into an immediate timeout. wait_command and wait_slow_command are now limited to 1–3600 seconds, a negative history_limit or num_close_matches falls back to the defaults too, and the replaced values are reported by a correction run and by go-fuck --doctor instead of being applied silently.

Performance

  • The shell is detected only by the commands that need it. --help and --list-rules never 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, --setup and the correction flow, which detect the shell right before they need it.

Verification

  • Full test suite, gofmt, go vet, staticcheck and 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

Full Changelog: v2.31.0...v2.31.1

v2.31.0

Choose a tag to compare

@github-actions github-actions released this 15 Nov 05:09

Features

  • Contradictory rule settings are reported. exclude_rules wins over rules and priority, so a rule that appears in both rules and exclude_rules is either redundant or silently ignored, and a priority override for an excluded or disabled rule never applies. A correction run now warns about these contradictions, and go-fuck --doctor has a new rules check that lists them:

    • rules "git_push" also appears in exclude_rules
    • priority "git_push" is ignored because the rule is excluded
    • priority "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 vet and 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 rules warning line in go-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

Choose a tag to compare

@github-actions github-actions released this 15 Nov 04:49

Features

  • Unknown rule names in the settings are reported. A typo in rules, exclude_rules or priority silently changed the behavior: an excluded rule kept running, a rule listed in rules was 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, and go-fuck --doctor lists them in the config check with the setting and the name (for example exclude_rules "git_pushh"). The check covers the rules, exclude_rules and priority settings.

Verification

  • Full test suite, gofmt, go vet and 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 in go-fuck --doctor, while the built-in rule names and All rules enabled stay 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

Full Changelog: v2.29.0...v2.30.0

v2.29.0

Choose a tag to compare

@github-actions github-actions released this 15 Nov 04:11

Fixes

  • fuck --list-rules and 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-rules therefore captured the rule list and executed every rule name as a command (the list contains names such as java, history, man, open and sudo that are real commands), and fuck --json executed the JSON report. The bash, zsh, fish and PowerShell aliases now pass --help, --version, --doctor, --list-rules, --json, --setup, --alias and --shell-logger through 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 vet and 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 --json and fuck --doctor print their output without evaluating it, while fuck still 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

Choose a tag to compare

@github-actions github-actions released this 13 Nov 11:08

Features

  • --output-from FILE fixes 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-from without --force-command now explains itself instead of printing only the short usage text.

Verification

  • Full test suite, gofmt, go vet and 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 the ls internal suggestion from the cat_dir rule through both a file and standard input, without re-running the command; a missing file and a missing --force-command report 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

Choose a tag to compare

@github-actions github-actions released this 13 Nov 10:08

Features

  • Rule provenance in the JSON report. Every suggestion of the --json correction 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, the schema_version stays 1, and the interactive mode is unchanged.
  • Rule metadata with --list-rules --json. The JSON form of --list-rules now prints one object per rule with its name, priority, enabled_by_default, requires_output and side_effect fields 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 vet and 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", and go-fuck --list-rules --json lists 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

Full Changelog: v2.26.1...v2.27.0