@smicolon/ai-kit 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/CLAUDE.md +7 -0
- package/.claude-plugin/marketplace.json +373 -0
- package/README.md +26 -16
- package/dist/index.js +146 -38
- package/package.json +4 -3
- package/packs/architect/CHANGELOG.md +17 -0
- package/packs/architect/README.md +58 -0
- package/packs/architect/agents/system-architect.md +768 -0
- package/packs/architect/commands/diagram-create.md +300 -0
- package/packs/better-auth/.claude-plugin/plugin.json +14 -0
- package/packs/better-auth/.mcp.json +14 -0
- package/packs/better-auth/CHANGELOG.md +26 -0
- package/packs/better-auth/README.md +125 -0
- package/packs/better-auth/agents/auth-architect.md +278 -0
- package/packs/better-auth/commands/auth-provider-add.md +265 -0
- package/packs/better-auth/commands/auth-setup.md +298 -0
- package/packs/better-auth/skills/auth-security/SKILL.md +425 -0
- package/packs/better-auth/skills/better-auth-patterns/SKILL.md +455 -0
- package/packs/dev-loop/.claude-plugin/plugin.json +10 -0
- package/packs/dev-loop/CHANGELOG.md +69 -0
- package/packs/dev-loop/README.md +155 -0
- package/packs/dev-loop/commands/cancel-dev.md +21 -0
- package/packs/dev-loop/commands/dev-loop.md +72 -0
- package/packs/dev-loop/commands/dev-plan.md +351 -0
- package/packs/dev-loop/hooks/hooks.json +15 -0
- package/packs/dev-loop/hooks/stop-hook.sh +178 -0
- package/packs/dev-loop/scripts/setup-dev-loop.sh +194 -0
- package/packs/dev-loop/skills/tdd-planner/SKILL.md +249 -0
- package/packs/dev-loop/skills/tdd-planner/references/framework-patterns.md +874 -0
- package/packs/dev-loop/skills/tdd-planner/references/good-example.md +260 -0
- package/packs/dev-loop/skills/tdd-planner/references/plan-template.md +275 -0
- package/packs/django/CHANGELOG.md +39 -0
- package/packs/django/README.md +92 -0
- package/packs/django/agents/django-architect.md +182 -0
- package/packs/django/agents/django-builder.md +250 -0
- package/packs/django/agents/django-feature-based.md +420 -0
- package/packs/django/agents/django-reviewer.md +253 -0
- package/packs/django/agents/django-tester.md +230 -0
- package/packs/django/commands/api-endpoint.md +285 -0
- package/packs/django/commands/model-create.md +178 -0
- package/packs/django/commands/test-generate.md +325 -0
- package/packs/django/rules/migrations.md +138 -0
- package/packs/django/rules/models.md +167 -0
- package/packs/django/rules/serializers.md +126 -0
- package/packs/django/rules/services.md +131 -0
- package/packs/django/rules/tests.md +140 -0
- package/packs/django/rules/views.md +102 -0
- package/packs/django/skills/import-convention-enforcer/SKILL.md +226 -0
- package/packs/django/skills/import-convention-enforcer/patterns/django-imports.md +343 -0
- package/packs/django/skills/migration-safety-checker/SKILL.md +375 -0
- package/packs/django/skills/model-entity-validator/SKILL.md +298 -0
- package/packs/django/skills/performance-optimizer/SKILL.md +447 -0
- package/packs/django/skills/red-phase-verifier/SKILL.md +180 -0
- package/packs/django/skills/security-first-validator/SKILL.md +435 -0
- package/packs/django/skills/test-coverage-advisor/SKILL.md +394 -0
- package/packs/django/skills/test-validity-checker/SKILL.md +194 -0
- package/packs/failure-log/.claude-plugin/plugin.json +14 -0
- package/packs/failure-log/CHANGELOG.md +20 -0
- package/packs/failure-log/README.md +168 -0
- package/packs/failure-log/commands/failure-add.md +106 -0
- package/packs/failure-log/commands/failure-list.md +89 -0
- package/packs/failure-log/hooks/hooks.json +16 -0
- package/packs/failure-log/hooks/scripts/inject-failures.sh +64 -0
- package/packs/failure-log/skills/failure-log-manager/SKILL.md +164 -0
- package/packs/flutter/.claude-plugin/plugin.json +10 -0
- package/packs/flutter/CHANGELOG.md +19 -0
- package/packs/flutter/README.md +170 -0
- package/packs/flutter/agents/flutter-architect.md +166 -0
- package/packs/flutter/agents/flutter-builder.md +303 -0
- package/packs/flutter/agents/release-manager.md +355 -0
- package/packs/flutter/commands/fastlane-setup.md +188 -0
- package/packs/flutter/commands/flutter-build.md +90 -0
- package/packs/flutter/commands/flutter-deploy.md +133 -0
- package/packs/flutter/commands/flutter-test.md +117 -0
- package/packs/flutter/commands/signing-setup.md +209 -0
- package/packs/flutter/hooks/hooks.json +17 -0
- package/packs/flutter/skills/fastlane-knowledge/SKILL.md +193 -0
- package/packs/flutter/skills/flutter-architecture/SKILL.md +127 -0
- package/packs/flutter/skills/store-publishing/SKILL.md +163 -0
- package/packs/hono/.claude-plugin/plugin.json +19 -0
- package/packs/hono/CHANGELOG.md +19 -0
- package/packs/hono/README.md +143 -0
- package/packs/hono/agents/hono-architect.md +240 -0
- package/packs/hono/agents/hono-builder.md +285 -0
- package/packs/hono/agents/hono-reviewer.md +279 -0
- package/packs/hono/agents/hono-tester.md +346 -0
- package/packs/hono/commands/middleware-create.md +223 -0
- package/packs/hono/commands/project-init.md +306 -0
- package/packs/hono/commands/route-create.md +153 -0
- package/packs/hono/commands/rpc-client.md +263 -0
- package/packs/hono/hooks/hooks.json +4 -0
- package/packs/hono/skills/cloudflare-bindings/SKILL.md +408 -0
- package/packs/hono/skills/hono-patterns/SKILL.md +309 -0
- package/packs/hono/skills/rpc-typesafe/SKILL.md +388 -0
- package/packs/hono/skills/zod-validation/SKILL.md +332 -0
- package/packs/nestjs/CHANGELOG.md +29 -0
- package/packs/nestjs/README.md +75 -0
- package/packs/nestjs/agents/nestjs-architect.md +402 -0
- package/packs/nestjs/agents/nestjs-builder.md +301 -0
- package/packs/nestjs/agents/nestjs-tester.md +437 -0
- package/packs/nestjs/commands/module-create.md +369 -0
- package/packs/nestjs/rules/controllers.md +92 -0
- package/packs/nestjs/rules/dto.md +124 -0
- package/packs/nestjs/rules/entities.md +102 -0
- package/packs/nestjs/rules/services.md +106 -0
- package/packs/nestjs/skills/barrel-export-manager/SKILL.md +389 -0
- package/packs/nestjs/skills/import-convention-enforcer/SKILL.md +365 -0
- package/packs/nextjs/CHANGELOG.md +36 -0
- package/packs/nextjs/README.md +76 -0
- package/packs/nextjs/agents/frontend-tester.md +680 -0
- package/packs/nextjs/agents/frontend-visual.md +820 -0
- package/packs/nextjs/agents/nextjs-architect.md +331 -0
- package/packs/nextjs/agents/nextjs-modular.md +433 -0
- package/packs/nextjs/commands/component-create.md +398 -0
- package/packs/nextjs/rules/api-routes.md +129 -0
- package/packs/nextjs/rules/components.md +106 -0
- package/packs/nextjs/rules/hooks.md +132 -0
- package/packs/nextjs/skills/accessibility-validator/SKILL.md +445 -0
- package/packs/nextjs/skills/import-convention-enforcer/SKILL.md +399 -0
- package/packs/nextjs/skills/react-form-validator/SKILL.md +569 -0
- package/packs/nuxtjs/CHANGELOG.md +30 -0
- package/packs/nuxtjs/README.md +56 -0
- package/packs/nuxtjs/agents/frontend-tester.md +680 -0
- package/packs/nuxtjs/agents/frontend-visual.md +820 -0
- package/packs/nuxtjs/agents/nuxtjs-architect.md +537 -0
- package/packs/nuxtjs/commands/component-create.md +223 -0
- package/packs/nuxtjs/rules/components.md +101 -0
- package/packs/nuxtjs/rules/composables.md +118 -0
- package/packs/nuxtjs/rules/server-routes.md +127 -0
- package/packs/nuxtjs/skills/accessibility-validator/SKILL.md +183 -0
- package/packs/nuxtjs/skills/import-convention-enforcer/SKILL.md +196 -0
- package/packs/nuxtjs/skills/veevalidate-form-validator/SKILL.md +190 -0
- package/packs/onboard/CHANGELOG.md +22 -0
- package/packs/onboard/README.md +103 -0
- package/packs/onboard/agents/onboard-guide.md +118 -0
- package/packs/onboard/commands/onboard.md +313 -0
- package/packs/onboard/skills/onboard-context-provider/SKILL.md +98 -0
- package/packs/tanstack-router/.claude-plugin/plugin.json +14 -0
- package/packs/tanstack-router/CHANGELOG.md +30 -0
- package/packs/tanstack-router/README.md +113 -0
- package/packs/tanstack-router/agents/tanstack-architect.md +173 -0
- package/packs/tanstack-router/agents/tanstack-builder.md +360 -0
- package/packs/tanstack-router/agents/tanstack-tester.md +454 -0
- package/packs/tanstack-router/commands/form-create.md +313 -0
- package/packs/tanstack-router/commands/query-create.md +263 -0
- package/packs/tanstack-router/commands/route-create.md +190 -0
- package/packs/tanstack-router/commands/table-create.md +413 -0
- package/packs/tanstack-router/skills/ai-patterns/SKILL.md +370 -0
- package/packs/tanstack-router/skills/db-patterns/SKILL.md +346 -0
- package/packs/tanstack-router/skills/devtools-patterns/SKILL.md +415 -0
- package/packs/tanstack-router/skills/form-patterns/SKILL.md +425 -0
- package/packs/tanstack-router/skills/pacer-patterns/SKILL.md +341 -0
- package/packs/tanstack-router/skills/query-patterns/SKILL.md +359 -0
- package/packs/tanstack-router/skills/router-patterns/SKILL.md +285 -0
- package/packs/tanstack-router/skills/store-patterns/SKILL.md +351 -0
- package/packs/tanstack-router/skills/table-patterns/SKILL.md +531 -0
- package/packs/tanstack-router/skills/tanstack-conventions/SKILL.md +428 -0
- package/packs/tanstack-router/skills/virtual-patterns/SKILL.md +490 -0
- package/packs/worktree/.claude-plugin/plugin.json +19 -0
- package/packs/worktree/CHANGELOG.md +24 -0
- package/packs/worktree/README.md +110 -0
- package/packs/worktree/commands/wt.md +73 -0
- package/packs/worktree/scripts/wt.sh +396 -0
- package/packs/worktree/skills/worktree-manager/SKILL.md +68 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# wt.sh - Git Worktree Manager
|
|
6
|
+
# Naming: ~/code/project/ → ~/code/project--branch-name/
|
|
7
|
+
# =============================================================================
|
|
8
|
+
|
|
9
|
+
# Colors
|
|
10
|
+
RED='\033[0;31m'
|
|
11
|
+
GREEN='\033[0;32m'
|
|
12
|
+
YELLOW='\033[1;33m'
|
|
13
|
+
BLUE='\033[0;34m'
|
|
14
|
+
NC='\033[0m' # No Color
|
|
15
|
+
|
|
16
|
+
# Helpers
|
|
17
|
+
info() { echo -e "${BLUE}ℹ${NC} $1"; }
|
|
18
|
+
success() { echo -e "${GREEN}✓${NC} $1"; }
|
|
19
|
+
warn() { echo -e "${YELLOW}⚠${NC} $1"; }
|
|
20
|
+
error() { echo -e "${RED}✗${NC} $1" >&2; }
|
|
21
|
+
|
|
22
|
+
# Get repo root and name (finds main worktree, not current worktree)
|
|
23
|
+
get_repo_info() {
|
|
24
|
+
# First check we're in a git repo
|
|
25
|
+
git rev-parse --show-toplevel &>/dev/null || {
|
|
26
|
+
error "Not in a git repository"
|
|
27
|
+
exit 1
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# Get the main worktree (first line of git worktree list)
|
|
31
|
+
REPO_ROOT=$(git worktree list --porcelain | grep "^worktree " | head -1 | sed 's/^worktree //')
|
|
32
|
+
|
|
33
|
+
if [[ -z "$REPO_ROOT" ]]; then
|
|
34
|
+
error "Could not determine main worktree"
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
REPO_NAME=$(basename "$REPO_ROOT")
|
|
39
|
+
REPO_PARENT=$(dirname "$REPO_ROOT")
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Detect package manager
|
|
43
|
+
detect_pkg_manager() {
|
|
44
|
+
local dir="${1:-$REPO_ROOT}"
|
|
45
|
+
if [[ -f "$dir/bun.lockb" ]] || [[ -f "$dir/bun.lock" ]]; then
|
|
46
|
+
echo "bun"
|
|
47
|
+
elif [[ -f "$dir/pnpm-lock.yaml" ]]; then
|
|
48
|
+
echo "pnpm"
|
|
49
|
+
elif [[ -f "$dir/yarn.lock" ]]; then
|
|
50
|
+
echo "yarn"
|
|
51
|
+
elif [[ -f "$dir/package-lock.json" ]] || [[ -f "$dir/package.json" ]]; then
|
|
52
|
+
echo "npm"
|
|
53
|
+
else
|
|
54
|
+
echo ""
|
|
55
|
+
fi
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
# Detect if monorepo
|
|
59
|
+
is_monorepo() {
|
|
60
|
+
local dir="${1:-$REPO_ROOT}"
|
|
61
|
+
# Check for monorepo indicators
|
|
62
|
+
[[ -f "$dir/pnpm-workspace.yaml" ]] && return 0
|
|
63
|
+
[[ -f "$dir/turbo.json" ]] && return 0
|
|
64
|
+
[[ -f "$dir/nx.json" ]] && return 0
|
|
65
|
+
[[ -f "$dir/lerna.json" ]] && return 0
|
|
66
|
+
# Check for workspaces in package.json
|
|
67
|
+
if [[ -f "$dir/package.json" ]]; then
|
|
68
|
+
grep -q '"workspaces"' "$dir/package.json" 2>/dev/null && return 0
|
|
69
|
+
fi
|
|
70
|
+
return 1
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# Copy .env files from source to destination
|
|
74
|
+
copy_env_files() {
|
|
75
|
+
local src="$1"
|
|
76
|
+
local dst="$2"
|
|
77
|
+
local count=0
|
|
78
|
+
|
|
79
|
+
# Copy root .env* files
|
|
80
|
+
for envfile in "$src"/.env*; do
|
|
81
|
+
[[ -f "$envfile" ]] || continue
|
|
82
|
+
local filename=$(basename "$envfile")
|
|
83
|
+
cp "$envfile" "$dst/$filename"
|
|
84
|
+
((count++))
|
|
85
|
+
done
|
|
86
|
+
|
|
87
|
+
# Copy nested .env* files from common monorepo directories
|
|
88
|
+
for subdir in apps packages services libs modules; do
|
|
89
|
+
[[ -d "$src/$subdir" ]] || continue
|
|
90
|
+
for app_dir in "$src/$subdir"/*/; do
|
|
91
|
+
[[ -d "$app_dir" ]] || continue
|
|
92
|
+
local app_name=$(basename "$app_dir")
|
|
93
|
+
for envfile in "$app_dir".env*; do
|
|
94
|
+
[[ -f "$envfile" ]] || continue
|
|
95
|
+
local filename=$(basename "$envfile")
|
|
96
|
+
# Ensure target directory exists
|
|
97
|
+
mkdir -p "$dst/$subdir/$app_name"
|
|
98
|
+
cp "$envfile" "$dst/$subdir/$app_name/$filename"
|
|
99
|
+
((count++))
|
|
100
|
+
done
|
|
101
|
+
done
|
|
102
|
+
done
|
|
103
|
+
|
|
104
|
+
echo "$count"
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
# Get worktree path from branch name
|
|
108
|
+
get_worktree_path() {
|
|
109
|
+
local branch="$1"
|
|
110
|
+
# Replace slashes with dashes for branch names like feature/auth
|
|
111
|
+
local safe_branch="${branch//\//-}"
|
|
112
|
+
echo "${REPO_PARENT}/${REPO_NAME}--${safe_branch}"
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# Strip main repo name prefix from worktree basename
|
|
116
|
+
get_branch_from_worktree() {
|
|
117
|
+
local wt_path="$1"
|
|
118
|
+
local wt_name=$(basename "$wt_path")
|
|
119
|
+
# Remove the repo name prefix and --
|
|
120
|
+
echo "${wt_name#${REPO_NAME}--}"
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
# =============================================================================
|
|
124
|
+
# Commands
|
|
125
|
+
# =============================================================================
|
|
126
|
+
|
|
127
|
+
cmd_create() {
|
|
128
|
+
local branch="${1:-}"
|
|
129
|
+
|
|
130
|
+
if [[ -z "$branch" ]]; then
|
|
131
|
+
error "Usage: wt create <branch-name>"
|
|
132
|
+
echo " Creates a new worktree for the given branch"
|
|
133
|
+
exit 1
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
get_repo_info
|
|
137
|
+
local wt_path=$(get_worktree_path "$branch")
|
|
138
|
+
|
|
139
|
+
if [[ -d "$wt_path" ]]; then
|
|
140
|
+
error "Worktree already exists: $wt_path"
|
|
141
|
+
exit 1
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
info "Creating worktree for branch: $branch"
|
|
145
|
+
|
|
146
|
+
# Check if branch exists (local or remote)
|
|
147
|
+
if git show-ref --verify --quiet "refs/heads/$branch" 2>/dev/null; then
|
|
148
|
+
info "Checking out existing local branch: $branch"
|
|
149
|
+
git worktree add "$wt_path" "$branch"
|
|
150
|
+
elif git show-ref --verify --quiet "refs/remotes/origin/$branch" 2>/dev/null; then
|
|
151
|
+
info "Checking out existing remote branch: origin/$branch"
|
|
152
|
+
git worktree add "$wt_path" "$branch"
|
|
153
|
+
else
|
|
154
|
+
info "Creating new branch: $branch"
|
|
155
|
+
git worktree add -b "$branch" "$wt_path"
|
|
156
|
+
fi
|
|
157
|
+
success "Worktree created at: $wt_path"
|
|
158
|
+
|
|
159
|
+
# Copy .env files
|
|
160
|
+
info "Copying .env files..."
|
|
161
|
+
local env_count=$(copy_env_files "$REPO_ROOT" "$wt_path")
|
|
162
|
+
if [[ "$env_count" -gt 0 ]]; then
|
|
163
|
+
success "Copied $env_count .env file(s)"
|
|
164
|
+
else
|
|
165
|
+
warn "No .env files found to copy"
|
|
166
|
+
fi
|
|
167
|
+
|
|
168
|
+
# Detect and run package manager install
|
|
169
|
+
local pkg_mgr=$(detect_pkg_manager "$wt_path")
|
|
170
|
+
if [[ -n "$pkg_mgr" ]]; then
|
|
171
|
+
info "Detected package manager: $pkg_mgr"
|
|
172
|
+
|
|
173
|
+
if is_monorepo "$wt_path"; then
|
|
174
|
+
info "Monorepo detected, installing at root..."
|
|
175
|
+
fi
|
|
176
|
+
|
|
177
|
+
info "Running $pkg_mgr install..."
|
|
178
|
+
cd "$wt_path"
|
|
179
|
+
case "$pkg_mgr" in
|
|
180
|
+
bun) bun install ;;
|
|
181
|
+
pnpm) pnpm install ;;
|
|
182
|
+
yarn) yarn install ;;
|
|
183
|
+
npm) npm install ;;
|
|
184
|
+
esac
|
|
185
|
+
success "Dependencies installed"
|
|
186
|
+
fi
|
|
187
|
+
|
|
188
|
+
echo ""
|
|
189
|
+
success "Worktree ready!"
|
|
190
|
+
echo ""
|
|
191
|
+
echo -e "${GREEN}cd ${wt_path}${NC}"
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
cmd_list() {
|
|
195
|
+
get_repo_info
|
|
196
|
+
|
|
197
|
+
info "Worktrees for: $REPO_NAME"
|
|
198
|
+
echo ""
|
|
199
|
+
|
|
200
|
+
# Get all worktrees
|
|
201
|
+
local found=0
|
|
202
|
+
while IFS= read -r line; do
|
|
203
|
+
# Parse worktree output (format: "path HEAD branch")
|
|
204
|
+
local wt_path=$(echo "$line" | awk '{print $1}')
|
|
205
|
+
local wt_branch=$(echo "$line" | awk '{print $3}' | sed 's/\[//;s/\]//')
|
|
206
|
+
|
|
207
|
+
if [[ "$wt_path" == "$REPO_ROOT" ]]; then
|
|
208
|
+
echo -e " ${BLUE}●${NC} $wt_path ${GREEN}(main)${NC}"
|
|
209
|
+
else
|
|
210
|
+
local branch_display=$(get_branch_from_worktree "$wt_path")
|
|
211
|
+
echo -e " ${YELLOW}○${NC} $wt_path ${YELLOW}($branch_display)${NC}"
|
|
212
|
+
fi
|
|
213
|
+
((found++))
|
|
214
|
+
done < <(git worktree list --porcelain | grep "^worktree " | sed 's/^worktree //')
|
|
215
|
+
|
|
216
|
+
if [[ "$found" -eq 0 ]]; then
|
|
217
|
+
warn "No worktrees found"
|
|
218
|
+
fi
|
|
219
|
+
echo ""
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
cmd_remove() {
|
|
223
|
+
local branch="${1:-}"
|
|
224
|
+
local delete_branch=false
|
|
225
|
+
|
|
226
|
+
# Check for --delete-branch flag
|
|
227
|
+
if [[ "${2:-}" == "--delete-branch" ]] || [[ "${2:-}" == "-d" ]]; then
|
|
228
|
+
delete_branch=true
|
|
229
|
+
fi
|
|
230
|
+
|
|
231
|
+
if [[ -z "$branch" ]]; then
|
|
232
|
+
error "Usage: wt remove <branch-name> [--delete-branch|-d]"
|
|
233
|
+
echo " Removes the worktree for the given branch"
|
|
234
|
+
echo " --delete-branch, -d: Also delete the git branch"
|
|
235
|
+
exit 1
|
|
236
|
+
fi
|
|
237
|
+
|
|
238
|
+
get_repo_info
|
|
239
|
+
local wt_path=$(get_worktree_path "$branch")
|
|
240
|
+
|
|
241
|
+
if [[ ! -d "$wt_path" ]]; then
|
|
242
|
+
error "Worktree not found: $wt_path"
|
|
243
|
+
exit 1
|
|
244
|
+
fi
|
|
245
|
+
|
|
246
|
+
info "Removing worktree: $wt_path"
|
|
247
|
+
git worktree remove "$wt_path" --force
|
|
248
|
+
success "Worktree removed"
|
|
249
|
+
|
|
250
|
+
if [[ "$delete_branch" == true ]]; then
|
|
251
|
+
info "Deleting branch: $branch"
|
|
252
|
+
git branch -D "$branch" 2>/dev/null || warn "Branch not found or already deleted"
|
|
253
|
+
success "Branch deleted"
|
|
254
|
+
fi
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
cmd_open() {
|
|
258
|
+
local branch=""
|
|
259
|
+
local editor=""
|
|
260
|
+
|
|
261
|
+
# Parse arguments
|
|
262
|
+
while [[ $# -gt 0 ]]; do
|
|
263
|
+
case "$1" in
|
|
264
|
+
--cursor|-c)
|
|
265
|
+
editor="cursor"
|
|
266
|
+
shift
|
|
267
|
+
;;
|
|
268
|
+
--agy|-a)
|
|
269
|
+
editor="agy"
|
|
270
|
+
shift
|
|
271
|
+
;;
|
|
272
|
+
--code|-v)
|
|
273
|
+
editor="code"
|
|
274
|
+
shift
|
|
275
|
+
;;
|
|
276
|
+
-*)
|
|
277
|
+
error "Unknown option: $1"
|
|
278
|
+
exit 1
|
|
279
|
+
;;
|
|
280
|
+
*)
|
|
281
|
+
branch="$1"
|
|
282
|
+
shift
|
|
283
|
+
;;
|
|
284
|
+
esac
|
|
285
|
+
done
|
|
286
|
+
|
|
287
|
+
if [[ -z "$branch" ]]; then
|
|
288
|
+
error "Usage: wt open <branch-name> [--cursor|-c] [--agy|-a] [--code|-v]"
|
|
289
|
+
echo " Opens the worktree in specified editor (auto-detects if not specified)"
|
|
290
|
+
exit 1
|
|
291
|
+
fi
|
|
292
|
+
|
|
293
|
+
get_repo_info
|
|
294
|
+
local wt_path=$(get_worktree_path "$branch")
|
|
295
|
+
|
|
296
|
+
if [[ ! -d "$wt_path" ]]; then
|
|
297
|
+
error "Worktree not found: $wt_path"
|
|
298
|
+
echo " Run 'wt create $branch' first"
|
|
299
|
+
exit 1
|
|
300
|
+
fi
|
|
301
|
+
|
|
302
|
+
# Priority: flag > WT_EDITOR env > auto-detect
|
|
303
|
+
if [[ -z "$editor" && -n "${WT_EDITOR:-}" ]]; then
|
|
304
|
+
editor="$WT_EDITOR"
|
|
305
|
+
fi
|
|
306
|
+
|
|
307
|
+
if [[ -n "$editor" ]]; then
|
|
308
|
+
if ! command -v "$editor" &>/dev/null; then
|
|
309
|
+
error "$editor not found in PATH"
|
|
310
|
+
exit 1
|
|
311
|
+
fi
|
|
312
|
+
info "Opening in $editor: $wt_path"
|
|
313
|
+
"$editor" "$wt_path"
|
|
314
|
+
else
|
|
315
|
+
# Auto-detect: Cursor → Antigravity → VS Code
|
|
316
|
+
if command -v cursor &>/dev/null; then
|
|
317
|
+
info "Opening in Cursor: $wt_path"
|
|
318
|
+
cursor "$wt_path"
|
|
319
|
+
elif command -v agy &>/dev/null; then
|
|
320
|
+
info "Opening in Antigravity: $wt_path"
|
|
321
|
+
agy "$wt_path"
|
|
322
|
+
elif command -v code &>/dev/null; then
|
|
323
|
+
info "Opening in VS Code: $wt_path"
|
|
324
|
+
code "$wt_path"
|
|
325
|
+
else
|
|
326
|
+
error "No supported editor found (cursor, agy, code)"
|
|
327
|
+
exit 1
|
|
328
|
+
fi
|
|
329
|
+
fi
|
|
330
|
+
success "Opened!"
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
cmd_help() {
|
|
334
|
+
echo "wt - Git Worktree Manager"
|
|
335
|
+
echo ""
|
|
336
|
+
echo "Usage: wt <command> [args]"
|
|
337
|
+
echo ""
|
|
338
|
+
echo "Commands:"
|
|
339
|
+
echo " create, c <branch> Create worktree, copy .env files, install deps"
|
|
340
|
+
echo " list, ls List all worktrees for current repo"
|
|
341
|
+
echo " remove, rm <branch> Remove worktree (add -d to delete branch too)"
|
|
342
|
+
echo " open, o <branch> Open worktree (flag > WT_EDITOR > auto-detect)"
|
|
343
|
+
echo " Options: --cursor|-c, --agy|-a, --code|-v"
|
|
344
|
+
echo " help, -h, --help Show this help"
|
|
345
|
+
echo ""
|
|
346
|
+
echo "Environment:"
|
|
347
|
+
echo " WT_EDITOR Default editor (cursor, agy, code)"
|
|
348
|
+
echo ""
|
|
349
|
+
echo "Naming convention:"
|
|
350
|
+
echo " ~/code/project/ → main repo"
|
|
351
|
+
echo " ~/code/project--feat-auth/ → worktree for feat-auth branch"
|
|
352
|
+
echo ""
|
|
353
|
+
echo "Examples:"
|
|
354
|
+
echo " wt create feature/authentication"
|
|
355
|
+
echo " wt c feat-payments"
|
|
356
|
+
echo " wt ls"
|
|
357
|
+
echo " wt rm feature/authentication"
|
|
358
|
+
echo " wt rm feat-payments -d"
|
|
359
|
+
echo " wt o feat-payments"
|
|
360
|
+
echo " wt o feat-payments --agy"
|
|
361
|
+
echo " WT_EDITOR=agy wt o feat-payments"
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
# =============================================================================
|
|
365
|
+
# Main
|
|
366
|
+
# =============================================================================
|
|
367
|
+
|
|
368
|
+
main() {
|
|
369
|
+
local cmd="${1:-help}"
|
|
370
|
+
shift || true
|
|
371
|
+
|
|
372
|
+
case "$cmd" in
|
|
373
|
+
create|c)
|
|
374
|
+
cmd_create "$@"
|
|
375
|
+
;;
|
|
376
|
+
list|ls)
|
|
377
|
+
cmd_list "$@"
|
|
378
|
+
;;
|
|
379
|
+
remove|rm)
|
|
380
|
+
cmd_remove "$@"
|
|
381
|
+
;;
|
|
382
|
+
open|o)
|
|
383
|
+
cmd_open "$@"
|
|
384
|
+
;;
|
|
385
|
+
help|-h|--help)
|
|
386
|
+
cmd_help
|
|
387
|
+
;;
|
|
388
|
+
*)
|
|
389
|
+
error "Unknown command: $cmd"
|
|
390
|
+
cmd_help
|
|
391
|
+
exit 1
|
|
392
|
+
;;
|
|
393
|
+
esac
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
main "$@"
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: worktree-manager
|
|
3
|
+
description: This skill should be used when the user mentions "worktree", "wt", "new branch workspace", "parallel development", "feature branch setup", "work on multiple branches", "separate workspace for branch", or wants to manage git worktrees for parallel feature development.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Git Worktree Manager Skill
|
|
8
|
+
|
|
9
|
+
Manages git worktrees for parallel development with automatic environment setup.
|
|
10
|
+
|
|
11
|
+
## Activation Triggers
|
|
12
|
+
|
|
13
|
+
This skill activates when the user:
|
|
14
|
+
- Asks about "worktree" or "git worktree"
|
|
15
|
+
- Mentions "wt" in context of git/branches
|
|
16
|
+
- Wants to "work on multiple branches simultaneously"
|
|
17
|
+
- Needs a "separate workspace for a feature"
|
|
18
|
+
- Asks about "parallel development" setup
|
|
19
|
+
- Wants to "set up a new branch workspace"
|
|
20
|
+
|
|
21
|
+
## Commands Reference
|
|
22
|
+
|
|
23
|
+
| Command | Alias | Description |
|
|
24
|
+
|---------|-------|-------------|
|
|
25
|
+
| `/wt create <branch>` | `/wt c` | Create worktree with auto-setup |
|
|
26
|
+
| `/wt list` | `/wt ls` | Show all worktrees |
|
|
27
|
+
| `/wt remove <branch>` | `/wt rm` | Remove worktree |
|
|
28
|
+
| `/wt open <branch> [--editor]` | `/wt o` | Open (--cursor\|-c, --agy\|-a, --code\|-v) |
|
|
29
|
+
|
|
30
|
+
## Naming Convention
|
|
31
|
+
|
|
32
|
+
Worktrees are created as siblings with `--` separator:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
~/[PARENT_DIRECTORY]/[REPO_NAME]/ # main repo
|
|
36
|
+
~/[PARENT_DIRECTORY]/[REPO_NAME]--[BRANCH_NAME]/ # worktree for [BRANCH_NAME]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Auto-Setup Features
|
|
40
|
+
|
|
41
|
+
When creating a worktree, the following happens automatically:
|
|
42
|
+
|
|
43
|
+
1. **Branch handling**: Creates new branch or checks out existing (local/remote)
|
|
44
|
+
2. **Env files**: Copies all `.env*` from root and nested directories
|
|
45
|
+
3. **Package manager**: Detects bun/pnpm/yarn/npm from lockfiles
|
|
46
|
+
4. **Dependencies**: Runs install at root (monorepo-aware)
|
|
47
|
+
|
|
48
|
+
## Behavioral Expectations
|
|
49
|
+
|
|
50
|
+
When user asks about worktrees or parallel development:
|
|
51
|
+
|
|
52
|
+
1. Suggest using `/wt create <branch>` for new worktrees
|
|
53
|
+
2. Explain the naming convention if they seem unfamiliar
|
|
54
|
+
3. Mention the auto-setup features (env copying, dep install)
|
|
55
|
+
4. Show the `cd` command output for easy navigation
|
|
56
|
+
|
|
57
|
+
## Example Interactions
|
|
58
|
+
|
|
59
|
+
**User**: "I need to work on the auth feature while keeping my current work"
|
|
60
|
+
|
|
61
|
+
**Response**: Use `/wt create feature/auth` to create a parallel workspace. This will:
|
|
62
|
+
- Create `project--feature-auth/` as sibling directory
|
|
63
|
+
- Copy your `.env` files
|
|
64
|
+
- Install dependencies
|
|
65
|
+
|
|
66
|
+
**User**: "Show me my worktrees"
|
|
67
|
+
|
|
68
|
+
**Response**: Use `/wt ls` to list all worktrees for the current repo.
|