a614ab337b
Check Cross-Plugin Imports / check (push) Has been cancelled
- Migration 0135: Fix 3 VARCHAR length drifts + 2 missing tables (forgejo_reported_errors, pgp_keys) - Migration 0136: Fix 8 RLS policies referencing app.tenant_id instead of app.current_tenant_id - wiki/__init__.py: Import WikiPlugin for discover_builtins() - wiki/plugin.py: Fix SyntaxError (unterminated triple-quoted string) - agent_loop.py: Fix SyntaxError (stray n character in dict) - test_p1_6_dms_streaming.py: Fix import (CHUNK_SIZE removed, use _sanitize_filename only) - conftest.py: Use create_all only (alembic conflicts with create_all in tests) - frontend errorTypes.ts: asError() now handles nested detail objects - AGENTS.md: Sub-agents forbidden in this project - DAMAGE_REPORT.md + SCHEMA_DRIFTS.md: Complete damage assessment - scripts/schema_drift_check.py: Schema drift checker tool Tests: 24/24 Phase J + 12/12 Phase K = 36/36 passed tsc: 0 errors Frontend build: successful
40 lines
1.8 KiB
Python
40 lines
1.8 KiB
Python
"""Wiki plugin - knowledge articles, categories, versioning."""
|
|
from __future__ import annotations
|
|
import logging
|
|
from app.plugins.base import BasePlugin
|
|
from app.plugins.manifest import FrontendMenuItem, FrontendPageRoute, PluginManifest, PluginRouteDef
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class WikiPlugin(BasePlugin):
|
|
manifest = PluginManifest(
|
|
name="wiki",
|
|
version="1.0.0",
|
|
display_name="Wiki",
|
|
description="Knowledge articles with Markdown, categories, tags, versioning, entity links.",
|
|
dependencies=["permissions"],
|
|
routes=[
|
|
PluginRouteDef(path="/api/v1/wiki", module="app.plugins.builtins.wiki.routes", router_attr="router"),
|
|
],
|
|
permissions=["wiki:read", "wiki:write", "wiki:delete", "wiki:admin"],
|
|
menu_items=[FrontendMenuItem(label_key="wiki.menu.wiki", label="Wiki", path="/wiki", icon="BookOpen")],
|
|
page_routes=[FrontendPageRoute(path="/wiki", component="@/pages/Wiki")],
|
|
)
|
|
|
|
async def on_activate(self, db, service_container, event_bus) -> None:
|
|
await super().on_activate(db, service_container, event_bus)
|
|
try:
|
|
from app.plugins.builtins.unified_search.provider_registry import get_search_registry
|
|
from app.plugins.builtins.unified_search.providers.wiki_provider import WikiSearchProvider
|
|
registry = get_search_registry()
|
|
registry.register(WikiSearchProvider())
|
|
logger.info("Registered WikiSearchProvider")
|
|
except Exception:
|
|
logger.exception("Failed to register WikiSearchProvider")
|
|
|
|
async def on_deactivate(self, db, service_container, event_bus) -> None:
|
|
from app.core.hooks import unregister_actions_by_owner
|
|
unregister_actions_by_owner("wiki")
|
|
await super().on_deactivate(db, service_container, event_bus)
|