dsh-plugin-toolkit 0.20.25 → 0.20.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## 0.20.26
2
+
3
+ - **The published tarball ships `scripts/preview.mjs`, so the command the
4
+ README tells a reader to run exists after install.** `files` listed the
5
+ benchmark and compatibility scripts but not the panel preview, so
6
+ `node scripts/preview.mjs /tmp/panel.html` worked only in a checkout and
7
+ failed with `MODULE_NOT_FOUND` in an installed package. The script is now in
8
+ the published file list. A test requires `npm pack --dry-run --json` to list
9
+ it and installs the packed tarball into a temp prefix, where the installed
10
+ copy must be byte-identical to the repository file.
11
+
12
+ - **Every `node scripts/<name>.mjs` command a shipped README tells a reader to
13
+ run is now gated against the tarball.** The 0.20.12 `files` list shipped the
14
+ benchmark and compatibility scripts but not `scripts/preview.mjs`, and only
15
+ that one path had a dedicated test. A new test extracts every such command
16
+ from `README.md` and `README.zh.md`, compares the paths with
17
+ `npm pack --dry-run --json`, and fails with the omitted path. The 0.20.12 file
18
+ list is kept as a control, so the gate is shown to fail on the bug it closes.
19
+
1
20
  ## 0.20.25
2
21
 
3
22
  - **`audit` reads a profile `package.json` saved with a UTF-8 BOM instead of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-toolkit",
3
- "version": "0.20.25",
3
+ "version": "0.20.26",
4
4
  "description": "Preflight, release and test DeepSeek Harness plugins: check a folder or any GitHub repository, wait for npm to actually serve the version, and keep the market index honest.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -28,6 +28,7 @@
28
28
  "docs/ecosystem-audit-2026-11-03.txt",
29
29
  "scripts/benchmark-audit.mjs",
30
30
  "scripts/compatibility-sample.mjs",
31
+ "scripts/preview.mjs",
31
32
  "examples/compatibility-sample/"
32
33
  ],
33
34
  "engines": {
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Render the panel to a static page so its layout can be looked at.
3
+ *
4
+ * The bundle is mounted in jsdom with the same testkit a test would use, and
5
+ * the resulting markup plus the plugin's own stylesheet becomes one HTML file.
6
+ * No browser automation, no screenshot of the real app: this is the panel's
7
+ * markup and its CSS, in the states that matter.
8
+ */
9
+ import fs from 'node:fs';
10
+ import path from 'node:path';
11
+ import { createHost, createFetch, mountClient } from '../lib/testkit/index.mjs';
12
+
13
+ const ROOT = path.resolve(import.meta.dirname, '..');
14
+ const out = process.argv[2] ?? '/tmp/kit-preview.html';
15
+
16
+ const result = {
17
+ ok: false,
18
+ dir: '/Users/you/work/my-plugin',
19
+ checks: [
20
+ { check: 'manifest', ok: true, message: 'my-plugin@0.2.0' },
21
+ { check: 'engines.dsh', ok: true, message: '>=0.2.0' },
22
+ { check: 'root export', ok: false, message: 'exports["."] points at the CLI (./bin/cli.mjs), so the loader\'s row has no plugin to apply' },
23
+ { check: 'client declaration', ok: true, message: 'dsh.client platform=web, exports["./client"]=./client.js' },
24
+ { check: 'files list', ok: false, message: 'files does not ship client.js, which package.json points at, so the installed plugin would be missing its own code' },
25
+ { check: 'readme', ok: true, message: 'Requirements section found' },
26
+ ],
27
+ };
28
+
29
+ const CANDIDATES = {
30
+ ok: false,
31
+ kind: 'candidates',
32
+ query: 'dsh-plugin',
33
+ candidates: [
34
+ { fullName: 'tanzhangjia/dsh-plugins-examples', description: 'Example plugins for the DeepSeek Harness', stars: 1, url: 'https://github.com/tanzhangjia/dsh-plugins-examples' },
35
+ { fullName: 'WJDdidi-1/dsh-plugin-example', description: 'A minimal panel plugin', stars: 0, url: 'https://github.com/WJDdidi-1/dsh-plugin-example' },
36
+ { fullName: 'hopefullstack-collab/dsh-plugin-company-example', description: '', stars: 0, url: 'https://github.com/hopefullstack-collab/dsh-plugin-company-example' },
37
+ ],
38
+ };
39
+
40
+ const REPO_RESULT = {
41
+ ...result,
42
+ kind: 'github',
43
+ dir: '/tmp/dsh-toolkit-gh-1a2b/repo',
44
+ repo: { fullName: 'WJDdidi-1/dsh-plugin-example', url: 'https://github.com/WJDdidi-1/dsh-plugin-example' },
45
+ };
46
+
47
+ const states = [
48
+ { name: 'dock collapsed', slot: 'conversation.input.dock', before: async () => {} },
49
+ { name: 'dock open', slot: 'conversation.input.dock', before: async (panel) => { await panel.click('.tk-dock-toggle'); } },
50
+ { name: 'dock result', slot: 'conversation.input.dock', before: async (panel) => { await panel.click('.tk-dock-toggle'); await panel.type('.tk-input', '/Users/you/work/my-plugin'); await panel.click('.tk-button'); } },
51
+ { name: 'dock candidates', slot: 'conversation.input.dock', route: 'search', before: async (panel) => { await panel.click('.tk-dock-toggle'); await panel.type('.tk-input', 'dsh-plugin'); await panel.click('.tk-button'); } },
52
+ { name: 'dock repository', slot: 'conversation.input.dock', route: 'repo', before: async (panel) => { await panel.click('.tk-dock-toggle'); await panel.type('.tk-input', 'WJDdidi-1/dsh-plugin-example'); await panel.click('.tk-button'); } },
53
+ { name: 'tab', slot: undefined, before: async () => {} },
54
+ { name: 'tab result', slot: undefined, before: async (panel) => { await panel.type('.tk-input', '/Users/you/work/my-plugin'); await panel.click('.tk-button'); } },
55
+ ];
56
+
57
+ const sections = [];
58
+ let firstPanel = null; // the injected stylesheet, read while the first panel is alive
59
+ for (const state of states) {
60
+ const panel = await mountClient({
61
+ file: path.join(ROOT, 'client.js'),
62
+ slot: state.slot,
63
+ host: createHost({ locale: { en: {}, zh: {} } }),
64
+ fetch: createFetch({ '/toolkit/check': { body: state.route === 'search' ? CANDIDATES : state.route === 'repo' ? REPO_RESULT : result } }),
65
+ });
66
+ if (firstPanel === null) {
67
+ firstPanel = panel.window.document.getElementById('dsh-plugin-toolkit:styles')?.textContent ?? '';
68
+ }
69
+ await state.before(panel);
70
+ sections.push(`<section class="frame"><h2>${state.name}</h2><div class="stage${state.slot === undefined ? '' : ' dock'}">${panel.html()}</div></section>`);
71
+ await panel.unmount();
72
+ }
73
+
74
+ // The stylesheet the plugin injects, read from the DOM it injected into: parsing
75
+ // the source with a regex silently truncates at the first `;` in a string.
76
+ const css = firstPanel;
77
+
78
+ const page = `<!doctype html><html lang="zh"><head><meta charset="utf-8"><title>dsh-plugin-toolkit preview</title>
79
+ <style>
80
+ :root { --dsw-alias-label-primary:#1f2329; --dsw-alias-label-secondary:#646a73; --dsw-alias-label-tertiary:#8f959e;
81
+ --dsw-alias-border-l1:#e5e6eb; --dsw-alias-border-l2:#d9dbe1; --dsw-alias-bg-body:#fff; --dsw-alias-bg-l1:#f7f8fa;
82
+ --dsw-alias-state-business-primary:#4176e6; --dsw-alias-state-success-primary:#2ea121; --dsw-alias-state-error-primary:#d54941; }
83
+ body { margin:0; padding:32px; background:#eef0f4; font:13px/1.5 -apple-system, "PingFang SC", system-ui, sans-serif; color:#1f2329; }
84
+ .frame { background:#fff; border-radius:12px; padding:20px; margin:0 0 24px; max-width:1120px; }
85
+ .frame h2 { font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:#8f959e; margin:0 0 14px; }
86
+ .stage { border:1px dashed #d9dbe1; border-radius:8px; padding:12px; }
87
+ .stage.dock { padding:0; }
88
+ ${css}
89
+ </style></head><body>${sections.join('\n')}</body></html>`;
90
+
91
+ fs.writeFileSync(out, page);
92
+ console.log(`wrote ${out} (${page.length} bytes)`);