@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
|
@@ -116,15 +116,15 @@ export function skillStatus(neededTools: ToolSecrets[]): AttentionStatus {
|
|
|
116
116
|
* What the sidebar has selected.
|
|
117
117
|
*
|
|
118
118
|
* Note there is no 'skills' / 'integrations' member. The design does not split
|
|
119
|
-
* the catalog by kind: a
|
|
120
|
-
* so filtering to "just tools" would show a
|
|
119
|
+
* the catalog by kind: a plugin owns its skills AND the tools those skills need,
|
|
120
|
+
* so filtering to "just tools" would show a plugin's integrations detached from
|
|
121
121
|
* the reason any of them are there. Kind is a property of a card, not a view.
|
|
122
122
|
*/
|
|
123
123
|
export type LibraryFilter =
|
|
124
124
|
| { kind: 'all' }
|
|
125
125
|
| { kind: 'owned' }
|
|
126
|
-
| { kind: 'group';
|
|
127
|
-
/** Owned by someone, in no
|
|
126
|
+
| { kind: 'group'; plugin: string }
|
|
127
|
+
/** Owned by someone, in no plugin — the prototype calls these "yours alone". */
|
|
128
128
|
| { kind: 'ungrouped' };
|
|
129
129
|
|
|
130
130
|
/**
|
|
@@ -150,8 +150,8 @@ export interface LibraryFilterable {
|
|
|
150
150
|
name: string;
|
|
151
151
|
description: string;
|
|
152
152
|
owned: boolean;
|
|
153
|
-
/** Folder
|
|
154
|
-
|
|
153
|
+
/** Folder plugin from the item's KB path, or null when it sits in none. */
|
|
154
|
+
plugin: string | null;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/** Sidebar selection narrows; the query matches name/description within it. */
|
|
@@ -171,29 +171,29 @@ export function filterLibraryItems<T extends LibraryFilterable>(
|
|
|
171
171
|
case 'owned':
|
|
172
172
|
return item.owned;
|
|
173
173
|
case 'group':
|
|
174
|
-
return item.
|
|
174
|
+
return item.plugin === filter.plugin;
|
|
175
175
|
case 'ungrouped':
|
|
176
|
-
return item.
|
|
176
|
+
return item.plugin === null;
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
|
-
*
|
|
182
|
+
* Plugin names present in the catalog, with how many items each holds.
|
|
183
183
|
*
|
|
184
184
|
* Sorted by name rather than by count so the sidebar does not reorder itself
|
|
185
|
-
* when a
|
|
186
|
-
* than one that buries the biggest
|
|
185
|
+
* when a plugin gains an item — a nav that moves under the pointer is worse
|
|
186
|
+
* than one that buries the biggest plugin in the middle.
|
|
187
187
|
*/
|
|
188
|
-
export function
|
|
188
|
+
export function pluginCounts<T extends LibraryFilterable>(
|
|
189
189
|
items: T[],
|
|
190
|
-
): {
|
|
190
|
+
): { plugin: string; count: number }[] {
|
|
191
191
|
const counts = new Map<string, number>();
|
|
192
192
|
for (const item of items) {
|
|
193
|
-
if (item.
|
|
194
|
-
counts.set(item.
|
|
193
|
+
if (item.plugin === null) continue;
|
|
194
|
+
counts.set(item.plugin, (counts.get(item.plugin) ?? 0) + 1);
|
|
195
195
|
}
|
|
196
196
|
return [...counts.entries()]
|
|
197
|
-
.map(([
|
|
198
|
-
.sort((a, b) => a.
|
|
197
|
+
.map(([plugin, count]) => ({ plugin, count }))
|
|
198
|
+
.sort((a, b) => a.plugin.localeCompare(b.plugin));
|
|
199
199
|
}
|
|
@@ -12,6 +12,7 @@ import { RootLanding } from '../components/RootLanding';
|
|
|
12
12
|
import { POST_LOGIN_REDIRECT_KEY } from '../../auth/services/sso';
|
|
13
13
|
import { WELCOME_PATH } from '../paths';
|
|
14
14
|
import { resetOnboardingForTests } from '../state/onboarding';
|
|
15
|
+
import { configureMcpUrl } from '../../../shared/mcp';
|
|
15
16
|
import { setSidebarCollapsed, useSidebar } from '../../layout/state/sidebar';
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -214,7 +215,7 @@ describe('WelcomePage', () => {
|
|
|
214
215
|
<Routes>
|
|
215
216
|
<Route path={WELCOME_PATH} element={<WelcomePage />} />
|
|
216
217
|
<Route path="/skills-and-tools" element={<div>library</div>} />
|
|
217
|
-
<Route path="/skills-and-tools/yours" element={<div>your
|
|
218
|
+
<Route path="/skills-and-tools/yours" element={<div>your plugin</div>} />
|
|
218
219
|
</Routes>,
|
|
219
220
|
auth,
|
|
220
221
|
route,
|
|
@@ -287,7 +288,7 @@ describe('WelcomePage', () => {
|
|
|
287
288
|
expect(sidebarState()).toMatchObject({ collapsed: true, instant: true });
|
|
288
289
|
});
|
|
289
290
|
|
|
290
|
-
it('leaves it collapsed when you go to your own
|
|
291
|
+
it('leaves it collapsed when you go to your own plugin', async () => {
|
|
291
292
|
setSidebarCollapsed(false);
|
|
292
293
|
mountPage(newUser(), greeted);
|
|
293
294
|
await userEvent.click(screen.getByRole('button', { name: /Go to your skills/ }));
|
|
@@ -343,6 +344,83 @@ describe('WelcomePage', () => {
|
|
|
343
344
|
expect(screen.getByText(/mcpServers/)).toBeInTheDocument();
|
|
344
345
|
});
|
|
345
346
|
|
|
347
|
+
/**
|
|
348
|
+
* One click instead of a menu path. It is Claude-only because Claude is the
|
|
349
|
+
* only client with a documented install link, and it appears only when
|
|
350
|
+
* Anthropic could actually reach this deployment — see `canDeepLink`. The
|
|
351
|
+
* copy block stays either way; it is the route that always works.
|
|
352
|
+
*/
|
|
353
|
+
describe('the Add to Claude link', () => {
|
|
354
|
+
it('offers one-click connect on a reachable deployment', () => {
|
|
355
|
+
configureMcpUrl('https://kb.acme.com/api/mcp');
|
|
356
|
+
mountPage();
|
|
357
|
+
const link = screen.getByRole('link', { name: 'Add to Claude' });
|
|
358
|
+
const href = new URL(link.getAttribute('href')!);
|
|
359
|
+
expect(href.origin + href.pathname).toBe('https://claude.ai/customize/connectors');
|
|
360
|
+
expect(href.searchParams.get('connectorUrl')).toBe('https://kb.acme.com/api/mcp');
|
|
361
|
+
expect(href.searchParams.get('connectorName')).toBe('Hexis — kb.acme.com');
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* The default install: `PUBLIC_BACKEND_URL` unset means localhost, which
|
|
366
|
+
* claude.ai cannot reach. A dead button on the first screen a self-hoster
|
|
367
|
+
* sees reads as a broken product.
|
|
368
|
+
*/
|
|
369
|
+
it('offers nothing to click on a localhost deployment', () => {
|
|
370
|
+
configureMcpUrl('http://localhost:3001/api/mcp');
|
|
371
|
+
mountPage();
|
|
372
|
+
expect(screen.queryByRole('link', { name: 'Add to Claude' })).toBeNull();
|
|
373
|
+
// …and the route that always works is still there.
|
|
374
|
+
expect(screen.getByText('http://localhost:3001/api/mcp')).toBeInTheDocument();
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* No `PUBLIC_BACKEND_URL` hint on THIS surface. The reader is a new
|
|
379
|
+
* employee who cannot change deployment config; naming an env var at them
|
|
380
|
+
* is noise. The settings page, whose reader plausibly can, says it there.
|
|
381
|
+
*/
|
|
382
|
+
it('does not lecture a new employee about deployment config', () => {
|
|
383
|
+
configureMcpUrl('http://localhost:3001/api/mcp');
|
|
384
|
+
mountPage();
|
|
385
|
+
expect(screen.queryByText(/PUBLIC_BACKEND_URL/)).toBeNull();
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it('belongs to Claude alone', async () => {
|
|
389
|
+
configureMcpUrl('https://kb.acme.com/api/mcp');
|
|
390
|
+
mountPage();
|
|
391
|
+
expect(screen.getByRole('link', { name: 'Add to Claude' })).toBeInTheDocument();
|
|
392
|
+
await userEvent.click(screen.getByRole('radio', { name: 'ChatGPT' }));
|
|
393
|
+
expect(screen.queryByRole('link', { name: 'Add to Claude' })).toBeNull();
|
|
394
|
+
await userEvent.click(screen.getByRole('radio', { name: 'Cursor & Others' }));
|
|
395
|
+
expect(screen.queryByRole('link', { name: 'Add to Claude' })).toBeNull();
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// Opening claude.ai must not hand it a handle on this window.
|
|
399
|
+
it('opens in a new tab safely', () => {
|
|
400
|
+
configureMcpUrl('https://kb.acme.com/api/mcp');
|
|
401
|
+
mountPage();
|
|
402
|
+
const link = screen.getByRole('link', { name: 'Add to Claude' });
|
|
403
|
+
expect(link).toHaveAttribute('target', '_blank');
|
|
404
|
+
expect(link).toHaveAttribute('rel', 'noopener noreferrer');
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* The whole point of the canonical URL: what the button hands Claude and
|
|
409
|
+
* what the copy block shows a human must be the same string, or one of
|
|
410
|
+
* them is lying.
|
|
411
|
+
*/
|
|
412
|
+
it('hands Claude exactly the URL the copy block shows', () => {
|
|
413
|
+
configureMcpUrl('https://kb.acme.com/api/mcp');
|
|
414
|
+
mountPage();
|
|
415
|
+
const href = new URL(
|
|
416
|
+
screen.getByRole('link', { name: 'Add to Claude' }).getAttribute('href')!,
|
|
417
|
+
);
|
|
418
|
+
expect(href.searchParams.get('connectorUrl')).toBe(
|
|
419
|
+
screen.getByText(/\/api\/mcp$/).textContent,
|
|
420
|
+
);
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
|
|
346
424
|
it('copies the visible snippet without concluding anything', async () => {
|
|
347
425
|
const writeText = stubClipboard();
|
|
348
426
|
mountPage();
|
|
@@ -354,9 +432,9 @@ describe('WelcomePage', () => {
|
|
|
354
432
|
});
|
|
355
433
|
|
|
356
434
|
// Exact, not a substring: `/skills-and-tools` is a PREFIX of the personal
|
|
357
|
-
//
|
|
435
|
+
// plugin's path, so a loose match would pass even if Done dropped someone in
|
|
358
436
|
// the whole company's catalog instead of their own shelf.
|
|
359
|
-
it('Done concludes: server write + landing in your own
|
|
437
|
+
it('Done concludes: server write + landing in your own plugin', async () => {
|
|
360
438
|
mountPage();
|
|
361
439
|
await userEvent.click(screen.getByRole('button', { name: 'Done' }));
|
|
362
440
|
expect(authFetchMock).toHaveBeenCalledWith(
|
|
@@ -397,7 +475,7 @@ describe('WelcomePage', () => {
|
|
|
397
475
|
|
|
398
476
|
/**
|
|
399
477
|
* `role="radiogroup"` is a promise about the keyboard, not just a label for
|
|
400
|
-
* a screen reader: arrows select, and selection follows focus. The
|
|
478
|
+
* a screen reader: arrows select, and selection follows focus. The plugin
|
|
401
479
|
* wraps, because three options in a row have no edge worth stopping at.
|
|
402
480
|
*/
|
|
403
481
|
it('drives the picker with the arrow keys, wrapping at both ends', async () => {
|
|
@@ -429,9 +507,9 @@ describe('WelcomePage', () => {
|
|
|
429
507
|
]);
|
|
430
508
|
});
|
|
431
509
|
|
|
432
|
-
// Into the person's OWN
|
|
510
|
+
// Into the person's OWN plugin, not the whole catalog — the same place the
|
|
433
511
|
// sidebar's personal row goes.
|
|
434
|
-
it('the skip link leaves for your own
|
|
512
|
+
it('the skip link leaves for your own plugin, without concluding', async () => {
|
|
435
513
|
mountPage();
|
|
436
514
|
await userEvent.click(screen.getByRole('button', { name: /Go to your skills/ }));
|
|
437
515
|
expect(authFetchMock).not.toHaveBeenCalled();
|
|
@@ -478,7 +556,7 @@ describe('WelcomePage', () => {
|
|
|
478
556
|
<AppRegistryContext.Provider value={{ ...EMPTY_REGISTRY, welcomeExit }}>
|
|
479
557
|
<Routes>
|
|
480
558
|
<Route path={WELCOME_PATH} element={<WelcomePage />} />
|
|
481
|
-
<Route path="/skills-and-tools/yours" element={<div>your
|
|
559
|
+
<Route path="/skills-and-tools/yours" element={<div>your plugin</div>} />
|
|
482
560
|
<Route path="/workspace" element={<div>knowledge</div>} />
|
|
483
561
|
</Routes>
|
|
484
562
|
</AppRegistryContext.Provider>,
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
+
import { jsonConfigSnippet } from '../../shared/mcp';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* The three ways an agent connects, named by PRODUCT rather than surface —
|
|
3
5
|
* someone knows which assistant they use before they know which build of it
|
|
4
6
|
* they are in (prototype `AGENT_CLIENTS`).
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* This file is now the welcome page's PICKER and nothing else: which clients
|
|
9
|
+
* to offer, what to call them, and how to say where the snippet goes. The
|
|
10
|
+
* snippets themselves, and the endpoint they are built from, live in
|
|
11
|
+
* `shared/mcp` — which is what makes the welcome page and the External agent
|
|
12
|
+
* access page agree.
|
|
13
|
+
*
|
|
14
|
+
* They did not, before. The docstring here used to claim the two surfaces
|
|
15
|
+
* "can never hand out different URLs" because the settings page derived the
|
|
16
|
+
* endpoint "exactly as" this file did. It never imported this file. It
|
|
17
|
+
* hand-built the same address in six places, and the two agreed by convention
|
|
18
|
+
* rather than by construction — which held only as long as nobody edited
|
|
19
|
+
* either one.
|
|
10
20
|
*/
|
|
11
21
|
|
|
12
22
|
export interface AgentClient {
|
|
@@ -28,21 +38,15 @@ export const AGENT_CLIENTS: AgentClient[] = [
|
|
|
28
38
|
{
|
|
29
39
|
id: 'chatgpt',
|
|
30
40
|
label: 'ChatGPT',
|
|
31
|
-
|
|
41
|
+
// Developer mode first: it is off by default, and every "Create" button
|
|
42
|
+
// someone hunts for is behind it.
|
|
43
|
+
hint: 'Settings → Apps & Connectors → Advanced → turn on Developer mode, then Create and paste this.',
|
|
32
44
|
snip: (url) => url,
|
|
33
45
|
},
|
|
34
46
|
{
|
|
35
47
|
id: 'other',
|
|
36
48
|
label: 'Cursor & Others',
|
|
37
49
|
hint: 'For clients that read their servers from a JSON config, like Cursor, Windsurf and Cline.',
|
|
38
|
-
snip: (url) =>
|
|
39
|
-
JSON.stringify({ mcpServers: { 'knowledge-base': { type: 'http', url } } }, null, 2),
|
|
50
|
+
snip: (url) => jsonConfigSnippet(url),
|
|
40
51
|
},
|
|
41
52
|
];
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The MCP endpoint for a given page origin — the one URL every snippet above
|
|
45
|
-
* is built from. Derived rather than configured, so a deployment on any host
|
|
46
|
-
* hands out its own address without anyone remembering to update a constant.
|
|
47
|
-
*/
|
|
48
|
-
export const mcpUrlFromOrigin = (origin: string): string => `${origin}/api/mcp`;
|
|
@@ -8,9 +8,10 @@ import { useLibraryToast } from '../../library/state/toast.context';
|
|
|
8
8
|
import { copyToClipboard, COPY_FAILED_TOAST } from '../../library/utils/clipboard';
|
|
9
9
|
import { pathForLibraryFilter } from '../../library/routes/library-paths';
|
|
10
10
|
import { useAppRegistry } from '../../../core/registry';
|
|
11
|
-
import { displayFirstName } from '../../library/utils/personal-
|
|
11
|
+
import { displayFirstName } from '../../library/utils/personal-plugin';
|
|
12
12
|
import { setSidebarCollapsed } from '../../layout/state/sidebar';
|
|
13
|
-
import {
|
|
13
|
+
import { ClaudeInstallLink, mcpEndpointUrl } from '../../../shared/mcp';
|
|
14
|
+
import { AGENT_CLIENTS, type AgentClient } from '../agent-clients';
|
|
14
15
|
import { useOnboarding } from '../state/onboarding';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -153,9 +154,11 @@ export function WelcomePage() {
|
|
|
153
154
|
}, []);
|
|
154
155
|
|
|
155
156
|
const client = AGENT_CLIENTS.find((c) => c.id === clientId) ?? AGENT_CLIENTS[0]!;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
// The deployment's own address, not the browser's — see `shared/mcp`.
|
|
158
|
+
const mcpUrl = mcpEndpointUrl();
|
|
159
|
+
const snippet = client.snip(mcpUrl);
|
|
160
|
+
// Capitalized by the same function that spells the plugin heading — "Welcome,
|
|
161
|
+
// juan" over a sidebar reading "Juan's Plugin" is the app misspelling someone
|
|
159
162
|
// to their face on the one page addressed to them.
|
|
160
163
|
const firstName = displayFirstName(user?.name) || 'there';
|
|
161
164
|
|
|
@@ -168,13 +171,13 @@ export function WelcomePage() {
|
|
|
168
171
|
* defines how it is driven: arrows select, Tab leaves. Claiming the role
|
|
169
172
|
* while only answering clicks describes a control the keyboard cannot work.
|
|
170
173
|
*
|
|
171
|
-
* Selection FOLLOWS focus, which is the pattern's default for a
|
|
174
|
+
* Selection FOLLOWS focus, which is the pattern's default for a plugin this
|
|
172
175
|
* cheap to change — picking a client re-renders one snippet, nothing is
|
|
173
176
|
* submitted, so there is no cost to arriving on an option and no reason to
|
|
174
177
|
* make people confirm. Wraps at both ends: three options in a row have no
|
|
175
178
|
* meaningful edge to stop at.
|
|
176
179
|
*
|
|
177
|
-
* Paired with the roving `tabIndex` below — one stop for the whole
|
|
180
|
+
* Paired with the roving `tabIndex` below — one stop for the whole plugin,
|
|
178
181
|
* not one per option, so Tab moves past the picker rather than through it.
|
|
179
182
|
*/
|
|
180
183
|
function onRadioKeyDown(event: React.KeyboardEvent, index: number) {
|
|
@@ -292,7 +295,7 @@ export function WelcomePage() {
|
|
|
292
295
|
type="button"
|
|
293
296
|
role="radio"
|
|
294
297
|
aria-checked={c.id === client.id}
|
|
295
|
-
// Roving: only the chosen option is a tab stop, so the
|
|
298
|
+
// Roving: only the chosen option is a tab stop, so the plugin
|
|
296
299
|
// costs ONE Tab rather than one per client.
|
|
297
300
|
tabIndex={c.id === client.id ? 0 : -1}
|
|
298
301
|
ref={(el) => {
|
|
@@ -314,6 +317,14 @@ export function WelcomePage() {
|
|
|
314
317
|
|
|
315
318
|
<p className="mt-2.5 text-meta leading-normal text-ink-faint">{client.hint}</p>
|
|
316
319
|
|
|
320
|
+
{/* Claude only, because Claude is the only client with an install
|
|
321
|
+
link — and it renders nothing at all when this deployment is one
|
|
322
|
+
Anthropic could not reach, rather than offering a shortcut that
|
|
323
|
+
dead-ends. No `showHint`: the reader here is a new employee, and
|
|
324
|
+
naming an env var they cannot change is noise. The copy block
|
|
325
|
+
below is the route that always works. */}
|
|
326
|
+
{client.id === 'claude' && <ClaudeInstallLink mcpUrl={mcpUrl} className="mt-3.5" />}
|
|
327
|
+
|
|
317
328
|
{/* The copy rides the block it copies. */}
|
|
318
329
|
<div className="relative mt-3.5">
|
|
319
330
|
<div
|
|
@@ -242,7 +242,7 @@ function FrontmatterDiffPanel({
|
|
|
242
242
|
// ── body diff helpers ───────────────────────────────────────────────────
|
|
243
243
|
|
|
244
244
|
/**
|
|
245
|
-
*
|
|
245
|
+
* Plugin consecutive same/changed runs into display blocks: runs of "same"
|
|
246
246
|
* lines, and "conflict" blocks bundling consecutive removed+added runs
|
|
247
247
|
* together — the same shape git uses for merge conflicts.
|
|
248
248
|
*/
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
stripJunkBeforeKbDir,
|
|
11
11
|
KB_ROUTE_PREFIX,
|
|
12
12
|
} from '../../workspace/routing/kb-routes';
|
|
13
|
-
import {
|
|
13
|
+
import { pluginOfPath, DEFAULT_BRANCH } from '@bevel-software/platform-shared';
|
|
14
14
|
import { cn } from '../../../lib/utils';
|
|
15
15
|
import { DOCUMENT_COLUMN, documentGutters } from '../../../shared/theme/measure';
|
|
16
16
|
import { ReviewFileRow } from './ReviewFileRow';
|
|
@@ -23,28 +23,28 @@ function isMarkdownPath(p: string): boolean {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Whether a review-session path is a skill or tool — anything under `
|
|
26
|
+
* Whether a review-session path is a skill or tool — anything under `Plugins/`.
|
|
27
27
|
*
|
|
28
28
|
* The paths in a review session are WORKSPACE-relative: the diff module
|
|
29
29
|
* resolves them against the workspace directory, so they arrive carrying the
|
|
30
|
-
* KB clone as their first segment (`knowledge-base/
|
|
31
|
-
* `
|
|
30
|
+
* KB clone as their first segment (`knowledge-base/Plugins/GTM/x/SKILL.md`).
|
|
31
|
+
* `pluginOfPath` wants them REPO-relative, and `stripJunkBeforeKbDir` does not
|
|
32
32
|
* get there on its own — it only drops junk BEFORE the kb dir and keeps the
|
|
33
33
|
* segment itself, so it returns an already-well-formed path unchanged. Asking
|
|
34
|
-
* `
|
|
35
|
-
*
|
|
34
|
+
* `pluginOfPath` about the workspace-relative form gets `null` for every path,
|
|
35
|
+
* plugin or not, which is a check that silently never fires.
|
|
36
36
|
*
|
|
37
37
|
* Exported so it can be tested directly. The behaviour it guards lives behind
|
|
38
38
|
* a dropdown the component tests cannot open, and a first attempt at covering
|
|
39
39
|
* it through the UI passed with the guard deleted.
|
|
40
40
|
*/
|
|
41
|
-
export function
|
|
41
|
+
export function isPluginItemPath(path: string, kbDirName: string | null): boolean {
|
|
42
42
|
const withoutJunk = stripJunkBeforeKbDir(path, kbDirName);
|
|
43
43
|
const repoRelative =
|
|
44
44
|
kbDirName && withoutJunk.startsWith(`${kbDirName}/`)
|
|
45
45
|
? withoutJunk.slice(kbDirName.length + 1)
|
|
46
46
|
: withoutJunk;
|
|
47
|
-
return
|
|
47
|
+
return pluginOfPath(repoRelative) !== null;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
@@ -57,12 +57,12 @@ export function isGroupItemPath(path: string, kbDirName: string | null): boolean
|
|
|
57
57
|
* Two reasons not to:
|
|
58
58
|
* - DELETED: navigating to a missing path lands FileRoute on its
|
|
59
59
|
* file-not-found state.
|
|
60
|
-
* - a
|
|
60
|
+
* - a plugin item ON THE DEFAULT BRANCH: that URL is a library location, so
|
|
61
61
|
* opening it switches the whole shell to Skills & Tools and the panel,
|
|
62
62
|
* the diff and the review vanish because someone clicked a row in a list.
|
|
63
63
|
*
|
|
64
64
|
* The branch is part of it, and this is the easy half to get wrong: only the
|
|
65
|
-
* DEFAULT branch's `
|
|
65
|
+
* DEFAULT branch's `Plugins/` URLs are library locations (`isLibraryLocation`
|
|
66
66
|
* tests `segments[1] === DEFAULT_BRANCH`). The same skill on a draft branch
|
|
67
67
|
* opens in Knowledge like any other file and switches nothing, so refusing to
|
|
68
68
|
* open it there would cost the context this call exists to give and buy
|
|
@@ -78,7 +78,7 @@ export function shouldOpenBesideDiff(input: {
|
|
|
78
78
|
branch: string | null;
|
|
79
79
|
}): boolean {
|
|
80
80
|
if (input.kind === 'deleted') return false;
|
|
81
|
-
const switchesApp = input.branch === DEFAULT_BRANCH &&
|
|
81
|
+
const switchesApp = input.branch === DEFAULT_BRANCH && isPluginItemPath(input.path, input.kbDirName);
|
|
82
82
|
return !switchesApp;
|
|
83
83
|
}
|
|
84
84
|
|
package/src/modules/review/components/__tests__/{isGroupItemPath.test.ts → isPluginItemPath.test.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach } from 'vitest';
|
|
2
2
|
import { configureBranchModel } from '@bevel-software/platform-shared';
|
|
3
|
-
import {
|
|
3
|
+
import { isPluginItemPath, shouldOpenBesideDiff } from '../ReviewPanel';
|
|
4
4
|
|
|
5
5
|
const DEFAULT = 'target-company-state';
|
|
6
6
|
const DRAFT = 'razvan/onboarding-tweaks';
|
|
@@ -24,17 +24,17 @@ const KB = 'knowledge-base';
|
|
|
24
24
|
* The first version of this check shipped broken for exactly the reason the
|
|
25
25
|
* first case below pins: review-session paths are WORKSPACE-relative, so they
|
|
26
26
|
* carry the KB clone as their first segment, and `stripJunkBeforeKbDir` keeps
|
|
27
|
-
* that segment rather than removing it. `
|
|
28
|
-
* `knowledge-base` where it wanted `
|
|
27
|
+
* that segment rather than removing it. `pluginOfPath` then saw
|
|
28
|
+
* `knowledge-base` where it wanted `Plugins` and answered `null` for every
|
|
29
29
|
* path — a guard that could never fire.
|
|
30
30
|
*/
|
|
31
|
-
describe('
|
|
31
|
+
describe('isPluginItemPath', () => {
|
|
32
32
|
it.each([
|
|
33
|
-
['skill, workspace-relative', `${KB}/
|
|
34
|
-
['tool, workspace-relative', `${KB}/
|
|
35
|
-
['personal
|
|
33
|
+
['skill, workspace-relative', `${KB}/Plugins/GTM/update-website/SKILL.md`],
|
|
34
|
+
['tool, workspace-relative', `${KB}/Plugins/Engineering/notion.tool`],
|
|
35
|
+
['personal plugin', `${KB}/Plugins/personal-u1/my-skill/SKILL.md`],
|
|
36
36
|
])('recognises a %s', (_name, path) => {
|
|
37
|
-
expect(
|
|
37
|
+
expect(isPluginItemPath(path, KB)).toBe(true);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it.each([
|
|
@@ -42,7 +42,7 @@ describe('isGroupItemPath', () => {
|
|
|
42
42
|
['repo-root file', `${KB}/roles.yaml`],
|
|
43
43
|
['data record', `${KB}/Data/Engineering/Knowledge/Ticket.md`],
|
|
44
44
|
])('leaves a %s alone', (_name, path) => {
|
|
45
|
-
expect(
|
|
45
|
+
expect(isPluginItemPath(path, KB)).toBe(false);
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -50,35 +50,35 @@ describe('isGroupItemPath', () => {
|
|
|
50
50
|
* fixtures use repo-relative ones — so both shapes have to work.
|
|
51
51
|
*/
|
|
52
52
|
it('accepts an already repo-relative path', () => {
|
|
53
|
-
expect(
|
|
54
|
-
expect(
|
|
53
|
+
expect(isPluginItemPath('Plugins/GTM/x/SKILL.md', KB)).toBe(true);
|
|
54
|
+
expect(isPluginItemPath('KnowledgeBase/Product/Thing.md', KB)).toBe(false);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
it('tolerates junk before the kb dir, which is what strip exists for', () => {
|
|
58
|
-
expect(
|
|
58
|
+
expect(isPluginItemPath(`some/prefix/${KB}/Plugins/GTM/x/SKILL.md`, KB)).toBe(true);
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
it('does not treat the
|
|
62
|
-
// `
|
|
63
|
-
// folder, and a bare `
|
|
64
|
-
expect(
|
|
65
|
-
expect(
|
|
61
|
+
it('does not treat the Plugins folder itself as an item', () => {
|
|
62
|
+
// `pluginOfPath` needs a segment BELOW the plugin; `Plugins/GTM` is the
|
|
63
|
+
// folder, and a bare `Plugins/x.tool` names no plugin at all.
|
|
64
|
+
expect(isPluginItemPath(`${KB}/Plugins/GTM`, KB)).toBe(false);
|
|
65
|
+
expect(isPluginItemPath(`${KB}/Plugins/slack.tool`, KB)).toBe(false);
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* A sibling directory whose name merely STARTS with the kb dir is not the
|
|
70
|
-
* clone, so nothing inside it is a
|
|
70
|
+
* clone, so nothing inside it is a plugin item. Both the segment-exact match
|
|
71
71
|
* in `stripJunkBeforeKbDir` and the `${kbDirName}/` prefix test added here
|
|
72
72
|
* have to agree on that — a `startsWith(kbDirName)` in either would strip
|
|
73
|
-
* `-backup/…` down to `
|
|
73
|
+
* `-backup/…` down to `Plugins/…` and call a backup copy a live skill.
|
|
74
74
|
*/
|
|
75
75
|
it('is not fooled by a directory whose name merely starts with the kb dir', () => {
|
|
76
|
-
expect(
|
|
76
|
+
expect(isPluginItemPath(`${KB}-backup/Plugins/GTM/x/SKILL.md`, KB)).toBe(false);
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
it('handles a null kbDirName', () => {
|
|
80
|
-
expect(
|
|
81
|
-
expect(
|
|
80
|
+
expect(isPluginItemPath('Plugins/GTM/x/SKILL.md', null)).toBe(true);
|
|
81
|
+
expect(isPluginItemPath('KnowledgeBase/Thing.md', null)).toBe(false);
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
|
|
@@ -89,7 +89,7 @@ describe('isGroupItemPath', () => {
|
|
|
89
89
|
*/
|
|
90
90
|
describe('shouldOpenBesideDiff', () => {
|
|
91
91
|
const base = { kbDirName: KB, branch: DEFAULT } as const;
|
|
92
|
-
const SKILL = `${KB}/
|
|
92
|
+
const SKILL = `${KB}/Plugins/GTM/update-website/SKILL.md`;
|
|
93
93
|
const DOC = `${KB}/KnowledgeBase/Product/Thing.md`;
|
|
94
94
|
|
|
95
95
|
it('opens an ordinary knowledge document', () => {
|
|
@@ -101,7 +101,7 @@ describe('shouldOpenBesideDiff', () => {
|
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
* Only the DEFAULT branch's `
|
|
104
|
+
* Only the DEFAULT branch's `Plugins/` URLs are library locations
|
|
105
105
|
* (`isLibraryLocation` tests `segments[1] === DEFAULT_BRANCH`). On a draft
|
|
106
106
|
* branch the same skill opens in Knowledge and switches nothing, so the
|
|
107
107
|
* guard must not fire — refusing there would cost the context this call
|
|
@@ -53,7 +53,7 @@ export function ToolSecretsPanel({ tool, onChanged }: { tool: ToolSecrets; onCha
|
|
|
53
53
|
<div className="flex flex-col gap-3.5">
|
|
54
54
|
<SetupBanner setup={tool.setup} />
|
|
55
55
|
{adminVars.length > 0 && (
|
|
56
|
-
<
|
|
56
|
+
<VarPlugin
|
|
57
57
|
title="Set by the tool owner"
|
|
58
58
|
hint={tool.canWrite ? 'Shared by everyone who uses this tool.' : 'Only a tool writer can set these.'}
|
|
59
59
|
slug={tool.slug}
|
|
@@ -66,7 +66,7 @@ export function ToolSecretsPanel({ tool, onChanged }: { tool: ToolSecrets; onCha
|
|
|
66
66
|
/>
|
|
67
67
|
)}
|
|
68
68
|
{userVars.length > 0 && (
|
|
69
|
-
<
|
|
69
|
+
<VarPlugin
|
|
70
70
|
title="Set by you"
|
|
71
71
|
hint="Your own value: not shared with other users."
|
|
72
72
|
slug={tool.slug}
|
|
@@ -115,7 +115,7 @@ function SetupBanner({ setup }: { setup: ToolSetup | null }) {
|
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
function
|
|
118
|
+
function VarPlugin({
|
|
119
119
|
title,
|
|
120
120
|
hint,
|
|
121
121
|
slug,
|
|
@@ -22,7 +22,7 @@ import { SettingsNav, type LinkableItem } from './SettingsNav';
|
|
|
22
22
|
* something each page has to remember to render.
|
|
23
23
|
*
|
|
24
24
|
* It fills the app's ONE `SidebarFrame` — the third renderer of it, after
|
|
25
|
-
* Knowledge's file tree and Skills & Tools'
|
|
25
|
+
* Knowledge's file tree and Skills & Tools' plugin list. `sidebar.ts` already
|
|
26
26
|
* states the claim this relies on: there is one nav, in one place, holding a
|
|
27
27
|
* different list depending on where you are.
|
|
28
28
|
*
|
|
@@ -9,18 +9,18 @@ export type LinkableItem = AdminMenuItem & { path: string };
|
|
|
9
9
|
/**
|
|
10
10
|
* `rail` is the sidebar column; `strip` is the horizontal row it becomes below
|
|
11
11
|
* the `md` breakpoint. The rows are identical in both — only the axis and the
|
|
12
|
-
* section label change, because a label that introduces a group
|
|
13
|
-
* a vertical-list device and reads as noise inline.
|
|
12
|
+
* section label change, because a label that introduces a group of rows
|
|
13
|
+
* beneath it is a vertical-list device and reads as noise inline.
|
|
14
14
|
*/
|
|
15
15
|
export type SettingsNavOrientation = 'rail' | 'strip';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* The settings nav's CONTENTS — a pure view of the URL, in the same sense
|
|
19
|
-
* `
|
|
19
|
+
* `PluginsSidebar` is. It holds no state, decides no membership and fetches
|
|
20
20
|
* nothing; the layout works out which rows exist and which one is current,
|
|
21
21
|
* and this renders them.
|
|
22
22
|
*
|
|
23
|
-
* Row styling is `
|
|
23
|
+
* Row styling is `PluginsSidebar`'s declaration token for token, minus the
|
|
24
24
|
* count slot it has no use for, plus `FileExplorer`'s inset focus ring — the
|
|
25
25
|
* more complete of the two treatments. The two sidebars must not read as two
|
|
26
26
|
* products, and the class string is what that rule actually protects.
|
|
@@ -99,7 +99,7 @@ export function SettingsNav({
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
* Copied from `
|
|
102
|
+
* Copied from `PluginsSidebar`'s `SectionLabel` rather than extracted into a
|
|
103
103
|
* shared component — the same call `FileExplorer` made about its own row
|
|
104
104
|
* class. Three sidebars agreeing on a label's padding is not yet an
|
|
105
105
|
* abstraction, and hoisting it would put a shared dependency between two
|