@akiojin/gwt 4.12.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (860) hide show
  1. package/README.ja.md +173 -203
  2. package/README.md +170 -212
  3. package/bin/gwt +0 -0
  4. package/bin/gwt.js +42 -33
  5. package/package.json +20 -107
  6. package/scripts/postinstall.js +152 -0
  7. package/dist/claude-history.d.ts +0 -60
  8. package/dist/claude-history.d.ts.map +0 -1
  9. package/dist/claude-history.js +0 -606
  10. package/dist/claude-history.js.map +0 -1
  11. package/dist/claude.d.ts +0 -42
  12. package/dist/claude.d.ts.map +0 -1
  13. package/dist/claude.js +0 -429
  14. package/dist/claude.js.map +0 -1
  15. package/dist/cli/ui/App.solid.d.ts +0 -29
  16. package/dist/cli/ui/App.solid.d.ts.map +0 -1
  17. package/dist/cli/ui/App.solid.js +0 -1427
  18. package/dist/cli/ui/App.solid.js.map +0 -1
  19. package/dist/cli/ui/components/solid/Footer.d.ts +0 -10
  20. package/dist/cli/ui/components/solid/Footer.d.ts.map +0 -1
  21. package/dist/cli/ui/components/solid/Footer.js +0 -10
  22. package/dist/cli/ui/components/solid/Footer.js.map +0 -1
  23. package/dist/cli/ui/components/solid/Header.d.ts +0 -32
  24. package/dist/cli/ui/components/solid/Header.d.ts.map +0 -1
  25. package/dist/cli/ui/components/solid/Header.js +0 -13
  26. package/dist/cli/ui/components/solid/Header.js.map +0 -1
  27. package/dist/cli/ui/components/solid/HelpOverlay.d.ts +0 -8
  28. package/dist/cli/ui/components/solid/HelpOverlay.d.ts.map +0 -1
  29. package/dist/cli/ui/components/solid/HelpOverlay.js +0 -118
  30. package/dist/cli/ui/components/solid/HelpOverlay.js.map +0 -1
  31. package/dist/cli/ui/components/solid/QuickStartStep.d.ts +0 -17
  32. package/dist/cli/ui/components/solid/QuickStartStep.d.ts.map +0 -1
  33. package/dist/cli/ui/components/solid/QuickStartStep.js +0 -152
  34. package/dist/cli/ui/components/solid/QuickStartStep.js.map +0 -1
  35. package/dist/cli/ui/components/solid/SelectInput.d.ts +0 -22
  36. package/dist/cli/ui/components/solid/SelectInput.d.ts.map +0 -1
  37. package/dist/cli/ui/components/solid/SelectInput.js +0 -45
  38. package/dist/cli/ui/components/solid/SelectInput.js.map +0 -1
  39. package/dist/cli/ui/components/solid/TextInput.d.ts +0 -12
  40. package/dist/cli/ui/components/solid/TextInput.d.ts.map +0 -1
  41. package/dist/cli/ui/components/solid/TextInput.js +0 -9
  42. package/dist/cli/ui/components/solid/TextInput.js.map +0 -1
  43. package/dist/cli/ui/components/solid/WizardController.d.ts +0 -34
  44. package/dist/cli/ui/components/solid/WizardController.d.ts.map +0 -1
  45. package/dist/cli/ui/components/solid/WizardController.js +0 -269
  46. package/dist/cli/ui/components/solid/WizardController.js.map +0 -1
  47. package/dist/cli/ui/components/solid/WizardPopup.d.ts +0 -26
  48. package/dist/cli/ui/components/solid/WizardPopup.d.ts.map +0 -1
  49. package/dist/cli/ui/components/solid/WizardPopup.js +0 -68
  50. package/dist/cli/ui/components/solid/WizardPopup.js.map +0 -1
  51. package/dist/cli/ui/components/solid/WizardSteps.d.ts +0 -57
  52. package/dist/cli/ui/components/solid/WizardSteps.d.ts.map +0 -1
  53. package/dist/cli/ui/components/solid/WizardSteps.js +0 -442
  54. package/dist/cli/ui/components/solid/WizardSteps.js.map +0 -1
  55. package/dist/cli/ui/core/index.d.ts +0 -12
  56. package/dist/cli/ui/core/index.d.ts.map +0 -1
  57. package/dist/cli/ui/core/index.js +0 -15
  58. package/dist/cli/ui/core/index.js.map +0 -1
  59. package/dist/cli/ui/core/keybindings.d.ts +0 -106
  60. package/dist/cli/ui/core/keybindings.d.ts.map +0 -1
  61. package/dist/cli/ui/core/keybindings.js +0 -270
  62. package/dist/cli/ui/core/keybindings.js.map +0 -1
  63. package/dist/cli/ui/core/theme.d.ts +0 -123
  64. package/dist/cli/ui/core/theme.d.ts.map +0 -1
  65. package/dist/cli/ui/core/theme.js +0 -191
  66. package/dist/cli/ui/core/theme.js.map +0 -1
  67. package/dist/cli/ui/core/types.d.ts +0 -156
  68. package/dist/cli/ui/core/types.d.ts.map +0 -1
  69. package/dist/cli/ui/core/types.js +0 -10
  70. package/dist/cli/ui/core/types.js.map +0 -1
  71. package/dist/cli/ui/hooks/solid/useScrollableList.d.ts +0 -26
  72. package/dist/cli/ui/hooks/solid/useScrollableList.d.ts.map +0 -1
  73. package/dist/cli/ui/hooks/solid/useScrollableList.js +0 -89
  74. package/dist/cli/ui/hooks/solid/useScrollableList.js.map +0 -1
  75. package/dist/cli/ui/hooks/solid/useTerminalSize.d.ts +0 -10
  76. package/dist/cli/ui/hooks/solid/useTerminalSize.d.ts.map +0 -1
  77. package/dist/cli/ui/hooks/solid/useTerminalSize.js +0 -16
  78. package/dist/cli/ui/hooks/solid/useTerminalSize.js.map +0 -1
  79. package/dist/cli/ui/index.solid.d.ts +0 -5
  80. package/dist/cli/ui/index.solid.d.ts.map +0 -1
  81. package/dist/cli/ui/index.solid.js +0 -21
  82. package/dist/cli/ui/index.solid.js.map +0 -1
  83. package/dist/cli/ui/screens/solid/BranchListScreen.d.ts +0 -53
  84. package/dist/cli/ui/screens/solid/BranchListScreen.d.ts.map +0 -1
  85. package/dist/cli/ui/screens/solid/BranchListScreen.js +0 -829
  86. package/dist/cli/ui/screens/solid/BranchListScreen.js.map +0 -1
  87. package/dist/cli/ui/screens/solid/ConfirmScreen.d.ts +0 -11
  88. package/dist/cli/ui/screens/solid/ConfirmScreen.d.ts.map +0 -1
  89. package/dist/cli/ui/screens/solid/ConfirmScreen.js +0 -45
  90. package/dist/cli/ui/screens/solid/ConfirmScreen.js.map +0 -1
  91. package/dist/cli/ui/screens/solid/EnvironmentScreen.d.ts +0 -14
  92. package/dist/cli/ui/screens/solid/EnvironmentScreen.d.ts.map +0 -1
  93. package/dist/cli/ui/screens/solid/EnvironmentScreen.js +0 -90
  94. package/dist/cli/ui/screens/solid/EnvironmentScreen.js.map +0 -1
  95. package/dist/cli/ui/screens/solid/ErrorScreen.d.ts +0 -8
  96. package/dist/cli/ui/screens/solid/ErrorScreen.d.ts.map +0 -1
  97. package/dist/cli/ui/screens/solid/ErrorScreen.js +0 -18
  98. package/dist/cli/ui/screens/solid/ErrorScreen.js.map +0 -1
  99. package/dist/cli/ui/screens/solid/InputScreen.d.ts +0 -13
  100. package/dist/cli/ui/screens/solid/InputScreen.d.ts.map +0 -1
  101. package/dist/cli/ui/screens/solid/InputScreen.js +0 -17
  102. package/dist/cli/ui/screens/solid/InputScreen.js.map +0 -1
  103. package/dist/cli/ui/screens/solid/LoadingIndicator.d.ts +0 -9
  104. package/dist/cli/ui/screens/solid/LoadingIndicator.d.ts.map +0 -1
  105. package/dist/cli/ui/screens/solid/LoadingIndicator.js +0 -43
  106. package/dist/cli/ui/screens/solid/LoadingIndicator.js.map +0 -1
  107. package/dist/cli/ui/screens/solid/LogDetailScreen.d.ts +0 -14
  108. package/dist/cli/ui/screens/solid/LogDetailScreen.d.ts.map +0 -1
  109. package/dist/cli/ui/screens/solid/LogDetailScreen.js +0 -34
  110. package/dist/cli/ui/screens/solid/LogDetailScreen.js.map +0 -1
  111. package/dist/cli/ui/screens/solid/LogScreen.d.ts +0 -25
  112. package/dist/cli/ui/screens/solid/LogScreen.d.ts.map +0 -1
  113. package/dist/cli/ui/screens/solid/LogScreen.js +0 -333
  114. package/dist/cli/ui/screens/solid/LogScreen.js.map +0 -1
  115. package/dist/cli/ui/screens/solid/ProfileEnvScreen.d.ts +0 -17
  116. package/dist/cli/ui/screens/solid/ProfileEnvScreen.d.ts.map +0 -1
  117. package/dist/cli/ui/screens/solid/ProfileEnvScreen.js +0 -115
  118. package/dist/cli/ui/screens/solid/ProfileEnvScreen.js.map +0 -1
  119. package/dist/cli/ui/screens/solid/ProfileScreen.d.ts +0 -17
  120. package/dist/cli/ui/screens/solid/ProfileScreen.d.ts.map +0 -1
  121. package/dist/cli/ui/screens/solid/ProfileScreen.js +0 -50
  122. package/dist/cli/ui/screens/solid/ProfileScreen.js.map +0 -1
  123. package/dist/cli/ui/screens/solid/SelectorScreen.d.ts +0 -20
  124. package/dist/cli/ui/screens/solid/SelectorScreen.d.ts.map +0 -1
  125. package/dist/cli/ui/screens/solid/SelectorScreen.js +0 -98
  126. package/dist/cli/ui/screens/solid/SelectorScreen.js.map +0 -1
  127. package/dist/cli/ui/screens/solid/WorktreeCreateScreen.d.ts +0 -13
  128. package/dist/cli/ui/screens/solid/WorktreeCreateScreen.d.ts.map +0 -1
  129. package/dist/cli/ui/screens/solid/WorktreeCreateScreen.js +0 -59
  130. package/dist/cli/ui/screens/solid/WorktreeCreateScreen.js.map +0 -1
  131. package/dist/cli/ui/stores/appStore.d.ts +0 -143
  132. package/dist/cli/ui/stores/appStore.d.ts.map +0 -1
  133. package/dist/cli/ui/stores/appStore.js +0 -158
  134. package/dist/cli/ui/stores/appStore.js.map +0 -1
  135. package/dist/cli/ui/stores/branchStore.d.ts +0 -159
  136. package/dist/cli/ui/stores/branchStore.d.ts.map +0 -1
  137. package/dist/cli/ui/stores/branchStore.js +0 -275
  138. package/dist/cli/ui/stores/branchStore.js.map +0 -1
  139. package/dist/cli/ui/stores/index.d.ts +0 -11
  140. package/dist/cli/ui/stores/index.d.ts.map +0 -1
  141. package/dist/cli/ui/stores/index.js +0 -14
  142. package/dist/cli/ui/stores/index.js.map +0 -1
  143. package/dist/cli/ui/stores/uiStore.d.ts +0 -146
  144. package/dist/cli/ui/stores/uiStore.d.ts.map +0 -1
  145. package/dist/cli/ui/stores/uiStore.js +0 -166
  146. package/dist/cli/ui/stores/uiStore.js.map +0 -1
  147. package/dist/cli/ui/types.d.ts +0 -293
  148. package/dist/cli/ui/types.d.ts.map +0 -1
  149. package/dist/cli/ui/types.js +0 -2
  150. package/dist/cli/ui/types.js.map +0 -1
  151. package/dist/cli/ui/utils/baseBranch.d.ts +0 -4
  152. package/dist/cli/ui/utils/baseBranch.d.ts.map +0 -1
  153. package/dist/cli/ui/utils/baseBranch.js +0 -17
  154. package/dist/cli/ui/utils/baseBranch.js.map +0 -1
  155. package/dist/cli/ui/utils/branchFormatter.d.ts +0 -19
  156. package/dist/cli/ui/utils/branchFormatter.d.ts.map +0 -1
  157. package/dist/cli/ui/utils/branchFormatter.js +0 -199
  158. package/dist/cli/ui/utils/branchFormatter.js.map +0 -1
  159. package/dist/cli/ui/utils/clipboard.d.ts +0 -7
  160. package/dist/cli/ui/utils/clipboard.d.ts.map +0 -1
  161. package/dist/cli/ui/utils/clipboard.js +0 -21
  162. package/dist/cli/ui/utils/clipboard.js.map +0 -1
  163. package/dist/cli/ui/utils/continueSession.d.ts +0 -36
  164. package/dist/cli/ui/utils/continueSession.d.ts.map +0 -1
  165. package/dist/cli/ui/utils/continueSession.js +0 -155
  166. package/dist/cli/ui/utils/continueSession.js.map +0 -1
  167. package/dist/cli/ui/utils/installedVersionCache.d.ts +0 -33
  168. package/dist/cli/ui/utils/installedVersionCache.d.ts.map +0 -1
  169. package/dist/cli/ui/utils/installedVersionCache.js +0 -59
  170. package/dist/cli/ui/utils/installedVersionCache.js.map +0 -1
  171. package/dist/cli/ui/utils/modelOptions.d.ts +0 -10
  172. package/dist/cli/ui/utils/modelOptions.d.ts.map +0 -1
  173. package/dist/cli/ui/utils/modelOptions.js +0 -155
  174. package/dist/cli/ui/utils/modelOptions.js.map +0 -1
  175. package/dist/cli/ui/utils/statisticsCalculator.d.ts +0 -9
  176. package/dist/cli/ui/utils/statisticsCalculator.d.ts.map +0 -1
  177. package/dist/cli/ui/utils/statisticsCalculator.js +0 -37
  178. package/dist/cli/ui/utils/statisticsCalculator.js.map +0 -1
  179. package/dist/cli/ui/utils/versionCache.d.ts +0 -37
  180. package/dist/cli/ui/utils/versionCache.d.ts.map +0 -1
  181. package/dist/cli/ui/utils/versionCache.js +0 -70
  182. package/dist/cli/ui/utils/versionCache.js.map +0 -1
  183. package/dist/cli/ui/utils/versionFetcher.d.ts +0 -41
  184. package/dist/cli/ui/utils/versionFetcher.d.ts.map +0 -1
  185. package/dist/cli/ui/utils/versionFetcher.js +0 -89
  186. package/dist/cli/ui/utils/versionFetcher.js.map +0 -1
  187. package/dist/client/assets/index-BbfV7Wuj.css +0 -1
  188. package/dist/client/assets/index-CoAyq5x1.js +0 -78
  189. package/dist/client/index.html +0 -13
  190. package/dist/codex.d.ts +0 -55
  191. package/dist/codex.d.ts.map +0 -1
  192. package/dist/codex.js +0 -329
  193. package/dist/codex.js.map +0 -1
  194. package/dist/config/builtin-coding-agents.d.ts +0 -27
  195. package/dist/config/builtin-coding-agents.d.ts.map +0 -1
  196. package/dist/config/builtin-coding-agents.js +0 -78
  197. package/dist/config/builtin-coding-agents.js.map +0 -1
  198. package/dist/config/constants.d.ts +0 -76
  199. package/dist/config/constants.d.ts.map +0 -1
  200. package/dist/config/constants.js +0 -92
  201. package/dist/config/constants.js.map +0 -1
  202. package/dist/config/env-history.d.ts +0 -4
  203. package/dist/config/env-history.d.ts.map +0 -1
  204. package/dist/config/env-history.js +0 -34
  205. package/dist/config/env-history.js.map +0 -1
  206. package/dist/config/index.d.ts +0 -51
  207. package/dist/config/index.d.ts.map +0 -1
  208. package/dist/config/index.js +0 -225
  209. package/dist/config/index.js.map +0 -1
  210. package/dist/config/profiles.d.ts +0 -94
  211. package/dist/config/profiles.d.ts.map +0 -1
  212. package/dist/config/profiles.js +0 -284
  213. package/dist/config/profiles.js.map +0 -1
  214. package/dist/config/shared-env.d.ts +0 -41
  215. package/dist/config/shared-env.d.ts.map +0 -1
  216. package/dist/config/shared-env.js +0 -114
  217. package/dist/config/shared-env.js.map +0 -1
  218. package/dist/config/tools.d.ts +0 -50
  219. package/dist/config/tools.d.ts.map +0 -1
  220. package/dist/config/tools.js +0 -239
  221. package/dist/config/tools.js.map +0 -1
  222. package/dist/gemini.d.ts +0 -35
  223. package/dist/gemini.d.ts.map +0 -1
  224. package/dist/gemini.js +0 -299
  225. package/dist/gemini.js.map +0 -1
  226. package/dist/git.d.ts +0 -154
  227. package/dist/git.d.ts.map +0 -1
  228. package/dist/git.js +0 -1012
  229. package/dist/git.js.map +0 -1
  230. package/dist/github.d.ts +0 -14
  231. package/dist/github.d.ts.map +0 -1
  232. package/dist/github.js +0 -123
  233. package/dist/github.js.map +0 -1
  234. package/dist/index.d.ts +0 -16
  235. package/dist/index.d.ts.map +0 -1
  236. package/dist/index.js +0 -782
  237. package/dist/index.js.map +0 -1
  238. package/dist/launcher.d.ts +0 -30
  239. package/dist/launcher.d.ts.map +0 -1
  240. package/dist/launcher.js +0 -185
  241. package/dist/launcher.js.map +0 -1
  242. package/dist/logging/agentOutput.d.ts +0 -21
  243. package/dist/logging/agentOutput.d.ts.map +0 -1
  244. package/dist/logging/agentOutput.js +0 -164
  245. package/dist/logging/agentOutput.js.map +0 -1
  246. package/dist/logging/formatter.d.ts +0 -15
  247. package/dist/logging/formatter.d.ts.map +0 -1
  248. package/dist/logging/formatter.js +0 -95
  249. package/dist/logging/formatter.js.map +0 -1
  250. package/dist/logging/logger.d.ts +0 -24
  251. package/dist/logging/logger.d.ts.map +0 -1
  252. package/dist/logging/logger.js +0 -79
  253. package/dist/logging/logger.js.map +0 -1
  254. package/dist/logging/reader.d.ts +0 -34
  255. package/dist/logging/reader.d.ts.map +0 -1
  256. package/dist/logging/reader.js +0 -178
  257. package/dist/logging/reader.js.map +0 -1
  258. package/dist/logging/rotation.d.ts +0 -6
  259. package/dist/logging/rotation.d.ts.map +0 -1
  260. package/dist/logging/rotation.js +0 -26
  261. package/dist/logging/rotation.js.map +0 -1
  262. package/dist/opentui/highlights-eq9cgrbb.scm +0 -604
  263. package/dist/opentui/highlights-ghv9g403.scm +0 -205
  264. package/dist/opentui/highlights-hk7bwhj4.scm +0 -284
  265. package/dist/opentui/highlights-r812a2qc.scm +0 -150
  266. package/dist/opentui/highlights-x6tmsnaa.scm +0 -115
  267. package/dist/opentui/index.solid.d.ts +0 -2
  268. package/dist/opentui/index.solid.d.ts.map +0 -1
  269. package/dist/opentui/index.solid.js +0 -53721
  270. package/dist/opentui/index.solid.js.map +0 -1
  271. package/dist/opentui/injections-73j83es3.scm +0 -27
  272. package/dist/opentui/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
  273. package/dist/opentui/tree-sitter-markdown-411r6y9b.wasm +0 -0
  274. package/dist/opentui/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
  275. package/dist/opentui/tree-sitter-typescript-zxjzwt75.wasm +0 -0
  276. package/dist/opentui/tree-sitter-zig-e78zbjpm.wasm +0 -0
  277. package/dist/repositories/git.repository.d.ts +0 -38
  278. package/dist/repositories/git.repository.d.ts.map +0 -1
  279. package/dist/repositories/git.repository.js +0 -117
  280. package/dist/repositories/git.repository.js.map +0 -1
  281. package/dist/repositories/github.repository.d.ts +0 -16
  282. package/dist/repositories/github.repository.d.ts.map +0 -1
  283. package/dist/repositories/github.repository.js +0 -61
  284. package/dist/repositories/github.repository.js.map +0 -1
  285. package/dist/repositories/worktree.repository.d.ts +0 -19
  286. package/dist/repositories/worktree.repository.d.ts.map +0 -1
  287. package/dist/repositories/worktree.repository.js +0 -64
  288. package/dist/repositories/worktree.repository.js.map +0 -1
  289. package/dist/services/BatchMergeService.d.ts +0 -45
  290. package/dist/services/BatchMergeService.d.ts.map +0 -1
  291. package/dist/services/BatchMergeService.js +0 -197
  292. package/dist/services/BatchMergeService.js.map +0 -1
  293. package/dist/services/WorktreeOrchestrator.d.ts +0 -37
  294. package/dist/services/WorktreeOrchestrator.d.ts.map +0 -1
  295. package/dist/services/WorktreeOrchestrator.js +0 -74
  296. package/dist/services/WorktreeOrchestrator.js.map +0 -1
  297. package/dist/services/codingAgentCommandResolver.d.ts +0 -10
  298. package/dist/services/codingAgentCommandResolver.d.ts.map +0 -1
  299. package/dist/services/codingAgentCommandResolver.js +0 -81
  300. package/dist/services/codingAgentCommandResolver.js.map +0 -1
  301. package/dist/services/codingAgentResolver.d.ts +0 -43
  302. package/dist/services/codingAgentResolver.d.ts.map +0 -1
  303. package/dist/services/codingAgentResolver.js +0 -269
  304. package/dist/services/codingAgentResolver.js.map +0 -1
  305. package/dist/services/dependency-installer.d.ts +0 -26
  306. package/dist/services/dependency-installer.d.ts.map +0 -1
  307. package/dist/services/dependency-installer.js +0 -134
  308. package/dist/services/dependency-installer.js.map +0 -1
  309. package/dist/services/git.service.d.ts +0 -27
  310. package/dist/services/git.service.d.ts.map +0 -1
  311. package/dist/services/git.service.js +0 -97
  312. package/dist/services/git.service.js.map +0 -1
  313. package/dist/services/github.service.d.ts +0 -14
  314. package/dist/services/github.service.d.ts.map +0 -1
  315. package/dist/services/github.service.js +0 -52
  316. package/dist/services/github.service.js.map +0 -1
  317. package/dist/services/worktree.service.d.ts +0 -20
  318. package/dist/services/worktree.service.d.ts.map +0 -1
  319. package/dist/services/worktree.service.js +0 -52
  320. package/dist/services/worktree.service.js.map +0 -1
  321. package/dist/shared/codingAgentConstants.d.ts +0 -12
  322. package/dist/shared/codingAgentConstants.d.ts.map +0 -1
  323. package/dist/shared/codingAgentConstants.js +0 -95
  324. package/dist/shared/codingAgentConstants.js.map +0 -1
  325. package/dist/types/api.d.ts +0 -225
  326. package/dist/types/api.d.ts.map +0 -1
  327. package/dist/types/api.js +0 -8
  328. package/dist/types/api.js.map +0 -1
  329. package/dist/types/coding-agent.d.ts +0 -62
  330. package/dist/types/coding-agent.d.ts.map +0 -1
  331. package/dist/types/coding-agent.js +0 -29
  332. package/dist/types/coding-agent.js.map +0 -1
  333. package/dist/types/profiles.d.ts +0 -54
  334. package/dist/types/profiles.d.ts.map +0 -1
  335. package/dist/types/profiles.js +0 -33
  336. package/dist/types/profiles.js.map +0 -1
  337. package/dist/types/tools.d.ts +0 -230
  338. package/dist/types/tools.d.ts.map +0 -1
  339. package/dist/types/tools.js +0 -8
  340. package/dist/types/tools.js.map +0 -1
  341. package/dist/utils/bun-runtime.d.ts +0 -12
  342. package/dist/utils/bun-runtime.d.ts.map +0 -1
  343. package/dist/utils/bun-runtime.js +0 -13
  344. package/dist/utils/bun-runtime.js.map +0 -1
  345. package/dist/utils/coding-agent-colors.d.ts +0 -88
  346. package/dist/utils/coding-agent-colors.d.ts.map +0 -1
  347. package/dist/utils/coding-agent-colors.js +0 -137
  348. package/dist/utils/coding-agent-colors.js.map +0 -1
  349. package/dist/utils/command.d.ts +0 -62
  350. package/dist/utils/command.d.ts.map +0 -1
  351. package/dist/utils/command.js +0 -186
  352. package/dist/utils/command.js.map +0 -1
  353. package/dist/utils/error-utils.d.ts +0 -27
  354. package/dist/utils/error-utils.d.ts.map +0 -1
  355. package/dist/utils/error-utils.js +0 -98
  356. package/dist/utils/error-utils.js.map +0 -1
  357. package/dist/utils/npmRegistry.d.ts +0 -61
  358. package/dist/utils/npmRegistry.d.ts.map +0 -1
  359. package/dist/utils/npmRegistry.js +0 -180
  360. package/dist/utils/npmRegistry.js.map +0 -1
  361. package/dist/utils/prompt.d.ts +0 -18
  362. package/dist/utils/prompt.d.ts.map +0 -1
  363. package/dist/utils/prompt.js +0 -107
  364. package/dist/utils/prompt.js.map +0 -1
  365. package/dist/utils/session/common.d.ts +0 -108
  366. package/dist/utils/session/common.d.ts.map +0 -1
  367. package/dist/utils/session/common.js +0 -439
  368. package/dist/utils/session/common.js.map +0 -1
  369. package/dist/utils/session/index.d.ts +0 -16
  370. package/dist/utils/session/index.d.ts.map +0 -1
  371. package/dist/utils/session/index.js +0 -20
  372. package/dist/utils/session/index.js.map +0 -1
  373. package/dist/utils/session/parsers/claude.d.ts +0 -62
  374. package/dist/utils/session/parsers/claude.d.ts.map +0 -1
  375. package/dist/utils/session/parsers/claude.js +0 -224
  376. package/dist/utils/session/parsers/claude.js.map +0 -1
  377. package/dist/utils/session/parsers/codex.d.ts +0 -37
  378. package/dist/utils/session/parsers/codex.d.ts.map +0 -1
  379. package/dist/utils/session/parsers/codex.js +0 -139
  380. package/dist/utils/session/parsers/codex.js.map +0 -1
  381. package/dist/utils/session/parsers/gemini.d.ts +0 -22
  382. package/dist/utils/session/parsers/gemini.d.ts.map +0 -1
  383. package/dist/utils/session/parsers/gemini.js +0 -118
  384. package/dist/utils/session/parsers/gemini.js.map +0 -1
  385. package/dist/utils/session/parsers/index.d.ts +0 -8
  386. package/dist/utils/session/parsers/index.d.ts.map +0 -1
  387. package/dist/utils/session/parsers/index.js +0 -12
  388. package/dist/utils/session/parsers/index.js.map +0 -1
  389. package/dist/utils/session/parsers/opencode.d.ts +0 -23
  390. package/dist/utils/session/parsers/opencode.d.ts.map +0 -1
  391. package/dist/utils/session/parsers/opencode.js +0 -126
  392. package/dist/utils/session/parsers/opencode.js.map +0 -1
  393. package/dist/utils/session/types.d.ts +0 -49
  394. package/dist/utils/session/types.d.ts.map +0 -1
  395. package/dist/utils/session/types.js +0 -5
  396. package/dist/utils/session/types.js.map +0 -1
  397. package/dist/utils/session.d.ts +0 -16
  398. package/dist/utils/session.d.ts.map +0 -1
  399. package/dist/utils/session.js +0 -16
  400. package/dist/utils/session.js.map +0 -1
  401. package/dist/utils/spinner.d.ts +0 -6
  402. package/dist/utils/spinner.d.ts.map +0 -1
  403. package/dist/utils/spinner.js +0 -47
  404. package/dist/utils/spinner.js.map +0 -1
  405. package/dist/utils/terminal.d.ts +0 -64
  406. package/dist/utils/terminal.d.ts.map +0 -1
  407. package/dist/utils/terminal.js +0 -270
  408. package/dist/utils/terminal.js.map +0 -1
  409. package/dist/utils/webui.d.ts +0 -8
  410. package/dist/utils/webui.d.ts.map +0 -1
  411. package/dist/utils/webui.js +0 -35
  412. package/dist/utils/webui.js.map +0 -1
  413. package/dist/utils.d.ts +0 -18
  414. package/dist/utils.d.ts.map +0 -1
  415. package/dist/utils.js +0 -79
  416. package/dist/utils.js.map +0 -1
  417. package/dist/web/client/src/components/BranchGraph.d.ts +0 -13
  418. package/dist/web/client/src/components/BranchGraph.d.ts.map +0 -1
  419. package/dist/web/client/src/components/BranchGraph.js +0 -49
  420. package/dist/web/client/src/components/BranchGraph.js.map +0 -1
  421. package/dist/web/client/src/components/CodingAgentLaunchModal.d.ts +0 -9
  422. package/dist/web/client/src/components/CodingAgentLaunchModal.d.ts.map +0 -1
  423. package/dist/web/client/src/components/CodingAgentLaunchModal.js +0 -354
  424. package/dist/web/client/src/components/CodingAgentLaunchModal.js.map +0 -1
  425. package/dist/web/client/src/components/CustomCodingAgentForm.d.ts +0 -23
  426. package/dist/web/client/src/components/CustomCodingAgentForm.d.ts.map +0 -1
  427. package/dist/web/client/src/components/CustomCodingAgentForm.js +0 -209
  428. package/dist/web/client/src/components/CustomCodingAgentForm.js.map +0 -1
  429. package/dist/web/client/src/components/CustomCodingAgentList.d.ts +0 -10
  430. package/dist/web/client/src/components/CustomCodingAgentList.d.ts.map +0 -1
  431. package/dist/web/client/src/components/CustomCodingAgentList.js +0 -57
  432. package/dist/web/client/src/components/CustomCodingAgentList.js.map +0 -1
  433. package/dist/web/client/src/components/EnvEditor.d.ts +0 -20
  434. package/dist/web/client/src/components/EnvEditor.d.ts.map +0 -1
  435. package/dist/web/client/src/components/EnvEditor.js +0 -75
  436. package/dist/web/client/src/components/EnvEditor.js.map +0 -1
  437. package/dist/web/client/src/components/EnvironmentEditor.d.ts +0 -17
  438. package/dist/web/client/src/components/EnvironmentEditor.d.ts.map +0 -1
  439. package/dist/web/client/src/components/EnvironmentEditor.js +0 -22
  440. package/dist/web/client/src/components/EnvironmentEditor.js.map +0 -1
  441. package/dist/web/client/src/components/Terminal.d.ts +0 -15
  442. package/dist/web/client/src/components/Terminal.d.ts.map +0 -1
  443. package/dist/web/client/src/components/Terminal.js +0 -119
  444. package/dist/web/client/src/components/Terminal.js.map +0 -1
  445. package/dist/web/client/src/components/branch-detail/BranchInfoCards.d.ts +0 -10
  446. package/dist/web/client/src/components/branch-detail/BranchInfoCards.d.ts.map +0 -1
  447. package/dist/web/client/src/components/branch-detail/BranchInfoCards.js +0 -107
  448. package/dist/web/client/src/components/branch-detail/BranchInfoCards.js.map +0 -1
  449. package/dist/web/client/src/components/branch-detail/SessionHistoryTable.d.ts +0 -22
  450. package/dist/web/client/src/components/branch-detail/SessionHistoryTable.d.ts.map +0 -1
  451. package/dist/web/client/src/components/branch-detail/SessionHistoryTable.js +0 -80
  452. package/dist/web/client/src/components/branch-detail/SessionHistoryTable.js.map +0 -1
  453. package/dist/web/client/src/components/branch-detail/TerminalPanel.d.ts +0 -11
  454. package/dist/web/client/src/components/branch-detail/TerminalPanel.d.ts.map +0 -1
  455. package/dist/web/client/src/components/branch-detail/TerminalPanel.js +0 -32
  456. package/dist/web/client/src/components/branch-detail/TerminalPanel.js.map +0 -1
  457. package/dist/web/client/src/components/branch-detail/ToolLauncher.d.ts +0 -40
  458. package/dist/web/client/src/components/branch-detail/ToolLauncher.d.ts.map +0 -1
  459. package/dist/web/client/src/components/branch-detail/ToolLauncher.js +0 -147
  460. package/dist/web/client/src/components/branch-detail/ToolLauncher.js.map +0 -1
  461. package/dist/web/client/src/components/branch-detail/index.d.ts +0 -5
  462. package/dist/web/client/src/components/branch-detail/index.d.ts.map +0 -1
  463. package/dist/web/client/src/components/branch-detail/index.js +0 -5
  464. package/dist/web/client/src/components/branch-detail/index.js.map +0 -1
  465. package/dist/web/client/src/components/common/BranchCard.d.ts +0 -17
  466. package/dist/web/client/src/components/common/BranchCard.d.ts.map +0 -1
  467. package/dist/web/client/src/components/common/BranchCard.js +0 -36
  468. package/dist/web/client/src/components/common/BranchCard.js.map +0 -1
  469. package/dist/web/client/src/components/common/MetricCard.d.ts +0 -10
  470. package/dist/web/client/src/components/common/MetricCard.d.ts.map +0 -1
  471. package/dist/web/client/src/components/common/MetricCard.js +0 -10
  472. package/dist/web/client/src/components/common/MetricCard.js.map +0 -1
  473. package/dist/web/client/src/components/common/PageHeader.d.ts +0 -12
  474. package/dist/web/client/src/components/common/PageHeader.d.ts.map +0 -1
  475. package/dist/web/client/src/components/common/PageHeader.js +0 -14
  476. package/dist/web/client/src/components/common/PageHeader.js.map +0 -1
  477. package/dist/web/client/src/components/common/SearchInput.d.ts +0 -14
  478. package/dist/web/client/src/components/common/SearchInput.d.ts.map +0 -1
  479. package/dist/web/client/src/components/common/SearchInput.js +0 -15
  480. package/dist/web/client/src/components/common/SearchInput.js.map +0 -1
  481. package/dist/web/client/src/components/common/StatusBadge.d.ts +0 -10
  482. package/dist/web/client/src/components/common/StatusBadge.d.ts.map +0 -1
  483. package/dist/web/client/src/components/common/StatusBadge.js +0 -15
  484. package/dist/web/client/src/components/common/StatusBadge.js.map +0 -1
  485. package/dist/web/client/src/components/common/index.d.ts +0 -6
  486. package/dist/web/client/src/components/common/index.d.ts.map +0 -1
  487. package/dist/web/client/src/components/common/index.js +0 -6
  488. package/dist/web/client/src/components/common/index.js.map +0 -1
  489. package/dist/web/client/src/components/graph/BranchDetailPanel.d.ts +0 -15
  490. package/dist/web/client/src/components/graph/BranchDetailPanel.d.ts.map +0 -1
  491. package/dist/web/client/src/components/graph/BranchDetailPanel.js +0 -57
  492. package/dist/web/client/src/components/graph/BranchDetailPanel.js.map +0 -1
  493. package/dist/web/client/src/components/graph/BranchNode.d.ts +0 -13
  494. package/dist/web/client/src/components/graph/BranchNode.d.ts.map +0 -1
  495. package/dist/web/client/src/components/graph/BranchNode.js +0 -103
  496. package/dist/web/client/src/components/graph/BranchNode.js.map +0 -1
  497. package/dist/web/client/src/components/graph/ClusterNode.d.ts +0 -13
  498. package/dist/web/client/src/components/graph/ClusterNode.d.ts.map +0 -1
  499. package/dist/web/client/src/components/graph/ClusterNode.js +0 -109
  500. package/dist/web/client/src/components/graph/ClusterNode.js.map +0 -1
  501. package/dist/web/client/src/components/graph/SynapticCanvas.d.ts +0 -17
  502. package/dist/web/client/src/components/graph/SynapticCanvas.d.ts.map +0 -1
  503. package/dist/web/client/src/components/graph/SynapticCanvas.js +0 -94
  504. package/dist/web/client/src/components/graph/SynapticCanvas.js.map +0 -1
  505. package/dist/web/client/src/components/graph/SynapticEdge.d.ts +0 -13
  506. package/dist/web/client/src/components/graph/SynapticEdge.d.ts.map +0 -1
  507. package/dist/web/client/src/components/graph/SynapticEdge.js +0 -113
  508. package/dist/web/client/src/components/graph/SynapticEdge.js.map +0 -1
  509. package/dist/web/client/src/components/graph/graphUtils.d.ts +0 -67
  510. package/dist/web/client/src/components/graph/graphUtils.d.ts.map +0 -1
  511. package/dist/web/client/src/components/graph/graphUtils.js +0 -175
  512. package/dist/web/client/src/components/graph/graphUtils.js.map +0 -1
  513. package/dist/web/client/src/components/graph/index.d.ts +0 -10
  514. package/dist/web/client/src/components/graph/index.d.ts.map +0 -1
  515. package/dist/web/client/src/components/graph/index.js +0 -10
  516. package/dist/web/client/src/components/graph/index.js.map +0 -1
  517. package/dist/web/client/src/components/ui/alert.d.ts +0 -9
  518. package/dist/web/client/src/components/ui/alert.d.ts.map +0 -1
  519. package/dist/web/client/src/components/ui/alert.js +0 -25
  520. package/dist/web/client/src/components/ui/alert.js.map +0 -1
  521. package/dist/web/client/src/components/ui/badge.d.ts +0 -10
  522. package/dist/web/client/src/components/ui/badge.d.ts.map +0 -1
  523. package/dist/web/client/src/components/ui/badge.js +0 -25
  524. package/dist/web/client/src/components/ui/badge.js.map +0 -1
  525. package/dist/web/client/src/components/ui/button.d.ts +0 -12
  526. package/dist/web/client/src/components/ui/button.d.ts.map +0 -1
  527. package/dist/web/client/src/components/ui/button.js +0 -33
  528. package/dist/web/client/src/components/ui/button.js.map +0 -1
  529. package/dist/web/client/src/components/ui/card.d.ts +0 -9
  530. package/dist/web/client/src/components/ui/card.d.ts.map +0 -1
  531. package/dist/web/client/src/components/ui/card.js +0 -16
  532. package/dist/web/client/src/components/ui/card.js.map +0 -1
  533. package/dist/web/client/src/components/ui/index.d.ts +0 -8
  534. package/dist/web/client/src/components/ui/index.d.ts.map +0 -1
  535. package/dist/web/client/src/components/ui/index.js +0 -8
  536. package/dist/web/client/src/components/ui/index.js.map +0 -1
  537. package/dist/web/client/src/components/ui/input.d.ts +0 -4
  538. package/dist/web/client/src/components/ui/input.d.ts.map +0 -1
  539. package/dist/web/client/src/components/ui/input.js +0 -8
  540. package/dist/web/client/src/components/ui/input.js.map +0 -1
  541. package/dist/web/client/src/components/ui/select.d.ts +0 -14
  542. package/dist/web/client/src/components/ui/select.d.ts.map +0 -1
  543. package/dist/web/client/src/components/ui/select.js +0 -39
  544. package/dist/web/client/src/components/ui/select.js.map +0 -1
  545. package/dist/web/client/src/components/ui/table.d.ts +0 -11
  546. package/dist/web/client/src/components/ui/table.d.ts.map +0 -1
  547. package/dist/web/client/src/components/ui/table.js +0 -21
  548. package/dist/web/client/src/components/ui/table.js.map +0 -1
  549. package/dist/web/client/src/hooks/useBranches.d.ts +0 -16
  550. package/dist/web/client/src/hooks/useBranches.d.ts.map +0 -1
  551. package/dist/web/client/src/hooks/useBranches.js +0 -35
  552. package/dist/web/client/src/hooks/useBranches.js.map +0 -1
  553. package/dist/web/client/src/hooks/useConfig.d.ts +0 -13
  554. package/dist/web/client/src/hooks/useConfig.d.ts.map +0 -1
  555. package/dist/web/client/src/hooks/useConfig.js +0 -27
  556. package/dist/web/client/src/hooks/useConfig.js.map +0 -1
  557. package/dist/web/client/src/hooks/useSessions.d.ts +0 -21
  558. package/dist/web/client/src/hooks/useSessions.d.ts.map +0 -1
  559. package/dist/web/client/src/hooks/useSessions.js +0 -54
  560. package/dist/web/client/src/hooks/useSessions.js.map +0 -1
  561. package/dist/web/client/src/hooks/useWorktrees.d.ts +0 -17
  562. package/dist/web/client/src/hooks/useWorktrees.d.ts.map +0 -1
  563. package/dist/web/client/src/hooks/useWorktrees.js +0 -41
  564. package/dist/web/client/src/hooks/useWorktrees.js.map +0 -1
  565. package/dist/web/client/src/lib/api.d.ts +0 -82
  566. package/dist/web/client/src/lib/api.d.ts.map +0 -1
  567. package/dist/web/client/src/lib/api.js +0 -147
  568. package/dist/web/client/src/lib/api.js.map +0 -1
  569. package/dist/web/client/src/lib/coding-agent-colors.d.ts +0 -86
  570. package/dist/web/client/src/lib/coding-agent-colors.d.ts.map +0 -1
  571. package/dist/web/client/src/lib/coding-agent-colors.js +0 -135
  572. package/dist/web/client/src/lib/coding-agent-colors.js.map +0 -1
  573. package/dist/web/client/src/lib/utils.d.ts +0 -7
  574. package/dist/web/client/src/lib/utils.d.ts.map +0 -1
  575. package/dist/web/client/src/lib/utils.js +0 -10
  576. package/dist/web/client/src/lib/utils.js.map +0 -1
  577. package/dist/web/client/src/lib/websocket.d.ts +0 -59
  578. package/dist/web/client/src/lib/websocket.d.ts.map +0 -1
  579. package/dist/web/client/src/lib/websocket.js +0 -182
  580. package/dist/web/client/src/lib/websocket.js.map +0 -1
  581. package/dist/web/client/src/main.d.ts +0 -2
  582. package/dist/web/client/src/main.d.ts.map +0 -1
  583. package/dist/web/client/src/main.js +0 -23
  584. package/dist/web/client/src/main.js.map +0 -1
  585. package/dist/web/client/src/pages/BranchDetailPage.d.ts +0 -3
  586. package/dist/web/client/src/pages/BranchDetailPage.d.ts.map +0 -1
  587. package/dist/web/client/src/pages/BranchDetailPage.js +0 -365
  588. package/dist/web/client/src/pages/BranchDetailPage.js.map +0 -1
  589. package/dist/web/client/src/pages/BranchListPage.d.ts +0 -3
  590. package/dist/web/client/src/pages/BranchListPage.d.ts.map +0 -1
  591. package/dist/web/client/src/pages/BranchListPage.js +0 -118
  592. package/dist/web/client/src/pages/BranchListPage.js.map +0 -1
  593. package/dist/web/client/src/pages/ConfigManagementPage.d.ts +0 -3
  594. package/dist/web/client/src/pages/ConfigManagementPage.d.ts.map +0 -1
  595. package/dist/web/client/src/pages/ConfigManagementPage.js +0 -132
  596. package/dist/web/client/src/pages/ConfigManagementPage.js.map +0 -1
  597. package/dist/web/client/src/pages/ConfigPage.d.ts +0 -3
  598. package/dist/web/client/src/pages/ConfigPage.d.ts.map +0 -1
  599. package/dist/web/client/src/pages/ConfigPage.js +0 -220
  600. package/dist/web/client/src/pages/ConfigPage.js.map +0 -1
  601. package/dist/web/client/src/router.d.ts +0 -9
  602. package/dist/web/client/src/router.d.ts.map +0 -1
  603. package/dist/web/client/src/router.js +0 -27
  604. package/dist/web/client/src/router.js.map +0 -1
  605. package/dist/web/client/vite.config.d.ts +0 -3
  606. package/dist/web/client/vite.config.d.ts.map +0 -1
  607. package/dist/web/client/vite.config.js +0 -28
  608. package/dist/web/client/vite.config.js.map +0 -1
  609. package/dist/web/server/env/importer.d.ts +0 -3
  610. package/dist/web/server/env/importer.d.ts.map +0 -1
  611. package/dist/web/server/env/importer.js +0 -51
  612. package/dist/web/server/env/importer.js.map +0 -1
  613. package/dist/web/server/index.d.ts +0 -33
  614. package/dist/web/server/index.d.ts.map +0 -1
  615. package/dist/web/server/index.js +0 -102
  616. package/dist/web/server/index.js.map +0 -1
  617. package/dist/web/server/pty/manager.d.ts +0 -54
  618. package/dist/web/server/pty/manager.d.ts.map +0 -1
  619. package/dist/web/server/pty/manager.js +0 -303
  620. package/dist/web/server/pty/manager.js.map +0 -1
  621. package/dist/web/server/routes/branches.d.ts +0 -11
  622. package/dist/web/server/routes/branches.d.ts.map +0 -1
  623. package/dist/web/server/routes/branches.js +0 -97
  624. package/dist/web/server/routes/branches.js.map +0 -1
  625. package/dist/web/server/routes/config.d.ts +0 -6
  626. package/dist/web/server/routes/config.d.ts.map +0 -1
  627. package/dist/web/server/routes/config.js +0 -162
  628. package/dist/web/server/routes/config.js.map +0 -1
  629. package/dist/web/server/routes/index.d.ts +0 -13
  630. package/dist/web/server/routes/index.d.ts.map +0 -1
  631. package/dist/web/server/routes/index.js +0 -29
  632. package/dist/web/server/routes/index.js.map +0 -1
  633. package/dist/web/server/routes/sessions.d.ts +0 -12
  634. package/dist/web/server/routes/sessions.d.ts.map +0 -1
  635. package/dist/web/server/routes/sessions.js +0 -176
  636. package/dist/web/server/routes/sessions.js.map +0 -1
  637. package/dist/web/server/routes/worktrees.d.ts +0 -11
  638. package/dist/web/server/routes/worktrees.d.ts.map +0 -1
  639. package/dist/web/server/routes/worktrees.js +0 -80
  640. package/dist/web/server/routes/worktrees.js.map +0 -1
  641. package/dist/web/server/services/branches.d.ts +0 -17
  642. package/dist/web/server/services/branches.d.ts.map +0 -1
  643. package/dist/web/server/services/branches.js +0 -275
  644. package/dist/web/server/services/branches.js.map +0 -1
  645. package/dist/web/server/services/worktrees.d.ts +0 -24
  646. package/dist/web/server/services/worktrees.d.ts.map +0 -1
  647. package/dist/web/server/services/worktrees.js +0 -66
  648. package/dist/web/server/services/worktrees.js.map +0 -1
  649. package/dist/web/server/tray.d.ts +0 -25
  650. package/dist/web/server/tray.d.ts.map +0 -1
  651. package/dist/web/server/tray.js +0 -116
  652. package/dist/web/server/tray.js.map +0 -1
  653. package/dist/web/server/types.d.ts +0 -4
  654. package/dist/web/server/types.d.ts.map +0 -1
  655. package/dist/web/server/types.js +0 -2
  656. package/dist/web/server/types.js.map +0 -1
  657. package/dist/web/server/websocket/handler.d.ts +0 -57
  658. package/dist/web/server/websocket/handler.d.ts.map +0 -1
  659. package/dist/web/server/websocket/handler.js +0 -220
  660. package/dist/web/server/websocket/handler.js.map +0 -1
  661. package/dist/worktree.d.ts +0 -117
  662. package/dist/worktree.d.ts.map +0 -1
  663. package/dist/worktree.js +0 -788
  664. package/dist/worktree.js.map +0 -1
  665. package/src/claude-history.ts +0 -717
  666. package/src/claude.ts +0 -557
  667. package/src/cli/ui/App.solid.tsx +0 -2145
  668. package/src/cli/ui/__tests__/solid/AppSolid.cleanup.test.tsx +0 -1175
  669. package/src/cli/ui/__tests__/solid/BranchListScreen.test.tsx +0 -343
  670. package/src/cli/ui/__tests__/solid/ConfirmScreen.test.tsx +0 -77
  671. package/src/cli/ui/__tests__/solid/LogScreen.test.tsx +0 -351
  672. package/src/cli/ui/__tests__/solid/components/QuickStartStep.test.tsx +0 -308
  673. package/src/cli/ui/__tests__/solid/components/WizardController.test.tsx +0 -71
  674. package/src/cli/ui/__tests__/solid/components/WizardPopup.test.tsx +0 -231
  675. package/src/cli/ui/__tests__/solid/components/WizardSteps.test.tsx +0 -331
  676. package/src/cli/ui/__tests__/utils/branchFormatter.test.ts +0 -702
  677. package/src/cli/ui/__tests__/utils/clipboard.test.ts +0 -65
  678. package/src/cli/ui/__tests__/utils/statisticsCalculator.test.ts +0 -243
  679. package/src/cli/ui/components/solid/Footer.tsx +0 -36
  680. package/src/cli/ui/components/solid/Header.tsx +0 -67
  681. package/src/cli/ui/components/solid/HelpOverlay.tsx +0 -194
  682. package/src/cli/ui/components/solid/QuickStartStep.tsx +0 -209
  683. package/src/cli/ui/components/solid/ScrollableList.tsx +0 -23
  684. package/src/cli/ui/components/solid/SearchInput.tsx +0 -42
  685. package/src/cli/ui/components/solid/SelectInput.tsx +0 -88
  686. package/src/cli/ui/components/solid/Stats.tsx +0 -92
  687. package/src/cli/ui/components/solid/TextInput.tsx +0 -49
  688. package/src/cli/ui/components/solid/WizardController.tsx +0 -457
  689. package/src/cli/ui/components/solid/WizardPopup.tsx +0 -135
  690. package/src/cli/ui/components/solid/WizardSteps.tsx +0 -781
  691. package/src/cli/ui/core/index.ts +0 -17
  692. package/src/cli/ui/core/keybindings.ts +0 -367
  693. package/src/cli/ui/core/theme.ts +0 -266
  694. package/src/cli/ui/core/types.ts +0 -235
  695. package/src/cli/ui/hooks/solid/useAsyncOperation.ts +0 -78
  696. package/src/cli/ui/hooks/solid/useFilter.ts +0 -86
  697. package/src/cli/ui/hooks/solid/useGitOperations.ts +0 -81
  698. package/src/cli/ui/hooks/solid/useKeyHandler.ts +0 -103
  699. package/src/cli/ui/hooks/solid/useScrollableList.ts +0 -149
  700. package/src/cli/ui/hooks/solid/useSelection.ts +0 -77
  701. package/src/cli/ui/hooks/solid/useTerminalSize.ts +0 -22
  702. package/src/cli/ui/index.solid.ts +0 -28
  703. package/src/cli/ui/screens/solid/BranchListScreen.tsx +0 -1153
  704. package/src/cli/ui/screens/solid/ConfirmScreen.tsx +0 -86
  705. package/src/cli/ui/screens/solid/EnvironmentScreen.tsx +0 -161
  706. package/src/cli/ui/screens/solid/ErrorScreen.tsx +0 -42
  707. package/src/cli/ui/screens/solid/InputScreen.tsx +0 -55
  708. package/src/cli/ui/screens/solid/LoadingIndicator.tsx +0 -77
  709. package/src/cli/ui/screens/solid/LogDetailScreen.tsx +0 -75
  710. package/src/cli/ui/screens/solid/LogScreen.tsx +0 -504
  711. package/src/cli/ui/screens/solid/ProfileEnvScreen.tsx +0 -196
  712. package/src/cli/ui/screens/solid/ProfileScreen.tsx +0 -98
  713. package/src/cli/ui/screens/solid/SelectorScreen.tsx +0 -181
  714. package/src/cli/ui/screens/solid/SettingsScreen.tsx +0 -52
  715. package/src/cli/ui/screens/solid/WorktreeCreateScreen.tsx +0 -136
  716. package/src/cli/ui/screens/solid/WorktreeDeleteScreen.tsx +0 -40
  717. package/src/cli/ui/stores/appStore.ts +0 -208
  718. package/src/cli/ui/stores/branchStore.ts +0 -357
  719. package/src/cli/ui/stores/index.ts +0 -31
  720. package/src/cli/ui/stores/uiStore.ts +0 -226
  721. package/src/cli/ui/types.ts +0 -371
  722. package/src/cli/ui/utils/__tests__/branchFormatter.test.ts +0 -227
  723. package/src/cli/ui/utils/__tests__/installedVersionCache.test.ts +0 -46
  724. package/src/cli/ui/utils/baseBranch.ts +0 -34
  725. package/src/cli/ui/utils/branchFormatter.ts +0 -222
  726. package/src/cli/ui/utils/clipboard.ts +0 -31
  727. package/src/cli/ui/utils/continueSession.ts +0 -231
  728. package/src/cli/ui/utils/installedVersionCache.ts +0 -84
  729. package/src/cli/ui/utils/modelOptions.test.ts +0 -98
  730. package/src/cli/ui/utils/modelOptions.ts +0 -169
  731. package/src/cli/ui/utils/statisticsCalculator.ts +0 -44
  732. package/src/cli/ui/utils/versionCache.ts +0 -93
  733. package/src/cli/ui/utils/versionFetcher.ts +0 -120
  734. package/src/codex.ts +0 -445
  735. package/src/config/__tests__/saveSession.test.ts +0 -143
  736. package/src/config/builtin-coding-agents.ts +0 -87
  737. package/src/config/constants.ts +0 -102
  738. package/src/config/env-history.ts +0 -45
  739. package/src/config/index.ts +0 -311
  740. package/src/config/profiles.ts +0 -359
  741. package/src/config/shared-env.ts +0 -139
  742. package/src/config/tools.ts +0 -319
  743. package/src/gemini.ts +0 -405
  744. package/src/git.ts +0 -1263
  745. package/src/github.ts +0 -158
  746. package/src/index.test.ts +0 -93
  747. package/src/index.ts +0 -1024
  748. package/src/launcher.ts +0 -235
  749. package/src/logging/agentOutput.ts +0 -216
  750. package/src/logging/formatter.ts +0 -125
  751. package/src/logging/logger.ts +0 -106
  752. package/src/logging/reader.ts +0 -240
  753. package/src/logging/rotation.ts +0 -25
  754. package/src/opentui/index.solid.ts +0 -1
  755. package/src/repositories/git.repository.ts +0 -129
  756. package/src/repositories/github.repository.ts +0 -83
  757. package/src/repositories/worktree.repository.ts +0 -77
  758. package/src/services/BatchMergeService.ts +0 -251
  759. package/src/services/WorktreeOrchestrator.ts +0 -115
  760. package/src/services/__tests__/BatchMergeService.test.ts +0 -534
  761. package/src/services/__tests__/WorktreeOrchestrator.test.ts +0 -259
  762. package/src/services/codingAgentCommandResolver.ts +0 -118
  763. package/src/services/codingAgentResolver.ts +0 -375
  764. package/src/services/dependency-installer.ts +0 -192
  765. package/src/services/git.service.ts +0 -115
  766. package/src/services/github.service.ts +0 -61
  767. package/src/services/worktree.service.ts +0 -66
  768. package/src/shared/codingAgentConstants.ts +0 -103
  769. package/src/trayicon.d.ts +0 -30
  770. package/src/types/api.ts +0 -256
  771. package/src/types/coding-agent.ts +0 -85
  772. package/src/types/profiles.ts +0 -64
  773. package/src/types/tools.ts +0 -269
  774. package/src/utils/__tests__/npmRegistry.test.ts +0 -250
  775. package/src/utils/__tests__/prompt.test.ts +0 -125
  776. package/src/utils/bun-runtime.ts +0 -29
  777. package/src/utils/coding-agent-colors.ts +0 -165
  778. package/src/utils/command.ts +0 -234
  779. package/src/utils/error-utils.ts +0 -133
  780. package/src/utils/npmRegistry.ts +0 -249
  781. package/src/utils/prompt.ts +0 -149
  782. package/src/utils/session/common.ts +0 -474
  783. package/src/utils/session/index.ts +0 -50
  784. package/src/utils/session/parsers/claude.ts +0 -283
  785. package/src/utils/session/parsers/codex.ts +0 -166
  786. package/src/utils/session/parsers/gemini.ts +0 -135
  787. package/src/utils/session/parsers/index.ts +0 -31
  788. package/src/utils/session/parsers/opencode.ts +0 -151
  789. package/src/utils/session/types.ts +0 -51
  790. package/src/utils/session.ts +0 -16
  791. package/src/utils/spinner.ts +0 -54
  792. package/src/utils/terminal.ts +0 -327
  793. package/src/utils/webui.ts +0 -43
  794. package/src/utils.test.ts +0 -43
  795. package/src/utils.ts +0 -93
  796. package/src/web/client/components.json +0 -21
  797. package/src/web/client/index.html +0 -12
  798. package/src/web/client/src/components/BranchGraph.tsx +0 -95
  799. package/src/web/client/src/components/CodingAgentLaunchModal.tsx +0 -570
  800. package/src/web/client/src/components/CustomCodingAgentForm.tsx +0 -386
  801. package/src/web/client/src/components/CustomCodingAgentList.tsx +0 -119
  802. package/src/web/client/src/components/EnvEditor.tsx +0 -188
  803. package/src/web/client/src/components/EnvironmentEditor.tsx +0 -97
  804. package/src/web/client/src/components/Terminal.tsx +0 -145
  805. package/src/web/client/src/components/branch-detail/BranchInfoCards.tsx +0 -193
  806. package/src/web/client/src/components/branch-detail/SessionHistoryTable.tsx +0 -187
  807. package/src/web/client/src/components/branch-detail/TerminalPanel.tsx +0 -92
  808. package/src/web/client/src/components/branch-detail/ToolLauncher.tsx +0 -332
  809. package/src/web/client/src/components/branch-detail/index.ts +0 -4
  810. package/src/web/client/src/components/common/BranchCard.tsx +0 -117
  811. package/src/web/client/src/components/common/MetricCard.tsx +0 -22
  812. package/src/web/client/src/components/common/PageHeader.tsx +0 -44
  813. package/src/web/client/src/components/common/SearchInput.tsx +0 -40
  814. package/src/web/client/src/components/common/StatusBadge.tsx +0 -37
  815. package/src/web/client/src/components/common/index.ts +0 -5
  816. package/src/web/client/src/components/graph/BranchDetailPanel.tsx +0 -152
  817. package/src/web/client/src/components/graph/BranchNode.tsx +0 -200
  818. package/src/web/client/src/components/graph/ClusterNode.tsx +0 -211
  819. package/src/web/client/src/components/graph/SynapticCanvas.tsx +0 -171
  820. package/src/web/client/src/components/graph/SynapticEdge.tsx +0 -311
  821. package/src/web/client/src/components/graph/graphUtils.ts +0 -265
  822. package/src/web/client/src/components/graph/index.ts +0 -10
  823. package/src/web/client/src/components/ui/alert.tsx +0 -63
  824. package/src/web/client/src/components/ui/badge.tsx +0 -44
  825. package/src/web/client/src/components/ui/button.tsx +0 -57
  826. package/src/web/client/src/components/ui/card.tsx +0 -82
  827. package/src/web/client/src/components/ui/index.ts +0 -32
  828. package/src/web/client/src/components/ui/input.tsx +0 -21
  829. package/src/web/client/src/components/ui/select.tsx +0 -156
  830. package/src/web/client/src/components/ui/table.tsx +0 -119
  831. package/src/web/client/src/hooks/useBranches.ts +0 -41
  832. package/src/web/client/src/hooks/useConfig.ts +0 -31
  833. package/src/web/client/src/hooks/useSessions.ts +0 -68
  834. package/src/web/client/src/hooks/useWorktrees.ts +0 -47
  835. package/src/web/client/src/index.css +0 -349
  836. package/src/web/client/src/lib/api.ts +0 -184
  837. package/src/web/client/src/lib/coding-agent-colors.ts +0 -149
  838. package/src/web/client/src/lib/utils.ts +0 -10
  839. package/src/web/client/src/lib/websocket.ts +0 -222
  840. package/src/web/client/src/main.tsx +0 -29
  841. package/src/web/client/src/pages/BranchDetailPage.tsx +0 -555
  842. package/src/web/client/src/pages/BranchListPage.tsx +0 -242
  843. package/src/web/client/src/pages/ConfigManagementPage.tsx +0 -248
  844. package/src/web/client/src/pages/ConfigPage.tsx +0 -368
  845. package/src/web/client/src/router.tsx +0 -27
  846. package/src/web/client/vite.config.ts +0 -28
  847. package/src/web/server/env/importer.ts +0 -62
  848. package/src/web/server/index.ts +0 -143
  849. package/src/web/server/pty/manager.ts +0 -443
  850. package/src/web/server/routes/branches.ts +0 -126
  851. package/src/web/server/routes/config.ts +0 -226
  852. package/src/web/server/routes/index.ts +0 -37
  853. package/src/web/server/routes/sessions.ts +0 -252
  854. package/src/web/server/routes/worktrees.ts +0 -108
  855. package/src/web/server/services/branches.ts +0 -387
  856. package/src/web/server/services/worktrees.ts +0 -93
  857. package/src/web/server/tray.ts +0 -136
  858. package/src/web/server/types.ts +0 -14
  859. package/src/web/server/websocket/handler.ts +0 -299
  860. package/src/worktree.ts +0 -1109
package/src/git.ts DELETED
@@ -1,1263 +0,0 @@
1
- import { execa } from "execa";
2
- import path from "node:path";
3
- import { BranchInfo } from "./cli/ui/types.js";
4
- import { GIT_CONFIG } from "./config/constants.js";
5
-
6
- export class GitError extends Error {
7
- constructor(
8
- message: string,
9
- public cause?: unknown,
10
- ) {
11
- super(message);
12
- this.name = "GitError";
13
- }
14
- }
15
-
16
- /**
17
- * 現在のディレクトリがGitリポジトリかどうかを確認
18
- * Worktree環境でも動作するように、.gitファイルの存在も確認します
19
- * @returns {Promise<boolean>} Gitリポジトリの場合true
20
- */
21
- export async function isGitRepository(): Promise<boolean> {
22
- try {
23
- // まず.gitの存在を確認(ディレクトリまたはファイル)
24
- const fs = await import("node:fs");
25
- const gitPath = path.join(process.cwd(), ".git");
26
-
27
- if (fs.existsSync(gitPath)) {
28
- // .gitが存在する場合、Git環境として認識
29
- if (process.env.DEBUG) {
30
- const stats = fs.statSync(gitPath);
31
- console.error(
32
- `[DEBUG] .git exists: ${gitPath} (${stats.isDirectory() ? "directory" : "file"})`,
33
- );
34
- }
35
- return true;
36
- }
37
-
38
- // .gitが存在しない場合、git rev-parseで確認
39
- const result = await execa("git", ["rev-parse", "--git-dir"]);
40
- if (process.env.DEBUG) {
41
- console.error(`[DEBUG] git rev-parse --git-dir: ${result.stdout}`);
42
- }
43
- return true;
44
- } catch (error: unknown) {
45
- // Debug: log the error for troubleshooting
46
- if (process.env.DEBUG) {
47
- const message = error instanceof Error ? error.message : String(error);
48
- const stderr =
49
- typeof error === "object" && error !== null && "stderr" in error
50
- ? (error as { stderr?: string }).stderr
51
- : undefined;
52
- console.error(`[DEBUG] git rev-parse --git-dir failed:`, message);
53
- if (stderr) {
54
- console.error(`[DEBUG] stderr:`, stderr);
55
- }
56
- }
57
- return false;
58
- }
59
- }
60
-
61
- /**
62
- * Gitリポジトリのルートディレクトリを取得
63
- * @returns {Promise<string>} リポジトリのルートパス
64
- * @throws {GitError} リポジトリルートの取得に失敗した場合
65
- */
66
- export async function getRepositoryRoot(): Promise<string> {
67
- const fs = await import("node:fs");
68
- const path = await import("node:path");
69
-
70
- const toExistingDir = (p: string): string => {
71
- let current = path.resolve(p);
72
- while (!fs.existsSync(current) && path.dirname(current) !== current) {
73
- current = path.dirname(current);
74
- }
75
- if (!fs.existsSync(current)) {
76
- return current;
77
- }
78
- try {
79
- const stat = fs.statSync(current);
80
- return stat.isDirectory() ? current : path.dirname(current);
81
- } catch {
82
- return current;
83
- }
84
- };
85
-
86
- // 1) show-toplevel を最優先
87
- try {
88
- const { stdout } = await execa("git", ["rev-parse", "--show-toplevel"]);
89
- const top = stdout.trim();
90
- if (top) {
91
- const marker = `${path.sep}.worktrees${path.sep}`;
92
- const idx = top.indexOf(marker);
93
- if (idx >= 0) {
94
- // /repo/.worktrees/<name> → repo root = /repo
95
- const parent = top.slice(0, idx);
96
- const upTwo = path.resolve(top, "..", "..");
97
- if (fs.existsSync(parent)) return toExistingDir(parent);
98
- if (fs.existsSync(upTwo)) return toExistingDir(upTwo);
99
- }
100
- if (fs.existsSync(top)) {
101
- return toExistingDir(top);
102
- }
103
- return toExistingDir(path.resolve(top, ".."));
104
- }
105
- } catch {
106
- // fallback
107
- }
108
-
109
- // 2) git-common-dir 経由
110
- try {
111
- const { stdout: gitCommonDir } = await execa("git", [
112
- "rev-parse",
113
- "--git-common-dir",
114
- ]);
115
- const gitDir = path.resolve(gitCommonDir.trim());
116
- const parts = gitDir.split(path.sep);
117
- const idxWorktrees = parts.lastIndexOf("worktrees");
118
- if (idxWorktrees > 0) {
119
- const repo = parts.slice(0, idxWorktrees).join(path.sep);
120
- if (fs.existsSync(repo)) return toExistingDir(repo);
121
- }
122
- const idxGit = parts.lastIndexOf(".git");
123
- if (idxGit > 0) {
124
- const repo = parts.slice(0, idxGit).join(path.sep);
125
- if (fs.existsSync(repo)) return toExistingDir(repo);
126
- }
127
- return toExistingDir(path.dirname(gitDir));
128
- } catch {
129
- // fallback
130
- }
131
-
132
- // 3) .git を上に辿って探す
133
- let current = process.cwd();
134
- const root = path.parse(current).root;
135
- while (true) {
136
- const candidate = path.join(current, ".git");
137
- if (fs.existsSync(candidate)) {
138
- if (fs.statSync(candidate).isDirectory()) {
139
- return toExistingDir(current);
140
- }
141
- try {
142
- const content = fs.readFileSync(candidate, "utf-8");
143
- const match = content.match(/gitdir:\s*(.+)\s*/i);
144
- const gitDirMatch = match?.[1];
145
- if (gitDirMatch) {
146
- const gitDirPath = path.resolve(current, gitDirMatch.trim());
147
- const parts = gitDirPath.split(path.sep);
148
- const idxWT = parts.lastIndexOf("worktrees");
149
- if (idxWT > 0) {
150
- const repo = parts.slice(0, idxWT).join(path.sep);
151
- return toExistingDir(repo);
152
- }
153
- return toExistingDir(path.dirname(gitDirPath));
154
- }
155
- } catch {
156
- // ignore and continue
157
- }
158
- }
159
- if (current === root) break;
160
- current = path.dirname(current);
161
- }
162
-
163
- throw new GitError("Failed to get repository root");
164
- }
165
-
166
- /**
167
- * 現在の作業ツリー(root branch か worktree かを問わず)のルートディレクトリを取得
168
- * @returns {Promise<string>} カレントWorktreeのルートパス
169
- * @throws {GitError} 取得に失敗した場合
170
- */
171
- export async function getWorktreeRoot(): Promise<string> {
172
- try {
173
- const { stdout } = await execa("git", ["rev-parse", "--show-toplevel"]);
174
- return stdout.trim();
175
- } catch (error) {
176
- throw new GitError("Failed to get worktree root", error);
177
- }
178
- }
179
-
180
- export async function getCurrentBranch(cwd?: string): Promise<string | null> {
181
- try {
182
- const workDir = cwd ?? (await getRepositoryRoot());
183
- const { stdout } = await execa("git", ["branch", "--show-current"], {
184
- cwd: workDir,
185
- });
186
- return stdout.trim() || null;
187
- } catch {
188
- try {
189
- const { stdout } = await execa("git", ["branch", "--show-current"]);
190
- return stdout.trim() || null;
191
- } catch {
192
- return null;
193
- }
194
- }
195
- }
196
-
197
- async function getBranchCommitTimestamps(
198
- refs: string[],
199
- cwd?: string,
200
- ): Promise<Map<string, number>> {
201
- try {
202
- const { stdout = "" } = (await execa(
203
- "git",
204
- [
205
- "for-each-ref",
206
- "--format=%(refname:short)%00%(committerdate:unix)",
207
- ...refs,
208
- ],
209
- cwd ? { cwd } : undefined,
210
- )) ?? { stdout: "" };
211
-
212
- const map = new Map<string, number>();
213
-
214
- for (const line of stdout.split("\n")) {
215
- if (!line) continue;
216
- const [ref, timestamp] = line.split("\0");
217
- if (!ref || !timestamp) continue;
218
- if (ref.endsWith("/HEAD")) continue;
219
- const parsed = Number.parseInt(timestamp, 10);
220
- if (Number.isNaN(parsed)) continue;
221
- map.set(ref, parsed);
222
- }
223
-
224
- return map;
225
- } catch (error) {
226
- throw new GitError("Failed to get branch commit timestamps", error);
227
- }
228
- }
229
-
230
- export async function getLocalBranches(cwd?: string): Promise<BranchInfo[]> {
231
- try {
232
- const execOptions = cwd ? { cwd } : undefined;
233
- const commitMap = await getBranchCommitTimestamps(["refs/heads"], cwd);
234
- const { stdout = "" } = (await execa(
235
- "git",
236
- ["branch", "--format=%(refname:short)"],
237
- execOptions,
238
- )) ?? { stdout: "" };
239
- return stdout
240
- .split("\n")
241
- .filter((line) => line.trim())
242
- .map((name) => {
243
- const trimmed = name.trim();
244
- const timestamp = commitMap.get(trimmed);
245
-
246
- return {
247
- name: trimmed,
248
- type: "local" as const,
249
- branchType: getBranchType(trimmed),
250
- isCurrent: false,
251
- ...(timestamp !== undefined
252
- ? { latestCommitTimestamp: timestamp }
253
- : {}),
254
- } satisfies BranchInfo;
255
- });
256
- } catch (primaryError) {
257
- throw new GitError("Failed to get local branches", primaryError);
258
- }
259
- }
260
-
261
- export async function getRemoteBranches(cwd?: string): Promise<BranchInfo[]> {
262
- try {
263
- const execOptions = cwd ? { cwd } : undefined;
264
- const commitMap = await getBranchCommitTimestamps(["refs/remotes"], cwd);
265
- const { stdout = "" } = (await execa(
266
- "git",
267
- ["branch", "-r", "--format=%(refname:short)"],
268
- execOptions,
269
- )) ?? { stdout: "" };
270
- return stdout
271
- .split("\n")
272
- .filter((line) => line.trim() && !line.includes("HEAD"))
273
- .map((line) => {
274
- const name = line.trim();
275
- const branchName = name.replace(/^origin\//, "");
276
- const timestamp = commitMap.get(name);
277
-
278
- return {
279
- name,
280
- type: "remote" as const,
281
- branchType: getBranchType(branchName),
282
- isCurrent: false,
283
- ...(timestamp !== undefined
284
- ? { latestCommitTimestamp: timestamp }
285
- : {}),
286
- } satisfies BranchInfo;
287
- });
288
- } catch (primaryError) {
289
- throw new GitError("Failed to get remote branches", primaryError);
290
- }
291
- }
292
-
293
- /**
294
- * ローカルとリモートのすべてのブランチ情報を取得
295
- * @param cwd - 作業ディレクトリ(省略時はリポジトリルート)
296
- * @returns {Promise<BranchInfo[]>} ブランチ情報の配列
297
- */
298
- export async function getAllBranches(cwd?: string): Promise<BranchInfo[]> {
299
- const [localBranches, remoteBranches, currentBranch] = await Promise.all([
300
- getLocalBranches(cwd),
301
- getRemoteBranches(cwd),
302
- getCurrentBranch(cwd),
303
- ]);
304
-
305
- // 現在のブランチ情報を設定
306
- if (currentBranch) {
307
- localBranches.forEach((branch) => {
308
- if (branch.name === currentBranch) {
309
- branch.isCurrent = true;
310
- }
311
- });
312
- }
313
-
314
- return [...localBranches, ...remoteBranches];
315
- }
316
-
317
- /**
318
- * ローカルブランチのupstream(追跡ブランチ)情報を取得
319
- * @param cwd - 作業ディレクトリ(省略時はリポジトリルート)
320
- * @returns Map<ローカルブランチ名, upstreamブランチ名>
321
- */
322
- export async function collectUpstreamMap(
323
- cwd?: string,
324
- ): Promise<Map<string, string>> {
325
- const workDir = cwd ?? (await getRepositoryRoot());
326
- try {
327
- const { stdout } = await execa(
328
- "git",
329
- [
330
- "for-each-ref",
331
- "--format=%(refname:short)|%(upstream:short)",
332
- "refs/heads",
333
- ],
334
- { cwd: workDir },
335
- );
336
-
337
- return stdout
338
- .split("\n")
339
- .filter((line) => line.includes("|"))
340
- .reduce((map, line) => {
341
- const [branch, upstream] = line.split("|");
342
- if (branch?.trim() && upstream?.trim()) {
343
- map.set(branch.trim(), upstream.trim());
344
- }
345
- return map;
346
- }, new Map<string, string>());
347
- } catch {
348
- return new Map();
349
- }
350
- }
351
-
352
- export async function createBranch(
353
- branchName: string,
354
- baseBranch = "main",
355
- ): Promise<void> {
356
- try {
357
- await execa("git", ["checkout", "-b", branchName, baseBranch]);
358
- } catch (error) {
359
- throw new GitError(`Failed to create branch ${branchName}`, error);
360
- }
361
- }
362
-
363
- export async function branchExists(branchName: string): Promise<boolean> {
364
- try {
365
- await execa("git", [
366
- "show-ref",
367
- "--verify",
368
- "--quiet",
369
- `refs/heads/${branchName}`,
370
- ]);
371
- return true;
372
- } catch {
373
- return false;
374
- }
375
- }
376
-
377
- export async function deleteBranch(
378
- branchName: string,
379
- force = false,
380
- ): Promise<void> {
381
- try {
382
- const args = ["branch", force ? "-D" : "-d", branchName];
383
- await execa("git", args);
384
- } catch (error) {
385
- throw new GitError(`Failed to delete branch ${branchName}`, error);
386
- }
387
- }
388
-
389
- interface WorktreeStatusResult {
390
- hasChanges: boolean;
391
- changedFilesCount: number;
392
- }
393
-
394
- async function getWorkdirStatus(
395
- worktreePath: string,
396
- ): Promise<WorktreeStatusResult> {
397
- try {
398
- // ファイルシステムの存在確認のためにfs.existsSyncを使用
399
- const fs = await import("node:fs");
400
- if (!fs.existsSync(worktreePath)) {
401
- // worktreeパスが存在しない場合はデフォルト値を返す
402
- return {
403
- hasChanges: false,
404
- changedFilesCount: 0,
405
- };
406
- }
407
-
408
- const { stdout } = await execa("git", ["status", "--porcelain"], {
409
- cwd: worktreePath,
410
- });
411
- const lines = stdout.split("\n").filter((line) => line.trim());
412
- return {
413
- hasChanges: lines.length > 0,
414
- changedFilesCount: lines.length,
415
- };
416
- } catch (error) {
417
- throw new GitError(
418
- `Failed to get worktree status for path: ${worktreePath}`,
419
- error,
420
- );
421
- }
422
- }
423
-
424
- export async function hasUncommittedChanges(
425
- worktreePath: string,
426
- ): Promise<boolean> {
427
- const status = await getWorkdirStatus(worktreePath);
428
- return status.hasChanges;
429
- }
430
-
431
- export async function getChangedFilesCount(
432
- worktreePath: string,
433
- ): Promise<number> {
434
- const status = await getWorkdirStatus(worktreePath);
435
- return status.changedFilesCount;
436
- }
437
-
438
- export async function showStatus(worktreePath: string): Promise<string> {
439
- try {
440
- const { stdout } = await execa("git", ["status"], { cwd: worktreePath });
441
- return stdout;
442
- } catch (error) {
443
- throw new GitError("Failed to show status", error);
444
- }
445
- }
446
-
447
- export async function stashChanges(
448
- worktreePath: string,
449
- message?: string,
450
- ): Promise<void> {
451
- try {
452
- const args = message ? ["stash", "push", "-m", message] : ["stash"];
453
- await execa("git", args, { cwd: worktreePath });
454
- } catch (error) {
455
- throw new GitError("Failed to stash changes", error);
456
- }
457
- }
458
-
459
- export async function discardAllChanges(worktreePath: string): Promise<void> {
460
- try {
461
- // Reset tracked files
462
- await execa("git", ["reset", "--hard"], { cwd: worktreePath });
463
- // Clean untracked files
464
- await execa("git", ["clean", "-fd"], { cwd: worktreePath });
465
- } catch (error) {
466
- throw new GitError("Failed to discard changes", error);
467
- }
468
- }
469
-
470
- export async function commitChanges(
471
- worktreePath: string,
472
- message: string,
473
- ): Promise<void> {
474
- try {
475
- // Add all changes
476
- await execa("git", ["add", "-A"], { cwd: worktreePath });
477
- // Commit
478
- await execa("git", ["commit", "-m", message], { cwd: worktreePath });
479
- } catch (error) {
480
- throw new GitError("Failed to commit changes", error);
481
- }
482
- }
483
-
484
- function getBranchType(branchName: string): BranchInfo["branchType"] {
485
- if (branchName === "main" || branchName === "master") return "main";
486
- if (branchName === "develop" || branchName === "dev") return "develop";
487
- if (branchName.startsWith("feature/")) return "feature";
488
- if (branchName.startsWith("bugfix/") || branchName.startsWith("bug/"))
489
- return "bugfix";
490
- if (branchName.startsWith("hotfix/")) return "hotfix";
491
- if (branchName.startsWith("release/")) return "release";
492
- return "other";
493
- }
494
-
495
- async function hasUnpushedCommitsInternal(
496
- branch: string,
497
- options: { cwd?: string } = {},
498
- ): Promise<boolean> {
499
- const { cwd } = options;
500
- const execOptions = cwd ? { cwd } : undefined;
501
- try {
502
- const { stdout } = await execa(
503
- "git",
504
- ["log", `origin/${branch}..${branch}`, "--oneline"],
505
- execOptions,
506
- );
507
- return stdout.trim().length > 0;
508
- } catch {
509
- const candidates = [
510
- `origin/${branch}`,
511
- "origin/main",
512
- "origin/master",
513
- "origin/develop",
514
- "origin/dev",
515
- branch,
516
- "main",
517
- "master",
518
- "develop",
519
- "dev",
520
- ];
521
-
522
- for (const candidate of candidates) {
523
- try {
524
- await execa("git", ["rev-parse", "--verify", candidate], execOptions);
525
-
526
- // If we are checking the same branch again, we already know the remote ref is missing.
527
- if (candidate === `origin/${branch}` || candidate === branch) {
528
- continue;
529
- }
530
-
531
- try {
532
- await execa(
533
- "git",
534
- ["merge-base", "--is-ancestor", branch, candidate],
535
- execOptions,
536
- );
537
- return false;
538
- } catch {
539
- // Not merged into this candidate, try next one.
540
- }
541
- } catch {
542
- // Candidate ref does not exist. Try the next candidate.
543
- }
544
- }
545
-
546
- // Could not prove that the branch is merged anywhere safe, treat as unpushed commits.
547
- return true;
548
- }
549
- }
550
-
551
- export async function hasUnpushedCommits(
552
- worktreePath: string,
553
- branch: string,
554
- ): Promise<boolean> {
555
- return hasUnpushedCommitsInternal(branch, { cwd: worktreePath });
556
- }
557
-
558
- export async function hasUnpushedCommitsInRepo(
559
- branch: string,
560
- repoRoot?: string,
561
- ): Promise<boolean> {
562
- return hasUnpushedCommitsInternal(branch, repoRoot ? { cwd: repoRoot } : {});
563
- }
564
-
565
- export async function branchHasUniqueCommitsComparedToBase(
566
- branch: string,
567
- baseBranch: string,
568
- repoRoot?: string,
569
- ): Promise<boolean> {
570
- const execOptions = repoRoot ? { cwd: repoRoot } : undefined;
571
- try {
572
- await execa("git", ["rev-parse", "--verify", branch], execOptions);
573
- } catch {
574
- return true;
575
- }
576
-
577
- const normalizedBase = baseBranch.trim();
578
- if (!normalizedBase) {
579
- return true;
580
- }
581
-
582
- const candidates = new Set<string>();
583
- candidates.add(normalizedBase);
584
-
585
- if (!normalizedBase.startsWith("origin/")) {
586
- candidates.add(`origin/${normalizedBase}`);
587
- } else {
588
- const localEquivalent = normalizedBase.replace(/^origin\//, "");
589
- if (localEquivalent) {
590
- candidates.add(localEquivalent);
591
- }
592
- }
593
-
594
- for (const candidate of candidates) {
595
- try {
596
- await execa("git", ["rev-parse", "--verify", candidate], execOptions);
597
- } catch {
598
- continue;
599
- }
600
-
601
- try {
602
- const { stdout } = await execa(
603
- "git",
604
- ["log", `${candidate}..${branch}`, "--oneline"],
605
- execOptions,
606
- );
607
-
608
- if (stdout.trim().length > 0) {
609
- return true;
610
- }
611
-
612
- return false;
613
- } catch {
614
- // Comparison failed for this candidate, try next one.
615
- }
616
- }
617
-
618
- // If no valid base candidate was found, treat the branch as having unique commits.
619
- return true;
620
- }
621
-
622
- /**
623
- * Get the latest commit message for a specific branch in a worktree
624
- */
625
- export async function getLatestCommitMessage(
626
- worktreePath: string,
627
- branch: string,
628
- ): Promise<string | null> {
629
- try {
630
- const { stdout } = await execa(
631
- "git",
632
- ["log", "-1", "--pretty=format:%s", branch],
633
- { cwd: worktreePath },
634
- );
635
- return stdout.trim() || null;
636
- } catch {
637
- return null;
638
- }
639
- }
640
-
641
- /**
642
- * Get the count of unpushed commits
643
- */
644
- export async function getUnpushedCommitsCount(
645
- worktreePath: string,
646
- branch: string,
647
- ): Promise<number> {
648
- try {
649
- const { stdout } = await execa(
650
- "git",
651
- ["rev-list", "--count", `origin/${branch}..${branch}`],
652
- { cwd: worktreePath },
653
- );
654
- return parseInt(stdout.trim(), 10) || 0;
655
- } catch {
656
- return 0;
657
- }
658
- }
659
-
660
- /**
661
- * Get the count of uncommitted changes (staged + unstaged)
662
- */
663
- export async function getUncommittedChangesCount(
664
- worktreePath: string,
665
- ): Promise<number> {
666
- try {
667
- const { stdout } = await execa("git", ["status", "--porcelain"], {
668
- cwd: worktreePath,
669
- });
670
- return stdout
671
- .trim()
672
- .split("\n")
673
- .filter((line) => line.trim()).length;
674
- } catch {
675
- return 0;
676
- }
677
- }
678
-
679
- /**
680
- * Enhanced session information for better display
681
- */
682
- export interface EnhancedSessionInfo {
683
- hasUncommittedChanges: boolean;
684
- uncommittedChangesCount: number;
685
- hasUnpushedCommits: boolean;
686
- unpushedCommitsCount: number;
687
- latestCommitMessage: string | null;
688
- branchType:
689
- | "feature"
690
- | "bugfix"
691
- | "hotfix"
692
- | "develop"
693
- | "main"
694
- | "master"
695
- | "other";
696
- }
697
-
698
- /**
699
- * Get enhanced session information for display
700
- */
701
- export async function getEnhancedSessionInfo(
702
- worktreePath: string,
703
- branch: string,
704
- ): Promise<EnhancedSessionInfo> {
705
- try {
706
- const [
707
- hasUncommitted,
708
- uncommittedCount,
709
- hasUnpushed,
710
- unpushedCount,
711
- latestCommit,
712
- ] = await Promise.all([
713
- hasUncommittedChanges(worktreePath),
714
- getUncommittedChangesCount(worktreePath),
715
- hasUnpushedCommits(worktreePath, branch),
716
- getUnpushedCommitsCount(worktreePath, branch),
717
- getLatestCommitMessage(worktreePath, branch),
718
- ]);
719
-
720
- // Determine branch type based on branch name
721
- let branchType: EnhancedSessionInfo["branchType"] = "other";
722
- const lowerBranch = branch.toLowerCase();
723
-
724
- if (lowerBranch.startsWith("feature/") || lowerBranch.startsWith("feat/")) {
725
- branchType = "feature";
726
- } else if (
727
- lowerBranch.startsWith("bugfix/") ||
728
- lowerBranch.startsWith("bug/") ||
729
- lowerBranch.startsWith("fix/")
730
- ) {
731
- branchType = "bugfix";
732
- } else if (lowerBranch.startsWith("hotfix/")) {
733
- branchType = "hotfix";
734
- } else if (lowerBranch === "develop" || lowerBranch === "development") {
735
- branchType = "develop";
736
- } else if (lowerBranch === "main") {
737
- branchType = "main";
738
- } else if (lowerBranch === "master") {
739
- branchType = "master";
740
- }
741
-
742
- return {
743
- hasUncommittedChanges: hasUncommitted,
744
- uncommittedChangesCount: uncommittedCount,
745
- hasUnpushedCommits: hasUnpushed,
746
- unpushedCommitsCount: unpushedCount,
747
- latestCommitMessage: latestCommit,
748
- branchType,
749
- };
750
- } catch {
751
- // Return safe defaults if any operation fails
752
- return {
753
- hasUncommittedChanges: false,
754
- uncommittedChangesCount: 0,
755
- hasUnpushedCommits: false,
756
- unpushedCommitsCount: 0,
757
- latestCommitMessage: null,
758
- branchType: "other",
759
- };
760
- }
761
- }
762
-
763
- export async function fetchAllRemotes(options?: {
764
- cwd?: string;
765
- timeoutMs?: number;
766
- allowPrompt?: boolean;
767
- }): Promise<void> {
768
- try {
769
- const execOptions = options?.cwd ? { cwd: options.cwd } : {};
770
- const timeoutMs = options?.timeoutMs ?? GIT_CONFIG.FETCH_TIMEOUT;
771
- const allowPrompt = options?.allowPrompt === true;
772
- const env = allowPrompt
773
- ? process.env
774
- : {
775
- ...process.env,
776
- GIT_TERMINAL_PROMPT: "0",
777
- GCM_INTERACTIVE: "Never",
778
- };
779
- const args = ["fetch", "--all", "--prune"];
780
- await execa("git", args, {
781
- ...execOptions,
782
- timeout: timeoutMs,
783
- env,
784
- stdin: allowPrompt ? "inherit" : "ignore",
785
- });
786
- } catch (error) {
787
- throw new GitError("Failed to fetch remote branches", error);
788
- }
789
- }
790
-
791
- export async function getCurrentVersion(repoRoot: string): Promise<string> {
792
- try {
793
- const packageJsonPath = path.join(repoRoot, "package.json");
794
- const fs = await import("node:fs");
795
- const packageJson = JSON.parse(
796
- await fs.promises.readFile(packageJsonPath, "utf-8"),
797
- );
798
- return packageJson.version || "0.0.0";
799
- } catch {
800
- // package.jsonが存在しない場合はデフォルトバージョンを返す
801
- return "0.0.0";
802
- }
803
- }
804
-
805
- export function calculateNewVersion(
806
- currentVersion: string,
807
- versionBump: "patch" | "minor" | "major",
808
- ): string {
809
- const versionParts = currentVersion.split(".");
810
- const major = parseInt(versionParts[0] || "0", 10);
811
- const minor = parseInt(versionParts[1] || "0", 10);
812
- const patch = parseInt(versionParts[2] || "0", 10);
813
-
814
- switch (versionBump) {
815
- case "major":
816
- return `${major + 1}.0.0`;
817
- case "minor":
818
- return `${major}.${minor + 1}.0`;
819
- case "patch":
820
- return `${major}.${minor}.${patch + 1}`;
821
- }
822
- }
823
-
824
- export async function executeNpmVersionInWorktree(
825
- worktreePath: string,
826
- newVersion: string,
827
- ): Promise<void> {
828
- try {
829
- // まずpackage.jsonが存在するか確認
830
- const fs = await import("node:fs");
831
- const packageJsonPath = path.join(worktreePath, "package.json");
832
-
833
- if (!fs.existsSync(packageJsonPath)) {
834
- // package.jsonが存在しない場合は作成
835
- const packageJson = {
836
- name: path.basename(worktreePath),
837
- version: newVersion,
838
- description: "",
839
- main: "index.js",
840
- scripts: {},
841
- keywords: [],
842
- author: "",
843
- license: "ISC",
844
- };
845
- await fs.promises.writeFile(
846
- packageJsonPath,
847
- JSON.stringify(packageJson, null, 2) + "\n",
848
- );
849
-
850
- // 新規作成したpackage.jsonをコミット
851
- await execa("git", ["add", "package.json"], { cwd: worktreePath });
852
- await execa(
853
- "git",
854
- [
855
- "commit",
856
- "-m",
857
- `chore: create package.json with version ${newVersion}`,
858
- ],
859
- { cwd: worktreePath },
860
- );
861
- } else {
862
- // package.json の version を直接書き換え(外部PMに依存しない)
863
- const content = await fs.promises.readFile(packageJsonPath, "utf-8");
864
- const json = JSON.parse(content);
865
- json.version = newVersion;
866
- await fs.promises.writeFile(
867
- packageJsonPath,
868
- JSON.stringify(json, null, 2) + "\n",
869
- );
870
-
871
- // 変更をコミット
872
- await execa("git", ["add", "package.json"], { cwd: worktreePath });
873
- await execa(
874
- "git",
875
- ["commit", "-m", `chore: bump version to ${newVersion}`],
876
- { cwd: worktreePath },
877
- );
878
- }
879
- } catch (error: unknown) {
880
- // エラーの詳細情報を含める
881
- const errorMessage = error instanceof Error ? error.message : String(error);
882
- const stderr =
883
- typeof error === "object" && error !== null && "stderr" in error
884
- ? (error as { stderr?: string }).stderr
885
- : undefined;
886
- const stdout =
887
- typeof error === "object" && error !== null && "stdout" in error
888
- ? (error as { stdout?: string }).stdout
889
- : undefined;
890
- const errorDetails = stderr ? ` (stderr: ${stderr})` : "";
891
- const errorStdout = stdout ? ` (stdout: ${stdout})` : "";
892
- throw new GitError(
893
- `Failed to update version to ${newVersion} in worktree: ${errorMessage}${errorDetails}${errorStdout}`,
894
- error,
895
- );
896
- }
897
- }
898
-
899
- export async function deleteRemoteBranch(
900
- branchName: string,
901
- remote = "origin",
902
- ): Promise<void> {
903
- try {
904
- await execa("git", ["push", remote, "--delete", branchName]);
905
- } catch (error) {
906
- throw new GitError(
907
- `Failed to delete remote branch ${remote}/${branchName}`,
908
- error,
909
- );
910
- }
911
- }
912
-
913
- export async function getCurrentBranchName(
914
- worktreePath: string,
915
- ): Promise<string> {
916
- try {
917
- const { stdout } = await execa("git", ["branch", "--show-current"], {
918
- cwd: worktreePath,
919
- });
920
- return stdout.trim();
921
- } catch (error) {
922
- throw new GitError("Failed to get current branch name", error);
923
- }
924
- }
925
-
926
- export async function pushBranchToRemote(
927
- worktreePath: string,
928
- branchName: string,
929
- remote = "origin",
930
- ): Promise<void> {
931
- try {
932
- // Check if the remote branch exists
933
- const remoteBranchExists = await checkRemoteBranchExists(
934
- branchName,
935
- remote,
936
- { cwd: worktreePath },
937
- );
938
-
939
- if (remoteBranchExists) {
940
- // Push to existing remote branch
941
- await execa("git", ["push", remote, branchName], { cwd: worktreePath });
942
- } else {
943
- // Push and set upstream for new remote branch
944
- await execa("git", ["push", "--set-upstream", remote, branchName], {
945
- cwd: worktreePath,
946
- });
947
- }
948
- } catch (error) {
949
- throw new GitError(
950
- `Failed to push branch ${branchName} to ${remote}`,
951
- error,
952
- );
953
- }
954
- }
955
-
956
- export async function checkRemoteBranchExists(
957
- branchName: string,
958
- remote = "origin",
959
- options?: { cwd?: string },
960
- ): Promise<boolean> {
961
- try {
962
- const execOptions = options?.cwd ? { cwd: options.cwd } : undefined;
963
- const args = [
964
- "show-ref",
965
- "--verify",
966
- "--quiet",
967
- `refs/remotes/${remote}/${branchName}`,
968
- ];
969
- if (execOptions) {
970
- await execa("git", args, execOptions);
971
- } else {
972
- await execa("git", args);
973
- }
974
- return true;
975
- } catch {
976
- return false;
977
- }
978
- }
979
-
980
- /**
981
- * 現在のディレクトリがworktreeディレクトリかどうかを確認
982
- * @returns {Promise<boolean>} worktreeディレクトリの場合true
983
- */
984
- export async function isInWorktree(): Promise<boolean> {
985
- try {
986
- // git rev-parse --show-toplevelとgit rev-parse --git-common-dirの結果を比較
987
- const [toplevelResult, gitCommonDirResult] = await Promise.all([
988
- execa("git", ["rev-parse", "--show-toplevel"]),
989
- execa("git", ["rev-parse", "--git-common-dir"]),
990
- ]);
991
-
992
- const toplevel = toplevelResult.stdout.trim();
993
- const gitCommonDir = gitCommonDirResult.stdout.trim();
994
-
995
- // gitCommonDirが絶対パスで、toplevelと異なる親ディレクトリを持つ場合はworktree
996
- const path = await import("node:path");
997
- if (path.isAbsolute(gitCommonDir)) {
998
- const mainRepoRoot = path.dirname(gitCommonDir);
999
- return toplevel !== mainRepoRoot;
1000
- }
1001
-
1002
- // gitCommonDirが相対パス(.git)の場合はメインリポジトリ
1003
- return false;
1004
- } catch {
1005
- return false;
1006
- }
1007
- }
1008
-
1009
- /**
1010
- * .gitignoreファイルに指定されたエントリーが存在することを保証します
1011
- * エントリーが既に存在する場合は何もしません
1012
- * @param {string} repoRoot - リポジトリのルートディレクトリ
1013
- * @param {string} entry - 追加するエントリー(例: ".worktrees/")
1014
- * @throws {GitError} ファイルの読み書きに失敗した場合
1015
- */
1016
- // ========================================
1017
- // Batch Merge Operations (SPEC-ee33ca26)
1018
- // ========================================
1019
-
1020
- /**
1021
- * Merge from source branch to current branch in worktree
1022
- * @param worktreePath - Path to worktree directory
1023
- * @param sourceBranch - Source branch to merge from
1024
- * @param dryRun - If true, use --no-commit flag for dry-run mode
1025
- * @see specs/SPEC-ee33ca26/research.md - Decision 3: Dry-run implementation
1026
- */
1027
- export async function mergeFromBranch(
1028
- worktreePath: string,
1029
- sourceBranch: string,
1030
- dryRun = false,
1031
- ): Promise<void> {
1032
- try {
1033
- const args = ["merge"];
1034
- if (dryRun) {
1035
- args.push("--no-commit");
1036
- }
1037
- args.push(sourceBranch);
1038
-
1039
- await execa("git", args, { cwd: worktreePath });
1040
- } catch (error) {
1041
- throw new GitError(
1042
- `Failed to merge from ${sourceBranch} in ${worktreePath}`,
1043
- error,
1044
- );
1045
- }
1046
- }
1047
-
1048
- /**
1049
- * Check if there is a merge in progress in worktree
1050
- * @param worktreePath - Path to worktree directory
1051
- * @returns true if MERGE_HEAD exists (merge in progress)
1052
- * @see specs/SPEC-ee33ca26/research.md - Best practices: Git state confirmation
1053
- */
1054
- export async function hasMergeConflict(worktreePath: string): Promise<boolean> {
1055
- try {
1056
- await execa("git", ["rev-parse", "--git-path", "MERGE_HEAD"], {
1057
- cwd: worktreePath,
1058
- });
1059
- return true;
1060
- } catch {
1061
- return false;
1062
- }
1063
- }
1064
-
1065
- /**
1066
- * Abort current merge operation in worktree
1067
- * @param worktreePath - Path to worktree directory
1068
- * @see specs/SPEC-ee33ca26/research.md - Decision 3: Dry-run rollback
1069
- */
1070
- export async function abortMerge(worktreePath: string): Promise<void> {
1071
- try {
1072
- await execa("git", ["merge", "--abort"], { cwd: worktreePath });
1073
- } catch (error) {
1074
- throw new GitError(`Failed to abort merge in ${worktreePath}`, error);
1075
- }
1076
- }
1077
-
1078
- /**
1079
- * Get current merge status in worktree
1080
- * @param worktreePath - Path to worktree directory
1081
- * @returns Object with inProgress and hasConflict flags
1082
- * @see specs/SPEC-ee33ca26/research.md - Best practices: Git state confirmation
1083
- */
1084
- export async function getMergeStatus(worktreePath: string): Promise<{
1085
- inProgress: boolean;
1086
- hasConflict: boolean;
1087
- }> {
1088
- // Check if merge is in progress (MERGE_HEAD exists)
1089
- const inProgress = await hasMergeConflict(worktreePath);
1090
-
1091
- // Check if there are conflicts (git status --porcelain shows UU)
1092
- let hasConflict = false;
1093
- if (inProgress) {
1094
- try {
1095
- const { stdout } = await execa("git", ["status", "--porcelain"], {
1096
- cwd: worktreePath,
1097
- });
1098
- // UU indicates unmerged paths (conflicts)
1099
- hasConflict = stdout.includes("UU ");
1100
- } catch {
1101
- hasConflict = false;
1102
- }
1103
- }
1104
-
1105
- return {
1106
- inProgress,
1107
- hasConflict,
1108
- };
1109
- }
1110
-
1111
- /**
1112
- * Reset worktree to HEAD (rollback all changes)
1113
- * Used for dry-run cleanup after git merge --no-commit
1114
- * @param worktreePath - Path to worktree directory
1115
- * @see specs/SPEC-ee33ca26/research.md - Dry-run implementation: --no-commit + rollback
1116
- */
1117
- export async function resetToHead(worktreePath: string): Promise<void> {
1118
- try {
1119
- await execa("git", ["reset", "--hard", "HEAD"], {
1120
- cwd: worktreePath,
1121
- });
1122
- } catch (error) {
1123
- throw new GitError(
1124
- `Failed to reset worktree to HEAD in ${worktreePath}`,
1125
- error,
1126
- );
1127
- }
1128
- }
1129
-
1130
- export interface BranchDivergenceStatus {
1131
- branch: string;
1132
- remoteAhead: number;
1133
- localAhead: number;
1134
- }
1135
-
1136
- export async function getBranchDivergenceStatuses(options?: {
1137
- cwd?: string;
1138
- remote?: string;
1139
- branches?: string[];
1140
- }): Promise<BranchDivergenceStatus[]> {
1141
- const cwd = options?.cwd;
1142
- const remote = options?.remote ?? "origin";
1143
- const execOptions = cwd ? { cwd } : undefined;
1144
- const branchFilter = options?.branches?.filter(
1145
- (name) => name.trim().length > 0,
1146
- );
1147
- const filterSet =
1148
- branchFilter && branchFilter.length > 0 ? new Set(branchFilter) : null;
1149
-
1150
- const branchArgs = ["branch", "--format=%(refname:short)"];
1151
- const { stdout: localBranchOutput } = execOptions
1152
- ? await execa("git", branchArgs, execOptions)
1153
- : await execa("git", branchArgs);
1154
-
1155
- const branchNames = localBranchOutput
1156
- .split("\n")
1157
- .map((name) => name.trim())
1158
- .filter(Boolean)
1159
- .filter((name) => !filterSet || filterSet.has(name));
1160
-
1161
- if (filterSet && branchNames.length === 0) {
1162
- return [];
1163
- }
1164
-
1165
- const results: BranchDivergenceStatus[] = [];
1166
-
1167
- for (const branchName of branchNames) {
1168
- const remoteExists = await checkRemoteBranchExists(
1169
- branchName,
1170
- remote,
1171
- cwd ? { cwd } : undefined,
1172
- );
1173
-
1174
- if (!remoteExists) {
1175
- continue;
1176
- }
1177
-
1178
- try {
1179
- const revListArgs = [
1180
- "rev-list",
1181
- "--left-right",
1182
- "--count",
1183
- `${remote}/${branchName}...${branchName}`,
1184
- ];
1185
- const { stdout } = execOptions
1186
- ? await execa("git", revListArgs, execOptions)
1187
- : await execa("git", revListArgs);
1188
-
1189
- const [remoteAheadRaw, localAheadRaw] = stdout.trim().split(/\s+/);
1190
- const remoteAhead = Number.parseInt(remoteAheadRaw || "0", 10) || 0;
1191
- const localAhead = Number.parseInt(localAheadRaw || "0", 10) || 0;
1192
-
1193
- results.push({ branch: branchName, remoteAhead, localAhead });
1194
- } catch (error) {
1195
- throw new GitError(
1196
- `Failed to inspect divergence for ${branchName}`,
1197
- error,
1198
- );
1199
- }
1200
- }
1201
-
1202
- return results;
1203
- }
1204
-
1205
- export async function pullFastForward(
1206
- worktreePath: string,
1207
- remote = "origin",
1208
- ): Promise<void> {
1209
- try {
1210
- await execa("git", ["pull", "--ff-only", remote], {
1211
- cwd: worktreePath,
1212
- });
1213
- } catch (error) {
1214
- throw new GitError(`Failed to fast-forward pull in ${worktreePath}`, error);
1215
- }
1216
- }
1217
-
1218
- export async function ensureGitignoreEntry(
1219
- repoRoot: string,
1220
- entry: string,
1221
- ): Promise<void> {
1222
- const fs = await import("node:fs/promises");
1223
- const gitignorePath = path.join(repoRoot, ".gitignore");
1224
-
1225
- try {
1226
- // .gitignoreファイルを読み込む(存在しない場合は空文字列)
1227
- let content = "";
1228
- let eol = "\n";
1229
- try {
1230
- content = await fs.readFile(gitignorePath, "utf-8");
1231
- if (content.includes("\r\n")) {
1232
- eol = "\r\n";
1233
- }
1234
- } catch (error: unknown) {
1235
- // ENOENTエラー(ファイルが存在しない)は無視
1236
- const code =
1237
- typeof error === "object" && error !== null && "code" in error
1238
- ? (error as { code?: string }).code
1239
- : undefined;
1240
- if (code !== "ENOENT") {
1241
- throw error;
1242
- }
1243
- }
1244
-
1245
- const normalizedEntry = entry.trim();
1246
- const normalizedLines = content.split(/\r?\n/).map((line) => line.trim());
1247
-
1248
- if (normalizedLines.includes(normalizedEntry)) {
1249
- // 既に存在する場合は何もしない
1250
- return;
1251
- }
1252
-
1253
- const needsSeparator =
1254
- content.length > 0 && !content.endsWith("\n") && !content.endsWith("\r");
1255
- const separator = needsSeparator ? eol : "";
1256
-
1257
- const newContent = `${content}${separator}${entry}${eol}`;
1258
- await fs.writeFile(gitignorePath, newContent, "utf-8");
1259
- } catch (error: unknown) {
1260
- const message = error instanceof Error ? error.message : String(error);
1261
- throw new GitError(`Failed to update .gitignore: ${message}`, error);
1262
- }
1263
- }