hub-launch 1.0.3

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 (331) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/README.md +195 -0
  3. package/bin/hublaunch +20 -0
  4. package/dist/commands/checkout.d.ts +7 -0
  5. package/dist/commands/checkout.d.ts.map +1 -0
  6. package/dist/commands/checkout.js +164 -0
  7. package/dist/commands/checkout.js.map +1 -0
  8. package/dist/commands/clean.d.ts +7 -0
  9. package/dist/commands/clean.d.ts.map +1 -0
  10. package/dist/commands/clean.js +206 -0
  11. package/dist/commands/clean.js.map +1 -0
  12. package/dist/commands/close.d.ts +7 -0
  13. package/dist/commands/close.d.ts.map +1 -0
  14. package/dist/commands/close.js +109 -0
  15. package/dist/commands/close.js.map +1 -0
  16. package/dist/commands/create.d.ts +7 -0
  17. package/dist/commands/create.d.ts.map +1 -0
  18. package/dist/commands/create.js +367 -0
  19. package/dist/commands/create.js.map +1 -0
  20. package/dist/commands/diff.d.ts +7 -0
  21. package/dist/commands/diff.d.ts.map +1 -0
  22. package/dist/commands/diff.js +98 -0
  23. package/dist/commands/diff.js.map +1 -0
  24. package/dist/commands/execute.d.ts +7 -0
  25. package/dist/commands/execute.d.ts.map +1 -0
  26. package/dist/commands/execute.js +376 -0
  27. package/dist/commands/execute.js.map +1 -0
  28. package/dist/commands/init.d.ts +8 -0
  29. package/dist/commands/init.d.ts.map +1 -0
  30. package/dist/commands/init.js +1243 -0
  31. package/dist/commands/init.js.map +1 -0
  32. package/dist/commands/interactive.d.ts +12 -0
  33. package/dist/commands/interactive.d.ts.map +1 -0
  34. package/dist/commands/interactive.js +1071 -0
  35. package/dist/commands/interactive.js.map +1 -0
  36. package/dist/commands/launch.d.ts +16 -0
  37. package/dist/commands/launch.d.ts.map +1 -0
  38. package/dist/commands/launch.js +684 -0
  39. package/dist/commands/launch.js.map +1 -0
  40. package/dist/commands/login.d.ts +40 -0
  41. package/dist/commands/login.d.ts.map +1 -0
  42. package/dist/commands/login.js +469 -0
  43. package/dist/commands/login.js.map +1 -0
  44. package/dist/commands/logs.d.ts +22 -0
  45. package/dist/commands/logs.d.ts.map +1 -0
  46. package/dist/commands/logs.js +105 -0
  47. package/dist/commands/logs.js.map +1 -0
  48. package/dist/commands/merge.d.ts +7 -0
  49. package/dist/commands/merge.d.ts.map +1 -0
  50. package/dist/commands/merge.js +240 -0
  51. package/dist/commands/merge.js.map +1 -0
  52. package/dist/commands/preview.d.ts +7 -0
  53. package/dist/commands/preview.d.ts.map +1 -0
  54. package/dist/commands/preview.js +160 -0
  55. package/dist/commands/preview.js.map +1 -0
  56. package/dist/commands/project.d.ts +18 -0
  57. package/dist/commands/project.d.ts.map +1 -0
  58. package/dist/commands/project.js +352 -0
  59. package/dist/commands/project.js.map +1 -0
  60. package/dist/commands/respond.d.ts +7 -0
  61. package/dist/commands/respond.d.ts.map +1 -0
  62. package/dist/commands/respond.js +112 -0
  63. package/dist/commands/respond.js.map +1 -0
  64. package/dist/commands/setPriority.d.ts +7 -0
  65. package/dist/commands/setPriority.d.ts.map +1 -0
  66. package/dist/commands/setPriority.js +112 -0
  67. package/dist/commands/setPriority.js.map +1 -0
  68. package/dist/commands/track.d.ts +7 -0
  69. package/dist/commands/track.d.ts.map +1 -0
  70. package/dist/commands/track.js +140 -0
  71. package/dist/commands/track.js.map +1 -0
  72. package/dist/commands/upload.d.ts +21 -0
  73. package/dist/commands/upload.d.ts.map +1 -0
  74. package/dist/commands/upload.js +145 -0
  75. package/dist/commands/upload.js.map +1 -0
  76. package/dist/commands/view.d.ts +7 -0
  77. package/dist/commands/view.d.ts.map +1 -0
  78. package/dist/commands/view.js +168 -0
  79. package/dist/commands/view.js.map +1 -0
  80. package/dist/commands/watch.d.ts +7 -0
  81. package/dist/commands/watch.d.ts.map +1 -0
  82. package/dist/commands/watch.js +438 -0
  83. package/dist/commands/watch.js.map +1 -0
  84. package/dist/commands/worktree.d.ts +7 -0
  85. package/dist/commands/worktree.d.ts.map +1 -0
  86. package/dist/commands/worktree.js +122 -0
  87. package/dist/commands/worktree.js.map +1 -0
  88. package/dist/config/command-names.d.ts +16 -0
  89. package/dist/config/command-names.d.ts.map +1 -0
  90. package/dist/config/command-names.js +17 -0
  91. package/dist/config/command-names.js.map +1 -0
  92. package/dist/config/constants.d.ts +12 -0
  93. package/dist/config/constants.d.ts.map +1 -0
  94. package/dist/config/constants.js +12 -0
  95. package/dist/config/constants.js.map +1 -0
  96. package/dist/config/index.d.ts +47 -0
  97. package/dist/config/index.d.ts.map +1 -0
  98. package/dist/config/index.js +175 -0
  99. package/dist/config/index.js.map +1 -0
  100. package/dist/index.d.ts +3 -0
  101. package/dist/index.d.ts.map +1 -0
  102. package/dist/index.js +148 -0
  103. package/dist/index.js.map +1 -0
  104. package/dist/services/api/HulaApiClient.d.ts +170 -0
  105. package/dist/services/api/HulaApiClient.d.ts.map +1 -0
  106. package/dist/services/api/HulaApiClient.js +233 -0
  107. package/dist/services/api/HulaApiClient.js.map +1 -0
  108. package/dist/services/diff/DiffService.d.ts +44 -0
  109. package/dist/services/diff/DiffService.d.ts.map +1 -0
  110. package/dist/services/diff/DiffService.js +126 -0
  111. package/dist/services/diff/DiffService.js.map +1 -0
  112. package/dist/services/editor/EditorService.d.ts +53 -0
  113. package/dist/services/editor/EditorService.d.ts.map +1 -0
  114. package/dist/services/editor/EditorService.js +161 -0
  115. package/dist/services/editor/EditorService.js.map +1 -0
  116. package/dist/services/git/GitService.d.ts +124 -0
  117. package/dist/services/git/GitService.d.ts.map +1 -0
  118. package/dist/services/git/GitService.js +423 -0
  119. package/dist/services/git/GitService.js.map +1 -0
  120. package/dist/services/git/WorktreeService.d.ts +144 -0
  121. package/dist/services/git/WorktreeService.d.ts.map +1 -0
  122. package/dist/services/git/WorktreeService.js +505 -0
  123. package/dist/services/git/WorktreeService.js.map +1 -0
  124. package/dist/services/github/ActionsService.d.ts +66 -0
  125. package/dist/services/github/ActionsService.d.ts.map +1 -0
  126. package/dist/services/github/ActionsService.js +114 -0
  127. package/dist/services/github/ActionsService.js.map +1 -0
  128. package/dist/services/github/AssetUploadService.d.ts +103 -0
  129. package/dist/services/github/AssetUploadService.d.ts.map +1 -0
  130. package/dist/services/github/AssetUploadService.js +299 -0
  131. package/dist/services/github/AssetUploadService.js.map +1 -0
  132. package/dist/services/github/BatchCopilotDetectionService.d.ts +58 -0
  133. package/dist/services/github/BatchCopilotDetectionService.d.ts.map +1 -0
  134. package/dist/services/github/BatchCopilotDetectionService.js +321 -0
  135. package/dist/services/github/BatchCopilotDetectionService.js.map +1 -0
  136. package/dist/services/github/CopilotDetectionService.d.ts +40 -0
  137. package/dist/services/github/CopilotDetectionService.d.ts.map +1 -0
  138. package/dist/services/github/CopilotDetectionService.js +280 -0
  139. package/dist/services/github/CopilotDetectionService.js.map +1 -0
  140. package/dist/services/github/CopilotService.d.ts +27 -0
  141. package/dist/services/github/CopilotService.d.ts.map +1 -0
  142. package/dist/services/github/CopilotService.js +249 -0
  143. package/dist/services/github/CopilotService.js.map +1 -0
  144. package/dist/services/github/DeploymentDetectionService.d.ts +38 -0
  145. package/dist/services/github/DeploymentDetectionService.d.ts.map +1 -0
  146. package/dist/services/github/DeploymentDetectionService.js +104 -0
  147. package/dist/services/github/DeploymentDetectionService.js.map +1 -0
  148. package/dist/services/github/GithubAppService.d.ts +40 -0
  149. package/dist/services/github/GithubAppService.d.ts.map +1 -0
  150. package/dist/services/github/GithubAppService.js +187 -0
  151. package/dist/services/github/GithubAppService.js.map +1 -0
  152. package/dist/services/github/IssueService.d.ts +65 -0
  153. package/dist/services/github/IssueService.d.ts.map +1 -0
  154. package/dist/services/github/IssueService.js +231 -0
  155. package/dist/services/github/IssueService.js.map +1 -0
  156. package/dist/services/github/LabelService.d.ts +36 -0
  157. package/dist/services/github/LabelService.d.ts.map +1 -0
  158. package/dist/services/github/LabelService.js +122 -0
  159. package/dist/services/github/LabelService.js.map +1 -0
  160. package/dist/services/github/PRService.d.ts +77 -0
  161. package/dist/services/github/PRService.d.ts.map +1 -0
  162. package/dist/services/github/PRService.js +287 -0
  163. package/dist/services/github/PRService.js.map +1 -0
  164. package/dist/services/github/ProjectService.d.ts +144 -0
  165. package/dist/services/github/ProjectService.d.ts.map +1 -0
  166. package/dist/services/github/ProjectService.js +804 -0
  167. package/dist/services/github/ProjectService.js.map +1 -0
  168. package/dist/services/hooks/HookExecutor.d.ts +66 -0
  169. package/dist/services/hooks/HookExecutor.d.ts.map +1 -0
  170. package/dist/services/hooks/HookExecutor.js +227 -0
  171. package/dist/services/hooks/HookExecutor.js.map +1 -0
  172. package/dist/services/hooks/index.d.ts +2 -0
  173. package/dist/services/hooks/index.d.ts.map +1 -0
  174. package/dist/services/hooks/index.js +2 -0
  175. package/dist/services/hooks/index.js.map +1 -0
  176. package/dist/services/logs/LogFormatterService.d.ts +17 -0
  177. package/dist/services/logs/LogFormatterService.d.ts.map +1 -0
  178. package/dist/services/logs/LogFormatterService.js +35 -0
  179. package/dist/services/logs/LogFormatterService.js.map +1 -0
  180. package/dist/services/logs/TempFileService.d.ts +27 -0
  181. package/dist/services/logs/TempFileService.d.ts.map +1 -0
  182. package/dist/services/logs/TempFileService.js +90 -0
  183. package/dist/services/logs/TempFileService.js.map +1 -0
  184. package/dist/services/logs/index.d.ts +3 -0
  185. package/dist/services/logs/index.d.ts.map +1 -0
  186. package/dist/services/logs/index.js +4 -0
  187. package/dist/services/logs/index.js.map +1 -0
  188. package/dist/services/plan/PlanService.d.ts +70 -0
  189. package/dist/services/plan/PlanService.d.ts.map +1 -0
  190. package/dist/services/plan/PlanService.js +211 -0
  191. package/dist/services/plan/PlanService.js.map +1 -0
  192. package/dist/services/polling/GitHubDirectPollingAdapter.d.ts +16 -0
  193. package/dist/services/polling/GitHubDirectPollingAdapter.d.ts.map +1 -0
  194. package/dist/services/polling/GitHubDirectPollingAdapter.js +87 -0
  195. package/dist/services/polling/GitHubDirectPollingAdapter.js.map +1 -0
  196. package/dist/services/polling/HulaServerPollingAdapter.d.ts +23 -0
  197. package/dist/services/polling/HulaServerPollingAdapter.d.ts.map +1 -0
  198. package/dist/services/polling/HulaServerPollingAdapter.js +78 -0
  199. package/dist/services/polling/HulaServerPollingAdapter.js.map +1 -0
  200. package/dist/services/polling/IStatusPollingAdapter.d.ts +29 -0
  201. package/dist/services/polling/IStatusPollingAdapter.d.ts.map +1 -0
  202. package/dist/services/polling/IStatusPollingAdapter.js +2 -0
  203. package/dist/services/polling/IStatusPollingAdapter.js.map +1 -0
  204. package/dist/services/polling/StatusPollingAdapterFactory.d.ts +14 -0
  205. package/dist/services/polling/StatusPollingAdapterFactory.d.ts.map +1 -0
  206. package/dist/services/polling/StatusPollingAdapterFactory.js +41 -0
  207. package/dist/services/polling/StatusPollingAdapterFactory.js.map +1 -0
  208. package/dist/services/polling/index.d.ts +5 -0
  209. package/dist/services/polling/index.d.ts.map +1 -0
  210. package/dist/services/polling/index.js +5 -0
  211. package/dist/services/polling/index.js.map +1 -0
  212. package/dist/services/preview/PreviewService.d.ts +86 -0
  213. package/dist/services/preview/PreviewService.d.ts.map +1 -0
  214. package/dist/services/preview/PreviewService.js +439 -0
  215. package/dist/services/preview/PreviewService.js.map +1 -0
  216. package/dist/services/tracking/ProjectTrackingAdapter.d.ts +41 -0
  217. package/dist/services/tracking/ProjectTrackingAdapter.d.ts.map +1 -0
  218. package/dist/services/tracking/ProjectTrackingAdapter.js +230 -0
  219. package/dist/services/tracking/ProjectTrackingAdapter.js.map +1 -0
  220. package/dist/services/tracking/RemoteTrackingAdapter.d.ts +62 -0
  221. package/dist/services/tracking/RemoteTrackingAdapter.d.ts.map +1 -0
  222. package/dist/services/tracking/RemoteTrackingAdapter.js +242 -0
  223. package/dist/services/tracking/RemoteTrackingAdapter.js.map +1 -0
  224. package/dist/services/tracking/TrackingAdapterFactory.d.ts +25 -0
  225. package/dist/services/tracking/TrackingAdapterFactory.d.ts.map +1 -0
  226. package/dist/services/tracking/TrackingAdapterFactory.js +55 -0
  227. package/dist/services/tracking/TrackingAdapterFactory.js.map +1 -0
  228. package/dist/services/tracking/TrackingService.d.ts +104 -0
  229. package/dist/services/tracking/TrackingService.d.ts.map +1 -0
  230. package/dist/services/tracking/TrackingService.js +256 -0
  231. package/dist/services/tracking/TrackingService.js.map +1 -0
  232. package/dist/services/tracking/UntrackedIssuesService.d.ts +20 -0
  233. package/dist/services/tracking/UntrackedIssuesService.d.ts.map +1 -0
  234. package/dist/services/tracking/UntrackedIssuesService.js +148 -0
  235. package/dist/services/tracking/UntrackedIssuesService.js.map +1 -0
  236. package/dist/services/tracking/local-file-migration.d.ts +16 -0
  237. package/dist/services/tracking/local-file-migration.d.ts.map +1 -0
  238. package/dist/services/tracking/local-file-migration.js +86 -0
  239. package/dist/services/tracking/local-file-migration.js.map +1 -0
  240. package/dist/templates/planning-instructions.md +752 -0
  241. package/dist/templates/proceed-instructions.md +453 -0
  242. package/dist/templates/scripts/hula-fix-commit.sh +110 -0
  243. package/dist/templates/scripts/hula-fix-setup.sh +145 -0
  244. package/dist/templates/scripts/hula-launch-run.sh +89 -0
  245. package/dist/templates/scripts/hula-merge-local.sh +138 -0
  246. package/dist/templates/scripts/hula-merge-remote.sh +74 -0
  247. package/dist/templates/scripts/hula-read-config.sh +38 -0
  248. package/dist/templates/scripts/hula-verify-gather.sh +135 -0
  249. package/dist/templates/scripts/hula-verify-post.sh +84 -0
  250. package/dist/templates/skills/hula-confirm/SKILL.md +361 -0
  251. package/dist/templates/skills/hula-create/SKILL.md +211 -0
  252. package/dist/templates/skills/hula-fix/SKILL.md +224 -0
  253. package/dist/templates/skills/hula-launch/SKILL.md +159 -0
  254. package/dist/templates/skills/hula-log/SKILL.md +105 -0
  255. package/dist/templates/skills/hula-merge/SKILL.md +387 -0
  256. package/dist/templates/skills/hula-plan/SKILL.md +148 -0
  257. package/dist/templates/skills/hula-upload/SKILL.md +115 -0
  258. package/dist/templates/skills/hula-verify/SKILL.md +754 -0
  259. package/dist/types/common.schema.d.ts +46 -0
  260. package/dist/types/common.schema.d.ts.map +1 -0
  261. package/dist/types/common.schema.js +60 -0
  262. package/dist/types/common.schema.js.map +1 -0
  263. package/dist/types/config.schema.d.ts +443 -0
  264. package/dist/types/config.schema.d.ts.map +1 -0
  265. package/dist/types/config.schema.js +126 -0
  266. package/dist/types/config.schema.js.map +1 -0
  267. package/dist/types/index.d.ts +6 -0
  268. package/dist/types/index.d.ts.map +1 -0
  269. package/dist/types/index.js +7 -0
  270. package/dist/types/index.js.map +1 -0
  271. package/dist/types/issue.schema.d.ts +136 -0
  272. package/dist/types/issue.schema.d.ts.map +1 -0
  273. package/dist/types/issue.schema.js +49 -0
  274. package/dist/types/issue.schema.js.map +1 -0
  275. package/dist/types/pr.schema.d.ts +118 -0
  276. package/dist/types/pr.schema.d.ts.map +1 -0
  277. package/dist/types/pr.schema.js +40 -0
  278. package/dist/types/pr.schema.js.map +1 -0
  279. package/dist/types/tracking.schema.d.ts +340 -0
  280. package/dist/types/tracking.schema.d.ts.map +1 -0
  281. package/dist/types/tracking.schema.js +56 -0
  282. package/dist/types/tracking.schema.js.map +1 -0
  283. package/dist/utils/browser-launcher.d.ts +60 -0
  284. package/dist/utils/browser-launcher.d.ts.map +1 -0
  285. package/dist/utils/browser-launcher.js +263 -0
  286. package/dist/utils/browser-launcher.js.map +1 -0
  287. package/dist/utils/cache.d.ts +44 -0
  288. package/dist/utils/cache.d.ts.map +1 -0
  289. package/dist/utils/cache.js +94 -0
  290. package/dist/utils/cache.js.map +1 -0
  291. package/dist/utils/config-parser.d.ts +16 -0
  292. package/dist/utils/config-parser.d.ts.map +1 -0
  293. package/dist/utils/config-parser.js +210 -0
  294. package/dist/utils/config-parser.js.map +1 -0
  295. package/dist/utils/editor.d.ts +21 -0
  296. package/dist/utils/editor.d.ts.map +1 -0
  297. package/dist/utils/editor.js +213 -0
  298. package/dist/utils/editor.js.map +1 -0
  299. package/dist/utils/git-utils.d.ts +5 -0
  300. package/dist/utils/git-utils.d.ts.map +1 -0
  301. package/dist/utils/git-utils.js +18 -0
  302. package/dist/utils/git-utils.js.map +1 -0
  303. package/dist/utils/github-cli.d.ts +62 -0
  304. package/dist/utils/github-cli.d.ts.map +1 -0
  305. package/dist/utils/github-cli.js +492 -0
  306. package/dist/utils/github-cli.js.map +1 -0
  307. package/dist/utils/logger.d.ts +45 -0
  308. package/dist/utils/logger.d.ts.map +1 -0
  309. package/dist/utils/logger.js +118 -0
  310. package/dist/utils/logger.js.map +1 -0
  311. package/dist/utils/open-url.d.ts +19 -0
  312. package/dist/utils/open-url.d.ts.map +1 -0
  313. package/dist/utils/open-url.js +37 -0
  314. package/dist/utils/open-url.js.map +1 -0
  315. package/dist/utils/project-resolver.d.ts +13 -0
  316. package/dist/utils/project-resolver.d.ts.map +1 -0
  317. package/dist/utils/project-resolver.js +35 -0
  318. package/dist/utils/project-resolver.js.map +1 -0
  319. package/dist/utils/prompts.d.ts +80 -0
  320. package/dist/utils/prompts.d.ts.map +1 -0
  321. package/dist/utils/prompts.js +326 -0
  322. package/dist/utils/prompts.js.map +1 -0
  323. package/dist/utils/shell.d.ts +54 -0
  324. package/dist/utils/shell.d.ts.map +1 -0
  325. package/dist/utils/shell.js +152 -0
  326. package/dist/utils/shell.js.map +1 -0
  327. package/dist/utils/validators.d.ts +32 -0
  328. package/dist/utils/validators.d.ts.map +1 -0
  329. package/dist/utils/validators.js +64 -0
  330. package/dist/utils/validators.js.map +1 -0
  331. package/package.json +73 -0
@@ -0,0 +1,387 @@
1
+ ---
2
+ name: hula-merge
3
+ description: Merge a PR — handles both local worktree and remote-only branches. Use when the user asks to merge, complete, or close a PR.
4
+ disable-model-invocation: true
5
+ argument-hint: "[issue-number]"
6
+ allowed-tools: Bash Read
7
+ ---
8
+
9
+ You are an expert PR merger for the HubLaunch project. You handle two scenarios automatically:
10
+
11
+ - **Local session merge**: A `/hula-fix` session exists with a local worktree — commit, push, merge, then clean up.
12
+ - **Remote-only merge**: No local session/worktree (e.g. PR was created by GitHub Copilot coding agent, another contributor, or a previous session was cleaned up) — merge the PR directly via GitHub.
13
+
14
+ You detect which path to take automatically. The user never needs to specify.
15
+
16
+ ## Instructions
17
+
18
+ Your job is to:
19
+
20
+ 1. **Detect merge path** — check for local fix session + worktree, or fall back to remote-only
21
+ 2. **If local session exists**: commit/push changes, merge PR, clean up worktree + session
22
+ 3. **If remote-only**: merge PR directly via `hula merge`
23
+ 4. **Report results**
24
+
25
+ The main working tree is **never modified** — all local operations happen in the fix worktree (if one exists).
26
+
27
+ User input: $ARGUMENTS
28
+
29
+ ## Workflow
30
+
31
+ ### Step 1: Determine Issue Number
32
+
33
+ **Priority 1: Check chat history**
34
+
35
+ - Look for `<!-- hula-fix-session: {...} -->` from previous `/hula-fix` command
36
+ - Parse JSON to get: `issueNumber`, `worktreePath`, `prBranch`
37
+
38
+ **Priority 2: Check user input**
39
+
40
+ - Look for explicit issue number in the `/hula-merge` invocation (e.g. `/hula-merge 42` or `/hula-merge #42`)
41
+ - Look for pattern: `YizYah/<repo>#\d+` or `#\d+` in user input
42
+
43
+ **Priority 3: Check tracked issues**
44
+
45
+ - Run `hula view` to list tracked issues
46
+ - If only one tracked issue has an open PR, use it automatically
47
+ - If multiple, ask user to select
48
+
49
+ **If no issue found**:
50
+
51
+ ```
52
+ ❌ No issue number found.
53
+
54
+ Usage:
55
+ - /hula-merge (auto-detect from fix session or tracked issues)
56
+ - /hula-merge 42 (explicit issue number)
57
+ ```
58
+
59
+ Stop execution here. Do not proceed.
60
+
61
+ ### Step 2: Detect Merge Path
62
+
63
+ Once you have the issue number, determine which merge path to use:
64
+
65
+ **Check 1: Look for session file**
66
+
67
+ - Check if `.hublaunch/.fix-sessions/issue-<N>.json` exists
68
+ - If found, parse it to get `worktreePath` and `prBranch`
69
+
70
+ **Check 2: Verify worktree exists (only if session was found)**
71
+
72
+ ```bash
73
+ git worktree list --porcelain | grep "<worktreePath>"
74
+ ```
75
+
76
+ **Decision logic:**
77
+
78
+ | Session file exists? | Worktree exists? | Path |
79
+ | -------------------- | ---------------- | ------------------------------------------------------ |
80
+ | Yes | Yes | **Path A: Local session merge** |
81
+ | Yes | No | **Path B: Remote-only merge** (clean up stale session) |
82
+ | No | N/A | **Path B: Remote-only merge** |
83
+
84
+ Display the detected path:
85
+
86
+ - Path A: `ℹ️ Local fix session found — will commit, push, merge, and clean up worktree.`
87
+ - Path B: `ℹ️ No local session — will merge PR directly on GitHub.`
88
+
89
+ ---
90
+
91
+ ## Path A: Local Session Merge
92
+
93
+ Follow this path when a fix session AND its worktree both exist.
94
+
95
+ ### Step A1: Check for Changes in Worktree
96
+
97
+ Run inside the worktree:
98
+
99
+ ```bash
100
+ cd <worktreePath>
101
+ git status --porcelain
102
+ ```
103
+
104
+ **If output is empty**: skip Step A2, proceed directly to Step A3 (the script handles the no-changes case gracefully).
105
+
106
+ Display: "ℹ️ No changes to commit, proceeding to merge..."
107
+
108
+ **If output has changes**: proceed to Step A2.
109
+
110
+ ### Step A2: Ask About Running Tests
111
+
112
+ Detect test command from `package.json` (look for: `test`, `typecheck`, `lint`).
113
+
114
+ ```
115
+ You have uncommitted changes ready to commit.
116
+
117
+ Would you like to run tests before pushing? (y/n)
118
+
119
+ Suggested test command: npm test
120
+ ```
121
+
122
+ **If yes**: run tests inside the worktree (`cd <worktreePath> && npm test`).
123
+
124
+ - If tests fail: show error and ask if they want to proceed anyway.
125
+
126
+ **If no**: proceed to Step A3.
127
+
128
+ ### Step A3: Commit, Push, Merge, and Clean Up (Script)
129
+
130
+ Generate a commit message based on the issue number, files changed, and nature of changes, then run the local-merge script — it handles commit, push, merge, worktree removal, and session cleanup in one terminal approval:
131
+
132
+ ```bash
133
+ bash .github/scripts/hula-merge-local.sh <issue-number> "<worktreePath>" "fix(#42): <generated-message>"
134
+ ```
135
+
136
+ The script outputs JSON with `status`, `committed`, `filesChanged`, `worktreeRemoved`, and `sessionCleaned`.
137
+
138
+ Parse the JSON output:
139
+ - If `status` is `"error"`, display the `message` and stop. The session is preserved so you can retry.
140
+ - If `status` is `"success"`, proceed to Step A4.
141
+
142
+ Display based on output:
143
+ - If `committed` is `true`:
144
+ ```
145
+ ✅ Changes committed: "<commitMessage>"
146
+ 🚀 Pushed to remote
147
+ ```
148
+ - If `filesChanged` is `0`:
149
+ ```
150
+ ℹ️ No changes to commit, proceeding to merge...
151
+ ```
152
+ - Always display:
153
+ ```
154
+ 🔀 Merged PR for issue #42 ✅
155
+ 🧹 Removed fix worktree: <worktreePath>
156
+ 🧹 Cleaned up session file
157
+ ```
158
+
159
+ ### Step A4: Delete Local Branch
160
+
161
+ After the script completes successfully, delete the local branch:
162
+
163
+ ```bash
164
+ git branch -D <prBranch>
165
+ ```
166
+
167
+ - If the above fails (branch still held by worktree ref), it was removed with the worktree — skip silently.
168
+
169
+ Display:
170
+
171
+ ```
172
+ 🧹 Deleted local branch: <prBranch>
173
+ ```
174
+
175
+ Or if already gone:
176
+
177
+ ```
178
+ ℹ️ Local branch already removed with worktree
179
+ ```
180
+
181
+ ### Step A5: Success Summary
182
+
183
+ ```
184
+ ✨ Merge completed successfully!
185
+
186
+ Summary:
187
+ - Committed and pushed changes from worktree ✅
188
+ - Merged PR for issue #42 ✅
189
+ - Closed issue #42 ✅
190
+ - Removed fix worktree ✅
191
+ - Deleted local branch: <prBranch> ✅
192
+
193
+ Main working tree was never modified. You're ready for the next task!
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Path B: Remote-Only Merge
199
+
200
+ Follow this path when no local fix session/worktree exists. This is the common path when:
201
+
202
+ - GitHub Copilot coding agent created and worked on the PR
203
+ - Another contributor submitted the PR
204
+ - A previous `/hula-fix` session was already cleaned up
205
+ - The user ran `/hula-create` with Copilot assignment
206
+
207
+ ### Step B1: Remote-Only Merge and Cleanup (Script)
208
+
209
+ Run the remote-merge script — it merges the PR directly on GitHub and cleans up any stale session file in one terminal approval:
210
+
211
+ ```bash
212
+ bash .github/scripts/hula-merge-remote.sh <issue-number>
213
+ ```
214
+
215
+ The script outputs JSON with `status`, `issueNumber`, and `sessionCleaned`.
216
+
217
+ Parse the JSON output:
218
+ - If `status` is `"error"`, display the `message` and stop.
219
+ - If `status` is `"success"`, proceed to Step B2.
220
+
221
+ Display:
222
+ - If `sessionCleaned` is `true`: `🧹 Cleaned up stale session file`
223
+
224
+ ### Step B2: Delete Local Branch (if applicable)
225
+
226
+ Check whether the branch exists locally:
227
+
228
+ ```bash
229
+ git branch --list <prBranch>
230
+ ```
231
+
232
+ **If the branch exists locally:**
233
+
234
+ 1. Check current branch:
235
+ ```bash
236
+ git rev-parse --abbrev-ref HEAD
237
+ ```
238
+ 2. If currently on the branch, detect default branch and switch first:
239
+ ```bash
240
+ gh repo view --json defaultBranchRef --jq ".defaultBranchRef.name"
241
+ git checkout <defaultBranch>
242
+ ```
243
+ 3. Delete the local branch:
244
+ ```bash
245
+ git branch -D <prBranch>
246
+ ```
247
+ Display: `🧹 Deleted local branch: <prBranch>`
248
+
249
+ **If the branch does not exist locally:**
250
+
251
+ Display: `ℹ️ No local branch to clean up`
252
+
253
+ ### Step B3: Success Summary
254
+
255
+ ```
256
+ ✨ Merge completed successfully!
257
+
258
+ Summary:
259
+ - Merged PR for issue #42 on GitHub ✅
260
+ - Closed issue #42 ✅
261
+ - Deleted local branch: <prBranch> ✅ (or: No local branch to clean up)
262
+
263
+ No local worktree was involved — PR was merged directly on GitHub.
264
+ ```
265
+
266
+ ---
267
+
268
+ ## Error Handling
269
+
270
+ ### Merge Conflicts
271
+
272
+ ```
273
+ ❌ Merge conflict detected!
274
+
275
+ The PR has conflicts with the base branch.
276
+
277
+ Options:
278
+ 1. Resolve conflicts via GitHub PR web UI
279
+ 2. If local worktree exists: resolve in worktree at <worktreePath>
280
+ 3. Run /hula-merge again after resolving
281
+ ```
282
+
283
+ ### CI Checks Failing
284
+
285
+ ```
286
+ ⚠️ CI checks are failing for this PR.
287
+
288
+ Failing checks: <list>
289
+
290
+ Options:
291
+ 1. Wait for checks to pass
292
+ 2. Investigate failures on GitHub
293
+ 3. Proceed anyway? (y/n)
294
+ ```
295
+
296
+ ### Commit Fails (Path A only)
297
+
298
+ ```
299
+ ❌ Failed to commit changes: <error>
300
+
301
+ Ensure git user.name and user.email are configured.
302
+ ```
303
+
304
+ ### Push Fails (Path A only)
305
+
306
+ ```
307
+ ❌ Failed to push changes: <error>
308
+
309
+ Try: cd <worktreePath> && git push
310
+ ```
311
+
312
+ ### Merge Command Fails
313
+
314
+ ```
315
+ ❌ Failed to merge PR: <error>
316
+
317
+ Check the PR on GitHub: <PR-URL>
318
+ ```
319
+
320
+ For Path A: `Session preserved — run /hula-merge again after resolving.`
321
+ For Path B: `Run /hula-merge again after resolving.`
322
+
323
+ ## Important Notes
324
+
325
+ ### Adaptive Path Detection
326
+
327
+ The merge command automatically detects whether to use the local worktree path or remote-only path. Users do not need to specify which mode to use. The detection is based on:
328
+
329
+ 1. Presence of `.hublaunch/.fix-sessions/issue-<N>.json`
330
+ 2. Whether the worktree at the recorded path still exists
331
+
332
+ This covers all scenarios:
333
+
334
+ - `/hula-fix` → `/hula-merge` on the same machine (Path A)
335
+ - Copilot coding agent created the PR on GitHub (Path B)
336
+ - Another contributor's PR (Path B)
337
+ - Previous fix session already cleaned up (Path B)
338
+
339
+ ### Worktree Cleanup on Success (Path A)
340
+
341
+ The fix worktree is removed after a successful merge. This:
342
+
343
+ - Frees disk space
344
+ - Removes the now-merged branch reference
345
+ - Keeps the list of active worktrees clean
346
+
347
+ On failure, the worktree is preserved so you can:
348
+
349
+ - Fix issues and retry `/hula-merge`
350
+ - Manually clean up with: `git worktree remove "<path>" --force`
351
+ - Or: `hula worktree cleanup`
352
+
353
+ ### Session File Lifecycle
354
+
355
+ - Created by `/hula-fix`
356
+ - Preserved if `/hula-merge` fails (so you can retry)
357
+ - Deleted after successful merge OR cleaned up if stale (worktree missing)
358
+
359
+ ## Session File Format
360
+
361
+ `.hublaunch/.fix-sessions/issue-42.json`:
362
+
363
+ ```json
364
+ {
365
+ "issueNumber": 42,
366
+ "worktreePath": "<worktreePath>",
367
+ "prBranch": "fix/issue-42-button-color",
368
+ "localName": "fix button color",
369
+ "startedAt": "2025-12-22T14:30:00.000Z"
370
+ }
371
+ ```
372
+
373
+ ## Success Criteria
374
+
375
+ - ✅ Automatically detects local session vs remote-only merge path
376
+ - ✅ Path A: Changes committed and pushed from within the fix worktree
377
+ - ✅ Path A: Tests run if user requests (and changes exist)
378
+ - ✅ Path A: Fix worktree removed after successful merge
379
+ - ✅ Path A: Session file cleaned up
380
+ - ✅ Path A: Local branch deleted after worktree removal
381
+ - ✅ Path B: PR merged directly on GitHub without any local branch/worktree operations
382
+ - ✅ Path B: Stale session files cleaned up if present
383
+ - ✅ Path B: Local branch deleted if it existed locally
384
+ - ✅ PR merged successfully (both paths)
385
+ - ✅ Issue closed automatically (both paths)
386
+ - ✅ Main working tree never modified (both paths)
387
+ - ✅ Graceful error handling for conflicts, CI failures, pending reviews
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: hula-plan
3
+ description: Generate a detailed implementation plan for a GitHub issue. Use when the user asks to plan a feature, create a plan, or implement an issue.
4
+ disable-model-invocation: true
5
+ argument-hint: <feature or issue description> [--folder <subfolder>]
6
+ allowed-tools: Bash Read
7
+ ---
8
+
9
+ You are an expert technical planner for the HubLaunch project.
10
+
11
+ ## Instructions
12
+
13
+ Read the detailed planning guidelines from the workspace file:
14
+
15
+ `.hublaunch/planning-instructions.md`
16
+
17
+ Follow those instructions carefully to generate a comprehensive implementation plan.
18
+
19
+ ## Context
20
+
21
+ The user will describe a feature or issue. Your job is to:
22
+
23
+ 1. **ASK CLARIFYING QUESTIONS FIRST** - Do not immediately generate a plan
24
+ 2. Understand the requirements through questions and answers
25
+ 3. Analyze the existing codebase context
26
+ 4. Generate a structured plan following the template in planning-instructions.md
27
+ 5. Include specific file paths, code suggestions, and actionable steps
28
+ 6. Consider testing, documentation, and edge cases
29
+
30
+ ## Input
31
+
32
+ Issue description: $ARGUMENTS
33
+ Folder (optional): Parsed from $ARGUMENTS if --folder flag is provided
34
+
35
+ ## Additional Context
36
+
37
+ Use the `#codebase` tool to search for relevant existing code:
38
+
39
+ - Similar features to reference
40
+ - Services that might be affected
41
+ - Patterns to follow
42
+
43
+ Use the `#file` tool to read specific files if needed to understand:
44
+
45
+ - Current implementation details
46
+ - Type definitions
47
+ - Configuration structure
48
+
49
+ ## Deep Analysis Requirements
50
+
51
+ **Before asking any clarifying questions**, you MUST perform an exhaustive codebase analysis:
52
+
53
+ 1. **Search exhaustively** — use workspace search, semantic search, and file reads to find ALL related code (not just the first match). Check all services, utilities, types, configurations, and templates that could be affected.
54
+ 2. **Trace dependencies end-to-end** — follow imports and understand how services connect to each other. Read every file that is transitively involved.
55
+ 3. **Read type definitions** — inspect interfaces, enums, and type aliases to understand data shapes.
56
+ 4. **Check existing patterns** — find similar features already implemented and follow the same patterns.
57
+ 5. **Review configuration** — check `.hublaunch/hublaunch.config.js` and any relevant config files for constraints.
58
+
59
+ **Self-answer from code**: If you can determine the answer by reading source files, present it as a **finding**, NOT as a question. Format these as:
60
+
61
+ > 📖 **Finding**: `GitService.deleteBranch()` already exists at `src/services/git/GitService.ts:58` and accepts a `force` flag.
62
+
63
+ **Only ask what requires human judgment**: Business decisions, user preferences, ambiguous requirements, or trade-offs that genuinely cannot be resolved from code. Do not ask questions whose answers are already in the codebase.
64
+
65
+ **Keep asking until 100% clear**: After the user answers your questions, if ANY ambiguity remains, ask follow-up questions in additional rounds. Do NOT proceed to planning with any uncertainty. Multiple rounds of clarification (2–3 rounds is normal and preferred) are expected over guessing or making assumptions.
66
+
67
+ ### Codebase Analysis Output Format
68
+
69
+ Present your findings before asking questions:
70
+
71
+ ```
72
+ ## Codebase Analysis
73
+
74
+ ### Related Files Found
75
+ - `src/...` — [what it does and why it's relevant]
76
+
77
+ ### Existing Patterns
78
+ - [pattern name]: [where it's used and how]
79
+
80
+ ### Self-Answered Questions
81
+ - ❓ Does X already exist? → ✅ Yes, at `src/...` (line N)
82
+ - ❓ What type does Y use? → ✅ `TypeName` defined in `src/types/...`
83
+
84
+ ### Questions Requiring Human Judgment
85
+ [Only genuinely ambiguous items go here]
86
+ ```
87
+
88
+ ## Output Requirements
89
+
90
+ Generate a complete markdown document that includes:
91
+
92
+ 1. **Title**: Clear H1 heading suitable for a GitHub issue
93
+ 2. **Problem Statement**: Context and motivation
94
+ 3. **Proposed Solution**: High-level approach
95
+ 4. **Implementation Steps**: Detailed, actionable tasks organized in phases
96
+ 5. **Technical Considerations**: Dependencies, config, security, etc.
97
+ 6. **Testing Strategy**: Unit, integration, and manual tests
98
+ 7. **Documentation Updates**: What docs need updating
99
+ 8. **Acceptance Criteria**: Clear completion conditions
100
+
101
+ The plan should be immediately actionable by a developer familiar with the codebase.
102
+
103
+ ## IMPORTANT: File Creation & Next Steps
104
+
105
+ **You MUST create and save the plan file directly.** Do not just provide the content - actually create the file.
106
+
107
+ ### Step 1: Create the Plan File
108
+
109
+ 1. Read the planPath from `.hublaunch/hublaunch.config.js` (defaults to `.hublaunch/plans`)
110
+ 2. If a **folder** was provided, append it to the planPath (e.g. `.hublaunch/plans/auth` or `.hublaunch/plans/refactoring/v2`). Nested folders are supported.
111
+ 3. Generate the filename using the format: `YYYY-MM-DD-HH:MM-{brief-title-slug}.md`
112
+ - Use today's date and current time (24-hour format)
113
+ - Create a brief, lowercase, hyphenated slug from the title
114
+ 4. Save the plan file locally in the plans directory:
115
+ - Without folder: `.hublaunch/plans/<filename>.md`
116
+ - With folder: `.hublaunch/plans/<folder>/<filename>.md`
117
+ - Example: `.hublaunch/plans/auth/2025-12-29-14:30-feature-name.md`
118
+ 5. Create the full directory path (including any nested subfolders) if it doesn't exist
119
+ 6. Write the complete plan content to the file
120
+
121
+ **⚠️ NEVER create plan files in the project root directory.** The plan file MUST always be inside the `.hublaunch/plans/` directory (or a subfolder of it). If you cannot read the config file, use the default path `.hublaunch/plans/`.
122
+
123
+ ### Step 2: Output the Plan Path and Next Steps
124
+
125
+ **Output Format:**
126
+
127
+ ```
128
+ ✅ Plan created: `.hublaunch/plans/2025-12-29-14:30-feature-name.md`
129
+ <!-- hula-plan: .hublaunch/plans/2025-12-29-14:30-feature-name.md -->
130
+
131
+ 📋 **Proceeding to validation now…**
132
+ ```
133
+
134
+ Now proceed directly to plan validation **without waiting for the user**. The plan file was just created in this session — the path is already known.
135
+
136
+ Read `.hublaunch/proceed-instructions.md` and execute the full validation workflow against the plan at `<path>` (substitute `<path>` with the actual plan file path you just created, e.g. `.hublaunch/plans/2025-12-29-14:30-feature-name.md`).
137
+
138
+ **Important adjustments for inline execution:**
139
+
140
+ - **Skip Step 1 (file location)** — the plan path is `<path>`. Do not ask "Is this correct?"
141
+ - **Execute Step 2 onwards** — Comprehensive Validation Analysis, auto-fix, MCQ questions if needed, plan update, iterate until quality bar is met.
142
+ - **Carry forward all context** from this planning session — you have full knowledge of the decisions made, which may help resolve validation questions.
143
+ - **Recovery fallback** — If validation cannot complete (e.g. context limit, tool error), print:
144
+ > ⚠️ Auto-validation could not complete. Run `/hula-confirm <path>` to resume.
145
+
146
+ where `<path>` is the plan file path.
147
+
148
+ **Note:** The plan is created locally and will need to be uploaded to origin/main before launching. The `/hula-upload` command will handle this seamlessly (stash, switch, commit, push, restore). `/hula-confirm` remains available as a standalone command for re-validation at any time.
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: hula-upload
3
+ description: Upload the current plan to origin/main via a temporary worktree. Use when the user asks to upload or sync the plan.
4
+ disable-model-invocation: true
5
+ argument-hint: "[plan-file-path]"
6
+ allowed-tools: Bash Read
7
+ ---
8
+
9
+ You are an expert HubLaunch workflow assistant, responsible for uploading implementation plans to the remote repository using an isolated worktree.
10
+
11
+ ## Instructions
12
+
13
+ Your job is to:
14
+
15
+ 1. **Find the plan file path** from Copilot's own previous output in THIS chat:
16
+ - Look for the output from `/hula-plan` command
17
+ - Parse the plan file path from the message
18
+ - Also check for the HTML comment: `<!-- hula-plan: <path> -->`
19
+ - **CRITICAL**: Do NOT search the filesystem for plans — ONLY use the path from chat history
20
+
21
+ 2. **Error if no plan found**:
22
+ - If no plan path is found in the current chat history, show error:
23
+ - "❌ No plan found in this chat. Run `/hula-plan` first."
24
+ - Stop execution
25
+
26
+ 3. **Inform the user — upload is automatic**:
27
+ - Plan upload is handled automatically by `hula launch` — no separate upload command is needed.
28
+ - Display this message:
29
+ ```
30
+ ℹ️ Upload is no longer a separate step.
31
+
32
+ `hula launch` automatically uploads the plan to `origin/main` before starting the job.
33
+
34
+ **Next Step:** Run `/hula-launch <branch-name>` to upload and launch in one step.
35
+
36
+ <!-- hula-uploaded: <plan-path> -->
37
+ ```
38
+ - Do not run any shell command. Do not attempt to call `hula upload` or any upload CLI.
39
+
40
+ 4. **Done** — no further action needed.
41
+
42
+ ## Input Format
43
+
44
+ ```
45
+ /hula-upload
46
+ ```
47
+
48
+ No arguments needed — the plan path is extracted from chat history.
49
+
50
+ User input: $ARGUMENTS
51
+
52
+ ## Workflow
53
+
54
+ ### Step 1: Find Plan in Chat History
55
+
56
+ **CRITICAL**: Do NOT search the filesystem. ONLY look in the current chat history.
57
+
58
+ Look for messages from `/hula-plan` command that contain:
59
+ - Text like: "Plan created: `.hublaunch/plans/2025-12-22-14:30-feature-name.md`"
60
+ - HTML comment: `<!-- hula-plan: .hublaunch/plans/2025-12-22-14:30-feature-name.md -->`
61
+
62
+ If NOT found in chat history:
63
+ ```
64
+ ❌ No plan found in this chat. Run `/hula-plan` first.
65
+ ```
66
+
67
+ Stop execution here.
68
+
69
+ ### Step 2: Validate Plan File
70
+
71
+ Use the `#file` tool to verify the plan file exists.
72
+
73
+ If not found:
74
+ ```
75
+ ❌ Plan file not found at <path>. The file may have been moved or deleted.
76
+ ```
77
+
78
+ ### Step 3: Inform User — Upload Is Automatic
79
+
80
+ Plan upload is now handled automatically by `hula launch`. There is no separate upload CLI command.
81
+
82
+ Display this message to the user:
83
+
84
+ ```
85
+ ℹ️ Upload is no longer a separate step.
86
+
87
+ `hula launch` automatically uploads the plan to `origin/main` before starting the job.
88
+
89
+ **Next Step:** Run `/hula-launch <branch-name>` to upload and launch in one step.
90
+
91
+ <!-- hula-uploaded: <plan-path> -->
92
+ ```
93
+
94
+ Do not run any shell command. Do not attempt to call `hula upload` or any upload CLI.
95
+
96
+ ### Step 4: Done
97
+
98
+ No further action needed. The message from Step 3 is the final output.
99
+
100
+ ## Important Notes
101
+
102
+ - This command uploads the plan from your local branch to `origin/main` using an isolated worktree
103
+ - The plan file in your main working tree is **never modified by upload** — it remains untouched. (It will be automatically removed later when `/hula-launch` or `/hula-create` succeeds, since it's already on origin/main.)
104
+ - The plan must be uploaded before running `/hula-launch`
105
+ - If the plan is already on `origin/main`, the command will confirm this
106
+ - This is typically run after `/hula-plan` and `/hula-confirm`, before `/hula-launch`
107
+
108
+ ## Typical Workflow
109
+
110
+ ```
111
+ /hula-plan Add user authentication # Create the plan
112
+ /hula-confirm # Refine the plan
113
+ /hula-upload # Sync plan to origin/main (worktree-based, non-destructive)
114
+ /hula-launch feature-auth # Launch the issue
115
+ ```