@mkterswingman/5mghost-wonder 0.0.18 → 0.0.19

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.
@@ -161,6 +161,9 @@ export async function runBrowserNoExportRead(options) {
161
161
  evidence.push("initial-attributed-text");
162
162
  if ((extracted?.tables.length ?? 0) > 0)
163
163
  evidence.push("table-control-characters");
164
+ if ((extracted?.tables ?? []).some((table) => table.rows.some((row) => row.some((cell) => (cell.colSpan ?? 1) > 1)))) {
165
+ evidence.push("horizontal-colspan-inference");
166
+ }
164
167
  if (extracted?.structureHints)
165
168
  evidence.push("structure-hints");
166
169
  const images = options.saveDir && extracted?.imageUrls
@@ -192,7 +195,7 @@ export async function runBrowserNoExportRead(options) {
192
195
  "No readable opendoc initialAttributedText was captured.",
193
196
  ],
194
197
  missing: [
195
- "table merge ranges",
198
+ "vertical table merge ranges",
196
199
  ...(images.some((image) => image.status === "downloaded") ? [] : ["image original resources"]),
197
200
  "image anchors",
198
201
  "floating vs fixed image classification",
@@ -333,6 +336,9 @@ export function extractTextFromOpendoc(body) {
333
336
  structureHints,
334
337
  warnings: [
335
338
  "No-export text is decoded from opendoc initialAttributedText; rich styles are not reconstructed yet.",
339
+ ...(tables.some((table) => table.rows.some((row) => row.some((cell) => (cell.colSpan ?? 1) > 1)))
340
+ ? ["Horizontal table colSpan is inferred from row cell counts; vertical rowSpan is not reconstructed yet."]
341
+ : []),
336
342
  ...(imageUrls.length > 0
337
343
  ? ["Image resource URLs were detected, but image anchors and fixed/floating placement are not reconstructed yet."]
338
344
  : []),
@@ -352,11 +358,22 @@ function extractTablesFromDecodedText(decodedText) {
352
358
  .filter((text) => text.length > 0)
353
359
  .map((text) => ({ text })))
354
360
  .filter((row) => row.length > 0);
361
+ inferHorizontalColSpans(rows);
355
362
  if (rows.length > 0)
356
363
  tables.push({ rows });
357
364
  }
358
365
  return tables;
359
366
  }
367
+ function inferHorizontalColSpans(rows) {
368
+ const maxColumnCount = Math.max(0, ...rows.map((row) => row.length));
369
+ if (maxColumnCount <= 1)
370
+ return;
371
+ for (const row of rows) {
372
+ if (row.length !== 1)
373
+ continue;
374
+ row[0].colSpan = maxColumnCount;
375
+ }
376
+ }
360
377
  function normalizeTableCellText(value) {
361
378
  return value
362
379
  .replace(/\r/g, "")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkterswingman/5mghost-wonder",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "企微文档读取 CLI — WeCom document reader",
5
5
  "type": "module",
6
6
  "engines": {
@@ -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.18**.
10
+ This skill matches **wonder 0.0.19**.
11
11
 
12
- Once the CLI is installed in Step 1, run `wonder --version`. If the output does not equal `0.0.18`, 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.
12
+ Once the CLI is installed in Step 1, run `wonder --version`. If the output does not equal `0.0.19`, 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
 
@@ -7,7 +7,7 @@ description: Use this skill when the user wants to update or upgrade wonder, say
7
7
 
8
8
  ## Skill version
9
9
 
10
- This skill matches **wonder 0.0.18**.
10
+ This skill matches **wonder 0.0.19**.
11
11
 
12
12
  ---
13
13
 
@@ -10,10 +10,10 @@ the referenced workflow files needed for the current task.
10
10
 
11
11
  ## Version Gate
12
12
 
13
- This skill matches **wonder 0.0.18**.
13
+ This skill matches **wonder 0.0.19**.
14
14
 
15
15
  On first use in a session, follow `references/session-init.md`. If the installed
16
- CLI version differs from `0.0.18`, stop and ask the user to run
16
+ CLI version differs from `0.0.19`, stop and ask the user to run
17
17
  `/update-5mghost-wonder`, then start a fresh AI session.
18
18
 
19
19
  ## Hard Rules
@@ -38,10 +38,11 @@ wonder browser read <url> --save /tmp/wonder-browser-read
38
38
 
39
39
  This currently attempts text extraction from the browser `opendoc`
40
40
  `initialAttributedText`, decodes simple table cells from WeCom table control
41
- characters, downloads detected image resources when `--save` is present, and
42
- returns safe `structureHints` for `htmlData`, `initialAttributedText`, and the
43
- full `opendoc` body. Treat it as `partial` unless it also proves merge ranges
44
- and image anchors.
41
+ characters, infers horizontal `colSpan` when a single-cell row spans the
42
+ table's max row width, downloads detected image resources when `--save` is
43
+ present, and returns safe `structureHints` for `htmlData`,
44
+ `initialAttributedText`, and the full `opendoc` body. Treat it as `partial`
45
+ unless it also proves vertical merge ranges and image anchors.
45
46
 
46
47
  3. If the read is insufficient, run the evidence probe:
47
48
 
@@ -63,11 +64,12 @@ Use `--headed` only when login/debug visibility is needed.
63
64
  - screenshots only as a fallback or visual cross-check
64
65
  6. For tables, specifically look for:
65
66
  - `tables[].rows[].text` for simple table cell content
67
+ - `tables[].rows[].colSpan` for inferred horizontal merged cells
66
68
  - `structureHints.*.hasTableSignals` and `hasMergeSignals`
67
69
  - `structureHints.htmlData.hasTableMarkup`
68
70
  - cell coordinates
69
71
  - displayed text
70
- - merge ranges
72
+ - vertical merge ranges / `rowSpan`
71
73
  - row/column sizes if available
72
74
  - fixed cell images
73
75
  - floating images with position, size, and anchor
@@ -91,7 +93,8 @@ Return a concise result:
91
93
  "tables": [
92
94
  {
93
95
  "rows": [
94
- [{ "text": "A1" }, { "text": "B1" }]
96
+ [{ "text": "A1B1", "colSpan": 2 }],
97
+ [{ "text": "A2" }, { "text": "B2" }]
95
98
  ]
96
99
  }
97
100
  ],
@@ -41,7 +41,8 @@ The goal is lossless structured data. Verify each field independently:
41
41
 
42
42
  - text
43
43
  - table cell coordinates
44
- - merge ranges
44
+ - horizontal `colSpan`
45
+ - vertical merge ranges / `rowSpan`
45
46
  - image original resources or URLs
46
47
  - image anchors, positions, and sizes
47
48
  - floating vs fixed cell images