ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
feat(extensions): Phase 5 — extract WordPress into serverkit-wordpress (backend)
Juan Denisa55e50bc160e
diff --git a/.gitignore b/.gitignoreindex ab71d70e..a925fa98 100644--- a/.gitignore+++ b/.gitignore@@ -13,6 +13,12 @@/frontend/out//frontend/build/+# Python (anywhere, incl. builtin-extensions/*/backend)+__pycache__/+*.pyc+*.pyo+*.pyd+# Python / Backend/backend/venv//backend/instance/diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 11247544..e8d6aa0e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -20,6 +20,19 @@ awaiting a stable release:### Added+- **Extensions platform (Phase 5 — WordPress is now a bundled extension)** — the+ entire WordPress backend (site provisioning, plugin library, environments/+ pipelines, updates, security, vulnerability scanning, analytics & reports, and+ the `/api/v1/wordpress` API family) has moved out of core into the+ **`serverkit-wordpress`** extension. Because WordPress is a flagship, it ships+ **installed by default on every panel** and can be uninstalled to slim the core —+ it never becomes a Marketplace hunt (decision D4). API paths are unchanged+ (`/api/v1/wordpress`, `/projects`, and the `/pipelines` alias all survive, D9),+ and every WordPress model stays core so backups, Fail2ban, status pages, and+ 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.- **Extensions platform (Phase 4 — Email is now an extension)** — the mail-serverstack (Postfix/Dovecot, domains, mailboxes, DKIM/SpamAssassin, Roundcube webmail,and the `/api/v1/email` API) has moved out of core into the bundleddiff --git a/backend/app/__init__.py b/backend/app/__init__.pyindex 2d80bdc9..6de54c4f 100644--- a/backend/app/__init__.py+++ b/backend/app/__init__.py@@ -141,24 +141,15 @@ def create_app(config_name=None):app.register_blueprint(nginx_bp, url_prefix='/api/v1/nginx')app.register_blueprint(ssl_bp, url_prefix='/api/v1/ssl')- # Register blueprints - PHP & WordPress+ # Register blueprints - PHPfrom app.api.php import php_bp- from app.api.wordpress import wordpress_bp- from app.api.wordpress_sites import wordpress_sites_bp- from app.api.environment_pipeline import environment_pipeline_bpapp.register_blueprint(php_bp, url_prefix='/api/v1/php')- # WordPress is a toggleable module (#14): 503 its API when disabled.- from app.services.module_service import attach_module_guard- attach_module_guard(wordpress_bp, 'wordpress')- attach_module_guard(wordpress_sites_bp, 'wordpress')- attach_module_guard(environment_pipeline_bp, 'wordpress')- app.register_blueprint(wordpress_bp, url_prefix='/api/v1/wordpress')- app.register_blueprint(wordpress_sites_bp, url_prefix='/api/v1/wordpress')- app.register_blueprint(environment_pipeline_bp, url_prefix='/api/v1/wordpress/projects')- # "WordPress Projects" was renamed to "Pipelines" (§2 unification). Mount the- # same blueprint under /wordpress/pipelines as a true alias so both URL- # spaces resolve identically during the deprecation window.- app.register_blueprint(environment_pipeline_bp, url_prefix='/api/v1/wordpress/pipelines', name='environment_pipeline_pipelines')+ # WordPress moved into the bundled, default-installed `serverkit-wordpress`+ # extension (#38). Its blueprints (wordpress / wordpress_sites /+ # environment_pipeline, keeping the /api/v1/wordpress[/projects|/pipelines]+ # prefixes per D9, incl. the /pipelines alias) are registered from the+ # extension by the plugin loader — seeded as a flagship in create_app. The old+ # `wordpress` module toggle is retired; the plugin status guard is the gate.# Register blueprints - Pythonfrom app.api.python import python_bpdiff --git a/backend/app/services/module_service.py b/backend/app/services/module_service.pyindex fc448d41..13d75647 100644--- a/backend/app/services/module_service.py+++ b/backend/app/services/module_service.py@@ -16,15 +16,12 @@ logger = logging.getLogger(__name__)# name -> presentation metadata. The settings key is module_<name>_enabled.#-# Email used to be a module toggle here; it's now the serverkit-email extension-# (Phase 4, #32) — install/disable it from the Marketplace instead. WordPress-# remains a core module toggle until its own extraction (Phase 5, #38).-MODULES = {- 'wordpress': {- 'label': 'WordPress',- 'description': 'WordPress site management, plugin library, and the /api/v1/wordpress API.',- },-}+# Email and WordPress used to be module toggles here; both are now bundled+# extensions (serverkit-email #32, serverkit-wordpress #38) — install/uninstall+# them from the Marketplace instead, and the plugin status guard gates their APIs.+# The map is intentionally empty now; the machinery below stays so future+# core-vertical toggles can be added without re-plumbing.+MODULES = {}def _setting_key(name):diff --git a/backend/app/services/plugin_service.py b/backend/app/services/plugin_service.pyindex 4ea66c94..e06da30f 100644--- a/backend/app/services/plugin_service.py+++ b/backend/app/services/plugin_service.py@@ -721,7 +721,13 @@ def _register_extra_blueprints(register, plugin, manifest):mod = importlib.import_module(full_module)bp = getattr(mod, attr)_attach_status_guard(bp, plugin.slug)- register(bp, url_prefix=url_prefix, name=name)+ # Only pass name= when the manifest supplies one (mounting the SAME+ # blueprint at a second prefix needs a distinct name, e.g. the WordPress+ # /pipelines alias); passing name=None would clobber the blueprint name.+ opts = {'url_prefix': url_prefix}+ if name:+ opts['name'] = name+ register(bp, **opts)logger.info(f'Registered extra blueprint {attr} at {url_prefix}'+ (f' (as {name})' if name else ''))@@ -764,7 +770,18 @@ def _regenerate_frontend_manifest():plugin install where no frontend was ever extracted, or a Dockerpanel without the bind mount), we just log and move on rather thanfailing the install.++ Never runs under the testing config: the test DB only has whatever a given+ test installed, so regenerating would clobber the repo's checked-in+ plugins-manifest.json with partial state (the flagship seed runs on every+ test boot). Tests that care about the manifest monkeypatch the dir."""+ try:+ from flask import current_app+ if current_app and current_app.config.get('TESTING'):+ return+ except Exception:+ passif not os.path.isdir(FRONTEND_PLUGINS_DIR):logger.info(f'Skipping frontend manifest regeneration: '@@ -1259,10 +1276,15 @@ def _seed_flagship_row(entry):logger.warning(f'Flagship lifecycle setup for {slug}: {e}')_refresh_plugin_ai(plugin)- try:- _regenerate_frontend_manifest()- except Exception as e:- logger.warning(f'Frontend manifest regen after flagship seed for {slug}: {e}')+ # Only touch the frontend build manifest if the flagship actually ships a+ # frontend (WordPress is backend-only — its UI stays core for now). A+ # pre-bundled flagship frontend (D5) is already represented in the checked-in+ # manifest, so there's nothing to regenerate here.+ if plugin.has_frontend:+ try:+ _regenerate_frontend_manifest()+ except Exception as e:+ logger.warning(f'Frontend manifest regen after flagship seed for {slug}: {e}')logger.info(f'Seeded flagship extension row: {slug} v{manifest["version"]}')return plugin@@ -1285,7 +1307,15 @@ def seed_flagship_extensions():# Make the backend importable in-place regardless (the bridge and the# loader both rely on app.plugins.<slug> resolving)._ensure_builtin_backend_importable(slug)- if InstalledPlugin.query.filter_by(slug=slug).first():+ existing = InstalledPlugin.query.filter_by(slug=slug).first()+ if existing:+ # Heal a row left in ERROR by a prior failed load so the flagship+ # comes back active on the next boot (the seed is authoritative for a+ # flagship the user hasn't uninstalled). A deliberate DISABLE is kept.+ if existing.status == InstalledPlugin.STATUS_ERROR:+ existing.status = InstalledPlugin.STATUS_ACTIVE+ existing.error_message = None+ db.session.commit()continuetry:_seed_flagship_row(entry)diff --git a/backend/tests/test_app_wordpress_surface.py b/backend/tests/test_app_wordpress_surface.pyindex b53e6a07..8bb2dbdc 100644--- a/backend/tests/test_app_wordpress_surface.py+++ b/backend/tests/test_app_wordpress_surface.py@@ -7,6 +7,8 @@ docker-compose paths that key on app_type=='docker' are unaffected."""import pytest+from app.services import wordpress_bridge+def _seed_app(app, *, wordpress=True):from app import db@@ -62,7 +64,7 @@ def test_db_snapshots_list_empty(app, client, auth_headers):def test_db_snapshot_create_and_delete(app, client, auth_headers, monkeypatch):from app.services.db_sync_service import DatabaseSyncService- from app.services.wordpress_env_service import WordPressEnvService+ WordPressEnvService = wordpress_bridge.get('wordpress_env_service', 'WordPressEnvService')monkeypatch.setattr(WordPressEnvService, '_get_db_password', staticmethod(lambda site: 'pw'))monkeypatch.setattr(DatabaseSyncService, 'create_snapshot', staticmethod(diff --git a/backend/tests/test_attach_domain.py b/backend/tests/test_attach_domain.pyindex 4a81f8fb..a26637e9 100644--- a/backend/tests/test_attach_domain.py+++ b/backend/tests/test_attach_domain.py@@ -4,6 +4,7 @@ Attaching a user-owned domain auto-creates its A record via a connected DNSprovider (or returns the record to add manually), then migrates the site to itby reusing the URL-swap tool."""+from app.services import wordpress_bridgedef _mk_user(db, username='owner'):@@ -98,7 +99,7 @@ def test_ensure_a_record_no_ip(app):def test_attach_auto_dns_and_migrate(app, monkeypatch):from app import dbfrom app.services.dns_provider_service import DNSProviderService- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db)app_row = _mk_site_app(db, user.id, host='old.lvh.me')@@ -127,7 +128,7 @@ def test_attach_auto_dns_and_migrate(app, monkeypatch):def test_attach_manual_dns_surfaces_record(app, monkeypatch):from app import dbfrom app.services.dns_provider_service import DNSProviderService- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db, 'o2')app_row = _mk_site_app(db, user.id, name='shop', host='old.lvh.me')@@ -150,7 +151,7 @@ def test_attach_with_ssl_migrates_https(app, monkeypatch):import app.services.ssl_service as ssl_modimport app.services.nginx_service as nginx_modfrom app.services.dns_provider_service import DNSProviderService- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db, 'o3')app_row = _mk_site_app(db, user.id, name='sec', host='old.lvh.me')@@ -177,7 +178,7 @@ def test_attach_without_migrate_sets_primary_domain(app, monkeypatch):import app.services.nginx_service as nginx_modfrom app.models.domain import Domainfrom app.services.dns_provider_service import DNSProviderService- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db, 'o4')app_row = _mk_site_app(db, user.id, name='nomig', host='old.lvh.me')diff --git a/backend/tests/test_fail2ban_jail_service.py b/backend/tests/test_fail2ban_jail_service.pyindex 3b076118..1f2c9d04 100644--- a/backend/tests/test_fail2ban_jail_service.py+++ b/backend/tests/test_fail2ban_jail_service.py@@ -13,6 +13,7 @@ import pytestfrom app.services.fail2ban_jail_service import Fail2banJailService as F2Bfrom app.services.nginx_service import NginxService+from app.services import wordpress_bridgedef _app(name='myblog'):@@ -172,7 +173,7 @@ def test_get_status_shape_when_jail_absent():# ---------- WpSecurityService wrapper ----------def test_wp_security_set_brute_force_delegates_to_jail_service():- from app.services.wp_security_service import WpSecurityService+ WpSecurityService = wordpress_bridge.get('wp_security_service', 'WpSecurityService')app = _app('myblog')site = types.SimpleNamespace(application=app)with patch.object(F2B, 'enable_wp_jail', return_value={'success': True}) as en, \@@ -185,7 +186,7 @@ def test_wp_security_set_brute_force_delegates_to_jail_service():def test_wp_security_brute_force_handles_missing_application():- from app.services.wp_security_service import WpSecurityService+ WpSecurityService = wordpress_bridge.get('wp_security_service', 'WpSecurityService')site = types.SimpleNamespace(application=None)assert WpSecurityService.set_brute_force(site, True)['success'] is Falseassert WpSecurityService.get_brute_force(site)['no_application'] is Truediff --git a/backend/tests/test_module_toggles.py b/backend/tests/test_module_toggles.pyindex 77053ade..bae4e055 100644--- a/backend/tests/test_module_toggles.py+++ b/backend/tests/test_module_toggles.py@@ -1,46 +1,32 @@-"""Module toggles (#14): hide/503 a core vertical on demand.--Email used to be a module toggle; it's now the serverkit-email extension (#32),-so WordPress is the remaining core module and drives these tests.+"""Module toggles (#14): the generic core-vertical toggle machinery.++Email (#32) and WordPress (#38) both graduated from module toggles to bundled+extensions (serverkit-email / serverkit-wordpress), so the MODULES map is now+empty. Their APIs are gated by the plugin status guard instead — proven in+test_wordpress_extraction.py / test_email_extraction.py. These tests keep the+generic toggle machinery honest so a future core-vertical toggle can be added+without re-plumbing."""from app.services import module_service-def test_modules_default_enabled(app, client, auth_headers):+def test_modules_default_empty(app, client, auth_headers):resp = client.get('/api/v1/modules', headers=auth_headers)assert resp.status_code == 200mods = {m['name']: m for m in resp.get_json()['modules']}- assert mods['wordpress']['enabled'] is True- # Email is no longer a module toggle (it's an extension now).+ # WordPress and Email are extensions now, not module toggles.+ assert 'wordpress' not in modsassert 'email' not in mods-def test_toggle_requires_admin_body(app, client, auth_headers):- resp = client.put('/api/v1/modules/wordpress', headers=auth_headers, json={})- assert resp.status_code == 400--def test_unknown_module_404(app, client, auth_headers):resp = client.put('/api/v1/modules/nope', headers=auth_headers, json={'enabled': False})assert resp.status_code == 404-def test_wordpress_api_503s_when_module_disabled(app, client, auth_headers):- # Enabled → the wordpress route is reachable (any status that isn't 503).- resp = client.get('/api/v1/wordpress/sites', headers=auth_headers)- assert resp.status_code != 503-- # Disable via the API, then the same route is guarded with 503.- toggle = client.put('/api/v1/modules/wordpress', headers=auth_headers, json={'enabled': False})- assert toggle.status_code == 200- assert toggle.get_json()['enabled'] is False-- resp = client.get('/api/v1/wordpress/sites', headers=auth_headers)- assert resp.status_code == 503- assert resp.get_json()['module'] == 'wordpress'-- # Re-enable restores it.- client.put('/api/v1/modules/wordpress', headers=auth_headers, json={'enabled': True})+def test_wordpress_api_reachable_via_extension(app, client, auth_headers):+ """WordPress ships as a default-installed flagship extension, so its API is+ reachable (not 503) on a stock panel — no module toggle stands in front."""resp = client.get('/api/v1/wordpress/sites', headers=auth_headers)assert resp.status_code != 503diff --git a/backend/tests/test_site_routing.py b/backend/tests/test_site_routing.pyindex 5f1bed4d..7eeecaeb 100644--- a/backend/tests/test_site_routing.py+++ b/backend/tests/test_site_routing.py@@ -4,6 +4,7 @@ Managed sites are published at a real hostname (<slug>.<base_domain>) insteadof localhost:<port>: SiteDomainService resolves the host, and WordPressServiceprovisions a primary Domain row + nginx reverse-proxy vhost."""+from app.services import wordpress_bridgedef _mk_user(db, username='owner'):@@ -60,7 +61,7 @@ def test_provision_routing_creates_primary_domain_and_docker_vhost(app, monkeypafrom app import dbfrom app.models.domain import Domainfrom app.services import nginx_service- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db)app_row = _mk_app(db, user.id, name='blog', port=8300)@@ -93,7 +94,7 @@ def test_provision_routing_warns_when_nginx_unavailable(app, monkeypatch):from app import dbfrom app.models.domain import Domainfrom app.services import nginx_service- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db, 'owner2')app_row = _mk_app(db, user.id, name='shop', port=8400)@@ -110,7 +111,7 @@ def test_provision_routing_warns_when_nginx_unavailable(app, monkeypatch):def test_canonical_site_url_prefers_primary_domain(app):from app import dbfrom app.models.domain import Domain- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db, 'owner3')app_row = _mk_app(db, user.id, name='acme', port=8500)diff --git a/backend/tests/test_sites_https.py b/backend/tests/test_sites_https.pyindex 07e5b5ac..a45def9d 100644--- a/backend/tests/test_sites_https.py+++ b/backend/tests/test_sites_https.py@@ -4,6 +4,7 @@ A one-time setup creates the *.<base> + <base> A records via a connected DNSprovider and issues a wildcard cert, after which managed subdomain vhosts serveTLS from it."""+from app.services import wordpress_bridgedef _mk_user(db, username='owner'):@@ -189,7 +190,7 @@ def test_write_vhost_uses_wildcard_cert_when_https_enabled(app, monkeypatch):from app import dbfrom app.models.system_settings import SystemSettingsfrom app.services import nginx_service- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db)app_row = _mk_app(db, user.id, host='blog.lvh.me') # covered by the lvh.me wildcard@@ -211,7 +212,7 @@ def test_write_vhost_no_wildcard_for_custom_domain(app, monkeypatch):from app.models.domain import Domainfrom app.models.system_settings import SystemSettingsfrom app.services import nginx_service- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db, 'o2')app_row = _mk_app(db, user.id, name='shop', host='blog.lvh.me')diff --git a/backend/tests/test_url_swap.py b/backend/tests/test_url_swap.pyindex 70fcf28b..63cb5ebd 100644--- a/backend/tests/test_url_swap.py+++ b/backend/tests/test_url_swap.py@@ -3,6 +3,7 @@Changing a site's URL is a serialization-safe DB rewrite (WP-CLI search-replace),backed up first and rolled back on failure, then a Domain/nginx re-point."""+from app.services import wordpress_bridgedef _mk_user(db, username='owner'):@@ -31,7 +32,7 @@ def _mk_site_app(db, user_id, name='blog', port=8300, host='blog.lvh.me'):# ── pure helpers ────────────────────────────────────────────────────────────def test_normalize_url():- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')assert WordPressService._normalize_url('example.com') == 'http://example.com'assert WordPressService._normalize_url('https://example.com/') == 'https://example.com'assert WordPressService._normalize_url(' https://a.com/blog/ ') == 'https://a.com/blog'@@ -40,7 +41,7 @@ def test_normalize_url():def test_url_swap_pairs():- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')# Host change -> full-URL pair (covers scheme) + host-only pair.assert WordPressService._url_swap_pairs('http://old.com', 'https://new.com') == [('http://old.com', 'https://new.com'), ('old.com', 'new.com')]@@ -50,7 +51,7 @@ def test_url_swap_pairs():def test_parse_sr_count():- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')assert WordPressService._parse_sr_count('Success: 12 replacements to be made.') == 12assert WordPressService._parse_sr_count('Table\tx\nSuccess: Made 1,234 replacements.') == 1234assert WordPressService._parse_sr_count('') == 0@@ -61,7 +62,7 @@ def test_parse_sr_count():def test_preview_counts_per_pair(app, monkeypatch):from app import db- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db)app_row = _mk_site_app(db, user.id, host='old.lvh.me')@@ -85,7 +86,7 @@ def test_preview_counts_per_pair(app, monkeypatch):def test_preview_rejects_same_url(app, monkeypatch):from app import db- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db, 'o2')app_row = _mk_site_app(db, user.id, host='same.lvh.me')monkeypatch.setattr(WordPressService, 'wp_cli',@@ -101,7 +102,7 @@ def test_change_url_happy_path_repoints_domain(app, monkeypatch):from app import dbfrom app.models.domain import Domainfrom app.services import nginx_service- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db, 'o3')app_row = _mk_site_app(db, user.id, name='shop', host='old.lvh.me')@@ -135,7 +136,7 @@ def test_change_url_happy_path_repoints_domain(app, monkeypatch):def test_change_url_rolls_back_on_failure(app, monkeypatch):from app import db- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db, 'o4')app_row = _mk_site_app(db, user.id, name='blogx', host='old.lvh.me')@@ -167,7 +168,7 @@ def test_change_url_rolls_back_on_failure(app, monkeypatch):def test_change_url_aborts_if_backup_fails(app, monkeypatch):from app import db- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db, 'o5')app_row = _mk_site_app(db, user.id, name='blogy', host='old.lvh.me')@@ -185,7 +186,7 @@ def test_change_url_aborts_if_backup_fails(app, monkeypatch):def test_repoint_keep_old_demotes_but_keeps(app):from app import dbfrom app.models.domain import Domain- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')user = _mk_user(db, 'o6')app_row = _mk_site_app(db, user.id, name='keepblog', host='old.lvh.me')@@ -201,7 +202,7 @@ def test_repoint_keep_old_demotes_but_keeps(app):def test_url_preview_api_smoke(app, client, auth_headers, monkeypatch):from app import dbfrom app.models import User- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')admin = User.query.filter_by(username='testadmin').first()app_row = _mk_site_app(db, admin.id, name='apisite', host='api.lvh.me')diff --git a/backend/tests/test_wordpress_extraction.py b/backend/tests/test_wordpress_extraction.pynew file mode 100644index 00000000..68306348--- /dev/null+++ b/backend/tests/test_wordpress_extraction.py@@ -0,0 +1,85 @@+"""Prove the WordPress extraction (Phase 5, #38).++WordPress physically moved out of core into the bundled, default-installed+``serverkit-wordpress`` extension (a flagship, D4). Unlike a niche extension it+ships installed on every panel, so the proof is the mirror of the Email one:++* the WordPress *services* are gone from ``app.services`` (physical move);+* they load instead from the dashed package ``app.plugins.serverkit-wordpress``+ via the importlib bridge — in-place, no copy (dev/test loadability);+* a stock panel has the ``/api/v1/wordpress`` blueprints registered *from the+ extension* (seeded flagship), including the ``/pipelines`` alias and+ ``/projects`` mounts (D9);+* uninstall records the user's choice and NEVER deletes the tracked builtin /+ pre-bundled files.+"""+import importlib+import os++import pytest++from app.models.plugin import InstalledPlugin+from app.services import plugin_service, wordpress_bridge++SLUG = 'serverkit-wordpress'+++def test_wordpress_services_left_core():+ """The WordPress service files no longer exist under app.services."""+ for mod in ('wordpress_service', 'git_wordpress_service',+ 'wordpress_env_service', 'wp_update_service'):+ with pytest.raises(ModuleNotFoundError):+ importlib.import_module(f'app.services.{mod}')+++def test_core_services_pkg_drops_wordpress_export():+ import app.services as services_pkg+ assert 'WordPressService' not in getattr(services_pkg, '__all__', [])+ assert not hasattr(services_pkg, 'WordPressService')+++def test_bridge_resolves_from_extension_in_place():+ """The bridge loads WordPressService from the dashed extension package,+ without the plugin being copy-installed under app/plugins/."""+ WordPressService = wordpress_bridge.wordpress_service()+ assert WordPressService.__name__ == 'WordPressService'+ assert WordPressService.__module__.startswith(f'app.plugins.{SLUG}')+++def test_wordpress_seeded_as_flagship(app):+ """A stock panel ships WordPress installed-by-default (D4)."""+ plugin = InstalledPlugin.query.filter_by(slug=SLUG).first()+ assert plugin is not None, 'WordPress flagship should be seeded on boot'+ assert plugin.status == InstalledPlugin.STATUS_ACTIVE+ assert plugin.has_backend is True+ assert plugin.url_prefix == '/api/v1/wordpress'+++def test_wordpress_blueprints_registered_from_extension(app):+ rules = [r.rule for r in app.url_map.iter_rules()]+ wp_rules = [r for r in rules if r.startswith('/api/v1/wordpress')]+ assert wp_rules, 'WordPress API should be registered from the extension'+ # D9: the /projects and /pipelines (alias) mounts both survive the move.+ assert any(r.startswith('/api/v1/wordpress/projects') for r in wp_rules)+ assert any(r.startswith('/api/v1/wordpress/pipelines') for r in wp_rules)+++def test_wordpress_api_responds_not_404_or_503(app, client, auth_headers):+ """The extension's blueprint is live: /sites is wired (not 404) and its+ status guard passes for the active flagship (not 503)."""+ resp = client.get('/api/v1/wordpress/sites', headers=auth_headers)+ assert resp.status_code not in (404, 503), resp.status_code+++def test_uninstall_flagship_keeps_tracked_files_and_marks(app):+ plugin = InstalledPlugin.query.filter_by(slug=SLUG).first()+ assert plugin is not None+ builtin_init = os.path.join(+ plugin_service.BUILTIN_EXTENSIONS_DIR, SLUG, 'backend', '__init__.py')+ assert os.path.isfile(builtin_init)++ assert plugin_service.uninstall_plugin(plugin.id) is True+ # Row gone, marker set, and the tracked builtin source is untouched.+ assert InstalledPlugin.query.filter_by(slug=SLUG).first() is None+ assert SLUG in plugin_service._flagship_uninstalled_set()+ assert os.path.isfile(builtin_init), 'uninstall must not delete builtin files'diff --git a/backend/tests/test_wp_import_zip.py b/backend/tests/test_wp_import_zip.pyindex 8e5abb32..73f95211 100644--- a/backend/tests/test_wp_import_zip.py+++ b/backend/tests/test_wp_import_zip.py@@ -3,6 +3,8 @@ and the container-copy flow (docker cp mocked; extraction/resolution is real).""import osimport zipfile+from app.services import wordpress_bridge+def _make_zip(path, entries):"""entries: {arcname: content_str}."""@@ -14,7 +16,7 @@ def _make_zip(path, entries):# ---- zip-slip safety -------------------------------------------------------def test_safe_extract_rejects_parent_traversal(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')z = tmp_path / 'evil.zip'_make_zip(str(z), {'../escape.txt': 'x', 'wp-content/ok.txt': 'y'})dest = tmp_path / 'out'@@ -25,7 +27,7 @@ def test_safe_extract_rejects_parent_traversal(tmp_path):def test_safe_extract_rejects_deep_traversal(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')z = tmp_path / 'evil2.zip'_make_zip(str(z), {'wp-content/../../../../tmp/evil.txt': 'x'})dest = tmp_path / 'out2'@@ -35,7 +37,7 @@ def test_safe_extract_rejects_deep_traversal(tmp_path):def test_safe_extract_ok(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')z = tmp_path / 'good.zip'_make_zip(str(z), {'wp-content/plugins/p/p.php': '<?php','wp-content/themes/t/style.css': 'body{}'})@@ -47,7 +49,7 @@ def test_safe_extract_ok(tmp_path):def test_safe_extract_rejects_bad_zip(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')bad = tmp_path / 'notazip.zip'bad.write_text('this is not a zip')dest = tmp_path / 'out4'@@ -59,26 +61,26 @@ def test_safe_extract_rejects_bad_zip(tmp_path):# ---- wp-content resolution (3 archive layouts) -----------------------------def test_resolve_wp_content_at_root(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')(tmp_path / 'wp-content' / 'plugins').mkdir(parents=True)assert WordPressService._resolve_wp_content_dir(str(tmp_path)) == str(tmp_path / 'wp-content')def test_resolve_full_site_wrapper_folder(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')(tmp_path / 'mysite' / 'wp-content' / 'themes').mkdir(parents=True)assert WordPressService._resolve_wp_content_dir(str(tmp_path)) == str(tmp_path / 'mysite' / 'wp-content')def test_resolve_root_is_wp_content(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')(tmp_path / 'plugins').mkdir()(tmp_path / 'themes').mkdir()assert WordPressService._resolve_wp_content_dir(str(tmp_path)) == str(tmp_path)def test_resolve_none_when_unrecognizable(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')(tmp_path / 'random').mkdir()assert WordPressService._resolve_wp_content_dir(str(tmp_path)) is None@@ -86,8 +88,8 @@ def test_resolve_none_when_unrecognizable(tmp_path):# ---- container copy flow (docker cp mocked) --------------------------------def test_import_wp_content_zip_issues_cp_and_chown(tmp_path, monkeypatch):- from app.services.wordpress_service import WordPressService- import app.services.wordpress_service as wp_mod+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')+ wp_mod = wordpress_bridge.load('wordpress_service')z = tmp_path / 'c.zip'_make_zip(str(z), {'wp-content/plugins/p/p.php': '<?php'})@@ -106,8 +108,8 @@ def test_import_wp_content_zip_issues_cp_and_chown(tmp_path, monkeypatch):def test_import_wp_content_zip_propagates_cp_failure(tmp_path, monkeypatch):- from app.services.wordpress_service import WordPressService- import app.services.wordpress_service as wp_mod+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')+ wp_mod = wordpress_bridge.load('wordpress_service')z = tmp_path / 'c.zip'_make_zip(str(z), {'wp-content/uploads/x.jpg': 'data'})@@ -122,7 +124,7 @@ def test_import_wp_content_zip_propagates_cp_failure(tmp_path, monkeypatch):def test_import_wp_content_zip_no_wp_content_found(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')z = tmp_path / 'empty.zip'_make_zip(str(z), {'readme.txt': 'hello'})# No subprocess mock needed: resolution fails before any docker call.diff --git a/backend/tests/test_wp_php_errors.py b/backend/tests/test_wp_php_errors.pyindex a326e8ac..0118a5ed 100644--- a/backend/tests/test_wp_php_errors.py+++ b/backend/tests/test_wp_php_errors.py@@ -1,4 +1,5 @@"""Tests for #25 PHP-fatals ingest — parsing the WP_DEBUG log (docker exec mocked)."""+from app.services import wordpress_bridge_SAMPLE = ('__SK_WPDEBUG__\n'@@ -22,12 +23,12 @@ class _Res:def _mock_run(monkeypatch, rc, out):- import app.services.wp_analytics_service as mod+ mod = wordpress_bridge.load('wp_analytics_service')monkeypatch.setattr(mod.subprocess, 'run', lambda *a, **k: _Res(rc, out))def test_classify_php_levels():- from app.services.wp_analytics_service import WpAnalyticsService as W+ W = wordpress_bridge.get('wp_analytics_service', 'WpAnalyticsService')assert W._classify_php('Fatal error') == 'fatal'assert W._classify_php('Parse error') == 'fatal'assert W._classify_php('Recoverable fatal error') == 'fatal'@@ -38,7 +39,7 @@ def test_classify_php_levels():def test_get_php_errors_parses_and_skips_stack_traces(monkeypatch):- from app.services.wp_analytics_service import WpAnalyticsService+ WpAnalyticsService = wordpress_bridge.get('wp_analytics_service', 'WpAnalyticsService')_mock_run(monkeypatch, 0, _SAMPLE)out = WpAnalyticsService.get_php_errors('site')assert out['available'] is True and out['enabled'] is True@@ -50,7 +51,7 @@ def test_get_php_errors_parses_and_skips_stack_traces(monkeypatch):def test_get_php_errors_logging_off(monkeypatch):- from app.services.wp_analytics_service import WpAnalyticsService+ WpAnalyticsService = wordpress_bridge.get('wp_analytics_service', 'WpAnalyticsService')_mock_run(monkeypatch, 0, '') # no marker => log file absentout = WpAnalyticsService.get_php_errors('site')assert out['available'] is False@@ -58,7 +59,7 @@ def test_get_php_errors_logging_off(monkeypatch):def test_get_php_errors_on_but_empty(monkeypatch):- from app.services.wp_analytics_service import WpAnalyticsService+ WpAnalyticsService = wordpress_bridge.get('wp_analytics_service', 'WpAnalyticsService')_mock_run(monkeypatch, 0, '__SK_WPDEBUG__\n') # log exists, no entriesout = WpAnalyticsService.get_php_errors('site')assert out['available'] is True and out['total'] == 0@@ -66,20 +67,20 @@ def test_get_php_errors_on_but_empty(monkeypatch):def test_get_php_errors_container_unavailable(monkeypatch):- from app.services.wp_analytics_service import WpAnalyticsService+ WpAnalyticsService = wordpress_bridge.get('wp_analytics_service', 'WpAnalyticsService')_mock_run(monkeypatch, 1, '') # docker exec non-zero (stopped / missing)out = WpAnalyticsService.get_php_errors('site')assert out['available'] is False and 'unavailable' in out['note']def test_get_php_errors_no_container():- from app.services.wp_analytics_service import WpAnalyticsService+ WpAnalyticsService = wordpress_bridge.get('wp_analytics_service', 'WpAnalyticsService')out = WpAnalyticsService.get_php_errors(None)assert out['available'] is False and out['total'] == 0def test_message_truncation(monkeypatch):- from app.services.wp_analytics_service import WpAnalyticsService+ WpAnalyticsService = wordpress_bridge.get('wp_analytics_service', 'WpAnalyticsService')long = 'x' * 500_mock_run(monkeypatch, 0, f'__SK_WPDEBUG__\n[1 UTC] PHP Fatal error: {long}\n')out = WpAnalyticsService.get_php_errors('site')diff --git a/backend/tests/test_wp_php_limits.py b/backend/tests/test_wp_php_limits.pyindex 1fe8050b..b6e8e745 100644--- a/backend/tests/test_wp_php_limits.py+++ b/backend/tests/test_wp_php_limits.py@@ -4,6 +4,8 @@ file-rendering, compose-mutation, merge, and injection-rejection logic is real."import osimport yaml+from app.services import wordpress_bridge+def _compose_site(tmp_path):"""A minimal Docker-stack WP site dir with a docker-compose.yml."""@@ -18,7 +20,7 @@ def _compose_site(tmp_path):def _mock_docker(monkeypatch):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')from app.services.docker_service import DockerServicemonkeypatch.setattr(DockerService, 'compose_up', lambda *a, **k: {'success': True})monkeypatch.setattr(DockerService, 'compose_restart', lambda *a, **k: {'success': True})@@ -29,13 +31,13 @@ def _mock_docker(monkeypatch):# ---- validation / injection rejection (no Docker needed) -------------------def test_rejects_unknown_directive(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')res = WordPressService.set_php_limits(_compose_site(tmp_path), {'evil_directive': '1'})assert res['success'] is False and 'Unknown PHP limit' in res['error']def test_rejects_injection_value(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')# A newline-smuggled extra directive must not pass validation.res = WordPressService.set_php_limits(_compose_site(tmp_path),{'memory_limit': '256M\nevil = 1'})@@ -45,7 +47,7 @@ def test_rejects_injection_value(tmp_path):def test_rejects_non_stack_site(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')res = WordPressService.set_php_limits(str(tmp_path), {'memory_limit': '256M'})assert res['success'] is False and 'Not a Docker-stack site' in res['error']@@ -53,7 +55,7 @@ def test_rejects_non_stack_site(tmp_path):# ---- durable write + bind-mount (Docker mocked) ----------------------------def test_writes_ini_and_injects_single_file_mount(tmp_path, monkeypatch):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')_mock_docker(monkeypatch)path = _compose_site(tmp_path)@@ -70,7 +72,7 @@ def test_writes_ini_and_injects_single_file_mount(tmp_path, monkeypatch):def test_partial_update_merges_and_mount_not_duplicated(tmp_path, monkeypatch):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')_mock_docker(monkeypatch)path = _compose_site(tmp_path)@@ -87,7 +89,7 @@ def test_partial_update_merges_and_mount_not_duplicated(tmp_path, monkeypatch):def test_accepts_unlimited_and_size_suffixes(tmp_path, monkeypatch):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')_mock_docker(monkeypatch)path = _compose_site(tmp_path)res = WordPressService.set_php_limits(path, {'memory_limit': '-1', 'max_input_time': '-1',@@ -99,7 +101,7 @@ def test_accepts_unlimited_and_size_suffixes(tmp_path, monkeypatch):# ---- ini parsing -----------------------------------------------------------def test_read_php_ini_skips_comments_and_garbage(tmp_path):- from app.services.wordpress_service import WordPressService+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')p = tmp_path / 'x.ini'p.write_text('; a comment\nmemory_limit = 128M\n\nno equals here\nmax_input_vars = 2000\n')assert WordPressService._read_php_ini(str(p)) == {'memory_limit': '128M', 'max_input_vars': '2000'}diff --git a/backend/tests/test_wp_plugin_library.py b/backend/tests/test_wp_plugin_library.pyindex aaac82d0..6c1359cf 100644--- a/backend/tests/test_wp_plugin_library.py+++ b/backend/tests/test_wp_plugin_library.py@@ -4,6 +4,8 @@ import shutilimport pytest+from app.services import wordpress_bridge+PLUGIN_PHP = """<?php/*@@ -43,8 +45,8 @@ def _fake_privileged(cmd, *args, **kwargs):# Pure helpers# --------------------------------------------------------------------------def test_slug_validation():- from app.services.wordpress_plugin_library_service import (- WordPressPluginLibraryService as S, PluginLibraryError)+ S = wordpress_bridge.get('wordpress_plugin_library_service', 'WordPressPluginLibraryService')+ PluginLibraryError = wordpress_bridge.get('wordpress_plugin_library_service', 'PluginLibraryError')assert S.validate_slug('my-plugin') == 'my-plugin'assert S.slugify('My Cool Plugin!') == 'my-cool-plugin'with pytest.raises(PluginLibraryError):@@ -54,7 +56,7 @@ def test_slug_validation():def test_version_behind():- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService as S+ S = wordpress_bridge.get('wordpress_plugin_library_service', 'WordPressPluginLibraryService')assert S._version_behind('1.0.0', '1.0.1') is Trueassert S._version_behind('1.2.0', '1.10.0') is Trueassert S._version_behind('2.0.0', '1.9.9') is False@@ -64,7 +66,7 @@ def test_version_behind():def test_parse_plugin_header(tmp_path):- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService as S+ S = wordpress_bridge.get('wordpress_plugin_library_service', 'WordPressPluginLibraryService')src = _make_local_plugin(tmp_path, 'my-plugin')header = S.parse_plugin_header(src, 'my-plugin')assert header['name'] == 'My Custom Plugin'@@ -74,7 +76,7 @@ def test_parse_plugin_header(tmp_path):def test_parse_plugin_header_falls_back_to_first_php(tmp_path):- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService as S+ S = wordpress_bridge.get('wordpress_plugin_library_service', 'WordPressPluginLibraryService')src = tmp_path / 'src'src.mkdir()(src / 'main.php').write_text(PLUGIN_PHP, encoding='utf-8')@@ -86,8 +88,8 @@ def test_parse_plugin_header_falls_back_to_first_php(tmp_path):# Service: sync + CRUD (local source)# --------------------------------------------------------------------------def test_add_and_sync_local_plugin(app, tmp_path, monkeypatch):- import app.services.wordpress_plugin_library_service as mod- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService as S+ mod = wordpress_bridge.load('wordpress_plugin_library_service')+ S = wordpress_bridge.get('wordpress_plugin_library_service', 'WordPressPluginLibraryService')monkeypatch.setattr(S, 'CACHE_DIR', str(tmp_path / 'cache'))src = _make_local_plugin(tmp_path, 'my-plugin')@@ -102,13 +104,13 @@ def test_add_and_sync_local_plugin(app, tmp_path, monkeypatch):assert os.path.isfile(os.path.join(cache, 'my-plugin.php'))# Duplicate slug rejected- from app.services.wordpress_plugin_library_service import PluginLibraryError+ PluginLibraryError = wordpress_bridge.get('wordpress_plugin_library_service', 'PluginLibraryError')with pytest.raises(PluginLibraryError):S.add_plugin({'source_type': 'local', 'source_url': src, 'slug': 'my-plugin'})def test_sync_reparses_updated_version(app, tmp_path, monkeypatch):- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService as S+ S = wordpress_bridge.get('wordpress_plugin_library_service', 'WordPressPluginLibraryService')monkeypatch.setattr(S, 'CACHE_DIR', str(tmp_path / 'cache'))src_dir = tmp_path / 'src'src_dir.mkdir()@@ -153,9 +155,9 @@ def _make_site(app, tmp_path, name='acme'):def test_install_on_site_copies_and_records(app, tmp_path, monkeypatch):- import app.services.wordpress_plugin_library_service as mod- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService as S- from app.services.wordpress_service import WordPressService+ mod = wordpress_bridge.load('wordpress_plugin_library_service')+ S = wordpress_bridge.get('wordpress_plugin_library_service', 'WordPressPluginLibraryService')+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')from app.models import WordPressSitePluginmonkeypatch.setattr(S, 'CACHE_DIR', str(tmp_path / 'cache'))@@ -187,8 +189,8 @@ def test_install_on_site_copies_and_records(app, tmp_path, monkeypatch):def test_scan_site_tags_managed(app, tmp_path, monkeypatch):- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService as S- from app.services.wordpress_service import WordPressService+ S = wordpress_bridge.get('wordpress_plugin_library_service', 'WordPressPluginLibraryService')+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')monkeypatch.setattr(S, 'CACHE_DIR', str(tmp_path / 'cache'))src = _make_local_plugin(tmp_path, 'my-plugin')@@ -217,7 +219,7 @@ def test_scan_site_tags_managed(app, tmp_path, monkeypatch):# API: CRUD + bulk update# --------------------------------------------------------------------------def test_api_library_crud(app, client, auth_headers, tmp_path, monkeypatch):- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService as S+ S = wordpress_bridge.get('wordpress_plugin_library_service', 'WordPressPluginLibraryService')monkeypatch.setattr(S, 'CACHE_DIR', str(tmp_path / 'cache'))src = _make_local_plugin(tmp_path, 'api-plugin')@@ -246,7 +248,7 @@ def test_api_library_crud(app, client, auth_headers, tmp_path, monkeypatch):def test_api_add_requires_source(app, client, auth_headers, tmp_path, monkeypatch):- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService as S+ S = wordpress_bridge.get('wordpress_plugin_library_service', 'WordPressPluginLibraryService')monkeypatch.setattr(S, 'CACHE_DIR', str(tmp_path / 'cache'))r = client.post('/api/v1/wordpress/plugins/library',json={'source_type': 'github'}, headers=auth_headers)@@ -254,9 +256,9 @@ def test_api_add_requires_source(app, client, auth_headers, tmp_path, monkeypatcdef test_api_bulk_update(app, client, auth_headers, tmp_path, monkeypatch):- import app.services.wordpress_plugin_library_service as mod- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService as S- from app.services.wordpress_service import WordPressService+ mod = wordpress_bridge.load('wordpress_plugin_library_service')+ S = wordpress_bridge.get('wordpress_plugin_library_service', 'WordPressPluginLibraryService')+ WordPressService = wordpress_bridge.get('wordpress_service', 'WordPressService')monkeypatch.setattr(S, 'CACHE_DIR', str(tmp_path / 'cache'))monkeypatch.setattr(mod, 'run_privileged', _fake_privileged)diff --git a/backend/tests/test_wp_reports.py b/backend/tests/test_wp_reports.pyindex db983fda..080d7de4 100644--- a/backend/tests/test_wp_reports.py+++ b/backend/tests/test_wp_reports.py@@ -3,6 +3,8 @@ from datetime import datetime, timedeltaimport pytest+from app.services import wordpress_bridge+def _mk_user(db, username='owner'):from app.models import User@@ -37,7 +39,7 @@ def _current_month():# ---- pure helpers ---------------------------------------------------------def test_month_bounds_normal_and_december():- from app.services.wp_reports_service import WpReportsService+ WpReportsService = wordpress_bridge.get('wp_reports_service', 'WpReportsService')start, end = WpReportsService._month_bounds(2026, 5)assert start == datetime(2026, 5, 1)assert end == datetime(2026, 6, 1)@@ -48,7 +50,7 @@ def test_month_bounds_normal_and_december():def test_client_from_tags():- from app.services.wp_reports_service import WpReportsService+ WpReportsService = wordpress_bridge.get('wp_reports_service', 'WpReportsService')assert WpReportsService._client_from_tags(['retainer', 'client-acme']) == 'acme'assert WpReportsService._client_from_tags(['client:Globex']) == 'Globex'assert WpReportsService._client_from_tags(['php8', 'retainer']) is None@@ -60,7 +62,7 @@ def test_client_from_tags():def test_generate_aggregates_bound_site(app):import jsonfrom app import db- from app.services.wp_reports_service import WpReportsService+ WpReportsService = wordpress_bridge.get('wp_reports_service', 'WpReportsService')from app.models.status_page import StatusPage, StatusComponent, HealthCheckfrom app.models.wordpress_site import WordPressUpdateRun, DatabaseSnapshot, WordPressVulnerability@@ -123,7 +125,7 @@ def test_generate_aggregates_bound_site(app):def test_generate_unbound_site_has_no_uptime_history(app):from app import db- from app.services.wp_reports_service import WpReportsService+ WpReportsService = wordpress_bridge.get('wp_reports_service', 'WpReportsService')user = _mk_user(db, 'owner2')_, site = _mk_site(db, user.id, name='nobound')@@ -140,7 +142,7 @@ def test_generate_unbound_site_has_no_uptime_history(app):def test_generate_is_upsert(app):from app import db- from app.services.wp_reports_service import WpReportsService+ WpReportsService = wordpress_bridge.get('wp_reports_service', 'WpReportsService')from app.models.wordpress_site import WordPressReportuser = _mk_user(db, 'owner3')@@ -155,7 +157,7 @@ def test_generate_is_upsert(app):def test_generate_rejects_future_month(app):from app import db- from app.services.wp_reports_service import WpReportsService+ WpReportsService = wordpress_bridge.get('wp_reports_service', 'WpReportsService')user = _mk_user(db, 'owner4')_, site = _mk_site(db, user.id, name='future')@@ -168,7 +170,7 @@ def test_generate_rejects_future_month(app):def test_daily_series_never_emits_a_future_day(app):"""Regression: the to-date daily series must stop at today, not tomorrow."""from app import db- from app.services.wp_reports_service import WpReportsService+ WpReportsService = wordpress_bridge.get('wp_reports_service', 'WpReportsService')from app.models.status_page import StatusPage, StatusComponentuser = _mk_user(db, 'owner5')@@ -193,7 +195,7 @@ def test_ongoing_incident_duration_is_clamped_to_the_month(app):its full elapsed time (up to now) into that month's attributed duration."""from datetime import datetime, timedeltafrom app import db- from app.services.wp_reports_service import WpReportsService+ WpReportsService = wordpress_bridge.get('wp_reports_service', 'WpReportsService')from app.models.status_page import StatusPage, StatusComponent, StatusIncidentnow = datetime.utcnow()diff --git a/builtin-extensions/serverkit-wordpress/backend/__init__.py b/builtin-extensions/serverkit-wordpress/backend/__init__.pynew file mode 100644index 00000000..20eeca2f--- /dev/null+++ b/builtin-extensions/serverkit-wordpress/backend/__init__.py@@ -0,0 +1 @@+"""ServerKit WordPress extension backend package."""diff --git a/backend/app/api/environment_pipeline.py b/builtin-extensions/serverkit-wordpress/backend/environment_pipeline.pysimilarity index 99%rename from backend/app/api/environment_pipeline.pyrename to builtin-extensions/serverkit-wordpress/backend/environment_pipeline.pyindex 689a5a6f..cef6d011 100644--- a/backend/app/api/environment_pipeline.py+++ b/builtin-extensions/serverkit-wordpress/backend/environment_pipeline.py@@ -24,7 +24,7 @@ from app.models.promotion_job import PromotionJobfrom app.models.sanitization_profile import SanitizationProfilefrom app.services.environment_pipeline_service import EnvironmentPipelineServicefrom app.services.environment_docker_service import EnvironmentDockerService-from app.services.git_wordpress_service import GitWordPressService+from .git_wordpress_service import GitWordPressServiceenvironment_pipeline_bp = Blueprint('environment_pipeline', __name__)diff --git a/backend/app/services/git_wordpress_service.py b/builtin-extensions/serverkit-wordpress/backend/git_wordpress_service.pysimilarity index 99%rename from backend/app/services/git_wordpress_service.pyrename to builtin-extensions/serverkit-wordpress/backend/git_wordpress_service.pyindex e396a835..e94cb3d7 100644--- a/backend/app/services/git_wordpress_service.py+++ b/builtin-extensions/serverkit-wordpress/backend/git_wordpress_service.py@@ -15,7 +15,7 @@ from typing import Dict, List, Optionalfrom app import dbfrom app.models.wordpress_site import WordPressSite, DatabaseSnapshotfrom app.services.db_sync_service import DatabaseSyncService-from app.services.wordpress_env_service import WordPressEnvService+from .wordpress_env_service import WordPressEnvServiceclass GitWordPressService:diff --git a/backend/app/api/wordpress.py b/builtin-extensions/serverkit-wordpress/backend/wordpress.pysimilarity index 96%rename from backend/app/api/wordpress.pyrename to builtin-extensions/serverkit-wordpress/backend/wordpress.pyindex 6c700429..f1dd2e4f 100644--- a/backend/app/api/wordpress.py+++ b/builtin-extensions/serverkit-wordpress/backend/wordpress.py@@ -3,7 +3,7 @@ from flask import Blueprint, request, jsonifyfrom flask_jwt_extended import jwt_required, get_jwt_identityfrom app.middleware.rbac import admin_requiredfrom app.models import User, Application, WordPressSite-from app.services.wordpress_service import WordPressService+from .wordpress_service import WordPressServicefrom app import dbwordpress_bp = Blueprint('wordpress', __name__)@@ -549,7 +549,7 @@ def detach_site_status_page(app_id):def get_site_analytics(app_id):"""Per-site traffic + error analytics, parsed on-demand from the container'sApache access log (visits / bandwidth / status codes / 404s / bots / top URLs)."""- from app.services.wp_analytics_service import WpAnalyticsService+ from .wp_analytics_service import WpAnalyticsServicecurrent_user_id = get_jwt_identity()user = User.query.get(current_user_id)app = _resolve_app(app_id)@@ -567,7 +567,7 @@ def get_site_analytics(app_id):@jwt_required()def get_site_vulnerabilities(app_id):"""Return persisted vulnerability findings + live scan status for a site."""- from app.services.wp_vulnerability_service import WpVulnerabilityService+ from .wp_vulnerability_service import WpVulnerabilityServicecurrent_user_id = get_jwt_identity()user = User.query.get(current_user_id)app = _resolve_app(app_id)@@ -586,7 +586,7 @@ def get_site_vulnerabilities(app_id):@admin_requireddef scan_site_vulnerabilities(app_id):"""Start a background vulnerability scan (cross-references the WPVulnerability feed)."""- from app.services.wp_vulnerability_service import WpVulnerabilityService+ from .wp_vulnerability_service import WpVulnerabilityServiceapp = _resolve_app(app_id)if not app:return jsonify({'error': 'Application not found'}), 404@@ -618,7 +618,7 @@ def _owner_or_admin_app(app_id):@jwt_required()def get_site_integrity(app_id):"""Return the latest file-integrity result + scan status for a site."""- from app.services.wp_security_service import WpSecurityService+ from .wp_security_service import WpSecurityServiceapp, err = _owner_or_admin_app(app_id)if err:return err@@ -633,7 +633,7 @@ def get_site_integrity(app_id):@admin_requireddef scan_site_integrity(app_id):"""Start a background file-integrity check (wp core/plugin verify-checksums)."""- from app.services.wp_security_service import WpSecurityService+ from .wp_security_service import WpSecurityServiceapp = _resolve_app(app_id)if not app:return jsonify({'error': 'Application not found'}), 404@@ -647,7 +647,7 @@ def scan_site_integrity(app_id):@jwt_required()def get_site_debug(app_id):"""Return the site's WP_DEBUG / WP_DEBUG_LOG / SCRIPT_DEBUG state."""- from app.services.wp_security_service import WpSecurityService+ from .wp_security_service import WpSecurityServiceapp, err = _owner_or_admin_app(app_id)if err:return err@@ -659,7 +659,7 @@ def get_site_debug(app_id):@admin_requireddef set_site_debug(app_id):"""Toggle debug logging (WP_DEBUG/WP_DEBUG_LOG/SCRIPT_DEBUG on; display always off)."""- from app.services.wp_security_service import WpSecurityService+ from .wp_security_service import WpSecurityServiceapp = _resolve_app(app_id)if not app:return jsonify({'error': 'Application not found'}), 404@@ -671,7 +671,7 @@ def set_site_debug(app_id):@jwt_required()def get_site_cron(app_id):"""Return WP-Cron status (DISABLE_WP_CRON + due events)."""- from app.services.wp_security_service import WpSecurityService+ from .wp_security_service import WpSecurityServiceapp, err = _owner_or_admin_app(app_id)if err:return err@@ -683,7 +683,7 @@ def get_site_cron(app_id):@admin_requireddef run_site_cron(app_id):"""Run all due WP-Cron events now."""- from app.services.wp_security_service import WpSecurityService+ from .wp_security_service import WpSecurityServiceapp = _resolve_app(app_id)if not app:return jsonify({'error': 'Application not found'}), 404@@ -695,7 +695,7 @@ def run_site_cron(app_id):@admin_requireddef set_site_cron(app_id):"""Enable/disable WP's pseudo-cron (DISABLE_WP_CRON)."""- from app.services.wp_security_service import WpSecurityService+ from .wp_security_service import WpSecurityServiceapp = _resolve_app(app_id)if not app:return jsonify({'error': 'Application not found'}), 404@@ -707,7 +707,7 @@ def set_site_cron(app_id):@jwt_required()def get_site_bruteforce(app_id):"""Per-site login brute-force status: fail2ban availability, jail on/off, bans."""- from app.services.wp_security_service import WpSecurityService+ from .wp_security_service import WpSecurityServiceapp, err = _owner_or_admin_app(app_id)if err:return err@@ -722,7 +722,7 @@ def get_site_bruteforce(app_id):@admin_requireddef set_site_bruteforce(app_id):"""Enable/disable the site's WP-login brute-force jail."""- from app.services.wp_security_service import WpSecurityService+ from .wp_security_service import WpSecurityServiceapp = _resolve_app(app_id)if not app:return jsonify({'error': 'Application not found'}), 404@@ -738,7 +738,7 @@ def set_site_bruteforce(app_id):@admin_requireddef unban_site_bruteforce(app_id):"""Unban an IP from the site's brute-force jail."""- from app.services.wp_security_service import WpSecurityService+ from .wp_security_service import WpSecurityServiceapp = _resolve_app(app_id)if not app:return jsonify({'error': 'Application not found'}), 404@@ -757,7 +757,7 @@ def unban_site_bruteforce(app_id):@jwt_required()def get_site_updates(app_id):"""Return safe-update run history + status + the site's update schedule."""- from app.services.wp_update_service import WpUpdateService+ from .wp_update_service import WpUpdateServiceapp, err = _owner_or_admin_app(app_id)if err:return err@@ -775,7 +775,7 @@ def get_site_updates(app_id):@admin_requireddef run_site_updates(app_id):"""Start a background safe update (snapshot -> update -> health-check -> auto-rollback)."""- from app.services.wp_update_service import WpUpdateService+ from .wp_update_service import WpUpdateServiceapp = _resolve_app(app_id)if not app:return jsonify({'error': 'Application not found'}), 404@@ -817,7 +817,7 @@ def set_site_update_schedule(app_id):@jwt_required()def get_site_reports(app_id):"""Return all persisted monthly reports for a site (newest month first)."""- from app.services.wp_reports_service import WpReportsService+ from .wp_reports_service import WpReportsServiceapp, err = _owner_or_admin_app(app_id)if err:return err@@ -833,7 +833,7 @@ def get_site_reports(app_id):def generate_site_report(app_id):"""Generate (or regenerate) the monthly report for a site. Body may carry{year, month}; defaults to the current UTC month."""- from app.services.wp_reports_service import WpReportsService+ from .wp_reports_service import WpReportsServiceapp = _resolve_app(app_id)if not app:return jsonify({'error': 'Application not found'}), 404@@ -850,7 +850,7 @@ def generate_site_report(app_id):@admin_requireddef delete_site_report(app_id, report_id):"""Delete one persisted monthly report."""- from app.services.wp_reports_service import WpReportsService+ from .wp_reports_service import WpReportsServiceapp = _resolve_app(app_id)if not app:return jsonify({'error': 'Application not found'}), 404@@ -1473,7 +1473,7 @@ def _resolve_wp_site(site_or_app_id):@jwt_required()def list_library_plugins():"""List all plugins in the global library."""- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService+ from .wordpress_plugin_library_service import WordPressPluginLibraryServicereturn jsonify({'plugins': WordPressPluginLibraryService.list_plugins()}), 200@@ -1482,7 +1482,7 @@ def list_library_plugins():@admin_requireddef add_library_plugin():"""Register a new plugin in the library and sync it into the cache."""- from app.services.wordpress_plugin_library_service import (+ from .wordpress_plugin_library_service import (WordPressPluginLibraryService, PluginLibraryError)data = request.get_json() or {}try:@@ -1496,7 +1496,7 @@ def add_library_plugin():@jwt_required()def get_library_plugin(plugin_id):"""Library plugin detail, including per-site installations."""- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService+ from .wordpress_plugin_library_service import WordPressPluginLibraryServicedata = WordPressPluginLibraryService.get_plugin(plugin_id)if not data:return jsonify({'error': 'Plugin not found'}), 404@@ -1508,7 +1508,7 @@ def get_library_plugin(plugin_id):@admin_requireddef update_library_plugin(plugin_id):"""Update a library plugin's source / branch / active state."""- from app.services.wordpress_plugin_library_service import (+ from .wordpress_plugin_library_service import (WordPressPluginLibraryService, PluginLibraryError)data = request.get_json() or {}try:@@ -1524,7 +1524,7 @@ def update_library_plugin(plugin_id):@admin_requireddef delete_library_plugin(plugin_id):"""Remove a plugin from the library (and delete its cache directory)."""- from app.services.wordpress_plugin_library_service import (+ from .wordpress_plugin_library_service import (WordPressPluginLibraryService, PluginLibraryError)try:return jsonify(WordPressPluginLibraryService.delete_plugin(plugin_id)), 200@@ -1537,7 +1537,7 @@ def delete_library_plugin(plugin_id):@admin_requireddef sync_library_plugin(plugin_id):"""Pull the latest source into the cache and re-parse the plugin header."""- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService+ from .wordpress_plugin_library_service import WordPressPluginLibraryServicefrom app.models import WordPressCustomPluginplugin = WordPressCustomPlugin.query.get(plugin_id)if not plugin:@@ -1551,7 +1551,7 @@ def sync_library_plugin(plugin_id):@admin_requireddef install_library_plugin(plugin_id):"""Install (or update) a library plugin on a specific site."""- from app.services.wordpress_plugin_library_service import (+ from .wordpress_plugin_library_service import (WordPressPluginLibraryService, PluginLibraryError)from app.models import WordPressCustomPlugindata = request.get_json() or {}@@ -1579,7 +1579,7 @@ def install_library_plugin(plugin_id):@admin_requireddef bulk_update_library_plugin(plugin_id):"""Push the latest cached version to every site that has the plugin."""- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService+ from .wordpress_plugin_library_service import WordPressPluginLibraryServicefrom app.models import WordPressCustomPluginplugin = WordPressCustomPlugin.query.get(plugin_id)if not plugin:@@ -1592,7 +1592,7 @@ def bulk_update_library_plugin(plugin_id):@admin_requireddef uninstall_library_plugin(plugin_id):"""Remove a library plugin from a specific site."""- from app.services.wordpress_plugin_library_service import (+ from .wordpress_plugin_library_service import (WordPressPluginLibraryService, PluginLibraryError)from app.models import WordPressCustomPlugindata = request.get_json() or {}@@ -1616,7 +1616,7 @@ def uninstall_library_plugin(plugin_id):@admin_requireddef scan_site_library_plugins(app_id):"""Scan a site and tag which installed plugins are library-managed."""- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService+ from .wordpress_plugin_library_service import WordPressPluginLibraryServicesite = _resolve_wp_site(app_id)if not site:return jsonify({'error': 'Site not found'}), 404@@ -1627,7 +1627,7 @@ def scan_site_library_plugins(app_id):@jwt_required()def get_site_managed_plugins(app_id):"""Which of a site's installed plugins are library-managed (+ update state)."""- from app.services.wordpress_plugin_library_service import WordPressPluginLibraryService+ from .wordpress_plugin_library_service import WordPressPluginLibraryServicesite = _resolve_wp_site(app_id)if not site:return jsonify({'error': 'Site not found'}), 404diff --git a/backend/app/services/wordpress_env_service.py b/builtin-extensions/serverkit-wordpress/backend/wordpress_env_service.pysimilarity index 99%rename from backend/app/services/wordpress_env_service.pyrename to builtin-extensions/serverkit-wordpress/backend/wordpress_env_service.pyindex 11b72453..c1b1d58c 100644--- a/backend/app/services/wordpress_env_service.py+++ b/builtin-extensions/serverkit-wordpress/backend/wordpress_env_service.py@@ -21,7 +21,7 @@ from app import dbfrom app.models.application import Applicationfrom app.models.wordpress_site import WordPressSite, DatabaseSnapshot, SyncJobfrom app.services.db_sync_service import DatabaseSyncService-from app.services.wordpress_service import WordPressService+from .wordpress_service import WordPressServicefrom app.services.database_service import DatabaseServicediff --git a/backend/app/services/wordpress_plugin_library_service.py b/builtin-extensions/serverkit-wordpress/backend/wordpress_plugin_library_service.pysimilarity index 99%rename from backend/app/services/wordpress_plugin_library_service.pyrename to builtin-extensions/serverkit-wordpress/backend/wordpress_plugin_library_service.pyindex 0393a350..ca6d8fc9 100644--- a/backend/app/services/wordpress_plugin_library_service.py+++ b/builtin-extensions/serverkit-wordpress/backend/wordpress_plugin_library_service.py@@ -27,7 +27,7 @@ from typing import Dict, List, Optionalfrom app import db, pathsfrom app.models.wordpress_custom_plugin import WordPressCustomPlugin, WordPressSitePluginfrom app.models.wordpress_site import WordPressSite-from app.services.wordpress_service import WordPressService+from .wordpress_service import WordPressServicefrom app.utils.system import run_privileged# Slug rule: lowercase letters, digits, single dashes (a wp-content/plugins dir name).diff --git a/backend/app/services/wordpress_service.py b/builtin-extensions/serverkit-wordpress/backend/wordpress_service.pysimilarity index 100%rename from backend/app/services/wordpress_service.pyrename to builtin-extensions/serverkit-wordpress/backend/wordpress_service.pydiff --git a/backend/app/api/wordpress_sites.py b/builtin-extensions/serverkit-wordpress/backend/wordpress_sites.pysimilarity index 99%rename from backend/app/api/wordpress_sites.pyrename to builtin-extensions/serverkit-wordpress/backend/wordpress_sites.pyindex bdce0b2d..70a5855b 100644--- a/backend/app/api/wordpress_sites.py+++ b/builtin-extensions/serverkit-wordpress/backend/wordpress_sites.py@@ -18,9 +18,9 @@ import jsonfrom app import dbfrom app.models.application import Applicationfrom app.models.wordpress_site import WordPressSite, DatabaseSnapshot-from app.services.wordpress_env_service import WordPressEnvService+from .wordpress_env_service import WordPressEnvServicefrom app.services.db_sync_service import DatabaseSyncService-from app.services.git_wordpress_service import GitWordPressService+from .git_wordpress_service import GitWordPressServicefrom app.services.backup_policy_service import BackupPolicyService, BackupPolicyErrorwordpress_sites_bp = Blueprint('wordpress_sites', __name__)diff --git a/backend/app/services/wp_analytics_service.py b/builtin-extensions/serverkit-wordpress/backend/wp_analytics_service.pysimilarity index 100%rename from backend/app/services/wp_analytics_service.pyrename to builtin-extensions/serverkit-wordpress/backend/wp_analytics_service.pydiff --git a/backend/app/services/wp_reports_service.py b/builtin-extensions/serverkit-wordpress/backend/wp_reports_service.pysimilarity index 100%rename from backend/app/services/wp_reports_service.pyrename to builtin-extensions/serverkit-wordpress/backend/wp_reports_service.pydiff --git a/backend/app/services/wp_security_service.py b/builtin-extensions/serverkit-wordpress/backend/wp_security_service.pysimilarity index 95%rename from backend/app/services/wp_security_service.pyrename to builtin-extensions/serverkit-wordpress/backend/wp_security_service.pyindex 370ac8ff..add83d2a 100644--- a/backend/app/services/wp_security_service.py+++ b/builtin-extensions/serverkit-wordpress/backend/wp_security_service.py@@ -51,7 +51,7 @@ class WpSecurityService:@classmethoddef _run_integrity(cls, app, site_id, path):with app.app_context():- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServicetry:if not path:raise RuntimeError('Site has no root path')@@ -95,7 +95,7 @@ class WpSecurityService:@classmethoddef get_debug(cls, path):- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServicedef _val(k):res = WordPressService.wp_cli(path, ['config', 'get', k])@@ -112,7 +112,7 @@ class WpSecurityService:@classmethoddef set_debug(cls, path, enabled):- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServicedef wp(*args):return WordPressService.wp_cli(path, ['config', 'set', *args])@@ -136,7 +136,7 @@ class WpSecurityService:@classmethoddef get_cron(cls, path):- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServicedis = WordPressService.wp_cli(path, ['config', 'get', 'DISABLE_WP_CRON'])disabled = (dis.get('output') or '').strip().lower() in ('1', 'true') if dis.get('success') else Falseevents = []@@ -150,7 +150,7 @@ class WpSecurityService:@classmethoddef run_cron(cls, path):- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServiceres = WordPressService.wp_cli(path, ['cron', 'event', 'run', '--due-now'])return {'success': bool(res.get('success')),@@ -160,7 +160,7 @@ class WpSecurityService:@classmethoddef set_cron_disabled(cls, path, disabled):- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServiceval = 'true' if disabled else 'false'res = WordPressService.wp_cli(path, ['config', 'set', 'DISABLE_WP_CRON', val, '--raw'])if not res.get('success'):diff --git a/backend/app/services/wp_update_service.py b/builtin-extensions/serverkit-wordpress/backend/wp_update_service.pysimilarity index 97%rename from backend/app/services/wp_update_service.pyrename to builtin-extensions/serverkit-wordpress/backend/wp_update_service.pyindex 21e7fe33..c7a4e601 100644--- a/backend/app/services/wp_update_service.py+++ b/builtin-extensions/serverkit-wordpress/backend/wp_update_service.py@@ -82,7 +82,7 @@ class WpUpdateService:with app.app_context():from app import dbfrom app.models.wordpress_site import WordPressSite, WordPressUpdateRun- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServicerun = WordPressUpdateRun.query.get(run_id)details = json.loads(run.details) if run and run.details else {}snapshot = f'/tmp/wp-preupdate-{run_id}.sql'@@ -169,7 +169,7 @@ class WpUpdateService:@staticmethoddef _versions(path):- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServicecore = WordPressService.wp_cli(path, ['core', 'version'])return {'core': (core.get('output') or '').strip() if core.get('success') else None,@@ -186,7 +186,7 @@ class WpUpdateService:— so an auto-rollback never pages on-call with spurious down/up). `wp eval`loads WP incl. plugins so a PHP fatal is caught; the HTTP probe catches a5xx/connection regression. Returns healthy | degraded | unhealthy | unknown."""- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServicefrom app.services.environment_health_service import EnvironmentHealthServicewp_ok = WordPressService.wp_cli(path, ['eval', "echo 'OK';"]).get('success', False)http_status = 'unknown'@@ -202,7 +202,7 @@ class WpUpdateService:@classmethoddef _apply_updates(cls, path, targets, exclude):- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServiceex = set(exclude or [])if targets.get('core'):WordPressService.update_wordpress(path)@@ -236,7 +236,7 @@ class WpUpdateService:runs even if a bad update left the site fatally broken (a loaded pluginwould otherwise crash wp-cli). Best-effort (a component not onwordpress.org can't be version-downgraded; the DB snapshot is the net)."""- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServiceskip = ['--skip-plugins', '--skip-themes']for u in updated:t, slug, old = u.get('type'), u.get('slug'), u.get('from')diff --git a/backend/app/services/wp_vulnerability_service.py b/builtin-extensions/serverkit-wordpress/backend/wp_vulnerability_service.pysimilarity index 99%rename from backend/app/services/wp_vulnerability_service.pyrename to builtin-extensions/serverkit-wordpress/backend/wp_vulnerability_service.pyindex 5f03339c..d905d1f1 100644--- a/backend/app/services/wp_vulnerability_service.py+++ b/builtin-extensions/serverkit-wordpress/backend/wp_vulnerability_service.py@@ -123,7 +123,7 @@ class WpVulnerabilityService:NOT get_wordpress_info, whose host-filesystem wp-config.php check fails forvolume-backed Docker sites (the primary managed model). Core is optional;we only bail when WP-CLI answers nothing at all."""- from app.services.wordpress_service import WordPressService+ from .wordpress_service import WordPressServicecore_res = WordPressService.wp_cli(path, ['core', 'version'])core_version = (core_res.get('output') or '').strip() if core_res.get('success') else Noneplugins = WordPressService.get_plugins(path) or []diff --git a/builtin-extensions/serverkit-wordpress/plugin.json b/builtin-extensions/serverkit-wordpress/plugin.jsonnew file mode 100644index 00000000..6632efe8--- /dev/null+++ b/builtin-extensions/serverkit-wordpress/plugin.json@@ -0,0 +1,34 @@+{+ "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": "<path d=\"M12 2a10 10 0 100 20 10 10 0 000-20zm-8 10a8 8 0 011.4-4.5l4.7 12.9A8 8 0 014 12zm8 8c-.8 0-1.6-.1-2.3-.3l2.4-7 2.5 6.8.1.1A8 8 0 0112 20zm1.1-11.8c.5 0 .9-.1.9-.1.4 0 .4-.6-.1-.6 0 0-1.4.1-2.3.1-.8 0-2.2-.1-2.2-.1-.5 0-.6.6-.1.6 0 0 .4.1.9.1l1.3 3.6-1.9 5.6L6.6 8.2c.5 0 .9-.1.9-.1.4 0 .4-.6-.1-.6 0 0-1.4.1-2.3.1h-.4A8 8 0 0112 4a8 8 0 016.5 3.3h-.3c-.8 0-1.4.7-1.4 1.5 0 .7.4 1.3.8 2 .3.6.7 1.3.7 2.3 0 .7-.3 1.6-.6 2.7l-.8 2.7-2.9-8.8z\"/>",+ "contributions": {}+}diff --git a/docs/EXTRACTION_WORDPRESS_AUDIT.md b/docs/EXTRACTION_WORDPRESS_AUDIT.mdindex d7b8042f..b3c1add4 100644--- a/docs/EXTRACTION_WORDPRESS_AUDIT.md+++ b/docs/EXTRACTION_WORDPRESS_AUDIT.md@@ -1,7 +1,12 @@# WordPress extraction — boundary audit (Phase 5, #37)-**Status:** Audit complete — extraction (#38) is the follow-up, and is the largest-single move in the plan. Do it only **after** Email (#32) proves the machinery.+**Status:** Audit complete; **backend extraction (#38) SHIPPED** — the WordPress+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).**Verdict:** extractable, but WordPress has **real core hooks** that must beinverted/guarded first. WordPress ships as a bundled, default-installed,uninstallable extension (D4) — never a marketplace hunt.