@shidesheng0218/dsh-plugin-lint 0.0.0-stage → 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,13 @@
1
+ dsh-plugin-lint
2
+ Copyright 2026 the dsh-plugin-lint authors
3
+
4
+ This product includes data derived from the DeepSeek Harness distribution:
5
+
6
+ src/data/event-types.json — the session event type catalog, harvested from
7
+ public `session.append(...)` call sites in the DeepSeek Harness packages.
8
+ DeepSeek Harness is licensed under the MIT License.
9
+ https://github.com/deepseek-ai/deepseek-harness
10
+
11
+ The rule set in src/rules/ encodes practices documented in the DeepSeek Harness
12
+ plugin-development reference (MIT). Each rule cites its source document in the
13
+ `doc` field so readers can verify the claim against the upstream text.
package/README.md CHANGED
@@ -1,3 +1,301 @@
1
- # Temporary Holding Version
1
+ # dsh-plugin-lint
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/shidesheng0218/dsh-plugin-lint/actions/workflows/ci.yml/badge.svg)](https://github.com/shidesheng0218/dsh-plugin-lint/actions/workflows/ci.yml)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
5
+ [![Node](https://img.shields.io/badge/node-%3E%3D22-brightgreen)](package.json)
6
+ [![Dependencies](https://img.shields.io/badge/runtime%20dependencies-0-brightgreen)](package.json)
7
+
8
+ **Conformance checks and a compatibility matrix for DeepSeek Harness plugins — factual, evidence-backed, zero-config.**
9
+
10
+ [Rules](#the-rules) · [Probe](#the-probe) · [Matrix](#compatibility-matrix) · [Panel](#the-panel) · [Conflicts](#composition-conflicts) · [中文说明](#中文说明)
11
+
12
+ ![The compatibility panel inside the DSH settings page](docs/assets/panel.png)
13
+
14
+ *The panel, running in a throwaway web profile: what this profile has installed, and how each plugin fares across DSH versions.*
15
+
16
+ ---
17
+
18
+ ## What this is
19
+
20
+ Four tools that answer four different questions about a DeepSeek Harness plugin. None of them needs a build step, a config file, or a network connection to run.
21
+
22
+ ```mermaid
23
+ flowchart TB
24
+ pkg["plugin package<br/>on disk"]
25
+
26
+ pkg --> lint["<b>dsh-plugin-lint</b><br/>static rules<br/>is it written the way the reference says?"]
27
+ pkg --> probe["<b>probe-boot</b><br/>one plugin, throwaway profile<br/>does it mount, and what does the model get?"]
28
+
29
+ probe --> matrix["<b>matrix runner</b><br/>plugin x DSH version x composition<br/>which version breaks it?"]
30
+ probe --> conflicts["<b>conflicts</b><br/>several plugins at once<br/>do they collide?"]
31
+
32
+ matrix --> panel["<b>settings panel</b><br/>your installed plugins<br/>what about <i>my</i> setup?"]
33
+ matrix --> index["aggregate index<br/>ecosystem numbers"]
34
+
35
+ classDef tool fill:#eef6ff,stroke:#4a7dbd,color:#123
36
+ class lint,probe,matrix,conflicts,panel tool
37
+ ```
38
+
39
+ Every finding carries a file, a line, an evidence excerpt, and the upstream document the rule encodes.
40
+
41
+ ## What this is not
42
+
43
+ - **Not a security endorsement.** A clean run means no rule fired, nothing more.
44
+ - **Not a replacement for the tools beside it.** Each answers a different question:
45
+
46
+ | Tool | The question it answers | This project |
47
+ | --- | --- | --- |
48
+ | [dsh-plugin-doctor](https://github.com/zoahdev/dsh-plugin-doctor) | does the package structure and build hold up? | does not touch builds |
49
+ | [dsh-testkit](https://github.com/iiwish/dsh-testkit) | does it install, run and uninstall on a real host? | only checks artifacts on disk |
50
+ | [dsh-trust-check](https://github.com/liuwenji007/dsh-trust-check) | what can this plugin touch? | makes no security judgement |
51
+ | [dsh-my-guardian](https://github.com/baosfeng/my-dsh-plugins) | what happens after it breaks? | does not recover anything |
52
+ | **dsh-plugin-lint** | **is it written the way the reference says, will it survive publishing, and will it survive an upgrade?** | — |
53
+
54
+ ```console
55
+ $ npx @shidesheng0218/dsh-plugin-lint .
56
+ demo-plugin@1.0.0 11 checks
57
+
58
+ E2 error client bundle factory id does not match the package name
59
+ lib/client.js:2
60
+ factory id "other-name" does not equal the package name "demo-plugin".
61
+ evidence: __ModuleLoader__.load({ id: "other-name" })
62
+ why: the browser module table keys the factory by package name; a mismatch
63
+ leaves the registration unreachable at runtime.
64
+ doc: dsh plugin-development / references/ui-plugin.md
65
+
66
+ W1 warn loads a Harness Client package as a module
67
+ lib/client.js:12
68
+ loads "@deepseek-ai/dsh-client-ui-primitives" from the browser module table.
69
+ why: the reference advises copying the primitive instead — these packages
70
+ change without notice and a throwing component blanks the slot. Official
71
+ first-party bundles do the same, so treat this as a coupling risk to
72
+ watch at upgrade time, not as a defect.
73
+
74
+ 1 error · 1 warn · 0 info
75
+ ```
76
+
77
+ ## The rules
78
+
79
+ Levels are assigned by **how reliably a rule can decide**, not by how bad the pattern sounds. A rule that cannot decide reliably does not get to be an error.
80
+
81
+ **error** — mechanically decidable, never observed in the official packages
82
+
83
+ | Rule | What it catches |
84
+ | --- | --- |
85
+ | E1 | `session.append("type", …)` with a type outside the Harness event catalog (45 types, harvested from the official packages) |
86
+ | E2 | client bundle factory id ≠ package name (the registration silently never resolves) |
87
+ | E3 | `main` / `exports["./client"]` / `dsh.bundle.patch` / `icon` points at a missing file |
88
+ | E4 | `dsh.client` declared with no resolvable `./client` export |
89
+ | E5 | `files[]` omits an artifact the manifest depends on — the "works locally, broken after publish" bug |
90
+
91
+ **warn** — documented risk patterns, evidence required
92
+
93
+ | Rule | What it catches |
94
+ | --- | --- |
95
+ | W1 | loads a `@deepseek-ai/dsh-client-*` package as a module (first-party packages exempt: they ship with the module table) |
96
+ | W2 | subscribes to `session/event` and rescans the log inside the listener instead of folding through `ctx.sessionProjections` |
97
+ | I3 | locale metadata exists but is not exported or published |
98
+
99
+ **info** — review hints and metadata completeness
100
+
101
+ | Rule | What it catches |
102
+ | --- | --- |
103
+ | I1 | no `dsh.compatibility.dshReleases` (or it omits the running DSH version, with `--dsh-version`) |
104
+ | I2 | no `icon`, or no `meta` title/description in `locale/<lang>.json` |
105
+ | W3 | a timer that looks unowned (brace depth is approximate on bundled output) |
106
+
107
+ Rules the first draft had, and why they are gone: "a waterfall listener must call `next()`" (real plugins reject deliberately, and re-enter `ctx.llm.stream()` on purpose), "never listen to `system-prompt/assemble`" (the official packages do, four times), "never subscribe to `session/event`" (the reference forbids *rescanning*, not subscribing). See [docs/06](docs/06-detailed-design.md).
108
+
109
+ ## The probe
110
+
111
+ Static analysis reads code. The probe reads **behaviour**: it boots a real DSH in a throwaway home with one plugin installed and records what the host did with it.
112
+
113
+ ```mermaid
114
+ flowchart LR
115
+ a["temporary<br/>DSH_HOME"] --> b["materialize the<br/>shipped profile"]
116
+ b --> c["dsh plugin add &lt;target&gt;"]
117
+ c --> d["boot with a stub<br/>Anthropic-Messages provider"]
118
+ d --> e["parse stderr:<br/>mount warnings,<br/>registered tools,<br/>system prompt"]
119
+ e --> f{"verdict"}
120
+ f -->|"mounted"| g["active<br/>+ what the model receives"]
121
+ f -->|"waiting for a service<br/>this composition lacks"| h["awaiting-service<br/>not a failure"]
122
+ f -->|"the host refused it"| i["rejected-by-host"]
123
+ ```
124
+
125
+ Two details make it work, and both were learned the hard way:
126
+
127
+ - **The success sentinel is a missing credential.** The throwaway home has no API key, so a plugin that mounted successfully ends in `MISSING_CREDENTIAL`. That is the signal.
128
+ - **The exit code is never the signal.** A mount failure is a warning and the process still exits 0.
129
+
130
+ ```bash
131
+ node scripts/probe-boot.mjs dsh-mnemon --tools
132
+ # active (3732 ms)
133
+ # tools 24 -> 41 +17: mnemon_remember, mnemon_recall, mnemon_forget, ...
134
+ # system prompt 2640 -> 7153 chars
135
+ ```
136
+
137
+ See [docs/11](docs/11-m4-capability-probe.md).
138
+
139
+ ## Why this exists
140
+
141
+ Measured on 2026-10-13 against the top 40 published community plugins and an installed DSH 0.2.0-rc.2:
142
+
143
+ | Observation | Result |
144
+ | --- | --- |
145
+ | plugins whose `peerDependencies` couple them to a Harness Client package | **16 / 40 (40%)** |
146
+ | plugins declaring `dsh.compatibility.dshReleases` | **5 / 40 (13%)** |
147
+ | plugins declaring an `icon` | 16 / 40 (40%) |
148
+
149
+ The ecosystem has 4,508 catalogued plugins and adds roughly a thousand a month. Upgrade breakage is a product category of its own (three tools sell the *recovery*), but nothing was checking the code against the documented practices.
150
+
151
+ ### Measured with this tool
152
+
153
+ | Run | Result |
154
+ | --- | --- |
155
+ | 80 official `@deepseek-ai/*` packages (zero-false-positive baseline) | **0 error · 0 warn** · 239 info |
156
+ | Top 100 published community plugins | **1 error · 86 warn** · 223 info |
157
+ | — of which couple to a Harness Client package | **62%** |
158
+ | — of which declare no DSH compatibility range | **87%** |
159
+
160
+ The error rules did not fire on any published plugin. They are insurance against rare, fatal mistakes — the daily value is the coupling inventory (W1) and declaration completeness (I1/I2), which nearly every plugin is missing something on. See [docs/07](docs/07-m1-results.md).
161
+
162
+ ## Usage
163
+
164
+ ```bash
165
+ npx @shidesheng0218/dsh-plugin-lint . # lint the package in the current directory
166
+ npx @shidesheng0218/dsh-plugin-lint ./plugins/a ./plugins/b
167
+ npx @shidesheng0218/dsh-plugin-lint . --json # machine-readable report
168
+ npx @shidesheng0218/dsh-plugin-lint . --sarif # SARIF 2.1.0 for code scanning
169
+ npx @shidesheng0218/dsh-plugin-lint . --dsh-version 0.2.0-rc.2
170
+ npx @shidesheng0218/dsh-plugin-lint . --exit-code # exit 1 when an error-level finding is present
171
+ ```
172
+
173
+ Exit codes: `0` ok · `1` errors found with `--exit-code` · `2` the run failed.
174
+
175
+ ## Compatibility matrix
176
+
177
+ The probe also runs as a grid: one cell per plugin version × DSH version × composition.
178
+
179
+ ```bash
180
+ node scripts/matrix/run.mjs --targets matrix/targets-top50.json --concurrency 4
181
+ node scripts/matrix/site.mjs
182
+ ```
183
+
184
+ Measured on 2026-10-13 over **228 cells** (57 plugins, two DSH versions, headless and web):
185
+
186
+ | Status | Cells | Meaning |
187
+ | --- | --- | --- |
188
+ | active | 136 | the host half mounted |
189
+ | awaiting-service | 31 | this composition does not provide a service it waits for |
190
+ | rejected-by-host | 30 | **the host itself refused the install** |
191
+ | install-failed | 3 | network (native package download) |
192
+
193
+ **17 of 57 plugins get a worse verdict on the newer DSH version and none get better**; 14 are the host refusing the install outright, and the largest system-prompt growth observed was 10,862 characters. Aggregate numbers: [docs/09](docs/09-ecosystem-measurements.md).
194
+
195
+ Plugin authors can run the same probe from their own CI — [docs/15](docs/15-federation.md):
196
+
197
+ ```yaml
198
+ - uses: shidesheng0218/dsh-plugin-lint/.github/actions/probe@v1
199
+ with:
200
+ target: .
201
+ dsh-versions: 0.2.0-rc.2,0.2.1-alpha.2
202
+ ```
203
+
204
+ Self-reported cells are never presented as ours: they are sampled, re-run, and either promoted to `verified` or marked `disputed` with both verdicts kept.
205
+
206
+ ## Composition conflicts
207
+
208
+ A plugin that mounts alone can still collide with another. `conflicts.mjs` reads the tool names already recorded in the matrix cells, groups them by owner, and then verifies a candidate by installing the pair into **one** profile.
209
+
210
+ The sampled ecosystem had no collisions (16 plugins, 118 tool names), so two fixtures claim the same tool name on purpose. Measured result:
211
+
212
+ | Stage | Result |
213
+ | --- | --- |
214
+ | each alone | both `active`, +1 tool each |
215
+ | **installed together** | **the later one never activates** |
216
+
217
+ ```text
218
+ tool-beta: Error: tool "collide_probe" is already registered
219
+ (for a per-agent variant, register through that agent's `agent.ctx` instead)
220
+ ```
221
+
222
+ It is not "the last one wins" — the later plugin is discarded whole. And because a failed mount is only a warning with exit code 0, a user can run two clashing plugins with one of them silently doing nothing. See [docs/18](docs/18-composition-conflicts.md).
223
+
224
+ ## The panel
225
+
226
+ [`panel/`](panel/) is a real DSH plugin: a settings section listing what this profile has installed and how each plugin fares across DSH versions, read from the matrix snapshot. The screenshot at the top of this file is it, captured by [`scripts/screenshot-panel.mjs`](scripts/screenshot-panel.mjs) in a throwaway web profile.
227
+
228
+ ```bash
229
+ node scripts/matrix/bundle-panel-data.mjs # snapshot the matrix into the package
230
+ dsh plugin --profile <profile> add <absolute path to panel/>
231
+ ```
232
+
233
+ It mounts on both pinned DSH versions in both compositions, and it passes this project's own linter with zero findings — only `react` comes from the browser module table, no Harness Client package is imported, and colours use `--dsw-alias-*` tokens with fallbacks.
234
+
235
+ Visual verification caught two bugs a code review had not: the page said "Running DSH unknown" because `import.meta.resolve` cannot see the harness from inside a profile, and it called first-party bundles "not installed" although the dsh installation provides them. Both are fixed, and [docs/16](docs/16-m5-panel.md) records what was checked.
236
+
237
+ ## Data policy
238
+
239
+ This repository ships the **tool**, not the results. Any output that names a package — `reports/`, `notify/`, `matrix/cells/`, `matrix/index/`, `site/`, and the panel's matrix snapshot — is generated locally and untracked.
240
+
241
+ Two reasons, and they point the same way:
242
+
243
+ 1. **Naming a package is a claim about someone's work.** Doing it well means contacting that maintainer first, and that is a decision, not a default.
244
+ 2. **Verified data is only meaningful for the environment that produced it.** Whoever runs the probe gets their own answer; a snapshot from our machine is not evidence about theirs.
245
+
246
+ The aggregate numbers are published, because they describe the ecosystem rather than any one maintainer: see [docs/09](docs/09-ecosystem-measurements.md).
247
+
248
+ ## Reports
249
+
250
+ ```bash
251
+ node scripts/build-report.mjs --top 100 # ecosystem coupling & declaration report
252
+ node scripts/build-contact-list.mjs reports/<date> # who to notify before publishing
253
+ node scripts/build-notification-pack.mjs # notify/NOTIFICATIONS.md + one message per package
254
+ ```
255
+
256
+ Every report names packages, so the project follows one rule (ADR D-001): **name the package, state only what was detected, cite the source, and notify the maintainer first.** See [docs/08](docs/08-author-notification.md).
257
+
258
+ ## Development
259
+
260
+ ```bash
261
+ npm test # unit tests for every rule (node:test, no dependencies)
262
+ npm run e2e:official # zero-false-positive baseline against official packages
263
+ ```
264
+
265
+ `npm run e2e:official` is the acceptance test that matters: it lints the official `@deepseek-ai/*` packages, which are the reference implementation of the documented practices. **Any error-level finding on them is a bug in a rule, not in the package.** Extract the fixtures first:
266
+
267
+ ```bash
268
+ node scripts/extract-official-fixtures.mjs # reads an installed DSH (asar)
269
+ node scripts/extract-official-fixtures.mjs --limit 80
270
+ ```
271
+
272
+ ## License
273
+
274
+ Apache-2.0. See [NOTICE](NOTICE) for the data derived from DeepSeek Harness (MIT).
275
+
276
+ ---
277
+
278
+ ## 中文说明
279
+
280
+ **给 DeepSeek Harness 插件做合规体检与兼容性实测的工具链:只陈述检测到的事实,每条结论都带文件、行号、证据和官方出处。**
281
+
282
+ **四件事,四个问题**:
283
+
284
+ | 工具 | 回答的问题 |
285
+ | --- | --- |
286
+ | `dsh-plugin-lint` | 代码写得符不符合官方规范、发布出去会不会缺文件 |
287
+ | `probe-boot` | 这个插件在这个 DSH 版本上能不能挂载、给了模型什么 |
288
+ | 矩阵跑批 | 哪个版本会让它坏掉 |
289
+ | `conflicts` | 几个插件装在一起会不会互相顶掉 |
290
+
291
+ **它不是什么**:不是安全背书(干净≠安全);也不替代旁边那几个工具——doctor 管包结构、testkit 管真实宿主生命周期、trust-check 管能力披露、my-guardian 管崩了之后怎么办。
292
+
293
+ **规则分级按"能不能可靠判定"来定,而不是按听起来多严重**:error 级必须机器可判且官方包里从不出现;warn 级是官方文档点名的风险写法,必须附证据;info 级是提示与元数据完整性。
294
+
295
+ **实测数据(2026-10-13)**:Top 40 社区插件里,**40% 依赖了官方的 Client 包**、**只有 13% 声明了兼容的 DSH 版本**;228 格矩阵里 **57 个插件中有 17 个在新版上结论变差,没有一个变好**。
296
+
297
+ **两个只有实测才能知道的坑**:宿主拒绝安装时只是 warning、退出码仍为 0(所以退出码永远不是信号);两个插件抢同一个工具名时,**后注册的那个整个插件报废**,而不是覆盖。
298
+
299
+ **数据政策**:仓库只发工具,不发点名结果——凡是会点名具体包的数据都在本地生成、不进版本库。生态聚合数字照常发布。
300
+
301
+ 初版规则里有三条被实测否掉(官方包自己就在监听 `system-prompt/assemble`;真实插件会故意不调 `next()`),详见 [详细设计](docs/06-detailed-design.md)。
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, readdirSync } from 'node:fs';
3
+ import { join, resolve } from 'node:path';
4
+ import { lintPackage, formatText, toSarif } from '../src/index.js';
5
+
6
+ /**
7
+ * A directory without its own package.json is treated as a container: every
8
+ * immediate subdirectory that is a package gets linted. Monorepos and fixture
9
+ * folders are the reason — measured: CI pointed the tool at a folder of two
10
+ * plugins and it refused the whole run.
11
+ */
12
+ function expandTargets(dir) {
13
+ if (existsSync(join(dir, 'package.json'))) return [dir];
14
+ let entries = [];
15
+ try { entries = readdirSync(dir, { withFileTypes: true }); } catch { entries = []; }
16
+ const packages = entries
17
+ .filter((e) => e.isDirectory() && existsSync(join(dir, e.name, 'package.json')))
18
+ .map((e) => join(dir, e.name));
19
+ if (packages.length === 0) fail('not a package directory (no package.json): ' + dir);
20
+ return packages;
21
+ }
22
+
23
+ const USAGE = [
24
+ 'dsh-plugin-lint — conformance checks for DeepSeek Harness plugins',
25
+ '',
26
+ 'Usage',
27
+ ' dsh-plugin-lint [dir ...] [options]',
28
+ '',
29
+ 'A directory without its own package.json is treated as a container, and every',
30
+ 'immediate subdirectory that is a package is linted.',
31
+ '',
32
+ '',
33
+ 'Options',
34
+ ' --json machine-readable report on stdout',
35
+ ' --sarif SARIF 2.1.0 report on stdout (for code scanning)',
36
+ ' --dsh-version <ver> check dsh.compatibility against this DSH version',
37
+ ' --exit-code exit 1 when any error-level finding is present',
38
+ ' --no-color disable ANSI colour',
39
+ ' --quiet print only the summary line',
40
+ ' -h, --help show this message',
41
+ '',
42
+ 'Exit codes: 0 ok · 1 errors found (with --exit-code) · 2 run failed',
43
+ ].join('\n');
44
+
45
+ function parseArgs(argv) {
46
+ const options = { dirs: [], json: false, sarif: false, exitCode: false, color: process.stdout.isTTY === true, quiet: false, dshVersion: undefined };
47
+ for (let i = 0; i < argv.length; i++) {
48
+ const a = argv[i];
49
+ if (a === '-h' || a === '--help') { console.log(USAGE); process.exit(0); }
50
+ else if (a === '--json') options.json = true;
51
+ else if (a === '--sarif') options.sarif = true;
52
+ else if (a === '--exit-code') options.exitCode = true;
53
+ else if (a === '--no-color') options.color = false;
54
+ else if (a === '--quiet') options.quiet = true;
55
+ else if (a === '--dsh-version') { options.dshVersion = argv[++i]; if (!options.dshVersion) fail('--dsh-version needs a value'); }
56
+ else if (a.startsWith('-')) fail('unknown option: ' + a);
57
+ else options.dirs.push(a);
58
+ }
59
+ if (options.dirs.length === 0) options.dirs.push('.');
60
+ if (process.env.NO_COLOR !== undefined) options.color = false;
61
+ return options;
62
+ }
63
+
64
+ function fail(message) {
65
+ console.error('dsh-plugin-lint: ' + message);
66
+ process.exit(2);
67
+ }
68
+
69
+ const options = parseArgs(process.argv.slice(2));
70
+ const reports = [];
71
+ for (const dir of options.dirs) {
72
+ for (const target of expandTargets(resolve(dir))) {
73
+ try {
74
+ reports.push(lintPackage(target, { dshVersion: options.dshVersion }));
75
+ } catch (error) {
76
+ fail(error.message);
77
+ }
78
+ }
79
+ }
80
+
81
+ if (options.json) {
82
+ console.log(JSON.stringify(reports.length === 1 ? reports[0] : reports, null, 2));
83
+ } else if (options.sarif) {
84
+ console.log(JSON.stringify(toSarif(reports), null, 2));
85
+ } else {
86
+ for (const report of reports) {
87
+ console.log(options.quiet
88
+ ? report.target.name + ': ' + report.summary.error + ' error · ' + report.summary.warn + ' warn · ' + report.summary.info + ' info'
89
+ : formatText(report, { color: options.color }));
90
+ }
91
+ }
92
+
93
+ if (options.exitCode && reports.some((r) => r.summary.error > 0)) process.exit(1);