@hustle-together/api-dev-tools 3.11.1 → 3.12.2
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/agents/code-reviewer.md +170 -0
- package/.claude/agents/docs-generator.md +80 -0
- package/.claude/agents/implementation-reviewer.md +119 -0
- package/.claude/agents/parallel-researcher.md +52 -0
- package/.claude/agents/research-validator.md +116 -0
- package/.claude/agents/schema-generator.md +70 -0
- package/.claude/agents/test-writer.md +104 -0
- package/.claude/api-dev-state.json +305 -56
- package/.claude/commands/README.md +21 -10
- package/.claude/commands/add-command.md +8 -5
- package/.claude/commands/api-create.md +36 -25
- package/.claude/commands/api-env.md +1 -0
- package/.claude/commands/api-interview.md +32 -19
- package/.claude/commands/api-research.md +47 -21
- package/.claude/commands/api-status.md +21 -1
- package/.claude/commands/api-verify.md +14 -13
- package/.claude/commands/beepboop.md +4 -5
- package/.claude/commands/busycommit.md +2 -3
- package/.claude/commands/commit.md +2 -3
- package/.claude/commands/cycle.md +2 -7
- package/.claude/commands/gap.md +2 -3
- package/.claude/commands/green.md +2 -7
- package/.claude/commands/issue.md +3 -8
- package/.claude/commands/ntfy-setup.md +91 -0
- package/.claude/commands/ntfy-test.md +74 -0
- package/.claude/commands/plan.md +2 -3
- package/.claude/commands/pr.md +2 -3
- package/.claude/commands/publish.md +40 -0
- package/.claude/commands/red.md +2 -7
- package/.claude/commands/refactor.md +2 -7
- package/.claude/commands/spike.md +2 -7
- package/.claude/commands/summarize.md +2 -3
- package/.claude/commands/tdd.md +2 -7
- package/.claude/commands/worktree-add.md +208 -216
- package/.claude/commands/worktree-cleanup.md +172 -178
- package/.claude/settings.json +63 -12
- package/.claude/settings.local.json +2 -1
- package/.claude-plugin/marketplace.json +2 -11
- package/.skills/README.md +55 -53
- package/.skills/_shared/settings.json +1 -1
- package/.skills/add-command/SKILL.md +10 -5
- package/.skills/api-create/SKILL.md +146 -35
- package/.skills/api-env/SKILL.md +1 -0
- package/.skills/api-interview/SKILL.md +32 -19
- package/.skills/api-research/SKILL.md +47 -21
- package/.skills/api-status/SKILL.md +21 -1
- package/.skills/api-verify/SKILL.md +14 -13
- package/.skills/beepboop/SKILL.md +6 -5
- package/.skills/busycommit/SKILL.md +4 -3
- package/.skills/commit/SKILL.md +4 -3
- package/.skills/cycle/SKILL.md +4 -7
- package/.skills/gap/SKILL.md +4 -3
- package/.skills/green/SKILL.md +4 -7
- package/.skills/issue/SKILL.md +5 -8
- package/.skills/plan/SKILL.md +4 -3
- package/.skills/pr/SKILL.md +4 -3
- package/.skills/publish/SKILL.md +160 -0
- package/.skills/red/SKILL.md +4 -7
- package/.skills/refactor/SKILL.md +4 -7
- package/.skills/spike/SKILL.md +4 -7
- package/.skills/summarize/SKILL.md +4 -3
- package/.skills/tdd/SKILL.md +4 -7
- package/.skills/update-todos/SKILL.md +22 -0
- package/.skills/worktree-add/SKILL.md +210 -216
- package/.skills/worktree-cleanup/SKILL.md +183 -187
- package/CHANGELOG.md +97 -79
- package/README.md +161 -7142
- package/bin/cli.js +448 -805
- package/commands/README.md +66 -31
- package/commands/add-command.md +8 -5
- package/commands/beepboop.md +4 -5
- package/commands/busycommit.md +2 -3
- package/commands/commit.md +2 -3
- package/commands/cycle.md +2 -7
- package/commands/gap.md +2 -3
- package/commands/green.md +2 -7
- package/commands/hustle-api-continue.md +8 -5
- package/commands/hustle-api-create.md +70 -29
- package/commands/hustle-api-env.md +1 -0
- package/commands/hustle-api-interview.md +32 -19
- package/commands/hustle-api-research.md +47 -21
- package/commands/hustle-api-sessions.md +8 -7
- package/commands/hustle-api-status.md +21 -1
- package/commands/hustle-api-verify.md +14 -13
- package/commands/hustle-combine.md +488 -241
- package/commands/hustle-ui-create-page.md +113 -50
- package/commands/hustle-ui-create.md +179 -26
- package/commands/issue.md +3 -8
- package/commands/plan.md +2 -3
- package/commands/pr.md +2 -3
- package/commands/red.md +2 -7
- package/commands/refactor.md +2 -7
- package/commands/spike.md +2 -7
- package/commands/summarize.md +2 -3
- package/commands/tdd.md +2 -7
- package/commands/worktree-add.md +208 -216
- package/commands/worktree-cleanup.md +172 -178
- package/hooks/api-workflow-check.py +5 -3
- package/hooks/enforce-component-type-confirm.py +97 -0
- package/hooks/lib/__init__.py +1 -0
- package/hooks/lib/greptile.py +355 -0
- package/hooks/lib/ntfy.py +209 -0
- package/hooks/notify-input-needed.py +73 -0
- package/hooks/notify-phase-complete.py +90 -0
- package/hooks/run-code-review.py +246 -0
- package/hooks/track-token-usage.py +121 -0
- package/package.json +13 -3
- package/scripts/collect-test-results.ts +102 -77
- package/scripts/extract-parameters.ts +112 -70
- package/scripts/generate-test-manifest.ts +118 -77
- package/templates/.env.example +57 -0
- package/templates/BRAND_GUIDE.md +92 -52
- package/templates/CLAUDE-SECTION.md +40 -37
- package/templates/SPEC.json +186 -38
- package/templates/api-dev-state.json +33 -4
- package/templates/api-showcase/_components/APICard.tsx +22 -18
- package/templates/api-showcase/_components/APIModal.tsx +110 -64
- package/templates/api-showcase/_components/APIShowcase.tsx +53 -35
- package/templates/api-showcase/_components/APITester.tsx +128 -67
- package/templates/api-showcase/page.tsx +4 -4
- package/templates/api-test/page.tsx +51 -30
- package/templates/api-test/test-structure/route.ts +43 -34
- package/templates/component/Component.stories.tsx +41 -39
- package/templates/component/Component.test.tsx +96 -78
- package/templates/component/Component.tsx +63 -52
- package/templates/component/Component.types.ts +10 -6
- package/templates/component/Component.visual.spec.ts +170 -0
- package/templates/component/index.ts +2 -2
- package/templates/dev-tools/_components/DevToolsLanding.tsx +8 -8
- package/templates/dev-tools/page.tsx +4 -3
- package/templates/mcp-servers.json +30 -2
- package/templates/page/page.e2e.test.ts +56 -48
- package/templates/page/page.tsx +3 -3
- package/templates/shared/HeroHeader.tsx +16 -15
- package/templates/shared/index.ts +1 -1
- package/templates/ui-showcase/_components/PreviewCard.tsx +20 -20
- package/templates/ui-showcase/_components/PreviewModal.tsx +149 -108
- package/templates/ui-showcase/_components/UIShowcase.tsx +43 -35
- package/templates/ui-showcase/page.tsx +4 -4
|
@@ -41,7 +41,6 @@ Provide a summary with these sections:
|
|
|
41
41
|
|
|
42
42
|
Keep the summary concise and actionable - suitable for pasting into a new conversation to quickly restore context without needing the full conversation history.
|
|
43
43
|
|
|
44
|
-
|
|
45
44
|
## 🛡 Project Rules (Injected into every command)
|
|
46
45
|
|
|
47
46
|
1. **NO BROKEN BUILDS:**
|
|
@@ -66,7 +65,7 @@ Keep the summary concise and actionable - suitable for pasting into a new conver
|
|
|
66
65
|
4. **API KEY MANAGEMENT:**
|
|
67
66
|
- Support three loading methods:
|
|
68
67
|
- Server environment variables
|
|
69
|
-
-
|
|
68
|
+
- NEXT*PUBLIC* variables (client-side)
|
|
70
69
|
- Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
|
|
71
70
|
- Never hardcode API keys
|
|
72
71
|
- Always validate key availability before use
|
|
@@ -91,4 +90,4 @@ Keep the summary concise and actionable - suitable for pasting into a new conver
|
|
|
91
90
|
- Code examples
|
|
92
91
|
- Testing notes
|
|
93
92
|
- Document expected behavior and edge cases
|
|
94
|
-
- Include real-world output examples
|
|
93
|
+
- Include real-world output examples
|
package/.claude/commands/tdd.md
CHANGED
|
@@ -20,7 +20,6 @@ argument-hint: [optional-response-to-last-message]
|
|
|
20
20
|
The foundation of TDD is the Red-Green-Refactor cycle:
|
|
21
21
|
|
|
22
22
|
1. **Red Phase**: Write ONE failing test that describes desired behavior
|
|
23
|
-
|
|
24
23
|
- The test must fail for the RIGHT reason (not syntax/import errors)
|
|
25
24
|
- Only one test at a time - this is critical for TDD discipline
|
|
26
25
|
- Exception: For browser-level tests or expensive setup (e.g., Storybook `*.stories.tsx`), group multiple assertions within a single test block to avoid redundant setup - but only when adding assertions to an existing interaction flow. If new user interactions are required, still create a new test. Split files by category if they exceed ~1000 lines.
|
|
@@ -30,7 +29,6 @@ The foundation of TDD is the Red-Green-Refactor cycle:
|
|
|
30
29
|
- Avoid hard-coded timeouts both in form of sleep() or timeout: 5000 etc; use proper async patterns (`waitFor`, `findBy*`, event-based sync) instead and rely on global test configs for timeout settings
|
|
31
30
|
|
|
32
31
|
2. **Green Phase**: Write MINIMAL code to make the test pass
|
|
33
|
-
|
|
34
32
|
- Implement only what's needed for the current failing test
|
|
35
33
|
- No anticipatory coding or extra features
|
|
36
34
|
- Address the specific failure message
|
|
@@ -44,12 +42,10 @@ The foundation of TDD is the Red-Green-Refactor cycle:
|
|
|
44
42
|
### Core Violations
|
|
45
43
|
|
|
46
44
|
1. **Multiple Test Addition**
|
|
47
|
-
|
|
48
45
|
- Adding more than one new test at once
|
|
49
46
|
- Exception: Initial test file setup or extracting shared test utilities
|
|
50
47
|
|
|
51
48
|
2. **Over-Implementation**
|
|
52
|
-
|
|
53
49
|
- Code that exceeds what's needed to pass the current failing test
|
|
54
50
|
- Adding untested features, methods, or error handling
|
|
55
51
|
- Implementing multiple methods when test only requires one
|
|
@@ -91,7 +87,6 @@ User response to the last message: $ARGUMENTS
|
|
|
91
87
|
|
|
92
88
|
Please continue with TDD approach based on the above response.
|
|
93
89
|
|
|
94
|
-
|
|
95
90
|
## 🛡 Project Rules (Injected into every command)
|
|
96
91
|
|
|
97
92
|
1. **NO BROKEN BUILDS:**
|
|
@@ -116,7 +111,7 @@ Please continue with TDD approach based on the above response.
|
|
|
116
111
|
4. **API KEY MANAGEMENT:**
|
|
117
112
|
- Support three loading methods:
|
|
118
113
|
- Server environment variables
|
|
119
|
-
-
|
|
114
|
+
- NEXT*PUBLIC* variables (client-side)
|
|
120
115
|
- Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
|
|
121
116
|
- Never hardcode API keys
|
|
122
117
|
- Always validate key availability before use
|
|
@@ -141,4 +136,4 @@ Please continue with TDD approach based on the above response.
|
|
|
141
136
|
- Code examples
|
|
142
137
|
- Testing notes
|
|
143
138
|
- Document expected behavior and edge cases
|
|
144
|
-
- Include real-world output examples
|
|
139
|
+
- Include real-world output examples
|
|
@@ -24,228 +24,221 @@ Uncommitted changes: !git status --short`
|
|
|
24
24
|
|
|
25
25
|
<execution_steps>
|
|
26
26
|
<step_0>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
If MCP validation fails:
|
|
39
|
-
- Show clear error message
|
|
40
|
-
- Provide setup instructions
|
|
41
|
-
- Fallback to CLI if possible
|
|
42
|
-
</error_handling>
|
|
43
|
-
<purpose>Ensure required MCP dependencies are available before proceeding</purpose>
|
|
27
|
+
<description>Validate MCP dependencies</description>
|
|
28
|
+
<check_github_mcp>
|
|
29
|
+
<requirement>GitHub MCP server must be configured</requirement>
|
|
30
|
+
<fallback>If unavailable, use `gh` CLI commands</fallback>
|
|
31
|
+
<validation> - Try listing available MCP resources - If GitHub MCP not found, switch to CLI fallback - Inform user about MCP configuration if needed
|
|
32
|
+
</validation>
|
|
33
|
+
</check_github_mcp>
|
|
34
|
+
<error_handling>
|
|
35
|
+
If MCP validation fails: - Show clear error message - Provide setup instructions - Fallback to CLI if possible
|
|
36
|
+
</error_handling>
|
|
37
|
+
<purpose>Ensure required MCP dependencies are available before proceeding</purpose>
|
|
44
38
|
</step_0>
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
40
|
+
<step_1>
|
|
41
|
+
<description>Detect current IDE environment</description>
|
|
42
|
+
<detection_methods>
|
|
43
|
+
<method_1>
|
|
44
|
+
<tool>mcp**ide**getDiagnostics</tool>
|
|
45
|
+
<vs_code_insiders>Check for paths containing "Code - Insiders"</vs_code_insiders>
|
|
46
|
+
<vs_code>Check for paths containing "Code/" or "Code.app"</vs_code>
|
|
47
|
+
<cursor>Check for paths containing "Cursor"</cursor>
|
|
48
|
+
<zed>Check for paths containing "Zed"</zed>
|
|
49
|
+
</method_1>
|
|
50
|
+
<method_2>
|
|
51
|
+
<fallback_detection>Use which command to find available IDEs</fallback_detection>
|
|
52
|
+
<commands>which code-insiders code zed cursor</commands>
|
|
53
|
+
<priority_order>code-insiders > cursor > zed > code</priority_order>
|
|
54
|
+
</method_2>
|
|
55
|
+
</detection_methods>
|
|
56
|
+
<set_variables>
|
|
57
|
+
<ide_command>Detected command (code-insiders|code|zed|cursor)</ide_command>
|
|
58
|
+
<ide_name>Human-readable name</ide_name>
|
|
59
|
+
<supports_tasks>true for VS Code variants, false for others</supports_tasks>
|
|
60
|
+
</set_variables>
|
|
61
|
+
<purpose>Automatically detect which IDE to use for opening the new worktree</purpose>
|
|
62
|
+
</step_1>
|
|
63
|
+
|
|
64
|
+
<step_2>
|
|
65
|
+
<description>Parse the arguments</description>
|
|
66
|
+
<input>The user-provided arguments</input>
|
|
67
|
+
<expected_format>branch-name-or-github-url [optional-base-branch]</expected_format>
|
|
68
|
+
<example>fix/issue-123-main-content-area-visually-clipped main</example>
|
|
69
|
+
<example_github_url><https://github.com/owner/project/issues/123> main</example_github_url>
|
|
70
|
+
<default_base_branch>main (if not specified)</default_base_branch>
|
|
71
|
+
</step_1>
|
|
72
|
+
|
|
73
|
+
<step_2_5>
|
|
74
|
+
<description>Handle GitHub issue URLs</description>
|
|
75
|
+
<condition>If first argument matches GitHub issue URL pattern</condition>
|
|
76
|
+
<url_detection>Check if argument contains "github.com" and "/issues/"</url_detection>
|
|
77
|
+
<url_parsing>
|
|
78
|
+
<pattern>https://github.com/{owner}/{repo}/issues/{issue_number}</pattern>
|
|
79
|
+
<extract>owner, repo, issue_number from URL</extract>
|
|
80
|
+
</url_parsing>
|
|
81
|
+
<fetch_issue_details>
|
|
82
|
+
<tool>mcp**github**issue_read</tool>
|
|
83
|
+
<method>get</method>
|
|
84
|
+
<parameters>owner, repo, issue_number</parameters>
|
|
85
|
+
</fetch_issue_details>
|
|
86
|
+
<generate_branch_name>
|
|
87
|
+
<determine_type>Analyze issue title/labels to determine type (feat/fix/refactor/chore)</determine_type>
|
|
88
|
+
<format>{type}/{repo}-{issue_number}-{kebab-case-title}</format>
|
|
89
|
+
<kebab_case>Convert title to lowercase, replace spaces/special chars with hyphens</kebab_case>
|
|
90
|
+
<sanitization>
|
|
91
|
+
<rule>Always use lowercase for branch names</rule>
|
|
92
|
+
<rule>Replace # with - (hash symbol not allowed in git branch names)</rule>
|
|
93
|
+
<rule>Remove or replace other special characters: @, $, %, ^, &, \*, (, ), [, ], {, }, \, |, ;, :, ", ', <, >, ?, /, ~, `</rule>
|
|
94
|
+
<rule>Replace multiple consecutive hyphens with single hyphen</rule>
|
|
95
|
+
<rule>Trim leading/trailing hyphens</rule>
|
|
96
|
+
</sanitization>
|
|
97
|
+
<truncate>Limit total branch name to reasonable length (~60 chars)</truncate>
|
|
98
|
+
</generate_branch_name>
|
|
99
|
+
<user_confirmation>
|
|
100
|
+
<display>Show generated branch name and ask for confirmation</display>
|
|
101
|
+
<options>"Yes, proceed" or "No, exit" or "Edit branch name"</options>
|
|
102
|
+
<if_no>Exit command gracefully</if_no>
|
|
103
|
+
<if_edit>Allow user to modify the branch name</if_edit>
|
|
104
|
+
<if_yes>Continue with generated/modified branch name</if_yes>
|
|
105
|
+
</user_confirmation>
|
|
106
|
+
<examples>
|
|
107
|
+
<input>https://github.com/owner/project/issues/456</input>
|
|
108
|
+
|
|
109
|
+
<title>"Fix duplicate items in list view"</title>
|
|
110
|
+
<generated>fix/issue-456-duplicate-items-in-list-view</generated>
|
|
111
|
+
</examples>
|
|
112
|
+
</step_1_5>
|
|
113
|
+
|
|
114
|
+
<step_3>
|
|
115
|
+
<description>Add all files and stash uncommitted changes if any exist</description>
|
|
116
|
+
<condition>If output is not empty (has uncommitted changes)</condition>
|
|
117
|
+
<command>git add -A && git stash push -m "Worktree switch: Moving changes to ${branch_name}"</chained_command>
|
|
118
|
+
<purpose>Preserve work in progress before switching worktrees</purpose>
|
|
119
|
+
<note>Remember stash was created for later restoration</note>
|
|
120
|
+
</step_3>
|
|
121
|
+
|
|
122
|
+
<step_4>
|
|
123
|
+
<description>Determine worktree parent directory</description>
|
|
124
|
+
<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>
|
|
125
|
+
<set_parent_path>
|
|
126
|
+
<if_main_worktree>Set parent_path=".."</if_main_worktree>
|
|
127
|
+
<if_secondary_worktree>Set parent_path="../.." (need to go up two levels)</if_secondary_worktree>
|
|
128
|
+
</set_parent_path>
|
|
129
|
+
<purpose>Correctly determine where to create new worktree regardless of current location</purpose>
|
|
130
|
+
<note>This handles both main worktree and secondary worktree scenarios</note>
|
|
131
|
+
</step_4>
|
|
132
|
+
|
|
133
|
+
<step_5>
|
|
134
|
+
<description>Fetch latest changes from remote</description>
|
|
135
|
+
<command>git fetch origin</command>
|
|
136
|
+
<purpose>Ensure we have the latest remote branches and main branch state</purpose>
|
|
137
|
+
<note>This ensures new worktrees are created from the most recent main branch</note>
|
|
138
|
+
</step_6>
|
|
139
|
+
|
|
140
|
+
<step_7>
|
|
141
|
+
<description>Check if branch exists on remote</description>
|
|
142
|
+
<command>git branch -r | grep "origin/${branch_name}"</command>
|
|
143
|
+
<decision>
|
|
144
|
+
<if_exists>Branch exists on remote - will checkout existing branch</if_exists>
|
|
145
|
+
<if_not_exists>Branch does not exist - will create new branch from base</if_not_exists>
|
|
146
|
+
</decision>
|
|
147
|
+
</step_5>
|
|
148
|
+
|
|
149
|
+
<step_6>
|
|
150
|
+
<description>Create the worktree</description>
|
|
151
|
+
<option_a_new_branch>
|
|
152
|
+
<condition>Remote branch does NOT exist</condition>
|
|
153
|
+
<command>git worktree add ${parent_path}/${branch_name} -b ${branch_name} ${base_branch}</command>
|
|
159
154
|
<example>git worktree add ../fix/issue-123-main-content-area-visually-clipped -b fix/issue-123-main-content-area-visually-clipped main</example>
|
|
160
155
|
</option_a_new_branch>
|
|
161
156
|
<option_b_existing_branch>
|
|
162
157
|
<condition>Remote branch EXISTS</condition>
|
|
163
158
|
<command>git worktree add ${parent_path}/${branch_name} ${branch_name}</command>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
<create_directory>mkdir -p ${parent_path}/${branch_name}/.vscode</create_directory>
|
|
195
|
-
<create_file_command>cat > ${parent_path}/${branch_name}/.vscode/tasks.json << 'EOF'
|
|
159
|
+
<example>git worktree add ../fix/issue-123-main-content-area-visually-clipped fix/issue-123-main-content-area-visually-clipped</example>
|
|
160
|
+
</option_b_existing_branch>
|
|
161
|
+
</step_7>
|
|
162
|
+
|
|
163
|
+
<step_8>
|
|
164
|
+
<description>Copy Claude settings to new worktree</description>
|
|
165
|
+
|
|
166
|
+
<source>.claude/settings.local.json</source>
|
|
167
|
+
<destination>${parent_path}/${branch_name}/.claude/settings.local.json</destination>
|
|
168
|
+
<command>cp -r .claude/settings.local.json ${parent_path}/${branch_name}/.claude/settings.local.json</command>
|
|
169
|
+
<purpose>Preserve all permission settings and configurations</purpose>
|
|
170
|
+
</step_8>
|
|
171
|
+
|
|
172
|
+
<step*9>
|
|
173
|
+
<description>Copy .env.local files to new worktree</description>
|
|
174
|
+
<search_command>find . -name ".env.local" -type f</search_command>
|
|
175
|
+
<copy_logic>For each .env.local file found, copy to corresponding location in new worktree</copy_logic>
|
|
176
|
+
<common_locations> - app/.env.local - packages/\*/.env.local - (any other .env.local files found)
|
|
177
|
+
</common_locations>
|
|
178
|
+
<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>
|
|
179
|
+
<purpose>Preserve local environment configurations for development</purpose>
|
|
180
|
+
<note>Only copies files that exist; ignores missing ones</note>
|
|
181
|
+
</step_9>
|
|
182
|
+
|
|
183
|
+
<step_10>
|
|
184
|
+
<description>Create IDE-specific configuration (conditional)</description>
|
|
185
|
+
<condition>Only if supports_tasks is true (VS Code variants)</condition>
|
|
186
|
+
<vs_code_tasks>
|
|
187
|
+
<create_directory>mkdir -p ${parent_path}/${branch_name}/.vscode</create_directory>
|
|
188
|
+
<create_file_command>cat > ${parent_path}/${branch_name}/.vscode/tasks.json << 'EOF'
|
|
196
189
|
{
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
190
|
+
"version": "2.0.0",
|
|
191
|
+
"tasks": [
|
|
192
|
+
{
|
|
193
|
+
"label": "Auto start Claude",
|
|
194
|
+
"type": "shell",
|
|
195
|
+
"command": "claude",
|
|
196
|
+
"runOptions": {
|
|
197
|
+
"runOn": "folderOpen"
|
|
198
|
+
},
|
|
199
|
+
"presentation": {
|
|
200
|
+
"echo": false,
|
|
201
|
+
"reveal": "always",
|
|
202
|
+
"focus": true,
|
|
203
|
+
"panel": "new"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
]
|
|
214
207
|
}
|
|
215
208
|
EOF</create_file_command>
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
209
|
+
</vs_code_tasks>
|
|
210
|
+
<purpose>Create auto-start Claude task for VS Code variants on folder open</purpose>
|
|
211
|
+
<note>Only creates for VS Code variants (code, code-insiders, cursor)</note>
|
|
212
|
+
<skip_message>Skipping IDE-specific config for non-VS Code IDEs</skip_message>
|
|
213
|
+
</step_10>
|
|
214
|
+
|
|
215
|
+
<step_11>
|
|
216
|
+
<description>Install dependencies in new worktree</description>
|
|
217
|
+
<working_directory>${parent_path}/${branch_name}</working_directory>
|
|
218
|
+
<command>cd ${parent_path}/${branch_name} && pnpm install</command>
|
|
219
|
+
<purpose>Ensure all node_modules are installed for the new worktree</purpose>
|
|
220
|
+
</step_11>
|
|
221
|
+
|
|
222
|
+
<step_12>
|
|
223
|
+
<description>Apply stashed changes to new worktree (if stash was created)</description>
|
|
224
|
+
<condition>Only if stash was created in step_3</condition>
|
|
225
|
+
<working_directory>${parent_path}/${branch_name}</working_directory>
|
|
226
|
+
<command>cd ${parent_path}/${branch_name} && git stash pop</command>
|
|
227
|
+
<purpose>Restore uncommitted work-in-progress to the new worktree branch</purpose>
|
|
228
|
+
<note>This moves your uncommitted changes to the new branch where you'll continue working</note>
|
|
229
|
+
</step_12>
|
|
230
|
+
|
|
231
|
+
<step_13>
|
|
232
|
+
<description>Open detected IDE in new worktree</description>
|
|
233
|
+
<command>${ide_command} ${parent_path}/${branch_name}</command>
|
|
234
|
+
<ide_specific_behavior>
|
|
235
|
+
<vs_code_variants>Opens folder in VS Code/Insiders/Cursor with tasks.json auto-starting Claude</vs_code_variants>
|
|
236
|
+
<zed>Opens folder in Zed editor</zed>
|
|
237
|
+
<other>Uses detected IDE command to open folder</other>
|
|
238
|
+
</ide_specific_behavior>
|
|
239
|
+
<purpose>Launch development environment for the new worktree using detected IDE</purpose>
|
|
240
|
+
<confirmation_message>Opening worktree in ${ide_name}</confirmation_message>
|
|
241
|
+
</step_11>
|
|
249
242
|
</execution_steps>
|
|
250
243
|
|
|
251
244
|
<important_notes>
|
|
@@ -260,8 +253,7 @@ EOF</create_file_command>
|
|
|
260
253
|
- Uncommitted changes are automatically stashed and moved to the new worktree
|
|
261
254
|
- Your work-in-progress seamlessly transfers to the new branch
|
|
262
255
|
- IDE detection fallback: checks available editors and uses priority order
|
|
263
|
-
</important_notes>
|
|
264
|
-
|
|
256
|
+
</important_notes>
|
|
265
257
|
|
|
266
258
|
## 🛡 Project Rules (Injected into every command)
|
|
267
259
|
|
|
@@ -287,7 +279,7 @@ EOF</create_file_command>
|
|
|
287
279
|
4. **API KEY MANAGEMENT:**
|
|
288
280
|
- Support three loading methods:
|
|
289
281
|
- Server environment variables
|
|
290
|
-
-
|
|
282
|
+
- NEXT*PUBLIC* variables (client-side)
|
|
291
283
|
- Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
|
|
292
284
|
- Never hardcode API keys
|
|
293
285
|
- Always validate key availability before use
|
|
@@ -312,4 +304,4 @@ EOF</create_file_command>
|
|
|
312
304
|
- Code examples
|
|
313
305
|
- Testing notes
|
|
314
306
|
- Document expected behavior and edge cases
|
|
315
|
-
- Include real-world output examples
|
|
307
|
+
- Include real-world output examples
|