@noob-stupid/dsh-plugin-console 0.5.14 → 0.5.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/client.js +95 -8
- package/lib/server/domain/dep-source.js +4 -0
- package/lib/server/domain/framework.js +89 -2
- package/lib/server/domain/install-diagnose.js +76 -6
- package/lib/server/domain/lockfile-health.js +433 -0
- package/lib/server/domain/repoland.js +141 -46
- package/lib/server/domain/sources.js +29 -1
- package/lib/server/infra/exec.js +64 -12
- package/lib/server/infra/fsx.js +50 -1
- package/lib/server/routes/framework-upgrade.js +2 -1
- package/lib/server/routes/framework.js +26 -2
- package/lib/server/routes/index.js +4 -0
- package/lib/server/routes/lockfile.js +54 -0
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// L2 · routes —— 依赖锁体检 / 重建(2026-09-27,纯加法)
|
|
2
|
+
// POST /plugin-console/lockfile-check 只读体检:清单 vs pnpm-lock.yaml vs 磁盘 + registry 解析(**不写任何文件**)
|
|
3
|
+
// POST /plugin-console/lockfile-repair **用户显式触发**的 lock 重建:pnpm install --lockfile-only
|
|
4
|
+
//
|
|
5
|
+
// 为什么要有这两条路由(真问题,隔离环境已复现):live 的 web profile 里 `plugin remove` / 任何一次 pnpm
|
|
6
|
+
// 全量解析都会失败,三条独立原因叠在一起 —— 依赖 404(npmmirror 与 npmjs 双双 404)、lock 陈旧残缺
|
|
7
|
+
// (importers 写 0.5.4 / manifest 写 0.5.14、7 个依赖缺 4 个)、供应链年龄闸(新发版本不足 24h)。
|
|
8
|
+
// 面板过去只能看到一句原始 stderr,用户无法判断"能不能修、修了会不会丢依赖"。
|
|
9
|
+
//
|
|
10
|
+
// 安全语义(写死):
|
|
11
|
+
// · check 纯只读(不写、不跑 pnpm);
|
|
12
|
+
// · repair **必须被显式调用**,且只跑 `pnpm install --lockfile-only`(argv 由 domain 的 repairArgsFor 唯一产出);
|
|
13
|
+
// · 有 404 依赖时 repair **停下并点名**,绝不为"重建成功"而静默丢弃依赖,也绝不自动绕过供应链闸。
|
|
14
|
+
// 细节与安全边界见 lib/server/domain/lockfile-health.js 头注释。
|
|
15
|
+
|
|
16
|
+
import { runLockfileCheck, runLockfileRepair } from '../domain/lockfile-health.js'
|
|
17
|
+
import { orderedRegistries, readSources } from '../domain/sources.js'
|
|
18
|
+
import { sendError, sendJson } from '../infra/httpd.js'
|
|
19
|
+
import { profileDirOf } from '../infra/paths.js'
|
|
20
|
+
|
|
21
|
+
/** 主源优先的 registry 列表(与安装通道同一份来源配置:用户可在「源管理」里改)。 */
|
|
22
|
+
function registryList() {
|
|
23
|
+
try {
|
|
24
|
+
const list = orderedRegistries(readSources())
|
|
25
|
+
return Array.isArray(list) && list.length > 0 ? list : ['https://registry.npmmirror.com']
|
|
26
|
+
} catch {
|
|
27
|
+
return ['https://registry.npmmirror.com']
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function lockProfileDir(rc, res) {
|
|
32
|
+
const dir = profileDirOf(rc.ctx)
|
|
33
|
+
if (typeof dir !== 'string' || dir === '') {
|
|
34
|
+
sendError(res, 400, '无法定位 profile 目录(读不到 cordis.yml 的 include 条目)')
|
|
35
|
+
return null
|
|
36
|
+
}
|
|
37
|
+
return dir
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function routeLockfileCheck(req, res, rc) {
|
|
41
|
+
const profileDir = lockProfileDir(rc, res)
|
|
42
|
+
if (profileDir === null) return
|
|
43
|
+
const view = await runLockfileCheck({ profileDir, registries: registryList() })
|
|
44
|
+
sendJson(res, 200, view)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function routeLockfileRepair(req, res, rc) {
|
|
48
|
+
const profileDir = lockProfileDir(rc, res)
|
|
49
|
+
if (profileDir === null) return
|
|
50
|
+
const result = await runLockfileRepair({ profileDir, registries: registryList() })
|
|
51
|
+
sendJson(res, 200, result)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { routeLockfileCheck, routeLockfileRepair }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noob-stupid/dsh-plugin-console",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.16",
|
|
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",
|