## Summary Implements the `git_worktree_create` tool with full validation and error handling per issue #4 acceptance criteria. ## Changes - New `pi-worktree-create.ts` module with pure, testable functions (no pi SDK deps) - `validateCreateWorktreeInput()` — validates path and branch name parameters - `validatePathDoesNotExist()` — refuses if target path exists (injectable for testing) - `isCurrentBranch()` — prevents creating worktree on current branch - `buildWorktreeAddCommand()` — builds correct git command with `-b` flag support - Integrated all helpers into `createCreateWorktreeTool()` in main extension - 17 new tests covering all validation paths and edge cases (29 total, all passing) ## Testing - [x] All 29 tests pass (`bun test .pi/extensions/*.test.ts`) - [x] Full test suite run with no regressions - [ ] Manual verification (requires pi runtime) ## Checklist - [x] Self-reviewed the diff - [x] Code follows project conventions - [x] Descriptive naming (no single-character variables) - [x] Documentation updated (JSDoc on all new functions) Co-authored-by: David Kong <davkon@gmail.com> Reviewed-on: #17 |
||
|---|---|---|
| .. | ||
| pi-worktree-create.ts | ||
| pi-worktree-parser.ts | ||
| pi-worktree.test.ts | ||
| pi-worktree.ts | ||