Repository navigation
feat(work): add undo for accepted AI Work results - #466
Open
Dhruv-Sharma29 wants to merge 1 commit into
Open
Dhruv-Sharma29 wants to merge 1 commit into
Dhruv-Sharma29 wants to merge 1 commit into
Conversation
Work Mode let users accept AI results but gave no way to back them out from the Work panel. Project Work was worse: it rewrites several tabs through React state, so editor Undo could not revert it at all. - Active document: an "Undo AI Changes" button restores the pre-Work text as one undoable editor edit. It refuses if the document was edited since, pointing the user to editor Undo instead. - Open project: accepting a proposal snapshots every affected tab. "Undo accepted changes" restores them and closes tabs the result opened. Tabs edited or saved after accepting are left alone and listed. Closes petertzy#462
This branch has not been deployed
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.
Closes #462
Problem
Work Mode let you accept an AI result, but the Work panel had no way to undo it.
Changes
Active-document Work
applyWorkEditpath, as one undoable editor edit. Editor Undo can then bring the AI result back.isWorkResultFresh.Project Work
captureProjectWorkUndosnapshots every tab the change touches.revertProjectWork, which:Files
frontend/src/lib/project-work-undo.mjs: the capture and revert logic (pure functions, easy to test)useProjectWork,useEditor(revertProjectChanges),useAIActions(undoWork,canUndoWork),AIPanel,ProjectWorkReview: wiring and buttonsTesting
tests/project-work-undo.test.mjscovers: reverting edits and closing opened tabs, never discarding later user edits, and saved results and saved new files.npm test(165 pass),npx tsc --noEmit,npm run lint,npm run buildall pass.