weflow-cli 1.7.0 → 1.8.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.
Files changed (194) hide show
  1. package/ARCHITECTURE.md +3 -2
  2. package/CHANGELOG.md +1949 -1
  3. package/OPERATIONS.md +774 -1
  4. package/README.en.md +93 -7
  5. package/README.md +31 -6
  6. package/bin/weflow-cli.ts +934 -27
  7. package/dist/bin/weflow-cli.js +952 -27
  8. package/dist/bin/weflow-cli.js.map +1 -1
  9. package/dist/mcp-server/index.js +39 -13
  10. package/dist/mcp-server/index.js.map +1 -1
  11. package/dist/src/core/appMsgFormat.d.ts +37 -0
  12. package/dist/src/core/appMsgFormat.d.ts.map +1 -0
  13. package/dist/src/core/appMsgFormat.js +106 -0
  14. package/dist/src/core/appMsgFormat.js.map +1 -0
  15. package/dist/src/core/ntCore.d.ts +19 -2
  16. package/dist/src/core/ntCore.d.ts.map +1 -1
  17. package/dist/src/core/ntCore.js +11 -1
  18. package/dist/src/core/ntCore.js.map +1 -1
  19. package/dist/src/core/sqlcipherCore.d.ts +0 -12
  20. package/dist/src/core/sqlcipherCore.d.ts.map +1 -1
  21. package/dist/src/core/sqlcipherCore.js +5 -64
  22. package/dist/src/core/sqlcipherCore.js.map +1 -1
  23. package/dist/src/core/wcdbCore.d.ts +1 -1
  24. package/dist/src/core/wcdbCore.d.ts.map +1 -1
  25. package/dist/src/core/wcdbCore.js +5 -1
  26. package/dist/src/core/wcdbCore.js.map +1 -1
  27. package/dist/src/panel/client.d.ts +25 -0
  28. package/dist/src/panel/client.d.ts.map +1 -0
  29. package/dist/src/panel/client.js +34 -0
  30. package/dist/src/panel/client.js.map +1 -0
  31. package/dist/src/panel/endpoint.d.ts +45 -0
  32. package/dist/src/panel/endpoint.d.ts.map +1 -0
  33. package/dist/src/panel/endpoint.js +132 -0
  34. package/dist/src/panel/endpoint.js.map +1 -0
  35. package/dist/src/panel/launch.d.ts +50 -0
  36. package/dist/src/panel/launch.d.ts.map +1 -0
  37. package/dist/src/panel/launch.js +74 -0
  38. package/dist/src/panel/launch.js.map +1 -0
  39. package/dist/src/panel/server.d.ts +23 -0
  40. package/dist/src/panel/server.d.ts.map +1 -0
  41. package/dist/src/panel/server.js +413 -0
  42. package/dist/src/panel/server.js.map +1 -0
  43. package/dist/src/panel/userId.d.ts +37 -0
  44. package/dist/src/panel/userId.d.ts.map +1 -0
  45. package/dist/src/panel/userId.js +56 -0
  46. package/dist/src/panel/userId.js.map +1 -0
  47. package/dist/src/services/assistantDaemon.d.ts +20 -3
  48. package/dist/src/services/assistantDaemon.d.ts.map +1 -1
  49. package/dist/src/services/assistantDaemon.js +46 -9
  50. package/dist/src/services/assistantDaemon.js.map +1 -1
  51. package/dist/src/services/assistantEval.d.ts +141 -0
  52. package/dist/src/services/assistantEval.d.ts.map +1 -0
  53. package/dist/src/services/assistantEval.js +497 -0
  54. package/dist/src/services/assistantEval.js.map +1 -0
  55. package/dist/src/services/assistantMemory.d.ts +106 -4
  56. package/dist/src/services/assistantMemory.d.ts.map +1 -1
  57. package/dist/src/services/assistantMemory.js +396 -61
  58. package/dist/src/services/assistantMemory.js.map +1 -1
  59. package/dist/src/services/assistantPrivacy.d.ts +15 -2
  60. package/dist/src/services/assistantPrivacy.d.ts.map +1 -1
  61. package/dist/src/services/assistantPrivacy.js +18 -4
  62. package/dist/src/services/assistantPrivacy.js.map +1 -1
  63. package/dist/src/services/assistantRouter.d.ts +41 -0
  64. package/dist/src/services/assistantRouter.d.ts.map +1 -0
  65. package/dist/src/services/assistantRouter.js +151 -0
  66. package/dist/src/services/assistantRouter.js.map +1 -0
  67. package/dist/src/services/assistantService.d.ts +209 -3
  68. package/dist/src/services/assistantService.d.ts.map +1 -1
  69. package/dist/src/services/assistantService.js +590 -75
  70. package/dist/src/services/assistantService.js.map +1 -1
  71. package/dist/src/services/assistantTools.d.ts +205 -1
  72. package/dist/src/services/assistantTools.d.ts.map +1 -1
  73. package/dist/src/services/assistantTools.js +1089 -58
  74. package/dist/src/services/assistantTools.js.map +1 -1
  75. package/dist/src/services/assistantTrace.d.ts +47 -0
  76. package/dist/src/services/assistantTrace.d.ts.map +1 -0
  77. package/dist/src/services/assistantTrace.js +150 -0
  78. package/dist/src/services/assistantTrace.js.map +1 -0
  79. package/dist/src/services/chatService.d.ts +1 -1
  80. package/dist/src/services/chatService.d.ts.map +1 -1
  81. package/dist/src/services/chatService.js +5 -2
  82. package/dist/src/services/chatService.js.map +1 -1
  83. package/dist/src/services/configService.d.ts +9 -0
  84. package/dist/src/services/configService.d.ts.map +1 -1
  85. package/dist/src/services/configService.js +15 -8
  86. package/dist/src/services/configService.js.map +1 -1
  87. package/dist/src/services/pythonBridge.d.ts +41 -0
  88. package/dist/src/services/pythonBridge.d.ts.map +1 -0
  89. package/dist/src/services/pythonBridge.js +119 -0
  90. package/dist/src/services/pythonBridge.js.map +1 -0
  91. package/dist/src/services/syncService.d.ts +8 -2
  92. package/dist/src/services/syncService.d.ts.map +1 -1
  93. package/dist/src/services/syncService.js +26 -7
  94. package/dist/src/services/syncService.js.map +1 -1
  95. package/dist/src/services/wechatMessageService.d.ts +25 -0
  96. package/dist/src/services/wechatMessageService.d.ts.map +1 -1
  97. package/dist/src/services/wechatMessageService.js +69 -7
  98. package/dist/src/services/wechatMessageService.js.map +1 -1
  99. package/dist/src/utils/atomicWrite.d.ts +4 -0
  100. package/dist/src/utils/atomicWrite.d.ts.map +1 -0
  101. package/dist/src/utils/atomicWrite.js +60 -0
  102. package/dist/src/utils/atomicWrite.js.map +1 -0
  103. package/dist/src/utils/dateRange.d.ts +15 -0
  104. package/dist/src/utils/dateRange.d.ts.map +1 -1
  105. package/dist/src/utils/dateRange.js +47 -0
  106. package/dist/src/utils/dateRange.js.map +1 -1
  107. package/dist/src/utils/text.d.ts +18 -0
  108. package/dist/src/utils/text.d.ts.map +1 -0
  109. package/dist/src/utils/text.js +20 -0
  110. package/dist/src/utils/text.js.map +1 -0
  111. package/docs/AI_INTERFACE.md +2 -0
  112. package/docs/DECISIONS.md +1424 -0
  113. package/docs/EXTENDING.md +187 -0
  114. package/docs/JEV/345/272/224/347/224/250/346/226/275/345/267/245/346/226/207/346/241/243.md +310 -0
  115. package/docs/MCP.md +23 -4
  116. package/docs/PROJECT_STATE.md +299 -98
  117. package/docs/SETUP.md +22 -0
  118. package/docs/SYNC_CONTRACT.md +31 -3
  119. package/mcp-server/index.ts +681 -657
  120. package/package.json +84 -83
  121. package/resources/panel/ball-position.cjs +153 -0
  122. package/resources/panel/index.html +46 -0
  123. package/resources/panel/main.cjs +447 -0
  124. package/resources/panel/mascot-focus.png +0 -0
  125. package/resources/panel/mascot-happy.png +0 -0
  126. package/resources/panel/mascot-sorry.png +0 -0
  127. package/resources/panel/mascot-tired.png +0 -0
  128. package/resources/panel/mascot.png +0 -0
  129. package/resources/panel/package.json +7 -0
  130. package/resources/panel/panel.css +407 -0
  131. package/resources/panel/preload.cjs +72 -0
  132. package/resources/panel/quick-menu.cjs +197 -0
  133. package/resources/panel/renderer.js +441 -0
  134. package/resources/panel/tray-menu.cjs +40 -0
  135. package/resources/panel/tray.png +0 -0
  136. package/scripts/_utils.py +403 -54
  137. package/scripts/annual_report.py +4 -2
  138. package/scripts/article_notes.py +423 -0
  139. package/scripts/backfill_articles.py +438 -0
  140. package/scripts/biz_daily.py +590 -105
  141. package/scripts/chat_notes.py +470 -0
  142. package/scripts/classify_daily.py +10 -18
  143. package/scripts/compile_wiki.py +1059 -46
  144. package/scripts/create_reading_notes.py +199 -14
  145. package/scripts/decide.py +253 -0
  146. package/scripts/draft_reply.py +671 -0
  147. package/scripts/export_chat_html.py +35 -33
  148. package/scripts/extract_todos.py +31 -5
  149. package/scripts/fav_notes.py +318 -0
  150. package/scripts/fix_topics.py +2 -1
  151. package/scripts/generate_ai_report.py +214 -9
  152. package/scripts/generate_html.py +18 -3
  153. package/scripts/generate_review.py +2 -2
  154. package/scripts/jev_client.py +294 -0
  155. package/scripts/jev_probe.py +440 -0
  156. package/scripts/nt_common.py +82 -0
  157. package/scripts/nt_decrypt.py +1755 -1460
  158. package/scripts/pipeline.py +27 -2
  159. package/scripts/promote_ideas.py +19 -4
  160. package/scripts/quality_eval.py +707 -0
  161. package/scripts/rag_chat.py +4 -4
  162. package/scripts/read_image.py +187 -0
  163. package/scripts/reply_debt.py +488 -0
  164. package/scripts/route_cards.py +453 -0
  165. package/scripts/semantic_search.py +208 -49
  166. package/scripts/user_notes.py +315 -0
  167. package/scripts/vault_rag.py +13 -7
  168. package/scripts/vault_search.py +21 -4
  169. package/scripts/wiki_lint.py +397 -0
  170. package/src/core/appMsgFormat.ts +117 -0
  171. package/src/core/ntCore.ts +27 -2
  172. package/src/core/sqlcipherCore.ts +5 -61
  173. package/src/core/wcdbCore.ts +6 -2
  174. package/src/panel/client.ts +49 -0
  175. package/src/panel/endpoint.ts +144 -0
  176. package/src/panel/launch.ts +101 -0
  177. package/src/panel/server.ts +424 -0
  178. package/src/panel/userId.ts +72 -0
  179. package/src/services/assistantDaemon.ts +57 -9
  180. package/src/services/assistantEval.ts +611 -0
  181. package/src/services/assistantMemory.ts +413 -57
  182. package/src/services/assistantPrivacy.ts +18 -4
  183. package/src/services/assistantRouter.ts +191 -0
  184. package/src/services/assistantService.ts +671 -74
  185. package/src/services/assistantTools.ts +1118 -57
  186. package/src/services/assistantTrace.ts +175 -0
  187. package/src/services/chatService.ts +6 -2
  188. package/src/services/configService.ts +403 -385
  189. package/src/services/pythonBridge.ts +139 -0
  190. package/src/services/syncService.ts +37 -9
  191. package/src/services/wechatMessageService.ts +73 -7
  192. package/src/utils/atomicWrite.ts +56 -0
  193. package/src/utils/dateRange.ts +46 -0
  194. package/src/utils/text.ts +20 -0
package/README.en.md CHANGED
@@ -11,7 +11,7 @@
11
11
  > Bring your chat history, official-account reading, and personal knowledge workflows back to your own computer.
12
12
 
13
13
  [![npm](https://img.shields.io/npm/v/weflow-cli)](https://www.npmjs.com/package/weflow-cli)
14
- [![Node.js](https://img.shields.io/badge/Node.js-18%2B-339933)](https://nodejs.org/)
14
+ [![Node.js](https://img.shields.io/badge/Node.js-22.13%2B-339933)](https://nodejs.org/)
15
15
  [![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB)](https://www.python.org/)
16
16
  [![WeChat](https://img.shields.io/badge/WeChat-4.x%20tested-07C160?logo=wechat&logoColor=white)](https://github.com/zhuobichen/weflow-cli/releases)
17
17
  [![Local-first](https://img.shields.io/badge/local--first-zero%20telemetry-8A2BE2)](./SECURITY.md)
@@ -52,7 +52,7 @@ $ weflow-cli fav list -n 3
52
52
  ```text
53
53
  weflow-cli sessions # list chat sessions
54
54
  weflow-cli messages "contact" -n 20 # query chat messages
55
- weflow-cli export "contact" html # export HTML / Excel / Markdown / JSON
55
+ weflow-cli export "contact" html # export HTML / Excel / TXT / JSON
56
56
  weflow-cli fav list -t article -k AI # favorites: type filter + keyword search
57
57
  weflow-cli daily --date 2026-08-21 # official-account digest + AI summary
58
58
  weflow-cli daily-server # local reader http://localhost:8765
@@ -60,11 +60,39 @@ weflow-cli chat "How does RAG work?" # knowledge-base RAG Q&A
60
60
  weflow-cli mcp-config # one-shot MCP client integration
61
61
  ```
62
62
 
63
+ ## Platform Support
64
+
65
+ | Capability | Windows | macOS | Linux |
66
+ | --- | --- | --- | --- |
67
+ | Data-directory discovery | ✅ | ✅ | ✅ |
68
+ | Local data initialization | ✅ auto-discover/verify | ❌ credentials must be supplied manually | ⚠️ depends on distro and permissions |
69
+ | Chat history query (NT / local databases) | ✅ | ✅ | ✅ |
70
+ | WCDB data service (contact nicknames, etc.) | ✅ | ⚠️ needs the native library | ⚠️ needs the native library |
71
+ | Official-account digest / knowledge base / MCP | ✅ | ✅ | ✅ |
72
+
73
+ macOS: there is no automatic initialization today. If you already have local data access through official or otherwise authorized means, follow the help of `weflow-cli init --path` and `config` to finish setup.
74
+
75
+ ### Linux Quick Start (native WeChat 4.x for Linux)
76
+
77
+ ```bash
78
+ # 1. sqlcipher development libraries (needed to build sqlcipher3)
79
+ sudo apt install libsqlcipher-dev
80
+
81
+ # 2. Python dependencies
82
+ pip3 install --user sqlcipher3 cryptography html2text zstandard
83
+
84
+ # 3. Install the CLI and initialize
85
+ npm install -g weflow-cli
86
+ weflow-cli init # follow the prompts
87
+ ```
88
+
89
+ Automatic initialization on Linux depends on the WeChat distribution, the Python dependencies, and your user's permissions. Run `weflow-cli check` first and configure within your system's security policy; do not lower machine-wide permissions just to troubleshoot.
90
+
63
91
  ## What You Can Do
64
92
 
65
93
  | Scenario | Capability |
66
94
  | --- | --- |
67
- | Chat history | Query sessions, contacts, and messages; export to JSON, TXT, Markdown, HTML, Excel. |
95
+ | Chat history | Query sessions, contacts, and messages; export to JSON, TXT, HTML, Excel. An HTML export also writes a media coverage report saying which images and stickers could not be embedded, and why. |
68
96
  | Official-account digest | Crawl articles, AI summarization and classification, generate a local reading page, keep favorites and read states. |
69
97
  | Personal knowledge base | Sync WeRead notes, build an Obsidian vault, semantic search, RAG Q&A, and a concept wiki. |
70
98
  | AI collaboration | Expose article crawling, knowledge-base retrieval, digests, and selected local-data tools to MCP-compatible clients. The inventory follows the current code and `docs/MCP.md`. |
@@ -78,6 +106,8 @@ weflow-cli mcp-config # one-shot MCP client integration
78
106
 
79
107
  ### 1. Install and Check
80
108
 
109
+ > npm packages and GitHub releases are published separately; if you need the newest fixes, check the npm package version first, or use the GitHub `master` branch directly.
110
+
81
111
  Requires Node.js 22.13+, Python 3.10+, and a signed-in Windows WeChat. After installation, check your environment first:
82
112
 
83
113
  ```powershell
@@ -138,6 +168,34 @@ weflow-cli daily --date 2026-08-12 --dry-run
138
168
 
139
169
  # Generate without any AI calls; fetching, HTML, and local indexes remain enabled
140
170
  weflow-cli daily --date 2026-08-12 --no-ai
171
+
172
+ # Push and digest-processing frequency per official account over the last 30 days
173
+ weflow-cli daily-stats --days 30 --limit 30
174
+
175
+ # Only include the given official accounts (repeatable, or comma-separated)
176
+ weflow-cli daily --source "AccountA" --source "AccountB"
177
+ weflow-cli daily --source "AccountA,AccountB"
178
+
179
+ # Persist digest sources; leave empty to restore "all accounts"
180
+ weflow-cli config set dailySources "AccountA,AccountB"
181
+
182
+ # Persist AI off for digests; set it back to true to re-enable
183
+ weflow-cli config set dailyAiEnabled false
184
+ weflow-cli config set dailyAiEnabled true
185
+
186
+ # Topics kept out of the digest (a display-layer switch: they are still fetched and
187
+ # archived, just not shown, so changing your mind needs no re-crawl). Focus topics
188
+ # cannot be excluded, and unknown topic names are ignored with a WARN.
189
+ weflow-cli config set dailyExcludeTopics "news,investing,academic"
190
+
191
+ # Pin a category for a source; a categorized source gets a summary only, and its tags
192
+ # come from the category you set rather than from the article.
193
+ weflow-cli config set dailySourceCategories '<JSON: source name or gh_ ID -> category>'
194
+
195
+ # Optional: decide article topic and relevance with TypeSafe's Jev decision model
196
+ # instead of parsing it out of generated text. Without the key the previous
197
+ # LLM-parse path is used unchanged.
198
+ weflow-cli config set typesafeApiKey "..."
141
199
  ```
142
200
 
143
201
  The reader serves at `http://localhost:8765/` by default.
@@ -148,7 +206,7 @@ The reader serves at `http://localhost:8765/` by default.
148
206
  weflow-cli export "contact" json --contract weflow-v1 --output ./output
149
207
  ```
150
208
 
151
- The generated envelope keeps message fields stable and includes conservative `coverage` metadata. For incremental reads, use an overlapping `--from` time window and deduplicate locally by conversation plus `localId`/`serverId`; a stable cursor is not exposed yet. The legacy JSON export remains a top-level array.
209
+ The generated envelope keeps message fields stable and includes conservative `coverage` metadata. For incremental reads, use an overlapping `--from` time window and deduplicate locally by conversation plus `localId`/`serverId`, or let `sync` keep the checkpoint and report what it covered. A stable cursor is still not exposed: it has to be backed by every database backend before it can be advertised. The legacy JSON export remains a top-level array.
152
210
 
153
211
  **Connect an AI editor**
154
212
 
@@ -158,7 +216,7 @@ weflow-cli mcp-config > .mcp.json
158
216
 
159
217
  Place the generated configuration wherever your MCP client expects it and restart the client. See `weflow-cli mcp-config` output for the tool list and configuration details.
160
218
 
161
- Beyond the knowledge-base tools, the MCP server also exposes selected local WeChat data capabilities (sessions, chat history, favorites, Moments, digests, WeRead, todos, knowledge base, and assistant memory). See the [MCP Integration Guide](./docs/MCP.md) for the current inventory and security boundaries.
219
+ Beyond the knowledge-base tools, the MCP server also exposes selected local WeChat data capabilities (sessions, chat history, favorites, Moments, digests, WeRead, todos, knowledge base, and assistant memory). By default MCP sends no messages, publishes no articles, and modifies no todos, memory, or configuration. See the [MCP Integration Guide](./docs/MCP.md) for the current inventory and security boundaries.
162
220
 
163
221
  **Host a local AI assistant in WeChat (second brain)**
164
222
 
@@ -166,8 +224,13 @@ Beyond the knowledge-base tools, the MCP server also exposes selected local WeCh
166
224
  weflow-cli config set deepseekApiKey "sk-..." # or any OpenAI-compatible endpoint: aiBaseUrl + aiModel
167
225
  weflow-cli login-wechat # scan the QR code to bind the messaging channel (a ClawBot contact appears in WeChat)
168
226
  weflow-cli assistant start # run the agent as a background daemon
227
+ weflow-cli panel # open the on-device panel window (usable without scanning a QR code)
169
228
  ```
170
229
 
230
+ `weflow-cli panel` opens a small always-on window that talks to **the same brain as the WeChat side** — the same memory, the same daily quota. **No WeChat login is required**: the messaging channel is optional. The window is only a client; its messages go to the daemon's entry point on `127.0.0.1`, so the two entry points never keep separate copies of memory.
231
+
232
+ The floating ball needs Electron (`npm i -g electron`); without it the panel degrades to an Edge/Chrome `--app` window — same UI, but no frameless always-on-top ball, no tray, no global shortcut. With the ball (a 96px mascot): **click it and the chat bubble opens beside it (the ball itself stays put; click again to collapse)**. The bubble opens to the left of the ball by default, flips to the right when there is no room on the left, and top-aligns when vertical space runs short; drag the ball to move it, and the position is remembered. The ball doubles as a status light — busy, offline, and quota-exhausted are three real states, each with its own face and glow colour, while an idle ball shows no glow at all. **Right-click anywhere in the panel** to draft a reply for someone on your list (`weflow-cli config set quickReplyContacts "Alice,Bob"` — a click sends that conversation to two cloud models and returns text only, never sending for you). The last item in that menu tucks the ball away; the tray icon brings it back.
233
+
171
234
  Then just talk to ClawBot on your phone. The assistant queries local chats and favorites to answer, with memory that survives across sessions:
172
235
 
173
236
  - "What have I been busy with lately?" — synthesizes recent sessions and messages
@@ -179,6 +242,7 @@ Then just talk to ClawBot on your phone. The assistant queries local chats and f
179
242
  - "What am I reading?" / "My notes on XX" — WeRead shelf and notebooks
180
243
  - "Any pending todos? Anything urgent?" — todo list sorted by urgency
181
244
  - "How does my knowledge base explain RAG?" — concept-wiki lookup
245
+ - "Draft a reply to Lao Wang" — first judges what the other side wants, the risk, and whether substance should be given, then offers a few candidates. **Text only, never sent for you**; when money or high risk is involved it withholds drafts and only says what to confirm first
182
246
  - "Remember: my project is called weflow-cli" — writes to long-term memory
183
247
 
184
248
  How it works: the daemon long-polls WeChat's official bot channel (iLink); the agent loop, three-tier memory (working window / rolling summary / long-term facts), and all database queries run on your machine. Only the final question and reply texts go to the configured LLM; phone numbers, emails, and links in tool output are redacted by default (`config set assistantPrivacy strict` for stronger masking; a local `ollama` engine keeps everything offline). Sessions expire after 24h of inactivity, and proactive replies per window are capped by official limits.
@@ -189,6 +253,15 @@ Cost guardrails: a built-in daily cap of 100 processed messages (send "记忆" i
189
253
  weflow-cli config set assistantWhitelist "your-@im.wechat-ID" # unset = deny everyone
190
254
  ```
191
255
 
256
+ Group chat currently depends on whether WeChat's official bot channel actually delivers explicit group events; this project never joins groups through client automation or unofficial protocols. Should upstream ever provide group IDs, sender IDs, and @-mention fields, group messages still default to deny — you must set the group whitelist, keep the member whitelist, and leave the @ requirement on:
257
+
258
+ ```powershell
259
+ weflow-cli config set assistantGroupWhitelist "group-id"
260
+ weflow-cli config set assistantGroupRequireMention true
261
+ ```
262
+
263
+ This only takes effect once the official channel really delivers group events; ClawBot direct messages are unaffected today.
264
+
192
265
  Management: `weflow-cli assistant status` / `log` / `stop`; send "帮助" in WeChat for in-chat commands.
193
266
 
194
267
  ## Common Commands
@@ -198,14 +271,19 @@ Management: `weflow-cli assistant status` / `log` / `stop`; send "帮助" in WeC
198
271
  | Check environment & config | `weflow-cli check` · `weflow-cli config show` |
199
272
  | Initialize or specify paths | `weflow-cli init [--path <dir>]` |
200
273
  | Browse chat data | `weflow-cli sessions` · `weflow-cli messages <contact>` · `weflow-cli contacts` |
201
- | Export chat history | `weflow-cli export <contact> <json\|txt\|md\|html\|excel>` |
274
+ | Who is waiting on a reply | `weflow-cli awaiting --dry-run` · `weflow-cli awaiting --yes` |
275
+ | Draft a reply (text only, never sent) | `weflow-cli draft <contact> --dry-run` · `--yes` |
276
+ | Local judgement primitive | `weflow-cli decide --request <file> --dry-run` · `--yes` |
277
+ | Export chat history | `weflow-cli export <contact> <json\|txt\|html\|excel>` |
278
+ | Sync checkpoint | `weflow-cli sync run <contact> --since <date>` · `sync status` · `sync verify` |
202
279
  | Digest & reader | `weflow-cli daily` · `weflow-cli daily-server` · `weflow-cli review` |
203
280
  | Moments cache | `weflow-cli sns timeline` · `weflow-cli sns users` · `weflow-cli sns stats` |
204
281
  | WeChat favorites | `weflow-cli fav list` · `weflow-cli fav export markdown` · `weflow-cli fav set-key` |
205
282
  | WeRead | `weflow-cli weread shelf` · `notes` · `search` · `stats` |
206
- | Knowledge base | `weflow-cli vault` · `weflow-cli wiki` · `weflow-cli search <query>` · `weflow-cli chat` |
283
+ | Knowledge base | `weflow-cli vault` · `weflow-cli wiki` · `weflow-cli search <query>` · `weflow-cli chat` (semantic search needs `config set dashscopeApiKey` first) |
207
284
  | Reports & tasks | `weflow-cli report` · `annual-report` · `todos` |
208
285
  | Second-brain assistant | `weflow-cli assistant start` · `status` · `log` · `stop` |
286
+ | On-device panel | `weflow-cli panel` — floating window; `--status` reads state only, `--ask "…"` asks from the command line |
209
287
  | AI editor integration | `weflow-cli mcp-config` |
210
288
 
211
289
  Run `weflow-cli <command> --help` for the full options of any command. For example:
@@ -260,6 +338,9 @@ For a more complete view of modules and data flow, read [ARCHITECTURE.md](./ARCH
260
338
  - Network requests involving DeepSeek, article crawling, WeRead, or MCP happen only when you run the corresponding workflow.
261
339
  - Use `whitelist`, `blacklist`, and `audit` to manage or audit message sending; always confirm the target contact and content before sending.
262
340
  - After upgrading WeChat, switching accounts, or migrating computers, you may need to re-initialize or re-scan NT keys.
341
+ - `init` validates existing local configuration first and does not re-capture keys when that validation passes. Use `weflow-cli init --refresh` only after a migration, an account switch, or an access failure.
342
+ - To test a first-time initialization or a failed key, prefer `weflow-cli init --test-missing-keys`; it simulates missing keys for that run only and leaves the saved configuration untouched. When keys really have failed, `weflow-cli config forget-keys` clears the database access keys only and asks for confirmation.
343
+ - Running `weflow-cli daily` without a date checks yesterday's artifacts first: if yesterday's `README.md`, article index, or `index.html` is missing, it backfills yesterday and only generates today once that succeeds. Passing `--date` or `--dry-run` skips the backfill.
263
344
 
264
345
  ## Documentation & Feedback
265
346
 
@@ -269,6 +350,11 @@ For a more complete view of modules and data flow, read [ARCHITECTURE.md](./ARCH
269
350
  - [Detailed Architecture](./ARCHITECTURE.md): modules, data flow, implementation boundaries.
270
351
  - [Project State](./docs/PROJECT_STATE.md): current capabilities, constraints, priorities, and handoff entry point.
271
352
  - [Technical Decisions](./docs/DECISIONS.md): durable design rationale for long-term maintenance.
353
+ - [Extending Guide](./docs/EXTENDING.md): what to touch to add a tool, config key, command, MCP tool, or Python script — and which test will stop you. **There is no plugin loader today**; this document says why, and how to extend anyway.
354
+ - [Branches & Merges](./docs/BRANCHES.md): branch purposes, merge timeline, and conventions for parallel work.
355
+ - [Release Checklist](./docs/RELEASING.md): version numbers, packaging checks for sensitive content, npm credentials, and mirror sync.
356
+ - [npm Publish FAQ](./docs/NPM-PUBLISH.md): whether 404 / 409 / ETARGET means failure or propagation — look it up by symptom.
357
+ - [Scheduled Health Check](./docs/HEALTH-CHECK.md): one command for version drift, missed shards, stale sessions, and failed exports.
272
358
  - [Electronic Evidence Guide](./docs/EVIDENCE_GUIDE.md): preservation workflow, legal boundaries, and usage notes.
273
359
  - [Contributing Guide](./CONTRIBUTING.md) and [Security Policy](./SECURITY.md): development, feedback, and sensitive issues.
274
360
  - [Changelog](./CHANGELOG.md): release summaries.
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  > 让聊天记录、公众号阅读和个人知识工作流回到你的本地电脑。
12
12
 
13
13
  [![npm](https://img.shields.io/npm/v/weflow-cli)](https://www.npmjs.com/package/weflow-cli)
14
- [![Node.js](https://img.shields.io/badge/Node.js-18%2B-339933)](https://nodejs.org/)
14
+ [![Node.js](https://img.shields.io/badge/Node.js-22.13%2B-339933)](https://nodejs.org/)
15
15
  [![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB)](https://www.python.org/)
16
16
  [![WeChat](https://img.shields.io/badge/WeChat-4.x%20tested-07C160?logo=wechat&logoColor=white)](https://github.com/zhuobichen/weflow-cli/releases)
17
17
  [![Local-first](https://img.shields.io/badge/local--first-zero%20telemetry-8A2BE2)](./SECURITY.md)
@@ -52,7 +52,7 @@ $ weflow-cli fav list -n 3
52
52
  ```text
53
53
  weflow-cli sessions # 会话列表
54
54
  weflow-cli messages "联系人" -n 20 # 查询聊天消息
55
- weflow-cli export "联系人" html # 导出 HTML / Excel / Markdown / JSON
55
+ weflow-cli export "联系人" html # 导出 HTML / Excel / TXT / JSON
56
56
  weflow-cli fav list -t article -k AI # 微信收藏: 类型过滤 + 关键词搜索
57
57
  weflow-cli daily --date 2026-08-21 # 公众号日报 + AI 摘要与分类
58
58
  weflow-cli daily-server # 本地阅读器 http://localhost:8765
@@ -92,7 +92,7 @@ Linux 的自动初始化能力取决于微信发行版、Python 依赖和当前
92
92
 
93
93
  | 场景 | 能力 |
94
94
  | --- | --- |
95
- | 聊天记录 | 查询会话、联系人和消息;导出 JSON、TXT、Markdown、HTML、Excel。 |
95
+ | 聊天记录 | 查询会话、联系人和消息;导出 JSON、TXT、HTML、Excel。HTML 导出会同时给出一份媒体覆盖报告,说明哪些图片/表情没能嵌入以及原因。 |
96
96
  | 公众号日报 | 抓取文章、AI 摘要与分类、生成本地阅读页,保留收藏和已读状态。 |
97
97
  | 个人知识库 | 同步微信读书笔记、构建 Obsidian Vault、语义搜索、RAG 问答和概念 Wiki。 |
98
98
  | AI 协作 | 通过 MCP 把文章、知识库、日报和受控的本地数据能力交给兼容客户端;工具清单以 `weflow-cli mcp-config` 和 `docs/MCP.md` 为准。 |
@@ -183,8 +183,15 @@ weflow-cli config set dailySources "公众号A,公众号B"
183
183
  weflow-cli config set dailyAiEnabled false
184
184
  weflow-cli config set dailyAiEnabled true
185
185
 
186
- # 为来源设置固定类别;已分类来源只生成摘要,不再调用文章主题分类
186
+ # 不在日报里出现的主题(展示层开关:照常抓取归档,只是不展示;改主意不用重抓)
187
+ # 焦点主题 AI 不能排除,写错的主题名会被忽略并打 WARN
188
+ weflow-cli config set dailyExcludeTopics "新闻,投资,学术"
189
+
190
+ # 为来源设置固定类别;已分类来源只生成摘要,主题用你配的、标签取该类别(不会有真标签)
187
191
  weflow-cli config set dailySourceCategories '<JSON object: source name or gh_ ID -> AI/政治/学术/新闻/文学/投资>'
192
+
193
+ # 文章主题与相关度改由 Jev 决策模型判断(可选;不配则沿用 LLM 解析路径)
194
+ weflow-cli config set typesafeApiKey "..."
188
195
  ```
189
196
 
190
197
  阅读器默认在 `http://localhost:8765/` 提供服务。
@@ -205,8 +212,18 @@ weflow-cli mcp-config > .mcp.json
205
212
  weflow-cli config set deepseekApiKey "sk-..." # 或任意 OpenAI 兼容端点: aiBaseUrl + aiModel
206
213
  weflow-cli login-wechat # 扫码绑定消息通道 (微信里会出现 ClawBot 联系人)
207
214
  weflow-cli assistant start # 后台守护进程常驻
215
+ weflow-cli panel # 打开本机面板窗口 (不扫码也能用)
208
216
  ```
209
217
 
218
+ `weflow-cli panel` 打开的是一个常驻小窗,它跟微信里问的**是同一个大脑**(同一份记忆、
219
+ 同一条每日配额)。**不登录微信也能用**——消息通道是可选的。窗口只是客户端:消息走守护进程
220
+ 开在 `127.0.0.1` 上的入口,所以两个入口不会各写一份记忆。
221
+
222
+ 悬浮球需要 Electron(`npm i -g electron`);没装的话会降级成 Edge/Chrome 的 `--app` 小窗,
223
+ 界面一样,但没有无边框置顶、没有托盘与快捷键。有球时:**点一下它在旁边展开对话气泡
224
+ (球不动,再点一下收起)**;气泡默认开在球的左边,左边放不下会自己翻到右边,上方不够就
225
+ 改成顶对齐;拖动球可以换位置(位置会记住)。**在面板里点右键**可以给名单上的人快速起草回复(`weflow-cli config set quickReplyContacts "某人,另一人"`;点一下就是把那段对话发给两个云端模型,只产出文本、不会替你发送),菜单最后一项能把球收起来(点托盘图标叫回来)。
226
+
210
227
  之后在手机微信的 ClawBot 对话里直接说话,助手会自动查询本地聊天记录和收藏作答,并具备跨会话记忆:
211
228
 
212
229
  - 「我最近都在忙什么?」— 自动检索会话与聊天记录综合回答
@@ -218,6 +235,8 @@ weflow-cli assistant start # 后台守护进程常驻
218
235
  - 「我在读什么书?」「XX 这本书的笔记」— 微信读书书架与笔记本
219
236
  - 「我有什么待办?有急事吗?」— 待办清单(按紧急度排序)
220
237
  - 「知识库里怎么讲 RAG 的?」— 概念 Wiki 检索
238
+ - 「帮我回老王那句话」— 起草回复:先判断对方要什么、风险和该不该给实质内容,再给几条候选。
239
+ **只产出文本,不会替你发送**;涉钱或风险很高时不给草稿,只说明该先确认什么
221
240
  - 「记住:我的项目叫 weflow-cli」— 写入长期记忆
222
241
 
223
242
  运行机制:守护进程通过微信官方 Bot 通道(iLink)长轮询收发消息,Agent 循环、三层记忆(工作窗口 / 滚动摘要 / 长期事实)、数据库查询全部在本机执行;仅最终提问与回复文本会发送给所配置的 LLM,工具输出中的电话/邮箱/链接等 PII 默认自动脱敏(`config set assistantPrivacy strict` 可加强,`ollama` 本地引擎则完全不出网)。会话 24 小时未活跃需重新扫码,单窗口内主动回复有官方条数限制。
@@ -246,14 +265,19 @@ weflow-cli config set assistantGroupRequireMention true
246
265
  | 检查环境与配置 | `weflow-cli check` · `weflow-cli config show` |
247
266
  | 初始化或手动指定路径 | `weflow-cli init [--path <目录>]` |
248
267
  | 浏览聊天数据 | `weflow-cli sessions` · `weflow-cli messages <联系人>` · `weflow-cli contacts` |
249
- | 导出聊天记录 | `weflow-cli export <联系人> <json\|txt\|md\|html\|excel>` |
268
+ | 谁在等我回话 | `weflow-cli awaiting --dry-run` · `weflow-cli awaiting --yes` |
269
+ | 帮我起草回复(只出文字,不发送) | `weflow-cli draft <联系人> --dry-run` · `--yes` |
270
+ | 本机判断层 | `weflow-cli decide --request <file> --dry-run` · `--yes` |
271
+ | 导出聊天记录 | `weflow-cli export <联系人> <json\|txt\|html\|excel>` |
272
+ | 同步检查点 | `weflow-cli sync run <联系人> --since <日期>` · `sync status` · `sync verify` |
250
273
  | 公众号日报与阅读器 | `weflow-cli daily` · `weflow-cli daily-server` · `weflow-cli review` |
251
274
  | 朋友圈缓存 | `weflow-cli sns timeline` · `weflow-cli sns users` · `weflow-cli sns stats` |
252
275
  | 微信收藏 | `weflow-cli fav list` · `weflow-cli fav export markdown` · `weflow-cli fav set-key` |
253
276
  | 微信读书 | `weflow-cli weread shelf` · `notes` · `search` · `stats` |
254
- | 知识库 | `weflow-cli vault` · `weflow-cli wiki` · `weflow-cli search <query>` · `weflow-cli chat` |
277
+ | 知识库 | `weflow-cli vault` · `weflow-cli wiki` · `weflow-cli search <query>` · `weflow-cli chat`(语义检索需先 `config set dashscopeApiKey`)|
255
278
  | 总结与任务 | `weflow-cli report` · `annual-report` · `todos` |
256
279
  | 第二大脑助手 | `weflow-cli assistant start` · `status` · `log` · `stop` |
280
+ | 本机面板 | `weflow-cli panel`(悬浮窗;`--status` 只看状态,`--ask "…"` 在命令行里问)|
257
281
  | AI 编辑器集成 | `weflow-cli mcp-config` |
258
282
 
259
283
  运行 `weflow-cli <命令> --help` 可以查看某个命令的完整参数。例如:
@@ -320,6 +344,7 @@ python scripts/fav_server.py --date YYYY-MM-DD
320
344
  - [详细架构说明](./ARCHITECTURE.md):模块、数据流与实现边界。
321
345
  - [项目维护状态](./docs/PROJECT_STATE.md):当前能力、限制、优先级与交接入口。
322
346
  - [技术决策记录](./docs/DECISIONS.md):长期维护中的关键设计取舍。
347
+ - [扩展指南](./docs/EXTENDING.md):加一个工具/配置键/命令/MCP 工具/Python 脚本要改哪几处,以及哪条测试会拦你。**目前没有插件加载器**,这份文档说的就是"为什么没有"和"现在怎么加"。
323
348
  - [分支与合并记录](./docs/BRANCHES.md):分支用途、合并时间线与并行开发的对齐约定。
324
349
  - [发布清单](./docs/RELEASING.md):版本号、打包敏感内容检查、npm 凭据、国内镜像同步。
325
350
  - [npm 发布速查](./docs/NPM-PUBLISH.md):404 / 409 / ETARGET 是失败还是在传播,按症状查表。