@noob-stupid/dsh-plugin-console 0.3.15 → 0.3.16
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/lib/index.js +40 -6
- package/package.json +37 -37
package/lib/index.js
CHANGED
|
@@ -520,6 +520,30 @@ function queuedWrite(fn) {
|
|
|
520
520
|
return run
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
+
/** 解析 DSH 框架版本号为可比较对象;正式版(无预发布段)视为 rc.∞。 */
|
|
524
|
+
function parseFrameworkVersion(value) {
|
|
525
|
+
const m = String(value ?? '').match(/^(\d+)\.(\d+)\.(\d+)(?:-(?:[a-z]+\.)?(\d+))?$/iu)
|
|
526
|
+
if (!m) return -1
|
|
527
|
+
const [, maj, min, pat, rc] = m
|
|
528
|
+
return {
|
|
529
|
+
maj: Number.parseInt(maj, 10),
|
|
530
|
+
min: Number.parseInt(min, 10),
|
|
531
|
+
pat: Number.parseInt(pat, 10),
|
|
532
|
+
rc: rc === undefined ? Number.POSITIVE_INFINITY : Number.parseInt(rc, 10),
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** 判断 candidate 是否比 current 更新(候选与当前必须是合法版本号,否则视为不可比)。 */
|
|
537
|
+
function isFrameworkVersionNewer(candidate, current) {
|
|
538
|
+
const a = parseFrameworkVersion(candidate)
|
|
539
|
+
const b = parseFrameworkVersion(current)
|
|
540
|
+
if (a === -1 || b === -1) return false
|
|
541
|
+
if (a.maj !== b.maj) return a.maj > b.maj
|
|
542
|
+
if (a.min !== b.min) return a.min > b.min
|
|
543
|
+
if (a.pat !== b.pat) return a.pat > b.pat
|
|
544
|
+
return a.rc > b.rc
|
|
545
|
+
}
|
|
546
|
+
|
|
523
547
|
/** 默认 profile 用户补丁层路径(无 include 条目可推导时的兜底)。 */
|
|
524
548
|
function defaultPatchPath() {
|
|
525
549
|
const home = dshHome()
|
|
@@ -3331,10 +3355,11 @@ async function handle(ctx, req, res) {
|
|
|
3331
3355
|
// 网络黑洞/超时:区分「检测失败」与「无更新」,避免误导用户以为已是最新
|
|
3332
3356
|
registryError = error instanceof Error ? error.message : String(error)
|
|
3333
3357
|
}
|
|
3334
|
-
// 升级目标:稳定版 latest 优先;latest
|
|
3335
|
-
|
|
3358
|
+
// 升级目标:稳定版 latest 优先;latest 不高于当前而 next(预发布渠道)确实更新时,目标取 next。
|
|
3359
|
+
// 必须用版本号比较而不是字符串不等(避免 current=0.1.1 稳定版时被 next=0.1.1-rc.3 反向降级)。
|
|
3360
|
+
const target = latest !== null && current !== null && isFrameworkVersionNewer(latest, current)
|
|
3336
3361
|
? latest
|
|
3337
|
-
: (next !== null && current !== null && next
|
|
3362
|
+
: (next !== null && current !== null && isFrameworkVersionNewer(next, current) ? next : null)
|
|
3338
3363
|
const profileDir = dirname(findPatchPath(ctx))
|
|
3339
3364
|
// 1) 升级前打包备份现有配置(patch / profile package.json / 插件清单)
|
|
3340
3365
|
let backupDir = null
|
|
@@ -3583,8 +3608,12 @@ async function handle(ctx, req, res) {
|
|
|
3583
3608
|
` New-Item -ItemType Directory -Path $tmpDir -Force | Out-Null`,
|
|
3584
3609
|
` $tgz = Join-Path $tmpDir 'pkg.tgz'`,
|
|
3585
3610
|
` $encName = $name.Replace('/','%2f')`,
|
|
3586
|
-
` $url = 'https://registry.
|
|
3587
|
-
` curl.exe -s -L -m 60 -o $tgz $url`,
|
|
3611
|
+
` $url = 'https://registry.npmmirror.com/' + $encName + '/-/' + $short + '-' + $refVersion + '.tgz'`,
|
|
3612
|
+
` curl.exe -s -L -m 60 --insecure -o $tgz $url`,
|
|
3613
|
+
` if (-not (Test-Path $tgz) -or (Get-Item $tgz).Length -lt 1000) {`,
|
|
3614
|
+
` $url = 'https://registry.npmjs.org/' + $encName + '/-/' + $short + '-' + $refVersion + '.tgz'`,
|
|
3615
|
+
` curl.exe -s -L -m 60 --insecure -o $tgz $url`,
|
|
3616
|
+
` }`,
|
|
3588
3617
|
` if (-not (Test-Path $tgz) -or (Get-Item $tgz).Length -lt 1000) { Remove-Item $tmpDir -Recurse -Force -ErrorAction SilentlyContinue; continue }`,
|
|
3589
3618
|
` tar -xzf $tgz -C $tmpDir`,
|
|
3590
3619
|
` $ver = (Get-Content (Join-Path $tmpDir 'package\\package.json') -Raw | ConvertFrom-Json).version`,
|
|
@@ -3612,6 +3641,10 @@ async function handle(ctx, req, res) {
|
|
|
3612
3641
|
` $indexJs = Join-Path $selfDir 'lib\\index.js'`,
|
|
3613
3642
|
` $clientJs = Join-Path $selfDir 'lib\\client.js'`,
|
|
3614
3643
|
` if (-not (Test-Path $indexJs)) { Log ('自报名校验跳过:index.js 未找到'); return }`,
|
|
3644
|
+
` # 计算部署目录的完整包名(scoped 包为 @scope/name,非 scoped 包为 name)`,
|
|
3645
|
+
` $leaf = Split-Path $selfDir -Leaf`,
|
|
3646
|
+
` $parentLeaf = Split-Path (Split-Path $selfDir -Parent) -Leaf`,
|
|
3647
|
+
` if ($parentLeaf.StartsWith('@')) { $deployName = $parentLeaf + '/' + $leaf } else { $deployName = $leaf }`,
|
|
3615
3648
|
` $idx = Get-Content $indexJs -Raw`,
|
|
3616
3649
|
` $nameOk = $idx.Contains("export const name = '" + $expectedName + "'")`,
|
|
3617
3650
|
` $clientOk = $true`,
|
|
@@ -3619,7 +3652,8 @@ async function handle(ctx, req, res) {
|
|
|
3619
3652
|
` $cli = Get-Content $clientJs -Raw`,
|
|
3620
3653
|
` $clientOk = $cli.Contains('id: "' + $expectedName + '"')`,
|
|
3621
3654
|
` }`,
|
|
3622
|
-
`
|
|
3655
|
+
` $dirOk = ($deployName -eq $expectedName)`,
|
|
3656
|
+
` if ($nameOk -and $clientOk -and $dirOk) { Log ('自报名一致性 OK:' + $expectedName + ' @ ' + $deployName) } else { Log ('⚠️ 自报名一致性异常:部署目录=' + $deployName + ',期望 ' + $expectedName + '(index=' + $nameOk + ' client=' + $clientOk + ' dir=' + $dirOk + ')——请检查部署目录与包名是否匹配') }`,
|
|
3623
3657
|
`}`,
|
|
3624
3658
|
`Verify-SelfNameConsistency '${selfName ?? '@noob-stupid/dsh-plugin-console'}'`,
|
|
3625
3659
|
pkgArgs.length > 0 ? `SetState 'pkg' '更新官方配套包…'\n Log '更新官方配套包…'\n Set-Location -Path ${ps(profileDir2)}\n if (Test-Path ${ps(corepackJs)}) {\n $pp = Start-Process -FilePath ${ps(nodePath)} -ArgumentList @(${ps(corepackJs)}, 'pnpm', 'update', ${pkgArgs.join(', ')}, '--no-optional', '--registry', 'https://registry.npmmirror.com') -PassThru -WindowStyle Hidden\n if (-not $pp.WaitForExit(300000)) { Stop-Process -Id $pp.Id -Force -ErrorAction SilentlyContinue; Log '官方配套包更新超时(5 分钟),已跳过' } else { try { Log ('官方配套包更新结束(exit=' + $pp.ExitCode + ')') } catch { Log '官方配套包更新结束(退出码读取失败)' } }\n }` : '',
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name":
|
|
3
|
-
"version":
|
|
4
|
-
"description":
|
|
5
|
-
"repository":
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"type":
|
|
10
|
-
"main":
|
|
11
|
-
"exports":
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"keywords":
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"dsh":
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"files":
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"license":
|
|
2
|
+
"name": "@noob-stupid/dsh-plugin-console",
|
|
3
|
+
"version": "0.3.16",
|
|
4
|
+
"description": "DSH plugin management panel & marketplace: one-click enable/disable, multi-source market (GitHub/Gitee/custom), static-index market (500+ plugins / 300 skills), skills, suites, and one-click framework upgrade.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Noob-stupid/dsh-plugin-hub"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./lib/index.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./lib/index.js",
|
|
13
|
+
"./client": "./lib/client.js",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"dsh-plugin",
|
|
18
|
+
"deepseek-harness",
|
|
19
|
+
"plugin-manager"
|
|
20
|
+
],
|
|
21
|
+
"dsh": {
|
|
22
|
+
"bundle": {
|
|
23
|
+
"patch": "./cordis.patch.yml"
|
|
24
|
+
},
|
|
25
|
+
"client": {
|
|
26
|
+
"platform": "web",
|
|
27
|
+
"inject": [
|
|
28
|
+
"@deepseek-ai/dsh-client-runtime",
|
|
29
|
+
"@deepseek-ai/dsh-client-locale",
|
|
30
|
+
"@deepseek-ai/dsh-client-ui-settings"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"lib",
|
|
36
|
+
"cordis.patch.yml"
|
|
37
|
+
],
|
|
38
|
+
"license": "MIT"
|
|
39
39
|
}
|