Before consulting rules, fix_command now walks the resolver chain in
the fixed order learned-db -> history -> /nix/store/zc6fy62c341aibk36p4ywff7rf9wn4wx-ripgrep-15.2.0/bin:/run/wrappers/bin:/home/fujin/.nix-profile/bin:/nix/profile/bin:/home/fujin/.local/state/nix/profile/bin:/etc/profiles/per-user/fujin/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/fujin/.local/share/JetBrains/Toolbox/scripts:/nix/store/rm982p6i9ry7rwq5jn638kdpv0a2331f-binutils-wrapper-2.46/bin:/nix/store/xabfaf6i4ry9r7jdg8rn7z56j34fjfgm-hyprland-qtutils-0.1.5/bin:/nix/store/mjgd7lbvp8rli365likrg9m4a5mmi5w4-pciutils-3.15.0/bin:/nix/store/paknc34adnxagnadmx2pg4c90hss8amv-pkgconf-wrapper-2.5.1/bin guess -> binary help:
history similarity runs before the disk-wide program-name guess per
the user requirement, and the binary's own --help is the last
automatic option before asking. Whichever resolver yields a script
is logged with its source, recorded via record(), and run through
the existing priority-0 CorrectedCommand block, so every automatic
fix is remembered; declines and aborts still record nothing and the
ask path is unchanged.
When no learned correction matches, fuzzy-match the mistyped token
against executables from $PATH and shell aliases. A guess is auto-run
and recorded into the learned-corrections db only when it is
unambiguous: the token is not an existing executable, contains no
path separators or extensions, shares its first character with the
candidate, has similarity of at least 0.8, and exactly one candidate
survives. Asking the user stays the last resort.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Record user-accepted corrections in a shelve-backed store and replay
them on future matching mistakes, bypassing rule evaluation entirely.
Two-level matching: exact full-command lookup, then word-level
reconstruction that generalises to different arguments (e.g. learning
'git psuh origin main' also fixes 'git psuh origin dev').
Using the `force_command` argument will run into issues as the
`_get_raw_command` method simply returns the value of `force_command`
(which is a string) while it should actually return a list.
Fix#1240