@noob-stupid/dsh-plugin-console 0.4.0 → 0.4.1
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.
|
@@ -242,9 +242,12 @@ function scanProducerText({ file, text, rules = {}, targetVersion = null, knownB
|
|
|
242
242
|
reason: item.reason, snippet: item.snippet,
|
|
243
243
|
})
|
|
244
244
|
}
|
|
245
|
+
// 注释掩码与 kind 规则同源:注释里提到 `.volatile(` 不算调用
|
|
246
|
+
// (发版门槛自扫时抓到过:本模块自己的文档注释与说明字符串就中招,报出无意义的提示)
|
|
247
|
+
const masked = maskComments(text)
|
|
245
248
|
for (const kb of knownBreakages) {
|
|
246
249
|
if (typeof kb.since === 'string' && targetVersion !== null && !versionAtLeast(targetVersion, kb.since)) continue
|
|
247
|
-
const matches = [...
|
|
250
|
+
const matches = [...masked.matchAll(new RegExp(kb.pattern.source, kb.pattern.flags.includes('g') ? kb.pattern.flags : kb.pattern.flags + 'g'))]
|
|
248
251
|
if (matches.length === 0) continue
|
|
249
252
|
// 带探针的规则:先确认运行时真的缺这个 API,否则不报(避免修好依赖后永远误报)
|
|
250
253
|
let extra = ''
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// 「一发消息就报错、会话整体不可用」。包级适配门(peerDependencies / 版本号)看不见这类
|
|
8
8
|
// 运行期契约破坏,所以必须在**升级前**单独预检、先把本地适配好再装。
|
|
9
9
|
|
|
10
|
+
import { readFileSync } from 'node:fs'
|
|
10
11
|
import { dirname, join } from 'node:path'
|
|
11
12
|
import { isFrameworkOwnedPackage } from '../domain/compat.js'
|
|
12
13
|
import { discoverFormatContract, summarizeContract } from '../domain/format-contract.js'
|
|
@@ -15,7 +16,7 @@ import { currentFrameworkVersion } from '../domain/framework.js'
|
|
|
15
16
|
import { listEntries } from '../domain/runtime.js'
|
|
16
17
|
import { curlText, fetchJsonUrl } from '../infra/http.js'
|
|
17
18
|
import { sendError, sendJson } from '../infra/httpd.js'
|
|
18
|
-
import { baseDirOf, dshHome, profileDirOf, resolvePackageJson } from '../infra/paths.js'
|
|
19
|
+
import { baseDirOf, dshHome, pluginRoot, profileDirOf, resolvePackageJson } from '../infra/paths.js'
|
|
19
20
|
|
|
20
21
|
const REGISTRY = 'https://registry.npmmirror.com'
|
|
21
22
|
|
|
@@ -24,11 +25,16 @@ const REGISTRY = 'https://registry.npmmirror.com'
|
|
|
24
25
|
* 仍然扫(能暴露框架自身的契约不一致),但**只报告不改**——改它等于污染框架安装树。 */
|
|
25
26
|
function preflightRoots(ports, profileDir) {
|
|
26
27
|
const roots = [{ root: join(dshHome(), 'agent-presets'), kind: 'preset' }]
|
|
28
|
+
// 控制台自身排除在外:它是工具、不是会话消息生产方,而它的报错文案/文档里本身就含
|
|
29
|
+
// `kind: 'plugin'`、`.volatile(` 这类字样 —— 发版门槛自扫时正是这些字串报出了无意义条目。
|
|
30
|
+
let selfName = null
|
|
31
|
+
try { selfName = JSON.parse(readFileSync(join(pluginRoot(), 'package.json'), 'utf8')).name ?? null } catch {}
|
|
27
32
|
let entries = []
|
|
28
33
|
try { entries = listEntries(ports) } catch {}
|
|
29
34
|
const baseDir = baseDirOf(ports?.baseUrl ?? 'file:///')
|
|
30
35
|
for (const entry of entries) {
|
|
31
36
|
if (typeof entry.moduleName !== 'string' || entry.moduleName === '' || entry.moduleName.startsWith('cordis:')) continue
|
|
37
|
+
if (selfName !== null && entry.moduleName === selfName) continue
|
|
32
38
|
let pkgPath = null
|
|
33
39
|
try { pkgPath = resolvePackageJson(entry.moduleName, baseDir, profileDir) } catch {}
|
|
34
40
|
if (pkgPath === null) continue
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noob-stupid/dsh-plugin-console",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "DSH 框架升级安全与插件升级门控:一键升级、失败自动回滚、升级后回滚上版、旧插件不适配自动禁用;内置多源插件市场为发现层,插件源全部可自定义,可指向公司内网私有源 / 私有索引 / 本地 Git 仓库,纯内网离线可用 | Framework upgrade safety & plugin version gating for DSH, with a customizable multi-source plugin market: point every source at internal mirrors or a local file:// repo for intranet-only, offline installs.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|