Skip to content

Conversation

@johnlindquist
Copy link
Owner

  • Update new.ts to create sibling directories

  • Add test documentation in TESTING.md

- Update new.ts to create sibling directories

- Add test documentation in TESTING.md
@johnlindquist johnlindquist merged commit 4c3cda0 into feature/github-ci-publish-workflow Mar 20, 2025
1 check passed
johnlindquist added a commit that referenced this pull request Dec 7, 2025
This commit implements comprehensive improvements to the worktree-cli:

1. Fix Global Path Collisions (#1)
   - Added repo namespace to global paths to prevent cross-repo collisions
   - ~/worktrees/auth now becomes ~/worktrees/repo-name/auth

2. Enable Bare Repository Support (#2)
   - Removed blocking check for bare repos
   - Skip clean check for bare repos (no working tree)

3. Refactor PR Command to Avoid Context Switching (#3)
   - Use `git fetch origin refs/pull/ID/head:branch` instead of checkout
   - No longer requires switching branches in main worktree

4. Interactive TUI for Missing Arguments (#4)
   - Added prompts library for interactive selection
   - `wt open`, `wt remove`, `wt pr` now show selection UI without args
   - `wt purge` uses multi-select for batch removal

5. Handle Dirty States Gracefully (#5)
   - Offer stash/pop workflow when worktree is dirty
   - Options: stash, abort, or continue anyway
   - Automatic stash restore in finally block

6. Replace Regex Security with Trust Model (#6)
   - Removed brittle regex blocklist for setup commands
   - Added --trust flag for CI environments
   - Shows commands and asks for confirmation before execution

7. Centralize Path and Naming Logic (#7)
   - Created src/utils/paths.ts with resolveWorktreeName()
   - Standardized on replacing / with - for branch names
   - Prevents collisions: feature/auth and hotfix/auth are now unique

8. Robust Git Output Parsing (#8)
   - Created typed WorktreeInfo interface
   - getWorktrees() parses --porcelain output correctly
   - Handles locked, prunable, detached, and bare states

9. Atomic Operations and Rollback (#9)
   - Created AtomicWorktreeOperation class
   - Automatic rollback on failure (removes worktree, cleans up)
   - withAtomicRollback() helper for clean error handling

10. Automated Integration Tests (#10)
    - Created test suite with vitest
    - 26 tests covering all major functionality
    - Tests create real git repos and run CLI commands
johnlindquist added a commit that referenced this pull request Dec 7, 2025
* feat: Implement 10 major improvements to worktree-cli

This commit implements comprehensive improvements to the worktree-cli:

1. Fix Global Path Collisions (#1)
   - Added repo namespace to global paths to prevent cross-repo collisions
   - ~/worktrees/auth now becomes ~/worktrees/repo-name/auth

2. Enable Bare Repository Support (#2)
   - Removed blocking check for bare repos
   - Skip clean check for bare repos (no working tree)

3. Refactor PR Command to Avoid Context Switching (#3)
   - Use `git fetch origin refs/pull/ID/head:branch` instead of checkout
   - No longer requires switching branches in main worktree

4. Interactive TUI for Missing Arguments (#4)
   - Added prompts library for interactive selection
   - `wt open`, `wt remove`, `wt pr` now show selection UI without args
   - `wt purge` uses multi-select for batch removal

5. Handle Dirty States Gracefully (#5)
   - Offer stash/pop workflow when worktree is dirty
   - Options: stash, abort, or continue anyway
   - Automatic stash restore in finally block

6. Replace Regex Security with Trust Model (#6)
   - Removed brittle regex blocklist for setup commands
   - Added --trust flag for CI environments
   - Shows commands and asks for confirmation before execution

7. Centralize Path and Naming Logic (#7)
   - Created src/utils/paths.ts with resolveWorktreeName()
   - Standardized on replacing / with - for branch names
   - Prevents collisions: feature/auth and hotfix/auth are now unique

8. Robust Git Output Parsing (#8)
   - Created typed WorktreeInfo interface
   - getWorktrees() parses --porcelain output correctly
   - Handles locked, prunable, detached, and bare states

9. Atomic Operations and Rollback (#9)
   - Created AtomicWorktreeOperation class
   - Automatic rollback on failure (removes worktree, cleans up)
   - withAtomicRollback() helper for clean error handling

10. Automated Integration Tests (#10)
    - Created test suite with vitest
    - 26 tests covering all major functionality
    - Tests create real git repos and run CLI commands

* docs: Update README with new features and add git utility tests
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