@bevel-software/platform-core-frontend 0.7.5 → 0.9.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/core/registry.ts +16 -4
- 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/admin/state/admin.context.tsx +15 -0
- 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} +197 -106
- package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +363 -0
- package/src/modules/library/__tests__/{GroupsSidebar.contextmenu.test.tsx → PluginsSidebar.contextmenu.test.tsx} +32 -31
- package/src/modules/library/__tests__/{GroupsSidebar.locked.test.tsx → PluginsSidebar.locked.test.tsx} +29 -28
- package/src/modules/library/__tests__/PluginsSidebar.test.tsx +171 -0
- 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__/library-data.test.ts +82 -0
- 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 +80 -71
- 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 +23 -5
- package/src/modules/library/components/PageActions.tsx +34 -11
- package/src/modules/library/components/PersonalAddDialog.tsx +5 -5
- package/src/modules/library/components/{PersonalGroupPage.tsx → PersonalPluginPage.tsx} +29 -19
- 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/PluginJoinRequests.tsx +77 -0
- package/src/modules/library/components/{GroupPage.tsx → PluginPage.tsx} +112 -72
- package/src/modules/library/components/{GroupsIndexPage.tsx → PluginsIndexPage.tsx} +91 -48
- package/src/modules/library/components/{GroupsSidebar.tsx → PluginsSidebar.tsx} +105 -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} +218 -27
- 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 +32 -19
- 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 +67 -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__/creator-welcome.test.tsx +318 -0
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +86 -8
- package/src/modules/onboarding/agent-clients.ts +18 -14
- package/src/modules/onboarding/components/CreatorWelcomePage.tsx +143 -0
- package/src/modules/onboarding/components/WelcomePage.tsx +30 -22
- package/src/modules/onboarding/components/WelcomeRoute.tsx +57 -0
- package/src/modules/onboarding/welcome-state.ts +36 -0
- 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/setup/__tests__/setup.test.tsx +203 -0
- package/src/modules/setup/components/SetupScreen.tsx +235 -68
- 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/FileRoute.tsx +8 -1
- package/src/modules/workspace/components/FileViewer.tsx +95 -38
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +14 -14
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +20 -0
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +227 -18
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +7 -2
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +25 -0
- package/src/modules/workspace/routing/kb-routes.ts +23 -1
- package/src/modules/workspace/utils/__tests__/diff.test.ts +1 -1
- package/src/modules/workspace/utils/fileTree.ts +54 -3
- package/src/shared/components/Surface.tsx +15 -0
- 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
- package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +0 -283
- package/src/modules/library/__tests__/GroupsSidebar.test.tsx +0 -142
- package/src/modules/library/components/GroupJoinRequests.tsx +0 -56
|
@@ -47,7 +47,7 @@ describe('narrow-layout source parity', () => {
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
it('keeps the library card track capable of shrinking to the viewport', () => {
|
|
50
|
-
const source = readSource('modules/library/components/
|
|
50
|
+
const source = readSource('modules/library/components/plugin-page-parts.tsx');
|
|
51
51
|
|
|
52
52
|
expect(source).toContain(
|
|
53
53
|
'grid-cols-[repeat(auto-fill,minmax(min(236px,100%),1fr))]',
|
|
@@ -33,7 +33,7 @@ const FOCUSABLE_SELECTOR =
|
|
|
33
33
|
* The app's nav spine — the prototype's `.side` + `.resizer` + `.side-inner`
|
|
34
34
|
* (proto:85-104, proto:4328-4370).
|
|
35
35
|
*
|
|
36
|
-
* ONE frame, filled by whichever surface you are on: the
|
|
36
|
+
* ONE frame, filled by whichever surface you are on: the plugin list in Skills
|
|
37
37
|
* & Tools, the file tree in Knowledge. They were two components with two
|
|
38
38
|
* different backgrounds, two paddings and only one of them resizable, which is
|
|
39
39
|
* two products wearing one logo. The prototype has a single `<aside>` and two
|
|
@@ -57,7 +57,7 @@ export function SidebarFrame({
|
|
|
57
57
|
header,
|
|
58
58
|
}: {
|
|
59
59
|
children: ReactNode;
|
|
60
|
-
/** Names the region and its resize handle, e.g. `Library
|
|
60
|
+
/** Names the region and its resize handle, e.g. `Library plugins`. */
|
|
61
61
|
label: string;
|
|
62
62
|
/**
|
|
63
63
|
* Pinned above `children`, outside whatever list the surface is holding.
|
package/src/modules/library/__tests__/{AddToGroupDialog.test.tsx → AddToPluginDialog.test.tsx}
RENAMED
|
@@ -24,10 +24,10 @@ vi.mock('../services/library.api', async (importOriginal) => ({
|
|
|
24
24
|
createEmptySkill: apiMock.createEmptySkill,
|
|
25
25
|
}));
|
|
26
26
|
|
|
27
|
-
import {
|
|
27
|
+
import { AddToPluginDialog } from '../components/AddToPluginDialog';
|
|
28
28
|
|
|
29
29
|
const ADD_PROMPT =
|
|
30
|
-
'Help me build a new skill or tool and add it to the GTM
|
|
30
|
+
'Help me build a new skill or tool and add it to the GTM plugin at Bevel. ' +
|
|
31
31
|
'I run it, so it goes in directly. No review step.';
|
|
32
32
|
|
|
33
33
|
function workspace(kbDirName: string | null) {
|
|
@@ -65,7 +65,7 @@ function renderDialog(
|
|
|
65
65
|
) {
|
|
66
66
|
const onClose = vi.fn();
|
|
67
67
|
render(
|
|
68
|
-
<MemoryRouter initialEntries={['/skills-and-tools/
|
|
68
|
+
<MemoryRouter initialEntries={['/skills-and-tools/plugins/GTM']}>
|
|
69
69
|
<AdminContext.Provider value={admin(isAdmin)}>
|
|
70
70
|
<WorkspaceContext.Provider value={workspace(kbDirName)}>
|
|
71
71
|
<LibraryToastProvider>
|
|
@@ -75,9 +75,9 @@ function renderDialog(
|
|
|
75
75
|
<Route
|
|
76
76
|
path="*"
|
|
77
77
|
element={
|
|
78
|
-
<
|
|
78
|
+
<AddToPluginDialog
|
|
79
79
|
name="GTM"
|
|
80
|
-
primaryPath="
|
|
80
|
+
primaryPath="Plugins/GTM"
|
|
81
81
|
canWrite={canWrite}
|
|
82
82
|
existingSkills={existingSkills}
|
|
83
83
|
onClose={onClose}
|
|
@@ -103,14 +103,14 @@ function renderDialog(
|
|
|
103
103
|
|
|
104
104
|
const writeText = vi.fn<(text: string) => Promise<void>>();
|
|
105
105
|
|
|
106
|
-
describe('
|
|
106
|
+
describe('AddToPluginDialog', () => {
|
|
107
107
|
beforeEach(() => {
|
|
108
108
|
writeText.mockReset();
|
|
109
109
|
writeText.mockResolvedValue(undefined);
|
|
110
110
|
apiMock.createEmptySkill.mockReset();
|
|
111
111
|
apiMock.createEmptySkill.mockResolvedValue({
|
|
112
|
-
repoRelativePath: '
|
|
113
|
-
workspacePath: 'knowledge-base/
|
|
112
|
+
repoRelativePath: 'Plugins/GTM/weekly-report/SKILL.md',
|
|
113
|
+
workspacePath: 'knowledge-base/Plugins/GTM/weekly-report/SKILL.md',
|
|
114
114
|
branch: 'target-company-state',
|
|
115
115
|
direct: true,
|
|
116
116
|
});
|
|
@@ -124,12 +124,12 @@ describe('AddToGroupDialog', () => {
|
|
|
124
124
|
Reflect.deleteProperty(navigator, 'clipboard');
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
it('names the
|
|
127
|
+
it('names the plugin in its title and its lede', () => {
|
|
128
128
|
renderDialog();
|
|
129
129
|
expect(screen.getByRole('heading', { name: 'Add a skill or tool to GTM' })).toBeInTheDocument();
|
|
130
130
|
expect(
|
|
131
131
|
screen.getByText(
|
|
132
|
-
'Two ways in. Either way it joins GTM. Everyone in the
|
|
132
|
+
'Two ways in. Either way it joins GTM. Everyone in the plugin gets it the next time their agent connects.',
|
|
133
133
|
),
|
|
134
134
|
).toBeInTheDocument();
|
|
135
135
|
});
|
|
@@ -164,15 +164,15 @@ describe('AddToGroupDialog', () => {
|
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
// ── the first door: a file, not a folder tour ──
|
|
167
|
-
// This half used to navigate to the
|
|
167
|
+
// This half used to navigate to the plugin folder and leave the person there to
|
|
168
168
|
// work out that a skill is a folder with a SKILL.md in it. It now writes the
|
|
169
169
|
// file, so the assertions are about what gets written and where it opens.
|
|
170
|
-
describe('
|
|
170
|
+
describe('AddToPluginDialog: starting an empty SKILL.md', () => {
|
|
171
171
|
beforeEach(() => {
|
|
172
172
|
apiMock.createEmptySkill.mockReset();
|
|
173
173
|
apiMock.createEmptySkill.mockResolvedValue({
|
|
174
|
-
repoRelativePath: '
|
|
175
|
-
workspacePath: 'knowledge-base/
|
|
174
|
+
repoRelativePath: 'Plugins/GTM/weekly-report/SKILL.md',
|
|
175
|
+
workspacePath: 'knowledge-base/Plugins/GTM/weekly-report/SKILL.md',
|
|
176
176
|
branch: 'target-company-state',
|
|
177
177
|
direct: true,
|
|
178
178
|
});
|
|
@@ -183,17 +183,17 @@ describe('AddToGroupDialog: starting an empty SKILL.md', () => {
|
|
|
183
183
|
expect(create()).toBeDisabled();
|
|
184
184
|
});
|
|
185
185
|
|
|
186
|
-
it('creates it in the
|
|
186
|
+
it('creates it in the plugin folder, opens the file, and closes', async () => {
|
|
187
187
|
const { field, create, onClose, href } = renderDialog();
|
|
188
188
|
fireEvent.change(field(), { target: { value: ' weekly-report ' } });
|
|
189
189
|
fireEvent.click(create());
|
|
190
190
|
|
|
191
|
-
// Trimmed, addressed at the
|
|
191
|
+
// Trimmed, addressed at the plugin's own folder, and carrying the writer
|
|
192
192
|
// verdict — the service decides direct-vs-change-request from it.
|
|
193
193
|
await waitFor(() =>
|
|
194
194
|
expect(apiMock.createEmptySkill).toHaveBeenCalledWith(
|
|
195
195
|
expect.objectContaining({
|
|
196
|
-
parentPath: '
|
|
196
|
+
parentPath: 'Plugins/GTM',
|
|
197
197
|
name: 'weekly-report',
|
|
198
198
|
canWrite: true,
|
|
199
199
|
}),
|
|
@@ -205,7 +205,7 @@ describe('AddToGroupDialog: starting an empty SKILL.md', () => {
|
|
|
205
205
|
// rather than silently landing on a read-only page.
|
|
206
206
|
await waitFor(() =>
|
|
207
207
|
// The canonical address: the new SKILL.md's own workspace URL.
|
|
208
|
-
expect(href()).toBe(`/workspace/${DEFAULT_BRANCH}/knowledge-base/
|
|
208
|
+
expect(href()).toBe(`/workspace/${DEFAULT_BRANCH}/knowledge-base/Plugins/GTM/weekly-report/SKILL.md`),
|
|
209
209
|
);
|
|
210
210
|
expect(screen.getByLabelText('router-state')).toHaveTextContent(
|
|
211
211
|
JSON.stringify({ startEditing: true }),
|
|
@@ -221,7 +221,7 @@ describe('AddToGroupDialog: starting an empty SKILL.md', () => {
|
|
|
221
221
|
expect(apiMock.createEmptySkill).not.toHaveBeenCalled();
|
|
222
222
|
});
|
|
223
223
|
|
|
224
|
-
it('refuses a name another skill already holds, in any
|
|
224
|
+
it('refuses a name another skill already holds, in any plugin', () => {
|
|
225
225
|
// A skill's id IS its name, and the backend's scan drops the second claimant
|
|
226
226
|
// outright — so this file would exist and never appear anywhere.
|
|
227
227
|
const { field, create } = renderDialog('knowledge-base', true, ['rfi', 'weekly-report']);
|
|
@@ -232,28 +232,28 @@ describe('AddToGroupDialog: starting an empty SKILL.md', () => {
|
|
|
232
232
|
|
|
233
233
|
it('surfaces the backend refusal and stays open', async () => {
|
|
234
234
|
apiMock.createEmptySkill.mockRejectedValue(
|
|
235
|
-
new Error("You don't have permission to write to
|
|
235
|
+
new Error("You don't have permission to write to Plugins/GTM"),
|
|
236
236
|
);
|
|
237
237
|
const { field, create, onClose } = renderDialog();
|
|
238
238
|
fireEvent.change(field(), { target: { value: 'weekly-report' } });
|
|
239
239
|
fireEvent.click(create());
|
|
240
240
|
|
|
241
|
-
expect(await screen.findByText(/don't have permission to write to
|
|
241
|
+
expect(await screen.findByText(/don't have permission to write to Plugins\/GTM/)).toBeInTheDocument();
|
|
242
242
|
expect(onClose).not.toHaveBeenCalled();
|
|
243
243
|
});
|
|
244
244
|
});
|
|
245
245
|
|
|
246
246
|
// ── one door, one varying clause ──
|
|
247
|
-
// The
|
|
247
|
+
// The plugin page used to fork on `canWrite` into two different flows. It does
|
|
248
248
|
// not any more: everybody gets THIS dialog, and the only thing role changes is
|
|
249
249
|
// what the prompt says happens next — and, now, where the new file lands.
|
|
250
|
-
describe('
|
|
250
|
+
describe('AddToPluginDialog for an admin non-writer', () => {
|
|
251
251
|
it('offers the same dialog, and tells the truth about review', () => {
|
|
252
252
|
renderDialog('knowledge-base', false);
|
|
253
253
|
expect(
|
|
254
254
|
screen.getByText(/goes to GTM as a change request, and an owner reviews it/),
|
|
255
255
|
).toBeInTheDocument();
|
|
256
|
-
expect(screen.getByText(/send it to the
|
|
256
|
+
expect(screen.getByText(/send it to the plugin as a change request/)).toBeInTheDocument();
|
|
257
257
|
expect(screen.queryByText(/no review step/)).not.toBeInTheDocument();
|
|
258
258
|
});
|
|
259
259
|
|
|
@@ -265,8 +265,8 @@ describe('AddToGroupDialog for an admin non-writer', () => {
|
|
|
265
265
|
|
|
266
266
|
it('passes the verdict down, so the file goes for review', async () => {
|
|
267
267
|
apiMock.createEmptySkill.mockResolvedValue({
|
|
268
|
-
repoRelativePath: '
|
|
269
|
-
workspacePath: 'knowledge-base/
|
|
268
|
+
repoRelativePath: 'Plugins/GTM/weekly-report/SKILL.md',
|
|
269
|
+
workspacePath: 'knowledge-base/Plugins/GTM/weekly-report/SKILL.md',
|
|
270
270
|
branch: 'suggestions/juan/weekly-report',
|
|
271
271
|
direct: false,
|
|
272
272
|
});
|
|
@@ -279,35 +279,35 @@ describe('AddToGroupDialog for an admin non-writer', () => {
|
|
|
279
279
|
expect.objectContaining({ canWrite: false }),
|
|
280
280
|
),
|
|
281
281
|
);
|
|
282
|
-
// A proposal has no page yet, so the dialog does NOT navigate — the
|
|
282
|
+
// A proposal has no page yet, so the dialog does NOT navigate — the plugin
|
|
283
283
|
// page stays put, and the new skill appears on it as an "In review" card.
|
|
284
|
-
expect(await screen.findByText(/sent to the
|
|
285
|
-
expect(href()).toBe('/skills-and-tools/
|
|
284
|
+
expect(await screen.findByText(/sent to the plugin's owners for review/)).toBeInTheDocument();
|
|
285
|
+
expect(href()).toBe('/skills-and-tools/plugins/GTM');
|
|
286
286
|
});
|
|
287
287
|
});
|
|
288
288
|
|
|
289
|
-
describe('
|
|
289
|
+
describe('AddToPluginDialog for a non-admin', () => {
|
|
290
290
|
beforeEach(() => {
|
|
291
291
|
apiMock.createEmptySkill.mockClear();
|
|
292
292
|
});
|
|
293
293
|
|
|
294
|
-
it('removes empty skill creation even when the person can write the
|
|
294
|
+
it('removes empty skill creation even when the person can write the plugin', () => {
|
|
295
295
|
renderDialog('knowledge-base', true, [], false);
|
|
296
296
|
|
|
297
297
|
expect(screen.queryByText('Start an empty SKILL.md')).not.toBeInTheDocument();
|
|
298
298
|
expect(screen.queryByRole('textbox', { name: 'Skill name' })).not.toBeInTheDocument();
|
|
299
299
|
expect(screen.getByRole('button', { name: 'Copy prompt' })).toBeInTheDocument();
|
|
300
|
-
expect(screen.getByText(/add it to GTM for everyone in the
|
|
300
|
+
expect(screen.getByText(/add it to GTM for everyone in the plugin/)).toBeInTheDocument();
|
|
301
301
|
expect(screen.queryByText(/Two ways in/)).not.toBeInTheDocument();
|
|
302
302
|
});
|
|
303
303
|
|
|
304
|
-
it('keeps only the reviewed agent path when the person cannot write the
|
|
304
|
+
it('keeps only the reviewed agent path when the person cannot write the plugin', () => {
|
|
305
305
|
renderDialog('knowledge-base', false, [], false);
|
|
306
306
|
|
|
307
307
|
expect(screen.queryByText('Start an empty SKILL.md')).not.toBeInTheDocument();
|
|
308
308
|
expect(screen.queryByRole('textbox', { name: 'Skill name' })).not.toBeInTheDocument();
|
|
309
309
|
expect(screen.getByText(/change request for an owner to review/)).toBeInTheDocument();
|
|
310
|
-
expect(screen.getByText(/send it to the
|
|
310
|
+
expect(screen.getByText(/send it to the plugin as a change request/)).toBeInTheDocument();
|
|
311
311
|
expect(apiMock.createEmptySkill).not.toHaveBeenCalled();
|
|
312
312
|
});
|
|
313
313
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
2
|
import { render, screen, cleanup } from '@testing-library/react';
|
|
3
3
|
import { LibraryCard, type LibraryCardProps } from '../components/LibraryCard';
|
|
4
|
-
import { displayFirstName,
|
|
4
|
+
import { displayFirstName, personalPluginName } from '../utils/personal-plugin';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* What a card says when it has nothing to report, and what it says when it has.
|
|
@@ -13,7 +13,11 @@ import { displayFirstName, personalGroupName } from '../utils/personal-group';
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
function card(over: Partial<LibraryCardProps> = {}) {
|
|
16
|
-
|
|
16
|
+
// The cast, not a typed literal: `LibraryCardProps` is a discriminated
|
|
17
|
+
// union on `kind`, and a base-plus-overrides spread cannot be proven to
|
|
18
|
+
// land on one arm. Integration overrides still pass `flavor`, as the union
|
|
19
|
+
// demands of real callers.
|
|
20
|
+
const props = {
|
|
17
21
|
kind: 'skill',
|
|
18
22
|
id: 'rfi',
|
|
19
23
|
name: 'rfi',
|
|
@@ -22,7 +26,7 @@ function card(over: Partial<LibraryCardProps> = {}) {
|
|
|
22
26
|
status: { state: 'ok', text: 'Ready' },
|
|
23
27
|
onOpen: vi.fn(),
|
|
24
28
|
...over,
|
|
25
|
-
};
|
|
29
|
+
} as LibraryCardProps;
|
|
26
30
|
render(<LibraryCard {...props} />);
|
|
27
31
|
}
|
|
28
32
|
|
|
@@ -32,10 +36,24 @@ describe('LibraryCard', () => {
|
|
|
32
36
|
expect(screen.queryByText(/^Skill$/i)).not.toBeInTheDocument();
|
|
33
37
|
|
|
34
38
|
cleanup();
|
|
35
|
-
card({ kind: 'integration', id: 'slack', name: 'slack', status: { state: 'ok', text: 'Connected' } });
|
|
39
|
+
card({ kind: 'integration', flavor: 'utcp', id: 'slack', name: 'slack', status: { state: 'ok', text: 'Connected' } });
|
|
36
40
|
expect(screen.queryByText(/^Integration$/i)).not.toBeInTheDocument();
|
|
37
41
|
});
|
|
38
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The one label an integration DOES carry: how it is declared, because that
|
|
45
|
+
* decides which file an owner edits. Required by the props union — an
|
|
46
|
+
* optional here shipped cards silently missing the badge.
|
|
47
|
+
*/
|
|
48
|
+
it('says how an integration is declared', () => {
|
|
49
|
+
card({ kind: 'integration', flavor: 'mcp', id: 'linear', name: 'linear', status: { state: 'ok', text: 'Connected' } });
|
|
50
|
+
expect(screen.getByText('MCP server')).toBeInTheDocument();
|
|
51
|
+
|
|
52
|
+
cleanup();
|
|
53
|
+
card({ kind: 'integration', flavor: 'utcp', id: 'slack', name: 'slack', status: { state: 'ok', text: 'Connected' } });
|
|
54
|
+
expect(screen.getByText('UTCP manual')).toBeInTheDocument();
|
|
55
|
+
});
|
|
56
|
+
|
|
39
57
|
it('says nothing about a healthy skill', () => {
|
|
40
58
|
card({ kind: 'skill', status: { state: 'ok', text: 'Ready' } });
|
|
41
59
|
// Not even "Ready": a green word on every skill in the grid is a row of
|
|
@@ -49,12 +67,13 @@ describe('LibraryCard', () => {
|
|
|
49
67
|
});
|
|
50
68
|
|
|
51
69
|
it('always states a tool’s connection, either way', () => {
|
|
52
|
-
card({ kind: 'integration', id: 'slack', name: 'slack', status: { state: 'ok', text: 'Connected' } });
|
|
70
|
+
card({ kind: 'integration', flavor: 'utcp', id: 'slack', name: 'slack', status: { state: 'ok', text: 'Connected' } });
|
|
53
71
|
expect(screen.getByText('Connected')).toBeInTheDocument();
|
|
54
72
|
|
|
55
73
|
cleanup();
|
|
56
74
|
card({
|
|
57
75
|
kind: 'integration',
|
|
76
|
+
flavor: 'utcp',
|
|
58
77
|
id: 'notion',
|
|
59
78
|
name: 'notion',
|
|
60
79
|
status: { state: 'warn', text: 'Needs your sign-in' },
|
|
@@ -116,17 +135,17 @@ describe('LibraryCard', () => {
|
|
|
116
135
|
});
|
|
117
136
|
});
|
|
118
137
|
|
|
119
|
-
describe('
|
|
138
|
+
describe('personalPluginName', () => {
|
|
120
139
|
it('uses the first name, as a colleague would say it out loud', () => {
|
|
121
|
-
expect(
|
|
122
|
-
expect(
|
|
140
|
+
expect(personalPluginName('Juan Viera')).toBe("Juan's Plugin");
|
|
141
|
+
expect(personalPluginName('juan')).toBe("Juan's Plugin");
|
|
123
142
|
});
|
|
124
143
|
|
|
125
144
|
it('still names the place when nobody is signed in', () => {
|
|
126
145
|
// The space exists either way and still needs a heading — and "Yours" is
|
|
127
146
|
// true for whoever is reading it.
|
|
128
|
-
expect(
|
|
129
|
-
expect(
|
|
147
|
+
expect(personalPluginName(null)).toBe('Yours');
|
|
148
|
+
expect(personalPluginName(' ')).toBe('Yours');
|
|
130
149
|
});
|
|
131
150
|
});
|
|
132
151
|
|
|
@@ -140,7 +159,7 @@ describe('displayFirstName', () => {
|
|
|
140
159
|
});
|
|
141
160
|
|
|
142
161
|
// Empty rather than a fallback, because the two callers want different
|
|
143
|
-
// words for it — "Yours" on the
|
|
162
|
+
// words for it — "Yours" on the plugin heading, "there" on the welcome page.
|
|
144
163
|
it('gives nothing back when there is no name, and lets the caller decide', () => {
|
|
145
164
|
expect(displayFirstName(null)).toBe('');
|
|
146
165
|
expect(displayFirstName(undefined)).toBe('');
|