@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useMemo, useState } from 'react';
|
|
2
|
+
import { DEFAULT_BRANCH, type FileTreeEntry } from '@bevel-software/platform-shared';
|
|
3
|
+
import { isUngrouped } from '../utils/status';
|
|
2
4
|
import { useNavigate } from 'react-router-dom';
|
|
3
|
-
import { useAuth } from '../../auth/state/auth.context';
|
|
4
5
|
import { useLibrary, type LibraryItem } from '../state/library-data';
|
|
5
6
|
import { useLibraryToast } from '../state/toast.context';
|
|
6
7
|
import { urlForLibraryItem } from '../routes/library-paths';
|
|
@@ -10,7 +11,11 @@ import { EmptySkillsNudge, PluginBreadcrumb, PluginItemSections, PageNote,
|
|
|
10
11
|
RemoveLibraryItemDialog,
|
|
11
12
|
} from './plugin-page-parts';
|
|
12
13
|
import { PageActions } from './PageActions';
|
|
14
|
+
import { PendingItemReview } from './PendingItemReview';
|
|
15
|
+
import { cn } from '../../../lib/utils';
|
|
16
|
+
import { HEADER_BAND, PAGE_HEADER_TESTID } from '../../../shared/theme/header';
|
|
13
17
|
import { PersonalAddDialog } from './PersonalAddDialog';
|
|
18
|
+
import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
|
|
14
19
|
import { copyToClipboard } from '../utils/clipboard';
|
|
15
20
|
|
|
16
21
|
/**
|
|
@@ -26,27 +31,45 @@ import { copyToClipboard } from '../utils/clipboard';
|
|
|
26
31
|
* kind of thing — with ONE exception, and it is a real one rather than a
|
|
27
32
|
* decision:
|
|
28
33
|
*
|
|
29
|
-
* - no Share. Every other action here is a client-side
|
|
30
|
-
* needs a folder to write an `access.md` into, and
|
|
31
|
-
* the items in NO folder. There is nothing to point
|
|
32
|
-
* prototype can share its personal list because there it
|
|
33
|
-
* record (`mine:<uid>`, proto:2265); the platform has no
|
|
34
|
-
* Share button that opens an editor over nothing is
|
|
35
|
-
* Giving a person's own items a home folder is a
|
|
36
|
-
* that exists this stays absent.
|
|
34
|
+
* - no Share IN THE TITLE ROW. Every other action here is a client-side
|
|
35
|
+
* affordance, but sharing needs a folder to write an `access.md` into, and
|
|
36
|
+
* this page is defined as the items in NO folder. There is nothing to point
|
|
37
|
+
* the dialog at. The prototype can share its personal list because there it
|
|
38
|
+
* is a real space record (`mine:<uid>`, proto:2265); the platform has no
|
|
39
|
+
* such object, and a Share button that opens an editor over nothing is
|
|
40
|
+
* worse than no button. Giving a person's own items a home folder is a
|
|
41
|
+
* backend change, and until that exists this stays absent.
|
|
42
|
+
*
|
|
43
|
+
* That absence is about the SPACE, not about what is in it. A skill here is
|
|
44
|
+
* still a folder of its own with its own rules — which is exactly the
|
|
45
|
+
* standalone skill the skill page offers Share for — so each skill CARD
|
|
46
|
+
* carries the same `…` menu it carries everywhere else, pointed at its own
|
|
47
|
+
* folder. Only the page has nothing to share; the skills on it do.
|
|
37
48
|
*/
|
|
38
49
|
export function PersonalPluginPage() {
|
|
39
50
|
const data = useLibrary();
|
|
40
51
|
const navigate = useNavigate();
|
|
41
52
|
const { kbDirName } = useWorkspace();
|
|
42
|
-
const { user } = useAuth();
|
|
43
53
|
const [addOpen, setAddOpen] = useState(false);
|
|
44
54
|
const toast = useLibraryToast();
|
|
45
55
|
/** The card being removed, while its confirm dialog is up. */
|
|
46
56
|
const [removing, setRemoving] = useState<LibraryItem | null>(null);
|
|
57
|
+
/**
|
|
58
|
+
* Which folder the access dialog is open on — set only by a card's Share,
|
|
59
|
+
* since the page itself has no folder to share. Held as the dialog's own
|
|
60
|
+
* entry, exactly as the gallery and the skill page hold it, so retargeting
|
|
61
|
+
* at an ancestor is the setter itself.
|
|
62
|
+
*/
|
|
63
|
+
const [manageTarget, setManageTarget] = useState<FileTreeEntry | null>(null);
|
|
64
|
+
/**
|
|
65
|
+
* The proposal whose change request is open in the review dialog — the same
|
|
66
|
+
* arrangement the gallery and the plugin page hold it in, so a Proposed card
|
|
67
|
+
* behaves identically on all three.
|
|
68
|
+
*/
|
|
69
|
+
const [reviewing, setReviewing] = useState<LibraryItem | null>(null);
|
|
47
70
|
|
|
48
|
-
const name = personalPluginName(
|
|
49
|
-
const items = useMemo(() => data.items.filter(
|
|
71
|
+
const name = personalPluginName();
|
|
72
|
+
const items = useMemo(() => data.items.filter(isUngrouped), [data.items]);
|
|
50
73
|
/**
|
|
51
74
|
* For the add dialog's name check. Every skill, not only the ungrouped ones:
|
|
52
75
|
* a skill's id is its name and ids are global, so a new skill here collides
|
|
@@ -59,8 +82,23 @@ export function PersonalPluginPage() {
|
|
|
59
82
|
const skillItems = items.filter((i) => i.kind === 'skill');
|
|
60
83
|
const toolItems = items.filter((i) => i.kind === 'integration');
|
|
61
84
|
|
|
62
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* Identical to the gallery's and the plugin page's — one behaviour per card,
|
|
87
|
+
* wherever you clicked it.
|
|
88
|
+
*
|
|
89
|
+
* A PROPOSAL has no page to navigate to (its file is on a change request's
|
|
90
|
+
* branch, and every item page reads the default branch), so it opens its
|
|
91
|
+
* change request instead — the only thing there is to read about it. This
|
|
92
|
+
* page is no exception: a proposal reaches an ungrouped card when its
|
|
93
|
+
* declaration sits in no plugin folder, and the card itself says whether it
|
|
94
|
+
* is waiting on YOU. A card that names the reader as the reviewer and then
|
|
95
|
+
* does nothing when clicked is the one arrangement that cannot be right.
|
|
96
|
+
*/
|
|
63
97
|
function openItem(item: LibraryItem) {
|
|
98
|
+
if (item.pending) {
|
|
99
|
+
setReviewing(item);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
64
102
|
if (kbDirName) navigate(urlForLibraryItem(kbDirName, item));
|
|
65
103
|
}
|
|
66
104
|
|
|
@@ -70,16 +108,26 @@ export function PersonalPluginPage() {
|
|
|
70
108
|
|
|
71
109
|
return (
|
|
72
110
|
<div className="pb-14">
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
111
|
+
{/* The same title row every plugin page has — the shared header band,
|
|
112
|
+
the height the sidebar's header row is, and the page's FIRST row:
|
|
113
|
+
the breadcrumb rides on the band, because a crumb row above it would
|
|
114
|
+
push the title bar off the line the sidebar's header row holds. The
|
|
115
|
+
description line that used to sit under it is gone: "Only you see
|
|
116
|
+
this" is what the page's own name already says, and a subtitle
|
|
117
|
+
explaining a heading is the heading admitting it did not work
|
|
118
|
+
(proto: the personal list carries no lede). */}
|
|
119
|
+
<div data-testid={PAGE_HEADER_TESTID} className={cn(HEADER_BAND, 'justify-between gap-4')}>
|
|
120
|
+
{/* Clipped, and allowed to take the row's shortfall, for the reason
|
|
121
|
+
the plugin page's is — the trail is a fixed width, so a group that
|
|
122
|
+
could only shrink would run its content across the actions beside
|
|
123
|
+
it on a narrow viewport. */}
|
|
124
|
+
<div className="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
|
125
|
+
<PluginBreadcrumb />
|
|
126
|
+
<h1 className="min-w-0 truncate text-display font-semibold" title={name}>
|
|
127
|
+
{name}
|
|
128
|
+
</h1>
|
|
129
|
+
</div>
|
|
130
|
+
<div className="flex-none">
|
|
83
131
|
<PageActions
|
|
84
132
|
onAdd={() => setAddOpen(true)}
|
|
85
133
|
onCopyLink={() => copyToClipboard(window.location.href)}
|
|
@@ -92,6 +140,17 @@ export function PersonalPluginPage() {
|
|
|
92
140
|
skillItems={skillItems}
|
|
93
141
|
toolItems={toolItems}
|
|
94
142
|
onOpen={openItem}
|
|
143
|
+
// The skill's own folder, not the space's — see the page's docstring.
|
|
144
|
+
onShare={
|
|
145
|
+
kbDirName
|
|
146
|
+
? (item) =>
|
|
147
|
+
setManageTarget({
|
|
148
|
+
name: item.path.split('/').pop() ?? item.path,
|
|
149
|
+
relativePath: `${kbDirName}/${item.path}`,
|
|
150
|
+
type: 'directory',
|
|
151
|
+
})
|
|
152
|
+
: undefined
|
|
153
|
+
}
|
|
95
154
|
// Your own space: everything here is yours to remove — the backend's
|
|
96
155
|
// per-path gate agrees, since your personal folder names you as owner.
|
|
97
156
|
onRemove={setRemoving}
|
|
@@ -119,6 +178,47 @@ export function PersonalPluginPage() {
|
|
|
119
178
|
/>
|
|
120
179
|
)}
|
|
121
180
|
|
|
181
|
+
{/* The same dialog the plugin page opens, on a skill's folder instead of
|
|
182
|
+
a plugin's. `kbDirName` gates the OPENER because the resolver
|
|
183
|
+
addresses files repo-relative and the dialog strips that prefix. */}
|
|
184
|
+
{manageTarget && (
|
|
185
|
+
<ManageAccessDialog
|
|
186
|
+
// Keyed on the path, so retargeting at an ancestor remounts it
|
|
187
|
+
// against that folder — the gallery's arrangement exactly.
|
|
188
|
+
key={manageTarget.relativePath}
|
|
189
|
+
// The Library speaks the DEFAULT branch: these cards list what is on
|
|
190
|
+
// it, so the rules they share are edited where they were read,
|
|
191
|
+
// whatever branch the ambient workspace happens to be on. Same choice
|
|
192
|
+
// the skill page's Share and the gallery's make.
|
|
193
|
+
workspaceId={encodeURIComponent(DEFAULT_BRANCH)}
|
|
194
|
+
entry={manageTarget}
|
|
195
|
+
// A personal skill's grant is usually its own, but one inherited from
|
|
196
|
+
// a folder above it is managed where it lives — the skill page's
|
|
197
|
+
// `Manage <Folder> →`, which a card's Share must offer too or the
|
|
198
|
+
// inherited grant is read-only here and editable there.
|
|
199
|
+
onManageAncestor={setManageTarget}
|
|
200
|
+
onClose={() => {
|
|
201
|
+
setManageTarget(null);
|
|
202
|
+
// A grant can change who sees the skill — and whether it is still
|
|
203
|
+
// in no plugin at all — so the catalog is re-read.
|
|
204
|
+
data.reload();
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
)}
|
|
208
|
+
|
|
209
|
+
{reviewing && (
|
|
210
|
+
<PendingItemReview
|
|
211
|
+
item={reviewing}
|
|
212
|
+
onClose={() => setReviewing(null)}
|
|
213
|
+
onResolved={() => {
|
|
214
|
+
setReviewing(null);
|
|
215
|
+
// One reload moves it off the review shelf and into the catalog —
|
|
216
|
+
// where, once merged, it is a released item of your own.
|
|
217
|
+
data.reload();
|
|
218
|
+
}}
|
|
219
|
+
/>
|
|
220
|
+
)}
|
|
221
|
+
|
|
122
222
|
{removing && (
|
|
123
223
|
<RemoveLibraryItemDialog
|
|
124
224
|
item={removing}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
1
|
+
import { useEffect, useId, useState } from 'react';
|
|
2
2
|
import { useNavigate } from 'react-router-dom';
|
|
3
|
-
import {
|
|
3
|
+
import { ChevronRight } from 'lucide-react';
|
|
4
|
+
import { DEFAULT_BRANCH, PLUGINS_DIR, PLUGIN_MANIFEST_FILE, type FileTreeEntry } from '@bevel-software/platform-shared';
|
|
5
|
+
import { cn } from '../../../lib/utils';
|
|
4
6
|
import { Button } from '../../../shared/components';
|
|
5
|
-
import { listFiles } from '../../workspace/services/workspace.api';
|
|
7
|
+
import { listFiles, readFile } from '../../workspace/services/workspace.api';
|
|
6
8
|
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
7
|
-
import {
|
|
9
|
+
import { checkoutRoot } from '../../workspace/utils/fileTree';
|
|
8
10
|
import { kbFileUrl } from '../../workspace/routing/kb-routes';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* The plugin page's two smallest sections, both pure REUSE of the Knowledge
|
|
12
|
-
*
|
|
13
|
-
* editor the tool page's "Edit the tool file" uses —
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* the
|
|
14
|
+
* file viewer: links are `kbFileUrl` + `rawFile` navigations into the same
|
|
15
|
+
* raw editor the tool page's "Edit the tool file" uses — rendered inside
|
|
16
|
+
* this app by `WorkspaceItemRoute`; no new viewer, no new backend. The one
|
|
17
|
+
* exception is a `.tool` file in a namespace listing, which drops the
|
|
18
|
+
* `rawFile` state so the item route renders its library tool page — the
|
|
19
|
+
* same destination its card in the Tools band reaches.
|
|
17
20
|
*
|
|
18
21
|
* MANIFEST: writers get a button to `plugin.json`. It is a button to the FILE,
|
|
19
22
|
* not a form, deliberately: the fields worth hand-editing (`version`,
|
|
@@ -58,6 +61,122 @@ export function ManifestButton({
|
|
|
58
61
|
);
|
|
59
62
|
}
|
|
60
63
|
|
|
64
|
+
/** The bundle dialect's manifest — read-only here; the file is edited in its own repository. */
|
|
65
|
+
const BUNDLE_MANIFEST_FILE = 'plugin.bundle.json';
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The manifest's CONTENTS, at the bottom of the plugin page, behind a
|
|
69
|
+
* disclosure: closed, it is one line naming the file; open, it is the file —
|
|
70
|
+
* what the plugin declares (its identifier, version, the skills it links,
|
|
71
|
+
* the servers it declares) shown as the JSON it is, pretty-printed when it
|
|
72
|
+
* parses and verbatim when it does not. Read only when opened, so a page
|
|
73
|
+
* view costs no request for a section most visits never expand. A writer
|
|
74
|
+
* gets the way to the raw editor from here too.
|
|
75
|
+
*/
|
|
76
|
+
export function ManifestSection({
|
|
77
|
+
kbDirName,
|
|
78
|
+
folder,
|
|
79
|
+
managed,
|
|
80
|
+
canWrite,
|
|
81
|
+
}: {
|
|
82
|
+
kbDirName: string | null;
|
|
83
|
+
folder: string;
|
|
84
|
+
/** A native manifest (`plugin.json`); false for the bundle dialect's file. */
|
|
85
|
+
managed: boolean;
|
|
86
|
+
canWrite: boolean;
|
|
87
|
+
}) {
|
|
88
|
+
const workspaceId = encodeURIComponent(DEFAULT_BRANCH);
|
|
89
|
+
const navigate = useNavigate();
|
|
90
|
+
const panelId = useId();
|
|
91
|
+
const file = managed ? PLUGIN_MANIFEST_FILE : BUNDLE_MANIFEST_FILE;
|
|
92
|
+
const path = kbDirName ? `${kbDirName}/${PLUGINS_DIR}/${folder}/${file}` : null;
|
|
93
|
+
const [open, setOpen] = useState(false);
|
|
94
|
+
// What was read, KEYED BY THE PATH it was read from: a folder change shows
|
|
95
|
+
// nothing of the previous plugin's file while the new read is in flight,
|
|
96
|
+
// with no reset to write — a result for another path is simply not this one.
|
|
97
|
+
const [loaded, setLoaded] = useState<{ path: string; text: string | null; failed: boolean } | null>(null);
|
|
98
|
+
const current = loaded?.path === path ? loaded : null;
|
|
99
|
+
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (!open || path === null) return;
|
|
102
|
+
let live = true;
|
|
103
|
+
readFile(workspaceId, path)
|
|
104
|
+
.then((text) => {
|
|
105
|
+
if (live) setLoaded({ path, text, failed: false });
|
|
106
|
+
})
|
|
107
|
+
.catch(() => {
|
|
108
|
+
if (live) setLoaded({ path, text: null, failed: true });
|
|
109
|
+
});
|
|
110
|
+
return () => {
|
|
111
|
+
live = false;
|
|
112
|
+
};
|
|
113
|
+
}, [open, workspaceId, path]);
|
|
114
|
+
|
|
115
|
+
if (path === null) return null;
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<section className="mt-8">
|
|
119
|
+
<button
|
|
120
|
+
type="button"
|
|
121
|
+
onClick={() => setOpen((o) => !o)}
|
|
122
|
+
aria-expanded={open}
|
|
123
|
+
aria-controls={panelId}
|
|
124
|
+
className="flex items-center gap-[7px] text-label font-semibold uppercase text-ink-faint transition-colors hover:text-ink"
|
|
125
|
+
>
|
|
126
|
+
<span className="flex w-3 flex-none items-center justify-center">
|
|
127
|
+
<ChevronRight size={11} className={cn('transition-transform duration-150', open && 'rotate-90')} />
|
|
128
|
+
</span>
|
|
129
|
+
Manifest
|
|
130
|
+
<span className="font-mono normal-case tracking-normal text-ink-faint">{file}</span>
|
|
131
|
+
</button>
|
|
132
|
+
{/* The panel is always in the tree, so the button's `aria-controls`
|
|
133
|
+
names an element that exists; only its CONTENT waits for `open`
|
|
134
|
+
(and so does the read behind it). */}
|
|
135
|
+
<div id={panelId} className={open ? 'mt-2.5' : undefined}>
|
|
136
|
+
{open && (
|
|
137
|
+
<>
|
|
138
|
+
<p className="mb-2 max-w-[62ch] text-detail text-ink-muted">
|
|
139
|
+
What the plugin declares: its identifier and version, the skills it links and the
|
|
140
|
+
servers it names.{' '}
|
|
141
|
+
{managed
|
|
142
|
+
? 'The extensions block is written by the platform; the rest is yours to edit.'
|
|
143
|
+
: 'Read from the bundle format; it is edited in its own repository.'}
|
|
144
|
+
</p>
|
|
145
|
+
{current?.failed ? (
|
|
146
|
+
<p className="text-detail text-ink-muted">Couldn't read {file}.</p>
|
|
147
|
+
) : current?.text == null ? (
|
|
148
|
+
<p className="text-detail text-ink-faint">Loading…</p>
|
|
149
|
+
) : (
|
|
150
|
+
<pre className="overflow-x-auto rounded-md border border-line bg-sunken px-3.5 py-2.5 font-mono text-detail text-ink">
|
|
151
|
+
{prettyJson(current.text)}
|
|
152
|
+
</pre>
|
|
153
|
+
)}
|
|
154
|
+
{canWrite && managed && (
|
|
155
|
+
<Button
|
|
156
|
+
variant="quiet"
|
|
157
|
+
size="sm"
|
|
158
|
+
className="mt-2"
|
|
159
|
+
onClick={() => navigate(kbFileUrl(DEFAULT_BRANCH, path), { state: { rawFile: true } })}
|
|
160
|
+
>
|
|
161
|
+
Edit the manifest
|
|
162
|
+
</Button>
|
|
163
|
+
)}
|
|
164
|
+
</>
|
|
165
|
+
)}
|
|
166
|
+
</div>
|
|
167
|
+
</section>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** The file as JSON, laid out — or as written, when it is not JSON. */
|
|
172
|
+
function prettyJson(text: string): string {
|
|
173
|
+
try {
|
|
174
|
+
return JSON.stringify(JSON.parse(text), null, 2);
|
|
175
|
+
} catch {
|
|
176
|
+
return text;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
61
180
|
interface NamespaceListing {
|
|
62
181
|
namespace: string;
|
|
63
182
|
files: string[]; // plugin-relative, e.g. `com.example.client/hooks/on-save.js`
|
|
@@ -97,13 +216,13 @@ export function ClientExtensionsSection({
|
|
|
97
216
|
setListings([]);
|
|
98
217
|
if (!kbDirName) return;
|
|
99
218
|
if (reusableTree) {
|
|
100
|
-
setListings(namespaceListings(reusableTree, folder));
|
|
219
|
+
setListings(namespaceListings(reusableTree, kbDirName, folder));
|
|
101
220
|
return;
|
|
102
221
|
}
|
|
103
222
|
let live = true;
|
|
104
223
|
listFiles(workspaceId)
|
|
105
224
|
.then((tree) => {
|
|
106
|
-
if (live) setListings(namespaceListings(tree, folder));
|
|
225
|
+
if (live) setListings(namespaceListings(tree, kbDirName, folder));
|
|
107
226
|
})
|
|
108
227
|
.catch(() => {
|
|
109
228
|
/* the section renders nothing — a tree fetch failure is not this page's story */
|
|
@@ -158,14 +277,20 @@ export function ClientExtensionsSection({
|
|
|
158
277
|
|
|
159
278
|
/**
|
|
160
279
|
* Walk the (already-loaded, ACL-filtered) tree down to this plugin's namespace
|
|
161
|
-
* dirs. Through `
|
|
162
|
-
* fileTree
|
|
163
|
-
*
|
|
164
|
-
*
|
|
280
|
+
* dirs. Through `checkoutRoot`, the one way anything here reaches into the
|
|
281
|
+
* repository: the fileTree roots at the workspace and carries the checkout as
|
|
282
|
+
* its `<kbDirName>/` child, and a `Plugins/` anywhere else in the workspace
|
|
283
|
+
* is not this deployment's.
|
|
165
284
|
*/
|
|
166
|
-
function namespaceListings(
|
|
167
|
-
|
|
168
|
-
|
|
285
|
+
function namespaceListings(
|
|
286
|
+
tree: FileTreeEntry,
|
|
287
|
+
kbDirName: string,
|
|
288
|
+
folder: string,
|
|
289
|
+
): NamespaceListing[] {
|
|
290
|
+
const kbRoot = checkoutRoot(tree, kbDirName);
|
|
291
|
+
// `folder` is the path below the plugins root — one segment for a top-level
|
|
292
|
+
// plugin, several for a nested one — and the tree is walked a segment at a time.
|
|
293
|
+
const pluginDir = kbRoot ? descend(kbRoot, [PLUGINS_DIR, ...folder.split('/')]) : null;
|
|
169
294
|
if (!pluginDir?.children) return [];
|
|
170
295
|
const out: NamespaceListing[] = [];
|
|
171
296
|
for (const child of pluginDir.children) {
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { ListRow } from '../../../shared/components';
|
|
3
|
+
import { cn } from '../../../lib/utils';
|
|
4
|
+
import { ItemMenuFrame, type ItemAction } from './ItemActionsMenu';
|
|
5
|
+
import { NameWithBadges } from './NameWithBadges';
|
|
3
6
|
|
|
4
7
|
export interface PluginIndexRowProps {
|
|
5
8
|
label: string;
|
|
6
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Beside the label — the `Owner` and `Private` chips. Beside it while there
|
|
11
|
+
* is room for both: past that the chips drop below the name rather than go
|
|
12
|
+
* on taking width from it (see `NameWithBadges`), so a row with chips can
|
|
13
|
+
* be two lines tall on a narrow window.
|
|
14
|
+
*/
|
|
7
15
|
badge?: ReactNode;
|
|
8
16
|
description?: string;
|
|
9
17
|
/** Right-aligned counts, e.g. `4 skills · 2 tools`. */
|
|
@@ -15,6 +23,13 @@ export interface PluginIndexRowProps {
|
|
|
15
23
|
* boolean, which is why those three states cost this file nothing.
|
|
16
24
|
*/
|
|
17
25
|
trailing?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* The row's own menu, BESIDE Open — Share for a plugin the caller can read,
|
|
28
|
+
* Subscribe for one it cannot. Empty (the default) leaves the row exactly as
|
|
29
|
+
* it was: the caller's own space is not a plugin and has neither verb, so it
|
|
30
|
+
* grows no `…` rather than growing one that can only say "Open".
|
|
31
|
+
*/
|
|
32
|
+
actions?: ItemAction[];
|
|
18
33
|
onOpen(): void;
|
|
19
34
|
}
|
|
20
35
|
|
|
@@ -25,6 +40,14 @@ export interface PluginIndexRowProps {
|
|
|
25
40
|
* with a link inside it: every row here means exactly one thing, "go there".
|
|
26
41
|
* Counts live in `meta` as plain text so the row's accessible name reads as the
|
|
27
42
|
* sentence it looks like ("GTM Run by Olga Ivanova 4 skills · 2 tools").
|
|
43
|
+
*
|
|
44
|
+
* When the row has `actions`, a `…` rides its right edge — a SIBLING of the row
|
|
45
|
+
* button, since the row is the button (see `ItemMenuFrame`). The row then keeps
|
|
46
|
+
* the trailing room clear for it (`pr-10`) instead of letting the menu paint
|
|
47
|
+
* over the counts and the Locked chip it is right beside. The frame itself is
|
|
48
|
+
* always there: which verbs a row has depends on answers that arrive after the
|
|
49
|
+
* first paint, and a frame that came with them would remount the row under
|
|
50
|
+
* whoever was already using it.
|
|
28
51
|
*/
|
|
29
52
|
export function PluginIndexRow({
|
|
30
53
|
label,
|
|
@@ -32,23 +55,23 @@ export function PluginIndexRow({
|
|
|
32
55
|
description,
|
|
33
56
|
meta,
|
|
34
57
|
trailing,
|
|
58
|
+
actions,
|
|
35
59
|
onOpen,
|
|
36
60
|
}: PluginIndexRowProps) {
|
|
37
|
-
|
|
61
|
+
const row = (
|
|
38
62
|
<ListRow
|
|
39
63
|
as="button"
|
|
40
64
|
density="row"
|
|
41
65
|
onClick={onOpen}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
66
|
+
className={cn(actions && actions.length > 0 && 'pr-10')}
|
|
67
|
+
// The same rule a card's name lives by, and for the same reason: a row
|
|
68
|
+
// narrowed by its counts used to spend all of its shortfall on the
|
|
69
|
+
// plugin's name while `Owner` and `Private` kept every pixel they
|
|
70
|
+
// asked for. Through `NameWithBadges` the chips drop to a second line
|
|
71
|
+
// before the name goes under a readable width — and the name carries
|
|
72
|
+
// its full self in `title` even on a row that has no chips at all,
|
|
73
|
+
// which the bare string it used to be could not.
|
|
74
|
+
label={<NameWithBadges name={label} badges={badge} />}
|
|
52
75
|
description={description}
|
|
53
76
|
meta={
|
|
54
77
|
meta || trailing ? (
|
|
@@ -60,4 +83,16 @@ export function PluginIndexRow({
|
|
|
60
83
|
}
|
|
61
84
|
/>
|
|
62
85
|
);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<ItemMenuFrame
|
|
89
|
+
label={label}
|
|
90
|
+
actions={actions ?? []}
|
|
91
|
+
// A row is one line tall, so its `…` sits on the mid-line rather than in
|
|
92
|
+
// a corner the way a card's does.
|
|
93
|
+
buttonClassName="top-1/2 right-2 -translate-y-1/2"
|
|
94
|
+
>
|
|
95
|
+
{row}
|
|
96
|
+
</ItemMenuFrame>
|
|
97
|
+
);
|
|
63
98
|
}
|