@bevel-software/platform-core-frontend 0.4.1 → 0.5.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 (327) hide show
  1. package/THIRD-PARTY-NOTICES.md +5366 -0
  2. package/package.json +7 -4
  3. package/src/core/CoreAppShell.tsx +195 -56
  4. package/src/core/__tests__/AppChrome.test.tsx +125 -0
  5. package/src/core/__tests__/ShellRoutes.test.tsx +37 -2
  6. package/src/core/__tests__/bootstrap.test.ts +63 -0
  7. package/src/core/bootstrap.ts +73 -0
  8. package/src/core/events.ts +12 -0
  9. package/src/core/registry.ts +58 -9
  10. package/src/index.css +100 -11
  11. package/src/index.ts +24 -23
  12. package/src/lib/utils.ts +93 -117
  13. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +281 -0
  14. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +166 -1
  15. package/src/modules/access/api.ts +49 -0
  16. package/src/modules/access/components/ManageAccessDialog.tsx +786 -481
  17. package/src/modules/access/hooks/useFileAccess.ts +1 -1
  18. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +86 -0
  19. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +17 -1
  20. package/src/modules/admin/__tests__/admin.unread.test.tsx +61 -0
  21. package/src/modules/admin/components/AdminRolesPage.tsx +44 -38
  22. package/src/modules/admin/components/RolesCorruptedBanner.tsx +11 -10
  23. package/src/modules/admin/components/UserAccountsPage.tsx +36 -28
  24. package/src/modules/admin/state/admin.context.tsx +15 -6
  25. package/src/modules/auth/components/AccountPage.tsx +11 -11
  26. package/src/modules/auth/components/LoginScreen.tsx +12 -12
  27. package/src/modules/auth/services/sso.ts +47 -1
  28. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +277 -0
  29. package/src/modules/change-requests/__tests__/author.test.ts +48 -0
  30. package/src/modules/change-requests/__tests__/conflict.test.ts +73 -0
  31. package/src/modules/change-requests/__tests__/diff.test.ts +134 -0
  32. package/src/modules/change-requests/__tests__/propose.test.ts +93 -0
  33. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +72 -0
  34. package/src/modules/change-requests/change-requests.css +22 -0
  35. package/src/modules/change-requests/components/ChangeBox.tsx +277 -0
  36. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +713 -0
  37. package/src/modules/change-requests/components/ConflictHelp.tsx +47 -0
  38. package/src/modules/change-requests/components/CrFileTree.tsx +398 -0
  39. package/src/modules/change-requests/components/FileChangeBoxes.tsx +168 -0
  40. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +236 -0
  41. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +79 -0
  42. package/src/modules/change-requests/hooks/useFileOnBranch.ts +80 -0
  43. package/src/modules/change-requests/services/change-requests.api.ts +45 -0
  44. package/src/modules/change-requests/services/propose.api.ts +162 -0
  45. package/src/modules/change-requests/utils/author.ts +47 -0
  46. package/src/modules/change-requests/utils/conflict.ts +38 -0
  47. package/src/modules/change-requests/utils/diff.ts +80 -0
  48. package/src/modules/git/__tests__/BranchSwitcher.test.tsx +27 -18
  49. package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +36 -83
  50. package/src/modules/git/__tests__/PullNeededBanner.test.tsx +5 -5
  51. package/src/modules/git/__tests__/PullRequestsForMe.test.tsx +147 -0
  52. package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +2 -8
  53. package/src/modules/git/components/BranchSwitcher.tsx +68 -31
  54. package/src/modules/git/components/DiffView.tsx +4 -4
  55. package/src/modules/git/components/FileComparisonPanel.tsx +20 -20
  56. package/src/modules/git/components/FileHistoryPanel.tsx +71 -107
  57. package/src/modules/git/components/PullNeededBanner.tsx +6 -13
  58. package/src/modules/git/components/PullRequestsForMe.tsx +71 -36
  59. package/src/modules/git/components/UnifiedDiffView.tsx +4 -4
  60. package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +2 -2
  61. package/src/modules/git/hooks/useGitState.ts +15 -14
  62. package/src/modules/git/services/__tests__/error-messages.test.ts +4 -4
  63. package/src/modules/git/services/error-messages.ts +7 -7
  64. package/src/modules/git/services/git.api.ts +17 -11
  65. package/src/modules/git/services/pr-prompts.ts +2 -2
  66. package/src/modules/git/state/git.context.ts +10 -1
  67. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +224 -0
  68. package/src/modules/layout/__tests__/SidebarToggle.test.tsx +242 -0
  69. package/src/modules/layout/__tests__/breakpoints.test.ts +56 -0
  70. package/src/modules/layout/breakpoints.ts +6 -0
  71. package/src/modules/layout/components/AppLayout.tsx +17 -5
  72. package/src/modules/layout/components/DemoBanner.tsx +10 -1
  73. package/src/modules/layout/components/MaintenanceOverlay.tsx +3 -3
  74. package/src/modules/layout/components/MobileChatLayout.tsx +31 -26
  75. package/src/modules/layout/components/ResizableThreePaneLayout.tsx +59 -24
  76. package/src/modules/layout/components/SidebarFrame.tsx +317 -0
  77. package/src/modules/layout/components/SidebarToggle.tsx +86 -0
  78. package/src/modules/layout/components/SlideOverlay.tsx +1 -1
  79. package/src/modules/layout/components/__tests__/MobileChatLayout.test.tsx +40 -2
  80. package/src/modules/layout/components/__tests__/ResizableThreePaneLayout.test.tsx +19 -3
  81. package/src/modules/layout/state/sidebar.ts +200 -0
  82. package/src/modules/library/__tests__/AddToGroupDialog.test.tsx +313 -0
  83. package/src/modules/library/__tests__/ChangeRequestDock.test.tsx +84 -0
  84. package/src/modules/library/__tests__/GroupJoinRequests.test.tsx +178 -0
  85. package/src/modules/library/__tests__/GroupPage.test.tsx +479 -0
  86. package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +283 -0
  87. package/src/modules/library/__tests__/GroupsSidebar.contextmenu.test.tsx +175 -0
  88. package/src/modules/library/__tests__/GroupsSidebar.locked.test.tsx +96 -0
  89. package/src/modules/library/__tests__/GroupsSidebar.test.tsx +142 -0
  90. package/src/modules/library/__tests__/GroupsSidebarMenu.test.tsx +142 -0
  91. package/src/modules/library/__tests__/LibraryCard.test.tsx +149 -0
  92. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +378 -0
  93. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +347 -0
  94. package/src/modules/library/__tests__/LockedGroupView.test.tsx +203 -0
  95. package/src/modules/library/__tests__/NewGroupDialog.test.tsx +114 -0
  96. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +177 -0
  97. package/src/modules/library/__tests__/SkillPage.test.tsx +1063 -0
  98. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +259 -0
  99. package/src/modules/library/__tests__/ToolLogo.test.tsx +63 -0
  100. package/src/modules/library/__tests__/ToolPage.test.tsx +315 -0
  101. package/src/modules/library/__tests__/ToolSharePanel.test.tsx +36 -0
  102. package/src/modules/library/__tests__/ToolVarRow.test.tsx +260 -0
  103. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +197 -0
  104. package/src/modules/library/__tests__/auth-harness.tsx +37 -0
  105. package/src/modules/library/__tests__/oauth-fragment.test.ts +48 -0
  106. package/src/modules/library/__tests__/status.test.ts +113 -20
  107. package/src/modules/library/__tests__/useSkillDetail.test.tsx +102 -0
  108. package/src/modules/library/__tests__/useToolPage.test.tsx +146 -0
  109. package/src/modules/library/components/AccessRequestsBanner.tsx +101 -0
  110. package/src/modules/library/components/AddToGroupDialog.tsx +115 -0
  111. package/src/modules/library/components/ChangeRequestDock.tsx +52 -28
  112. package/src/modules/library/components/DeleteGroupDialog.tsx +87 -0
  113. package/src/modules/library/components/GroupIndexRow.tsx +63 -0
  114. package/src/modules/library/components/GroupJoinRequests.tsx +56 -0
  115. package/src/modules/library/components/GroupPage.tsx +373 -0
  116. package/src/modules/library/components/GroupsIndexPage.tsx +222 -0
  117. package/src/modules/library/components/GroupsSidebar.tsx +338 -0
  118. package/src/modules/library/components/GroupsSidebarMenu.tsx +160 -0
  119. package/src/modules/library/components/LibraryCard.tsx +123 -102
  120. package/src/modules/library/components/LibraryLayout.tsx +344 -0
  121. package/src/modules/library/components/LibraryPage.tsx +111 -227
  122. package/src/modules/library/components/LockGlyph.tsx +31 -0
  123. package/src/modules/library/components/LockedGroupView.tsx +159 -0
  124. package/src/modules/library/components/ManagedGroupRequests.tsx +70 -0
  125. package/src/modules/library/components/NewGroupDialog.tsx +112 -0
  126. package/src/modules/library/components/NewSkillPanel.tsx +151 -0
  127. package/src/modules/library/components/PageActions.tsx +156 -0
  128. package/src/modules/library/components/PendingSkillReview.tsx +63 -0
  129. package/src/modules/library/components/PersonalAddDialog.tsx +88 -0
  130. package/src/modules/library/components/PersonalGroupPage.tsx +125 -0
  131. package/src/modules/library/components/StatusDot.tsx +25 -0
  132. package/src/modules/library/components/ToolLogo.tsx +171 -0
  133. package/src/modules/library/components/group-page-parts.tsx +419 -0
  134. package/src/modules/library/components/skill-page/SkillFileEditor.tsx +134 -0
  135. package/src/modules/library/components/skill-page/SkillFilePane.tsx +117 -0
  136. package/src/modules/library/components/skill-page/SkillFileTabs.tsx +112 -0
  137. package/src/modules/library/components/skill-page/SkillPage.tsx +673 -0
  138. package/src/modules/library/components/skill-page/tab-ids.ts +33 -0
  139. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +175 -0
  140. package/src/modules/library/components/tool-page/ToolPage.tsx +228 -0
  141. package/src/modules/library/components/tool-page/ToolSharePanel.tsx +45 -0
  142. package/src/modules/library/components/tool-page/ToolVarRow.tsx +289 -0
  143. package/src/modules/library/hooks/useJoinRequests.ts +114 -0
  144. package/src/modules/library/hooks/useLibraryData.ts +134 -119
  145. package/src/modules/library/hooks/useSkillDetail.ts +119 -74
  146. package/src/modules/library/hooks/useToolPage.ts +145 -0
  147. package/src/modules/library/library.css +33 -245
  148. package/src/modules/library/routes/LibraryRoutes.tsx +134 -0
  149. package/src/modules/library/routes/WorkspaceItemRoute.tsx +74 -0
  150. package/src/modules/library/routes/library-paths.ts +191 -0
  151. package/src/modules/library/services/groups.api.ts +189 -0
  152. package/src/modules/library/services/library.api.ts +291 -164
  153. package/src/modules/library/services/tools.api.ts +60 -0
  154. package/src/modules/library/state/library-context.ts +22 -0
  155. package/src/modules/library/state/library-data.tsx +223 -0
  156. package/src/modules/library/state/toast.context.ts +32 -0
  157. package/src/modules/library/state/toast.tsx +84 -42
  158. package/src/modules/library/utils/clipboard.ts +33 -0
  159. package/src/modules/library/utils/group-summary.ts +68 -0
  160. package/src/modules/library/utils/names.ts +30 -0
  161. package/src/modules/library/utils/navigate-external.ts +15 -0
  162. package/src/modules/library/utils/oauth-fragment.ts +32 -0
  163. package/src/modules/library/utils/personal-group.ts +36 -0
  164. package/src/modules/library/utils/status.ts +108 -25
  165. package/src/modules/library/utils/toast-duration.ts +16 -0
  166. package/src/modules/onboarding/__tests__/onboarding.test.tsx +533 -0
  167. package/src/modules/onboarding/agent-clients.ts +48 -0
  168. package/src/modules/onboarding/components/ConnectAgentPill.tsx +133 -0
  169. package/src/modules/onboarding/components/RootLanding.tsx +54 -0
  170. package/src/modules/onboarding/components/WelcomePage.tsx +364 -0
  171. package/src/modules/onboarding/paths.ts +9 -0
  172. package/src/modules/onboarding/state/onboarding.ts +191 -0
  173. package/src/modules/pr/components/OpenChangeRequestDialog.tsx +10 -10
  174. package/src/modules/pr/services/pr-approvals.api.ts +19 -0
  175. package/src/modules/pr/services/pr-cancel.api.ts +11 -0
  176. package/src/modules/review/components/BinaryChangePlaceholder.tsx +3 -3
  177. package/src/modules/review/components/DiffViewer.tsx +4 -4
  178. package/src/modules/review/components/MarkdownDiffViewer.tsx +84 -26
  179. package/src/modules/review/components/ReviewFileRow.tsx +10 -10
  180. package/src/modules/review/components/ReviewPanel.tsx +49 -17
  181. package/src/modules/review/components/ReviewPanelSurface.tsx +1 -1
  182. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +122 -0
  183. package/src/modules/review/hooks/__tests__/useReviewState.test.ts +1 -1
  184. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +273 -171
  185. package/src/modules/secrets-vault/components/SecretsPage.tsx +147 -110
  186. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +109 -92
  187. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +35 -4
  188. package/src/modules/secrets-vault/services/connect.api.ts +24 -3
  189. package/src/modules/settings/components/DeploymentPage.tsx +90 -0
  190. package/src/modules/settings/components/SettingsLayout.tsx +135 -0
  191. package/src/modules/settings/components/SettingsNav.tsx +114 -0
  192. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +110 -0
  193. package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +249 -0
  194. package/src/modules/settings/settings-nav-items.tsx +166 -0
  195. package/src/modules/setup/__tests__/setup.test.tsx +540 -0
  196. package/src/modules/setup/components/SetupGate.tsx +67 -0
  197. package/src/modules/setup/components/SetupScreen.tsx +573 -0
  198. package/src/modules/setup/services/setup.api.ts +106 -0
  199. package/src/modules/setup/utils/git-host.ts +34 -0
  200. package/src/modules/toolbar/components/AppSwitcher.tsx +38 -15
  201. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +50 -50
  202. package/src/modules/toolbar/components/ProfileMenu.tsx +294 -0
  203. package/src/modules/toolbar/components/Toolbar.tsx +56 -54
  204. package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +176 -122
  205. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +252 -77
  206. package/src/modules/tools/ToolsExplorerPage.tsx +45 -40
  207. package/src/modules/workspace/__tests__/design-system-parity.test.ts +133 -0
  208. package/src/modules/workspace/__tests__/testFixtures.ts +2 -0
  209. package/src/modules/workspace/components/EditorTabs.tsx +82 -50
  210. package/src/modules/workspace/components/FileExplorer.tsx +413 -189
  211. package/src/modules/workspace/components/FilePaneCard.tsx +53 -0
  212. package/src/modules/workspace/components/FileRoute.tsx +89 -84
  213. package/src/modules/workspace/components/FileViewer.tsx +700 -294
  214. package/src/modules/workspace/components/KbDocumentShell.tsx +138 -0
  215. package/src/modules/workspace/components/KbFileRail.tsx +128 -0
  216. package/src/modules/workspace/components/KbPageHeader.tsx +390 -0
  217. package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +87 -3
  218. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +293 -39
  219. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +1 -16
  220. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +462 -44
  221. package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +84 -0
  222. package/src/modules/workspace/components/__tests__/KbFileRail.test.tsx +83 -0
  223. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +192 -0
  224. package/src/modules/workspace/components/renderers/CopyAnchorButton.tsx +64 -0
  225. package/src/modules/workspace/components/renderers/CsvRenderer.tsx +8 -8
  226. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +18 -9
  227. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +14 -14
  228. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +2 -2
  229. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +31 -165
  230. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +18 -5
  231. package/src/modules/workspace/components/renderers/MermaidDiagram.tsx +27 -10
  232. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +2 -2
  233. package/src/modules/workspace/components/renderers/TextRenderer.tsx +11 -5
  234. package/src/modules/workspace/components/renderers/ToolForm.tsx +24 -24
  235. package/src/modules/workspace/components/renderers/ToolRenderer.tsx +27 -27
  236. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -11
  237. package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +66 -0
  238. package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +17 -1
  239. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +1 -1
  240. package/src/modules/workspace/components/renderers/__tests__/MermaidDiagram.test.tsx +58 -0
  241. package/src/modules/workspace/components/renderers/__tests__/lazyRenderer.test.tsx +68 -0
  242. package/src/modules/workspace/components/renderers/__tests__/rendererLayout.test.ts +64 -0
  243. package/src/modules/workspace/components/renderers/__tests__/sanitizeDocxHtml.test.ts +0 -0
  244. package/src/modules/workspace/components/renderers/chunk-boundary.tsx +71 -0
  245. package/src/modules/workspace/components/renderers/index.ts +78 -2
  246. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +241 -0
  247. package/src/modules/workspace/components/renderers/lazyRenderer.tsx +59 -0
  248. package/src/modules/workspace/components/renderers/sanitizeDocxHtml.ts +91 -0
  249. package/src/modules/workspace/hooks/__tests__/useLinksOut.test.ts +59 -0
  250. package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +237 -0
  251. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +185 -0
  252. package/src/modules/workspace/hooks/useAutoGrowTextarea.ts +30 -0
  253. package/src/modules/workspace/hooks/useLastCommit.ts +66 -0
  254. package/src/modules/workspace/hooks/useLinksOut.ts +56 -0
  255. package/src/modules/workspace/hooks/useOpenChangeRequests.ts +20 -0
  256. package/src/modules/workspace/hooks/useWorkspaceState.ts +123 -14
  257. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +1 -1
  258. package/src/modules/workspace/services/workspace.api.ts +9 -2
  259. package/src/modules/workspace/state/open-change-requests.context.ts +35 -0
  260. package/src/modules/workspace/state/open-change-requests.tsx +185 -0
  261. package/src/modules/workspace/state/workspace.context.ts +9 -0
  262. package/src/modules/workspace/utils/__tests__/diff.test.ts +87 -0
  263. package/src/modules/workspace/utils/diff.ts +130 -53
  264. package/src/modules/workspace/utils/fileTree.ts +7 -4
  265. package/src/modules/workspace/workspace.css +28 -0
  266. package/src/shared/components/Badge.tsx +62 -0
  267. package/src/shared/components/Banner.tsx +58 -0
  268. package/src/shared/components/Button.tsx +90 -0
  269. package/src/shared/components/Dialog.tsx +6 -6
  270. package/src/shared/components/Field.tsx +45 -0
  271. package/src/shared/components/IconButton.tsx +74 -0
  272. package/src/shared/components/ListRow.tsx +96 -0
  273. package/src/shared/components/Menu.tsx +88 -0
  274. package/src/shared/components/PageShell.tsx +8 -5
  275. package/src/shared/components/Surface.tsx +86 -0
  276. package/src/shared/components/__tests__/primitives.test.tsx +333 -0
  277. package/src/shared/components/index.ts +48 -0
  278. package/src/shared/components/useDismissableMenu.ts +71 -0
  279. package/src/shared/theme/__tests__/accent-contrast.test.ts +84 -0
  280. package/src/shared/theme/index.css +12 -0
  281. package/src/shared/theme/measure.ts +64 -0
  282. package/src/shared/theme/shadows.css +34 -0
  283. package/src/shared/theme/tokens.css +193 -0
  284. package/src/test-setup.ts +9 -0
  285. package/src/modules/access/components/AccessRestrictedBanner.tsx +0 -31
  286. package/src/modules/access/components/NodeOwnersBanner.tsx +0 -30
  287. package/src/modules/git/__tests__/ProtectedBranchBanner.test.tsx +0 -82
  288. package/src/modules/git/components/ProtectedBranchBanner.tsx +0 -42
  289. package/src/modules/library/__tests__/DetailDialog.test.tsx +0 -200
  290. package/src/modules/library/__tests__/diff.test.ts +0 -62
  291. package/src/modules/library/__tests__/loadout.test.tsx +0 -72
  292. package/src/modules/library/components/CompareView.tsx +0 -357
  293. package/src/modules/library/components/DetailDialog.tsx +0 -566
  294. package/src/modules/library/components/GearIcon.tsx +0 -12
  295. package/src/modules/library/components/LoadoutSidebar.tsx +0 -156
  296. package/src/modules/library/components/StatusGem.tsx +0 -21
  297. package/src/modules/library/components/SuggestChange.tsx +0 -171
  298. package/src/modules/library/components/particles.ts +0 -50
  299. package/src/modules/library/state/loadout.tsx +0 -129
  300. package/src/modules/library/utils/diff.ts +0 -102
  301. package/src/modules/pr/__tests__/PrApprovalBadge.test.tsx +0 -93
  302. package/src/modules/pr/__tests__/PrCancelButton.test.tsx +0 -158
  303. package/src/modules/pr/__tests__/PrCancelConfirmDialog.test.tsx +0 -44
  304. package/src/modules/pr/__tests__/PrMergeButton.test.tsx +0 -360
  305. package/src/modules/pr/__tests__/bucketize-comments.test.ts +0 -85
  306. package/src/modules/pr/__tests__/parsePatch.test.ts +0 -104
  307. package/src/modules/pr/__tests__/usePrViewerState.test.ts +0 -72
  308. package/src/modules/pr/components/PrApprovalBadge.tsx +0 -80
  309. package/src/modules/pr/components/PrCancelButton.tsx +0 -99
  310. package/src/modules/pr/components/PrCancelConfirmDialog.tsx +0 -119
  311. package/src/modules/pr/components/PrCommentComposer.tsx +0 -92
  312. package/src/modules/pr/components/PrCommentThread.tsx +0 -168
  313. package/src/modules/pr/components/PrCommentsPanel.tsx +0 -143
  314. package/src/modules/pr/components/PrDiffPane.tsx +0 -425
  315. package/src/modules/pr/components/PrFileRow.tsx +0 -164
  316. package/src/modules/pr/components/PrFilesList.tsx +0 -53
  317. package/src/modules/pr/components/PrHeader.tsx +0 -45
  318. package/src/modules/pr/components/PrHeaderOverflowMenu.tsx +0 -58
  319. package/src/modules/pr/components/PrMergeButton.tsx +0 -268
  320. package/src/modules/pr/components/PrMergeConfirmDialog.tsx +0 -112
  321. package/src/modules/pr/components/PrRefreshFromTargetButton.tsx +0 -110
  322. package/src/modules/pr/components/PrViewer.tsx +0 -364
  323. package/src/modules/pr/hooks/usePrViewerState.ts +0 -150
  324. package/src/modules/pr/state/pr-viewer.context.ts +0 -34
  325. package/src/modules/pr/utils/bucketize-comments.ts +0 -55
  326. package/src/modules/pr/utils/parsePatch.ts +0 -57
  327. package/src/modules/toolbar/components/AdminMenu.tsx +0 -271
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The ids tying the file tabs to the panel they control.
3
+ *
4
+ * Their own module rather than exports from `SkillFileTabs`: the two halves of
5
+ * the relationship live in different files (the tablist here, the panel in
6
+ * `SkillPage`), and a component file that also exports plain functions breaks
7
+ * fast refresh — the repo lints for it.
8
+ *
9
+ * Callers pass a `baseId` from `useId()`, so two skill pages mounted at once
10
+ * cannot mint colliding ids.
11
+ */
12
+
13
+ /**
14
+ * One tab — also what the panel names as its label.
15
+ *
16
+ * The file name is percent-encoded, and that is load-bearing rather than
17
+ * tidiness: `aria-labelledby` holds a SPACE-SEPARATED list of IDREFs, so a
18
+ * bundled file called `notes draft.md` would split the reference into two
19
+ * tokens (`…-tab-notes` and `draft.md`), neither of which names anything, and
20
+ * the panel would quietly lose its label. An `id` carrying ASCII whitespace is
21
+ * invalid besides. KB paths with spaces are ordinary here — the markdown and
22
+ * PDF renderers both handle them — so this is a reachable case, not a
23
+ * hypothetical one.
24
+ *
25
+ * `encodeURIComponent` is injective, so two different files can never collide
26
+ * on one id, and both sides of the relationship build their string through this
27
+ * function, so they cannot disagree about the encoding.
28
+ */
29
+ export const skillTabId = (baseId: string, file: string) =>
30
+ `${baseId}-tab-${encodeURIComponent(file)}`;
31
+
32
+ /** The single panel every tab controls. */
33
+ export const skillPanelId = (baseId: string) => `${baseId}-panel`;
@@ -0,0 +1,175 @@
1
+ import { useState } from 'react';
2
+ import { Link, useNavigate } from 'react-router-dom';
3
+ import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
4
+ import { Banner, Button, buttonClasses } from '../../../../shared/components';
5
+ import { useWorkspace } from '../../../workspace/state/workspace.context';
6
+ import { kbFileUrl } from '../../../workspace/routing/kb-routes';
7
+ import type { ToolSecrets } from '../../../secrets-vault/services/tool-secrets.api';
8
+ import { pathForTool } from '../../routes/library-paths';
9
+ import { toolVariableStatuses } from '../../utils/status';
10
+ import { ToolVarRow } from './ToolVarRow';
11
+
12
+ /**
13
+ * "Your connection" — what this tool still needs from you, and (if you own it)
14
+ * from you on everyone's behalf.
15
+ *
16
+ * The setup banner above the rows exists because `oauth-manual` is the one
17
+ * state the rows CANNOT explain on their own: auto-discovery found that the
18
+ * remote server wants a sign-in but couldn't register a client for it, so every
19
+ * row underneath is stuck through no fault of the person reading them. The
20
+ * banner names whose move it is — the owner's — and for the owner it links
21
+ * straight at the file they have to edit.
22
+ */
23
+
24
+ export interface ToolConnectionSectionProps {
25
+ tool: ToolSecrets;
26
+ /** A write landed — the caller refetches so the chips catch up. */
27
+ onChanged(): void;
28
+ onError(message: string): void;
29
+ }
30
+
31
+ export function ToolConnectionSection({ tool, onChanged, onError }: ToolConnectionSectionProps) {
32
+ const navigate = useNavigate();
33
+ const { kbDirName } = useWorkspace();
34
+ /** `{varName, n}` — bumping `n` opens that variable's editor from the banner. */
35
+ const [edit, setEdit] = useState<{ name: string; n: number }>({ name: '', n: 0 });
36
+
37
+ const setupKind = tool.setup?.kind ?? null;
38
+ // Not just "kind is oauth-manual": once the owner declares the provider and
39
+ // saves its secret, the same tool is a normal sign-in and the banner is noise.
40
+ // No oauth variable at all is the un-started case, so it counts as unfinished.
41
+ const setupUnfinished =
42
+ setupKind === 'oauth-manual' && !tool.variables.some((v) => v.oauth && v.adminConfigured);
43
+
44
+ /**
45
+ * The CONFIGURATION this tool is still missing, named.
46
+ *
47
+ * Only configuration gaps earn the amber banner: keys nobody has entered,
48
+ * owner-side setup nobody has finished. A pending sign-in on a fully
49
+ * configured provider is deliberately NOT here — the row right below says
50
+ * "Needs your sign-in" with its own Sign in button, and a banner repeating
51
+ * both is the same sentence twice with two identical buttons. Configuration
52
+ * is the state of the TOOL; signing in is a step each PERSON takes, and the
53
+ * row is where personal steps live.
54
+ */
55
+ const missing = toolVariableStatuses(tool).filter(
56
+ ({ v, status }) => status.state !== 'ok' && !(v.oauth && v.adminConfigured),
57
+ );
58
+
59
+ /**
60
+ * The banner's one action — the first missing key the READER can enter.
61
+ *
62
+ * Saying "Needs a key from you" and making the reader hunt for where to put
63
+ * it is a treasure map; the banner carries the shovel: the button opens (and
64
+ * scrolls to) the row's editor. An admin-scope gap for a non-writer yields
65
+ * no button, because the honest button would be "go ask someone else" —
66
+ * and an unconfigured sign-in provider is exactly that case too.
67
+ */
68
+ const actionable = missing.find(
69
+ ({ v }) => !v.oauth && (v.scope === 'user' || tool.canWrite),
70
+ );
71
+
72
+ // The aria-label carries the variable so the banner's button and the row's
73
+ // never share an accessible name — same words to the eye, distinct to a
74
+ // screen reader and to the tests.
75
+ const bannerAction = actionable ? (
76
+ <Button
77
+ variant="primary"
78
+ size="sm"
79
+ aria-label={`${actionable.v.scope === 'user' ? 'Add key' : 'Set key'}: ${
80
+ actionable.v.label ?? actionable.v.name
81
+ }`}
82
+ onClick={() => setEdit((e) => ({ name: actionable.v.name, n: e.n + 1 }))}
83
+ >
84
+ {actionable.v.scope === 'user' ? 'Add key' : 'Set key'}
85
+ </Button>
86
+ ) : null;
87
+
88
+ return (
89
+ <section className="mt-8">
90
+ <div className="mb-2.5 flex items-center justify-between gap-3">
91
+ <h2 className="text-label font-semibold uppercase text-ink-faint">Your connection</h2>
92
+ <Link to="/secrets" className={buttonClasses({ variant: 'quiet', size: 'tiny' })}>
93
+ Open Secrets
94
+ </Link>
95
+ </div>
96
+
97
+ {setupUnfinished && (
98
+ <Banner tone="wait" role="status" className="mb-2.5">
99
+ {tool.canWrite ? (
100
+ <>
101
+ Sign-in setup needed: this server needs users to sign in, but Bevel couldn't set
102
+ that up automatically. Declare the OAuth provider in the tool file, then set its
103
+ client secret below.
104
+ {tool.setup?.reason && <em className="mt-1 block">{tool.setup.reason}</em>}
105
+ {kbDirName && (
106
+ <Button
107
+ variant="quiet"
108
+ size="tiny"
109
+ className="mt-1.5"
110
+ // `rawFile` steps past the WorkspaceItemGate: this URL is
111
+ // the tool page's own canonical address, and the button
112
+ // wants the raw editor behind it.
113
+ onClick={() =>
114
+ navigate(kbFileUrl(DEFAULT_BRANCH, `${kbDirName}/${tool.path}`), {
115
+ state: { rawFile: true },
116
+ })
117
+ }
118
+ >
119
+ Edit the tool file
120
+ </Button>
121
+ )}
122
+ </>
123
+ ) : (
124
+ <>
125
+ Sign-in setup needed: ask the tool's owner to finish setting this up.
126
+ {tool.setup?.reason && <em className="mt-1 block">{tool.setup.reason}</em>}
127
+ </>
128
+ )}
129
+ </Banner>
130
+ )}
131
+
132
+ {/* Suppressed while the sign-in setup banner is up: that one names a
133
+ cause, this one would only re-list its symptoms. */}
134
+ {missing.length > 0 && !setupUnfinished && (
135
+ <Banner tone="wait" role="status" className="mb-2.5">
136
+ <div className="flex items-center gap-3">
137
+ <span className="min-w-0 flex-1">
138
+ <span className="font-semibold">
139
+ {missing.length === 1
140
+ ? 'This tool is not connected yet.'
141
+ : `This tool needs ${missing.length} things before it works.`}
142
+ </span>{' '}
143
+ <span>
144
+ {missing
145
+ .map(({ v, status }) => `${v.label ?? v.name}: ${status.text}`)
146
+ .join(' · ')}
147
+ </span>
148
+ </span>
149
+ {bannerAction && <span className="shrink-0">{bannerAction}</span>}
150
+ </div>
151
+ </Banner>
152
+ )}
153
+
154
+ {tool.variables.length === 0 ? (
155
+ <p className="text-body text-ink-muted">Nothing to set up</p>
156
+ ) : (
157
+ <div className="flex flex-col gap-1.5">
158
+ {tool.variables.map((variable) => (
159
+ <ToolVarRow
160
+ key={variable.name}
161
+ slug={tool.slug}
162
+ variable={variable}
163
+ canWrite={tool.canWrite}
164
+ setupKind={setupKind}
165
+ returnTo={pathForTool(tool.slug)}
166
+ editSignal={edit.name === variable.name ? edit.n : undefined}
167
+ onChanged={onChanged}
168
+ onError={onError}
169
+ />
170
+ ))}
171
+ </div>
172
+ )}
173
+ </section>
174
+ );
175
+ }
@@ -0,0 +1,228 @@
1
+ import { useEffect, useState, type ReactNode } from 'react';
2
+ import { Link, useNavigate, useParams } from 'react-router-dom';
3
+ import { Banner, Button, buttonClasses } from '../../../../shared/components';
4
+ import { useToolPage } from '../../hooks/useToolPage';
5
+ import { libraryHomeForItemPath, LIBRARY_ROOT } from '../../routes/library-paths';
6
+ import { readOAuthFragment } from '../../utils/oauth-fragment';
7
+ import type { ToolCapability } from '../../services/tools.api';
8
+ import type { LibrarySkillSummary } from '../../services/library.api';
9
+ import { ToolConnectionSection } from './ToolConnectionSection';
10
+ import { ToolLogo } from '../ToolLogo';
11
+
12
+ /**
13
+ * One tool, as a page.
14
+ *
15
+ * This replaces the Library dialog's integration half, and the reason it is a
16
+ * ROUTE and not a bigger dialog is the OAuth round-trip: signing in leaves the
17
+ * app entirely and comes back through the provider and our callback, which can
18
+ * only return the browser to a URL. A dialog has no URL, so the old flow could
19
+ * only ever land you back on `/connect`, away from what you were doing.
20
+ *
21
+ * Three signals gate what renders, and roles are none of them:
22
+ * - read access to the `.tool` — implied by the tool appearing in the secrets
23
+ * listing at all. Absent ⇒ the not-found state, which is deliberately the
24
+ * same state as a typo'd slug (fail-closed: a distinct "you can't see this"
25
+ * would confirm the tool exists).
26
+ * - `tool.canWrite` — the owner-side affordances, from the per-file ACL.
27
+ */
28
+ export function ToolPage({
29
+ slug: slugProp,
30
+ }: {
31
+ /**
32
+ * Provided when the page is mounted at its canonical address — the `.tool`
33
+ * file's own /workspace URL (see `WorkspaceItemGate`). Absent on the legacy
34
+ * `/skills-and-tools/tools/:slug` mount, which now only hosts the redirect
35
+ * and the OAuth return.
36
+ */
37
+ slug?: string;
38
+ } = {}) {
39
+ const { slug: rawSlug = '' } = useParams<{ slug: string }>();
40
+ const slug = slugProp ?? safeDecode(rawSlug);
41
+ const navigate = useNavigate();
42
+ const page = useToolPage(slug);
43
+
44
+ // Read ONCE, synchronously, before the strip effect below runs — an effect
45
+ // here would race the stripper and lose the outcome. Kept apart from
46
+ // `actionError` so a successful reload can't clear a callback failure.
47
+ const [oauthOutcome] = useState(readOAuthFragment);
48
+ const [actionError, setActionError] = useState<string | null>(null);
49
+
50
+ useEffect(() => {
51
+ if (oauthOutcome) window.history.replaceState(null, '', window.location.pathname);
52
+ }, [oauthOutcome]);
53
+
54
+ // Same rule as the skill page: back goes to the page the tool LIVES on —
55
+ // its group, or the personal page — never to a root the reader may not
56
+ // have come from. Falls back to the root while the tool is still loading.
57
+ const home = libraryHomeForItemPath(page.tool?.path ?? '');
58
+ const backLink = (
59
+ <Button variant="quiet" size="sm" onClick={() => navigate(home.path)}>
60
+ {`‹ ${home.label}`}
61
+ </Button>
62
+ );
63
+
64
+ if (page.loading) {
65
+ return <div className="py-16 text-center text-ui text-ink-muted">Loading…</div>;
66
+ }
67
+
68
+ if (page.error) {
69
+ return (
70
+ <Article>
71
+ {backLink}
72
+ <Banner tone="danger" role="alert" className="mt-4">
73
+ <div className="flex flex-wrap items-center gap-3">
74
+ <span>{page.error}</span>
75
+ <Button variant="outline" size="sm" onClick={page.reload}>
76
+ Try again
77
+ </Button>
78
+ </div>
79
+ </Banner>
80
+ </Article>
81
+ );
82
+ }
83
+
84
+ if (page.notFound || !page.tool) {
85
+ return (
86
+ <Article>
87
+ {backLink}
88
+ <p className="mt-4 text-label font-semibold uppercase text-ink-faint">Tool</p>
89
+ <p className="mt-2 text-body text-ink-muted">
90
+ This tool doesn't exist, or you don't have access to it.
91
+ </p>
92
+ </Article>
93
+ );
94
+ }
95
+
96
+ const tool = page.tool;
97
+
98
+ return (
99
+ <Article>
100
+ {oauthOutcome?.kind === 'authorized' && (
101
+ <Banner tone="ok" role="status" className="mb-4">
102
+ Signed in to {tool.name}.
103
+ </Banner>
104
+ )}
105
+ {oauthOutcome?.kind === 'error' && (
106
+ <Banner tone="danger" role="alert" className="mb-4">
107
+ {oauthOutcome.message}
108
+ </Banner>
109
+ )}
110
+
111
+ {backLink}
112
+
113
+ <header className="mt-4 flex items-start gap-4">
114
+ <ToolLogo slug={tool.slug} name={tool.name} size="lg" className="mt-1" />
115
+ <div className="min-w-0 flex-1">
116
+ <h1 className="text-display font-semibold text-ink">{tool.name}</h1>
117
+ {page.detail?.description && (
118
+ <p className="mt-1.5 max-w-[56ch] text-lede text-ink-muted">
119
+ {page.detail.description}
120
+ </p>
121
+ )}
122
+ </div>
123
+ {/* No `Manage access` here, deliberately. Access is decided at the
124
+ GROUP — a tool inherits its folder's `access.md`, so an editor on
125
+ this page would either duplicate the group's one or quietly write a
126
+ per-file override that nobody looking at the group would see. The
127
+ group's `Share` panel is the single place. */}
128
+ </header>
129
+
130
+ {actionError && (
131
+ <Banner tone="danger" role="alert" className="mt-4">
132
+ {actionError}
133
+ </Banner>
134
+ )}
135
+
136
+ <ToolConnectionSection
137
+ tool={tool}
138
+ onChanged={() => {
139
+ setActionError(null);
140
+ page.reload();
141
+ }}
142
+ onError={setActionError}
143
+ />
144
+
145
+ {page.detail && page.detail.capabilities.length > 0 && (
146
+ <CapabilitiesSection capabilities={page.detail.capabilities} />
147
+ )}
148
+
149
+ <PoweredSkillsSection skills={page.poweredSkills} loaded={page.skillsLoaded} />
150
+
151
+ <div className="mt-6 border-t border-line pt-3 text-detail text-ink-faint">
152
+ Managed by the Admins.
153
+ </div>
154
+
155
+ </Article>
156
+ );
157
+ }
158
+
159
+ /**
160
+ * The reading column. Horizontal and vertical padding come from the Library
161
+ * layout's `<main>`, which already wraps every page under `/skills-and-tools` —
162
+ * repeating them here would double the gutter.
163
+ */
164
+ function Article({ children }: { children: ReactNode }) {
165
+ return <article className="mx-auto w-full max-w-3xl">{children}</article>;
166
+ }
167
+
168
+ function SectionHeading({ children }: { children: ReactNode }) {
169
+ return <h2 className="mb-2.5 text-label font-semibold uppercase text-ink-faint">{children}</h2>;
170
+ }
171
+
172
+ function CapabilitiesSection({ capabilities }: { capabilities: ToolCapability[] }) {
173
+ return (
174
+ <section className="mt-8">
175
+ <SectionHeading>What it lets the assistant do</SectionHeading>
176
+ <ul>
177
+ {capabilities.map((c) => (
178
+ <li key={c.name} className="text-body text-ink-muted">
179
+ · {c.description ?? c.name}
180
+ </li>
181
+ ))}
182
+ </ul>
183
+ </section>
184
+ );
185
+ }
186
+
187
+ /**
188
+ * The reverse index. `loaded` is not cosmetic: the skill catalog degrades to
189
+ * `[]` on failure, so rendering "No skills use this yet." before it settles
190
+ * would state as fact something we simply don't know.
191
+ */
192
+ function PoweredSkillsSection({
193
+ skills,
194
+ loaded,
195
+ }: {
196
+ skills: LibrarySkillSummary[];
197
+ loaded: boolean;
198
+ }) {
199
+ return (
200
+ <section className="mt-8">
201
+ <SectionHeading>Powers these skills</SectionHeading>
202
+ {!loaded ? null : skills.length === 0 ? (
203
+ <p className="text-detail text-ink-muted">No skills use this yet.</p>
204
+ ) : (
205
+ <div className="flex flex-wrap gap-1.5">
206
+ {skills.map((s) => (
207
+ <Link
208
+ key={s.name}
209
+ to={`${LIBRARY_ROOT}/skills/${encodeURIComponent(s.name)}`}
210
+ className={buttonClasses({ variant: 'outline', size: 'tiny' })}
211
+ >
212
+ {s.name}
213
+ </Link>
214
+ ))}
215
+ </div>
216
+ )}
217
+ </section>
218
+ );
219
+ }
220
+
221
+ /** A malformed escape is a bad link, not a crash — fall back to the raw segment. */
222
+ function safeDecode(raw: string): string {
223
+ try {
224
+ return decodeURIComponent(raw);
225
+ } catch {
226
+ return raw;
227
+ }
228
+ }
@@ -0,0 +1,45 @@
1
+ import { Button, Dialog } from '../../../../shared/components';
2
+
3
+ /**
4
+ * SEAM (Ali) — the tool's share panel.
5
+ *
6
+ * This is the SHELL only. The F-lens contents (Access / People / Link-access
7
+ * sections and the admin fork in the footer) are Ali's work and replace the
8
+ * `tool-share-panel-body` placeholder below.
9
+ *
10
+ * Frozen by the master plan — do not rename, move, or change the shape:
11
+ * path `modules/library/components/tool-page/ToolSharePanel.tsx`
12
+ * props { open, tool: { slug, name, path }, onClose }
13
+ * title `Share tool`
14
+ * body <div data-testid="tool-share-panel-body" />
15
+ *
16
+ * `tool` carries `slug` and `path` even though the shell renders neither: the
17
+ * contents need the slug for the API and the repo path for the access file, and
18
+ * changing the prop later would break the one thing this seam exists to avoid.
19
+ */
20
+
21
+ export interface ToolSharePanelProps {
22
+ open: boolean;
23
+ tool: { slug: string; name: string; path: string };
24
+ onClose(): void;
25
+ }
26
+
27
+ export function ToolSharePanel({ open, tool, onClose }: ToolSharePanelProps) {
28
+ return (
29
+ <Dialog
30
+ open={open}
31
+ onClose={onClose}
32
+ title="Share tool"
33
+ footer={
34
+ <Button variant="outline" onClick={onClose}>
35
+ Done
36
+ </Button>
37
+ }
38
+ >
39
+ <p className="text-body text-ink-muted">
40
+ Access, ownership, and roles for <strong>{tool.name}</strong>.
41
+ </p>
42
+ <div data-testid="tool-share-panel-body" />
43
+ </Dialog>
44
+ );
45
+ }