Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "bank-statement-categorizer",
"version": "0.1.0",
"description": "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.",
"description_i18n": {
"en": "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.",
"zh-CN": "把银行卡、信用卡、支付软件导出的流水(.csv/.xlsx,中英文都行)按可编辑的关键词规则自动分类,可逐笔手动改分类,标出未分类和可能重复计入的交易,按分类和月份汇总收支。导出分类后的 Excel、CSV 和 HTML 报告,规则可以下个月继续用。在本地运行,不需要登录银行,无需 API 密钥。"
},
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"keywords": [
"bank statement",
"expenses",
"budget",
"categorize",
"personal finance",
"csv",
"账单",
"流水",
"记账",
"分类",
"支出统计",
"支付宝",
"微信账单"
],
"skills": "skills",
"mcpServers": {
"bank-statement-categorizer": {
"type": "stdio",
"command": "node",
"args": [
"${ZCODE_PLUGIN_ROOT}/dist/server.mjs"
],
"cwd": "${ZCODE_PROJECT_DIR}",
"timeoutMs": 900000,
"env": {
"ZCODE_WORKSPACE_ROOT": "${ZCODE_PROJECT_DIR}"
}
}
},
"ui": {
"surfaces": [
{
"id": "editor",
"title": {
"zh-CN": "账单自动分类",
"en-US": "Statement Categorizer"
},
"icon": "wallet",
"server": "bank-statement-categorizer",
"resourceUri": "ui://bank-statement-categorizer/panel.html",
"availability": "session"
}
]
}
}
21 changes: 21 additions & 0 deletions external_plugins/bank-statement-categorizer/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Penova

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 52 additions & 0 deletions external_plugins/bank-statement-categorizer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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.

## Features

- **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.
- **Panel**: pick input files, adjust settings, see problems, edit any cell in the table, preview the result and export — all in the ZCode side panel. Edits are saved in `bank-statement-categorizer/<project>.project.json` and kept until you re-open the inputs.

## Usage

Ask the agent in ZCode Desktop:

- "Categorise 账单/bank-2026-10.csv and 账单/支付宝-2026-11.csv and tell me where my money went each month"
- "Put UNKNOWN MERCHANT 8831 under Dining and add a rule that 小店 means Shopping"
- "Export the categorised Excel and the monthly report"

## Tools

| Tool | Purpose |
|---|---|
| `statement_open` | Read statement exports and categorise every transaction. Opens the panel |
| `statement_edit` | Change settings, edit cells by row, add or remove rows |
| `statement_status` | Show the current rows, issues and summary |
| `statement_export` | Write categorised.xlsx (transactions, month × category, rules), categorised.csv, report.html and rules.txt |

Output goes to `bank-statement-categorizer/<project>/` in the workspace.

## 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.

## Privacy, network and files

- **Everything runs locally.** No network, no uploads, no API keys or accounts.
- Reads only the files you choose. Writes only the `bank-statement-categorizer/` folder in the workspace. No hooks.

## Build and test (developers)

- Source: `ui-plugins/bank-statement-categorizer/`.
- Build: `pnpm install --frozen-lockfile && pnpm build`, then add `dist/local-marketplace` as a local source.
- Tests: `pnpm --filter @penova/plugin-bank-statement-categorizer test` and `test:e2e` (needs Chrome; sample files in `test/samples/`).

## Third-party components and licenses

MIT licensed (author: Penova). Bundled: ExcelJS (MIT), MCP SDK and ext-apps (MIT), zod (MIT); the full list is in `dist/THIRD_PARTY_NOTICES.txt`.
52 changes: 52 additions & 0 deletions external_plugins/bank-statement-categorizer/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 账单自动分类

把银行卡、信用卡、支付软件导出的流水(.csv/.xlsx,中英文都行)按可编辑的关键词规则自动分类,可逐笔手动改分类,标出未分类和可能重复计入的交易,按分类和月份汇总收支。导出分类后的 Excel、CSV 和 HTML 报告,规则可以下个月继续用。在本地运行,不需要登录银行,无需 API 密钥。

## 功能

- **输入**:一个或多个 CSV/XLSX 导出文件,表格上方的说明文字会自动跳过。能识别中英文列名:交易时间/date、交易对方/payee、摘要/商品说明/description,带正负号的金额、金额加“收/支”列,或分开的借方/贷方列。GBK 编码的 CSV 也能读。
- **规则**:一行一条,`关键词|另一个关键词 => 分类`,不区分大小写,第一条命中的规则生效。自带一套常见中英文商户的规则(餐饮、买菜、交通、购物、订阅、生活缴费、住房、收入、储蓄)。
- **手动分类**:在表格里改的分类优先于规则,改规则后也保留。
- **检查**:未分类的交易、无法识别的日期或金额,以及两个不同文件里日期、金额、说明都相同的交易(可能重复计入)。
- **汇总**:收入和支出合计、每个分类一条柱形、按月×分类的汇总表,面板和报告里都有。
- **面板**:在 ZCode 侧栏里选择输入文件、调整设置、查看问题、直接修改表格里的任意单元格、预览成品并导出。修改保存在 `bank-statement-categorizer/<项目>.project.json`,重新打开输入文件前一直保留。

## 使用方法

在 ZCode 桌面端对助手说:

- “把 账单/bank-2026-10.csv 和 账单/支付宝-2026-11.csv 分类,告诉我每个月钱花在哪了”
- “把 UNKNOWN MERCHANT 8831 归到餐饮,再加一条规则:小店算购物”
- “导出分类后的 Excel 和月度报告”

## 工具

| 工具 | 作用 |
|---|---|
| `statement_open` | 读取账单导出文件并给每笔交易分类,并打开面板 |
| `statement_edit` | 修改设置、按行修改单元格、新增或删除行 |
| `statement_status` | 查看当前数据、问题和汇总 |
| `statement_export` | 导出 categorised.xlsx(交易明细、月份×分类汇总、规则)、categorised.csv、report.html 和 rules.txt |

导出文件写到工作区的 `bank-statement-categorizer/<项目>/` 文件夹。

## 范围(v0.1)

- 只读取导出的文件,不连接银行或支付软件。
- 每个项目一种币种(不做汇率换算)。PDF 账单请先在银行导出 CSV/XLSX。
- 规则是关键词匹配,不是机器学习;未分类的交易可以让助手帮你补规则。

## 隐私、网络与文件

- **全部在本地运行。** 不联网、不上传,不需要 API 密钥或账号。
- 只读取你选择的文件,只写入工作区的 `bank-statement-categorizer/` 文件夹。没有 Hook。

## 构建与测试(开发者)

- 源码:`ui-plugins/bank-statement-categorizer/`。
- 构建:`pnpm install --frozen-lockfile && pnpm build`,然后把 `dist/local-marketplace` 添加为本地来源。
- 测试:`pnpm --filter @penova/plugin-bank-statement-categorizer test` 和 `test:e2e`(需要 Chrome;样例文件在 `test/samples/`)。

## 第三方组件与许可证

MIT 许可(作者:Penova)。打包的组件:ExcelJS (MIT)、MCP SDK 与 ext-apps(MIT)、zod(MIT);完整列表见 `dist/THIRD_PARTY_NOTICES.txt`。
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: bank-statement-categorizer
description: 把银行卡、信用卡、支付软件导出的流水(.csv/.xlsx,中英文都行)按可编辑的关键词规则自动分类,可逐笔手动改分类,标出未分类和可能重复计入的交易,按分类和月份汇总收支。导出分类后的 Excel、CSV 和 HTML 报告,规则可以下个月继续用。在本地运行,不需要登录银行,无需 API 密钥。 用户提到“账单分类 / 流水分类 / 记账 / 钱花在哪 / 支出统计 / 银行流水 / 支付宝账单”时使用。
---

# 账单自动分类

1. `statement_open(inputs, settings?, project?)`:读取账单导出文件并给每笔交易分类。inputs 是工作区相对路径。
- 结果里有汇总、问题列表(错误 / 提醒)和前几行数据,每行有编号 `#n`。
- 信用卡账单里正数是消费时,settings 用 `sign: "positive"`。
2. 向用户简要说明结果,先说错误和需要确认的地方,不要逐行念。
3. 用户要改时调用 `statement_edit(project, settings?, set?: [{row, values}], add?, remove?)`。
- 手动分类:`set: [{row, values: {category: "餐饮 Dining"}}]`;加规则:把新行追加到 settings.rules 原文末尾(先用 status 看当前规则)。
4. `statement_export(project, formats?)`:导出 categorised.xlsx(交易明细、月份×分类汇总、规则)、categorised.csv、report.html 和 rules.txt。把文件路径告诉用户。
5. 给用户的总结先说支出最多的 3 个分类和未分类的笔数,再说可能重复计入的交易。
51 changes: 51 additions & 0 deletions marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,57 @@
"把上一个 Hi3D 任务生成的模型按角色拆分成部件"
]
}
},
{
"name": "bank-statement-categorizer",
"componentTypes": [
"ui"
],
"source": "./external_plugins/bank-statement-categorizer",
"displayName": "Statement Categorizer",
"displayName_i18n": {
"en": "Statement Categorizer",
"zh-CN": "账单自动分类"
},
"description": "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.",
"description_i18n": {
"en": "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.",
"zh-CN": "把银行卡、信用卡、支付软件导出的流水(.csv/.xlsx,中英文都行)按可编辑的关键词规则自动分类,可逐笔手动改分类,标出未分类和可能重复计入的交易,按分类和月份汇总收支。导出分类后的 Excel、CSV 和 HTML 报告,规则可以下个月继续用。在本地运行,不需要登录银行,无需 API 密钥。"
},
"version": "0.1.0",
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"category": "productivity",
"keywords": [
"bank statement",
"expenses",
"budget",
"categorize",
"personal finance",
"csv",
"账单",
"流水",
"记账",
"分类",
"支出统计",
"支付宝",
"微信账单"
],
"examplePrompts": [
"Categorise 账单/bank-2026-10.csv and 账单/支付宝-2026-11.csv and tell me where my money went each month",
"Put UNKNOWN MERCHANT 8831 under Dining and add a rule that 小店 means Shopping",
"Export the categorised Excel and the monthly report"
],
"examplePrompts_i18n": {
"zh-CN": [
"把 账单/bank-2026-10.csv 和 账单/支付宝-2026-11.csv 分类,告诉我每个月钱花在哪了",
"把 UNKNOWN MERCHANT 8831 归到餐饮,再加一条规则:小店算购物",
"导出分类后的 Excel 和月度报告"
]
}
}
]
}
Loading