From be02c3516f71dddfdd954e8024c2feb96bda5495 Mon Sep 17 00:00:00 2001 From: Federico Jaramillo Martinez Date: Wed, 3 Jun 2026 22:53:37 +0200 Subject: [PATCH] fix(plugins): rename updates plugin id --- .changeset/updates-plugin-rename.md | 5 ++ README.md | 2 +- docs/plugins.html | 22 +++++++- docs/plugins.md | 17 +++++- pi-web-plugins/pi-web/package.json | 9 ---- pi-web-plugins/updates/package.json | 9 ++++ .../{pi-web => updates}/pi-web-plugin.ts | 52 +++++++++---------- 7 files changed, 78 insertions(+), 38 deletions(-) create mode 100644 .changeset/updates-plugin-rename.md delete mode 100644 pi-web-plugins/pi-web/package.json create mode 100644 pi-web-plugins/updates/package.json rename pi-web-plugins/{pi-web => updates}/pi-web-plugin.ts (71%) diff --git a/.changeset/updates-plugin-rename.md b/.changeset/updates-plugin-rename.md new file mode 100644 index 0000000..1ddfd22 --- /dev/null +++ b/.changeset/updates-plugin-rename.md @@ -0,0 +1,5 @@ +--- +"@jmfederico/pi-web": patch +--- + +Rename the built-in Updates plugin id from `pi-web` to `updates` for clearer plugin configuration. diff --git a/README.md b/README.md index 74488f9..212fb36 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ PI WEB keeps its own state intentionally small: PI WEB production installs can load trusted local UI plugins without rebuilding PI WEB. Plugins are browser-side ES modules that can add action-palette actions, workspace panels, and workspace-label metadata. They do not run in the session daemon and are not sandboxed. -The supported package shape is intentionally singular: `piWeb.plugins` entries with explicit `id` and `module`, plus a browser module that exports `{ apiVersion: 1, name, activate }`. The bundled `pi-web-plugins/info` TypeScript source is the canonical minimal real example, `pi-web-plugins/pi-web` demonstrates a dynamic status panel, and built-in [Workspace Tasks](docs/plugins.md#workspace-tasks) adds a workspace tab for running configured shell commands in PI WEB terminals. +The supported package shape is intentionally singular: `piWeb.plugins` entries with explicit `id` and `module`, plus a browser module that exports `{ apiVersion: 1, name, activate }`. The bundled `pi-web-plugins/info` TypeScript source is the canonical minimal real example, `pi-web-plugins/updates` demonstrates a dynamic status panel, and built-in [Workspace Tasks](docs/plugins.md#workspace-tasks) adds a workspace tab for running configured shell commands in PI WEB terminals. A useful prompt for AI agents: diff --git a/docs/plugins.html b/docs/plugins.html index ffe07b3..f618e62 100644 --- a/docs/plugins.html +++ b/docs/plugins.html @@ -162,7 +162,7 @@ After editing, check the manifest endpoint and browser-console failure cases.info plugin.

- The bundled pi-web status plugin demonstrates dynamic visible and badge + The bundled updates plugin demonstrates dynamic visible and badge callbacks for tabs that only appear when the host has status messages or needs extra install visibility.

@@ -179,6 +179,26 @@ After editing, check the manifest endpoint and browser-console failure cases.plugins config key.

+

Updates

+

+ Updates adds a conditional Updates workspace tab with PI WEB update, + restart, and installed-service guidance. It is built into PI WEB and enabled by default. +

+ +
+
+ Disable Updates + +
+
{
+  "plugins": {
+    "updates": { "enabled": false }
+  }
+}
+
+

Workspace Tasks

Workspace Tasks adds a Tasks workspace tab for running configured shell diff --git a/docs/plugins.md b/docs/plugins.md index 74d1d1f..97d5fe8 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -112,7 +112,7 @@ export default { When copying the Info plugin, choose a new plugin id so it does not conflict with the bundled `info` plugin. -PI WEB also ships a `pi-web` status plugin that demonstrates dynamic `visible` and `badge` callbacks for tabs that only appear when the host has status messages or needs extra install visibility. +PI WEB also ships an `updates` plugin that demonstrates dynamic `visible` and `badge` callbacks for tabs that only appear when the host has status messages or needs extra install visibility. ## Local plugin usage @@ -157,6 +157,21 @@ PI WEB ships core, discoverable plugins in the main `@jmfederico/pi-web` npm pac Built-in plugins can be managed from **Settings → Plugins** or with the top-level `plugins` config key. +### Updates + +**Plugin id:** `updates` +**What it does:** adds a conditional **Updates** workspace tab with PI WEB update, restart, and installed-service guidance. + +Updates is enabled by default. To hide it, disable `updates` in **Settings → Plugins** or set: + +```json +{ + "plugins": { + "updates": { "enabled": false } + } +} +``` + ### Workspace Tasks **Plugin id:** `workspace-tasks` diff --git a/pi-web-plugins/pi-web/package.json b/pi-web-plugins/pi-web/package.json deleted file mode 100644 index 136c5cf..0000000 --- a/pi-web-plugins/pi-web/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "@pi-web/status-plugin", - "private": true, - "piWeb": { - "plugins": [ - { "id": "pi-web", "module": "pi-web-plugin.js" } - ] - } -} diff --git a/pi-web-plugins/updates/package.json b/pi-web-plugins/updates/package.json new file mode 100644 index 0000000..e53b362 --- /dev/null +++ b/pi-web-plugins/updates/package.json @@ -0,0 +1,9 @@ +{ + "name": "@pi-web/updates-plugin", + "private": true, + "piWeb": { + "plugins": [ + { "id": "updates", "module": "pi-web-plugin.js" } + ] + } +} diff --git a/pi-web-plugins/pi-web/pi-web-plugin.ts b/pi-web-plugins/updates/pi-web-plugin.ts similarity index 71% rename from pi-web-plugins/pi-web/pi-web-plugin.ts rename to pi-web-plugins/updates/pi-web-plugin.ts index 800c276..fda5c17 100644 --- a/pi-web-plugins/pi-web/pi-web-plugin.ts +++ b/pi-web-plugins/updates/pi-web-plugin.ts @@ -19,7 +19,7 @@ function isLocalOrUnknownInstallation(installation: PiWebInstallationInfo | unde return installation === undefined || installation.kind === "local" || installation.kind === "unknown"; } -function shouldShowStatusPanel(state: AppState): boolean { +function shouldShowUpdatesPanel(state: AppState): boolean { const status = statusFor(state); if (messageCount(state) > 0) return true; if (status === undefined) return false; @@ -50,7 +50,7 @@ function renderComponent(html: HtmlTemplateTag, component: PiWebComponentStatus) ? "restart needed" : "current"; return html` -

+
${component.label} ${status} running ${formatVersion(component.runtimeVersion)} · installed ${formatVersion(component.installedVersion)} @@ -61,7 +61,7 @@ function renderComponent(html: HtmlTemplateTag, component: PiWebComponentStatus) function renderCommand(html: HtmlTemplateTag, label: string, command: string): TemplateResult { return html` -
+
${label} ${command} @@ -87,7 +87,7 @@ function renderCommands(html: HtmlTemplateTag, status: PiWebStatusResponse): Tem `; } -function renderStatusPanel(html: HtmlTemplateTag, state: AppState): TemplateResult { +function renderUpdatesPanel(html: HtmlTemplateTag, state: AppState): TemplateResult { const status = statusFor(state); if (status === undefined) { return html` @@ -99,29 +99,29 @@ function renderStatusPanel(html: HtmlTemplateTag, state: AppState): TemplateResu const messages = status.messages; return html`
Updatesbeta${messages.length > 0 ? html`${String(messages.length)}` : null}
-
+
${messages.length === 0 ? html`

No PI WEB update or restart messages.

` : messages.map((message) => html` -
-
${message.title}${message.severity}
+
+
${message.title}${message.severity}

${message.body}

${message.command === undefined ? null : html`${message.command}`}
@@ -136,7 +136,7 @@ function renderStatusPanel(html: HtmlTemplateTag, state: AppState): TemplateResu ${renderCommands(html, status)} -
+
Generated ${status.generatedAt} ${status.release.latestVersion === undefined ? null : html`Latest npm release ${status.release.latestVersion}`} ${status.release.skipped === true ? html`Remote version check skipped.` : null} @@ -148,12 +148,12 @@ function renderStatusPanel(html: HtmlTemplateTag, state: AppState): TemplateResu const plugin: PiWebPlugin = { apiVersion: 1, - name: "PI WEB Updates", + name: "Updates", activate: ({ html, svg }) => ({ contributions: { workspacePanels: [ { - id: "workspace.status", + id: "workspace.updates", title: "Updates", icon: svg` @@ -164,12 +164,12 @@ const plugin: PiWebPlugin = { `, order: 100, - visible: (context) => shouldShowStatusPanel(context.state), + visible: (context) => shouldShowUpdatesPanel(context.state), badge: (context) => { const count = messageCount(context.state); return html`beta${count > 0 ? html` · ${String(count)}` : null}`; }, - render: (context) => renderStatusPanel(html, context.state), + render: (context) => renderUpdatesPanel(html, context.state), }, ], },