@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.
Files changed (139) hide show
  1. package/.claude/agents/code-reviewer.md +170 -0
  2. package/.claude/agents/docs-generator.md +80 -0
  3. package/.claude/agents/implementation-reviewer.md +119 -0
  4. package/.claude/agents/parallel-researcher.md +52 -0
  5. package/.claude/agents/research-validator.md +116 -0
  6. package/.claude/agents/schema-generator.md +70 -0
  7. package/.claude/agents/test-writer.md +104 -0
  8. package/.claude/api-dev-state.json +305 -56
  9. package/.claude/commands/README.md +21 -10
  10. package/.claude/commands/add-command.md +8 -5
  11. package/.claude/commands/api-create.md +36 -25
  12. package/.claude/commands/api-env.md +1 -0
  13. package/.claude/commands/api-interview.md +32 -19
  14. package/.claude/commands/api-research.md +47 -21
  15. package/.claude/commands/api-status.md +21 -1
  16. package/.claude/commands/api-verify.md +14 -13
  17. package/.claude/commands/beepboop.md +4 -5
  18. package/.claude/commands/busycommit.md +2 -3
  19. package/.claude/commands/commit.md +2 -3
  20. package/.claude/commands/cycle.md +2 -7
  21. package/.claude/commands/gap.md +2 -3
  22. package/.claude/commands/green.md +2 -7
  23. package/.claude/commands/issue.md +3 -8
  24. package/.claude/commands/ntfy-setup.md +91 -0
  25. package/.claude/commands/ntfy-test.md +74 -0
  26. package/.claude/commands/plan.md +2 -3
  27. package/.claude/commands/pr.md +2 -3
  28. package/.claude/commands/publish.md +40 -0
  29. package/.claude/commands/red.md +2 -7
  30. package/.claude/commands/refactor.md +2 -7
  31. package/.claude/commands/spike.md +2 -7
  32. package/.claude/commands/summarize.md +2 -3
  33. package/.claude/commands/tdd.md +2 -7
  34. package/.claude/commands/worktree-add.md +208 -216
  35. package/.claude/commands/worktree-cleanup.md +172 -178
  36. package/.claude/settings.json +63 -12
  37. package/.claude/settings.local.json +2 -1
  38. package/.claude-plugin/marketplace.json +2 -11
  39. package/.skills/README.md +55 -53
  40. package/.skills/_shared/settings.json +1 -1
  41. package/.skills/add-command/SKILL.md +10 -5
  42. package/.skills/api-create/SKILL.md +146 -35
  43. package/.skills/api-env/SKILL.md +1 -0
  44. package/.skills/api-interview/SKILL.md +32 -19
  45. package/.skills/api-research/SKILL.md +47 -21
  46. package/.skills/api-status/SKILL.md +21 -1
  47. package/.skills/api-verify/SKILL.md +14 -13
  48. package/.skills/beepboop/SKILL.md +6 -5
  49. package/.skills/busycommit/SKILL.md +4 -3
  50. package/.skills/commit/SKILL.md +4 -3
  51. package/.skills/cycle/SKILL.md +4 -7
  52. package/.skills/gap/SKILL.md +4 -3
  53. package/.skills/green/SKILL.md +4 -7
  54. package/.skills/issue/SKILL.md +5 -8
  55. package/.skills/plan/SKILL.md +4 -3
  56. package/.skills/pr/SKILL.md +4 -3
  57. package/.skills/publish/SKILL.md +160 -0
  58. package/.skills/red/SKILL.md +4 -7
  59. package/.skills/refactor/SKILL.md +4 -7
  60. package/.skills/spike/SKILL.md +4 -7
  61. package/.skills/summarize/SKILL.md +4 -3
  62. package/.skills/tdd/SKILL.md +4 -7
  63. package/.skills/update-todos/SKILL.md +22 -0
  64. package/.skills/worktree-add/SKILL.md +210 -216
  65. package/.skills/worktree-cleanup/SKILL.md +183 -187
  66. package/CHANGELOG.md +97 -79
  67. package/README.md +161 -7142
  68. package/bin/cli.js +448 -805
  69. package/commands/README.md +66 -31
  70. package/commands/add-command.md +8 -5
  71. package/commands/beepboop.md +4 -5
  72. package/commands/busycommit.md +2 -3
  73. package/commands/commit.md +2 -3
  74. package/commands/cycle.md +2 -7
  75. package/commands/gap.md +2 -3
  76. package/commands/green.md +2 -7
  77. package/commands/hustle-api-continue.md +8 -5
  78. package/commands/hustle-api-create.md +70 -29
  79. package/commands/hustle-api-env.md +1 -0
  80. package/commands/hustle-api-interview.md +32 -19
  81. package/commands/hustle-api-research.md +47 -21
  82. package/commands/hustle-api-sessions.md +8 -7
  83. package/commands/hustle-api-status.md +21 -1
  84. package/commands/hustle-api-verify.md +14 -13
  85. package/commands/hustle-combine.md +488 -241
  86. package/commands/hustle-ui-create-page.md +113 -50
  87. package/commands/hustle-ui-create.md +179 -26
  88. package/commands/issue.md +3 -8
  89. package/commands/plan.md +2 -3
  90. package/commands/pr.md +2 -3
  91. package/commands/red.md +2 -7
  92. package/commands/refactor.md +2 -7
  93. package/commands/spike.md +2 -7
  94. package/commands/summarize.md +2 -3
  95. package/commands/tdd.md +2 -7
  96. package/commands/worktree-add.md +208 -216
  97. package/commands/worktree-cleanup.md +172 -178
  98. package/hooks/api-workflow-check.py +5 -3
  99. package/hooks/enforce-component-type-confirm.py +97 -0
  100. package/hooks/lib/__init__.py +1 -0
  101. package/hooks/lib/greptile.py +355 -0
  102. package/hooks/lib/ntfy.py +209 -0
  103. package/hooks/notify-input-needed.py +73 -0
  104. package/hooks/notify-phase-complete.py +90 -0
  105. package/hooks/run-code-review.py +246 -0
  106. package/hooks/track-token-usage.py +121 -0
  107. package/package.json +13 -3
  108. package/scripts/collect-test-results.ts +102 -77
  109. package/scripts/extract-parameters.ts +112 -70
  110. package/scripts/generate-test-manifest.ts +118 -77
  111. package/templates/.env.example +57 -0
  112. package/templates/BRAND_GUIDE.md +92 -52
  113. package/templates/CLAUDE-SECTION.md +40 -37
  114. package/templates/SPEC.json +186 -38
  115. package/templates/api-dev-state.json +33 -4
  116. package/templates/api-showcase/_components/APICard.tsx +22 -18
  117. package/templates/api-showcase/_components/APIModal.tsx +110 -64
  118. package/templates/api-showcase/_components/APIShowcase.tsx +53 -35
  119. package/templates/api-showcase/_components/APITester.tsx +128 -67
  120. package/templates/api-showcase/page.tsx +4 -4
  121. package/templates/api-test/page.tsx +51 -30
  122. package/templates/api-test/test-structure/route.ts +43 -34
  123. package/templates/component/Component.stories.tsx +41 -39
  124. package/templates/component/Component.test.tsx +96 -78
  125. package/templates/component/Component.tsx +63 -52
  126. package/templates/component/Component.types.ts +10 -6
  127. package/templates/component/Component.visual.spec.ts +170 -0
  128. package/templates/component/index.ts +2 -2
  129. package/templates/dev-tools/_components/DevToolsLanding.tsx +8 -8
  130. package/templates/dev-tools/page.tsx +4 -3
  131. package/templates/mcp-servers.json +30 -2
  132. package/templates/page/page.e2e.test.ts +56 -48
  133. package/templates/page/page.tsx +3 -3
  134. package/templates/shared/HeroHeader.tsx +16 -15
  135. package/templates/shared/index.ts +1 -1
  136. package/templates/ui-showcase/_components/PreviewCard.tsx +20 -20
  137. package/templates/ui-showcase/_components/PreviewModal.tsx +149 -108
  138. package/templates/ui-showcase/_components/UIShowcase.tsx +43 -35
  139. 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
- - NEXT_PUBLIC_ variables (client-side)
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/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
- - NEXT_PUBLIC_ variables (client-side)
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
- <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>
32
- - Try listing available MCP resources
33
- - If GitHub MCP not found, switch to CLI fallback
34
- - Inform user about MCP configuration if needed
35
- </validation>
36
- </check_github_mcp>
37
- <error_handling>
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
- <step_1>
47
- <description>Detect current IDE environment</description>
48
- <detection_methods>
49
- <method_1>
50
- <tool>mcp__ide__getDiagnostics</tool>
51
- <vs_code_insiders>Check for paths containing "Code - Insiders"</vs_code_insiders>
52
- <vs_code>Check for paths containing "Code/" or "Code.app"</vs_code>
53
- <cursor>Check for paths containing "Cursor"</cursor>
54
- <zed>Check for paths containing "Zed"</zed>
55
- </method_1>
56
- <method_2>
57
- <fallback_detection>Use which command to find available IDEs</fallback_detection>
58
- <commands>which code-insiders code zed cursor</commands>
59
- <priority_order>code-insiders > cursor > zed > code</priority_order>
60
- </method_2>
61
- </detection_methods>
62
- <set_variables>
63
- <ide_command>Detected command (code-insiders|code|zed|cursor)</ide_command>
64
- <ide_name>Human-readable name</ide_name>
65
- <supports_tasks>true for VS Code variants, false for others</supports_tasks>
66
- </set_variables>
67
- <purpose>Automatically detect which IDE to use for opening the new worktree</purpose>
68
- </step_1>
69
-
70
- <step_2>
71
- <description>Parse the arguments</description>
72
- <input>The user-provided arguments</input>
73
- <expected_format>branch-name-or-github-url [optional-base-branch]</expected_format>
74
- <example>fix/issue-123-main-content-area-visually-clipped main</example>
75
- <example_github_url><https://github.com/owner/project/issues/123> main</example_github_url>
76
- <default_base_branch>main (if not specified)</default_base_branch>
77
- </step_1>
78
-
79
- <step_2_5>
80
- <description>Handle GitHub issue URLs</description>
81
- <condition>If first argument matches GitHub issue URL pattern</condition>
82
- <url_detection>Check if argument contains "github.com" and "/issues/"</url_detection>
83
- <url_parsing>
84
- <pattern>https://github.com/{owner}/{repo}/issues/{issue_number}</pattern>
85
- <extract>owner, repo, issue_number from URL</extract>
86
- </url_parsing>
87
- <fetch_issue_details>
88
- <tool>mcp__github__issue_read</tool>
89
- <method>get</method>
90
- <parameters>owner, repo, issue_number</parameters>
91
- </fetch_issue_details>
92
- <generate_branch_name>
93
- <determine_type>Analyze issue title/labels to determine type (feat/fix/refactor/chore)</determine_type>
94
- <format>{type}/{repo}-{issue_number}-{kebab-case-title}</format>
95
- <kebab_case>Convert title to lowercase, replace spaces/special chars with hyphens</kebab_case>
96
- <sanitization>
97
- <rule>Always use lowercase for branch names</rule>
98
- <rule>Replace # with - (hash symbol not allowed in git branch names)</rule>
99
- <rule>Remove or replace other special characters: @, $, %, ^, &, *, (, ), [, ], {, }, \, |, ;, :, ", ', <, >, ?, /, ~, `</rule>
100
- <rule>Replace multiple consecutive hyphens with single hyphen</rule>
101
- <rule>Trim leading/trailing hyphens</rule>
102
- </sanitization>
103
- <truncate>Limit total branch name to reasonable length (~60 chars)</truncate>
104
- </generate_branch_name>
105
- <user_confirmation>
106
- <display>Show generated branch name and ask for confirmation</display>
107
- <options>"Yes, proceed" or "No, exit" or "Edit branch name"</options>
108
- <if_no>Exit command gracefully</if_no>
109
- <if_edit>Allow user to modify the branch name</if_edit>
110
- <if_yes>Continue with generated/modified branch name</if_yes>
111
- </user_confirmation>
112
- <examples>
113
- <input>https://github.com/owner/project/issues/456</input>
114
- <title>"Fix duplicate items in list view"</title>
115
- <generated>fix/issue-456-duplicate-items-in-list-view</generated>
116
- </examples>
117
- </step_1_5>
118
-
119
- <step_3>
120
- <description>Add all files and stash uncommitted changes if any exist</description>
121
- <condition>If output is not empty (has uncommitted changes)</condition>
122
- <command>git add -A && git stash push -m "Worktree switch: Moving changes to ${branch_name}"</chained_command>
123
- <purpose>Preserve work in progress before switching worktrees</purpose>
124
- <note>Remember stash was created for later restoration</note>
125
- </step_3>
126
-
127
- <step_4>
128
- <description>Determine worktree parent directory</description>
129
- <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>
130
- <set_parent_path>
131
- <if_main_worktree>Set parent_path=".."</if_main_worktree>
132
- <if_secondary_worktree>Set parent_path="../.." (need to go up two levels)</if_secondary_worktree>
133
- </set_parent_path>
134
- <purpose>Correctly determine where to create new worktree regardless of current location</purpose>
135
- <note>This handles both main worktree and secondary worktree scenarios</note>
136
- </step_4>
137
-
138
- <step_5>
139
- <description>Fetch latest changes from remote</description>
140
- <command>git fetch origin</command>
141
- <purpose>Ensure we have the latest remote branches and main branch state</purpose>
142
- <note>This ensures new worktrees are created from the most recent main branch</note>
143
- </step_6>
144
-
145
- <step_7>
146
- <description>Check if branch exists on remote</description>
147
- <command>git branch -r | grep "origin/${branch_name}"</command>
148
- <decision>
149
- <if_exists>Branch exists on remote - will checkout existing branch</if_exists>
150
- <if_not_exists>Branch does not exist - will create new branch from base</if_not_exists>
151
- </decision>
152
- </step_5>
153
-
154
- <step_6>
155
- <description>Create the worktree</description>
156
- <option_a_new_branch>
157
- <condition>Remote branch does NOT exist</condition>
158
- <command>git worktree add ${parent_path}/${branch_name} -b ${branch_name} ${base_branch}</command>
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
- <example>git worktree add ../fix/issue-123-main-content-area-visually-clipped fix/issue-123-main-content-area-visually-clipped</example>
165
- </option_b_existing_branch>
166
- </step_7>
167
-
168
- <step_8>
169
- <description>Copy Claude settings to new worktree</description>
170
- <source>.claude/settings.local.json</source>
171
- <destination>${parent_path}/${branch_name}/.claude/settings.local.json</destination>
172
- <command>cp -r .claude/settings.local.json ${parent_path}/${branch_name}/.claude/settings.local.json</command>
173
- <purpose>Preserve all permission settings and configurations</purpose>
174
- </step_8>
175
-
176
- <step_9>
177
- <description>Copy .env.local files to new worktree</description>
178
- <search_command>find . -name ".env.local" -type f</search_command>
179
- <copy_logic>For each .env.local file found, copy to corresponding location in new worktree</copy_logic>
180
- <common_locations>
181
- - app/.env.local
182
- - packages/*/.env.local
183
- - (any other .env.local files found)
184
- </common_locations>
185
- <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>
186
- <purpose>Preserve local environment configurations for development</purpose>
187
- <note>Only copies files that exist; ignores missing ones</note>
188
- </step_9>
189
-
190
- <step_10>
191
- <description>Create IDE-specific configuration (conditional)</description>
192
- <condition>Only if supports_tasks is true (VS Code variants)</condition>
193
- <vs_code_tasks>
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
- "version": "2.0.0",
198
- "tasks": [
199
- {
200
- "label": "Auto start Claude",
201
- "type": "shell",
202
- "command": "claude",
203
- "runOptions": {
204
- "runOn": "folderOpen"
205
- },
206
- "presentation": {
207
- "echo": false,
208
- "reveal": "always",
209
- "focus": true,
210
- "panel": "new"
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
- </vs_code_tasks>
217
- <purpose>Create auto-start Claude task for VS Code variants on folder open</purpose>
218
- <note>Only creates for VS Code variants (code, code-insiders, cursor)</note>
219
- <skip_message>Skipping IDE-specific config for non-VS Code IDEs</skip_message>
220
- </step_10>
221
-
222
- <step_11>
223
- <description>Install dependencies in new worktree</description>
224
- <working_directory>${parent_path}/${branch_name}</working_directory>
225
- <command>cd ${parent_path}/${branch_name} && pnpm install</command>
226
- <purpose>Ensure all node_modules are installed for the new worktree</purpose>
227
- </step_11>
228
-
229
- <step_12>
230
- <description>Apply stashed changes to new worktree (if stash was created)</description>
231
- <condition>Only if stash was created in step_3</condition>
232
- <working_directory>${parent_path}/${branch_name}</working_directory>
233
- <command>cd ${parent_path}/${branch_name} && git stash pop</command>
234
- <purpose>Restore uncommitted work-in-progress to the new worktree branch</purpose>
235
- <note>This moves your uncommitted changes to the new branch where you'll continue working</note>
236
- </step_12>
237
-
238
- <step_13>
239
- <description>Open detected IDE in new worktree</description>
240
- <command>${ide_command} ${parent_path}/${branch_name}</command>
241
- <ide_specific_behavior>
242
- <vs_code_variants>Opens folder in VS Code/Insiders/Cursor with tasks.json auto-starting Claude</vs_code_variants>
243
- <zed>Opens folder in Zed editor</zed>
244
- <other>Uses detected IDE command to open folder</other>
245
- </ide_specific_behavior>
246
- <purpose>Launch development environment for the new worktree using detected IDE</purpose>
247
- <confirmation_message>Opening worktree in ${ide_name}</confirmation_message>
248
- </step_11>
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
- - NEXT_PUBLIC_ variables (client-side)
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