Skip to content

Conversation

@amberpixels
Copy link
Owner

No description provided.

amberpixels and others added 11 commits June 9, 2025 23:13
- Fix all shellcheck warnings (SC2155, SC2129, SC2015, SC1091, SC2034)
  - Separate variable declaration and assignment to avoid masking return values
  - Group multiple file redirects using brace syntax for better performance
  - Replace ambiguous A && B || C patterns with explicit if-then statements
  - Add shellcheck disable directives for unavoidable warnings
  - Export or properly handle unused variables

- Reorganize scripts directory structure for better separation of concerns
  - Move colors.sh and common.sh to scripts/src/ alongside template files
  - Update all path references in build.sh and source templates
  - Refactor _get_script_dir function to handle new common.sh location

- Standardize color variable usage by removing duplicate RESET/NC variables
  - Remove RESET variable and use NC consistently across all scripts
  - Update all template files and logging functions

- Add shellcheck task to Makefile as 'make sc' for continuous quality checking
  - Includes proper error handling to not fail build on warnings
  - Covers all shell script types (.sh, .bash, .zsh)

- Improve zsh hook file compatibility
  - Add proper shebang to git-undo-hook.zsh
  - Disable shellcheck for zsh-specific syntax not supported by shellcheck
- Add new git-back binary for undoing checkout/switch operations
- Implement BackUndoer with conflict detection and safety warnings
- Add comprehensive integration tests for git-back workflows
- Make git-back installation optional with graceful degradation
- Add verbose installation mode for debugging (--verbose flag)
- Update build system to support both git-undo and git-back binaries
- Enhance logging to filter checkout/switch commands specifically
- Improve installation error handling and user feedback
- Add comprehensive undo support for 4 new git commands (57% increase)
- Implement TagUndoer for lightweight and annotated tag creation undo
- Implement MvUndoer for file/directory move operations undo
- Implement RmUndoer for cached and full file removal undo
- Implement RestoreUndoer for staged file restore undo
- Add 20+ unit tests with comprehensive edge case coverage
- Add BATS integration tests for end-to-end workflow validation
- Create systematic expansion plan for additional git commands
- Update command routing to support new undoer implementations
- All implementations follow existing patterns and maintain safety
- Add Phase 2 undoers: reset (reflog-based), revert, cherry-pick, clean (limited)
- Implement dedicated git switch undoer with -c/-C branch creation support
- Reorganize test files: split monolithic tests into command-specific files
- Add comprehensive unit tests (25+ scenarios) and BATS integration tests
- Update command coverage to 70% (16/23 planned commands)
- Enhance git command recognition to include modern git switch
- Maintain backward compatibility with extensive safety warnings

Command support: reset, revert, cherry-pick (state management)
+ git switch (modern checkout alternative with full feature parity)
Test structure: individual *_test.go files with shared setup_test.go
Integration: BATS tests for end-to-end workflow validation
Split Phase 3 into logical complexity tiers based on operation success/failure:

**Phase 3A: Conflict/State Recovery (Medium-High)**
- git rebase (failed/conflicted) → git rebase --abort
- git pull (failed/conflicted) → abort merge conflicts
- git config → restore previous values
- git remote → reverse remote operations

**Phase 3B: Complex State Operations (High)**
- git worktree → reverse worktree operations
- git submodule → reverse submodule operations

**Phase 4: Expert Level (Very High)**
- git rebase (completed) → undo successful history rewriting
- git pull (successful) → undo successful remote operations
- git push → remote state modification

Key insight: Conflict/abort scenarios are much more tractable than undoing
successful complex operations. Phase 3A focuses on detecting ongoing git
states (REBASE_HEAD, MERGE_HEAD) and using git's built-in abort mechanisms.

Updated command coverage: 16/25 commands (64% planned coverage)
- Detect when users try to undo git checkout/switch operations
- Provide friendly info message suggesting git back instead
- Add concise one-liner: "Last operation can't be undone. Use git back instead"
- Use info icon (ℹ️) for helpful tone instead of error styling
- Implement comprehensive unit and integration test coverage
- Add isCheckoutOrSwitchCommand helper for reliable detection
- Create logInfof method for friendly informational messages
- Constantify app names (git-undo, git-back) to satisfy linter
- Replace string concatenation with fmt.Errorf for error messages
- Update documentation and examples in README and planning files

Prevents user confusion when trying to undo branch navigation operations
and guides them to the appropriate git back command for their workflow.
@amberpixels amberpixels self-assigned this Jun 13, 2025
@amberpixels amberpixels changed the title Several updates Refactor & Updates Jun 13, 2025
@amberpixels amberpixels merged commit d90a145 into main Jun 13, 2025
1 of 2 checks passed
amberpixels added a commit that referenced this pull request Jun 13, 2025
* add claude.md

* refactor: scripts/src files to be separated

* refactor: improve shell script quality and organization

- Fix all shellcheck warnings (SC2155, SC2129, SC2015, SC1091, SC2034)
  - Separate variable declaration and assignment to avoid masking return values
  - Group multiple file redirects using brace syntax for better performance
  - Replace ambiguous A && B || C patterns with explicit if-then statements
  - Add shellcheck disable directives for unavoidable warnings
  - Export or properly handle unused variables

- Reorganize scripts directory structure for better separation of concerns
  - Move colors.sh and common.sh to scripts/src/ alongside template files
  - Update all path references in build.sh and source templates
  - Refactor _get_script_dir function to handle new common.sh location

- Standardize color variable usage by removing duplicate RESET/NC variables
  - Remove RESET variable and use NC consistently across all scripts
  - Update all template files and logging functions

- Add shellcheck task to Makefile as 'make sc' for continuous quality checking
  - Includes proper error handling to not fail build on warnings
  - Covers all shell script types (.sh, .bash, .zsh)

- Improve zsh hook file compatibility
  - Add proper shebang to git-undo-hook.zsh
  - Disable shellcheck for zsh-specific syntax not supported by shellcheck

* feat: add git-back binary and improve installation system

- Add new git-back binary for undoing checkout/switch operations
- Implement BackUndoer with conflict detection and safety warnings
- Add comprehensive integration tests for git-back workflows
- Make git-back installation optional with graceful degradation
- Add verbose installation mode for debugging (--verbose flag)
- Update build system to support both git-undo and git-back binaries
- Enhance logging to filter checkout/switch commands specifically
- Improve installation error handling and user feedback

* feat: implement Phase 1 commands - git rm, mv, tag, restore undo support

- Add comprehensive undo support for 4 new git commands (57% increase)
- Implement TagUndoer for lightweight and annotated tag creation undo
- Implement MvUndoer for file/directory move operations undo
- Implement RmUndoer for cached and full file removal undo
- Implement RestoreUndoer for staged file restore undo
- Add 20+ unit tests with comprehensive edge case coverage
- Add BATS integration tests for end-to-end workflow validation
- Create systematic expansion plan for additional git commands
- Update command routing to support new undoer implementations
- All implementations follow existing patterns and maintain safety

* feat: implement Phase 2 commands and git switch undo support

- Add Phase 2 undoers: reset (reflog-based), revert, cherry-pick, clean (limited)
- Implement dedicated git switch undoer with -c/-C branch creation support
- Reorganize test files: split monolithic tests into command-specific files
- Add comprehensive unit tests (25+ scenarios) and BATS integration tests
- Update command coverage to 70% (16/23 planned commands)
- Enhance git command recognition to include modern git switch
- Maintain backward compatibility with extensive safety warnings

Command support: reset, revert, cherry-pick (state management)
+ git switch (modern checkout alternative with full feature parity)
Test structure: individual *_test.go files with shared setup_test.go
Integration: BATS tests for end-to-end workflow validation

* refactor: reorganize Phase 3 implementation strategy

Split Phase 3 into logical complexity tiers based on operation success/failure:

**Phase 3A: Conflict/State Recovery (Medium-High)**
- git rebase (failed/conflicted) → git rebase --abort
- git pull (failed/conflicted) → abort merge conflicts
- git config → restore previous values
- git remote → reverse remote operations

**Phase 3B: Complex State Operations (High)**
- git worktree → reverse worktree operations
- git submodule → reverse submodule operations

**Phase 4: Expert Level (Very High)**
- git rebase (completed) → undo successful history rewriting
- git pull (successful) → undo successful remote operations
- git push → remote state modification

Key insight: Conflict/abort scenarios are much more tractable than undoing
successful complex operations. Phase 3A focuses on detecting ongoing git
states (REBASE_HEAD, MERGE_HEAD) and using git's built-in abort mechanisms.

Updated command coverage: 16/25 commands (64% planned coverage)

* feat: add smart checkout/switch detection with friendly guidance

- Detect when users try to undo git checkout/switch operations
- Provide friendly info message suggesting git back instead
- Add concise one-liner: "Last operation can't be undone. Use git back instead"
- Use info icon (ℹ️) for helpful tone instead of error styling
- Implement comprehensive unit and integration test coverage
- Add isCheckoutOrSwitchCommand helper for reliable detection
- Create logInfof method for friendly informational messages
- Constantify app names (git-undo, git-back) to satisfy linter
- Replace string concatenation with fmt.Errorf for error messages
- Update documentation and examples in README and planning files

Prevents user confusion when trying to undo branch navigation operations
and guides them to the appropriate git back command for their workflow.

* minor refactor: lets avoid too generic appName variable name

* make linter happier

* up

* cleanup

* Revert "cleanup"

This reverts commit 3d00d70.

* update

* cleanup

* Updates
amberpixels added a commit that referenced this pull request Jun 13, 2025
* refactor: scripts/src files to be separated

* refactor: improve shell script quality and organization

- Fix all shellcheck warnings (SC2155, SC2129, SC2015, SC1091, SC2034)
  - Separate variable declaration and assignment to avoid masking return values
  - Group multiple file redirects using brace syntax for better performance
  - Replace ambiguous A && B || C patterns with explicit if-then statements
  - Add shellcheck disable directives for unavoidable warnings
  - Export or properly handle unused variables

- Reorganize scripts directory structure for better separation of concerns
  - Move colors.sh and common.sh to scripts/src/ alongside template files
  - Update all path references in build.sh and source templates
  - Refactor _get_script_dir function to handle new common.sh location

- Standardize color variable usage by removing duplicate RESET/NC variables
  - Remove RESET variable and use NC consistently across all scripts
  - Update all template files and logging functions

- Add shellcheck task to Makefile as 'make sc' for continuous quality checking
  - Includes proper error handling to not fail build on warnings
  - Covers all shell script types (.sh, .bash, .zsh)

- Improve zsh hook file compatibility
  - Add proper shebang to git-undo-hook.zsh
  - Disable shellcheck for zsh-specific syntax not supported by shellcheck

* feat: add git-back binary and improve installation system

- Add new git-back binary for undoing checkout/switch operations
- Implement BackUndoer with conflict detection and safety warnings
- Add comprehensive integration tests for git-back workflows
- Make git-back installation optional with graceful degradation
- Add verbose installation mode for debugging (--verbose flag)
- Update build system to support both git-undo and git-back binaries
- Enhance logging to filter checkout/switch commands specifically
- Improve installation error handling and user feedback

* feat: implement Phase 1 commands - git rm, mv, tag, restore undo support

- Add comprehensive undo support for 4 new git commands (57% increase)
- Implement TagUndoer for lightweight and annotated tag creation undo
- Implement MvUndoer for file/directory move operations undo
- Implement RmUndoer for cached and full file removal undo
- Implement RestoreUndoer for staged file restore undo
- Add 20+ unit tests with comprehensive edge case coverage
- Add BATS integration tests for end-to-end workflow validation
- Create systematic expansion plan for additional git commands
- Update command routing to support new undoer implementations
- All implementations follow existing patterns and maintain safety

* feat: implement Phase 2 commands and git switch undo support

- Add Phase 2 undoers: reset (reflog-based), revert, cherry-pick, clean (limited)
- Implement dedicated git switch undoer with -c/-C branch creation support
- Reorganize test files: split monolithic tests into command-specific files
- Add comprehensive unit tests (25+ scenarios) and BATS integration tests
- Update command coverage to 70% (16/23 planned commands)
- Enhance git command recognition to include modern git switch
- Maintain backward compatibility with extensive safety warnings

Command support: reset, revert, cherry-pick (state management)
+ git switch (modern checkout alternative with full feature parity)
Test structure: individual *_test.go files with shared setup_test.go
Integration: BATS tests for end-to-end workflow validation

* refactor: reorganize Phase 3 implementation strategy

Split Phase 3 into logical complexity tiers based on operation success/failure:

**Phase 3A: Conflict/State Recovery (Medium-High)**
- git rebase (failed/conflicted) → git rebase --abort
- git pull (failed/conflicted) → abort merge conflicts
- git config → restore previous values
- git remote → reverse remote operations

**Phase 3B: Complex State Operations (High)**
- git worktree → reverse worktree operations
- git submodule → reverse submodule operations

**Phase 4: Expert Level (Very High)**
- git rebase (completed) → undo successful history rewriting
- git pull (successful) → undo successful remote operations
- git push → remote state modification

Key insight: Conflict/abort scenarios are much more tractable than undoing
successful complex operations. Phase 3A focuses on detecting ongoing git
states (REBASE_HEAD, MERGE_HEAD) and using git's built-in abort mechanisms.

Updated command coverage: 16/25 commands (64% planned coverage)

* feat: add smart checkout/switch detection with friendly guidance

- Detect when users try to undo git checkout/switch operations
- Provide friendly info message suggesting git back instead
- Add concise one-liner: "Last operation can't be undone. Use git back instead"
- Use info icon (ℹ️) for helpful tone instead of error styling
- Implement comprehensive unit and integration test coverage
- Add isCheckoutOrSwitchCommand helper for reliable detection
- Create logInfof method for friendly informational messages
- Constantify app names (git-undo, git-back) to satisfy linter
- Replace string concatenation with fmt.Errorf for error messages
- Update documentation and examples in README and planning files

Prevents user confusion when trying to undo branch navigation operations
and guides them to the appropriate git back command for their workflow.

* minor refactor: lets avoid too generic appName variable name

* make linter happier

* up

* cleanup

* Revert "cleanup"

This reverts commit 3d00d70.

* update

* cleanup

* Updates
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.

2 participants