Expose the dashboard file viewer to plugin views and wire Compound Engineering artifacts to it. - add an openFile callback to the dashboard plugin view context and pass through the app host implementation - switch Compound Engineering artifact Open actions to the built-in file viewer with matching styling and coverage - document the new plugin context capability and add a published changeset for the CLI package Files changed: .changeset/ce-docs-built-in-viewer.md | 5 +++ docs/PLUGIN_AUTHORING.md | 2 +- packages/dashboard/app/App.tsx | 1 + packages/dashboard/app/plugins/types.ts | 2 ++ .../src/dashboard-interop.d.ts | 1 + .../src/dashboard/CompoundEngineeringView.css | 16 +++++++++ .../src/dashboard/CompoundEngineeringView.tsx | 24 +++++++------- .../__tests__/CompoundEngineeringView.test.tsx | 38 ++++++++++++++++++++++ 8 files changed, 76 insertions(+), 13 deletions(-) Fusion-Task-Id: FN-6119 Fusion-Task-Lineage: 8feb461c-b1d2-4059-9aa1-ffc756d15196
36 lines
1.6 KiB
TypeScript
36 lines
1.6 KiB
TypeScript
// Ambient declaration for the dashboard host's plugin-view context, so this
|
|
// bundled plugin can consume the type WITHOUT a runtime dependency on
|
|
// `@fusion/dashboard` (a host package). Depending on the host would create a
|
|
// dashboard -> plugin -> dashboard cycle and violate the workspace-acyclicity /
|
|
// "bundled plugins must not depend on host packages" invariants. The host
|
|
// passes the real object at runtime; this minimal structural shape is enough to
|
|
// type-check the fields this plugin actually reads. Mirrors the interop pattern
|
|
// used by fusion-plugin-dependency-graph.
|
|
declare module "@fusion/dashboard/app/plugins/types" {
|
|
import type { ReactNode } from "react";
|
|
import type { Task, TaskDetail, WorkflowStep } from "@fusion/core";
|
|
|
|
export type DetailTaskTab =
|
|
| "definition" | "logs" | "changes" | "comments" | "model" | "workflow" | "pr" | "retries";
|
|
export type PluginToastType = "success" | "error" | "warning" | "info";
|
|
|
|
export interface PluginCustomEvent {
|
|
event: string;
|
|
payload: unknown;
|
|
}
|
|
|
|
export interface PluginDashboardViewContext {
|
|
projectId?: string;
|
|
tasks: Task[];
|
|
workflowSteps: WorkflowStep[];
|
|
openTaskDetail: (task: Task | TaskDetail, initialTab?: DetailTaskTab) => void;
|
|
openFile: (path: string, options?: { workspace?: string; line?: number; col?: number }) => void;
|
|
renderTaskCard?: (task: Task | TaskDetail) => ReactNode;
|
|
addToast?: (message: string, type?: PluginToastType) => void;
|
|
subscribePluginEvents?: (
|
|
pluginId: string,
|
|
onEvent: (event: PluginCustomEvent) => void,
|
|
) => () => void;
|
|
}
|
|
}
|