@agimon-ai/doompi-git 0.0.1-alpha.7 → 0.0.1-alpha.9

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 (325) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +23 -1
  2. package/dist/api-contracts.cjs +7 -1
  3. package/dist/api-contracts.d.cts +1 -1
  4. package/dist/api-contracts.d.mts +1 -1
  5. package/dist/api-contracts.mjs +2 -1
  6. package/dist/extensions/pi.cjs +38 -1
  7. package/dist/extensions/pi.cjs.map +1 -1
  8. package/dist/extensions/pi.d.cts +5 -4
  9. package/dist/extensions/pi.d.cts.map +1 -1
  10. package/dist/extensions/pi.d.mts +5 -4
  11. package/dist/extensions/pi.d.mts.map +1 -1
  12. package/dist/extensions/pi.mjs +33 -1
  13. package/dist/extensions/pi.mjs.map +1 -1
  14. package/dist/extensions/server.cjs +72 -1
  15. package/dist/extensions/server.cjs.map +1 -1
  16. package/dist/extensions/server.d.cts +3 -3
  17. package/dist/extensions/server.d.cts.map +1 -1
  18. package/dist/extensions/server.d.mts +3 -3
  19. package/dist/extensions/server.d.mts.map +1 -1
  20. package/dist/extensions/server.mjs +67 -1
  21. package/dist/extensions/server.mjs.map +1 -1
  22. package/dist/extensions/web.mjs +485 -0
  23. package/dist/extensions/web.mjs.map +1 -0
  24. package/dist/index.cjs +5 -1
  25. package/dist/index.d.cts +3 -3
  26. package/dist/index.d.mts +3 -3
  27. package/dist/index.mjs +3 -1
  28. package/dist/src/constants/git.cjs +8 -0
  29. package/dist/src/constants/git.cjs.map +1 -0
  30. package/dist/src/constants/git.mjs +7 -0
  31. package/dist/src/constants/git.mjs.map +1 -0
  32. package/dist/src/extensions/(backend)/api/_lib/route.server.cjs +93 -0
  33. package/dist/src/extensions/(backend)/api/_lib/route.server.cjs.map +1 -0
  34. package/dist/src/extensions/(backend)/api/_lib/route.server.mjs +92 -0
  35. package/dist/src/extensions/(backend)/api/_lib/route.server.mjs.map +1 -0
  36. package/dist/src/extensions/(backend)/api/route.server.cjs +7 -0
  37. package/dist/src/extensions/(backend)/api/route.server.cjs.map +1 -0
  38. package/dist/src/extensions/(backend)/api/route.server.mjs +8 -0
  39. package/dist/src/extensions/(backend)/api/route.server.mjs.map +1 -0
  40. package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.cjs +195 -0
  41. package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.cjs.map +1 -0
  42. package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.mjs +194 -0
  43. package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.mjs.map +1 -0
  44. package/dist/src/extensions/(backend)/channel/git-worktrees.server.cjs +7 -0
  45. package/dist/src/extensions/(backend)/channel/git-worktrees.server.cjs.map +1 -0
  46. package/dist/src/extensions/(backend)/channel/git-worktrees.server.mjs +8 -0
  47. package/dist/src/extensions/(backend)/channel/git-worktrees.server.mjs.map +1 -0
  48. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.cjs +7 -0
  49. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.cjs.map +1 -0
  50. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.mjs +8 -0
  51. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.mjs.map +1 -0
  52. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.cjs +71 -0
  53. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.cjs.map +1 -0
  54. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.mjs +70 -0
  55. package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.mjs.map +1 -0
  56. package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.cjs +17 -0
  57. package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.cjs.map +1 -0
  58. package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.mjs +16 -0
  59. package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.mjs.map +1 -0
  60. package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.cjs +7 -0
  61. package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.cjs.map +1 -0
  62. package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.mjs +8 -0
  63. package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.mjs.map +1 -0
  64. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.cjs +15 -0
  65. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.cjs.map +1 -0
  66. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.mjs +15 -0
  67. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.mjs.map +1 -0
  68. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.cjs +6 -0
  69. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.cjs.map +1 -0
  70. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.mjs +6 -0
  71. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.mjs.map +1 -0
  72. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.cjs +6 -0
  73. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.cjs.map +1 -0
  74. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.mjs +6 -0
  75. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.mjs.map +1 -0
  76. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.cjs +6 -0
  77. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.cjs.map +1 -0
  78. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.mjs +6 -0
  79. package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.mjs.map +1 -0
  80. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.cjs +7 -0
  81. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.cjs.map +1 -0
  82. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.mjs +8 -0
  83. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.mjs.map +1 -0
  84. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.cjs +7 -0
  85. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.cjs.map +1 -0
  86. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.mjs +8 -0
  87. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.mjs.map +1 -0
  88. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.cjs +7 -0
  89. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.cjs.map +1 -0
  90. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.mjs +8 -0
  91. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.mjs.map +1 -0
  92. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.cjs +7 -0
  93. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.cjs.map +1 -0
  94. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.mjs +8 -0
  95. package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.mjs.map +1 -0
  96. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs +7 -0
  97. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs.map +1 -0
  98. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.mjs +8 -0
  99. package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.mjs.map +1 -0
  100. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.cjs +7 -0
  101. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.cjs.map +1 -0
  102. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.mjs +8 -0
  103. package/dist/src/extensions/workspaces/sessions/(backend)/root.server.mjs.map +1 -0
  104. package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.cjs +38 -0
  105. package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.cjs.map +1 -0
  106. package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.mjs +36 -0
  107. package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.mjs.map +1 -0
  108. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.cjs +7 -0
  109. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.cjs.map +1 -0
  110. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.mjs +8 -0
  111. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.mjs.map +1 -0
  112. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.cjs +6 -0
  113. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.cjs.map +1 -0
  114. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.mjs +7 -0
  115. package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.mjs.map +1 -0
  116. package/dist/src/schemas/apiContracts.cjs +138 -0
  117. package/dist/src/schemas/apiContracts.cjs.map +1 -0
  118. package/dist/{schemas → src/schemas}/apiContracts.d.cts +2 -2
  119. package/dist/{schemas → src/schemas}/apiContracts.d.cts.map +1 -1
  120. package/dist/{schemas → src/schemas}/apiContracts.d.mts +2 -2
  121. package/dist/{schemas → src/schemas}/apiContracts.d.mts.map +1 -1
  122. package/dist/src/schemas/apiContracts.mjs +135 -0
  123. package/dist/src/schemas/apiContracts.mjs.map +1 -0
  124. package/dist/src/schemas/runWorktreeTool.cjs +152 -0
  125. package/dist/src/schemas/runWorktreeTool.cjs.map +1 -0
  126. package/dist/src/schemas/runWorktreeTool.mjs +150 -0
  127. package/dist/src/schemas/runWorktreeTool.mjs.map +1 -0
  128. package/dist/src/services/atomicJson/index.cjs +42 -0
  129. package/dist/src/services/atomicJson/index.cjs.map +1 -0
  130. package/dist/src/services/atomicJson/index.mjs +38 -0
  131. package/dist/src/services/atomicJson/index.mjs.map +1 -0
  132. package/dist/src/services/compositionMirror/index.cjs +119 -0
  133. package/dist/src/services/compositionMirror/index.cjs.map +1 -0
  134. package/dist/src/services/compositionMirror/index.mjs +116 -0
  135. package/dist/src/services/compositionMirror/index.mjs.map +1 -0
  136. package/dist/src/services/errors/index.cjs +29 -0
  137. package/dist/src/services/errors/index.cjs.map +1 -0
  138. package/dist/src/services/errors/index.mjs +27 -0
  139. package/dist/src/services/errors/index.mjs.map +1 -0
  140. package/dist/src/services/extensionService/index.cjs +13 -0
  141. package/dist/src/services/extensionService/index.cjs.map +1 -0
  142. package/dist/{services → src/services}/extensionService/index.d.cts +1 -2
  143. package/dist/src/services/extensionService/index.d.cts.map +1 -0
  144. package/dist/{services → src/services}/extensionService/index.d.mts +1 -2
  145. package/dist/src/services/extensionService/index.d.mts.map +1 -0
  146. package/dist/src/services/extensionService/index.mjs +13 -0
  147. package/dist/src/services/extensionService/index.mjs.map +1 -0
  148. package/dist/src/services/gitCli/index.cjs +144 -0
  149. package/dist/src/services/gitCli/index.cjs.map +1 -0
  150. package/dist/src/services/gitCli/index.mjs +142 -0
  151. package/dist/src/services/gitCli/index.mjs.map +1 -0
  152. package/dist/src/services/gitDependencies/index.cjs +14 -0
  153. package/dist/src/services/gitDependencies/index.cjs.map +1 -0
  154. package/dist/src/services/gitDependencies/index.d.cts +5 -0
  155. package/dist/src/services/gitDependencies/index.d.cts.map +1 -0
  156. package/dist/src/services/gitDependencies/index.d.mts +5 -0
  157. package/dist/src/services/gitDependencies/index.d.mts.map +1 -0
  158. package/dist/src/services/gitDependencies/index.mjs +14 -0
  159. package/dist/src/services/gitDependencies/index.mjs.map +1 -0
  160. package/dist/src/services/paths/index.cjs +35 -0
  161. package/dist/src/services/paths/index.cjs.map +1 -0
  162. package/dist/src/services/paths/index.mjs +30 -0
  163. package/dist/src/services/paths/index.mjs.map +1 -0
  164. package/dist/src/services/repositoryIdentity/index.cjs +71 -0
  165. package/dist/src/services/repositoryIdentity/index.cjs.map +1 -0
  166. package/dist/src/services/repositoryIdentity/index.mjs +65 -0
  167. package/dist/src/services/repositoryIdentity/index.mjs.map +1 -0
  168. package/dist/src/services/runWorktree/index.cjs +145 -0
  169. package/dist/src/services/runWorktree/index.cjs.map +1 -0
  170. package/dist/src/services/runWorktree/index.mjs +142 -0
  171. package/dist/src/services/runWorktree/index.mjs.map +1 -0
  172. package/dist/src/services/worktreeEvents/index.cjs +64 -0
  173. package/dist/src/services/worktreeEvents/index.cjs.map +1 -0
  174. package/dist/{services → src/services}/worktreeEvents/index.d.cts +3 -4
  175. package/dist/src/services/worktreeEvents/index.d.cts.map +1 -0
  176. package/dist/{services → src/services}/worktreeEvents/index.d.mts +3 -4
  177. package/dist/src/services/worktreeEvents/index.d.mts.map +1 -0
  178. package/dist/src/services/worktreeEvents/index.mjs +60 -0
  179. package/dist/src/services/worktreeEvents/index.mjs.map +1 -0
  180. package/dist/src/services/worktreeNaming/index.cjs +99 -0
  181. package/dist/src/services/worktreeNaming/index.cjs.map +1 -0
  182. package/dist/{services → src/services}/worktreeNaming/index.d.cts +2 -3
  183. package/dist/src/services/worktreeNaming/index.d.cts.map +1 -0
  184. package/dist/{services → src/services}/worktreeNaming/index.d.mts +2 -3
  185. package/dist/src/services/worktreeNaming/index.d.mts.map +1 -0
  186. package/dist/src/services/worktreeNaming/index.mjs +94 -0
  187. package/dist/src/services/worktreeNaming/index.mjs.map +1 -0
  188. package/dist/src/services/worktreeOperations/index.cjs +263 -0
  189. package/dist/src/services/worktreeOperations/index.cjs.map +1 -0
  190. package/dist/{services → src/services}/worktreeOperations/index.d.cts +4 -5
  191. package/dist/src/services/worktreeOperations/index.d.cts.map +1 -0
  192. package/dist/{services → src/services}/worktreeOperations/index.d.mts +4 -5
  193. package/dist/src/services/worktreeOperations/index.d.mts.map +1 -0
  194. package/dist/src/services/worktreeOperations/index.mjs +261 -0
  195. package/dist/src/services/worktreeOperations/index.mjs.map +1 -0
  196. package/dist/src/services/worktreeRegistry/index.cjs +38 -0
  197. package/dist/src/services/worktreeRegistry/index.cjs.map +1 -0
  198. package/dist/src/services/worktreeRegistry/index.mjs +38 -0
  199. package/dist/src/services/worktreeRegistry/index.mjs.map +1 -0
  200. package/dist/{types → src/types}/extension.d.cts +4 -5
  201. package/dist/src/types/extension.d.cts.map +1 -0
  202. package/dist/{types → src/types}/extension.d.mts +4 -5
  203. package/dist/src/types/extension.d.mts.map +1 -0
  204. package/dist/src/types/webWorktrees.cjs +20 -0
  205. package/dist/src/types/webWorktrees.cjs.map +1 -0
  206. package/dist/src/types/webWorktrees.mjs +20 -0
  207. package/dist/src/types/webWorktrees.mjs.map +1 -0
  208. package/dist/{types → src/types}/worktreeRegistry.d.cts +3 -4
  209. package/dist/src/types/worktreeRegistry.d.cts.map +1 -0
  210. package/dist/{types → src/types}/worktreeRegistry.d.mts +3 -4
  211. package/dist/src/types/worktreeRegistry.d.mts.map +1 -0
  212. package/package.json +31 -26
  213. package/dist/constants/git.cjs +0 -2
  214. package/dist/constants/git.cjs.map +0 -1
  215. package/dist/constants/git.mjs +0 -2
  216. package/dist/constants/git.mjs.map +0 -1
  217. package/dist/controllers/gitCommand.cjs +0 -2
  218. package/dist/controllers/gitCommand.cjs.map +0 -1
  219. package/dist/controllers/gitCommand.mjs +0 -2
  220. package/dist/controllers/gitCommand.mjs.map +0 -1
  221. package/dist/controllers/gitSession.cjs +0 -2
  222. package/dist/controllers/gitSession.cjs.map +0 -1
  223. package/dist/controllers/gitSession.mjs +0 -2
  224. package/dist/controllers/gitSession.mjs.map +0 -1
  225. package/dist/controllers/hubApi.cjs +0 -2
  226. package/dist/controllers/hubApi.cjs.map +0 -1
  227. package/dist/controllers/hubApi.mjs +0 -2
  228. package/dist/controllers/hubApi.mjs.map +0 -1
  229. package/dist/controllers/worktreesChannel.cjs +0 -2
  230. package/dist/controllers/worktreesChannel.cjs.map +0 -1
  231. package/dist/controllers/worktreesChannel.mjs +0 -2
  232. package/dist/controllers/worktreesChannel.mjs.map +0 -1
  233. package/dist/schemas/apiContracts.cjs +0 -2
  234. package/dist/schemas/apiContracts.cjs.map +0 -1
  235. package/dist/schemas/apiContracts.mjs +0 -2
  236. package/dist/schemas/apiContracts.mjs.map +0 -1
  237. package/dist/schemas/runWorktreeTool.cjs +0 -2
  238. package/dist/schemas/runWorktreeTool.cjs.map +0 -1
  239. package/dist/schemas/runWorktreeTool.mjs +0 -2
  240. package/dist/schemas/runWorktreeTool.mjs.map +0 -1
  241. package/dist/services/atomicJson/index.cjs +0 -2
  242. package/dist/services/atomicJson/index.cjs.map +0 -1
  243. package/dist/services/atomicJson/index.mjs +0 -2
  244. package/dist/services/atomicJson/index.mjs.map +0 -1
  245. package/dist/services/compositionMirror/index.cjs +0 -2
  246. package/dist/services/compositionMirror/index.cjs.map +0 -1
  247. package/dist/services/compositionMirror/index.mjs +0 -2
  248. package/dist/services/compositionMirror/index.mjs.map +0 -1
  249. package/dist/services/errors/index.cjs +0 -2
  250. package/dist/services/errors/index.cjs.map +0 -1
  251. package/dist/services/errors/index.mjs +0 -2
  252. package/dist/services/errors/index.mjs.map +0 -1
  253. package/dist/services/extensionService/index.cjs +0 -2
  254. package/dist/services/extensionService/index.cjs.map +0 -1
  255. package/dist/services/extensionService/index.d.cts.map +0 -1
  256. package/dist/services/extensionService/index.d.mts.map +0 -1
  257. package/dist/services/extensionService/index.mjs +0 -2
  258. package/dist/services/extensionService/index.mjs.map +0 -1
  259. package/dist/services/gitCli/index.cjs +0 -4
  260. package/dist/services/gitCli/index.cjs.map +0 -1
  261. package/dist/services/gitCli/index.mjs +0 -4
  262. package/dist/services/gitCli/index.mjs.map +0 -1
  263. package/dist/services/gitDependencies/index.cjs +0 -2
  264. package/dist/services/gitDependencies/index.cjs.map +0 -1
  265. package/dist/services/gitDependencies/index.d.cts +0 -6
  266. package/dist/services/gitDependencies/index.d.cts.map +0 -1
  267. package/dist/services/gitDependencies/index.d.mts +0 -6
  268. package/dist/services/gitDependencies/index.d.mts.map +0 -1
  269. package/dist/services/gitDependencies/index.mjs +0 -2
  270. package/dist/services/gitDependencies/index.mjs.map +0 -1
  271. package/dist/services/paths/index.cjs +0 -2
  272. package/dist/services/paths/index.cjs.map +0 -1
  273. package/dist/services/paths/index.mjs +0 -2
  274. package/dist/services/paths/index.mjs.map +0 -1
  275. package/dist/services/repositoryIdentity/index.cjs +0 -2
  276. package/dist/services/repositoryIdentity/index.cjs.map +0 -1
  277. package/dist/services/repositoryIdentity/index.mjs +0 -2
  278. package/dist/services/repositoryIdentity/index.mjs.map +0 -1
  279. package/dist/services/runWorktree/index.cjs +0 -15
  280. package/dist/services/runWorktree/index.cjs.map +0 -1
  281. package/dist/services/runWorktree/index.mjs +0 -15
  282. package/dist/services/runWorktree/index.mjs.map +0 -1
  283. package/dist/services/worktreeEvents/index.cjs +0 -2
  284. package/dist/services/worktreeEvents/index.cjs.map +0 -1
  285. package/dist/services/worktreeEvents/index.d.cts.map +0 -1
  286. package/dist/services/worktreeEvents/index.d.mts.map +0 -1
  287. package/dist/services/worktreeEvents/index.mjs +0 -2
  288. package/dist/services/worktreeEvents/index.mjs.map +0 -1
  289. package/dist/services/worktreeNaming/index.cjs +0 -2
  290. package/dist/services/worktreeNaming/index.cjs.map +0 -1
  291. package/dist/services/worktreeNaming/index.d.cts.map +0 -1
  292. package/dist/services/worktreeNaming/index.d.mts.map +0 -1
  293. package/dist/services/worktreeNaming/index.mjs +0 -2
  294. package/dist/services/worktreeNaming/index.mjs.map +0 -1
  295. package/dist/services/worktreeOperations/index.cjs +0 -2
  296. package/dist/services/worktreeOperations/index.cjs.map +0 -1
  297. package/dist/services/worktreeOperations/index.d.cts.map +0 -1
  298. package/dist/services/worktreeOperations/index.d.mts.map +0 -1
  299. package/dist/services/worktreeOperations/index.mjs +0 -2
  300. package/dist/services/worktreeOperations/index.mjs.map +0 -1
  301. package/dist/services/worktreeRegistry/index.cjs +0 -2
  302. package/dist/services/worktreeRegistry/index.cjs.map +0 -1
  303. package/dist/services/worktreeRegistry/index.mjs +0 -2
  304. package/dist/services/worktreeRegistry/index.mjs.map +0 -1
  305. package/dist/tools/runWorktree.cjs +0 -2
  306. package/dist/tools/runWorktree.cjs.map +0 -1
  307. package/dist/tools/runWorktree.mjs +0 -2
  308. package/dist/tools/runWorktree.mjs.map +0 -1
  309. package/dist/types/extension.d.cts.map +0 -1
  310. package/dist/types/extension.d.mts.map +0 -1
  311. package/dist/types/webWorktrees.cjs +0 -2
  312. package/dist/types/webWorktrees.cjs.map +0 -1
  313. package/dist/types/webWorktrees.mjs +0 -2
  314. package/dist/types/webWorktrees.mjs.map +0 -1
  315. package/dist/types/worktreeRegistry.d.cts.map +0 -1
  316. package/dist/types/worktreeRegistry.d.mts.map +0 -1
  317. package/src/extensions/web.ts +0 -33
  318. package/src/types/webWorktrees.ts +0 -55
  319. package/src/types/worktreeRegistry.ts +0 -78
  320. package/src/web/components/RunWorktreeToolMessage.tsx +0 -45
  321. package/src/web/components/WorktreesActivitySection.tsx +0 -80
  322. package/src/web/components/WorktreesPanel.tsx +0 -175
  323. package/src/web/components/toolRenderers.ts +0 -8
  324. package/src/web/stores/worktreesActivityStore.ts +0 -125
  325. package/src/web/tsconfig.json +0 -22
@@ -0,0 +1,94 @@
1
+ //#region src/services/worktreeNaming/index.ts
2
+ const MAX_SLUG_LENGTH = 64;
3
+ /**
4
+ * A branch name reduced to one safe path segment.
5
+ *
6
+ * Slashes are the point: `wt/fix-auth` is a perfectly good branch and a
7
+ * terrible directory name, because the nested directory it implies is not the
8
+ * one the worktree lives in.
9
+ */
10
+ function branchSlug(branch) {
11
+ const slug = branch.toLowerCase().replace(/[^a-z0-9]+/gu, "-").replace(/^-+|-+$/gu, "").slice(0, MAX_SLUG_LENGTH).replace(/-+$/gu, "");
12
+ return slug === "" ? "worktree" : slug;
13
+ }
14
+ /**
15
+ * The directory for one worktree.
16
+ *
17
+ * The short id disambiguates two branches whose slugs collide, such as
18
+ * `feature/x` and `feature_x`, which would otherwise want the same directory.
19
+ */
20
+ function worktreeDirectory(input) {
21
+ const repository = `${input.repositoryLabel}--${input.repositoryId}`;
22
+ return `${input.worktreesRoot}/${repository}/${branchSlug(input.branch)}--${input.shortId}`;
23
+ }
24
+ /** Why a worktree cannot be created, or undefined when it can. */
25
+ function refuseSpawn(input) {
26
+ if (input.branch.trim() === "") return "A branch name is required.";
27
+ const live = input.existing.find((record) => record.branch === input.branch && record.status !== "orphaned");
28
+ if (live) return `Branch ${input.branch} already has a worktree (${live.id}).`;
29
+ }
30
+ /** Why a worktree cannot be closed, or undefined when it can. */
31
+ function refuseClose(input) {
32
+ if (!input.record) return "No worktree with that id. Call list to see the current ids.";
33
+ if (input.dirtyFiles.length === 0 || input.force) return void 0;
34
+ const names = input.dirtyFiles.slice(0, 10).join(", ");
35
+ const more = input.dirtyFiles.length > 10 ? `, and ${String(input.dirtyFiles.length - 10)} more` : "";
36
+ return `${String(input.dirtyFiles.length)} uncommitted file(s): ${names}${more}. Pass force: true to discard them.`;
37
+ }
38
+ /**
39
+ * Marks records whose process or directory is gone as orphaned.
40
+ *
41
+ * Nothing is deleted here. A doompi-git orphan owns a directory that may hold
42
+ * uncommitted work, so losing the record would lose the only pointer to it.
43
+ * Deletion is always a separate, named decision.
44
+ */
45
+ function reconcile(records, probe) {
46
+ const changed = [];
47
+ return {
48
+ records: records.map((record) => {
49
+ if (record.status === "orphaned") return record;
50
+ if (!(!probe.exists(record.path) || !probe.alive(record))) return record;
51
+ changed.push(record.id);
52
+ return {
53
+ ...record,
54
+ status: "orphaned"
55
+ };
56
+ }),
57
+ changed
58
+ };
59
+ }
60
+ /**
61
+ * What a prune would do, decided before anything is destroyed.
62
+ *
63
+ * Separating the plan from the execution is what makes dryRun honest and lets
64
+ * the destructive half be reviewed on its own.
65
+ */
66
+ function planPrune(input) {
67
+ const plan = {
68
+ remove: [],
69
+ forget: [],
70
+ untracked: [],
71
+ keptDirty: [],
72
+ keptBranches: []
73
+ };
74
+ const known = new Set(input.records.map((record) => record.path));
75
+ const listed = new Set(input.gitPaths);
76
+ for (const record of input.records) {
77
+ if (record.status !== "orphaned") continue;
78
+ if (!listed.has(record.path)) {
79
+ plan.forget.push(record);
80
+ continue;
81
+ }
82
+ if ((input.dirtyByPath.get(record.path) ?? []).length > 0) {
83
+ plan.keptDirty.push(record);
84
+ continue;
85
+ }
86
+ plan.remove.push(record);
87
+ }
88
+ for (const path of input.gitPaths) if (path.startsWith(`${input.worktreesRoot}/`) && !known.has(path)) plan.untracked.push(path);
89
+ return plan;
90
+ }
91
+ //#endregion
92
+ export { branchSlug, planPrune, reconcile, refuseClose, refuseSpawn, worktreeDirectory };
93
+
94
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/services/worktreeNaming/index.ts"],"sourcesContent":["/**\n * Naming and reconciliation rules for worktrees, as pure functions.\n *\n * Everything here is a function of its arguments so the interesting decisions,\n * which are the ones about destroying work, can be tested without a repository\n * or a filesystem.\n */\n\nimport type { WorktreeRecord } from '../../types/worktreeRegistry';\n\nconst MAX_SLUG_LENGTH = 64;\n\n/**\n * A branch name reduced to one safe path segment.\n *\n * Slashes are the point: `wt/fix-auth` is a perfectly good branch and a\n * terrible directory name, because the nested directory it implies is not the\n * one the worktree lives in.\n */\nexport function branchSlug(branch: string): string {\n const slug = branch\n .toLowerCase()\n .replace(/[^a-z0-9]+/gu, '-')\n .replace(/^-+|-+$/gu, '')\n .slice(0, MAX_SLUG_LENGTH)\n .replace(/-+$/gu, '');\n return slug === '' ? 'worktree' : slug;\n}\n\n/**\n * The directory for one worktree.\n *\n * The short id disambiguates two branches whose slugs collide, such as\n * `feature/x` and `feature_x`, which would otherwise want the same directory.\n */\nexport function worktreeDirectory(input: {\n worktreesRoot: string;\n repositoryLabel: string;\n repositoryId: string;\n branch: string;\n shortId: string;\n}): string {\n const repository = `${input.repositoryLabel}--${input.repositoryId}`;\n return `${input.worktreesRoot}/${repository}/${branchSlug(input.branch)}--${input.shortId}`;\n}\n\n/** Why a worktree cannot be created, or undefined when it can. */\nexport function refuseSpawn(input: { branch: string; existing: readonly WorktreeRecord[] }): string | undefined {\n if (input.branch.trim() === '') return 'A branch name is required.';\n // Git refuses a second worktree on one branch, but its message names a path\n // the caller never chose, so this says it in the caller's own terms first.\n const live = input.existing.find((record) => record.branch === input.branch && record.status !== 'orphaned');\n if (live) return `Branch ${input.branch} already has a worktree (${live.id}).`;\n return undefined;\n}\n\n/** Why a worktree cannot be closed, or undefined when it can. */\nexport function refuseClose(input: {\n record: WorktreeRecord | undefined;\n dirtyFiles: readonly string[];\n force: boolean;\n}): string | undefined {\n if (!input.record) return 'No worktree with that id. Call list to see the current ids.';\n if (input.dirtyFiles.length === 0 || input.force) return undefined;\n // Naming the files is the point: \"the tree is dirty\" sends the reader to go\n // look, and the answer is usually a file they forgot rather than one they\n // meant to keep.\n const names = input.dirtyFiles.slice(0, 10).join(', ');\n const more = input.dirtyFiles.length > 10 ? `, and ${String(input.dirtyFiles.length - 10)} more` : '';\n return `${String(input.dirtyFiles.length)} uncommitted file(s): ${names}${more}. Pass force: true to discard them.`;\n}\n\nexport interface Reconciliation {\n records: WorktreeRecord[];\n /** Ids whose status changed, so a caller can report what it noticed. */\n changed: string[];\n}\n\n/**\n * Marks records whose process or directory is gone as orphaned.\n *\n * Nothing is deleted here. A doompi-git orphan owns a directory that may hold\n * uncommitted work, so losing the record would lose the only pointer to it.\n * Deletion is always a separate, named decision.\n */\nexport function reconcile(\n records: readonly WorktreeRecord[],\n probe: { alive: (record: WorktreeRecord) => boolean; exists: (path: string) => boolean },\n): Reconciliation {\n const changed: string[] = [];\n const next = records.map((record) => {\n if (record.status === 'orphaned') return record;\n const gone = !probe.exists(record.path) || !probe.alive(record);\n if (!gone) return record;\n changed.push(record.id);\n return { ...record, status: 'orphaned' as const };\n });\n return { records: next, changed };\n}\n\nexport interface PrunePlan {\n /** Orphans whose directory git still lists, safe to remove. */\n remove: WorktreeRecord[];\n /** Orphans whose directory is already gone; drop the record only. */\n forget: WorktreeRecord[];\n /** Paths git lists under our root that we have no record of; report, never touch. */\n untracked: string[];\n /** Orphans left alone because they still hold uncommitted work. */\n keptDirty: WorktreeRecord[];\n /**\n * Branches git refused to delete because they hold commits.\n *\n * Filled by the prune itself, not by the plan: a dry run destroys nothing, so\n * it has nothing to report here and leaves it empty.\n */\n keptBranches: string[];\n}\n\n/**\n * What a prune would do, decided before anything is destroyed.\n *\n * Separating the plan from the execution is what makes dryRun honest and lets\n * the destructive half be reviewed on its own.\n */\nexport function planPrune(input: {\n records: readonly WorktreeRecord[];\n gitPaths: readonly string[];\n worktreesRoot: string;\n dirtyByPath: ReadonlyMap<string, readonly string[]>;\n}): PrunePlan {\n const plan: PrunePlan = { remove: [], forget: [], untracked: [], keptDirty: [], keptBranches: [] };\n const known = new Set(input.records.map((record) => record.path));\n const listed = new Set(input.gitPaths);\n for (const record of input.records) {\n if (record.status !== 'orphaned') continue;\n if (!listed.has(record.path)) {\n plan.forget.push(record);\n continue;\n }\n if ((input.dirtyByPath.get(record.path) ?? []).length > 0) {\n plan.keptDirty.push(record);\n continue;\n }\n plan.remove.push(record);\n }\n for (const path of input.gitPaths) {\n // Only ever inside our own root: a worktree the user made by hand is none\n // of this package's business, even when it looks abandoned.\n if (path.startsWith(`${input.worktreesRoot}/`) && !known.has(path)) plan.untracked.push(path);\n }\n return plan;\n}\n"],"mappings":";AAUA,MAAM,kBAAkB;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AO;GAClB,QAAQ,KAAK,OAAO,EAAE;GACtB,OAAO;IAAE,GAAG;IAAQ,QAAQ;GAAoB;EAClD,CACqB;EAAG;CAAQ;AAClC;;;;;;;AA0BA,SAAgB,UAAU,OAKZ;CACZ,MAAM,OAAkB;EAAE,QAAQ,CAAC;EAAG,QAAQ,CAAC;EAAG,WAAW,CAAC;EAAG,WAAW,CAAC;EAAG,cAAc,CAAC;CAAE;CACjG,MAAM,QAAQ,IAAI,IAAI,MAAM,QAAQ,KAAK,WAAW,OAAO,IAAI,CAAC;CAChE,MAAM,SAAS,IAAI,IAAI,MAAM,QAAQ;CACrC,KAAK,MAAM,UAAU,MAAM,SAAS;EAClC,IAAI,OAAO,WAAW,YAAY;EAClC,IAAI,CAAC,OAAO,IAAI,OAAO,IAAI,GAAG;GAC5B,KAAK,OAAO,KAAK,MAAM;GACvB;EACF;EACA,KAAK,MAAM,YAAY,IAAI,OAAO,IAAI,KAAK,CAAC,EAAA,CAAG,SAAS,GAAG;GACzD,KAAK,UAAU,KAAK,MAAM;GAC1B;EACF;EACA,KAAK,OAAO,KAAK,MAAM;CACzB;CACA,KAAK,MAAM,QAAQ,MAAM,UAGvB,IAAI,KAAK,WAAW,GAAG,MAAM,cAAc,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,GAAG,KAAK,UAAU,KAAK,IAAI;CAE9F,OAAO;AACT"}
@@ -0,0 +1,263 @@
1
+ const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_index = require("../compositionMirror/index.cjs");
3
+ const require_index$1 = require("../errors/index.cjs");
4
+ const require_index$2 = require("../repositoryIdentity/index.cjs");
5
+ const require_index$3 = require("../paths/index.cjs");
6
+ const require_index$4 = require("../worktreeEvents/index.cjs");
7
+ const require_index$5 = require("../worktreeNaming/index.cjs");
8
+ const require_index$6 = require("../worktreeRegistry/index.cjs");
9
+ let node_fs = require("node:fs");
10
+ node_fs = require_runtime.__toESM(node_fs, 1);
11
+ let node_crypto = require("node:crypto");
12
+ //#region src/services/worktreeOperations/index.ts
13
+ function createWorktreeOperations(deps) {
14
+ const { git } = deps;
15
+ const sessionService = deps.sessionService;
16
+ const mirror = deps.mirror ?? require_index.mirrorComposition;
17
+ const now = deps.now ?? (() => /* @__PURE__ */ new Date());
18
+ const requireSessionService = () => {
19
+ if (sessionService === void 0) throw new require_index$1.HubUnavailableError("The cockpit session service is unavailable. Start the cockpit and try again.");
20
+ return sessionService;
21
+ };
22
+ const requireMessageInbox = () => {
23
+ if (deps.messageInbox === void 0) throw new require_index$1.HubUnavailableError("The Git message service is unavailable. Start the cockpit and try again.");
24
+ return deps.messageInbox;
25
+ };
26
+ const probe = {
27
+ alive: (record) => requireSessionService().isLive(record.sessionId),
28
+ exists: (path) => node_fs.default.existsSync(path)
29
+ };
30
+ /**
31
+ * Everything an action needs about the repository it is acting on.
32
+ *
33
+ * Resolved per call rather than cached: a session's cwd is stable, but the
34
+ * worktree registry is shared and another process may have written it since
35
+ * the last call.
36
+ */
37
+ const resolve = async (context) => {
38
+ const root = await git.repositoryRoot(context.cwd);
39
+ if (root === void 0) throw new require_index$1.DoomGitExpectedError("not_a_repository", `${context.cwd} is not inside a git repository.`, false, "Run this from a repository checkout.");
40
+ const store = require_index$6.createWorktreeRegistry(require_index$3.registryFile(root, deps.homeDir));
41
+ return {
42
+ root,
43
+ store,
44
+ records: store.list()
45
+ };
46
+ };
47
+ const require$1 = (records, id) => {
48
+ const record = records.find((entry) => entry.id === id);
49
+ if (record === void 0) throw new require_index$1.DoomGitExpectedError("worktree_not_found", `No worktree with id ${id}.`, false, "Call list to see the current ids.");
50
+ return record;
51
+ };
52
+ /**
53
+ * Refuses to destroy or merge a worktree another live session is using.
54
+ *
55
+ * `parentSessionId` records who asked for the worktree. Two sessions in one
56
+ * checkout share this registry, so without the check either could close the
57
+ * other's work in progress by id.
58
+ *
59
+ * Once that session is gone there is no owner left to protect, and refusing
60
+ * would strand the worktree: nothing else could ever close it.
61
+ */
62
+ const requireOwner = (context, record, action) => {
63
+ if (record.parentSessionId === context.sessionId) return;
64
+ if (!requireSessionService().isLive(record.parentSessionId)) return;
65
+ throw new require_index$1.DoomGitExpectedError("worktree_not_owned", `Worktree ${record.id} belongs to another session.`, false, `Ask the session that created it to ${action} it, or close that session first.`);
66
+ };
67
+ const peerFor = (context, record) => {
68
+ if (context.sessionId === record.parentSessionId) return {
69
+ sessionId: record.sessionId,
70
+ party: "parent"
71
+ };
72
+ if (context.sessionId === record.sessionId) return {
73
+ sessionId: record.parentSessionId,
74
+ party: "child"
75
+ };
76
+ throw new require_index$1.DoomGitExpectedError("worktree_not_owned", `Worktree ${record.id} belongs to another session.`, false, "Use a worktree owned by this session.");
77
+ };
78
+ const requirePeerLive = (peerSessionId) => {
79
+ if (!requireSessionService().isLive(peerSessionId)) throw new require_index$1.DoomGitExpectedError("worktree_peer_unavailable", "The other worktree session is no longer live.", false, "Start a new worktree session before sending a message.");
80
+ };
81
+ return {
82
+ async spawn(context, request, options) {
83
+ const { root, store, records } = await resolve(context);
84
+ const refusal = require_index$5.refuseSpawn({
85
+ branch: request.branch,
86
+ existing: records
87
+ });
88
+ if (refusal !== void 0) throw new require_index$1.DoomGitExpectedError("worktree_exists", refusal, false, "Pick another branch name, or close it.");
89
+ const baseRef = request.baseRef ?? await git.currentBranch(root) ?? "HEAD";
90
+ const id = require_index$2.shortId((0, node_crypto.randomUUID)());
91
+ const path = require_index$5.worktreeDirectory({
92
+ worktreesRoot: require_index$3.worktreesRoot(deps.homeDir),
93
+ repositoryLabel: require_index$2.repositoryLabel(root),
94
+ repositoryId: require_index$2.repositoryId(root),
95
+ branch: request.branch,
96
+ shortId: id
97
+ });
98
+ const cancelled = () => options?.signal?.aborted === true;
99
+ const rollback = async () => {
100
+ await git.removeWorktree({
101
+ repositoryRoot: root,
102
+ path,
103
+ force: true
104
+ }).catch(() => void 0);
105
+ return await git.deleteBranch({
106
+ repositoryRoot: root,
107
+ branch: request.branch
108
+ }).catch(() => false) ? "" : ` The branch ${request.branch} has work on it and was kept.`;
109
+ };
110
+ options?.onProgress?.(`creating branch ${request.branch}\u2026`);
111
+ await git.addWorktree({
112
+ repositoryRoot: root,
113
+ path,
114
+ branch: request.branch,
115
+ baseRef
116
+ });
117
+ if (cancelled()) {
118
+ const kept = await rollback();
119
+ throw new require_index$1.DoomGitExpectedError("spawn_cancelled", `Cancelled before the session started.${kept}`, false, "The worktree was removed; run it again when you are ready.");
120
+ }
121
+ options?.onProgress?.("mirroring build output…");
122
+ mirror(root, path);
123
+ options?.onProgress?.("starting session…");
124
+ let sessionId;
125
+ try {
126
+ sessionId = (await requireSessionService().create({
127
+ cwd: path,
128
+ name: request.name ?? request.branch,
129
+ parentSessionId: context.sessionId,
130
+ sessionProvenance: "worktree",
131
+ ...options?.signal === void 0 ? {} : { signal: options.signal }
132
+ })).sessionId;
133
+ } catch (error) {
134
+ const kept = await rollback();
135
+ if (cancelled()) throw new require_index$1.DoomGitExpectedError("spawn_cancelled", `Cancelled while the session was starting.${kept}`, false, "The worktree was removed; run it again when you are ready.");
136
+ if (error instanceof require_index$1.HubUnavailableError) throw new require_index$1.DoomGitExpectedError("hub_unavailable", `${error.message}${kept}`, true, "Start the cockpit and try again.");
137
+ throw error;
138
+ }
139
+ const record = {
140
+ version: 1,
141
+ id,
142
+ branch: request.branch,
143
+ baseRef,
144
+ path,
145
+ repositoryRoot: root,
146
+ sessionId,
147
+ parentSessionId: context.sessionId,
148
+ status: "running",
149
+ createdAt: now().toISOString()
150
+ };
151
+ try {
152
+ store.replace([...records, record]);
153
+ } catch (error) {
154
+ await requireSessionService().close(sessionId).catch(() => void 0);
155
+ const kept = await rollback();
156
+ throw new require_index$1.DoomGitExpectedError("registry_write_failed", `The worktree was created but the registry could not be written (${error.message}).${kept}`, true, "Check the registry file for permissions or free space, then try again.");
157
+ }
158
+ return record;
159
+ },
160
+ async close(context, id, force) {
161
+ const { root, store, records } = await resolve(context);
162
+ const record = require$1(records, id);
163
+ requireOwner(context, record, "close");
164
+ const dirtyFiles = node_fs.default.existsSync(record.path) ? await git.dirtyFiles(record.path) : [];
165
+ const refusal = require_index$5.refuseClose({
166
+ record,
167
+ dirtyFiles,
168
+ force
169
+ });
170
+ if (refusal !== void 0) throw new require_index$1.DoomGitExpectedError("worktree_dirty", refusal, false, "Commit the work, or pass force: true.");
171
+ await requireSessionService().close(record.sessionId);
172
+ await git.removeWorktree({
173
+ repositoryRoot: root,
174
+ path: record.path,
175
+ force
176
+ });
177
+ store.replace(records.filter((entry) => entry.id !== id));
178
+ return record;
179
+ },
180
+ async list(context) {
181
+ const { store, records } = await resolve(context);
182
+ const outcome = require_index$5.reconcile(records, probe);
183
+ if (outcome.changed.length > 0) store.replace(outcome.records);
184
+ return outcome.records;
185
+ },
186
+ async status(context, id) {
187
+ const { records } = await resolve(context);
188
+ const record = require$1(records, id);
189
+ return {
190
+ record,
191
+ dirtyFiles: node_fs.default.existsSync(record.path) ? await git.dirtyFiles(record.path) : []
192
+ };
193
+ },
194
+ async merge(context, id, message) {
195
+ const { root, records } = await resolve(context);
196
+ const record = require$1(records, id);
197
+ requireOwner(context, record, "merge");
198
+ const parentDirty = await git.dirtyFiles(root);
199
+ if (parentDirty.length > 0) throw new require_index$1.DoomGitExpectedError("worktree_dirty", `The parent checkout has ${String(parentDirty.length)} uncommitted file(s): ${parentDirty.slice(0, 10).join(", ")}.`, false, "Commit or stash the parent checkout first.");
200
+ await git.mergeBranch({
201
+ repositoryRoot: root,
202
+ branch: record.branch,
203
+ ...message === void 0 ? {} : { message }
204
+ });
205
+ return record;
206
+ },
207
+ /** Sends only between the parent session and its own worktree session. */
208
+ async send(context, id, message) {
209
+ if (Buffer.byteLength(message, "utf8") > 65536) throw new require_index$1.DoomGitExpectedError("message_too_large", `A message may not exceed ${String(require_index$4.MAX_WORKTREE_MESSAGE_BYTES)} bytes.`, false, "Send a shorter message.");
210
+ const { records } = await resolve(context);
211
+ const record = require$1(records, id);
212
+ const peer = peerFor(context, record);
213
+ requirePeerLive(peer.sessionId);
214
+ requireMessageInbox().send(peer.sessionId, {
215
+ version: 1,
216
+ worktreeId: record.id,
217
+ fromSessionId: context.sessionId,
218
+ from: peer.party,
219
+ text: message,
220
+ sentAt: (/* @__PURE__ */ new Date()).toISOString()
221
+ });
222
+ },
223
+ async messages(context, id) {
224
+ const { records } = await resolve(context);
225
+ const record = require$1(records, id);
226
+ peerFor(context, record);
227
+ return requireMessageInbox().receive(record.id);
228
+ },
229
+ async prune(context, dryRun) {
230
+ const { root, store, records } = await resolve(context);
231
+ const reconciled = require_index$5.reconcile(records, probe);
232
+ const gitPaths = await git.listWorktreePaths(root);
233
+ const dirtyByPath = /* @__PURE__ */ new Map();
234
+ for (const record of reconciled.records) if (record.status === "orphaned" && node_fs.default.existsSync(record.path)) dirtyByPath.set(record.path, await git.dirtyFiles(record.path));
235
+ const plan = require_index$5.planPrune({
236
+ records: reconciled.records,
237
+ gitPaths,
238
+ worktreesRoot: require_index$3.worktreesRoot(deps.homeDir),
239
+ dirtyByPath
240
+ });
241
+ if (dryRun) {
242
+ store.replace(reconciled.records);
243
+ return plan;
244
+ }
245
+ for (const record of plan.remove) await git.removeWorktree({
246
+ repositoryRoot: root,
247
+ path: record.path,
248
+ force: false
249
+ });
250
+ for (const record of [...plan.remove, ...plan.forget]) if (!await git.deleteBranch({
251
+ repositoryRoot: root,
252
+ branch: record.branch
253
+ }).catch(() => false)) plan.keptBranches.push(record.branch);
254
+ const dropped = new Set([...plan.remove, ...plan.forget].map((record) => record.id));
255
+ store.replace(reconciled.records.filter((record) => !dropped.has(record.id)));
256
+ return plan;
257
+ }
258
+ };
259
+ }
260
+ //#endregion
261
+ exports.createWorktreeOperations = createWorktreeOperations;
262
+
263
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["mirrorComposition","HubUnavailableError","fs","DoomGitExpectedError","createWorktreeRegistry","registryFile","require","refuseSpawn","shortId","randomUUID","worktreeDirectory","worktreesRoot","repositoryLabel","repositoryId","refuseClose","reconcile","MAX_WORKTREE_MESSAGE_BYTES","planPrune"],"sources":["../../../../src/services/worktreeOperations/index.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\n\nimport type { DoomHubSessionService } from '@agimon-ai/doompi-core/hub-channel';\n\nimport { WORKTREE_RECORD_VERSION } from '../../types/worktreeRegistry';\nimport type { WorktreeGit, WorktreeRecord } from '../../types/worktreeRegistry';\nimport { mirrorComposition } from '../compositionMirror';\nimport { DoomGitExpectedError, HubUnavailableError } from '../errors';\nimport { registryFile, worktreesRoot } from '../paths';\nimport { repositoryId, repositoryLabel, shortId } from '../repositoryIdentity';\nimport { MAX_WORKTREE_MESSAGE_BYTES, type WorktreeMessageInbox, type WorktreeMessageParty } from '../worktreeEvents';\nimport { planPrune, reconcile, refuseClose, refuseSpawn, worktreeDirectory } from '../worktreeNaming';\nimport { createWorktreeRegistry } from '../worktreeRegistry';\n\nexport interface WorktreeContext {\n /** Where the calling session is working, used to find the repository. */\n cwd: string;\n /** The calling session, recorded as the new session's parent. */\n sessionId: string;\n}\n\nexport interface SpawnWorktreeRequest {\n branch: string;\n baseRef?: string;\n name?: string;\n}\n\nexport interface SpawnOptions {\n /** Aborted when the caller gives up, so a spawn nobody is waiting for stops. */\n signal?: AbortSignal;\n /** Phase labels, for a caller that can show them while the work runs. */\n onProgress?: (label: string) => void;\n}\n\nexport interface WorktreeOperations {\n spawn(context: WorktreeContext, request: SpawnWorktreeRequest, options?: SpawnOptions): Promise<WorktreeRecord>;\n close(context: WorktreeContext, id: string, force: boolean): Promise<WorktreeRecord>;\n list(context: WorktreeContext): Promise<WorktreeRecord[]>;\n status(context: WorktreeContext, id: string): Promise<{ record: WorktreeRecord; dirtyFiles: string[] }>;\n merge(context: WorktreeContext, id: string, message?: string): Promise<WorktreeRecord>;\n prune(context: WorktreeContext, dryRun: boolean): Promise<ReturnType<typeof planPrune>>;\n send(context: WorktreeContext, id: string, message: string): Promise<void>;\n messages(context: WorktreeContext, id: string): Promise<import('../worktreeEvents').WorktreeMessage[]>;\n}\n\nexport interface WorktreeOperationsDeps {\n git: WorktreeGit;\n /** The canonical hub-owned session lifecycle. */\n sessionService?: DoomHubSessionService;\n /** Session-local inbox for parent/worktree messages. */\n messageInbox?: WorktreeMessageInbox;\n /** Injected so a test never copies a real dependency tree. */\n mirror?: typeof mirrorComposition;\n homeDir?: string;\n /** Injected so a record's createdAt is reproducible in a test. */\n now?: () => Date;\n}\n\nexport function createWorktreeOperations(deps: WorktreeOperationsDeps): WorktreeOperations {\n const { git } = deps;\n const sessionService = deps.sessionService;\n const mirror = deps.mirror ?? mirrorComposition;\n const now = deps.now ?? (() => new Date());\n const requireSessionService = (): DoomHubSessionService => {\n if (sessionService === undefined)\n throw new HubUnavailableError('The cockpit session service is unavailable. Start the cockpit and try again.');\n return sessionService;\n };\n const requireMessageInbox = (): WorktreeMessageInbox => {\n if (deps.messageInbox === undefined)\n throw new HubUnavailableError('The Git message service is unavailable. Start the cockpit and try again.');\n return deps.messageInbox;\n };\n const probe = {\n alive: (record: WorktreeRecord) => requireSessionService().isLive(record.sessionId),\n exists: (path: string) => fs.existsSync(path),\n };\n\n /**\n * Everything an action needs about the repository it is acting on.\n *\n * Resolved per call rather than cached: a session's cwd is stable, but the\n * worktree registry is shared and another process may have written it since\n * the last call.\n */\n const resolve = async (context: WorktreeContext) => {\n const root = await git.repositoryRoot(context.cwd);\n if (root === undefined) {\n throw new DoomGitExpectedError(\n 'not_a_repository',\n `${context.cwd} is not inside a git repository.`,\n false,\n 'Run this from a repository checkout.',\n );\n }\n const store = createWorktreeRegistry(registryFile(root, deps.homeDir));\n return { root, store, records: store.list() };\n };\n\n const require = (records: readonly WorktreeRecord[], id: string): WorktreeRecord => {\n const record = records.find((entry) => entry.id === id);\n if (record === undefined) {\n throw new DoomGitExpectedError(\n 'worktree_not_found',\n `No worktree with id ${id}.`,\n false,\n 'Call list to see the current ids.',\n );\n }\n return record;\n };\n\n /**\n * Refuses to destroy or merge a worktree another live session is using.\n *\n * `parentSessionId` records who asked for the worktree. Two sessions in one\n * checkout share this registry, so without the check either could close the\n * other's work in progress by id.\n *\n * Once that session is gone there is no owner left to protect, and refusing\n * would strand the worktree: nothing else could ever close it.\n */\n const requireOwner = (context: WorktreeContext, record: WorktreeRecord, action: string): void => {\n if (record.parentSessionId === context.sessionId) return;\n if (!requireSessionService().isLive(record.parentSessionId)) return;\n throw new DoomGitExpectedError(\n 'worktree_not_owned',\n `Worktree ${record.id} belongs to another session.`,\n false,\n `Ask the session that created it to ${action} it, or close that session first.`,\n );\n };\n\n const peerFor = (\n context: WorktreeContext,\n record: WorktreeRecord,\n ): { sessionId: string; party: WorktreeMessageParty } => {\n if (context.sessionId === record.parentSessionId) return { sessionId: record.sessionId, party: 'parent' };\n if (context.sessionId === record.sessionId) return { sessionId: record.parentSessionId, party: 'child' };\n throw new DoomGitExpectedError(\n 'worktree_not_owned',\n `Worktree ${record.id} belongs to another session.`,\n false,\n 'Use a worktree owned by this session.',\n );\n };\n\n const requirePeerLive = (peerSessionId: string): void => {\n if (!requireSessionService().isLive(peerSessionId)) {\n throw new DoomGitExpectedError(\n 'worktree_peer_unavailable',\n 'The other worktree session is no longer live.',\n false,\n 'Start a new worktree session before sending a message.',\n );\n }\n };\n\n return {\n async spawn(context, request, options) {\n const { root, store, records } = await resolve(context);\n const refusal = refuseSpawn({ branch: request.branch, existing: records });\n if (refusal !== undefined) {\n throw new DoomGitExpectedError('worktree_exists', refusal, false, 'Pick another branch name, or close it.');\n }\n const baseRef = request.baseRef ?? (await git.currentBranch(root)) ?? 'HEAD';\n const id = shortId(randomUUID());\n const path = worktreeDirectory({\n worktreesRoot: worktreesRoot(deps.homeDir),\n repositoryLabel: repositoryLabel(root),\n repositoryId: repositoryId(root),\n branch: request.branch,\n shortId: id,\n });\n\n // The worktree and the branch are made by one command, so they are undone\n // by one too. `worktree remove` leaves the branch behind, and a branch\n // nobody asked for is what a failed spawn used to leave on the floor.\n const cancelled = (): boolean => options?.signal?.aborted === true;\n const rollback = async (): Promise<string> => {\n await git.removeWorktree({ repositoryRoot: root, path, force: true }).catch(() => undefined);\n const deleted = await git.deleteBranch({ repositoryRoot: root, branch: request.branch }).catch(() => false);\n return deleted ? '' : ` The branch ${request.branch} has work on it and was kept.`;\n };\n\n options?.onProgress?.(`creating branch ${request.branch}\\u2026`);\n await git.addWorktree({ repositoryRoot: root, path, branch: request.branch, baseRef });\n\n // Checked here rather than only inside the session call: this is the\n // point where a checkout exists that nothing has recorded yet, which is\n // exactly the state an interrupted spawn used to leave behind.\n if (cancelled()) {\n const kept = await rollback();\n throw new DoomGitExpectedError(\n 'spawn_cancelled',\n `Cancelled before the session started.${kept}`,\n false,\n 'The worktree was removed; run it again when you are ready.',\n );\n }\n\n // Before the session, because the session composes the extensions this\n // repository's config names and those live in build output git does not\n // track. A worktree without it starts and dies on the first package it\n // cannot resolve. Nothing here can fail the spawn: a repository with no\n // build output to mirror simply has none.\n options?.onProgress?.('mirroring build output\\u2026');\n mirror(root, path);\n\n // The worktree exists from here on, so every later failure has to leave\n // it removed or recorded. An unrecorded directory on disk is the one\n // outcome with no way back: nothing would ever list it again.\n options?.onProgress?.('starting session\\u2026');\n let sessionId: string;\n try {\n const session = await requireSessionService().create({\n cwd: path,\n name: request.name ?? request.branch,\n parentSessionId: context.sessionId,\n sessionProvenance: 'worktree',\n ...(options?.signal === undefined ? {} : { signal: options.signal }),\n });\n sessionId = session.sessionId;\n } catch (error) {\n const kept = await rollback();\n if (cancelled()) {\n throw new DoomGitExpectedError(\n 'spawn_cancelled',\n `Cancelled while the session was starting.${kept}`,\n false,\n 'The worktree was removed; run it again when you are ready.',\n );\n }\n if (error instanceof HubUnavailableError) {\n throw new DoomGitExpectedError(\n 'hub_unavailable',\n `${error.message}${kept}`,\n true,\n 'Start the cockpit and try again.',\n );\n }\n throw error;\n }\n\n const record: WorktreeRecord = {\n version: WORKTREE_RECORD_VERSION,\n id,\n branch: request.branch,\n baseRef,\n path,\n repositoryRoot: root,\n sessionId,\n parentSessionId: context.sessionId,\n status: 'running',\n createdAt: now().toISOString(),\n };\n try {\n store.replace([...records, record]);\n } catch (error) {\n // A live session with no record is the worst outcome available here:\n // it runs, and no id anything can name points at it. The session goes\n // back too, rather than being left for someone to find by hand.\n await requireSessionService()\n .close(sessionId)\n .catch(() => undefined);\n const kept = await rollback();\n throw new DoomGitExpectedError(\n 'registry_write_failed',\n `The worktree was created but the registry could not be written (${(error as Error).message}).${kept}`,\n true,\n 'Check the registry file for permissions or free space, then try again.',\n );\n }\n return record;\n },\n\n async close(context, id, force) {\n const { root, store, records } = await resolve(context);\n const record = require(records, id);\n requireOwner(context, record, 'close');\n const dirtyFiles = fs.existsSync(record.path) ? await git.dirtyFiles(record.path) : [];\n const refusal = refuseClose({ record, dirtyFiles, force });\n if (refusal !== undefined) {\n throw new DoomGitExpectedError('worktree_dirty', refusal, false, 'Commit the work, or pass force: true.');\n }\n // The session is stopped before the directory goes. Removing a checkout\n // while a process still holds files open in it is how a half-removed\n // worktree and a stale git administrative entry are made.\n await requireSessionService().close(record.sessionId);\n await git.removeWorktree({ repositoryRoot: root, path: record.path, force });\n store.replace(records.filter((entry) => entry.id !== id));\n return record;\n },\n\n async list(context) {\n const { store, records } = await resolve(context);\n const outcome = reconcile(records, probe);\n if (outcome.changed.length > 0) store.replace(outcome.records);\n return outcome.records;\n },\n\n async status(context, id) {\n const { records } = await resolve(context);\n const record = require(records, id);\n const dirtyFiles = fs.existsSync(record.path) ? await git.dirtyFiles(record.path) : [];\n return { record, dirtyFiles };\n },\n\n async merge(context, id, message) {\n const { root, records } = await resolve(context);\n const record = require(records, id);\n requireOwner(context, record, 'merge');\n // The merge lands in the parent, so the parent is what must be clean. A\n // dirty parent would mix the person's in-flight edits into a merge commit\n // they did not intend to make.\n const parentDirty = await git.dirtyFiles(root);\n if (parentDirty.length > 0) {\n throw new DoomGitExpectedError(\n 'worktree_dirty',\n `The parent checkout has ${String(parentDirty.length)} uncommitted file(s): ${parentDirty.slice(0, 10).join(', ')}.`,\n false,\n 'Commit or stash the parent checkout first.',\n );\n }\n await git.mergeBranch({\n repositoryRoot: root,\n branch: record.branch,\n ...(message === undefined ? {} : { message }),\n });\n return record;\n },\n\n /** Sends only between the parent session and its own worktree session. */\n async send(context, id, message) {\n if (Buffer.byteLength(message, 'utf8') > MAX_WORKTREE_MESSAGE_BYTES) {\n throw new DoomGitExpectedError(\n 'message_too_large',\n `A message may not exceed ${String(MAX_WORKTREE_MESSAGE_BYTES)} bytes.`,\n false,\n 'Send a shorter message.',\n );\n }\n const { records } = await resolve(context);\n const record = require(records, id);\n const peer = peerFor(context, record);\n requirePeerLive(peer.sessionId);\n requireMessageInbox().send(peer.sessionId, {\n version: 1,\n worktreeId: record.id,\n fromSessionId: context.sessionId,\n from: peer.party,\n text: message,\n sentAt: new Date().toISOString(),\n });\n },\n\n async messages(context, id) {\n const { records } = await resolve(context);\n const record = require(records, id);\n peerFor(context, record);\n return requireMessageInbox().receive(record.id);\n },\n\n async prune(context, dryRun) {\n const { root, store, records } = await resolve(context);\n const reconciled = reconcile(records, probe);\n const gitPaths = await git.listWorktreePaths(root);\n const dirtyByPath = new Map<string, readonly string[]>();\n for (const record of reconciled.records) {\n if (record.status === 'orphaned' && fs.existsSync(record.path)) {\n dirtyByPath.set(record.path, await git.dirtyFiles(record.path));\n }\n }\n const plan = planPrune({\n records: reconciled.records,\n gitPaths,\n worktreesRoot: worktreesRoot(deps.homeDir),\n dirtyByPath,\n });\n if (dryRun) {\n store.replace(reconciled.records);\n return plan;\n }\n for (const record of plan.remove) {\n await git.removeWorktree({ repositoryRoot: root, path: record.path, force: false });\n }\n // The checkout goes, so the branch it was made for goes with it. Safe\n // delete only: git keeps anything holding commits, and the plan says\n // which ones it kept rather than leaving the reader to notice later.\n for (const record of [...plan.remove, ...plan.forget]) {\n const deleted = await git.deleteBranch({ repositoryRoot: root, branch: record.branch }).catch(() => false);\n if (!deleted) plan.keptBranches.push(record.branch);\n }\n const dropped = new Set([...plan.remove, ...plan.forget].map((record) => record.id));\n store.replace(reconciled.records.filter((record) => !dropped.has(record.id)));\n return plan;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;AA2DA,SAAgB,yBAAyB,MAAkD;CACzF,MAAM,EAAE,QAAQ;CAChB,MAAM,iBAAiB,KAAK;CAC5B,MAAM,SAAS,KAAK,UAAUA,cAAAA;CAC9B,MAAM,MAAM,KAAK,8BAAc,IAAI,KAAK;CACxC,MAAM,8BAAqD;EACzD,IAAI,mBAAmB,KAAA,GACrB,MAAM,IAAIC,gBAAAA,oBAAoB,8EAA8E;EAC9G,OAAO;CACT;CACA,MAAM,4BAAkD;EACtD,IAAI,KAAK,iBAAiB,KAAA,GACxB,MAAM,IAAIA,gBAAAA,oBAAoB,0EAA0E;EAC1G,OAAO,KAAK;CACd;CACA,MAAM,QAAQ;EACZ,QAAQ,WAA2B,sBAAsB,CAAC,CAAC,OAAO,OAAO,SAAS;EAClF,SAAS,SAAiBC,QAAAA,QAAG,WAAW,IAAI;CAC9C;;;;;;;;CASA,MAAM,UAAU,OAAO,YAA6B;EAClD,MAAM,OAAO,MAAM,IAAI,eAAe,QAAQ,GAAG;EACjD,IAAI,SAAS,KAAA,GACX,MAAM,IAAIC,gBAAAA,qBACR,oBACA,GAAG,QAAQ,IAAI,mCACf,OACA,sCACF;EAEF,MAAM,QAAQC,gBAAAA,uBAAuBC,gBAAAA,aAAa,MAAM,KAAK,OAAO,CAAC;EACrE,OAAO;GAAE;GAAM;GAAO,SAAS,MAAM,KAAK;EAAE;CAC9C;CAEA,MAAMC,aAAW,SAAoC,OAA+B;EAClF,MAAM,SAAS,QAAQ,MAAM,UAAU,MAAM,OAAO,EAAE;EACtD,IAAI,WAAW,KAAA,GACb,MAAM,IAAIH,gBAAAA,qBACR,sBACA,uBAAuB,GAAG,IAC1B,OACA,mCACF;EAEF,OAAO;CACT;;;;;;;;;;;CAYA,MAAM,gBAAgB,SAA0B,QAAwB,WAAy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,EAAE,CAAC,CAAC;GAC5E,OAAO;EACT;CACF;AACF"}
@@ -3,24 +3,24 @@ import { WorktreeRecord } from "../../types/worktreeRegistry.cjs";
3
3
  import { planPrune } from "../worktreeNaming/index.cjs";
4
4
  import "@agimon-ai/doompi-core/hub-channel";
5
5
  //#region src/services/worktreeOperations/index.d.ts
6
- interface WorktreeContext {
6
+ export interface WorktreeContext {
7
7
  /** Where the calling session is working, used to find the repository. */
8
8
  cwd: string;
9
9
  /** The calling session, recorded as the new session's parent. */
10
10
  sessionId: string;
11
11
  }
12
- interface SpawnWorktreeRequest {
12
+ export interface SpawnWorktreeRequest {
13
13
  branch: string;
14
14
  baseRef?: string;
15
15
  name?: string;
16
16
  }
17
- interface SpawnOptions {
17
+ export interface SpawnOptions {
18
18
  /** Aborted when the caller gives up, so a spawn nobody is waiting for stops. */
19
19
  signal?: AbortSignal;
20
20
  /** Phase labels, for a caller that can show them while the work runs. */
21
21
  onProgress?: (label: string) => void;
22
22
  }
23
- interface WorktreeOperations {
23
+ export interface WorktreeOperations {
24
24
  spawn(context: WorktreeContext, request: SpawnWorktreeRequest, options?: SpawnOptions): Promise<WorktreeRecord>;
25
25
  close(context: WorktreeContext, id: string, force: boolean): Promise<WorktreeRecord>;
26
26
  list(context: WorktreeContext): Promise<WorktreeRecord[]>;
@@ -34,5 +34,4 @@ interface WorktreeOperations {
34
34
  messages(context: WorktreeContext, id: string): Promise<WorktreeMessage[]>;
35
35
  }
36
36
  //#endregion
37
- export { SpawnOptions, SpawnWorktreeRequest, WorktreeContext, WorktreeOperations };
38
37
  //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../../../src/services/worktreeOperations/index.ts"],"mappings":";;;;;iBAeiB;;EAEf;;EAEA;;iBAGe;EACf;EACA;EACA;;iBAGe;;EAEf,SAAS;;EAET,cAAc;;iBAGC;EACf,MAAM,SAAS,iBAAiB,SAAS,sBAAsB,UAAU,eAAe,QAAQ;EAChG,MAAM,SAAS,iBAAiB,YAAY,iBAAiB,QAAQ;EACrE,KAAK,SAAS,kBAAkB,QAAQ;EACxC,OAAO,SAAS,iBAAiB,aAAa;IAAU,QAAQ;IAAgB;;EAChF,MAAM,SAAS,iBAAiB,YAAY,mBAAmB,QAAQ;EACvE,MAAM,SAAS,iBAAiB,kBAAkB,QAAQ,kBAAkB;EAC5E,KAAK,SAAS,iBAAiB,YAAY,kBAAkB;EAC7D,SAAS,SAAS,iBAAiB,aAAa,QAA9B"}
@@ -3,24 +3,24 @@ import { WorktreeRecord } from "../../types/worktreeRegistry.mjs";
3
3
  import { planPrune } from "../worktreeNaming/index.mjs";
4
4
  import "@agimon-ai/doompi-core/hub-channel";
5
5
  //#region src/services/worktreeOperations/index.d.ts
6
- interface WorktreeContext {
6
+ export interface WorktreeContext {
7
7
  /** Where the calling session is working, used to find the repository. */
8
8
  cwd: string;
9
9
  /** The calling session, recorded as the new session's parent. */
10
10
  sessionId: string;
11
11
  }
12
- interface SpawnWorktreeRequest {
12
+ export interface SpawnWorktreeRequest {
13
13
  branch: string;
14
14
  baseRef?: string;
15
15
  name?: string;
16
16
  }
17
- interface SpawnOptions {
17
+ export interface SpawnOptions {
18
18
  /** Aborted when the caller gives up, so a spawn nobody is waiting for stops. */
19
19
  signal?: AbortSignal;
20
20
  /** Phase labels, for a caller that can show them while the work runs. */
21
21
  onProgress?: (label: string) => void;
22
22
  }
23
- interface WorktreeOperations {
23
+ export interface WorktreeOperations {
24
24
  spawn(context: WorktreeContext, request: SpawnWorktreeRequest, options?: SpawnOptions): Promise<WorktreeRecord>;
25
25
  close(context: WorktreeContext, id: string, force: boolean): Promise<WorktreeRecord>;
26
26
  list(context: WorktreeContext): Promise<WorktreeRecord[]>;
@@ -34,5 +34,4 @@ interface WorktreeOperations {
34
34
  messages(context: WorktreeContext, id: string): Promise<WorktreeMessage[]>;
35
35
  }
36
36
  //#endregion
37
- export { SpawnOptions, SpawnWorktreeRequest, WorktreeContext, WorktreeOperations };
38
37
  //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/services/worktreeOperations/index.ts"],"mappings":";;;;;iBAeiB;;EAEf;;EAEA;;iBAGe;EACf;EACA;EACA;;iBAGe;;EAEf,SAAS;;EAET,cAAc;;iBAGC;EACf,MAAM,SAAS,iBAAiB,SAAS,sBAAsB,UAAU,eAAe,QAAQ;EAChG,MAAM,SAAS,iBAAiB,YAAY,iBAAiB,QAAQ;EACrE,KAAK,SAAS,kBAAkB,QAAQ;EACxC,OAAO,SAAS,iBAAiB,aAAa;IAAU,QAAQ;IAAgB;;EAChF,MAAM,SAAS,iBAAiB,YAAY,mBAAmB,QAAQ;EACvE,MAAM,SAAS,iBAAiB,kBAAkB,QAAQ,kBAAkB;EAC5E,KAAK,SAAS,iBAAiB,YAAY,kBAAkB;EAC7D,SAAS,SAAS,iBAAiB,aAAa,QAA9B"}