@wemind/cli 1.1.0 → 1.1.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.
- package/LICENSE +22 -0
- package/README.md +23 -32
- package/dist/cli.js +374 -112
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Howardzhangdqs (mcp-wechat-server — https://github.com/Howardzhangdqs/mcp-wechat-server)
|
|
4
|
+
Copyright (c) 2026 imwangpan (WeMind — https://github.com/imwangpan/WeMind)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
npm i -g @wemind/cli # 安装后得到 wemind 命令
|
|
13
|
-
wemind version # → wemind 1.
|
|
13
|
+
wemind version # → wemind 1.1.0 (@wemind/cli, node …, win32-x64) # 版本以实际安装为准
|
|
14
14
|
|
|
15
15
|
# 不安装、一次性运行(注意是包名 @wemind/cli,不是 wemind)
|
|
16
16
|
npx -y @wemind/cli list
|
|
@@ -53,7 +53,7 @@ wemind brain check # ③ 验证大脑能说 ACP(initialize +
|
|
|
53
53
|
|
|
54
54
|
## 常驻怎么跑
|
|
55
55
|
|
|
56
|
-
`wemind start` 默认用**自带的跨平台看门狗**(builtin):detached 拉起 `wemind _watchdog`,它循环执行 `wemind daemon`,进程退出 5 秒后自动重拉;单实例靠 `wrapper.pid` + 进程身份校验。也可以用 `--runner pm2`(或 `WEMIND_RUNNER=pm2`)交给 pm2
|
|
56
|
+
`wemind start` 默认用**自带的跨平台看门狗**(builtin):detached 拉起 `wemind _watchdog`,它循环执行 `wemind daemon`,进程退出 5 秒后自动重拉;单实例靠 `wrapper.pid` + 进程身份校验。也可以用 `--runner pm2`(或 `WEMIND_RUNNER=pm2`)交给 pm2——`wemind` 会在账号目录生成 `pm2.app.json`(5s 重拉、最多 50 次、退出码 78 停手、日志合并到 `daemon.log`,与 builtin 语义一致),再 `pm2 start` 它。
|
|
57
57
|
|
|
58
58
|
开机自启:让系统在登录时执行一次 `wemind start <账号>` 即可(Windows 计划任务/启动文件夹、Linux systemd user service、macOS launchd)。**同一账号只用一套常驻方案**——两种 runner 同时跑会抢同一个 bot token。
|
|
59
59
|
|
|
@@ -96,7 +96,7 @@ wemind brain check # ③ 验证大脑能说 ACP(initialize +
|
|
|
96
96
|
|
|
97
97
|
本包(包名 `@wemind/cli`,命令 `wemind`)通过 GitHub Actions([`.github/workflows/wemind-publish.yml`](../../.github/workflows/wemind-publish.yml))发布到 npm。**下面的命令都在 WeMind 仓库根目录运行**,不是在 `packages/wechat-daemon` 子目录。
|
|
98
98
|
|
|
99
|
-
>
|
|
99
|
+
> ℹ️ **版本号只有一处来源**:`packages/wechat-daemon/package.json` 的 `version`。`src/version.ts` 在**运行时**读它(不再手写常量),所以改版本不会漏改源码。仓库提供 `npm run release:*` 一步到位,并自动跑一致性自检。
|
|
100
100
|
|
|
101
101
|
### 第一步:判断要不要发版
|
|
102
102
|
|
|
@@ -116,41 +116,32 @@ wemind brain check # ③ 验证大脑能说 ACP(initialize +
|
|
|
116
116
|
| `minor` | `1.0.0` → `1.1.0` | 新增向后兼容的能力(如新增内置大脑预设、新增子命令) |
|
|
117
117
|
| `major` | `1.0.0` → `2.0.0` | 不兼容改动(如删子命令、改数据目录布局、改 CLI 参数) |
|
|
118
118
|
|
|
119
|
-
###
|
|
120
|
-
|
|
121
|
-
**方式 A:用 npm 改 `package.json` + lock,再手改 `version.ts`(推荐)**
|
|
119
|
+
### 第三步:升版本号(一条命令)
|
|
122
120
|
|
|
123
121
|
```powershell
|
|
124
|
-
|
|
125
|
-
npm
|
|
126
|
-
|
|
127
|
-
# ② 手工同步源码常量(npm 不会帮你改这个)
|
|
128
|
-
# 编辑 packages/wechat-daemon/src/version.ts:
|
|
129
|
-
# export const CLI_VERSION = "1.0.1"; ← 与上一步的版本一致
|
|
130
|
-
|
|
131
|
-
# ③ 自检三处是否一致(不一致会 exit 1)
|
|
132
|
-
npm run check:version
|
|
122
|
+
npm run release:patch # 1.1.0 → 1.1.1(Bug 修复)
|
|
123
|
+
npm run release:minor # 1.1.0 → 1.2.0(向后兼容的新功能)
|
|
124
|
+
npm run release:major # 1.1.0 → 2.0.0(不兼容改动)
|
|
133
125
|
```
|
|
134
126
|
|
|
135
|
-
|
|
136
|
-
- `--no-git-tag-version`:不自动创建 commit 或 tag,改完由你自己检查提交。
|
|
137
|
-
|
|
138
|
-
**方式 B:全部手动**
|
|
139
|
-
|
|
140
|
-
1. 编辑 `packages/wechat-daemon/package.json` 的 `"version"`;
|
|
141
|
-
2. 编辑 `packages/wechat-daemon/src/version.ts` 的 `CLI_VERSION`;
|
|
142
|
-
3. 回到仓库根目录刷新锁文件:
|
|
127
|
+
这三个脚本等价于:
|
|
143
128
|
|
|
144
129
|
```powershell
|
|
145
|
-
npm
|
|
130
|
+
npm version <type> --workspace @wemind/cli --no-git-tag-version && npm run check:version
|
|
146
131
|
```
|
|
147
132
|
|
|
148
|
-
|
|
133
|
+
- 前半句改 **`package.json` 与 `package-lock.json` 两处**;`--no-git-tag-version` 让它**不**自动创建 git commit 和 tag(我们的发布流程要求「版本号 + 源码改动」在同一个 commit 里);
|
|
134
|
+
- 后半句跑 `check-version` 自检:包名、`bin` 是否仍叫 `wemind`、lock 是否同步、**`src/version.ts` 有没有被改回硬编码版本号**。任一项不对就 `exit 1`,`&&` 会中断,不会带着错误版本继续。
|
|
135
|
+
|
|
136
|
+
> **指定具体版本**:`npm version 1.4.2 --workspace @wemind/cli --no-git-tag-version`
|
|
137
|
+
>
|
|
138
|
+
> 想完全手动也可以:改 `packages/wechat-daemon/package.json` 的 `"version"`,再 `npm install --package-lock-only --ignore-scripts` 刷新 lock。
|
|
139
|
+
> **不需要**改 `src/version.ts`——它运行时读 package.json。不要手动编辑 `package-lock.json`。
|
|
149
140
|
|
|
150
141
|
### 第四步:本地校验
|
|
151
142
|
|
|
152
143
|
```powershell
|
|
153
|
-
npm run check:version # 包名
|
|
144
|
+
npm run check:version # 包名 / bin / lock / 无硬编码版本号
|
|
154
145
|
npm run lint && npm run typecheck && npm run build && npm test
|
|
155
146
|
npm pack --dry-run --workspace @wemind/cli # 应看到 4 个文件:cli.js / cli.js.map / README.md / package.json
|
|
156
147
|
```
|
|
@@ -162,16 +153,16 @@ npm pack --dry-run --workspace @wemind/cli # 应看到 4 个文件:cli.js /
|
|
|
162
153
|
### 第五步:提交并推送
|
|
163
154
|
|
|
164
155
|
```powershell
|
|
165
|
-
git add packages/wechat-daemon/package.json
|
|
156
|
+
git add packages/wechat-daemon/package.json package-lock.json
|
|
166
157
|
git add packages/wechat-daemon/src packages/wechat-ilink-core/src # 有源码改动时
|
|
167
|
-
git commit -m "chore: release @wemind/cli 1.
|
|
158
|
+
git commit -m "chore: release @wemind/cli 1.1.1"
|
|
168
159
|
git push origin main
|
|
169
160
|
```
|
|
170
161
|
|
|
171
162
|
推送到 `main` 后,工作流依次执行:
|
|
172
163
|
|
|
173
164
|
```
|
|
174
|
-
check-version
|
|
165
|
+
check-version(包名 / bin / lock / 无硬编码版本号)→ npm ci → lint → format:check → typecheck → build → test
|
|
175
166
|
→ npm pack --dry-run(prepack 守卫确认包内容)
|
|
176
167
|
→ 把 tarball 真装到临时目录跑 wemind version / help(装包冒烟)
|
|
177
168
|
→ 检查 npm 上是否已存在该版本
|
|
@@ -194,9 +185,9 @@ wemind list # 应能正确识别在跑
|
|
|
194
185
|
|
|
195
186
|
| 现象 | 原因 | 处理 |
|
|
196
187
|
| --- | --- | --- |
|
|
197
|
-
|
|
|
198
|
-
|
|
|
199
|
-
| CI
|
|
188
|
+
| `check-version` 报「lock 版本不一致」 | 手改了 `package.json` 没刷新 lock | `npm install --package-lock-only --ignore-scripts`(或改用 `npm run release:*`) |
|
|
189
|
+
| `check-version` 报「硬编码 CLI_VERSION 字面量」 | 有人把 `src/version.ts` 改回了常量写法 | 还原为 `readOwnVersion(...)`(版本号必须只来自 package.json) |
|
|
190
|
+
| CI 绿了但 npm 上没新版本 | 版本号没升,被跳过 | `npm run release:patch` 后再推 |
|
|
200
191
|
| `npm pack` 出来是空壳 | 没先 `npm run build` | 先 build 再 pack |
|
|
201
192
|
| `prepack` 守卫拒绝发布 | 产物为空 / `bin` 缺失 / 声明了 sourcemap 但 `.map` 不在包里 | 按守卫提示补 build 或检查 `files` |
|
|
202
193
|
| `npm publish` 报 403 / EOTP | 本地直发需要交互式 2FA | **不要本地发**,走 CI(Trusted Publisher 已配好) |
|