Skip to content

feat: implement interactive smart restore negotiation#52

Merged
JacksonFergusonDev merged 6 commits intomainfrom
feat/smart-restore
Feb 24, 2026
Merged

feat: implement interactive smart restore negotiation#52
JacksonFergusonDev merged 6 commits intomainfrom
feat/smart-restore

Conversation

@JacksonFergusonDev
Copy link
Owner

Description

This PR addresses the "Smart Restore" item from the Phase 1 roadmap. Previously, running git pulsar restore on a dirty file would trigger a hard exit to protect uncommitted changes, forcing the user to blindly append --force.

This updates the behavior to use an interactive state machine, giving the user the ability to safely inspect the delta before deciding to overwrite or cancel.

Changes

  • Git Abstraction (git_wrapper.py): Expanded run_diff to accept an optional file argument, properly isolating the path with -- to prevent refspec collisions.
  • Business Logic (ops.py): Replaced the sys.exit(1) kill-switch in restore_file with a rich.prompt.Prompt loop ([O]verwrite / [V]iew Diff / [C]ancel).
  • Testing (test_ops.py, test_git_wrapper.py):
    • Removed the obsolete test_restore_dirty_fails.
    • Added granular mock coverage for all three interactive branches (test_restore_dirty_cancels, test_restore_dirty_overwrites, test_restore_dirty_views_diff).
    • Added regression coverage for file-targeted diff construction.
  • Documentation: Updated architecture mappings, test strategy docs, and checked off the roadmap item.

Verification

  • Tested interactive pager mapping (diffs open in less and return cleanly to the prompt).
  • Verified pytest suite passes with new mocked Prompt sequences.

@JacksonFergusonDev JacksonFergusonDev merged commit ff1e9c9 into main Feb 24, 2026
4 checks passed
@JacksonFergusonDev JacksonFergusonDev deleted the feat/smart-restore branch February 24, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant