@gitkraken/core-gitlens 0.2.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 (361) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/dist/git/cache.d.ts +28 -4
  3. package/dist/git/cache.d.ts.map +1 -1
  4. package/dist/git/cache.js +82 -18
  5. package/dist/git/cache.js.map +1 -1
  6. package/dist/git/models/commit.d.ts.map +1 -1
  7. package/dist/git/models/commit.js.map +1 -1
  8. package/dist/git/models/reference.d.ts +31 -0
  9. package/dist/git/models/reference.d.ts.map +1 -1
  10. package/dist/git/models/remote.d.ts.map +1 -1
  11. package/dist/git/models/remote.js.map +1 -1
  12. package/dist/git/models/repository.d.ts +9 -1
  13. package/dist/git/models/repository.d.ts.map +1 -1
  14. package/dist/git/models/repository.js +19 -3
  15. package/dist/git/models/repository.js.map +1 -1
  16. package/dist/git/models/search.d.ts +2 -2
  17. package/dist/git/models/search.d.ts.map +1 -1
  18. package/dist/git/models/worktree.d.ts +4 -1
  19. package/dist/git/models/worktree.d.ts.map +1 -1
  20. package/dist/git/models/worktree.js +2 -2
  21. package/dist/git/models/worktree.js.map +1 -1
  22. package/dist/git/parsers/diffParser.d.ts.map +1 -1
  23. package/dist/git/parsers/diffParser.js.map +1 -1
  24. package/dist/git/providers/branches.d.ts +15 -4
  25. package/dist/git/providers/branches.d.ts.map +1 -1
  26. package/dist/git/providers/config.d.ts +4 -1
  27. package/dist/git/providers/config.d.ts.map +1 -1
  28. package/dist/git/providers/operations.d.ts +33 -10
  29. package/dist/git/providers/operations.d.ts.map +1 -1
  30. package/dist/git/providers/pausedOperations.d.ts +3 -1
  31. package/dist/git/providers/pausedOperations.d.ts.map +1 -1
  32. package/dist/git/providers/refs.d.ts +23 -2
  33. package/dist/git/providers/refs.d.ts.map +1 -1
  34. package/dist/git/providers/staging.d.ts +16 -0
  35. package/dist/git/providers/staging.d.ts.map +1 -1
  36. package/dist/git/providers/status.d.ts +4 -1
  37. package/dist/git/providers/status.d.ts.map +1 -1
  38. package/dist/git/remotes/azure-devops.d.ts.map +1 -1
  39. package/dist/git/remotes/azure-devops.js.map +1 -1
  40. package/dist/git/{exec.types.d.ts → run.types.d.ts} +22 -3
  41. package/dist/git/run.types.d.ts.map +1 -0
  42. package/dist/git/run.types.js +2 -0
  43. package/dist/git/run.types.js.map +1 -0
  44. package/dist/git/service.d.ts.map +1 -1
  45. package/dist/git/service.js.map +1 -1
  46. package/dist/git/utils/autolink.utils.d.ts.map +1 -1
  47. package/dist/git/utils/autolink.utils.js.map +1 -1
  48. package/dist/git/utils/blame.utils.d.ts.map +1 -1
  49. package/dist/git/utils/blame.utils.js.map +1 -1
  50. package/dist/git/utils/conflictResolution.utils.d.ts +6 -0
  51. package/dist/git/utils/conflictResolution.utils.d.ts.map +1 -0
  52. package/dist/git/utils/conflictResolution.utils.js +25 -0
  53. package/dist/git/utils/conflictResolution.utils.js.map +1 -0
  54. package/dist/git/utils/fileStatus.utils.d.ts +2 -1
  55. package/dist/git/utils/fileStatus.utils.d.ts.map +1 -1
  56. package/dist/git/utils/fileStatus.utils.js +4 -0
  57. package/dist/git/utils/fileStatus.utils.js.map +1 -1
  58. package/dist/git/utils/search.utils.d.ts.map +1 -1
  59. package/dist/git/utils/search.utils.js +3 -0
  60. package/dist/git/utils/search.utils.js.map +1 -1
  61. package/dist/git/utils/sorting.d.ts +8 -0
  62. package/dist/git/utils/sorting.d.ts.map +1 -1
  63. package/dist/git/utils/sorting.js +15 -0
  64. package/dist/git/utils/sorting.js.map +1 -1
  65. package/dist/git/utils/status.utils.d.ts.map +1 -1
  66. package/dist/git/utils/status.utils.js.map +1 -1
  67. package/dist/git/watching/classifyChange.d.ts.map +1 -1
  68. package/dist/git/watching/classifyChange.js +8 -0
  69. package/dist/git/watching/classifyChange.js.map +1 -1
  70. package/dist/git/watching/gitIgnoreFilter.js +1 -1
  71. package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
  72. package/dist/git/watching/initWatcher.d.ts.map +1 -1
  73. package/dist/git/watching/initWatcher.js.map +1 -1
  74. package/dist/git/watching/watchGroup.d.ts.map +1 -1
  75. package/dist/git/watching/watchGroup.js.map +1 -1
  76. package/dist/git/watching/watchService.d.ts.map +1 -1
  77. package/dist/git/watching/watchService.js +24 -4
  78. package/dist/git/watching/watchService.js.map +1 -1
  79. package/dist/git/watching/watchSession.d.ts.map +1 -1
  80. package/dist/git/watching/watchSession.js.map +1 -1
  81. package/dist/git-cli/exec/exec.types.d.ts +1 -1
  82. package/dist/git-cli/exec/exec.types.d.ts.map +1 -1
  83. package/dist/git-cli/exec/git.d.ts +3 -3
  84. package/dist/git-cli/exec/git.d.ts.map +1 -1
  85. package/dist/git-cli/exec/git.js.map +1 -1
  86. package/dist/git-cli/exec/gitQueue.d.ts +10 -2
  87. package/dist/git-cli/exec/gitQueue.d.ts.map +1 -1
  88. package/dist/git-cli/exec/gitQueue.js +39 -12
  89. package/dist/git-cli/exec/gitQueue.js.map +1 -1
  90. package/dist/git-cli/parsers/blameParser.d.ts.map +1 -1
  91. package/dist/git-cli/parsers/blameParser.js.map +1 -1
  92. package/dist/git-cli/parsers/logParser.js.map +1 -1
  93. package/dist/git-cli/parsers/refParser.d.ts +3 -30
  94. package/dist/git-cli/parsers/refParser.d.ts.map +1 -1
  95. package/dist/git-cli/parsers/refParser.js +30 -30
  96. package/dist/git-cli/parsers/refParser.js.map +1 -1
  97. package/dist/git-cli/providers/blame.d.ts.map +1 -1
  98. package/dist/git-cli/providers/blame.js.map +1 -1
  99. package/dist/git-cli/providers/branches.d.ts +15 -5
  100. package/dist/git-cli/providers/branches.d.ts.map +1 -1
  101. package/dist/git-cli/providers/branches.js +98 -68
  102. package/dist/git-cli/providers/branches.js.map +1 -1
  103. package/dist/git-cli/providers/commits.d.ts.map +1 -1
  104. package/dist/git-cli/providers/commits.js +74 -30
  105. package/dist/git-cli/providers/commits.js.map +1 -1
  106. package/dist/git-cli/providers/config.d.ts +11 -2
  107. package/dist/git-cli/providers/config.d.ts.map +1 -1
  108. package/dist/git-cli/providers/config.js +27 -2
  109. package/dist/git-cli/providers/config.js.map +1 -1
  110. package/dist/git-cli/providers/diff.d.ts.map +1 -1
  111. package/dist/git-cli/providers/diff.js +4 -2
  112. package/dist/git-cli/providers/diff.js.map +1 -1
  113. package/dist/git-cli/providers/graph.d.ts.map +1 -1
  114. package/dist/git-cli/providers/graph.js +7 -2
  115. package/dist/git-cli/providers/graph.js.map +1 -1
  116. package/dist/git-cli/providers/operations.d.ts +13 -11
  117. package/dist/git-cli/providers/operations.d.ts.map +1 -1
  118. package/dist/git-cli/providers/operations.js +108 -38
  119. package/dist/git-cli/providers/operations.js.map +1 -1
  120. package/dist/git-cli/providers/patch.d.ts.map +1 -1
  121. package/dist/git-cli/providers/patch.js.map +1 -1
  122. package/dist/git-cli/providers/pausedOperations.d.ts +3 -1
  123. package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
  124. package/dist/git-cli/providers/pausedOperations.js +7 -1
  125. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  126. package/dist/git-cli/providers/refs.d.ts +19 -2
  127. package/dist/git-cli/providers/refs.d.ts.map +1 -1
  128. package/dist/git-cli/providers/refs.js +286 -2
  129. package/dist/git-cli/providers/refs.js.map +1 -1
  130. package/dist/git-cli/providers/revision.js.map +1 -1
  131. package/dist/git-cli/providers/staging.d.ts +6 -0
  132. package/dist/git-cli/providers/staging.d.ts.map +1 -1
  133. package/dist/git-cli/providers/staging.js +32 -0
  134. package/dist/git-cli/providers/staging.js.map +1 -1
  135. package/dist/git-cli/providers/status.d.ts +4 -1
  136. package/dist/git-cli/providers/status.d.ts.map +1 -1
  137. package/dist/git-cli/providers/status.js +4 -3
  138. package/dist/git-cli/providers/status.js.map +1 -1
  139. package/dist/git-cli/providers/tags.d.ts.map +1 -1
  140. package/dist/git-cli/providers/tags.js +10 -6
  141. package/dist/git-cli/providers/tags.js.map +1 -1
  142. package/dist/ipc/discovery.d.ts +27 -0
  143. package/dist/ipc/discovery.d.ts.map +1 -0
  144. package/dist/ipc/discovery.js +38 -0
  145. package/dist/ipc/discovery.js.map +1 -0
  146. package/dist/ipc/ipcServer.d.ts +20 -0
  147. package/dist/ipc/ipcServer.d.ts.map +1 -0
  148. package/dist/ipc/ipcServer.js +162 -0
  149. package/dist/ipc/ipcServer.js.map +1 -0
  150. package/dist/plus/agents/providers/claudeCodeProvider.d.ts +114 -0
  151. package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -0
  152. package/dist/plus/agents/providers/claudeCodeProvider.js +1480 -0
  153. package/dist/plus/agents/providers/claudeCodeProvider.js.map +1 -0
  154. package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +36 -0
  155. package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -0
  156. package/dist/plus/agents/providers/claudeCodeTranscript.js +171 -0
  157. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -0
  158. package/dist/plus/agents/sanitizePrompt.d.ts +15 -0
  159. package/dist/plus/agents/sanitizePrompt.d.ts.map +1 -0
  160. package/dist/plus/agents/sanitizePrompt.js +103 -0
  161. package/dist/plus/agents/sanitizePrompt.js.map +1 -0
  162. package/dist/plus/agents/stateMachine.d.ts +32 -0
  163. package/dist/plus/agents/stateMachine.d.ts.map +1 -0
  164. package/dist/plus/agents/stateMachine.js +180 -0
  165. package/dist/plus/agents/stateMachine.js.map +1 -0
  166. package/dist/plus/agents/types.d.ts +203 -0
  167. package/dist/plus/agents/types.d.ts.map +1 -0
  168. package/dist/plus/agents/types.js +49 -0
  169. package/dist/plus/agents/types.js.map +1 -0
  170. package/dist/plus/ai/errors.d.ts +4 -1
  171. package/dist/plus/ai/errors.d.ts.map +1 -1
  172. package/dist/plus/ai/errors.js +38 -0
  173. package/dist/plus/ai/errors.js.map +1 -1
  174. package/dist/plus/ai/models/promptTemplates.d.ts +11 -2
  175. package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
  176. package/dist/plus/ai/prompts.d.ts +1 -0
  177. package/dist/plus/ai/prompts.d.ts.map +1 -1
  178. package/dist/plus/ai/prompts.js +48 -8
  179. package/dist/plus/ai/prompts.js.map +1 -1
  180. package/dist/plus/ai/utils/results.utils.d.ts.map +1 -1
  181. package/dist/plus/ai/utils/results.utils.js.map +1 -1
  182. package/dist/plus/git-github/api/github.d.ts +10 -1
  183. package/dist/plus/git-github/api/github.d.ts.map +1 -1
  184. package/dist/plus/git-github/api/github.js +156 -49
  185. package/dist/plus/git-github/api/github.js.map +1 -1
  186. package/dist/plus/git-github/api/types.d.ts +8 -0
  187. package/dist/plus/git-github/api/types.d.ts.map +1 -1
  188. package/dist/plus/git-github/models.d.ts +1 -1
  189. package/dist/plus/git-github/models.d.ts.map +1 -1
  190. package/dist/plus/git-github/models.js.map +1 -1
  191. package/dist/plus/git-github/providers/github/blame.d.ts.map +1 -1
  192. package/dist/plus/git-github/providers/github/blame.js.map +1 -1
  193. package/dist/plus/git-github/providers/github/branches.d.ts +5 -1
  194. package/dist/plus/git-github/providers/github/branches.d.ts.map +1 -1
  195. package/dist/plus/git-github/providers/github/branches.js +47 -24
  196. package/dist/plus/git-github/providers/github/branches.js.map +1 -1
  197. package/dist/plus/git-github/providers/github/commits.d.ts.map +1 -1
  198. package/dist/plus/git-github/providers/github/commits.js +144 -92
  199. package/dist/plus/git-github/providers/github/commits.js.map +1 -1
  200. package/dist/plus/git-github/providers/github/diff.d.ts +1 -1
  201. package/dist/plus/git-github/providers/github/diff.d.ts.map +1 -1
  202. package/dist/plus/git-github/providers/github/diff.js +23 -9
  203. package/dist/plus/git-github/providers/github/diff.js.map +1 -1
  204. package/dist/plus/git-github/providers/github/refs.d.ts +9 -1
  205. package/dist/plus/git-github/providers/github/refs.d.ts.map +1 -1
  206. package/dist/plus/git-github/providers/github/refs.js +38 -13
  207. package/dist/plus/git-github/providers/github/refs.js.map +1 -1
  208. package/dist/plus/git-github/providers/github/revision.d.ts.map +1 -1
  209. package/dist/plus/git-github/providers/github/revision.js +1 -2
  210. package/dist/plus/git-github/providers/github/revision.js.map +1 -1
  211. package/dist/plus/git-github/providers/github/status.d.ts +4 -1
  212. package/dist/plus/git-github/providers/github/status.d.ts.map +1 -1
  213. package/dist/plus/git-github/providers/github/status.js +1 -1
  214. package/dist/plus/git-github/providers/github/status.js.map +1 -1
  215. package/dist/plus/git-github/providers/github/tags.d.ts.map +1 -1
  216. package/dist/plus/git-github/providers/github/tags.js +35 -36
  217. package/dist/plus/git-github/providers/github/tags.js.map +1 -1
  218. package/dist/plus/git-github/providers/githubGitProvider.d.ts.map +1 -1
  219. package/dist/plus/git-github/providers/githubGitProvider.js.map +1 -1
  220. package/dist/utils/color.d.ts.map +1 -1
  221. package/dist/utils/color.js.map +1 -1
  222. package/dist/utils/decorators/serializable.d.ts.map +1 -1
  223. package/dist/utils/decorators/serializable.js.map +1 -1
  224. package/dist/utils/dedupedAsyncCache.d.ts +37 -0
  225. package/dist/utils/dedupedAsyncCache.d.ts.map +1 -0
  226. package/dist/utils/dedupedAsyncCache.js +68 -0
  227. package/dist/utils/dedupedAsyncCache.js.map +1 -0
  228. package/dist/utils/diff.d.ts +2 -0
  229. package/dist/utils/diff.d.ts.map +1 -0
  230. package/dist/utils/diff.js +53 -0
  231. package/dist/utils/diff.js.map +1 -0
  232. package/dist/utils/disposable.d.ts.map +1 -1
  233. package/dist/utils/disposable.js.map +1 -1
  234. package/dist/utils/env/node/exec.d.ts.map +1 -1
  235. package/dist/utils/env/node/exec.js.map +1 -1
  236. package/dist/utils/error.d.ts.map +1 -1
  237. package/dist/utils/error.js.map +1 -1
  238. package/dist/utils/iterable.d.ts.map +1 -1
  239. package/dist/utils/iterable.js.map +1 -1
  240. package/dist/utils/logger.d.ts.map +1 -1
  241. package/dist/utils/logger.js.map +1 -1
  242. package/dist/utils/lruMap.d.ts +9 -0
  243. package/dist/utils/lruMap.d.ts.map +1 -1
  244. package/dist/utils/lruMap.js +26 -4
  245. package/dist/utils/lruMap.js.map +1 -1
  246. package/dist/utils/markdown.d.ts.map +1 -1
  247. package/dist/utils/markdown.js.map +1 -1
  248. package/dist/utils/mru.d.ts.map +1 -1
  249. package/dist/utils/mru.js.map +1 -1
  250. package/dist/utils/path.d.ts.map +1 -1
  251. package/dist/utils/path.js.map +1 -1
  252. package/dist/utils/promise.d.ts +1 -0
  253. package/dist/utils/promise.d.ts.map +1 -1
  254. package/dist/utils/promise.js +17 -0
  255. package/dist/utils/promise.js.map +1 -1
  256. package/dist/utils/promiseCache.d.ts +10 -0
  257. package/dist/utils/promiseCache.d.ts.map +1 -1
  258. package/dist/utils/promiseCache.js +22 -0
  259. package/dist/utils/promiseCache.js.map +1 -1
  260. package/dist/utils/string.d.ts.map +1 -1
  261. package/dist/utils/string.js.map +1 -1
  262. package/dist/utils/uri.d.ts.map +1 -1
  263. package/dist/utils/uri.js.map +1 -1
  264. package/dist/utils/version.d.ts.map +1 -1
  265. package/dist/utils/version.js.map +1 -1
  266. package/package.json +13 -1
  267. package/src/git/cache.ts +142 -28
  268. package/src/git/models/commit.ts +1 -0
  269. package/src/git/models/reference.ts +33 -0
  270. package/src/git/models/remote.ts +1 -0
  271. package/src/git/models/repository.ts +21 -3
  272. package/src/git/models/search.ts +2 -2
  273. package/src/git/models/worktree.ts +10 -2
  274. package/src/git/parsers/diffParser.ts +2 -0
  275. package/src/git/providers/branches.ts +22 -4
  276. package/src/git/providers/config.ts +2 -0
  277. package/src/git/providers/operations.ts +44 -0
  278. package/src/git/providers/pausedOperations.ts +1 -0
  279. package/src/git/providers/refs.ts +32 -3
  280. package/src/git/providers/staging.ts +12 -0
  281. package/src/git/providers/status.ts +6 -1
  282. package/src/git/remotes/azure-devops.ts +2 -0
  283. package/src/git/{exec.types.ts → run.types.ts} +22 -2
  284. package/src/git/service.ts +1 -0
  285. package/src/git/utils/autolink.utils.ts +1 -0
  286. package/src/git/utils/blame.utils.ts +2 -0
  287. package/src/git/utils/conflictResolution.utils.ts +31 -0
  288. package/src/git/utils/fileStatus.utils.ts +7 -1
  289. package/src/git/utils/search.utils.ts +2 -0
  290. package/src/git/utils/sorting.ts +17 -0
  291. package/src/git/utils/status.utils.ts +1 -0
  292. package/src/git/watching/classifyChange.ts +9 -0
  293. package/src/git/watching/gitIgnoreFilter.ts +2 -2
  294. package/src/git/watching/initWatcher.ts +2 -0
  295. package/src/git/watching/watchGroup.ts +3 -0
  296. package/src/git/watching/watchService.ts +38 -5
  297. package/src/git/watching/watchSession.ts +10 -0
  298. package/src/git-cli/exec/exec.types.ts +2 -2
  299. package/src/git-cli/exec/git.ts +6 -5
  300. package/src/git-cli/exec/gitQueue.ts +41 -12
  301. package/src/git-cli/parsers/blameParser.ts +1 -0
  302. package/src/git-cli/parsers/logParser.ts +1 -0
  303. package/src/git-cli/parsers/refParser.ts +33 -34
  304. package/src/git-cli/providers/blame.ts +1 -0
  305. package/src/git-cli/providers/branches.ts +164 -93
  306. package/src/git-cli/providers/commits.ts +83 -37
  307. package/src/git-cli/providers/config.ts +41 -2
  308. package/src/git-cli/providers/diff.ts +8 -2
  309. package/src/git-cli/providers/graph.ts +11 -2
  310. package/src/git-cli/providers/operations.ts +186 -49
  311. package/src/git-cli/providers/patch.ts +1 -0
  312. package/src/git-cli/providers/pausedOperations.ts +8 -0
  313. package/src/git-cli/providers/refs.ts +247 -3
  314. package/src/git-cli/providers/revision.ts +2 -2
  315. package/src/git-cli/providers/staging.ts +33 -0
  316. package/src/git-cli/providers/status.ts +15 -4
  317. package/src/git-cli/providers/tags.ts +15 -16
  318. package/src/ipc/discovery.ts +56 -0
  319. package/src/ipc/ipcServer.ts +171 -0
  320. package/src/plus/agents/providers/claudeCodeProvider.ts +1782 -0
  321. package/src/plus/agents/providers/claudeCodeTranscript.ts +214 -0
  322. package/src/plus/agents/sanitizePrompt.ts +109 -0
  323. package/src/plus/agents/stateMachine.ts +197 -0
  324. package/src/plus/agents/types.ts +277 -0
  325. package/src/plus/ai/errors.ts +40 -0
  326. package/src/plus/ai/models/promptTemplates.ts +13 -0
  327. package/src/plus/ai/prompts.ts +49 -8
  328. package/src/plus/ai/utils/results.utils.ts +2 -0
  329. package/src/plus/git-github/api/github.ts +199 -53
  330. package/src/plus/git-github/api/types.ts +15 -0
  331. package/src/plus/git-github/models.ts +1 -1
  332. package/src/plus/git-github/providers/github/blame.ts +2 -0
  333. package/src/plus/git-github/providers/github/branches.ts +61 -31
  334. package/src/plus/git-github/providers/github/commits.ts +231 -160
  335. package/src/plus/git-github/providers/github/diff.ts +27 -19
  336. package/src/plus/git-github/providers/github/refs.ts +57 -22
  337. package/src/plus/git-github/providers/github/revision.ts +1 -2
  338. package/src/plus/git-github/providers/github/status.ts +6 -1
  339. package/src/plus/git-github/providers/github/tags.ts +61 -62
  340. package/src/plus/git-github/providers/githubGitProvider.ts +1 -0
  341. package/src/utils/color.ts +2 -0
  342. package/src/utils/decorators/serializable.ts +1 -0
  343. package/src/utils/dedupedAsyncCache.ts +74 -0
  344. package/src/utils/diff.ts +61 -0
  345. package/src/utils/disposable.ts +2 -0
  346. package/src/utils/env/node/exec.ts +2 -0
  347. package/src/utils/error.ts +1 -0
  348. package/src/utils/iterable.ts +3 -0
  349. package/src/utils/logger.ts +1 -0
  350. package/src/utils/lruMap.ts +29 -4
  351. package/src/utils/markdown.ts +1 -0
  352. package/src/utils/mru.ts +2 -0
  353. package/src/utils/path.ts +1 -0
  354. package/src/utils/promise.ts +22 -0
  355. package/src/utils/promiseCache.ts +24 -0
  356. package/src/utils/string.ts +2 -0
  357. package/src/utils/uri.ts +1 -0
  358. package/src/utils/version.ts +1 -0
  359. package/dist/git/exec.types.d.ts.map +0 -1
  360. package/dist/git/exec.types.js +0 -2
  361. package/dist/git/exec.types.js.map +0 -1
@@ -38,7 +38,16 @@ export interface WatchHandle {
38
38
  interface SessionRecord {
39
39
  readonly session: RepositoryWatchSession;
40
40
  readonly gitDir: GitDir;
41
- readonly watchHooks?: WatchHooks;
41
+ /**
42
+ * Hooks contributed by all current `watch()` callers for this repo path. Earlier
43
+ * implementations stored just the first caller's hooks (`WatchHooks | undefined`) and
44
+ * silently dropped subsequent callers' hooks — that broke the case where a low-level
45
+ * subscriber (e.g. the Graph's secondary-worktree WIP watcher) opened the session
46
+ * first without hooks, and a later `Repository.setupWatching` for the same path lost
47
+ * its `markFetched` / `onIgnoresChanged` wiring. Each `watch()` call adds its hooks
48
+ * to this set and removes them on dispose; fire sites iterate the set.
49
+ */
50
+ readonly watchHooks: Set<WatchHooks>;
42
51
  refCount: number;
43
52
  }
44
53
 
@@ -83,6 +92,7 @@ export class RepositoryWatchService implements UnifiedDisposable {
83
92
 
84
93
  dispose(): void {
85
94
  if (this._disposed) return;
95
+
86
96
  this._disposed = true;
87
97
 
88
98
  for (const record of this.sessionMap.values()) {
@@ -117,6 +127,9 @@ export class RepositoryWatchService implements UnifiedDisposable {
117
127
  let record = this.sessionMap.get(repoPath);
118
128
  if (record != null) {
119
129
  record.refCount++;
130
+ if (watchHooks != null) {
131
+ record.watchHooks.add(watchHooks);
132
+ }
120
133
  } else {
121
134
  const session = new RepositoryWatchSession({
122
135
  repoPath: repoPath,
@@ -150,10 +163,15 @@ export class RepositoryWatchService implements UnifiedDisposable {
150
163
  },
151
164
  });
152
165
 
166
+ const watchHooksSet = new Set<WatchHooks>();
167
+ if (watchHooks != null) {
168
+ watchHooksSet.add(watchHooks);
169
+ }
170
+
153
171
  record = {
154
172
  session: session,
155
173
  gitDir: gitDir,
156
- watchHooks: watchHooks,
174
+ watchHooks: watchHooksSet,
157
175
  refCount: 1,
158
176
  };
159
177
  this.sessionMap.set(repoPath, record);
@@ -166,12 +184,16 @@ export class RepositoryWatchService implements UnifiedDisposable {
166
184
  session: sessionRef,
167
185
  dispose: (): void => {
168
186
  if (handleDisposed) return;
187
+
169
188
  handleDisposed = true;
170
189
 
171
190
  const rec = this.sessionMap.get(repoPath);
172
191
  if (rec == null) return;
173
192
 
174
193
  rec.refCount--;
194
+ if (watchHooks != null) {
195
+ rec.watchHooks.delete(watchHooks);
196
+ }
175
197
  if (rec.refCount <= 0) {
176
198
  this.sessionMap.delete(repoPath);
177
199
  this.disposeSessionRecord(rec);
@@ -229,11 +251,18 @@ export class RepositoryWatchService implements UnifiedDisposable {
229
251
  session.pushRepoChanges(changes);
230
252
  },
231
253
  onFetchHeadChanged: function (repoPath: string): void {
232
- watchHooks?.onFetchHeadChanged?.(repoPath);
254
+ // Iterate at fire time so callers that joined after the group was wired up
255
+ // still receive events (e.g. a `Repository.setupWatching` whose hooks landed
256
+ // after a hookless `GitRepositoryService.watch` registered first).
257
+ for (const h of watchHooks) {
258
+ h.onFetchHeadChanged?.(repoPath);
259
+ }
233
260
  },
234
261
  onIgnoresChanged: (repoPath: string): void => {
235
262
  this.refreshWorkingTreeFilter(repoPath);
236
- watchHooks?.onIgnoresChanged?.(repoPath);
263
+ for (const h of watchHooks) {
264
+ h.onIgnoresChanged?.(repoPath);
265
+ }
237
266
  },
238
267
  };
239
268
 
@@ -293,7 +322,10 @@ export class RepositoryWatchService implements UnifiedDisposable {
293
322
  if (filter != null) {
294
323
  void filter.refresh();
295
324
  }
296
- watchHooks?.onGitIgnoreChanged?.(repoPath);
325
+ // See `connectToWatchGroup` for the iterate-at-fire-time rationale.
326
+ for (const h of watchHooks) {
327
+ h.onGitIgnoreChanged?.(repoPath);
328
+ }
297
329
  // Don't push .gitignore itself as a working tree change
298
330
  return;
299
331
  }
@@ -341,6 +373,7 @@ function filterWorkingTreePaths(absolutePaths: string[], repoPath: string, filte
341
373
  const result: string[] = [];
342
374
  for (const p of absolutePaths) {
343
375
  if (!isDescendant(p, repoPath)) continue;
376
+
344
377
  const relativePath = relative(repoPath, p);
345
378
  if (!filter.isIgnored(relativePath)) {
346
379
  result.push(p);
@@ -97,6 +97,7 @@ export class RepositoryWatchSession implements UnifiedDisposable {
97
97
 
98
98
  dispose(): void {
99
99
  if (this._disposed) return;
100
+
100
101
  this._disposed = true;
101
102
 
102
103
  this.cancelRepoTimer();
@@ -175,6 +176,7 @@ export class RepositoryWatchSession implements UnifiedDisposable {
175
176
  return Object.assign(
176
177
  createDisposable(() => {
177
178
  if (subDisposed) return;
179
+
178
180
  subDisposed = true;
179
181
 
180
182
  this.repoDelays.delete(id);
@@ -221,6 +223,7 @@ export class RepositoryWatchSession implements UnifiedDisposable {
221
223
  return Object.assign(
222
224
  createDisposable(() => {
223
225
  if (subDisposed) return;
226
+
224
227
  subDisposed = true;
225
228
 
226
229
  this.wtDelays.delete(id);
@@ -245,6 +248,7 @@ export class RepositoryWatchSession implements UnifiedDisposable {
245
248
 
246
249
  resume(delayMs?: number): void {
247
250
  if (!this._suspended) return;
251
+
248
252
  this._suspended = false;
249
253
 
250
254
  // Flush accumulated changes
@@ -259,30 +263,35 @@ export class RepositoryWatchSession implements UnifiedDisposable {
259
263
  /** Inject changes (e.g., after a git operation the caller performed). Goes through debounce + suspend. */
260
264
  fireChange(...changes: RepositoryChange[]): void {
261
265
  if (this._disposed || changes.length === 0) return;
266
+
262
267
  this.coalesceRepo(changes);
263
268
  }
264
269
 
265
270
  /** Immediate fire, bypassing debounce + suspend (for Closed/Opened). */
266
271
  fireChangeImmediate(...changes: RepositoryChange[]): void {
267
272
  if (this._disposed || changes.length === 0) return;
273
+
268
274
  this.repoEmitter.fire(new WatcherRepoChangeEvent(this.repoPath, changes));
269
275
  }
270
276
 
271
277
  /** Push interpreted repo changes into the pipeline */
272
278
  pushRepoChanges(changes: RepositoryChange[]): void {
273
279
  if (this._disposed) return;
280
+
274
281
  this.coalesceRepo(changes);
275
282
  }
276
283
 
277
284
  /** Push working tree file changes into the pipeline */
278
285
  pushWorkingTreeChanges(paths: Iterable<string>): void {
279
286
  if (this._disposed) return;
287
+
280
288
  this._etagWorkingTree++;
281
289
  this.coalesceWT(paths);
282
290
  }
283
291
 
284
292
  private static minDelay(delays: Map<number, number>, fallback: number): number {
285
293
  if (delays.size === 0) return fallback;
294
+
286
295
  let min = fallback;
287
296
  for (const d of delays.values()) {
288
297
  if (d < min) {
@@ -304,6 +313,7 @@ export class RepositoryWatchSession implements UnifiedDisposable {
304
313
  this.repoTimer = undefined;
305
314
  const event = this.pendingRepoEvent;
306
315
  if (event == null) return;
316
+
307
317
  this.pendingRepoEvent = undefined;
308
318
  this.repoEmitter.fire(event);
309
319
  this.onDidFireRepoChangeCallback?.(event);
@@ -1,8 +1,8 @@
1
1
  export type {
2
2
  GitCommandPriority,
3
3
  GitErrorHandling,
4
- GitExecOptions,
4
+ GitRunOptions,
5
5
  GitResult,
6
6
  GitResultCache,
7
7
  GitSpawnOptions,
8
- } from '../../git/exec.types.js';
8
+ } from '../../git/run.types.js';
@@ -39,7 +39,7 @@ import { compare, fromString } from '../../utils/version.js';
39
39
  import { CancelledRunError, RunError } from './exec.errors.js';
40
40
  import type { RunOptions, RunResult } from './exec.js';
41
41
  import { fsExists, runSpawn } from './exec.js';
42
- import type { GitCommandPriority, GitExecOptions, GitResult, GitSpawnOptions } from './exec.types.js';
42
+ import type { GitCommandPriority, GitResult, GitRunOptions, GitSpawnOptions } from './exec.types.js';
43
43
  import type { FilteredGitFeatures, GitFeatureOrPrefix, GitFeatures } from './features.js';
44
44
  import { gitFeaturesByVersion } from './features.js';
45
45
  import type { GitQueueConfig } from './gitQueue.js';
@@ -508,7 +508,7 @@ const trailingNewlineRegex = /[\r|\n]+$/;
508
508
  const uniqueCounterForStdin = getScopedCounter();
509
509
  const uniqueCounterForStream = getScopedCounter();
510
510
 
511
- type ExitCodeOnlyGitCommandOptions = GitExecOptions & { exitCodeOnly: true };
511
+ type ExitCodeOnlyGitCommandOptions = GitRunOptions & { exitCodeOnly: true };
512
512
 
513
513
  export class Git {
514
514
  /** Map of running git commands — avoids running duplicate overlapping commands */
@@ -636,11 +636,11 @@ export class Git {
636
636
  ...args: readonly (string | undefined)[]
637
637
  ): Promise<GitResult<unknown>>;
638
638
  async run<T extends string | Buffer = string>(
639
- options: GitExecOptions,
639
+ options: GitRunOptions,
640
640
  ...args: readonly (string | undefined)[]
641
641
  ): Promise<GitResult<T>>;
642
642
  async run<T extends string | Buffer = string>(
643
- options: GitExecOptions,
643
+ options: GitRunOptions,
644
644
  ...args: readonly (string | undefined)[]
645
645
  ): Promise<GitResult<T | unknown>> {
646
646
  if (this.options.isTrusted?.() === false) throw new WorkspaceUntrustedError();
@@ -668,7 +668,7 @@ export class Git {
668
668
  }
669
669
 
670
670
  private async runCore<T extends string | Buffer>(
671
- options: GitExecOptions,
671
+ options: GitRunOptions,
672
672
  args: string[],
673
673
  gitCommand: string,
674
674
  ): Promise<GitResult<T | unknown>> {
@@ -906,6 +906,7 @@ export class Git {
906
906
  let cleanedUp = false;
907
907
  const cleanup = () => {
908
908
  if (cleanedUp) return;
909
+
909
910
  cleanedUp = true;
910
911
 
911
912
  try {
@@ -261,33 +261,62 @@ export class GitQueue {
261
261
  }
262
262
 
263
263
  /**
264
- * Infers priority from git command type.
265
- * Only downgrades to 'background' for expensive commands; never upgrades to 'interactive'.
264
+ * Git global options that consume the next positional arg as their value
265
+ * (e.g. `--work-tree <path>`). Long-form `--name=value` is already skipped by
266
+ * the leading-dash check, so only the separated form needs explicit handling.
267
+ */
268
+ const optionsTakingValue = new Set([
269
+ '-c',
270
+ '-C',
271
+ '--git-dir',
272
+ '--work-tree',
273
+ '--namespace',
274
+ '--exec-path',
275
+ '--super-prefix',
276
+ '--config-env',
277
+ '--attr-source',
278
+ '--list-cmds',
279
+ ]);
280
+
281
+ /**
282
+ * Infers a queue priority from the git command being invoked.
283
+ *
284
+ * Intentionally narrow: only returns 'background' for commands that are
285
+ * *always* read-only AND *always* potentially expensive. Polymorphic commands
286
+ * like `log` and `rev-list` (which can be quick bounded lookups or full-history
287
+ * walks) are deliberately omitted — call sites that perform heavy walks must
288
+ * pass `priority: 'background'` explicitly. Never upgrades to 'interactive'.
289
+ *
290
+ * No subcommand awareness (e.g. `stash list`, `branch -l`): the risk of
291
+ * misclassifying a write subcommand as background outweighs the gain.
266
292
  */
267
293
  export function inferGitCommandPriority(args: readonly (string | undefined)[]): GitCommandPriority {
268
- let skip = false;
269
294
  let command: string | undefined;
270
- for (const a of args) {
295
+ for (let i = 0; i < args.length; i++) {
296
+ const a = args[i];
271
297
  if (a == null) continue;
272
- if (skip) {
273
- skip = false;
274
- continue;
275
- }
276
- if (a === '-c' || a === '-C') {
277
- skip = true;
298
+ if (optionsTakingValue.has(a)) {
299
+ const next = args[i + 1];
300
+ if (next != null && !next.startsWith('-')) {
301
+ i++;
302
+ }
278
303
  continue;
279
304
  }
280
305
  if (a.startsWith('-')) continue;
306
+
281
307
  command = a;
282
308
  break;
283
309
  }
284
310
 
285
311
  switch (command) {
286
- case 'log':
287
- case 'rev-list':
288
312
  case 'for-each-ref':
289
313
  case 'shortlog':
290
314
  case 'reflog':
315
+ case 'name-rev':
316
+ case 'describe':
317
+ case 'cherry':
318
+ case 'count-objects':
319
+ case 'fsck':
291
320
  return 'background';
292
321
  default:
293
322
  return 'normal';
@@ -342,6 +342,7 @@ export async function* parseGitBlameAsync(stream: AsyncIterable<string>): AsyncG
342
342
  case 0x66 /* f — filename */:
343
343
  entry.path = line.substring(valueStart);
344
344
  yield entry;
345
+
345
346
  entry = undefined;
346
347
  break;
347
348
 
@@ -420,6 +420,7 @@ function createLogParserWithFilesAndStats<T extends Record<string, string> | voi
420
420
 
421
421
  endIndex = line.indexOf(' ', startIndex);
422
422
  if (endIndex === -1) continue;
423
+
423
424
  const newMode = line.substring(startIndex, endIndex);
424
425
 
425
426
  // Parse old_sha and new_sha positions
@@ -1,52 +1,51 @@
1
1
  import type { FilteredGitFeatures } from '../../git/features.js';
2
+ import type { RefRecord } from '../../git/models/reference.js';
2
3
  import { maybeStopWatch } from '../../utils/stopwatch.js';
3
4
  import { iterateByDelimiter } from '../../utils/string.js';
4
5
  import type { ExtractAll } from '../../utils/types.js';
5
6
  import type { Parser } from './logParser.js';
6
7
 
7
- const branchMapping = {
8
- current: `%(HEAD)`, // HEAD indicator (current branch)
9
- name: `%(refname)`, // Full reference name
10
- upstream: `%(upstream)`, // Upstream branch, if any
11
- upstreamTracking: `%(upstream:track)`, // Tracking status
12
- sha: `%(objectname)`, // SHA
13
- date: `%(committerdate:iso8601)`, // Date
8
+ /**
9
+ * Unified `for-each-ref` mapping covering branches, remotes, and tags in a single pass.
10
+ * Fields inapplicable to a given ref-type come back as empty strings from git.
11
+ *
12
+ * NOTE: When adding a new field that is gated on a git feature flag, mirror the entry in
13
+ * `refMappingSupportsWorktreePath` (and any future variants) both maps MUST stay aligned
14
+ * so callers can switch parsers based on `git.supported('git:for-each-ref')` without losing
15
+ * field positions.
16
+ */
17
+ const refMapping = {
18
+ current: `%(HEAD)`,
19
+ name: `%(refname)`,
20
+ objectname: `%(objectname)`,
21
+ peeledObjectname: `%(*objectname)`,
22
+ upstream: `%(upstream)`,
23
+ upstreamTracking: `%(upstream:track)`,
24
+ committerDate: `%(committerdate:iso8601)`,
25
+ creatorDate: `%(creatordate:iso8601)`,
26
+ authorDate: `%(authordate:iso8601)`,
27
+ subject: `%(subject)`,
14
28
  worktreePath: undefined,
15
29
  };
16
30
 
17
- const branchMappingSupportsWorktreePath = {
18
- ...branchMapping,
19
- worktreePath: '%(worktreepath)', // Worktree path
31
+ const refMappingSupportsWorktreePath = {
32
+ ...refMapping,
33
+ worktreePath: '%(worktreepath)',
20
34
  };
21
35
 
22
- type BranchParser = Parser<typeof branchMapping> | Parser<typeof branchMappingSupportsWorktreePath>;
36
+ type RefParser = Parser<RefRecord>;
23
37
 
24
- let _branchParser: BranchParser | undefined;
25
- let _branchParserWithWorktree: BranchParser | undefined;
26
- export function getBranchParser(supportedFeatures: FilteredGitFeatures<'git:for-each-ref'>[]): BranchParser {
38
+ let _refParser: RefParser | undefined;
39
+ let _refParserWithWorktree: RefParser | undefined;
40
+
41
+ export function getRefParser(supportedFeatures: FilteredGitFeatures<'git:for-each-ref'>[]): RefParser {
27
42
  if (supportedFeatures.includes('git:for-each-ref:worktreePath')) {
28
- _branchParserWithWorktree ??= createRefParser(branchMappingSupportsWorktreePath);
29
- return _branchParserWithWorktree;
43
+ _refParserWithWorktree ??= createRefParser(refMappingSupportsWorktreePath);
44
+ return _refParserWithWorktree;
30
45
  }
31
- _branchParser ??= createRefParser(branchMapping);
32
- return _branchParser;
33
- }
34
-
35
- const tagMapping = {
36
- name: `%(refname)`, // Full reference name
37
- tagSha: `%(objectname)`, // sha of the tag
38
- sha: `%(*objectname)`, // sha of the commit the tag points to, if any
39
- date: `%(creatordate:iso8601)`, // date the tag was created
40
- commitDate: `%(authordate:iso8601)`, // author date of the commit the tag points to
41
- message: `%(subject)`, // message
42
- };
43
-
44
- type TagParser = Parser<typeof tagMapping>;
45
- let _tagParser: TagParser | undefined;
46
46
 
47
- export function getTagParser(): TagParser {
48
- _tagParser ??= createRefParser(tagMapping);
49
- return _tagParser;
47
+ _refParser ??= createRefParser(refMapping);
48
+ return _refParser;
50
49
  }
51
50
 
52
51
  const recordSep = '\x1E'; // ASCII Record Separator character
@@ -234,6 +234,7 @@ export class BlameGitSubProvider implements GitBlameSubProvider {
234
234
  let blameLine = blame.lines[editorLine];
235
235
  if (blameLine == null) {
236
236
  if (blame.lines.length !== editorLine) return undefined;
237
+
237
238
  blameLine = blame.lines[editorLine - 1];
238
239
  }
239
240