@mkterswingman/5mghost-wonder 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/auth/runtime.js +15 -0
  2. package/dist/cli.js +75 -0
  3. package/dist/commands/auth.js +100 -0
  4. package/dist/commands/check.js +258 -0
  5. package/dist/commands/help.js +38 -0
  6. package/dist/commands/index.js +50 -0
  7. package/dist/commands/read.js +198 -0
  8. package/dist/commands/setup.js +81 -0
  9. package/dist/commands/types.js +4 -0
  10. package/dist/commands/uninstall.js +14 -0
  11. package/dist/commands/update.js +21 -0
  12. package/dist/commands/version.js +8 -0
  13. package/dist/commands/wecom.js +136 -0
  14. package/dist/platform/npm.js +14 -0
  15. package/dist/platform/paths.js +25 -0
  16. package/dist/telemetry/events.js +42 -0
  17. package/dist/telemetry/policy.js +51 -0
  18. package/dist/telemetry/runtime.js +31 -0
  19. package/dist/wecom/browser.js +344 -0
  20. package/dist/wecom/cache.js +119 -0
  21. package/dist/wecom/cookies.js +151 -0
  22. package/dist/wecom/export.js +236 -0
  23. package/dist/wecom/url.js +45 -0
  24. package/dist/wecom/url.test.js +64 -0
  25. package/dist/xlsx/drawing.js +131 -0
  26. package/dist/xlsx/metadata.js +34 -0
  27. package/dist/xlsx/parse-tab.js +124 -0
  28. package/dist/xlsx/shared-strings.js +51 -0
  29. package/dist/xlsx/sheet.js +161 -0
  30. package/dist/xlsx/styles.js +85 -0
  31. package/dist/xlsx/unzip.js +33 -0
  32. package/dist/xlsx/workbook.js +51 -0
  33. package/dist/xlsx/workbook.test.js +19 -0
  34. package/package.json +41 -0
  35. package/scripts/check-export-types.mjs +37 -0
  36. package/scripts/postinstall.mjs +50 -0
  37. package/skills/setup-5mghost-wonder/SKILL.md +245 -0
  38. package/skills/use-5mghost-wonder/SKILL.md +240 -0
  39. package/skills.manifest.json +36 -0
@@ -0,0 +1,245 @@
1
+ ---
2
+ name: setup-5mghost-wonder
3
+ description: Use this skill when the user wants to install or set up wonder, says "安装 wonder", "设置 wonder", "install wonder", "setup wonder", or when wonder is not yet installed or configured. Also use when `wonder check` reports missing dependencies.
4
+ ---
5
+
6
+ # Setup wonder — 企微文档 CLI 安装向导
7
+
8
+ You are guiding the user through installing and configuring `wonder`, the WeCom document reader CLI.
9
+
10
+ Execute each step in order using the Bash tool. Stop and ask for user interaction only when a step requires it (e.g., browser OAuth, QR code scan). After each detection step, only proceed to installation if the tool is missing.
11
+
12
+ ---
13
+
14
+ ## Step 1 — Check if wonder CLI is installed
15
+
16
+ ```bash
17
+ wonder --version
18
+ ```
19
+
20
+ **If missing**, install globally:
21
+
22
+ ```bash
23
+ npm install -g @mkterswingman/5mghost-wonder
24
+ ```
25
+
26
+ Verify:
27
+
28
+ ```bash
29
+ wonder --version
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Step 2 — mkterswingman Auth Login
35
+
36
+ Check current status:
37
+
38
+ ```bash
39
+ wonder auth status
40
+ ```
41
+
42
+ If not logged in, run:
43
+
44
+ ```bash
45
+ wonder auth login
46
+ ```
47
+
48
+ A browser window will open for OAuth. Wait for the user to complete login, then verify:
49
+
50
+ ```bash
51
+ wonder auth status
52
+ ```
53
+
54
+ For headless or CI environments, use PAT instead:
55
+
56
+ ```bash
57
+ wonder auth login --pat
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Step 3 — WeCom Cookie (企微扫码)
63
+
64
+ Check current cookie status:
65
+
66
+ ```bash
67
+ wonder wecom status
68
+ ```
69
+
70
+ If expired or missing, run:
71
+
72
+ ```bash
73
+ wonder wecom cookie
74
+ ```
75
+
76
+ This launches the local Chrome/Edge browser via CDP. The user must scan the QR code in the browser using their WeCom mobile app. Wait for the user to confirm they have scanned and logged in, then verify:
77
+
78
+ ```bash
79
+ wonder wecom status
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Step 4 — Detect and install docx skill
85
+
86
+ Check plugin cache first:
87
+
88
+ ```bash
89
+ ls ~/.claude-internal/plugins/cache/anthropic-agent-skills/document-skills/*/skills/docx/SKILL.md 2>/dev/null | head -1
90
+ ```
91
+
92
+ Check user skills:
93
+
94
+ ```bash
95
+ ls ~/.claude-internal/skills/docx/SKILL.md 2>/dev/null
96
+ ```
97
+
98
+ **If neither exists**, download from GitHub:
99
+
100
+ ```bash
101
+ mkdir -p ~/.claude-internal/skills/docx
102
+ curl -fsSL https://raw.githubusercontent.com/anthropics/skills/main/skills/docx/SKILL.md \
103
+ -o ~/.claude-internal/skills/docx/SKILL.md
104
+ ```
105
+
106
+ Confirm:
107
+
108
+ ```bash
109
+ ls -lh ~/.claude-internal/skills/docx/SKILL.md
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Step 5 — Detect and install pptx skill
115
+
116
+ Check plugin cache first:
117
+
118
+ ```bash
119
+ ls ~/.claude-internal/plugins/cache/anthropic-agent-skills/document-skills/*/skills/pptx/SKILL.md 2>/dev/null | head -1
120
+ ```
121
+
122
+ Check user skills:
123
+
124
+ ```bash
125
+ ls ~/.claude-internal/skills/pptx/SKILL.md 2>/dev/null
126
+ ```
127
+
128
+ **If neither exists**, download from GitHub:
129
+
130
+ ```bash
131
+ mkdir -p ~/.claude-internal/skills/pptx
132
+ curl -fsSL https://raw.githubusercontent.com/anthropics/skills/main/skills/pptx/SKILL.md \
133
+ -o ~/.claude-internal/skills/pptx/SKILL.md
134
+ ```
135
+
136
+ Confirm:
137
+
138
+ ```bash
139
+ ls -lh ~/.claude-internal/skills/pptx/SKILL.md
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Step 6 — Detect and install LibreOffice
145
+
146
+ ```bash
147
+ which soffice
148
+ ```
149
+
150
+ **If missing**, install by platform:
151
+
152
+ **macOS:**
153
+
154
+ ```bash
155
+ brew install --cask libreoffice
156
+ ```
157
+
158
+ **Windows:**
159
+
160
+ ```bash
161
+ winget install LibreOffice.LibreOffice
162
+ ```
163
+
164
+ Or download manually: https://www.libreoffice.org/download
165
+
166
+ **Linux (Debian/Ubuntu):**
167
+
168
+ ```bash
169
+ sudo apt install -y libreoffice
170
+ ```
171
+
172
+ **Linux (Fedora/RHEL):**
173
+
174
+ ```bash
175
+ sudo dnf install -y libreoffice
176
+ ```
177
+
178
+ Verify after install:
179
+
180
+ ```bash
181
+ which soffice && soffice --version
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Step 7 — Detect and install pandoc
187
+
188
+ ```bash
189
+ which pandoc
190
+ ```
191
+
192
+ **If missing**, install by platform:
193
+
194
+ **macOS:**
195
+
196
+ ```bash
197
+ brew install pandoc
198
+ ```
199
+
200
+ **Windows:**
201
+
202
+ ```bash
203
+ winget install pandoc
204
+ ```
205
+
206
+ **Linux (Debian/Ubuntu):**
207
+
208
+ ```bash
209
+ sudo apt install -y pandoc
210
+ ```
211
+
212
+ **Linux (Fedora/RHEL):**
213
+
214
+ ```bash
215
+ sudo dnf install -y pandoc
216
+ ```
217
+
218
+ Verify after install:
219
+
220
+ ```bash
221
+ pandoc --version | head -1
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Step 8 — Final verification
227
+
228
+ Run the built-in health check:
229
+
230
+ ```bash
231
+ wonder check
232
+ ```
233
+
234
+ All items should show ✅. If any item fails, re-run the relevant step above.
235
+
236
+ ---
237
+
238
+ ## Reference links
239
+
240
+ | Dependency | Source |
241
+ |-----------|--------|
242
+ | docx skill | https://github.com/anthropics/skills/tree/main/skills/docx |
243
+ | pptx skill | https://github.com/anthropics/skills/tree/main/skills/pptx |
244
+ | LibreOffice | https://www.libreoffice.org/download |
245
+ | pandoc | https://pandoc.org/installing.html |
@@ -0,0 +1,240 @@
1
+ ---
2
+ name: use-5mghost-wonder
3
+ description: Use this skill when the user shares a URL containing "doc.weixin.qq.com", mentions 企微文档, 企业微信文档, 在线表格, 腾讯文档, wecom doc, wechat doc, wecom document, or asks you to read a WeCom document. Activate automatically on any doc.weixin.qq.com link.
4
+ ---
5
+
6
+ # use-5mghost-wonder — 企微文档读取操作指南
7
+
8
+ ## Session Initialization (first use only per session)
9
+
10
+ The **first time** you encounter a WeCom document URL in a session, run these checks before processing the document. Remember you have already done this — do not repeat in subsequent calls within the same session.
11
+
12
+ ```bash
13
+ # 1. Check for updates
14
+ wonder update
15
+
16
+ # 2. Check WeCom cookie status
17
+ wonder wecom status
18
+ ```
19
+
20
+ If `wonder wecom status` reports that the cookie is expired or missing:
21
+
22
+ ```bash
23
+ wonder wecom cookie
24
+ ```
25
+
26
+ Wait for the user to complete the QR code scan in the browser, then verify:
27
+
28
+ ```bash
29
+ wonder wecom status
30
+ ```
31
+
32
+ Proceed only after cookie is valid.
33
+
34
+ ---
35
+
36
+ ## URL Type Routing
37
+
38
+ Identify the document type from the URL path prefix:
39
+
40
+ | URL prefix | Type | Action |
41
+ |-----------|------|--------|
42
+ | `sheet/e3_` | xlsx spreadsheet | Two-step: meta → tab data |
43
+ | `doc/w3_` | docx document | Download → parse with docx skill |
44
+ | `doc/e2_` | docx document | Download → parse with docx skill |
45
+ | `slide/p3_` | pptx presentation | Download → parse with pptx skill |
46
+ | `smartpage/a1_` | Smart page | ❌ Not supported in v1 |
47
+ | `mind/m4_` | Mind map | ❌ Not supported in v1 |
48
+
49
+ ---
50
+
51
+ ## xlsx Workflow (`sheet/e3_`)
52
+
53
+ ### Step 1 — Get metadata
54
+
55
+ ```bash
56
+ wonder read <url>
57
+ ```
58
+
59
+ Output is a JSON with tab list and row/column counts:
60
+
61
+ ```json
62
+ {
63
+ "type": "sheet",
64
+ "title": "文档标题",
65
+ "tabs": [
66
+ { "name": "Sheet1", "rows": 50, "cols": 12 },
67
+ { "name": "汇总", "rows": 20, "cols": 8 }
68
+ ]
69
+ }
70
+ ```
71
+
72
+ Decide which tab(s) to read based on the user's question and the metadata.
73
+
74
+ ### Step 2 — Read specific tab
75
+
76
+ ```bash
77
+ wonder read <url> --tab <tab-name>
78
+ ```
79
+
80
+ Output is a structured JSON:
81
+
82
+ ```json
83
+ {
84
+ "tab": "Sheet1",
85
+ "maxRow": 50,
86
+ "maxCol": 12,
87
+ "cells": [
88
+ { "row": 1, "col": 1, "text": "标题" },
89
+ { "row": 3, "col": 4, "image": { "path": "/path/to/xl/media/image1.png", "width": 200, "height": 150 } }
90
+ ],
91
+ "merges": [
92
+ { "startRow": 1, "startCol": 1, "endRow": 1, "endCol": 3 }
93
+ ]
94
+ }
95
+ ```
96
+
97
+ Consume this JSON directly to answer the user's question.
98
+
99
+ ### Viewing embedded images
100
+
101
+ Image cells have a `path` field pointing to the local extracted file. Use the Read tool to view:
102
+
103
+ ```
104
+ Read("/Users/<you>/Downloads/5mghost-wonder/media/image3.png")
105
+ ```
106
+
107
+ **Note:** Images are full-resolution originals (up to several MB each). Only load images the user specifically asks about.
108
+
109
+ ---
110
+
111
+ ## docx Workflow (`doc/w3_`, `doc/e2_`)
112
+
113
+ ### Step 1 — Download
114
+
115
+ ```bash
116
+ wonder read <url>
117
+ ```
118
+
119
+ Output:
120
+
121
+ ```json
122
+ { "type": "doc", "path": "/Users/<you>/Downloads/5mghost-wonder/filename.docx" }
123
+ ```
124
+
125
+ ### Step 2 — Read content
126
+
127
+ **Read text** (recommended first step):
128
+
129
+ ```bash
130
+ pandoc <path> -o /tmp/wonder-doc-output.md && cat /tmp/wonder-doc-output.md
131
+ ```
132
+
133
+ **View full-page layout with images** (when layout matters):
134
+
135
+ ```bash
136
+ soffice --headless --convert-to pdf --outdir /tmp/ <path>
137
+ ```
138
+
139
+ Then use the Read tool on the generated PDF.
140
+
141
+ **Access embedded images** (when individual images are needed):
142
+
143
+ ```bash
144
+ mkdir -p /tmp/wonder-doc-unpack && cp <path> /tmp/wonder-doc-unpack/doc.zip && unzip -o /tmp/wonder-doc-unpack/doc.zip -d /tmp/wonder-doc-unpack/
145
+ ```
146
+
147
+ Then use Read tool on files in `/tmp/wonder-doc-unpack/word/media/`.
148
+
149
+ ---
150
+
151
+ ## pptx Workflow (`slide/p3_`)
152
+
153
+ ### Step 1 — Download
154
+
155
+ ```bash
156
+ wonder read <url>
157
+ ```
158
+
159
+ Output:
160
+
161
+ ```json
162
+ { "type": "slide", "path": "/Users/<you>/Downloads/5mghost-wonder/filename.pptx" }
163
+ ```
164
+
165
+ ### Step 2 — Read content
166
+
167
+ **Read text** (recommended first step):
168
+
169
+ ```bash
170
+ pandoc <path> -o /tmp/wonder-slide-output.md && cat /tmp/wonder-slide-output.md
171
+ ```
172
+
173
+ **View slide layout**:
174
+
175
+ ```bash
176
+ soffice --headless --convert-to pdf --outdir /tmp/ <path>
177
+ ```
178
+
179
+ Then use the Read tool on the generated PDF.
180
+
181
+ **Access embedded images**:
182
+
183
+ ```bash
184
+ mkdir -p /tmp/wonder-pptx-unpack && cp <path> /tmp/wonder-pptx-unpack/slide.zip && unzip -o /tmp/wonder-pptx-unpack/slide.zip -d /tmp/wonder-pptx-unpack/
185
+ ```
186
+
187
+ Then use Read tool on files in `/tmp/wonder-pptx-unpack/ppt/media/`.
188
+
189
+ ### ⚠️ Known issue: python-pptx slice crash
190
+
191
+ If you use python-pptx to process WeCom pptx files, **do not use slice syntax**:
192
+
193
+ ```python
194
+ # ❌ This crashes on WeCom pptx
195
+ for slide in prs.slides[:5]:
196
+ ...
197
+
198
+ # ✅ Use iteration instead
199
+ for slide in prs.slides:
200
+ ...
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Unsupported types
206
+
207
+ **smartpage (`smartpage/a1_`):**
208
+
209
+ > 当前版本不支持智能文档(smartpage)。建议在浏览器中手动打开文档,选择"导出为 PDF"或"复制内容"。
210
+
211
+ **mind (`mind/m4_`):**
212
+
213
+ > 当前版本不支持思维导图(mind)。
214
+
215
+ ---
216
+
217
+ ## Known issues
218
+
219
+ | Issue | Detail | Workaround |
220
+ |-------|--------|-----------|
221
+ | pptx slice crash | `prs.slides[:N]` → `AttributeError: 'list' object has no attribute 'rId'` | Use `for slide in prs.slides` |
222
+ | Cookie expiry | Cookie valid for 7–30 days | Run `wonder wecom cookie` to refresh |
223
+ | xlsx images are full-size | Original images can be up to 6 MB each | Only read images when user specifically needs them |
224
+ | smartpage unsupported | Export API returns 0% progress forever | Manual browser export |
225
+
226
+ ---
227
+
228
+ ## CLI command reference
229
+
230
+ ```
231
+ wonder read <url> # Auto-detect type; xlsx → metadata; doc/slide → download
232
+ wonder read <url> --tab <name> # xlsx: get full data for specified tab
233
+ wonder read <url> --save <dir> # Set output directory (default: ~/Downloads/5mghost-wonder/)
234
+
235
+ wonder wecom status # Check cookie validity
236
+ wonder wecom cookie # Refresh cookie via browser QR scan
237
+ wonder update # Update to latest version
238
+ wonder check # Health check for all dependencies
239
+ wonder auth status # Check mkterswingman auth status
240
+ ```
@@ -0,0 +1,36 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "product": "5mghost-wonder",
4
+ "skills": [
5
+ {
6
+ "name": "setup-5mghost-wonder",
7
+ "source": { "type": "local", "path": "./skills/setup-5mghost-wonder" },
8
+ "targets": [
9
+ "claude",
10
+ "claude-internal",
11
+ "codex",
12
+ "codex-internal",
13
+ "gemini",
14
+ "gemini-internal",
15
+ "openclaw",
16
+ "workbuddy",
17
+ "codebuddy"
18
+ ]
19
+ },
20
+ {
21
+ "name": "use-5mghost-wonder",
22
+ "source": { "type": "local", "path": "./skills/use-5mghost-wonder" },
23
+ "targets": [
24
+ "claude",
25
+ "claude-internal",
26
+ "codex",
27
+ "codex-internal",
28
+ "gemini",
29
+ "gemini-internal",
30
+ "openclaw",
31
+ "workbuddy",
32
+ "codebuddy"
33
+ ]
34
+ }
35
+ ]
36
+ }