@mkterswingman/5mghost-wonder 0.0.11 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/browser.js +76 -0
- package/dist/commands/help.js +5 -0
- package/dist/commands/index.js +3 -0
- package/dist/telemetry/runtime.js +23 -2
- package/dist/wecom/browser-probe.js +402 -0
- package/dist/wecom/browser.js +49 -7
- package/dist/wecom/cookies.js +11 -0
- package/package.json +3 -2
- package/scripts/check-skills.mjs +37 -0
- package/skills/setup-5mghost-wonder/SKILL.md +2 -2
- package/skills/update-5mghost-wonder/SKILL.md +1 -1
- package/skills/use-5mghost-wonder/SKILL.md +66 -298
- package/skills/use-5mghost-wonder/references/cli-reference.md +26 -0
- package/skills/use-5mghost-wonder/references/cookie-recovery.md +24 -0
- package/skills/use-5mghost-wonder/references/edit-browser-runtime.md +62 -0
- package/skills/use-5mghost-wonder/references/failure-recovery.md +16 -0
- package/skills/use-5mghost-wonder/references/read-export.md +97 -0
- package/skills/use-5mghost-wonder/references/read-no-export-browser.md +81 -0
- package/skills/use-5mghost-wonder/references/route-map.md +21 -0
- package/skills/use-5mghost-wonder/references/session-init.md +19 -0
- package/skills/use-5mghost-wonder/references/verification.md +49 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkterswingman/5mghost-wonder",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "企微文档读取 CLI — WeCom document reader",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "rm -rf dist && tsc && chmod +x dist/cli.js",
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
|
-
"
|
|
28
|
+
"check:skills": "node scripts/check-skills.mjs",
|
|
29
|
+
"test": "npm run check:skills && node dist/wecom/url.test.js && node --test tests/sheet-parity.test.mjs && node --test tests/export-sanitize.test.mjs && node --test tests/format.test.mjs && node --test tests/cookies-validation.test.mjs",
|
|
29
30
|
"smoke": "npm run build && node dist/cli.js help > /dev/null",
|
|
30
31
|
"postinstall": "node scripts/postinstall.mjs"
|
|
31
32
|
},
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// scripts/check-skills.mjs
|
|
2
|
+
// Lightweight packaging guard for bundled skills. It verifies that router
|
|
3
|
+
// skills do not point to missing reference files.
|
|
4
|
+
|
|
5
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
6
|
+
import { dirname, resolve } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
10
|
+
const skillPath = resolve(root, "skills/use-5mghost-wonder/SKILL.md");
|
|
11
|
+
const skillDir = dirname(skillPath);
|
|
12
|
+
const skillText = readFileSync(skillPath, "utf8");
|
|
13
|
+
|
|
14
|
+
const refs = new Set();
|
|
15
|
+
const referencePattern = /`(references\/[^`]+\.md)`/g;
|
|
16
|
+
let match;
|
|
17
|
+
while ((match = referencePattern.exec(skillText)) !== null) {
|
|
18
|
+
refs.add(match[1]);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (refs.size === 0) {
|
|
22
|
+
throw new Error("use-5mghost-wonder/SKILL.md does not reference any workflow files");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const missing = [];
|
|
26
|
+
for (const ref of refs) {
|
|
27
|
+
const filePath = resolve(skillDir, ref);
|
|
28
|
+
if (!existsSync(filePath)) {
|
|
29
|
+
missing.push(ref);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (missing.length > 0) {
|
|
34
|
+
throw new Error(`Missing use-5mghost-wonder references: ${missing.join(", ")}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.log(`✅ use-5mghost-wonder references OK (${refs.size} files)`);
|
|
@@ -7,9 +7,9 @@ description: Use this skill when the user wants to install or set up wonder, say
|
|
|
7
7
|
|
|
8
8
|
## Skill version
|
|
9
9
|
|
|
10
|
-
This skill matches **wonder 0.0.
|
|
10
|
+
This skill matches **wonder 0.0.14**.
|
|
11
11
|
|
|
12
|
-
Once the CLI is installed in Step 1, run `wonder --version`. If the output does not equal `0.0.
|
|
12
|
+
Once the CLI is installed in Step 1, run `wonder --version`. If the output does not equal `0.0.14`, the CLI on disk has drifted from the skill text loaded in this session. Ask the user to run `/update-5mghost-wonder`, then **start a fresh AI session** (`/exit` and re-enter, or open a new chat) — skill text already loaded into a running session does not refresh after `wonder update`, even though the file on disk has been replaced.
|
|
13
13
|
|
|
14
14
|
After a successful first install, also remind the user to start a fresh AI session before invoking `/use-5mghost-wonder` for the first time. The skill files were just written to disk; the current session never loaded them.
|
|
15
15
|
|
|
@@ -1,302 +1,70 @@
|
|
|
1
1
|
---
|
|
2
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,
|
|
3
|
+
description: Use this skill when the user shares a URL containing "doc.weixin.qq.com", mentions 企微文档, 企业微信文档, 在线表格, 腾讯文档, wecom doc, wechat doc, wecom document, asks to read or edit a WeCom document, or asks about Wonder. Activate automatically on any doc.weixin.qq.com link.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# use-5mghost-wonder
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
wonder
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
### Step 1 — Get metadata
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
wonder read <url>
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Output is a JSON with tab list and row/column counts:
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
{
|
|
82
|
-
"type": "sheet",
|
|
83
|
-
"title": "文档标题",
|
|
84
|
-
"tabs": [
|
|
85
|
-
{ "name": "Sheet1", "rows": 50, "cols": 12 },
|
|
86
|
-
{ "name": "汇总", "rows": 20, "cols": 8 }
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Decide which tab(s) to read based on the user's question and the metadata.
|
|
92
|
-
|
|
93
|
-
### Step 2 — Read specific tab
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
wonder read <url> --tab <tab-name>
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
Output is a structured JSON:
|
|
100
|
-
|
|
101
|
-
```json
|
|
102
|
-
{
|
|
103
|
-
"tab": "Sheet1",
|
|
104
|
-
"maxRow": 50,
|
|
105
|
-
"maxCol": 12,
|
|
106
|
-
"cells": [
|
|
107
|
-
{ "row": 1, "col": 1, "text": "标题" },
|
|
108
|
-
{ "row": 3, "col": 4, "image": { "path": "/path/to/xl/media/image1.png", "width": 200, "height": 150 } }
|
|
109
|
-
],
|
|
110
|
-
"merges": [
|
|
111
|
-
{ "startRow": 1, "startCol": 1, "endRow": 1, "endCol": 3 }
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Consume this JSON directly to answer the user's question.
|
|
117
|
-
|
|
118
|
-
### ⚠️ Merged cells — always check `mergeSpan`
|
|
119
|
-
|
|
120
|
-
A cell may carry `mergeSpan: {rows, cols}` when it is the top-left anchor of a merged range. The cell's content is shared across `rows × cols` grid positions starting at `(row, col)`. **When the user asks about a cell's content, always factor `mergeSpan` into the answer.**
|
|
121
|
-
|
|
122
|
-
Concrete example: in a half-hour-grid time table, a `mergeSpan: {rows: 4, cols: 1}` anchored at `(row=39, col=40)` saying "★直播 + Poach" means the activity actually occupies **4 half-hour slots = 2 hours**, not 30 minutes. Quoting only the anchor row's time would mislead the user.
|
|
123
|
-
|
|
124
|
-
The complete merge list is also available in the top-level `merges[]` array if you need to reason about every merge in the sheet.
|
|
125
|
-
|
|
126
|
-
### ⚠️ Date / time cells — read `text`, not `value`
|
|
127
|
-
|
|
128
|
-
Number cells with date or time formats (e.g. `m"月"d"日"`, `h:mm`) are rendered into a readable `text` string (`"2026-04-30"`, `"12:00"`) alongside the raw `value` and `format`. **Always use `text` when reporting dates and times to the user.** The raw `value` is an Excel serial number (days since 1899-12-30) and is meaningless to humans.
|
|
129
|
-
|
|
130
|
-
### ⚠️ Row/column indexing — JSON is 0-based, Excel is 1-based
|
|
131
|
-
|
|
132
|
-
In wonder's JSON output, `row` and `col` (and `startRow`/`endRow`/`startCol`/`endCol` in `merges`) are **0-based**. Excel addresses the user sees in the WeCom UI are **1-based**.
|
|
133
|
-
|
|
134
|
-
| JSON value | Excel address |
|
|
135
|
-
|---|---|
|
|
136
|
-
| `row: 0, col: 0` | A1 |
|
|
137
|
-
| `row: 9, col: 2` | C10 |
|
|
138
|
-
| `startRow: 1, startCol: 2, endRow: 9, endCol: 2` | C2:C10 (merged cell) |
|
|
139
|
-
|
|
140
|
-
**When talking to the user, always convert to 1-based Excel addresses.** The user thinks in Excel rows ("第 10 行"), not JSON indices. Internal calculations can stay 0-based; only what the user reads needs translation. Do not say "行 9" when you mean Excel row 10.
|
|
141
|
-
|
|
142
|
-
### Viewing embedded images
|
|
143
|
-
|
|
144
|
-
Image cells have a `path` field pointing to the local extracted file. Use the Read tool to view:
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
Read("/Users/<you>/Downloads/5mghost-wonder/media/image3.png")
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
**Note:** Images are full-resolution originals (up to several MB each). Only load images the user specifically asks about.
|
|
151
|
-
|
|
152
|
-
### Viewing visual layout — required when colour or layout carries meaning
|
|
153
|
-
|
|
154
|
-
The JSON does not carry cell colours, font colours, or rendered borders. When colour or position is part of the answer, you cannot recover it from JSON — you must read the rendered sheet.
|
|
155
|
-
|
|
156
|
-
Render to PDF and Read it whenever any of these are true:
|
|
157
|
-
|
|
158
|
-
- The user asks about "how it looks", "颜色", "排版", "这个图表", "这张表的结构", or refers to a visible highlight
|
|
159
|
-
- The sheet is a gantt chart, calendar, status board, or roadmap (colour = stage / owner / priority / "this week")
|
|
160
|
-
- A column or row in the user's question is highlighted (yellow / red / green) in the WeCom UI
|
|
161
|
-
- The merge-to-cell ratio in the JSON is non-trivial (e.g. `merges.length / cells.length > 0.1`) — likely a layout-driven sheet
|
|
162
|
-
|
|
163
|
-
You cannot detect colour from JSON alone, so when in doubt about a sheet that mixes data with visual cues, render. The cost is ~30 s and ~10 MB; the cost of guessing wrong is worse.
|
|
164
|
-
|
|
165
|
-
Render command (one PDF page per tab, preserves layout, merges, fills, borders):
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
soffice --headless \
|
|
169
|
-
--convert-to 'pdf:calc_pdf_Export:{"SinglePageSheets":{"type":"boolean","value":"true"}}' \
|
|
170
|
-
--outdir /tmp/ <path-to-downloaded-xlsx>
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Then use the Read tool on the generated PDF. Page N corresponds to the Nth tab in workbook order (same as `tabs[]` in the metadata output).
|
|
174
|
-
|
|
175
|
-
Skip rendering only when the user clearly wants a single cell value or a numeric lookup from a plain data table.
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## docx Workflow (`doc/w3_`, `doc/e2_`)
|
|
180
|
-
|
|
181
|
-
### Step 1 — Download
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
wonder read <url>
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
Output:
|
|
188
|
-
|
|
189
|
-
```json
|
|
190
|
-
{ "type": "doc", "path": "/Users/<you>/Downloads/5mghost-wonder/filename.docx" }
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### Step 2 — Read content
|
|
194
|
-
|
|
195
|
-
**Read text** (recommended first step):
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
pandoc <path> -o /tmp/wonder-doc-output.md && cat /tmp/wonder-doc-output.md
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
**View full-page layout with images** (when layout matters):
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
soffice --headless --convert-to pdf --outdir /tmp/ <path>
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
Then use the Read tool on the generated PDF.
|
|
208
|
-
|
|
209
|
-
**Access embedded images** (when individual images are needed):
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
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/
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
Then use Read tool on files in `/tmp/wonder-doc-unpack/word/media/`.
|
|
216
|
-
|
|
217
|
-
---
|
|
218
|
-
|
|
219
|
-
## pptx Workflow (`slide/p3_`)
|
|
220
|
-
|
|
221
|
-
### Step 1 — Download
|
|
222
|
-
|
|
223
|
-
```bash
|
|
224
|
-
wonder read <url>
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
Output:
|
|
228
|
-
|
|
229
|
-
```json
|
|
230
|
-
{ "type": "slide", "path": "/Users/<you>/Downloads/5mghost-wonder/filename.pptx" }
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### Step 2 — Always extract both text and visual layout
|
|
234
|
-
|
|
235
|
-
For pptx, run **both** extractions every time. Most WeCom slides are layout-driven (timelines, image collages, status boards, recap pages) — pure text loses critical meaning, and pure-PDF visual reading can mis-OCR text that pandoc captures cleanly. You cannot tell a "complex" slide from a "simple" slide without first looking at it, so don't try to decide; just run both and use whichever the question calls for.
|
|
236
|
-
|
|
237
|
-
**1. Text** (for exact wording, fast keyword scanning, copy-quoting):
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
pandoc <path> -o /tmp/wonder-slide-output.md && cat /tmp/wonder-slide-output.md
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
**2. Visual layout** (for image-text relationships, timelines, colour, embedded screenshots whose text pandoc cannot reach — e.g. Korean / Japanese chat captures):
|
|
244
|
-
|
|
245
|
-
```bash
|
|
246
|
-
soffice --headless --convert-to pdf --outdir /tmp/ <path>
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
Then use the Read tool on the generated PDF.
|
|
250
|
-
|
|
251
|
-
When answering, combine: lean on the PDF for "what's on the slide and how it's organised", lean on the markdown for exact-wording quotes. Don't answer from text-only when a slide visibly relies on layout — the user will spot the gap immediately.
|
|
252
|
-
|
|
253
|
-
If `soffice` is not installed (`wonder check` reports it as optional/missing), fall back to pandoc-only and tell the user upfront that visual cues, embedded screenshot text, and image-text relationships will be missing from your answer.
|
|
254
|
-
|
|
255
|
-
### Optional: access embedded images directly
|
|
256
|
-
|
|
257
|
-
```bash
|
|
258
|
-
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/
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
Then use Read tool on files in `/tmp/wonder-pptx-unpack/ppt/media/`.
|
|
262
|
-
|
|
263
|
-
---
|
|
264
|
-
|
|
265
|
-
## Unsupported types
|
|
266
|
-
|
|
267
|
-
**smartpage (`smartpage/a1_`):**
|
|
268
|
-
|
|
269
|
-
> 当前版本不支持智能文档(smartpage)。建议在浏览器中手动打开文档,选择"导出为 PDF"或"复制内容"。
|
|
270
|
-
|
|
271
|
-
**mind (`mind/m4_`):**
|
|
272
|
-
|
|
273
|
-
> 当前版本不支持思维导图(mind)。
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## Known issues
|
|
278
|
-
|
|
279
|
-
| Issue | Detail | Workaround |
|
|
280
|
-
|-------|--------|-----------|
|
|
281
|
-
| pptx slice crash | `prs.slides[:N]` → `AttributeError: 'list' object has no attribute 'rId'` | Use `for slide in prs.slides` |
|
|
282
|
-
| Cookie expiry | Cookie valid for 7–30 days | Run `wonder wecom cookie` to refresh |
|
|
283
|
-
| xlsx images are full-size | Original images can be up to 6 MB each | Only read images when user specifically needs them |
|
|
284
|
-
| xlsx colour / visual layout | JSON has no fill colour, font colour, or rendered borders | Render to PDF (xlsx section) when colour or layout carries meaning |
|
|
285
|
-
| pptx layout-driven slides | Pure pandoc loses image-text relationships, timelines, embedded screenshot text (e.g. Korean chats) | pptx workflow now runs pandoc + soffice→pdf together by default |
|
|
286
|
-
| smartpage unsupported | Export API returns 0% progress forever | Manual browser export |
|
|
287
|
-
|
|
288
|
-
---
|
|
289
|
-
|
|
290
|
-
## CLI command reference
|
|
291
|
-
|
|
292
|
-
```
|
|
293
|
-
wonder read <url> # Auto-detect type; xlsx → metadata; doc/slide → download
|
|
294
|
-
wonder read <url> --tab <name> # xlsx: get full data for specified tab
|
|
295
|
-
wonder read <url> --save <dir> # Set output directory (default: ~/Downloads/5mghost-wonder/)
|
|
296
|
-
|
|
297
|
-
wonder wecom status # Check cookie validity
|
|
298
|
-
wonder wecom cookie # Refresh cookie via browser QR scan
|
|
299
|
-
wonder update # Update to latest version
|
|
300
|
-
wonder check # Health check for all dependencies
|
|
301
|
-
wonder auth status # Check mkterswingman auth status
|
|
302
|
-
```
|
|
6
|
+
# use-5mghost-wonder
|
|
7
|
+
|
|
8
|
+
This is the Wonder router skill. Keep this file as the entrypoint and load only
|
|
9
|
+
the referenced workflow files needed for the current task.
|
|
10
|
+
|
|
11
|
+
## Version Gate
|
|
12
|
+
|
|
13
|
+
This skill matches **wonder 0.0.14**.
|
|
14
|
+
|
|
15
|
+
On first use in a session, follow `references/session-init.md`. If the installed
|
|
16
|
+
CLI version differs from `0.0.14`, stop and ask the user to run
|
|
17
|
+
`/update-5mghost-wonder`, then start a fresh AI session.
|
|
18
|
+
|
|
19
|
+
## Hard Rules
|
|
20
|
+
|
|
21
|
+
- Do not ask the user to export cookies, install Cookie-Editor, paste raw
|
|
22
|
+
cookies, or run Wonder commands themselves unless they explicitly ask for a
|
|
23
|
+
manual/dev/CI path.
|
|
24
|
+
- If cookies are missing, expired, invalid, or a WeCom request returns 401/403,
|
|
25
|
+
follow `references/cookie-recovery.md`.
|
|
26
|
+
- Treat `wonder read` export output as one read path, not the only possible read
|
|
27
|
+
path. If export fails because the document is read-only, export-disabled, or
|
|
28
|
+
unsupported, route to `references/read-no-export-browser.md`.
|
|
29
|
+
- Do not claim rich editing succeeded because a toolbar button was clicked.
|
|
30
|
+
Editing success requires the verification rules in `references/verification.md`.
|
|
31
|
+
- For sheet answers, convert 0-based JSON coordinates to 1-based spreadsheet
|
|
32
|
+
addresses before talking to the user.
|
|
33
|
+
- Preserve images and layout when the user asks visual, table, screenshot,
|
|
34
|
+
merge-cell, or embedded-image questions. Do not answer those from text-only
|
|
35
|
+
extraction.
|
|
36
|
+
|
|
37
|
+
## Route
|
|
38
|
+
|
|
39
|
+
Identify the user's actual job, then load the smallest workflow reference:
|
|
40
|
+
|
|
41
|
+
| User job | Primary reference |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| First Wonder use this session | `references/session-init.md` |
|
|
44
|
+
| Cookie/auth recovery | `references/cookie-recovery.md` |
|
|
45
|
+
| Read exportable doc/sheet/slide | `references/read-export.md` |
|
|
46
|
+
| Read read-only, export-disabled, unsupported, or visual-heavy docs without export | `references/read-no-export-browser.md` |
|
|
47
|
+
| Edit a WeCom doc through the browser editor | `references/edit-browser-runtime.md` |
|
|
48
|
+
| Verify read/write results | `references/verification.md` |
|
|
49
|
+
| Explain/triage failures | `references/failure-recovery.md` |
|
|
50
|
+
| Check command syntax | `references/cli-reference.md` |
|
|
51
|
+
|
|
52
|
+
Use `references/route-map.md` when the task is ambiguous or mixes several
|
|
53
|
+
jobs. For mixed tasks, run the references in this order: session init, cookie
|
|
54
|
+
recovery if needed, read, edit, verify.
|
|
55
|
+
|
|
56
|
+
## Current Capability Boundary
|
|
57
|
+
|
|
58
|
+
Stable:
|
|
59
|
+
- Export-backed reads for supported docs, sheets, and slides.
|
|
60
|
+
- Sheet JSON with cells, merge ranges, and exported embedded images.
|
|
61
|
+
- Cookie refresh through `wonder wecom cookie`.
|
|
62
|
+
|
|
63
|
+
Experimental:
|
|
64
|
+
- Browser editor runtime for controlled write tasks.
|
|
65
|
+
- No-export browser reading for read-only/export-disabled documents.
|
|
66
|
+
|
|
67
|
+
Not promised yet:
|
|
68
|
+
- Lossless no-export extraction for every WeCom document shape.
|
|
69
|
+
- Every toolbar command, callout, highlighter, nested menus, or complex block
|
|
70
|
+
semantics.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# CLI Reference
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
wonder read <url> # Auto-detect type; sheet -> metadata, doc/slide -> file path
|
|
5
|
+
wonder read <url> --tab <name> # Sheet tab data: cells, merges, images
|
|
6
|
+
wonder read <url> --save <dir> # Output directory
|
|
7
|
+
wonder read <url> --no-cache # Force fresh export
|
|
8
|
+
|
|
9
|
+
wonder browser probe <url> # Experimental no-export browser evidence probe
|
|
10
|
+
wonder browser probe <url> --headed
|
|
11
|
+
wonder browser probe <url> --save <dir>
|
|
12
|
+
|
|
13
|
+
wonder wecom status # Check WeCom cookie validity
|
|
14
|
+
wonder wecom cookie # Open browser login and refresh cookies
|
|
15
|
+
wonder wecom set-cookie # Manual/dev/CI only
|
|
16
|
+
|
|
17
|
+
wonder check # Health check
|
|
18
|
+
wonder setup # Guided setup
|
|
19
|
+
wonder update # Update package and bundled skills
|
|
20
|
+
wonder auth status # mkterswingman auth status
|
|
21
|
+
wonder auth login # Browser OAuth login
|
|
22
|
+
wonder version # Print version
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Browser editor runtime remains experimental. No-export read now has an
|
|
26
|
+
experimental evidence probe command, but it is not a lossless reader yet.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Cookie Recovery
|
|
2
|
+
|
|
3
|
+
When WeCom cookies are missing, expired, invalid, or rejected with 401/403:
|
|
4
|
+
|
|
5
|
+
1. Ask the user whether now is a convenient time to open the browser for WeCom
|
|
6
|
+
login.
|
|
7
|
+
2. If they confirm, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
wonder wecom cookie
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
3. Wait for the user to complete browser login or QR scan.
|
|
14
|
+
4. Verify:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
wonder wecom status
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
5. Retry the original task only after status is valid.
|
|
21
|
+
|
|
22
|
+
Never ask the user to install Cookie-Editor, export JSON, paste a cookie
|
|
23
|
+
string, run `wonder wecom cookie` themselves, or use `wonder wecom set-cookie`
|
|
24
|
+
unless they explicitly request a manual/dev/CI cookie path.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Browser Editor Runtime
|
|
2
|
+
|
|
3
|
+
Use this experimental path when the user asks Wonder to edit a WeCom document.
|
|
4
|
+
|
|
5
|
+
## Meaning of Runtime
|
|
6
|
+
|
|
7
|
+
The runtime is a controlled browser execution layer. It is not freeform "AI
|
|
8
|
+
clicking around." It should expose limited, auditable actions:
|
|
9
|
+
|
|
10
|
+
- open document
|
|
11
|
+
- confirm login
|
|
12
|
+
- focus editor
|
|
13
|
+
- inspect available toolbar controls
|
|
14
|
+
- insert text
|
|
15
|
+
- apply a known formatting operation
|
|
16
|
+
- read back or export for verification
|
|
17
|
+
- capture screenshots/logs when verification fails
|
|
18
|
+
|
|
19
|
+
## Safety Gate
|
|
20
|
+
|
|
21
|
+
Before editing:
|
|
22
|
+
|
|
23
|
+
1. Confirm the user intends to modify this exact document.
|
|
24
|
+
2. Prefer a test document for experimental toolbar operations.
|
|
25
|
+
3. Never edit other documents while probing.
|
|
26
|
+
4. If cookies are invalid, follow `cookie-recovery.md`.
|
|
27
|
+
|
|
28
|
+
## Supported v0 Operations
|
|
29
|
+
|
|
30
|
+
These operations have evidence from prior browser/DOCX verification and may be
|
|
31
|
+
attempted on an explicitly authorized document:
|
|
32
|
+
|
|
33
|
+
- insert plain text
|
|
34
|
+
- bold
|
|
35
|
+
- italic
|
|
36
|
+
- underline
|
|
37
|
+
- strikethrough
|
|
38
|
+
- bullet list
|
|
39
|
+
- quote block
|
|
40
|
+
|
|
41
|
+
These are not promised yet:
|
|
42
|
+
|
|
43
|
+
- numbered list
|
|
44
|
+
- highlight block
|
|
45
|
+
- callout
|
|
46
|
+
- nested toolbar menus
|
|
47
|
+
- complex paragraph styles
|
|
48
|
+
- arbitrary smart-page blocks
|
|
49
|
+
|
|
50
|
+
## Procedure
|
|
51
|
+
|
|
52
|
+
1. Read the document enough to understand the target location.
|
|
53
|
+
2. Open the document in the Wonder browser profile or available browser
|
|
54
|
+
automation runtime.
|
|
55
|
+
3. Locate the editor surface.
|
|
56
|
+
4. Apply only supported operations unless the user explicitly asked to probe a
|
|
57
|
+
test document.
|
|
58
|
+
5. Insert a unique marker when probing.
|
|
59
|
+
6. Verify with `verification.md`.
|
|
60
|
+
|
|
61
|
+
If verification fails, do not keep retrying blindly. Capture the failed
|
|
62
|
+
operation, screenshot or runtime evidence, and return `partial` or `failed`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Failure Recovery
|
|
2
|
+
|
|
3
|
+
Return actionable states. Do not show raw stack traces as the main answer.
|
|
4
|
+
|
|
5
|
+
| Failure | Action |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `not_authenticated` | Ask user to allow `wonder auth login`; then verify `wonder auth status`. |
|
|
8
|
+
| `cookie_invalid`, 401, 403 | Follow `cookie-recovery.md`. |
|
|
9
|
+
| `unsupported_type` | Try `read-no-export-browser.md` if the page can load in browser. |
|
|
10
|
+
| `export_failed` | If it looks permission/export related, route to no-export browser read. Otherwise report the export error and retry only once if transient. |
|
|
11
|
+
| Browser cannot launch | Run `wonder check`; report missing browser/dependency state. |
|
|
12
|
+
| Toolbar operation not found | Report `not_supported` for that operation and do not claim the edit worked. |
|
|
13
|
+
| Verification mismatch | Report `partial` or `failed`, include what changed and what did not verify. |
|
|
14
|
+
|
|
15
|
+
If a task partially succeeds, answer with the usable result and a short missing
|
|
16
|
+
capability list.
|