@bevel-software/platform-core-frontend 0.7.5 → 0.8.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/LICENSE +202 -202
- package/THIRD-PARTY-NOTICES.md +344 -988
- package/package.json +5 -5
- package/src/core/CoreAppShell.tsx +4 -4
- package/src/core/__tests__/ShellRoutes.test.tsx +1 -1
- package/src/core/__tests__/bootstrap.test.ts +47 -2
- package/src/core/bootstrap.ts +20 -0
- package/src/css-side-effect-imports.d.ts +7 -7
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +1 -1
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +5 -5
- package/src/modules/access/api.ts +5 -5
- package/src/modules/access/components/ManageAccessDialog.tsx +21 -20
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
- package/src/modules/admin/components/AdminRolesPage.tsx +1 -1
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +2 -2
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +1 -1
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +1 -1
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +4 -4
- package/src/modules/layout/__tests__/SidebarToggle.test.tsx +4 -4
- package/src/modules/layout/__tests__/breakpoints.test.ts +1 -1
- package/src/modules/layout/components/SidebarFrame.tsx +2 -2
- package/src/modules/library/__tests__/{AddToGroupDialog.test.tsx → AddToPluginDialog.test.tsx} +34 -34
- package/src/modules/library/__tests__/LibraryCard.test.tsx +30 -11
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +84 -59
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +51 -51
- package/src/modules/library/__tests__/{LockedGroupView.test.tsx → LockedPluginView.test.tsx} +33 -33
- package/src/modules/library/__tests__/McpServerSection.test.tsx +138 -0
- package/src/modules/library/__tests__/{NewGroupDialog.test.tsx → NewPluginDialog.test.tsx} +22 -22
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +7 -7
- package/src/modules/library/__tests__/PluginExtras.test.tsx +131 -0
- package/src/modules/library/__tests__/{GroupJoinRequests.test.tsx → PluginJoinRequests.test.tsx} +24 -24
- package/src/modules/library/__tests__/{GroupPage.test.tsx → PluginPage.test.tsx} +101 -101
- package/src/modules/library/__tests__/{GroupsIndexPage.test.tsx → PluginsIndexPage.test.tsx} +57 -57
- package/src/modules/library/__tests__/{GroupsSidebar.contextmenu.test.tsx → PluginsSidebar.contextmenu.test.tsx} +31 -31
- package/src/modules/library/__tests__/{GroupsSidebar.locked.test.tsx → PluginsSidebar.locked.test.tsx} +28 -28
- package/src/modules/library/__tests__/{GroupsSidebar.test.tsx → PluginsSidebar.test.tsx} +39 -39
- package/src/modules/library/__tests__/{GroupsSidebarMenu.test.tsx → PluginsSidebarMenu.test.tsx} +18 -18
- package/src/modules/library/__tests__/SkillPage.test.tsx +8 -8
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +2 -2
- package/src/modules/library/__tests__/ToolPage.test.tsx +41 -12
- package/src/modules/library/__tests__/ToolSharePanel.test.tsx +1 -1
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +57 -57
- package/src/modules/library/__tests__/auth-harness.tsx +4 -4
- package/src/modules/library/__tests__/status.test.ts +19 -19
- package/src/modules/library/__tests__/tools.api.test.ts +70 -0
- package/src/modules/library/__tests__/useToolPage.test.tsx +4 -4
- package/src/modules/library/components/AccessRequestsBanner.tsx +8 -8
- package/src/modules/library/components/{AddToGroupDialog.tsx → AddToPluginDialog.tsx} +11 -11
- package/src/modules/library/components/ChangeRequestDock.tsx +1 -1
- package/src/modules/library/components/{DeleteGroupDialog.tsx → DeletePluginDialog.tsx} +9 -9
- package/src/modules/library/components/LibraryCard.tsx +26 -2
- package/src/modules/library/components/LibraryLayout.tsx +70 -70
- package/src/modules/library/components/LibraryPage.tsx +8 -8
- package/src/modules/library/components/LockGlyph.tsx +1 -1
- package/src/modules/library/components/{LockedGroupView.tsx → LockedPluginView.tsx} +35 -35
- package/src/modules/library/components/{ManagedGroupRequests.tsx → ManagedPluginRequests.tsx} +13 -13
- package/src/modules/library/components/{NewGroupDialog.tsx → NewPluginDialog.tsx} +24 -24
- package/src/modules/library/components/NewSkillPanel.tsx +5 -5
- package/src/modules/library/components/PageActions.tsx +3 -3
- package/src/modules/library/components/PersonalAddDialog.tsx +5 -5
- package/src/modules/library/components/{PersonalGroupPage.tsx → PersonalPluginPage.tsx} +17 -17
- package/src/modules/library/components/PluginExtras.tsx +195 -0
- package/src/modules/library/components/{GroupIndexRow.tsx → PluginIndexRow.tsx} +6 -6
- package/src/modules/library/components/{GroupJoinRequests.tsx → PluginJoinRequests.tsx} +12 -12
- package/src/modules/library/components/{GroupPage.tsx → PluginPage.tsx} +72 -69
- package/src/modules/library/components/{GroupsIndexPage.tsx → PluginsIndexPage.tsx} +46 -46
- package/src/modules/library/components/{GroupsSidebar.tsx → PluginsSidebar.tsx} +55 -55
- package/src/modules/library/components/{GroupsSidebarMenu.tsx → PluginsSidebarMenu.tsx} +15 -15
- package/src/modules/library/components/{group-page-parts.tsx → plugin-page-parts.tsx} +35 -24
- package/src/modules/library/components/skill-page/SkillPage.tsx +12 -12
- package/src/modules/library/components/tool-page/McpServerSection.tsx +380 -0
- package/src/modules/library/components/tool-page/ToolPage.tsx +22 -5
- package/src/modules/library/hooks/useJoinRequests.ts +8 -8
- package/src/modules/library/routes/LibraryRoutes.tsx +30 -17
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +24 -24
- package/src/modules/library/routes/library-paths.ts +36 -36
- package/src/modules/library/services/library.api.ts +9 -9
- package/src/modules/library/services/{groups.api.ts → plugins.api.ts} +43 -43
- package/src/modules/library/services/tools.api.ts +54 -0
- package/src/modules/library/state/library-data.tsx +46 -46
- package/src/modules/library/utils/names.ts +1 -1
- package/src/modules/library/utils/{personal-group.ts → personal-plugin.ts} +8 -8
- package/src/modules/library/utils/{group-summary.ts → plugin-summary.ts} +14 -14
- package/src/modules/library/utils/status.ts +17 -17
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +86 -8
- package/src/modules/onboarding/agent-clients.ts +18 -14
- package/src/modules/onboarding/components/WelcomePage.tsx +19 -8
- package/src/modules/review/components/MarkdownDiffViewer.tsx +1 -1
- package/src/modules/review/components/ReviewPanel.tsx +11 -11
- package/src/modules/review/components/__tests__/{isGroupItemPath.test.ts → isPluginItemPath.test.ts} +24 -24
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +3 -3
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +1 -1
- package/src/modules/settings/components/SettingsLayout.tsx +1 -1
- package/src/modules/settings/components/SettingsNav.tsx +5 -5
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +29 -107
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +1 -1
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +228 -0
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +3 -3
- package/src/modules/workspace/components/FileExplorer.tsx +12 -12
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +14 -14
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +7 -2
- package/src/modules/workspace/utils/__tests__/diff.test.ts +1 -1
- package/src/modules/workspace/utils/fileTree.ts +3 -3
- package/src/shared/mcp/ClaudeInstallLink.tsx +88 -0
- package/src/shared/mcp/ConnectionInstructions.tsx +51 -0
- package/src/shared/mcp/CopyBlock.tsx +42 -0
- package/src/shared/mcp/__tests__/ClaudeInstallLink.test.tsx +40 -0
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +431 -0
- package/src/shared/mcp/__tests__/useCopyFeedback.test.ts +112 -0
- package/src/shared/mcp/connect-snippets.ts +353 -0
- package/src/shared/mcp/index.ts +28 -0
- package/src/shared/mcp/useCopyFeedback.ts +46 -0
- package/src/test-setup.ts +11 -0
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
import { AdminContext, type AdminContextValue } from '../../admin/state/admin.context';
|
|
10
10
|
import type { LibraryData } from '../hooks/useLibraryData';
|
|
11
11
|
import type { ToolSecrets } from '../../secrets-vault/services/tool-secrets.api';
|
|
12
|
-
import type {
|
|
12
|
+
import type { PluginSummary } from '../services/plugins.api';
|
|
13
13
|
import { withAuth } from './auth-harness';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* The
|
|
17
|
-
* the
|
|
16
|
+
* The plugin page: which view a caller gets, what the page says about who runs
|
|
17
|
+
* the plugin, and where its one action goes. The catalog and the plugin index are
|
|
18
18
|
* mocked at their two seams — what is under test is the page's judgement, not
|
|
19
19
|
* the fetching underneath it.
|
|
20
20
|
*/
|
|
@@ -22,11 +22,11 @@ import { withAuth } from './auth-harness';
|
|
|
22
22
|
const dataMock = vi.hoisted(() => ({ useLibraryData: vi.fn() }));
|
|
23
23
|
vi.mock('../hooks/useLibraryData', () => ({ useLibraryData: dataMock.useLibraryData }));
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const pluginsMock = vi.hoisted(() => ({
|
|
26
|
+
listPlugins: vi.fn(),
|
|
27
27
|
listJoinRequests: vi.fn(),
|
|
28
28
|
reconcileJoinRequest: vi.fn(),
|
|
29
|
-
|
|
29
|
+
requestPluginAccess: vi.fn(),
|
|
30
30
|
}));
|
|
31
31
|
const libApiMock = vi.hoisted(() => ({ removeLibraryItem: vi.fn() }));
|
|
32
32
|
vi.mock('../services/library.api', async (importOriginal) => ({
|
|
@@ -34,16 +34,16 @@ vi.mock('../services/library.api', async (importOriginal) => ({
|
|
|
34
34
|
removeLibraryItem: libApiMock.removeLibraryItem,
|
|
35
35
|
}));
|
|
36
36
|
|
|
37
|
-
vi.mock('../services/
|
|
38
|
-
|
|
39
|
-
listJoinRequests:
|
|
40
|
-
reconcileJoinRequest:
|
|
41
|
-
|
|
37
|
+
vi.mock('../services/plugins.api', () => ({
|
|
38
|
+
listPlugins: pluginsMock.listPlugins,
|
|
39
|
+
listJoinRequests: pluginsMock.listJoinRequests,
|
|
40
|
+
reconcileJoinRequest: pluginsMock.reconcileJoinRequest,
|
|
41
|
+
requestPluginAccess: pluginsMock.requestPluginAccess,
|
|
42
42
|
AlreadyReadableError: class AlreadyReadableError extends Error {},
|
|
43
43
|
}));
|
|
44
44
|
|
|
45
45
|
// The ONE access surface — the separate summary section this page was designed
|
|
46
|
-
// with never shipped, so there is no `
|
|
46
|
+
// with never shipped, so there is no `PluginAccessSection.test.tsx` to defer to.
|
|
47
47
|
// Mocked at the component: the dialog fetches on mount, and stubbing that seam
|
|
48
48
|
// keeps these tests on the page's judgement rather than the network. Its own
|
|
49
49
|
// behaviour lives in the access module's tests; what this file owes is that the
|
|
@@ -66,7 +66,7 @@ vi.mock('../../access/components/ManageAccessDialog', () => ({
|
|
|
66
66
|
|
|
67
67
|
import { LibraryProvider } from '../state/library-data';
|
|
68
68
|
import { LibraryToastProvider } from '../state/toast';
|
|
69
|
-
import {
|
|
69
|
+
import { PluginPage } from '../components/PluginPage';
|
|
70
70
|
|
|
71
71
|
const workspace = {
|
|
72
72
|
workspaceId: 'target-company-state',
|
|
@@ -87,7 +87,7 @@ const nonAdmin: AdminContextValue = {
|
|
|
87
87
|
const connectedTool = (over: Partial<ToolSecrets> = {}): ToolSecrets => ({
|
|
88
88
|
slug: 'heyreach',
|
|
89
89
|
name: 'heyreach',
|
|
90
|
-
path: '
|
|
90
|
+
path: 'Plugins/GTM/heyreach.tool',
|
|
91
91
|
type: 'inline',
|
|
92
92
|
setup: null,
|
|
93
93
|
canWrite: false,
|
|
@@ -100,7 +100,7 @@ const unsetTool = (over: Partial<ToolSecrets> = {}): ToolSecrets =>
|
|
|
100
100
|
connectedTool({
|
|
101
101
|
slug: 'apollo',
|
|
102
102
|
name: 'apollo',
|
|
103
|
-
path: '
|
|
103
|
+
path: 'Plugins/GTM/apollo.tool',
|
|
104
104
|
variables: [
|
|
105
105
|
{
|
|
106
106
|
name: 'API_KEY',
|
|
@@ -118,8 +118,8 @@ const CATALOG: LibraryData = {
|
|
|
118
118
|
loading: false,
|
|
119
119
|
error: null,
|
|
120
120
|
skills: [
|
|
121
|
-
{ name: 'outreach', description: 'Runs the GTM outreach.', path: '
|
|
122
|
-
{ name: 'roadmap', description: 'Keeps the roadmap.', path: '
|
|
121
|
+
{ name: 'outreach', description: 'Runs the GTM outreach.', path: 'Plugins/GTM/outreach' },
|
|
122
|
+
{ name: 'roadmap', description: 'Keeps the roadmap.', path: 'Plugins/Product/roadmap' },
|
|
123
123
|
],
|
|
124
124
|
pendingSkills: [],
|
|
125
125
|
tools: [connectedTool()],
|
|
@@ -130,9 +130,9 @@ const CATALOG: LibraryData = {
|
|
|
130
130
|
reload: vi.fn(),
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
const gtm = (over: Partial<
|
|
133
|
+
const gtm = (over: Partial<PluginSummary> = {}): PluginSummary => ({
|
|
134
134
|
name: 'GTM',
|
|
135
|
-
folders: ['
|
|
135
|
+
folders: ['Plugins/GTM'],
|
|
136
136
|
canRead: true,
|
|
137
137
|
canWrite: false,
|
|
138
138
|
isOwner: false,
|
|
@@ -155,9 +155,9 @@ function LocationProbe() {
|
|
|
155
155
|
return <div aria-label="href">{location.pathname + location.search}</div>;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
function
|
|
158
|
+
function renderPlugin(name: string, children?: ReactNode) {
|
|
159
159
|
return render(
|
|
160
|
-
<MemoryRouter initialEntries={[`/skills-and-tools/
|
|
160
|
+
<MemoryRouter initialEntries={[`/skills-and-tools/plugins/${encodeURIComponent(name)}`]}>
|
|
161
161
|
<AdminContext.Provider value={nonAdmin}>
|
|
162
162
|
<WorkspaceContext.Provider value={workspace}>
|
|
163
163
|
<LibraryToastProvider>
|
|
@@ -165,7 +165,7 @@ function renderGroup(name: string, children?: ReactNode) {
|
|
|
165
165
|
{withAuth(
|
|
166
166
|
<>
|
|
167
167
|
<Routes>
|
|
168
|
-
<Route path="/skills-and-tools/
|
|
168
|
+
<Route path="/skills-and-tools/plugins/:plugin" element={<PluginPage />} />
|
|
169
169
|
<Route path="*" element={<div />} />
|
|
170
170
|
</Routes>
|
|
171
171
|
<LocationProbe />
|
|
@@ -182,53 +182,53 @@ function renderGroup(name: string, children?: ReactNode) {
|
|
|
182
182
|
|
|
183
183
|
const href = () => screen.getByLabelText('href').textContent;
|
|
184
184
|
|
|
185
|
-
describe('
|
|
185
|
+
describe('PluginPage', () => {
|
|
186
186
|
beforeEach(() => {
|
|
187
187
|
dataMock.useLibraryData.mockReturnValue(CATALOG);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
pluginsMock.listPlugins.mockResolvedValue([gtm()]);
|
|
189
|
+
pluginsMock.listJoinRequests.mockResolvedValue([]);
|
|
190
|
+
pluginsMock.reconcileJoinRequest.mockResolvedValue(false);
|
|
191
|
+
pluginsMock.requestPluginAccess.mockResolvedValue(undefined);
|
|
192
192
|
});
|
|
193
193
|
|
|
194
|
-
it('lets a
|
|
195
|
-
|
|
194
|
+
it('lets a plugin MANAGER remove a skill, behind a confirm that says who loses it', async () => {
|
|
195
|
+
pluginsMock.listPlugins.mockResolvedValue([gtm({ canWrite: true })]);
|
|
196
196
|
libApiMock.removeLibraryItem.mockResolvedValue(undefined);
|
|
197
|
-
|
|
197
|
+
renderPlugin('GTM');
|
|
198
198
|
|
|
199
199
|
fireEvent.click(await screen.findByRole('button', { name: 'Remove outreach' }));
|
|
200
200
|
expect(await screen.findByText(/Everyone here loses it/)).toBeInTheDocument();
|
|
201
201
|
fireEvent.click(screen.getByRole('button', { name: 'Remove' }));
|
|
202
202
|
|
|
203
203
|
// The skill FOLDER, repo-relative — the recursive delete under it runs
|
|
204
|
-
// per-file through the same ACL gate that governs editing the
|
|
204
|
+
// per-file through the same ACL gate that governs editing the plugin.
|
|
205
205
|
await waitFor(() =>
|
|
206
|
-
expect(libApiMock.removeLibraryItem).toHaveBeenCalledWith('
|
|
206
|
+
expect(libApiMock.removeLibraryItem).toHaveBeenCalledWith('Plugins/GTM/outreach'),
|
|
207
207
|
);
|
|
208
208
|
expect(await screen.findByText(/Removed outreach from GTM/)).toBeInTheDocument();
|
|
209
209
|
});
|
|
210
210
|
|
|
211
211
|
it('offers no remove affordance to a non-manager', async () => {
|
|
212
|
-
|
|
212
|
+
renderPlugin('GTM'); // gtm() defaults to canWrite: false
|
|
213
213
|
await screen.findByText('outreach');
|
|
214
214
|
expect(screen.queryByRole('button', { name: 'Remove outreach' })).toBeNull();
|
|
215
215
|
});
|
|
216
216
|
|
|
217
|
-
it("shows only the
|
|
218
|
-
|
|
217
|
+
it("shows only the plugin's own skills and tools", async () => {
|
|
218
|
+
renderPlugin('GTM');
|
|
219
219
|
expect(await screen.findByRole('heading', { name: 'GTM', level: 1 })).toBeInTheDocument();
|
|
220
220
|
expect(screen.getByTestId('library-card-skill-outreach')).toBeInTheDocument();
|
|
221
221
|
expect(screen.getByTestId('library-card-integration-heyreach')).toBeInTheDocument();
|
|
222
|
-
// Product's skill belongs to another
|
|
222
|
+
// Product's skill belongs to another plugin and never appears here.
|
|
223
223
|
expect(screen.queryByTestId('library-card-skill-roadmap')).not.toBeInTheDocument();
|
|
224
224
|
expect(screen.getByRole('heading', { name: 'Skills' })).toBeInTheDocument();
|
|
225
225
|
expect(screen.getByRole('heading', { name: 'Tools' })).toBeInTheDocument();
|
|
226
226
|
});
|
|
227
227
|
|
|
228
|
-
it('leads with the
|
|
229
|
-
|
|
228
|
+
it('leads with the plugin, not with who runs it', async () => {
|
|
229
|
+
renderPlugin('GTM');
|
|
230
230
|
expect(await screen.findByRole('heading', { name: 'GTM', level: 1 })).toBeInTheDocument();
|
|
231
|
-
// The run-by/shared-with lede is gone: it restated, above every
|
|
231
|
+
// The run-by/shared-with lede is gone: it restated, above every plugin, what
|
|
232
232
|
// the Share panel says once and on demand.
|
|
233
233
|
expect(screen.queryByText(/^Run by /)).not.toBeInTheDocument();
|
|
234
234
|
expect(screen.queryByText(/shared with/)).not.toBeInTheDocument();
|
|
@@ -238,10 +238,10 @@ describe('GroupPage', () => {
|
|
|
238
238
|
// skills or tools" (a dialog) and "Propose a skill or tool" (a whole other
|
|
239
239
|
// page) — the same button, in the same spot, opening a different flow with
|
|
240
240
|
// different words depending on who pressed it. Who reviews what is a property
|
|
241
|
-
// of the
|
|
241
|
+
// of the plugin, not of the door.
|
|
242
242
|
it('opens the same add dialog for a writer', async () => {
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
pluginsMock.listPlugins.mockResolvedValue([gtm({ canWrite: true })]);
|
|
244
|
+
renderPlugin('GTM');
|
|
245
245
|
fireEvent.click(await screen.findByRole('button', { name: 'Add a skill or tool to GTM' }));
|
|
246
246
|
expect(
|
|
247
247
|
await screen.findByRole('heading', { name: 'Add a skill or tool to GTM' }),
|
|
@@ -251,7 +251,7 @@ describe('GroupPage', () => {
|
|
|
251
251
|
});
|
|
252
252
|
|
|
253
253
|
it('opens the same add dialog for everyone else, and says review is coming', async () => {
|
|
254
|
-
|
|
254
|
+
renderPlugin('GTM');
|
|
255
255
|
fireEvent.click(await screen.findByRole('button', { name: 'Add a skill or tool to GTM' }));
|
|
256
256
|
expect(
|
|
257
257
|
await screen.findByRole('heading', { name: 'Add a skill or tool to GTM' }),
|
|
@@ -261,7 +261,7 @@ describe('GroupPage', () => {
|
|
|
261
261
|
});
|
|
262
262
|
|
|
263
263
|
it('offers no separate propose door to anybody', async () => {
|
|
264
|
-
|
|
264
|
+
renderPlugin('GTM');
|
|
265
265
|
await screen.findByRole('button', { name: 'Add a skill or tool to GTM' });
|
|
266
266
|
expect(screen.queryByRole('button', { name: /Propose/i })).not.toBeInTheDocument();
|
|
267
267
|
});
|
|
@@ -271,10 +271,10 @@ describe('GroupPage', () => {
|
|
|
271
271
|
...CATALOG,
|
|
272
272
|
tools: [connectedTool(), unsetTool()],
|
|
273
273
|
});
|
|
274
|
-
|
|
274
|
+
renderPlugin('GTM');
|
|
275
275
|
expect(
|
|
276
276
|
await screen.findByText(
|
|
277
|
-
"1 integration needs setup: connect it to unblock this
|
|
277
|
+
"1 integration needs setup: connect it to unblock this plugin's skills.",
|
|
278
278
|
),
|
|
279
279
|
).toBeInTheDocument();
|
|
280
280
|
fireEvent.click(screen.getByRole('button', { name: 'Finish setup' }));
|
|
@@ -284,116 +284,116 @@ describe('GroupPage', () => {
|
|
|
284
284
|
it('pluralises the attention banner', async () => {
|
|
285
285
|
dataMock.useLibraryData.mockReturnValue({
|
|
286
286
|
...CATALOG,
|
|
287
|
-
tools: [unsetTool(), unsetTool({ slug: 'clay', name: 'clay', path: '
|
|
287
|
+
tools: [unsetTool(), unsetTool({ slug: 'clay', name: 'clay', path: 'Plugins/GTM/clay.tool' })],
|
|
288
288
|
});
|
|
289
|
-
|
|
289
|
+
renderPlugin('GTM');
|
|
290
290
|
expect(
|
|
291
291
|
await screen.findByText(
|
|
292
|
-
"2 integrations need setup: connect them to unblock this
|
|
292
|
+
"2 integrations need setup: connect them to unblock this plugin's skills.",
|
|
293
293
|
),
|
|
294
294
|
).toBeInTheDocument();
|
|
295
295
|
});
|
|
296
296
|
|
|
297
|
-
it('renders both empty states for a
|
|
297
|
+
it('renders both empty states for a plugin with nothing in it', async () => {
|
|
298
298
|
dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
pluginsMock.listPlugins.mockResolvedValue([gtm({ skillCount: 0, toolCount: 0 })]);
|
|
300
|
+
renderPlugin('GTM');
|
|
301
301
|
expect(
|
|
302
302
|
await screen.findByText('No skills yet. Add one, or ask your agent to write one for GTM.'),
|
|
303
303
|
).toBeInTheDocument();
|
|
304
304
|
expect(screen.getByText('No tools yet.')).toBeInTheDocument();
|
|
305
305
|
});
|
|
306
306
|
|
|
307
|
-
it('keeps Share on an EMPTY
|
|
308
|
-
//
|
|
307
|
+
it('keeps Share on an EMPTY plugin. The folder is what carries access, not the items', async () => {
|
|
308
|
+
// Plugins used to be derived from their items, which meant a plugin with
|
|
309
309
|
// nothing in it had no folder to manage and silently lost its access
|
|
310
310
|
// surface. `folders` now comes from the backend's readdir, so an empty
|
|
311
|
-
//
|
|
311
|
+
// plugin is still a place whose sharing can be changed.
|
|
312
312
|
dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
|
|
313
|
-
|
|
314
|
-
|
|
313
|
+
pluginsMock.listPlugins.mockResolvedValue([gtm({ skillCount: 0, toolCount: 0 })]);
|
|
314
|
+
renderPlugin('GTM');
|
|
315
315
|
|
|
316
316
|
fireEvent.click(await screen.findByRole('button', { name: 'Share' }));
|
|
317
317
|
expect(
|
|
318
318
|
await screen.findByRole('dialog', {
|
|
319
|
-
name: 'Manage access directory knowledge-base/
|
|
319
|
+
name: 'Manage access directory knowledge-base/Plugins/GTM',
|
|
320
320
|
}),
|
|
321
321
|
).toBeInTheDocument();
|
|
322
322
|
});
|
|
323
323
|
|
|
324
|
-
it('Share IS the manage-access dialog, opened on this
|
|
325
|
-
|
|
324
|
+
it('Share IS the manage-access dialog, opened on this plugin\'s directory', async () => {
|
|
325
|
+
renderPlugin('GTM');
|
|
326
326
|
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
327
327
|
|
|
328
328
|
fireEvent.click(await screen.findByRole('button', { name: 'Share' }));
|
|
329
329
|
// One dialog for every access path — no intermediate read-only panel.
|
|
330
|
-
// The entry is the
|
|
330
|
+
// The entry is the plugin DIRECTORY under the KB dir, so the rules land on
|
|
331
331
|
// the folder, never on one file inside it.
|
|
332
332
|
expect(
|
|
333
333
|
await screen.findByRole('dialog', {
|
|
334
|
-
name: 'Manage access directory knowledge-base/
|
|
334
|
+
name: 'Manage access directory knowledge-base/Plugins/GTM',
|
|
335
335
|
}),
|
|
336
336
|
).toBeInTheDocument();
|
|
337
337
|
});
|
|
338
338
|
|
|
339
|
-
it('an UNDISCOVERABLE
|
|
340
|
-
// Fail-closed: the endpoint omits
|
|
339
|
+
it('an UNDISCOVERABLE plugin renders exactly like one that does not exist', async () => {
|
|
340
|
+
// Fail-closed: the endpoint omits plugins with no verdict at all, so the
|
|
341
341
|
// page cannot tell "hidden from you" apart from "absent" — the point.
|
|
342
342
|
dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
expect(await screen.findByText("This
|
|
343
|
+
pluginsMock.listPlugins.mockResolvedValue([]);
|
|
344
|
+
renderPlugin('Finance');
|
|
345
|
+
expect(await screen.findByText("This plugin doesn't exist yet.")).toBeInTheDocument();
|
|
346
346
|
});
|
|
347
347
|
|
|
348
|
-
it('a DISCOVERABLE
|
|
348
|
+
it('a DISCOVERABLE plugin the caller cannot read shows the locked view', async () => {
|
|
349
349
|
dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
|
|
350
|
-
|
|
351
|
-
gtm({ name: 'Finance', folders: ['
|
|
350
|
+
pluginsMock.listPlugins.mockResolvedValue([
|
|
351
|
+
gtm({ name: 'Finance', folders: ['Plugins/Finance'], canRead: false }),
|
|
352
352
|
]);
|
|
353
|
-
|
|
353
|
+
renderPlugin('Finance');
|
|
354
354
|
expect(
|
|
355
355
|
await screen.findByRole('button', { name: 'Subscribe to its skills and tools' }),
|
|
356
356
|
).toBeInTheDocument();
|
|
357
357
|
expect(screen.queryByRole('heading', { name: 'Skills' })).not.toBeInTheDocument();
|
|
358
|
-
// A locked
|
|
358
|
+
// A locked plugin offers no way in at all — not an add door, not a propose one.
|
|
359
359
|
expect(screen.queryByRole('button', { name: /Add a skill or tool/ })).not.toBeInTheDocument();
|
|
360
360
|
});
|
|
361
361
|
|
|
362
362
|
it('a locked-out admin (canWrite via admin-rescue) gets the locked view with Manage access', async () => {
|
|
363
363
|
dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
|
|
364
|
-
|
|
365
|
-
gtm({ name: 'Finance', folders: ['
|
|
364
|
+
pluginsMock.listPlugins.mockResolvedValue([
|
|
365
|
+
gtm({ name: 'Finance', folders: ['Plugins/Finance'], canRead: false, canWrite: true }),
|
|
366
366
|
]);
|
|
367
|
-
|
|
367
|
+
renderPlugin('Finance');
|
|
368
368
|
expect(await screen.findByRole('button', { name: 'Manage access' })).toBeInTheDocument();
|
|
369
369
|
});
|
|
370
370
|
|
|
371
371
|
it('keeps the member view when an item-level grant beats the folder verdict', async () => {
|
|
372
372
|
// Closeness-first resolution hands this caller one skill inside a folder
|
|
373
|
-
// they cannot read; the
|
|
373
|
+
// they cannot read; the plugin itself is absent from the (fail-closed)
|
|
374
374
|
// summaries. The platform already returned the item; the page shows it.
|
|
375
375
|
dataMock.useLibraryData.mockReturnValue({
|
|
376
376
|
...CATALOG,
|
|
377
|
-
skills: [{ name: 'budget', description: '', path: '
|
|
377
|
+
skills: [{ name: 'budget', description: '', path: 'Plugins/Finance/budget' }],
|
|
378
378
|
tools: [],
|
|
379
379
|
});
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
pluginsMock.listPlugins.mockResolvedValue([]);
|
|
381
|
+
renderPlugin('Finance');
|
|
382
382
|
expect(await screen.findByTestId('library-card-skill-budget')).toBeInTheDocument();
|
|
383
383
|
});
|
|
384
384
|
|
|
385
|
-
it('says so when the
|
|
386
|
-
|
|
387
|
-
expect(await screen.findByText("This
|
|
388
|
-
expect(screen.getByRole('link', { name: 'All
|
|
385
|
+
it('says so when the plugin does not exist', async () => {
|
|
386
|
+
renderPlugin('Nope');
|
|
387
|
+
expect(await screen.findByText("This plugin doesn't exist yet.")).toBeInTheDocument();
|
|
388
|
+
expect(screen.getByRole('link', { name: 'All plugins' })).toHaveAttribute(
|
|
389
389
|
'href',
|
|
390
390
|
'/skills-and-tools',
|
|
391
391
|
);
|
|
392
392
|
});
|
|
393
393
|
|
|
394
|
-
it('degrades to the catalog when the
|
|
395
|
-
|
|
396
|
-
|
|
394
|
+
it('degrades to the catalog when the plugins endpoint fails', async () => {
|
|
395
|
+
pluginsMock.listPlugins.mockRejectedValue(new Error("Couldn't load plugins."));
|
|
396
|
+
renderPlugin('GTM');
|
|
397
397
|
expect(await screen.findByTestId('library-card-skill-outreach')).toBeInTheDocument();
|
|
398
398
|
// No verified principals, so no claim about them. The add door still opens
|
|
399
399
|
// — it writes nothing, so there is no permission to be wrong about.
|
|
@@ -401,23 +401,23 @@ describe('GroupPage', () => {
|
|
|
401
401
|
expect(screen.getByRole('button', { name: 'Add a skill or tool to GTM' })).toBeInTheDocument();
|
|
402
402
|
});
|
|
403
403
|
|
|
404
|
-
it('does not claim a missing
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
it('does not claim a missing plugin is gone while the endpoint is still failing', async () => {
|
|
405
|
+
pluginsMock.listPlugins.mockRejectedValue(new Error("Couldn't load plugins."));
|
|
406
|
+
renderPlugin('Finance');
|
|
407
407
|
await waitFor(() =>
|
|
408
408
|
expect(screen.queryByText('Loading the library…')).not.toBeInTheDocument(),
|
|
409
409
|
);
|
|
410
|
-
expect(screen.queryByText("This
|
|
410
|
+
expect(screen.queryByText("This plugin doesn't exist yet.")).not.toBeInTheDocument();
|
|
411
411
|
expect(screen.getByRole('heading', { name: 'Finance', level: 1 })).toBeInTheDocument();
|
|
412
412
|
});
|
|
413
413
|
|
|
414
|
-
it('decodes a URL-hostile
|
|
414
|
+
it('decodes a URL-hostile plugin name', async () => {
|
|
415
415
|
dataMock.useLibraryData.mockReturnValue({
|
|
416
416
|
...CATALOG,
|
|
417
|
-
skills: [{ name: 'pricing', description: '', path: '
|
|
417
|
+
skills: [{ name: 'pricing', description: '', path: 'Plugins/Sales & Ops/pricing' }],
|
|
418
418
|
tools: [],
|
|
419
419
|
});
|
|
420
|
-
|
|
420
|
+
renderPlugin('Sales & Ops');
|
|
421
421
|
expect(
|
|
422
422
|
await screen.findByRole('heading', { name: 'Sales & Ops', level: 1 }),
|
|
423
423
|
).toBeInTheDocument();
|
|
@@ -426,9 +426,9 @@ describe('GroupPage', () => {
|
|
|
426
426
|
|
|
427
427
|
it('waits rather than guessing while the catalog is still loading', () => {
|
|
428
428
|
dataMock.useLibraryData.mockReturnValue({ ...CATALOG, loading: true, skills: [], tools: [] });
|
|
429
|
-
|
|
429
|
+
renderPlugin('GTM');
|
|
430
430
|
expect(screen.getByText('Loading the library…')).toBeInTheDocument();
|
|
431
|
-
expect(screen.queryByText("This
|
|
431
|
+
expect(screen.queryByText("This plugin doesn't exist yet.")).not.toBeInTheDocument();
|
|
432
432
|
});
|
|
433
433
|
|
|
434
434
|
/**
|
|
@@ -444,12 +444,12 @@ describe('GroupPage', () => {
|
|
|
444
444
|
const spinning = () => refreshButton().querySelector('.animate-spin') !== null;
|
|
445
445
|
|
|
446
446
|
it('claims freshness only once the refetch has actually landed', async () => {
|
|
447
|
-
|
|
447
|
+
renderPlugin('GTM');
|
|
448
448
|
await screen.findByRole('heading', { name: 'GTM', level: 1 });
|
|
449
449
|
|
|
450
|
-
let land!: (
|
|
451
|
-
|
|
452
|
-
new Promise<
|
|
450
|
+
let land!: (plugins: PluginSummary[]) => void;
|
|
451
|
+
pluginsMock.listPlugins.mockReturnValueOnce(
|
|
452
|
+
new Promise<PluginSummary[]>((resolve) => {
|
|
453
453
|
land = resolve;
|
|
454
454
|
}),
|
|
455
455
|
);
|
|
@@ -466,10 +466,10 @@ describe('GroupPage', () => {
|
|
|
466
466
|
});
|
|
467
467
|
|
|
468
468
|
it('does not report success when the refetch fails', async () => {
|
|
469
|
-
|
|
469
|
+
renderPlugin('GTM');
|
|
470
470
|
await screen.findByRole('heading', { name: 'GTM', level: 1 });
|
|
471
471
|
|
|
472
|
-
|
|
472
|
+
pluginsMock.listPlugins.mockRejectedValueOnce(new Error("Couldn't load plugins."));
|
|
473
473
|
fireEvent.click(refreshButton());
|
|
474
474
|
|
|
475
475
|
await waitFor(() => expect(spinning()).toBe(false));
|