Skip to content

feat(ui-plugins): add Expense Splitter (expense-splitter) - #296

Open
ppppp2005-p wants to merge 11 commits into
zai-org:mainfrom
ppppp2005-p:feat/expense-splitter
Open

ppppp2005-p wants to merge 11 commits into
zai-org:mainfrom
ppppp2005-p:feat/expense-splitter

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

What / 改动内容

New community UI plugin Expense Splitter / AA 分账: Split the costs of a group trip, dinner or shared flat and settle up with the fewest transfers. List who paid what — one payer or several — and who shares each expense: everyone, everyone except someone, weighted shares like “A*2”, an exact amount, or an extra on top of an equal share. See what each person paid, owes and gets back, and the shortest list of “who pays whom”. Export a settlement workbook and a clean image to send to the group chat. Runs locally; no account or API keys.

  • Tools: split_open, split_edit, split_status, split_export (all share one side panel: file picker, settings, issue list, editable table, preview, export).
  • Several payers: “小李:900; 阿珍:500” for a bill two people paid together.
  • Flexible splits: 全部 / all, a list of names, “全部, -Tom” (everyone but Tom), weights “小王*2”, an exact amount “Tom:80, 小王, 小李”, or an extra “Tom+80, 全部” (Tom pays 80 more, the rest is split by everyone).
  • Exact to the cent: amounts are counted in cents and leftover cents are shared out so every split adds up exactly.
  • Fewest transfers: groups people whose balances cancel out, so the settle-up list is as short as possible.
  • Checks: payers that don't add up to the amount, nobody to share an expense, names spelled two ways, people missing from the member list.
  • Exports: a workbook with transfers, balances and each expense split per person, and a PNG card for the group chat.
  • Scope (v0.1):
    • One currency per project in v0.1 — convert foreign spending before entering it.
    • Refunds: enter them as a separate expense paid by the person who received the money.
  • Local only; writes only expense-splitter/ 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 expenses.csv (4 people, 8 expenses incl. split payers, exclusions, weights and extras; no problems), exported settlement.xlsx and settlement.png; demo video in the comments)

@ppppp2005-p

Copy link
Copy Markdown
Author

ZCode desktop demo (ZCode 4.0.0, macOS arm64)

expense-splitter-demo.mp4

Flow shown:

  1. Installed expense-splitter from a local marketplace built from this PR's branch.
  2. Asked ZCode to open p100/expense-splitter/expenses.csv with the title 大理国庆游, fix anything that blocks the export with split_edit, then export.
  3. split_open read 8 expenses for 4 people (小王, 小李, 阿珍, Tom), total ¥3,884.50, covering the tricky cases in the sample: an amount written as "1,240", a bill paid by two people (小李:900; 阿珍:500), someone left out (全部, -Tom), weighted shares (小王*2) and a personal extra (Tom+80). No problems were found, so split_edit was not needed and the CSV was not changed.
  4. The panel (AA 分账) shows the settings (title, currency ¥), "4 people, 8 expense(s), total ¥3,884.50 → 3 transfer(s) settle up", 没有发现问题 and the expense table.
  5. split_export wrote expense-splitter/expenses/settlement.xlsx and settlement.png. The second image is the PNG: 3 transfers settle everything (阿珍 → 小李 ¥150.95, Tom → 小王 ¥308.53, Tom → 小李 ¥75.59), and each person's paid / share / balance adds up to zero.

演示流程:本地 marketplace 安装 → split_open(4 人 8 笔共 ¥3,884.50,含多人付款、排除、加权和个人加项,无问题)→ split_export 导出 xlsx 和结算图;第二张图是结算 PNG(3 笔转账即可结清)。

@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