Skip to content

feat(ui-plugins): add Statement Categorizer (bank-statement-categorizer) - #253

Open
ppppp2005-p wants to merge 11 commits into
zai-org:mainfrom
ppppp2005-p:feat/bank-statement-categorizer
Open

ppppp2005-p wants to merge 11 commits into
zai-org:mainfrom
ppppp2005-p:feat/bank-statement-categorizer

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) / 涉及的插件名称:bank-statement-categorizer (UI Plugin, new)

What / 改动内容

New community UI plugin Statement Categorizer / 账单自动分类: Categorise bank, card and payment-app statement exports (.csv/.xlsx, Chinese or English) with keyword rules you can edit, fix any transaction by hand, spot uncategorised and double-counted rows, and see totals by category and month. Export a categorised Excel file, CSV and an HTML report; keep your rules for next month. Runs locally; no bank login, no API keys.

  • Tools: statement_open, statement_edit, statement_status, statement_export (all share one side panel: file picker, settings, issue list, editable table, preview, export).
  • Inputs: one or more CSV/XLSX exports. Description lines above the table are skipped. Columns are recognised in Chinese and English: date/交易时间, payee/交易对方, description/摘要/商品说明, a signed amount, an amount plus a 收/支 (in/out) column, or separate debit and credit columns. GBK-encoded CSV files are decoded.
  • Rules: one line per rule, keyword|other keyword => category, case-insensitive; the first matching rule wins. A starter set covers common Chinese and English merchants (dining, groceries, transport, shopping, subscriptions, utilities, housing, income, savings).
  • Manual categories in the table override rules and are kept when rules change.
  • Checks: uncategorised transactions, unreadable dates or amounts, and the same date + amount + description appearing in two different files (possible double counting).
  • Summary: income and spending totals, a bar per category, and a month × category table in the panel and the report.
  • Scope (v0.1):
    • Reads exported files only — it does not connect to banks or payment apps.
    • One currency per project (no conversion). PDF statements: export CSV/XLSX from your bank first.
    • Rules are keyword matches, not machine learning; the agent can suggest new rules for uncategorised rows.
  • Local only; writes only bank-statement-categorizer/ in the workspace. Workspace paths are checked so symlinks cannot lead reads or writes outside the workspace (regression test included).
  • Tests: vitest unit + MCP tool tests on real sample files, and a browser e2e with the official AppBridge host (panel → open → edit → export).

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, opened a bank CSV and an Alipay CSV from p100/bank-statement-categorizer/ together and exported the categorised workbook and report; demo video in the comments)

@ppppp2005-p

Copy link
Copy Markdown
Author

ZCode desktop demo (ZCode 4.0.0, macOS arm64)

bank-statement-categorizer-demo.mp4

Flow shown:

  1. Installed bank-statement-categorizer from a local marketplace built from this PR's branch.
  2. Asked ZCode to open two statements together, a bank CSV (bank-2026-10.csv) and an Alipay export (支付宝-2026-11.csv), and export right away (only statement_open and statement_export).
  3. statement_open read 26 transactions from the 2 files: income 8,900.00, spending 5,829.00, 11 categories, 2 uncategorised. The side panel (账单自动分类) shows the editable keyword rules, the totals chips and the 2 warnings: row 10 UNKNOWN MERCHANT 8831 and row 24 某某小店 · 未知.
  4. statement_export wrote bank-statement-categorizer/bank-2026-10/: categorised.xlsx, categorised.csv, report.html and rules.txt. The last card is the final state.

演示流程:本地 marketplace 安装 → statement_open 同时读银行 CSV 和支付宝账单(26 笔,收入 8,900、支出 5,829,2 笔未分类)→ statement_export 导出分类表、CSV、报告和规则;面板显示规则、汇总和未分类提醒。

@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