dsh-plugin-mesh 0.5.0 → 0.5.2
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/AGENTS.md +1 -1
- package/README.md +7 -7
- package/client/client.js +6410 -893
- package/cordis.patch.yml +3 -2
- package/lib/_rehearsal-peer.mjs +2 -1
- package/lib/_selftest-capabilities.mjs +28 -2
- package/lib/_selftest-client.mjs +6 -389
- package/lib/_selftest-layout.mjs +112 -0
- package/lib/_selftest-prompt.mjs +67 -1
- package/lib/_selftest-reply-route.mjs +12 -1
- package/lib/_selftest-tsnet.mjs +26 -1
- package/lib/_selftest-workbench.mjs +728 -0
- package/lib/capabilities.js +16 -4
- package/lib/discovery.js +43 -6
- package/lib/index.js +302 -49
- package/lib/layout.js +128 -0
- package/lib/persist.js +4 -0
- package/lib/prompt.js +25 -7
- package/lib/scan.js +11 -10
- package/lib/tsnet/download.js +5 -1
- package/package.json +4 -3
- package/scripts/_selftest-release-plan.mjs +33 -2
- package/scripts/release-plan.mjs +19 -1
package/lib/layout.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mesh 目录布局。
|
|
3
|
+
*
|
|
4
|
+
* 每个 DSH profile 根目录下有一个 `mesh/`:
|
|
5
|
+
*
|
|
6
|
+
* <profile>/mesh/
|
|
7
|
+
* state.json 本 profile 的身份、配对码、tsnet 设置
|
|
8
|
+
* threads.json conversationId ↔ 本地 session 绑定
|
|
9
|
+
* sessions/
|
|
10
|
+
* <sessionId>/ 该会话的工作目录(cwd)
|
|
11
|
+
*
|
|
12
|
+
* 为什么按 profile 而不是按 DSH_HOME:同一个 DSH_HOME 下可能跑多个 profile
|
|
13
|
+
* (desktop / meshtest / 不同账号),state.json 里的配对码是信任边界,不能
|
|
14
|
+
* 跨 profile 共享。按 profile 分目录后,每个 profile 有自己的配对码与会话工作区。
|
|
15
|
+
*
|
|
16
|
+
* 例外:tsnet 的 sidecar 仍是整机一个 tailnet 节点,继续放在共享目录,
|
|
17
|
+
* 不在本模块的职责内(见 lib/tsnet/manager.js)。
|
|
18
|
+
*/
|
|
19
|
+
import { basename, join, resolve } from "node:path";
|
|
20
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
21
|
+
import { fileURLToPath } from "node:url";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 从 import.meta.url 推导 profile 根目录。
|
|
25
|
+
*
|
|
26
|
+
* 插件被 DSH 加载时路径是:
|
|
27
|
+
* <profileDir>/node_modules/dsh-plugin-mesh/lib/index.js
|
|
28
|
+
* 从 lib/index.js 往上三层正好是 profileDir。
|
|
29
|
+
* 开发目录(如 <repo>/lib/index.js)会推到 repo 的上级,由 isProfileDir 再确认。
|
|
30
|
+
*/
|
|
31
|
+
export function profileDirFromModuleUrl(moduleUrl) {
|
|
32
|
+
try {
|
|
33
|
+
const dir = resolve(fileURLToPath(new URL("../../..", moduleUrl)));
|
|
34
|
+
return dir && basename(dir) ? dir : "";
|
|
35
|
+
} catch {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* profile 根目录的判据:package.json 里有 dsh.profile。
|
|
42
|
+
*
|
|
43
|
+
* 不用「目录存在」当判据:开发目录也有一堆 package.json,但那是插件/仓库,
|
|
44
|
+
* 不是 DSH profile。写错位置的后果是把 mesh/ 建到仓库根目录。
|
|
45
|
+
*/
|
|
46
|
+
export function isProfileDir(dir) {
|
|
47
|
+
if (!dir) return false;
|
|
48
|
+
try {
|
|
49
|
+
// Windows 上手工编辑过的 package.json 可能带 BOM;JSON.parse 不认。
|
|
50
|
+
const raw = readFileSync(join(dir, "package.json"), "utf8").replace(/^\uFEFF/, "");
|
|
51
|
+
const pkg = JSON.parse(raw);
|
|
52
|
+
return Boolean(pkg?.dsh?.profile);
|
|
53
|
+
} catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 选择 mesh 根目录。只做路径计算,不创建目录。
|
|
60
|
+
*
|
|
61
|
+
* 优先级:profileDir/mesh > DSH_HOME/mesh > ~/.dsh/mesh。
|
|
62
|
+
*/
|
|
63
|
+
export function chooseMeshRoot({ profileDir = "", dshHome = "", homeDir = "" } = {}) {
|
|
64
|
+
if (profileDir) return join(profileDir, "mesh");
|
|
65
|
+
const base = dshHome || join(homeDir || ".", ".dsh");
|
|
66
|
+
return join(base, "mesh");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** 每个会话的独立工作目录:<meshRoot>/sessions/<safeSessionId>。 */
|
|
70
|
+
export function sessionDirFor(meshRoot, sessionId) {
|
|
71
|
+
return join(meshRoot, "sessions", safeSegment(sessionId));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 收到的 mesh 任务统一使用的**唯一**工作区(每个 DSH profile 一个)。
|
|
76
|
+
*
|
|
77
|
+
* 为什么不再按 session 分目录:每来一条任务就在 `sessions/<uuid>` 下新开一个
|
|
78
|
+
* 工作区,工作区数量会爆炸(用户原话:「工作区太多了」)。mesh 任务多数是
|
|
79
|
+
* 看一眼、回一句,本来不需要独立目录。
|
|
80
|
+
*
|
|
81
|
+
* 前提是**按 profile 隔离**:路径挂在 <profile>/mesh 下,desktop / web / meshtest
|
|
82
|
+
* 各有各的,互不干扰。
|
|
83
|
+
*
|
|
84
|
+
* 代价:同一 profile 内并发任务共用一个 cwd,文件会互相看见;确实要隔离时
|
|
85
|
+
* 用 task.workspace 指定独立目录(resolveWorkspace 已优先)。
|
|
86
|
+
*/
|
|
87
|
+
export function receiveWorkspaceDir(meshRoot) {
|
|
88
|
+
return join(meshRoot, "mesh-receive-task");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function safeSegment(id) {
|
|
92
|
+
const s = String(id ?? "").trim();
|
|
93
|
+
return s.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 120) || "session";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** 旧版状态目录:<DSH_HOME>/mesh。只用于迁移,不用于新状态。 */
|
|
97
|
+
export function legacyMeshDir({ dshHome = "", homeDir = "" } = {}) {
|
|
98
|
+
const base = dshHome || join(homeDir || ".", ".dsh");
|
|
99
|
+
return join(base, "mesh");
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** 新状态文件是否已存在(迁移判据)。 */
|
|
103
|
+
export function hasState(meshRoot) {
|
|
104
|
+
return existsSync(join(meshRoot, "state.json"));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 把旧共享目录里的状态文件复制到新 mesh 根。
|
|
109
|
+
*
|
|
110
|
+
* 只复制不删除;目标已存在或源不存在就跳过,所以幂等、可回退。
|
|
111
|
+
* 返回实际复制的文件名(测试/日志用)。
|
|
112
|
+
*/
|
|
113
|
+
export function copyLegacyFiles(root, legacy, names = ["state.json", "threads.json"]) {
|
|
114
|
+
if (!root || !legacy || resolve(root) === resolve(legacy)) return [];
|
|
115
|
+
const copied = [];
|
|
116
|
+
for (const name of names) {
|
|
117
|
+
const src = join(legacy, name);
|
|
118
|
+
const dst = join(root, name);
|
|
119
|
+
if (existsSync(dst) || !existsSync(src)) continue;
|
|
120
|
+
try {
|
|
121
|
+
writeFileSync(dst, readFileSync(src), { mode: 0o600 });
|
|
122
|
+
copied.push(name);
|
|
123
|
+
} catch {
|
|
124
|
+
/* 迁移失败不阻塞启动;下次启动再试 */
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return copied;
|
|
128
|
+
}
|
package/lib/persist.js
CHANGED
|
@@ -105,6 +105,10 @@ export function toPeerSnapshot(peers) {
|
|
|
105
105
|
user: String(p.user ?? ""),
|
|
106
106
|
profile: String(p.profile ?? ""),
|
|
107
107
|
version: String(p.version ?? ""),
|
|
108
|
+
// 协议版本与 proto 也要落盘:否则 restore() 只剩 id 形态一条判据,
|
|
109
|
+
// 挡不住"自报 app:dsh-mesh 的同协议第三方"(2026-10-21 实测的幽灵 peer)。
|
|
110
|
+
...(Number(p.v) ? { v: Number(p.v) } : {}),
|
|
111
|
+
...(p.proto ? { proto: String(p.proto) } : {}),
|
|
108
112
|
// 设备级 lastSeen 不在 health 记录里,用端点时间还原;这里给 ts 兜底
|
|
109
113
|
ts: Number(p.ts) || 0,
|
|
110
114
|
port: Number(p.port) || 0,
|
package/lib/prompt.js
CHANGED
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
* 这种 bug 只有能单测才防得住。
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* 「手动派发」在会话里留下的第一条消息。
|
|
14
|
+
*
|
|
15
|
+
* 为什么需要:派发时会预建一个会话等回执,但如果它是空的,用户点进去只看到
|
|
16
|
+
* 「暂无消息」,不知道自己发了什么。这里把原文摆进第一条,并明确告诉 agent
|
|
17
|
+
* **不要再调 mesh_run** —— 宿主已经替它发出去了,重复调用会让对端收到两份。
|
|
18
|
+
*/
|
|
12
19
|
/**
|
|
13
20
|
* @param input 入参可能是两种形状:webhook delivery(deliveryId/source)或
|
|
14
21
|
* mesh task(id/from)。两条入站路径都会走到这里,所以统一做一次归一化 ——
|
|
@@ -30,6 +37,14 @@ export function buildPrompt(input) {
|
|
|
30
37
|
// 退化成把 `/user` 后缀切掉。
|
|
31
38
|
const replyTo = String(input?.fromMachine || "").trim() || String(from).split("/")[0] || "unknown";
|
|
32
39
|
|
|
40
|
+
// 「这条是回执」和「这是一条新任务」必须给 agent 完全相反的指令。
|
|
41
|
+
//
|
|
42
|
+
// 真机事故(2026-10-21 手动派发):对端的回执被注入会话后,提示词仍然写着
|
|
43
|
+
// 「做完后用 mesh_run 回派给 X」→ 会话里的 agent 认真照做 → 对端又把它的回执
|
|
44
|
+
// 注回它自己的会话 → 两边互相回执,停不下来。
|
|
45
|
+
// 回执的处理方式只有一个:**转述给用户,不要再回派**。
|
|
46
|
+
const isReply = input?.isReply === true;
|
|
47
|
+
|
|
33
48
|
return [
|
|
34
49
|
`[DSH Mesh 任务 ${id}]`,
|
|
35
50
|
`来自: ${from}${input?.fromMachine ? ` (${input.fromMachine})` : ""}`,
|
|
@@ -37,13 +52,16 @@ export function buildPrompt(input) {
|
|
|
37
52
|
"",
|
|
38
53
|
String(input?.task ?? ""),
|
|
39
54
|
"",
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
// 精简原则:每条只留**可执行的动作**,删掉解释性长句。
|
|
56
|
+
// 「为什么」留给本文件的注释和 docs,不放进取景框 —— 对端 agent 不需要被说服,
|
|
57
|
+
// 它只需要知道做什么、别做什么。
|
|
58
|
+
isReply
|
|
59
|
+
? "—— 这是回执,不是新任务:直接转述给用户,**不要再用 mesh_run 回派**(回执套回执会循环)。"
|
|
60
|
+
: [
|
|
61
|
+
`—— 对端派给你的任务。做完后用 mesh_run 把结果回派给 ${replyTo}(thread ${thread}),` +
|
|
62
|
+
`peer 填**机器名**(${replyTo}),不要填 "机器名/用户"。`,
|
|
63
|
+
"回派一次即可;纯回执带 noWake: true,否则会来回循环。",
|
|
64
|
+
].join("\n"),
|
|
47
65
|
]
|
|
48
66
|
.filter(Boolean)
|
|
49
67
|
.join("\n");
|
package/lib/scan.js
CHANGED
|
@@ -25,20 +25,21 @@ export function candidateAddresses(extraRanges = [], limit = 1024) {
|
|
|
25
25
|
out.push(ip);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
//
|
|
28
|
+
// 本机所在 /24 **始终**要扫:scanRanges 是"额外"网段,不是替代品。
|
|
29
|
+
//
|
|
30
|
+
// 原来的实现一旦配了 scanRanges 就丢掉本机 /24;更糟的是 CIDR 写错时
|
|
31
|
+
// expandCidr 返回空数组,于是"扫描"变成 0 个地址且没有任何报错 ——
|
|
32
|
+
// 主动发现完全失效,界面却只显示"命中 0 台"。
|
|
33
33
|
//
|
|
34
34
|
// 注意:这里**不排除本机 IP**。因为同机跑多个实例时它们共用一个 IP,
|
|
35
35
|
// 排掉就永远发现不了彼此;而扫到自己也无害 —— discovery.note() 会按
|
|
36
36
|
// 实例 id 把自身拒掉。
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
for (const { address } of lanIPv4Addresses()) {
|
|
38
|
+
const prefix = address.slice(0, address.lastIndexOf("."));
|
|
39
|
+
for (let host = 1; host <= 254; host += 1) push(`${prefix}.${host}`);
|
|
40
|
+
}
|
|
41
|
+
for (const range of extraRanges) {
|
|
42
|
+
for (const ip of expandCidr(range)) push(ip);
|
|
42
43
|
}
|
|
43
44
|
return out;
|
|
44
45
|
}
|
package/lib/tsnet/download.js
CHANGED
|
@@ -66,7 +66,11 @@ export function detectTarget() {
|
|
|
66
66
|
/** 本平台对应的资产名,例如 dsh-mesh-tsnet-darwin-amd64.gz */
|
|
67
67
|
export function assetName() {
|
|
68
68
|
const { os, arch } = detectTarget();
|
|
69
|
-
|
|
69
|
+
// Windows release assets carry .exe before .gz (see build-sidecar.sh and
|
|
70
|
+
// PINNED_CHECKSUMS). Without it every mirror 404s and the checksum lookup
|
|
71
|
+
// silently misses, so the binary is never verified and never refreshed.
|
|
72
|
+
const exe = os === "windows" ? ".exe" : "";
|
|
73
|
+
return `dsh-mesh-tsnet-${os}-${arch}${exe}.gz`;
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
/** 缓存目录:~/.dsh/mesh/bin/sidecar-v1/ */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-mesh",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "DSH Mesh:局域网自动发现同网段的 DSH 实例、显示每台机器上报的能力,并双向派发任务;可用内置的用户态 Tailscale 节点跨互联网组网。Discovers other DSH instances on the LAN, shows the capabilities each one reports, and dispatches tasks between machines in both directions, with an optional userspace Tailscale node for links across networks.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,8 +63,9 @@
|
|
|
63
63
|
"selftest:resume": "node --experimental-vm-modules lib/_selftest-resume.mjs",
|
|
64
64
|
"selftest:persist": "node lib/_selftest-persist.mjs",
|
|
65
65
|
"selftest:reasoning": "node lib/_selftest-reasoning.mjs",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
66
|
+
"selftest:layout": "node lib/_selftest-layout.mjs",
|
|
67
|
+
"test": "npm run check && npm run selftest && npm run selftest:prompt && npm run selftest:pairing && npm run selftest:client && npm run selftest:caps && npm run selftest:release && npm run selftest:reply && npm run selftest:reasoning && npm run selftest:resume && npm run selftest:persist && npm run selftest:layout",
|
|
68
|
+
"check": "node scripts/check-version.mjs && node scripts/check-tdz.mjs && node --check lib/index.js && node --check lib/layout.js && node --check lib/discovery.js && node --check lib/conversation.js && node --check lib/identity.js && node --check lib/capabilities.js && node --check lib/prompt.js && node --check lib/pairing.js && node --check lib/scan.js && node --check lib/tsnet/download.js && node --check lib/tsnet/manager.js && node --check lib/tsnet/bridge.js && node --check client/client.js && node --check scripts/release-plan.mjs && npm run check:loadable && npm run check:docs",
|
|
68
69
|
"build:sidecar": "bash scripts/build-sidecar.sh",
|
|
69
70
|
"verify:mirror": "node scripts/verify-lan-mirror.mjs",
|
|
70
71
|
"release:plan": "node scripts/release-plan.mjs",
|
|
@@ -122,7 +122,7 @@ test("只认 plugin-v 前缀,别把 sidecar 的 tag 当插件版本", () => {
|
|
|
122
122
|
|
|
123
123
|
console.log("\n── 状态机:真实半态 ──");
|
|
124
124
|
|
|
125
|
-
test("
|
|
125
|
+
test("0.x 阶段 feat 只升 patch:0.3.33 + feat → 0.3.34", () => {
|
|
126
126
|
const p = planRelease({
|
|
127
127
|
pkgVersion: "0.3.33",
|
|
128
128
|
tag: "plugin-v0.3.33",
|
|
@@ -130,8 +130,39 @@ test("正常推进:tag=npm=仓库=0.3.33,有 feat → 0.4.0", () => {
|
|
|
130
130
|
commits: [{ subject: "feat: 新面板" }],
|
|
131
131
|
});
|
|
132
132
|
assert.equal(p.mode, "bump");
|
|
133
|
+
assert.equal(p.version, "0.3.34", "0.x 阶段加功能不应把 minor 推上去(真机反馈:一天从 0.3.36 涨到 0.5.0 太快)");
|
|
134
|
+
assert.equal(p.tag, "plugin-v0.3.34");
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test("1.0 之后 feat 恢复标准 semver:1.2.3 + feat → 1.3.0", () => {
|
|
138
|
+
const p = planRelease({
|
|
139
|
+
pkgVersion: "1.2.3",
|
|
140
|
+
tag: "plugin-v1.2.3",
|
|
141
|
+
npmLatest: "1.2.3",
|
|
142
|
+
commits: [{ subject: "feat: 新面板" }],
|
|
143
|
+
});
|
|
144
|
+
assert.equal(p.version, "1.3.0");
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test("0.x 阶段 breaking 仍然升 minor:0.3.33 + feat! → 0.4.0", () => {
|
|
148
|
+
const p = planRelease({
|
|
149
|
+
pkgVersion: "0.3.33",
|
|
150
|
+
tag: "plugin-v0.3.33",
|
|
151
|
+
npmLatest: "0.3.33",
|
|
152
|
+
commits: [{ subject: "feat!: 换协议" }],
|
|
153
|
+
});
|
|
154
|
+
assert.equal(p.version, "0.4.0");
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test("手动 --bump minor 不被 0.x 规则收敛(显式意图优先)", () => {
|
|
158
|
+
const p = planRelease({
|
|
159
|
+
pkgVersion: "0.3.33",
|
|
160
|
+
tag: "plugin-v0.3.33",
|
|
161
|
+
npmLatest: "0.3.33",
|
|
162
|
+
forcedBump: "minor",
|
|
163
|
+
commits: [{ subject: "chore: 手动发一版" }],
|
|
164
|
+
});
|
|
133
165
|
assert.equal(p.version, "0.4.0");
|
|
134
|
-
assert.equal(p.tag, "plugin-v0.4.0");
|
|
135
166
|
});
|
|
136
167
|
|
|
137
168
|
test("只有文档改动 → 不发版(每改一句话就发一版是最贵的注意力税)", () => {
|
package/scripts/release-plan.mjs
CHANGED
|
@@ -56,6 +56,13 @@ export function compareSemver(a, b) {
|
|
|
56
56
|
return 0;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/** 0.x 阶段把 minor 收敛成 patch(breaking 走的 major 不受影响)。 */
|
|
60
|
+
function zeroFeatAsPatch(base, bump) {
|
|
61
|
+
if (!ZERO_FEAT_AS_PATCH || bump !== "minor") return bump;
|
|
62
|
+
const v = parseSemver(base);
|
|
63
|
+
return v && v.major === 0 ? "patch" : bump;
|
|
64
|
+
}
|
|
65
|
+
|
|
59
66
|
export function applyBump(version, bump) {
|
|
60
67
|
const v = parseSemver(version);
|
|
61
68
|
if (!v) throw new Error(`当前版本号不合法:${version}`);
|
|
@@ -78,6 +85,16 @@ export function applyBump(version, bump) {
|
|
|
78
85
|
/** 一行是不是 Conventional Commit;允许前面带列表符号(合并提交的正文会长这样)。 */
|
|
79
86
|
const HEADER = /^\s*(?:[-*+]\s*)?(feat|fix|perf|refactor|revert|docs|chore|ci|test|style|build)(?:\([^)]*\))?(!)?\s*:\s*/;
|
|
80
87
|
|
|
88
|
+
/**
|
|
89
|
+
* 0.x 阶段把 `feat` 当 patch 处理。
|
|
90
|
+
*
|
|
91
|
+
* semver 允许 0.x 任意变动,而"加了个功能就 0.4.0、再修一个就 0.5.0"在真实使用里
|
|
92
|
+
* 涨得太快 —— 0.3.36 一天之内变成 0.5.0,维护者直接反馈"版本增长不要这么大"。
|
|
93
|
+
* 所以 0.x 期间:feat / fix / perf 都只升 patch,**只有 breaking 才升 minor**
|
|
94
|
+
* (见 applyBump 里的 ZERO_MAJOR_AS_MINOR)。1.0 之后恢复标准 semver。
|
|
95
|
+
*/
|
|
96
|
+
const ZERO_FEAT_AS_PATCH = true;
|
|
97
|
+
|
|
81
98
|
const RANK = { none: 0, patch: 1, minor: 2, major: 3 };
|
|
82
99
|
/** 只有这三种会让人真的想装新版本;其余(docs/chore/ci/test/style/build)不触发发版。 */
|
|
83
100
|
const TYPE_TO_BUMP = { feat: "minor", fix: "patch", perf: "patch", refactor: "patch", revert: "patch" };
|
|
@@ -235,7 +252,8 @@ export function planRelease({ pkgVersion, tag = "", npmLatest = "", since = "",
|
|
|
235
252
|
const analyzed = forcedBump
|
|
236
253
|
? { bump: forcedBump, hits: [] }
|
|
237
254
|
: analyzeCommits(commits);
|
|
238
|
-
|
|
255
|
+
// 手动 --bump 是显式意图,不收敛;只有自动分析出来的才套 0.x 规则
|
|
256
|
+
const bump = forcedBump ? analyzed.bump : zeroFeatAsPatch(base, analyzed.bump);
|
|
239
257
|
|
|
240
258
|
if (bump === "none") {
|
|
241
259
|
return {
|