Files
fusion/plugins/fusion-plugin-cli-printing-press/src/index.ts
Fusion a04b3205b4 feat(FN-3767): add task runtime env injection into executor commands via pl
Adds executor runtime environment support to the plugin system, enabling plugins to contribute environment variables that get injected into executor commands. The implementation includes new plugin types (`ExecutorRuntimeEnvPlugin`), aggregation in the plugin runner, thread-through into executor com

Fusion-Task-Id: FN-3767
2026-05-10 23:36:09 -07:00

59 lines
1.9 KiB
TypeScript

import { definePlugin } from "@fusion/plugin-sdk";
import { createCliPrintingPressRoutes } from "./routes/wizard-routes.js";
import { buildExecutorRuntimeEnv } from "./runtime/executor-runtime-env.js";
import { createCliPressStore, ensureCliPressSchema } from "./store/cli-press-store.js";
const storeByDb = new WeakMap<object, ReturnType<typeof createCliPressStore>>();
function getStore(taskStore: { getDatabase: () => object }) {
const db = taskStore.getDatabase();
const existing = storeByDb.get(db);
if (existing) return existing;
const next = createCliPressStore(db as never);
storeByDb.set(db, next);
return next;
}
const plugin = definePlugin({
manifest: {
id: "fusion-plugin-cli-printing-press",
name: "CLI Printing Press",
version: "0.1.0",
description: "Guided wizard for drafting external service CLI definitions",
},
state: "installed",
hooks: {
onSchemaInit: ensureCliPressSchema,
},
routes: createCliPrintingPressRoutes(),
executorRuntimeEnv: (taskCtx, ctx) => {
const store = getStore(ctx.taskStore as { getDatabase: () => object });
return buildExecutorRuntimeEnv(store, taskCtx, ctx);
},
dashboardViews: [
{
viewId: "wizard",
label: "Create Service CLI",
componentPath: "./dashboard-view",
icon: "Wand2",
placement: "primary",
order: 60,
},
{
viewId: "manage",
label: "Manage Service CLIs",
componentPath: "./manage-view",
icon: "List",
placement: "primary",
order: 61,
},
],
});
export default plugin;
export { CliPrintingPressWizardView } from "./dashboard-view.js";
export { CliPrintingPressManageView } from "./manage-view.js";
export { CliPrintingPressTestRunner } from "./run/TestRunnerPanel.js";
export { createCliPressStore, ensureCliPressSchema } from "./store/cli-press-store.js";
export * from "./store/cli-press-types.js";