@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.
Files changed (132) hide show
  1. package/LICENSE +202 -202
  2. package/THIRD-PARTY-NOTICES.md +344 -988
  3. package/package.json +5 -5
  4. package/src/core/CoreAppShell.tsx +4 -4
  5. package/src/core/__tests__/ShellRoutes.test.tsx +1 -1
  6. package/src/core/__tests__/bootstrap.test.ts +47 -2
  7. package/src/core/bootstrap.ts +20 -0
  8. package/src/core/registry.ts +16 -4
  9. package/src/css-side-effect-imports.d.ts +7 -7
  10. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +1 -1
  11. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +5 -5
  12. package/src/modules/access/api.ts +5 -5
  13. package/src/modules/access/components/ManageAccessDialog.tsx +21 -20
  14. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
  15. package/src/modules/admin/components/AdminRolesPage.tsx +1 -1
  16. package/src/modules/admin/state/admin.context.tsx +15 -0
  17. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +2 -2
  18. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +1 -1
  19. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +1 -1
  20. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +4 -4
  21. package/src/modules/layout/__tests__/SidebarToggle.test.tsx +4 -4
  22. package/src/modules/layout/__tests__/breakpoints.test.ts +1 -1
  23. package/src/modules/layout/components/SidebarFrame.tsx +2 -2
  24. package/src/modules/library/__tests__/{AddToGroupDialog.test.tsx → AddToPluginDialog.test.tsx} +34 -34
  25. package/src/modules/library/__tests__/LibraryCard.test.tsx +30 -11
  26. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +84 -59
  27. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +51 -51
  28. package/src/modules/library/__tests__/{LockedGroupView.test.tsx → LockedPluginView.test.tsx} +33 -33
  29. package/src/modules/library/__tests__/McpServerSection.test.tsx +138 -0
  30. package/src/modules/library/__tests__/{NewGroupDialog.test.tsx → NewPluginDialog.test.tsx} +22 -22
  31. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +7 -7
  32. package/src/modules/library/__tests__/PluginExtras.test.tsx +131 -0
  33. package/src/modules/library/__tests__/{GroupJoinRequests.test.tsx → PluginJoinRequests.test.tsx} +24 -24
  34. package/src/modules/library/__tests__/{GroupPage.test.tsx → PluginPage.test.tsx} +197 -106
  35. package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +363 -0
  36. package/src/modules/library/__tests__/{GroupsSidebar.contextmenu.test.tsx → PluginsSidebar.contextmenu.test.tsx} +32 -31
  37. package/src/modules/library/__tests__/{GroupsSidebar.locked.test.tsx → PluginsSidebar.locked.test.tsx} +29 -28
  38. package/src/modules/library/__tests__/PluginsSidebar.test.tsx +171 -0
  39. package/src/modules/library/__tests__/{GroupsSidebarMenu.test.tsx → PluginsSidebarMenu.test.tsx} +18 -18
  40. package/src/modules/library/__tests__/SkillPage.test.tsx +8 -8
  41. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +2 -2
  42. package/src/modules/library/__tests__/ToolPage.test.tsx +41 -12
  43. package/src/modules/library/__tests__/ToolSharePanel.test.tsx +1 -1
  44. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +57 -57
  45. package/src/modules/library/__tests__/auth-harness.tsx +4 -4
  46. package/src/modules/library/__tests__/library-data.test.ts +82 -0
  47. package/src/modules/library/__tests__/status.test.ts +19 -19
  48. package/src/modules/library/__tests__/tools.api.test.ts +70 -0
  49. package/src/modules/library/__tests__/useToolPage.test.tsx +4 -4
  50. package/src/modules/library/components/AccessRequestsBanner.tsx +8 -8
  51. package/src/modules/library/components/{AddToGroupDialog.tsx → AddToPluginDialog.tsx} +11 -11
  52. package/src/modules/library/components/ChangeRequestDock.tsx +1 -1
  53. package/src/modules/library/components/{DeleteGroupDialog.tsx → DeletePluginDialog.tsx} +9 -9
  54. package/src/modules/library/components/LibraryCard.tsx +26 -2
  55. package/src/modules/library/components/LibraryLayout.tsx +80 -71
  56. package/src/modules/library/components/LibraryPage.tsx +8 -8
  57. package/src/modules/library/components/LockGlyph.tsx +1 -1
  58. package/src/modules/library/components/{LockedGroupView.tsx → LockedPluginView.tsx} +35 -35
  59. package/src/modules/library/components/{ManagedGroupRequests.tsx → ManagedPluginRequests.tsx} +13 -13
  60. package/src/modules/library/components/{NewGroupDialog.tsx → NewPluginDialog.tsx} +24 -24
  61. package/src/modules/library/components/NewSkillPanel.tsx +23 -5
  62. package/src/modules/library/components/PageActions.tsx +34 -11
  63. package/src/modules/library/components/PersonalAddDialog.tsx +5 -5
  64. package/src/modules/library/components/{PersonalGroupPage.tsx → PersonalPluginPage.tsx} +29 -19
  65. package/src/modules/library/components/PluginExtras.tsx +195 -0
  66. package/src/modules/library/components/{GroupIndexRow.tsx → PluginIndexRow.tsx} +6 -6
  67. package/src/modules/library/components/PluginJoinRequests.tsx +77 -0
  68. package/src/modules/library/components/{GroupPage.tsx → PluginPage.tsx} +112 -72
  69. package/src/modules/library/components/{GroupsIndexPage.tsx → PluginsIndexPage.tsx} +91 -48
  70. package/src/modules/library/components/{GroupsSidebar.tsx → PluginsSidebar.tsx} +105 -55
  71. package/src/modules/library/components/{GroupsSidebarMenu.tsx → PluginsSidebarMenu.tsx} +15 -15
  72. package/src/modules/library/components/{group-page-parts.tsx → plugin-page-parts.tsx} +218 -27
  73. package/src/modules/library/components/skill-page/SkillPage.tsx +12 -12
  74. package/src/modules/library/components/tool-page/McpServerSection.tsx +380 -0
  75. package/src/modules/library/components/tool-page/ToolPage.tsx +22 -5
  76. package/src/modules/library/hooks/useJoinRequests.ts +8 -8
  77. package/src/modules/library/routes/LibraryRoutes.tsx +32 -19
  78. package/src/modules/library/routes/WorkspaceItemRoute.tsx +24 -24
  79. package/src/modules/library/routes/library-paths.ts +36 -36
  80. package/src/modules/library/services/library.api.ts +9 -9
  81. package/src/modules/library/services/{groups.api.ts → plugins.api.ts} +43 -43
  82. package/src/modules/library/services/tools.api.ts +54 -0
  83. package/src/modules/library/state/library-data.tsx +67 -46
  84. package/src/modules/library/utils/names.ts +1 -1
  85. package/src/modules/library/utils/{personal-group.ts → personal-plugin.ts} +8 -8
  86. package/src/modules/library/utils/{group-summary.ts → plugin-summary.ts} +14 -14
  87. package/src/modules/library/utils/status.ts +17 -17
  88. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +318 -0
  89. package/src/modules/onboarding/__tests__/onboarding.test.tsx +86 -8
  90. package/src/modules/onboarding/agent-clients.ts +18 -14
  91. package/src/modules/onboarding/components/CreatorWelcomePage.tsx +143 -0
  92. package/src/modules/onboarding/components/WelcomePage.tsx +30 -22
  93. package/src/modules/onboarding/components/WelcomeRoute.tsx +57 -0
  94. package/src/modules/onboarding/welcome-state.ts +36 -0
  95. package/src/modules/review/components/MarkdownDiffViewer.tsx +1 -1
  96. package/src/modules/review/components/ReviewPanel.tsx +11 -11
  97. package/src/modules/review/components/__tests__/{isGroupItemPath.test.ts → isPluginItemPath.test.ts} +24 -24
  98. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +3 -3
  99. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +1 -1
  100. package/src/modules/settings/components/SettingsLayout.tsx +1 -1
  101. package/src/modules/settings/components/SettingsNav.tsx +5 -5
  102. package/src/modules/setup/__tests__/setup.test.tsx +203 -0
  103. package/src/modules/setup/components/SetupScreen.tsx +235 -68
  104. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +29 -107
  105. package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +1 -1
  106. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +228 -0
  107. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +3 -3
  108. package/src/modules/workspace/components/FileExplorer.tsx +12 -12
  109. package/src/modules/workspace/components/FileRoute.tsx +8 -1
  110. package/src/modules/workspace/components/FileViewer.tsx +95 -38
  111. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +14 -14
  112. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +20 -0
  113. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +227 -18
  114. package/src/modules/workspace/components/renderers/ToolRenderer.tsx +7 -2
  115. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +25 -0
  116. package/src/modules/workspace/routing/kb-routes.ts +23 -1
  117. package/src/modules/workspace/utils/__tests__/diff.test.ts +1 -1
  118. package/src/modules/workspace/utils/fileTree.ts +54 -3
  119. package/src/shared/components/Surface.tsx +15 -0
  120. package/src/shared/mcp/ClaudeInstallLink.tsx +88 -0
  121. package/src/shared/mcp/ConnectionInstructions.tsx +51 -0
  122. package/src/shared/mcp/CopyBlock.tsx +42 -0
  123. package/src/shared/mcp/__tests__/ClaudeInstallLink.test.tsx +40 -0
  124. package/src/shared/mcp/__tests__/connect-snippets.test.ts +431 -0
  125. package/src/shared/mcp/__tests__/useCopyFeedback.test.ts +112 -0
  126. package/src/shared/mcp/connect-snippets.ts +353 -0
  127. package/src/shared/mcp/index.ts +28 -0
  128. package/src/shared/mcp/useCopyFeedback.ts +46 -0
  129. package/src/test-setup.ts +11 -0
  130. package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +0 -283
  131. package/src/modules/library/__tests__/GroupsSidebar.test.tsx +0 -142
  132. package/src/modules/library/components/GroupJoinRequests.tsx +0 -56
@@ -9,12 +9,12 @@ import {
9
9
  import { AdminContext, type AdminContextValue } from '../../admin/state/admin.context';
10
10
  import type { LibraryData } from '../hooks/useLibraryData';
11
11
  import type { ToolSecrets } from '../../secrets-vault/services/tool-secrets.api';
12
- import type { GroupSummary } from '../services/groups.api';
12
+ import type { PluginSummary } from '../services/plugins.api';
13
13
  import { withAuth } from './auth-harness';
14
14
 
15
15
  /**
16
- * The group page: which view a caller gets, what the page says about who runs
17
- * the group, and where its one action goes. The catalog and the group index are
16
+ * The plugin page: which view a caller gets, what the page says about who runs
17
+ * the plugin, and where its one action goes. The catalog and the plugin index are
18
18
  * mocked at their two seams — what is under test is the page's judgement, not
19
19
  * the fetching underneath it.
20
20
  */
@@ -22,11 +22,11 @@ import { withAuth } from './auth-harness';
22
22
  const dataMock = vi.hoisted(() => ({ useLibraryData: vi.fn() }));
23
23
  vi.mock('../hooks/useLibraryData', () => ({ useLibraryData: dataMock.useLibraryData }));
24
24
 
25
- const groupsMock = vi.hoisted(() => ({
26
- listGroups: vi.fn(),
25
+ const pluginsMock = vi.hoisted(() => ({
26
+ listPlugins: vi.fn(),
27
27
  listJoinRequests: vi.fn(),
28
28
  reconcileJoinRequest: vi.fn(),
29
- requestGroupAccess: vi.fn(),
29
+ requestPluginAccess: vi.fn(),
30
30
  }));
31
31
  const libApiMock = vi.hoisted(() => ({ removeLibraryItem: vi.fn() }));
32
32
  vi.mock('../services/library.api', async (importOriginal) => ({
@@ -34,16 +34,16 @@ vi.mock('../services/library.api', async (importOriginal) => ({
34
34
  removeLibraryItem: libApiMock.removeLibraryItem,
35
35
  }));
36
36
 
37
- vi.mock('../services/groups.api', () => ({
38
- listGroups: groupsMock.listGroups,
39
- listJoinRequests: groupsMock.listJoinRequests,
40
- reconcileJoinRequest: groupsMock.reconcileJoinRequest,
41
- requestGroupAccess: groupsMock.requestGroupAccess,
37
+ vi.mock('../services/plugins.api', () => ({
38
+ listPlugins: pluginsMock.listPlugins,
39
+ listJoinRequests: pluginsMock.listJoinRequests,
40
+ reconcileJoinRequest: pluginsMock.reconcileJoinRequest,
41
+ requestPluginAccess: pluginsMock.requestPluginAccess,
42
42
  AlreadyReadableError: class AlreadyReadableError extends Error {},
43
43
  }));
44
44
 
45
45
  // The ONE access surface — the separate summary section this page was designed
46
- // with never shipped, so there is no `GroupAccessSection.test.tsx` to defer to.
46
+ // with never shipped, so there is no `PluginAccessSection.test.tsx` to defer to.
47
47
  // Mocked at the component: the dialog fetches on mount, and stubbing that seam
48
48
  // keeps these tests on the page's judgement rather than the network. Its own
49
49
  // behaviour lives in the access module's tests; what this file owes is that the
@@ -66,7 +66,7 @@ vi.mock('../../access/components/ManageAccessDialog', () => ({
66
66
 
67
67
  import { LibraryProvider } from '../state/library-data';
68
68
  import { LibraryToastProvider } from '../state/toast';
69
- import { GroupPage } from '../components/GroupPage';
69
+ import { PluginPage } from '../components/PluginPage';
70
70
 
71
71
  const workspace = {
72
72
  workspaceId: 'target-company-state',
@@ -84,10 +84,13 @@ const nonAdmin: AdminContextValue = {
84
84
  runRolesRecovery: vi.fn(),
85
85
  };
86
86
 
87
+ /** The same caller with the admin bit set — the empty band's doorway is theirs. */
88
+ const asAdmin: AdminContextValue = { ...nonAdmin, isAdmin: true };
89
+
87
90
  const connectedTool = (over: Partial<ToolSecrets> = {}): ToolSecrets => ({
88
91
  slug: 'heyreach',
89
92
  name: 'heyreach',
90
- path: 'Groups/GTM/heyreach.tool',
93
+ path: 'Plugins/GTM/heyreach.tool',
91
94
  type: 'inline',
92
95
  setup: null,
93
96
  canWrite: false,
@@ -100,7 +103,7 @@ const unsetTool = (over: Partial<ToolSecrets> = {}): ToolSecrets =>
100
103
  connectedTool({
101
104
  slug: 'apollo',
102
105
  name: 'apollo',
103
- path: 'Groups/GTM/apollo.tool',
106
+ path: 'Plugins/GTM/apollo.tool',
104
107
  variables: [
105
108
  {
106
109
  name: 'API_KEY',
@@ -118,8 +121,8 @@ const CATALOG: LibraryData = {
118
121
  loading: false,
119
122
  error: null,
120
123
  skills: [
121
- { name: 'outreach', description: 'Runs the GTM outreach.', path: 'Groups/GTM/outreach' },
122
- { name: 'roadmap', description: 'Keeps the roadmap.', path: 'Groups/Product/roadmap' },
124
+ { name: 'outreach', description: 'Runs the GTM outreach.', path: 'Plugins/GTM/outreach' },
125
+ { name: 'roadmap', description: 'Keeps the roadmap.', path: 'Plugins/Product/roadmap' },
123
126
  ],
124
127
  pendingSkills: [],
125
128
  tools: [connectedTool()],
@@ -130,9 +133,9 @@ const CATALOG: LibraryData = {
130
133
  reload: vi.fn(),
131
134
  };
132
135
 
133
- const gtm = (over: Partial<GroupSummary> = {}): GroupSummary => ({
136
+ const gtm = (over: Partial<PluginSummary> = {}): PluginSummary => ({
134
137
  name: 'GTM',
135
- folders: ['Groups/GTM'],
138
+ folders: ['Plugins/GTM'],
136
139
  canRead: true,
137
140
  canWrite: false,
138
141
  isOwner: false,
@@ -155,17 +158,17 @@ function LocationProbe() {
155
158
  return <div aria-label="href">{location.pathname + location.search}</div>;
156
159
  }
157
160
 
158
- function renderGroup(name: string, children?: ReactNode) {
161
+ function renderPlugin(name: string, children?: ReactNode, admin: AdminContextValue = nonAdmin) {
159
162
  return render(
160
- <MemoryRouter initialEntries={[`/skills-and-tools/groups/${encodeURIComponent(name)}`]}>
161
- <AdminContext.Provider value={nonAdmin}>
163
+ <MemoryRouter initialEntries={[`/skills-and-tools/plugins/${encodeURIComponent(name)}`]}>
164
+ <AdminContext.Provider value={admin}>
162
165
  <WorkspaceContext.Provider value={workspace}>
163
166
  <LibraryToastProvider>
164
167
  <LibraryProvider>
165
168
  {withAuth(
166
169
  <>
167
170
  <Routes>
168
- <Route path="/skills-and-tools/groups/:group" element={<GroupPage />} />
171
+ <Route path="/skills-and-tools/plugins/:plugin" element={<PluginPage />} />
169
172
  <Route path="*" element={<div />} />
170
173
  </Routes>
171
174
  <LocationProbe />
@@ -182,53 +185,53 @@ function renderGroup(name: string, children?: ReactNode) {
182
185
 
183
186
  const href = () => screen.getByLabelText('href').textContent;
184
187
 
185
- describe('GroupPage', () => {
188
+ describe('PluginPage', () => {
186
189
  beforeEach(() => {
187
190
  dataMock.useLibraryData.mockReturnValue(CATALOG);
188
- groupsMock.listGroups.mockResolvedValue([gtm()]);
189
- groupsMock.listJoinRequests.mockResolvedValue([]);
190
- groupsMock.reconcileJoinRequest.mockResolvedValue(false);
191
- groupsMock.requestGroupAccess.mockResolvedValue(undefined);
191
+ pluginsMock.listPlugins.mockResolvedValue([gtm()]);
192
+ pluginsMock.listJoinRequests.mockResolvedValue([]);
193
+ pluginsMock.reconcileJoinRequest.mockResolvedValue(false);
194
+ pluginsMock.requestPluginAccess.mockResolvedValue(undefined);
192
195
  });
193
196
 
194
- it('lets a group MANAGER remove a skill, behind a confirm that says who loses it', async () => {
195
- groupsMock.listGroups.mockResolvedValue([gtm({ canWrite: true })]);
197
+ it('lets a plugin MANAGER remove a skill, behind a confirm that says who loses it', async () => {
198
+ pluginsMock.listPlugins.mockResolvedValue([gtm({ canWrite: true })]);
196
199
  libApiMock.removeLibraryItem.mockResolvedValue(undefined);
197
- renderGroup('GTM');
200
+ renderPlugin('GTM');
198
201
 
199
202
  fireEvent.click(await screen.findByRole('button', { name: 'Remove outreach' }));
200
203
  expect(await screen.findByText(/Everyone here loses it/)).toBeInTheDocument();
201
204
  fireEvent.click(screen.getByRole('button', { name: 'Remove' }));
202
205
 
203
206
  // The skill FOLDER, repo-relative — the recursive delete under it runs
204
- // per-file through the same ACL gate that governs editing the group.
207
+ // per-file through the same ACL gate that governs editing the plugin.
205
208
  await waitFor(() =>
206
- expect(libApiMock.removeLibraryItem).toHaveBeenCalledWith('Groups/GTM/outreach'),
209
+ expect(libApiMock.removeLibraryItem).toHaveBeenCalledWith('Plugins/GTM/outreach'),
207
210
  );
208
211
  expect(await screen.findByText(/Removed outreach from GTM/)).toBeInTheDocument();
209
212
  });
210
213
 
211
214
  it('offers no remove affordance to a non-manager', async () => {
212
- renderGroup('GTM'); // gtm() defaults to canWrite: false
215
+ renderPlugin('GTM'); // gtm() defaults to canWrite: false
213
216
  await screen.findByText('outreach');
214
217
  expect(screen.queryByRole('button', { name: 'Remove outreach' })).toBeNull();
215
218
  });
216
219
 
217
- it("shows only the group's own skills and tools", async () => {
218
- renderGroup('GTM');
220
+ it("shows only the plugin's own skills and tools", async () => {
221
+ renderPlugin('GTM');
219
222
  expect(await screen.findByRole('heading', { name: 'GTM', level: 1 })).toBeInTheDocument();
220
223
  expect(screen.getByTestId('library-card-skill-outreach')).toBeInTheDocument();
221
224
  expect(screen.getByTestId('library-card-integration-heyreach')).toBeInTheDocument();
222
- // Product's skill belongs to another group and never appears here.
225
+ // Product's skill belongs to another plugin and never appears here.
223
226
  expect(screen.queryByTestId('library-card-skill-roadmap')).not.toBeInTheDocument();
224
227
  expect(screen.getByRole('heading', { name: 'Skills' })).toBeInTheDocument();
225
228
  expect(screen.getByRole('heading', { name: 'Tools' })).toBeInTheDocument();
226
229
  });
227
230
 
228
- it('leads with the group, not with who runs it', async () => {
229
- renderGroup('GTM');
231
+ it('leads with the plugin, not with who runs it', async () => {
232
+ renderPlugin('GTM');
230
233
  expect(await screen.findByRole('heading', { name: 'GTM', level: 1 })).toBeInTheDocument();
231
- // The run-by/shared-with lede is gone: it restated, above every group, what
234
+ // The run-by/shared-with lede is gone: it restated, above every plugin, what
232
235
  // the Share panel says once and on demand.
233
236
  expect(screen.queryByText(/^Run by /)).not.toBeInTheDocument();
234
237
  expect(screen.queryByText(/shared with/)).not.toBeInTheDocument();
@@ -238,10 +241,10 @@ describe('GroupPage', () => {
238
241
  // skills or tools" (a dialog) and "Propose a skill or tool" (a whole other
239
242
  // page) — the same button, in the same spot, opening a different flow with
240
243
  // different words depending on who pressed it. Who reviews what is a property
241
- // of the group, not of the door.
244
+ // of the plugin, not of the door.
242
245
  it('opens the same add dialog for a writer', async () => {
243
- groupsMock.listGroups.mockResolvedValue([gtm({ canWrite: true })]);
244
- renderGroup('GTM');
246
+ pluginsMock.listPlugins.mockResolvedValue([gtm({ canWrite: true })]);
247
+ renderPlugin('GTM');
245
248
  fireEvent.click(await screen.findByRole('button', { name: 'Add a skill or tool to GTM' }));
246
249
  expect(
247
250
  await screen.findByRole('heading', { name: 'Add a skill or tool to GTM' }),
@@ -251,7 +254,7 @@ describe('GroupPage', () => {
251
254
  });
252
255
 
253
256
  it('opens the same add dialog for everyone else, and says review is coming', async () => {
254
- renderGroup('GTM');
257
+ renderPlugin('GTM');
255
258
  fireEvent.click(await screen.findByRole('button', { name: 'Add a skill or tool to GTM' }));
256
259
  expect(
257
260
  await screen.findByRole('heading', { name: 'Add a skill or tool to GTM' }),
@@ -261,7 +264,7 @@ describe('GroupPage', () => {
261
264
  });
262
265
 
263
266
  it('offers no separate propose door to anybody', async () => {
264
- renderGroup('GTM');
267
+ renderPlugin('GTM');
265
268
  await screen.findByRole('button', { name: 'Add a skill or tool to GTM' });
266
269
  expect(screen.queryByRole('button', { name: /Propose/i })).not.toBeInTheDocument();
267
270
  });
@@ -271,10 +274,10 @@ describe('GroupPage', () => {
271
274
  ...CATALOG,
272
275
  tools: [connectedTool(), unsetTool()],
273
276
  });
274
- renderGroup('GTM');
277
+ renderPlugin('GTM');
275
278
  expect(
276
279
  await screen.findByText(
277
- "1 integration needs setup: connect it to unblock this group's skills.",
280
+ "1 integration needs setup: connect it to unblock this plugin's skills.",
278
281
  ),
279
282
  ).toBeInTheDocument();
280
283
  fireEvent.click(screen.getByRole('button', { name: 'Finish setup' }));
@@ -284,140 +287,228 @@ describe('GroupPage', () => {
284
287
  it('pluralises the attention banner', async () => {
285
288
  dataMock.useLibraryData.mockReturnValue({
286
289
  ...CATALOG,
287
- tools: [unsetTool(), unsetTool({ slug: 'clay', name: 'clay', path: 'Groups/GTM/clay.tool' })],
290
+ tools: [unsetTool(), unsetTool({ slug: 'clay', name: 'clay', path: 'Plugins/GTM/clay.tool' })],
288
291
  });
289
- renderGroup('GTM');
292
+ renderPlugin('GTM');
290
293
  expect(
291
294
  await screen.findByText(
292
- "2 integrations need setup: connect them to unblock this group's skills.",
295
+ "2 integrations need setup: connect them to unblock this plugin's skills.",
293
296
  ),
294
297
  ).toBeInTheDocument();
295
298
  });
296
299
 
297
- it('renders both empty states for a group with nothing in it', async () => {
300
+ it('renders both empty states for a plugin with nothing in it', async () => {
298
301
  dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
299
- groupsMock.listGroups.mockResolvedValue([gtm({ skillCount: 0, toolCount: 0 })]);
300
- renderGroup('GTM');
302
+ pluginsMock.listPlugins.mockResolvedValue([gtm({ skillCount: 0, toolCount: 0 })]);
303
+ renderPlugin('GTM');
304
+ // A non-admin reads one plain sentence: the fact, and the agent as the
305
+ // door that IS theirs. No inline action, so nothing is split around it.
301
306
  expect(
302
- await screen.findByText('No skills yet. Add one, or ask your agent to write one for GTM.'),
307
+ await screen.findByText('No skills yet. Ask your agent to write one for GTM.'),
303
308
  ).toBeInTheDocument();
304
309
  expect(screen.getByText('No tools yet.')).toBeInTheDocument();
305
310
  });
306
311
 
307
- it('keeps Share on an EMPTY group. The folder is what carries access, not the items', async () => {
308
- // Groups used to be derived from their items, which meant a group with
312
+ it('keeps the empty band a dead end for a non-admin — no doorway, no arrow', async () => {
313
+ dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
314
+ pluginsMock.listPlugins.mockResolvedValue([gtm({ skillCount: 0, toolCount: 0 })]);
315
+ renderPlugin('GTM');
316
+ await screen.findByText(/No skills yet/);
317
+ expect(screen.queryByRole('button', { name: 'Add the first skill' })).not.toBeInTheDocument();
318
+ expect(screen.queryByTestId('chalk-arrow')).not.toBeInTheDocument();
319
+ });
320
+
321
+ it('keeps the doorway but not the dialog-less click when the plugins endpoint failed', async () => {
322
+ // The add dialog mounts only with a summary and its primary folder. When
323
+ // the endpoint failed there is neither, so an admin's "Add the first
324
+ // skill" would be a button that does nothing — the band must fall back to
325
+ // the sentence whose one door (the agent) still works.
326
+ dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
327
+ pluginsMock.listPlugins.mockRejectedValue(new Error('boom'));
328
+ renderPlugin('GTM', undefined, asAdmin);
329
+ expect(
330
+ await screen.findByText('No skills yet. Ask your agent to write one for GTM.'),
331
+ ).toBeInTheDocument();
332
+ expect(screen.queryByRole('button', { name: 'Add the first skill' })).not.toBeInTheDocument();
333
+ // The title row's `+` is under the same prerequisite: both ways to add
334
+ // must agree that adding is impossible here.
335
+ expect(
336
+ screen.queryByRole('button', { name: 'Add a skill or tool to GTM' }),
337
+ ).not.toBeInTheDocument();
338
+ });
339
+
340
+ it('makes the empty Skills band a doorway for an admin: its link opens the same add dialog as `+`', async () => {
341
+ dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
342
+ pluginsMock.listPlugins.mockResolvedValue([gtm({ skillCount: 0, toolCount: 0 })]);
343
+ renderPlugin('GTM', undefined, asAdmin);
344
+ // The sentence is split around its inline action, so it is asserted in its
345
+ // parts: the fact, the doorway, and the agent as the other door.
346
+ expect(await screen.findByText(/No skills yet/)).toBeInTheDocument();
347
+ expect(screen.getByText(/or ask your agent to write one for GTM/)).toBeInTheDocument();
348
+ fireEvent.click(screen.getByRole('button', { name: 'Add the first skill' }));
349
+ expect(
350
+ await screen.findByRole('heading', { name: 'Add a skill or tool to GTM' }),
351
+ ).toBeInTheDocument();
352
+ });
353
+
354
+ it('drops the nudge once a skill exists — the arrow belongs to the empty band only', async () => {
355
+ renderPlugin('GTM', undefined, asAdmin); // CATALOG carries outreach in GTM
356
+ await screen.findByRole('button', { name: /^outreach/ });
357
+ expect(screen.queryByRole('button', { name: 'Add the first skill' })).not.toBeInTheDocument();
358
+ });
359
+
360
+ it('keeps Share on an EMPTY plugin. The folder is what carries access, not the items', async () => {
361
+ // Plugins used to be derived from their items, which meant a plugin with
309
362
  // nothing in it had no folder to manage and silently lost its access
310
363
  // surface. `folders` now comes from the backend's readdir, so an empty
311
- // group is still a place whose sharing can be changed.
364
+ // plugin is still a place whose sharing can be changed.
312
365
  dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
313
- groupsMock.listGroups.mockResolvedValue([gtm({ skillCount: 0, toolCount: 0 })]);
314
- renderGroup('GTM');
366
+ pluginsMock.listPlugins.mockResolvedValue([gtm({ skillCount: 0, toolCount: 0 })]);
367
+ renderPlugin('GTM');
315
368
 
316
369
  fireEvent.click(await screen.findByRole('button', { name: 'Share' }));
317
370
  expect(
318
371
  await screen.findByRole('dialog', {
319
- name: 'Manage access directory knowledge-base/Groups/GTM',
372
+ name: 'Manage access directory knowledge-base/Plugins/GTM',
320
373
  }),
321
374
  ).toBeInTheDocument();
322
375
  });
323
376
 
324
- it('Share IS the manage-access dialog, opened on this group\'s directory', async () => {
325
- renderGroup('GTM');
377
+ it('Share IS the manage-access dialog, opened on this plugin\'s directory', async () => {
378
+ renderPlugin('GTM');
326
379
  expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
327
380
 
328
381
  fireEvent.click(await screen.findByRole('button', { name: 'Share' }));
329
382
  // One dialog for every access path — no intermediate read-only panel.
330
- // The entry is the group DIRECTORY under the KB dir, so the rules land on
383
+ // The entry is the plugin DIRECTORY under the KB dir, so the rules land on
331
384
  // the folder, never on one file inside it.
332
385
  expect(
333
386
  await screen.findByRole('dialog', {
334
- name: 'Manage access directory knowledge-base/Groups/GTM',
387
+ name: 'Manage access directory knowledge-base/Plugins/GTM',
335
388
  }),
336
389
  ).toBeInTheDocument();
337
390
  });
338
391
 
339
- it('an UNDISCOVERABLE group renders exactly like one that does not exist', async () => {
340
- // Fail-closed: the endpoint omits groups with no verdict at all, so the
392
+ it('an UNDISCOVERABLE plugin renders exactly like one that does not exist', async () => {
393
+ // Fail-closed: the endpoint omits plugins with no verdict at all, so the
341
394
  // page cannot tell "hidden from you" apart from "absent" — the point.
342
395
  dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
343
- groupsMock.listGroups.mockResolvedValue([]);
344
- renderGroup('Finance');
345
- expect(await screen.findByText("This group doesn't exist yet.")).toBeInTheDocument();
396
+ pluginsMock.listPlugins.mockResolvedValue([]);
397
+ renderPlugin('Finance');
398
+ expect(await screen.findByText("This plugin doesn't exist yet.")).toBeInTheDocument();
346
399
  });
347
400
 
348
- it('a DISCOVERABLE group the caller cannot read shows the locked view', async () => {
401
+ it('a DISCOVERABLE plugin the caller cannot read shows the locked view', async () => {
349
402
  dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
350
- groupsMock.listGroups.mockResolvedValue([
351
- gtm({ name: 'Finance', folders: ['Groups/Finance'], canRead: false }),
403
+ pluginsMock.listPlugins.mockResolvedValue([
404
+ gtm({ name: 'Finance', folders: ['Plugins/Finance'], canRead: false }),
352
405
  ]);
353
- renderGroup('Finance');
406
+ renderPlugin('Finance');
354
407
  expect(
355
408
  await screen.findByRole('button', { name: 'Subscribe to its skills and tools' }),
356
409
  ).toBeInTheDocument();
357
410
  expect(screen.queryByRole('heading', { name: 'Skills' })).not.toBeInTheDocument();
358
- // A locked group offers no way in at all — not an add door, not a propose one.
411
+ // A locked plugin offers no way in at all — not an add door, not a propose one.
359
412
  expect(screen.queryByRole('button', { name: /Add a skill or tool/ })).not.toBeInTheDocument();
360
413
  });
361
414
 
362
415
  it('a locked-out admin (canWrite via admin-rescue) gets the locked view with Manage access', async () => {
363
416
  dataMock.useLibraryData.mockReturnValue({ ...CATALOG, skills: [], tools: [] });
364
- groupsMock.listGroups.mockResolvedValue([
365
- gtm({ name: 'Finance', folders: ['Groups/Finance'], canRead: false, canWrite: true }),
417
+ pluginsMock.listPlugins.mockResolvedValue([
418
+ gtm({ name: 'Finance', folders: ['Plugins/Finance'], canRead: false, canWrite: true }),
366
419
  ]);
367
- renderGroup('Finance');
420
+ renderPlugin('Finance');
368
421
  expect(await screen.findByRole('button', { name: 'Manage access' })).toBeInTheDocument();
369
422
  });
370
423
 
371
424
  it('keeps the member view when an item-level grant beats the folder verdict', async () => {
372
425
  // Closeness-first resolution hands this caller one skill inside a folder
373
- // they cannot read; the group itself is absent from the (fail-closed)
426
+ // they cannot read; the plugin itself is absent from the (fail-closed)
374
427
  // summaries. The platform already returned the item; the page shows it.
375
428
  dataMock.useLibraryData.mockReturnValue({
376
429
  ...CATALOG,
377
- skills: [{ name: 'budget', description: '', path: 'Groups/Finance/budget' }],
430
+ skills: [{ name: 'budget', description: '', path: 'Plugins/Finance/budget' }],
378
431
  tools: [],
379
432
  });
380
- groupsMock.listGroups.mockResolvedValue([]);
381
- renderGroup('Finance');
433
+ pluginsMock.listPlugins.mockResolvedValue([]);
434
+ renderPlugin('Finance');
382
435
  expect(await screen.findByTestId('library-card-skill-budget')).toBeInTheDocument();
383
436
  });
384
437
 
385
- it('says so when the group does not exist', async () => {
386
- renderGroup('Nope');
387
- expect(await screen.findByText("This group doesn't exist yet.")).toBeInTheDocument();
388
- expect(screen.getByRole('link', { name: 'All groups' })).toHaveAttribute(
438
+ it('says so when the plugin does not exist', async () => {
439
+ renderPlugin('Nope');
440
+ expect(await screen.findByText("This plugin doesn't exist yet.")).toBeInTheDocument();
441
+ expect(screen.getByRole('link', { name: 'All plugins' })).toHaveAttribute(
389
442
  'href',
390
443
  '/skills-and-tools',
391
444
  );
392
445
  });
393
446
 
394
- it('degrades to the catalog when the groups endpoint fails', async () => {
395
- groupsMock.listGroups.mockRejectedValue(new Error("Couldn't load groups."));
396
- renderGroup('GTM');
447
+ it('degrades to the catalog when the plugins endpoint fails', async () => {
448
+ pluginsMock.listPlugins.mockRejectedValue(new Error("Couldn't load plugins."));
449
+ renderPlugin('GTM');
397
450
  expect(await screen.findByTestId('library-card-skill-outreach')).toBeInTheDocument();
398
- // No verified principals, so no claim about them. The add door still opens
399
- // — it writes nothing, so there is no permission to be wrong about.
451
+ // No verified principals, so no claim about them.
400
452
  expect(screen.queryByText(/^Run by/)).not.toBeInTheDocument();
401
- expect(screen.getByRole('button', { name: 'Add a skill or tool to GTM' })).toBeInTheDocument();
453
+ // The add door is GONE. It used to be asserted present-and-enabled, on
454
+ // the reasoning that adding writes nothing a permission could be wrong
455
+ // about — but permission was never what stops it here: `AddToPluginDialog`
456
+ // needs `summary && primaryFolder` to mount, and the failed endpoint left
457
+ // neither, so the button opened nothing at all. Omitted, like `Share`
458
+ // is when there is no folder to manage.
459
+ expect(
460
+ screen.queryByRole('button', { name: 'Add a skill or tool to GTM' }),
461
+ ).not.toBeInTheDocument();
462
+ });
463
+
464
+ it('brings the add door back once plugin discovery lands', async () => {
465
+ // The page renders as soon as the CATALOG has items, so the summary can be
466
+ // missing simply because plugins are still on their way. The button is
467
+ // absent for that moment and appears when there is something behind it —
468
+ // an affordance arriving, never one that was there and stopped working.
469
+ let settle!: (plugins: PluginSummary[]) => void;
470
+ pluginsMock.listPlugins.mockReturnValue(new Promise((resolve) => (settle = resolve)));
471
+ renderPlugin('GTM');
472
+ await screen.findByTestId('library-card-skill-outreach');
473
+ expect(
474
+ screen.queryByRole('button', { name: 'Add a skill or tool to GTM' }),
475
+ ).not.toBeInTheDocument();
476
+
477
+ settle([gtm()]);
478
+ expect(
479
+ await screen.findByRole('button', { name: 'Add a skill or tool to GTM' }),
480
+ ).toBeInTheDocument();
481
+ });
482
+
483
+ it('offers no add door to a caller who only reached the plugin through an item grant', async () => {
484
+ // A per-file grant puts one skill from GTM in this caller's catalog while
485
+ // no summary vouches for the plugin. Discovery worked — they simply have
486
+ // no folder of their own to add into, so there is no door to offer.
487
+ pluginsMock.listPlugins.mockResolvedValue([]);
488
+ renderPlugin('GTM');
489
+ await screen.findByTestId('library-card-skill-outreach');
490
+ expect(
491
+ screen.queryByRole('button', { name: 'Add a skill or tool to GTM' }),
492
+ ).not.toBeInTheDocument();
402
493
  });
403
494
 
404
- it('does not claim a missing group is gone while the endpoint is still failing', async () => {
405
- groupsMock.listGroups.mockRejectedValue(new Error("Couldn't load groups."));
406
- renderGroup('Finance');
495
+ it('does not claim a missing plugin is gone while the endpoint is still failing', async () => {
496
+ pluginsMock.listPlugins.mockRejectedValue(new Error("Couldn't load plugins."));
497
+ renderPlugin('Finance');
407
498
  await waitFor(() =>
408
499
  expect(screen.queryByText('Loading the library…')).not.toBeInTheDocument(),
409
500
  );
410
- expect(screen.queryByText("This group doesn't exist yet.")).not.toBeInTheDocument();
501
+ expect(screen.queryByText("This plugin doesn't exist yet.")).not.toBeInTheDocument();
411
502
  expect(screen.getByRole('heading', { name: 'Finance', level: 1 })).toBeInTheDocument();
412
503
  });
413
504
 
414
- it('decodes a URL-hostile group name', async () => {
505
+ it('decodes a URL-hostile plugin name', async () => {
415
506
  dataMock.useLibraryData.mockReturnValue({
416
507
  ...CATALOG,
417
- skills: [{ name: 'pricing', description: '', path: 'Groups/Sales & Ops/pricing' }],
508
+ skills: [{ name: 'pricing', description: '', path: 'Plugins/Sales & Ops/pricing' }],
418
509
  tools: [],
419
510
  });
420
- renderGroup('Sales & Ops');
511
+ renderPlugin('Sales & Ops');
421
512
  expect(
422
513
  await screen.findByRole('heading', { name: 'Sales & Ops', level: 1 }),
423
514
  ).toBeInTheDocument();
@@ -426,9 +517,9 @@ describe('GroupPage', () => {
426
517
 
427
518
  it('waits rather than guessing while the catalog is still loading', () => {
428
519
  dataMock.useLibraryData.mockReturnValue({ ...CATALOG, loading: true, skills: [], tools: [] });
429
- renderGroup('GTM');
520
+ renderPlugin('GTM');
430
521
  expect(screen.getByText('Loading the library…')).toBeInTheDocument();
431
- expect(screen.queryByText("This group doesn't exist yet.")).not.toBeInTheDocument();
522
+ expect(screen.queryByText("This plugin doesn't exist yet.")).not.toBeInTheDocument();
432
523
  });
433
524
 
434
525
  /**
@@ -444,12 +535,12 @@ describe('GroupPage', () => {
444
535
  const spinning = () => refreshButton().querySelector('.animate-spin') !== null;
445
536
 
446
537
  it('claims freshness only once the refetch has actually landed', async () => {
447
- renderGroup('GTM');
538
+ renderPlugin('GTM');
448
539
  await screen.findByRole('heading', { name: 'GTM', level: 1 });
449
540
 
450
- let land!: (groups: GroupSummary[]) => void;
451
- groupsMock.listGroups.mockReturnValueOnce(
452
- new Promise<GroupSummary[]>((resolve) => {
541
+ let land!: (plugins: PluginSummary[]) => void;
542
+ pluginsMock.listPlugins.mockReturnValueOnce(
543
+ new Promise<PluginSummary[]>((resolve) => {
453
544
  land = resolve;
454
545
  }),
455
546
  );
@@ -466,10 +557,10 @@ describe('GroupPage', () => {
466
557
  });
467
558
 
468
559
  it('does not report success when the refetch fails', async () => {
469
- renderGroup('GTM');
560
+ renderPlugin('GTM');
470
561
  await screen.findByRole('heading', { name: 'GTM', level: 1 });
471
562
 
472
- groupsMock.listGroups.mockRejectedValueOnce(new Error("Couldn't load groups."));
563
+ pluginsMock.listPlugins.mockRejectedValueOnce(new Error("Couldn't load plugins."));
473
564
  fireEvent.click(refreshButton());
474
565
 
475
566
  await waitFor(() => expect(spinning()).toBe(false));