@hustle-together/api-dev-tools 3.10.0 → 3.11.1
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/api-dev-state.json +159 -0
- package/.claude/commands/README.md +185 -0
- package/.claude/commands/add-command.md +209 -0
- package/.claude/commands/api-create.md +499 -0
- package/.claude/commands/api-env.md +50 -0
- package/.claude/commands/api-interview.md +331 -0
- package/.claude/commands/api-research.md +331 -0
- package/.claude/commands/api-status.md +259 -0
- package/.claude/commands/api-verify.md +231 -0
- package/.claude/commands/beepboop.md +97 -0
- package/.claude/commands/busycommit.md +112 -0
- package/.claude/commands/commit.md +83 -0
- package/.claude/commands/cycle.md +142 -0
- package/.claude/commands/gap.md +86 -0
- package/.claude/commands/green.md +142 -0
- package/.claude/commands/issue.md +192 -0
- package/.claude/commands/plan.md +168 -0
- package/.claude/commands/pr.md +122 -0
- package/.claude/commands/red.md +142 -0
- package/.claude/commands/refactor.md +142 -0
- package/.claude/commands/spike.md +142 -0
- package/.claude/commands/summarize.md +94 -0
- package/.claude/commands/tdd.md +144 -0
- package/.claude/commands/worktree-add.md +315 -0
- package/.claude/commands/worktree-cleanup.md +281 -0
- package/.claude/hooks/api-workflow-check.py +227 -0
- package/.claude/hooks/enforce-deep-research.py +185 -0
- package/.claude/hooks/enforce-disambiguation.py +155 -0
- package/.claude/hooks/enforce-documentation.py +192 -0
- package/.claude/hooks/enforce-environment.py +253 -0
- package/.claude/hooks/enforce-external-research.py +328 -0
- package/.claude/hooks/enforce-interview.py +421 -0
- package/.claude/hooks/enforce-refactor.py +189 -0
- package/.claude/hooks/enforce-research.py +159 -0
- package/.claude/hooks/enforce-schema.py +186 -0
- package/.claude/hooks/enforce-scope.py +160 -0
- package/.claude/hooks/enforce-tdd-red.py +250 -0
- package/.claude/hooks/enforce-verify.py +186 -0
- package/.claude/hooks/periodic-reground.py +154 -0
- package/.claude/hooks/session-startup.py +151 -0
- package/.claude/hooks/track-tool-use.py +626 -0
- package/.claude/hooks/verify-after-green.py +282 -0
- package/.claude/hooks/verify-implementation.py +225 -0
- package/.claude/research/index.json +6 -0
- package/.claude/settings.json +93 -0
- package/.claude/settings.local.json +11 -0
- package/.claude-plugin/marketplace.json +112 -0
- package/.skills/README.md +291 -0
- package/.skills/_shared/convert-commands.py +192 -0
- package/.skills/_shared/hooks/api-workflow-check.py +227 -0
- package/.skills/_shared/hooks/enforce-deep-research.py +185 -0
- package/.skills/_shared/hooks/enforce-disambiguation.py +155 -0
- package/.skills/_shared/hooks/enforce-documentation.py +192 -0
- package/.skills/_shared/hooks/enforce-environment.py +253 -0
- package/.skills/_shared/hooks/enforce-external-research.py +328 -0
- package/.skills/_shared/hooks/enforce-interview.py +421 -0
- package/.skills/_shared/hooks/enforce-refactor.py +189 -0
- package/.skills/_shared/hooks/enforce-research.py +159 -0
- package/.skills/_shared/hooks/enforce-schema.py +186 -0
- package/.skills/_shared/hooks/enforce-scope.py +160 -0
- package/.skills/_shared/hooks/enforce-tdd-red.py +250 -0
- package/.skills/_shared/hooks/enforce-verify.py +186 -0
- package/.skills/_shared/hooks/periodic-reground.py +154 -0
- package/.skills/_shared/hooks/session-startup.py +151 -0
- package/.skills/_shared/hooks/track-tool-use.py +626 -0
- package/.skills/_shared/hooks/verify-after-green.py +282 -0
- package/.skills/_shared/hooks/verify-implementation.py +225 -0
- package/.skills/_shared/install.sh +114 -0
- package/.skills/_shared/settings.json +93 -0
- package/.skills/add-command/SKILL.md +222 -0
- package/.skills/api-create/SKILL.md +512 -0
- package/.skills/api-env/SKILL.md +63 -0
- package/.skills/api-interview/SKILL.md +344 -0
- package/.skills/api-research/SKILL.md +344 -0
- package/.skills/api-status/SKILL.md +272 -0
- package/.skills/api-verify/SKILL.md +244 -0
- package/.skills/beepboop/SKILL.md +110 -0
- package/.skills/busycommit/SKILL.md +125 -0
- package/.skills/commit/SKILL.md +96 -0
- package/.skills/cycle/SKILL.md +155 -0
- package/.skills/gap/SKILL.md +99 -0
- package/.skills/green/SKILL.md +155 -0
- package/.skills/issue/SKILL.md +205 -0
- package/.skills/plan/SKILL.md +181 -0
- package/.skills/pr/SKILL.md +135 -0
- package/.skills/red/SKILL.md +155 -0
- package/.skills/refactor/SKILL.md +155 -0
- package/.skills/spike/SKILL.md +155 -0
- package/.skills/summarize/SKILL.md +107 -0
- package/.skills/tdd/SKILL.md +157 -0
- package/.skills/update-todos/SKILL.md +228 -0
- package/.skills/worktree-add/SKILL.md +328 -0
- package/.skills/worktree-cleanup/SKILL.md +294 -0
- package/CHANGELOG.md +97 -0
- package/README.md +66 -20
- package/bin/cli.js +7 -6
- package/package.json +22 -11
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: update-todos
|
|
3
|
+
description: Update TodoWrite progress tracker for multi-phase workflows. Internal helper skill that visualizes workflow progress with checkboxes. Automatically determines status based on current phase. Keywords: todowrite, progress, tracking, workflow, visualization, helper
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Claude Code with TodoWrite tool support
|
|
6
|
+
metadata:
|
|
7
|
+
version: "1.0.0"
|
|
8
|
+
category: "workflow"
|
|
9
|
+
tags: ["todowrite", "progress", "tracking", "visualization", "helper"]
|
|
10
|
+
author: "Hustle Together"
|
|
11
|
+
allowed-tools: TodoWrite Read
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Update Todos - TodoWrite Progress Helper
|
|
15
|
+
|
|
16
|
+
**Usage:** `/update-todos [workflow] [current-phase]`
|
|
17
|
+
|
|
18
|
+
**Purpose:** Updates the TodoWrite visual progress tracker for multi-phase workflows. Internal helper skill called by workflow commands.
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
- **workflow**: Which workflow to update
|
|
23
|
+
- `api-create` - 13-phase API development
|
|
24
|
+
- `ui-create-component` - 13-phase component development
|
|
25
|
+
- `ui-create-page` - 13-phase page development
|
|
26
|
+
- `combine` - 12-phase API orchestration
|
|
27
|
+
|
|
28
|
+
- **current-phase**: Phase number just completed (0 = initialization, 1-13 = phases)
|
|
29
|
+
|
|
30
|
+
## Workflow Phase Definitions
|
|
31
|
+
|
|
32
|
+
### API Create (13 phases)
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
Phase 1: Disambiguation - Clarify ambiguous API terms
|
|
36
|
+
Phase 2: Scope - Confirm endpoint understanding
|
|
37
|
+
Phase 3: Initial Research - Targeted doc searches (Context7, Web)
|
|
38
|
+
Phase 4: Interview - Questions FROM research findings
|
|
39
|
+
Phase 5: Deep Research - Adaptive propose-approve searches
|
|
40
|
+
Phase 6: Schema - Zod schema from research + interview
|
|
41
|
+
Phase 7: Environment - Verify API keys exist
|
|
42
|
+
Phase 8: TDD Red - Write failing tests
|
|
43
|
+
Phase 9: TDD Green - Minimal implementation
|
|
44
|
+
Phase 10: Verify - Re-research docs vs implementation
|
|
45
|
+
Phase 11: Refactor - Clean up code
|
|
46
|
+
Phase 12: Documentation - Update manifests, cache research
|
|
47
|
+
Phase 13: Completion - Final verification, commit
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### UI Create Component (13 phases)
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Phase 1: Component Scope - Define type (Atom/Molecule/Organism)
|
|
54
|
+
Phase 2: Brand Guide - Check existing design system
|
|
55
|
+
Phase 3: Research - ShadCN, Radix, Tailwind patterns
|
|
56
|
+
Phase 4: Props Interview - Component API questions
|
|
57
|
+
Phase 5: ShadCN Detection - Check if base exists
|
|
58
|
+
Phase 6: Component Schema - Props, variants, defaults
|
|
59
|
+
Phase 7: TDD Red - Write component tests
|
|
60
|
+
Phase 8: TDD Green - Implement component
|
|
61
|
+
Phase 9: Storybook Stories - Create interactive docs
|
|
62
|
+
Phase 10: Responsive Check - Test breakpoints
|
|
63
|
+
Phase 11: Accessibility - WCAG AA/AAA audit
|
|
64
|
+
Phase 12: Brand Validation - Verify design system compliance
|
|
65
|
+
Phase 13: Showcase Update - Add to UI showcase page
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### UI Create Page (13 phases)
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Phase 1: Page Type - Landing/Dashboard/Form/List/Detail/Auth
|
|
72
|
+
Phase 2: Route Planning - Define URL structure
|
|
73
|
+
Phase 3: API Route Check - Verify backend exists
|
|
74
|
+
Phase 4: Data Schema - Define page data requirements
|
|
75
|
+
Phase 5: Component Research - Find needed UI components
|
|
76
|
+
Phase 6: Layout Design - Structure with App Router patterns
|
|
77
|
+
Phase 7: TDD Red - Write Playwright E2E tests
|
|
78
|
+
Phase 8: TDD Green - Implement page
|
|
79
|
+
Phase 9: Data Integration - Connect to API routes
|
|
80
|
+
Phase 10: SEO Metadata - Add meta tags, OG, Twitter cards
|
|
81
|
+
Phase 11: Accessibility - Keyboard nav, ARIA, focus management
|
|
82
|
+
Phase 12: E2E Validation - Run Playwright tests
|
|
83
|
+
Phase 13: Registry Update - Add to route registry
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Combine APIs (12 phases)
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
Phase 1: API Selection - Choose 2+ existing APIs from registry
|
|
90
|
+
Phase 2: Registry Verification - Confirm APIs are complete
|
|
91
|
+
Phase 3: Flow Type - Sequential/Parallel/Conditional
|
|
92
|
+
Phase 4: Data Mapping - Define transformations between APIs
|
|
93
|
+
Phase 5: Error Strategy - Fail-fast/Fallback/Retry
|
|
94
|
+
Phase 6: Schema Design - Combined Zod schema
|
|
95
|
+
Phase 7: TDD Red - Write orchestration tests
|
|
96
|
+
Phase 8: TDD Green - Implement orchestration
|
|
97
|
+
Phase 9: Curl Examples - Generate test commands
|
|
98
|
+
Phase 10: Performance Test - Verify latency acceptable
|
|
99
|
+
Phase 11: Documentation - Update manifests with examples
|
|
100
|
+
Phase 12: Showcase Update - Add to API showcase
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Implementation
|
|
104
|
+
|
|
105
|
+
You are a TodoWrite progress updater. Your job is to:
|
|
106
|
+
|
|
107
|
+
1. **Read the workflow parameter** to determine which phase structure to use
|
|
108
|
+
2. **Build the todos array** with proper status for each phase
|
|
109
|
+
3. **Call TodoWrite** with the complete array
|
|
110
|
+
4. **Return silently** without output to the user
|
|
111
|
+
|
|
112
|
+
### Status Logic
|
|
113
|
+
|
|
114
|
+
For a given `current_phase` number:
|
|
115
|
+
- Phases < current_phase: `"completed"`
|
|
116
|
+
- Phase == current_phase: `"in_progress"`
|
|
117
|
+
- Phases > current_phase: `"pending"`
|
|
118
|
+
|
|
119
|
+
### Example Call
|
|
120
|
+
|
|
121
|
+
User calls: `/update-todos api-create 3`
|
|
122
|
+
|
|
123
|
+
You build:
|
|
124
|
+
```json
|
|
125
|
+
[
|
|
126
|
+
{"content": "Phase 1: Disambiguation", "status": "completed", "activeForm": "Clarified API terms"},
|
|
127
|
+
{"content": "Phase 2: Scope", "status": "completed", "activeForm": "Confirmed endpoint understanding"},
|
|
128
|
+
{"content": "Phase 3: Initial Research", "status": "in_progress", "activeForm": "Researching documentation"},
|
|
129
|
+
{"content": "Phase 4: Interview", "status": "pending", "activeForm": "Interviewing user for requirements"},
|
|
130
|
+
...
|
|
131
|
+
]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Then call TodoWrite with this array.
|
|
135
|
+
|
|
136
|
+
## Special Cases
|
|
137
|
+
|
|
138
|
+
### Initialization (phase 0)
|
|
139
|
+
When `current_phase = 0`, all phases are `"pending"` with one `"in_progress"`:
|
|
140
|
+
- Phase 1: `"in_progress"` (starting workflow)
|
|
141
|
+
- Phases 2-13: `"pending"`
|
|
142
|
+
|
|
143
|
+
### Completion (phase 13 for 13-phase workflows)
|
|
144
|
+
When `current_phase = 13`:
|
|
145
|
+
- All phases: `"completed"`
|
|
146
|
+
- Display completion message
|
|
147
|
+
|
|
148
|
+
### Loop-Back Scenarios
|
|
149
|
+
If a verification phase fails (e.g., Phase 10 requires going back to Phase 8):
|
|
150
|
+
- The calling workflow will call `/update-todos` with the looped-back phase number
|
|
151
|
+
- Example: After Phase 10 fails verification → `/update-todos api-create 8`
|
|
152
|
+
- Phase 8 becomes `"in_progress"` again
|
|
153
|
+
- Phases 9-13 revert to `"pending"`
|
|
154
|
+
|
|
155
|
+
## Error Handling
|
|
156
|
+
|
|
157
|
+
If invalid parameters:
|
|
158
|
+
- Invalid workflow name → Use `api-create` as default, warn user
|
|
159
|
+
- Invalid phase number → Clamp to valid range (0-13 or 0-12)
|
|
160
|
+
- Missing parameters → Ask user to provide them
|
|
161
|
+
|
|
162
|
+
## Silent Operation
|
|
163
|
+
|
|
164
|
+
**CRITICAL:** This is a helper skill. After calling TodoWrite, you MUST:
|
|
165
|
+
- **NOT output any text to the user**
|
|
166
|
+
- **NOT explain what you did**
|
|
167
|
+
- **NOT ask follow-up questions**
|
|
168
|
+
- Simply update the todos and return control to the calling workflow
|
|
169
|
+
|
|
170
|
+
The calling workflow (e.g., `/api-create`) will handle all user communication.
|
|
171
|
+
|
|
172
|
+
## Usage Examples
|
|
173
|
+
|
|
174
|
+
### From api-create workflow
|
|
175
|
+
```markdown
|
|
176
|
+
# Start of workflow
|
|
177
|
+
/update-todos api-create 0
|
|
178
|
+
|
|
179
|
+
# After Phase 1 completes
|
|
180
|
+
/update-todos api-create 1
|
|
181
|
+
|
|
182
|
+
# After Phase 10 verification fails (loop back to Phase 8)
|
|
183
|
+
/update-todos api-create 8
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### From ui-create-component workflow
|
|
187
|
+
```markdown
|
|
188
|
+
# Start of workflow
|
|
189
|
+
/update-todos ui-create-component 0
|
|
190
|
+
|
|
191
|
+
# After completing Brand Guide check
|
|
192
|
+
/update-todos ui-create-component 2
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### From combine workflow
|
|
196
|
+
```markdown
|
|
197
|
+
# Start of workflow (note: only 12 phases)
|
|
198
|
+
/update-todos combine 0
|
|
199
|
+
|
|
200
|
+
# After Flow Type selection
|
|
201
|
+
/update-todos combine 3
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Integration Points
|
|
205
|
+
|
|
206
|
+
This skill is called by:
|
|
207
|
+
- `.skills/api-create/SKILL.md` (or `/hustle-api-create`)
|
|
208
|
+
- `.skills/hustle-ui-create/SKILL.md` (component mode)
|
|
209
|
+
- `.skills/hustle-ui-create-page/SKILL.md` (page mode)
|
|
210
|
+
- `.skills/hustle-combine/SKILL.md` (orchestration)
|
|
211
|
+
|
|
212
|
+
## Testing
|
|
213
|
+
|
|
214
|
+
To test this helper independently:
|
|
215
|
+
```bash
|
|
216
|
+
/update-todos api-create 5
|
|
217
|
+
# Should show phases 1-4 completed, phase 5 in_progress, 6-13 pending
|
|
218
|
+
|
|
219
|
+
/update-todos combine 12
|
|
220
|
+
# Should show all 12 phases completed
|
|
221
|
+
|
|
222
|
+
/update-todos ui-create-component 0
|
|
223
|
+
# Should show phase 1 in_progress, rest pending
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
**Now execute the TodoWrite update based on the provided parameters.**
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: worktree-add
|
|
3
|
+
description: Add new git worktree from branch name or GitHub issue URL. Copies settings, installs deps, opens in IDE. Use for parallel feature development. Keywords: git, worktree, parallel, workflow, branches
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Claude Code with MCP servers (Context7, GitHub), Python 3.9+ for hooks, pnpm 10.11.0+
|
|
6
|
+
metadata:
|
|
7
|
+
version: "3.0.0"
|
|
8
|
+
category: "git"
|
|
9
|
+
tags: ['git', 'worktree', 'parallel', 'workflow']
|
|
10
|
+
author: "Hustle Together"
|
|
11
|
+
allowed-tools: WebSearch WebFetch mcp__context7 mcp__github AskUserQuestion Read Write Edit Bash TodoWrite
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
description: Add a new git worktree from branch name or GitHub issue URL, copy settings, install deps, and open in current IDE
|
|
16
|
+
argument-hint: <branch-name-or-github-issue-url> [optional-base-branch]
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Git Worktree Setup
|
|
20
|
+
|
|
21
|
+
## General Guidelines
|
|
22
|
+
|
|
23
|
+
### Output Style
|
|
24
|
+
|
|
25
|
+
- **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
|
|
26
|
+
- Write natural, descriptive code without meta-commentary about the development process
|
|
27
|
+
- The code should speak for itself - TDD is the process, not the product
|
|
28
|
+
|
|
29
|
+
Create a new git worktree for branch: $ARGUMENTS
|
|
30
|
+
|
|
31
|
+
<current_state>
|
|
32
|
+
Current branch: !git branch --show-current`
|
|
33
|
+
Current worktrees: !git worktree list`
|
|
34
|
+
Remote branches: !git branch -r`
|
|
35
|
+
Uncommitted changes: !git status --short`
|
|
36
|
+
</current_state>
|
|
37
|
+
|
|
38
|
+
<execution_steps>
|
|
39
|
+
<step_0>
|
|
40
|
+
<description>Validate MCP dependencies</description>
|
|
41
|
+
<check_github_mcp>
|
|
42
|
+
<requirement>GitHub MCP server must be configured</requirement>
|
|
43
|
+
<fallback>If unavailable, use `gh` CLI commands</fallback>
|
|
44
|
+
<validation>
|
|
45
|
+
- Try listing available MCP resources
|
|
46
|
+
- If GitHub MCP not found, switch to CLI fallback
|
|
47
|
+
- Inform user about MCP configuration if needed
|
|
48
|
+
</validation>
|
|
49
|
+
</check_github_mcp>
|
|
50
|
+
<error_handling>
|
|
51
|
+
If MCP validation fails:
|
|
52
|
+
- Show clear error message
|
|
53
|
+
- Provide setup instructions
|
|
54
|
+
- Fallback to CLI if possible
|
|
55
|
+
</error_handling>
|
|
56
|
+
<purpose>Ensure required MCP dependencies are available before proceeding</purpose>
|
|
57
|
+
</step_0>
|
|
58
|
+
|
|
59
|
+
<step_1>
|
|
60
|
+
<description>Detect current IDE environment</description>
|
|
61
|
+
<detection_methods>
|
|
62
|
+
<method_1>
|
|
63
|
+
<tool>mcp__ide__getDiagnostics</tool>
|
|
64
|
+
<vs_code_insiders>Check for paths containing "Code - Insiders"</vs_code_insiders>
|
|
65
|
+
<vs_code>Check for paths containing "Code/" or "Code.app"</vs_code>
|
|
66
|
+
<cursor>Check for paths containing "Cursor"</cursor>
|
|
67
|
+
<zed>Check for paths containing "Zed"</zed>
|
|
68
|
+
</method_1>
|
|
69
|
+
<method_2>
|
|
70
|
+
<fallback_detection>Use which command to find available IDEs</fallback_detection>
|
|
71
|
+
<commands>which code-insiders code zed cursor</commands>
|
|
72
|
+
<priority_order>code-insiders > cursor > zed > code</priority_order>
|
|
73
|
+
</method_2>
|
|
74
|
+
</detection_methods>
|
|
75
|
+
<set_variables>
|
|
76
|
+
<ide_command>Detected command (code-insiders|code|zed|cursor)</ide_command>
|
|
77
|
+
<ide_name>Human-readable name</ide_name>
|
|
78
|
+
<supports_tasks>true for VS Code variants, false for others</supports_tasks>
|
|
79
|
+
</set_variables>
|
|
80
|
+
<purpose>Automatically detect which IDE to use for opening the new worktree</purpose>
|
|
81
|
+
</step_1>
|
|
82
|
+
|
|
83
|
+
<step_2>
|
|
84
|
+
<description>Parse the arguments</description>
|
|
85
|
+
<input>The user-provided arguments</input>
|
|
86
|
+
<expected_format>branch-name-or-github-url [optional-base-branch]</expected_format>
|
|
87
|
+
<example>fix/issue-123-main-content-area-visually-clipped main</example>
|
|
88
|
+
<example_github_url><https://github.com/owner/project/issues/123> main</example_github_url>
|
|
89
|
+
<default_base_branch>main (if not specified)</default_base_branch>
|
|
90
|
+
</step_1>
|
|
91
|
+
|
|
92
|
+
<step_2_5>
|
|
93
|
+
<description>Handle GitHub issue URLs</description>
|
|
94
|
+
<condition>If first argument matches GitHub issue URL pattern</condition>
|
|
95
|
+
<url_detection>Check if argument contains "github.com" and "/issues/"</url_detection>
|
|
96
|
+
<url_parsing>
|
|
97
|
+
<pattern>https://github.com/{owner}/{repo}/issues/{issue_number}</pattern>
|
|
98
|
+
<extract>owner, repo, issue_number from URL</extract>
|
|
99
|
+
</url_parsing>
|
|
100
|
+
<fetch_issue_details>
|
|
101
|
+
<tool>mcp__github__issue_read</tool>
|
|
102
|
+
<method>get</method>
|
|
103
|
+
<parameters>owner, repo, issue_number</parameters>
|
|
104
|
+
</fetch_issue_details>
|
|
105
|
+
<generate_branch_name>
|
|
106
|
+
<determine_type>Analyze issue title/labels to determine type (feat/fix/refactor/chore)</determine_type>
|
|
107
|
+
<format>{type}/{repo}-{issue_number}-{kebab-case-title}</format>
|
|
108
|
+
<kebab_case>Convert title to lowercase, replace spaces/special chars with hyphens</kebab_case>
|
|
109
|
+
<sanitization>
|
|
110
|
+
<rule>Always use lowercase for branch names</rule>
|
|
111
|
+
<rule>Replace # with - (hash symbol not allowed in git branch names)</rule>
|
|
112
|
+
<rule>Remove or replace other special characters: @, $, %, ^, &, *, (, ), [, ], {, }, \, |, ;, :, ", ', <, >, ?, /, ~, `</rule>
|
|
113
|
+
<rule>Replace multiple consecutive hyphens with single hyphen</rule>
|
|
114
|
+
<rule>Trim leading/trailing hyphens</rule>
|
|
115
|
+
</sanitization>
|
|
116
|
+
<truncate>Limit total branch name to reasonable length (~60 chars)</truncate>
|
|
117
|
+
</generate_branch_name>
|
|
118
|
+
<user_confirmation>
|
|
119
|
+
<display>Show generated branch name and ask for confirmation</display>
|
|
120
|
+
<options>"Yes, proceed" or "No, exit" or "Edit branch name"</options>
|
|
121
|
+
<if_no>Exit command gracefully</if_no>
|
|
122
|
+
<if_edit>Allow user to modify the branch name</if_edit>
|
|
123
|
+
<if_yes>Continue with generated/modified branch name</if_yes>
|
|
124
|
+
</user_confirmation>
|
|
125
|
+
<examples>
|
|
126
|
+
<input>https://github.com/owner/project/issues/456</input>
|
|
127
|
+
<title>"Fix duplicate items in list view"</title>
|
|
128
|
+
<generated>fix/issue-456-duplicate-items-in-list-view</generated>
|
|
129
|
+
</examples>
|
|
130
|
+
</step_1_5>
|
|
131
|
+
|
|
132
|
+
<step_3>
|
|
133
|
+
<description>Add all files and stash uncommitted changes if any exist</description>
|
|
134
|
+
<condition>If output is not empty (has uncommitted changes)</condition>
|
|
135
|
+
<command>git add -A && git stash push -m "Worktree switch: Moving changes to ${branch_name}"</chained_command>
|
|
136
|
+
<purpose>Preserve work in progress before switching worktrees</purpose>
|
|
137
|
+
<note>Remember stash was created for later restoration</note>
|
|
138
|
+
</step_3>
|
|
139
|
+
|
|
140
|
+
<step_4>
|
|
141
|
+
<description>Determine worktree parent directory</description>
|
|
142
|
+
<check_if_in_worktree>git rev-parse --is-inside-work-tree && git worktree list --porcelain | grep "$(git rev-parse --show-toplevel)"</check_if_in_worktree>
|
|
143
|
+
<set_parent_path>
|
|
144
|
+
<if_main_worktree>Set parent_path=".."</if_main_worktree>
|
|
145
|
+
<if_secondary_worktree>Set parent_path="../.." (need to go up two levels)</if_secondary_worktree>
|
|
146
|
+
</set_parent_path>
|
|
147
|
+
<purpose>Correctly determine where to create new worktree regardless of current location</purpose>
|
|
148
|
+
<note>This handles both main worktree and secondary worktree scenarios</note>
|
|
149
|
+
</step_4>
|
|
150
|
+
|
|
151
|
+
<step_5>
|
|
152
|
+
<description>Fetch latest changes from remote</description>
|
|
153
|
+
<command>git fetch origin</command>
|
|
154
|
+
<purpose>Ensure we have the latest remote branches and main branch state</purpose>
|
|
155
|
+
<note>This ensures new worktrees are created from the most recent main branch</note>
|
|
156
|
+
</step_6>
|
|
157
|
+
|
|
158
|
+
<step_7>
|
|
159
|
+
<description>Check if branch exists on remote</description>
|
|
160
|
+
<command>git branch -r | grep "origin/${branch_name}"</command>
|
|
161
|
+
<decision>
|
|
162
|
+
<if_exists>Branch exists on remote - will checkout existing branch</if_exists>
|
|
163
|
+
<if_not_exists>Branch does not exist - will create new branch from base</if_not_exists>
|
|
164
|
+
</decision>
|
|
165
|
+
</step_5>
|
|
166
|
+
|
|
167
|
+
<step_6>
|
|
168
|
+
<description>Create the worktree</description>
|
|
169
|
+
<option_a_new_branch>
|
|
170
|
+
<condition>Remote branch does NOT exist</condition>
|
|
171
|
+
<command>git worktree add ${parent_path}/${branch_name} -b ${branch_name} ${base_branch}</command>
|
|
172
|
+
<example>git worktree add ../fix/issue-123-main-content-area-visually-clipped -b fix/issue-123-main-content-area-visually-clipped main</example>
|
|
173
|
+
</option_a_new_branch>
|
|
174
|
+
<option_b_existing_branch>
|
|
175
|
+
<condition>Remote branch EXISTS</condition>
|
|
176
|
+
<command>git worktree add ${parent_path}/${branch_name} ${branch_name}</command>
|
|
177
|
+
<example>git worktree add ../fix/issue-123-main-content-area-visually-clipped fix/issue-123-main-content-area-visually-clipped</example>
|
|
178
|
+
</option_b_existing_branch>
|
|
179
|
+
</step_7>
|
|
180
|
+
|
|
181
|
+
<step_8>
|
|
182
|
+
<description>Copy Claude settings to new worktree</description>
|
|
183
|
+
<source>.claude/settings.local.json</source>
|
|
184
|
+
<destination>${parent_path}/${branch_name}/.claude/settings.local.json</destination>
|
|
185
|
+
<command>cp -r .claude/settings.local.json ${parent_path}/${branch_name}/.claude/settings.local.json</command>
|
|
186
|
+
<purpose>Preserve all permission settings and configurations</purpose>
|
|
187
|
+
</step_8>
|
|
188
|
+
|
|
189
|
+
<step_9>
|
|
190
|
+
<description>Copy .env.local files to new worktree</description>
|
|
191
|
+
<search_command>find . -name ".env.local" -type f</search_command>
|
|
192
|
+
<copy_logic>For each .env.local file found, copy to corresponding location in new worktree</copy_logic>
|
|
193
|
+
<common_locations>
|
|
194
|
+
- app/.env.local
|
|
195
|
+
- packages/*/.env.local
|
|
196
|
+
- (any other .env.local files found)
|
|
197
|
+
</common_locations>
|
|
198
|
+
<copy_command>find . -name ".env.local" -type f -exec sh -c 'mkdir -p "$(dirname "${parent_path}/${branch_name}/$1")" && cp "$1" "${parent_path}/${branch_name}/$1"' _{} \;</copy_command>
|
|
199
|
+
<purpose>Preserve local environment configurations for development</purpose>
|
|
200
|
+
<note>Only copies files that exist; ignores missing ones</note>
|
|
201
|
+
</step_9>
|
|
202
|
+
|
|
203
|
+
<step_10>
|
|
204
|
+
<description>Create IDE-specific configuration (conditional)</description>
|
|
205
|
+
<condition>Only if supports_tasks is true (VS Code variants)</condition>
|
|
206
|
+
<vs_code_tasks>
|
|
207
|
+
<create_directory>mkdir -p ${parent_path}/${branch_name}/.vscode</create_directory>
|
|
208
|
+
<create_file_command>cat > ${parent_path}/${branch_name}/.vscode/tasks.json << 'EOF'
|
|
209
|
+
{
|
|
210
|
+
"version": "2.0.0",
|
|
211
|
+
"tasks": [
|
|
212
|
+
{
|
|
213
|
+
"label": "Auto start Claude",
|
|
214
|
+
"type": "shell",
|
|
215
|
+
"command": "claude",
|
|
216
|
+
"runOptions": {
|
|
217
|
+
"runOn": "folderOpen"
|
|
218
|
+
},
|
|
219
|
+
"presentation": {
|
|
220
|
+
"echo": false,
|
|
221
|
+
"reveal": "always",
|
|
222
|
+
"focus": true,
|
|
223
|
+
"panel": "new"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
EOF</create_file_command>
|
|
229
|
+
</vs_code_tasks>
|
|
230
|
+
<purpose>Create auto-start Claude task for VS Code variants on folder open</purpose>
|
|
231
|
+
<note>Only creates for VS Code variants (code, code-insiders, cursor)</note>
|
|
232
|
+
<skip_message>Skipping IDE-specific config for non-VS Code IDEs</skip_message>
|
|
233
|
+
</step_10>
|
|
234
|
+
|
|
235
|
+
<step_11>
|
|
236
|
+
<description>Install dependencies in new worktree</description>
|
|
237
|
+
<working_directory>${parent_path}/${branch_name}</working_directory>
|
|
238
|
+
<command>cd ${parent_path}/${branch_name} && pnpm install</command>
|
|
239
|
+
<purpose>Ensure all node_modules are installed for the new worktree</purpose>
|
|
240
|
+
</step_11>
|
|
241
|
+
|
|
242
|
+
<step_12>
|
|
243
|
+
<description>Apply stashed changes to new worktree (if stash was created)</description>
|
|
244
|
+
<condition>Only if stash was created in step_3</condition>
|
|
245
|
+
<working_directory>${parent_path}/${branch_name}</working_directory>
|
|
246
|
+
<command>cd ${parent_path}/${branch_name} && git stash pop</command>
|
|
247
|
+
<purpose>Restore uncommitted work-in-progress to the new worktree branch</purpose>
|
|
248
|
+
<note>This moves your uncommitted changes to the new branch where you'll continue working</note>
|
|
249
|
+
</step_12>
|
|
250
|
+
|
|
251
|
+
<step_13>
|
|
252
|
+
<description>Open detected IDE in new worktree</description>
|
|
253
|
+
<command>${ide_command} ${parent_path}/${branch_name}</command>
|
|
254
|
+
<ide_specific_behavior>
|
|
255
|
+
<vs_code_variants>Opens folder in VS Code/Insiders/Cursor with tasks.json auto-starting Claude</vs_code_variants>
|
|
256
|
+
<zed>Opens folder in Zed editor</zed>
|
|
257
|
+
<other>Uses detected IDE command to open folder</other>
|
|
258
|
+
</ide_specific_behavior>
|
|
259
|
+
<purpose>Launch development environment for the new worktree using detected IDE</purpose>
|
|
260
|
+
<confirmation_message>Opening worktree in ${ide_name}</confirmation_message>
|
|
261
|
+
</step_11>
|
|
262
|
+
</execution_steps>
|
|
263
|
+
|
|
264
|
+
<important_notes>
|
|
265
|
+
|
|
266
|
+
- Automatically detects and uses your current IDE (VS Code, VS Code Insiders, Cursor, Zed, etc.)
|
|
267
|
+
- Creates VS Code-specific tasks.json only for VS Code variants (auto-starts Claude on folder open)
|
|
268
|
+
- Branch names with slashes (feat/, fix/, etc.) are fully supported
|
|
269
|
+
- The worktree directory path will match the full branch name including slashes
|
|
270
|
+
- Settings are copied to maintain the same permissions across worktrees
|
|
271
|
+
- Environment files (.env.local) are copied to preserve local configurations
|
|
272
|
+
- Each worktree has its own node_modules installation
|
|
273
|
+
- Uncommitted changes are automatically stashed and moved to the new worktree
|
|
274
|
+
- Your work-in-progress seamlessly transfers to the new branch
|
|
275
|
+
- IDE detection fallback: checks available editors and uses priority order
|
|
276
|
+
</important_notes>
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
## 🛡 Project Rules (Injected into every command)
|
|
280
|
+
|
|
281
|
+
1. **NO BROKEN BUILDS:**
|
|
282
|
+
- Run `pnpm test` before every `/commit`
|
|
283
|
+
- Ensure all tests pass
|
|
284
|
+
- Fix any type errors immediately
|
|
285
|
+
|
|
286
|
+
2. **API DEVELOPMENT:**
|
|
287
|
+
- All new APIs MUST have Zod request/response schemas
|
|
288
|
+
- All APIs MUST be documented in both:
|
|
289
|
+
- OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
|
|
290
|
+
- API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
|
|
291
|
+
- Test ALL parameters and edge cases
|
|
292
|
+
- Include code examples and real-world outputs
|
|
293
|
+
|
|
294
|
+
3. **TDD WORKFLOW:**
|
|
295
|
+
- ALWAYS use /red → /green → /refactor cycle
|
|
296
|
+
- NEVER write implementation without failing test first
|
|
297
|
+
- Use /cycle for feature development
|
|
298
|
+
- Use characterization tests for refactoring
|
|
299
|
+
|
|
300
|
+
4. **API KEY MANAGEMENT:**
|
|
301
|
+
- Support three loading methods:
|
|
302
|
+
- Server environment variables
|
|
303
|
+
- NEXT_PUBLIC_ variables (client-side)
|
|
304
|
+
- Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
|
|
305
|
+
- Never hardcode API keys
|
|
306
|
+
- Always validate key availability before use
|
|
307
|
+
|
|
308
|
+
5. **COMPREHENSIVE TESTING:**
|
|
309
|
+
- When researching APIs, read actual implementation code
|
|
310
|
+
- Discover ALL possible parameters (not just documented ones)
|
|
311
|
+
- Test with various parameter combinations
|
|
312
|
+
- Document custom headers, query params, request/response schemas
|
|
313
|
+
- Include validation rules and testing notes
|
|
314
|
+
|
|
315
|
+
6. **NO UI BLOAT:**
|
|
316
|
+
- This is an API project with minimal frontend
|
|
317
|
+
- Only keep necessary test/documentation interfaces
|
|
318
|
+
- Delete unused components immediately
|
|
319
|
+
- No unnecessary UI libraries or features
|
|
320
|
+
|
|
321
|
+
7. **DOCUMENTATION:**
|
|
322
|
+
- If you change an API, you MUST update:
|
|
323
|
+
- OpenAPI spec
|
|
324
|
+
- api-tests-manifest.json
|
|
325
|
+
- Code examples
|
|
326
|
+
- Testing notes
|
|
327
|
+
- Document expected behavior and edge cases
|
|
328
|
+
- Include real-world output examples
|