Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pnpm install -g .
### Create a new worktree

```bash
cursor-worktree new <branchName> [options]
cwt new <branchName> [options]
```

Options:
Expand All @@ -22,27 +22,27 @@ Options:

Example:
```bash
cursor-worktree new feature/login
cursor-worktree new feature/chat --checkout
cursor-worktree new feature/auth -p ./auth-worktree
cwt new feature/login
cwt new feature/chat --checkout
cwt new feature/auth -p ./auth-worktree
```

### List worktrees

```bash
cursor-worktree list
cwt list
```

### Remove a worktree

```bash
cursor-worktree remove <pathOrBranch>
cwt remove <pathOrBranch>
```

You can remove a worktree by either its path or branch name:
```bash
cursor-worktree remove ./feature/login-worktree
cursor-worktree remove feature/chat
cwt remove ./feature/login-worktree
cwt remove feature/chat
```

## Requirements
Expand Down
34 changes: 29 additions & 5 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,50 @@

1. In a test repository, run:
```bash
cursor-worktree new editor
cwt new editor
```
2. Verify that a new sibling directory named `<currentDirectoryName>editor` is created.
3. Confirm that the worktree is added to the Git repository and that the Cursor editor opens the new directory.

## Manual Test for CLI Command Name Change

1. Install the package globally:
```bash
pnpm install -g .
```
2. Run the command help to verify the new command:
```bash
cwt --help
```
3. Optionally, test additional commands:
- Create a new worktree:
```bash
cwt new feature/test
```
- List worktrees:
```bash
cwt list
```
- Remove a worktree:
```bash
cwt remove feature/test
```

## Remove Worktree Force Flag Test

1. Create a test worktree:
```bash
cursor-worktree new test-branch
cwt new test-branch
```
2. Make some changes in the worktree that would prevent normal removal
3. Try removing the worktree without the force flag:
```bash
cursor-worktree remove test-branch
cwt remove test-branch
```
This should fail if there are uncommitted changes
4. Try removing the worktree with the force flag:
```bash
cursor-worktree remove --force test-branch
cwt remove --force test-branch
```
This should succeed and remove the worktree regardless of its state
5. Verify that the worktree directory is removed and the Git worktree reference is cleaned up
5. Verify that the worktree directory is removed and the Git worktree reference is cleaned up
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"type": "module",
"bin": {
"cursor-worktree": "dist/index.js"
"cwt": "dist/index.js"
},
"scripts": {
"build": "tsc",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { removeWorktreeHandler } from "./commands/remove.js";
const program = new Command();

program
.name("cursor-worktree")
.name("cwt")
.description("Manage git worktrees and open them in the Cursor editor.")
.version("1.0.0");

Expand Down