@gitkraken/core-gitlens 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/dist/git/cache.d.ts +49 -9
  3. package/dist/git/cache.d.ts.map +1 -1
  4. package/dist/git/cache.js +174 -14
  5. package/dist/git/cache.js.map +1 -1
  6. package/dist/git/context.d.ts +11 -2
  7. package/dist/git/context.d.ts.map +1 -1
  8. package/dist/git/context.js.map +1 -1
  9. package/dist/git/models/branch.d.ts +1 -0
  10. package/dist/git/models/branch.d.ts.map +1 -1
  11. package/dist/git/models/branch.js.map +1 -1
  12. package/dist/git/models/commit.d.ts +1 -9
  13. package/dist/git/models/commit.d.ts.map +1 -1
  14. package/dist/git/models/commit.js +4 -9
  15. package/dist/git/models/commit.js.map +1 -1
  16. package/dist/git/models/graph.d.ts +2 -4
  17. package/dist/git/models/graph.d.ts.map +1 -1
  18. package/dist/git/models/reference.d.ts +31 -0
  19. package/dist/git/models/reference.d.ts.map +1 -1
  20. package/dist/git/models/remote.d.ts.map +1 -1
  21. package/dist/git/models/remote.js.map +1 -1
  22. package/dist/git/models/repository.d.ts +20 -3
  23. package/dist/git/models/repository.d.ts.map +1 -1
  24. package/dist/git/models/repository.js +42 -5
  25. package/dist/git/models/repository.js.map +1 -1
  26. package/dist/git/models/search.d.ts +2 -2
  27. package/dist/git/models/search.d.ts.map +1 -1
  28. package/dist/git/models/worktree.d.ts +4 -1
  29. package/dist/git/models/worktree.d.ts.map +1 -1
  30. package/dist/git/models/worktree.js +2 -2
  31. package/dist/git/models/worktree.js.map +1 -1
  32. package/dist/git/parsers/diffParser.d.ts +0 -1
  33. package/dist/git/parsers/diffParser.d.ts.map +1 -1
  34. package/dist/git/parsers/diffParser.js +22 -61
  35. package/dist/git/parsers/diffParser.js.map +1 -1
  36. package/dist/git/providers/branches.d.ts +18 -4
  37. package/dist/git/providers/branches.d.ts.map +1 -1
  38. package/dist/git/providers/commits.d.ts +6 -0
  39. package/dist/git/providers/commits.d.ts.map +1 -1
  40. package/dist/git/providers/config.d.ts +6 -1
  41. package/dist/git/providers/config.d.ts.map +1 -1
  42. package/dist/git/providers/diff.d.ts +2 -0
  43. package/dist/git/providers/diff.d.ts.map +1 -1
  44. package/dist/git/providers/operations.d.ts +39 -10
  45. package/dist/git/providers/operations.d.ts.map +1 -1
  46. package/dist/git/providers/pausedOperations.d.ts +3 -1
  47. package/dist/git/providers/pausedOperations.d.ts.map +1 -1
  48. package/dist/git/providers/refs.d.ts +23 -2
  49. package/dist/git/providers/refs.d.ts.map +1 -1
  50. package/dist/git/providers/revision.d.ts +1 -1
  51. package/dist/git/providers/revision.d.ts.map +1 -1
  52. package/dist/git/providers/staging.d.ts +18 -0
  53. package/dist/git/providers/staging.d.ts.map +1 -1
  54. package/dist/git/providers/status.d.ts +4 -1
  55. package/dist/git/providers/status.d.ts.map +1 -1
  56. package/dist/git/remotes/azure-devops.d.ts.map +1 -1
  57. package/dist/git/remotes/azure-devops.js.map +1 -1
  58. package/dist/git/{exec.types.d.ts → run.types.d.ts} +22 -3
  59. package/dist/git/run.types.d.ts.map +1 -0
  60. package/dist/git/run.types.js +2 -0
  61. package/dist/git/run.types.js.map +1 -0
  62. package/dist/git/service.d.ts.map +1 -1
  63. package/dist/git/service.js.map +1 -1
  64. package/dist/git/utils/autolink.utils.d.ts.map +1 -1
  65. package/dist/git/utils/autolink.utils.js.map +1 -1
  66. package/dist/git/utils/blame.utils.d.ts.map +1 -1
  67. package/dist/git/utils/blame.utils.js.map +1 -1
  68. package/dist/git/utils/conflictResolution.utils.d.ts +6 -0
  69. package/dist/git/utils/conflictResolution.utils.d.ts.map +1 -0
  70. package/dist/git/utils/conflictResolution.utils.js +25 -0
  71. package/dist/git/utils/conflictResolution.utils.js.map +1 -0
  72. package/dist/git/utils/fileStatus.utils.d.ts +2 -1
  73. package/dist/git/utils/fileStatus.utils.d.ts.map +1 -1
  74. package/dist/git/utils/fileStatus.utils.js +4 -0
  75. package/dist/git/utils/fileStatus.utils.js.map +1 -1
  76. package/dist/git/utils/search.utils.d.ts.map +1 -1
  77. package/dist/git/utils/search.utils.js +3 -0
  78. package/dist/git/utils/search.utils.js.map +1 -1
  79. package/dist/git/utils/sorting.d.ts +14 -0
  80. package/dist/git/utils/sorting.d.ts.map +1 -1
  81. package/dist/git/utils/sorting.js +34 -0
  82. package/dist/git/utils/sorting.js.map +1 -1
  83. package/dist/git/utils/status.utils.d.ts.map +1 -1
  84. package/dist/git/utils/status.utils.js.map +1 -1
  85. package/dist/git/watching/classifyChange.d.ts.map +1 -1
  86. package/dist/git/watching/classifyChange.js +8 -0
  87. package/dist/git/watching/classifyChange.js.map +1 -1
  88. package/dist/git/watching/gitIgnoreFilter.js +1 -1
  89. package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
  90. package/dist/git/watching/initWatcher.d.ts.map +1 -1
  91. package/dist/git/watching/initWatcher.js.map +1 -1
  92. package/dist/git/watching/watchGroup.d.ts.map +1 -1
  93. package/dist/git/watching/watchGroup.js.map +1 -1
  94. package/dist/git/watching/watchService.d.ts.map +1 -1
  95. package/dist/git/watching/watchService.js +24 -4
  96. package/dist/git/watching/watchService.js.map +1 -1
  97. package/dist/git/watching/watchSession.d.ts.map +1 -1
  98. package/dist/git/watching/watchSession.js.map +1 -1
  99. package/dist/git-cli/cliGitProvider.js +1 -1
  100. package/dist/git-cli/cliGitProvider.js.map +1 -1
  101. package/dist/git-cli/exec/exec.types.d.ts +1 -1
  102. package/dist/git-cli/exec/exec.types.d.ts.map +1 -1
  103. package/dist/git-cli/exec/git.d.ts +31 -6
  104. package/dist/git-cli/exec/git.d.ts.map +1 -1
  105. package/dist/git-cli/exec/git.js +70 -9
  106. package/dist/git-cli/exec/git.js.map +1 -1
  107. package/dist/git-cli/exec/gitQueue.d.ts +22 -6
  108. package/dist/git-cli/exec/gitQueue.d.ts.map +1 -1
  109. package/dist/git-cli/exec/gitQueue.js +88 -24
  110. package/dist/git-cli/exec/gitQueue.js.map +1 -1
  111. package/dist/git-cli/parsers/blameParser.d.ts.map +1 -1
  112. package/dist/git-cli/parsers/blameParser.js.map +1 -1
  113. package/dist/git-cli/parsers/logParser.d.ts +1 -0
  114. package/dist/git-cli/parsers/logParser.d.ts.map +1 -1
  115. package/dist/git-cli/parsers/logParser.js +4 -0
  116. package/dist/git-cli/parsers/logParser.js.map +1 -1
  117. package/dist/git-cli/parsers/refParser.d.ts +3 -30
  118. package/dist/git-cli/parsers/refParser.d.ts.map +1 -1
  119. package/dist/git-cli/parsers/refParser.js +30 -30
  120. package/dist/git-cli/parsers/refParser.js.map +1 -1
  121. package/dist/git-cli/providers/blame.d.ts.map +1 -1
  122. package/dist/git-cli/providers/blame.js +1 -1
  123. package/dist/git-cli/providers/blame.js.map +1 -1
  124. package/dist/git-cli/providers/branches.d.ts +17 -5
  125. package/dist/git-cli/providers/branches.d.ts.map +1 -1
  126. package/dist/git-cli/providers/branches.js +245 -162
  127. package/dist/git-cli/providers/branches.js.map +1 -1
  128. package/dist/git-cli/providers/commits.d.ts +4 -0
  129. package/dist/git-cli/providers/commits.d.ts.map +1 -1
  130. package/dist/git-cli/providers/commits.js +120 -35
  131. package/dist/git-cli/providers/commits.js.map +1 -1
  132. package/dist/git-cli/providers/config.d.ts +11 -2
  133. package/dist/git-cli/providers/config.d.ts.map +1 -1
  134. package/dist/git-cli/providers/config.js +36 -11
  135. package/dist/git-cli/providers/config.js.map +1 -1
  136. package/dist/git-cli/providers/contributors.d.ts.map +1 -1
  137. package/dist/git-cli/providers/contributors.js +7 -4
  138. package/dist/git-cli/providers/contributors.js.map +1 -1
  139. package/dist/git-cli/providers/diff.d.ts +2 -0
  140. package/dist/git-cli/providers/diff.d.ts.map +1 -1
  141. package/dist/git-cli/providers/diff.js +92 -20
  142. package/dist/git-cli/providers/diff.js.map +1 -1
  143. package/dist/git-cli/providers/graph.d.ts.map +1 -1
  144. package/dist/git-cli/providers/graph.js +49 -28
  145. package/dist/git-cli/providers/graph.js.map +1 -1
  146. package/dist/git-cli/providers/operations.d.ts +30 -11
  147. package/dist/git-cli/providers/operations.d.ts.map +1 -1
  148. package/dist/git-cli/providers/operations.js +146 -43
  149. package/dist/git-cli/providers/operations.js.map +1 -1
  150. package/dist/git-cli/providers/patch.d.ts.map +1 -1
  151. package/dist/git-cli/providers/patch.js +15 -30
  152. package/dist/git-cli/providers/patch.js.map +1 -1
  153. package/dist/git-cli/providers/pausedOperations.d.ts +3 -1
  154. package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
  155. package/dist/git-cli/providers/pausedOperations.js +13 -7
  156. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  157. package/dist/git-cli/providers/refs.d.ts +19 -2
  158. package/dist/git-cli/providers/refs.d.ts.map +1 -1
  159. package/dist/git-cli/providers/refs.js +312 -9
  160. package/dist/git-cli/providers/refs.js.map +1 -1
  161. package/dist/git-cli/providers/remotes.js +4 -4
  162. package/dist/git-cli/providers/remotes.js.map +1 -1
  163. package/dist/git-cli/providers/revision.d.ts +1 -1
  164. package/dist/git-cli/providers/revision.d.ts.map +1 -1
  165. package/dist/git-cli/providers/revision.js +15 -11
  166. package/dist/git-cli/providers/revision.js.map +1 -1
  167. package/dist/git-cli/providers/staging.d.ts +8 -0
  168. package/dist/git-cli/providers/staging.d.ts.map +1 -1
  169. package/dist/git-cli/providers/staging.js +52 -8
  170. package/dist/git-cli/providers/staging.js.map +1 -1
  171. package/dist/git-cli/providers/stash.d.ts +0 -8
  172. package/dist/git-cli/providers/stash.d.ts.map +1 -1
  173. package/dist/git-cli/providers/stash.js +63 -119
  174. package/dist/git-cli/providers/stash.js.map +1 -1
  175. package/dist/git-cli/providers/status.d.ts +4 -1
  176. package/dist/git-cli/providers/status.d.ts.map +1 -1
  177. package/dist/git-cli/providers/status.js +10 -9
  178. package/dist/git-cli/providers/status.js.map +1 -1
  179. package/dist/git-cli/providers/tags.d.ts.map +1 -1
  180. package/dist/git-cli/providers/tags.js +13 -9
  181. package/dist/git-cli/providers/tags.js.map +1 -1
  182. package/dist/git-cli/providers/worktrees.js +3 -3
  183. package/dist/git-cli/providers/worktrees.js.map +1 -1
  184. package/dist/ipc/discovery.d.ts +27 -0
  185. package/dist/ipc/discovery.d.ts.map +1 -0
  186. package/dist/ipc/discovery.js +38 -0
  187. package/dist/ipc/discovery.js.map +1 -0
  188. package/dist/ipc/ipcServer.d.ts +20 -0
  189. package/dist/ipc/ipcServer.d.ts.map +1 -0
  190. package/dist/ipc/ipcServer.js +162 -0
  191. package/dist/ipc/ipcServer.js.map +1 -0
  192. package/dist/plus/agents/providers/claudeCodeProvider.d.ts +114 -0
  193. package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -0
  194. package/dist/plus/agents/providers/claudeCodeProvider.js +1480 -0
  195. package/dist/plus/agents/providers/claudeCodeProvider.js.map +1 -0
  196. package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +36 -0
  197. package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -0
  198. package/dist/plus/agents/providers/claudeCodeTranscript.js +171 -0
  199. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -0
  200. package/dist/plus/agents/sanitizePrompt.d.ts +15 -0
  201. package/dist/plus/agents/sanitizePrompt.d.ts.map +1 -0
  202. package/dist/plus/agents/sanitizePrompt.js +103 -0
  203. package/dist/plus/agents/sanitizePrompt.js.map +1 -0
  204. package/dist/plus/agents/stateMachine.d.ts +32 -0
  205. package/dist/plus/agents/stateMachine.d.ts.map +1 -0
  206. package/dist/plus/agents/stateMachine.js +180 -0
  207. package/dist/plus/agents/stateMachine.js.map +1 -0
  208. package/dist/plus/agents/types.d.ts +203 -0
  209. package/dist/plus/agents/types.d.ts.map +1 -0
  210. package/dist/plus/agents/types.js +49 -0
  211. package/dist/plus/agents/types.js.map +1 -0
  212. package/dist/plus/ai/constants.d.ts +2 -1
  213. package/dist/plus/ai/constants.d.ts.map +1 -1
  214. package/dist/plus/ai/constants.js +7 -0
  215. package/dist/plus/ai/constants.js.map +1 -1
  216. package/dist/plus/ai/errors.d.ts +4 -1
  217. package/dist/plus/ai/errors.d.ts.map +1 -1
  218. package/dist/plus/ai/errors.js +38 -0
  219. package/dist/plus/ai/errors.js.map +1 -1
  220. package/dist/plus/ai/models/model.d.ts +1 -1
  221. package/dist/plus/ai/models/model.d.ts.map +1 -1
  222. package/dist/plus/ai/models/model.js.map +1 -1
  223. package/dist/plus/ai/models/promptTemplates.d.ts +28 -2
  224. package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
  225. package/dist/plus/ai/models/results.d.ts +28 -0
  226. package/dist/plus/ai/models/results.d.ts.map +1 -1
  227. package/dist/plus/ai/prompts.d.ts +4 -0
  228. package/dist/plus/ai/prompts.d.ts.map +1 -1
  229. package/dist/plus/ai/prompts.js +167 -1
  230. package/dist/plus/ai/prompts.js.map +1 -1
  231. package/dist/plus/ai/utils/ai.utils.d.ts.map +1 -1
  232. package/dist/plus/ai/utils/ai.utils.js +2 -0
  233. package/dist/plus/ai/utils/ai.utils.js.map +1 -1
  234. package/dist/plus/ai/utils/results.utils.d.ts +3 -0
  235. package/dist/plus/ai/utils/results.utils.d.ts.map +1 -1
  236. package/dist/plus/ai/utils/results.utils.js +75 -0
  237. package/dist/plus/ai/utils/results.utils.js.map +1 -1
  238. package/dist/plus/ai/utils/truncation.utils.d.ts +1 -1
  239. package/dist/plus/ai/utils/truncation.utils.d.ts.map +1 -1
  240. package/dist/plus/ai/utils/truncation.utils.js.map +1 -1
  241. package/dist/plus/git-github/api/github.d.ts +10 -1
  242. package/dist/plus/git-github/api/github.d.ts.map +1 -1
  243. package/dist/plus/git-github/api/github.js +156 -49
  244. package/dist/plus/git-github/api/github.js.map +1 -1
  245. package/dist/plus/git-github/api/types.d.ts +8 -0
  246. package/dist/plus/git-github/api/types.d.ts.map +1 -1
  247. package/dist/plus/git-github/models.d.ts +1 -1
  248. package/dist/plus/git-github/models.d.ts.map +1 -1
  249. package/dist/plus/git-github/models.js.map +1 -1
  250. package/dist/plus/git-github/providers/github/blame.d.ts.map +1 -1
  251. package/dist/plus/git-github/providers/github/blame.js.map +1 -1
  252. package/dist/plus/git-github/providers/github/branches.d.ts +5 -1
  253. package/dist/plus/git-github/providers/github/branches.d.ts.map +1 -1
  254. package/dist/plus/git-github/providers/github/branches.js +60 -22
  255. package/dist/plus/git-github/providers/github/branches.js.map +1 -1
  256. package/dist/plus/git-github/providers/github/commits.d.ts.map +1 -1
  257. package/dist/plus/git-github/providers/github/commits.js +144 -92
  258. package/dist/plus/git-github/providers/github/commits.js.map +1 -1
  259. package/dist/plus/git-github/providers/github/diff.d.ts +3 -1
  260. package/dist/plus/git-github/providers/github/diff.d.ts.map +1 -1
  261. package/dist/plus/git-github/providers/github/diff.js +23 -9
  262. package/dist/plus/git-github/providers/github/diff.js.map +1 -1
  263. package/dist/plus/git-github/providers/github/refs.d.ts +9 -1
  264. package/dist/plus/git-github/providers/github/refs.d.ts.map +1 -1
  265. package/dist/plus/git-github/providers/github/refs.js +38 -13
  266. package/dist/plus/git-github/providers/github/refs.js.map +1 -1
  267. package/dist/plus/git-github/providers/github/revision.d.ts.map +1 -1
  268. package/dist/plus/git-github/providers/github/revision.js +1 -2
  269. package/dist/plus/git-github/providers/github/revision.js.map +1 -1
  270. package/dist/plus/git-github/providers/github/status.d.ts +4 -1
  271. package/dist/plus/git-github/providers/github/status.d.ts.map +1 -1
  272. package/dist/plus/git-github/providers/github/status.js +1 -1
  273. package/dist/plus/git-github/providers/github/status.js.map +1 -1
  274. package/dist/plus/git-github/providers/github/tags.d.ts.map +1 -1
  275. package/dist/plus/git-github/providers/github/tags.js +35 -36
  276. package/dist/plus/git-github/providers/github/tags.js.map +1 -1
  277. package/dist/plus/git-github/providers/githubGitProvider.d.ts.map +1 -1
  278. package/dist/plus/git-github/providers/githubGitProvider.js.map +1 -1
  279. package/dist/utils/color.d.ts.map +1 -1
  280. package/dist/utils/color.js.map +1 -1
  281. package/dist/utils/decorators/log.js +1 -1
  282. package/dist/utils/decorators/log.js.map +1 -1
  283. package/dist/utils/decorators/sequentialize.d.ts.map +1 -1
  284. package/dist/utils/decorators/sequentialize.js +4 -2
  285. package/dist/utils/decorators/sequentialize.js.map +1 -1
  286. package/dist/utils/decorators/serializable.d.ts.map +1 -1
  287. package/dist/utils/decorators/serializable.js.map +1 -1
  288. package/dist/utils/dedupedAsyncCache.d.ts +37 -0
  289. package/dist/utils/dedupedAsyncCache.d.ts.map +1 -0
  290. package/dist/utils/dedupedAsyncCache.js +68 -0
  291. package/dist/utils/dedupedAsyncCache.js.map +1 -0
  292. package/dist/utils/diff.d.ts +2 -0
  293. package/dist/utils/diff.d.ts.map +1 -0
  294. package/dist/utils/diff.js +53 -0
  295. package/dist/utils/diff.js.map +1 -0
  296. package/dist/utils/disposable.d.ts.map +1 -1
  297. package/dist/utils/disposable.js.map +1 -1
  298. package/dist/utils/env/node/base64.js.map +1 -1
  299. package/dist/utils/env/node/exec.d.ts.map +1 -1
  300. package/dist/utils/env/node/exec.js.map +1 -1
  301. package/dist/utils/error.d.ts.map +1 -1
  302. package/dist/utils/error.js.map +1 -1
  303. package/dist/utils/formatter.d.ts.map +1 -1
  304. package/dist/utils/formatter.js +4 -10
  305. package/dist/utils/formatter.js.map +1 -1
  306. package/dist/utils/iterable.d.ts.map +1 -1
  307. package/dist/utils/iterable.js.map +1 -1
  308. package/dist/utils/logger.d.ts.map +1 -1
  309. package/dist/utils/logger.js.map +1 -1
  310. package/dist/utils/lruMap.d.ts +49 -0
  311. package/dist/utils/lruMap.d.ts.map +1 -0
  312. package/dist/utils/lruMap.js +103 -0
  313. package/dist/utils/lruMap.js.map +1 -0
  314. package/dist/utils/markdown.d.ts.map +1 -1
  315. package/dist/utils/markdown.js.map +1 -1
  316. package/dist/utils/mru.d.ts.map +1 -1
  317. package/dist/utils/mru.js.map +1 -1
  318. package/dist/utils/path.d.ts.map +1 -1
  319. package/dist/utils/path.js.map +1 -1
  320. package/dist/utils/promise.d.ts +1 -0
  321. package/dist/utils/promise.d.ts.map +1 -1
  322. package/dist/utils/promise.js +17 -0
  323. package/dist/utils/promise.js.map +1 -1
  324. package/dist/utils/promiseCache.d.ts +10 -0
  325. package/dist/utils/promiseCache.d.ts.map +1 -1
  326. package/dist/utils/promiseCache.js +22 -0
  327. package/dist/utils/promiseCache.js.map +1 -1
  328. package/dist/utils/string.d.ts.map +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 +14 -0
  333. package/dist/utils/version.d.ts.map +1 -1
  334. package/dist/utils/version.js +48 -0
  335. package/dist/utils/version.js.map +1 -1
  336. package/package.json +13 -1
  337. package/src/git/cache.ts +309 -29
  338. package/src/git/context.ts +11 -2
  339. package/src/git/models/branch.ts +1 -0
  340. package/src/git/models/commit.ts +2 -17
  341. package/src/git/models/graph.ts +2 -4
  342. package/src/git/models/reference.ts +33 -0
  343. package/src/git/models/remote.ts +1 -0
  344. package/src/git/models/repository.ts +44 -6
  345. package/src/git/models/search.ts +2 -2
  346. package/src/git/models/worktree.ts +10 -2
  347. package/src/git/parsers/diffParser.ts +9 -44
  348. package/src/git/providers/branches.ts +25 -4
  349. package/src/git/providers/commits.ts +7 -0
  350. package/src/git/providers/config.ts +4 -0
  351. package/src/git/providers/diff.ts +8 -2
  352. package/src/git/providers/operations.ts +54 -3
  353. package/src/git/providers/pausedOperations.ts +1 -0
  354. package/src/git/providers/refs.ts +32 -3
  355. package/src/git/providers/revision.ts +5 -1
  356. package/src/git/providers/staging.ts +14 -0
  357. package/src/git/providers/status.ts +6 -1
  358. package/src/git/remotes/azure-devops.ts +2 -0
  359. package/src/git/{exec.types.ts → run.types.ts} +22 -2
  360. package/src/git/service.ts +1 -0
  361. package/src/git/utils/autolink.utils.ts +1 -0
  362. package/src/git/utils/blame.utils.ts +2 -0
  363. package/src/git/utils/conflictResolution.utils.ts +31 -0
  364. package/src/git/utils/fileStatus.utils.ts +7 -1
  365. package/src/git/utils/search.utils.ts +2 -0
  366. package/src/git/utils/sorting.ts +38 -0
  367. package/src/git/utils/status.utils.ts +1 -0
  368. package/src/git/watching/classifyChange.ts +9 -0
  369. package/src/git/watching/gitIgnoreFilter.ts +2 -2
  370. package/src/git/watching/initWatcher.ts +2 -0
  371. package/src/git/watching/watchGroup.ts +3 -0
  372. package/src/git/watching/watchService.ts +38 -5
  373. package/src/git/watching/watchSession.ts +10 -0
  374. package/src/git-cli/cliGitProvider.ts +1 -1
  375. package/src/git-cli/exec/exec.types.ts +2 -2
  376. package/src/git-cli/exec/git.ts +76 -23
  377. package/src/git-cli/exec/gitQueue.ts +98 -25
  378. package/src/git-cli/parsers/blameParser.ts +1 -0
  379. package/src/git-cli/parsers/logParser.ts +6 -1
  380. package/src/git-cli/parsers/refParser.ts +33 -34
  381. package/src/git-cli/providers/blame.ts +2 -1
  382. package/src/git-cli/providers/branches.ts +341 -196
  383. package/src/git-cli/providers/commits.ts +145 -46
  384. package/src/git-cli/providers/config.ts +50 -16
  385. package/src/git-cli/providers/contributors.ts +7 -12
  386. package/src/git-cli/providers/diff.ts +107 -20
  387. package/src/git-cli/providers/graph.ts +58 -29
  388. package/src/git-cli/providers/operations.ts +253 -57
  389. package/src/git-cli/providers/patch.ts +16 -37
  390. package/src/git-cli/providers/pausedOperations.ts +14 -6
  391. package/src/git-cli/providers/refs.ts +274 -11
  392. package/src/git-cli/providers/remotes.ts +4 -4
  393. package/src/git-cli/providers/revision.ts +22 -15
  394. package/src/git-cli/providers/staging.ts +51 -8
  395. package/src/git-cli/providers/stash.ts +67 -134
  396. package/src/git-cli/providers/status.ts +21 -10
  397. package/src/git-cli/providers/tags.ts +18 -19
  398. package/src/git-cli/providers/worktrees.ts +3 -3
  399. package/src/ipc/discovery.ts +56 -0
  400. package/src/ipc/ipcServer.ts +171 -0
  401. package/src/plus/agents/providers/claudeCodeProvider.ts +1782 -0
  402. package/src/plus/agents/providers/claudeCodeTranscript.ts +214 -0
  403. package/src/plus/agents/sanitizePrompt.ts +109 -0
  404. package/src/plus/agents/stateMachine.ts +197 -0
  405. package/src/plus/agents/types.ts +277 -0
  406. package/src/plus/ai/constants.ts +8 -0
  407. package/src/plus/ai/errors.ts +40 -0
  408. package/src/plus/ai/models/model.ts +1 -0
  409. package/src/plus/ai/models/promptTemplates.ts +42 -0
  410. package/src/plus/ai/models/results.ts +30 -0
  411. package/src/plus/ai/prompts.ts +171 -1
  412. package/src/plus/ai/utils/ai.utils.ts +2 -0
  413. package/src/plus/ai/utils/results.utils.ts +101 -0
  414. package/src/plus/ai/utils/truncation.utils.ts +3 -1
  415. package/src/plus/git-github/api/github.ts +199 -53
  416. package/src/plus/git-github/api/types.ts +15 -0
  417. package/src/plus/git-github/models.ts +1 -1
  418. package/src/plus/git-github/providers/github/blame.ts +2 -0
  419. package/src/plus/git-github/providers/github/branches.ts +75 -33
  420. package/src/plus/git-github/providers/github/commits.ts +231 -160
  421. package/src/plus/git-github/providers/github/diff.ts +35 -21
  422. package/src/plus/git-github/providers/github/refs.ts +57 -22
  423. package/src/plus/git-github/providers/github/revision.ts +1 -2
  424. package/src/plus/git-github/providers/github/status.ts +6 -1
  425. package/src/plus/git-github/providers/github/tags.ts +61 -62
  426. package/src/plus/git-github/providers/githubGitProvider.ts +1 -0
  427. package/src/utils/color.ts +2 -0
  428. package/src/utils/decorators/log.ts +1 -1
  429. package/src/utils/decorators/sequentialize.ts +8 -6
  430. package/src/utils/decorators/serializable.ts +1 -0
  431. package/src/utils/dedupedAsyncCache.ts +74 -0
  432. package/src/utils/diff.ts +61 -0
  433. package/src/utils/disposable.ts +2 -0
  434. package/src/utils/env/node/base64.ts +1 -1
  435. package/src/utils/env/node/exec.ts +4 -2
  436. package/src/utils/error.ts +1 -0
  437. package/src/utils/formatter.ts +4 -11
  438. package/src/utils/iterable.ts +4 -1
  439. package/src/utils/logger.ts +1 -0
  440. package/src/utils/lruMap.ts +112 -0
  441. package/src/utils/markdown.ts +1 -0
  442. package/src/utils/mru.ts +2 -0
  443. package/src/utils/path.ts +1 -0
  444. package/src/utils/promise.ts +22 -0
  445. package/src/utils/promiseCache.ts +24 -0
  446. package/src/utils/string.ts +2 -0
  447. package/src/utils/uri.ts +1 -0
  448. package/src/utils/version.ts +49 -0
  449. package/dist/git/exec.types.d.ts.map +0 -1
  450. package/dist/git/exec.types.js +0 -2
  451. package/dist/git/exec.types.js.map +0 -1
package/src/git/cache.ts CHANGED
@@ -8,17 +8,15 @@ import type { PromiseOrValue } from '../utils/promise.js';
8
8
  import type { CacheController } from '../utils/promiseCache.js';
9
9
  import { PromiseCache, PromiseMap, RepoPromiseCacheMap } from '../utils/promiseCache.js';
10
10
  import type { Uri } from '../utils/uri.js';
11
- import { getCommonRepositoryPath, getRepositoryOrWorktreePath } from './utils/repository.utils.js';
12
- import type { GitResult } from './exec.types.js';
13
11
  import type { ProgressiveGitBlame } from './models/blame.js';
14
- import type { GitBranch } from './models/branch.js';
15
- import type { GitStashCommit } from './models/commit.js';
12
+ import type { BranchMetadata, GitBranch } from './models/branch.js';
13
+ import type { GitCommit, GitStashCommit } from './models/commit.js';
16
14
  import type { GitContributor, GitContributorsStats } from './models/contributor.js';
17
15
  import type { ParsedGitDiffHunks } from './models/diff.js';
18
16
  import type { GitLog } from './models/log.js';
19
17
  import type { ConflictDetectionResult } from './models/mergeConflicts.js';
20
18
  import type { GitPausedOperationStatus } from './models/pausedOperationStatus.js';
21
- import type { GitBranchReference } from './models/reference.js';
19
+ import type { GitBranchReference, GitRefTip, RefRecord } from './models/reference.js';
22
20
  import type { GitRemote } from './models/remote.js';
23
21
  import type { RemoteProvider } from './models/remoteProvider.js';
24
22
  import type { GitDir, RepositoryChange } from './models/repository.js';
@@ -26,9 +24,14 @@ import type { GitStash } from './models/stash.js';
26
24
  import type { GitTag } from './models/tag.js';
27
25
  import type { GitUser } from './models/user.js';
28
26
  import type { GitWorktree } from './models/worktree.js';
27
+ import type { BranchContributionsOverview, GitBranchMergedStatus } from './providers/branches.js';
29
28
  import type { GitCommitReachability, LeftRightCommitCountResult } from './providers/commits.js';
30
29
  import type { GitContributorsResult } from './providers/contributors.js';
31
30
  import type { ResolvedRevision } from './providers/revision.js';
31
+ import type { GitResult } from './run.types.js';
32
+ import { getBranchId } from './utils/branch.utils.js';
33
+ import { createReference } from './utils/reference.utils.js';
34
+ import { getCommonRepositoryPath, getRepositoryOrWorktreePath } from './utils/repository.utils.js';
32
35
  import type { GitIgnoreFilter } from './watching/gitIgnoreFilter.js';
33
36
 
34
37
  type RepoPath = string;
@@ -49,6 +52,7 @@ export type CachedGitTypes =
49
52
  | 'contributors'
50
53
  | 'gitignore'
51
54
  | 'gkConfig'
55
+ | 'lastFetched'
52
56
  | 'providers'
53
57
  | 'remotes'
54
58
  | 'stashes'
@@ -59,11 +63,27 @@ export type CachedGitTypes =
59
63
 
60
64
  export type ConflictDetectionCacheKey = `apply:${string}:${string}:${string}` | `merge:${string}:${string}`;
61
65
 
66
+ /**
67
+ * gkConfig keys that participate in the `branchOverviews` cache's mergeTarget/mergeBase lineage.
68
+ * Capture group 1 is the ref name (which may itself contain `.`/`/`).
69
+ */
70
+ const branchOverviewGkConfigKeysRegex = /^branch\.(.+)\.(?:gk-merge-(?:base|target(?:-user)?)|gk-target-base)$/;
71
+
72
+ /**
73
+ * Downstream caches that `deleteGkConfig` may invalidate when a `branch.<ref>.gk-...` key changes.
74
+ * Callers performing a "self-write" (where the value being written matches what they just resolved,
75
+ * so the about-to-be-evicted entry is exactly the entry they want to preserve) can opt out by
76
+ * naming the targets to skip via `skipInvalidation`.
77
+ */
78
+ export type GkConfigInvalidationTarget = 'branchOverviews' | 'baseBranchName';
79
+
62
80
  /** Per-worktree caches — cleared by repoPath directly */
63
81
  interface Caches {
64
82
  bestRemotes: PromiseMap<RepoPath, GitRemote<RemoteProvider>[]> | undefined;
65
83
  blame: RepoPromiseCacheMap<string, ProgressiveGitBlame | undefined> | undefined;
66
84
  branch: PromiseMap<RepoPath, GitBranch | undefined> | undefined;
85
+ commit: RepoPromiseCacheMap<string, GitCommit | undefined> | undefined;
86
+ commitCount: RepoPromiseCacheMap<string, number | undefined> | undefined;
67
87
  conflictDetection: RepoPromiseCacheMap<ConflictDetectionCacheKey, ConflictDetectionResult> | undefined;
68
88
  currentBranchReference: PromiseCache<RepoPath, GitBranchReference | undefined> | undefined;
69
89
  currentUser: Map<RepoPath, GitUser | null> | undefined;
@@ -73,8 +93,8 @@ interface Caches {
73
93
  gitDir: Map<RepoPath, GitDir> | undefined;
74
94
  gitIgnore: Map<RepoPath, GitIgnoreFilter> | undefined;
75
95
  ignoreRevsFile: PromiseCache<string, boolean> | undefined;
76
- lastFetched: PromiseCache<RepoPath, number | undefined> | undefined;
77
96
  leftRightCommitCount: RepoPromiseCacheMap<string, LeftRightCommitCountResult | undefined> | undefined;
97
+ mergeBase: RepoPromiseCacheMap<string, string | undefined> | undefined;
78
98
  pausedOperationStatus: PromiseMap<RepoPath, GitPausedOperationStatus | undefined> | undefined;
79
99
  reachability: RepoPromiseCacheMap<string, GitCommitReachability | undefined> | undefined;
80
100
  resolvedRevisions: RepoPromiseCacheMap<string, ResolvedRevision> | undefined;
@@ -83,6 +103,10 @@ interface Caches {
83
103
 
84
104
  /** Shared caches — cleared via commonPath + all worktree paths */
85
105
  interface SharedCaches {
106
+ baseBranchName: RepoPromiseCacheMap<string, string | undefined> | undefined;
107
+ branchMergedStatus: RepoPromiseCacheMap<string, GitBranchMergedStatus> | undefined;
108
+ branchMetadataMap: PromiseMap<RepoPath, Map<string, BranchMetadata>> | undefined;
109
+ branchOverviews: RepoPromiseCacheMap<string, BranchContributionsOverview | undefined> | undefined;
86
110
  branches: PromiseMap<RepoPath, PagedResult<GitBranch>> | undefined;
87
111
  configKeys: RepoPromiseCacheMap<string, string | undefined> | undefined;
88
112
  configPatterns: RepoPromiseCacheMap<string, Map<string, string>> | undefined;
@@ -94,10 +118,14 @@ interface SharedCaches {
94
118
  gkConfigKeys: RepoPromiseCacheMap<string, string | undefined> | undefined;
95
119
  gkConfigPatterns: RepoPromiseCacheMap<string, Map<string, string>> | undefined;
96
120
  initialCommitSha: PromiseMap<RepoPath, string | undefined> | undefined;
121
+ /** Keyed by commonPath — `FETCH_HEAD` lives in the common git dir, shared across worktrees. */
122
+ lastFetched: PromiseCache<RepoPath, number | undefined> | undefined;
97
123
  logShas: RepoPromiseCacheMap<string, string[]> | undefined;
124
+ refs: PromiseMap<RepoPath, RefRecord[]> | undefined;
125
+ refTips: PromiseMap<RepoPath, GitRefTip[]> | undefined;
98
126
  remotes: PromiseMap<RepoPath, GitRemote[]> | undefined;
99
127
  sharedBranches: PromiseMap<RepoPath, PagedResult<GitBranch>> | undefined;
100
- stashes: PromiseMap<RepoPath, GitStash> | undefined;
128
+ stashes: RepoPromiseCacheMap<string, GitStash> | undefined;
101
129
  tags: PromiseMap<RepoPath, PagedResult<GitTag>> | undefined;
102
130
  worktrees: PromiseMap<RepoPath, GitWorktree[]> | undefined;
103
131
  }
@@ -107,6 +135,10 @@ type AllCaches = Caches & SharedCaches;
107
135
  /** Compile-time enforced: adding a key to SharedCaches without listing it here is a type error */
108
136
  const sharedCacheKeys: ReadonlySet<keyof AllCaches> = new Set(
109
137
  exhaustiveArray<keyof SharedCaches>()([
138
+ 'baseBranchName',
139
+ 'branchMergedStatus',
140
+ 'branchMetadataMap',
141
+ 'branchOverviews',
110
142
  'branches',
111
143
  'configKeys',
112
144
  'configPatterns',
@@ -118,7 +150,10 @@ const sharedCacheKeys: ReadonlySet<keyof AllCaches> = new Set(
118
150
  'gkConfigKeys',
119
151
  'gkConfigPatterns',
120
152
  'initialCommitSha',
153
+ 'lastFetched',
121
154
  'logShas',
155
+ 'refs',
156
+ 'refTips',
122
157
  'remotes',
123
158
  'sharedBranches',
124
159
  'stashes',
@@ -129,13 +164,20 @@ const sharedCacheKeys: ReadonlySet<keyof AllCaches> = new Set(
129
164
 
130
165
  function createEmptyCaches(): AllCaches {
131
166
  return {
167
+ baseBranchName: undefined,
132
168
  bestRemotes: undefined,
133
169
  blame: undefined,
134
170
  branch: undefined,
171
+ branchMergedStatus: undefined,
172
+ branchMetadataMap: undefined,
173
+ branchOverviews: undefined,
135
174
  branches: undefined,
175
+ commit: undefined,
176
+ commitCount: undefined,
136
177
  fileExistence: undefined,
137
178
  ignoreRevsFile: undefined,
138
179
  leftRightCommitCount: undefined,
180
+ mergeBase: undefined,
139
181
  configKeys: undefined,
140
182
  configPatterns: undefined,
141
183
  conflictDetection: undefined,
@@ -158,6 +200,8 @@ function createEmptyCaches(): AllCaches {
158
200
  pausedOperationStatus: undefined,
159
201
  resolvedRevisions: undefined,
160
202
  reachability: undefined,
203
+ refs: undefined,
204
+ refTips: undefined,
161
205
  remotes: undefined,
162
206
  sharedBranches: undefined,
163
207
  stashes: undefined,
@@ -206,10 +250,33 @@ export class Cache implements Disposable {
206
250
  }));
207
251
  }
208
252
 
253
+ private get baseBranchName(): RepoPromiseCacheMap<string, string | undefined> {
254
+ return (this._caches.baseBranchName ??= new RepoPromiseCacheMap<string, string | undefined>());
255
+ }
256
+
209
257
  get branch(): PromiseMap<RepoPath, GitBranch | undefined> {
210
258
  return (this._caches.branch ??= new PromiseMap<RepoPath, GitBranch | undefined>());
211
259
  }
212
260
 
261
+ get branchMergedStatus(): RepoPromiseCacheMap<string, GitBranchMergedStatus> {
262
+ return (this._caches.branchMergedStatus ??= new RepoPromiseCacheMap<string, GitBranchMergedStatus>({
263
+ createTTL: 1000 * 60 * 5, // 5 minutes
264
+ }));
265
+ }
266
+
267
+ private get branchMetadataMap(): PromiseMap<RepoPath, Map<string, BranchMetadata>> {
268
+ return (this._caches.branchMetadataMap ??= new PromiseMap<RepoPath, Map<string, BranchMetadata>>());
269
+ }
270
+
271
+ private get branchOverviews(): RepoPromiseCacheMap<string, BranchContributionsOverview | undefined> {
272
+ return (this._caches.branchOverviews ??= new RepoPromiseCacheMap<
273
+ string,
274
+ BranchContributionsOverview | undefined
275
+ >(
276
+ { accessTTL: 1000 * 60 * 60 }, // 60 minutes
277
+ ));
278
+ }
279
+
213
280
  get branches(): PromiseMap<RepoPath, PagedResult<GitBranch>> {
214
281
  return (this._caches.branches ??= new PromiseMap<RepoPath, PagedResult<GitBranch>>());
215
282
  }
@@ -319,17 +386,25 @@ export class Cache implements Disposable {
319
386
  }));
320
387
  }
321
388
 
322
- getLeftRightCommitCount(
323
- repoPath: string,
324
- key: string,
325
- factory: () => PromiseOrValue<LeftRightCommitCountResult | undefined>,
326
- ): Promise<LeftRightCommitCountResult | undefined> {
327
- const cached = this.leftRightCommitCount.get(repoPath, key);
328
- if (cached != null) return cached;
389
+ get commit(): RepoPromiseCacheMap<string, GitCommit | undefined> {
390
+ return (this._caches.commit ??= new RepoPromiseCacheMap<string, GitCommit | undefined>({
391
+ accessTTL: 1000 * 60 * 60, // 60 minutes
392
+ capacity: 100, // Limit to 100 commits per repo
393
+ }));
394
+ }
329
395
 
330
- const factoryPromise = Promise.resolve(factory());
331
- this.leftRightCommitCount.set(repoPath, key, factoryPromise);
332
- return factoryPromise;
396
+ get commitCount(): RepoPromiseCacheMap<string, number | undefined> {
397
+ return (this._caches.commitCount ??= new RepoPromiseCacheMap<string, number | undefined>({
398
+ accessTTL: 1000 * 60 * 60, // 60 minutes
399
+ capacity: 50,
400
+ }));
401
+ }
402
+
403
+ get mergeBase(): RepoPromiseCacheMap<string, string | undefined> {
404
+ return (this._caches.mergeBase ??= new RepoPromiseCacheMap<string, string | undefined>({
405
+ accessTTL: 1000 * 60 * 60, // 60 minutes
406
+ capacity: 50,
407
+ }));
333
408
  }
334
409
 
335
410
  get logShas(): RepoPromiseCacheMap<string, string[]> {
@@ -353,6 +428,14 @@ export class Cache implements Disposable {
353
428
  }));
354
429
  }
355
430
 
431
+ get refs(): PromiseMap<RepoPath, RefRecord[]> {
432
+ return (this._caches.refs ??= new PromiseMap<RepoPath, RefRecord[]>());
433
+ }
434
+
435
+ get refTips(): PromiseMap<RepoPath, GitRefTip[]> {
436
+ return (this._caches.refTips ??= new PromiseMap<RepoPath, GitRefTip[]>());
437
+ }
438
+
356
439
  get reachability(): RepoPromiseCacheMap<string, GitCommitReachability | undefined> {
357
440
  return (this._caches.reachability ??= new RepoPromiseCacheMap<string, GitCommitReachability | undefined>({
358
441
  accessTTL: 1000 * 60 * 60, // 60 minutes
@@ -364,8 +447,10 @@ export class Cache implements Disposable {
364
447
  return (this._caches.remotes ??= new PromiseMap<RepoPath, GitRemote[]>());
365
448
  }
366
449
 
367
- get stashes(): PromiseMap<RepoPath, GitStash> {
368
- return (this._caches.stashes ??= new PromiseMap<RepoPath, GitStash>());
450
+ get stashes(): RepoPromiseCacheMap<string, GitStash> {
451
+ return (this._caches.stashes ??= new RepoPromiseCacheMap<string, GitStash>({
452
+ accessTTL: 1000 * 60 * 60, // 60 minutes
453
+ }));
369
454
  }
370
455
 
371
456
  get tags(): PromiseMap<RepoPath, PagedResult<GitTag>> {
@@ -424,23 +509,38 @@ export class Cache implements Disposable {
424
509
  keysToClear.add('fileLog');
425
510
  }
426
511
 
427
- // Per-worktree branch caches (current branch / HEAD sensitive)
512
+ // Branch caches affected by HEAD/heads changes — `branchMergedStatus` is shared
513
+ // (the answer is invariant across worktrees of the same common repo) but is invalidated
514
+ // here because branch-tip movement in any worktree can change the merge status; the
515
+ // shared-clear logic below routes shared keys via commonPath.
428
516
  if (types.includes('branch') || types.includes('branches')) {
429
517
  keysToClear.add('branch');
518
+ keysToClear.add('branchMergedStatus');
519
+ keysToClear.add('branchOverviews');
520
+ // `commit`/`commitCount` are keyed by symbolic ref or SHA — symbolic-ref entries
521
+ // can drift when branches move; cascade-clear conservatively.
522
+ keysToClear.add('commit');
523
+ keysToClear.add('commitCount');
430
524
  keysToClear.add('conflictDetection');
431
525
  keysToClear.add('currentBranchReference');
432
526
  keysToClear.add('leftRightCommitCount');
527
+ // `mergeBase` keyed by ref-pairs — symbolic refs can move; cascade-clear.
528
+ keysToClear.add('mergeBase');
433
529
  keysToClear.add('reachability');
434
530
  keysToClear.add('resolvedRevisions');
435
531
  }
436
532
 
437
533
  // Shared branch caches (branch list, metadata)
438
534
  if (types.includes('branches')) {
535
+ keysToClear.add('baseBranchName');
536
+ keysToClear.add('branchMetadataMap');
439
537
  keysToClear.add('branches');
440
538
  keysToClear.add('sharedBranches');
441
539
  keysToClear.add('defaultBranchName');
442
540
  keysToClear.add('initialCommitSha');
443
541
  keysToClear.add('logShas');
542
+ keysToClear.add('refs');
543
+ keysToClear.add('refTips');
444
544
  }
445
545
 
446
546
  if (types.includes('config')) {
@@ -452,6 +552,7 @@ export class Cache implements Disposable {
452
552
  }
453
553
 
454
554
  if (types.includes('contributors')) {
555
+ keysToClear.add('branchOverviews');
455
556
  keysToClear.add('contributors');
456
557
  keysToClear.add('contributorsLite');
457
558
  keysToClear.add('contributorsStats');
@@ -464,6 +565,16 @@ export class Cache implements Disposable {
464
565
  if (types.includes('gkConfig')) {
465
566
  keysToClear.add('gkConfigKeys');
466
567
  keysToClear.add('gkConfigPatterns');
568
+ // Derived from `branch.<ref>.gk-merge-base`/`vscode-merge-base`; clear so external
569
+ // gkConfig mutations don't leave stale base-branch resolutions cached.
570
+ keysToClear.add('baseBranchName');
571
+ // Cached overviews are keyed by `${ref}|${mergeTarget}`; bulk gkConfig changes can
572
+ // affect any of the merge-target sources (stored, base, default), so clear all.
573
+ keysToClear.add('branchOverviews');
574
+ }
575
+
576
+ if (types.includes('lastFetched')) {
577
+ keysToClear.add('lastFetched');
467
578
  }
468
579
 
469
580
  if (types.includes('providers')) {
@@ -486,6 +597,8 @@ export class Cache implements Disposable {
486
597
  }
487
598
  if (types.includes('tags')) {
488
599
  keysToClear.add('tags');
600
+ keysToClear.add('refs');
601
+ keysToClear.add('refTips');
489
602
  }
490
603
 
491
604
  if (types.includes('tracking')) {
@@ -522,12 +635,14 @@ export class Cache implements Disposable {
522
635
  invalidate.call(cache, commonPath);
523
636
  for (const worktreePath of this.getWorktreePaths(commonPath)) {
524
637
  if (worktreePath === commonPath) continue;
638
+
525
639
  invalidate.call(cache, worktreePath);
526
640
  }
527
641
  } else {
528
642
  cache.delete(commonPath);
529
643
  for (const worktreePath of this.getWorktreePaths(commonPath)) {
530
644
  if (worktreePath === commonPath) continue;
645
+
531
646
  cache.delete(worktreePath);
532
647
  }
533
648
  }
@@ -700,6 +815,10 @@ export class Cache implements Disposable {
700
815
  types.add('gkConfig');
701
816
  }
702
817
 
818
+ if (hasAny('lastFetched')) {
819
+ types.add('lastFetched');
820
+ }
821
+
703
822
  if (hasAny('remoteProviders')) {
704
823
  types.add('providers');
705
824
  }
@@ -855,10 +974,72 @@ export class Cache implements Disposable {
855
974
  return factoryPromise;
856
975
  }
857
976
 
858
- deleteGkConfig(repoPath: string, key: string): void {
977
+ /**
978
+ * @param options.skipInvalidation Downstream caches the caller wants preserved despite this
979
+ * write. Use when the value being written is exactly what was just resolved — e.g. the Tier 2
980
+ * `storeMergeTargetBranchName` self-write inside `getBranchContributionsOverview` (skip
981
+ * `'branchOverviews'`) or the Tier 3 `storeBaseBranchName` self-write inside `getBaseBranchName`
982
+ * (skip both `'baseBranchName'` and `'branchOverviews'`). The upstream caches (`gkConfigKeys`,
983
+ * `gkConfigPatterns`) always invalidate so subsequent reads of this key see the new value.
984
+ */
985
+ deleteGkConfig(
986
+ repoPath: string,
987
+ key: string,
988
+ options?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },
989
+ ): void {
859
990
  const cacheKey = this.getCommonPath(repoPath);
860
991
  this._caches.gkConfigKeys?.delete(cacheKey, key);
861
992
  this._caches.gkConfigPatterns?.delete(cacheKey);
993
+
994
+ const refMatch = key.match(branchOverviewGkConfigKeysRegex);
995
+ if (refMatch == null) return;
996
+
997
+ const ref = refMatch[1];
998
+ const skip = options?.skipInvalidation;
999
+
1000
+ // `getBaseBranchName` reads `branch.<ref>.gk-merge-base` and caches the resolved value
1001
+ // per-ref. A write to that key must invalidate the cached base or Tier 3 of
1002
+ // `getBranchContributionsOverview` will resolve `mergeTarget` against the pre-write value.
1003
+ if (key.endsWith('.gk-merge-base') && !skip?.includes('baseBranchName')) {
1004
+ this._caches.baseBranchName?.delete(cacheKey, ref);
1005
+ }
1006
+
1007
+ if (skip?.includes('branchOverviews')) return;
1008
+
1009
+ // When the change affects a branch's merge-target/base lineage, invalidate that branch's
1010
+ // cached overviews so subsequent reads pick up the new stored value rather than stale data.
1011
+ // `getBranchContributionsOverview` keys `branchOverviews` by `${ref}|${mergeTarget}`, so
1012
+ // invalidate every entry for the affected ref regardless of which target it resolved to.
1013
+ // Uses `invalidateByKeyPrefix` (not `deleteByKeyPrefix`) so an in-flight factory is still
1014
+ // shared with new callers instead of triggering a duplicate fetch.
1015
+ this._caches.branchOverviews?.invalidateByKeyPrefix(cacheKey, `${ref}|`);
1016
+ }
1017
+
1018
+ async getBranchOverview(
1019
+ repoPath: string,
1020
+ cacheKey: string,
1021
+ factory: (
1022
+ commonPath: string,
1023
+ cacheable: CacheController,
1024
+ cancellation?: AbortSignal,
1025
+ ) => PromiseOrValue<BranchContributionsOverview | undefined>,
1026
+ options?: { accessTTL?: number; cancellation?: AbortSignal },
1027
+ ): Promise<BranchContributionsOverview | undefined> {
1028
+ return this.getSharedOrCreateWithKey(
1029
+ this.branchOverviews,
1030
+ repoPath,
1031
+ cacheKey,
1032
+ factory,
1033
+ (data, newRepoPath) =>
1034
+ data == null
1035
+ ? data
1036
+ : {
1037
+ ...data,
1038
+ repoPath: newRepoPath,
1039
+ contributors: data.contributors.map(c => c.withRepoPath(newRepoPath)),
1040
+ },
1041
+ options,
1042
+ );
862
1043
  }
863
1044
 
864
1045
  async getContributors(
@@ -907,12 +1088,66 @@ export class Cache implements Disposable {
907
1088
  getContributorsStats(
908
1089
  repoPath: string,
909
1090
  cacheKey: string,
910
- factory: (commonPath: string) => PromiseOrValue<GitContributorsStats | undefined>,
911
- options?: { accessTTL?: number },
1091
+ factory: (commonPath: string, cancellation?: AbortSignal) => PromiseOrValue<GitContributorsStats | undefined>,
1092
+ options?: { accessTTL?: number; cancellation?: AbortSignal },
912
1093
  ): Promise<GitContributorsStats | undefined> {
913
1094
  return this.getSharedSimpleWithKey(this.contributorsStats, repoPath, cacheKey, factory, options);
914
1095
  }
915
1096
 
1097
+ getBaseBranchName(
1098
+ repoPath: string,
1099
+ ref: string,
1100
+ factory: (commonPath: string, cancellation?: AbortSignal) => PromiseOrValue<string | undefined>,
1101
+ cancellation?: AbortSignal,
1102
+ ): Promise<string | undefined> {
1103
+ return this.getSharedSimpleWithKey(this.baseBranchName, repoPath, ref, factory, {
1104
+ cancellation: cancellation,
1105
+ });
1106
+ }
1107
+
1108
+ getBranchMergedStatus(
1109
+ repoPath: string,
1110
+ cacheKey: string,
1111
+ factory: (
1112
+ commonPath: string,
1113
+ cacheable: CacheController,
1114
+ cancellation?: AbortSignal,
1115
+ ) => PromiseOrValue<GitBranchMergedStatus>,
1116
+ cancellation?: AbortSignal,
1117
+ ): Promise<GitBranchMergedStatus> {
1118
+ return this.getSharedOrCreateWithKey(
1119
+ this.branchMergedStatus,
1120
+ repoPath,
1121
+ cacheKey,
1122
+ factory,
1123
+ (data, newRepoPath) => {
1124
+ if (!data.merged) return data;
1125
+ if (data.localBranchOnly == null) return data;
1126
+
1127
+ const lbo = data.localBranchOnly;
1128
+ return {
1129
+ ...data,
1130
+ localBranchOnly: createReference(lbo.ref, newRepoPath, {
1131
+ id: getBranchId(newRepoPath, lbo.remote, lbo.name),
1132
+ refType: 'branch',
1133
+ name: lbo.name,
1134
+ remote: lbo.remote,
1135
+ upstream: lbo.upstream,
1136
+ sha: lbo.sha,
1137
+ }),
1138
+ };
1139
+ },
1140
+ { cancellation: cancellation },
1141
+ );
1142
+ }
1143
+
1144
+ getBranchMetadataMap(
1145
+ repoPath: string,
1146
+ factory: (commonPath: string) => PromiseOrValue<Map<string, BranchMetadata>>,
1147
+ ): Promise<Map<string, BranchMetadata>> {
1148
+ return this.getSharedSimple(this.branchMetadataMap, repoPath, factory);
1149
+ }
1150
+
916
1151
  getDefaultBranchName(
917
1152
  repoPath: string,
918
1153
  remote: string,
@@ -935,6 +1170,42 @@ export class Cache implements Disposable {
935
1170
  return this.getSharedSimple(this.lastFetched, repoPath, factory);
936
1171
  }
937
1172
 
1173
+ getRefs(
1174
+ repoPath: string,
1175
+ factory: (
1176
+ commonPath: string,
1177
+ cacheable: CacheController,
1178
+ cancellation?: AbortSignal,
1179
+ ) => PromiseOrValue<RefRecord[]>,
1180
+ cancellation?: AbortSignal,
1181
+ ): Promise<RefRecord[]> {
1182
+ // Raw ref records are repoPath-agnostic (no per-worktree binding to remap), so we key only
1183
+ // by commonPath and skip the per-worktree mapper that `getBranches`/`getTags` need.
1184
+ const commonPath = this.getCommonPath(repoPath);
1185
+ return this.refs.getOrCreate(
1186
+ commonPath,
1187
+ (cacheable, signal) => Promise.resolve(factory(commonPath, cacheable, signal)),
1188
+ cancellation,
1189
+ );
1190
+ }
1191
+
1192
+ getRefTips(
1193
+ repoPath: string,
1194
+ factory: (
1195
+ commonPath: string,
1196
+ cacheable: CacheController,
1197
+ cancellation?: AbortSignal,
1198
+ ) => PromiseOrValue<GitRefTip[]>,
1199
+ cancellation?: AbortSignal,
1200
+ ): Promise<GitRefTip[]> {
1201
+ const commonPath = this.getCommonPath(repoPath);
1202
+ return this.refTips.getOrCreate(
1203
+ commonPath,
1204
+ (cacheable, signal) => Promise.resolve(factory(commonPath, cacheable, signal)),
1205
+ cancellation,
1206
+ );
1207
+ }
1208
+
938
1209
  async getRemotes(
939
1210
  repoPath: string,
940
1211
  factory: (
@@ -955,16 +1226,18 @@ export class Cache implements Disposable {
955
1226
 
956
1227
  async getStash(
957
1228
  repoPath: string,
1229
+ cacheKey: string,
958
1230
  factory: (
959
1231
  commonPath: string,
960
1232
  cacheable: CacheController,
961
1233
  cancellation?: AbortSignal,
962
1234
  ) => PromiseOrValue<GitStash>,
963
- cancellation?: AbortSignal,
1235
+ options?: { accessTTL?: number; cancellation?: AbortSignal },
964
1236
  ): Promise<GitStash> {
965
- return this.getSharedOrCreate(
1237
+ return this.getSharedOrCreateWithKey(
966
1238
  this.stashes,
967
1239
  repoPath,
1240
+ cacheKey,
968
1241
  factory,
969
1242
  (data, newRepoPath) => ({
970
1243
  repoPath: newRepoPath,
@@ -975,7 +1248,7 @@ export class Cache implements Disposable {
975
1248
  ]),
976
1249
  ),
977
1250
  }),
978
- cancellation,
1251
+ options,
979
1252
  );
980
1253
  }
981
1254
 
@@ -1039,6 +1312,7 @@ export class Cache implements Disposable {
1039
1312
  if (cacheable.invalidated) {
1040
1313
  for (const worktreePath of this.getWorktreePaths(commonPath)) {
1041
1314
  if (worktreePath === commonPath) continue;
1315
+
1042
1316
  cache.invalidate(worktreePath);
1043
1317
  }
1044
1318
  }
@@ -1095,6 +1369,7 @@ export class Cache implements Disposable {
1095
1369
  if (cacheable.invalidated) {
1096
1370
  for (const worktreePath of this.getWorktreePaths(commonPath)) {
1097
1371
  if (worktreePath === commonPath) continue;
1372
+
1098
1373
  cache.invalidate(worktreePath, cacheKey);
1099
1374
  }
1100
1375
  }
@@ -1142,11 +1417,16 @@ export class Cache implements Disposable {
1142
1417
  cache: RepoPromiseCacheMap<string, T>,
1143
1418
  repoPath: string,
1144
1419
  cacheKey: string,
1145
- factory: (commonPath: string) => PromiseOrValue<T>,
1146
- options?: { accessTTL?: number },
1420
+ factory: (commonPath: string, cancellation?: AbortSignal) => PromiseOrValue<T>,
1421
+ options?: { accessTTL?: number; cancellation?: AbortSignal },
1147
1422
  ): Promise<T> {
1148
1423
  const commonPath = this.getCommonPath(repoPath);
1149
1424
 
1150
- return cache.getOrCreate(commonPath, cacheKey, () => Promise.resolve(factory(commonPath)), options);
1425
+ return cache.getOrCreate(
1426
+ commonPath,
1427
+ cacheKey,
1428
+ (_cacheable, signal) => Promise.resolve(factory(commonPath, signal)),
1429
+ options,
1430
+ );
1151
1431
  }
1152
1432
  }
@@ -113,9 +113,18 @@ export interface GitServiceHooks {
113
113
  };
114
114
  /** Commit lifecycle hooks */
115
115
  readonly commits?: {
116
- /** Called when a commit is signed successfully */
116
+ /**
117
+ * Called when a commit is signed successfully.
118
+ *
119
+ * Note: currently fired only from explicit-sign paths in the patch provider
120
+ * (where signing is requested via `-S` and confirmed up front). Operations
121
+ * that sign implicitly via `commit.gpgsign=true` (`commit`, `merge`, `pull`,
122
+ * `rebase`, `revert`, `cherryPick`) do not fire this hook because the
123
+ * library cannot cheaply confirm that signing actually occurred without an
124
+ * extra `git config`/`log --show-signature` call.
125
+ */
117
126
  onSigned?(format: SigningFormat, source?: unknown): void;
118
- /** Called when commit signing fails */
127
+ /** Called when commit signing fails — fired from all signing-capable paths. */
119
128
  onSigningFailed?(reason: SigningErrorReason, format: SigningFormat, source?: unknown): void;
120
129
  };
121
130
  /** Git operation hooks */
@@ -21,6 +21,7 @@ export type BranchDisposition = 'starred' | 'archived';
21
21
  export interface BranchMetadata {
22
22
  lastAccessedAt?: string;
23
23
  lastModifiedAt?: string;
24
+ agentLastActivityAt?: string;
24
25
  disposition?: BranchDisposition;
25
26
  }
26
27