@mkterswingman/5mghost-wonder 0.0.7 → 0.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkterswingman/5mghost-wonder",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "企微文档读取 CLI — WeCom document reader",
5
5
  "type": "module",
6
6
  "engines": {
@@ -130,19 +130,20 @@ Read("/Users/<you>/Downloads/5mghost-wonder/media/image3.png")
130
130
 
131
131
  **Note:** Images are full-resolution originals (up to several MB each). Only load images the user specifically asks about.
132
132
 
133
- ### Viewing visual layout (optional)
133
+ ### Viewing visual layout — required when colour or layout carries meaning
134
134
 
135
- Use when the cell JSON alone can't answer the question because the sheet's meaning comes from **visual structure** not from the cell values themselves. Typical signals:
135
+ 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 JSONyou must read the rendered sheet.
136
136
 
137
- - Gantt chart (date columns × task rows, coloured blocks across cell ranges)
138
- - Calendar (week grid with merged day cells or coloured categories)
139
- - Status board / roadmap (colour-coded cells indicating stage, owner, priority)
140
- - Large merge-to-cell ratio in the JSON (`merges.length` is a non-trivial fraction of `cells.length`)
141
- - User explicitly asks about "how it looks", "颜色", "排版", "这个图表", "这张表的结构"
137
+ Render to PDF and Read it whenever any of these are true:
142
138
 
143
- Do **not** run render for plain data tables, lookup sheets, or when the user just wants a value. The render costs ~30 s and ~10+ MB of PDF per file.
139
+ - The user asks about "how it looks", "颜色", "排版", "这个图表", "这张表的结构", or refers to a visible highlight
140
+ - The sheet is a gantt chart, calendar, status board, or roadmap (colour = stage / owner / priority / "this week")
141
+ - A column or row in the user's question is highlighted (yellow / red / green) in the WeCom UI
142
+ - The merge-to-cell ratio in the JSON is non-trivial (e.g. `merges.length / cells.length > 0.1`) — likely a layout-driven sheet
144
143
 
145
- Render the whole xlsx (one PDF page per tab, preserves layout, merges, fills, borders):
144
+ 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.
145
+
146
+ Render command (one PDF page per tab, preserves layout, merges, fills, borders):
146
147
 
147
148
  ```bash
148
149
  soffice --headless \
@@ -152,6 +153,8 @@ soffice --headless \
152
153
 
153
154
  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).
154
155
 
156
+ Skip rendering only when the user clearly wants a single cell value or a numeric lookup from a plain data table.
157
+
155
158
  ---
156
159
 
157
160
  ## docx Workflow (`doc/w3_`, `doc/e2_`)
@@ -208,15 +211,17 @@ Output:
208
211
  { "type": "slide", "path": "/Users/<you>/Downloads/5mghost-wonder/filename.pptx" }
209
212
  ```
210
213
 
211
- ### Step 2 — Read content
214
+ ### Step 2 — Always extract both text and visual layout
212
215
 
213
- **Read text** (recommended first step):
216
+ 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.
217
+
218
+ **1. Text** (for exact wording, fast keyword scanning, copy-quoting):
214
219
 
215
220
  ```bash
216
221
  pandoc <path> -o /tmp/wonder-slide-output.md && cat /tmp/wonder-slide-output.md
217
222
  ```
218
223
 
219
- **View slide layout**:
224
+ **2. Visual layout** (for image-text relationships, timelines, colour, embedded screenshots whose text pandoc cannot reach — e.g. Korean / Japanese chat captures):
220
225
 
221
226
  ```bash
222
227
  soffice --headless --convert-to pdf --outdir /tmp/ <path>
@@ -224,7 +229,11 @@ soffice --headless --convert-to pdf --outdir /tmp/ <path>
224
229
 
225
230
  Then use the Read tool on the generated PDF.
226
231
 
227
- **Access embedded images**:
232
+ 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.
233
+
234
+ 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.
235
+
236
+ ### Optional: access embedded images directly
228
237
 
229
238
  ```bash
230
239
  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/
@@ -253,7 +262,8 @@ Then use Read tool on files in `/tmp/wonder-pptx-unpack/ppt/media/`.
253
262
  | pptx slice crash | `prs.slides[:N]` → `AttributeError: 'list' object has no attribute 'rId'` | Use `for slide in prs.slides` |
254
263
  | Cookie expiry | Cookie valid for 7–30 days | Run `wonder wecom cookie` to refresh |
255
264
  | xlsx images are full-size | Original images can be up to 6 MB each | Only read images when user specifically needs them |
256
- | xlsx visual layout needs soffice | Gantt/calendar/coloured boards lose meaning in JSON alone | Run the optional soffice render step in the xlsx section; CLI does not auto-render |
265
+ | 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 |
266
+ | 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 |
257
267
  | smartpage unsupported | Export API returns 0% progress forever | Manual browser export |
258
268
 
259
269
  ---