@tencent-weixin/openclaw-weixin-cli 2.1.1 → 2.1.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/README.md CHANGED
@@ -22,7 +22,7 @@ npx -y @tencent-weixin/openclaw-weixin-cli install
22
22
  | openclaw-weixin | 支持的 OpenClaw | dist-tag | 说明 |
23
23
  |-----------------|-----------------------|---------------------------------------|----------------------|
24
24
  | 1.0.x | >=2026.3.0 <2026.3.22 | `compat-host-gte2026.3.0-lt2026.3.22` | 兼容轨道 |
25
- | 2.0.x | >=2026.3.22 | `latest` | 当前推荐主线 |
25
+ | v2 主线 | >=2026.3.22 | `latest` | 当前推荐 |
26
26
 
27
27
  > 从 2.0.0 开始,插件采用独立 semver 版本号,不再对齐宿主 OpenClaw 版本号。
28
28
 
@@ -82,114 +82,3 @@ openclaw --version
82
82
 
83
83
  - **插件仓库**:openclaw-weixin,通过各分支发布到不同的 npm dist-tag
84
84
  - **本仓库**:CLI 安装器,根据 `COMPAT_MATRIX` 自动选择正确的插件 dist-tag 来安装
85
-
86
- ### 分支管理规则
87
-
88
- 内网和外网通过不同分支管理,prerelease 分支从主分支拉出,合并回主分支:
89
-
90
- | 分支 | 用途 | package.json 状态 |
91
- |------|------|------------------|
92
- | `master-prerelease` | 日常开发 + 内网发布 | 内网发布后保持内网包名和版本 |
93
- | `master` | 外网发布 | 外网发布后保持外网包名和版本 |
94
-
95
- **核心原则:**
96
- - 日常开发和内网发布在 `-prerelease` 分支上进行
97
- - 需要发外网时,将 prerelease 分支合入对应主分支,再在主分支上发布
98
- - 发布后 package.json **不回退**,分支保持对应环境的最新发布状态
99
- - prerelease 和主分支同构(共用 `publish.config.json`),合并时自然更新
100
-
101
- ### CLI 发布命令
102
-
103
- ```bash
104
- # 在 prerelease 分支上发布内网
105
- node scripts/publish.mjs internal patch
106
-
107
- # dry run 预检
108
- node scripts/publish.mjs internal patch --dry-run
109
- ```
110
-
111
- 发布脚本会:
112
- 1. 检查工作区是否干净
113
- 2. 将 `package.json` 的 name/version 和 `cli.mjs` 的 PLUGIN_SPEC 替换为目标环境的值
114
- 3. 更新 `publish.config.json` 中对应目标的版本号
115
- 4. 提交 release commit 并打 git tag
116
- 5. npm publish
117
- 6. push commit + tag
118
-
119
- 发布后 package.json 保持发布态,不回退。如果 npm publish 失败,自动回滚 release commit 和 tag。
120
-
121
- ### 内网验证后发外网
122
-
123
- ```bash
124
- # ① 在 prerelease 分支上完成内网发布和验证
125
-
126
- # ② 合入主分支
127
- git checkout master
128
- git merge master-prerelease
129
-
130
- # ③ 在主分支上发布外网
131
- node scripts/publish.mjs external patch
132
- ```
133
-
134
- ### 兼容轨道发版流程
135
-
136
- 当 openclaw 发布破坏兼容性的新版本时:
137
-
138
- #### 1. 插件仓库操作(openclaw-weixin)
139
-
140
- ```bash
141
- # 从当前分支拉出兼容轨道
142
- git checkout -b compat-host-gteX.Y.Z-ltA.B.C-prerelease master-prerelease
143
- git checkout -b compat-host-gteX.Y.Z-ltA.B.C master
144
- # 修改 compat 分支上的 publish.config.json,将 npmTag 改为轨道名
145
-
146
- # master-prerelease 上适配新宿主,major + 1
147
- ```
148
-
149
- #### 2. CLI 仓库操作(本仓库)
150
-
151
- ```bash
152
- # ① 更新 lib/compat.mjs 的 COMPAT_MATRIX
153
-
154
- # ② 在 prerelease 分支上发布内网验证
155
- node scripts/publish.mjs internal minor
156
-
157
- # ③ 验证后合入主分支发外网
158
- git checkout master && git merge master-prerelease
159
- node scripts/publish.mjs external minor
160
- ```
161
-
162
- #### 3. 验证清单
163
-
164
- - [ ] `npx @tencent/openclaw-weixin-cli install` 在旧宿主上安装兼容轨道版本
165
- - [ ] `npx @tencent/openclaw-weixin-cli install` 在新宿主上安装 latest 版本
166
- - [ ] 已安装旧 tag 的用户重跑 CLI 后自动卸载旧版、安装新版
167
- - [ ] 插件运行时 `version-check.mjs` 报错信息指引正确
168
-
169
- ### 兼容轨道 bug 修复
170
-
171
- ```bash
172
- # ① 在 compat prerelease 分支上修复
173
- git checkout compat-host-gteX.Y.Z-ltA.B.C-prerelease
174
- # cherry-pick 或直接修复
175
- node scripts/publish.mjs internal patch
176
-
177
- # ② 需要发外网时合入 compat 主分支
178
- git checkout compat-host-gteX.Y.Z-ltA.B.C
179
- git merge compat-host-gteX.Y.Z-ltA.B.C-prerelease
180
- node scripts/publish.mjs external patch
181
-
182
- # ③ 评估是否需要同步到 master 和其他 compat 分支
183
- ```
184
-
185
- > CLI 不需要重新发布——同一 dist-tag 下的 patch 更新,用户通过 `openclaw plugins update` 即可获取。
186
-
187
- ## 开发
188
-
189
- ```bash
190
- # 安装开发依赖
191
- npm install
192
-
193
- # 本地测试 install 命令
194
- node cli.mjs install
195
- ```
package/cli.mjs CHANGED
@@ -21,6 +21,8 @@ const LEGACY_TAG_ALIASES = {
21
21
  legacy: "compat-host-gte2026.3.0-lt2026.3.22",
22
22
  };
23
23
 
24
+ const COMPAT_MATRIX_DIST_TAG_PAD = Math.max(...COMPAT_MATRIX.map((e) => e.distTag.length));
25
+
24
26
  // ── helpers ──────────────────────────────────────────────────────────────────
25
27
 
26
28
  function log(msg) {
@@ -70,7 +72,9 @@ function selectPluginTag(openclawVersion) {
70
72
  error(`当前 OpenClaw 版本 ${openclawVersion} 不在任何已知兼容范围内`);
71
73
  console.log("\n 已知兼容矩阵:");
72
74
  for (const e of COMPAT_MATRIX) {
73
- console.log(` ${e.label} → OpenClaw ${formatRange(e.openclawRange)}`);
75
+ console.log(
76
+ ` ${e.distTag.padEnd(COMPAT_MATRIX_DIST_TAG_PAD)} OpenClaw ${formatRange(e.openclawRange)}`,
77
+ );
74
78
  }
75
79
  console.log();
76
80
  return null;
@@ -217,7 +221,7 @@ function install() {
217
221
  }
218
222
 
219
223
  const pluginInstallSpec = `${PLUGIN_SPEC}@${compat.distTag}`;
220
- log(`匹配兼容版本: ${compat.label} (dist-tag: ${compat.distTag})`);
224
+ log(`匹配 dist-tag: ${compat.distTag}`);
221
225
 
222
226
  // 3. If already installed with a different dist-tag, uninstall first
223
227
  // so the fresh install picks up the correct dist-tag.
@@ -299,7 +303,9 @@ function help() {
299
303
 
300
304
  兼容矩阵:`);
301
305
  for (const e of COMPAT_MATRIX) {
302
- console.log(` ${e.label.padEnd(28)} OpenClaw ${formatRange(e.openclawRange)}`);
306
+ console.log(
307
+ ` ${e.distTag.padEnd(COMPAT_MATRIX_DIST_TAG_PAD)} OpenClaw ${formatRange(e.openclawRange)}`,
308
+ );
303
309
  }
304
310
  console.log();
305
311
  }
package/lib/compat.mjs CHANGED
@@ -10,13 +10,11 @@ export const COMPAT_MATRIX = [
10
10
  pluginMajor: 1,
11
11
  distTag: 'compat-host-gte2026.3.0-lt2026.3.22',
12
12
  openclawRange: { gte: '2026.3.0', lt: '2026.3.22' },
13
- label: '1.0.x (兼容轨道: OpenClaw >=2026.3.0 <2026.3.22)',
14
13
  },
15
14
  {
16
15
  pluginMajor: 2,
17
16
  distTag: 'latest',
18
17
  openclawRange: { gte: '2026.3.22' },
19
- label: '2.0.x (当前最新主线)',
20
18
  },
21
19
  ];
22
20
 
@@ -73,7 +73,7 @@ export function assertHostCompat() {
73
73
 
74
74
  const supported = formatRange(entry.openclawRange);
75
75
  const suggestion = compat
76
- ? `请安装 openclaw-weixin@${compat.distTag} (${compat.label})`
76
+ ? `请安装 openclaw-weixin@${compat.distTag}`
77
77
  : '请升级或降级 OpenClaw 宿主到受支持的版本';
78
78
 
79
79
  throw new Error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencent-weixin/openclaw-weixin-cli",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Lightweight installer for the OpenClaw Weixin channel plugin",
5
5
  "license": "MIT",
6
6
  "author": "Tencent",