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
60 changes: 60 additions & 0 deletions external_plugins/sheet-to-app/.zcode-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "sheet-to-app",
"version": "0.1.0",
"description": "Turn an inventory, booking or customer spreadsheet (.xlsx / .csv) into a small offline web app: infers field types, required fields, options and a key column, lists data problems in the sheet, and writes one HTML file with search, filters, sorting, add / edit / delete forms with validation, a highlight rule (e.g. low stock), CSV import / export and JSON backup. Data stays in the browser. The mapping is saved, so when the sheet changes the app is rebuilt with your settings kept. No server, no network.",
"description_i18n": {
"en": "Turn an inventory, booking or customer spreadsheet (.xlsx / .csv) into a small offline web app: infers field types, required fields, options and a key column, lists data problems in the sheet, and writes one HTML file with search, filters, sorting, add / edit / delete forms with validation, a highlight rule (e.g. low stock), CSV import / export and JSON backup. Data stays in the browser. The mapping is saved, so when the sheet changes the app is rebuilt with your settings kept. No server, no network.",
"zh-CN": "把库存、预约、客户等表格(.xlsx / .csv)变成一个离线小应用:自动识别字段类型、必填、选项和唯一编号列,列出表格里的数据问题,生成一个 HTML 文件,带搜索、筛选、排序、新增/修改/删除(含校验)、高亮规则(如库存不足)、CSV 导入导出和 JSON 备份。数据存在浏览器本地。字段映射会保存,表格更新后一键重新生成并保留设置。不需要服务器,不联网。"
},
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"keywords": [
"spreadsheet",
"excel",
"csv",
"app",
"inventory",
"booking",
"crud",
"no-code",
"offline",
"表格",
"小应用",
"库存",
"预约",
"客户管理"
],
"skills": "skills",
"mcpServers": {
"sheet-to-app": {
"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": "Sheet To App"
},
"icon": "table",
"server": "sheet-to-app",
"resourceUri": "ui://sheet-to-app/panel.html",
"availability": "session"
}
]
}
}
21 changes: 21 additions & 0 deletions external_plugins/sheet-to-app/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.
53 changes: 53 additions & 0 deletions external_plugins/sheet-to-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Sheet To App

Turn an **inventory, booking or customer spreadsheet** (.xlsx / .csv / .tsv) into a small web app: **one HTML file** that opens by double-clicking, with search, filters and forms. No server, no account, no internet.

## What it does

- **Field mapping**: reads the header row and the data, then guesses each column's type: text, long text, number, money, date, email, phone, link, options (select) or yes/no. It also guesses which columns are required, the options of a select column, a unique key column (SKU, ID, 编号…) and the record title. Every guess can be changed in the panel or by asking the agent.
- **Data problems**: lists rows where a required value is missing, a value has the wrong type ("十" in a number column, a bad email or date), a value is not one of the options, or a key is duplicated, with sheet row numbers. These rows are still imported and shown in red in the app.
- **The app** (`apps/<id>/index.html`):
- Search across text columns, a filter for each options / yes-no column, click a header to sort, and pages of rows.
- Add, edit and delete records in a form with validation (required, number, date, email, link, unique key).
- An optional highlight rule, for example `库存 ≤ 5 → 库存不足`.
- CSV export (opens in Excel with Chinese text intact) and import (append or replace), plus JSON backup and restore.
- Chinese or English interface and an accent colour.
- Data is saved in the browser that opened the file (localStorage).
- **When the sheet changes**: `app_refresh` re-reads it, keeps your field settings, adds new columns, drops removed ones and rebuilds. Anyone who already used the app sees a banner offering to load the new data; their own edits stay until they choose.

## Usage

Ask the agent in ZCode Desktop:

- "Turn inventory.xlsx into a small app I can search and edit"
- "Make a booking tracker from this CSV"
- "The sheet changed — rebuild the app and keep my settings"

Or use the panel: pick the spreadsheet, click **Make app**, adjust field types, labels and the highlight rule, then **Apply & rebuild**. The right side shows a static preview.

## Tools

| Tool | Purpose |
|---|---|
| `app_new` | Read a sheet, infer the mapping, write the app and list data problems |
| `app_update` | Change fields (type, label, required, options, list / filter / hide, key, title) and settings (title, language, colour, page size, sort, highlight), then rebuild |
| `app_refresh` | Re-read the changed sheet, keep the settings and rebuild |
| `app_check` | List data problems without rebuilding |
| `app_list` | List the apps in this workspace |

## Scope (v0.1)

- One sheet per app. The first row holds the headers. Up to 20,000 rows.
- Data lives in one browser on one computer; there is no sync between people. Use **Backup** / **Export CSV** to move it, and keep the spreadsheet as the master copy.
- Edits made in the app are not written back to the spreadsheet. Export a CSV if you want them there.
- No hosting is included. The `apps/<id>/` folder is a plain static site, so you can upload it later to any static host such as Cloudflare Pages. Data would still stay per browser.
- Formulas are read as their last calculated values. .xls files must be saved as .xlsx first.

## Privacy, network and files

- Runs locally with no network access and no API keys. The generated app loads nothing from the internet.
- Reads the spreadsheet. Writes `apps/<id>/index.html` and `.sheet-to-app/apps.json` (the saved mappings). The spreadsheet is never changed.

## License

MIT. Uses [ExcelJS](https://github.com/exceljs/exceljs) (MIT) to read .xlsx files.
53 changes: 53 additions & 0 deletions external_plugins/sheet-to-app/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 表格转小应用

把**库存、预约、客户等表格**(.xlsx / .csv / .tsv)变成一个小网页应用:**只有一个 HTML 文件**,双击就能打开,能搜索、筛选、用表单增删改。不需要服务器,不用注册账号,也不联网。

## 功能

- **字段映射**:读取表头和数据,自动判断每一列的类型:文本、长文本、数字、金额、日期、邮箱、电话、链接、选项、是/否。同时判断哪些列必填、选项列有哪些选项、哪一列是唯一编号(SKU、ID、编号…)、哪一列是记录标题。所有判断都可以在面板里改,也可以直接让助手改。
- **数据问题**:列出必填却为空、类型不对(数字列里写了“十”、邮箱或日期格式不对)、不在选项里、编号重复的行,并标出表格行号。这些行仍会导入,在应用里标红显示。
- **生成的应用**(`apps/<id>/index.html`):
- 在文本类列里搜索;每个选项列、是/否列都有筛选;点表头排序;分页显示。
- 用表单新增、修改、删除记录,带校验(必填、数字、日期、邮箱、链接、编号不能重复)。
- 可选的高亮规则,例如“库存 ≤ 5 → 库存不足”。
- 导出 CSV(用 Excel 打开中文不乱码)、导入 CSV(追加或替换)、JSON 备份与恢复。
- 界面可选中文或英文,可设置主题色。
- 数据保存在打开这个文件的浏览器里(localStorage)。
- **表格更新后**:`app_refresh` 重新读取表格,保留你的字段设置,新增的列自动加上,删掉的列自动去掉,然后重新生成。已经用过这个应用的人会看到提示条,可以选择载入新数据;在他们选择之前,自己做的修改都会保留。

## 使用

在 ZCode Desktop 里对助手说:

- “把库存表.xlsx 做成一个能查询、能修改的小应用”
- “用这个预约表 CSV 生成一个预约管理页面”
- “表格更新了,重新生成应用,保留我的设置”

也可以用面板:选择表格,点 **生成应用**,调整字段类型、显示名和高亮规则,再点 **应用修改并重新生成**。右侧是静态预览。

## 工具

| 工具 | 作用 |
|---|---|
| `app_new` | 读取表格、推断字段映射、生成应用并列出数据问题 |
| `app_update` | 修改字段(类型、显示名、必填、选项、列表/筛选/隐藏、编号列、标题列)和设置(标题、语言、颜色、每页行数、排序、高亮),然后重新生成 |
| `app_refresh` | 表格改了以后重新读取,保留设置并重新生成 |
| `app_check` | 只检查数据问题,不重新生成 |
| `app_list` | 列出这个工作区里的应用 |

## 范围(v0.1)

- 一个应用对应一张工作表,第一行是表头,最多 20,000 行。
- 数据只保存在一台电脑的一个浏览器里,多人之间不同步。要换电脑,请用 **备份** 或 **导出 CSV**;以表格为准。
- 在应用里做的修改不会写回原表格;需要的话,导出 CSV 即可。
- 不包含托管。`apps/<id>/` 是普通静态网站,以后可以上传到 Cloudflare Pages 等静态托管,但数据仍然按浏览器各自保存。
- 公式按最近一次计算的结果读取。.xls 文件需要先另存为 .xlsx。

## 隐私、网络与文件

- 全部在本地运行,不联网,不需要 API Key。生成的应用也不加载任何网络资源。
- 读取表格,写入 `apps/<id>/index.html` 和 `.sheet-to-app/apps.json`(保存的字段映射)。原表格不会被改动。

## 许可证

MIT。读取 .xlsx 用的是 [ExcelJS](https://github.com/exceljs/exceljs)(MIT)。
13 changes: 13 additions & 0 deletions external_plugins/sheet-to-app/skills/sheet-to-app/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: sheet-to-app
description: 把库存、预约、客户等表格(xlsx/csv)生成单文件离线小应用(搜索、筛选、增删改带校验、高亮规则、CSV 导入导出、备份),保存字段映射,表格更新后重新生成。用户提到“表格做成应用 / 管理页面 / 库存管理 / 预约管理 / 把 Excel 变成系统”时使用。
---

# 表格转小应用

1. 找到表格(.xlsx / .csv / .tsv,第一行是表头)。工作簿有多张表时,问清楚用哪一张,用 `sheet` 参数指定。
2. 调用 `app_new({source, title?, lang?})`。它会推断字段类型、必填项、选项和编号列,写出 `apps/<id>/index.html`,并列出表格里的数据问题。
3. 向用户说明:识别出的字段(类型不对的要指出),以及数据问题(第几行、哪一列、什么问题)。问题行仍会导入并标红,用户可以在应用里改,也可以先改原表格。
4. 按用户的要求用 `app_update` 调整:字段类型、显示名、必填、选项、哪些列显示、筛选或隐藏,编号列、标题列,以及标题、语言、主题色、默认排序、高亮规则(例如 `{column:"库存", op:"<=", value:5, label:"库存不足"}`)。
5. 表格更新后,调用 `app_refresh({id})`,设置会保留,然后把新增和删除的列告诉用户。
6. 告诉用户:用浏览器打开 `apps/<id>/index.html` 就能用;数据保存在这个浏览器里,换电脑前请先“备份”或“导出 CSV”;应用里的修改不会写回原表格。以后要放到网上,可以把 `apps/<id>/` 文件夹上传到 Cloudflare Pages 等静态托管。
52 changes: 52 additions & 0 deletions marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,58 @@
"把上一个 Hi3D 任务生成的模型按角色拆分成部件"
]
}
},
{
"name": "sheet-to-app",
"componentTypes": [
"ui"
],
"source": "./external_plugins/sheet-to-app",
"displayName": "Sheet To App",
"displayName_i18n": {
"en": "Sheet To App",
"zh-CN": "表格转小应用"
},
"description": "Turn an inventory, booking or customer spreadsheet (.xlsx / .csv) into a small offline web app: infers field types, required fields, options and a key column, lists data problems in the sheet, and writes one HTML file with search, filters, sorting, add / edit / delete forms with validation, a highlight rule (e.g. low stock), CSV import / export and JSON backup. Data stays in the browser. The mapping is saved, so when the sheet changes the app is rebuilt with your settings kept. No server, no network.",
"description_i18n": {
"en": "Turn an inventory, booking or customer spreadsheet (.xlsx / .csv) into a small offline web app: infers field types, required fields, options and a key column, lists data problems in the sheet, and writes one HTML file with search, filters, sorting, add / edit / delete forms with validation, a highlight rule (e.g. low stock), CSV import / export and JSON backup. Data stays in the browser. The mapping is saved, so when the sheet changes the app is rebuilt with your settings kept. No server, no network.",
"zh-CN": "把库存、预约、客户等表格(.xlsx / .csv)变成一个离线小应用:自动识别字段类型、必填、选项和唯一编号列,列出表格里的数据问题,生成一个 HTML 文件,带搜索、筛选、排序、新增/修改/删除(含校验)、高亮规则(如库存不足)、CSV 导入导出和 JSON 备份。数据存在浏览器本地。字段映射会保存,表格更新后一键重新生成并保留设置。不需要服务器,不联网。"
},
"version": "0.1.0",
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"category": "productivity",
"keywords": [
"spreadsheet",
"excel",
"csv",
"app",
"inventory",
"booking",
"crud",
"no-code",
"offline",
"表格",
"小应用",
"库存",
"预约",
"客户管理"
],
"examplePrompts": [
"Turn inventory.xlsx into a small app I can search and edit",
"Make a booking tracker from this CSV",
"The sheet changed — rebuild the app and keep my settings"
],
"examplePrompts_i18n": {
"zh-CN": [
"把库存表.xlsx 做成一个能查询、能修改的小应用",
"用这个预约表 CSV 生成一个预约管理页面",
"表格更新了,重新生成应用,保留我的设置"
]
}
}
]
}
Loading