dsh-plugin-toolkit 0.20.45 → 0.20.46

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,19 @@
1
+ ## 0.20.46
2
+
3
+ - **`index` rejects two plugin entries that share a name before auditing
4
+ either.** The audit resolves a plugin by name, so a second `dup-plugin` entry
5
+ re-read the first entry's versions and printed `ok` for both, even when the
6
+ duplicate was the broken one. The shape pass now groups plugin names by
7
+ position and emits one finding naming every duplicate position
8
+ (`plugins[0], plugins[1]`), so the command exits `1` before the `ok` loop can
9
+ start. Distinct names still audit and print `ok` for each entry. A unique
10
+ plugin may list several versions, and when its second version (`1.0.1`) omits
11
+ `engines.dsh` the command still exits `1` with `1.0.1 no engines.dsh` instead
12
+ of inheriting the clean first version.
13
+ `test/index-duplicate.test.mjs` pins the duplicate finding at the library and
14
+ the shipped CLI, the absence of either `ok` line, and both control paths,
15
+ including the finding for a second version that is missing its range.
16
+
1
17
  ## 0.20.45
2
18
 
3
19
  - **The reproducible compatibility sample answers for the DSH version the
package/README.md CHANGED
@@ -416,8 +416,11 @@ forgets `client.js` passes it and fails only after `npm i`.
416
416
  `engines.dsh` is missing or is not a semver range (a malformed value such as
417
417
  `>=banana`, or a single pinned version such as `0.2.0`, both fail). It also
418
418
  rejects an index it cannot audit: a missing `plugins` or `versions` array, a
419
- plugin entry without a name, a version entry without `version`, and a
420
- non-SemVer `version`. Each failure names the file and the plugin or entry.
419
+ plugin entry without a name, two entries sharing one name, a version entry
420
+ without `version`, and a non-SemVer `version`. Each failure names the file and
421
+ the plugin, entry, or both duplicate positions. A duplicate is rejected before
422
+ any audit, so the second entry cannot inherit the first entry's clean result or
423
+ produce an `ok` line.
421
424
  Pin `version:` if you would rather not track the latest release.
422
425
 
423
426
  ## Check a plugin you have not cloned
@@ -37,6 +37,11 @@ function nonEmptyString(value) {
37
37
  * list) or crashed on `plugin.name` and printed a raw TypeError. Every finding
38
38
  * names the plugin and, where one exists, the entry position or version, so a
39
39
  * CI log points at the JSON line to edit instead of at the command.
40
+ *
41
+ * Names have to be unique too. `auditVersions()` resolves a plugin by name, so
42
+ * a second entry with the same name made the audit re-read the first entry and
43
+ * report the duplicate clean. Duplicate names are reported by position, before
44
+ * any `engines.dsh` check can print `ok` for either entry.
40
45
  */
41
46
  export function validateIndex(index) {
42
47
  if (isRecord(index) === false) {
@@ -55,6 +60,7 @@ export function validateIndex(index) {
55
60
  }
56
61
 
57
62
  const findings = [];
63
+ const names = new Map();
58
64
  index.plugins.forEach((plugin, pluginPosition) => {
59
65
  if (isRecord(plugin) === false) {
60
66
  findings.push({ entry: `plugins[${pluginPosition}]`, problem: 'the plugin entry is not an object' });
@@ -62,6 +68,14 @@ export function validateIndex(index) {
62
68
  }
63
69
 
64
70
  const name = nonEmptyString(plugin.name) ? plugin.name : `plugins[${pluginPosition}]`;
71
+ if (nonEmptyString(plugin.name)) {
72
+ // Keep every position so the finding names the entry to delete, not just
73
+ // the one the audit happens to read. A blank or missing name already has
74
+ // its own finding and is not a duplicate.
75
+ const positions = names.get(plugin.name) ?? [];
76
+ positions.push(pluginPosition);
77
+ names.set(plugin.name, positions);
78
+ }
65
79
  if (nonEmptyString(plugin.name) === false) {
66
80
  findings.push({
67
81
  entry: name,
@@ -111,6 +125,17 @@ export function validateIndex(index) {
111
125
  }
112
126
  });
113
127
  });
128
+
129
+ // One finding per repeated name, naming every duplicate position. Auditing a
130
+ // duplicate by name would silently reuse the first entry, so this has to
131
+ // stop the command before the `ok` loop starts.
132
+ for (const [name, positions] of names) {
133
+ if (positions.length < 2) continue;
134
+ findings.push({
135
+ entry: positions.map((position) => `plugins[${position}]`).join(', '),
136
+ problem: `all are named "${name}"; every plugin name must be unique`,
137
+ });
138
+ }
114
139
  return findings;
115
140
  }
116
141
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-toolkit",
3
- "version": "0.20.45",
3
+ "version": "0.20.46",
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": {