weflow-cli 1.5.0
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 +21 -0
- package/README.md +149 -0
- package/bin/weflow-cli-electron.cjs +59 -0
- package/bin/weflow-cli.ts +2311 -0
- package/cli.cjs +3 -0
- package/dist/bin/weflow-cli.d.ts +3 -0
- package/dist/bin/weflow-cli.d.ts.map +1 -0
- package/dist/bin/weflow-cli.js +2270 -0
- package/dist/bin/weflow-cli.js.map +1 -0
- package/dist/mcp-server/index.d.ts +3 -0
- package/dist/mcp-server/index.d.ts.map +1 -0
- package/dist/mcp-server/index.js +690 -0
- package/dist/mcp-server/index.js.map +1 -0
- package/dist/src/core/dbPathService.d.ts +40 -0
- package/dist/src/core/dbPathService.d.ts.map +1 -0
- package/dist/src/core/dbPathService.js +324 -0
- package/dist/src/core/dbPathService.js.map +1 -0
- package/dist/src/core/keyService.d.ts +59 -0
- package/dist/src/core/keyService.d.ts.map +1 -0
- package/dist/src/core/keyService.js +368 -0
- package/dist/src/core/keyService.js.map +1 -0
- package/dist/src/core/ntCore.d.ts +62 -0
- package/dist/src/core/ntCore.d.ts.map +1 -0
- package/dist/src/core/ntCore.js +191 -0
- package/dist/src/core/ntCore.js.map +1 -0
- package/dist/src/core/sqlcipherCore.d.ts +119 -0
- package/dist/src/core/sqlcipherCore.d.ts.map +1 -0
- package/dist/src/core/sqlcipherCore.js +693 -0
- package/dist/src/core/sqlcipherCore.js.map +1 -0
- package/dist/src/core/wcdbCore.d.ts +738 -0
- package/dist/src/core/wcdbCore.d.ts.map +1 -0
- package/dist/src/core/wcdbCore.js +4545 -0
- package/dist/src/core/wcdbCore.js.map +1 -0
- package/dist/src/core/wechatClient.d.ts +23 -0
- package/dist/src/core/wechatClient.d.ts.map +1 -0
- package/dist/src/core/wechatClient.js +166 -0
- package/dist/src/core/wechatClient.js.map +1 -0
- package/dist/src/services/chatService.d.ts +25 -0
- package/dist/src/services/chatService.d.ts.map +1 -0
- package/dist/src/services/chatService.js +291 -0
- package/dist/src/services/chatService.js.map +1 -0
- package/dist/src/services/configService.d.ts +43 -0
- package/dist/src/services/configService.d.ts.map +1 -0
- package/dist/src/services/configService.js +156 -0
- package/dist/src/services/configService.js.map +1 -0
- package/dist/src/services/exportService.d.ts +30 -0
- package/dist/src/services/exportService.d.ts.map +1 -0
- package/dist/src/services/exportService.js +273 -0
- package/dist/src/services/exportService.js.map +1 -0
- package/dist/src/services/wechat-formatter.d.ts +69 -0
- package/dist/src/services/wechat-formatter.d.ts.map +1 -0
- package/dist/src/services/wechat-formatter.js +248 -0
- package/dist/src/services/wechat-formatter.js.map +1 -0
- package/dist/src/services/wechatMessageService.d.ts +28 -0
- package/dist/src/services/wechatMessageService.d.ts.map +1 -0
- package/dist/src/services/wechatMessageService.js +341 -0
- package/dist/src/services/wechatMessageService.js.map +1 -0
- package/dist/src/services/wereadService.d.ts +206 -0
- package/dist/src/services/wereadService.d.ts.map +1 -0
- package/dist/src/services/wereadService.js +145 -0
- package/dist/src/services/wereadService.js.map +1 -0
- package/dist/src/services/whitelistService.d.ts +20 -0
- package/dist/src/services/whitelistService.d.ts.map +1 -0
- package/dist/src/services/whitelistService.js +60 -0
- package/dist/src/services/whitelistService.js.map +1 -0
- package/dist/src/types.d.ts +140 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/errors.d.ts +25 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +43 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/pathUtils.d.ts +5 -0
- package/dist/src/utils/pathUtils.d.ts.map +1 -0
- package/dist/src/utils/pathUtils.js +16 -0
- package/dist/src/utils/pathUtils.js.map +1 -0
- package/dist/src/utils/pythonRunner.d.ts +27 -0
- package/dist/src/utils/pythonRunner.d.ts.map +1 -0
- package/dist/src/utils/pythonRunner.js +62 -0
- package/dist/src/utils/pythonRunner.js.map +1 -0
- package/dist/src/utils/talkerUtils.d.ts +14 -0
- package/dist/src/utils/talkerUtils.d.ts.map +1 -0
- package/dist/src/utils/talkerUtils.js +73 -0
- package/dist/src/utils/talkerUtils.js.map +1 -0
- package/mcp-server/index.ts +757 -0
- package/package.json +72 -0
- package/resources/key/win32/x64/wx_key.dll +0 -0
- package/resources/wcdb/win32/x64/SDL2.dll +0 -0
- package/resources/wcdb/win32/x64/WCDB.dll +0 -0
- package/resources/wcdb/win32/x64/msvcp140.dll +0 -0
- package/resources/wcdb/win32/x64/msvcp140_1.dll +0 -0
- package/resources/wcdb/win32/x64/vcruntime140.dll +0 -0
- package/resources/wcdb/win32/x64/vcruntime140_1.dll +0 -0
- package/resources/wcdb/win32/x64/wcdb_api.dll +0 -0
- package/scripts/_batch_link_sources.py +73 -0
- package/scripts/_utils.py +531 -0
- package/scripts/annual_report.py +796 -0
- package/scripts/auto_tag.py +128 -0
- package/scripts/biz_daily.py +896 -0
- package/scripts/chat_report.py +397 -0
- package/scripts/chat_stats.py +702 -0
- package/scripts/classify_daily.py +411 -0
- package/scripts/compile_wiki.py +258 -0
- package/scripts/create_reading_notes.py +370 -0
- package/scripts/enrich_backlinks.py +163 -0
- package/scripts/export_chat_html.py +766 -0
- package/scripts/extract_3x_key.py +86 -0
- package/scripts/extract_todos.py +404 -0
- package/scripts/fav_server.py +392 -0
- package/scripts/fix_topics.py +111 -0
- package/scripts/generate_ai_report.py +367 -0
- package/scripts/generate_html.py +1372 -0
- package/scripts/generate_review.py +170 -0
- package/scripts/mcp_bridge.py +398 -0
- package/scripts/nt_decrypt.py +562 -0
- package/scripts/pipeline.py +145 -0
- package/scripts/promote_all.py +310 -0
- package/scripts/promote_ideas.py +297 -0
- package/scripts/rag_chat.py +191 -0
- package/scripts/scan_decrypt_4x.py +329 -0
- package/scripts/semantic_search.py +431 -0
- package/scripts/sync_fav.py +146 -0
- package/scripts/sync_weread.py +192 -0
- package/scripts/vault_rag.py +139 -0
- package/scripts/vault_search.py +141 -0
- package/src/core/dbPathService.ts +348 -0
- package/src/core/keyService.ts +409 -0
- package/src/core/ntCore.ts +224 -0
- package/src/core/sqlcipherCore.ts +764 -0
- package/src/core/wcdbCore.ts +4568 -0
- package/src/core/wechatClient.ts +204 -0
- package/src/lz4.d.ts +10 -0
- package/src/services/chatService.ts +296 -0
- package/src/services/configService.ts +197 -0
- package/src/services/exportService.ts +305 -0
- package/src/services/wechat-formatter.ts +348 -0
- package/src/services/wechatMessageService.ts +383 -0
- package/src/services/wereadService.ts +308 -0
- package/src/services/whitelistService.ts +72 -0
- package/src/types.ts +141 -0
- package/src/utils/errors.ts +42 -0
- package/src/utils/pathUtils.ts +16 -0
- package/src/utils/pythonRunner.ts +81 -0
- package/src/utils/talkerUtils.ts +84 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shixiansheng
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
|
|
2
|
+
<div align="center">
|
|
3
|
+
|
|
4
|
+
<h1>WeFlow CLI</h1>
|
|
5
|
+
|
|
6
|
+
**让 AI 读懂你的微信 — 一键生成公众号日报、导出聊天记录**
|
|
7
|
+
|
|
8
|
+
[](https://www.npmjs.com/package/weflow-cli)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 一分钟上手
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 1. 安装
|
|
21
|
+
npm install -g weflow-cli
|
|
22
|
+
|
|
23
|
+
# 2. 初始化(自动提取微信密钥)
|
|
24
|
+
weflow-cli init
|
|
25
|
+
|
|
26
|
+
# 3. 让 AI 接管
|
|
27
|
+
weflow-cli mcp-config > .mcp.json
|
|
28
|
+
|
|
29
|
+
# 4. 生成今日公众号日报
|
|
30
|
+
weflow-cli daily --api-key <你的DeepSeek密钥>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
重启 AI 编辑器后,你的 AI 助手就可以自动搜索、浏览、分析你的微信知识库。
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 你能做什么
|
|
38
|
+
|
|
39
|
+
| 场景 | 操作 |
|
|
40
|
+
|------|------|
|
|
41
|
+
| 📰 **公众号日报** | 每天自动抓取所有公众号推送 → AI 分类·摘要·行动建议 |
|
|
42
|
+
| 🔍 **知识库搜索** | 搜索所有历史文章(支持 MCP,AI 直接调用) |
|
|
43
|
+
| 💬 **聊天记录导出** | 导出任意会话为 HTML/JSON/TXT/Excel |
|
|
44
|
+
| 📊 **统计报告** | 聊天月报、年度数字生活报告、待办提取 |
|
|
45
|
+
| 📖 **微信读书** | 书架同步、笔记划线、阅读统计、书评浏览 |
|
|
46
|
+
| 🧠 **Obsidian 集成** | RAG 问答、语义搜索、知识管道 |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 环境检查
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
weflow-cli check # 一键检测 Python、依赖、数据库
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 公众号日报流水线
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# 生成今日日报(抓取 + AI 摘要 + 行动建议 + HTML 阅读器)
|
|
62
|
+
weflow-cli daily --api-key <key>
|
|
63
|
+
|
|
64
|
+
# 仅抓取某天
|
|
65
|
+
weflow-cli daily --date 2026-06-20 --api-key <key>
|
|
66
|
+
|
|
67
|
+
# 启动本地阅读器(浏览器浏览 + 收藏 + 笔记)
|
|
68
|
+
weflow-cli daily-server --date 2026-06-20
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## MCP Server — 让 AI 直接操作
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# 输出 MCP 配置
|
|
77
|
+
weflow-cli mcp-config # 打印 JSON
|
|
78
|
+
weflow-cli mcp-config -o .mcp.json # 写入文件
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
重启编辑器后,AI 自动获得以下工具:
|
|
82
|
+
|
|
83
|
+
| 工具 | 用途 |
|
|
84
|
+
|------|------|
|
|
85
|
+
| `wechat.search_articles` | 按关键词/主题/日期搜索知识库 |
|
|
86
|
+
| `wechat.get_daily` | 获取某天的公众号日报 |
|
|
87
|
+
| `wechat.get_review` | 获取 AI 学习日报 |
|
|
88
|
+
| `wechat.get_stats` | 知识库统计概览 |
|
|
89
|
+
| `wechat.get_concepts` | 概念图谱查询 |
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 命令速查
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# 初始化
|
|
97
|
+
weflow-cli init # 自动检测微信 + 提取密钥
|
|
98
|
+
weflow-cli check # 环境检查
|
|
99
|
+
|
|
100
|
+
# MCP
|
|
101
|
+
weflow-cli mcp-config # 输出 MCP 配置
|
|
102
|
+
|
|
103
|
+
# 公众号日报
|
|
104
|
+
weflow-cli daily # 今天
|
|
105
|
+
weflow-cli daily --date D # 指定日期
|
|
106
|
+
weflow-cli daily-server # 启动阅读器
|
|
107
|
+
weflow-cli daily-server --open # 启动并自动打开浏览器
|
|
108
|
+
|
|
109
|
+
# 聊天
|
|
110
|
+
weflow-cli sessions # 会话列表
|
|
111
|
+
weflow-cli messages <昵称> # 查看消息
|
|
112
|
+
weflow-cli export <昵称> html # 导出 HTML
|
|
113
|
+
|
|
114
|
+
# 报告
|
|
115
|
+
weflow-cli report # 聊天月报
|
|
116
|
+
weflow-cli annual-report # 年度报告
|
|
117
|
+
|
|
118
|
+
# 微信读书
|
|
119
|
+
weflow-cli weread shelf # 书架
|
|
120
|
+
weflow-cli weread stats # 阅读统计
|
|
121
|
+
weflow-cli weread notes # 笔记划线
|
|
122
|
+
weflow-cli weread search <书名>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 常见问题
|
|
128
|
+
|
|
129
|
+
**Q: 需要哪些前置环境?**
|
|
130
|
+
A: Node.js 18+、Python 3.10+、微信桌面版已登录。运行 `weflow-cli check` 检查。
|
|
131
|
+
|
|
132
|
+
**Q: 会泄露隐私吗?**
|
|
133
|
+
A: 不会。所有数据纯本地处理,密钥 AES-256-GCM 加密绑定单机。公众号文章仅本地索引。
|
|
134
|
+
|
|
135
|
+
**Q: 图片不显示?**
|
|
136
|
+
A: 文章图片自动下载到 `images/` 目录,HTML 阅读器通过本地服务器代理加载,绕过微信防盗链。
|
|
137
|
+
|
|
138
|
+
**Q: 如何让 AI 自动操作?**
|
|
139
|
+
A: `weflow-cli mcp-config -o .mcp.json`,重启 AI 编辑器即可。
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Thanks
|
|
144
|
+
|
|
145
|
+
- [WeFlow](https://github.com/hicccc77/WeFlow) — 原始桌面应用
|
|
146
|
+
- [DeepSeek](https://deepseek.com/) — AI 摘要引擎
|
|
147
|
+
- [sqlcipher3](https://pypi.org/project/sqlcipher3/) — 数据库解密
|
|
148
|
+
|
|
149
|
+
MIT License · [GitHub](https://github.com/zhuobichen/weflow-cli)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WeFlow CLI wrapper - uses Electron runtime to satisfy wcdb_api.dll security check
|
|
5
|
+
*
|
|
6
|
+
* Uses ELECTRON_RUN_AS_NODE=1 to run in Node.js mode within an Electron process.
|
|
7
|
+
* The -e flag is used instead of passing the script file directly, because commander.js
|
|
8
|
+
* in Electron's Node.js mode doesn't correctly skip process.argv[1] (the script path),
|
|
9
|
+
* treating it as an unknown command instead.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const { execFileSync } = require('child_process');
|
|
13
|
+
const { join, resolve } = require('path');
|
|
14
|
+
const { existsSync } = require('fs');
|
|
15
|
+
|
|
16
|
+
const scriptDir = __dirname;
|
|
17
|
+
const projectRoot = resolve(scriptDir, '..');
|
|
18
|
+
|
|
19
|
+
function getElectronPath() {
|
|
20
|
+
// Use the actual electron binary for execFileSync
|
|
21
|
+
const electronDist = join(projectRoot, 'node_modules', 'electron', 'dist', 'electron.exe');
|
|
22
|
+
if (existsSync(electronDist)) return electronDist;
|
|
23
|
+
|
|
24
|
+
if (process.platform === 'darwin') {
|
|
25
|
+
return join(projectRoot, 'node_modules', 'electron', 'dist', 'Electron.app', 'Contents', 'MacOS', 'Electron');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return join(projectRoot, 'node_modules', 'electron', 'dist', 'electron');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const cliEntry = join(projectRoot, 'dist', 'bin', 'weflow-cli.js');
|
|
32
|
+
|
|
33
|
+
if (!existsSync(cliEntry)) {
|
|
34
|
+
console.error('Error: CLI entry point not found. Run "npm run build" first.');
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const args = process.argv.slice(2);
|
|
39
|
+
const electronPath = getElectronPath();
|
|
40
|
+
const env = { ...process.env, ELECTRON_RUN_AS_NODE: '1' };
|
|
41
|
+
|
|
42
|
+
// Use file:// URL for ESM import compatibility
|
|
43
|
+
const fileUrl = 'file:///' + cliEntry.replace(/\\/g, '/');
|
|
44
|
+
const script = `import('${fileUrl}')`;
|
|
45
|
+
const electronArgs = ['-e', script, '--', ...args];
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
execFileSync(electronPath, electronArgs, {
|
|
49
|
+
stdio: 'inherit',
|
|
50
|
+
env,
|
|
51
|
+
cwd: process.cwd()
|
|
52
|
+
});
|
|
53
|
+
} catch (err) {
|
|
54
|
+
if (err.status !== undefined) {
|
|
55
|
+
process.exit(err.status);
|
|
56
|
+
}
|
|
57
|
+
console.error('Failed to run weflow-cli:', err.message);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|