$ show GTJasonMK/lessAI
LessAI is a Tauri 2 desktop application for AI-assisted document rewriting. It supports importing documents in plain text, Markdown, LaTeX, DOCX, and PDF formats, segmenting them into rewrite units, and sending them to an OpenAI-compatible LLM for rewriting. The system provides a workbench view with a side-by-side editor and review panel, enabling users to view diff hunks, accept/reject suggestions, and finalize writeback to the original file. For complex formats like DOCX and PDF, a slot-based model preserves locked placeholders (e.g., tables, images, hyperlinks) while allowing editable text regions to be rewritten. The application includes a web demo mode for plain text only, a full settings UI for provider configuration, and an in-app update mechanism. The architecture is a monolith split between a Rust backend (Tauri commands, document adapters, rewrite pipeline) and a React/TypeScript frontend with custom hooks, progressive rendering, and a slot-based structured editor. The codebase is well-structured with extensive unit tests, roundtrip test fixtures, and CI/CD pipelines for cross-platform bundles.
The LLM identified 3 files worth highlighting for reuse:
Provides a safe atomic file write operation using a temporary file and rename, with parent directory sync and Windows ReplaceFileW support. This is a standalone utility that can be extracted and reused in any Rust project requiring crash-safe file writes. It demonstrates non-obvious handling of cross-platform edge cases (parent dir sync, temp file collision).
Implements a generic Myers diff algorithm with character-level and line-level modes, along with a fallback prefix/suffix diff for large inputs. This is a high-quality, self-contained Rust module that can be reused in any project needing text diffing. It handles edge cases like empty inputs, large traces, and line endings.
Splits text into clauses, sentences, or paragraphs based on punctuation and language-specific rules (CJK, Latin). This is a reusable utility for text segmentation, particularly useful for applications that need to break text into rewrite units or chunks. It handles edge cases like closing quotes, numeric contexts, and ellipsis, making it non-trivial.