@bushizhanghan/dsh-publish-gate 0.12.0 → 0.13.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.0
4
+
5
+ - `market-fork-of-listed` / `market-fork-undisclosed` (warn): the repo is a GitHub fork whose parent is
6
+ already in the catalogue, and nothing says so. A submission was blocked for exactly this: the entry
7
+ described the fork as if it were original work, and both plugins claim the same provider id, so installing
8
+ both silently shadows one of them. The check uses the `fork` and `parent.full_name` fields of the repo
9
+ metadata the market layer already fetches.
3
10
  ## 0.12.0
4
11
 
5
12
  - `pack-ships-junk` (warn): the tarball carries `.bak-*`, `.orig`, `.swp`, `.log`, `~` or `.DS_Store` debris.
package/README.md CHANGED
@@ -141,6 +141,8 @@ dsh plugin --profile desktop add @bushizhanghan/dsh-publish-gate
141
141
  | `market-duplicate-entry` | 这个仓库**已经在目录里**。再提一个 PR 就是同一仓库的第二条条目,reviewer 会拒。版本升级根本不需要 PR——目录条目只存 `url` |
142
142
  | `market-npm-name-collision` | 另一个条目也在发同一个 npm 包,安装路径会互相盖 |
143
143
  | `market-repo-too-new` | 仓库创建不满 24 小时。门禁会报 `0.0 days old` 然后**自己重跑**,PR 不会丢,但在那之前什么都不会合 |
144
+ | `market-fork-of-listed` | 这个仓库是某个**已经在目录里**的仓库的 fork。两条条目装的代码抢同一批 id,两个都装就有一个被静默盖掉——而且 reviewer 会把"没写"当成"隐瞒 fork" |
145
+ | `market-fork-undisclosed` | 是 fork,但 README 和 package.json 里都没有上游的 `owner/repo` |
144
146
  | `market-no-repo` | `package.json` 里没有 GitHub 地址,没东西可提交 |
145
147
  | `market-unavailable` | 目录拉不到(warn)——这几条没跑,别把它当干净 |
146
148
 
@@ -221,7 +223,7 @@ dsh plugin --profile desktop add @bushizhanghan/dsh-publish-gate
221
223
  ## 开发
222
224
 
223
225
  ```sh
224
- node --test # 104 个引擎单测
226
+ node --test # 107 个引擎单测
225
227
  node test/integration.test.mjs # 27 条集成断言(9 个真实插件作 fixture)
226
228
  ```
227
229
 
package/lib/engine.js CHANGED
@@ -931,7 +931,7 @@ export async function checkMarketReadiness(dir, opts = {}) {
931
931
  if (hours < 24) {
932
932
  out.push(
933
933
  F(
934
- 'market-repo-too-new',
934
+ 'market-repo-too-new', 'market-fork-of-listed', 'market-fork-undisclosed',
935
935
  'warn',
936
936
  `the repo is ${hours.toFixed(1)}h old; the submission gate needs 24h`,
937
937
  'The gate fails with a "repo too new" message and reruns on its own, so the PR is not lost — but nothing merges until it passes.',
@@ -941,12 +941,45 @@ export async function checkMarketReadiness(dir, opts = {}) {
941
941
  }
942
942
  }
943
943
  }
944
+ // A fork of a repo that is already listed collides with its own upstream:
945
+ // both register the same provider or tool names, and whichever loads second
946
+ // wins or throws. A reviewer blocked a submission for exactly this and the
947
+ // description said nothing about it.
948
+ const parentSlug = typeof repoInfo?.parent?.full_name === 'string' ? repoInfo.parent.full_name : null
949
+ if (repoInfo?.fork === true && parentSlug) {
950
+ const parentListed = entries.some((e) => typeof e?.url === 'string' && e.url.toLowerCase().includes(parentSlug.toLowerCase()))
951
+ if (parentListed) {
952
+ out.push(
953
+ F(
954
+ 'market-fork-of-listed',
955
+ 'warn',
956
+ `this repo is a fork of ${parentSlug}, which is already in the catalogue`,
957
+ 'Both entries install code that claims the same ids, so a user who installs both gets one silently shadowing the other — and a reviewer reads the missing note as an undisclosed fork.',
958
+ `Say in the entry description that it is a fork of ${parentSlug} and that the two must not be installed together.`,
959
+ ),
960
+ )
961
+ }
962
+ const readme = safeText(join(dir, 'README.md')) || ''
963
+ const desc = typeof json?.description === 'string' ? json.description : ''
964
+ if (!readme.includes(parentSlug) && !desc.includes(parentSlug)) {
965
+ out.push(
966
+ F(
967
+ 'market-fork-undisclosed',
968
+ 'warn',
969
+ `nothing in README or package.json names the upstream ${parentSlug}`,
970
+ 'A fork that does not say what it forked from looks like original work until someone diffs it, and the upstream author finds out from a collision report.',
971
+ `Mention ${parentSlug} in the README and in the market entry description.`,
972
+ ),
973
+ )
974
+ }
975
+ }
944
976
  return out
945
977
  }
946
978
 
947
979
  // =====================================================================
948
980
  // Source sanity: the entry protocol
949
981
  // =====================================================================
982
+
950
983
  export function checkEntrySource(dir) {
951
984
  const out = []
952
985
  const path = join(dir, 'lib', 'index.js')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bushizhanghan/dsh-publish-gate",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Pre-publish gate for DSH plugins: manifest, dependencies, artifact, runtime, browser half, traceability and market readiness — plus an input fuzzer that drives every declared parameter with the wrong type. 发布前的七层门禁 + 入参模糊测试。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",