@deepseek-ai/dsh-experimental-client-ui-forge 0.2.3-alpha.2 → 0.2.3-alpha.4

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 (350) hide show
  1. package/README.i18n.yaml +10 -10
  2. package/README.md +37 -19
  3. package/README.zh.md +37 -19
  4. package/lib/client.js +22 -17
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +941 -188
  7. package/lib/typert.host.js +894 -175
  8. package/lib/typert.remote-client.d.ts +35 -17
  9. package/lib/typert.remote-client.d.ts.map +1 -1
  10. package/lib/typert.remote-client.js +751 -146
  11. package/lib/types/client/ActionToast.d.ts +1 -1
  12. package/lib/types/client/ActionToast.d.ts.map +1 -1
  13. package/lib/types/client/ActionToast.js.map +1 -1
  14. package/lib/types/client/BaseMenu.d.ts +6 -4
  15. package/lib/types/client/BaseMenu.d.ts.map +1 -1
  16. package/lib/types/client/BaseMenu.js.map +1 -1
  17. package/lib/types/client/BranchPicker.d.ts +84 -0
  18. package/lib/types/client/BranchPicker.d.ts.map +1 -0
  19. package/lib/types/client/BranchPicker.js.map +1 -0
  20. package/lib/types/client/ChangeRequestCard.d.ts +31 -13
  21. package/lib/types/client/ChangeRequestCard.d.ts.map +1 -1
  22. package/lib/types/client/ChangeRequestCard.js.map +1 -1
  23. package/lib/types/client/ChangeRequestOverview.d.ts +28 -6
  24. package/lib/types/client/ChangeRequestOverview.d.ts.map +1 -1
  25. package/lib/types/client/ChangeRequestOverview.js.map +1 -1
  26. package/lib/types/client/ChangeRequestsSection.d.ts +5 -3
  27. package/lib/types/client/ChangeRequestsSection.d.ts.map +1 -1
  28. package/lib/types/client/ChangeRequestsSection.js.map +1 -1
  29. package/lib/types/client/ChangeStatus.d.ts +41 -0
  30. package/lib/types/client/ChangeStatus.d.ts.map +1 -0
  31. package/lib/types/client/ChangeStatus.js.map +1 -0
  32. package/lib/types/client/ChangedFiles.d.ts +1 -1
  33. package/lib/types/client/ChangedFiles.d.ts.map +1 -1
  34. package/lib/types/client/ChangedFiles.js.map +1 -1
  35. package/lib/types/client/ChangesLoading.d.ts +1 -1
  36. package/lib/types/client/ChangesLoading.d.ts.map +1 -1
  37. package/lib/types/client/ChangesTab.d.ts +35 -12
  38. package/lib/types/client/ChangesTab.d.ts.map +1 -1
  39. package/lib/types/client/ChangesTab.js.map +1 -1
  40. package/lib/types/client/ChangesTabTitle.d.ts +1 -1
  41. package/lib/types/client/ChangesTabTitle.d.ts.map +1 -1
  42. package/lib/types/client/ChangesTabTitle.js.map +1 -1
  43. package/lib/types/client/CommitMenu.d.ts +11 -8
  44. package/lib/types/client/CommitMenu.d.ts.map +1 -1
  45. package/lib/types/client/CommitMenu.js.map +1 -1
  46. package/lib/types/client/CopyCommandButton.d.ts +19 -0
  47. package/lib/types/client/CopyCommandButton.d.ts.map +1 -0
  48. package/lib/types/client/CopyCommandButton.js.map +1 -0
  49. package/lib/types/client/DiffFile.d.ts +36 -5
  50. package/lib/types/client/DiffFile.d.ts.map +1 -1
  51. package/lib/types/client/DiffFile.js.map +1 -1
  52. package/lib/types/client/EnvironmentRows.d.ts +6 -6
  53. package/lib/types/client/EnvironmentRows.d.ts.map +1 -1
  54. package/lib/types/client/EnvironmentRows.js.map +1 -1
  55. package/lib/types/client/FileLabel.d.ts +5 -5
  56. package/lib/types/client/FileLabel.d.ts.map +1 -1
  57. package/lib/types/client/FileLabel.js.map +1 -1
  58. package/lib/types/client/HeadMenu.d.ts +35 -0
  59. package/lib/types/client/HeadMenu.d.ts.map +1 -0
  60. package/lib/types/client/HeadMenu.js.map +1 -0
  61. package/lib/types/client/HostSettings.d.ts +33 -0
  62. package/lib/types/client/HostSettings.d.ts.map +1 -0
  63. package/lib/types/client/HostSettings.js.map +1 -0
  64. package/lib/types/client/LensFilter.d.ts +2 -2
  65. package/lib/types/client/LensFilter.d.ts.map +1 -1
  66. package/lib/types/client/LensFilter.js.map +1 -1
  67. package/lib/types/client/ReasonButton.js.map +1 -1
  68. package/lib/types/client/RefreshGlyph.js.map +1 -1
  69. package/lib/types/client/ReviewComposer.d.ts +1 -1
  70. package/lib/types/client/ReviewComposer.d.ts.map +1 -1
  71. package/lib/types/client/ReviewComposer.js.map +1 -1
  72. package/lib/types/client/ReviewControls.d.ts +1 -1
  73. package/lib/types/client/ReviewControls.d.ts.map +1 -1
  74. package/lib/types/client/ReviewControls.js.map +1 -1
  75. package/lib/types/client/ReviewThread.d.ts +1 -1
  76. package/lib/types/client/ReviewThread.d.ts.map +1 -1
  77. package/lib/types/client/ReviewThread.js.map +1 -1
  78. package/lib/types/client/ReviewThreads.d.ts +21 -4
  79. package/lib/types/client/ReviewThreads.d.ts.map +1 -1
  80. package/lib/types/client/ReviewThreads.js.map +1 -1
  81. package/lib/types/client/SessionHoverForge.d.ts +1 -1
  82. package/lib/types/client/SessionHoverForge.d.ts.map +1 -1
  83. package/lib/types/client/SessionHoverForge.js.map +1 -1
  84. package/lib/types/client/SessionRowForge.d.ts +1 -1
  85. package/lib/types/client/SessionRowForge.d.ts.map +1 -1
  86. package/lib/types/client/SessionRowForge.js.map +1 -1
  87. package/lib/types/client/SubmitReview.d.ts +1 -1
  88. package/lib/types/client/SubmitReview.d.ts.map +1 -1
  89. package/lib/types/client/SubmitReview.js.map +1 -1
  90. package/lib/types/client/ThreadList.d.ts +3 -1
  91. package/lib/types/client/ThreadList.d.ts.map +1 -1
  92. package/lib/types/client/ThreadList.js.map +1 -1
  93. package/lib/types/client/ViewOptionsMenu.d.ts +1 -1
  94. package/lib/types/client/ViewOptionsMenu.d.ts.map +1 -1
  95. package/lib/types/client/ViewOptionsMenu.js.map +1 -1
  96. package/lib/types/client/WorktreeNameDialog.d.ts +1 -1
  97. package/lib/types/client/WorktreeNameDialog.d.ts.map +1 -1
  98. package/lib/types/client/WorktreeNameDialog.js.map +1 -1
  99. package/lib/types/client/WorktreeProgress.d.ts +1 -1
  100. package/lib/types/client/WorktreeProgress.d.ts.map +1 -1
  101. package/lib/types/client/WorktreeProgress.js.map +1 -1
  102. package/lib/types/client/WorktreeSettings.d.ts +1 -1
  103. package/lib/types/client/WorktreeSettings.d.ts.map +1 -1
  104. package/lib/types/client/WorktreeSettings.js.map +1 -1
  105. package/lib/types/client/WorktreeToggle.d.ts +1 -1
  106. package/lib/types/client/WorktreeToggle.d.ts.map +1 -1
  107. package/lib/types/client/WorktreeToggle.js.map +1 -1
  108. package/lib/types/client/annotations.d.ts +1 -1
  109. package/lib/types/client/annotations.d.ts.map +1 -1
  110. package/lib/types/client/branch-search.d.ts +1 -1
  111. package/lib/types/client/branch-search.d.ts.map +1 -1
  112. package/lib/types/client/branch-search.js.map +1 -1
  113. package/lib/types/client/changes-address.d.ts +1 -1
  114. package/lib/types/client/changes-address.d.ts.map +1 -1
  115. package/lib/types/client/changes-service.d.ts +1 -1
  116. package/lib/types/client/changes-service.d.ts.map +1 -1
  117. package/lib/types/client/changes-store.d.ts +25 -6
  118. package/lib/types/client/changes-store.d.ts.map +1 -1
  119. package/lib/types/client/changes-store.js.map +1 -1
  120. package/lib/types/client/checkout.d.ts +1 -1
  121. package/lib/types/client/checkout.d.ts.map +1 -1
  122. package/lib/types/client/code-selection.d.ts.map +1 -1
  123. package/lib/types/client/code-selection.js.map +1 -1
  124. package/lib/types/client/forge-copy.d.ts +8 -1
  125. package/lib/types/client/forge-copy.d.ts.map +1 -1
  126. package/lib/types/client/forge-copy.js.map +1 -1
  127. package/lib/types/client/format.d.ts +1 -1
  128. package/lib/types/client/format.d.ts.map +1 -1
  129. package/lib/types/client/format.js.map +1 -1
  130. package/lib/types/client/glyphs.d.ts +36 -1
  131. package/lib/types/client/glyphs.d.ts.map +1 -1
  132. package/lib/types/client/glyphs.js.map +1 -1
  133. package/lib/types/client/highlight-context.d.ts +1 -1
  134. package/lib/types/client/highlight-context.d.ts.map +1 -1
  135. package/lib/types/client/host-settings-form.d.ts +69 -0
  136. package/lib/types/client/host-settings-form.d.ts.map +1 -0
  137. package/lib/types/client/host-settings-form.js.map +1 -0
  138. package/lib/types/client/host-sign-in.d.ts +31 -0
  139. package/lib/types/client/host-sign-in.d.ts.map +1 -0
  140. package/lib/types/client/host-sign-in.js.map +1 -0
  141. package/lib/types/client/index.d.ts +1 -2
  142. package/lib/types/client/index.d.ts.map +1 -1
  143. package/lib/types/client/index.js.map +1 -1
  144. package/lib/types/client/local-writes.d.ts +47 -0
  145. package/lib/types/client/local-writes.d.ts.map +1 -0
  146. package/lib/types/client/local-writes.js.map +1 -0
  147. package/lib/types/client/locales.d.ts +111 -13
  148. package/lib/types/client/locales.d.ts.map +1 -1
  149. package/lib/types/client/locales.js.map +1 -1
  150. package/lib/types/client/minute-clock.d.ts +7 -0
  151. package/lib/types/client/minute-clock.d.ts.map +1 -0
  152. package/lib/types/client/minute-clock.js.map +1 -0
  153. package/lib/types/client/mount.d.ts +15 -1
  154. package/lib/types/client/mount.d.ts.map +1 -1
  155. package/lib/types/client/mount.js.map +1 -1
  156. package/lib/types/client/review-page/ReviewActivity.d.ts +44 -0
  157. package/lib/types/client/review-page/ReviewActivity.d.ts.map +1 -0
  158. package/lib/types/client/review-page/ReviewActivity.js.map +1 -0
  159. package/lib/types/client/review-page/ReviewChat.d.ts +1 -1
  160. package/lib/types/client/review-page/ReviewChat.d.ts.map +1 -1
  161. package/lib/types/client/review-page/ReviewChat.js.map +1 -1
  162. package/lib/types/client/review-page/ReviewDetail.d.ts +26 -9
  163. package/lib/types/client/review-page/ReviewDetail.d.ts.map +1 -1
  164. package/lib/types/client/review-page/ReviewDetail.js.map +1 -1
  165. package/lib/types/client/review-page/ReviewLabels.d.ts +1 -1
  166. package/lib/types/client/review-page/ReviewLabels.d.ts.map +1 -1
  167. package/lib/types/client/review-page/ReviewLabels.js.map +1 -1
  168. package/lib/types/client/review-page/ReviewList.d.ts +10 -8
  169. package/lib/types/client/review-page/ReviewList.d.ts.map +1 -1
  170. package/lib/types/client/review-page/ReviewList.js.map +1 -1
  171. package/lib/types/client/review-page/ReviewNav.d.ts +1 -1
  172. package/lib/types/client/review-page/ReviewNav.d.ts.map +1 -1
  173. package/lib/types/client/review-page/ReviewPage.d.ts +17 -14
  174. package/lib/types/client/review-page/ReviewPage.d.ts.map +1 -1
  175. package/lib/types/client/review-page/ReviewPage.js.map +1 -1
  176. package/lib/types/client/review-page/ReviewSkeleton.d.ts +26 -0
  177. package/lib/types/client/review-page/ReviewSkeleton.d.ts.map +1 -0
  178. package/lib/types/client/review-page/ReviewSkeleton.js.map +1 -0
  179. package/lib/types/client/review-page/ReviewStatus.d.ts +19 -13
  180. package/lib/types/client/review-page/ReviewStatus.d.ts.map +1 -1
  181. package/lib/types/client/review-page/ReviewStatus.js.map +1 -1
  182. package/lib/types/client/review-page/review-activity.d.ts +37 -0
  183. package/lib/types/client/review-page/review-activity.d.ts.map +1 -0
  184. package/lib/types/client/review-page/review-activity.js.map +1 -0
  185. package/lib/types/client/review-page/review-lists.d.ts +48 -13
  186. package/lib/types/client/review-page/review-lists.d.ts.map +1 -1
  187. package/lib/types/client/review-page/review-lists.js.map +1 -1
  188. package/lib/types/client/review-page/review-mount.d.ts +3 -1
  189. package/lib/types/client/review-page/review-mount.d.ts.map +1 -1
  190. package/lib/types/client/review-page/review-mount.js.map +1 -1
  191. package/lib/types/client/review-page/review-store.d.ts +19 -9
  192. package/lib/types/client/review-page/review-store.d.ts.map +1 -1
  193. package/lib/types/client/review-page/review-store.js.map +1 -1
  194. package/lib/types/client/review-queue.d.ts +1 -1
  195. package/lib/types/client/review-queue.d.ts.map +1 -1
  196. package/lib/types/client/review-queue.js.map +1 -1
  197. package/lib/types/client/review-threads.d.ts +15 -8
  198. package/lib/types/client/review-threads.d.ts.map +1 -1
  199. package/lib/types/client/review-threads.js.map +1 -1
  200. package/lib/types/client/review.d.ts +12 -1
  201. package/lib/types/client/review.d.ts.map +1 -1
  202. package/lib/types/client/review.js.map +1 -1
  203. package/lib/types/client/row-form-labels.d.ts +12 -0
  204. package/lib/types/client/row-form-labels.d.ts.map +1 -0
  205. package/lib/types/client/row-form-labels.js.map +1 -0
  206. package/lib/types/client/session-list.d.ts +1 -1
  207. package/lib/types/client/session-list.d.ts.map +1 -1
  208. package/lib/types/client/slots.d.ts +1 -1
  209. package/lib/types/client/slots.d.ts.map +1 -1
  210. package/lib/types/client/source.d.ts +1 -1
  211. package/lib/types/client/source.d.ts.map +1 -1
  212. package/lib/types/client/status.d.ts +7 -6
  213. package/lib/types/client/status.d.ts.map +1 -1
  214. package/lib/types/client/status.js.map +1 -1
  215. package/lib/types/client/thread-state.d.ts +2 -2
  216. package/lib/types/client/thread-state.d.ts.map +1 -1
  217. package/lib/types/client/thread-state.js.map +1 -1
  218. package/lib/types/client/toolbar-fold.d.ts +16 -6
  219. package/lib/types/client/toolbar-fold.d.ts.map +1 -1
  220. package/lib/types/client/toolbar-fold.js.map +1 -1
  221. package/lib/types/client/worktree-settings-form.d.ts +1 -1
  222. package/lib/types/client/worktree-settings-form.d.ts.map +1 -1
  223. package/lib/types/client/worktree-settings-form.js.map +1 -1
  224. package/lib/types/diff.d.ts.map +1 -1
  225. package/lib/types/diff.js.map +1 -1
  226. package/lib/types/git.d.ts +22 -0
  227. package/lib/types/git.d.ts.map +1 -1
  228. package/lib/types/git.js.map +1 -1
  229. package/lib/types/index.d.ts +137 -36
  230. package/lib/types/index.d.ts.map +1 -1
  231. package/lib/types/index.js.map +1 -1
  232. package/lib/types/local-diff.d.ts +81 -23
  233. package/lib/types/local-diff.d.ts.map +1 -1
  234. package/lib/types/local-diff.js.map +1 -1
  235. package/lib/types/local-write.d.ts +44 -0
  236. package/lib/types/local-write.d.ts.map +1 -0
  237. package/lib/types/local-write.js.map +1 -0
  238. package/lib/types/panel.js.map +1 -1
  239. package/lib/types/parse.d.ts +12 -3
  240. package/lib/types/parse.d.ts.map +1 -1
  241. package/lib/types/parse.js.map +1 -1
  242. package/lib/types/restore.d.ts +12 -0
  243. package/lib/types/restore.d.ts.map +1 -0
  244. package/lib/types/restore.js.map +1 -0
  245. package/lib/types/types.d.ts +128 -13
  246. package/lib/types/types.d.ts.map +1 -1
  247. package/lib/types/viewer-lists.d.ts +22 -13
  248. package/lib/types/viewer-lists.d.ts.map +1 -1
  249. package/lib/types/viewer-lists.js.map +1 -1
  250. package/lib/types/worktree.js.map +1 -1
  251. package/package.json +62 -58
  252. package/src/client/ActionToast.tsx +2 -2
  253. package/src/client/BaseMenu.module.css +15 -3
  254. package/src/client/BaseMenu.tsx +25 -88
  255. package/src/client/BranchPicker.tsx +170 -0
  256. package/src/client/ChangeRequestCard.tsx +194 -70
  257. package/src/client/ChangeRequestOverview.tsx +194 -82
  258. package/src/client/ChangeRequestsSection.tsx +45 -14
  259. package/src/client/ChangeStatus.module.css +70 -0
  260. package/src/client/ChangeStatus.tsx +104 -0
  261. package/src/client/ChangedFiles.tsx +22 -9
  262. package/src/client/ChangesLoading.tsx +1 -1
  263. package/src/client/ChangesTab.module.css +181 -33
  264. package/src/client/ChangesTab.tsx +499 -183
  265. package/src/client/ChangesTabTitle.tsx +2 -2
  266. package/src/client/CommitMenu.tsx +83 -42
  267. package/src/client/CopyCommandButton.tsx +25 -0
  268. package/src/client/DiffFile.tsx +147 -29
  269. package/src/client/EnvironmentRows.tsx +34 -28
  270. package/src/client/FileLabel.module.css +16 -18
  271. package/src/client/FileLabel.tsx +16 -32
  272. package/src/client/Forge.module.css +26 -6
  273. package/src/client/HeadMenu.tsx +69 -0
  274. package/src/client/HostSettings.module.css +194 -0
  275. package/src/client/HostSettings.tsx +194 -0
  276. package/src/client/LensFilter.tsx +13 -11
  277. package/src/client/ReasonButton.tsx +1 -1
  278. package/src/client/RefreshGlyph.tsx +1 -1
  279. package/src/client/ReviewComposer.tsx +31 -19
  280. package/src/client/ReviewControls.tsx +18 -9
  281. package/src/client/ReviewThread.tsx +65 -23
  282. package/src/client/ReviewThreads.tsx +133 -38
  283. package/src/client/SessionHoverForge.tsx +2 -2
  284. package/src/client/SessionRowForge.tsx +2 -2
  285. package/src/client/SubmitReview.tsx +7 -5
  286. package/src/client/ThreadList.module.css +4 -3
  287. package/src/client/ThreadList.tsx +11 -8
  288. package/src/client/ViewOptionsMenu.tsx +12 -10
  289. package/src/client/WorktreeNameDialog.tsx +17 -13
  290. package/src/client/WorktreeProgress.tsx +13 -11
  291. package/src/client/WorktreeSettings.tsx +8 -14
  292. package/src/client/WorktreeToggle.tsx +67 -37
  293. package/src/client/annotations.ts +1 -1
  294. package/src/client/branch-search.tsx +2 -2
  295. package/src/client/changes-address.ts +1 -1
  296. package/src/client/changes-service.ts +1 -1
  297. package/src/client/changes-store.ts +57 -10
  298. package/src/client/checkout.ts +1 -1
  299. package/src/client/code-selection.ts +3 -1
  300. package/src/client/forge-copy.ts +11 -1
  301. package/src/client/format.ts +2 -2
  302. package/src/client/glyphs.tsx +72 -5
  303. package/src/client/highlight-context.ts +1 -1
  304. package/src/client/host-settings-form.ts +115 -0
  305. package/src/client/host-sign-in.ts +46 -0
  306. package/src/client/index.ts +1 -2
  307. package/src/client/local-writes.ts +129 -0
  308. package/src/client/locales.ts +881 -97
  309. package/src/client/minute-clock.ts +19 -0
  310. package/src/client/mount.ts +121 -57
  311. package/src/client/review-page/ReviewActivity.tsx +406 -0
  312. package/src/client/review-page/ReviewChat.tsx +48 -19
  313. package/src/client/review-page/ReviewDetail.tsx +246 -78
  314. package/src/client/review-page/ReviewLabels.tsx +2 -2
  315. package/src/client/review-page/ReviewList.tsx +173 -151
  316. package/src/client/review-page/ReviewNav.tsx +1 -1
  317. package/src/client/review-page/ReviewPage.module.css +571 -23
  318. package/src/client/review-page/ReviewPage.tsx +84 -53
  319. package/src/client/review-page/ReviewSkeleton.tsx +108 -0
  320. package/src/client/review-page/ReviewStatus.tsx +74 -44
  321. package/src/client/review-page/review-activity.ts +64 -0
  322. package/src/client/review-page/review-lists.ts +85 -22
  323. package/src/client/review-page/review-mount.ts +24 -7
  324. package/src/client/review-page/review-store.ts +24 -7
  325. package/src/client/review-queue.ts +7 -3
  326. package/src/client/review-threads.ts +24 -12
  327. package/src/client/review.ts +20 -2
  328. package/src/client/row-form-labels.ts +17 -0
  329. package/src/client/session-list.ts +1 -1
  330. package/src/client/slots.ts +1 -1
  331. package/src/client/source.ts +1 -1
  332. package/src/client/status.ts +20 -9
  333. package/src/client/thread-state.ts +8 -7
  334. package/src/client/toolbar-fold.ts +59 -14
  335. package/src/client/worktree-settings-form.ts +1 -1
  336. package/src/diff.ts +8 -5
  337. package/src/git.ts +31 -1
  338. package/src/index.ts +319 -70
  339. package/src/local-diff.ts +151 -48
  340. package/src/local-write.ts +159 -0
  341. package/src/panel.ts +1 -1
  342. package/src/parse.ts +26 -4
  343. package/src/restore.ts +15 -0
  344. package/src/types.ts +121 -17
  345. package/src/viewer-lists.ts +124 -48
  346. package/src/worktree.ts +1 -1
  347. package/lib/types/client/AttentionIndicator.d.ts +0 -22
  348. package/lib/types/client/AttentionIndicator.d.ts.map +0 -1
  349. package/lib/types/client/AttentionIndicator.js.map +0 -1
  350. package/src/client/AttentionIndicator.tsx +0 -37
@@ -0,0 +1,170 @@
1
+ /**
2
+ * The frame the two branch pickers of the local changes header share: a trigger that names the choice, and a
3
+ * searchable menu of grouped rows above a note.
4
+ */
5
+
6
+ import { useCallback, useState, type ReactNode } from 'react'
7
+ import clsx from 'clsx'
8
+ import {
9
+ IconBranchOutlineRegular, IconCheckOutlineRegular, IconChevronDownOutlineRegular,
10
+ IconWarningTriangleOutlineRegular, Menu, MenuItemButton, Tooltip,
11
+ } from '@deepseek-ai/dsh-client-ui-primitives/client'
12
+ import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
13
+ import { useBranchSearch, type BranchSearch } from './branch-search.tsx'
14
+ import css from './BaseMenu.module.css'
15
+
16
+ /** One selectable row of a branch picker. */
17
+ export interface BranchPickerOption<T> {
18
+ /** Identity among the rows, which also tells the chosen row. */
19
+ readonly key: string
20
+ /** Branch name the row shows. */
21
+ readonly name: string
22
+ /** What choosing the row picks. */
23
+ readonly value: T
24
+ /** A mark after the name, such as what makes the row the default. */
25
+ readonly tag?: string
26
+ /** Text for the pointer where the name alone does not say where the branch is. */
27
+ readonly title?: string
28
+ }
29
+
30
+ /** Rows under one heading. */
31
+ export interface BranchPickerGroup<T> {
32
+ readonly id: string
33
+ /** Accessible name of the group, and its heading unless `plain`. */
34
+ readonly label: string
35
+ /** Whether the group shows no heading, as when its one row carries a tag that names it. */
36
+ readonly plain?: boolean
37
+ readonly options: readonly BranchPickerOption<T>[]
38
+ }
39
+
40
+ /** A data attribute a picker puts on its trigger or its menu, for tests and automation. */
41
+ export type PickerMark = Readonly<Record<`data-${string}`, string>>
42
+
43
+ /** Whether a picker's menu is open, with its search. */
44
+ export interface BranchPickerState<L> extends BranchSearch<L> {
45
+ /** Whether the menu shows: the reader opened it and the owning tab is visible. */
46
+ readonly shown: boolean
47
+ /** Close the menu and clear its search. */
48
+ readonly close: () => void
49
+ /** Open the menu, or close it while it shows. */
50
+ readonly toggle: () => void
51
+ }
52
+
53
+ /**
54
+ * Keep a picker's menu and its search: opening and each search read the listing again, and a hidden tab keeps the
55
+ * menu closed.
56
+ * @param visible - whether the owning tab is visible.
57
+ * @param list - reads the branches whose names contain the query; the signal aborts the read.
58
+ * @returns the menu state and the search.
59
+ */
60
+ export function useBranchPicker<L>(
61
+ visible: boolean, list: (query: string, signal: AbortSignal) => Promise<RemoteResult<L>>,
62
+ ): BranchPickerState<L> {
63
+ const [open, setOpen] = useState(false)
64
+ const shown = visible && open
65
+ const search = useBranchSearch(shown, list)
66
+ const close = (): void => {
67
+ setOpen(false)
68
+ search.reset()
69
+ }
70
+ return { ...search, shown, close, toggle: () => { if (shown) close(); else setOpen(true) } }
71
+ }
72
+
73
+ /** Props of the shared frame. */
74
+ export interface BranchPickerProps<T, L> {
75
+ /** The menu state and search of {@link useBranchPicker}. */
76
+ readonly state: BranchPickerState<L>
77
+ /** Accessible name and tooltip of the trigger. */
78
+ readonly label: string
79
+ /** Name the trigger shows. */
80
+ readonly name: string
81
+ /** Whether the choice no longer exists. */
82
+ readonly missing: boolean
83
+ /** Class that sizes the trigger in the header. */
84
+ readonly anchorClassName: string | undefined
85
+ /** Attribute of the trigger. */
86
+ readonly triggerMark: PickerMark
87
+ /** Attribute of the menu's content. */
88
+ readonly menuMark: PickerMark
89
+ /** Placeholder and accessible name of the search field. */
90
+ readonly searchLabel: string
91
+ /** What replaces the rows: reading, a failed read, or nothing matching; null to show `groups`. */
92
+ readonly status: ReactNode
93
+ /** Groups with at least one row each. */
94
+ readonly groups: readonly BranchPickerGroup<T>[]
95
+ /** Key of the chosen row. */
96
+ readonly chosen: string
97
+ /** Choose a row other than the chosen one. */
98
+ readonly choose: (value: T) => void
99
+ /** What the rows compare or show, under them. */
100
+ readonly note: string
101
+ }
102
+
103
+ /** One row of a picker's menu: a branch name with its tag, choosing that row's value. */
104
+ function PickerRow<T>({ option, chosen, choose, close }: {
105
+ readonly option: BranchPickerOption<T>
106
+ readonly chosen: string
107
+ readonly choose: (value: T) => void
108
+ readonly close: () => void
109
+ }) {
110
+ const selected = option.key === chosen
111
+ const select = useCallback((): void => {
112
+ close()
113
+ if (option.key !== chosen) choose(option.value)
114
+ }, [chosen, choose, close, option])
115
+ return (
116
+ <MenuItemButton icon={<IconBranchOutlineRegular size={14} />} current={selected} onSelect={select}>
117
+ <span className={css.option} title={option.title}>
118
+ <span className={css.name}>{option.name}</span>
119
+ {option.tag !== undefined && <span className={css.tag}>{option.tag}</span>}
120
+ {selected && <IconCheckOutlineRegular size={14} className={css.check} />}
121
+ </span>
122
+ </MenuItemButton>
123
+ )
124
+ }
125
+
126
+ /**
127
+ * Render a branch picker: the trigger and, while open, the portalled menu.
128
+ * @param props - the menu state, the trigger's texts, the rows with the chosen one, and the note.
129
+ * @returns the trigger with its menu.
130
+ */
131
+ export function BranchPicker<T, L>({
132
+ state, label, name, missing, anchorClassName, triggerMark, menuMark, searchLabel, status, groups, chosen, choose, note,
133
+ }: BranchPickerProps<T, L>): ReactNode {
134
+ return (
135
+ <Menu
136
+ open={state.shown}
137
+ portal
138
+ dense
139
+ align="start"
140
+ className={anchorClassName}
141
+ listClassName={css.menu}
142
+ onClose={state.close}
143
+ search={{ label: searchLabel, value: state.query, onChange: state.setQuery, skipAutoFocusOnTouch: true }}
144
+ anchor={(
145
+ <Tooltip label={label} side="bottom" portal delayMs={500}>
146
+ <button type="button" className={clsx(css.trigger, missing && css.missing)} aria-haspopup="menu" aria-expanded={state.shown}
147
+ aria-label={label} {...triggerMark} onClick={state.toggle}>
148
+ {missing && <IconWarningTriangleOutlineRegular size={12} className={css.warning} />}
149
+ <span className={css.triggerName} data-fold-floor="">{name}</span>
150
+ <IconChevronDownOutlineRegular size={12} />
151
+ </button>
152
+ </Tooltip>
153
+ )}
154
+ >
155
+ <div className={css.root} {...menuMark}>
156
+ <div className={css.rows}>
157
+ {status ?? groups.map(group => (
158
+ <div key={group.id} role="group" aria-label={group.label}>
159
+ {group.plain !== true && <div className={css.label} role="presentation">{group.label}</div>}
160
+ {group.options.map(option => (
161
+ <PickerRow key={option.key} option={option} chosen={chosen} choose={choose} close={state.close} />
162
+ ))}
163
+ </div>
164
+ ))}
165
+ </div>
166
+ <div className={css.note}>{note}</div>
167
+ </div>
168
+ </Menu>
169
+ )
170
+ }
@@ -3,52 +3,60 @@
3
3
  * the state glyph, the title, the number, and the checks outcome, which opens
4
4
  * the changes view, and, while expanded, one row per fact (checks, review,
5
5
  * merge state, the changed lines, which open its changes too, and the linked
6
- * issues) above the merge action. Opening on the host, copying, viewing
6
+ * issues) above the merge action, which merges now, turns the host's automatic
7
+ * merge on, or shows that it is on. Opening on the host, copying, viewing
7
8
  * changes, marking a draft ready, and removing live in the card's actions
8
9
  * menu, which shows on hover or focus as on the panel's other rows.
9
10
  */
10
11
 
11
- import { useId, useState, type MouseEvent, type ReactNode } from 'react'
12
+ import { useCallback, useId, useState, type MouseEvent, type ReactNode } from 'react'
12
13
  import clsx from 'clsx'
13
14
  import {
14
- Button, HoverCard, IconCheckCircleOutlineRegular, IconChevronDownOutlineRegular, IconCloseOutlineRegular, IconCopyOutlineRegular,
15
- IconEllipsisOutlineRegular, IconFilesDiffOutlineRegular, IconRightUpOutlineRegular, IconTriangleRightFillRegular, Menu,
15
+ Button, HoverCard, IconCheckCircleOutlineRegular, IconChevronDownOutlineRegular, IconClockOutlineRegular, IconCloseOutlineRegular,
16
+ IconCopyOutlineRegular, IconEllipsisOutlineRegular, IconFilesDiffOutlineRegular, IconTriangleRightFillRegular, Menu,
16
17
  MenuItemButton, StateDot, Tooltip,
17
18
  type MenuEntry, type MenuItem, type StateDotState,
18
- } from '@deepseek-ai/dsh-client-ui-primitives'
19
+ } from '@deepseek-ai/dsh-client-ui-primitives/client'
19
20
  import type { PanelDetailsProps } from '@deepseek-ai/dsh-client-ui-session-panel/client'
20
- import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
21
+ import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots/client'
21
22
  import type {
22
- ChangeRequestSnapshot, CheckState, ChecksRollup, ForgeFailure, MergeMethod, MergeRequest,
23
+ AutoMergeRequest, ChangeRequestAutoMerge, ChangeRequestSnapshot, CheckState, ChecksRollup, ForgeFailure, MergeMethod, MergeRequest,
23
24
  } from '@deepseek-ai/dsh-experimental-forge/types'
24
25
  import type { ForgePanelChangeRequest } from '../types.ts'
25
- import { ChecksRow, IssuesRow, MergeRow, ReviewRow, RowParts, ThreadGlyph, type OverviewActions } from './ChangeRequestOverview.tsx'
26
+ import {
27
+ ChecksRow, IssuesRow, MergeRow, ReviewRow, RowParts, ThreadGlyph, useHeadChoiceMenu, type OverviewActions,
28
+ } from './ChangeRequestOverview.tsx'
29
+ import { openOnLabel } from './forge-copy.ts'
26
30
  import { formatAgo } from './format.ts'
27
- import { ChangeRequestGlyph, CheckGlyph } from './glyphs.tsx'
31
+ import { ChangeRequestGlyph, CheckGlyph, ForgeGlyph } from './glyphs.tsx'
28
32
  import type { ForgePanelKey, NS } from './locales.ts'
29
33
  import type { ForgeChangeRequestCardActionsProps } from './slots.ts'
30
- import { ciSummary, flagOf, numberOf, TONE_LABEL, toneOf, type ChangeRequestEntry, type ChangeRequestTone } from './status.ts'
34
+ import {
35
+ ciSummary, flagOf, mergeBlockers, numberOf, TONE_LABEL, toneOf, type ChangeRequestEntry, type ChangeRequestTone,
36
+ } from './status.ts'
31
37
  import css from './Forge.module.css'
32
38
 
33
39
  type Translate = PropsLocale<typeof NS>['t']
34
40
 
35
41
  /**
36
- * What a card can do; a surface without a Session binding omits `remove`, `markReady`, `merge`, `viewChanges`, and the
37
- * overview actions.
42
+ * What a card can do; a surface without a Session binding omits `remove`, `markReady`, `merge`, `autoMerge`,
43
+ * `viewChanges`, and the overview actions.
38
44
  */
39
45
  export interface ChangeRequestActions extends OverviewActions {
40
46
  /** Open a URL outside the app. */
41
47
  readonly openLink: (url: string) => void
42
48
  /** Copy a URL to the clipboard. */
43
49
  readonly copyLink: (url: string) => void
44
- /** Read the status again after a failed read. */
45
- readonly retry: () => void
50
+ /** Read the status again; a surface that knows when the read ends returns a promise that settles then. */
51
+ readonly retry: () => void | Promise<void>
46
52
  /** Remove the change request from its Session. */
47
53
  readonly remove?: ((entry: ChangeRequestEntry) => void) | undefined
48
54
  /** Mark a draft ready for review; settles once the outcome is reported. */
49
55
  readonly markReady?: ((entry: ChangeRequestEntry) => Promise<void>) | undefined
50
56
  /** Merge the change request as `request` describes; settles once the outcome is reported. */
51
57
  readonly merge?: ((entry: ChangeRequestEntry, request: MergeRequest) => Promise<void>) | undefined
58
+ /** Turn the code host's automatic merge on or off as `request` describes; settles once the outcome is reported. */
59
+ readonly autoMerge?: ((entry: ChangeRequestEntry, request: AutoMergeRequest) => Promise<void>) | undefined
52
60
  /** Load complete check details independently of polling; cancellation follows the open list. */
53
61
  readonly readChecks?: ((url: string, headSha: string, signal: AbortSignal) => Promise<ChangeRequestSnapshot>) | undefined
54
62
  /** Open the changes view of the change request. */
@@ -75,6 +83,8 @@ export interface ChangeRequestCardProps {
75
83
  readonly actions: ChangeRequestActions
76
84
  /** Active UI language for numeric formatting. */
77
85
  readonly locale: string
86
+ /** Whether the page's primary pointer is coarse, which keeps the reviewer search from focusing its field. */
87
+ readonly coarsePointer: boolean
78
88
  /** Forge panel copy. */
79
89
  readonly t: Translate
80
90
  }
@@ -132,7 +142,7 @@ export function ChangesRow({ entry, snapshot, name, actions, locale, t }: {
132
142
  readonly entry: ChangeRequestEntry
133
143
  readonly snapshot: ChangeRequestSnapshot
134
144
  readonly name: string
135
- readonly actions: ChangeRequestActions
145
+ readonly actions: Pick<ChangeRequestActions, 'viewChanges'>
136
146
  readonly locale: string
137
147
  readonly t: Translate
138
148
  }): ReactNode {
@@ -180,10 +190,12 @@ function finished(snapshot: ChangeRequestSnapshot, now: number, t: Translate): s
180
190
  }
181
191
 
182
192
  /**
183
- * The checks outcome after the number: a spinner before the first read, the combined outcome of an open change
184
- * request that has checks, and nothing for a finished one, whose glyph already says how it ended.
193
+ * Render the checks outcome of a change request as one glyph: a spinner before the first read, the combined outcome of
194
+ * an open change request that has checks, and nothing for a finished one, whose own glyph already says how it ended.
195
+ * @param props.snapshot - the latest snapshot, or null before the first read.
196
+ * @returns the glyph, or null.
185
197
  */
186
- function Mark({ snapshot }: { readonly snapshot: ChangeRequestSnapshot | null }): ReactNode {
198
+ export function ChecksMark({ snapshot }: { readonly snapshot: ChangeRequestSnapshot | null }): ReactNode {
187
199
  if (snapshot === null) return <StateDot state="ongoing" size={12} />
188
200
  if (snapshot.state !== 'open') return null
189
201
  const ci = ciSummary(snapshot)
@@ -226,25 +238,30 @@ function identity(number: number | null, snapshot: ChangeRequestSnapshot | null,
226
238
  return parts.length === 0 ? [] : [parts.join(' · ')]
227
239
  }
228
240
 
229
- /** The merge button and its menu: a title row, one row per method with the chosen one checked, and the confirmation. */
230
- function MergeMenu({ snapshot, name, usual, busy, onMerge, t }: {
241
+ /**
242
+ * The merge button and its menu: a title row, one row per method with the chosen one checked, and the confirmation.
243
+ * With `auto` it is the button that turns the host's automatic merge on instead, which asks for the same two things.
244
+ */
245
+ function MergeMenu({ snapshot, name, usual, busy, auto = false, onMerge, t }: {
231
246
  readonly snapshot: ChangeRequestSnapshot
232
247
  readonly name: string
233
248
  readonly usual: MergeMethod
234
249
  readonly busy: boolean
250
+ readonly auto?: boolean
235
251
  readonly onMerge: (method: MergeMethod, headSha: string) => void
236
252
  readonly t: Translate
237
253
  }): ReactNode {
238
- const [open, setOpen] = useState(false)
239
- const [confirmedHead, setConfirmedHead] = useState(snapshot.headSha)
240
254
  const [chosen, setChosen] = useState<string>(usual)
241
- const stale = confirmedHead !== snapshot.headSha
242
255
  // The methods can change between polls; a choice the repository no longer allows falls back to the usual one.
243
- const method = snapshot.mergeMethods.find(entry => entry === chosen) ?? usual
244
- const close = (): void => { setOpen(false) }
256
+ const { method, open, confirmedHead, close, toggle } = useHeadChoiceMenu(snapshot.mergeMethods, chosen, usual, snapshot.headSha)
257
+ const stale = confirmedHead !== snapshot.headSha
258
+ const confirmMerge = useCallback((): void => {
259
+ close()
260
+ onMerge(method, confirmedHead)
261
+ }, [close, confirmedHead, method, onMerge])
245
262
  const base = snapshot.baseBranch
246
263
  const items: MenuEntry[] = [
247
- { type: 'label', id: 'title', text: t('change.mergeTitle', { name, base }) },
264
+ { type: 'label', id: 'title', text: t(auto ? 'change.autoMergeTitle' : 'change.mergeTitle', { name, base }) },
248
265
  ...snapshot.mergeMethods.map(entry => ({
249
266
  id: entry,
250
267
  label: (
@@ -264,17 +281,15 @@ function MergeMenu({ snapshot, name, usual, busy, onMerge, t }: {
264
281
  anchor={(
265
282
  <Button
266
283
  size="sm"
267
- variant="primary"
268
- className={clsx(css.primaryAction, css.mergeAction)}
284
+ variant={auto ? 'outline' : 'primary'}
285
+ className={clsx(css.primaryAction, auto ? css.autoMergeAction : css.mergeAction)}
269
286
  aria-haspopup="menu"
270
287
  aria-expanded={open}
271
288
  disabled={busy}
272
- onClick={() => {
273
- if (!open) setConfirmedHead(snapshot.headSha)
274
- setOpen(!open)
275
- }}
289
+ onClick={toggle}
276
290
  >
277
- {t('change.merge')}
291
+ {auto && <IconClockOutlineRegular size={14} />}
292
+ {t(auto ? 'change.autoMerge' : 'change.merge')}
278
293
  <IconTriangleRightFillRegular size={10} className={clsx(css.mergeCaret, open && css.mergeCaretOpen)} />
279
294
  </Button>
280
295
  )}
@@ -285,57 +300,151 @@ function MergeMenu({ snapshot, name, usual, busy, onMerge, t }: {
285
300
  <MenuItemButton
286
301
  separatorBefore
287
302
  disabled={stale}
288
- onSelect={() => {
289
- close()
290
- onMerge(method, confirmedHead)
291
- }}
303
+ onSelect={confirmMerge}
292
304
  >
293
- {t(stale ? 'change.mergeChanged' : 'change.mergeConfirm')}
305
+ {t(stale ? 'change.mergeChanged' : auto ? 'change.autoMergeConfirm' : 'change.mergeConfirm')}
294
306
  </MenuItemButton>
295
307
  </Menu>
296
308
  )
297
309
  }
298
310
 
299
311
  /**
300
- * Render the merge action of an open change request the host would merge now.
312
+ * The button of a change request whose automatic merge is on, and its menu: where it merges, how and by whom when the
313
+ * host names them, and the cancellation when the signed-in user may cancel.
314
+ */
315
+ function AutoMergeStatus({ snapshot, autoMerge, busy, onCancel, t }: {
316
+ readonly snapshot: ChangeRequestSnapshot
317
+ readonly autoMerge: ChangeRequestAutoMerge
318
+ readonly busy: boolean
319
+ readonly onCancel: (() => void) | undefined
320
+ readonly t: Translate
321
+ }): ReactNode {
322
+ const [open, setOpen] = useState(false)
323
+ const facts = [
324
+ ...autoMerge.method === null ? [] : [t('change.autoMergeMethod', { method: t(`change.mergeMethod.${autoMerge.method}`) })],
325
+ ...autoMerge.enabledBy === null ? [] : [t('change.autoMergeBy', { login: autoMerge.enabledBy })],
326
+ ]
327
+ const items: MenuEntry[] = [
328
+ { type: 'label', id: 'title', text: t('change.autoMergeOnTitle', { base: snapshot.baseBranch }) },
329
+ ...facts.length === 0 ? [] : [{ type: 'label' as const, id: 'facts', text: facts.join(' · ') }],
330
+ ]
331
+ const close = useCallback((): void => { setOpen(false) }, [])
332
+ const toggle = useCallback((): void => { setOpen(value => !value) }, [])
333
+ const cancelAutoMerge = useCallback((): void => {
334
+ close()
335
+ onCancel?.()
336
+ }, [close, onCancel])
337
+ return (
338
+ <Menu
339
+ open={open}
340
+ onClose={close}
341
+ portal
342
+ align="end"
343
+ anchor={(
344
+ <Button size="sm" variant="outline" className={clsx(css.primaryAction, css.autoMergeAction)} data-forge-auto-merge="on"
345
+ aria-haspopup="menu" aria-expanded={open} disabled={busy} onClick={toggle}>
346
+ <IconClockOutlineRegular size={14} />
347
+ {t('change.autoMergeOn')}
348
+ <IconTriangleRightFillRegular size={10} className={clsx(css.mergeCaret, open && css.mergeCaretOpen)} />
349
+ </Button>
350
+ )}
351
+ items={items}
352
+ onSelect={close}
353
+ >
354
+ {onCancel !== undefined && (
355
+ <MenuItemButton separatorBefore onSelect={cancelAutoMerge}>{t('change.autoMergeCancel')}</MenuItemButton>
356
+ )}
357
+ </Menu>
358
+ )
359
+ }
360
+
361
+ /** The merge button of a change request its host would not merge now: it names why on hover and focus, and does nothing. */
362
+ function BlockedMerge({ snapshot, t }: { readonly snapshot: ChangeRequestSnapshot; readonly t: Translate }): ReactNode {
363
+ const reason = mergeBlockers(snapshot).map(key => t(key)).join(t('issues.separator'))
364
+ return (
365
+ <Tooltip label={reason} side="bottom" align="end">
366
+ <Button size="sm" variant="primary" className={clsx(css.primaryAction, css.mergeAction, css.unavailable)} aria-disabled="true"
367
+ data-forge-merge-blocked="">
368
+ {t('change.merge')}
369
+ </Button>
370
+ </Tooltip>
371
+ )
372
+ }
373
+
374
+ /** The host's automatic merge while it is on, with the cancellation when the host lets the signed-in user turn it off. */
375
+ function AutoMergeOffered({ snapshot, autoMerge, busy, entry, disable, run, t }: {
376
+ readonly snapshot: ChangeRequestSnapshot
377
+ readonly autoMerge: ChangeRequestAutoMerge
378
+ readonly busy: boolean
379
+ readonly entry: ChangeRequestEntry
380
+ readonly disable: NonNullable<ChangeRequestActions['autoMerge']>
381
+ readonly run: (action: () => Promise<void>) => void
382
+ readonly t: Translate
383
+ }) {
384
+ const cancel = useCallback((): void => {
385
+ run(() => disable(entry, { enabled: false }))
386
+ }, [disable, entry, run])
387
+ return <AutoMergeStatus snapshot={snapshot} autoMerge={autoMerge} busy={busy} onCancel={cancel} t={t} />
388
+ }
389
+
390
+ /**
391
+ * Render the merge action of an open change request that is not a draft: the merge when the host would merge now; the
392
+ * state of its automatic merge with the cancellation when that is on; the button that turns the automatic merge on
393
+ * when the signed-in user can; and, with `blocked`, a merge button that names why the host would not merge.
301
394
  * @param props.entry - the change request.
302
395
  * @param props.snapshot - its latest snapshot.
303
396
  * @param props.name - how menus name it.
304
397
  * @param props.actions - the actions the surface offers.
305
398
  * @param props.className - class of the wrapper, the card footer's by default.
399
+ * @param props.blocked - whether a change request with none of the other actions shows the merge it cannot run.
306
400
  * @param props.t - forge panel copy.
307
- * @returns the action, or null when the host would not merge now or the surface does not offer it.
401
+ * @returns the action, or null for a change request with none.
308
402
  */
309
- export function ChangeRequestPrimary({ entry, snapshot, name, actions, className = css.footer, t }: {
403
+ export function ChangeRequestPrimary({ entry, snapshot, name, actions, className = css.footer, blocked = false, t }: {
310
404
  readonly entry: ChangeRequestEntry
311
405
  readonly snapshot: ChangeRequestSnapshot
312
406
  readonly name: string
313
407
  readonly actions: ChangeRequestActions
314
408
  readonly className?: string | undefined
409
+ readonly blocked?: boolean | undefined
315
410
  readonly t: Translate
316
411
  }): ReactNode {
317
412
  // One request at a time: the action stays disabled until the previous one settles.
318
413
  const [busy, setBusy] = useState(false)
319
- const run = (action: () => Promise<void>): void => {
414
+ const run = useCallback((action: () => Promise<void>): void => {
320
415
  setBusy(true)
321
416
  void action().finally(() => { setBusy(false) })
322
- }
323
- const { merge } = actions
417
+ }, [])
418
+ const { merge, autoMerge: setAutoMerge } = actions
419
+ // The merge menu keeps its own method and confirmation, so both branches below must render that same element.
420
+ const mergeNow = useCallback((method: MergeMethod, headSha: string): void => {
421
+ /* v8 ignore next -- the merge menu renders only while the host offers a merge */
422
+ if (merge === undefined) return
423
+ run(() => merge(entry, { method, headSha }))
424
+ }, [entry, merge, run])
425
+ const mergeAutomatically = useCallback((method: MergeMethod, headSha: string): void => {
426
+ /* v8 ignore next -- the enabling menu renders only while the signed-in user may turn automatic merge on */
427
+ if (setAutoMerge === undefined) return
428
+ run(() => setAutoMerge(entry, { enabled: true, method, headSha }))
429
+ }, [entry, run, setAutoMerge])
324
430
  if (snapshot.state !== 'open' || snapshot.draft) return null
325
431
  const [usual] = snapshot.mergeMethods
326
- if (!snapshot.mergeReady || usual === undefined || merge === undefined) return null
327
- return (
328
- <div className={className}>
329
- <MergeMenu
330
- snapshot={snapshot}
331
- name={name}
332
- usual={usual}
333
- busy={busy}
334
- onMerge={(method, headSha) => { run(() => merge(entry, { method, headSha })) }}
335
- t={t}
336
- />
337
- </div>
338
- )
432
+ const auto = snapshot.autoMerge
433
+ let action: ReactNode
434
+ if (snapshot.mergeReady && usual !== undefined && merge !== undefined) {
435
+ action = <MergeMenu snapshot={snapshot} name={name} usual={usual} busy={busy} t={t} onMerge={mergeNow} />
436
+ } else if (auto?.enabled === true) {
437
+ action = auto.canDisable && setAutoMerge !== undefined
438
+ ? <AutoMergeOffered snapshot={snapshot} autoMerge={auto} busy={busy} entry={entry} disable={setAutoMerge} run={run} t={t} />
439
+ : <AutoMergeStatus snapshot={snapshot} autoMerge={auto} busy={busy} onCancel={undefined} t={t} />
440
+ } else if (auto?.canEnable === true && usual !== undefined && setAutoMerge !== undefined) {
441
+ action = <MergeMenu auto snapshot={snapshot} name={name} usual={usual} busy={busy} t={t} onMerge={mergeAutomatically} />
442
+ } else if (blocked) {
443
+ action = <BlockedMerge snapshot={snapshot} t={t} />
444
+ } else {
445
+ return null
446
+ }
447
+ return <div className={className}>{action}</div>
339
448
  }
340
449
 
341
450
  /**
@@ -366,7 +475,10 @@ function CardMenu({ entry, snapshot, name, url, actions, t }: {
366
475
  item: { id: 'changes', label: t('change.viewChanges'), icon: <IconFilesDiffOutlineRegular size={14} /> },
367
476
  run: () => { viewChanges(entry) },
368
477
  }] : [],
369
- { item: { id: 'open', label: t('change.view'), icon: <IconRightUpOutlineRegular size={14} /> }, run: () => { actions.openLink(url) } },
478
+ {
479
+ item: { id: 'open', label: openOnLabel(t, entry.forge?.label ?? null), icon: <ForgeGlyph forge={entry.forge?.forge ?? null} /> },
480
+ run: () => { actions.openLink(url) },
481
+ },
370
482
  { item: { id: 'copy', label: t('change.copy'), icon: <IconCopyOutlineRegular size={14} /> }, run: () => { actions.copyLink(url) } },
371
483
  ...ready === undefined ? [] : [{
372
484
  item: { id: 'ready', label: t('change.markReady'), icon: <IconCheckCircleOutlineRegular size={14} />, disabled: busy },
@@ -380,14 +492,16 @@ function CardMenu({ entry, snapshot, name, url, actions, t }: {
380
492
  // Removing sits apart from the other actions.
381
493
  const items: MenuEntry[] = choices.flatMap(({ item }) => item.id === 'remove'
382
494
  ? [{ type: 'separator' as const, id: 'remove-separator' }, item] : [item])
383
- const select = (id: string): void => {
495
+ const select = useCallback((id: string): void => {
384
496
  setOpen(false)
385
497
  for (const choice of choices) if (choice.item.id === id) choice.run()
386
- }
498
+ }, [choices])
499
+ const close = useCallback((): void => { setOpen(false) }, [])
500
+ const toggle = useCallback((): void => { setOpen(value => !value) }, [])
387
501
  return (
388
502
  <Menu
389
503
  open={open}
390
- onClose={() => { setOpen(false) }}
504
+ onClose={close}
391
505
  portal
392
506
  align="end"
393
507
  anchor={(
@@ -396,7 +510,7 @@ function CardMenu({ entry, snapshot, name, url, actions, t }: {
396
510
  aria-label={t('change.actions', { name })}
397
511
  aria-haspopup="menu"
398
512
  aria-expanded={open}
399
- onClick={() => { setOpen(!open) }}
513
+ onClick={toggle}
400
514
  >
401
515
  <IconEllipsisOutlineRegular size={16} />
402
516
  </button>
@@ -465,13 +579,14 @@ export function MergeStateRow({ entry, snapshot, updateBranch, t }: {
465
579
  * The facts of a change request one row each: the merged or closed state, or the checks, review, and merge state;
466
580
  * the changed lines; and the linked issues.
467
581
  */
468
- function Details({ entry, snapshot, name, now, actions, locale, t }: {
582
+ function Details({ entry, snapshot, name, now, actions, locale, coarsePointer, t }: {
469
583
  readonly entry: ChangeRequestEntry
470
584
  readonly snapshot: ChangeRequestSnapshot
471
585
  readonly name: string
472
586
  readonly now: number
473
587
  readonly actions: ChangeRequestActions
474
588
  readonly locale: string
589
+ readonly coarsePointer: boolean
475
590
  readonly t: Translate
476
591
  }): ReactNode {
477
592
  const changes = <ChangesRow entry={entry} snapshot={snapshot} name={name} actions={actions} locale={locale} t={t} />
@@ -489,7 +604,7 @@ function Details({ entry, snapshot, name, now, actions, locale, t }: {
489
604
  <ChecksRow key={snapshot.headSha} entry={entry} snapshot={snapshot} openLink={actions.openLink} readChecks={actions.readChecks}
490
605
  rerunChecks={actions.rerunChecks} t={t} />
491
606
  <ReviewRow entry={entry} snapshot={snapshot} tone={review.tone} openLink={actions.openLink} value={review.value}
492
- requestReviews={actions.requestReviews} reviewerCandidates={actions.reviewerCandidates} t={t} />
607
+ requestReviews={actions.requestReviews} reviewerCandidates={actions.reviewerCandidates} coarsePointer={coarsePointer} t={t} />
493
608
  <MergeStateRow entry={entry} snapshot={snapshot} updateBranch={actions.updateBranch} t={t} />
494
609
  {changes}
495
610
  <IssuesRow snapshot={snapshot} openLink={actions.openLink} t={t} />
@@ -502,10 +617,12 @@ function Details({ entry, snapshot, name, now, actions, locale, t }: {
502
617
  * and has read; with the platform's modifier key or the middle button, and for any other change request, it opens
503
618
  * the host's page. The line shows its status as glyphs and, while collapsed, reads it in words to assistive
504
619
  * technology, which the expanded rows do otherwise; the hover card names the full title, the branches, and that status.
505
- * @param props - change request, expansion, current time, actions, and copy.
620
+ * @param props - change request, expansion, current time, actions, number locale, pointer accuracy, and copy.
506
621
  * @returns the card.
507
622
  */
508
- export function ChangeRequestCard({ entry, expanded, onToggle, now, actions, locale, t }: ChangeRequestCardProps): ReactNode {
623
+ export function ChangeRequestCard({
624
+ entry, expanded, onToggle, now, actions, locale, coarsePointer, t,
625
+ }: ChangeRequestCardProps): ReactNode {
509
626
  const snapshot = entry.snapshot
510
627
  const number = numberOf(entry)
511
628
  const url = snapshot?.url ?? entry.url
@@ -523,6 +640,8 @@ export function ChangeRequestCard({ entry, expanded, onToggle, now, actions, loc
523
640
  if (viewChanges === undefined || event.metaKey || event.ctrlKey) actions.openLink(url)
524
641
  else viewChanges(entry)
525
642
  }
643
+ const openHost = useCallback((): void => { actions.openLink(url) }, [actions, url])
644
+ const retryRead = useCallback((): void => { void actions.retry() }, [actions])
526
645
  const head = (
527
646
  <div className={css.changeHead} data-session-panel-row="">
528
647
  <button
@@ -539,7 +658,7 @@ export function ChangeRequestCard({ entry, expanded, onToggle, now, actions, loc
539
658
  </button>
540
659
  <span data-row-part="trailing" className={css.status}>
541
660
  {number !== null && <span className={css.number}>{t('change.number', { number })}</span>}
542
- {notice === undefined && <Mark snapshot={snapshot} />}
661
+ {notice === undefined && <ChecksMark snapshot={snapshot} />}
543
662
  {!expanded && notice === undefined && status !== undefined && <span className={css.visuallyHidden}>{status.label}</span>}
544
663
  {actions.renderActions?.({ url: entry.url, ref: entry.ref, headSha: snapshot?.headSha ?? null, state: snapshot?.state ?? null })}
545
664
  </span>
@@ -571,12 +690,17 @@ export function ChangeRequestCard({ entry, expanded, onToggle, now, actions, loc
571
690
  <div className={css.notice}>
572
691
  <span>{t(notice)}</span>
573
692
  {entry.ref === null
574
- ? <Button size="sm" variant="outline" onClick={() => { actions.openLink(url) }}>{t('change.view')}</Button>
575
- : <Button size="sm" variant="outline" onClick={actions.retry}>{t('retry')}</Button>}
693
+ ? (
694
+ <Button size="sm" variant="outline" onClick={openHost}>
695
+ {openOnLabel(t, entry.forge?.label ?? null)}
696
+ </Button>
697
+ )
698
+ : <Button size="sm" variant="outline" onClick={retryRead}>{t('retry')}</Button>}
576
699
  </div>
577
700
  )}
578
701
  {expanded && snapshot !== null && (
579
- <Details entry={entry} snapshot={snapshot} name={name} now={now} actions={actions} locale={locale} t={t} />
702
+ <Details entry={entry} snapshot={snapshot} name={name} now={now} actions={actions} locale={locale}
703
+ coarsePointer={coarsePointer} t={t} />
580
704
  )}
581
705
  {expanded && snapshot !== null && <ChangeRequestPrimary entry={entry} snapshot={snapshot} name={name} actions={actions} t={t} />}
582
706
  </li>