feat(meta): give the plugin the icon and locale DSH 0.1.7 shows in its list

0.1.7 reads `package.json#icon` plus `locale/<lang>.json` to illustrate and
label a plugin in the Plugins page and the `plugin_manager` list. The plugin
had neither, so it rendered as a bare row (and every other third-party entry
in this profile still does — ours is now the only one with a real mark).

The icon follows the two icons DSH ships for this feature
(packages/experimental/*/icon.svg): a 36x36, fill-only geometric mark with a
blue gradient and no stroked outlines or text. It reads as a panel with a
docked right rail — the sidebar this plugin is. The first cut used two blocks
separated by a gap, but the rail shared the panel's light tone at the top, so
the split leaned on a 3px gap that shrinks away at list size; a darker rail
flush inside one panel survives any downscale.

`locale/en.json` is the discovery baseline English needs to be present for the
whole directory to be read — and `locale/zh.json` carries the Chinese title
and blurb. The manifest's own `description` still advertised the terminal and
the browser, which this plugin handed to DSH in 0.20.0; it is now user-visible
as the fallback label, so it was corrected too.

Every failure in this feature is silent: bad metadata only ever degrades to a
plain text row. `tests/plugin-meta.spec.ts` therefore pins both ends — the
manifest wiring and the packed tarball — plus the house style of the artwork,
and was red/green verified (removing `icon.svg` from `files` fails it twice,
once against the real tarball).

Verified on the live 3080 instance: `readPluginMeta` resolves the icon to a
`data:image/svg+xml` URI and the page renders it (`ourIconExact: 1`, no page
errors).
This commit is contained in:
Menghuan1918
2026-09-22 17:44:18 +08:00
parent 97ef21fe09
commit 3ee2d40ff9
6 changed files with 152 additions and 5 deletions
+8 -4
View File
@@ -1,7 +1,7 @@
{
"name": "dsh-better-sidebar",
"version": "0.21.0-alpha.1",
"description": "DSH web plugin: a VSCode-like right sidebar (explorer / editor / terminal / git / browser), isolated per conversation session. Exposes a service for other plugins to register sidebar tabs and file viewers.",
"description": "DSH web plugin: a VSCode-like right sidebar (file tree / editor / changes / tasks / side chat), isolated per conversation. Exposes a service for other plugins to register sidebar tabs and file viewers.",
"type": "module",
"repository": {
"type": "git",
@@ -34,7 +34,8 @@
"default": "./lib/client.js"
},
"./src/*": "./src/*",
"./package.json": "./package.json"
"./package.json": "./package.json",
"./locale/*.json": "./locale/*.json"
},
"engines": {
"node": ">=20"
@@ -71,7 +72,9 @@
"cordis.patch.yml",
"README.md",
"README_EN.md",
"LICENSE"
"LICENSE",
"icon.svg",
"locale/*.json"
],
"scripts": {
"build": "node -e \"require('node:fs').rmSync('lib',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && tsdown",
@@ -219,5 +222,6 @@
"unrun": "^0.2.39",
"vitest": "^4.1.8",
"zustand": "~4.4.7"
}
},
"icon": "./icon.svg"
}