feat: undo/redo system, action history, and LLM-agent CLI ergonomics - #84
Merged
Conversation
Implement a linear-timeline undo/redo system with snapshot-based state restoration, action history with config/file diffs, and machine-readable CLI output for LLM agent consumption. - Add history module with ActionRecord, ActionState, FileSnapshot structs and ActionHistory with load/save/push/undo/redo/past/future/get methods - New commands: undo [--force], redo, history [--limit N] [--show <id>] - Record pre/post state snapshots for all mutating commands - Add --json global flag for structured JSON output via CommandResult enum - Add --dry-run flag to veil, unveil, and apply commands - Add --files flag to status for per-file state reporting - Add error codes (E001-E034) for machine-parseable error responses - Add normalize_path helper and HISTORY_DIR constant - 500-entry history cap with automatic truncation and ID renumbering
🔒 Security Report
|
Coverage Report
Per-file coverage (28 files)
|
- Add 50+ tests covering undo/redo state restoration, history show config diffs, JSON output for all commands, dry-run modes, checkpoint history recording, error codes, restore_action_state, and more - Statement coverage: 95.27% -> 97.01%, branch: 87.72% -> 89.03% - Update CI: 97% statement floor, 87% branch floor, 1% relative tolerance with absolute floors enforced (prevents progressive erosion) - Add PLAN.md: physical file removal, parser-based veiling, and progressive disclosure for context window optimization
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.
Summary
.funveil/history/log.yaml. Undo restores pre-state (config + files from CAS), redo restores post-state. New action after undo discards future. 500-entry cap with auto-truncation.fv historylists past/future actions with timestamps.fv history --show <id>shows config diffs and file size changes for a specific action.--jsonglobal flag: Machine-readable JSON output viaCommandResultenum with#[serde(tag = "command")]. Errors include error codes (E001-E034). Enables LLM agents to parsefvoutput programmatically.--dry-runflag: Added toveil,unveil, andapply— previews what would change without modifying state.--filesflag onstatus: Per-file state reporting (veiled/unveiled, full/partial, ranges).undo [--force],redo,history [--limit N] [--show <id>]Files changed
src/history.rsActionRecord,ActionState,FileSnapshot,ActionHistorywith 18 unit testssrc/main.rs--json/--dry-run/--filesflags,CommandResultenum, history integration, 15 new testssrc/error.rsHistoryEmpty,NothingToRedo,ActionNotUndoablevariants +code()methodsrc/config.rsHISTORY_DIRconstant,normalize_path()helper, history dir inensure_data_dir()src/lib.rshistorymodule, new re-exportsCargo.tomlserde_jsonmade unconditional dependencyTest plan
cargo test --all-features— all 1,724 tests pass (33 new)cargo clippy --all-targets --all-features -- -D warnings— cleanfv init → fv veil src/ → fv history → fv undo → verify restored → fv redo → verify veiled againfv veil src/ --json→ valid JSON;fv veil src/ --dry-run→ no state changefv status --files --json→ per-file detail as JSONfv history show 2→ shows config diff and file size changes