Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:19:55 +08:00
commit 783a00ca56
4 changed files with 102 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
{
"name": "git-worktree-plugin",
"description": "Manage git worktrees for parallel branch work. Proactively suggests worktree creation when working on PRs or new features",
"version": "1.0.0",
"author": {
"name": "Stefan Cho"
},
"skills": [
"./skills"
]
}

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# git-worktree-plugin
Manage git worktrees for parallel branch work. Proactively suggests worktree creation when working on PRs or new features

45
plugin.lock.json Normal file
View File

@@ -0,0 +1,45 @@
{
"$schema": "internal://schemas/plugin.lock.v1.json",
"pluginId": "gh:devstefancho/claude-plugins:git-worktree-plugin",
"normalized": {
"repo": null,
"ref": "refs/tags/v20251128.0",
"commit": "2129f54a4b23fd8a07a7f766e99c2822060df63b",
"treeHash": "cea9c705b538152c762c9e1ad7f8368d314f919026609f76b0c5932825f81c23",
"generatedAt": "2025-11-28T10:16:21.081420Z",
"toolVersion": "publish_plugins.py@0.2.0"
},
"origin": {
"remote": "git@github.com:zhongweili/42plugin-data.git",
"branch": "master",
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
},
"manifest": {
"name": "git-worktree-plugin",
"description": "Manage git worktrees for parallel branch work. Proactively suggests worktree creation when working on PRs or new features",
"version": "1.0.0"
},
"content": {
"files": [
{
"path": "README.md",
"sha256": "e14d0ad45e28065bdf77220a5836164cc1e991adab2efed702d1b5a54442cacf"
},
{
"path": ".claude-plugin/plugin.json",
"sha256": "926c002db90db0ee8ae0f47a94f216e1a828f2a87fa0b0a6912c2f3f7f3868ee"
},
{
"path": "skills/git-worktree/SKILL.md",
"sha256": "4674e9ae9c17515897727361cc094dfeb31724854045084d67be51616d6c50e4"
}
],
"dirSha256": "cea9c705b538152c762c9e1ad7f8368d314f919026609f76b0c5932825f81c23"
},
"security": {
"scannedAt": null,
"scannerVersion": null,
"flags": []
}
}

View File

@@ -0,0 +1,43 @@
---
name: git-worktree
description: Manage git worktrees for parallel branch work. PROACTIVELY USE when user mentions working on a PR, new feature, or new task - ask if they want to create a worktree BEFORE starting implementation.
---
# Git Worktree Manager
## Proactive Usage Triggers
When the user mentions any of these, IMMEDIATELY ask if they want to create a new worktree:
- Working on a PR (e.g., "PR #9 작업하자", "work on PR #123")
- Starting a new feature/task (e.g., "새 기능 구현", "이슈 처리")
- Implementing something new while on main branch
**Ask BEFORE proceeding with implementation work.**
## Create Worktree
1. Run `git fetch` to update remote refs
2. Determine branch name:
- If PR number provided: use `gh pr checkout {pr-number}` in `./trees/pr-{number}/`
- If feature name provided: ask for prefix (feat/fix/bug/chore/docs/test), format as `{prefix}/{lowercase-with-dashes}`
- If no name: ask user for feature description, then ask for prefix
3. Ask for base branch (default: `main`)
4. Check if `./trees/{branch-name}` exists:
- If exists: ask user "Worktree exists. Remove and recreate? (yes/no)"
- If yes: run `git worktree remove ./trees/{branch-name} --force` then `git branch -D {branch-name}` (ignore errors)
5. Create worktree: `git worktree add ./trees/{branch-name} -b {branch-name} origin/{base-branch}`
## Cleanup Worktree
1. List worktrees: `git worktree list`
2. Ask user which to remove (or "all")
3. For each worktree in `./trees/`:
- `git worktree remove {path} --force`
- `git branch -D {branch-name}` (ignore errors)
## Format Rules
- Feature names: lowercase, spaces/underscores → dashes
- Branch format: `{prefix}/{feature-name}` (e.g., `feat/user-authentication`)
- PR format: `pr-{number}` (e.g., `pr-123`)
- Worktree path: `./trees/{branch-name}`