@bevel-software/platform-core-frontend 0.15.1 → 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 +16 -9
- package/src/core/__tests__/AppChrome.test.tsx +0 -3
- package/src/core/__tests__/events.test.ts +43 -0
- package/src/core/bootstrap.ts +11 -3
- package/src/core/events.ts +85 -3
- package/src/core/registry.ts +1 -1
- package/src/lib/__tests__/email.test.ts +44 -0
- package/src/lib/email.ts +37 -1
- 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 +721 -126
- 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__/tailwindDeclarations.ts +210 -0
- package/src/modules/access/api.ts +140 -6
- package/src/modules/access/components/ManageAccessDialog.tsx +1299 -561
- 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/components/FileHistoryPanel.tsx +5 -0
- 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 +108 -3
- 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 +103 -98
- package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +20 -5
- package/src/modules/library/__tests__/LockedPluginView.test.tsx +97 -7
- package/src/modules/library/__tests__/NewPluginDialog.test.tsx +13 -4
- 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 +100 -9
- package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
- package/src/modules/library/__tests__/PluginPage.test.tsx +258 -6
- package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +16 -56
- package/src/modules/library/__tests__/PluginsSidebar.test.tsx +155 -152
- 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 +386 -80
- package/src/modules/library/__tests__/SkillsTree.test.tsx +293 -4
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
- package/src/modules/library/__tests__/ToolPage.test.tsx +87 -4
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +173 -26
- 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 +121 -28
- package/src/modules/library/__tests__/library-data.test.ts +7 -0
- package/src/modules/library/__tests__/library-paths.test.ts +47 -4
- package/src/modules/library/__tests__/link-membership.test.ts +13 -4
- 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 +36 -1
- 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/components/AccessRequestsBanner.tsx +85 -47
- package/src/modules/library/components/AddDialogTabs.tsx +103 -0
- package/src/modules/library/components/AddToPluginDialog.tsx +74 -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 +146 -45
- package/src/modules/library/components/LibraryLayout.tsx +119 -256
- package/src/modules/library/components/LibraryPage.tsx +172 -39
- package/src/modules/library/components/LinkSkillPanel.tsx +1 -3
- package/src/modules/library/components/LockedPluginView.tsx +62 -34
- package/src/modules/library/components/NameWithBadges.tsx +164 -0
- package/src/modules/library/components/NewPluginDialog.tsx +16 -2
- package/src/modules/library/components/PageActions.tsx +11 -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 +121 -22
- package/src/modules/library/components/PluginExtras.tsx +140 -17
- package/src/modules/library/components/PluginIndexRow.tsx +47 -12
- package/src/modules/library/components/PluginPage.tsx +157 -41
- package/src/modules/library/components/PluginRows.tsx +286 -0
- package/src/modules/library/components/PluginsSidebar.tsx +239 -263
- package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
- package/src/modules/library/components/ShareButton.tsx +17 -0
- package/src/modules/library/components/SkillsTree.tsx +141 -28
- 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 +103 -17
- package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +6 -12
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +274 -122
- 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 +106 -16
- 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/useLibraryData.ts +92 -19
- package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +77 -27
- package/src/modules/library/routes/library-paths.ts +26 -28
- package/src/modules/library/services/library.api.ts +38 -20
- package/src/modules/library/services/plugins.api.ts +69 -8
- 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 +170 -32
- 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 +75 -9
- package/src/modules/library/utils/status.ts +135 -33
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +8 -1
- 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 +9 -24
- package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
- package/src/modules/settings/components/DeploymentPage.tsx +10 -30
- package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +67 -4
- 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 +23 -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 +497 -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 +521 -43
- package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +140 -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 +177 -118
- 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 +542 -42
- 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 +6 -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 +5 -3
- package/src/modules/workspace/components/FileExplorer.tsx +1295 -191
- package/src/modules/workspace/components/FileRoute.tsx +353 -36
- 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 +731 -18
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +331 -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 +22 -3
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +424 -66
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
- package/src/modules/workspace/routing/kb-routes.ts +206 -29
- 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 +125 -19
- package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +220 -6
- 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 +112 -36
- 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 +6 -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 +33 -5
- 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 +25 -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 -270
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
import { render, screen, within } from '@testing-library/react';
|
|
2
|
+
import { fireEvent, render, screen, within } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
|
-
import { MemoryRouter } from 'react-router-dom';
|
|
4
|
+
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
|
5
5
|
import { ExternalAgentAccessPage } from '../ExternalAgentAccessPage';
|
|
6
6
|
import { configureMcpUrl } from '../../../../shared/mcp';
|
|
7
7
|
import { GITHUB_LINK_KIND, configureMarketplaceGitUrl } from '../../../../shared/marketplace-url';
|
|
@@ -22,13 +22,31 @@ import { GITHUB_LINK_KIND, configureMarketplaceGitUrl } from '../../../../shared
|
|
|
22
22
|
* regression cases below name all six.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const { listMock, createMock } = vi.hoisted(() => ({
|
|
25
|
+
const { listMock, createMock, instructionsMock, facadeMock, registrationMock, adminState } = vi.hoisted(() => ({
|
|
26
26
|
listMock: vi.fn(),
|
|
27
27
|
createMock: vi.fn(),
|
|
28
|
+
instructionsMock: vi.fn(),
|
|
29
|
+
facadeMock: vi.fn(),
|
|
30
|
+
registrationMock: vi.fn(),
|
|
31
|
+
// Mutable so one file can mount the page as both roles: the tutorial must
|
|
32
|
+
// be identical for both, and only the "not set up" notice may differ.
|
|
33
|
+
adminState: { isAdmin: false },
|
|
28
34
|
}));
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
// Only the hook is replaced. `AdminContext` itself stays real, because the
|
|
37
|
+
// instructions card below reads the context directly rather than through the
|
|
38
|
+
// hook; a whole-module mock left it undefined and every case here threw.
|
|
39
|
+
vi.mock('../../../admin/state/admin.context', async (importOriginal) => ({
|
|
40
|
+
...(await importOriginal<typeof import('../../../admin/state/admin.context')>()),
|
|
41
|
+
useAdmin: () => ({ isAdmin: adminState.isAdmin }),
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
// The registration state the Cowork drawer reads, and the admin credentials
|
|
45
|
+
// endpoint this page must never call. Mocked, or the component reaches for
|
|
46
|
+
// the real endpoints over the network.
|
|
47
|
+
vi.mock('../../../settings/services/github-facade.api', () => ({
|
|
48
|
+
fetchGitHubFacade: facadeMock,
|
|
49
|
+
fetchMarketplaceRegistration: registrationMock,
|
|
32
50
|
}));
|
|
33
51
|
|
|
34
52
|
vi.mock('../../services/external-api-keys.api', () => ({
|
|
@@ -38,6 +56,14 @@ vi.mock('../../services/external-api-keys.api', () => ({
|
|
|
38
56
|
deleteExternalApiKey: vi.fn(async () => {}),
|
|
39
57
|
}));
|
|
40
58
|
|
|
59
|
+
// The "What connected agents are told" card fetches on mount; its own cases
|
|
60
|
+
// live in AgentInstructionsCard.test.tsx. Here it only has to stay out of the
|
|
61
|
+
// way of the snippet assertions, which read every textbox on the page.
|
|
62
|
+
vi.mock('../../services/agent-instructions.api', async (importOriginal) => ({
|
|
63
|
+
...(await importOriginal<typeof import('../../services/agent-instructions.api')>()),
|
|
64
|
+
fetchAgentInstructions: instructionsMock,
|
|
65
|
+
}));
|
|
66
|
+
|
|
41
67
|
/** A deployment configured the way a real one is: public, https, its own domain. */
|
|
42
68
|
const PUBLIC_URL = 'https://kb.acme.com/api/mcp';
|
|
43
69
|
/** What an unconfigured deployment actually runs with — see `.env.example`. */
|
|
@@ -45,8 +71,38 @@ const LOCALHOST_URL = 'http://localhost:3001/api/mcp';
|
|
|
45
71
|
|
|
46
72
|
const KEY = 'bvl_live_s3cret';
|
|
47
73
|
|
|
74
|
+
const FACADE = {
|
|
75
|
+
host: 'kb.acme.com',
|
|
76
|
+
appId: '12345',
|
|
77
|
+
clientId: 'Iv1.abcdef',
|
|
78
|
+
clientSecret: 'ghs_secret',
|
|
79
|
+
webhookSecret: 'whsec_0123456789012345678',
|
|
80
|
+
privateKeyPem: '-----BEGIN RSA PRIVATE KEY-----\nx\n-----END RSA PRIVATE KEY-----',
|
|
81
|
+
marketplaceUrl: 'https://kb.acme.com/git/marketplace.git',
|
|
82
|
+
createdAt: Date.now(),
|
|
83
|
+
rotatedAt: null,
|
|
84
|
+
};
|
|
85
|
+
|
|
48
86
|
beforeEach(() => {
|
|
87
|
+
adminState.isAdmin = false;
|
|
88
|
+
// Cleared, not just re-stubbed: the count is an assertion of its own below.
|
|
89
|
+
facadeMock.mockClear();
|
|
90
|
+
facadeMock.mockResolvedValue(FACADE);
|
|
91
|
+
registrationMock.mockReset();
|
|
92
|
+
registrationMock.mockResolvedValue(true);
|
|
49
93
|
listMock.mockResolvedValue([]);
|
|
94
|
+
instructionsMock.mockResolvedValue({
|
|
95
|
+
instructions: 'Search the knowledge base first.',
|
|
96
|
+
header: 'Search the knowledge base first.',
|
|
97
|
+
preamble: '',
|
|
98
|
+
toolPrefix: 'Search it before answering from memory.',
|
|
99
|
+
toolPrefixLine: 'Search it before answering from memory.',
|
|
100
|
+
truncated: false,
|
|
101
|
+
preambleChars: 0,
|
|
102
|
+
toolPrefixTruncated: false,
|
|
103
|
+
toolPrefixChars: 40,
|
|
104
|
+
unterminatedComment: false,
|
|
105
|
+
});
|
|
50
106
|
createMock.mockResolvedValue({
|
|
51
107
|
plaintext: KEY,
|
|
52
108
|
summary: {
|
|
@@ -55,6 +111,7 @@ beforeEach(() => {
|
|
|
55
111
|
createdAt: Date.now(),
|
|
56
112
|
lastUsedAt: null,
|
|
57
113
|
revokedAt: null,
|
|
114
|
+
revokedBy: null,
|
|
58
115
|
},
|
|
59
116
|
});
|
|
60
117
|
});
|
|
@@ -70,6 +127,13 @@ function mount(mcpUrl: string) {
|
|
|
70
127
|
);
|
|
71
128
|
}
|
|
72
129
|
|
|
130
|
+
/** Opens the Cowork drawer on the Marketplaces tab — the opening is what reads the registration state. */
|
|
131
|
+
async function openCowork(user: ReturnType<typeof userEvent.setup>) {
|
|
132
|
+
const cowork = screen.getByText('Cowork and claude.ai').closest('details') as HTMLDetailsElement;
|
|
133
|
+
await user.click(within(cowork).getByText('Cowork and claude.ai'));
|
|
134
|
+
return cowork;
|
|
135
|
+
}
|
|
136
|
+
|
|
73
137
|
/** Every read-only snippet on screen, as plain strings. */
|
|
74
138
|
function snippets(): string[] {
|
|
75
139
|
return screen
|
|
@@ -85,7 +149,7 @@ async function revealAKey(user: ReturnType<typeof userEvent.setup>) {
|
|
|
85
149
|
await screen.findByRole('heading', { name: /Save this external API key now/ });
|
|
86
150
|
}
|
|
87
151
|
|
|
88
|
-
describe('the interactive tab:
|
|
152
|
+
describe('the interactive tab: Claude and ChatGPT first, each family on its own address', () => {
|
|
89
153
|
it('builds all three hosted keyless snippets from the configured URL', () => {
|
|
90
154
|
mount(PUBLIC_URL);
|
|
91
155
|
const values = snippets();
|
|
@@ -103,26 +167,52 @@ describe('the interactive tab: local first, hosted second, each with its own add
|
|
|
103
167
|
});
|
|
104
168
|
|
|
105
169
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* quote the workspace ORIGIN, because hexis-mcp resolves the endpoint from
|
|
110
|
-
* `GET <base>/api/config` itself.
|
|
170
|
+
* Claude and ChatGPT lead, OPEN: the page arrives on the one-click button
|
|
171
|
+
* and the address to paste. Desktop agents and every other agent follow,
|
|
172
|
+
* closed — and no drawer title calls itself recommended any more.
|
|
111
173
|
*/
|
|
112
|
-
it('leads with
|
|
174
|
+
it('leads with an open Claude and ChatGPT drawer, then Desktop agents, then any other agent', () => {
|
|
113
175
|
mount(PUBLIC_URL);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const local = screen.getByText(
|
|
176
|
+
const summaries = [
|
|
177
|
+
'Claude and ChatGPT',
|
|
117
178
|
'Desktop agents: Claude Code, Claude Desktop, Cursor, Windsurf, Cline and similar',
|
|
179
|
+
'Any other agent',
|
|
180
|
+
].map((text) => screen.getByText(text));
|
|
181
|
+
for (const summary of summaries) expect(summary.tagName).toBe('SUMMARY');
|
|
182
|
+
// The page's own drawers, in order — the Marketplaces and Autonomous tabs are not mounted.
|
|
183
|
+
const drawers = Array.from(
|
|
184
|
+
screen.getByTestId('agent-connection-section').querySelectorAll('details > summary'),
|
|
118
185
|
);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
expect(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
186
|
+
expect(drawers).toEqual(summaries);
|
|
187
|
+
expect(drawers.some((d) => /recommended/i.test(d.textContent ?? ''))).toBe(false);
|
|
188
|
+
expect(summaries.map((s) => (s.closest('details') as HTMLDetailsElement).open)).toEqual([
|
|
189
|
+
true,
|
|
190
|
+
false,
|
|
191
|
+
false,
|
|
192
|
+
]);
|
|
125
193
|
|
|
194
|
+
// Everything the first drawer promises lives inside it.
|
|
195
|
+
const first = summaries[0]!.closest('details') as HTMLElement;
|
|
196
|
+
expect(within(first).getByRole('link', { name: 'Add to Claude' })).toBeInTheDocument();
|
|
197
|
+
expect(within(first).getByRole('link', { name: 'Add to ChatGPT' })).toBeInTheDocument();
|
|
198
|
+
expect(within(first).getByRole('link', { name: /Configure your tools/ })).toBeInTheDocument();
|
|
199
|
+
expect(
|
|
200
|
+
within(first).getAllByRole('textbox').map((el) => (el as HTMLTextAreaElement).value),
|
|
201
|
+
).toContain(PUBLIC_URL);
|
|
202
|
+
|
|
203
|
+
// Desktop agents keeps the sentence about local-only tools.
|
|
204
|
+
const desktop = summaries[1]!.closest('details') as HTMLElement;
|
|
205
|
+
expect(within(desktop).getByText(/local-only tools/)).toBeInTheDocument();
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* The local-server snippets are KEYLESS — interactive mode signs in through
|
|
210
|
+
* the browser on first run, so no key belongs in the config. Both quote the
|
|
211
|
+
* workspace ORIGIN, because hexis-mcp resolves the endpoint from
|
|
212
|
+
* `GET <base>/api/config` itself.
|
|
213
|
+
*/
|
|
214
|
+
it('gives Desktop agents keyless snippets built from the origin', () => {
|
|
215
|
+
mount(PUBLIC_URL);
|
|
126
216
|
const values = snippets();
|
|
127
217
|
expect(values).toContain(
|
|
128
218
|
`claude mcp add skills-tools-knowledge --env HEXIS_URL="${window.location.origin}" -- npx -y @bevel-software/hexis-mcp`,
|
|
@@ -135,6 +225,27 @@ describe('the interactive tab: local first, hosted second, each with its own add
|
|
|
135
225
|
expect(parsed.env.HEXIS_CONNECTION_KEY).toBeUndefined();
|
|
136
226
|
});
|
|
137
227
|
|
|
228
|
+
/**
|
|
229
|
+
* The two things that stop this configuration working on a machine where it
|
|
230
|
+
* is otherwise correct: the wrong Node major, and a client that cannot see
|
|
231
|
+
* `npx` because it was launched from the Dock rather than from a shell. The
|
|
232
|
+
* SNIPPET must not try to fix the second one — an absolute path is specific
|
|
233
|
+
* to one machine, and baking one in would break every reader whose PATH was
|
|
234
|
+
* fine — so the prose beside it is the only place this can be said.
|
|
235
|
+
*/
|
|
236
|
+
it('warns Desktop agents about Node and PATH without touching the snippet', () => {
|
|
237
|
+
mount(PUBLIC_URL);
|
|
238
|
+
const desktop = screen
|
|
239
|
+
.getByText('Desktop agents: Claude Code, Claude Desktop, Cursor, Windsurf, Cline and similar')
|
|
240
|
+
.closest('details') as HTMLElement;
|
|
241
|
+
expect(within(desktop).getByText(/Needs Node 22\.13\+ or 24/)).toBeInTheDocument();
|
|
242
|
+
expect(within(desktop).getByText(/cannot see your shell's PATH/)).toBeInTheDocument();
|
|
243
|
+
expect(within(desktop).getByText('which npx')).toBeInTheDocument();
|
|
244
|
+
// The snippet still spawns the bare `npx`, for every client that can find it.
|
|
245
|
+
const json = snippets().find((v) => v.includes('mcpServers') && v.includes('"command"'));
|
|
246
|
+
expect(JSON.parse(json!).mcpServers['skills-tools-knowledge'].command).toBe('npx');
|
|
247
|
+
});
|
|
248
|
+
|
|
138
249
|
/**
|
|
139
250
|
* The regression stated as a negative, per family: a hosted snippet
|
|
140
251
|
* quoting the origin means one of the six sites quietly went back to
|
|
@@ -201,22 +312,22 @@ describe('the key-bearing snippets quote the deployment too', () => {
|
|
|
201
312
|
});
|
|
202
313
|
|
|
203
314
|
/**
|
|
204
|
-
* The modal
|
|
205
|
-
*
|
|
206
|
-
*
|
|
315
|
+
* The modal follows the tab's order — the hosted endpoint first, the local
|
|
316
|
+
* server second — with the REAL key in both local snippets (unlike the
|
|
317
|
+
* interactive tab, which carries none). And it is the one place the page's own origin is right:
|
|
207
318
|
* hexis-mcp takes the workspace's address — the one the browser provably
|
|
208
319
|
* loaded this app from — and resolves the MCP endpoint from it itself,
|
|
209
320
|
* so the configured `mcpUrl` (possibly a proxy serving only the MCP path)
|
|
210
321
|
* must appear in neither snippet.
|
|
211
322
|
*/
|
|
212
|
-
it('
|
|
323
|
+
it('hands the local server the origin and the minted key, after the hosted endpoint', async () => {
|
|
213
324
|
const user = userEvent.setup();
|
|
214
325
|
mount(PUBLIC_URL);
|
|
215
326
|
await revealAKey(user);
|
|
216
|
-
const
|
|
217
|
-
const
|
|
218
|
-
// DOCUMENT_POSITION_FOLLOWING: the
|
|
219
|
-
expect(
|
|
327
|
+
const hosted = screen.getByText('Claude, ChatGPT and pipelines — the hosted endpoint');
|
|
328
|
+
const local = screen.getByText('Desktop agents — the local server');
|
|
329
|
+
// DOCUMENT_POSITION_FOLLOWING: the local block comes after the hosted one.
|
|
330
|
+
expect(hosted.compareDocumentPosition(local) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
|
220
331
|
const values = snippets();
|
|
221
332
|
|
|
222
333
|
// 7. the Claude Code stdio one-liner
|
|
@@ -233,20 +344,22 @@ describe('the key-bearing snippets quote the deployment too', () => {
|
|
|
233
344
|
});
|
|
234
345
|
|
|
235
346
|
/**
|
|
236
|
-
* The modal
|
|
237
|
-
*
|
|
347
|
+
* The modal's three drawers run in the interactive tab's order — hosted
|
|
348
|
+
* endpoint for Claude and ChatGPT, Desktop agents, marketplace — and every
|
|
349
|
+
* one of them arrives closed: the key is what the
|
|
238
350
|
* dialog hands over, and the configs wait until the reader picks a side.
|
|
239
351
|
*/
|
|
240
|
-
it('folds the configs into the tab\'s
|
|
352
|
+
it('folds the configs into three drawers in the tab\'s order, all closed', async () => {
|
|
241
353
|
const user = userEvent.setup();
|
|
242
354
|
mount(PUBLIC_URL);
|
|
243
355
|
await revealAKey(user);
|
|
244
356
|
const dialog = screen.getByRole('alertdialog');
|
|
245
357
|
const summaries = [
|
|
246
|
-
'
|
|
247
|
-
'
|
|
358
|
+
'Claude, ChatGPT and pipelines — the hosted endpoint',
|
|
359
|
+
'Desktop agents — the local server',
|
|
248
360
|
'Skills as native plugins — the marketplace',
|
|
249
361
|
].map((text) => within(dialog).getByText(text));
|
|
362
|
+
expect(Array.from(dialog.querySelectorAll('details > summary'))).toEqual(summaries);
|
|
250
363
|
for (const summary of summaries) {
|
|
251
364
|
expect(summary.tagName).toBe('SUMMARY');
|
|
252
365
|
expect((summary.closest('details') as HTMLDetailsElement).open).toBe(false);
|
|
@@ -315,6 +428,10 @@ describe('the Marketplaces tab', () => {
|
|
|
315
428
|
for (const drawer of [cowork, git]) {
|
|
316
429
|
expect((drawer.closest('details') as HTMLDetailsElement).open).toBe(false);
|
|
317
430
|
}
|
|
431
|
+
await openCowork(user);
|
|
432
|
+
await within(cowork.closest('details') as HTMLElement).findByRole('region', {
|
|
433
|
+
name: 'Set up the Claude marketplace',
|
|
434
|
+
});
|
|
318
435
|
const remote = `${new URL(PUBLIC_URL).origin}/git/marketplace.git`;
|
|
319
436
|
// The same address in both drawers: what Cowork adds is what Claude Code clones.
|
|
320
437
|
expect(snippets().filter((v) => v === remote)).toHaveLength(2);
|
|
@@ -324,16 +441,306 @@ describe('the Marketplaces tab', () => {
|
|
|
324
441
|
for (const v of commands) expect(v).toContain(new URL(PUBLIC_URL).host);
|
|
325
442
|
});
|
|
326
443
|
|
|
444
|
+
/**
|
|
445
|
+
* The registration steps live on pages inside Claude's ADMIN settings, and
|
|
446
|
+
* now in Deployment configuration here. This page has no admin branch left:
|
|
447
|
+
* the six actions every person takes, one at a time, and none of the
|
|
448
|
+
* registration screenshots.
|
|
449
|
+
*/
|
|
450
|
+
it('gives everyone only the personal steps, and none of the admin screenshots', async () => {
|
|
451
|
+
const user = userEvent.setup();
|
|
452
|
+
mount(PUBLIC_URL);
|
|
453
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
454
|
+
const cowork = await openCowork(user);
|
|
455
|
+
|
|
456
|
+
const carousel = await within(cowork).findByRole('region', { name: 'Set up the Claude marketplace' });
|
|
457
|
+
expect(within(cowork).queryByText('Register this deployment with your Claude organization')).toBeNull();
|
|
458
|
+
expect(carousel).toHaveAttribute('aria-roledescription', 'carousel');
|
|
459
|
+
expect(within(cowork).getByText('Select repository')).toBeTruthy();
|
|
460
|
+
expect(within(cowork).getByText('Connect to URL')).toBeTruthy();
|
|
461
|
+
|
|
462
|
+
// One action shot at a time, beginning with the repository picker trigger,
|
|
463
|
+
// and not one of the four screens that only an admin can use.
|
|
464
|
+
const alts = within(cowork).getAllByRole('img').map((el) => el.getAttribute('alt') ?? '');
|
|
465
|
+
expect(alts).toHaveLength(1);
|
|
466
|
+
expect(alts[0]).toContain('Select repository');
|
|
467
|
+
expect(alts.some((a) => a.includes('admin settings'))).toBe(false);
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
it('pairs every screenshot with its instruction and lets the reader move through all six', async () => {
|
|
471
|
+
const user = userEvent.setup();
|
|
472
|
+
mount(PUBLIC_URL);
|
|
473
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
474
|
+
const cowork = await openCowork(user);
|
|
475
|
+
const carousel = await within(cowork).findByRole('region', { name: 'Set up the Claude marketplace' });
|
|
476
|
+
// One shot a slide, except the connector: that step is one action read
|
|
477
|
+
// across two screens — the row that says Not added and the dialog the
|
|
478
|
+
// button opens — so splitting it would put the check that it worked on a
|
|
479
|
+
// different slide from the control that does it.
|
|
480
|
+
const expected: [string[], string][] = [
|
|
481
|
+
[['Select repository'], 'Connect to URL'],
|
|
482
|
+
[['Plugins tab'], 'select the Plugins tab'],
|
|
483
|
+
[['Add marketplace'], 'choose Add marketplace'],
|
|
484
|
+
[['URL field'], 'Paste the Marketplace URL'],
|
|
485
|
+
[['Hexis all row'], 'choose the Hexis all row'],
|
|
486
|
+
[['Not added', 'Add custom connector dialog'], 'Add for your team'],
|
|
487
|
+
];
|
|
488
|
+
|
|
489
|
+
for (const [alts, instruction] of expected) {
|
|
490
|
+
const shown = within(carousel)
|
|
491
|
+
.getAllByRole('img')
|
|
492
|
+
.map((el) => el.getAttribute('alt') ?? '');
|
|
493
|
+
expect(shown).toHaveLength(alts.length);
|
|
494
|
+
alts.forEach((alt, index) => expect(shown[index]).toContain(alt));
|
|
495
|
+
expect(carousel).toHaveTextContent(instruction);
|
|
496
|
+
if (within(carousel).queryByRole('button', { name: 'Next' })) {
|
|
497
|
+
await user.click(within(carousel).getByRole('button', { name: 'Next' }));
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
expect(within(carousel).getByRole('button', { name: 'Review again' })).toBeTruthy();
|
|
502
|
+
await user.click(within(carousel).getByRole('button', { name: 'Go to step 3: Marketplace' }));
|
|
503
|
+
expect(within(carousel).getByRole('group')).toHaveAccessibleName(
|
|
504
|
+
'Step 3 of 6: Choose Add marketplace',
|
|
505
|
+
);
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Installing the plugin brings the skills and leaves the knowledge base
|
|
510
|
+
* disconnected, which is where this tutorial used to stop. The last slide
|
|
511
|
+
* is the connector, and End reaches it: the carousel is reachable from the
|
|
512
|
+
* keyboard, and the step a reader most needs is the one furthest away.
|
|
513
|
+
*/
|
|
514
|
+
it('ends on the connector step, reachable with End, naming Add for your team', async () => {
|
|
515
|
+
const user = userEvent.setup();
|
|
516
|
+
mount(PUBLIC_URL);
|
|
517
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
518
|
+
const cowork = await openCowork(user);
|
|
519
|
+
const carousel = await within(cowork).findByRole('region', { name: 'Set up the Claude marketplace' });
|
|
520
|
+
|
|
521
|
+
await user.click(within(carousel).getByRole('button', { name: 'Next' }));
|
|
522
|
+
fireEvent.keyDown(carousel, { key: 'End' });
|
|
523
|
+
|
|
524
|
+
expect(within(carousel).getByRole('group')).toHaveAccessibleName(
|
|
525
|
+
'Step 6 of 6: Add the hexis connector',
|
|
526
|
+
);
|
|
527
|
+
expect(within(carousel).getByRole('button', { name: 'Review again' })).toBeTruthy();
|
|
528
|
+
expect(within(carousel).getByText('6 / 6')).toBeTruthy();
|
|
529
|
+
|
|
530
|
+
// What the step has to say, in the reader's own words: the plugin does
|
|
531
|
+
// not bring the connector, the row that proves it, the button, and the
|
|
532
|
+
// check that it worked.
|
|
533
|
+
expect(carousel).toHaveTextContent('does not connect its MCP server');
|
|
534
|
+
expect(carousel).toHaveTextContent('Not added');
|
|
535
|
+
expect(carousel).toHaveTextContent('Add for your team');
|
|
536
|
+
expect(carousel).toHaveTextContent('Add custom connector');
|
|
537
|
+
expect(carousel).toHaveTextContent('approve the sign-in on this deployment');
|
|
538
|
+
expect(carousel).toHaveTextContent('no longer reads');
|
|
539
|
+
expect(carousel).toHaveTextContent('Without organization-admin rights');
|
|
540
|
+
|
|
541
|
+
// Both of its screens are drawings rather than captures, and the slide
|
|
542
|
+
// says so under each one: a reader comparing their own Claude to a
|
|
543
|
+
// sketch should not be left deciding they are on the wrong screen. One
|
|
544
|
+
// note per shot.
|
|
545
|
+
expect(within(carousel).getAllByText(/Illustration, not a capture/)).toHaveLength(2);
|
|
546
|
+
|
|
547
|
+
// And Home goes back to the first, so End is not a one-way door. The
|
|
548
|
+
// first slide is a real capture, so the same press is what shows the
|
|
549
|
+
// note is per-shot rather than part of the shell. One press proving
|
|
550
|
+
// both: a second one here would only be re-entering a state the press
|
|
551
|
+
// before it had already produced.
|
|
552
|
+
fireEvent.keyDown(carousel, { key: 'Home' });
|
|
553
|
+
expect(within(carousel).getByRole('group')).toHaveAccessibleName(
|
|
554
|
+
'Step 1 of 6: Select this deployment in Claude Code',
|
|
555
|
+
);
|
|
556
|
+
expect(within(carousel).queryByText(/Illustration, not a capture/)).toBeNull();
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Changing slide moves no focus, so nothing would be announced: the reader
|
|
561
|
+
* is left on the control they pressed while everything under it changes.
|
|
562
|
+
* The slide group is the live region, and the counter is not, so the step
|
|
563
|
+
* is announced once rather than twice.
|
|
564
|
+
*/
|
|
565
|
+
it('announces the slide that replaced it, and only once', async () => {
|
|
566
|
+
const user = userEvent.setup();
|
|
567
|
+
mount(PUBLIC_URL);
|
|
568
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
569
|
+
const cowork = await openCowork(user);
|
|
570
|
+
const carousel = await within(cowork).findByRole('region', { name: 'Set up the Claude marketplace' });
|
|
571
|
+
|
|
572
|
+
expect(within(carousel).getByRole('group')).toHaveAttribute('aria-live', 'polite');
|
|
573
|
+
expect(within(carousel).getByText('1 / 6')).not.toHaveAttribute('aria-live');
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* The footer control is ONE button that changes its label, so reaching the
|
|
578
|
+
* last slide cannot unmount the button the reader is focused on — focus
|
|
579
|
+
* would fall to the body and take the arrow keys with it, which this
|
|
580
|
+
* section handles. Node identity is asserted alongside focus because it is
|
|
581
|
+
* the property that actually guarantees this: it names the cause, so a
|
|
582
|
+
* `key` or a wrapper added later fails here rather than somewhere vague.
|
|
583
|
+
*/
|
|
584
|
+
it('keeps focus on the footer control when the last slide relabels it', async () => {
|
|
585
|
+
const user = userEvent.setup();
|
|
586
|
+
mount(PUBLIC_URL);
|
|
587
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
588
|
+
const cowork = await openCowork(user);
|
|
589
|
+
const carousel = await within(cowork).findByRole('region', { name: 'Set up the Claude marketplace' });
|
|
590
|
+
|
|
591
|
+
const advance = within(carousel).getByRole('button', { name: 'Next' });
|
|
592
|
+
for (let step = 0; step < 5; step += 1) {
|
|
593
|
+
await user.click(within(carousel).getByRole('button', { name: 'Next' }));
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
const restart = within(carousel).getByRole('button', { name: 'Review again' });
|
|
597
|
+
expect(restart).toBe(advance);
|
|
598
|
+
expect(restart).toHaveFocus();
|
|
599
|
+
|
|
600
|
+
// And it still works as the control it now says it is.
|
|
601
|
+
await user.click(restart);
|
|
602
|
+
expect(within(carousel).getByRole('group')).toHaveAccessibleName(
|
|
603
|
+
'Step 1 of 6: Select this deployment in Claude Code',
|
|
604
|
+
);
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* State one of three: REGISTERED. The tutorial is the same DOM for an admin
|
|
609
|
+
* as for anyone else — the admin branch is gone, not merely hidden — and
|
|
610
|
+
* no one's copy of this page asks for the credentials.
|
|
611
|
+
*/
|
|
612
|
+
it('shows an admin exactly the tutorial a non-admin sees once the deployment is registered', async () => {
|
|
613
|
+
const drawerHtml = async () => {
|
|
614
|
+
const user = userEvent.setup();
|
|
615
|
+
const view = mount(PUBLIC_URL);
|
|
616
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
617
|
+
const cowork = await openCowork(user);
|
|
618
|
+
await within(cowork).findByRole('region', { name: 'Set up the Claude marketplace' });
|
|
619
|
+
expect(within(cowork).queryByTestId('marketplace-not-configured')).toBeNull();
|
|
620
|
+
const html = cowork.innerHTML;
|
|
621
|
+
view.unmount();
|
|
622
|
+
return html;
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
adminState.isAdmin = false;
|
|
626
|
+
const asMember = await drawerHtml();
|
|
627
|
+
adminState.isAdmin = true;
|
|
628
|
+
const asAdmin = await drawerHtml();
|
|
629
|
+
|
|
630
|
+
expect(asAdmin).toBe(asMember);
|
|
631
|
+
expect(asAdmin).not.toContain('Register this deployment with your Claude organization');
|
|
632
|
+
expect(facadeMock).not.toHaveBeenCalled();
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* State two: NOT REGISTERED, for a non-admin. No tutorial — its first
|
|
637
|
+
* screen would list no deployment — and a notice that an admin has to
|
|
638
|
+
* configure the marketplace, with no link to a page they cannot use.
|
|
639
|
+
*/
|
|
640
|
+
it('tells a non-admin an admin must configure the marketplace, and shows no tutorial', async () => {
|
|
641
|
+
registrationMock.mockResolvedValue(false);
|
|
642
|
+
const user = userEvent.setup();
|
|
643
|
+
mount(PUBLIC_URL);
|
|
644
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
645
|
+
const cowork = await openCowork(user);
|
|
646
|
+
|
|
647
|
+
const notice = await within(cowork).findByTestId('marketplace-not-configured');
|
|
648
|
+
expect(notice).toHaveTextContent('An admin has to configure the marketplace');
|
|
649
|
+
expect(within(notice).queryByRole('link')).toBeNull();
|
|
650
|
+
expect(within(cowork).queryByRole('region', { name: 'Set up the Claude marketplace' })).toBeNull();
|
|
651
|
+
expect(within(cowork).queryAllByRole('img')).toHaveLength(0);
|
|
652
|
+
expect(facadeMock).not.toHaveBeenCalled();
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* State three: NOT REGISTERED, for an admin. The same absence of a
|
|
657
|
+
* tutorial, and a notice pointing at the Deployment section that fixes it —
|
|
658
|
+
* a link that actually lands there.
|
|
659
|
+
*/
|
|
660
|
+
it('points an admin at the Deployment section with a working link', async () => {
|
|
661
|
+
registrationMock.mockResolvedValue(false);
|
|
662
|
+
adminState.isAdmin = true;
|
|
663
|
+
const user = userEvent.setup();
|
|
664
|
+
render(
|
|
665
|
+
<MemoryRouter initialEntries={['/external-agent-access']}>
|
|
666
|
+
<Routes>
|
|
667
|
+
<Route path="/external-agent-access" element={<ExternalAgentAccessPage />} />
|
|
668
|
+
<Route path="/deployment" element={<div>Deployment settings page</div>} />
|
|
669
|
+
</Routes>
|
|
670
|
+
</MemoryRouter>,
|
|
671
|
+
);
|
|
672
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
673
|
+
const cowork = await openCowork(user);
|
|
674
|
+
|
|
675
|
+
const notice = await within(cowork).findByTestId('marketplace-not-configured');
|
|
676
|
+
expect(within(cowork).queryByRole('region', { name: 'Set up the Claude marketplace' })).toBeNull();
|
|
677
|
+
const link = within(notice).getByRole('link', { name: /Marketplace section of Deployment settings/ });
|
|
678
|
+
expect(link).toHaveAttribute('href', '/deployment#marketplace');
|
|
679
|
+
await user.click(link);
|
|
680
|
+
expect(await screen.findByText('Deployment settings page')).toBeInTheDocument();
|
|
681
|
+
expect(facadeMock).not.toHaveBeenCalled();
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* A closed <details> still mounts its children, so a read on mount put a
|
|
686
|
+
* request behind every visit to this tab — and never repeated it, leaving
|
|
687
|
+
* the "not set up yet" notice standing after an admin registered the
|
|
688
|
+
* deployment elsewhere. The state is read when the drawer opens, and again
|
|
689
|
+
* on every opening.
|
|
690
|
+
*/
|
|
691
|
+
it('reads the registration state only when the drawer opens, and again on each opening', async () => {
|
|
692
|
+
registrationMock.mockResolvedValueOnce(false).mockResolvedValue(true);
|
|
693
|
+
const user = userEvent.setup();
|
|
694
|
+
mount(PUBLIC_URL);
|
|
695
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
696
|
+
const cowork = screen.getByText('Cowork and claude.ai').closest('details') as HTMLDetailsElement;
|
|
697
|
+
expect(cowork.open).toBe(false);
|
|
698
|
+
expect(registrationMock).not.toHaveBeenCalled();
|
|
699
|
+
|
|
700
|
+
const summary = within(cowork).getByText('Cowork and claude.ai');
|
|
701
|
+
await user.click(summary);
|
|
702
|
+
await within(cowork).findByTestId('marketplace-not-configured');
|
|
703
|
+
expect(registrationMock).toHaveBeenCalledTimes(1);
|
|
704
|
+
|
|
705
|
+
// Registered in the meantime: closing and reopening is all it takes.
|
|
706
|
+
await user.click(summary);
|
|
707
|
+
expect(cowork.open).toBe(false);
|
|
708
|
+
await user.click(summary);
|
|
709
|
+
await within(cowork).findByRole('region', { name: 'Set up the Claude marketplace' });
|
|
710
|
+
expect(within(cowork).queryByTestId('marketplace-not-configured')).toBeNull();
|
|
711
|
+
expect(registrationMock).toHaveBeenCalledTimes(2);
|
|
712
|
+
expect(facadeMock).not.toHaveBeenCalled();
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Every box is decoration: `aria-hidden`, and the control it frames is
|
|
717
|
+
* named in the image's own alt text. A screen reader that never sees a red
|
|
718
|
+
* rectangle still gets the instruction.
|
|
719
|
+
*/
|
|
720
|
+
it('names the highlighted control in alt text rather than only boxing it', async () => {
|
|
721
|
+
const user = userEvent.setup();
|
|
722
|
+
mount(PUBLIC_URL);
|
|
723
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
724
|
+
const cowork = await openCowork(user);
|
|
725
|
+
await within(cowork).findByRole('region', { name: 'Set up the Claude marketplace' });
|
|
726
|
+
|
|
727
|
+
for (const img of within(cowork).getAllByRole('img')) {
|
|
728
|
+
expect((img.getAttribute('alt') ?? '').length).toBeGreaterThan(40);
|
|
729
|
+
}
|
|
730
|
+
// The deployment's own host, never a hard-coded example.
|
|
731
|
+
expect(cowork).toHaveTextContent(new URL(PUBLIC_URL).host);
|
|
732
|
+
});
|
|
733
|
+
|
|
327
734
|
it('tells Claude connections from keys by their stored kind — never by the label', async () => {
|
|
328
735
|
listMock.mockResolvedValue([
|
|
329
|
-
{ id: 'c1', kind: GITHUB_LINK_KIND, label: 'My Cowork link', createdAt: Date.now(), lastUsedAt: null, revokedAt: null },
|
|
736
|
+
{ id: 'c1', kind: GITHUB_LINK_KIND, label: 'My Cowork link', createdAt: Date.now(), lastUsedAt: null, revokedAt: null, revokedBy: null },
|
|
330
737
|
// A hand-made key wearing the link's usual label is still a key.
|
|
331
|
-
{ id: 'k1', kind: 'key', label: 'Claude (claude.ai and Cowork)', createdAt: Date.now(), lastUsedAt: null, revokedAt: null },
|
|
738
|
+
{ id: 'k1', kind: 'key', label: 'Claude (claude.ai and Cowork)', createdAt: Date.now(), lastUsedAt: null, revokedAt: null, revokedBy: null },
|
|
332
739
|
]);
|
|
333
740
|
const user = userEvent.setup();
|
|
334
741
|
mount(PUBLIC_URL);
|
|
335
742
|
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
336
|
-
const cowork =
|
|
743
|
+
const cowork = await openCowork(user);
|
|
337
744
|
await screen.findByText('My Cowork link');
|
|
338
745
|
expect(cowork).toHaveTextContent('My Cowork link');
|
|
339
746
|
expect(cowork).not.toHaveTextContent('Claude (claude.ai and Cowork)');
|
|
@@ -343,9 +750,30 @@ describe('the Marketplaces tab', () => {
|
|
|
343
750
|
expect(screen.queryByText('My Cowork link')).toBeNull();
|
|
344
751
|
});
|
|
345
752
|
|
|
753
|
+
it('tells a key an admin revoked from one you disconnected yourself', async () => {
|
|
754
|
+
// "Disconnected" invites reconnecting. A key an admin took will not come
|
|
755
|
+
// back that way, so the row must say who ended it.
|
|
756
|
+
listMock.mockResolvedValue([
|
|
757
|
+
{ id: 'k1', kind: 'key', label: 'CI', createdAt: Date.now(), lastUsedAt: null, revokedAt: Date.now(), revokedBy: 'admin' },
|
|
758
|
+
{ id: 'k2', kind: 'key', label: 'Laptop', createdAt: Date.now(), lastUsedAt: null, revokedAt: Date.now(), revokedBy: 'owner' },
|
|
759
|
+
// Revoked before who-did-it was recorded: read as the owner's doing.
|
|
760
|
+
{ id: 'k3', kind: 'key', label: 'Old', createdAt: Date.now(), lastUsedAt: null, revokedAt: Date.now(), revokedBy: null },
|
|
761
|
+
]);
|
|
762
|
+
const user = userEvent.setup();
|
|
763
|
+
mount(PUBLIC_URL);
|
|
764
|
+
await user.click(screen.getByRole('tab', { name: 'Autonomous agents' }));
|
|
765
|
+
await screen.findByText('CI');
|
|
766
|
+
const rowOf = (label: string) => screen.getByText(label).closest('li') as HTMLElement;
|
|
767
|
+
expect(rowOf('CI')).toHaveTextContent('Revoked by an admin');
|
|
768
|
+
expect(rowOf('CI')).not.toHaveTextContent('Disconnected');
|
|
769
|
+
expect(rowOf('Laptop')).toHaveTextContent('Disconnected');
|
|
770
|
+
expect(rowOf('Laptop')).not.toHaveTextContent('Revoked by an admin');
|
|
771
|
+
expect(rowOf('Old')).toHaveTextContent('Disconnected');
|
|
772
|
+
});
|
|
773
|
+
|
|
346
774
|
it('says where the keys went when only Claude connections exist, and shows a load error on both tabs', async () => {
|
|
347
775
|
listMock.mockResolvedValue([
|
|
348
|
-
{ id: 'c1', kind: GITHUB_LINK_KIND, label: 'Claude', createdAt: Date.now(), lastUsedAt: null, revokedAt: null },
|
|
776
|
+
{ id: 'c1', kind: GITHUB_LINK_KIND, label: 'Claude', createdAt: Date.now(), lastUsedAt: null, revokedAt: null, revokedBy: null },
|
|
349
777
|
]);
|
|
350
778
|
const user = userEvent.setup();
|
|
351
779
|
const first = mount(PUBLIC_URL);
|
|
@@ -381,16 +809,17 @@ describe('the one-click install link', () => {
|
|
|
381
809
|
|
|
382
810
|
/**
|
|
383
811
|
* ChatGPT sits beside Claude, with the honest difference: no prefill
|
|
384
|
-
* exists, so the button opens the settings
|
|
812
|
+
* exists, so the button opens the settings root and the copy under it
|
|
385
813
|
* names the connector to type. Same gate — an endpoint Anthropic cannot
|
|
386
814
|
* reach is one OpenAI cannot reach.
|
|
387
815
|
*/
|
|
388
816
|
it('offers Add to ChatGPT beside it, naming what to call the connector', () => {
|
|
389
817
|
mount(PUBLIC_URL);
|
|
390
818
|
const link = screen.getByRole('link', { name: 'Add to ChatGPT' });
|
|
391
|
-
// The whole href, not just the origin: the settings
|
|
392
|
-
//
|
|
393
|
-
|
|
819
|
+
// The whole href, not just the origin: it opens the settings root, not a
|
|
820
|
+
// pane anchor — ChatGPT renamed the connectors pane, so no anchor reliably
|
|
821
|
+
// lands there, and the steps beside the button start from Settings.
|
|
822
|
+
expect(link).toHaveAttribute('href', 'https://chatgpt.com/#settings');
|
|
394
823
|
expect(link).toHaveAttribute('target', '_blank');
|
|
395
824
|
expect(link).toHaveAttribute('rel', 'noopener noreferrer');
|
|
396
825
|
expect(screen.getByText('Skills, Tools and Knowledge')).toBeInTheDocument();
|
|
@@ -433,6 +862,20 @@ describe('the one-click install link', () => {
|
|
|
433
862
|
});
|
|
434
863
|
|
|
435
864
|
describe('tabs', () => {
|
|
865
|
+
it('puts connection setup first and agent instructions in a separate card below it', () => {
|
|
866
|
+
mount(PUBLIC_URL);
|
|
867
|
+
const connections = screen.getByTestId('agent-connection-section');
|
|
868
|
+
const instructions = screen.getByTestId('agent-instructions-section');
|
|
869
|
+
expect(within(connections).getByRole('tablist')).toBeInTheDocument();
|
|
870
|
+
expect(within(instructions).getByRole('heading', {
|
|
871
|
+
name: 'What agents are told about this knowledge base',
|
|
872
|
+
})).toBeInTheDocument();
|
|
873
|
+
expect(connections.compareDocumentPosition(instructions) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
|
874
|
+
expect(connections.parentElement).toBe(instructions.parentElement);
|
|
875
|
+
expect(connections.className).toContain('rounded-lg');
|
|
876
|
+
expect(instructions.className).toContain('rounded-lg');
|
|
877
|
+
});
|
|
878
|
+
|
|
436
879
|
it('starts on the interactive tab', () => {
|
|
437
880
|
mount(PUBLIC_URL);
|
|
438
881
|
const tabs = screen.getAllByRole('tab');
|
|
@@ -470,3 +913,60 @@ describe('tabs', () => {
|
|
|
470
913
|
expect(screen.queryByRole('link', { name: 'Add to Claude' })).toBeNull();
|
|
471
914
|
});
|
|
472
915
|
});
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Adding a marketplace installs nothing in Codex, and the compiled plugin's
|
|
919
|
+
* server entry carries no credentials: the block has to carry the install and
|
|
920
|
+
* the sign-in, and the page has to say why the sign-in is there.
|
|
921
|
+
*/
|
|
922
|
+
describe('the Codex block', () => {
|
|
923
|
+
const REMOTE = 'https://key:<external-api-key>@kb.acme.com/git/marketplace.git';
|
|
924
|
+
const note = /Codex signs in through your browser once: the login line is needed because the plugin's server entry carries no credentials\./;
|
|
925
|
+
|
|
926
|
+
function codexLines(remote: string): string[] {
|
|
927
|
+
return [
|
|
928
|
+
`codex plugin marketplace add ${remote}`,
|
|
929
|
+
'codex plugin add skills-and-knowledge@hexis',
|
|
930
|
+
'codex mcp login hexis',
|
|
931
|
+
'codex exec --skip-git-repo-check "Call the hexis MCP server\'s list_tools tool and print the tool names it returns."',
|
|
932
|
+
];
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
it('adds, installs, signs in and checks, in that order, and says why it signs in', async () => {
|
|
936
|
+
const user = userEvent.setup();
|
|
937
|
+
mount(PUBLIC_URL);
|
|
938
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
939
|
+
const drawer = screen.getByTestId('marketplace-section');
|
|
940
|
+
const codex = within(drawer)
|
|
941
|
+
.getAllByRole('textbox')
|
|
942
|
+
.map((el) => (el as HTMLTextAreaElement).value)
|
|
943
|
+
.find((v) => v.startsWith('codex '));
|
|
944
|
+
expect(codex?.split('\n')).toEqual(codexLines(REMOTE));
|
|
945
|
+
expect(within(drawer).getByText(note)).toBeTruthy();
|
|
946
|
+
// The other two commands are exactly what they were.
|
|
947
|
+
const values = within(drawer).getAllByRole('textbox').map((el) => (el as HTMLTextAreaElement).value);
|
|
948
|
+
expect(values).toContain(`claude plugin marketplace add ${REMOTE} && claude plugin install hexis-all@hexis`);
|
|
949
|
+
expect(values).toContain(`npx skills add ${REMOTE} --all -y`);
|
|
950
|
+
});
|
|
951
|
+
|
|
952
|
+
it('copies the whole block, not its first line', async () => {
|
|
953
|
+
const user = userEvent.setup();
|
|
954
|
+
mount(PUBLIC_URL);
|
|
955
|
+
await user.click(screen.getByRole('tab', { name: 'Marketplaces' }));
|
|
956
|
+
// Stubbed after userEvent.setup(), which installs a clipboard of its own.
|
|
957
|
+
const writeText = vi.fn().mockResolvedValue(undefined);
|
|
958
|
+
Object.defineProperty(navigator, 'clipboard', { value: { writeText }, configurable: true });
|
|
959
|
+
fireEvent.click(screen.getByRole('button', { name: 'Copy: Codex' }));
|
|
960
|
+
expect(writeText).toHaveBeenCalledWith(codexLines(REMOTE).join('\n'));
|
|
961
|
+
});
|
|
962
|
+
|
|
963
|
+
it('is the same block in the connection-keys dialog, with the key filled in', async () => {
|
|
964
|
+
const user = userEvent.setup();
|
|
965
|
+
mount(PUBLIC_URL);
|
|
966
|
+
await revealAKey(user);
|
|
967
|
+
const dialog = screen.getByRole('alertdialog');
|
|
968
|
+
const block = within(dialog).getByRole('textbox', { name: 'Codex marketplace command' }) as HTMLTextAreaElement;
|
|
969
|
+
expect(block.value.split('\n')).toEqual(codexLines(`https://key:${KEY}@kb.acme.com/git/marketplace.git`));
|
|
970
|
+
expect(within(dialog).getByText(note)).toBeTruthy();
|
|
971
|
+
});
|
|
972
|
+
});
|