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.
Files changed (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +149 -0
  3. package/bin/weflow-cli-electron.cjs +59 -0
  4. package/bin/weflow-cli.ts +2311 -0
  5. package/cli.cjs +3 -0
  6. package/dist/bin/weflow-cli.d.ts +3 -0
  7. package/dist/bin/weflow-cli.d.ts.map +1 -0
  8. package/dist/bin/weflow-cli.js +2270 -0
  9. package/dist/bin/weflow-cli.js.map +1 -0
  10. package/dist/mcp-server/index.d.ts +3 -0
  11. package/dist/mcp-server/index.d.ts.map +1 -0
  12. package/dist/mcp-server/index.js +690 -0
  13. package/dist/mcp-server/index.js.map +1 -0
  14. package/dist/src/core/dbPathService.d.ts +40 -0
  15. package/dist/src/core/dbPathService.d.ts.map +1 -0
  16. package/dist/src/core/dbPathService.js +324 -0
  17. package/dist/src/core/dbPathService.js.map +1 -0
  18. package/dist/src/core/keyService.d.ts +59 -0
  19. package/dist/src/core/keyService.d.ts.map +1 -0
  20. package/dist/src/core/keyService.js +368 -0
  21. package/dist/src/core/keyService.js.map +1 -0
  22. package/dist/src/core/ntCore.d.ts +62 -0
  23. package/dist/src/core/ntCore.d.ts.map +1 -0
  24. package/dist/src/core/ntCore.js +191 -0
  25. package/dist/src/core/ntCore.js.map +1 -0
  26. package/dist/src/core/sqlcipherCore.d.ts +119 -0
  27. package/dist/src/core/sqlcipherCore.d.ts.map +1 -0
  28. package/dist/src/core/sqlcipherCore.js +693 -0
  29. package/dist/src/core/sqlcipherCore.js.map +1 -0
  30. package/dist/src/core/wcdbCore.d.ts +738 -0
  31. package/dist/src/core/wcdbCore.d.ts.map +1 -0
  32. package/dist/src/core/wcdbCore.js +4545 -0
  33. package/dist/src/core/wcdbCore.js.map +1 -0
  34. package/dist/src/core/wechatClient.d.ts +23 -0
  35. package/dist/src/core/wechatClient.d.ts.map +1 -0
  36. package/dist/src/core/wechatClient.js +166 -0
  37. package/dist/src/core/wechatClient.js.map +1 -0
  38. package/dist/src/services/chatService.d.ts +25 -0
  39. package/dist/src/services/chatService.d.ts.map +1 -0
  40. package/dist/src/services/chatService.js +291 -0
  41. package/dist/src/services/chatService.js.map +1 -0
  42. package/dist/src/services/configService.d.ts +43 -0
  43. package/dist/src/services/configService.d.ts.map +1 -0
  44. package/dist/src/services/configService.js +156 -0
  45. package/dist/src/services/configService.js.map +1 -0
  46. package/dist/src/services/exportService.d.ts +30 -0
  47. package/dist/src/services/exportService.d.ts.map +1 -0
  48. package/dist/src/services/exportService.js +273 -0
  49. package/dist/src/services/exportService.js.map +1 -0
  50. package/dist/src/services/wechat-formatter.d.ts +69 -0
  51. package/dist/src/services/wechat-formatter.d.ts.map +1 -0
  52. package/dist/src/services/wechat-formatter.js +248 -0
  53. package/dist/src/services/wechat-formatter.js.map +1 -0
  54. package/dist/src/services/wechatMessageService.d.ts +28 -0
  55. package/dist/src/services/wechatMessageService.d.ts.map +1 -0
  56. package/dist/src/services/wechatMessageService.js +341 -0
  57. package/dist/src/services/wechatMessageService.js.map +1 -0
  58. package/dist/src/services/wereadService.d.ts +206 -0
  59. package/dist/src/services/wereadService.d.ts.map +1 -0
  60. package/dist/src/services/wereadService.js +145 -0
  61. package/dist/src/services/wereadService.js.map +1 -0
  62. package/dist/src/services/whitelistService.d.ts +20 -0
  63. package/dist/src/services/whitelistService.d.ts.map +1 -0
  64. package/dist/src/services/whitelistService.js +60 -0
  65. package/dist/src/services/whitelistService.js.map +1 -0
  66. package/dist/src/types.d.ts +140 -0
  67. package/dist/src/types.d.ts.map +1 -0
  68. package/dist/src/types.js +2 -0
  69. package/dist/src/types.js.map +1 -0
  70. package/dist/src/utils/errors.d.ts +25 -0
  71. package/dist/src/utils/errors.d.ts.map +1 -0
  72. package/dist/src/utils/errors.js +43 -0
  73. package/dist/src/utils/errors.js.map +1 -0
  74. package/dist/src/utils/pathUtils.d.ts +5 -0
  75. package/dist/src/utils/pathUtils.d.ts.map +1 -0
  76. package/dist/src/utils/pathUtils.js +16 -0
  77. package/dist/src/utils/pathUtils.js.map +1 -0
  78. package/dist/src/utils/pythonRunner.d.ts +27 -0
  79. package/dist/src/utils/pythonRunner.d.ts.map +1 -0
  80. package/dist/src/utils/pythonRunner.js +62 -0
  81. package/dist/src/utils/pythonRunner.js.map +1 -0
  82. package/dist/src/utils/talkerUtils.d.ts +14 -0
  83. package/dist/src/utils/talkerUtils.d.ts.map +1 -0
  84. package/dist/src/utils/talkerUtils.js +73 -0
  85. package/dist/src/utils/talkerUtils.js.map +1 -0
  86. package/mcp-server/index.ts +757 -0
  87. package/package.json +72 -0
  88. package/resources/key/win32/x64/wx_key.dll +0 -0
  89. package/resources/wcdb/win32/x64/SDL2.dll +0 -0
  90. package/resources/wcdb/win32/x64/WCDB.dll +0 -0
  91. package/resources/wcdb/win32/x64/msvcp140.dll +0 -0
  92. package/resources/wcdb/win32/x64/msvcp140_1.dll +0 -0
  93. package/resources/wcdb/win32/x64/vcruntime140.dll +0 -0
  94. package/resources/wcdb/win32/x64/vcruntime140_1.dll +0 -0
  95. package/resources/wcdb/win32/x64/wcdb_api.dll +0 -0
  96. package/scripts/_batch_link_sources.py +73 -0
  97. package/scripts/_utils.py +531 -0
  98. package/scripts/annual_report.py +796 -0
  99. package/scripts/auto_tag.py +128 -0
  100. package/scripts/biz_daily.py +896 -0
  101. package/scripts/chat_report.py +397 -0
  102. package/scripts/chat_stats.py +702 -0
  103. package/scripts/classify_daily.py +411 -0
  104. package/scripts/compile_wiki.py +258 -0
  105. package/scripts/create_reading_notes.py +370 -0
  106. package/scripts/enrich_backlinks.py +163 -0
  107. package/scripts/export_chat_html.py +766 -0
  108. package/scripts/extract_3x_key.py +86 -0
  109. package/scripts/extract_todos.py +404 -0
  110. package/scripts/fav_server.py +392 -0
  111. package/scripts/fix_topics.py +111 -0
  112. package/scripts/generate_ai_report.py +367 -0
  113. package/scripts/generate_html.py +1372 -0
  114. package/scripts/generate_review.py +170 -0
  115. package/scripts/mcp_bridge.py +398 -0
  116. package/scripts/nt_decrypt.py +562 -0
  117. package/scripts/pipeline.py +145 -0
  118. package/scripts/promote_all.py +310 -0
  119. package/scripts/promote_ideas.py +297 -0
  120. package/scripts/rag_chat.py +191 -0
  121. package/scripts/scan_decrypt_4x.py +329 -0
  122. package/scripts/semantic_search.py +431 -0
  123. package/scripts/sync_fav.py +146 -0
  124. package/scripts/sync_weread.py +192 -0
  125. package/scripts/vault_rag.py +139 -0
  126. package/scripts/vault_search.py +141 -0
  127. package/src/core/dbPathService.ts +348 -0
  128. package/src/core/keyService.ts +409 -0
  129. package/src/core/ntCore.ts +224 -0
  130. package/src/core/sqlcipherCore.ts +764 -0
  131. package/src/core/wcdbCore.ts +4568 -0
  132. package/src/core/wechatClient.ts +204 -0
  133. package/src/lz4.d.ts +10 -0
  134. package/src/services/chatService.ts +296 -0
  135. package/src/services/configService.ts +197 -0
  136. package/src/services/exportService.ts +305 -0
  137. package/src/services/wechat-formatter.ts +348 -0
  138. package/src/services/wechatMessageService.ts +383 -0
  139. package/src/services/wereadService.ts +308 -0
  140. package/src/services/whitelistService.ts +72 -0
  141. package/src/types.ts +141 -0
  142. package/src/utils/errors.ts +42 -0
  143. package/src/utils/pathUtils.ts +16 -0
  144. package/src/utils/pythonRunner.ts +81 -0
  145. package/src/utils/talkerUtils.ts +84 -0
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "weflow-cli",
3
+ "version": "1.5.0",
4
+ "description": "让 AI 读懂你的微信 — 公众号日报·聊天导出·知识库搜索·MCP Server",
5
+ "type": "module",
6
+ "bin": {
7
+ "weflow-cli": "./cli.cjs"
8
+ },
9
+ "files": [
10
+ "cli.cjs",
11
+ "dist/",
12
+ "scripts/**/*.py",
13
+ "mcp-server/",
14
+ "bin/",
15
+ "src/",
16
+ "resources/",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "keywords": [
21
+ "wechat",
22
+ "weixin",
23
+ "mcp",
24
+ "rss",
25
+ "daily",
26
+ "公众号",
27
+ "聊天记录",
28
+ "ai",
29
+ "deepseek",
30
+ "claude"
31
+ ],
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/zhuobichen/weflow-cli"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc",
38
+ "dev": "npx tsx bin/weflow-cli.ts",
39
+ "start": "node cli.cjs",
40
+ "prepublishOnly": "npm run build"
41
+ },
42
+ "dependencies": {
43
+ "@modelcontextprotocol/sdk": "^1.29.0",
44
+ "@wenyan-md/core": "^3.0.10",
45
+ "chalk": "^5.4.1",
46
+ "commander": "^13.1.0",
47
+ "css-tree": "^3.2.1",
48
+ "exceljs": "^4.4.0",
49
+ "form-data-encoder": "^4.1.0",
50
+ "formdata-node": "^6.0.3",
51
+ "front-matter": "^4.0.2",
52
+ "fzstd": "^0.1.1",
53
+ "highlight.js": "^11.11.1",
54
+ "inquirer": "^13.4.3",
55
+ "jsdom": "^27.4.0",
56
+ "koffi": "^2.9.0",
57
+ "lz4": "^0.6.5",
58
+ "marked": "^18.0.4",
59
+ "marked-highlight": "^2.2.4",
60
+ "qrcode-terminal": "^0.12.0"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^22.0.0",
64
+ "@types/qrcode-terminal": "^0.12.2",
65
+ "electron": "^42.0.1",
66
+ "tsx": "^4.19.0",
67
+ "typescript": "^5.7.0"
68
+ },
69
+ "engines": {
70
+ "node": ">=18"
71
+ }
72
+ }
@@ -0,0 +1,73 @@
1
+ """Batch add local_source links to existing V2 notes."""
2
+ from pathlib import Path
3
+ import re
4
+
5
+ vault = Path('output/wechat-vault')
6
+ lit_dir = vault / '002_Literature' / 'WeChat'
7
+ biz = Path('output/biz-daily')
8
+
9
+ updated = 0
10
+ for date_dir in sorted(lit_dir.iterdir()):
11
+ if not date_dir.is_dir():
12
+ continue
13
+ date_str = date_dir.name
14
+ for note_file in date_dir.glob('*.md'):
15
+ content = note_file.read_text(encoding='utf-8')
16
+ if 'local_source:' in content:
17
+ continue
18
+
19
+ title_match = re.search(r'title:\s*"(.+?)"', content)
20
+ source_match = re.search(r'source:\s*"(.+?)"', content)
21
+ if not title_match:
22
+ continue
23
+
24
+ title = title_match.group(1)
25
+ source = source_match.group(1) if source_match else ''
26
+
27
+ # Find matching biz-daily article
28
+ found = False
29
+ for topic_dir in biz.glob(f'{date_str}/*'):
30
+ if not topic_dir.is_dir():
31
+ continue
32
+ for article in topic_dir.glob('*.md'):
33
+ if article.name == 'README.md':
34
+ continue
35
+ try:
36
+ ac = article.read_text(encoding='utf-8')
37
+ except Exception:
38
+ continue
39
+ if f'title: "{title}"' in ac or f"title: '{title}'" in ac:
40
+ local_path = 'file:///' + str(article.resolve()).replace('\\', '/')
41
+
42
+ # Add local_source in frontmatter
43
+ content = content.replace(
44
+ 'source_type: wechat-article\n',
45
+ f'source_type: wechat-article\nlocal_source: "{local_path}"\n'
46
+ )
47
+
48
+ # Update callout: rename 链接→网页, add 本地
49
+ if '📂 打开源文件' not in content:
50
+ # Replace the link line in callout
51
+ content = content.replace(
52
+ '- **链接**: [',
53
+ '- **网页**: [微信原文]('
54
+ )
55
+ # Find where to insert local line (after 网页 line)
56
+ lines = content.split('\n')
57
+ for i, line in enumerate(lines):
58
+ if line.strip().startswith('- **网页**: ['):
59
+ # Insert local file line after this
60
+ lines.insert(i + 1, f'> - **本地**: [📂 打开源文件]({local_path})')
61
+ break
62
+ content = '\n'.join(lines)
63
+
64
+ note_file.write_text(content, encoding='utf-8')
65
+ updated += 1
66
+ found = True
67
+ break
68
+ if found:
69
+ break
70
+
71
+ print(f' {date_str}: {updated} total')
72
+
73
+ print(f'\nBatch done: {updated} notes updated')