From 783a00ca5602e78e70d10798446bb77b6fbbbc6c Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sat, 29 Nov 2025 18:19:55 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 11 +++++++++ README.md | 3 +++ plugin.lock.json | 45 ++++++++++++++++++++++++++++++++++++ skills/git-worktree/SKILL.md | 43 ++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 plugin.lock.json create mode 100644 skills/git-worktree/SKILL.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..2a3b05f --- /dev/null +++ b/.claude-plugin/plugin.json @@ -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" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ecf196d --- /dev/null +++ b/README.md @@ -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 diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..3b55d15 --- /dev/null +++ b/plugin.lock.json @@ -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": [] + } +} \ No newline at end of file diff --git a/skills/git-worktree/SKILL.md b/skills/git-worktree/SKILL.md new file mode 100644 index 0000000..343a1ed --- /dev/null +++ b/skills/git-worktree/SKILL.md @@ -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}`