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
@@ -0,0 +1,273 @@
1
+ import { join, dirname } from 'path';
2
+ import { existsSync, mkdirSync, writeFileSync } from 'fs';
3
+ import { execFile } from 'child_process';
4
+ import { promisify } from 'util';
5
+ import { fileURLToPath } from 'url';
6
+ import { chatService } from './chatService.js';
7
+ import { configService } from './configService.js';
8
+ const execFileAsync = promisify(execFile);
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+ export class ExportService {
12
+ async exportJson(talker, outputDir, limit = 0) {
13
+ try {
14
+ const messages = await chatService.getMessages(talker, limit);
15
+ if (messages.length === 0) {
16
+ return { success: false, error: '未找到消息' };
17
+ }
18
+ const dir = this.ensureOutputDir(outputDir);
19
+ const filePath = join(dir, `${talker}_messages.json`);
20
+ writeFileSync(filePath, JSON.stringify(messages, null, 2), 'utf8');
21
+ return { success: true, path: filePath };
22
+ }
23
+ catch (e) {
24
+ return { success: false, error: String(e) };
25
+ }
26
+ }
27
+ async exportTxt(talker, outputDir, limit = 0) {
28
+ try {
29
+ const messages = await chatService.getMessages(talker, limit);
30
+ if (messages.length === 0) {
31
+ return { success: false, error: '未找到消息' };
32
+ }
33
+ const lines = messages.map(m => {
34
+ const time = new Date(m.createTime * 1000).toLocaleString('zh-CN');
35
+ const sender = m.isSend ? '我' : (m.senderUsername || talker);
36
+ const content = m.parsedContent || m.rawContent || '';
37
+ return `[${time}] ${sender}: ${content}`;
38
+ });
39
+ const dir = this.ensureOutputDir(outputDir);
40
+ const filePath = join(dir, `${talker}_messages.txt`);
41
+ writeFileSync(filePath, lines.join('\n'), 'utf8');
42
+ return { success: true, path: filePath };
43
+ }
44
+ catch (e) {
45
+ return { success: false, error: String(e) };
46
+ }
47
+ }
48
+ async exportHtml(talker, outputDir, limit = 0) {
49
+ try {
50
+ // Use Python export_chat_html.py for rich HTML with images
51
+ const cfg = configService.getAll();
52
+ const db = cfg.ntDbPath;
53
+ const key = cfg.ntKey;
54
+ const salt = cfg.ntSalt;
55
+ if (!db || !key || !salt) {
56
+ // Fallback: basic HTML
57
+ return this.exportHtmlBasic(talker, outputDir, limit);
58
+ }
59
+ // Resolve Python script path (dist/src/services → package root)
60
+ const pkgRoot = join(__dirname, '..', '..', '..');
61
+ const script = join(pkgRoot, 'scripts', 'export_chat_html.py');
62
+ // Cache dir for image thumbnails
63
+ const cacheDir = cfg.contactDbPath
64
+ ? join(dirname(dirname(cfg.contactDbPath)), 'cache')
65
+ : '';
66
+ // Resolve display name for filename (prefer remark/nickname over wxid)
67
+ let displayName = '';
68
+ try {
69
+ const sessions = await chatService.listSessions();
70
+ const match = sessions.find(s => s.username === talker);
71
+ if (match?.displayName && match.displayName !== talker) {
72
+ displayName = match.displayName;
73
+ }
74
+ }
75
+ catch { }
76
+ const args = [
77
+ script,
78
+ '--db', db,
79
+ '--key', key,
80
+ '--salt', salt,
81
+ '--talker', talker,
82
+ '--out', outputDir || `./output`,
83
+ '--single',
84
+ '--parts', '1',
85
+ ];
86
+ if (displayName) {
87
+ args.push('--name', displayName);
88
+ }
89
+ if (cacheDir && existsSync(cacheDir)) {
90
+ args.push('--cache-dir', cacheDir);
91
+ }
92
+ console.log(` Exporting HTML via Python...`);
93
+ const { stdout } = await execFileAsync('python', args, {
94
+ timeout: 300_000,
95
+ maxBuffer: 50 * 1024 * 1024,
96
+ });
97
+ // Parse JSON result from Python output
98
+ const lines = stdout.split('\n').filter((l) => l.trim());
99
+ for (let i = lines.length - 1; i >= 0; i--) {
100
+ try {
101
+ const result = JSON.parse(lines[i]);
102
+ if (result.success && result.files?.length > 0) {
103
+ return { success: true, path: result.files[0] };
104
+ }
105
+ }
106
+ catch { }
107
+ }
108
+ return { success: false, error: 'Python export succeeded but no output found' };
109
+ }
110
+ catch (e) {
111
+ console.error(` Python export failed: ${e.message}`);
112
+ // Fallback to basic HTML
113
+ return this.exportHtmlBasic(talker, outputDir, limit);
114
+ }
115
+ }
116
+ async exportHtmlBasic(talker, outputDir, limit = 0) {
117
+ const messages = await chatService.getMessages(talker, limit);
118
+ if (messages.length === 0) {
119
+ return { success: false, error: '未找到消息' };
120
+ }
121
+ const html = this.buildHtml(talker, messages);
122
+ const dir = this.ensureOutputDir(outputDir);
123
+ const filePath = join(dir, `${talker}_messages.html`);
124
+ writeFileSync(filePath, html, 'utf8');
125
+ return { success: true, path: filePath };
126
+ }
127
+ async exportExcel(talker, outputDir, limit = 0) {
128
+ try {
129
+ const ExcelJS = await import('exceljs');
130
+ const messages = await chatService.getMessages(talker, limit);
131
+ if (messages.length === 0) {
132
+ return { success: false, error: '未找到消息' };
133
+ }
134
+ const workbook = new ExcelJS.Workbook();
135
+ const sheet = workbook.addWorksheet('聊天记录');
136
+ sheet.columns = [
137
+ { header: '时间', key: 'time', width: 20 },
138
+ { header: '发送者', key: 'sender', width: 15 },
139
+ { header: '类型', key: 'type', width: 10 },
140
+ { header: '内容', key: 'content', width: 80 },
141
+ { header: '消息ID', key: 'msgId', width: 15 }
142
+ ];
143
+ for (const m of messages) {
144
+ sheet.addRow({
145
+ time: new Date(m.createTime * 1000).toLocaleString('zh-CN'),
146
+ sender: m.isSend ? '我' : (m.senderUsername || talker),
147
+ type: this.getMessageTypeName(m.localType),
148
+ content: m.parsedContent || m.rawContent || '',
149
+ msgId: m.localId
150
+ });
151
+ }
152
+ const dir = this.ensureOutputDir(outputDir);
153
+ const filePath = join(dir, `${talker}_messages.xlsx`);
154
+ await workbook.xlsx.writeFile(filePath);
155
+ return { success: true, path: filePath };
156
+ }
157
+ catch (e) {
158
+ return { success: false, error: String(e) };
159
+ }
160
+ }
161
+ buildHtml(talker, messages) {
162
+ const rows = messages.map(m => {
163
+ const time = new Date(m.createTime * 1000).toLocaleString('zh-CN');
164
+ const sender = m.isSend ? '我' : this.escapeHtml(m.senderUsername || talker);
165
+ const contentType = m.localType;
166
+ const contentHtml = this.renderMessageContent(m);
167
+ const align = m.isSend ? 'right' : 'left';
168
+ const bgColor = m.isSend ? '#95ec69' : '#ffffff';
169
+ return `<div style="text-align:${align};margin:8px 0;">
170
+ <div style="display:inline-block;background:${bgColor};padding:8px 12px;border-radius:8px;max-width:80%;">
171
+ <div style="font-size:12px;color:#999;">${sender} · ${time}</div>
172
+ <div style="margin-top:4px;white-space:pre-wrap;word-break:break-all;">${contentHtml}</div>
173
+ </div>
174
+ </div>`;
175
+ }).join('\n');
176
+ return `<!DOCTYPE html>
177
+ <html lang="zh-CN">
178
+ <head>
179
+ <meta charset="UTF-8">
180
+ <title>聊天记录 - ${this.escapeHtml(talker)}</title>
181
+ <style>
182
+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f0f0; padding: 20px; }
183
+ .container { max-width: 820px; margin: 0 auto; background: #f5f5f5; padding: 20px; border-radius: 12px; }
184
+ .msg-image { color:#888; }
185
+ .msg-image img { max-width:240px; max-height:240px; border-radius:4px; margin-top:6px; display:block; }
186
+ .msg-app { margin:0; }
187
+ .msg-app .app-title { font-size:14px; font-weight:600; color:#333; }
188
+ .msg-app .app-desc { font-size:12px; color:#999; margin-top:2px; }
189
+ .msg-app .app-url { display:block; margin-top:6px; padding:6px 10px; background:#f0f0f0; border-left:3px solid #07c160; text-decoration:none; color:#576b95; border-radius:0 4px 4px 0; font-size:13px; }
190
+ .msg-app .app-file { color:#07c160; font-weight:600; }
191
+ .msg-sys { color:#bbb; font-size:13px; }
192
+ .msg-media { color:#888; }
193
+ </style>
194
+ </head>
195
+ <body>
196
+ <div class="container">
197
+ <h2 style="text-align:center;">聊天记录 - ${this.escapeHtml(talker)}</h2>
198
+ <p style="text-align:center;color:#999;">共 ${messages.length} 条消息</p>
199
+ ${rows}
200
+ </div>
201
+ </body>
202
+ </html>`;
203
+ }
204
+ renderMessageContent(m) {
205
+ switch (m.localType) {
206
+ case 1:
207
+ return this.escapeHtml(m.parsedContent || m.rawContent || '');
208
+ case 3: {
209
+ let html = `<span class="msg-media">[图片]</span>`;
210
+ if (m.imageFileName) {
211
+ html = `<span class="msg-media">[图片: ${this.escapeHtml(m.imageFileName)}]</span>`;
212
+ }
213
+ if (m.imageBase64) {
214
+ html += `<br><img src="data:image/jpeg;base64,${m.imageBase64}" />`;
215
+ }
216
+ return html;
217
+ }
218
+ case 34:
219
+ return '<span class="msg-media">[语音]</span>';
220
+ case 43:
221
+ return '<span class="msg-media">[视频]</span>';
222
+ case 47:
223
+ return this.escapeHtml(m.parsedContent || '[表情]');
224
+ case 49: {
225
+ let html = '<div class="msg-app">';
226
+ if (m.appTitle) {
227
+ html += `<div class="app-title">${this.escapeHtml(m.appTitle)}</div>`;
228
+ }
229
+ if (m.appDescription) {
230
+ html += `<div class="app-desc">${this.escapeHtml(m.appDescription)}</div>`;
231
+ }
232
+ if (m.appUrl) {
233
+ html += `<a class="app-url" href="${this.escapeHtml(m.appUrl)}" target="_blank">${this.escapeHtml(m.appUrl)}</a>`;
234
+ }
235
+ html += '</div>';
236
+ if (!m.appTitle && !m.appDescription && !m.appUrl) {
237
+ html = this.escapeHtml(m.parsedContent || '[链接/文件]');
238
+ }
239
+ return html;
240
+ }
241
+ case 50:
242
+ return '<span class="msg-media">[语音通话]</span>';
243
+ case 10000:
244
+ return `<span class="msg-sys">${this.escapeHtml(m.parsedContent || '')}</span>`;
245
+ default:
246
+ return this.escapeHtml(m.parsedContent || m.rawContent || '');
247
+ }
248
+ }
249
+ escapeHtml(str) {
250
+ return str
251
+ .replace(/&/g, '&amp;')
252
+ .replace(/</g, '&lt;')
253
+ .replace(/>/g, '&gt;')
254
+ .replace(/"/g, '&quot;');
255
+ }
256
+ getMessageTypeName(type) {
257
+ const map = {
258
+ 1: '文本', 3: '图片', 34: '语音', 42: '名片',
259
+ 43: '视频', 47: '表情', 48: '位置', 49: '链接/文件',
260
+ 50: '语音通话', 10000: '系统', 10002: '引用'
261
+ };
262
+ return map[type] || `类型${type}`;
263
+ }
264
+ ensureOutputDir(dir) {
265
+ const resolved = dir || './output';
266
+ if (!existsSync(resolved)) {
267
+ mkdirSync(resolved, { recursive: true });
268
+ }
269
+ return resolved;
270
+ }
271
+ }
272
+ export const exportService = new ExportService();
273
+ //# sourceMappingURL=exportService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exportService.js","sourceRoot":"","sources":["../../../src/services/exportService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAY,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,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AI,EAAE,QAAQ,CAAC,CAAA;IAC5B,CAAC;IAEO,kBAAkB,CAAC,IAAY;QACrC,MAAM,GAAG,GAA2B;YAClC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI;YACpC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO;YACzC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI;SACrC,CAAA;QACD,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAA;IACjC,CAAC;IAEO,eAAe,CAAC,GAAW;QACjC,MAAM,QAAQ,GAAG,GAAG,IAAI,UAAU,CAAA;QAClC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAC1C,CAAC;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAA"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * 微信公众号 Markdown → HTML 排版转换器
3
+ *
4
+ * 基于 wechat-publisher-mcp 的 MarkdownConverter.js(MIT 许可)改写,
5
+ * 增加多主题支持,输出微信兼容的 inline-style HTML。
6
+ */
7
+ export interface FormatOptions {
8
+ theme?: 'default' | 'warm' | 'minimal' | 'green';
9
+ fontSize?: number;
10
+ lineHeight?: number;
11
+ }
12
+ interface ThemeConfig {
13
+ id: string;
14
+ name: string;
15
+ description: string;
16
+ h1: {
17
+ color: string;
18
+ border: string;
19
+ };
20
+ h2: {
21
+ color: string;
22
+ prefix: string;
23
+ };
24
+ h3: {
25
+ color: string;
26
+ prefix: string;
27
+ };
28
+ h4: {
29
+ color: string;
30
+ prefix: string;
31
+ };
32
+ bold: {
33
+ color: string;
34
+ };
35
+ italic: {
36
+ color: string;
37
+ };
38
+ del: {
39
+ color: string;
40
+ };
41
+ codeBlock: {
42
+ bg: string;
43
+ border: string;
44
+ };
45
+ inlineCode: {
46
+ bg: string;
47
+ color: string;
48
+ };
49
+ blockquote: {
50
+ border: string;
51
+ bg: string;
52
+ color: string;
53
+ };
54
+ link: {
55
+ color: string;
56
+ };
57
+ }
58
+ /** 列出所有可用主题 */
59
+ export declare function listThemes(): {
60
+ id: string;
61
+ name: string;
62
+ description: string;
63
+ }[];
64
+ /** 获取单个主题配置 */
65
+ export declare function getTheme(id: string): ThemeConfig | undefined;
66
+ /** 主入口:Markdown → 微信兼容 HTML */
67
+ export declare function formatWeChatArticle(markdown: string, options?: FormatOptions): string;
68
+ export {};
69
+ //# sourceMappingURL=wechat-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wechat-formatter.d.ts","sourceRoot":"","sources":["../../../src/services/wechat-formatter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACvB,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,UAAU,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACzB;AAqED,eAAe;AACf,wBAAgB,UAAU,IAAI;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EAAE,CAMhF;AAED,eAAe;AACf,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAE5D;AAcD,+BAA+B;AAC/B,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CAsCzF"}
@@ -0,0 +1,248 @@
1
+ const THEMES = {
2
+ default: {
3
+ id: 'default',
4
+ name: '经典蓝',
5
+ description: '蓝色强调 + 红色重点,适配大多数内容',
6
+ h1: { color: '#2c3e50', border: '#3498db' },
7
+ h2: { color: '#3498db', prefix: '🔹' },
8
+ h3: { color: '#27ae60', prefix: '▶' },
9
+ h4: { color: '#8e44ad', prefix: '•' },
10
+ bold: { color: '#e74c3c' },
11
+ italic: { color: '#9b59b6' },
12
+ del: { color: '#95a5a6' },
13
+ codeBlock: { bg: '#f8f9fa', border: '#e9ecef' },
14
+ inlineCode: { bg: '#f1f3f4', color: '#e91e63' },
15
+ blockquote: { border: '#3498db', bg: '#f8fafb', color: '#555' },
16
+ link: { color: '#3498db' },
17
+ },
18
+ warm: {
19
+ id: 'warm',
20
+ name: '暖橙',
21
+ description: '温暖橙色系,适合生活/人文类内容',
22
+ h1: { color: '#c0392b', border: '#e67e22' },
23
+ h2: { color: '#e67e22', prefix: '🔥' },
24
+ h3: { color: '#d35400', prefix: '▸' },
25
+ h4: { color: '#a0522d', prefix: '·' },
26
+ bold: { color: '#c0392b' },
27
+ italic: { color: '#d35400' },
28
+ del: { color: '#bdc3c7' },
29
+ codeBlock: { bg: '#fef9f4', border: '#f5d9b5' },
30
+ inlineCode: { bg: '#fdf2e9', color: '#c0392b' },
31
+ blockquote: { border: '#e67e22', bg: '#fef9f4', color: '#7f5539' },
32
+ link: { color: '#e67e22' },
33
+ },
34
+ minimal: {
35
+ id: 'minimal',
36
+ name: '极简黑白',
37
+ description: '黑白灰极简风,适合技术/严肃内容',
38
+ h1: { color: '#1a1a1a', border: '#333' },
39
+ h2: { color: '#333', prefix: '#' },
40
+ h3: { color: '#555', prefix: '##' },
41
+ h4: { color: '#777', prefix: '###' },
42
+ bold: { color: '#1a1a1a' },
43
+ italic: { color: '#666' },
44
+ del: { color: '#aaa' },
45
+ codeBlock: { bg: '#f5f5f5', border: '#ddd' },
46
+ inlineCode: { bg: '#f0f0f0', color: '#333' },
47
+ blockquote: { border: '#999', bg: '#f9f9f9', color: '#666' },
48
+ link: { color: '#333' },
49
+ },
50
+ green: {
51
+ id: 'green',
52
+ name: '清新绿',
53
+ description: '绿色自然系,适合健康/科普/环保内容',
54
+ h1: { color: '#1e5631', border: '#27ae60' },
55
+ h2: { color: '#27ae60', prefix: '🌿' },
56
+ h3: { color: '#2ecc71', prefix: '▹' },
57
+ h4: { color: '#16a085', prefix: '◦' },
58
+ bold: { color: '#27ae60' },
59
+ italic: { color: '#2ecc71' },
60
+ del: { color: '#a0c4a8' },
61
+ codeBlock: { bg: '#f0faf3', border: '#c8e6c9' },
62
+ inlineCode: { bg: '#e8f5e9', color: '#1e5631' },
63
+ blockquote: { border: '#27ae60', bg: '#f0faf3', color: '#2e7d32' },
64
+ link: { color: '#27ae60' },
65
+ },
66
+ };
67
+ /** 列出所有可用主题 */
68
+ export function listThemes() {
69
+ return Object.values(THEMES).map(t => ({
70
+ id: t.id,
71
+ name: t.name,
72
+ description: t.description,
73
+ }));
74
+ }
75
+ /** 获取单个主题配置 */
76
+ export function getTheme(id) {
77
+ return THEMES[id];
78
+ }
79
+ /** HTML 实体转义 */
80
+ function escapeHtml(text) {
81
+ const map = {
82
+ '&': '&amp;',
83
+ '<': '&lt;',
84
+ '>': '&gt;',
85
+ '"': '&quot;',
86
+ "'": '&#039;',
87
+ };
88
+ return text.replace(/[&<>"']/g, m => map[m]);
89
+ }
90
+ /** 主入口:Markdown → 微信兼容 HTML */
91
+ export function formatWeChatArticle(markdown, options = {}) {
92
+ if (!markdown || typeof markdown !== 'string')
93
+ return '';
94
+ const theme = THEMES[options.theme || 'default'] || THEMES.default;
95
+ const fontSize = options.fontSize || 16;
96
+ const lineHeight = options.lineHeight || 1.8;
97
+ let html = markdown;
98
+ // 1. 代码块(最先处理,避免被后续规则影响)
99
+ html = convertCodeBlocks(html, theme);
100
+ // 2. 标题
101
+ html = convertHeadings(html, theme);
102
+ // 3. 文本格式
103
+ html = convertTextFormatting(html, theme);
104
+ // 4. 列表
105
+ html = convertLists(html);
106
+ // 5. 引用
107
+ html = convertBlockquotes(html, theme);
108
+ // 6. 链接
109
+ html = convertLinks(html, theme);
110
+ // 7. 表格
111
+ html = convertTables(html);
112
+ // 8. 段落
113
+ html = convertParagraphs(html, fontSize, lineHeight);
114
+ // 9. 清理
115
+ html = cleanupHTML(html);
116
+ // 10. 添加基础样式
117
+ return addBaseStyles(html, fontSize, lineHeight);
118
+ }
119
+ function convertCodeBlocks(html, theme) {
120
+ // 围栏代码块
121
+ html = html.replace(/```(\w+)?\n([\s\S]*?)```/g, (_match, lang, code) => {
122
+ const language = lang || 'text';
123
+ return `<pre data-language="${language}" style="background: ${theme.codeBlock.bg}; padding: 16px; border-radius: 8px; overflow-x: auto; font-size: 14px; line-height: 1.4; border: 1px solid ${theme.codeBlock.border}; margin: 16px 0;"><code style="color: #333; background: none; padding: 0;">${escapeHtml(code.trim())}</code></pre>`;
124
+ });
125
+ // 行内代码
126
+ html = html.replace(/`([^`]+)`/g, `<code style="background: ${theme.inlineCode.bg}; color: ${theme.inlineCode.color}; padding: 2px 6px; border-radius: 4px; font-size: 0.9em;">$1</code>`);
127
+ return html;
128
+ }
129
+ function convertHeadings(html, theme) {
130
+ html = html.replace(/^# (.+)$/gm, `<h1 style="color: ${theme.h1.color}; font-size: 26px; font-weight: bold; margin: 24px 0 16px 0; line-height: 1.3; border-bottom: 3px solid ${theme.h1.border}; padding-bottom: 8px;">$1</h1>`);
131
+ html = html.replace(/^## (.+)$/gm, `<h2 style="color: ${theme.h2.color}; font-size: 22px; font-weight: bold; margin: 20px 0 12px 0; line-height: 1.3;">${theme.h2.prefix} $1</h2>`);
132
+ html = html.replace(/^### (.+)$/gm, `<h3 style="color: ${theme.h3.color}; font-size: 18px; font-weight: bold; margin: 18px 0 10px 0; line-height: 1.3;">${theme.h3.prefix} $1</h3>`);
133
+ html = html.replace(/^#### (.+)$/gm, `<h4 style="color: ${theme.h4.color}; font-size: 17px; font-weight: bold; margin: 16px 0 8px 0; line-height: 1.3;">${theme.h4.prefix} $1</h4>`);
134
+ return html;
135
+ }
136
+ function convertTextFormatting(html, theme) {
137
+ html = html.replace(/\*\*(.+?)\*\*/g, `<strong style="color: ${theme.bold.color}; font-weight: bold;">$1</strong>`);
138
+ html = html.replace(/\*(?!\*)(.+?)(?<!\*)\*/g, `<em style="color: ${theme.italic.color}; font-style: italic;">$1</em>`);
139
+ html = html.replace(/~~(.+?)~~/g, `<del style="color: ${theme.del.color}; text-decoration: line-through;">$1</del>`);
140
+ return html;
141
+ }
142
+ function convertLists(html) {
143
+ // 有序列表
144
+ html = html.replace(/^\d+\.\s+(.+)$/gm, '<li style="margin: 8px 0; line-height: 1.6;">$1</li>');
145
+ // 无序列表
146
+ html = html.replace(/^[-*+]\s+(.+)$/gm, '<li style="margin: 8px 0; line-height: 1.6;">$1</li>');
147
+ // 包裹连续的 <li>
148
+ html = html.replace(/(<li[^>]*>.*?<\/li>(\s*<li[^>]*>.*?<\/li>)*)/gs, (match) => `<ul style="margin: 16px 0; padding-left: 24px; list-style-type: disc;">${match}</ul>`);
149
+ return html;
150
+ }
151
+ function convertBlockquotes(html, theme) {
152
+ return html.replace(/^>\s*(.+)$/gm, `<blockquote style="border-left: 4px solid ${theme.blockquote.border}; padding: 16px 20px; margin: 16px 0; background: ${theme.blockquote.bg}; font-style: italic; color: ${theme.blockquote.color}; border-radius: 0 8px 8px 0;">$1</blockquote>`);
153
+ }
154
+ function convertLinks(html, theme) {
155
+ return html.replace(/\[([^\]]+)\]\(([^)]+)\)/g, `<a href="$2" style="color: ${theme.link.color}; text-decoration: none; border-bottom: 1px dotted ${theme.link.color};" target="_blank">$1</a>`);
156
+ }
157
+ function convertTables(html) {
158
+ const lines = html.split('\n');
159
+ let inTable = false;
160
+ let tableLines = [];
161
+ const result = [];
162
+ for (const line of lines) {
163
+ const trimmed = line.trim();
164
+ if (trimmed.includes('|') && !inTable) {
165
+ inTable = true;
166
+ tableLines = [trimmed];
167
+ }
168
+ else if (trimmed.includes('|') && inTable) {
169
+ tableLines.push(trimmed);
170
+ }
171
+ else if (inTable) {
172
+ if (tableLines.length > 0)
173
+ result.push(convertTableToHTML(tableLines));
174
+ inTable = false;
175
+ tableLines = [];
176
+ result.push(line);
177
+ }
178
+ else {
179
+ result.push(line);
180
+ }
181
+ }
182
+ if (inTable && tableLines.length > 0) {
183
+ result.push(convertTableToHTML(tableLines));
184
+ }
185
+ return result.join('\n');
186
+ }
187
+ function convertTableToHTML(tableLines) {
188
+ if (tableLines.length < 2)
189
+ return tableLines.join('\n');
190
+ const headerLine = tableLines[0];
191
+ const separatorLine = tableLines[1];
192
+ const dataLines = tableLines.slice(2);
193
+ const headers = headerLine.split('|').map(h => h.trim()).filter(h => h);
194
+ if (!separatorLine.includes('-'))
195
+ return tableLines.join('\n');
196
+ let tableHTML = '<table style="width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">';
197
+ tableHTML += '<thead><tr style="background: #f8f9fa;">';
198
+ headers.forEach(header => {
199
+ tableHTML += `<th style="border: 1px solid #dee2e6; padding: 12px 8px; text-align: left; font-weight: bold; color: #495057;">${header}</th>`;
200
+ });
201
+ tableHTML += '</tr></thead><tbody>';
202
+ dataLines.forEach((line, index) => {
203
+ const cells = line.split('|').map(c => c.trim()).filter(c => c);
204
+ const bg = index % 2 === 0 ? '#ffffff' : '#f8f9fa';
205
+ tableHTML += `<tr style="background: ${bg};">`;
206
+ cells.forEach(cell => {
207
+ tableHTML += `<th style="border: 1px solid #dee2e6; padding: 12px 8px; color: #495057;">${cell}</th>`;
208
+ });
209
+ tableHTML += '</tr>';
210
+ });
211
+ tableHTML += '</tbody></table>';
212
+ return tableHTML;
213
+ }
214
+ function convertParagraphs(html, fontSize, lineHeight) {
215
+ html = html.replace(/\n\s*\n/g, `</p><p style="margin: 15px 0; line-height: ${lineHeight}; text-align: justify; color: #333; font-size: ${fontSize}px;">`);
216
+ html =
217
+ `<p style="margin: 15px 0; line-height: ${lineHeight}; text-align: justify; color: #333; font-size: ${fontSize}px;">${html}</p>`;
218
+ return html;
219
+ }
220
+ function cleanupHTML(html) {
221
+ html = html.replace(/<p[^>]*>\s*<\/p>/g, '');
222
+ html = html.replace(/<p[^>]*>(\s*<h[1-6][^>]*>.*?<\/h[1-6]>\s*)<\/p>/g, '$1');
223
+ html = html.replace(/<p[^>]*>(\s*<ul[^>]*>.*?<\/ul>\s*)<\/p>/gs, '$1');
224
+ html = html.replace(/<p[^>]*>(\s*<ol[^>]*>.*?<\/ol>\s*)<\/p>/gs, '$1');
225
+ html = html.replace(/<p[^>]*>(\s*<blockquote[^>]*>.*?<\/blockquote>\s*)<\/p>/gs, '$1');
226
+ html = html.replace(/<p[^>]*>(\s*<pre[^>]*>.*?<\/pre>\s*)<\/p>/gs, '$1');
227
+ html = html.replace(/<p[^>]*>(\s*<table[^>]*>.*?<\/table>\s*)<\/p>/gs, '$1');
228
+ return html;
229
+ }
230
+ function addBaseStyles(html, fontSize, lineHeight) {
231
+ const style = `
232
+ <style>
233
+ body {
234
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
235
+ line-height: ${lineHeight};
236
+ color: #333;
237
+ background: #fff;
238
+ font-size: ${fontSize}px;
239
+ margin: 0;
240
+ padding: 20px;
241
+ }
242
+ img { max-width: 100%; height: auto; display: block; margin: 16px auto; border-radius: 8px; }
243
+ hr { border: none; height: 1px; background: linear-gradient(to right, transparent, #ddd, transparent); margin: 24px 0; }
244
+ </style>
245
+ `;
246
+ return style + html;
247
+ }
248
+ //# sourceMappingURL=wechat-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wechat-formatter.js","sourceRoot":"","sources":["../../../src/services/wechat-formatter.ts"],"names":[],"mappings":"AA6BA,MAAM,MAAM,GAAgC;IAC1C,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,qBAAqB;QAClC,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE;QAC3C,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;QACtC,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE;QACrC,EAAE,EAAE,EAAE,KAAK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