From 39d21f7a460ab00a76c16701e26797f38fa87610 Mon Sep 17 00:00:00 2001 From: Juan Denis Date: Thu, 2 Jul 2026 00:50:10 -0400 Subject: [PATCH] =?UTF-8?q?feat(extensions):=20Phase=205=20=E2=80=94=20Wor?= =?UTF-8?q?dPress=20UI=20contributed=20by=20serverkit-wordpress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Completes #38: the WordPress frontend now belongs to the extension too, not just the backend. The tab-group constraint (contributed routes are flat — there's no way to contribute a shared TabGroupLayout parent inside the dashboard) is solved by contributing a SINGLE splat route `wordpress/*` whose component (WordPressExtension) self-renders the whole WordPress sub-router — reproducing the exact structure core App.jsx used to own: - TabGroupLayout + WORDPRESS_TABS over the 3 list pages (sites / plugin library / pipelines), - full-bleed site + pipeline detail routes as siblings, - the legacy /wordpress/projects → /wordpress/pipelines deprecation redirects. The 5 page components stay in core pages/ and are re-used (Pattern A, same as serverkit-git/email/workflows); only the routing + nav/palette/title ownership moves into the manifest. - builtin-extensions/serverkit-wordpress/frontend/index.jsx (source) → synced to frontend/src/plugins/serverkit-wordpress/ (pre-bundled, D5) via scripts/sync-builtin-frontends.mjs (drift check green). - plugin.json contributions: nav (WordPress), routes ([{path:"wordpress/*", component:"WordPressExtension"}]), page_titles, command_palette. - Core App.jsx: removed the WordPress imports, the TabGroupLayout WORDPRESS_TABS route block, the detail routes, LegacyWpPipelineRedirect, and the now-unused ModuleRoute + WORDPRESS_TABS imports (kept the dynamic /wordpress/ title fallbacks). Removed the sidebar nav item and the two command-palette entries. WordPress now disappears cleanly (nav+routes+API) when the extension is uninstalled. Verified: npm run lint (0 errors) + npm run build clean; the screenshots skill renders /wordpress/42 correctly (visually confirmed — full detail page, Overview tab, sidebar item active); backend flagship still seeds/loads (has_frontend now true) with tests green. Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 8 +- .../serverkit-wordpress/frontend/index.jsx | 60 +++++++++++++++ .../serverkit-wordpress/plugin.json | 24 +++++- docs/EXTRACTION_WORDPRESS_AUDIT.md | 6 +- frontend/src/App.jsx | 43 ++--------- frontend/src/components/CommandPalette.jsx | 3 +- frontend/src/components/sidebarItems.js | 16 +--- .../src/plugins/serverkit-wordpress/index.jsx | 60 +++++++++++++++ .../plugins/serverkit-wordpress/plugin.json | 75 +++++++++++++++++++ 9 files changed, 240 insertions(+), 55 deletions(-) create mode 100644 builtin-extensions/serverkit-wordpress/frontend/index.jsx create mode 100644 frontend/src/plugins/serverkit-wordpress/index.jsx create mode 100644 frontend/src/plugins/serverkit-wordpress/plugin.json diff --git a/CHANGELOG.md b/CHANGELOG.md index e8d6aa0e..045f47d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,13 @@ awaiting a stable release: environment activity keep their foreign keys. The old WordPress "module toggle" is retired — the extension's install/enable state is the gate. Core code reaches the extension's services through an importlib bridge, so a panel with WordPress - uninstalled no longer loads any of the ~6k lines of WordPress service code. + uninstalled no longer loads any of the ~6k lines of WordPress service code. The + **WordPress UI is contributed by the extension too** — a single `wordpress/*` + route self-renders the whole WordPress sub-router (site list + plugin library + + pipelines tab group, plus the full-bleed site/pipeline detail pages), and the + sidebar item, command-palette entries, and page titles all come from the + extension manifest. Uninstalling WordPress now cleanly removes its nav, routes, + and API in one go. - **Extensions platform (Phase 4 — Email is now an extension)** — the mail-server stack (Postfix/Dovecot, domains, mailboxes, DKIM/SpamAssassin, Roundcube webmail, and the `/api/v1/email` API) has moved out of core into the bundled diff --git a/builtin-extensions/serverkit-wordpress/frontend/index.jsx b/builtin-extensions/serverkit-wordpress/frontend/index.jsx new file mode 100644 index 00000000..e1286b82 --- /dev/null +++ b/builtin-extensions/serverkit-wordpress/frontend/index.jsx @@ -0,0 +1,60 @@ +// WordPress UI, contributed through the extension system. The full WordPress +// backend (the /api/v1/wordpress* blueprints + services) lives in this +// extension's backend/; the page components stay in the host pages/ dir and are +// re-used here (same re-export pattern as serverkit-git/email/workflows) so +// their many relative imports keep resolving. +// +// After sync this file lives at frontend/src/plugins/serverkit-wordpress/ so the +// relative imports resolve against the host's src/ tree. +// +// The WordPress surface is a tab group + full-bleed detail pages. Contributed +// routes are flat (there's no way to contribute a shared TabGroupLayout parent +// inside the dashboard), so we contribute ONE splat route (`wordpress/*`) and +// this component self-renders the whole WordPress sub-router — reproducing the +// exact structure the core App.jsx used to own (TabGroupLayout + WORDPRESS_TABS +// over the three list pages; full-bleed detail/pipeline routes as siblings; +// the legacy /wordpress/projects → /wordpress/pipelines deprecation redirects). +import { Routes, Route, Navigate, useParams } from 'react-router-dom'; + +import TabGroupLayout from '../../layouts/TabGroupLayout'; +import { WORDPRESS_TABS } from '../../components/wordpress/wordpressTabs'; +import WordPress from '../../pages/WordPress'; +import WordPressPluginLibrary from '../../pages/WordPressPluginLibrary'; +import WordPressProjects from '../../pages/WordPressProjects'; +import WordPressProject from '../../pages/WordPressProject'; +import WordPressDetail from '../../pages/WordPressDetail'; + +// "WordPress Projects" was renamed to "Pipelines" (§2 unification). Forward old +// deep links to the new space. +function LegacyWpPipelineRedirect() { + const { id, tab } = useParams(); + const suffix = [id, tab].filter(Boolean).join('/'); + return ; +} + +export function WordPressExtension() { + return ( + + {/* Tab group — list surfaces share one PageTopbar + WORDPRESS_TABS. */} + }> + } /> + } /> + } /> + + {/* Full-bleed pipeline detail (own chrome, outside the tab group). */} + } /> + } /> + {/* Legacy "WordPress Projects" URLs → Pipelines (§2). */} + } /> + } /> + } /> + {/* Full-bleed site detail (own chrome, outside the tab group). The + :tab/:section depth keeps the Settings sub-nav shareable. */} + } /> + } /> + } /> + + ); +} + +export default WordPressExtension; diff --git a/builtin-extensions/serverkit-wordpress/plugin.json b/builtin-extensions/serverkit-wordpress/plugin.json index 6632efe8..97888f65 100644 --- a/builtin-extensions/serverkit-wordpress/plugin.json +++ b/builtin-extensions/serverkit-wordpress/plugin.json @@ -30,5 +30,27 @@ } ], "icon": "", - "contributions": {} + "contributions": { + "nav": [ + { + "id": "wordpress", + "label": "WordPress", + "route": "/wordpress", + "category": "infrastructure", + "icon": "" + } + ], + "routes": [ + { "path": "wordpress/*", "component": "WordPressExtension" } + ], + "page_titles": { + "/wordpress": "WordPress Sites", + "/wordpress/plugins/library": "WordPress Plugin Library", + "/wordpress/pipelines": "WordPress Pipelines" + }, + "command_palette": [ + { "label": "WordPress", "path": "/wordpress", "category": "Pages", "keywords": "wp sites" }, + { "label": "WordPress Pipelines", "path": "/wordpress/pipelines", "category": "Pages", "keywords": "wp environments projects pipeline" } + ] + } } diff --git a/docs/EXTRACTION_WORDPRESS_AUDIT.md b/docs/EXTRACTION_WORDPRESS_AUDIT.md index b3c1add4..403cf6f6 100644 --- a/docs/EXTRACTION_WORDPRESS_AUDIT.md +++ b/docs/EXTRACTION_WORDPRESS_AUDIT.md @@ -5,8 +5,10 @@ backend now lives in `builtin-extensions/serverkit-wordpress/` as a bundled, default-installed flagship (D4), loaded via an importlib bridge. See the Phase 5 section of `docs/plans/12_EXTENSIONS_PLATFORM_PLAN.md` for the shipped scope and deviations (models stay core; event-catalog + Fail2ban WP filter kept core as -two-speed items; frontend UI stays core — its tab-grouped conversion is the -scoped follow-up). Largest single move in the plan; done after Email (#32). +two-speed items). The **frontend UI is now contributed by the extension too** — a +single `wordpress/*` splat route self-renders the whole WordPress sub-router (tab +group + full-bleed detail), so the sidebar item, routes, palette, and page titles +all come from the manifest. Largest single move in the plan; done after Email (#32). **Verdict:** extractable, but WordPress has **real core hooks** that must be inverted/guarded first. WordPress ships as a bundled, default-installed, uninstallable extension (D4) — never a marketplace hunt. diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 3fb05122..2a2fe5ef 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -40,16 +40,10 @@ import { SERVICE_TABS } from './components/services/serviceTabs'; import { FILE_TABS } from './components/files/fileTabs'; import { MONITOR_TABS } from './components/monitoring/monitorTabs'; import { MARKET_TABS } from './components/marketplace/marketTabs'; -import { WORDPRESS_TABS } from './components/wordpress/wordpressTabs'; import { BACKUP_TABS } from './components/backups/backupTabs'; import { SECURITY_TABS } from './components/security/securityTabs'; import { ORG_TABS } from './components/organization/organizationTabs'; import Downloads from './pages/Downloads'; -import WordPress from './pages/WordPress'; -import WordPressDetail from './pages/WordPressDetail'; -import WordPressProjects from './pages/WordPressProjects'; -import WordPressPluginLibrary from './pages/WordPressPluginLibrary'; -import WordPressProject from './pages/WordPressProject'; import SSLCertificates from './pages/SSLCertificates'; import SSOCallback from './pages/SSOCallback'; import SourceConnectionCallback from './pages/SourceConnectionCallback'; @@ -81,7 +75,6 @@ import Telemetry from './pages/Telemetry'; import Jobs from './pages/Jobs'; import useExtensionRoutes from './plugins/ExtensionRoutes'; import { useContributions } from './plugins/contributions'; -import ModuleRoute from './components/ModuleRoute'; // Page title mapping const PAGE_TITLES = { @@ -94,9 +87,8 @@ const PAGE_TITLES = { '/projects': 'Projects', '/shared-variables': 'Shared Variables', '/fleet-proxy': 'Fleet Proxy', - '/wordpress': 'WordPress Sites', - '/wordpress/plugins/library': 'WordPress Plugin Library', - '/wordpress/pipelines': 'WordPress Pipelines', + // WordPress list-page titles come from the serverkit-wordpress manifest + // (page_titles) now; the dynamic detail-page fallbacks below stay in core. '/templates': 'Templates', '/deployments': 'Deployment Activity', '/domains': 'Domains', @@ -156,14 +148,6 @@ function LegacyAppRedirect() { return ; } -// "WordPress Projects" was renamed to "Pipelines" (§2 unification) to end the -// collision with generic /projects. Forward old deep links to the new space. -function LegacyWpPipelineRedirect() { - const { id, tab } = useParams(); - const suffix = [id, tab].filter(Boolean).join('/'); - return ; -} - function PageTitleUpdater() { const location = useLocation(); const { page_titles: pluginTitles } = useContributions(); @@ -336,24 +320,11 @@ function AppRoutes() { } /> } /> } /> - {/* WordPress routes are gated by the WordPress module toggle - (Settings → Modules); disabled ⇒ redirect to the dashboard. */} - }> - } /> - } /> - } /> - - } /> - } /> - {/* Legacy "WordPress Projects" URLs → Pipelines (§2). */} - } /> - } /> - } /> - } /> - } /> - {/* Settings sub-section in the URL (e.g. .../settings/git) so the - Settings left-nav is shareable and survives a refresh. */} - } /> + {/* WordPress moved into the serverkit-wordpress builtin extension + (Phase 5 #38). It contributes a single splat route wordpress/* + via its manifest and self-renders the whole sub-router (tab + group + full-bleed detail + legacy /projects redirects), so all + the WordPress routing now lives in the extension. */} {/* /workflow is now the serverkit-workflows builtin extension (contributes the route via its manifest, full layout). */} }> diff --git a/frontend/src/components/CommandPalette.jsx b/frontend/src/components/CommandPalette.jsx index 96b2aeb2..ab066729 100644 --- a/frontend/src/components/CommandPalette.jsx +++ b/frontend/src/components/CommandPalette.jsx @@ -19,8 +19,7 @@ const STATIC_PAGES = [ { label: 'SSL Certificates', path: '/ssl', category: 'Pages', keywords: 'https tls' }, { label: 'Templates', path: '/templates', category: 'Pages', keywords: 'deploy one-click' }, { label: 'Deployments', path: '/deployments', category: 'Pages', keywords: 'deploy jobs status logs' }, - { label: 'WordPress', path: '/wordpress', category: 'Pages', keywords: 'wp sites' }, - { label: 'WordPress Pipelines', path: '/wordpress/pipelines', category: 'Pages', keywords: 'wp environments projects pipeline' }, + // WordPress palette entries are contributed by the serverkit-wordpress extension. { label: 'Files', path: '/files', category: 'Pages', keywords: 'file manager explorer' }, { label: 'FTP Server', path: '/ftp', category: 'Pages', keywords: 'sftp upload' }, { label: 'Observability', path: '/monitoring', category: 'Pages', keywords: 'metrics uptime monitoring alerts' }, diff --git a/frontend/src/components/sidebarItems.js b/frontend/src/components/sidebarItems.js index 0246078b..23873308 100644 --- a/frontend/src/components/sidebarItems.js +++ b/frontend/src/components/sidebarItems.js @@ -86,19 +86,9 @@ export const SIDEBAR_ITEMS = [ category: 'infrastructure', icon: '' }, - { - // Redesign: WordPress uses the top-bar layout (REDESIGN_MAP §6 dec. 3). - // Pipeline now lives in the page's top bar (PageTopbar WORDPRESS_TABS), - // not as a sidebar sub-item. The pipeline list is at /wordpress/pipelines - // (renamed from /wordpress/projects in §2; old URLs redirect). - id: 'wordpress', - label: 'WordPress', - route: '/wordpress', - category: 'infrastructure', - // Hidden when an admin disables the WordPress module (Settings → Modules). - requiresCondition: 'wordpressEnabled', - icon: '' - }, + // WordPress is now the serverkit-wordpress builtin extension (Phase 5 #38); + // its sidebar item is contributed by the extension manifest (nav), so it + // disappears cleanly when the extension is uninstalled. // Workflow Builder is now the serverkit-workflows builtin extension; its // sidebar item is contributed by the extension manifest. { diff --git a/frontend/src/plugins/serverkit-wordpress/index.jsx b/frontend/src/plugins/serverkit-wordpress/index.jsx new file mode 100644 index 00000000..e1286b82 --- /dev/null +++ b/frontend/src/plugins/serverkit-wordpress/index.jsx @@ -0,0 +1,60 @@ +// WordPress UI, contributed through the extension system. The full WordPress +// backend (the /api/v1/wordpress* blueprints + services) lives in this +// extension's backend/; the page components stay in the host pages/ dir and are +// re-used here (same re-export pattern as serverkit-git/email/workflows) so +// their many relative imports keep resolving. +// +// After sync this file lives at frontend/src/plugins/serverkit-wordpress/ so the +// relative imports resolve against the host's src/ tree. +// +// The WordPress surface is a tab group + full-bleed detail pages. Contributed +// routes are flat (there's no way to contribute a shared TabGroupLayout parent +// inside the dashboard), so we contribute ONE splat route (`wordpress/*`) and +// this component self-renders the whole WordPress sub-router — reproducing the +// exact structure the core App.jsx used to own (TabGroupLayout + WORDPRESS_TABS +// over the three list pages; full-bleed detail/pipeline routes as siblings; +// the legacy /wordpress/projects → /wordpress/pipelines deprecation redirects). +import { Routes, Route, Navigate, useParams } from 'react-router-dom'; + +import TabGroupLayout from '../../layouts/TabGroupLayout'; +import { WORDPRESS_TABS } from '../../components/wordpress/wordpressTabs'; +import WordPress from '../../pages/WordPress'; +import WordPressPluginLibrary from '../../pages/WordPressPluginLibrary'; +import WordPressProjects from '../../pages/WordPressProjects'; +import WordPressProject from '../../pages/WordPressProject'; +import WordPressDetail from '../../pages/WordPressDetail'; + +// "WordPress Projects" was renamed to "Pipelines" (§2 unification). Forward old +// deep links to the new space. +function LegacyWpPipelineRedirect() { + const { id, tab } = useParams(); + const suffix = [id, tab].filter(Boolean).join('/'); + return ; +} + +export function WordPressExtension() { + return ( + + {/* Tab group — list surfaces share one PageTopbar + WORDPRESS_TABS. */} + }> + } /> + } /> + } /> + + {/* Full-bleed pipeline detail (own chrome, outside the tab group). */} + } /> + } /> + {/* Legacy "WordPress Projects" URLs → Pipelines (§2). */} + } /> + } /> + } /> + {/* Full-bleed site detail (own chrome, outside the tab group). The + :tab/:section depth keeps the Settings sub-nav shareable. */} + } /> + } /> + } /> + + ); +} + +export default WordPressExtension; diff --git a/frontend/src/plugins/serverkit-wordpress/plugin.json b/frontend/src/plugins/serverkit-wordpress/plugin.json new file mode 100644 index 00000000..df5a463c --- /dev/null +++ b/frontend/src/plugins/serverkit-wordpress/plugin.json @@ -0,0 +1,75 @@ +{ + "name": "serverkit-wordpress", + "display_name": "WordPress", + "version": "1.0.0", + "description": "The full WordPress suite — site provisioning, plugin library, environments/pipelines, updates, security hardening, vulnerability scanning, analytics and reports. Ships bundled and installed by default (a flagship), and can be uninstalled to slim the core.", + "author": "ServerKit", + "license": "MIT", + "category": "integration", + "homepage": "https://github.com/jhd3197/ServerKit", + "permissions": [ + "shell", + "filesystem", + "network", + "docker", + "database" + ], + "min_panel_version": "1.7.0", + "entry_point": "wordpress:wordpress_bp", + "url_prefix": "/api/v1/wordpress", + "extra_blueprints": [ + { + "module": "wordpress_sites", + "attr": "wordpress_sites_bp", + "url_prefix": "/api/v1/wordpress" + }, + { + "module": "environment_pipeline", + "attr": "environment_pipeline_bp", + "url_prefix": "/api/v1/wordpress/projects" + }, + { + "module": "environment_pipeline", + "attr": "environment_pipeline_bp", + "url_prefix": "/api/v1/wordpress/pipelines", + "name": "environment_pipeline_pipelines" + } + ], + "icon": "", + "contributions": { + "nav": [ + { + "id": "wordpress", + "label": "WordPress", + "route": "/wordpress", + "category": "infrastructure", + "icon": "" + } + ], + "routes": [ + { + "path": "wordpress/*", + "component": "WordPressExtension" + } + ], + "page_titles": { + "/wordpress": "WordPress Sites", + "/wordpress/plugins/library": "WordPress Plugin Library", + "/wordpress/pipelines": "WordPress Pipelines" + }, + "command_palette": [ + { + "label": "WordPress", + "path": "/wordpress", + "category": "Pages", + "keywords": "wp sites" + }, + { + "label": "WordPress Pipelines", + "path": "/wordpress/pipelines", + "category": "Pages", + "keywords": "wp environments projects pipeline" + } + ] + } +}