pi-worktrees/.pi/extensions
David Kong 8761c3af5f feat: implement git_worktree_remove tool (Issue #5) (#18)
## Summary
Implement `git_worktree_remove` tool with proper validation and error handling.

## Changes
- Add `pi-worktree-remove.ts` — pure validation functions for remove operation
  - `validateRemoveWorktreeInput()` — validates path is non-empty
  - `isMainRepository()` — refuses removal of main repo root (suggests `git worktree prune`)
  - `hasUncommittedChanges()` — checks git status --porcelain output
  - `buildWorktreeRemoveCommand()` — builds `git worktree remove` args with optional `--force`
- Add `pi-worktree-remove.test.ts` — 17 unit tests covering all validation paths
- Wire up `createRemoveWorktreeTool()` in main extension with full validation pipeline

## Testing
- [x] All 72 tests pass (55 existing + 17 new)
- [x] No regressions in existing test suite
- [ ] Manual verification — remove a worktree, try removing main repo, try removing worktree with changes

## Checklist
- [x] Self-reviewed the diff
- [x] Code follows project conventions (pure functions, fail-fast validation)
- [x] Descriptive naming (no single-character variables)

Co-authored-by: David Kong <davkon@gmail.com>
Reviewed-on: #18
2026-07-25 02:21:03 +00:00
..
pi-worktree-create.ts Milestone 2.1: Implement git_worktree_create tool (#4) (#17) 2026-07-24 20:50:45 +00:00
pi-worktree-parser.ts Milestone 1.3: Implement git_worktree_list tool (#3) (#16) 2026-07-24 13:11:08 +00:00
pi-worktree-remove.test.ts feat: implement git_worktree_remove tool (Issue #5) (#18) 2026-07-25 02:21:03 +00:00
pi-worktree-remove.ts feat: implement git_worktree_remove tool (Issue #5) (#18) 2026-07-25 02:21:03 +00:00
pi-worktree.test.ts Milestone 2.1: Implement git_worktree_create tool (#4) (#17) 2026-07-24 20:50:45 +00:00
pi-worktree.ts feat: implement git_worktree_remove tool (Issue #5) (#18) 2026-07-25 02:21:03 +00:00