@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
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
reconcileJoinRequest,
|
|
8
8
|
type JoinProposal,
|
|
9
9
|
type JoinRequest,
|
|
10
|
-
} from '../services/
|
|
10
|
+
} from '../services/plugins.api';
|
|
11
11
|
import { useLibraryToast } from '../state/toast.context';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* The join requests one
|
|
14
|
+
* The join requests one plugin's managers can answer, and the two ways to
|
|
15
15
|
* answer them.
|
|
16
16
|
*
|
|
17
17
|
* ACCEPTING IS A GRANT, NOT A MERGE. A proposal is "give this principal this
|
|
18
|
-
* verb on the
|
|
18
|
+
* verb on the plugin folder", so accepting it calls the ordinary access-grant
|
|
19
19
|
* API — the same endpoint the Manage-access dialog uses, with the same gate,
|
|
20
20
|
* lock and commit. The request's branch is never merged, so nothing else it
|
|
21
21
|
* carries can ride in on an approval, and a request naming five people can be
|
|
@@ -40,14 +40,14 @@ export interface JoinRequestsState {
|
|
|
40
40
|
reload(): void;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export function useJoinRequests(
|
|
43
|
+
export function useJoinRequests(plugin: string, folder: string | null): JoinRequestsState {
|
|
44
44
|
const [requests, setRequests] = useState<JoinRequest[]>([]);
|
|
45
45
|
const [revision, setRevision] = useState(0);
|
|
46
46
|
const toast = useLibraryToast();
|
|
47
47
|
|
|
48
48
|
useEffect(() => {
|
|
49
49
|
let cancelled = false;
|
|
50
|
-
listJoinRequests(
|
|
50
|
+
listJoinRequests(plugin)
|
|
51
51
|
.then((rows) => {
|
|
52
52
|
if (!cancelled) setRequests(rows);
|
|
53
53
|
})
|
|
@@ -58,7 +58,7 @@ export function useJoinRequests(group: string, folder: string | null): JoinReque
|
|
|
58
58
|
return () => {
|
|
59
59
|
cancelled = true;
|
|
60
60
|
};
|
|
61
|
-
}, [
|
|
61
|
+
}, [plugin, revision]);
|
|
62
62
|
|
|
63
63
|
const reload = useCallback(() => setRevision((r) => r + 1), []);
|
|
64
64
|
|
|
@@ -92,10 +92,10 @@ export function useJoinRequests(group: string, folder: string | null): JoinReque
|
|
|
92
92
|
),
|
|
93
93
|
);
|
|
94
94
|
toast(`${proposal.label} now has ${proposal.verb} access.`);
|
|
95
|
-
await reconcileJoinRequest(
|
|
95
|
+
await reconcileJoinRequest(plugin, request.number).catch(() => false);
|
|
96
96
|
setRevision((r) => r + 1);
|
|
97
97
|
},
|
|
98
|
-
[folder,
|
|
98
|
+
[folder, plugin, toast],
|
|
99
99
|
);
|
|
100
100
|
|
|
101
101
|
const decline = useCallback(
|
|
@@ -4,19 +4,19 @@ import { LibraryProvider, useLibrary } from '../state/library-data';
|
|
|
4
4
|
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
5
5
|
import { LibraryLayout } from '../components/LibraryLayout';
|
|
6
6
|
import { LibraryPage } from '../components/LibraryPage';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { PluginPage } from '../components/PluginPage';
|
|
8
|
+
import { PluginsIndexPage } from '../components/PluginsIndexPage';
|
|
9
|
+
import { PersonalPluginPage } from '../components/PersonalPluginPage';
|
|
10
10
|
import { WelcomePage } from '../../onboarding/components/WelcomePage';
|
|
11
11
|
import { WorkspaceItemRoute } from './WorkspaceItemRoute';
|
|
12
|
-
import {
|
|
12
|
+
import { decodePluginSegment, LIBRARY_ROOT, pathForPlugin, urlForItemFile, urlForSkillFile } from './library-paths';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* The Skills & Tools surface — everything under `/skills-and-tools/*`.
|
|
16
16
|
*
|
|
17
17
|
* The shell mounts this once (`CORE_APPS`), so the toast host and the data
|
|
18
18
|
* provider wrap the WHOLE surface rather than one page: navigating between the
|
|
19
|
-
* gallery, a
|
|
19
|
+
* gallery, a plugin and an item must not refetch the catalog or drop a toast
|
|
20
20
|
* mid-flight.
|
|
21
21
|
*
|
|
22
22
|
* Paths below are RELATIVE — the shell already matched `/skills-and-tools/*`.
|
|
@@ -32,11 +32,11 @@ export function LibraryRoutes() {
|
|
|
32
32
|
<LibraryProvider>
|
|
33
33
|
<Routes>
|
|
34
34
|
<Route element={<LibraryLayout />}>
|
|
35
|
-
{/* The Library OPENS on its
|
|
35
|
+
{/* The Library OPENS on its plugins. A plugin is where skills and
|
|
36
36
|
tools live and who they are for, so the index of them is the
|
|
37
37
|
orienting view; the undifferentiated card grid is a lens on
|
|
38
38
|
the same catalog and keeps its own row and URL below. */}
|
|
39
|
-
<Route index element={<
|
|
39
|
+
<Route index element={<PluginsIndexPage />} />
|
|
40
40
|
|
|
41
41
|
{/* The whole catalog as cards, with the library-wide search. */}
|
|
42
42
|
<Route path="everything" element={<LibraryPage filter={{ kind: 'all' }} />} />
|
|
@@ -49,26 +49,26 @@ export function LibraryRoutes() {
|
|
|
49
49
|
|
|
50
50
|
<Route path="owned" element={<LibraryPage filter={{ kind: 'owned' }} />} />
|
|
51
51
|
|
|
52
|
-
{/* `yours` is a
|
|
52
|
+
{/* `yours` is a PLUGIN page, not a gallery filter — the items in no
|
|
53
53
|
folder, given the same page the folders get. The sidebar still
|
|
54
54
|
lights it through the `ungrouped` filter, so the URL and the
|
|
55
55
|
selection stay the pair they were. */}
|
|
56
|
-
<Route path="yours" element={<
|
|
56
|
+
<Route path="yours" element={<PersonalPluginPage />} />
|
|
57
57
|
|
|
58
|
-
{/* A
|
|
59
|
-
URL, and `
|
|
58
|
+
{/* A plugin is a PLACE: `plugins/:plugin` is a real page with a real
|
|
59
|
+
URL, and `PluginPage` — not the router — decides whether the
|
|
60
60
|
caller gets the member view or the locked one. */}
|
|
61
61
|
{/* The index moved to the root. This path is where every older
|
|
62
62
|
link points, so it redirects rather than 404s or duplicates
|
|
63
63
|
the page at a second URL. */}
|
|
64
|
-
<Route path="
|
|
65
|
-
<Route path="
|
|
64
|
+
<Route path="plugins" element={<Navigate to={LIBRARY_ROOT} replace />} />
|
|
65
|
+
<Route path="plugins/:plugin" element={<PluginPage />} />
|
|
66
66
|
|
|
67
67
|
{/* The canonical item addresses. This surface is mounted at TWO
|
|
68
68
|
shell paths (`/skills-and-tools/*` and, for default-branch
|
|
69
|
-
`
|
|
69
|
+
`Plugins/` URLs, `/workspace/*` — see `isLibraryLocation` and
|
|
70
70
|
the shell's `CoreSurfaces`), and under the second the remainder
|
|
71
|
-
is `<branch>/<kbDir>/
|
|
71
|
+
is `<branch>/<kbDir>/Plugins/...`. Matching it HERE, inside the
|
|
72
72
|
layout route, is what makes a skill page share the exact
|
|
73
73
|
sidebar instance the reader browsed in with — one surface, not
|
|
74
74
|
a second implementation of it. Static siblings above outrank
|
|
@@ -88,6 +88,13 @@ export function LibraryRoutes() {
|
|
|
88
88
|
<Route path="tools/:slug" element={<LegacyToolRedirect />} />
|
|
89
89
|
<Route path="skills/:name" element={<LegacySkillRedirect />} />
|
|
90
90
|
|
|
91
|
+
{/* LEGACY plugin addresses: `groups/…` is the pre-rename URL shape,
|
|
92
|
+
and links to it exist in the wild. Same posture as the other
|
|
93
|
+
legacy routes — a redirect to the current URL, outside the
|
|
94
|
+
layout route. */}
|
|
95
|
+
<Route path="groups" element={<Navigate to={LIBRARY_ROOT} replace />} />
|
|
96
|
+
<Route path="groups/:plugin" element={<LegacyGroupRedirect />} />
|
|
97
|
+
|
|
91
98
|
{/* An unknown subpath is a stale or mistyped link, not an error page —
|
|
92
99
|
send it home. Outside the layout route so a redirect never paints
|
|
93
100
|
a sidebar on its way through. */}
|
|
@@ -98,12 +105,18 @@ export function LibraryRoutes() {
|
|
|
98
105
|
);
|
|
99
106
|
}
|
|
100
107
|
|
|
108
|
+
/** `groups/:plugin` → `plugins/:plugin` — the pre-rename plugin URL. */
|
|
109
|
+
function LegacyGroupRedirect() {
|
|
110
|
+
const { plugin = '' } = useParams<{ plugin: string }>();
|
|
111
|
+
return <Navigate to={pathForPlugin(decodePluginSegment(plugin))} replace />;
|
|
112
|
+
}
|
|
113
|
+
|
|
101
114
|
/** `skills/:name` → the skill's canonical workspace URL (its SKILL.md). */
|
|
102
115
|
function LegacySkillRedirect() {
|
|
103
116
|
const { name = '' } = useParams<{ name: string }>();
|
|
104
117
|
const data = useLibrary();
|
|
105
118
|
const { kbDirName } = useWorkspace();
|
|
106
|
-
const decoded =
|
|
119
|
+
const decoded = decodePluginSegment(name);
|
|
107
120
|
const skill = data.items.find((i) => i.kind === 'skill' && i.id === decoded);
|
|
108
121
|
if (skill && kbDirName) return <Navigate to={urlForSkillFile(kbDirName, skill.path)} replace />;
|
|
109
122
|
if (kbDirName === null) return null;
|
|
@@ -121,7 +134,7 @@ function LegacyToolRedirect() {
|
|
|
121
134
|
const location = useLocation();
|
|
122
135
|
const data = useLibrary();
|
|
123
136
|
const { kbDirName } = useWorkspace();
|
|
124
|
-
const decoded =
|
|
137
|
+
const decoded = decodePluginSegment(slug);
|
|
125
138
|
const tool = data.items.find((i) => i.kind === 'integration' && i.id === decoded);
|
|
126
139
|
if (kbDirName === null) return null;
|
|
127
140
|
if (tool) {
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { Navigate, useParams } from 'react-router-dom';
|
|
2
|
-
import { DEFAULT_BRANCH,
|
|
2
|
+
import { DEFAULT_BRANCH, PLUGINS_DIR } from '@bevel-software/platform-shared';
|
|
3
3
|
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
4
4
|
import { useLibrary } from '../state/library-data';
|
|
5
5
|
import { SkillPage } from '../components/skill-page/SkillPage';
|
|
6
6
|
import { ToolPage } from '../components/tool-page/ToolPage';
|
|
7
|
-
import { LIBRARY_ROOT,
|
|
7
|
+
import { LIBRARY_ROOT, pathForPlugin } from './library-paths';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The library page behind a canonical workspace URL —
|
|
11
|
-
* `/workspace/<default>/<kbDir>/
|
|
11
|
+
* `/workspace/<default>/<kbDir>/Plugins/<plugin>/<...>` — rendered INSIDE the
|
|
12
12
|
* same `LibraryLayout` route tree as every other library page, so the sidebar
|
|
13
13
|
* is the one the reader already had and nothing remounts on the way in.
|
|
14
14
|
*
|
|
15
|
-
* Resolution is STRUCTURAL, not a catalog lookup: under `
|
|
15
|
+
* Resolution is STRUCTURAL, not a catalog lookup: under `Plugins/<plugin>/`, a
|
|
16
16
|
* `*.tool` file is a tool page, any other direct FILE (an extension, no
|
|
17
|
-
* segments below it — `access.md`) belongs to the
|
|
17
|
+
* segments below it — `access.md`) belongs to the plugin page, and everything
|
|
18
18
|
* else is a skill FOLDER whose name is the skill's id — the same identity the
|
|
19
19
|
* old name-based route used. That is what makes a skill created a moment ago
|
|
20
20
|
* open instantly: its URL says everything the page needs, and `SkillPage`
|
|
21
21
|
* fetches the skill by name itself. Waiting on the catalog here raced every
|
|
22
|
-
* reload and lost (the just-created skill bounced to its
|
|
22
|
+
* reload and lost (the just-created skill bounced to its plugin's page).
|
|
23
23
|
*
|
|
24
24
|
* The catalog is consulted only to REFINE a tool's slug (a `.tool` may
|
|
25
25
|
* declare an explicit id different from its filename); the filename is the
|
|
@@ -35,19 +35,19 @@ export function WorkspaceItemRoute() {
|
|
|
35
35
|
// Shape re-validation: the route pattern (`:branch/*`) is broader than the
|
|
36
36
|
// shape the shell dispatches here, and a stray URL must not read as a page.
|
|
37
37
|
const segments = splat.split('/').filter(Boolean).map(safeDecode);
|
|
38
|
-
if (branch !== DEFAULT_BRANCH || segments[1] !==
|
|
38
|
+
if (branch !== DEFAULT_BRANCH || segments[1] !== PLUGINS_DIR || segments.length < 3) {
|
|
39
39
|
return <Navigate to={LIBRARY_ROOT} replace />;
|
|
40
40
|
}
|
|
41
41
|
if (kbDirName !== null && segments[0] !== kbDirName) {
|
|
42
42
|
return <Navigate to={LIBRARY_ROOT} replace />;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const [, ,
|
|
45
|
+
const [, , plugin, ...tail] = segments;
|
|
46
46
|
const last = tail[tail.length - 1];
|
|
47
|
-
if (!
|
|
47
|
+
if (!plugin || !last) {
|
|
48
48
|
return <Navigate to={LIBRARY_ROOT} replace />;
|
|
49
49
|
}
|
|
50
|
-
const repoRel = `${
|
|
50
|
+
const repoRel = `${PLUGINS_DIR}/${plugin}/${tail.join('/')}`;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* `key={name}` is load-bearing. A provisional name gets CORRECTED once the
|
|
@@ -61,9 +61,9 @@ export function WorkspaceItemRoute() {
|
|
|
61
61
|
);
|
|
62
62
|
|
|
63
63
|
// A `.tool` is a tool page wherever it sits. The backend finds manuals at
|
|
64
|
-
// ANY depth below `
|
|
64
|
+
// ANY depth below `Plugins/` (`walkFiles` over the whole tree), so a manual
|
|
65
65
|
// filed inside a category folder is a real, listed tool — matching only at
|
|
66
|
-
// the
|
|
66
|
+
// the plugin's top level would list it and then 404 the click.
|
|
67
67
|
if (last.toLowerCase().endsWith('.tool')) {
|
|
68
68
|
const catalogSlug = data.items.find(
|
|
69
69
|
(i) => i.kind === 'integration' && i.path === repoRel,
|
|
@@ -72,7 +72,7 @@ export function WorkspaceItemRoute() {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// THE CATALOG IS THE AUTHORITY on which folder is a skill and what its id
|
|
75
|
-
// is.
|
|
75
|
+
// is. Plugins may nest (`Plugins/Engineering/coding/create-ticket/SKILL.md`),
|
|
76
76
|
// and a skill's id is its frontmatter `id`/`name` — only FALLING BACK to the
|
|
77
77
|
// folder name — so neither the depth nor the id can be read off the URL with
|
|
78
78
|
// certainty. Take the DEEPEST skill whose folder contains this path: a
|
|
@@ -88,10 +88,10 @@ export function WorkspaceItemRoute() {
|
|
|
88
88
|
// Not in the catalog. A `SKILL.md` still names its own skill structurally —
|
|
89
89
|
// the folder holding it — and that is deliberately catalog-FREE: a skill
|
|
90
90
|
// created a moment ago opens from its URL alone, before any reload lands.
|
|
91
|
-
// (`
|
|
91
|
+
// (`Plugins/<plugin>/SKILL.md` makes the plugin folder itself the skill, which
|
|
92
92
|
// is what the backend's walk would report for it.)
|
|
93
93
|
if (last === 'SKILL.md') {
|
|
94
|
-
return skillPage(tail.length >= 2 ? tail[tail.length - 2]! :
|
|
94
|
+
return skillPage(tail.length >= 2 ? tail[tail.length - 2]! : plugin, 'SKILL.md', true);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// Everything below is decided on POSITIVE evidence only. What the catalog
|
|
@@ -99,24 +99,24 @@ export function WorkspaceItemRoute() {
|
|
|
99
99
|
// failed refresh — but what it does NOT know proves nothing: it may be
|
|
100
100
|
// loading, stale (a skill created seconds ago), or have failed outright.
|
|
101
101
|
// Reading absence as "this is not a page" is what bounced valid deep links
|
|
102
|
-
// to the
|
|
102
|
+
// to the plugin, so this no longer draws that inference at all.
|
|
103
103
|
|
|
104
104
|
// A folder with catalog skills UNDER it is a category, not a skill. That is
|
|
105
105
|
// the discriminator between a category folder and a just-created skill whose
|
|
106
106
|
// reload hasn't landed: the former has known descendants, the latter has
|
|
107
|
-
// none. A category has no page of its own; its
|
|
107
|
+
// none. A category has no page of its own; its plugin does.
|
|
108
108
|
if (!hasExtension(last) && containsCatalogSkill(data.items, repoRel)) {
|
|
109
|
-
return <Navigate to={
|
|
109
|
+
return <Navigate to={pathForPlugin(plugin)} replace />;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
// A FILE is the
|
|
113
|
-
// sits directly in the
|
|
112
|
+
// A FILE is the plugin's business when it cannot be a skill's file: either it
|
|
113
|
+
// sits directly in the plugin folder (structurally never inside a skill), or
|
|
114
114
|
// its own folder is a known category. `access.md` at either level, a stray
|
|
115
115
|
// upload. A file under an UNKNOWN folder is left alone — that folder is most
|
|
116
116
|
// likely a skill the catalog hasn't caught up with.
|
|
117
117
|
const parentRel = repoRel.slice(0, repoRel.length - last.length - 1);
|
|
118
118
|
if (hasExtension(last) && (tail.length === 1 || containsCatalogSkill(data.items, parentRel))) {
|
|
119
|
-
return <Navigate to={
|
|
119
|
+
return <Navigate to={pathForPlugin(plugin)} replace />;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// Nothing positive settled it. While the catalog is still loading, WAIT: the
|
|
@@ -131,7 +131,7 @@ export function WorkspaceItemRoute() {
|
|
|
131
131
|
// so SkillPage must not turn a failed lookup into "doesn't exist" until the
|
|
132
132
|
// catalog has actually answered.
|
|
133
133
|
return hasExtension(last)
|
|
134
|
-
? skillPage(tail.length >= 2 ? tail[tail.length - 2]! :
|
|
134
|
+
? skillPage(tail.length >= 2 ? tail[tail.length - 2]! : plugin, last, true)
|
|
135
135
|
: skillPage(last, 'SKILL.md', true);
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -154,9 +154,9 @@ function containsCatalogSkill(
|
|
|
154
154
|
/**
|
|
155
155
|
* The catalog skill whose folder contains `repoRel`, deepest first — the skill
|
|
156
156
|
* a bundled file belongs to. Deepest wins because a category folder is never a
|
|
157
|
-
* skill itself, so between `
|
|
157
|
+
* skill itself, so between `Plugins/E/coding` and `Plugins/E/coding/create-ticket`
|
|
158
158
|
* only the latter can be a real entry; taking the shallower match would hand
|
|
159
|
-
* the file to whichever skill sat nearest the
|
|
159
|
+
* the file to whichever skill sat nearest the plugin root.
|
|
160
160
|
*
|
|
161
161
|
* Compares on whole segments (`path + '/'`), never a bare `startsWith`: a
|
|
162
162
|
* sibling named `create-ticket-v2` shares a prefix with `create-ticket` and
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_BRANCH,
|
|
1
|
+
import { DEFAULT_BRANCH, PLUGINS_DIR, pluginOfPath, isPersonalPluginFolder } from '@bevel-software/platform-shared';
|
|
2
2
|
import { matchPath } from 'react-router-dom';
|
|
3
3
|
import { kbFileUrl } from '../../workspace/routing/kb-routes';
|
|
4
4
|
import type { LibraryFilter } from '../utils/status';
|
|
@@ -8,7 +8,7 @@ import type { LibraryFilter } from '../utils/status';
|
|
|
8
8
|
*
|
|
9
9
|
* Pure functions rather than logic inside the layout, because three surfaces
|
|
10
10
|
* need them: the layout (to light the right sidebar row), every page that links
|
|
11
|
-
* to a
|
|
11
|
+
* to a plugin, and the tests. Keeping the pair together is what makes the round
|
|
12
12
|
* trip auditable — a path that maps to a filter must map back to itself.
|
|
13
13
|
*/
|
|
14
14
|
|
|
@@ -17,21 +17,21 @@ export const LIBRARY_ROOT = '/skills-and-tools';
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* What the sidebar should show as selected for a path. `null` on the pages that
|
|
20
|
-
* are not a filtered view of the catalog — the all-
|
|
21
|
-
* `
|
|
20
|
+
* are not a filtered view of the catalog — the all-plugins index (the root, see
|
|
21
|
+
* `isPluginsIndexPath`) and the item pages — where the gallery rows are all
|
|
22
22
|
* inactive.
|
|
23
23
|
*
|
|
24
24
|
* `matchPath` hands params back RAW (react-router decodes neither here nor in
|
|
25
|
-
* `useParams`), so a
|
|
26
|
-
* and has to be decoded to match the catalog's folder name. The
|
|
27
|
-
* the same decode on `useParams().
|
|
25
|
+
* `useParams`), so a plugin named `Sales & Ops` arrives as `Sales%20%26%20Ops`
|
|
26
|
+
* and has to be decoded to match the catalog's folder name. The plugin page owes
|
|
27
|
+
* the same decode on `useParams().plugin`.
|
|
28
28
|
*/
|
|
29
29
|
export function libraryFilterForPath(pathname: string): LibraryFilter | null {
|
|
30
30
|
if (matchPath({ path: `${LIBRARY_ROOT}/everything`, end: true }, pathname)) return { kind: 'all' };
|
|
31
31
|
if (matchPath({ path: `${LIBRARY_ROOT}/owned`, end: true }, pathname)) return { kind: 'owned' };
|
|
32
32
|
if (matchPath({ path: `${LIBRARY_ROOT}/yours`, end: true }, pathname)) return { kind: 'ungrouped' };
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
33
|
+
const plugin = matchPath({ path: `${LIBRARY_ROOT}/plugins/:plugin`, end: true }, pathname);
|
|
34
|
+
if (plugin?.params.plugin) return { kind: 'group', plugin: decodeSegment(plugin.params.plugin) };
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -45,32 +45,32 @@ export function pathForLibraryFilter(filter: LibraryFilter): string {
|
|
|
45
45
|
case 'ungrouped':
|
|
46
46
|
return `${LIBRARY_ROOT}/yours`;
|
|
47
47
|
case 'group':
|
|
48
|
-
return
|
|
48
|
+
return pathForPlugin(filter.plugin);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
/** The route for one
|
|
53
|
-
export function
|
|
54
|
-
return `${LIBRARY_ROOT}/
|
|
52
|
+
/** The route for one plugin — member view or locked view, the page decides. */
|
|
53
|
+
export function pathForPlugin(plugin: string): string {
|
|
54
|
+
return `${LIBRARY_ROOT}/plugins/${encodeURIComponent(plugin)}`;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* The all-
|
|
59
|
-
* surface, so the index of them is what the root shows; `
|
|
58
|
+
* The all-plugins index — the Library's HOME. Plugins are the structure of this
|
|
59
|
+
* surface, so the index of them is what the root shows; `plugins` is kept as a
|
|
60
60
|
* redirect so the links that used to name it still land.
|
|
61
61
|
*/
|
|
62
|
-
export function
|
|
62
|
+
export function pathForPluginsIndex(): string {
|
|
63
63
|
return LIBRARY_ROOT;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* Read a `:
|
|
67
|
+
* Read a `:plugin` route param. React-router 7 hands params back RAW from both
|
|
68
68
|
* `matchPath` and `useParams`, so every reader owes this decode — and a
|
|
69
69
|
* malformed escape (`%zz`, from a hand-edited or truncated link) THROWS, which
|
|
70
70
|
* would blank the page. A bad link is a bad link, not a crash: fall back to the
|
|
71
|
-
* raw segment and let the
|
|
71
|
+
* raw segment and let the plugin simply not be found.
|
|
72
72
|
*/
|
|
73
|
-
export function
|
|
73
|
+
export function decodePluginSegment(raw: string): string {
|
|
74
74
|
return decodeSegment(raw);
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -98,9 +98,9 @@ export function urlForSkillFile(kbDirName: string, skillPath: string, file = 'SK
|
|
|
98
98
|
/**
|
|
99
99
|
* Whether a location belongs to the LIBRARY surface — decided by URL SHAPE
|
|
100
100
|
* alone, never by catalog contents: `/skills-and-tools/...`, or a
|
|
101
|
-
* default-branch workspace URL under `
|
|
102
|
-
* (`/workspace/<default>/<kbDir>/
|
|
103
|
-
* to the Knowledge surface,
|
|
101
|
+
* default-branch workspace URL under `Plugins/`
|
|
102
|
+
* (`/workspace/<default>/<kbDir>/Plugins/<plugin>/...`). KnowledgeBase paths go
|
|
103
|
+
* to the Knowledge surface, Plugins paths to Skills & Tools — the two roots ARE
|
|
104
104
|
* the two apps. A shape rule means a just-created skill routes correctly
|
|
105
105
|
* before any catalog has heard of it.
|
|
106
106
|
*
|
|
@@ -113,8 +113,8 @@ export function isLibraryLocation(pathname: string): boolean {
|
|
|
113
113
|
return (
|
|
114
114
|
segments[0] === 'workspace' &&
|
|
115
115
|
segments[1] === DEFAULT_BRANCH &&
|
|
116
|
-
segments[3] ===
|
|
117
|
-
segments.length >= 6 // workspace/<branch>/<kbDir>/
|
|
116
|
+
segments[3] === PLUGINS_DIR &&
|
|
117
|
+
segments.length >= 6 // workspace/<branch>/<kbDir>/Plugins/<plugin>/<item>
|
|
118
118
|
);
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -142,18 +142,18 @@ export function pathForSkill(name: string): string {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
* Whether a path is the all-
|
|
146
|
-
*
|
|
145
|
+
* Whether a path is the all-plugins index — the one path that lights the "All
|
|
146
|
+
* plugins" row. It is not a `LibraryFilter`: the index lists PLACES, not a
|
|
147
147
|
* filtered slice of the catalog, which is why selection for it travels beside
|
|
148
148
|
* the filter rather than inside it.
|
|
149
149
|
*
|
|
150
|
-
* `
|
|
150
|
+
* `plugins` answers true as well even though it only ever redirects, so the row
|
|
151
151
|
* is already lit while the redirect resolves.
|
|
152
152
|
*/
|
|
153
|
-
export function
|
|
153
|
+
export function isPluginsIndexPath(pathname: string): boolean {
|
|
154
154
|
return (
|
|
155
155
|
matchPath({ path: LIBRARY_ROOT, end: true }, pathname) !== null ||
|
|
156
|
-
matchPath({ path: `${LIBRARY_ROOT}/
|
|
156
|
+
matchPath({ path: `${LIBRARY_ROOT}/plugins`, end: true }, pathname) !== null
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -170,21 +170,21 @@ function decodeSegment(raw: string): string {
|
|
|
170
170
|
* Where an item's back link points: the page the item LIVES on.
|
|
171
171
|
*
|
|
172
172
|
* `‹ All skills & tools` used to be the one answer, and it stopped being
|
|
173
|
-
* true the day the Library's root became the all-
|
|
174
|
-
* opened from its
|
|
173
|
+
* true the day the Library's root became the all-plugins index — a skill
|
|
174
|
+
* opened from its plugin page went "back" to a page the reader had never
|
|
175
175
|
* been on. The honest destination is derivable from the path alone: the
|
|
176
|
-
*
|
|
176
|
+
* plugin page for a grouped item, the personal page for a personal one, and
|
|
177
177
|
* the root only for the legacy shapes that live in neither.
|
|
178
178
|
*/
|
|
179
179
|
export function libraryHomeForItemPath(repoRelativePath: string): {
|
|
180
180
|
label: string;
|
|
181
181
|
path: string;
|
|
182
182
|
} {
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
return { label:
|
|
183
|
+
const plugin = pluginOfPath(repoRelativePath);
|
|
184
|
+
if (plugin !== null && !isPersonalPluginFolder(plugin)) {
|
|
185
|
+
return { label: plugin, path: pathForPlugin(plugin) };
|
|
186
186
|
}
|
|
187
|
-
if (
|
|
187
|
+
if (plugin !== null) {
|
|
188
188
|
return { label: 'Yours', path: `${LIBRARY_ROOT}/yours` };
|
|
189
189
|
}
|
|
190
190
|
return { label: 'All skills & tools', path: LIBRARY_ROOT };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_BRANCH,
|
|
1
|
+
import { DEFAULT_BRANCH, PLUGINS_DIR, type PullRequestSummary } from '@bevel-software/platform-shared';
|
|
2
2
|
import { authFetch } from '../../../lib/api';
|
|
3
3
|
import { handleApiResponse } from '../../git/services/git.api';
|
|
4
4
|
import { createBranch } from '../../git/services/git.api';
|
|
@@ -6,7 +6,7 @@ import { deleteFile, getOrCreateWorkspace, writeFile } from '../../workspace/ser
|
|
|
6
6
|
import { openChangeRequest } from '../../pr/services/pr-open.api';
|
|
7
7
|
import { postPrComment } from '../../pr/services/pr-comments.api';
|
|
8
8
|
import { branchSegment } from '../../change-requests/services/propose.api';
|
|
9
|
-
import {
|
|
9
|
+
import { ensurePersonalPlugin } from './plugins.api';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Library data access. Skills come from the browser skill routes
|
|
@@ -31,7 +31,7 @@ export interface LibrarySkillSummary {
|
|
|
31
31
|
name: string;
|
|
32
32
|
description: string;
|
|
33
33
|
version?: string;
|
|
34
|
-
/** Repo-root-relative skill folder, e.g. `
|
|
34
|
+
/** Repo-root-relative skill folder, e.g. `Plugins/Everyone/rfi`. */
|
|
35
35
|
path: string;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -204,7 +204,7 @@ export type CreateSkillInput = {
|
|
|
204
204
|
userName: string;
|
|
205
205
|
} & (
|
|
206
206
|
| {
|
|
207
|
-
/** Repo-root-relative
|
|
207
|
+
/** Repo-root-relative plugin folder the skill lands in — `Plugins/GTM`. */
|
|
208
208
|
parentPath: string;
|
|
209
209
|
/** False (or unknown) routes the new file through a change request instead. */
|
|
210
210
|
canWrite: boolean;
|
|
@@ -212,7 +212,7 @@ export type CreateSkillInput = {
|
|
|
212
212
|
| {
|
|
213
213
|
/**
|
|
214
214
|
* The skill is the caller's own: it lands in their personal folder
|
|
215
|
-
* (`
|
|
215
|
+
* (`Plugins/personal-<id>/`), which the provisioning endpoint ensures —
|
|
216
216
|
* and commits — first. Always a direct write: the ensured folder's
|
|
217
217
|
* access.md names the caller as owner, so the write gate passes on its
|
|
218
218
|
* own, with no permission special-case anywhere.
|
|
@@ -248,7 +248,7 @@ export interface CreatedSkill {
|
|
|
248
248
|
export async function createEmptySkill(input: CreateSkillInput): Promise<CreatedSkill> {
|
|
249
249
|
const parentPath =
|
|
250
250
|
'personal' in input
|
|
251
|
-
? `${
|
|
251
|
+
? `${PLUGINS_DIR}/${(await ensurePersonalPlugin()).folder}`
|
|
252
252
|
: input.parentPath;
|
|
253
253
|
const repoRelativePath = `${parentPath}/${input.name}/SKILL.md`;
|
|
254
254
|
|
|
@@ -279,11 +279,11 @@ export async function createEmptySkill(input: CreateSkillInput): Promise<Created
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
/**
|
|
282
|
-
* Delete a skill folder or tool file from the default branch — the
|
|
283
|
-
* manager's "remove from
|
|
282
|
+
* Delete a skill folder or tool file from the default branch — the plugin
|
|
283
|
+
* manager's "remove from plugin". One call for both shapes: the backend's
|
|
284
284
|
* delete route recurses a folder into per-file lock+commit cycles, and every
|
|
285
285
|
* one of those locks runs the per-path ACL gate, so a caller who does not
|
|
286
|
-
* manage the
|
|
286
|
+
* manage the plugin is refused by the same rule that governs editing it.
|
|
287
287
|
*/
|
|
288
288
|
export async function removeLibraryItem(repoRelativePath: string): Promise<void> {
|
|
289
289
|
const { workspace } = await getOrCreateWorkspace(DEFAULT_BRANCH);
|