@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect, vi, type Mock } from 'vitest';
|
|
2
2
|
import { render, screen, fireEvent, cleanup } from '@testing-library/react';
|
|
3
|
-
import {
|
|
3
|
+
import { PluginsSidebar, type PluginsSidebarProps } from '../components/PluginsSidebar';
|
|
4
4
|
import type { LibraryFilter } from '../utils/status';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -9,53 +9,53 @@ import type { LibraryFilter } from '../utils/status';
|
|
|
9
9
|
* and no navigation, so nothing here needs a router.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
function renderSidebar(over: Partial<
|
|
12
|
+
function renderSidebar(over: Partial<PluginsSidebarProps> = {}) {
|
|
13
13
|
const onSelect = vi.fn();
|
|
14
14
|
const onFinishSetup = vi.fn();
|
|
15
|
-
const props:
|
|
15
|
+
const props: PluginsSidebarProps = {
|
|
16
16
|
filter: { kind: 'all' },
|
|
17
17
|
onSelect,
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
{
|
|
21
|
-
{
|
|
18
|
+
plugins: [
|
|
19
|
+
{ plugin: 'Engineering', count: 4, attention: 0 },
|
|
20
|
+
{ plugin: 'GTM', count: 3, attention: 2 },
|
|
21
|
+
{ plugin: 'Product', count: 0, attention: 0 },
|
|
22
22
|
],
|
|
23
|
-
|
|
23
|
+
lockedPlugins: [],
|
|
24
24
|
ownedCount: 2,
|
|
25
25
|
ownedAttention: 0,
|
|
26
|
-
|
|
26
|
+
personalPluginLabel: "Juan's Plugin",
|
|
27
27
|
ungroupedCount: 1,
|
|
28
28
|
attentionCount: 2,
|
|
29
29
|
onFinishSetup,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
onCreatePlugin: vi.fn(),
|
|
31
|
+
pluginsIndexActive: false,
|
|
32
|
+
onOpenPluginsIndex: vi.fn(),
|
|
33
33
|
|
|
34
34
|
...over,
|
|
35
35
|
};
|
|
36
|
-
render(<
|
|
36
|
+
render(<PluginsSidebar {...props} />);
|
|
37
37
|
return {
|
|
38
38
|
onSelect,
|
|
39
39
|
onFinishSetup,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
onCreatePlugin: props.onCreatePlugin as Mock,
|
|
41
|
+
onOpenPluginsIndex: props.onOpenPluginsIndex as Mock,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
const row = (name: RegExp | string) => screen.getByRole('button', { name });
|
|
46
46
|
|
|
47
|
-
describe('
|
|
48
|
-
it('leads with All
|
|
49
|
-
const {
|
|
47
|
+
describe('PluginsSidebar', () => {
|
|
48
|
+
it('leads with All plugins. The Library opens there, so the nav starts there', () => {
|
|
49
|
+
const { onOpenPluginsIndex } = renderSidebar();
|
|
50
50
|
const rows = screen.getAllByRole('button');
|
|
51
|
-
expect(rows[0]).toHaveAccessibleName('All
|
|
51
|
+
expect(rows[0]).toHaveAccessibleName('All plugins');
|
|
52
52
|
fireEvent.click(rows[0]);
|
|
53
|
-
expect(
|
|
53
|
+
expect(onOpenPluginsIndex).toHaveBeenCalledTimes(1);
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
it('marks All
|
|
57
|
-
renderSidebar({ filter: null,
|
|
58
|
-
expect(row(/^All
|
|
56
|
+
it('marks All plugins current on the index, and nothing else', () => {
|
|
57
|
+
renderSidebar({ filter: null, pluginsIndexActive: true });
|
|
58
|
+
expect(row(/^All plugins/)).toHaveAttribute('aria-current', 'true');
|
|
59
59
|
expect(row(/^Everything/)).toHaveAttribute('aria-current', 'false');
|
|
60
60
|
expect(row(/^Owned by me/)).toHaveAttribute('aria-current', 'false');
|
|
61
61
|
});
|
|
@@ -63,28 +63,28 @@ describe('GroupsSidebar', () => {
|
|
|
63
63
|
it('keeps Everything as a lens of its own, since the root is the index now', () => {
|
|
64
64
|
renderSidebar({ filter: { kind: 'all' } });
|
|
65
65
|
expect(row(/^Everything/)).toHaveAttribute('aria-current', 'true');
|
|
66
|
-
expect(row(/^All
|
|
66
|
+
expect(row(/^All plugins/)).toHaveAttribute('aria-current', 'false');
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
it('heads the
|
|
69
|
+
it('heads the plugin rows with what the list is: the set in your MCP', () => {
|
|
70
70
|
renderSidebar();
|
|
71
71
|
expect(screen.getByText('Included in your MCP')).toBeInTheDocument();
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
it("leads the
|
|
74
|
+
it("leads the plugins with the caller's own space", () => {
|
|
75
75
|
renderSidebar({ filter: { kind: 'ungrouped' } });
|
|
76
|
-
expect(row(/^Juan's
|
|
76
|
+
expect(row(/^Juan's Plugin/)).toHaveAttribute('aria-current', 'true');
|
|
77
77
|
expect(row(/^Owned by me/)).toHaveAttribute('aria-current', 'false');
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
it('offers a way to make a
|
|
81
|
-
const {
|
|
82
|
-
fireEvent.click(screen.getByRole('button', { name: 'New
|
|
83
|
-
expect(
|
|
80
|
+
it('offers a way to make a plugin', () => {
|
|
81
|
+
const { onCreatePlugin } = renderSidebar();
|
|
82
|
+
fireEvent.click(screen.getByRole('button', { name: 'New plugin' }));
|
|
83
|
+
expect(onCreatePlugin).toHaveBeenCalledTimes(1);
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
it('marks the selected
|
|
87
|
-
renderSidebar({ filter: { kind: 'group',
|
|
86
|
+
it('marks the selected plugin current and leaves the others alone', () => {
|
|
87
|
+
renderSidebar({ filter: { kind: 'group', plugin: 'GTM' } });
|
|
88
88
|
expect(row(/^GTM/)).toHaveAttribute('aria-current', 'true');
|
|
89
89
|
expect(row(/^Engineering/)).toHaveAttribute('aria-current', 'false');
|
|
90
90
|
});
|
|
@@ -94,7 +94,7 @@ describe('GroupsSidebar', () => {
|
|
|
94
94
|
// GTM: 3 items but 2 integrations need setup — amber wins the slot.
|
|
95
95
|
expect(row(/^GTM/)).toHaveAccessibleName('GTM 2');
|
|
96
96
|
expect(row(/^Engineering/)).toHaveAccessibleName('Engineering 4');
|
|
97
|
-
// Never a grey 0: an empty
|
|
97
|
+
// Never a grey 0: an empty plugin shows no count at all.
|
|
98
98
|
expect(row(/^Product/)).toHaveAccessibleName('Product');
|
|
99
99
|
});
|
|
100
100
|
|
|
@@ -103,8 +103,8 @@ describe('GroupsSidebar', () => {
|
|
|
103
103
|
const expected: [RegExp, LibraryFilter][] = [
|
|
104
104
|
[/^Everything/, { kind: 'all' }],
|
|
105
105
|
[/^Owned by me/, { kind: 'owned' }],
|
|
106
|
-
[/^GTM/, { kind: 'group',
|
|
107
|
-
[/^Juan's
|
|
106
|
+
[/^GTM/, { kind: 'group', plugin: 'GTM' }],
|
|
107
|
+
[/^Juan's Plugin/, { kind: 'ungrouped' }],
|
|
108
108
|
];
|
|
109
109
|
for (const [name, filter] of expected) {
|
|
110
110
|
onSelect.mockClear();
|
|
@@ -113,11 +113,11 @@ describe('GroupsSidebar', () => {
|
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
-
it("keeps the caller's own
|
|
117
|
-
// It is a PLACE, not a filtered view: a
|
|
116
|
+
it("keeps the caller's own plugin listed even when it is empty", () => {
|
|
117
|
+
// It is a PLACE, not a filtered view: a plugin you are always in does not
|
|
118
118
|
// vanish because you have not put anything in it yet.
|
|
119
119
|
renderSidebar({ ungroupedCount: 0 });
|
|
120
|
-
expect(row(/^Juan's
|
|
120
|
+
expect(row(/^Juan's Plugin/)).toBeInTheDocument();
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
it('shows the owned count in grey, and amber only when something waits on you', () => {
|
package/src/modules/library/__tests__/{GroupsSidebarMenu.test.tsx → PluginsSidebarMenu.test.tsx}
RENAMED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
2
|
import { createRef } from 'react';
|
|
3
3
|
import { render, screen, fireEvent, within } from '@testing-library/react';
|
|
4
|
-
import {
|
|
4
|
+
import { PluginsSidebarMenu, type PluginsSidebarMenuProps } from '../components/PluginsSidebarMenu';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The Library nav's right-click menu.
|
|
8
8
|
*
|
|
9
9
|
* Two things are under test and they are not the same thing. The ITEMS are the
|
|
10
|
-
* Library's own — a
|
|
10
|
+
* Library's own — a plugin is not a file, so this menu says `New plugin` where
|
|
11
11
|
* the tree says `New folder` — but the BEHAVIOUR has to be the file tree's,
|
|
12
12
|
* because a right-click that dismisses one way in Knowledge and another way in
|
|
13
13
|
* Skills is two products in one window. Outside click closes, Escape closes,
|
|
14
14
|
* Escape returns focus to the row (`useDismissableMenu`).
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
function renderMenu(over: Partial<
|
|
17
|
+
function renderMenu(over: Partial<PluginsSidebarMenuProps> = {}) {
|
|
18
18
|
const onClose = vi.fn();
|
|
19
|
-
const props:
|
|
19
|
+
const props: PluginsSidebarMenuProps = {
|
|
20
20
|
x: 140,
|
|
21
21
|
y: 260,
|
|
22
22
|
label: 'GTM',
|
|
23
23
|
onClose,
|
|
24
24
|
onAdd: vi.fn(),
|
|
25
|
-
|
|
25
|
+
onCreatePlugin: vi.fn(),
|
|
26
26
|
onCopyLink: vi.fn(),
|
|
27
27
|
onManageAccess: vi.fn(),
|
|
28
28
|
...over,
|
|
29
29
|
};
|
|
30
|
-
render(<
|
|
30
|
+
render(<PluginsSidebarMenu {...props} />);
|
|
31
31
|
return { ...props, onClose };
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -37,7 +37,7 @@ const items = () =>
|
|
|
37
37
|
.getAllByRole('menuitem')
|
|
38
38
|
.map((i) => i.textContent);
|
|
39
39
|
|
|
40
|
-
describe('
|
|
40
|
+
describe('PluginsSidebarMenu', () => {
|
|
41
41
|
it('names itself after the row it was opened from', () => {
|
|
42
42
|
renderMenu();
|
|
43
43
|
expect(screen.getByRole('menu', { name: 'Actions for GTM' })).toBeInTheDocument();
|
|
@@ -55,52 +55,52 @@ describe('GroupsSidebarMenu', () => {
|
|
|
55
55
|
* order (`FileExplorer.tsx:232-287`), so the two menus have the same shape
|
|
56
56
|
* even where they do not have the same words.
|
|
57
57
|
*/
|
|
58
|
-
it('orders a full
|
|
58
|
+
it('orders a full plugin menu the way the file tree orders its own', () => {
|
|
59
59
|
renderMenu();
|
|
60
|
-
expect(items()).toEqual(['Add a skill or tool', 'New
|
|
60
|
+
expect(items()).toEqual(['Add a skill or tool', 'New plugin', 'Copy link', 'Manage access']);
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
it('renders only the verbs it was given. An absent one is not a disabled one', () => {
|
|
64
64
|
// What a lens row gets: no folder behind it, so nothing to add to and no
|
|
65
65
|
// access to manage.
|
|
66
66
|
renderMenu({ onAdd: undefined, onManageAccess: undefined });
|
|
67
|
-
expect(items()).toEqual(['New
|
|
67
|
+
expect(items()).toEqual(['New plugin', 'Copy link']);
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
it("puts Delete
|
|
70
|
+
it("puts Delete plugin last, below its own rule, and only when it was given — the owner's verb", () => {
|
|
71
71
|
renderMenu({ onDelete: vi.fn() });
|
|
72
72
|
expect(items()).toEqual([
|
|
73
73
|
'Add a skill or tool',
|
|
74
|
-
'New
|
|
74
|
+
'New plugin',
|
|
75
75
|
'Copy link',
|
|
76
76
|
'Manage access',
|
|
77
|
-
'Delete
|
|
77
|
+
'Delete plugin',
|
|
78
78
|
]);
|
|
79
79
|
// The default render (no onDelete) is the non-owner's menu — the earlier
|
|
80
80
|
// full-menu assertion already proves the item is absent there.
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
it('runs Delete
|
|
83
|
+
it('runs Delete plugin and then closes', () => {
|
|
84
84
|
const onDelete = vi.fn();
|
|
85
85
|
const props = renderMenu({ onDelete });
|
|
86
|
-
fireEvent.click(screen.getByRole('menuitem', { name: 'Delete
|
|
86
|
+
fireEvent.click(screen.getByRole('menuitem', { name: 'Delete plugin' }));
|
|
87
87
|
expect(onDelete).toHaveBeenCalledTimes(1);
|
|
88
88
|
expect(props.onClose).toHaveBeenCalledTimes(1);
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
it('keeps New
|
|
91
|
+
it('keeps New plugin on the empty-space menu, where it is the only verb', () => {
|
|
92
92
|
renderMenu({
|
|
93
93
|
label: 'Library',
|
|
94
94
|
onAdd: undefined,
|
|
95
95
|
onCopyLink: undefined,
|
|
96
96
|
onManageAccess: undefined,
|
|
97
97
|
});
|
|
98
|
-
expect(items()).toEqual(['New
|
|
98
|
+
expect(items()).toEqual(['New plugin']);
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
it.each([
|
|
102
102
|
['Add a skill or tool', 'onAdd'],
|
|
103
|
-
['New
|
|
103
|
+
['New plugin', 'onCreatePlugin'],
|
|
104
104
|
['Copy link', 'onCopyLink'],
|
|
105
105
|
['Manage access', 'onManageAccess'],
|
|
106
106
|
] as const)('runs %s and then closes', (name, key) => {
|
|
@@ -188,7 +188,7 @@ function libraryValue(owned: boolean, crs: PullRequestSummary[] = [], mine: numb
|
|
|
188
188
|
name: 'newsletter',
|
|
189
189
|
description: skillSummary.description,
|
|
190
190
|
owned,
|
|
191
|
-
|
|
191
|
+
plugin: null,
|
|
192
192
|
path: skillSummary.path,
|
|
193
193
|
status: { state: 'ok', text: '' },
|
|
194
194
|
},
|
|
@@ -200,10 +200,10 @@ function libraryValue(owned: boolean, crs: PullRequestSummary[] = [], mine: numb
|
|
|
200
200
|
loading: false,
|
|
201
201
|
error: null,
|
|
202
202
|
reload: () => {},
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
pluginSummaries: [],
|
|
204
|
+
pluginsLoading: false,
|
|
205
|
+
pluginsError: null,
|
|
206
|
+
reloadPlugins: () => {},
|
|
207
207
|
} as unknown as LibraryContextValue;
|
|
208
208
|
}
|
|
209
209
|
|
|
@@ -457,7 +457,7 @@ describe('SkillPage', () => {
|
|
|
457
457
|
await screen.findByRole('heading', { name: 'newsletter' });
|
|
458
458
|
|
|
459
459
|
expect(screen.getByText('Owner')).toBeInTheDocument();
|
|
460
|
-
// A skill inherits its
|
|
460
|
+
// A skill inherits its plugin folder's rules; the plugin's Share panel is the
|
|
461
461
|
// one place they are decided, for owner and non-owner alike.
|
|
462
462
|
expect(screen.queryByRole('button', { name: 'Manage access' })).toBeNull();
|
|
463
463
|
});
|
|
@@ -621,7 +621,7 @@ describe('SkillPage', () => {
|
|
|
621
621
|
* resolved by reading the folder name, which is the skill's id only when no
|
|
622
622
|
* frontmatter declares one — so a failed fetch under a loading catalog is
|
|
623
623
|
* not evidence the skill is missing, just that we asked with the wrong name.
|
|
624
|
-
*
|
|
624
|
+
* PluginPage already refuses to decide this early; this is the same call.
|
|
625
625
|
*/
|
|
626
626
|
describe('a PROVISIONAL name — one the route guessed from the URL', () => {
|
|
627
627
|
// The route reads the folder name when the catalog can't resolve a URL,
|
|
@@ -825,7 +825,7 @@ describe('SkillPage: deciding on a change', () => {
|
|
|
825
825
|
*
|
|
826
826
|
* The merge gate requires a non-stale approval from an eligible approver for
|
|
827
827
|
* every markdown file that has owners — which is every SKILL.md governed by a
|
|
828
|
-
*
|
|
828
|
+
* plugin's `access.md`, i.e. exactly what this page exists for. Going straight
|
|
829
829
|
* to the merge is refused with "Waiting on approval for …", so a page that
|
|
830
830
|
* only merged had an Approve button that could not approve anything.
|
|
831
831
|
*/
|
|
@@ -50,7 +50,7 @@ function tool(over: Partial<ToolSecrets> = {}): ToolSecrets {
|
|
|
50
50
|
return {
|
|
51
51
|
slug: 'github',
|
|
52
52
|
name: 'github',
|
|
53
|
-
path: '
|
|
53
|
+
path: 'Plugins/Engineering/github.tool',
|
|
54
54
|
type: 'mcp',
|
|
55
55
|
setup: null,
|
|
56
56
|
canWrite: false,
|
|
@@ -109,7 +109,7 @@ describe('ToolConnectionSection', () => {
|
|
|
109
109
|
fireEvent.click(screen.getByRole('button', { name: 'Edit the tool file' }));
|
|
110
110
|
await waitFor(() =>
|
|
111
111
|
expect(screen.getByLabelText('pathname').textContent).toContain(
|
|
112
|
-
'knowledge-base/
|
|
112
|
+
'knowledge-base/Plugins/Engineering/github.tool',
|
|
113
113
|
),
|
|
114
114
|
);
|
|
115
115
|
});
|
|
@@ -28,8 +28,16 @@ const secretsMock = vi.hoisted(() => ({
|
|
|
28
28
|
}));
|
|
29
29
|
vi.mock('../../secrets-vault/services/tool-secrets.api', () => secretsMock);
|
|
30
30
|
|
|
31
|
-
const toolsMock = vi.hoisted(() => ({
|
|
32
|
-
|
|
31
|
+
const toolsMock = vi.hoisted(() => ({
|
|
32
|
+
getToolDetail: vi.fn(),
|
|
33
|
+
// The server section self-hides on null — these frame tests are not about it.
|
|
34
|
+
getMcpServer: vi.fn(async () => null),
|
|
35
|
+
}));
|
|
36
|
+
vi.mock('../services/tools.api', () => ({
|
|
37
|
+
getToolDetail: toolsMock.getToolDetail,
|
|
38
|
+
getMcpServer: toolsMock.getMcpServer,
|
|
39
|
+
putMcpServer: vi.fn(),
|
|
40
|
+
}));
|
|
33
41
|
|
|
34
42
|
const libraryMock = vi.hoisted(() => ({ listSkills: vi.fn(), getSkill: vi.fn() }));
|
|
35
43
|
vi.mock('../services/library.api', () => ({
|
|
@@ -45,7 +53,7 @@ import { ToolPage } from '../components/tool-page/ToolPage';
|
|
|
45
53
|
const GITHUB: ToolSecrets = {
|
|
46
54
|
slug: 'heyreach',
|
|
47
55
|
name: 'heyreach',
|
|
48
|
-
path: '
|
|
56
|
+
path: 'Plugins/GTM/heyreach.tool',
|
|
49
57
|
type: 'inline',
|
|
50
58
|
setup: null,
|
|
51
59
|
canWrite: false,
|
|
@@ -55,7 +63,7 @@ const GITHUB: ToolSecrets = {
|
|
|
55
63
|
const DETAIL: ToolManualDetail = {
|
|
56
64
|
slug: 'heyreach',
|
|
57
65
|
name: 'heyreach',
|
|
58
|
-
path: '
|
|
66
|
+
path: 'Plugins/GTM/heyreach.tool',
|
|
59
67
|
type: 'inline',
|
|
60
68
|
description: 'Runs LinkedIn outreach campaigns.',
|
|
61
69
|
capabilities: [
|
|
@@ -115,6 +123,7 @@ beforeEach(() => {
|
|
|
115
123
|
window.history.replaceState(null, '', '/skills-and-tools/tools/heyreach');
|
|
116
124
|
secretsMock.listToolSecrets.mockReset().mockResolvedValue([GITHUB]);
|
|
117
125
|
toolsMock.getToolDetail.mockReset().mockResolvedValue(DETAIL);
|
|
126
|
+
toolsMock.getMcpServer.mockClear();
|
|
118
127
|
libraryMock.listSkills.mockReset().mockResolvedValue([]);
|
|
119
128
|
libraryMock.getSkill.mockReset().mockResolvedValue({ allowedTools: [] });
|
|
120
129
|
});
|
|
@@ -142,8 +151,8 @@ describe('ToolPage: frame', () => {
|
|
|
142
151
|
expect(screen.queryByText(/Tool · /)).toBeNull();
|
|
143
152
|
});
|
|
144
153
|
|
|
145
|
-
it("goes back to the tool's own
|
|
146
|
-
// Not the Library root: the reader opened this tool off its
|
|
154
|
+
it("goes back to the tool's own plugin from the back link", async () => {
|
|
155
|
+
// Not the Library root: the reader opened this tool off its plugin page,
|
|
147
156
|
// and "back" should land where the tool lives. Derived from the path, so
|
|
148
157
|
// a deep link gets the same destination as a click.
|
|
149
158
|
renderPage();
|
|
@@ -151,7 +160,7 @@ describe('ToolPage: frame', () => {
|
|
|
151
160
|
|
|
152
161
|
fireEvent.click(screen.getByRole('button', { name: '‹ GTM' }));
|
|
153
162
|
await waitFor(() =>
|
|
154
|
-
expect(screen.getByLabelText('pathname').textContent).toBe('/skills-and-tools/
|
|
163
|
+
expect(screen.getByLabelText('pathname').textContent).toBe('/skills-and-tools/plugins/GTM'),
|
|
155
164
|
);
|
|
156
165
|
});
|
|
157
166
|
|
|
@@ -212,8 +221,8 @@ describe('ToolPage: capabilities', () => {
|
|
|
212
221
|
describe('ToolPage: powers these skills', () => {
|
|
213
222
|
it('links each matching skill at the reserved skill route', async () => {
|
|
214
223
|
libraryMock.listSkills.mockResolvedValue([
|
|
215
|
-
{ name: 'outreach', description: '', path: '
|
|
216
|
-
{ name: 'roadmap', description: '', path: '
|
|
224
|
+
{ name: 'outreach', description: '', path: 'Plugins/GTM/outreach' },
|
|
225
|
+
{ name: 'roadmap', description: '', path: 'Plugins/Product/roadmap' },
|
|
217
226
|
]);
|
|
218
227
|
libraryMock.getSkill.mockImplementation(async (name: string) =>
|
|
219
228
|
name === 'outreach' ? { allowedTools: ['heyreach_add_leads'] } : { allowedTools: ['Bash'] },
|
|
@@ -278,11 +287,31 @@ describe('ToolPage: connection', () => {
|
|
|
278
287
|
});
|
|
279
288
|
});
|
|
280
289
|
|
|
290
|
+
describe('ToolPage: server section', () => {
|
|
291
|
+
/**
|
|
292
|
+
* Only an mcp-type tool can have an mcp.json server pair — mounting the
|
|
293
|
+
* section for the others would send a `/server` GET whose 404 is guaranteed,
|
|
294
|
+
* once per page view.
|
|
295
|
+
*/
|
|
296
|
+
it('never asks for a server pair on a non-mcp tool', async () => {
|
|
297
|
+
renderPage(); // the fixture is `type: 'inline'`
|
|
298
|
+
await screen.findByRole('heading', { name: 'heyreach', level: 1 });
|
|
299
|
+
expect(toolsMock.getMcpServer).not.toHaveBeenCalled();
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
it('still asks on an mcp tool, where the pair can exist', async () => {
|
|
303
|
+
secretsMock.listToolSecrets.mockResolvedValue([{ ...GITHUB, type: 'mcp' }]);
|
|
304
|
+
renderPage();
|
|
305
|
+
await screen.findByRole('heading', { name: 'heyreach', level: 1 });
|
|
306
|
+
await waitFor(() => expect(toolsMock.getMcpServer).toHaveBeenCalledWith('heyreach'));
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
|
|
281
310
|
describe('ToolPage: manage access', () => {
|
|
282
311
|
it('offers none, to anyone, including an admin', async () => {
|
|
283
|
-
// Access is decided at the
|
|
284
|
-
// editor here would either duplicate the
|
|
285
|
-
// per-file override nobody looking at the
|
|
312
|
+
// Access is decided at the PLUGIN. A tool inherits its folder's rules, so an
|
|
313
|
+
// editor here would either duplicate the plugin's or quietly write a
|
|
314
|
+
// per-file override nobody looking at the plugin would ever see.
|
|
286
315
|
renderPage({ isAdmin: true });
|
|
287
316
|
await screen.findByRole('heading', { name: 'heyreach', level: 1 });
|
|
288
317
|
expect(screen.queryByRole('button', { name: 'Manage access' })).toBeNull();
|
|
@@ -8,7 +8,7 @@ import { ToolSharePanel } from '../components/tool-page/ToolSharePanel';
|
|
|
8
8
|
* placeholder are what his work replaces without touching this file's callers.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const TOOL = { slug: 'github', name: 'github', path: '
|
|
11
|
+
const TOOL = { slug: 'github', name: 'github', path: 'Plugins/Engineering/github.tool' };
|
|
12
12
|
|
|
13
13
|
describe('ToolSharePanel', () => {
|
|
14
14
|
it('renders nothing while closed', () => {
|