feat: make each plugin an npm workspace built by a termix-plugin CLI

This commit is contained in:
LukeGus committed 2026-09-22 15:09:50 -05:00
1 parent 4758016f41
commit 5796186a1c
448 files changed
+3087 -2003

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import type { PluginContext } from "@termix/plugin-sdk/backend";
import {
TERMINAL_WS_PORT,
sessionManager,
startTerminalServer,
stopTerminalServer,
} from "../../../../src/backend/hosts/terminal/index.js";
export async function activate(ctx: PluginContext) {
await startTerminalServer();
// Published so collab and session-sharing can reach live sessions without
// importing a plugin. Revoked automatically when this plugin is disabled.
ctx.registry.provide("terminal.sessions", sessionManager ?? null);
ctx.log.info(`SSH terminal listening on ${TERMINAL_WS_PORT ?? 30002}`);
}
export async function deactivate() {
await stopTerminalServer();
}
@@ -0,0 +1,49 @@
/**
* Frontend half of the ssh-terminal plugin.
*
* Registers the existing Terminal component through the extension seams that
* already exist in the shell (registerRailItem / registerTabComponent). The
* component itself is unchanged and still lives in src/ui/features/terminal -
* this only controls whether the shell knows about it.
*
* register() is called when the plugin is enabled, unregister() when it is
* disabled, so the tab and rail entry appear and disappear with the plugin.
*/
export const id = "ssh-terminal";
export const tabId = "terminal";
export const toolbarSlotId = "terminal.toolbar";
export async function register({
registerRailItem,
registerTabComponent,
declareActionSlot,
icons,
}) {
registerTabComponent(tabId, () =>
import("@/features/terminal/Terminal").then((m) => ({
default: m.Terminal,
})),
);
registerRailItem({
id: tabId,
icon: icons.SquareTerminal,
labelKey: "nav.terminal",
kind: "tab",
});
// Offers other plugins a place in the terminal toolbar. The terminal does
// not know or care who fills it.
declareActionSlot({ id: toolbarSlotId, accepts: ["button"] });
}
export async function unregister({
unregisterRailItem,
unregisterTabComponent,
undeclareActionSlot,
}) {
unregisterRailItem(tabId);
unregisterTabComponent(tabId);
undeclareActionSlot(toolbarSlotId);
}