@bevel-software/platform-core-frontend 0.7.4 → 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bevel-software/platform-core-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Open-source core UI of the Bevel platform (raw TS/TSX source): workspace explorer/viewer, branches & change requests, Library, secrets, tools, access control.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
31
|
"lucide-react": "^1.7.0",
|
|
32
32
|
"mammoth": "^1.12.0",
|
|
33
|
-
"mermaid": "^11.
|
|
33
|
+
"mermaid": "^11.16.1",
|
|
34
34
|
"react-markdown": "^10.1.0",
|
|
35
35
|
"react-resizable-panels": "^4.10.0",
|
|
36
36
|
"rehype-raw": "^7.0.0",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"remark-frontmatter": "^5.0.0",
|
|
40
40
|
"remark-gfm": "^4.0.1",
|
|
41
41
|
"tailwind-merge": "^3.5.0",
|
|
42
|
-
"xlsx": "
|
|
42
|
+
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
43
43
|
"yaml": "^2.9.0",
|
|
44
|
-
"@bevel-software/platform-shared": "0.
|
|
44
|
+
"@bevel-software/platform-shared": "0.8.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react-router-dom": "^7.1.1",
|
|
56
56
|
"tailwindcss": "^4.2.2",
|
|
57
57
|
"typescript": "~5.9.3",
|
|
58
|
-
"vitest": "^2.
|
|
58
|
+
"vitest": "^3.2.6"
|
|
59
59
|
},
|
|
60
60
|
"license": "Apache-2.0",
|
|
61
61
|
"repository": {
|
|
@@ -179,7 +179,7 @@ const CORE_BANNERS: BannerDef[] = [
|
|
|
179
179
|
// other apps render their own full surface (see CORE_APPS).
|
|
180
180
|
const CORE_PANES: PaneDef[] = [
|
|
181
181
|
// The file tree is the SIDEBAR, not a panel — the same frame, at the same
|
|
182
|
-
// width, that Skills & Tools puts its
|
|
182
|
+
// width, that Skills & Tools puts its plugin list in. It left the resizable
|
|
183
183
|
// group when the two navs were unified; `SidebarFrame` owns its width and
|
|
184
184
|
// the shared store owns whether it is showing.
|
|
185
185
|
{ id: 'explorer', order: 10, node: <FileExplorer />, sidebar: true, collapsible: true },
|
|
@@ -189,7 +189,7 @@ const CORE_PANES: PaneDef[] = [
|
|
|
189
189
|
/**
|
|
190
190
|
* The core apps behind the toolbar's app switcher. Each app is a full
|
|
191
191
|
* surface below the always-mounted toolbar. "Skills & Tools" mounts
|
|
192
|
-
* `LibraryRoutes`, which owns its own nested route table (gallery,
|
|
192
|
+
* `LibraryRoutes`, which owns its own nested route table (gallery, plugins,
|
|
193
193
|
* items) below this path. Knowledge's path IS `KB_ROUTE_PREFIX` ('/workspace') — the KB file
|
|
194
194
|
* links `kbFileUrl()` produces are absolute `/workspace/<branch>/<path>`
|
|
195
195
|
* URLs, so they land inside the Knowledge surface by construction.
|
|
@@ -224,7 +224,7 @@ const CORE_APPS: AppDef[] = [
|
|
|
224
224
|
*
|
|
225
225
|
* Which surface renders is decided by URL SHAPE (`isLibraryLocation`): the KB
|
|
226
226
|
* repo's two roots ARE the two apps — `KnowledgeBase/` paths get the pane
|
|
227
|
-
* workspace, default-branch `
|
|
227
|
+
* workspace, default-branch `Plugins/` paths get the library. The catalog is
|
|
228
228
|
* never consulted for the surface, so a just-created skill routes correctly
|
|
229
229
|
* before any reload. Router state `rawFile` steps past the shape rule to the
|
|
230
230
|
* raw file view (the tool page's "Edit the tool file"); it is state, not URL,
|
|
@@ -318,7 +318,7 @@ export function AppChrome() {
|
|
|
318
318
|
const activeId = claimedApp ?? activeAppId(apps, location.pathname);
|
|
319
319
|
|
|
320
320
|
// A narrow sidebar can be opened from the toolbar, but it must not cover
|
|
321
|
-
// the destination after the user chooses a
|
|
321
|
+
// the destination after the user chooses a plugin or file inside it.
|
|
322
322
|
useEffect(() => {
|
|
323
323
|
if (narrow) setSidebarCollapsed(true);
|
|
324
324
|
}, [location.pathname, narrow]);
|
|
@@ -91,7 +91,7 @@ describe('ShellRoutes', () => {
|
|
|
91
91
|
|
|
92
92
|
it('keeps a tool deep link inside the Skills & Tools surface', () => {
|
|
93
93
|
// The app owns everything under `/skills-and-tools/*`, so its nested
|
|
94
|
-
// routes (the tool page, the
|
|
94
|
+
// routes (the tool page, the plugin pages) must not fall into the shell's
|
|
95
95
|
// catch-all on a cold load or a refresh.
|
|
96
96
|
renderAt('/skills-and-tools/tools/heyreach');
|
|
97
97
|
expect(screen.getByTestId('pathname')).toHaveTextContent(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
2
|
import { configureBranchModel, DEFAULT_BRANCH } from '@bevel-software/platform-shared';
|
|
3
3
|
import { loadServerConfig } from '../bootstrap';
|
|
4
|
+
import { mcpEndpointUrl } from '../../shared/mcp';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The bootstrap runs before React does, and it is the ONLY thing between a
|
|
@@ -27,8 +28,8 @@ afterEach(() => {
|
|
|
27
28
|
configureBranchModel(CONFIGURED);
|
|
28
29
|
});
|
|
29
30
|
|
|
30
|
-
const respond = (branchModel: unknown) =>
|
|
31
|
-
fetchMock.mockResolvedValue({ ok: true, json: async () => ({ branchModel }) });
|
|
31
|
+
const respond = (branchModel: unknown, rest: Record<string, unknown> = {}) =>
|
|
32
|
+
fetchMock.mockResolvedValue({ ok: true, json: async () => ({ branchModel, ...rest }) });
|
|
32
33
|
|
|
33
34
|
describe('loadServerConfig', () => {
|
|
34
35
|
it('applies a configured model', async () => {
|
|
@@ -60,4 +61,48 @@ describe('loadServerConfig', () => {
|
|
|
60
61
|
fetchMock.mockResolvedValue({ ok: false, status: 502 });
|
|
61
62
|
await expect(loadServerConfig()).rejects.toThrow(/Could not load configuration/);
|
|
62
63
|
});
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The MCP endpoint travels on the same payload, for the same reason the
|
|
67
|
+
* branch model does: it is a property of the deployment, and the frontend
|
|
68
|
+
* cannot work it out for itself. `window.location.origin` is the browser's
|
|
69
|
+
* idea of our address; behind a proxy or on a second domain it is not the
|
|
70
|
+
* one the OAuth metadata publishes, and that is the one that decides
|
|
71
|
+
* whether a connector works.
|
|
72
|
+
*/
|
|
73
|
+
describe('the MCP endpoint', () => {
|
|
74
|
+
it('applies what the server said', async () => {
|
|
75
|
+
respond(CONFIGURED, { mcpUrl: 'https://kb.acme.com/api/mcp' });
|
|
76
|
+
await loadServerConfig();
|
|
77
|
+
expect(mcpEndpointUrl()).toBe('https://kb.acme.com/api/mcp');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A cached bundle can outlive the server it came from. A backend that
|
|
82
|
+
* predates the field must still let the app boot — the connect snippets
|
|
83
|
+
* fall back to the origin, which is what they did before it existed.
|
|
84
|
+
*/
|
|
85
|
+
it('falls back to the origin when the server does not send one', async () => {
|
|
86
|
+
respond(CONFIGURED);
|
|
87
|
+
await expect(loadServerConfig()).resolves.toBeUndefined();
|
|
88
|
+
expect(mcpEndpointUrl()).toBe(`${window.location.origin}/api/mcp`);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('falls back rather than trusting a value it cannot parse', async () => {
|
|
92
|
+
respond(CONFIGURED, { mcpUrl: 'not a url' });
|
|
93
|
+
await expect(loadServerConfig()).resolves.toBeUndefined();
|
|
94
|
+
expect(mcpEndpointUrl()).toBe(`${window.location.origin}/api/mcp`);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Deliberately NOT gated on the branch model being valid. A deployment
|
|
99
|
+
* nobody has set up yet still has a real address, and the setup screen is
|
|
100
|
+
* exactly where someone might want to see it.
|
|
101
|
+
*/
|
|
102
|
+
it('applies even on a deployment that has not been set up yet', async () => {
|
|
103
|
+
respond({ defaultBranch: '', protectedBranches: [] }, { mcpUrl: 'https://kb.acme.com/api/mcp' });
|
|
104
|
+
await loadServerConfig();
|
|
105
|
+
expect(mcpEndpointUrl()).toBe('https://kb.acme.com/api/mcp');
|
|
106
|
+
});
|
|
107
|
+
});
|
|
63
108
|
});
|
package/src/core/bootstrap.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { configureBranchModel, validateBranchModel } from '@bevel-software/platform-shared';
|
|
2
|
+
// The pure module, NOT the `shared/mcp` barrel — the same reason `test-setup.ts`
|
|
3
|
+
// avoids it. This runs BEFORE React renders, and the barrel would drag the
|
|
4
|
+
// components and their icon imports into the boot path to set one string.
|
|
5
|
+
import { configureMcpUrl } from '../shared/mcp/connect-snippets';
|
|
2
6
|
|
|
3
7
|
/** What `GET /api/config` serves. Unauthenticated — see the route's comment. */
|
|
4
8
|
interface ServerConfig {
|
|
5
9
|
branchModel: { defaultBranch: string; protectedBranches: string[] };
|
|
10
|
+
/**
|
|
11
|
+
* Optional because a browser can outlive the server it loaded from — a
|
|
12
|
+
* cached bundle talking to a backend that predates this field must still
|
|
13
|
+
* boot. `configureMcpUrl` falls back to the origin when it is absent, which
|
|
14
|
+
* is what every connect surface did before this existed.
|
|
15
|
+
*/
|
|
16
|
+
mcpUrl?: string;
|
|
6
17
|
}
|
|
7
18
|
|
|
8
19
|
/**
|
|
@@ -41,6 +52,15 @@ export async function loadServerConfig(): Promise<void> {
|
|
|
41
52
|
*/
|
|
42
53
|
const problem = validateBranchModel(config.branchModel);
|
|
43
54
|
if (!problem) configureBranchModel(config.branchModel);
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Unconditional, and deliberately not guarded by the branch-model check
|
|
58
|
+
* above: an unconfigured deployment still has a real address, and the
|
|
59
|
+
* connect surfaces are among the few things worth showing on one. Absent or
|
|
60
|
+
* unparseable input is not an error here either — it falls back to the
|
|
61
|
+
* origin rather than taking down the boot for a snippet.
|
|
62
|
+
*/
|
|
63
|
+
configureMcpUrl(config.mcpUrl);
|
|
44
64
|
}
|
|
45
65
|
|
|
46
66
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ambient declaration for side-effect CSS imports (`import '../library.css'`).
|
|
3
|
-
* The enterprise app gets this from Vite's `vite/client` types; this package
|
|
4
|
-
* is published as raw source and typechecked without Vite, so it declares the
|
|
5
|
-
* module shape itself (harmless alongside vite/client in consumers).
|
|
6
|
-
*/
|
|
7
|
-
declare module '*.css';
|
|
1
|
+
/**
|
|
2
|
+
* Ambient declaration for side-effect CSS imports (`import '../library.css'`).
|
|
3
|
+
* The enterprise app gets this from Vite's `vite/client` types; this package
|
|
4
|
+
* is published as raw source and typechecked without Vite, so it declares the
|
|
5
|
+
* module shape itself (harmless alongside vite/client in consumers).
|
|
6
|
+
*/
|
|
7
|
+
declare module '*.css';
|
|
@@ -124,7 +124,7 @@ let offsetHeightDescriptor: PropertyDescriptor | undefined;
|
|
|
124
124
|
beforeEach(() => {
|
|
125
125
|
vi.clearAllMocks();
|
|
126
126
|
api.fetchFileAccess.mockResolvedValue(VIEW);
|
|
127
|
-
api.suggestPrincipals.mockResolvedValue({
|
|
127
|
+
api.suggestPrincipals.mockResolvedValue({ plugins: [], people: [], peopleWithheld: false });
|
|
128
128
|
|
|
129
129
|
rects.clear();
|
|
130
130
|
watchers = [];
|
|
@@ -46,7 +46,7 @@ async function openAndUncheckEdit(user: ReturnType<typeof userEvent.setup>) {
|
|
|
46
46
|
describe('ManageAccessDialog: unchecking an inherited verb on a mixed row', () => {
|
|
47
47
|
beforeEach(() => {
|
|
48
48
|
vi.clearAllMocks();
|
|
49
|
-
api.suggestPrincipals.mockResolvedValue({
|
|
49
|
+
api.suggestPrincipals.mockResolvedValue({ plugins: [], people: [], peopleWithheld: false });
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
it('write PURELY inherited (download direct): uncheck "Can edit" → 409 → opens prompt on FIRST click, revokes only write', async () => {
|
|
@@ -135,7 +135,7 @@ describe('ManageAccessDialog: unchecking an inherited verb on a mixed row', () =
|
|
|
135
135
|
* The file explorer edits the branch the user is looking at, so the ambient
|
|
136
136
|
* workspace is the right default and stays the default. The Library is the
|
|
137
137
|
* other case entirely: it describes the default branch no matter which branch
|
|
138
|
-
* happens to be open, so a
|
|
138
|
+
* happens to be open, so a plugin's access edit has to be pinned. Without the
|
|
139
139
|
* pin the same click would splice `access.md` on a draft — a rule that looks
|
|
140
140
|
* written and governs nothing.
|
|
141
141
|
*/
|
|
@@ -166,7 +166,7 @@ describe('ManageAccessDialog: which workspace the edit targets', () => {
|
|
|
166
166
|
|
|
167
167
|
beforeEach(() => {
|
|
168
168
|
vi.clearAllMocks();
|
|
169
|
-
api.suggestPrincipals.mockResolvedValue({
|
|
169
|
+
api.suggestPrincipals.mockResolvedValue({ plugins: [], people: [], peopleWithheld: false });
|
|
170
170
|
api.fetchFileAccess.mockResolvedValue(VIEW);
|
|
171
171
|
api.grantAccess.mockResolvedValue(VIEW);
|
|
172
172
|
});
|
|
@@ -215,7 +215,7 @@ describe('ManageAccessDialog: which workspace the edit targets', () => {
|
|
|
215
215
|
describe('ManageAccessDialog: naming the rules', () => {
|
|
216
216
|
beforeEach(() => {
|
|
217
217
|
vi.clearAllMocks();
|
|
218
|
-
api.suggestPrincipals.mockResolvedValue({ users: [],
|
|
218
|
+
api.suggestPrincipals.mockResolvedValue({ users: [], plugins: [], peopleWithheld: false });
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
/** The real AccessResponse shape — see the passing fixture above. */
|
|
@@ -240,7 +240,7 @@ describe('ManageAccessDialog: naming the rules', () => {
|
|
|
240
240
|
expect(screen.queryByRole('heading', { name: /People with access/i })).not.toBeInTheDocument();
|
|
241
241
|
});
|
|
242
242
|
|
|
243
|
-
it('gives each granting folder its own
|
|
243
|
+
it('gives each granting folder its own plugin, named after the folder', async () => {
|
|
244
244
|
api.fetchFileAccess.mockResolvedValue(
|
|
245
245
|
view({
|
|
246
246
|
readers: { restricted: true, roles: [], users: [A, { name: 'Bo', email: 'bo@x.com' }] },
|
|
@@ -15,7 +15,7 @@ export interface AccessReaders extends AccessEligible {
|
|
|
15
15
|
* ONE place a principal is named for a verb (mirrors the backend `GrantSource`).
|
|
16
16
|
* Both kinds are file-backed and removable from the dialog: `direct` → remove
|
|
17
17
|
* here; `ancestor` → remove-from-parent or deny-here. A principal who only
|
|
18
|
-
* resolves via a
|
|
18
|
+
* resolves via a plugin / `everyone` / admin-rescue produces no source.
|
|
19
19
|
*/
|
|
20
20
|
export type GrantSource =
|
|
21
21
|
| { kind: 'direct' }
|
|
@@ -85,7 +85,7 @@ export function asInheritedError(err: unknown): InheritedRevokeError | null {
|
|
|
85
85
|
return null;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
/** A grantable principal — a person (by email) or a
|
|
88
|
+
/** A grantable principal — a person (by email) or a plugin (a roles.yaml role). */
|
|
89
89
|
export type Principal =
|
|
90
90
|
| { kind: 'user'; email: string; displayName: string }
|
|
91
91
|
| { kind: 'role'; role: string };
|
|
@@ -94,14 +94,14 @@ export type Principal =
|
|
|
94
94
|
export type GrantVerb = 'read' | 'write' | 'owner' | 'download';
|
|
95
95
|
|
|
96
96
|
export interface SuggestResponse {
|
|
97
|
-
|
|
97
|
+
plugins: string[];
|
|
98
98
|
people: { name: string; email: string }[];
|
|
99
|
-
/** True when the query was too short to return people (
|
|
99
|
+
/** True when the query was too short to return people (plugins still shown). */
|
|
100
100
|
peopleWithheld: boolean;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
* Autocomplete the share dialog: matching
|
|
104
|
+
* Autocomplete the share dialog: matching plugins (roles) + people. People are
|
|
105
105
|
* withheld until the query is ≥ 2 chars (server-side harvesting guard).
|
|
106
106
|
*/
|
|
107
107
|
export async function suggestPrincipals(
|
|
@@ -42,7 +42,7 @@ interface Props {
|
|
|
42
42
|
* it edits the branch the user is looking at.
|
|
43
43
|
*
|
|
44
44
|
* The Library is the other case: its surfaces describe the DEFAULT branch
|
|
45
|
-
* regardless of which branch happens to be open, so a
|
|
45
|
+
* regardless of which branch happens to be open, so a plugin's access edit
|
|
46
46
|
* has to be pinned to it. Without this the same click would splice
|
|
47
47
|
* `access.md` on whatever branch the context last had open — a rule written
|
|
48
48
|
* into a draft nobody merges, silently doing nothing.
|
|
@@ -214,7 +214,7 @@ const ROLE_TO_KEY: Record<Role, keyof VerbSet> = {
|
|
|
214
214
|
'Can download': 'download',
|
|
215
215
|
};
|
|
216
216
|
|
|
217
|
-
/** The built-in `everyone`
|
|
217
|
+
/** The built-in `everyone` plugin — grantable as public READ only (see backend). */
|
|
218
218
|
function isEveryoneRole(p: Principal): boolean {
|
|
219
219
|
return p.kind === 'role' && p.role.trim().toLowerCase() === 'everyone';
|
|
220
220
|
}
|
|
@@ -362,7 +362,7 @@ function AnchoredMenu({
|
|
|
362
362
|
/**
|
|
363
363
|
* Google-Drive-style "Manage access" sheet. Reads the resolved access for a KB
|
|
364
364
|
* path and lets anyone who can write the path's access config share it: add one
|
|
365
|
-
* or more people/
|
|
365
|
+
* or more people/plugins as chips and grant them a shared verb (Owner / Can edit /
|
|
366
366
|
* Can read / Can download). Each existing grantee's verbs are editable inline via
|
|
367
367
|
* a multi-select checklist (independent verbs); toggling a box grants or revokes
|
|
368
368
|
* that single verb. Grants/revokes write the folder's `access.md` (folder target)
|
|
@@ -569,7 +569,7 @@ export function ManageAccessDialog({
|
|
|
569
569
|
);
|
|
570
570
|
|
|
571
571
|
/**
|
|
572
|
-
* The inherited rows, ONE
|
|
572
|
+
* The inherited rows, ONE PLUGIN PER GRANTING FOLDER — the prototype's shape
|
|
573
573
|
* (proto:3637-3649) and, more to the point, its reasoning:
|
|
574
574
|
*
|
|
575
575
|
* "Inheritance, said as a sentence instead of labelled as a concept.
|
|
@@ -614,9 +614,10 @@ export function ManageAccessDialog({
|
|
|
614
614
|
return { folders, external };
|
|
615
615
|
}, [inheritedRows]);
|
|
616
616
|
|
|
617
|
-
/** Which
|
|
618
|
-
* as in the prototype, where
|
|
619
|
-
|
|
617
|
+
/** Which inherited-access section is expanded — a granting folder's path, or
|
|
618
|
+
* `'roles'`, or null. One at a time — as in the prototype, where
|
|
619
|
+
* `state.accOpen` holds a single value. */
|
|
620
|
+
const [openSection, setOpenSection] = useState<string | null>(null);
|
|
620
621
|
|
|
621
622
|
const governed = repoRelative !== null;
|
|
622
623
|
// The dialog can mutate only if the current user can write this path's access
|
|
@@ -625,12 +626,12 @@ export function ManageAccessDialog({
|
|
|
625
626
|
const canManage = !!data?.canWrite;
|
|
626
627
|
|
|
627
628
|
// Resolve the CURRENT typed query into a principal to append as a chip: an
|
|
628
|
-
// exact
|
|
629
|
+
// exact plugin match or a free-typed email. (Suggestion clicks append directly.)
|
|
629
630
|
const addPending: Principal | null = useMemo(() => {
|
|
630
631
|
const q = query.trim();
|
|
631
632
|
if (!q) return null;
|
|
632
|
-
const
|
|
633
|
-
if (
|
|
633
|
+
const pluginHit = suggest?.plugins.find((g) => g.toLowerCase() === q.toLowerCase());
|
|
634
|
+
if (pluginHit) return { kind: 'role', role: pluginHit };
|
|
634
635
|
if (EMAIL_RE.test(q)) return { kind: 'user', email: q, displayName: q.split('@')[0] };
|
|
635
636
|
return null;
|
|
636
637
|
}, [query, suggest]);
|
|
@@ -1007,7 +1008,7 @@ export function ManageAccessDialog({
|
|
|
1007
1008
|
</Button>
|
|
1008
1009
|
</div>
|
|
1009
1010
|
) : canManage && p.manage === 'external' ? (
|
|
1010
|
-
// No file-backed grant to remove here — managed elsewhere (a
|
|
1011
|
+
// No file-backed grant to remove here — managed elsewhere (a plugin's
|
|
1011
1012
|
// membership, the everyone policy, or admin rescue).
|
|
1012
1013
|
<span
|
|
1013
1014
|
className="ml-auto shrink-0 text-detail text-ink-faint"
|
|
@@ -1145,9 +1146,9 @@ export function ManageAccessDialog({
|
|
|
1145
1146
|
className="min-w-32 flex-1 bg-transparent px-1 py-1 text-ui text-ink placeholder:text-ink-faint focus:outline-none"
|
|
1146
1147
|
/>
|
|
1147
1148
|
</div>
|
|
1148
|
-
{query.trim() && suggest && (suggest.
|
|
1149
|
+
{query.trim() && suggest && (suggest.plugins.length > 0 || suggest.people.length > 0) && (
|
|
1149
1150
|
<AnchoredMenu width="anchor" align="left" className="max-h-56 overflow-auto">
|
|
1150
|
-
{suggest.
|
|
1151
|
+
{suggest.plugins.map((g) => (
|
|
1151
1152
|
<MenuItem
|
|
1152
1153
|
key={`g:${g}`}
|
|
1153
1154
|
onClick={() => addChip({ kind: 'role', role: g })}
|
|
@@ -1337,14 +1338,14 @@ export function ManageAccessDialog({
|
|
|
1337
1338
|
{inheritedRows.length > 0 && (
|
|
1338
1339
|
<div className="mt-3 border-t border-line pt-2">
|
|
1339
1340
|
{inheritedByFolder.folders.map(([ancestor, rows]) => {
|
|
1340
|
-
const open =
|
|
1341
|
+
const open = openSection === ancestor;
|
|
1341
1342
|
return (
|
|
1342
1343
|
<div key={ancestor}>
|
|
1343
1344
|
<button
|
|
1344
1345
|
type="button"
|
|
1345
1346
|
aria-expanded={open}
|
|
1346
1347
|
title={folderPath(ancestor)}
|
|
1347
|
-
onClick={() =>
|
|
1348
|
+
onClick={() => setOpenSection(open ? null : ancestor)}
|
|
1348
1349
|
className="flex w-full items-center gap-1.5 rounded-xs py-1 text-detail text-ink-muted hover:text-ink"
|
|
1349
1350
|
>
|
|
1350
1351
|
<ChevronDown
|
|
@@ -1394,25 +1395,25 @@ export function ManageAccessDialog({
|
|
|
1394
1395
|
|
|
1395
1396
|
{/* A role that grants at the workspace level belongs to no
|
|
1396
1397
|
folder, so it cannot be filed under one. Named for what it
|
|
1397
|
-
is rather than swept into the folder
|
|
1398
|
+
is rather than swept into the folder sections. */}
|
|
1398
1399
|
{inheritedByFolder.external.length > 0 && (
|
|
1399
1400
|
<div>
|
|
1400
1401
|
<button
|
|
1401
1402
|
type="button"
|
|
1402
|
-
aria-expanded={
|
|
1403
|
-
onClick={() =>
|
|
1403
|
+
aria-expanded={openSection === 'roles'}
|
|
1404
|
+
onClick={() => setOpenSection(openSection === 'roles' ? null : 'roles')}
|
|
1404
1405
|
className="flex w-full items-center gap-1.5 rounded-xs py-1 text-detail text-ink-muted hover:text-ink"
|
|
1405
1406
|
>
|
|
1406
1407
|
<ChevronDown
|
|
1407
1408
|
size={14}
|
|
1408
|
-
className={`shrink-0 transition-transform ${
|
|
1409
|
+
className={`shrink-0 transition-transform ${openSection === 'roles' ? 'rotate-180' : '-rotate-90'}`}
|
|
1409
1410
|
/>
|
|
1410
1411
|
<span className="min-w-0 truncate">People with access through a role</span>
|
|
1411
1412
|
<span className="ml-auto shrink-0 tabular-nums text-ink-faint">
|
|
1412
1413
|
{inheritedByFolder.external.length}
|
|
1413
1414
|
</span>
|
|
1414
1415
|
</button>
|
|
1415
|
-
{
|
|
1416
|
+
{openSection === 'roles' && (
|
|
1416
1417
|
<div className="mb-1">{inheritedByFolder.external.map(renderRow)}</div>
|
|
1417
1418
|
)}
|
|
1418
1419
|
</div>
|
|
@@ -371,7 +371,7 @@ function RoleCard({
|
|
|
371
371
|
const [renamePending, setRenamePending] = useState(false);
|
|
372
372
|
|
|
373
373
|
// Add-member input + people autocomplete (same suggest source as Manage
|
|
374
|
-
// Access, scoped to people/emails — a role's members are emails, not
|
|
374
|
+
// Access, scoped to people/emails — a role's members are emails, not plugins).
|
|
375
375
|
const [memberEmail, setMemberEmail] = useState('');
|
|
376
376
|
const [suggestions, setSuggestions] = useState<{ name: string; email: string }[]>([]);
|
|
377
377
|
const [showSuggest, setShowSuggest] = useState(false);
|
|
@@ -16,9 +16,9 @@ beforeEach(() => {
|
|
|
16
16
|
|
|
17
17
|
describe('useFileOnBranch', () => {
|
|
18
18
|
it('returns the file once the read lands', async () => {
|
|
19
|
-
const { result } = renderHook(() => useFileOnBranch('main', '
|
|
19
|
+
const { result } = renderHook(() => useFileOnBranch('main', 'Plugins/Sales/deck/SKILL.md'));
|
|
20
20
|
expect(result.current).toBeNull();
|
|
21
|
-
await waitFor(() => expect(result.current).toBe('content of
|
|
21
|
+
await waitFor(() => expect(result.current).toBe('content of Plugins/Sales/deck/SKILL.md'));
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -31,7 +31,7 @@ import { CrFileTree, type CrTreeFileState } from './CrFileTree';
|
|
|
31
31
|
* so the owner can read the untouched parts of the thing under review too.
|
|
32
32
|
*/
|
|
33
33
|
export interface ChangeRequestScope {
|
|
34
|
-
/** Repo-root-relative folder, no trailing slash (e.g. `
|
|
34
|
+
/** Repo-root-relative folder, no trailing slash (e.g. `Plugins/gtm/rfi`). */
|
|
35
35
|
prefix: string;
|
|
36
36
|
/** Files that ALWAYS list, relative to `prefix`, whether touched or not. */
|
|
37
37
|
baseFiles: string[];
|
|
@@ -42,7 +42,7 @@ export interface ApplyChangeRequest {
|
|
|
42
42
|
* 1. **Approving is not merging.** The merge gate requires a recorded per-file
|
|
43
43
|
* approval from an eligible approver for every markdown file that has
|
|
44
44
|
* owners — which is precisely the case the skill page is built for, since a
|
|
45
|
-
* SKILL.md inside a
|
|
45
|
+
* SKILL.md inside a plugin folder inherits that folder's `access.md`. Going
|
|
46
46
|
* straight to merge is refused with "Waiting on approval for …". So the
|
|
47
47
|
* owner's click records the approvals FIRST, then merges. Files the caller
|
|
48
48
|
* is not eligible for are skipped rather than treated as failures: the gate
|
|
@@ -28,7 +28,7 @@ function setViewportWidth(width: number): void {
|
|
|
28
28
|
/** Mount a frame and hand back the `<aside>` — what most assertions here are about. */
|
|
29
29
|
function renderFrame(): HTMLElement {
|
|
30
30
|
const { container } = render(
|
|
31
|
-
<SidebarFrame label="Library
|
|
31
|
+
<SidebarFrame label="Library plugins">
|
|
32
32
|
<button type="button">Engineering</button>
|
|
33
33
|
</SidebarFrame>,
|
|
34
34
|
);
|
|
@@ -42,7 +42,7 @@ function renderFrame(): HTMLElement {
|
|
|
42
42
|
*/
|
|
43
43
|
function renderFrameWithContainer() {
|
|
44
44
|
return render(
|
|
45
|
-
<SidebarFrame label="Library
|
|
45
|
+
<SidebarFrame label="Library plugins">
|
|
46
46
|
<button type="button">Engineering</button>
|
|
47
47
|
</SidebarFrame>,
|
|
48
48
|
);
|
|
@@ -123,7 +123,7 @@ describe('SidebarFrame: narrow viewport', () => {
|
|
|
123
123
|
expect(aside).not.toHaveAttribute('inert');
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
it.each(['File explorer', 'Library
|
|
126
|
+
it.each(['File explorer', 'Library plugins'])(
|
|
127
127
|
'opens %s as the same modal drawer over a backdrop',
|
|
128
128
|
(label) => {
|
|
129
129
|
setViewportWidth(375);
|
|
@@ -191,7 +191,7 @@ describe('SidebarFrame: narrow viewport', () => {
|
|
|
191
191
|
render(
|
|
192
192
|
<>
|
|
193
193
|
<Probe />
|
|
194
|
-
<SidebarFrame label="Library
|
|
194
|
+
<SidebarFrame label="Library plugins">
|
|
195
195
|
<button type="button">Engineering</button>
|
|
196
196
|
</SidebarFrame>
|
|
197
197
|
</>,
|
|
@@ -28,7 +28,7 @@ beforeEach(() => {
|
|
|
28
28
|
|
|
29
29
|
function frame() {
|
|
30
30
|
const { container } = render(
|
|
31
|
-
<SidebarFrame label="Library
|
|
31
|
+
<SidebarFrame label="Library plugins">
|
|
32
32
|
<button type="button">Engineering</button>
|
|
33
33
|
</SidebarFrame>,
|
|
34
34
|
);
|
|
@@ -112,7 +112,7 @@ describe('SidebarFrame: collapsed', () => {
|
|
|
112
112
|
// sizing something invisible (proto:98).
|
|
113
113
|
it('withdraws the drag handle while hidden', () => {
|
|
114
114
|
render(
|
|
115
|
-
<SidebarFrame label="Library
|
|
115
|
+
<SidebarFrame label="Library plugins">
|
|
116
116
|
<span>x</span>
|
|
117
117
|
</SidebarFrame>,
|
|
118
118
|
);
|
|
@@ -125,7 +125,7 @@ describe('SidebarFrame: collapsed', () => {
|
|
|
125
125
|
describe('SidebarFrame: resize', () => {
|
|
126
126
|
function grip() {
|
|
127
127
|
render(
|
|
128
|
-
<SidebarFrame label="Library
|
|
128
|
+
<SidebarFrame label="Library plugins">
|
|
129
129
|
<span>x</span>
|
|
130
130
|
</SidebarFrame>,
|
|
131
131
|
);
|
|
@@ -190,7 +190,7 @@ describe('SidebarFrame: drag cleanup', () => {
|
|
|
190
190
|
|
|
191
191
|
function startDrag() {
|
|
192
192
|
const { unmount } = render(
|
|
193
|
-
<SidebarFrame label="Library
|
|
193
|
+
<SidebarFrame label="Library plugins">
|
|
194
194
|
<span>x</span>
|
|
195
195
|
</SidebarFrame>,
|
|
196
196
|
);
|
|
@@ -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.
|