@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
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { render, screen, fireEvent, waitFor, within } from '@testing-library/react';
|
|
3
|
+
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
|
|
4
|
+
import {
|
|
5
|
+
WorkspaceContext,
|
|
6
|
+
type WorkspaceContextValue,
|
|
7
|
+
} from '../../workspace/state/workspace.context';
|
|
8
|
+
import { AdminContext, type AdminContextValue } from '../../admin/state/admin.context';
|
|
9
|
+
import type { LibraryData } from '../hooks/useLibraryData';
|
|
10
|
+
import type { PendingToolSummary } from '../services/tools.api';
|
|
11
|
+
import type { PluginSummary } from '../services/plugins.api';
|
|
12
|
+
import { withAuth } from './auth-harness';
|
|
13
|
+
import { NAME_MIN_WIDTH } from '../components/NameWithBadges';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A tool proposed on an open change request, in the library.
|
|
17
|
+
*
|
|
18
|
+
* The bug, told by the tester: they asked the agent for a tool, a change
|
|
19
|
+
* request opened — and the tools UI showed nothing at all until somebody
|
|
20
|
+
* approved it. Skills already had the answer (a Proposed card linked to its
|
|
21
|
+
* request); these tests pin the same answer for tools, and pin the two things
|
|
22
|
+
* a proposal must NOT become: an openable tool page, and a unit of "needs
|
|
23
|
+
* setup" amber.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const dataMock = vi.hoisted(() => ({ useLibraryData: vi.fn() }));
|
|
27
|
+
vi.mock('../hooks/useLibraryData', () => ({ useLibraryData: dataMock.useLibraryData }));
|
|
28
|
+
|
|
29
|
+
const pluginsMock = vi.hoisted(() => ({
|
|
30
|
+
listPlugins: vi.fn(),
|
|
31
|
+
listJoinRequests: vi.fn(),
|
|
32
|
+
reconcileJoinRequest: vi.fn(),
|
|
33
|
+
requestPluginAccess: vi.fn(),
|
|
34
|
+
unlinkSkill: vi.fn(),
|
|
35
|
+
renamePlugin: vi.fn(),
|
|
36
|
+
}));
|
|
37
|
+
vi.mock('../services/teams.api', () => ({ listTeams: vi.fn().mockResolvedValue([]) }));
|
|
38
|
+
vi.mock('../services/plugins.api', () => ({
|
|
39
|
+
listPlugins: pluginsMock.listPlugins,
|
|
40
|
+
listJoinRequests: pluginsMock.listJoinRequests,
|
|
41
|
+
reconcileJoinRequest: pluginsMock.reconcileJoinRequest,
|
|
42
|
+
requestPluginAccess: pluginsMock.requestPluginAccess,
|
|
43
|
+
unlinkSkill: pluginsMock.unlinkSkill,
|
|
44
|
+
renamePlugin: pluginsMock.renamePlugin,
|
|
45
|
+
AlreadyReadableError: class AlreadyReadableError extends Error {},
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
// The review dialog is the CARD'S LINK to the change request: the whole of what
|
|
49
|
+
// there is to read about a proposal, and the only place the decision is made.
|
|
50
|
+
// Stubbed so these tests can see WHICH request the card reached for, without
|
|
51
|
+
// the dialog's own fetching.
|
|
52
|
+
vi.mock('../../change-requests/components/ChangeRequestDialog', () => ({
|
|
53
|
+
ChangeRequestDialog: ({
|
|
54
|
+
cr,
|
|
55
|
+
onClose,
|
|
56
|
+
}: {
|
|
57
|
+
cr: { number: number; title: string };
|
|
58
|
+
onClose(): void;
|
|
59
|
+
}) => (
|
|
60
|
+
<div role="dialog" aria-label={`Change request ${cr.number}`}>
|
|
61
|
+
<p>{cr.title}</p>
|
|
62
|
+
<button type="button" onClick={onClose}>
|
|
63
|
+
Close
|
|
64
|
+
</button>
|
|
65
|
+
</div>
|
|
66
|
+
),
|
|
67
|
+
}));
|
|
68
|
+
|
|
69
|
+
import { LibraryProvider, attentionOf, type LibraryItem } from '../state/library-data';
|
|
70
|
+
import { LibraryToastProvider } from '../state/toast';
|
|
71
|
+
import { PluginPage } from '../components/PluginPage';
|
|
72
|
+
import { PersonalPluginPage } from '../components/PersonalPluginPage';
|
|
73
|
+
|
|
74
|
+
const workspace = {
|
|
75
|
+
workspaceId: 'target-company-state',
|
|
76
|
+
kbDirName: 'knowledge-base',
|
|
77
|
+
} as unknown as WorkspaceContextValue;
|
|
78
|
+
|
|
79
|
+
const nonAdmin: AdminContextValue = {
|
|
80
|
+
isAdmin: false,
|
|
81
|
+
unreadCount: 0,
|
|
82
|
+
lastSeen: null,
|
|
83
|
+
markSeen: vi.fn(),
|
|
84
|
+
refresh: vi.fn(),
|
|
85
|
+
rolesConfigCorrupted: false,
|
|
86
|
+
rolesConfigErrors: [],
|
|
87
|
+
runRolesRecovery: vi.fn(),
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const pendingTool = (over: Partial<PendingToolSummary> = {}): PendingToolSummary => ({
|
|
91
|
+
slug: 'weather',
|
|
92
|
+
name: 'weather',
|
|
93
|
+
path: 'Plugins/Ops/weather.tool',
|
|
94
|
+
type: 'http',
|
|
95
|
+
plugin: 'Ops',
|
|
96
|
+
changeRequestNumber: 7,
|
|
97
|
+
branch: 'agent/weather',
|
|
98
|
+
authorName: 'Ali Raza',
|
|
99
|
+
createdAt: '2026-09-06T09:00:00.000Z',
|
|
100
|
+
isAuthor: false,
|
|
101
|
+
...over,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const emptyCatalog: LibraryData = {
|
|
105
|
+
loading: false,
|
|
106
|
+
error: null,
|
|
107
|
+
skills: [],
|
|
108
|
+
pendingSkills: [],
|
|
109
|
+
pendingTools: [],
|
|
110
|
+
tools: [],
|
|
111
|
+
ownedSkills: new Set(),
|
|
112
|
+
writableSkills: new Set(),
|
|
113
|
+
ownedTools: new Set(),
|
|
114
|
+
allowedToolsBySkill: new Map(),
|
|
115
|
+
crs: [],
|
|
116
|
+
myCrNumbers: new Set<number>(),
|
|
117
|
+
reload: vi.fn(),
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const ops = (over: Partial<PluginSummary> = {}): PluginSummary => ({
|
|
121
|
+
name: 'Ops',
|
|
122
|
+
folders: ['Plugins/Ops'],
|
|
123
|
+
canRead: true,
|
|
124
|
+
canWrite: false,
|
|
125
|
+
isOwner: false,
|
|
126
|
+
skillCount: 0,
|
|
127
|
+
toolCount: 0,
|
|
128
|
+
owners: { roles: [], users: [{ name: 'Olga Ivanova', email: 'olga@bevel.software' }] },
|
|
129
|
+
writers: { roles: ['Admin'], users: [] },
|
|
130
|
+
readers: { restricted: false, roles: [], users: [] },
|
|
131
|
+
hasRequested: false,
|
|
132
|
+
requestNumber: null,
|
|
133
|
+
...over,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
function LocationProbe() {
|
|
137
|
+
const location = useLocation();
|
|
138
|
+
return <div aria-label="href">{location.pathname + location.search}</div>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** The whole tree the tests mount, so a re-render can reuse it verbatim. */
|
|
142
|
+
function opsTree() {
|
|
143
|
+
return (
|
|
144
|
+
<MemoryRouter initialEntries={['/skills-and-tools/plugins/Ops']}>
|
|
145
|
+
<AdminContext.Provider value={nonAdmin}>
|
|
146
|
+
<WorkspaceContext.Provider value={workspace}>
|
|
147
|
+
<LibraryToastProvider>
|
|
148
|
+
<LibraryProvider>
|
|
149
|
+
{withAuth(
|
|
150
|
+
<>
|
|
151
|
+
<Routes>
|
|
152
|
+
<Route path="/skills-and-tools/plugins/:plugin" element={<PluginPage />} />
|
|
153
|
+
<Route path="*" element={<div />} />
|
|
154
|
+
</Routes>
|
|
155
|
+
<LocationProbe />
|
|
156
|
+
</>,
|
|
157
|
+
)}
|
|
158
|
+
</LibraryProvider>
|
|
159
|
+
</LibraryToastProvider>
|
|
160
|
+
</WorkspaceContext.Provider>
|
|
161
|
+
</AdminContext.Provider>
|
|
162
|
+
</MemoryRouter>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function renderOps() {
|
|
167
|
+
return render(opsTree());
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Your own space — the page for the items that belong to no plugin at all. */
|
|
171
|
+
function renderYours() {
|
|
172
|
+
return render(
|
|
173
|
+
<MemoryRouter initialEntries={['/skills-and-tools/yours']}>
|
|
174
|
+
<AdminContext.Provider value={nonAdmin}>
|
|
175
|
+
<WorkspaceContext.Provider value={workspace}>
|
|
176
|
+
<LibraryToastProvider>
|
|
177
|
+
<LibraryProvider>{withAuth(<PersonalPluginPage />)}</LibraryProvider>
|
|
178
|
+
</LibraryToastProvider>
|
|
179
|
+
</WorkspaceContext.Provider>
|
|
180
|
+
</AdminContext.Provider>
|
|
181
|
+
</MemoryRouter>,
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const href = () => screen.getByLabelText('href').textContent;
|
|
186
|
+
|
|
187
|
+
describe('a tool proposed on an open change request', () => {
|
|
188
|
+
/** The `console.error` spy in flight, so `afterEach` can take it off again. */
|
|
189
|
+
let consoleErrorSpy: ReturnType<typeof vi.spyOn> | null = null;
|
|
190
|
+
|
|
191
|
+
beforeEach(() => {
|
|
192
|
+
dataMock.useLibraryData.mockReturnValue(emptyCatalog);
|
|
193
|
+
pluginsMock.listPlugins.mockResolvedValue([ops()]);
|
|
194
|
+
pluginsMock.listJoinRequests.mockResolvedValue([]);
|
|
195
|
+
pluginsMock.reconcileJoinRequest.mockResolvedValue(false);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// The spy a test installs on `console.error` comes off here, pass or fail:
|
|
199
|
+
// an assertion that throws mid-test would otherwise leave it swallowed for
|
|
200
|
+
// every later test in the file, hiding the next real failure behind this
|
|
201
|
+
// one. Scoped to this one spy — `restoreAllMocks` would also tear down the
|
|
202
|
+
// module mocks `beforeEach` depends on.
|
|
203
|
+
afterEach(() => {
|
|
204
|
+
consoleErrorSpy?.mockRestore();
|
|
205
|
+
consoleErrorSpy = null;
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('shows in the plugin it targets, marked in review and named by its proposer', async () => {
|
|
209
|
+
dataMock.useLibraryData.mockReturnValue({ ...emptyCatalog, pendingTools: [pendingTool()] });
|
|
210
|
+
renderOps();
|
|
211
|
+
|
|
212
|
+
const card = await screen.findByTestId('library-card-integration-weather');
|
|
213
|
+
expect(card).toHaveTextContent('weather');
|
|
214
|
+
expect(card).toHaveTextContent('In review');
|
|
215
|
+
expect(card).toHaveTextContent('From Ali Raza: waiting on you');
|
|
216
|
+
// Not mixed in with the active tools: the dashed outline says "an outline
|
|
217
|
+
// of a tool, not one" before a word of it is read.
|
|
218
|
+
expect(card.className).toContain('border-dashed');
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* A long proposed tool keeps a readable name, through the whole page rather
|
|
223
|
+
* than in a hand-built card.
|
|
224
|
+
*
|
|
225
|
+
* A proposal is the most crowded card the library draws — a monogram, the
|
|
226
|
+
* flavour chip and `In review`, all beside the name — and every one of those
|
|
227
|
+
* is `shrink-0`, so before `NameWithBadges` the truncating name paid for all
|
|
228
|
+
* of them: 25px of the 141px `prometheus_metrics` needs, rendered as `p…` in
|
|
229
|
+
* the 260px grid track. The floor is what stops that, and it is granted only
|
|
230
|
+
* while badges are present, so the card with the most badges is the one
|
|
231
|
+
* worth checking reaches it by the real data path.
|
|
232
|
+
*
|
|
233
|
+
* jsdom has no layout, so this is the class rather than the pixels.
|
|
234
|
+
*/
|
|
235
|
+
it('keeps a long proposed tool’s name legible on the page that draws it', async () => {
|
|
236
|
+
dataMock.useLibraryData.mockReturnValue({
|
|
237
|
+
...emptyCatalog,
|
|
238
|
+
pendingTools: [
|
|
239
|
+
pendingTool({
|
|
240
|
+
slug: 'prometheus_metrics',
|
|
241
|
+
name: 'prometheus_metrics',
|
|
242
|
+
path: 'Plugins/Ops/mcp.json',
|
|
243
|
+
type: 'mcp',
|
|
244
|
+
}),
|
|
245
|
+
],
|
|
246
|
+
});
|
|
247
|
+
renderOps();
|
|
248
|
+
|
|
249
|
+
const card = await screen.findByTestId('library-card-integration-prometheus_metrics');
|
|
250
|
+
expect(card).toHaveTextContent('In review');
|
|
251
|
+
// Which file the request adds, beside the fact that it has not landed —
|
|
252
|
+
// the two things an approver is deciding between.
|
|
253
|
+
expect(card).toHaveTextContent('MCP server');
|
|
254
|
+
|
|
255
|
+
const name = within(card).getByText('prometheus_metrics');
|
|
256
|
+
expect(name.className).toContain(NAME_MIN_WIDTH);
|
|
257
|
+
// Clipped or not, the whole name is one hover away.
|
|
258
|
+
expect(name).toHaveAttribute('title', 'prometheus_metrics');
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* The card LINKS to the change request and opens nothing else. A tool page
|
|
263
|
+
* would read the default branch, where the manual does not exist — and would
|
|
264
|
+
* start probing a connection for a file nobody has approved.
|
|
265
|
+
*/
|
|
266
|
+
it('opens its change request rather than a tool page', async () => {
|
|
267
|
+
dataMock.useLibraryData.mockReturnValue({ ...emptyCatalog, pendingTools: [pendingTool()] });
|
|
268
|
+
renderOps();
|
|
269
|
+
const before = href();
|
|
270
|
+
|
|
271
|
+
fireEvent.click(await screen.findByTestId('library-card-integration-weather'));
|
|
272
|
+
|
|
273
|
+
const dialog = await screen.findByRole('dialog', { name: 'Change request 7' });
|
|
274
|
+
expect(dialog).toHaveTextContent('New tool: weather');
|
|
275
|
+
// Still on the plugin page: the click navigated nowhere.
|
|
276
|
+
expect(href()).toBe(before);
|
|
277
|
+
|
|
278
|
+
fireEvent.click(screen.getByRole('button', { name: 'Close' }));
|
|
279
|
+
await waitFor(() =>
|
|
280
|
+
expect(screen.queryByRole('dialog', { name: 'Change request 7' })).not.toBeInTheDocument(),
|
|
281
|
+
);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Once the request is no longer open the backend stops listing it, so the
|
|
286
|
+
* next load simply has no proposal — and the card is gone, replaced by the
|
|
287
|
+
* real tool when the request merged. Pinned here as the FRONTEND's half of
|
|
288
|
+
* that: nothing on this side caches a proposal past the load it arrived on.
|
|
289
|
+
*/
|
|
290
|
+
it('disappears on the next load once the request is resolved', async () => {
|
|
291
|
+
dataMock.useLibraryData.mockReturnValue({ ...emptyCatalog, pendingTools: [pendingTool()] });
|
|
292
|
+
const view = renderOps();
|
|
293
|
+
await screen.findByTestId('library-card-integration-weather');
|
|
294
|
+
|
|
295
|
+
// The SAME mounted tree, re-rendered against the answer the reloaded
|
|
296
|
+
// catalog now gives — the request merged or closed, so the backend lists
|
|
297
|
+
// no proposal. Mounting a second, fresh tree would prove nothing: a
|
|
298
|
+
// provider that cached proposals in state would still start empty there,
|
|
299
|
+
// and the caching regression this guards against is exactly the one that
|
|
300
|
+
// survives across a reload.
|
|
301
|
+
dataMock.useLibraryData.mockReturnValue(emptyCatalog);
|
|
302
|
+
view.rerender(opsTree());
|
|
303
|
+
|
|
304
|
+
await screen.findByText('No tools yet.');
|
|
305
|
+
expect(screen.queryByTestId('library-card-integration-weather')).not.toBeInTheDocument();
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* A tool's plugin membership is DERIVED from where its file sits, and a
|
|
310
|
+
* plugin can LINK a root outside its own folder. A released tool under such a
|
|
311
|
+
* root is on that plugin's page; a proposal into the same root must be too,
|
|
312
|
+
* or the card the reviewer is meant to act on is on no page at all.
|
|
313
|
+
*/
|
|
314
|
+
it('shows under a plugin that only LINKS the root its declaration lands in', async () => {
|
|
315
|
+
pluginsMock.listPlugins.mockResolvedValue([
|
|
316
|
+
ops({ folders: ['Plugins/Ops'], linkedRoots: ['Integrations'] }),
|
|
317
|
+
]);
|
|
318
|
+
dataMock.useLibraryData.mockReturnValue({
|
|
319
|
+
...emptyCatalog,
|
|
320
|
+
pendingTools: [pendingTool({ path: 'Integrations/weather.tool', plugin: null })],
|
|
321
|
+
});
|
|
322
|
+
renderOps();
|
|
323
|
+
|
|
324
|
+
const card = await screen.findByTestId('library-card-integration-weather');
|
|
325
|
+
expect(card).toHaveTextContent('In review');
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* A proposal in NO plugin folder lands on your own space — and its card says
|
|
330
|
+
* "waiting on you" just as it does anywhere else. A card that names the
|
|
331
|
+
* reader as the reviewer and then does nothing when clicked is the one
|
|
332
|
+
* arrangement that cannot be right, so this page opens the request too.
|
|
333
|
+
*/
|
|
334
|
+
it('opens its change request from your own space as well', async () => {
|
|
335
|
+
dataMock.useLibraryData.mockReturnValue({
|
|
336
|
+
...emptyCatalog,
|
|
337
|
+
pendingTools: [pendingTool({ path: 'Plugins/weather.tool', plugin: null })],
|
|
338
|
+
});
|
|
339
|
+
renderYours();
|
|
340
|
+
|
|
341
|
+
const card = await screen.findByTestId('library-card-integration-weather');
|
|
342
|
+
expect(card).toHaveTextContent('From Ali Raza: waiting on you');
|
|
343
|
+
fireEvent.click(card);
|
|
344
|
+
expect(await screen.findByRole('dialog', { name: 'Change request 7' })).toBeInTheDocument();
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Nothing has been approved yet, so nothing has been refused a collision:
|
|
349
|
+
* one request can add the same basename to two plugin folders, and both
|
|
350
|
+
* cards have to render. Keyed on the id and the request number alone they
|
|
351
|
+
* would be one key, and React would drop one of them.
|
|
352
|
+
*/
|
|
353
|
+
it('renders both proposals when one request adds the same name twice', async () => {
|
|
354
|
+
dataMock.useLibraryData.mockReturnValue({
|
|
355
|
+
...emptyCatalog,
|
|
356
|
+
pendingTools: [
|
|
357
|
+
pendingTool({ path: 'Plugins/Ops/weather.tool' }),
|
|
358
|
+
pendingTool({ path: 'Plugins/Ops/Field/weather.tool' }),
|
|
359
|
+
],
|
|
360
|
+
});
|
|
361
|
+
// Restored by the suite's `afterEach`, never here: an assertion below
|
|
362
|
+
// that throws would otherwise leave `console.error` swallowed for every
|
|
363
|
+
// later test in the file, hiding the next real failure behind this one.
|
|
364
|
+
const complaints = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
365
|
+
consoleErrorSpy = complaints;
|
|
366
|
+
renderOps();
|
|
367
|
+
expect(await screen.findAllByTestId('library-card-integration-weather')).toHaveLength(2);
|
|
368
|
+
// Two same-keyed siblings still PAINT — React only warns — so the render
|
|
369
|
+
// count alone would pass either way. The warning is the failure.
|
|
370
|
+
expect(
|
|
371
|
+
complaints.mock.calls.map((c) => String(c[0])).join('\n'),
|
|
372
|
+
).not.toMatch(/same key/i);
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* A proposal is a REVIEW concern, never a setup one. Counting it would put
|
|
377
|
+
* amber on the plugin's sidebar row and offer a "what needs you" filter for a
|
|
378
|
+
* tool that does not exist — there is no credential to fill in.
|
|
379
|
+
*/
|
|
380
|
+
it('is not counted as an integration needing setup', () => {
|
|
381
|
+
const proposed: LibraryItem = {
|
|
382
|
+
kind: 'integration',
|
|
383
|
+
id: 'weather',
|
|
384
|
+
name: 'weather',
|
|
385
|
+
description: '',
|
|
386
|
+
owned: false,
|
|
387
|
+
canWrite: false,
|
|
388
|
+
plugin: 'Ops',
|
|
389
|
+
path: 'Plugins/Ops/weather.tool',
|
|
390
|
+
status: { state: 'ok', text: 'In review' },
|
|
391
|
+
pending: { changeRequestNumber: 7, branch: 'agent/weather', authorName: 'Ali Raza', mine: false },
|
|
392
|
+
};
|
|
393
|
+
expect(attentionOf([proposed], 'Ops').total).toBe(0);
|
|
394
|
+
// Even if a proposal ever carried a non-`ok` status, it still must not.
|
|
395
|
+
expect(attentionOf([{ ...proposed, status: { state: 'warn', text: 'Needs setup' } }], 'Ops').total).toBe(0);
|
|
396
|
+
// …while a released tool in the same state is exactly what the count is for.
|
|
397
|
+
const released: LibraryItem = { ...proposed, pending: undefined, status: { state: 'warn', text: 'Needs setup' } };
|
|
398
|
+
expect(attentionOf([released], 'Ops').total).toBe(1);
|
|
399
|
+
});
|
|
400
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import type { LibraryItem } from '../state/library-data';
|
|
3
|
+
import type { PluginSummary } from '../services/plugins.api';
|
|
4
|
+
import { pluginEntriesFor } from '../utils/plugin-entries';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The plugin rows of a gallery page, from both witnesses. Driven through the
|
|
8
|
+
* one exported function with crafted catalogs and summaries.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const item = (over: Partial<LibraryItem>): LibraryItem => ({
|
|
12
|
+
kind: 'skill',
|
|
13
|
+
id: 'x',
|
|
14
|
+
name: 'x',
|
|
15
|
+
description: '',
|
|
16
|
+
owned: false,
|
|
17
|
+
canWrite: false,
|
|
18
|
+
status: { state: 'ok', text: 'Ready' },
|
|
19
|
+
plugin: null,
|
|
20
|
+
path: 'Skills/x',
|
|
21
|
+
...over,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const summary = (over: Partial<PluginSummary>): PluginSummary => ({
|
|
25
|
+
name: 'gtm',
|
|
26
|
+
displayName: 'GTM',
|
|
27
|
+
folders: ['Plugins/GTM'],
|
|
28
|
+
linksAreManaged: true,
|
|
29
|
+
canRead: true,
|
|
30
|
+
canWrite: false,
|
|
31
|
+
isOwner: false,
|
|
32
|
+
skillCount: 3,
|
|
33
|
+
toolCount: 2,
|
|
34
|
+
brokenLinks: 0,
|
|
35
|
+
owners: { roles: [], users: [] },
|
|
36
|
+
writers: { roles: [], users: [] },
|
|
37
|
+
readers: { restricted: true, roles: [], users: [] },
|
|
38
|
+
hasRequested: false,
|
|
39
|
+
requestNumber: null,
|
|
40
|
+
...over,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const names = (entries: { name: string | null }[]) => entries.map((e) => e.name);
|
|
44
|
+
|
|
45
|
+
describe('pluginEntriesFor', () => {
|
|
46
|
+
it('leads Everything with the own space, then every plugin either witness names', () => {
|
|
47
|
+
const items = [
|
|
48
|
+
item({ id: 'a', name: 'a', plugin: 'ops', path: 'Plugins/Ops/skills/a' }),
|
|
49
|
+
// Reached only through a LINK: no folder item names the plugin.
|
|
50
|
+
item({ id: 'b', name: 'b', shared: true, path: 'Skills/Eng/b', plugins: [{ name: 'eng', linked: true, granted: true }] }),
|
|
51
|
+
item({ id: 'mine', name: 'mine', path: 'Plugins/personal-u1/skills/mine' }),
|
|
52
|
+
];
|
|
53
|
+
const entries = pluginEntriesFor(items, [summary({})], { kind: 'all' }, [], '', 'Yours');
|
|
54
|
+
expect(names(entries)).toEqual([null, 'eng', 'gtm', 'ops']);
|
|
55
|
+
expect(entries[0]).toMatchObject({ label: 'Yours', skillCount: 1, toolCount: 0, member: true });
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('counts a plugin\'s items by folder OR by link, the way its page lists them', () => {
|
|
59
|
+
const items = [
|
|
60
|
+
item({ id: 'a', name: 'a', plugin: 'gtm', path: 'Plugins/GTM/skills/a' }),
|
|
61
|
+
item({ id: 'b', name: 'b', shared: true, path: 'Skills/Eng/b', plugins: [{ name: 'gtm', linked: true, granted: true }] }),
|
|
62
|
+
item({ kind: 'integration', id: 't', name: 't', plugin: 'gtm', path: 'Plugins/GTM/mcp.json' }),
|
|
63
|
+
];
|
|
64
|
+
// No summary: the catalog's own counts stand.
|
|
65
|
+
const [, gtm] = pluginEntriesFor(items, [], { kind: 'all' }, [], '', 'Yours');
|
|
66
|
+
expect(gtm).toMatchObject({ name: 'gtm', skillCount: 2, toolCount: 1, member: true });
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('is a member by READ, never by write — an admin rescued into the rules of a folder they cannot open is locked out', () => {
|
|
70
|
+
const rescued = summary({ canRead: false, canWrite: true });
|
|
71
|
+
const [, gtm] = pluginEntriesFor([], [rescued], { kind: 'all' }, [], '', 'Yours');
|
|
72
|
+
expect(gtm?.member).toBe(false);
|
|
73
|
+
// …but a linked skill in the catalog proves they can read something of it.
|
|
74
|
+
const linked = item({ id: 'b', name: 'b', shared: true, path: 'Skills/Eng/b', plugins: [{ name: 'gtm', linked: true, granted: true }] });
|
|
75
|
+
const [, again] = pluginEntriesFor([linked], [rescued], { kind: 'all' }, [], '', 'Yours');
|
|
76
|
+
expect(again?.member).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('Owned by me keeps the plugins the caller OWNS (`isOwner`), own space first — managing is not owning', () => {
|
|
80
|
+
const entries = pluginEntriesFor(
|
|
81
|
+
[],
|
|
82
|
+
[
|
|
83
|
+
summary({ name: 'gtm', canWrite: true, isOwner: true }),
|
|
84
|
+
// A manager (an Admin by role, say) who is not in the owner list.
|
|
85
|
+
summary({ name: 'ops', displayName: 'Ops', canWrite: true, isOwner: false }),
|
|
86
|
+
summary({ name: 'hr', displayName: 'HR', canWrite: false, isOwner: false }),
|
|
87
|
+
],
|
|
88
|
+
{ kind: 'owned' },
|
|
89
|
+
[],
|
|
90
|
+
'',
|
|
91
|
+
'Yours',
|
|
92
|
+
);
|
|
93
|
+
expect(names(entries)).toEqual([null, 'gtm']);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("a team's rows are the server's plugins, counted by the team's slice, with no own space", () => {
|
|
97
|
+
const items = [
|
|
98
|
+
item({ id: 'a', name: 'a', plugin: 'gtm', path: 'Plugins/GTM/skills/a' }),
|
|
99
|
+
item({ id: 'b', name: 'b', plugin: 'gtm', path: 'Plugins/GTM/skills/b' }),
|
|
100
|
+
item({ kind: 'integration', id: 't', name: 't', plugin: 'gtm', path: 'Plugins/GTM/mcp.json' }),
|
|
101
|
+
];
|
|
102
|
+
const teams = [{ name: 'Sales', plugins: ['gtm'], skills: ['a'], tools: [] }];
|
|
103
|
+
const entries = pluginEntriesFor(items, [summary({ skillCount: 9, toolCount: 9 })], { kind: 'team', group: 'Sales' }, teams, '', 'Yours');
|
|
104
|
+
expect(entries).toHaveLength(1);
|
|
105
|
+
expect(entries[0]).toMatchObject({ name: 'gtm', skillCount: 1, toolCount: 0 });
|
|
106
|
+
// An unknown team lists nothing — and so does a known one that names no plugin.
|
|
107
|
+
expect(pluginEntriesFor(items, [summary({})], { kind: 'team', group: 'Nobody' }, teams, '', 'Yours')).toEqual([]);
|
|
108
|
+
const empty = [{ name: 'Sales', plugins: [], skills: ['a'], tools: [] }];
|
|
109
|
+
expect(pluginEntriesFor(items, [summary({})], { kind: 'team', group: 'Sales' }, empty, '', 'Yours')).toEqual([]);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('a search narrows the rows by label, own space included', () => {
|
|
113
|
+
const entries = pluginEntriesFor([], [summary({}), summary({ name: 'ops', displayName: 'Ops' })], { kind: 'all' }, [], 'gt', 'Yours');
|
|
114
|
+
expect(names(entries)).toEqual(['gtm']);
|
|
115
|
+
expect(names(pluginEntriesFor([], [summary({})], { kind: 'all' }, [], 'you', 'Yours'))).toEqual([null]);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('lists no plugins for a plugin page or the personal page', () => {
|
|
119
|
+
expect(pluginEntriesFor([], [summary({})], { kind: 'group', plugin: 'gtm' }, [], '', 'Yours')).toEqual([]);
|
|
120
|
+
expect(pluginEntriesFor([], [summary({})], { kind: 'ungrouped' }, [], '', 'Yours')).toEqual([]);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { pluginLabel, pluginNameForPath, pluginsHoldingTool } from '../utils/plugin-summary';
|
|
3
|
+
|
|
4
|
+
const summaries = [
|
|
5
|
+
{ name: 'gtm', displayName: 'Go To Market', folders: ['Plugins/GTM'] },
|
|
6
|
+
{ name: 'deep', displayName: 'Deep', folders: ['Plugins/GTM/teams/Deep'] },
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
describe('pluginNameForPath', () => {
|
|
10
|
+
it('names the plugin by the catalog folder holding the path — the deepest one', () => {
|
|
11
|
+
expect(pluginNameForPath('Plugins/GTM/skills/outreach', summaries)).toBe('gtm');
|
|
12
|
+
expect(pluginNameForPath('Plugins/GTM/teams/Deep/skills/x', summaries)).toBe('deep');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('asks the catalog FIRST: a listed folder names the plugin whatever the folder is called', () => {
|
|
16
|
+
const listed = [{ name: 'shelf', displayName: 'Shelf', folders: ['Plugins/personal-u1'] }];
|
|
17
|
+
expect(pluginNameForPath('Plugins/personal-u1/skills/notes', listed)).toBe('shelf');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('falls back to the folder for an unlisted path, and to null for a personal shelf', () => {
|
|
21
|
+
expect(pluginNameForPath('Plugins/Legacy/skills/x', summaries)).toBe('Legacy');
|
|
22
|
+
expect(pluginNameForPath('Plugins/personal-u1/skills/notes', summaries)).toBeNull();
|
|
23
|
+
expect(pluginNameForPath('Skills/Eng/deploy', summaries)).toBeNull();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('pluginLabel', () => {
|
|
28
|
+
it('is the display name, else the identity', () => {
|
|
29
|
+
expect(pluginLabel('gtm', summaries)).toBe('Go To Market');
|
|
30
|
+
expect(pluginLabel('unknown', summaries)).toBe('unknown');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe('pluginsHoldingTool', () => {
|
|
35
|
+
// A tool file in one plugin's folder, and a root two other plugins link.
|
|
36
|
+
const withRoots = [
|
|
37
|
+
{ name: 'gtm', folders: ['Plugins/GTM'], linkedRoots: ['Plugins/Shared/observability'] },
|
|
38
|
+
{ name: 'ops', folders: ['Plugins/Ops'], linkedRoots: ['Plugins/Shared/observability'] },
|
|
39
|
+
{ name: 'finance', folders: ['Plugins/Finance'], linkedRoots: [] },
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
it('is INLINE in the plugin whose folder holds the file', () => {
|
|
43
|
+
expect(pluginsHoldingTool('Plugins/GTM/heyreach.tool', withRoots)).toEqual([
|
|
44
|
+
{ name: 'gtm', linked: false, granted: true },
|
|
45
|
+
]);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('is LINKED into every plugin whose linked root holds it — a shared root reaches them all', () => {
|
|
49
|
+
expect(pluginsHoldingTool('Plugins/Shared/observability/grafana.tool', withRoots)).toEqual([
|
|
50
|
+
{ name: 'gtm', linked: true, granted: true },
|
|
51
|
+
{ name: 'ops', linked: true, granted: true },
|
|
52
|
+
]);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('says INLINE once, never twice: a root inside the plugin’s own folder adds nothing', () => {
|
|
56
|
+
const selfRooted = [{ name: 'gtm', folders: ['Plugins/GTM'], linkedRoots: ['Plugins/GTM/tools'] }];
|
|
57
|
+
expect(pluginsHoldingTool('Plugins/GTM/tools/grafana.tool', selfRooted)).toEqual([
|
|
58
|
+
{ name: 'gtm', linked: false, granted: true },
|
|
59
|
+
]);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('claims nothing on a sibling folder sharing a prefix, nor from an older server with no roots', () => {
|
|
63
|
+
expect(pluginsHoldingTool('Plugins/Shared/observability-archive/old.tool', withRoots)).toEqual([]);
|
|
64
|
+
const older = [{ name: 'gtm', folders: ['Plugins/GTM'] }];
|
|
65
|
+
expect(pluginsHoldingTool('Plugins/Shared/observability/grafana.tool', older)).toEqual([]);
|
|
66
|
+
});
|
|
67
|
+
});
|