@gitkraken/core-gitlens 0.2.0 → 0.3.1

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 (448) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/dist/git/cache.d.ts +38 -8
  3. package/dist/git/cache.d.ts.map +1 -1
  4. package/dist/git/cache.js +120 -55
  5. package/dist/git/cache.js.map +1 -1
  6. package/dist/git/context.d.ts +19 -0
  7. package/dist/git/context.d.ts.map +1 -1
  8. package/dist/git/context.js.map +1 -1
  9. package/dist/git/features.d.ts +1 -1
  10. package/dist/git/features.d.ts.map +1 -1
  11. package/dist/git/features.js +1 -0
  12. package/dist/git/features.js.map +1 -1
  13. package/dist/git/models/commit.d.ts.map +1 -1
  14. package/dist/git/models/commit.js.map +1 -1
  15. package/dist/git/models/graph.d.ts +96 -0
  16. package/dist/git/models/graph.d.ts.map +1 -1
  17. package/dist/git/models/graph.js +24 -1
  18. package/dist/git/models/graph.js.map +1 -1
  19. package/dist/git/models/reference.d.ts +31 -0
  20. package/dist/git/models/reference.d.ts.map +1 -1
  21. package/dist/git/models/remote.d.ts.map +1 -1
  22. package/dist/git/models/remote.js.map +1 -1
  23. package/dist/git/models/remoteProvider.d.ts +1 -0
  24. package/dist/git/models/remoteProvider.d.ts.map +1 -1
  25. package/dist/git/models/remoteProvider.js.map +1 -1
  26. package/dist/git/models/repository.d.ts +30 -13
  27. package/dist/git/models/repository.d.ts.map +1 -1
  28. package/dist/git/models/repository.js +89 -87
  29. package/dist/git/models/repository.js.map +1 -1
  30. package/dist/git/models/search.d.ts +2 -2
  31. package/dist/git/models/search.d.ts.map +1 -1
  32. package/dist/git/models/statusFile.d.ts +9 -0
  33. package/dist/git/models/statusFile.d.ts.map +1 -1
  34. package/dist/git/models/statusFile.js +11 -0
  35. package/dist/git/models/statusFile.js.map +1 -1
  36. package/dist/git/models/worktree.d.ts +4 -1
  37. package/dist/git/models/worktree.d.ts.map +1 -1
  38. package/dist/git/models/worktree.js +2 -2
  39. package/dist/git/models/worktree.js.map +1 -1
  40. package/dist/git/parsers/diffParser.d.ts.map +1 -1
  41. package/dist/git/parsers/diffParser.js.map +1 -1
  42. package/dist/git/providers/branches.d.ts +15 -4
  43. package/dist/git/providers/branches.d.ts.map +1 -1
  44. package/dist/git/providers/commits.d.ts +4 -0
  45. package/dist/git/providers/commits.d.ts.map +1 -1
  46. package/dist/git/providers/config.d.ts +5 -4
  47. package/dist/git/providers/config.d.ts.map +1 -1
  48. package/dist/git/providers/operations.d.ts +61 -12
  49. package/dist/git/providers/operations.d.ts.map +1 -1
  50. package/dist/git/providers/pausedOperations.d.ts +3 -1
  51. package/dist/git/providers/pausedOperations.d.ts.map +1 -1
  52. package/dist/git/providers/refs.d.ts +23 -2
  53. package/dist/git/providers/refs.d.ts.map +1 -1
  54. package/dist/git/providers/staging.d.ts +16 -0
  55. package/dist/git/providers/staging.d.ts.map +1 -1
  56. package/dist/git/providers/status.d.ts +4 -1
  57. package/dist/git/providers/status.d.ts.map +1 -1
  58. package/dist/git/remotes/azure-devops.d.ts.map +1 -1
  59. package/dist/git/remotes/azure-devops.js.map +1 -1
  60. package/dist/git/remotes/custom.d.ts +2 -0
  61. package/dist/git/remotes/custom.d.ts.map +1 -1
  62. package/dist/git/remotes/custom.js +20 -0
  63. package/dist/git/remotes/custom.js.map +1 -1
  64. package/dist/git/{exec.types.d.ts → run.types.d.ts} +22 -3
  65. package/dist/git/run.types.d.ts.map +1 -0
  66. package/dist/git/run.types.js +2 -0
  67. package/dist/git/run.types.js.map +1 -0
  68. package/dist/git/service.d.ts.map +1 -1
  69. package/dist/git/service.js.map +1 -1
  70. package/dist/git/utils/autolink.utils.d.ts.map +1 -1
  71. package/dist/git/utils/autolink.utils.js.map +1 -1
  72. package/dist/git/utils/blame.utils.d.ts.map +1 -1
  73. package/dist/git/utils/blame.utils.js.map +1 -1
  74. package/dist/git/utils/conflictResolution.utils.d.ts +6 -0
  75. package/dist/git/utils/conflictResolution.utils.d.ts.map +1 -0
  76. package/dist/git/utils/conflictResolution.utils.js +25 -0
  77. package/dist/git/utils/conflictResolution.utils.js.map +1 -0
  78. package/dist/git/utils/contributor.utils.d.ts +3 -0
  79. package/dist/git/utils/contributor.utils.d.ts.map +1 -1
  80. package/dist/git/utils/contributor.utils.js +22 -0
  81. package/dist/git/utils/contributor.utils.js.map +1 -1
  82. package/dist/git/utils/fileStatus.utils.d.ts +2 -1
  83. package/dist/git/utils/fileStatus.utils.d.ts.map +1 -1
  84. package/dist/git/utils/fileStatus.utils.js +4 -0
  85. package/dist/git/utils/fileStatus.utils.js.map +1 -1
  86. package/dist/git/utils/reachability.utils.d.ts +37 -0
  87. package/dist/git/utils/reachability.utils.d.ts.map +1 -0
  88. package/dist/git/utils/reachability.utils.js +96 -0
  89. package/dist/git/utils/reachability.utils.js.map +1 -0
  90. package/dist/git/utils/search.utils.d.ts.map +1 -1
  91. package/dist/git/utils/search.utils.js +3 -0
  92. package/dist/git/utils/search.utils.js.map +1 -1
  93. package/dist/git/utils/sorting.d.ts +8 -0
  94. package/dist/git/utils/sorting.d.ts.map +1 -1
  95. package/dist/git/utils/sorting.js +15 -0
  96. package/dist/git/utils/sorting.js.map +1 -1
  97. package/dist/git/utils/status.utils.d.ts.map +1 -1
  98. package/dist/git/utils/status.utils.js.map +1 -1
  99. package/dist/git/watching/classifyChange.d.ts.map +1 -1
  100. package/dist/git/watching/classifyChange.js +8 -0
  101. package/dist/git/watching/classifyChange.js.map +1 -1
  102. package/dist/git/watching/gitIgnoreFilter.js +1 -1
  103. package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
  104. package/dist/git/watching/initWatcher.d.ts.map +1 -1
  105. package/dist/git/watching/initWatcher.js.map +1 -1
  106. package/dist/git/watching/watchGroup.d.ts.map +1 -1
  107. package/dist/git/watching/watchGroup.js.map +1 -1
  108. package/dist/git/watching/watchService.d.ts +4 -2
  109. package/dist/git/watching/watchService.d.ts.map +1 -1
  110. package/dist/git/watching/watchService.js +31 -6
  111. package/dist/git/watching/watchService.js.map +1 -1
  112. package/dist/git/watching/watchSession.d.ts +14 -12
  113. package/dist/git/watching/watchSession.d.ts.map +1 -1
  114. package/dist/git/watching/watchSession.js +56 -55
  115. package/dist/git/watching/watchSession.js.map +1 -1
  116. package/dist/git-cli/exec/exec.types.d.ts +1 -1
  117. package/dist/git-cli/exec/exec.types.d.ts.map +1 -1
  118. package/dist/git-cli/exec/git.d.ts +3 -3
  119. package/dist/git-cli/exec/git.d.ts.map +1 -1
  120. package/dist/git-cli/exec/git.js.map +1 -1
  121. package/dist/git-cli/exec/gitQueue.d.ts +10 -2
  122. package/dist/git-cli/exec/gitQueue.d.ts.map +1 -1
  123. package/dist/git-cli/exec/gitQueue.js +39 -12
  124. package/dist/git-cli/exec/gitQueue.js.map +1 -1
  125. package/dist/git-cli/parsers/blameParser.d.ts.map +1 -1
  126. package/dist/git-cli/parsers/blameParser.js.map +1 -1
  127. package/dist/git-cli/parsers/logParser.js.map +1 -1
  128. package/dist/git-cli/parsers/refParser.d.ts +3 -30
  129. package/dist/git-cli/parsers/refParser.d.ts.map +1 -1
  130. package/dist/git-cli/parsers/refParser.js +30 -30
  131. package/dist/git-cli/parsers/refParser.js.map +1 -1
  132. package/dist/git-cli/providers/blame.d.ts.map +1 -1
  133. package/dist/git-cli/providers/blame.js.map +1 -1
  134. package/dist/git-cli/providers/branches.d.ts +15 -5
  135. package/dist/git-cli/providers/branches.d.ts.map +1 -1
  136. package/dist/git-cli/providers/branches.js +99 -68
  137. package/dist/git-cli/providers/branches.js.map +1 -1
  138. package/dist/git-cli/providers/commits.d.ts +1 -0
  139. package/dist/git-cli/providers/commits.d.ts.map +1 -1
  140. package/dist/git-cli/providers/commits.js +86 -30
  141. package/dist/git-cli/providers/commits.js.map +1 -1
  142. package/dist/git-cli/providers/config.d.ts +19 -6
  143. package/dist/git-cli/providers/config.d.ts.map +1 -1
  144. package/dist/git-cli/providers/config.js +86 -38
  145. package/dist/git-cli/providers/config.js.map +1 -1
  146. package/dist/git-cli/providers/diff.d.ts.map +1 -1
  147. package/dist/git-cli/providers/diff.js +5 -3
  148. package/dist/git-cli/providers/diff.js.map +1 -1
  149. package/dist/git-cli/providers/graph.d.ts.map +1 -1
  150. package/dist/git-cli/providers/graph.js +139 -16
  151. package/dist/git-cli/providers/graph.js.map +1 -1
  152. package/dist/git-cli/providers/operations.d.ts +17 -14
  153. package/dist/git-cli/providers/operations.d.ts.map +1 -1
  154. package/dist/git-cli/providers/operations.js +135 -63
  155. package/dist/git-cli/providers/operations.js.map +1 -1
  156. package/dist/git-cli/providers/patch.d.ts.map +1 -1
  157. package/dist/git-cli/providers/patch.js.map +1 -1
  158. package/dist/git-cli/providers/pausedOperations.d.ts +3 -1
  159. package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
  160. package/dist/git-cli/providers/pausedOperations.js +7 -1
  161. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  162. package/dist/git-cli/providers/refs.d.ts +19 -2
  163. package/dist/git-cli/providers/refs.d.ts.map +1 -1
  164. package/dist/git-cli/providers/refs.js +286 -2
  165. package/dist/git-cli/providers/refs.js.map +1 -1
  166. package/dist/git-cli/providers/revision.js.map +1 -1
  167. package/dist/git-cli/providers/staging.d.ts +6 -0
  168. package/dist/git-cli/providers/staging.d.ts.map +1 -1
  169. package/dist/git-cli/providers/staging.js +32 -0
  170. package/dist/git-cli/providers/staging.js.map +1 -1
  171. package/dist/git-cli/providers/stash.d.ts.map +1 -1
  172. package/dist/git-cli/providers/stash.js +20 -2
  173. package/dist/git-cli/providers/stash.js.map +1 -1
  174. package/dist/git-cli/providers/status.d.ts +4 -1
  175. package/dist/git-cli/providers/status.d.ts.map +1 -1
  176. package/dist/git-cli/providers/status.js +8 -4
  177. package/dist/git-cli/providers/status.js.map +1 -1
  178. package/dist/git-cli/providers/tags.d.ts.map +1 -1
  179. package/dist/git-cli/providers/tags.js +10 -6
  180. package/dist/git-cli/providers/tags.js.map +1 -1
  181. package/dist/ipc/discovery.d.ts +49 -0
  182. package/dist/ipc/discovery.d.ts.map +1 -0
  183. package/dist/ipc/discovery.js +147 -0
  184. package/dist/ipc/discovery.js.map +1 -0
  185. package/dist/ipc/ipcServer.d.ts +20 -0
  186. package/dist/ipc/ipcServer.d.ts.map +1 -0
  187. package/dist/ipc/ipcServer.js +162 -0
  188. package/dist/ipc/ipcServer.js.map +1 -0
  189. package/dist/plus/agents/providers/claudeCodeProvider.d.ts +167 -0
  190. package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -0
  191. package/dist/plus/agents/providers/claudeCodeProvider.js +1786 -0
  192. package/dist/plus/agents/providers/claudeCodeProvider.js.map +1 -0
  193. package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +36 -0
  194. package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -0
  195. package/dist/plus/agents/providers/claudeCodeTranscript.js +171 -0
  196. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -0
  197. package/dist/plus/agents/sanitizePrompt.d.ts +15 -0
  198. package/dist/plus/agents/sanitizePrompt.d.ts.map +1 -0
  199. package/dist/plus/agents/sanitizePrompt.js +103 -0
  200. package/dist/plus/agents/sanitizePrompt.js.map +1 -0
  201. package/dist/plus/agents/stateMachine.d.ts +32 -0
  202. package/dist/plus/agents/stateMachine.d.ts.map +1 -0
  203. package/dist/plus/agents/stateMachine.js +180 -0
  204. package/dist/plus/agents/stateMachine.js.map +1 -0
  205. package/dist/plus/agents/types.d.ts +254 -0
  206. package/dist/plus/agents/types.d.ts.map +1 -0
  207. package/dist/plus/agents/types.js +49 -0
  208. package/dist/plus/agents/types.js.map +1 -0
  209. package/dist/plus/ai/errors.d.ts +4 -1
  210. package/dist/plus/ai/errors.d.ts.map +1 -1
  211. package/dist/plus/ai/errors.js +38 -0
  212. package/dist/plus/ai/errors.js.map +1 -1
  213. package/dist/plus/ai/models/model.d.ts +1 -1
  214. package/dist/plus/ai/models/model.d.ts.map +1 -1
  215. package/dist/plus/ai/models/model.js.map +1 -1
  216. package/dist/plus/ai/models/promptTemplates.d.ts +11 -2
  217. package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
  218. package/dist/plus/ai/models/provider.d.ts +3 -0
  219. package/dist/plus/ai/models/provider.d.ts.map +1 -1
  220. package/dist/plus/ai/prompts.d.ts +1 -0
  221. package/dist/plus/ai/prompts.d.ts.map +1 -1
  222. package/dist/plus/ai/prompts.js +48 -8
  223. package/dist/plus/ai/prompts.js.map +1 -1
  224. package/dist/plus/ai/providers/gitkrakenProvider.d.ts +1 -1
  225. package/dist/plus/ai/providers/gitkrakenProvider.d.ts.map +1 -1
  226. package/dist/plus/ai/providers/gitkrakenProvider.js +4 -1
  227. package/dist/plus/ai/providers/gitkrakenProvider.js.map +1 -1
  228. package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts +4 -3
  229. package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts.map +1 -1
  230. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +9 -6
  231. package/dist/plus/ai/providers/openAICompatibleProviderBase.js.map +1 -1
  232. package/dist/plus/ai/utils/ai.utils.d.ts.map +1 -1
  233. package/dist/plus/ai/utils/ai.utils.js +2 -0
  234. package/dist/plus/ai/utils/ai.utils.js.map +1 -1
  235. package/dist/plus/ai/utils/results.utils.d.ts.map +1 -1
  236. package/dist/plus/ai/utils/results.utils.js.map +1 -1
  237. package/dist/plus/git-github/api/github.d.ts +12 -1
  238. package/dist/plus/git-github/api/github.d.ts.map +1 -1
  239. package/dist/plus/git-github/api/github.js +245 -51
  240. package/dist/plus/git-github/api/github.js.map +1 -1
  241. package/dist/plus/git-github/api/types.d.ts +8 -0
  242. package/dist/plus/git-github/api/types.d.ts.map +1 -1
  243. package/dist/plus/git-github/models.d.ts +1 -1
  244. package/dist/plus/git-github/models.d.ts.map +1 -1
  245. package/dist/plus/git-github/models.js.map +1 -1
  246. package/dist/plus/git-github/providers/github/blame.d.ts.map +1 -1
  247. package/dist/plus/git-github/providers/github/blame.js.map +1 -1
  248. package/dist/plus/git-github/providers/github/branches.d.ts +5 -1
  249. package/dist/plus/git-github/providers/github/branches.d.ts.map +1 -1
  250. package/dist/plus/git-github/providers/github/branches.js +47 -24
  251. package/dist/plus/git-github/providers/github/branches.js.map +1 -1
  252. package/dist/plus/git-github/providers/github/commits.d.ts.map +1 -1
  253. package/dist/plus/git-github/providers/github/commits.js +144 -92
  254. package/dist/plus/git-github/providers/github/commits.js.map +1 -1
  255. package/dist/plus/git-github/providers/github/diff.d.ts +1 -1
  256. package/dist/plus/git-github/providers/github/diff.d.ts.map +1 -1
  257. package/dist/plus/git-github/providers/github/diff.js +23 -9
  258. package/dist/plus/git-github/providers/github/diff.js.map +1 -1
  259. package/dist/plus/git-github/providers/github/refs.d.ts +9 -1
  260. package/dist/plus/git-github/providers/github/refs.d.ts.map +1 -1
  261. package/dist/plus/git-github/providers/github/refs.js +39 -14
  262. package/dist/plus/git-github/providers/github/refs.js.map +1 -1
  263. package/dist/plus/git-github/providers/github/revision.d.ts.map +1 -1
  264. package/dist/plus/git-github/providers/github/revision.js +1 -2
  265. package/dist/plus/git-github/providers/github/revision.js.map +1 -1
  266. package/dist/plus/git-github/providers/github/status.d.ts +4 -1
  267. package/dist/plus/git-github/providers/github/status.d.ts.map +1 -1
  268. package/dist/plus/git-github/providers/github/status.js +1 -1
  269. package/dist/plus/git-github/providers/github/status.js.map +1 -1
  270. package/dist/plus/git-github/providers/github/tags.d.ts.map +1 -1
  271. package/dist/plus/git-github/providers/github/tags.js +35 -36
  272. package/dist/plus/git-github/providers/github/tags.js.map +1 -1
  273. package/dist/plus/git-github/providers/githubGitProvider.d.ts.map +1 -1
  274. package/dist/plus/git-github/providers/githubGitProvider.js.map +1 -1
  275. package/dist/utils/color.d.ts.map +1 -1
  276. package/dist/utils/color.js.map +1 -1
  277. package/dist/utils/date.d.ts.map +1 -1
  278. package/dist/utils/date.js +6 -0
  279. package/dist/utils/date.js.map +1 -1
  280. package/dist/utils/debounce.js +1 -1
  281. package/dist/utils/decorators/serializable.d.ts.map +1 -1
  282. package/dist/utils/decorators/serializable.js.map +1 -1
  283. package/dist/utils/dedupedAsyncCache.d.ts +37 -0
  284. package/dist/utils/dedupedAsyncCache.d.ts.map +1 -0
  285. package/dist/utils/dedupedAsyncCache.js +68 -0
  286. package/dist/utils/dedupedAsyncCache.js.map +1 -0
  287. package/dist/utils/diff.d.ts +2 -0
  288. package/dist/utils/diff.d.ts.map +1 -0
  289. package/dist/utils/diff.js +53 -0
  290. package/dist/utils/diff.js.map +1 -0
  291. package/dist/utils/disposable.d.ts.map +1 -1
  292. package/dist/utils/disposable.js.map +1 -1
  293. package/dist/utils/env/node/exec.d.ts.map +1 -1
  294. package/dist/utils/env/node/exec.js.map +1 -1
  295. package/dist/utils/error.d.ts.map +1 -1
  296. package/dist/utils/error.js.map +1 -1
  297. package/dist/utils/iterable.d.ts +7 -1
  298. package/dist/utils/iterable.d.ts.map +1 -1
  299. package/dist/utils/iterable.js +12 -4
  300. package/dist/utils/iterable.js.map +1 -1
  301. package/dist/utils/logger.d.ts.map +1 -1
  302. package/dist/utils/logger.js.map +1 -1
  303. package/dist/utils/lruMap.d.ts +9 -0
  304. package/dist/utils/lruMap.d.ts.map +1 -1
  305. package/dist/utils/lruMap.js +26 -4
  306. package/dist/utils/lruMap.js.map +1 -1
  307. package/dist/utils/markdown.d.ts.map +1 -1
  308. package/dist/utils/markdown.js.map +1 -1
  309. package/dist/utils/mru.d.ts.map +1 -1
  310. package/dist/utils/mru.js.map +1 -1
  311. package/dist/utils/object.d.ts +22 -1
  312. package/dist/utils/object.d.ts.map +1 -1
  313. package/dist/utils/object.js +56 -3
  314. package/dist/utils/object.js.map +1 -1
  315. package/dist/utils/paging.js +14 -15
  316. package/dist/utils/paging.js.map +1 -1
  317. package/dist/utils/path.d.ts.map +1 -1
  318. package/dist/utils/path.js.map +1 -1
  319. package/dist/utils/promise.d.ts +1 -0
  320. package/dist/utils/promise.d.ts.map +1 -1
  321. package/dist/utils/promise.js +17 -0
  322. package/dist/utils/promise.js.map +1 -1
  323. package/dist/utils/promiseCache.d.ts +10 -0
  324. package/dist/utils/promiseCache.d.ts.map +1 -1
  325. package/dist/utils/promiseCache.js +34 -4
  326. package/dist/utils/promiseCache.js.map +1 -1
  327. package/dist/utils/string.d.ts.map +1 -1
  328. package/dist/utils/string.js +1 -1
  329. package/dist/utils/string.js.map +1 -1
  330. package/dist/utils/uri.d.ts.map +1 -1
  331. package/dist/utils/uri.js.map +1 -1
  332. package/dist/utils/version.d.ts.map +1 -1
  333. package/dist/utils/version.js.map +1 -1
  334. package/package.json +13 -1
  335. package/src/git/cache.ts +192 -90
  336. package/src/git/context.ts +21 -0
  337. package/src/git/features.ts +2 -0
  338. package/src/git/models/commit.ts +1 -0
  339. package/src/git/models/graph.ts +97 -0
  340. package/src/git/models/reference.ts +33 -0
  341. package/src/git/models/remote.ts +1 -0
  342. package/src/git/models/remoteProvider.ts +1 -0
  343. package/src/git/models/repository.ts +105 -96
  344. package/src/git/models/search.ts +2 -2
  345. package/src/git/models/statusFile.ts +12 -0
  346. package/src/git/models/worktree.ts +10 -2
  347. package/src/git/parsers/diffParser.ts +2 -0
  348. package/src/git/providers/branches.ts +22 -4
  349. package/src/git/providers/commits.ts +4 -0
  350. package/src/git/providers/config.ts +3 -5
  351. package/src/git/providers/operations.ts +65 -1
  352. package/src/git/providers/pausedOperations.ts +1 -0
  353. package/src/git/providers/refs.ts +32 -3
  354. package/src/git/providers/staging.ts +12 -0
  355. package/src/git/providers/status.ts +6 -1
  356. package/src/git/remotes/azure-devops.ts +2 -0
  357. package/src/git/remotes/custom.ts +23 -0
  358. package/src/git/{exec.types.ts → run.types.ts} +22 -2
  359. package/src/git/service.ts +1 -0
  360. package/src/git/utils/autolink.utils.ts +1 -0
  361. package/src/git/utils/blame.utils.ts +2 -0
  362. package/src/git/utils/conflictResolution.utils.ts +31 -0
  363. package/src/git/utils/contributor.utils.ts +24 -0
  364. package/src/git/utils/fileStatus.utils.ts +7 -1
  365. package/src/git/utils/reachability.utils.ts +109 -0
  366. package/src/git/utils/search.utils.ts +2 -0
  367. package/src/git/utils/sorting.ts +17 -0
  368. package/src/git/utils/status.utils.ts +1 -0
  369. package/src/git/watching/classifyChange.ts +9 -0
  370. package/src/git/watching/gitIgnoreFilter.ts +2 -2
  371. package/src/git/watching/initWatcher.ts +2 -0
  372. package/src/git/watching/watchGroup.ts +3 -0
  373. package/src/git/watching/watchService.ts +45 -7
  374. package/src/git/watching/watchSession.ts +71 -55
  375. package/src/git-cli/exec/exec.types.ts +2 -2
  376. package/src/git-cli/exec/git.ts +6 -5
  377. package/src/git-cli/exec/gitQueue.ts +41 -12
  378. package/src/git-cli/parsers/blameParser.ts +1 -0
  379. package/src/git-cli/parsers/logParser.ts +1 -0
  380. package/src/git-cli/parsers/refParser.ts +33 -34
  381. package/src/git-cli/providers/blame.ts +1 -0
  382. package/src/git-cli/providers/branches.ts +165 -93
  383. package/src/git-cli/providers/commits.ts +107 -37
  384. package/src/git-cli/providers/config.ts +101 -48
  385. package/src/git-cli/providers/diff.ts +10 -3
  386. package/src/git-cli/providers/graph.ts +156 -16
  387. package/src/git-cli/providers/operations.ts +208 -83
  388. package/src/git-cli/providers/patch.ts +1 -0
  389. package/src/git-cli/providers/pausedOperations.ts +8 -0
  390. package/src/git-cli/providers/refs.ts +247 -3
  391. package/src/git-cli/providers/revision.ts +2 -2
  392. package/src/git-cli/providers/staging.ts +33 -0
  393. package/src/git-cli/providers/stash.ts +20 -2
  394. package/src/git-cli/providers/status.ts +24 -5
  395. package/src/git-cli/providers/tags.ts +15 -16
  396. package/src/ipc/discovery.ts +186 -0
  397. package/src/ipc/ipcServer.ts +171 -0
  398. package/src/plus/agents/providers/claudeCodeProvider.ts +2122 -0
  399. package/src/plus/agents/providers/claudeCodeTranscript.ts +214 -0
  400. package/src/plus/agents/sanitizePrompt.ts +109 -0
  401. package/src/plus/agents/stateMachine.ts +197 -0
  402. package/src/plus/agents/types.ts +325 -0
  403. package/src/plus/ai/errors.ts +40 -0
  404. package/src/plus/ai/models/model.ts +1 -0
  405. package/src/plus/ai/models/promptTemplates.ts +13 -0
  406. package/src/plus/ai/models/provider.ts +7 -1
  407. package/src/plus/ai/prompts.ts +49 -8
  408. package/src/plus/ai/providers/gitkrakenProvider.ts +4 -0
  409. package/src/plus/ai/providers/openAICompatibleProviderBase.ts +21 -4
  410. package/src/plus/ai/utils/ai.utils.ts +2 -0
  411. package/src/plus/ai/utils/results.utils.ts +2 -0
  412. package/src/plus/git-github/api/github.ts +315 -57
  413. package/src/plus/git-github/api/types.ts +15 -0
  414. package/src/plus/git-github/models.ts +1 -1
  415. package/src/plus/git-github/providers/github/blame.ts +2 -0
  416. package/src/plus/git-github/providers/github/branches.ts +61 -31
  417. package/src/plus/git-github/providers/github/commits.ts +231 -160
  418. package/src/plus/git-github/providers/github/diff.ts +27 -19
  419. package/src/plus/git-github/providers/github/refs.ts +58 -23
  420. package/src/plus/git-github/providers/github/revision.ts +1 -2
  421. package/src/plus/git-github/providers/github/status.ts +6 -1
  422. package/src/plus/git-github/providers/github/tags.ts +61 -62
  423. package/src/plus/git-github/providers/githubGitProvider.ts +1 -0
  424. package/src/utils/color.ts +2 -0
  425. package/src/utils/date.ts +5 -0
  426. package/src/utils/debounce.ts +1 -1
  427. package/src/utils/decorators/serializable.ts +1 -0
  428. package/src/utils/dedupedAsyncCache.ts +74 -0
  429. package/src/utils/diff.ts +61 -0
  430. package/src/utils/disposable.ts +2 -0
  431. package/src/utils/env/node/exec.ts +2 -0
  432. package/src/utils/error.ts +1 -0
  433. package/src/utils/iterable.ts +17 -3
  434. package/src/utils/logger.ts +1 -0
  435. package/src/utils/lruMap.ts +29 -4
  436. package/src/utils/markdown.ts +1 -0
  437. package/src/utils/mru.ts +2 -0
  438. package/src/utils/object.ts +55 -4
  439. package/src/utils/paging.ts +14 -14
  440. package/src/utils/path.ts +1 -0
  441. package/src/utils/promise.ts +22 -0
  442. package/src/utils/promiseCache.ts +48 -16
  443. package/src/utils/string.ts +3 -1
  444. package/src/utils/uri.ts +1 -0
  445. package/src/utils/version.ts +1 -0
  446. package/dist/git/exec.types.d.ts.map +0 -1
  447. package/dist/git/exec.types.js +0 -2
  448. package/dist/git/exec.types.js.map +0 -1
@@ -0,0 +1,186 @@
1
+ import { mkdir, readdir, readFile, unlink, writeFile } from 'fs/promises';
2
+ import { tmpdir } from 'os';
3
+ import { join } from 'path';
4
+ import { kill, ppid } from 'process';
5
+
6
+ /**
7
+ * Directory scanned by `gk` binaries (and `@gitkraken/core-gitlens` consumers) for the
8
+ * extension's CLI-capable IPC server discovery file. Anything written here is assumed
9
+ * by older `gk` versions to be a CLI server — do NOT write agent-only files here.
10
+ */
11
+ export const cliDiscoveryDir = join(tmpdir(), 'gitkraken', 'gitlens');
12
+
13
+ /**
14
+ * Directory scanned by peer GitLens windows for agent-session-capable IPC servers.
15
+ * Stable across GitLens versions; older windows still scan it, so don't move it.
16
+ */
17
+ export const agentDiscoveryDir = join(tmpdir(), 'gitkraken', 'gitlens', 'agents');
18
+
19
+ export interface IpcDiscoveryData {
20
+ token: string;
21
+ address: string;
22
+ port: number;
23
+ workspacePaths: string[];
24
+ // Optional fields — present when the writing capability needs them.
25
+ // Old gk binaries ignore unknown fields, so this stays back-compat.
26
+ ideName?: string;
27
+ ideDisplayName?: string;
28
+ scheme?: string;
29
+ pid?: number;
30
+ createdAt: string;
31
+ }
32
+
33
+ export function getDiscoveryFileName(port: number): string {
34
+ return `gitlens-ipc-server-${ppid}-${port}.json`;
35
+ }
36
+
37
+ const discoveryFileNameRegex = /^gitlens-ipc-server-(\d+)-(\d+)\.json$/;
38
+
39
+ /** Parses a discovery file name back into its `ppid`/`port` parts; returns `undefined` if it doesn't match. */
40
+ export function parseDiscoveryFileName(name: string): { ppid: number; port: number } | undefined {
41
+ const match = discoveryFileNameRegex.exec(name);
42
+ if (match == null) return undefined;
43
+
44
+ return { ppid: Number(match[1]), port: Number(match[2]) };
45
+ }
46
+
47
+ export function getDiscoveryFilePath(dir: string, port: number): string {
48
+ return join(dir, getDiscoveryFileName(port));
49
+ }
50
+
51
+ export async function writeDiscoveryFile(dir: string, data: IpcDiscoveryData): Promise<string> {
52
+ const filePath = getDiscoveryFilePath(dir, data.port);
53
+ await mkdir(dir, { recursive: true, mode: 0o700 });
54
+ await writeFile(filePath, JSON.stringify(data, null, 2), { mode: 0o600 });
55
+ return filePath;
56
+ }
57
+
58
+ export async function cleanupDiscoveryFile(filePath: string | undefined): Promise<void> {
59
+ if (filePath == null) return;
60
+
61
+ try {
62
+ await unlink(filePath);
63
+ } catch {
64
+ // Ignore cleanup errors
65
+ }
66
+ }
67
+
68
+ export interface SweepDiscoveryFilesOptions {
69
+ /** Ports to never touch (e.g. our own live server). */
70
+ excludePorts?: number[];
71
+ /** Absolute file paths to never touch (e.g. our own files). */
72
+ excludePaths?: string[];
73
+ }
74
+
75
+ /**
76
+ * Best-effort sweep of orphaned discovery files left by processes that crashed or were
77
+ * hard-killed without cleaning up. Reachability is the source of truth: a file is removed
78
+ * only when its owning process is provably gone (pid reports `ESRCH`) or its server is
79
+ * unreachable (the probe fails with anything other than a timeout). Anything reachable — or
80
+ * ambiguous (timeouts, parse errors) — is kept, so a live peer's file is never deleted.
81
+ */
82
+ export async function sweepStaleDiscoveryFiles(
83
+ dirs: string[],
84
+ options?: SweepDiscoveryFilesOptions,
85
+ ): Promise<{ scanned: number; pruned: number }> {
86
+ const excludePorts = options?.excludePorts;
87
+ const excludePaths = options?.excludePaths;
88
+
89
+ let scanned = 0;
90
+ let pruned = 0;
91
+
92
+ for (const dir of dirs) {
93
+ let names: string[];
94
+ try {
95
+ names = await readdir(dir);
96
+ } catch {
97
+ // Dir doesn't exist yet (nothing ever published here) — nothing to sweep.
98
+ continue;
99
+ }
100
+
101
+ const candidates: string[] = [];
102
+ for (const name of names) {
103
+ const parsed = parseDiscoveryFileName(name);
104
+ if (parsed == null) continue;
105
+ if (excludePorts?.includes(parsed.port)) continue;
106
+
107
+ const filePath = join(dir, name);
108
+ if (excludePaths?.includes(filePath)) continue;
109
+
110
+ candidates.push(filePath);
111
+ }
112
+
113
+ scanned += candidates.length;
114
+
115
+ const results = await Promise.allSettled(
116
+ candidates.map(async filePath => {
117
+ if (await isDiscoveryFileStale(filePath)) {
118
+ await cleanupDiscoveryFile(filePath);
119
+ return true;
120
+ }
121
+ return false;
122
+ }),
123
+ );
124
+
125
+ for (const r of results) {
126
+ if (r.status === 'fulfilled' && r.value) {
127
+ pruned++;
128
+ }
129
+ }
130
+ }
131
+
132
+ return { scanned: scanned, pruned: pruned };
133
+ }
134
+
135
+ /** Returns true only when the file's server is provably gone (dead pid or unreachable server). */
136
+ async function isDiscoveryFileStale(filePath: string): Promise<boolean> {
137
+ let data: IpcDiscoveryData;
138
+ try {
139
+ data = JSON.parse(await readFile(filePath, 'utf8')) as IpcDiscoveryData;
140
+ } catch {
141
+ // Can't read/parse — don't delete files we don't understand.
142
+ return false;
143
+ }
144
+
145
+ // Cheap short-circuit: if the owning process is gone, the file is orphaned.
146
+ if (data.pid != null && !isProcessAlive(data.pid)) return true;
147
+
148
+ // Otherwise reachability is the source of truth.
149
+ if (!data.address) return false;
150
+
151
+ try {
152
+ await fetch(`${data.address}/ping`, { signal: AbortSignal.timeout(1000) });
153
+ // Any HTTP response (even 401/404) means a server is listening — keep.
154
+ return false;
155
+ } catch (ex) {
156
+ // A timeout is ambiguous — the server may be alive but slow to answer — so keep. Any other
157
+ // failure (connection refused, reset, host unreachable, bad address) means nothing is
158
+ // serving on that localhost port, so the file is stale. A healthy local server always
159
+ // answers near-instantly, so this never deletes a reachable peer.
160
+ return !isTimeoutError(ex);
161
+ }
162
+ }
163
+
164
+ function isProcessAlive(pid: number): boolean {
165
+ // `kill(0, ...)` / `kill(<negative>, ...)` have process-group semantics and don't probe a
166
+ // specific pid, so a malformed pid (from a foreign or corrupt file) can't prove death — treat
167
+ // it as inconclusive so the sweep falls through to the reachability probe rather than deleting
168
+ // on a bad pid. (Note: the agents session-card tracker's `isProcessAlive` biases the opposite
169
+ // way — toward dead — because expiring a live card there is harmless; deleting a live file is
170
+ // not, so this copy intentionally keeps on uncertainty.)
171
+ if (!Number.isInteger(pid) || pid <= 0) return true;
172
+
173
+ try {
174
+ kill(pid, 0);
175
+ return true;
176
+ } catch (ex) {
177
+ // ESRCH → no such process (dead). EPERM/EACCES → exists but not ours (alive). Anything
178
+ // else is inconclusive → treat as alive so we never delete a file on uncertainty.
179
+ return (ex as NodeJS.ErrnoException | null)?.code !== 'ESRCH';
180
+ }
181
+ }
182
+
183
+ function isTimeoutError(ex: unknown): boolean {
184
+ // `AbortSignal.timeout` rejects with a `TimeoutError`; a bare abort yields an `AbortError`.
185
+ return ex instanceof Error && (ex.name === 'TimeoutError' || ex.name === 'AbortError');
186
+ }
@@ -0,0 +1,171 @@
1
+ import type { IncomingMessage, Server, ServerResponse } from 'http';
2
+ import { createServer } from 'http';
3
+ import { uuid } from '../utils/crypto.js';
4
+ import { debug } from '../utils/decorators/log.js';
5
+ import type { UnifiedDisposable } from '../utils/disposable.js';
6
+ import { createDisposable } from '../utils/disposable.js';
7
+ import { Logger } from '../utils/logger.js';
8
+ import { getScopedLogger } from '../utils/logger.scoped.js';
9
+
10
+ export interface IpcHandler<Request = unknown, Response = void> {
11
+ (request: Request | undefined, searchParams: URLSearchParams): Promise<Response>;
12
+ }
13
+
14
+ export async function createIpcServer<Request = unknown, Response = void>(): Promise<IpcServer<Request, Response>> {
15
+ const server = createServer();
16
+ const token = uuid();
17
+
18
+ return new Promise<IpcServer<Request, Response>>((resolve, reject) => {
19
+ try {
20
+ server.on('error', ex => {
21
+ Logger.error(ex, 'IPC server error');
22
+ reject(ex);
23
+ });
24
+
25
+ // Let the OS assign an available port by listening on port 0
26
+ server.listen(0, '127.0.0.1', () => {
27
+ const address = server.address();
28
+ if (address == null || typeof address === 'string') {
29
+ reject(new Error('Failed to get server address'));
30
+ return;
31
+ }
32
+
33
+ const port = address.port;
34
+ const serverUrl = `http://127.0.0.1:${port}`;
35
+ resolve(new IpcServer(serverUrl, port, token, server));
36
+ });
37
+ } catch (ex) {
38
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
39
+ reject(ex);
40
+ }
41
+ });
42
+ }
43
+
44
+ export class IpcServer<Request = unknown, Response = void> implements UnifiedDisposable {
45
+ private readonly handlers = new Map<string | undefined, IpcHandler<Request, Response>>();
46
+
47
+ constructor(
48
+ readonly ipcAddress: string,
49
+ readonly ipcPort: number,
50
+ readonly ipcToken: string,
51
+ private server: Server,
52
+ ) {
53
+ server
54
+ .on('listening', () => {
55
+ Logger.trace(`IPC server listening on ${this.ipcAddress}`);
56
+ })
57
+ .on('request', this.onRequest.bind(this));
58
+ }
59
+
60
+ dispose(): void {
61
+ this.handlers.clear();
62
+ this.server.close();
63
+ }
64
+
65
+ [Symbol.dispose](): void {
66
+ this.dispose();
67
+ }
68
+
69
+ // Awaits server close; use only when deterministic teardown is required (e.g., tests).
70
+ // Production callers should use dispose() — UnifiedDisposable contract is sync.
71
+ shutdown(): Promise<void> {
72
+ this.handlers.clear();
73
+ return new Promise<void>(resolve => {
74
+ this.server.close(() => resolve());
75
+ });
76
+ }
77
+
78
+ registerHandler(name: string, handler: IpcHandler<Request, Response>): UnifiedDisposable {
79
+ const path = `/${name}`;
80
+ if (this.handlers.has(path)) {
81
+ throw new Error(`IPC handler '${name}' is already registered`);
82
+ }
83
+
84
+ this.handlers.set(path, handler);
85
+ return createDisposable(() => this.handlers.delete(path));
86
+ }
87
+
88
+ @debug({ args: false })
89
+ private onRequest(req: IncomingMessage, res: ServerResponse): void {
90
+ const scope = getScopedLogger();
91
+
92
+ // Parse URL to extract pathname for routing and query parameters
93
+ let pathname: string | undefined;
94
+ let searchParams = new URLSearchParams();
95
+ try {
96
+ const url = new URL(req.url ?? '', this.ipcAddress);
97
+ pathname = url.pathname;
98
+ searchParams = url.searchParams;
99
+ } catch {
100
+ pathname = req.url;
101
+ }
102
+
103
+ const handler = this.handlers.get(pathname);
104
+ if (handler == null) {
105
+ scope?.warn(`IPC handler for ${pathname} not found`);
106
+ res.writeHead(404);
107
+ res.end();
108
+ return;
109
+ }
110
+
111
+ // Add bearer token authorization
112
+ const authHeader = req.headers['authorization'];
113
+ if (authHeader !== `Bearer ${this.ipcToken}`) {
114
+ Logger.warn(scope, `IPC handler for ${req.url} unauthorized`);
115
+ res.writeHead(401);
116
+ res.end();
117
+ return;
118
+ }
119
+
120
+ const maxBodySize = 10_485_760; // 10 MB
121
+ let bodySize = 0;
122
+ const chunks: Uint8Array[] = [];
123
+ req.on('data', (d: Uint8Array) => {
124
+ bodySize += d.length;
125
+ if (bodySize > maxBodySize) {
126
+ res.writeHead(413);
127
+ res.end();
128
+ req.destroy();
129
+ return;
130
+ }
131
+
132
+ chunks.push(d);
133
+ });
134
+ req.on('end', async () => {
135
+ if (bodySize > maxBodySize) return;
136
+
137
+ const body = Buffer.concat(chunks).toString('utf8');
138
+
139
+ let data: Request | undefined;
140
+ try {
141
+ data = body ? (JSON.parse(body) as Request) : undefined;
142
+ } catch (ex) {
143
+ scope?.error(ex, 'Invalid JSON in IPC request body', { body: body });
144
+ res.writeHead(400);
145
+ res.end('Invalid JSON');
146
+ return;
147
+ }
148
+
149
+ try {
150
+ const result = await handler(data, searchParams);
151
+ if (result == null) {
152
+ res.writeHead(200);
153
+ res.end();
154
+ return;
155
+ }
156
+
157
+ if (typeof result === 'string') {
158
+ res.writeHead(200);
159
+ res.end(result);
160
+ } else {
161
+ res.writeHead(200);
162
+ res.end(JSON.stringify(result));
163
+ }
164
+ } catch (ex) {
165
+ scope?.error(ex, 'IPC handler error', data);
166
+ res.writeHead(500);
167
+ res.end();
168
+ }
169
+ });
170
+ }
171
+ }