feat(FN-3169): expand plugin authoring documentation

Updated the plugin authoring documentation (`docs/PLUGIN_AUTHORING.md`) with expanded authoring capabilities as part of Step 3, adding 23 lines of guidance for developers creating extensions.

Fusion-Task-Id: FN-3169
This commit is contained in:
Fusion
2026-05-09 08:57:01 -07:00
committed by gsxdsm
parent 9ef787125e
commit 865f2eba4f

View File

@@ -460,6 +460,10 @@ const plugin: FusionPlugin = {
Routes are mounted at `/api/plugins/{pluginId}/{path}`.
Route handlers receive the same loader-built `PluginContext` used by hooks/tools, including real `taskStore`, plugin `settings`, `logger`, `emitEvent`, and engine-injected `createAiSession` (when available):
- Example roadmap plugin route: `path: "/roadmaps"` in plugin `roadmap-planner` resolves to `/api/plugins/roadmap-planner/roadmaps`
- Roadmap suggestion endpoints follow the same namespace (for example `/api/plugins/roadmap-planner/roadmaps/:roadmapId/suggestions/milestones`)
- Do not document or depend on legacy host-owned `/api/roadmaps` routes unless your current source still ships them
- Plugin ID: `fusion-plugin-notification`
- Route path: `/status`
- Full URL: `/api/plugins/fusion-plugin-notification/status`
@@ -582,7 +586,8 @@ The API only returns normalized surface names.
Top-level views are a **sibling contribution type** to `uiSlots`.
- `uiSlots` are embedded surfaces (task detail tab, header action, etc.)
- `dashboardViews` are full-screen destinations in dashboard navigation
- `dashboardViews` is the shipped top-level plugin field for full-screen dashboard destinations
- Earlier planning language may say `views`; the implemented API in `FusionPlugin` is `dashboardViews`
Register `dashboardViews` on the plugin definition:
@@ -637,6 +642,12 @@ registerPluginView(
The host then renders plugin views via `PluginDashboardViewHost` using the composite ID.
Bundled workspace plugin pattern:
- Keep plugin package under `plugins/` (for example `plugins/fusion-plugin-roadmap`)
- Export backend/plugin entry from `src/index.ts` and keep dashboard view exports in the plugin package (for example `./dashboard-view`)
- Register the lazy dashboard component in host code (currently `packages/dashboard/app/plugins/registerBundledPluginViews.ts`)
- CLI bundling inlines backend plugin code from workspace packages; dashboard view modules are imported by the dashboard build via the host registry
Runtime host context contract:
- Registered views receive a `context` object from the dashboard host (`PluginDashboardViewContext`).
- Context includes the active `projectId`, current visible `tasks`, optional `workflowSteps`, and `openTaskDetail` for launching the native task detail flow.
@@ -874,6 +885,8 @@ The factory is dependency-injected by the engine at runtime. In test-only or cor
### Example: Using `ctx.createAiSession()`
Use this context factory for plugin AI features (for example roadmap milestone/feature suggestion generation). Avoid direct `@fusion/engine` imports from plugin code; engine wiring is injected by the host through `PluginContext`.
```typescript
hooks: {
onLoad: async (ctx) => {
@@ -1129,6 +1142,15 @@ Polls CI status for branches and provides custom API endpoints.
- Demonstrates: Custom routes, periodic background work, route handlers, UI slot registration
- Features: `onLoad`/`onUnload` lifecycle, `setInterval` polling, REST API, UI slots for task cards and task detail tabs
### [Roadmap Planner Plugin](../../plugins/fusion-plugin-roadmap/)
Standalone roadmap planning plugin extracted from dashboard host code.
- Demonstrates: `hooks.onSchemaInit` for plugin-owned schema DDL (`ensureRoadmapSchema`)
- Demonstrates: plugin-scoped route namespace under `/api/plugins/roadmap-planner/*`
- Demonstrates: top-level navigation registration through `dashboardViews` (`viewId: "roadmaps"`) and host static view registration
- Demonstrates: AI suggestion flows that consume `ctx.createAiSession` through plugin route handlers
### [Droid Runtime Plugin](../../plugins/fusion-plugin-droid-runtime/)
Reference runtime plugin that migrates a CLI-backed provider into the plugin system.