Skip to content

feat(table-scan-to-excel): add table scan to Excel UI plugin - #224

Open
ppppp2005-p wants to merge 16 commits into
zai-org:mainfrom
ppppp2005-p:feat/table-scan-to-excel
Open

ppppp2005-p wants to merge 16 commits into
zai-org:mainfrom
ppppp2005-p:feat/table-scan-to-excel

Conversation

@ppppp2005-p

Copy link
Copy Markdown

Plugin type (required) / 插件类型(必填)

  • UI Plugin / 是 UI 插件 — provides MCP Apps interactive pages / 提供 MCP Apps 交互页面
  • Standard plugin / 普通插件(非 UI)
  • Not applicable / 不适用

Affected plugin name(s) / 涉及的插件名称:table-scan-to-excel (UI Plugin, new)

What / 改动内容

New community UI plugin Table Scan to Excel / 扫描表格转 Excel: photo or scan of a table → checked, user-confirmed .xlsx / .csv. The ZCode agent's own vision model reads the image; the plugin adds what a model alone can't guarantee — arithmetic checks, a side-by-side review and a faithful Excel export.

  • table_scan_open(image): returns the image (≤ 2000 px JPEG) as tool-result image content plus transcription rules (copy verbatim, never calculate, merges, uncertain cells, bounds); opens the panel; reloads an earlier transcription instead of re-reading.
  • table_submit(image, tables): pads ragged rows, checks subtotals against their section and totals against all detail rows (subtotals skipped), finds text in numeric columns, lists uncertain cells; saves tables/<image>.tablescan.json; keeps the user's confirmations on re-submission when the cell text is unchanged.
  • table_export(image, format, output?): .xlsx (one sheet per table, bold frozen header rows, merged cells, real numbers with the printed thousands/decimal/percent/bracket format, flagged cells coloured + cell comment) and/or UTF-8-BOM .csv.
  • Panel (ui://table-scan-to-excel/panel.html): image (zoom, approximate cell outline from bounds) next to an editable grid with merges; yellow = uncertain / not a number, red = total mismatch; issue list, "Looks right", "Ask the agent" (sends a message on click), save, export. App-only tools: table_save, image_view, workspace_files.

Network / API / side effects: local stdio MCP server only; no network, no API keys, no hooks, no command execution. Reads only the chosen image; writes only inside the workspace (tables/ or the given export path). The image goes to the user's ZCode model as a tool result, same as attaching it.

Third-party: ExcelJS (MIT; optional unzipper stubbed), pngjs (MIT), jpeg-js (BSD-3-Clause), MCP SDK / ext-apps (MIT); notices in dist/THIRD_PARTY_NOTICES.txt. Test images: self-made purchase list (CC0) and a 1912 Census of India page from Wikimedia Commons (no known copyright restrictions).

Tests: vitest over MCP (number parsing incl. full-width/brackets/percent/currency, subtotal + grand total check with a deliberately wrong printed total, ragged rows, text in numeric columns, confirmations, input validation, xlsx values/formats/merges/fills/comments, CSV); Chrome e2e with the official AppBridge host: photographed purchase list → review → confirm → correct the wrong total → export (xlsx verified), plus a real 1912 census scan. validate.py, build_dist.py, git diff --check, oxlint, tsc pass.

A ZCode Desktop demo recording is attached in the comments. / ZCode 桌面版演示录屏见评论。

Self-check / 自查清单

  • Plugin name is unique kebab-case; new external plugin directory is external_plugins/<name>/
  • Usage category is set (productivity)
  • Plugin type and affected names are declared above
  • version 0.1.0 in both plugin.json and marketplace.json
  • README.md (EN) and README_CN.md (中文) both provided and equivalent
  • description_i18n has both en and zh-CN
  • No secrets, machine-specific paths, or private dependencies
  • Model/API/network dependencies documented
  • python3 scripts/validate.py and python3 scripts/build_dist.py pass locally
  • Exercised in ZCode Desktop (ZCode 4.0.0, macOS arm64: installed from a local marketplace, table_scan_open → side panel → agent transcription via table_submit (11 rows × 6 cols, 6 merges) → check flagged a total that differs by 10 from the printed sum (kept as printed) → table_export to tables/purchase-photo.xlsx; demo video in the comments)

@ppppp2005-p

Copy link
Copy Markdown
Author

ZCode desktop demo (ZCode 4.0.0, macOS arm64)

table-scan-to-excel-demo.mp4

Flow shown:

  1. Installed table-scan-to-excel from a local marketplace built from this PR's branch.
  2. Asked ZCode to convert tables/purchase-photo.jpg (a photographed purchase list) to Excel. The agent called table_scan_open, which opened the side panel with the image, then transcribed the table and sent it with table_submit (11 rows × 6 columns, 6 merged cells).
  3. The check flagged one problem: the printed total differs by 10 from the sum of the rows above. The agent zoomed in, confirmed it is what the paper says, and kept it as printed (the skill tells it not to “fix” totals).
  4. table_export wrote tables/purchase-photo.xlsx. The last card shows the source photo and the panel.

演示流程:本地 marketplace 安装 → table_scan_open 打开面板 → agent 转写并 table_submit(11 行 × 6 列,6 处合并)→ 核对发现合计与上方之和差 10,确认是原单据印刷数字,按原样保留 → table_export 导出 xlsx。

@panda920

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

@panda920

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

@panda920

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants