@bevel-software/platform-core-frontend 0.14.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +2 -2
- package/package.json +3 -3
- package/src/core/CoreAppShell.tsx +34 -26
- package/src/core/__tests__/AppChrome.test.tsx +0 -3
- package/src/core/__tests__/bootstrap.test.ts +33 -1
- package/src/core/__tests__/events.test.ts +43 -0
- package/src/core/bootstrap.ts +38 -1
- package/src/core/events.ts +85 -3
- package/src/core/registry.ts +1 -1
- package/src/lib/__tests__/api.test.ts +38 -0
- package/src/lib/__tests__/email.test.ts +44 -0
- package/src/lib/api.ts +19 -2
- package/src/lib/email.ts +37 -1
- package/src/lib/utils.ts +2 -0
- package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
- package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
- package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
- package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
- package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
- package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +781 -76
- package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
- package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
- package/src/modules/access/__tests__/plugin-token.test.ts +21 -0
- package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
- package/src/modules/access/api.ts +192 -10
- package/src/modules/access/components/ManageAccessDialog.tsx +1337 -570
- package/src/modules/access/manage-access-affordance.ts +17 -0
- package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
- package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
- package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
- package/src/modules/admin/__tests__/ConnectionKeysPage.test.tsx +266 -0
- package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
- package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
- package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
- package/src/modules/admin/components/AddMemberInput.tsx +268 -0
- package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
- package/src/modules/admin/components/ConnectionKeysPage.tsx +269 -0
- package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
- package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
- package/src/modules/admin/components/connection-keys-grouping.ts +43 -0
- package/src/modules/admin/components/group-members-path.ts +32 -0
- package/src/modules/admin/services/connection-keys.api.ts +47 -0
- package/src/modules/admin/services/roles.api.ts +12 -1
- package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
- package/src/modules/auth/components/AccountPage.tsx +73 -54
- package/src/modules/auth/components/LoginScreen.tsx +1 -0
- package/src/modules/auth/services/account.api.ts +78 -4
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
- package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
- package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
- package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
- package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
- package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
- package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
- package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
- package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
- package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
- package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
- package/src/modules/change-requests/services/change-requests.api.ts +57 -1
- package/src/modules/change-requests/services/denied-file.api.ts +53 -0
- package/src/modules/change-requests/services/propose.api.ts +97 -8
- package/src/modules/change-requests/utils/approval.ts +15 -0
- package/src/modules/change-requests/utils/author.ts +32 -0
- package/src/modules/change-requests/utils/readFailure.ts +110 -0
- package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
- package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +65 -1
- package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
- package/src/modules/git/components/GitSyncFailedBanner.tsx +68 -5
- package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
- package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
- package/src/modules/git/services/error-messages.ts +12 -0
- package/src/modules/git/services/pr-prompts.ts +5 -5
- package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
- package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
- package/src/modules/layout/components/AppLayout.tsx +2 -0
- package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
- package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
- package/src/modules/layout/components/SidebarFrame.tsx +109 -4
- package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
- package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
- package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
- package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +104 -99
- package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +136 -0
- package/src/modules/library/__tests__/LockedPluginView.test.tsx +103 -7
- package/src/modules/library/__tests__/NewPluginDialog.test.tsx +18 -8
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
- package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
- package/src/modules/library/__tests__/PluginExtras.test.tsx +115 -9
- package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
- package/src/modules/library/__tests__/PluginPage.test.tsx +453 -7
- package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +17 -57
- package/src/modules/library/__tests__/PluginsSidebar.test.tsx +161 -97
- package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
- package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +391 -78
- package/src/modules/library/__tests__/SkillsTree.test.tsx +461 -0
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
- package/src/modules/library/__tests__/ToolPage.test.tsx +94 -4
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +279 -21
- package/src/modules/library/__tests__/auth-harness.tsx +9 -9
- package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
- package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
- package/src/modules/library/__tests__/library-data.stale.test.tsx +183 -0
- package/src/modules/library/__tests__/library-data.test.ts +7 -0
- package/src/modules/library/__tests__/library-paths.test.ts +75 -0
- package/src/modules/library/__tests__/link-membership.test.ts +129 -0
- package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
- package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
- package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
- package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
- package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
- package/src/modules/library/__tests__/plugin-summary.test.ts +67 -0
- package/src/modules/library/__tests__/status.test.ts +82 -2
- package/src/modules/library/__tests__/tools.api.test.ts +44 -1
- package/src/modules/library/__tests__/useJoinRequests.test.tsx +46 -0
- package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
- package/src/modules/library/components/AddDialogTabs.tsx +103 -0
- package/src/modules/library/components/AddToPluginDialog.tsx +107 -18
- package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
- package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
- package/src/modules/library/components/LibraryCard.tsx +149 -34
- package/src/modules/library/components/LibraryLayout.tsx +120 -247
- package/src/modules/library/components/LibraryPage.tsx +172 -39
- package/src/modules/library/components/LinkSkillPanel.tsx +169 -0
- package/src/modules/library/components/LockedPluginView.tsx +63 -35
- package/src/modules/library/components/NameWithBadges.tsx +164 -0
- package/src/modules/library/components/NewPluginDialog.tsx +19 -5
- package/src/modules/library/components/PageActions.tsx +31 -9
- package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
- package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
- package/src/modules/library/components/PersonalPluginPage.tsx +123 -23
- package/src/modules/library/components/PluginExtras.tsx +143 -18
- package/src/modules/library/components/PluginIndexRow.tsx +47 -12
- package/src/modules/library/components/PluginPage.tsx +234 -38
- package/src/modules/library/components/PluginRows.tsx +286 -0
- package/src/modules/library/components/PluginsSidebar.tsx +271 -238
- package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
- package/src/modules/library/components/RenamePluginDialog.tsx +136 -0
- package/src/modules/library/components/ShareButton.tsx +17 -0
- package/src/modules/library/components/SkillsTree.tsx +204 -0
- package/src/modules/library/components/StatusDot.tsx +1 -0
- package/src/modules/library/components/TeamRoute.tsx +15 -0
- package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
- package/src/modules/library/components/plugin-page-parts.tsx +132 -23
- package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +212 -0
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +337 -121
- package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
- package/src/modules/library/components/tool-page/ToolPage.tsx +116 -17
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
- package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
- package/src/modules/library/hooks/useJoinRequests.ts +48 -18
- package/src/modules/library/hooks/useLibraryData.ts +92 -19
- package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +229 -82
- package/src/modules/library/routes/library-paths.ts +46 -35
- package/src/modules/library/services/library.api.ts +89 -17
- package/src/modules/library/services/plugins.api.ts +161 -9
- package/src/modules/library/services/teams.api.ts +15 -0
- package/src/modules/library/services/tools.api.ts +78 -0
- package/src/modules/library/state/library-data.tsx +268 -37
- package/src/modules/library/utils/personal-plugin.ts +13 -15
- package/src/modules/library/utils/plugin-entries.ts +134 -0
- package/src/modules/library/utils/plugin-summary.ts +102 -0
- package/src/modules/library/utils/status.ts +204 -35
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +11 -3
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
- package/src/modules/onboarding/agent-clients.ts +55 -23
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
- package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
- package/src/modules/pr/services/pr-merge.api.ts +2 -1
- package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
- package/src/modules/review/components/ReviewPanel.tsx +15 -17
- package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
- package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
- package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
- package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
- package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
- package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
- package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
- package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
- package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
- package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
- package/src/modules/secrets-vault/services/connect.api.ts +36 -5
- package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
- package/src/modules/settings/components/ClaudeConnectionCard.tsx +154 -0
- package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
- package/src/modules/settings/components/DeploymentPage.tsx +16 -22
- package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
- package/src/modules/settings/components/__tests__/ClaudeConnectionCard.test.tsx +63 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +74 -1
- package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
- package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +5 -5
- package/src/modules/settings/services/github-facade.api.ts +66 -0
- package/src/modules/settings/settings-nav-items.tsx +10 -2
- package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
- package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
- package/src/modules/setup/__tests__/setup.test.tsx +615 -4
- package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
- package/src/modules/setup/components/SetupGate.tsx +16 -16
- package/src/modules/setup/components/SetupScreen.tsx +711 -40
- package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +218 -3
- package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
- package/src/modules/setup/utils/root-folders.ts +46 -0
- package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
- package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
- package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
- package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
- package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +395 -124
- package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
- package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
- package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +659 -36
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
- package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
- package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
- package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
- package/src/modules/toolbar/components/deployment-address.ts +29 -0
- package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
- package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
- package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
- package/src/modules/toolbar/services/external-api-keys.api.ts +8 -0
- package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
- package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
- package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
- package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
- package/src/modules/workflow/state/event-bus.context.ts +10 -0
- package/src/modules/workspace/__tests__/testFixtures.ts +6 -3
- package/src/modules/workspace/components/FileExplorer.tsx +1527 -367
- package/src/modules/workspace/components/FileRoute.tsx +376 -22
- package/src/modules/workspace/components/FileViewer.tsx +166 -45
- package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
- package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
- package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2473 -129
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +768 -16
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +332 -12
- package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
- package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
- package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
- package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
- package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
- package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
- package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
- package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
- package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
- package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
- package/src/modules/workspace/components/renderers/index.ts +53 -2
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
- package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
- package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
- package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
- package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
- package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
- package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +89 -0
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +438 -66
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
- package/src/modules/workspace/routing/kb-routes.ts +207 -30
- package/src/modules/workspace/services/__tests__/workspace.api.test.ts +57 -1
- package/src/modules/workspace/services/workspace.api.ts +57 -4
- package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
- package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
- package/src/modules/workspace/state/open-change-requests.tsx +100 -12
- package/src/modules/workspace/state/workspace.context.ts +130 -16
- package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +234 -5
- package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
- package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
- package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
- package/src/modules/workspace/utils/file-trace.ts +50 -0
- package/src/modules/workspace/utils/fileTree.ts +126 -52
- package/src/modules/workspace/utils/frontmatter.ts +8 -4
- package/src/modules/workspace/utils/pasteLink.ts +90 -0
- package/src/modules/workspace/utils/treeConfirm.ts +338 -0
- package/src/modules/workspace/utils/uploadError.ts +29 -0
- package/src/shared/__tests__/marketplace-url.test.ts +59 -0
- package/src/shared/components/Badge.tsx +3 -1
- package/src/shared/components/Banner.tsx +5 -1
- package/src/shared/components/Button.tsx +16 -2
- package/src/shared/components/Dialog.tsx +27 -11
- package/src/shared/components/Menu.tsx +13 -1
- package/src/shared/components/PageShell.tsx +13 -8
- package/src/shared/components/__tests__/primitives.test.tsx +116 -2
- package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
- package/src/shared/components/index.ts +2 -0
- package/src/shared/components/useDismissableMenu.ts +32 -10
- package/src/shared/components/useFocusHandoff.ts +51 -0
- package/src/shared/components/useLatestRef.ts +28 -0
- package/src/shared/markdown/Markdown.tsx +12 -3
- package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
- package/src/shared/markdown/hrefs.ts +50 -0
- package/src/shared/marketplace-url.ts +118 -0
- package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
- package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
- package/src/shared/mcp/connect-snippets.ts +14 -9
- package/src/shared/mcp/index.ts +1 -1
- package/src/shared/theme/__tests__/header-band.test.ts +197 -0
- package/src/shared/theme/header.ts +75 -0
- package/src/shared/theme/measure.ts +7 -4
- package/src/shared/theme/tokens.css +34 -0
- package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
- package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
- package/src/modules/library/components/PluginsIndexPage.tsx +0 -265
- package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
- package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
- package/src/modules/update-check/services/update-check.api.ts +0 -24
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
SIDEBAR_DRAWER_WIDTH,
|
|
6
6
|
SidebarFrame,
|
|
7
7
|
} from '../components/SidebarFrame';
|
|
8
|
+
import { SIDEBAR_HEADER_TESTID } from '../../../shared/theme/header';
|
|
8
9
|
import {
|
|
9
10
|
SIDEBAR_DEFAULT_WIDTH,
|
|
10
11
|
setSidebarCollapsed,
|
|
@@ -59,6 +60,66 @@ beforeEach(() => {
|
|
|
59
60
|
setSidebarWidth(SIDEBAR_DEFAULT_WIDTH);
|
|
60
61
|
});
|
|
61
62
|
|
|
63
|
+
describe('SidebarFrame: slots', () => {
|
|
64
|
+
it('pins the header above and the footer below whatever the surface holds, inside the one nav column', () => {
|
|
65
|
+
const { container } = render(
|
|
66
|
+
<SidebarFrame label="Library plugins" header={<div>pill</div>} footer={<div>dock</div>}>
|
|
67
|
+
<button type="button">Engineering</button>
|
|
68
|
+
</SidebarFrame>,
|
|
69
|
+
);
|
|
70
|
+
const aside = container.querySelector('aside') as HTMLElement;
|
|
71
|
+
const pill = screen.getByText('pill');
|
|
72
|
+
const row = screen.getByRole('button', { name: 'Engineering' });
|
|
73
|
+
const dock = screen.getByText('dock');
|
|
74
|
+
expect(aside).toContainElement(pill);
|
|
75
|
+
expect(aside).toContainElement(dock);
|
|
76
|
+
// One column, three siblings in it: the header band, the contents, the
|
|
77
|
+
// footer group. Each end slot has exactly one wrapper and for its own
|
|
78
|
+
// reason — the header's is the shared band, the row that has to be the
|
|
79
|
+
// same height as the page's title bar beside it; the footer's is the one
|
|
80
|
+
// slot holding more than one row, so something has to space them. The
|
|
81
|
+
// contents sit between them with no wrapper at all, and all three line up
|
|
82
|
+
// because they are siblings in the same column.
|
|
83
|
+
const band = screen.getByTestId(SIDEBAR_HEADER_TESTID);
|
|
84
|
+
expect(band).toContainElement(pill);
|
|
85
|
+
expect(band.parentElement).toBe(row.parentElement);
|
|
86
|
+
const group = dock.parentElement as HTMLElement;
|
|
87
|
+
expect(group).toHaveAttribute('data-sidebar-footer');
|
|
88
|
+
expect(group.parentElement).toBe(row.parentElement);
|
|
89
|
+
expect(pill.compareDocumentPosition(row) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
|
90
|
+
expect(row.compareDocumentPosition(dock) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('mounts no footer group for a surface that passes no footer', () => {
|
|
94
|
+
const { container } = render(
|
|
95
|
+
<SidebarFrame label="Settings">
|
|
96
|
+
<button type="button">General</button>
|
|
97
|
+
</SidebarFrame>,
|
|
98
|
+
);
|
|
99
|
+
expect(container.querySelector('[data-sidebar-footer]')).toBeNull();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Both footer rows decide for themselves whether they have anything to say,
|
|
104
|
+
* and on the ordinary day neither does. The group cannot learn that from
|
|
105
|
+
* React — an element that renders null is still an element — so it is read
|
|
106
|
+
* off the DOM, and `empty:hidden` is what turns "no children" into no rule
|
|
107
|
+
* and no space. Without it every sidebar in the app carries a stray
|
|
108
|
+
* hairline and 16px of dead air at the bottom.
|
|
109
|
+
*/
|
|
110
|
+
it('hides the footer group, rule and all, once its rows render nothing', () => {
|
|
111
|
+
const Nothing = () => null;
|
|
112
|
+
const { container } = render(
|
|
113
|
+
<SidebarFrame label="Library plugins" footer={<Nothing />}>
|
|
114
|
+
<button type="button">Engineering</button>
|
|
115
|
+
</SidebarFrame>,
|
|
116
|
+
);
|
|
117
|
+
const group = container.querySelector('[data-sidebar-footer]') as HTMLElement;
|
|
118
|
+
expect(group).toBeEmptyDOMElement();
|
|
119
|
+
expect(group).toHaveClass('empty:hidden');
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
62
123
|
describe('SidebarFrame: narrow viewport', () => {
|
|
63
124
|
it('starts collapsed and genuinely removes the sidebar from interaction', () => {
|
|
64
125
|
setViewportWidth(375);
|
|
@@ -23,6 +23,8 @@ interface AppLayoutProps {
|
|
|
23
23
|
* `SidebarFrame`'s `header`.
|
|
24
24
|
*/
|
|
25
25
|
sidebarHeader?: ReactNode;
|
|
26
|
+
/** Pinned below the sidebar's content — see `SidebarFrame`'s `footer`. */
|
|
27
|
+
sidebarFooter?: ReactNode;
|
|
26
28
|
// Legacy named slots, kept as a convenience/compat signature.
|
|
27
29
|
explorer?: ReactNode;
|
|
28
30
|
viewer?: ReactNode;
|
|
@@ -18,6 +18,8 @@ interface MobileChatLayoutProps {
|
|
|
18
18
|
onController?: (controller: LayoutController | null) => void;
|
|
19
19
|
/** Pinned above the explorer contents inside the shared sidebar frame. */
|
|
20
20
|
sidebarHeader?: ReactNode;
|
|
21
|
+
/** Pinned below them — see `SidebarFrame`'s `footer`. */
|
|
22
|
+
sidebarFooter?: ReactNode;
|
|
21
23
|
/**
|
|
22
24
|
* Registry-driven pane list (preferred). This layout is chat-first, so it
|
|
23
25
|
* picks the well-known 'explorer' / 'viewer' / 'chat' panes out of the
|
|
@@ -44,6 +46,7 @@ export function MobileChatLayout({
|
|
|
44
46
|
panes,
|
|
45
47
|
onController,
|
|
46
48
|
sidebarHeader,
|
|
49
|
+
sidebarFooter,
|
|
47
50
|
explorer: explorerSlot,
|
|
48
51
|
viewer: viewerSlot,
|
|
49
52
|
chat: chatSlot,
|
|
@@ -114,7 +117,7 @@ export function MobileChatLayout({
|
|
|
114
117
|
</div>
|
|
115
118
|
</div>
|
|
116
119
|
|
|
117
|
-
<SidebarFrame label="File explorer" header={sidebarHeader}>
|
|
120
|
+
<SidebarFrame label="File explorer" header={sidebarHeader} footer={sidebarFooter}>
|
|
118
121
|
{explorer}
|
|
119
122
|
</SidebarFrame>
|
|
120
123
|
|
|
@@ -53,6 +53,8 @@ interface ResizableThreePaneLayoutProps {
|
|
|
53
53
|
* see `SidebarFrame`'s `header`.
|
|
54
54
|
*/
|
|
55
55
|
sidebarHeader?: ReactNode;
|
|
56
|
+
/** Pinned below the sidebar pane's own content — see `SidebarFrame`'s `footer`. */
|
|
57
|
+
sidebarFooter?: ReactNode;
|
|
56
58
|
// Legacy named slots, kept as a convenience/compat signature (converted to
|
|
57
59
|
// the same pane list internally with the historical sizing defaults).
|
|
58
60
|
explorer?: ReactNode;
|
|
@@ -65,6 +67,7 @@ export function ResizableThreePaneLayout({
|
|
|
65
67
|
panes,
|
|
66
68
|
onController,
|
|
67
69
|
sidebarHeader,
|
|
70
|
+
sidebarFooter,
|
|
68
71
|
explorer,
|
|
69
72
|
viewer,
|
|
70
73
|
chat,
|
|
@@ -199,7 +202,7 @@ export function ResizableThreePaneLayout({
|
|
|
199
202
|
{header}
|
|
200
203
|
<div className="flex flex-1 min-h-0">
|
|
201
204
|
{sidebarPane && (
|
|
202
|
-
<SidebarFrame label="File explorer" header={sidebarHeader}>
|
|
205
|
+
<SidebarFrame label="File explorer" header={sidebarHeader} footer={sidebarFooter}>
|
|
203
206
|
{sidebarPane.node}
|
|
204
207
|
</SidebarFrame>
|
|
205
208
|
)}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { useMediaQuery } from '../hooks/useMediaQuery';
|
|
14
14
|
import { NARROW_QUERY } from '../breakpoints';
|
|
15
15
|
import { useModalLayer } from '../../../shared/components/useModalLayer';
|
|
16
|
+
import { HEADER_BAND, HEADER_COLUMN_TOP, SIDEBAR_HEADER_TESTID } from '../../../shared/theme/header';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* The `aria-controls` target for the top bar's toggle, which renders in a
|
|
@@ -29,6 +30,61 @@ export const SIDEBAR_DRAWER_MAX_WIDTH = '24rem';
|
|
|
29
30
|
const FOCUSABLE_SELECTOR =
|
|
30
31
|
'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
31
32
|
|
|
33
|
+
/**
|
|
34
|
+
* The sidebar's ROW GRID — the horizontal inset every row in this column sits
|
|
35
|
+
* on, the tree rows above and the footer rows below alike (proto:684-693,
|
|
36
|
+
* `FileExplorer`'s `ROW_CLASS`, `PluginsSidebar`'s `rowClass`).
|
|
37
|
+
*
|
|
38
|
+
* Exported because "the same inset" only holds if it is ONE declaration. It
|
|
39
|
+
* was several, and the two rows at the bottom of the column drifted off it —
|
|
40
|
+
* the change-request dock sat 4px right of the tree it hangs under, which is
|
|
41
|
+
* the sort of thing nobody can name and everybody can see.
|
|
42
|
+
*/
|
|
43
|
+
export const SIDEBAR_ROW_INSET = 'px-2.5';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* How far a change request's content sits inside its row, so that it starts
|
|
47
|
+
* under the word "Change" in the CHANGE REQUESTS header above it: that row's
|
|
48
|
+
* own caret slot (`w-3`, 12px) plus its own gap (`gap-[7px]`), both in
|
|
49
|
+
* `git/components/PullRequestsForMe`. The two numbers are the header's, and
|
|
50
|
+
* this constant is only correct for children of THAT row — a parent with a
|
|
51
|
+
* different caret would need its own.
|
|
52
|
+
*
|
|
53
|
+
* It is emphatically NOT the tree's indent. `FileExplorer` spends a wider
|
|
54
|
+
* caret (`w-3.5`) and a narrower gap (`gap-1.5`), and steps its children by
|
|
55
|
+
* `10 + depth * 13` (proto:3561), which is a depth ladder rather than an
|
|
56
|
+
* alignment — a file there does not start under its folder's name and is not
|
|
57
|
+
* trying to. Only the horizontal INSET (`SIDEBAR_ROW_INSET`) is shared by
|
|
58
|
+
* both; what a row does inside that inset is its own.
|
|
59
|
+
*
|
|
60
|
+
* An indent INSIDE the row, deliberately, rather than a larger inset written
|
|
61
|
+
* instead of it. The row still carries `SIDEBAR_ROW_INSET` and so still moves
|
|
62
|
+
* with the grid — whereas one value holding the inset and the indent added
|
|
63
|
+
* together would keep its own counsel the day the inset changes, and the
|
|
64
|
+
* child rows would drift off the header that moved without them. It also
|
|
65
|
+
* keeps the row spanning the full column, hover and focus ring included.
|
|
66
|
+
*/
|
|
67
|
+
export const SIDEBAR_CHILD_INDENT = 'pl-[19px]';
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The footer group's geometry: one hairline off whatever the surface was
|
|
71
|
+
* holding, then its rows on the sidebar's own vertical rhythm.
|
|
72
|
+
*
|
|
73
|
+
* It lives HERE rather than on the rows because nowhere else knows all of
|
|
74
|
+
* them. The rows arrive through the `footer` slot from different modules —
|
|
75
|
+
* the Library's setup reminder, the change-request dock — and each bringing a
|
|
76
|
+
* margin and a border of its own is precisely how they ended up pressed
|
|
77
|
+
* together under two hairlines with no gap between them.
|
|
78
|
+
*
|
|
79
|
+
* `empty:hidden` is load-bearing. Both rows decide for THEMSELVES whether
|
|
80
|
+
* they have anything to say (nothing needs setup; nothing is waiting on you),
|
|
81
|
+
* and on the ordinary day both render nothing. React cannot tell the slot
|
|
82
|
+
* that — an element that renders null is still an element — so the emptiness
|
|
83
|
+
* is read off the DOM instead: no children, no rule, no space.
|
|
84
|
+
*/
|
|
85
|
+
const SIDEBAR_FOOTER_SLOT =
|
|
86
|
+
'mt-2 flex flex-none flex-col gap-1.5 border-t border-line pt-2 empty:hidden';
|
|
87
|
+
|
|
32
88
|
/**
|
|
33
89
|
* The app's nav spine — the prototype's `.side` + `.resizer` + `.side-inner`
|
|
34
90
|
* (proto:85-104, proto:4328-4370).
|
|
@@ -55,9 +111,10 @@ export function SidebarFrame({
|
|
|
55
111
|
children,
|
|
56
112
|
label,
|
|
57
113
|
header,
|
|
114
|
+
footer,
|
|
58
115
|
}: {
|
|
59
116
|
children: ReactNode;
|
|
60
|
-
/** Names the region and its resize handle, e.g. `Library
|
|
117
|
+
/** Names the region and its resize handle, e.g. `Library navigation`. */
|
|
61
118
|
label: string;
|
|
62
119
|
/**
|
|
63
120
|
* Pinned above `children`, outside whatever list the surface is holding.
|
|
@@ -70,6 +127,20 @@ export function SidebarFrame({
|
|
|
70
127
|
* not know that, and the next thing to go there costs no edit here.
|
|
71
128
|
*/
|
|
72
129
|
header?: ReactNode;
|
|
130
|
+
/**
|
|
131
|
+
* Pinned below `children`, outside whatever list the surface is holding —
|
|
132
|
+
* the same slot as `header`, at the other end. Both surfaces pass the
|
|
133
|
+
* change-request dock, which is what makes it one queue in one place
|
|
134
|
+
* across Knowledge and Skills & Tools; the frame does not know that.
|
|
135
|
+
*
|
|
136
|
+
* Unlike `header` this slot is a GROUP: it is the one end of the column
|
|
137
|
+
* that holds more than one thing, so the frame draws the rule above it and
|
|
138
|
+
* spaces whatever is inside it (`SIDEBAR_FOOTER_SLOT`). What the rows must
|
|
139
|
+
* still bring themselves is the inset — `SIDEBAR_ROW_INSET`, on the row
|
|
140
|
+
* rather than on the group, so a row's hover and focus still span the full
|
|
141
|
+
* column the way a tree row's does.
|
|
142
|
+
*/
|
|
143
|
+
footer?: ReactNode;
|
|
73
144
|
}) {
|
|
74
145
|
// `narrow` comes off the store rather than straight off `viewportNarrow`
|
|
75
146
|
// below, because the store is where it lands in the same write as
|
|
@@ -269,16 +340,50 @@ export function SidebarFrame({
|
|
|
269
340
|
}}
|
|
270
341
|
>
|
|
271
342
|
{/* proto:104 — `padding:16px 14px 18px`, and an explicit width so the
|
|
272
|
-
column does not reflow while the frame animates to zero.
|
|
343
|
+
column does not reflow while the frame animates to zero.
|
|
344
|
+
|
|
345
|
+
The prototype's 16px TOP is the one number of the three that did
|
|
346
|
+
not survive: it used to stand in for half of the sidebar header
|
|
347
|
+
row's height, with the slot's own content supplying the rest, and
|
|
348
|
+
a height nobody could name is a height the page beside it could
|
|
349
|
+
not match. `HEADER_COLUMN_TOP` replaces it with 12px — the offset
|
|
350
|
+
the page column already opened on — and the band below is the
|
|
351
|
+
same height on both sides, which is what puts the two rows on one
|
|
352
|
+
line. */}
|
|
273
353
|
<div
|
|
274
|
-
|
|
354
|
+
// Named, because it is where the sidebar's row grid starts: every
|
|
355
|
+
// row's inset is this padding plus its own, and the test that holds
|
|
356
|
+
// the footer rows on that grid needs to know where to stop adding.
|
|
357
|
+
data-sidebar-column
|
|
358
|
+
className={cn('flex h-full flex-col px-3.5 pb-[18px]', HEADER_COLUMN_TOP)}
|
|
275
359
|
style={{
|
|
276
360
|
width: narrow ? SIDEBAR_DRAWER_WIDTH : width,
|
|
277
361
|
maxWidth: narrow ? SIDEBAR_DRAWER_MAX_WIDTH : undefined,
|
|
278
362
|
}}
|
|
279
363
|
>
|
|
280
|
-
{header
|
|
364
|
+
{/* The sidebar's header row, on the shared band — the left half of
|
|
365
|
+
the seam under the toolbar; the page's title bar is the right
|
|
366
|
+
half.
|
|
367
|
+
|
|
368
|
+
Keyed on whether the surface DECLARED a header, not on whether
|
|
369
|
+
that header drew anything. Knowledge and the Library both pass
|
|
370
|
+
the connect-your-agent pill, which renders nothing once
|
|
371
|
+
onboarding is done; if the row went with it, finishing setup
|
|
372
|
+
would pull the nav up by the band's height and leave the page's
|
|
373
|
+
title bar aligned to nothing. Settings passes no header at all
|
|
374
|
+
and gets no band, because it has no title bar on the other side
|
|
375
|
+
of the seam to hold a line with. */}
|
|
376
|
+
{header !== undefined && (
|
|
377
|
+
<div data-testid={SIDEBAR_HEADER_TESTID} className={cn(HEADER_BAND, 'w-full')}>
|
|
378
|
+
{header}
|
|
379
|
+
</div>
|
|
380
|
+
)}
|
|
281
381
|
{children}
|
|
382
|
+
{footer && (
|
|
383
|
+
<div data-sidebar-footer className={SIDEBAR_FOOTER_SLOT}>
|
|
384
|
+
{footer}
|
|
385
|
+
</div>
|
|
386
|
+
)}
|
|
282
387
|
</div>
|
|
283
388
|
</aside>
|
|
284
389
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
2
|
import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
|
|
3
|
-
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
|
3
|
+
import { render, screen, fireEvent, waitFor, within } from '@testing-library/react';
|
|
4
4
|
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
|
|
5
5
|
import {
|
|
6
6
|
WorkspaceContext,
|
|
@@ -250,10 +250,13 @@ describe('AddToPluginDialog: starting an empty SKILL.md', () => {
|
|
|
250
250
|
describe('AddToPluginDialog for an admin non-writer', () => {
|
|
251
251
|
it('offers the same dialog, and tells the truth about review', () => {
|
|
252
252
|
renderDialog('knowledge-base', false);
|
|
253
|
+
// Both clauses also appear on the hidden Tools panel, so this is scoped to
|
|
254
|
+
// the panel actually on screen.
|
|
255
|
+
const skills = within(screen.getByRole('tabpanel'));
|
|
253
256
|
expect(
|
|
254
|
-
|
|
257
|
+
skills.getByText(/goes to GTM as a change request, and an owner reviews it/),
|
|
255
258
|
).toBeInTheDocument();
|
|
256
|
-
expect(
|
|
259
|
+
expect(skills.getByText(/send it to the plugin as a change request/)).toBeInTheDocument();
|
|
257
260
|
expect(screen.queryByText(/no review step/)).not.toBeInTheDocument();
|
|
258
261
|
});
|
|
259
262
|
|
|
@@ -306,8 +309,171 @@ describe('AddToPluginDialog for a non-admin', () => {
|
|
|
306
309
|
|
|
307
310
|
expect(screen.queryByText('Start an empty SKILL.md')).not.toBeInTheDocument();
|
|
308
311
|
expect(screen.queryByRole('textbox', { name: 'Skill name' })).not.toBeInTheDocument();
|
|
309
|
-
|
|
310
|
-
expect(
|
|
312
|
+
const skills = within(screen.getByRole('tabpanel'));
|
|
313
|
+
expect(skills.getByText(/change request for an owner to review/)).toBeInTheDocument();
|
|
314
|
+
expect(skills.getByText(/send it to the plugin as a change request/)).toBeInTheDocument();
|
|
311
315
|
expect(apiMock.createEmptySkill).not.toHaveBeenCalled();
|
|
312
316
|
});
|
|
313
317
|
});
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
// ── the Tools tab ──
|
|
321
|
+
// The dialog is titled "Add a skill or tool", and people looking for the tool
|
|
322
|
+
// half found only skills. The Tools tab explains rather than creates, so what
|
|
323
|
+
// is worth asserting is its prompt (verbatim, per plugin and per role), the
|
|
324
|
+
// two declaration surfaces it names, and that it carries no form.
|
|
325
|
+
//
|
|
326
|
+
// Both panels are MOUNTED at all times and the inactive one is hidden, so the
|
|
327
|
+
// Skills half never loses a half-typed name to a tab click. That makes every
|
|
328
|
+
// text assertion below panel-scoped: `panel()` is the visible tabpanel, and
|
|
329
|
+
// the hidden one is deliberately still in the document.
|
|
330
|
+
describe('AddToPluginDialog: Skills and Tools tabs', () => {
|
|
331
|
+
beforeEach(() => {
|
|
332
|
+
writeText.mockReset();
|
|
333
|
+
writeText.mockResolvedValue(undefined);
|
|
334
|
+
apiMock.createEmptySkill.mockReset();
|
|
335
|
+
Object.defineProperty(navigator, 'clipboard', { value: { writeText }, configurable: true });
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
afterEach(() => {
|
|
339
|
+
Reflect.deleteProperty(navigator, 'clipboard');
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
const TOOL_PROMPT_WRITER =
|
|
343
|
+
'Help me build a new tool and add it to the GTM plugin at Bevel. ' +
|
|
344
|
+
'I run it, so it goes in directly. No review step.';
|
|
345
|
+
const TOOL_PROMPT_NON_OWNER =
|
|
346
|
+
'Help me build a new tool and add it to the GTM plugin at Bevel. ' +
|
|
347
|
+
'I am not an owner, so send it to the plugin as a change request for review.';
|
|
348
|
+
const TOOL_MANUAL_SENTENCE =
|
|
349
|
+
'To call an API without an MCP server, add a .tool manual describing it to the ' +
|
|
350
|
+
"GTM plugin's software.bevel.hexis/tools/ folder.";
|
|
351
|
+
|
|
352
|
+
/** The visible tabpanel. Role queries skip the hidden one. */
|
|
353
|
+
const panel = () => screen.getByRole('tabpanel');
|
|
354
|
+
|
|
355
|
+
it('opens on Skills, with the two tabs named Skills and Tools', () => {
|
|
356
|
+
renderDialog();
|
|
357
|
+
const tabs = screen.getAllByRole('tab');
|
|
358
|
+
expect(tabs.map((t) => t.textContent)).toEqual(['Skills', 'Tools']);
|
|
359
|
+
expect(screen.getByRole('tab', { name: 'Skills' })).toHaveAttribute('aria-selected', 'true');
|
|
360
|
+
expect(panel()).toHaveAccessibleName('Skills');
|
|
361
|
+
expect(within(panel()).getByText(ADD_PROMPT)).toBeInTheDocument();
|
|
362
|
+
// The Tools half is mounted but not shown.
|
|
363
|
+
expect(screen.getByText(TOOL_PROMPT_WRITER)).not.toBeVisible();
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it('shows the tool prompt, the MCP and .tool sentences, and no form', () => {
|
|
367
|
+
renderDialog();
|
|
368
|
+
fireEvent.click(screen.getByRole('tab', { name: 'Tools' }));
|
|
369
|
+
|
|
370
|
+
expect(screen.getByRole('tab', { name: 'Tools' })).toHaveAttribute('aria-selected', 'true');
|
|
371
|
+
expect(panel()).toHaveAccessibleName('Tools');
|
|
372
|
+
expect(within(panel()).getByText(TOOL_PROMPT_WRITER)).toBeInTheDocument();
|
|
373
|
+
expect(
|
|
374
|
+
within(panel()).getByText(
|
|
375
|
+
'To connect an MCP server, add it to the mcp.json in the GTM plugin folder.',
|
|
376
|
+
),
|
|
377
|
+
).toBeInTheDocument();
|
|
378
|
+
expect(within(panel()).getByText(TOOL_MANUAL_SENTENCE)).toBeInTheDocument();
|
|
379
|
+
expect(
|
|
380
|
+
within(panel()).getByText(/it joins GTM\. Everyone in the plugin gets it/),
|
|
381
|
+
).toBeInTheDocument();
|
|
382
|
+
expect(screen.getByText(ADD_PROMPT)).not.toBeVisible();
|
|
383
|
+
// No form on this tab: the Skills panel's field is hidden, so no role query
|
|
384
|
+
// reaches it.
|
|
385
|
+
expect(screen.queryByRole('textbox')).not.toBeInTheDocument();
|
|
386
|
+
expect(screen.getByRole('heading', { name: 'Add a skill or tool to GTM' })).toBeInTheDocument();
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
// The regression the panels exist for: a name typed into the Skills half must
|
|
390
|
+
// survive a look at the Tools tab.
|
|
391
|
+
it('keeps a typed skill name across a tab round trip', () => {
|
|
392
|
+
const { field } = renderDialog();
|
|
393
|
+
fireEvent.change(field(), { target: { value: 'weekly-report' } });
|
|
394
|
+
|
|
395
|
+
fireEvent.click(screen.getByRole('tab', { name: 'Tools' }));
|
|
396
|
+
fireEvent.click(screen.getByRole('tab', { name: 'Skills' }));
|
|
397
|
+
|
|
398
|
+
expect(field()).toHaveValue('weekly-report');
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
it('copies the prompt of the tab that is showing', async () => {
|
|
402
|
+
renderDialog();
|
|
403
|
+
fireEvent.click(screen.getByRole('tab', { name: 'Tools' }));
|
|
404
|
+
fireEvent.click(screen.getByRole('button', { name: 'Copy prompt' }));
|
|
405
|
+
await waitFor(() => expect(writeText).toHaveBeenCalledWith(TOOL_PROMPT_WRITER));
|
|
406
|
+
|
|
407
|
+
fireEvent.click(screen.getByRole('tab', { name: 'Skills' }));
|
|
408
|
+
fireEvent.click(screen.getByRole('button', { name: 'Copy prompt' }));
|
|
409
|
+
await waitFor(() => expect(writeText).toHaveBeenLastCalledWith(ADD_PROMPT));
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it('carries the change-request note and clause for a non-owner', () => {
|
|
413
|
+
renderDialog('knowledge-base', false, [], false);
|
|
414
|
+
fireEvent.click(screen.getByRole('tab', { name: 'Tools' }));
|
|
415
|
+
expect(within(panel()).getByText(TOOL_PROMPT_NON_OWNER)).toBeInTheDocument();
|
|
416
|
+
expect(
|
|
417
|
+
within(panel()).getByText(
|
|
418
|
+
/goes to GTM as a change request, and an owner reviews it before it joins/,
|
|
419
|
+
),
|
|
420
|
+
).toBeInTheDocument();
|
|
421
|
+
expect(within(panel()).queryByText(/No review step/)).not.toBeInTheDocument();
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
it('names whichever plugin it was opened on', () => {
|
|
425
|
+
render(
|
|
426
|
+
<MemoryRouter>
|
|
427
|
+
<AdminContext.Provider value={admin(false)}>
|
|
428
|
+
<WorkspaceContext.Provider value={workspace('knowledge-base')}>
|
|
429
|
+
<LibraryToastProvider>
|
|
430
|
+
{withAuth(
|
|
431
|
+
<AddToPluginDialog
|
|
432
|
+
name="Finance"
|
|
433
|
+
primaryPath="Plugins/Finance"
|
|
434
|
+
canWrite
|
|
435
|
+
existingSkills={[]}
|
|
436
|
+
onClose={vi.fn()}
|
|
437
|
+
/>,
|
|
438
|
+
)}
|
|
439
|
+
</LibraryToastProvider>
|
|
440
|
+
</WorkspaceContext.Provider>
|
|
441
|
+
</AdminContext.Provider>
|
|
442
|
+
</MemoryRouter>,
|
|
443
|
+
);
|
|
444
|
+
fireEvent.click(screen.getByRole('tab', { name: 'Tools' }));
|
|
445
|
+
expect(
|
|
446
|
+
within(panel()).getByText(
|
|
447
|
+
'Help me build a new tool and add it to the Finance plugin at Bevel. I run it, so it goes in directly. No review step.',
|
|
448
|
+
),
|
|
449
|
+
).toBeInTheDocument();
|
|
450
|
+
expect(within(panel()).getByText(/mcp\.json in the Finance plugin folder/)).toBeInTheDocument();
|
|
451
|
+
expect(
|
|
452
|
+
within(panel()).getByText(/Finance plugin's software\.bevel\.hexis\/tools\/ folder/),
|
|
453
|
+
).toBeInTheDocument();
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
it('moves between tabs with the arrow keys, focus following', () => {
|
|
457
|
+
renderDialog();
|
|
458
|
+
const skills = screen.getByRole('tab', { name: 'Skills' });
|
|
459
|
+
fireEvent.keyDown(skills, { key: 'ArrowRight' });
|
|
460
|
+
const tools = screen.getByRole('tab', { name: 'Tools' });
|
|
461
|
+
expect(tools).toHaveAttribute('aria-selected', 'true');
|
|
462
|
+
expect(tools).toHaveFocus();
|
|
463
|
+
fireEvent.keyDown(tools, { key: 'Home' });
|
|
464
|
+
expect(screen.getByRole('tab', { name: 'Skills' })).toHaveAttribute('aria-selected', 'true');
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
// Each tab owns its own panel, so a screen reader following `aria-controls`
|
|
468
|
+
// lands on the half that tab describes rather than on one relabelled div.
|
|
469
|
+
it('gives each tab its own panel to control', () => {
|
|
470
|
+
renderDialog();
|
|
471
|
+
const ids = screen.getAllByRole('tab').map((t) => t.getAttribute('aria-controls'));
|
|
472
|
+
expect(new Set(ids).size).toBe(2);
|
|
473
|
+
for (const id of ids) {
|
|
474
|
+
const owned = document.getElementById(id!);
|
|
475
|
+
expect(owned).not.toBeNull();
|
|
476
|
+
expect(owned).toHaveAttribute('role', 'tabpanel');
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
});
|