@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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Export-Backed Read
|
|
2
|
+
|
|
3
|
+
Use this path for supported, exportable WeCom docs, sheets, and slides.
|
|
4
|
+
|
|
5
|
+
## URL Types
|
|
6
|
+
|
|
7
|
+
| URL prefix | Type | First command |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `sheet/e3_` | Spreadsheet | `wonder read <url>` |
|
|
10
|
+
| `doc/w3_` | Document | `wonder read <url>` |
|
|
11
|
+
| `doc/e2_` | Document | `wonder read <url>` |
|
|
12
|
+
| `slide/p3_` | Presentation | `wonder read <url>` |
|
|
13
|
+
| `smartpage/a1_` | Smart page | Try no-export browser path |
|
|
14
|
+
| `mind/m4_` | Mind map | Try no-export browser path |
|
|
15
|
+
|
|
16
|
+
If export fails because the document cannot be exported, is read-only, or the
|
|
17
|
+
export job does not complete, switch to `read-no-export-browser.md`.
|
|
18
|
+
|
|
19
|
+
## Spreadsheet
|
|
20
|
+
|
|
21
|
+
First get workbook metadata:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
wonder read <url>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then read the relevant tab:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
wonder read <url> --tab <tab-name>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Use the returned JSON directly. Important rules:
|
|
34
|
+
|
|
35
|
+
- `row`, `col`, and merge coordinates are 0-based internally. Convert to
|
|
36
|
+
1-based spreadsheet addresses for the user.
|
|
37
|
+
- Use `text` for date/time cells. Raw `value` may be an Excel serial number.
|
|
38
|
+
- A `mergeSpan` on a cell means that anchor cell covers the full merged range.
|
|
39
|
+
- Image cells point to local extracted image paths. Load only images the user
|
|
40
|
+
specifically needs.
|
|
41
|
+
|
|
42
|
+
Render visual layout when color, layout, merged-cell density, screenshots, or
|
|
43
|
+
image relationships matter:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
soffice --headless \
|
|
47
|
+
--convert-to 'pdf:calc_pdf_Export:{"SinglePageSheets":{"type":"boolean","value":"true"}}' \
|
|
48
|
+
--outdir /tmp/ <path-to-downloaded-xlsx>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Document
|
|
52
|
+
|
|
53
|
+
Download:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
wonder read <url>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Read text:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pandoc <path> -o /tmp/wonder-doc-output.md && cat /tmp/wonder-doc-output.md
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
When layout or images matter, render PDF:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
soffice --headless --convert-to pdf --outdir /tmp/ <path>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
To inspect embedded images:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
mkdir -p /tmp/wonder-doc-unpack
|
|
75
|
+
cp <path> /tmp/wonder-doc-unpack/doc.zip
|
|
76
|
+
unzip -o /tmp/wonder-doc-unpack/doc.zip -d /tmp/wonder-doc-unpack/
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Read images from `/tmp/wonder-doc-unpack/word/media/`.
|
|
80
|
+
|
|
81
|
+
## Presentation
|
|
82
|
+
|
|
83
|
+
Download:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
wonder read <url>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Always extract both text and visual layout:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pandoc <path> -o /tmp/wonder-slide-output.md && cat /tmp/wonder-slide-output.md
|
|
93
|
+
soffice --headless --convert-to pdf --outdir /tmp/ <path>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Use text extraction for exact wording and PDF rendering for visual structure,
|
|
97
|
+
timelines, screenshots, and image-text relationships.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# No-Export Browser Read
|
|
2
|
+
|
|
3
|
+
Use this experimental path when export-backed `wonder read` is unavailable or
|
|
4
|
+
insufficient:
|
|
5
|
+
|
|
6
|
+
- Read-only document.
|
|
7
|
+
- Export disabled.
|
|
8
|
+
- Export job fails or never completes.
|
|
9
|
+
- Smart page / mind map / unsupported type.
|
|
10
|
+
- User specifically needs browser-visible images, floating images, merged
|
|
11
|
+
tables, or layout that export misses.
|
|
12
|
+
|
|
13
|
+
## Goal
|
|
14
|
+
|
|
15
|
+
Read from the browser-loaded document without relying on WeCom's export API.
|
|
16
|
+
Prefer structured runtime or network data over screenshots.
|
|
17
|
+
|
|
18
|
+
## Evidence Ladder
|
|
19
|
+
|
|
20
|
+
Treat results by evidence strength:
|
|
21
|
+
|
|
22
|
+
| Result | Requirement |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| `pass` | Text, table cells, merge ranges, image resources or URLs, and image-to-cell/position relationships are captured without export. |
|
|
25
|
+
| `partial` | Some structured data is captured, but images, merges, anchors, or positions are missing. |
|
|
26
|
+
| `fail` | Only screenshots/OCR are available, or the page cannot be loaded. |
|
|
27
|
+
|
|
28
|
+
Do not describe screenshot/OCR output as lossless.
|
|
29
|
+
|
|
30
|
+
## Procedure
|
|
31
|
+
|
|
32
|
+
1. Confirm cookies are valid. If not, follow `cookie-recovery.md`.
|
|
33
|
+
2. Start with the built-in evidence probe:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
wonder browser probe <url> --save /tmp/wonder-browser-probe
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Use `--headed` only when login/debug visibility is needed.
|
|
40
|
+
|
|
41
|
+
3. If the probe is insufficient, continue with the available browser automation
|
|
42
|
+
runtime.
|
|
43
|
+
4. Capture non-destructive evidence:
|
|
44
|
+
- page URL and document type
|
|
45
|
+
- visible title
|
|
46
|
+
- loaded script/runtime globals that look like document stores
|
|
47
|
+
- network responses that contain cell text, merge ranges, image metadata, or
|
|
48
|
+
media URLs
|
|
49
|
+
- WebSocket messages if they expose structured document operations
|
|
50
|
+
- screenshots only as a fallback or visual cross-check
|
|
51
|
+
5. For tables, specifically look for:
|
|
52
|
+
- cell coordinates
|
|
53
|
+
- displayed text
|
|
54
|
+
- merge ranges
|
|
55
|
+
- row/column sizes if available
|
|
56
|
+
- fixed cell images
|
|
57
|
+
- floating images with position, size, and anchor
|
|
58
|
+
6. For image-heavy docs, verify whether each image can be fetched as an original
|
|
59
|
+
resource or only appears in a raster screenshot.
|
|
60
|
+
7. Report `pass`, `partial`, or `fail` with the missing fields.
|
|
61
|
+
|
|
62
|
+
## Output Contract
|
|
63
|
+
|
|
64
|
+
Return a concise result:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"mode": "browser-no-export",
|
|
69
|
+
"status": "pass|partial|fail",
|
|
70
|
+
"textAvailable": true,
|
|
71
|
+
"tablesAvailable": true,
|
|
72
|
+
"mergeRangesAvailable": true,
|
|
73
|
+
"imagesAvailable": true,
|
|
74
|
+
"imageAnchorsAvailable": true,
|
|
75
|
+
"evidence": ["runtime-store", "network-response", "websocket", "screenshot"],
|
|
76
|
+
"missing": []
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If the user asked for an answer, answer only from fields that are backed by
|
|
81
|
+
evidence. State any partial gaps plainly.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Route Map
|
|
2
|
+
|
|
3
|
+
Classify by the user's job, not only by URL shape.
|
|
4
|
+
|
|
5
|
+
| Signal | Route |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| User asks to read, summarize, translate, extract, inspect content | `read-export.md` first |
|
|
8
|
+
| `wonder read` fails due to export disabled, read-only, unsupported export, or stuck export | `read-no-export-browser.md` |
|
|
9
|
+
| User asks to edit, append, format, rewrite in place, or change toolbar styles | `edit-browser-runtime.md` |
|
|
10
|
+
| User asks about images, screenshots, layout, colors, embedded media, merged cells, or table structure | `read-export.md` plus `verification.md`; use `read-no-export-browser.md` if export is unavailable |
|
|
11
|
+
| Cookie/auth failure | `cookie-recovery.md` |
|
|
12
|
+
| Need exact command syntax | `cli-reference.md` |
|
|
13
|
+
|
|
14
|
+
Mixed task order:
|
|
15
|
+
|
|
16
|
+
1. Session init if not already done.
|
|
17
|
+
2. Cookie recovery if needed.
|
|
18
|
+
3. Read enough context.
|
|
19
|
+
4. Execute edit or extraction.
|
|
20
|
+
5. Verify with `verification.md`.
|
|
21
|
+
6. Report supported, partial, and not-verified parts separately.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Session Initialization
|
|
2
|
+
|
|
3
|
+
Run this once per AI session before processing a WeCom document.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
wonder update
|
|
7
|
+
wonder --version
|
|
8
|
+
wonder wecom status
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Compare `wonder --version` with the version in `SKILL.md`. If they differ, the
|
|
12
|
+
loaded skill text and CLI are out of sync. Stop and tell the user to run
|
|
13
|
+
`/update-5mghost-wonder`, then start a fresh AI session.
|
|
14
|
+
|
|
15
|
+
If `wonder wecom status` reports missing, expired, invalid, 401, or 403, follow
|
|
16
|
+
`cookie-recovery.md`.
|
|
17
|
+
|
|
18
|
+
Do not repeat these checks for every document in the same session unless a
|
|
19
|
+
Wonder command reports an auth/cookie failure.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Verification
|
|
2
|
+
|
|
3
|
+
Verification depends on the path.
|
|
4
|
+
|
|
5
|
+
## Export-Backed Reads
|
|
6
|
+
|
|
7
|
+
- For sheets, trust structured JSON for text, values, merges, and extracted
|
|
8
|
+
image files.
|
|
9
|
+
- Use PDF rendering when visual layout, colors, screenshots, or image
|
|
10
|
+
relationships matter.
|
|
11
|
+
- For docs/slides, combine text extraction with PDF rendering when layout
|
|
12
|
+
matters.
|
|
13
|
+
|
|
14
|
+
## Browser Writes
|
|
15
|
+
|
|
16
|
+
Clicking a toolbar button is not success.
|
|
17
|
+
|
|
18
|
+
When export is available:
|
|
19
|
+
|
|
20
|
+
1. Write a unique marker or make a targeted change.
|
|
21
|
+
2. Run `wonder read <url> --save <dir>`.
|
|
22
|
+
3. Inspect the exported DOCX/XLSX/PPTX internals or parsed output.
|
|
23
|
+
4. Confirm the marker/change carries the expected semantic property.
|
|
24
|
+
|
|
25
|
+
Examples:
|
|
26
|
+
|
|
27
|
+
- DOCX bold uses Word XML run properties such as `<w:b`.
|
|
28
|
+
- DOCX underline uses `<w:u`.
|
|
29
|
+
- Lists use paragraph numbering properties such as `<w:numPr`.
|
|
30
|
+
- Quote-like blocks may show paragraph borders or related paragraph properties.
|
|
31
|
+
|
|
32
|
+
When export is unavailable:
|
|
33
|
+
|
|
34
|
+
1. Use browser runtime/network evidence.
|
|
35
|
+
2. Prefer structured editor state over screenshot evidence.
|
|
36
|
+
3. If only screenshot/OCR proves the change, report `partial`, not `success`.
|
|
37
|
+
|
|
38
|
+
## No-Export Reads
|
|
39
|
+
|
|
40
|
+
The goal is lossless structured data. Verify each field independently:
|
|
41
|
+
|
|
42
|
+
- text
|
|
43
|
+
- table cell coordinates
|
|
44
|
+
- merge ranges
|
|
45
|
+
- image original resources or URLs
|
|
46
|
+
- image anchors, positions, and sizes
|
|
47
|
+
- floating vs fixed cell images
|
|
48
|
+
|
|
49
|
+
If any field is missing, report exactly which capability is missing.
|