Repository navigation
feat!: rebuild AutoFix as a fast, simple single-process app - #38
Open
HusseinBaraja wants to merge 2 commits into
Open
HusseinBaraja wants to merge 2 commits into
HusseinBaraja wants to merge 2 commits into
Conversation
Old design: two processes, IPC, SQLite, 50+ settings, local word-list engine by default, and a 700 ms auto timeout shorter than most LLM responses, so automatic fixes rarely landed. - type-tracking engine with backspace-and-retype edits; fixes land one API round trip after the trigger - triggers: sentence end, pause, Enter hold, Ctrl+Alt+Space - Backspace right after a fix undoes it and learns the words - providers: DeepSeek, OpenAI, Anthropic, Gemini, Groq, OpenRouter, Mistral, Ollama, custom OpenAI-compatible - one-page settings with key paste-and-test and a Try it box - unit tests plus an end-to-end harness against the real exe BREAKING CHANGE: Rust engine, WPF settings app, TOML/SQLite storage removed. Settings start fresh; saved provider keys are still read.
- ignore focus events from background apps; a background WPF host reset the typed text about once a second - resync modifiers after secure-desktop switches so Space is not taken as the shortcut - queue user input behind replayed input to keep key order - tag each edit with an id and scale its timeout with its size - skip key translation while input is held (dead keys) - drop held keys when focus moves during an Enter hold - never complete an unfinished last word after a pause - skip fixes that change the first letter of a possibly partial word - stop the timer spinning while a request is in flight - save learned words off the hook thread - selection fix: abort if the user typed meanwhile; keep restored clipboard out of history - log error kinds only, never provider error text
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The core idea (type anywhere, an LLM quietly fixes typos) was buried in ~43k lines of Rust + C#. That code ran two processes with IPC and SQLite and had 50+ settings. Its default engine was a local word list. The automatic API timeout was 700 ms, which is shorter than most LLM responses, so automatic fixes rarely landed. The model also had to return JSON with character offsets, which is slow and fragile.
This PR replaces it with one lean .NET 8 app (~4k lines). Paste an API key and it works, in about one API round trip.
What changed
src/AutoFix.Core/Engine/TypingEngine.cs): a platform-free state machine. It tracks the text typed before the caret and applies a fix by deleting back to the first changed character and retyping the rest. There is no clipboard use and no reading of the document. Keys you press while a fix is typed, or while Enter is held, are swallowed and replayed in their original order.Verification
Machine: Windows 11 Pro, 16 GB RAM.
dotnet build AutoFix.slnwith warnings treated as errors: passes, 0 warnings.dotnet test tests/AutoFix.Tests: 74/74 passed. Covers the engine state machine, edit planning, response guard, LLM client (request shapes, retry quirks, error mapping), settings, and dead keys.scripts/test-e2e.ps1: 7/7 passed, repeated across several runs. It runs the realAutoFix.exeagainst a mock server and types into a real Win32 text box withSendInput. Scenarios: sentence fix, typing during a request, Backspace undo, Enter hold, fast typing through an Enter hold (key order), selection fix with the clipboard preserved, and no request from a password field.dist/AutoFix.exe(63 MB, self-contained) also passes the E2E check.deepseek-chat):SendInputat about 1 ms per event; I measured the same rate without AutoFix running.Known limitations
🤖 Generated with Claude Code