@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
@@ -22,6 +22,7 @@ import { encodeGitLensRevisionUriAuthority } from '../../../../git/utils/uriAuth
22
22
  import { debug } from '../../../../utils/decorators/log.js';
23
23
  import { union } from '../../../../utils/iterable.js';
24
24
  import { getScopedLogger } from '../../../../utils/logger.scoped.js';
25
+ import { getSettledValue } from '../../../../utils/promise.js';
25
26
  import type { Uri } from '../../../../utils/uri.js';
26
27
  import { fromUri } from '../../../../utils/uri.js';
27
28
  import { toTokenInfo } from '../../api/tokenUtils.js';
@@ -58,12 +59,18 @@ export class DiffGitSubProvider implements GitDiffSubProvider {
58
59
  async getChangedFilesCount(
59
60
  repoPath: string,
60
61
  to?: string,
61
- _from?: string,
62
+ from?: string,
62
63
  _options?: { uris?: (string | Uri)[]; includeUntracked?: boolean },
63
64
  _cancellation?: AbortSignal,
64
65
  ): Promise<GitDiffShortStat | undefined> {
65
- // TODO@eamodio if there is no ref we can't return anything, until we can get at the change store from RemoteHub
66
- if (!to) return undefined;
66
+ // Virtual GitHub repos have no working tree, so no working changes can exist.
67
+ // Without any refs, return empty stats rather than undefined to avoid "uncertain state" callers.
68
+ if (!to && !from) return { additions: 0, deletions: 0, files: 0 };
69
+
70
+ // If only `from` is provided, compare against HEAD
71
+ if (!to) {
72
+ to = 'HEAD';
73
+ }
67
74
 
68
75
  const commit = await this.provider.commits.getCommit(repoPath, to);
69
76
  if (commit?.stats == null) return undefined;
@@ -115,27 +122,28 @@ export class DiffGitSubProvider implements GitDiffSubProvider {
115
122
  }
116
123
 
117
124
  try {
118
- let result = await github.getComparison(
119
- toTokenInfo(this.provider.authenticationProviderId, session),
120
- metadata.repo.owner,
121
- metadata.repo.name,
122
- stripOrigin(range),
123
- );
124
-
125
- const files1 = result?.files;
125
+ const token = toTokenInfo(this.provider.authenticationProviderId, session);
126
126
 
127
- let files = files1;
127
+ let files;
128
128
  if (range2) {
129
- result = await github.getComparison(
130
- toTokenInfo(this.provider.authenticationProviderId, session),
131
- metadata.repo.owner,
132
- metadata.repo.name,
133
- stripOrigin(range2),
134
- );
129
+ // GitHub doesn't support `..`, so issue both `...` comparisons in parallel and union the results.
130
+ const [result1, result2] = await Promise.allSettled([
131
+ github.getComparison(token, metadata.repo.owner, metadata.repo.name, stripOrigin(range)),
132
+ github.getComparison(token, metadata.repo.owner, metadata.repo.name, stripOrigin(range2)),
133
+ ]);
135
134
 
136
- const files2 = result?.files;
135
+ const files1 = getSettledValue(result1)?.files;
136
+ const files2 = getSettledValue(result2)?.files;
137
137
 
138
138
  files = [...new Set(union(files1, files2))];
139
+ } else {
140
+ const result = await github.getComparison(
141
+ token,
142
+ metadata.repo.owner,
143
+ metadata.repo.name,
144
+ stripOrigin(range),
145
+ );
146
+ files = result?.files;
139
147
  }
140
148
 
141
149
  return files?.map(f => ({
@@ -1,9 +1,10 @@
1
1
  import type { Cache } from '../../../../git/cache.js';
2
2
  import type { GitBranch } from '../../../../git/models/branch.js';
3
- import type { GitReference } from '../../../../git/models/reference.js';
3
+ import type { GitReference, GitRefTip } from '../../../../git/models/reference.js';
4
4
  import { deletedOrMissing } from '../../../../git/models/revision.js';
5
5
  import type { GitTag } from '../../../../git/models/tag.js';
6
6
  import type { GitRefsSubProvider } from '../../../../git/providers/refs.js';
7
+ import type { GitCommandPriority } from '../../../../git/run.types.js';
7
8
  import { createReference } from '../../../../git/utils/reference.utils.js';
8
9
  import {
9
10
  createRevisionRange,
@@ -16,7 +17,7 @@ import { toTokenInfo } from '../../api/tokenUtils.js';
16
17
  import type { GitHubGitProviderInternal } from '../githubProvider.js';
17
18
 
18
19
  // Since negative lookbehind isn't supported in all browsers, this leaves out the negative lookbehind condition `(?<!\.lock)` to ensure the branch name doesn't end with `.lock`
19
- // eslint-disable-next-line no-control-regex
20
+ // oxlint-disable-next-line no-control-regex
20
21
  const validBranchOrTagRegex = /^[^/](?!.*\/\.)(?!.*\.\.)(?!.*\/\/)(?!.*@\{)[^\x00-\x1F\x7F ~^:?*[\\]+[^./]$/;
21
22
 
22
23
  export class RefsGitSubProvider implements GitRefsSubProvider {
@@ -31,32 +32,42 @@ export class RefsGitSubProvider implements GitRefsSubProvider {
31
32
  }
32
33
 
33
34
  @debug()
34
- async getMergeBase(
35
+ getMergeBase(
35
36
  repoPath: string,
36
37
  ref1: string,
37
38
  ref2: string,
38
- _options?: { forkPoint?: boolean },
39
+ _options?: { forkPoint?: boolean; priority?: GitCommandPriority },
39
40
  _cancellation?: AbortSignal,
40
41
  ): Promise<string | undefined> {
41
- if (repoPath == null) return undefined;
42
-
43
- const scope = getScopedLogger();
44
-
45
- const { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);
46
-
47
- try {
48
- const result = await github.getComparison(
49
- toTokenInfo(this.provider.authenticationProviderId, session),
50
- metadata.repo.owner,
51
- metadata.repo.name,
52
- createRevisionRange(stripOrigin(ref1), stripOrigin(ref2), '...'),
53
- );
54
- return result?.merge_base_commit?.sha;
55
- } catch (ex) {
56
- scope?.error(ex);
57
- debugger;
58
- return undefined;
59
- }
42
+ if (repoPath == null) return Promise.resolve(undefined);
43
+
44
+ const a = stripOrigin(ref1);
45
+ const b = stripOrigin(ref2);
46
+ // `merge-base` is symmetric, so normalize ref order in the cache key to coalesce
47
+ // `(A, B)` and `(B, A)` lookups onto a single entry.
48
+ const [left, right] = a < b ? [a, b] : [b, a];
49
+ const cacheKey = `${left}...${right}`;
50
+ const queryRange = createRevisionRange(a, b, '...');
51
+
52
+ return this.cache.mergeBase.getOrCreate(repoPath, cacheKey, async () => {
53
+ const scope = getScopedLogger();
54
+
55
+ const { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);
56
+
57
+ try {
58
+ const result = await github.getComparison(
59
+ toTokenInfo(this.provider.authenticationProviderId, session),
60
+ metadata.repo.owner,
61
+ metadata.repo.name,
62
+ queryRange,
63
+ );
64
+ return result?.merge_base_commit?.sha;
65
+ } catch (ex) {
66
+ scope?.error(ex);
67
+ debugger;
68
+ return undefined;
69
+ }
70
+ });
60
71
  }
61
72
 
62
73
  @debug()
@@ -90,6 +101,30 @@ export class RefsGitSubProvider implements GitRefsSubProvider {
90
101
  return createReference(ref, repoPath, { refType: 'revision' });
91
102
  }
92
103
 
104
+ @debug()
105
+ getRefTips(
106
+ _repoPath: string,
107
+ _options?: { include?: ReadonlyArray<'heads' | 'remotes' | 'tags'> },
108
+ _cancellation?: AbortSignal,
109
+ ): Promise<GitRefTip[]> {
110
+ // Not implemented for GitHub virtual repos — current consumers (timeline slice-by-branch)
111
+ // gate this off via `!repo.virtual`. A future implementation can use GraphQL `refs` /
112
+ // `commit.associatedRefs`.
113
+ return Promise.resolve([]);
114
+ }
115
+
116
+ @debug()
117
+ getRefsContainingShas(
118
+ _repoPath: string,
119
+ _shas: ReadonlySet<string> | readonly string[],
120
+ _oldestSha: string,
121
+ _options?: { include?: ReadonlyArray<'heads' | 'remotes' | 'tags'> },
122
+ _cancellation?: AbortSignal,
123
+ ): Promise<Map<string, GitRefTip[]>> {
124
+ // See `getRefTips` — gated off for virtual repos until GraphQL `commit.associatedRefs` lands.
125
+ return Promise.resolve(new Map<string, GitRefTip[]>());
126
+ }
127
+
93
128
  @debug()
94
129
  async hasBranchOrTag(
95
130
  repoPath: string | undefined,
@@ -98,8 +98,7 @@ export class RevisionGitSubProvider implements GitRevisionSubProvider {
98
98
  });
99
99
  }
100
100
 
101
- // TODO@eamodio: Implement this
102
- return [];
101
+ return result;
103
102
  }
104
103
 
105
104
  @debug()
@@ -2,6 +2,7 @@ import type { GitFile } from '../../../../git/models/file.js';
2
2
  import type { GitConflictFile } from '../../../../git/models/staging.js';
3
3
  import { GitStatus } from '../../../../git/models/status.js';
4
4
  import type { GitStatusSubProvider, GitWorkingChangesState } from '../../../../git/providers/status.js';
5
+ import type { GitCommandPriority } from '../../../../git/run.types.js';
5
6
  import { gate } from '../../../../utils/decorators/gate.js';
6
7
  import { debug } from '../../../../utils/decorators/log.js';
7
8
  import { HeadType } from '../../context.js';
@@ -12,7 +13,11 @@ export class StatusGitSubProvider implements GitStatusSubProvider {
12
13
 
13
14
  @gate()
14
15
  @debug()
15
- async getStatus(repoPath: string | undefined, _cancellation?: AbortSignal): Promise<GitStatus | undefined> {
16
+ async getStatus(
17
+ repoPath: string | undefined,
18
+ _options?: { priority?: GitCommandPriority },
19
+ _cancellation?: AbortSignal,
20
+ ): Promise<GitStatus | undefined> {
16
21
  if (repoPath == null) return undefined;
17
22
 
18
23
  const context = await this.provider.ensureRepositoryContext(repoPath);
@@ -33,72 +33,71 @@ export class TagsGitSubProvider implements GitTagsSubProvider {
33
33
  ): Promise<PagedResult<GitTag>> {
34
34
  if (repoPath == null) return emptyPagedResult;
35
35
 
36
+ const path = repoPath;
37
+
36
38
  const scope = getScopedLogger();
37
39
 
38
- const tagsPromise = options?.paging?.cursor
39
- ? undefined
40
- : this.cache.tags.getOrCreate(
41
- repoPath,
42
- async cancellable => {
43
- try {
44
- const { metadata, github, session } = await this.provider.ensureRepositoryContext(repoPath);
45
-
46
- const tags: GitTag[] = [];
47
-
48
- let cursor = options?.paging?.cursor;
49
- const loadAll = cursor == null;
50
-
51
- let authoredDate;
52
- let committedDate;
53
-
54
- while (true) {
55
- const result = await github.getTags(
56
- toTokenInfo(this.provider.authenticationProviderId, session),
57
- metadata.repo.owner,
58
- metadata.repo.name,
59
- { cursor: cursor },
60
- );
61
-
62
- for (const tag of result.values) {
63
- authoredDate =
64
- tag.target.authoredDate ??
65
- tag.target.target?.authoredDate ??
66
- tag.target.tagger?.date;
67
- committedDate =
68
- tag.target.committedDate ??
69
- tag.target.target?.committedDate ??
70
- tag.target.tagger?.date;
71
-
72
- tags.push(
73
- new GitTag(
74
- repoPath,
75
- tag.name,
76
- tag.target.target?.oid ?? tag.target.oid,
77
- tag.target.message ?? tag.target.target?.message ?? '',
78
- authoredDate != null ? new Date(authoredDate) : undefined,
79
- committedDate != null ? new Date(committedDate) : undefined,
80
- ),
81
- );
82
- }
83
-
84
- if (!result.paging?.more || !loadAll) return { ...result, values: tags };
85
-
86
- cursor = result.paging.cursor;
87
- }
88
- } catch (ex) {
89
- cancellable.invalidate();
90
- scope?.error(ex);
91
- debugger;
92
-
93
- return emptyPagedResult;
40
+ // Compose cache key with cursor so re-loads of the same page hit the cache;
41
+ // `repoPath` (no suffix) is reserved for the full "all tags" entry.
42
+ // TODO: `cache.tags` is `PromiseMap<RepoPath, ...>` keyed exactly by repoPath, so
43
+ // `clearCaches('tags')` / `unregisterRepoPath` will not invalidate composite-key entries.
44
+ // Acceptable today because tags rarely move during a virtual-repo session, but the entries
45
+ // leak in memory until provider GC. Long-term: switch to RepoPromiseCacheMap or add prefix-invalidate.
46
+ const cacheKey = options?.paging?.cursor != null ? `${path}#${options.paging.cursor}` : path;
47
+ const tagsPromise = this.cache.tags.getOrCreate(
48
+ cacheKey,
49
+ async cancellable => {
50
+ try {
51
+ const { metadata, github, session } = await this.provider.ensureRepositoryContext(path);
52
+
53
+ const tags: GitTag[] = [];
54
+
55
+ let cursor = options?.paging?.cursor;
56
+ const loadAll = cursor == null;
57
+
58
+ let authoredDate;
59
+ let committedDate;
60
+
61
+ while (true) {
62
+ const result = await github.getTags(
63
+ toTokenInfo(this.provider.authenticationProviderId, session),
64
+ metadata.repo.owner,
65
+ metadata.repo.name,
66
+ { cursor: cursor },
67
+ );
68
+
69
+ for (const tag of result.values) {
70
+ authoredDate =
71
+ tag.target.authoredDate ?? tag.target.target?.authoredDate ?? tag.target.tagger?.date;
72
+ committedDate =
73
+ tag.target.committedDate ?? tag.target.target?.committedDate ?? tag.target.tagger?.date;
74
+
75
+ tags.push(
76
+ new GitTag(
77
+ path,
78
+ tag.name,
79
+ tag.target.target?.oid ?? tag.target.oid,
80
+ tag.target.message ?? tag.target.target?.message ?? '',
81
+ authoredDate != null ? new Date(authoredDate) : undefined,
82
+ committedDate != null ? new Date(committedDate) : undefined,
83
+ ),
84
+ );
94
85
  }
95
- },
96
- cancellation,
97
- );
98
86
 
99
- if (tagsPromise == null) {
100
- return emptyPagedResult;
101
- }
87
+ if (!result.paging?.more || !loadAll) return { ...result, values: tags };
88
+
89
+ cursor = result.paging.cursor;
90
+ }
91
+ } catch (ex) {
92
+ cancellable.invalidate();
93
+ scope?.error(ex);
94
+ debugger;
95
+
96
+ return emptyPagedResult;
97
+ }
98
+ },
99
+ cancellation,
100
+ );
102
101
 
103
102
  let result = await tagsPromise;
104
103
  if (options?.filter != null) {
@@ -152,6 +152,7 @@ export class GitHubGitProvider implements GitHubGitProviderInternal, GitProvider
152
152
 
153
153
  getPagingLimit(limit?: number): number {
154
154
  if (limit === 0) return 0;
155
+
155
156
  limit = Math.min(limit ?? this.context.config?.paging?.limit ?? 100, 100);
156
157
  if (limit !== 0 && limit < 100) {
157
158
  limit = Math.max(limit, 1);
@@ -568,6 +568,7 @@ export class Color {
568
568
  if (of.isLighterThan(relative)) {
569
569
  return of;
570
570
  }
571
+
571
572
  factor = factor ? factor : 0.5;
572
573
  const lum1 = of.getRelativeLuminance();
573
574
  const lum2 = relative.getRelativeLuminance();
@@ -579,6 +580,7 @@ export class Color {
579
580
  if (of.isDarkerThan(relative)) {
580
581
  return of;
581
582
  }
583
+
582
584
  factor = factor ? factor : 0.5;
583
585
  const lum1 = of.getRelativeLuminance();
584
586
  const lum2 = relative.getRelativeLuminance();
package/src/utils/date.ts CHANGED
@@ -80,6 +80,8 @@ export function createFromDateDelta(
80
80
 
81
81
  export function fromNow(date: Date | number, short?: boolean): string {
82
82
  const elapsed = (typeof date === 'number' ? date : date.getTime()) - Date.now();
83
+ // Guard against invalid dates (e.g. `new Date(<unparseable>)`), since a non-finite value would throw in `Intl.RelativeTimeFormat.format`
84
+ if (!Number.isFinite(elapsed)) return '';
83
85
 
84
86
  for (const [unit, threshold, divisor, shortUnit] of relativeUnitThresholds) {
85
87
  const elapsedABS = Math.abs(elapsed);
@@ -134,6 +136,9 @@ export function formatDate(
134
136
  ): string {
135
137
  format = format ?? undefined;
136
138
 
139
+ // Guard against invalid dates (e.g. `new Date(<unparseable>)`), since they would throw in `Intl.DateTimeFormat.format`
140
+ if (Number.isNaN(typeof date === 'number' ? date : date.getTime())) return '';
141
+
137
142
  const key = `${locale ?? ''}:${format}`;
138
143
 
139
144
  let formatter = dateTimeFormatCache.get(key);
@@ -276,7 +276,7 @@ export function debounce<F extends (...args: any[]) => ReturnType<F>>(
276
276
  if (aggregator != null && lastArgs != null) {
277
277
  lastArgs = aggregator(lastArgs, args);
278
278
  } else {
279
- // eslint-disable-next-line @typescript-eslint/no-this-alias
279
+ // oxlint-disable-next-line @typescript-eslint/no-this-alias
280
280
  lastThis = this;
281
281
  lastArgs = args;
282
282
  }
@@ -18,6 +18,7 @@ export function serializable(target: Function): void {
18
18
  while (proto != null && proto !== Object.prototype) {
19
19
  for (const key of Object.getOwnPropertyNames(proto)) {
20
20
  if (key === 'constructor') continue;
21
+
21
22
  const desc = Object.getOwnPropertyDescriptor(proto, key);
22
23
  if (desc?.get != null) {
23
24
  getterKeys.add(key);
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Per-key cache for async resolution that dedupes concurrent first-time callers and caches the
3
+ * resolved value (including `undefined`) for subsequent reads.
4
+ *
5
+ * Two internal Maps drive the semantics:
6
+ * - `_resolved` holds settled values. `has(key)` distinguishes a cached `undefined` from "never
7
+ * resolved", so callers can intentionally cache "no result" without re-running the resolver.
8
+ * - `_resolving` holds in-flight Promises. While a key resolves, concurrent `getOrResolve` callers
9
+ * share the same Promise instead of each invoking the resolver.
10
+ *
11
+ * Failed resolutions do not poison the cache — the entry is removed when the in-flight Promise
12
+ * rejects, so the next call retries.
13
+ */
14
+ export class DedupedAsyncCache<K, V> {
15
+ private readonly _resolved = new Map<K, V>();
16
+ private readonly _resolving = new Map<K, Promise<V>>();
17
+
18
+ /** True iff `key` has a settled value cached. Distinct from "currently resolving". */
19
+ has(key: K): boolean {
20
+ return this._resolved.has(key);
21
+ }
22
+
23
+ /** Settled value for `key`, or `undefined` when not yet cached. May also legitimately return
24
+ * `undefined` for a key whose cached value is `undefined`; use `has` to disambiguate. */
25
+ get(key: K): V | undefined {
26
+ return this._resolved.get(key);
27
+ }
28
+
29
+ /** Populates the cache directly, bypassing the resolver. Used by callers that already know the
30
+ * value (e.g. event payloads, post-write reconciles) and want subsequent reads to hit. */
31
+ set(key: K, value: V): void {
32
+ this._resolved.set(key, value);
33
+ }
34
+
35
+ /** Removes both the settled value and any in-flight Promise for `key`. */
36
+ delete(key: K): void {
37
+ this._resolved.delete(key);
38
+ this._resolving.delete(key);
39
+ }
40
+
41
+ /** Clears everything — both settled values and in-flight Promises. */
42
+ clear(): void {
43
+ this._resolved.clear();
44
+ this._resolving.clear();
45
+ }
46
+
47
+ /**
48
+ * Returns the cached value for `key`, invoking `resolver` only on a cache miss. Concurrent
49
+ * cache-miss callers for the same key share the same in-flight Promise — `resolver` is invoked
50
+ * exactly once per cache fill. If `resolver` rejects, the entry is removed so subsequent calls
51
+ * retry rather than receiving a permanently cached failure.
52
+ */
53
+ getOrResolve(key: K, resolver: () => Promise<V>): Promise<V> {
54
+ if (this._resolved.has(key)) {
55
+ // Map.get returns `V | undefined`; `has` confirmed presence, so the value (even if it
56
+ // is `undefined` by intent) is the cached one. Cast pins the return type.
57
+ return Promise.resolve(this._resolved.get(key) as V);
58
+ }
59
+
60
+ const existing = this._resolving.get(key);
61
+ if (existing != null) return existing;
62
+
63
+ const pending = resolver()
64
+ .then(value => {
65
+ this._resolved.set(key, value);
66
+ return value;
67
+ })
68
+ .finally(() => {
69
+ this._resolving.delete(key);
70
+ });
71
+ this._resolving.set(key, pending);
72
+ return pending;
73
+ }
74
+ }
@@ -0,0 +1,61 @@
1
+ // Annotates diff to make is easier for agentic reference to line number.
2
+ // Brackets sit AFTER the line-type marker so file-level diff parsers
3
+ // (e.g. `filterDiffFiles`) that key off `diff --git` / `+++` / `---` headers still work.
4
+ export function annotateDiffWithNewLineNumbers(diff: string): string {
5
+ if (!diff) return diff;
6
+
7
+ const lines = diff.split('\n');
8
+ const out: string[] = new Array(lines.length);
9
+ let newLine = 0;
10
+ let inHunk = false;
11
+
12
+ for (let i = 0; i < lines.length; i++) {
13
+ const line = lines[i];
14
+
15
+ if (line.startsWith('@@')) {
16
+ const match = /\+(\d+)(?:,\d+)?\s/.exec(line);
17
+ newLine = match != null ? parseInt(match[1], 10) : 0;
18
+ inHunk = true;
19
+ out[i] = line;
20
+ continue;
21
+ }
22
+
23
+ if (
24
+ line.startsWith('diff --git') ||
25
+ line.startsWith('index ') ||
26
+ line.startsWith('--- ') ||
27
+ line.startsWith('+++ ') ||
28
+ line.startsWith('new file') ||
29
+ line.startsWith('deleted file') ||
30
+ line.startsWith('rename ') ||
31
+ line.startsWith('copy ') ||
32
+ line.startsWith('similarity ') ||
33
+ line.startsWith('dissimilarity ') ||
34
+ line.startsWith('Binary files')
35
+ ) {
36
+ inHunk = false;
37
+ out[i] = line;
38
+ continue;
39
+ }
40
+
41
+ if (!inHunk || line.startsWith('\\')) {
42
+ out[i] = line;
43
+ continue;
44
+ }
45
+
46
+ const marker = line[0];
47
+ if (marker === '-') {
48
+ out[i] = `-[ ]${line.slice(1)}`;
49
+ continue;
50
+ }
51
+ if (marker === '+' || marker === ' ') {
52
+ out[i] = `${marker}[${String(newLine).padStart(5, ' ')}]${line.slice(1)}`;
53
+ newLine++;
54
+ continue;
55
+ }
56
+
57
+ out[i] = line;
58
+ }
59
+
60
+ return out.join('\n');
61
+ }
@@ -13,6 +13,7 @@ export function createDisposable(
13
13
  options?: { once?: boolean },
14
14
  ): UnifiedDisposable | undefined {
15
15
  if (dispose == null) return undefined;
16
+
16
17
  if (options?.once) {
17
18
  dispose = once(dispose);
18
19
  }
@@ -61,6 +62,7 @@ export function fromDisposables(
61
62
  let disposed = false;
62
63
  const dispose = () => {
63
64
  if (disposed) return;
65
+
64
66
  disposed = true;
65
67
 
66
68
  for (const d of disposables) {
@@ -287,6 +287,7 @@ export function run<T extends number | string>(
287
287
  `Non-UTF-8 encoding '${encoding}' requested but no decode function configured`,
288
288
  );
289
289
  }
290
+
290
291
  stdoutDecoded = await decode(
291
292
  Buffer.from(stdout, 'binary'),
292
293
  encoding ? { encoding: encoding } : undefined,
@@ -311,6 +312,7 @@ export function run<T extends number | string>(
311
312
  if (decode == null) {
312
313
  throw new Error(`Non-UTF-8 encoding '${encoding}' requested but no decode function configured`);
313
314
  }
315
+
314
316
  resolve(
315
317
  (await decode(
316
318
  Buffer.from(stdout, 'binary'),
@@ -7,6 +7,7 @@
7
7
  export function isErrorLike(v: unknown): v is { name: string; message: string; stack?: string } {
8
8
  if (v == null || typeof v !== 'object') return false;
9
9
  if (v instanceof Error) return true;
10
+
10
11
  const o = v as { name?: unknown; message?: unknown };
11
12
  return typeof o.name === 'string' && typeof o.message === 'string';
12
13
  }
@@ -48,6 +48,7 @@ class ChunkByStringLengthIterator implements IterableIterator<string[]> {
48
48
  constructor(
49
49
  private readonly source: string[],
50
50
  private readonly maxLength: number,
51
+ private readonly overheadPerItem: number = 0,
51
52
  ) {}
52
53
 
53
54
  next(): IteratorResult<string[]> {
@@ -61,7 +62,7 @@ class ChunkByStringLengthIterator implements IterableIterator<string[]> {
61
62
 
62
63
  while (this.index < this.source.length) {
63
64
  const item = this.source[this.index];
64
- const length = chunkLength + item.length;
65
+ const length = chunkLength + item.length + this.overheadPerItem;
65
66
 
66
67
  if (length > this.maxLength && chunk.length > 0) {
67
68
  break;
@@ -80,8 +81,18 @@ class ChunkByStringLengthIterator implements IterableIterator<string[]> {
80
81
  }
81
82
  }
82
83
 
83
- export function chunkByStringLength(source: string[], maxLength: number): Iterable<string[]> {
84
- return new ChunkByStringLengthIterator(source, maxLength);
84
+ /**
85
+ * Chunks strings so each chunk's total serialized length stays within `maxLength`.
86
+ * `overheadPerItem` adds a fixed per-item cost to the running total — use it when the strings will
87
+ * be joined with a separator or otherwise expanded per item (e.g. CLI argv: one separator + quoting
88
+ * per argument), so the assembled result can't exceed the limit even with many short items.
89
+ */
90
+ export function chunkByStringLength(
91
+ source: string[],
92
+ maxLength: number,
93
+ overheadPerItem: number = 0,
94
+ ): Iterable<string[]> {
95
+ return new ChunkByStringLengthIterator(source, maxLength, overheadPerItem);
85
96
  }
86
97
 
87
98
  /**
@@ -269,6 +280,7 @@ export function findIndex<T>(source: Iterable<T> | IterableIterator<T>, predicat
269
280
  let i = 0;
270
281
  for (const item of source) {
271
282
  if (predicate(item)) return i;
283
+
272
284
  i++;
273
285
  }
274
286
  return -1;
@@ -329,6 +341,7 @@ class FlatMapIterator<T, TMapped> implements IterableIterator<TMapped> {
329
341
  if (!mappedResult.done) {
330
342
  return { done: false, value: mappedResult.value };
331
343
  }
344
+
332
345
  // Current mapped iterator is exhausted, move to next source item
333
346
  this.currentMappedIterator = undefined;
334
347
  }
@@ -576,6 +589,7 @@ class SkipIterator<T> implements IterableIterator<T> {
576
589
  this.done = true;
577
590
  return { done: true, value: undefined };
578
591
  }
592
+
579
593
  this.skipped++;
580
594
  }
581
595