@lark-apaas/coding-miaoda-sandbox-skills 0.1.0-dev.28c4f05 → 0.1.0-dev.4e64c13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/miaoda/animation-skill/SKILL.md +348 -0
- package/miaoda/authz-cli/SKILL.md +1 -0
- package/miaoda/charts-skill/SKILL.md +264 -0
- package/miaoda/creative-to-fullstack/SKILL.md +157 -0
- package/miaoda/creative-to-fullstack/references/artifact-signals.md +46 -0
- package/miaoda/creative-to-fullstack/references/ui-to-function.md +134 -0
- package/miaoda/data-analysis/SKILL.md +151 -0
- package/miaoda/data-analysis/references/json-output-specification.md +277 -0
- package/miaoda/data-analysis/references/post-analysis-guide.md +77 -0
- package/miaoda/data-analysis/references/python-analysis-reference.md +272 -0
- package/miaoda/data-analysis/references/tmp-file-management-guide.md +100 -0
- package/miaoda/debug-investigation/SKILL.md +21 -18
- package/miaoda/extract-json-schema/SKILL.md +147 -0
- package/miaoda/lark-apps/SKILL.md +37 -0
- package/miaoda/lark-apps/references/openapi-key.md +80 -0
- package/miaoda/lark-apps-authz/SKILL.md +292 -0
- package/miaoda/lark-apps-authz/references/permission-points.md +39 -0
- package/miaoda/lark-apps-authz/references/role.md +122 -0
- package/miaoda/lark-apps-db/SKILL.md +226 -0
- package/miaoda/lark-apps-db/references/full-reference.md +302 -0
- package/miaoda/lark-apps-file/SKILL.md +216 -0
- package/miaoda/lark-apps-ops/SKILL.md +62 -0
- package/miaoda/lark-apps-ops/references/lark-apps-access-scope-get.md +30 -0
- package/miaoda/lark-apps-ops/references/lark-apps-access-scope-set.md +40 -0
- package/miaoda/lark-apps-ops/references/lark-apps-cache.md +62 -0
- package/miaoda/lark-apps-ops/references/lark-apps-env.md +46 -0
- package/miaoda/lark-apps-ops/references/lark-apps-local-dev.md +25 -0
- package/miaoda/lark-apps-ops/references/lark-apps-member.md +93 -0
- package/miaoda/lark-apps-ops/references/lark-apps-observability.md +46 -0
- package/miaoda/lark-apps-ops/references/lark-apps-plugin-install.md +36 -0
- package/miaoda/lark-apps-ops/references/lark-apps-plugin-list.md +23 -0
- package/miaoda/lark-apps-ops/references/lark-apps-plugin-uninstall.md +25 -0
- package/miaoda/lark-apps-ops/references/lark-apps-release-create.md +30 -0
- package/miaoda/lark-apps-ops/references/lark-apps-release-get.md +28 -0
- package/miaoda/lark-apps-ops/references/lark-apps-release-list.md +31 -0
- package/miaoda/lark-apps-ops/references/lark-apps-update.md +30 -0
- package/miaoda/lark-apps-ops/references/openapi-key.md +80 -0
- package/miaoda/miaoda-file/SKILL.md +1 -0
- package/miaoda/miaoda-sql/SKILL.md +6 -2
- package/miaoda/performance-review/SKILL.md +144 -0
- package/miaoda/performance-review/references/business-analyzer.md +139 -0
- package/miaoda/performance-review/references/examples.md +107 -0
- package/miaoda/reviewer-usage/SKILL.md +111 -0
- package/miaoda/testing-guide/SKILL.md +218 -0
- package/miaoda-design/lark-apps-comment/SKILL.md +110 -0
- package/miaoda-design/lark-apps-ops/SKILL.md +45 -0
- package/miaoda-design/lark-apps-ops/references/lark-apps-release-create.md +51 -0
- package/miaoda-design/lark-apps-ops/references/lark-apps-release-get.md +28 -0
- package/miaoda-design/lark-apps-ops/references/lark-apps-release-list.md +31 -0
- package/miaoda-design/lark-apps-ops/references/lark-apps-update.md +33 -0
- package/{shared → miaoda-modern}/lark-apps/SKILL.md +5 -5
- package/miaoda-modern/lark-apps/references/openapi-key.md +80 -0
- package/miaoda-modern/lark-apps-ops/SKILL.md +62 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-access-scope-get.md +30 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-access-scope-set.md +40 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-cache.md +62 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-env.md +46 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-local-dev.md +25 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-member.md +93 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-observability.md +46 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-plugin-install.md +36 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-plugin-list.md +23 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-plugin-uninstall.md +25 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-release-create.md +30 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-release-get.md +28 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-release-list.md +31 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-update.md +30 -0
- package/{shared/lark-apps → miaoda-modern/lark-apps-ops}/references/openapi-key.md +3 -3
- package/miaoda-modern/memory/SKILL.md +86 -0
- package/package.json +1 -1
- package/shared/lark-cli/SKILL.md +221 -0
- package/shared/lark-cli/lark-base/README.md +56 -0
- package/shared/lark-cli/lark-base/references/lark-base-commands.md +108 -0
- package/shared/lark-cli/lark-calendar/README.md +158 -0
- package/shared/lark-cli/lark-calendar/references/lark-calendar-meeting.md +30 -0
- package/shared/lark-cli/lark-calendar/references/lark-calendar-room-find.md +108 -0
- package/shared/lark-cli/lark-calendar/references/lark-calendar-suggestion.md +120 -0
- package/shared/lark-cli/lark-contact/README.md +35 -0
- package/shared/lark-cli/lark-contact/references/lark-contact-get-user.md +13 -0
- package/shared/lark-cli/lark-contact/references/lark-contact-search-user.md +121 -0
- package/shared/lark-cli/lark-doc/README.md +67 -0
- package/shared/lark-cli/lark-doc/references/lark-doc-fetch.md +138 -0
- package/shared/lark-cli/lark-doc/references/lark-doc-history.md +61 -0
- package/shared/lark-cli/lark-drive/README.md +129 -0
- package/shared/lark-cli/lark-drive/references/lark-drive-files-list.md +183 -0
- package/shared/lark-cli/lark-im/README.md +84 -0
- package/shared/lark-cli/lark-im/references/lark-im-chat-list.md +140 -0
- package/shared/lark-cli/lark-im/references/lark-im-chat-members-list.md +84 -0
- package/shared/lark-cli/lark-im/references/lark-im-chat-search.md +135 -0
- package/shared/lark-cli/lark-im/references/lark-im-reactions.md +232 -0
- package/shared/lark-cli/lark-minutes/README.md +51 -0
- package/shared/lark-cli/lark-minutes/references/lark-minutes-download.md +130 -0
- package/shared/lark-cli/lark-sheets/README.md +173 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-changeset.md +105 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-chart.md +45 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-conditional-format.md +42 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-filter-view.md +49 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-filter.md +42 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-float-image.md +43 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-formula-verify.md +64 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-history.md +70 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-pivot-table.md +44 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-read-data.md +216 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-search-replace.md +67 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-sheet-structure.md +52 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-sparkline.md +47 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-workbook.md +69 -0
- package/shared/lark-cli/lark-sheets/scripts/sheets_df.py +32 -0
- package/shared/lark-cli/lark-slides/README.md +86 -0
- package/shared/lark-cli/lark-slides/references/lark-slides-history.md +105 -0
- package/shared/lark-cli/lark-slides/references/lark-slides-xml-presentation-slide-get.md +108 -0
- package/shared/lark-cli/lark-slides/references/lark-slides-xml-presentations-get.md +77 -0
- package/shared/lark-cli/lark-task/README.md +93 -0
- package/shared/lark-cli/lark-task/references/lark-task-get-my-tasks.md +57 -0
- package/shared/lark-cli/lark-task/references/lark-task-get-related-tasks.md +49 -0
- package/shared/lark-cli/lark-task/references/lark-task-search.md +36 -0
- package/shared/lark-cli/lark-task/references/lark-task-tasklist-search.md +35 -0
- package/shared/lark-cli/lark-vc/README.md +40 -0
- package/shared/lark-cli/lark-vc/references/lark-vc-recording.md +31 -0
- package/shared/lark-cli/lark-whiteboard/README.md +35 -0
- package/shared/lark-cli/lark-whiteboard/references/lark-whiteboard-export.md +59 -0
- package/shared/lark-cli/lark-wiki/README.md +50 -0
- package/shared/lark-cli/lark-wiki/references/lark-wiki-node-get.md +59 -0
- package/shared/lark-cli/lark-wiki/references/lark-wiki-node-list.md +95 -0
- package/shared/lark-cli/lark-wiki/references/lark-wiki-space-list.md +68 -0
- package/miaoda-design/attachment/SKILL.md +0 -58
- /package/{shared → miaoda}/memory/SKILL.md +0 -0
- /package/{shared → miaoda-modern}/animation-skill/SKILL.md +0 -0
- /package/{shared → miaoda-modern}/charts-skill/SKILL.md +0 -0
- /package/{shared → miaoda-modern}/data-analysis/SKILL.md +0 -0
- /package/{shared → miaoda-modern}/data-analysis/references/json-output-specification.md +0 -0
- /package/{shared → miaoda-modern}/data-analysis/references/post-analysis-guide.md +0 -0
- /package/{shared → miaoda-modern}/data-analysis/references/python-analysis-reference.md +0 -0
- /package/{shared → miaoda-modern}/data-analysis/references/tmp-file-management-guide.md +0 -0
- /package/{shared → miaoda-modern}/extract-json-schema/SKILL.md +0 -0
- /package/{shared → miaoda-modern}/performance-review/SKILL.md +0 -0
- /package/{shared → miaoda-modern}/performance-review/references/business-analyzer.md +0 -0
- /package/{shared → miaoda-modern}/performance-review/references/examples.md +0 -0
- /package/{shared → miaoda-modern}/reviewer-usage/SKILL.md +0 -0
- /package/{shared → miaoda-modern}/testing-guide/SKILL.md +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# apps +plugin-install
|
|
2
|
+
|
|
3
|
+
> **本地命令**:读当前目录的 `package.json`,在项目根目录下运行(和 npm 一样)。**不接受 `--app-id`**——它不是远端 API 命令。
|
|
4
|
+
|
|
5
|
+
安装插件包到项目。运行时命令事实以 `lark-cli apps +plugin-install --help` 为准。
|
|
6
|
+
|
|
7
|
+
## 何时用
|
|
8
|
+
|
|
9
|
+
用户要接入 AI 能力或飞书平台能力,需要先安装对应的插件包。安装后才能创建插件实例。具体有哪些可用插件、该选哪个,读取创建的应用仓库 Skill:`.agents/skills/plugin-guide/SKILL.md`。
|
|
10
|
+
|
|
11
|
+
**插件包 ≠ npm 包**:插件包写入 `actionPlugins`,npm 写入 `dependencies`,两套独立机制。禁止用 `npm install` 代替本命令。
|
|
12
|
+
|
|
13
|
+
## 命令骨架
|
|
14
|
+
|
|
15
|
+
- `--name <key>`:插件包 key(从仓库 Skill 的「AI 插件目录」获取)。不传则批量安装 `actionPlugins` 中声明的所有插件。
|
|
16
|
+
- `--version <ver>`:指定版本(如 `1.0.0`)。不传则安装最新版。
|
|
17
|
+
|
|
18
|
+
在项目根目录下运行(和 npm 一样,无需指定路径)。
|
|
19
|
+
|
|
20
|
+
## 示例
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# 安装最新版
|
|
24
|
+
lark-cli apps +plugin-install --name <plugin-key>
|
|
25
|
+
|
|
26
|
+
# 安装指定版本
|
|
27
|
+
lark-cli apps +plugin-install --name <plugin-key> --version 1.0.0
|
|
28
|
+
|
|
29
|
+
# 批量安装已声明的所有插件
|
|
30
|
+
lark-cli apps +plugin-install
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 输出契约
|
|
34
|
+
|
|
35
|
+
- 已安装同版本会跳过(status=already_installed)。
|
|
36
|
+
- 失败时 hint 指示原因(网络/版本不存在/package.json 缺失)。
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# apps +plugin-list
|
|
2
|
+
|
|
3
|
+
> **本地命令**:读当前目录的 `package.json`,在项目根目录下运行(和 npm 一样)。**不接受 `--app-id`**——它不是远端 API 命令。
|
|
4
|
+
|
|
5
|
+
列出已声明的插件包及安装状态。运行时命令事实以 `lark-cli apps +plugin-list --help` 为准。
|
|
6
|
+
|
|
7
|
+
## 何时用
|
|
8
|
+
|
|
9
|
+
查看当前项目声明了哪些插件、是否已安装。`declared_not_installed` 状态表示需要运行 `+plugin-install` 安装。
|
|
10
|
+
|
|
11
|
+
## 命令骨架
|
|
12
|
+
|
|
13
|
+
在项目根目录下运行(和 npm 一样,无需指定路径)。
|
|
14
|
+
|
|
15
|
+
## 示例
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
lark-cli apps +plugin-list --format json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 输出契约
|
|
22
|
+
|
|
23
|
+
- `data.plugins[]` 包含 `key`、`version`、`status`(`installed` / `declared_not_installed`)。
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# apps +plugin-uninstall
|
|
2
|
+
|
|
3
|
+
> **本地命令**:读当前目录的 `package.json`,在项目根目录下运行(和 npm 一样)。**不接受 `--app-id`**——它不是远端 API 命令。
|
|
4
|
+
|
|
5
|
+
卸载插件包。运行时命令事实以 `lark-cli apps +plugin-uninstall --help` 为准。
|
|
6
|
+
|
|
7
|
+
## 何时用
|
|
8
|
+
|
|
9
|
+
用户不再需要某个插件能力时,卸载对应的插件包。卸载前应先删除该插件的所有实例。
|
|
10
|
+
|
|
11
|
+
## 命令骨架
|
|
12
|
+
|
|
13
|
+
- `--name <key>`:要卸载的插件包 key。
|
|
14
|
+
|
|
15
|
+
在项目根目录下运行(和 npm 一样,无需指定路径)。
|
|
16
|
+
|
|
17
|
+
## 示例
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
lark-cli apps +plugin-uninstall --name <plugin-key>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 输出契约
|
|
24
|
+
|
|
25
|
+
- 删除 `node_modules/{key}` + 移除 `actionPlugins` 条目。
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# apps +release-create
|
|
2
|
+
|
|
3
|
+
为妙搭应用创建发布 release。运行时命令事实以 `lark-cli apps +release-create --help` 为准。
|
|
4
|
+
|
|
5
|
+
## 何时用
|
|
6
|
+
|
|
7
|
+
用于把全栈应用的代码分支推进到发布流程。
|
|
8
|
+
|
|
9
|
+
## 命令骨架
|
|
10
|
+
|
|
11
|
+
- 必填:`--app-id`。
|
|
12
|
+
- 可选:`--branch`;省略时服务端使用默认发布分支。
|
|
13
|
+
- 返回 `release_id` 和 `status`,后续用 `+release-get` 轮询。
|
|
14
|
+
|
|
15
|
+
## 示例
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
lark-cli apps +release-create --app-id "$app_id"
|
|
19
|
+
lark-cli apps +release-create --app-id "$app_id" --branch sprint/default --dry-run
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 输出契约
|
|
23
|
+
|
|
24
|
+
- 成功读取 `data.release_id` 和 `data.status`;`release_id` 是后续 `+release-get` 的入参。
|
|
25
|
+
- `status=publishing` 表示发布仍在进行;继续用 `+release-get` 轮询,轮询间隔应该为 20s。应用发布平均耗时大约 2min,整体超时时间大约 5min。
|
|
26
|
+
- `+release-create` 返回 release 只代表发布已发起。只有 `+release-get` 对同一个 `release_id` 返回 `finished` 后,才能说本轮最新版本已部署。
|
|
27
|
+
|
|
28
|
+
## Agent 规则
|
|
29
|
+
|
|
30
|
+
`+release-create` 部署的是远端 `sprint/default` 上已 push 的代码,不是本地工作区——本地若有你修改但未推送的改动,需要先 `git add` + `git commit` 并 `git push` 到 `sprint/default`,否则这些改动不会进入这次发布。发布后若 status 是 `publishing`,用 [`+release-get`](lark-apps-release-get.md) 查询。`+release-create` 部署上线属高影响动作——作为别的命令的连带前置时,按 SKILL.md「发布态护栏」先征得用户同意再发布。
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# apps +release-get
|
|
2
|
+
|
|
3
|
+
按 release ID 查询单次发布详情。运行时命令事实以 `lark-cli apps +release-get --help` 为准。
|
|
4
|
+
|
|
5
|
+
## 何时用
|
|
6
|
+
|
|
7
|
+
用于跟进已知 `release_id` 的发布状态。没有 `release_id` 时先读 [`lark-apps-release-list.md`](lark-apps-release-list.md),不要让用户手填。
|
|
8
|
+
|
|
9
|
+
`release_id` 是妙搭发布 ID(`+release-create` 返回),不是飞书审批实例号;查发布进度/失败都在 `apps +release-*` 命令族内完成,不要路由到 lark-approval。
|
|
10
|
+
|
|
11
|
+
## 命令骨架
|
|
12
|
+
|
|
13
|
+
- 必填:`--app-id`、`--release-id`。
|
|
14
|
+
- `release_id` 来自 `+release-create` 或 `+release-list`。
|
|
15
|
+
|
|
16
|
+
## 示例
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
lark-cli apps +release-get --app-id "$app_id" --release-id <release_id>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 输出契约
|
|
23
|
+
|
|
24
|
+
- 成功可能直接返回 release 字段,也可能包在 `data.release`;读取 `release_id`、`status`、`created_at`、`updated_at`,以及 `commit_id`(本轮发布对应的 git commit SHA,pretty 输出在其非空时展示一行)。
|
|
25
|
+
- `status=publishing` 继续轮询。此时尚无 `online_url`;不要拿其它链接(如应用主页 / 开发态预览 URL)冒充"本轮发布的访问链接"——只回报 `release_id`、`status`,并说明 `finished` 后才有 `online_url`。
|
|
26
|
+
- `status=finished` 发布成功——**本命令输出已含 `online_url`,直接读取它作为本轮发布的线上访问链接**返回用户。
|
|
27
|
+
- `status=failed` 发布失败——**本命令输出已含 `error_logs`(`step`/`error_log`),直接据此向用户转述关键失败步骤和可行动修复**。
|
|
28
|
+
- 只有当这个 `release_id` 已返回 `finished`,随后读到的 `online_url` 才能被表述为"本轮发布后的访问链接";未经 `+release-get` 确认 `finished` 的任何旁证都不能证明最新版本已部署。
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# apps +release-list
|
|
2
|
+
|
|
3
|
+
分页查询妙搭应用发布历史,最新发布在前。运行时命令事实以 `lark-cli apps +release-list --help` 为准。
|
|
4
|
+
|
|
5
|
+
## 何时用
|
|
6
|
+
|
|
7
|
+
用户问"最近发布""历史版本""上次为什么失败",但没有提供 `release_id` 时使用。拿到候选 release 后再接 `+release-get`。
|
|
8
|
+
|
|
9
|
+
## 命令骨架
|
|
10
|
+
|
|
11
|
+
- 必填:`--app-id`。
|
|
12
|
+
- 可选 `--status`:`publishing` / `finished` / `failed`。
|
|
13
|
+
- 可选 `--page-size`:默认 20,最大 500;总是发送给服务端。
|
|
14
|
+
- 可选 `--page-token`:上一页 cursor。
|
|
15
|
+
|
|
16
|
+
## 示例
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
lark-cli apps +release-list --app-id "$app_id" --page-size 10
|
|
20
|
+
lark-cli apps +release-list --app-id "$app_id" --status failed
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 输出契约
|
|
24
|
+
|
|
25
|
+
- 成功读取 `data.releases[]`;关键字段是 `release_id`、`status`、`created_at`、`updated_at`。
|
|
26
|
+
- `release_id` 用于继续查 `+release-get`。
|
|
27
|
+
- 若 `has_more=true`,用 `next_page_token` / `page_token` 翻页。
|
|
28
|
+
|
|
29
|
+
## Agent 规则
|
|
30
|
+
|
|
31
|
+
用户限定只看 N 条("最近 N 条""最新 N 个""只要前 N 条")时用 `--page-size N`(如"最近一次发布"→ `--page-size 1`),而不是取全量再本地截断。
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# apps +update
|
|
2
|
+
|
|
3
|
+
部分更新妙搭应用元信息。运行时命令事实以 `lark-cli apps +update --help` 为准。
|
|
4
|
+
|
|
5
|
+
## 何时用
|
|
6
|
+
|
|
7
|
+
只更新应用展示元信息。用户要改代码、发布内容、可见范围或数据库时,不走 `+update`。
|
|
8
|
+
|
|
9
|
+
## 命令骨架
|
|
10
|
+
|
|
11
|
+
- 必填:`--app-id`。
|
|
12
|
+
- 至少提供一个:`--name` 或 `--description`。
|
|
13
|
+
- 只发送用户提供的字段,不会清空未提供字段。
|
|
14
|
+
|
|
15
|
+
## 示例
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
lark-cli apps +update --app-id "$app_id" --name "审批系统"
|
|
19
|
+
lark-cli apps +update --app-id "$app_id" --description "用于部门审批流转"
|
|
20
|
+
lark-cli apps +update --app-id "$app_id" --name "审批系统" --description "用于部门审批流转" --dry-run
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 输出契约
|
|
24
|
+
|
|
25
|
+
- 成功读取 `data.app`;响应是完整应用对象,不只是被修改字段。
|
|
26
|
+
- 缺 `--app-id` 或没有提供 `--name` / `--description` 会在本地 validation 失败。
|
|
27
|
+
|
|
28
|
+
## Agent 规则
|
|
29
|
+
|
|
30
|
+
更新前复述要变更的字段;用户没有提到的字段不要补默认值。执行后只转述新的名称/描述和 app_id,不需要展开原始响应。
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# apps openapi-key 命令族(开放 API Key)
|
|
2
|
+
|
|
3
|
+
管理妙搭应用对外暴露的 HTTP API Key(`/openapi/**` 鉴权凭证)。命令事实以 `lark-cli apps +openapi-key-list --help`(各子命令同理)为准;本文件只记录 Agent 不看就会做错的领域规则。鉴权由沙箱运行环境自动注入(见 SKILL.md「鉴权自动」),命令无需也不要传身份参数。
|
|
4
|
+
|
|
5
|
+
## 命令路由
|
|
6
|
+
|
|
7
|
+
| 命令 | 用途 |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `+openapi-key-list` | 列出应用所有 API Key(脱敏) |
|
|
10
|
+
| `+openapi-key-get` | 查看单个 Key 详情(脱敏) |
|
|
11
|
+
| `+openapi-key-create` | 创建新 Key,**原始密钥一次性可见** |
|
|
12
|
+
| `+openapi-key-update` | 改名或改 config(不改 status) |
|
|
13
|
+
| `+openapi-key-enable` | 启用 Key(status→1) |
|
|
14
|
+
| `+openapi-key-disable` | 停用 Key(status→0),**泄露/疑似泄露优先用这个而非 delete** |
|
|
15
|
+
| `+openapi-key-delete` | 永久删除 Key(不可逆,高风险) |
|
|
16
|
+
| `+openapi-key-reset` | 轮换密钥(刷新原始 Key),**一次性可见**(高风险) |
|
|
17
|
+
|
|
18
|
+
命令均带 `--app-id "$app_id"`(当前沙箱应用),如:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
lark-cli apps +openapi-key-list --app-id "$app_id"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 密钥红线(安全关键,务必遵守)
|
|
25
|
+
|
|
26
|
+
- `create` / `reset` 返回的**原始密钥仅一次性可见**:只在 `data.api_key`(顶层)随本次响应返回一次,同时 stderr 打印一次性提示(大意:此密钥仅显示一次、不被 lark-cli 保存,请立即复制到你自己的密钥管理器)。
|
|
27
|
+
- **绝不**把原始密钥写入 cache / config / recent / debug log / 错误信息,也不要在后续对话里回显完整密钥;只向用户转述一次并提示自行妥善保管。
|
|
28
|
+
- **密钥丢失不能找回**:`list` / `get` 不回显原始密钥。唯一恢复方式是 `+openapi-key-reset` 重新生成新密钥(旧密钥同时失效)。
|
|
29
|
+
|
|
30
|
+
## 脱敏口径
|
|
31
|
+
|
|
32
|
+
- `list` / `get` / `update` / `enable` / `disable`:返回结构里 **无** `api_key` 字段,只有 `key_preview`(格式:`****` + 原始密钥末 4 位,如 `****5f4a`)。
|
|
33
|
+
- `create` / `reset`:**仅** 在 `data.api_key`(顶层)返回原始密钥一次(见上「密钥红线」)。
|
|
34
|
+
|
|
35
|
+
## scope 结构与 CLI 表达
|
|
36
|
+
|
|
37
|
+
后端 `config.request_scope` 的真实结构(**snake_case**——Lark 开放网关 `/open-apis/` 对外契约约定;`api_key.thrift` 的 camelCase go.tag 是内部表示,OGW 已转成 snake_case):
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"allow_all": true,
|
|
42
|
+
"http_infos": [
|
|
43
|
+
{ "http_method": "GET", "http_path": "/openapi/some-path" }
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- `allow_all=true`:放开该应用所有 `/openapi/**` 路由;`http_infos` 此时忽略。
|
|
49
|
+
- `allow_all=false`:按 `http_infos` 逐条授权,每条需 `http_method`(大写)+ `http_path`(`/openapi/` 开头)。
|
|
50
|
+
|
|
51
|
+
CLI 提供三种互斥的 scope 表达方式:
|
|
52
|
+
|
|
53
|
+
| flag | 用途 | 备注 |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `--scope-all` | `allow_all=true`,放开所有路由 | bool flag,显式传 `--scope-all=false` 也算"已设置" |
|
|
56
|
+
| `--scope-api 'METHOD /openapi/path'` | 逐条授权一个路由,可重复 | 路由从应用 `docs/openapi.json` 取 |
|
|
57
|
+
| `--scope '<raw request_scope JSON>'` | 高级逃生口,直传 request_scope JSON(snake_case) | CLI 只校验合法 JSON;`--scope` 与 `--scope-all`/`--scope-api` 互斥 |
|
|
58
|
+
|
|
59
|
+
### scope 值来源
|
|
60
|
+
|
|
61
|
+
妙搭应用的 `/openapi/**` 路由定义在应用仓库,并同步维护在 `docs/openapi.json`(`paths` 下每个 `"/openapi/..."` 条目 + HTTP 方法)。要授权哪些路由,读目标应用自己的 `docs/openapi.json`,取 `(method, path)` 对。CLI 本身不提供 API 路由发现功能(P1 规划中)。
|
|
62
|
+
|
|
63
|
+
## 高风险操作(delete / reset)
|
|
64
|
+
|
|
65
|
+
`delete` 和 `reset` 是高风险写操作(`high-risk-write`):缺 `--yes` 会 **exit 10**(`confirmation_required`),须按 SKILL.md 的 exit-10 审批协议先征得用户显式同意再补 `--yes`——**不要**自动补 `--yes`;不确定先 `--dry-run` 查看将执行的 HTTP 请求(不含密钥)。
|
|
66
|
+
|
|
67
|
+
- **泄露场景**:应优先 `+openapi-key-disable` 立即停用,而非 `+openapi-key-delete`——停用可随时 `+openapi-key-enable` 恢复,delete 不可逆。
|
|
68
|
+
|
|
69
|
+
## 典型决策场景
|
|
70
|
+
|
|
71
|
+
| 用户意图 | 正确操作 |
|
|
72
|
+
|---|---|
|
|
73
|
+
| "key 泄露了,先停掉" | `+openapi-key-disable`(不是 delete) |
|
|
74
|
+
| "key 丢了/忘了,再给我一个" | `+openapi-key-reset`(不是 create 新 key;reset 轮换密钥、保留原 key 配置) |
|
|
75
|
+
| "我的 key 密钥是什么" | 解释:list/get 不回显原始密钥,只能用 `+openapi-key-reset` 轮换 |
|
|
76
|
+
| "给应用创建一个有权限限制的 key" | `+openapi-key-create --name ... --scope-api 'GET /openapi/...'`(路由取自应用 `docs/openapi.json`) |
|
|
77
|
+
|
|
78
|
+
## 不在本 skill 范围
|
|
79
|
+
|
|
80
|
+
- OpenAPI spec 全量导出、实时日志 tail、Webhook 消费、多鉴权方式:本期不支持。
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: miaoda-file
|
|
3
3
|
description: "Use when Agent 需要在对话 / 开发中对应用存储里的文件做一次性操作:上传、下载、列出、删除、清理、查看元数据,或获取下载 / 临时分享链接(如分析数据后上传产物、传素材、灌测试数据、验证上传、清理)。NOT for 应用运行时代码里的文件能力——前端用 client-builtins-file-storage-service、后端用 server-builtins-file-storage-service。触发词:文件上传, 文件下载, 文件列表, 文件删除, 文件清理, 文件查看, 文件元数据, 下载链接, 临时分享链接, miaoda file, 应用存储"
|
|
4
|
+
control-by-feature-ab: true
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# miaoda-file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: miaoda-sql
|
|
3
|
-
description: Use when creating or modifying Miaoda PostgreSQL tables, running `miaoda db` SQL/schema/data commands, seeding mock data, or handling audit/changelog/migration/recovery. 触发词:miaoda db, SQL, 建表, 改表, 数据库, mock 数据, 示例数据, 数据审计, 变更历史, 数据恢复, PITR,
|
|
3
|
+
description: Use when creating or modifying Miaoda PostgreSQL tables, writing or troubleshooting RLS policies, running `miaoda db` SQL/schema/data commands, seeding mock data, or handling audit/changelog/migration/recovery. 触发词:miaoda db, SQL, 建表, 改表, 数据库, mock 数据, 示例数据, 数据审计, 变更历史, 数据恢复, PITR, 多环境发布, RLS, policy, pgPolicy, 行级权限, SQLSTATE 42501 (permission denied)
|
|
4
|
+
control-by-feature-ab: true
|
|
4
5
|
gate-tools:
|
|
5
6
|
- tool: bash
|
|
6
7
|
when-contains:
|
|
@@ -134,6 +135,7 @@ CREATE POLICY "修改本人数据" ON <table>
|
|
|
134
135
|
| user_profile 表达式索引 / 唯一性 | 索引用三重括号:`CREATE INDEX ... ON t (((owner).user_id))`;表达式唯一性用 `CREATE UNIQUE INDEX`,不要用 `ALTER TABLE ADD CONSTRAINT UNIQUE` |
|
|
135
136
|
| UUID 手写 | 主键用 `DEFAULT gen_random_uuid()`;INSERT 不手写 UUID,外键用子查询取父表 id |
|
|
136
137
|
| MySQL 方言 | 不用 `SHOW TABLES` / `DESCRIBE` / 内联 `COMMENT`;改用 schema 命令和 `COMMENT ON` |
|
|
138
|
+
| 日期列当字符串用 | 按月 / 按天筛选写范围比较 `col >= '2026-08-01' AND col < '2026-09-01'`;date / timestamptz 上 `LIKE '2026-08%'` 报 42883 |
|
|
137
139
|
| 空数组类型不明 | 写 `ARRAY[]::text[]` 或 `'{}'::text[]` |
|
|
138
140
|
| 标量子查询多行 | `VALUES((SELECT ...))` / `SET col=(SELECT ...)` 必须唯一或 `ORDER BY ... LIMIT 1` |
|
|
139
141
|
| 系统表查询 | 常规结构查询用 schema 命令;系统表仅限 reference 中列出的白名单 |
|
|
@@ -161,7 +163,9 @@ CREATE POLICY "修改本人数据" ON <table>
|
|
|
161
163
|
| 关联 | 外键 / 子查询引用的数据必须已存在;UUID 字段不用手写 |
|
|
162
164
|
| 审计列 | `_created_at` / `_updated_at` 可省略;需要归属时显式写 `_created_by` / `_updated_by` |
|
|
163
165
|
|
|
164
|
-
|
|
166
|
+
测试用户(**只用于数据库 `user_profile` 列**):`1847292357012580` 张伟、`1847292986161210` 李明、`1838411738368010` 刘洋、`1847292458018820` 赵丽、`1847286122258458` 孙强、`1846114399229988` John Smith、`1847298549409911` Emma Johnson、`1847291727560708` Michael Brown、`1848568929333380` Robert Wilson、`1847751107397639` Maria Garcia。
|
|
167
|
+
|
|
168
|
+
> ⚠️ 这些是妙搭数字 user_id,**不是飞书 open_id**。需要 open_id(`ou_` 开头)的场景一律另行解析,禁止直接复用这些数字 ID。
|
|
165
169
|
|
|
166
170
|
### `user_id` / `user_profile`
|
|
167
171
|
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: performance-review
|
|
3
|
+
description: "Fullstack performance audit checklist for the Reviewer agent. Covers frontend rendering, data fetching, memory, loading, backend queries, algorithm complexity, concurrency. 触发词:性能审查, performance review, 性能问题"
|
|
4
|
+
hook: SessionStart
|
|
5
|
+
available-agents:
|
|
6
|
+
- Reviewer
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Performance Review Checklist
|
|
10
|
+
|
|
11
|
+
## Frontend Rendering & State
|
|
12
|
+
|
|
13
|
+
**Reference stability (trace origin):**
|
|
14
|
+
- Dependencies of useEffect/useMemo/useCallback containing object/array refs — trace whether the ref is recreated each render
|
|
15
|
+
- Event listener cleanup referencing the same function instance as addEventListener
|
|
16
|
+
|
|
17
|
+
**Render path cost:**
|
|
18
|
+
- Inline .filter()/.map()/.sort()/new Set()/new Date() in JSX — should extract to useMemo
|
|
19
|
+
- Large lists (100+ items) without virtualization
|
|
20
|
+
- Large components (500+ lines) where local state changes cause unrelated subtree re-renders
|
|
21
|
+
- Derived data using useState + useEffect instead of useMemo
|
|
22
|
+
|
|
23
|
+
## Frontend Data Fetching
|
|
24
|
+
|
|
25
|
+
- List API using getAll without pagination — should use backend pagination
|
|
26
|
+
- Multiple independent requests using serial await — should Promise.all
|
|
27
|
+
- Polling (setInterval + async) without request lock — next request shouldn't fire before previous completes
|
|
28
|
+
- Missing request cancellation on component unmount or parameter change
|
|
29
|
+
|
|
30
|
+
## Frontend Memory
|
|
31
|
+
|
|
32
|
+
By frequency of occurrence, focus on top three:
|
|
33
|
+
- setTimeout/setInterval without cleanup in useEffect return
|
|
34
|
+
- addEventListener without matching removeEventListener
|
|
35
|
+
- subscribe without unsubscribe
|
|
36
|
+
|
|
37
|
+
## Frontend Loading
|
|
38
|
+
|
|
39
|
+
- Routes not using React.lazy — synchronous import of all pages impacts initial load
|
|
40
|
+
- Large third-party libraries (ECharts, jsPDF, etc.) not dynamically imported
|
|
41
|
+
- Importing from barrel files (index.ts) — import directly from source for tree-shaking
|
|
42
|
+
- **Google Fonts / external CDN must not appear in entry resources**:
|
|
43
|
+
- Search `index.html` and CSS files (especially `tailwind-theme.css`) for: `fonts.googleapis.com`, `fonts.gstatic.com`, `cdn.jsdelivr.net`, `unpkg.com`, `cdnjs.cloudflare.com`
|
|
44
|
+
- **Must fix**: delete the `@import url(...)` line in CSS and the `<link rel="preconnect">` / `<link href="...">` tags in HTML; fall back to the system font stack.
|
|
45
|
+
|
|
46
|
+
## P1 · Data Access Performance
|
|
47
|
+
|
|
48
|
+
**Core issue**: N+1 queries in loops, findAll without limit.
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
// BAD: N+1 — 100 orders → 100 queries
|
|
52
|
+
for (const order of orders) { const user = await User.findById(order.userId); }
|
|
53
|
+
// GOOD: batch query + in-memory join
|
|
54
|
+
const users = await User.findAll({ where: { id: userIds } });
|
|
55
|
+
const userMap = new Map(users.map(u => [u.id, u]));
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Checklist**:
|
|
59
|
+
- N+1 queries: per-item DB calls inside loops — use batch or JOIN
|
|
60
|
+
- List endpoints without pagination — will break as data grows
|
|
61
|
+
- OFFSET pagination on large datasets — use cursor pagination (WHERE id > cursor)
|
|
62
|
+
- Multiple independent DB queries running serially — use Promise.all
|
|
63
|
+
- External API calls without timeout
|
|
64
|
+
- WHERE/ORDER BY columns missing indexes — **cross-check with schema definition: for every ORDER BY or WHERE column in service queries, verify a matching index exists in schema.ts**
|
|
65
|
+
- Aggregation done in JS instead of SQL layer — fetch all rows then compute in app is a common anti-pattern
|
|
66
|
+
- **Sorting fields used in list/ranking endpoints must have database indexes — read schema.ts and verify**
|
|
67
|
+
- **Date-range loop expansion in JS (CRITICAL)**: code shaped like `for (let d = new Date(start); d <= end; d.setDate(d.getDate()+1)) for (item of items) ...` is O(N×days). For 1000 records over 90 days = 90,000 ops per request. Must be pushed to SQL using `generate_series(start, end, '1 day') + unnest(array_field) + GROUP BY ... HAVING COUNT(*) > N` — let the database do the date×row cross product
|
|
68
|
+
- **Multiple endpoints sharing the same base data should be merged**: e.g. Dashboard frontend calling 4 separate stats endpoints, each internally re-querying the full teacher table to build a lookup map. Merge into a single overview endpoint that runs the 4 stats in parallel internally and shares one base-data query.
|
|
69
|
+
- **Stats / Dashboard endpoints must have a default time window**: any query that scans the entire fact table for aggregation (`select ... from coursePlan` with no `where`) will degrade as data grows. Add a default `where startDate >= now() - interval '90 day'` (or business-appropriate window) so it can hit `idx_*_start_date`. Without a time window, even with indexes the planner may still seq-scan. If "all history" is required, use a materialized view or pre-aggregated table refreshed on schedule, never a live full-table scan.
|
|
70
|
+
|
|
71
|
+
| Scenario | Severity |
|
|
72
|
+
|----------|----------|
|
|
73
|
+
| findAll without limit | CRITICAL |
|
|
74
|
+
| N+1 queries | HIGH |
|
|
75
|
+
|
|
76
|
+
## P2 · Memory Usage
|
|
77
|
+
|
|
78
|
+
**Core issue**: Large file readFileSync into memory, module-level Map growing without bound.
|
|
79
|
+
|
|
80
|
+
**Checklist**:
|
|
81
|
+
- Large files must use streams, not readFileSync
|
|
82
|
+
- Module-level collections must have size limits or LRU eviction
|
|
83
|
+
- Must not accumulate full datasets in memory
|
|
84
|
+
|
|
85
|
+
| Scenario | Severity |
|
|
86
|
+
|----------|----------|
|
|
87
|
+
| readFileSync on user uploads / Map without limit | HIGH |
|
|
88
|
+
|
|
89
|
+
## P3 · Algorithm Complexity
|
|
90
|
+
|
|
91
|
+
**Core issue**: Nested loop O(n²) should use Set/Map index; hot-path JSON.parse(JSON.stringify) deep clone.
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// BAD: O(n²) nested lookup
|
|
95
|
+
for (const order of orders) {
|
|
96
|
+
const user = users.find(u => u.id === order.userId); // linear scan per order
|
|
97
|
+
}
|
|
98
|
+
// GOOD: pre-build index
|
|
99
|
+
const userMap = new Map(users.map(u => [u.id, u]));
|
|
100
|
+
for (const order of orders) {
|
|
101
|
+
const user = userMap.get(order.userId); // O(1) lookup
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Checklist**:
|
|
106
|
+
- No nested loops with linear lookup (O(n²)) — pre-build Map/Set index
|
|
107
|
+
- No unnecessary sort or deep clone on hot paths
|
|
108
|
+
- No ReDoS-vulnerable regular expressions
|
|
109
|
+
|
|
110
|
+
| Scenario | Severity |
|
|
111
|
+
|----------|----------|
|
|
112
|
+
| O(n²) nested loops / ReDoS | HIGH |
|
|
113
|
+
| Hot-path deep clone | MEDIUM |
|
|
114
|
+
|
|
115
|
+
## P4 · Concurrency & Backpressure
|
|
116
|
+
|
|
117
|
+
**Core issue**: Unbounded Promise.all overwhelming downstream; Stream without backpressure handling.
|
|
118
|
+
|
|
119
|
+
**Checklist**:
|
|
120
|
+
- Large array Promise.all must have concurrency limit (p-limit or chunked batches)
|
|
121
|
+
- Stream pipelines must handle backpressure (use pipeline)
|
|
122
|
+
- Batch operations must be chunked
|
|
123
|
+
|
|
124
|
+
| Scenario | Severity |
|
|
125
|
+
|----------|----------|
|
|
126
|
+
| Unbounded Promise.all | HIGH |
|
|
127
|
+
| Stream without backpressure | MEDIUM |
|
|
128
|
+
|
|
129
|
+
## Q1 · Anti-pattern Detection
|
|
130
|
+
|
|
131
|
+
**Checklist**:
|
|
132
|
+
- No overly long functions (> 60 lines)
|
|
133
|
+
- No deep nesting (> 4 levels)
|
|
134
|
+
- No magic numbers
|
|
135
|
+
- No duplicated code blocks (3+ times)
|
|
136
|
+
|
|
137
|
+
| Scenario | Severity |
|
|
138
|
+
|----------|----------|
|
|
139
|
+
| Overly long functions / deep nesting | MEDIUM |
|
|
140
|
+
| Magic numbers | LOW |
|
|
141
|
+
|
|
142
|
+
## On-demand References
|
|
143
|
+
|
|
144
|
+
For business-type-specific checks (e-commerce, payment, lottery, etc.), see `references/business-analyzer.md`.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Business Analyzer — 业务特性分析参考
|
|
2
|
+
|
|
3
|
+
> 本文件由主 Skill Stage 1 引用。定义了业务类型识别规则和业务特性检查点映射。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 业务类型识别规则
|
|
8
|
+
|
|
9
|
+
### 1. 依赖特征映射
|
|
10
|
+
|
|
11
|
+
通过 package.json 中的依赖组合来推断业务类型。不要只看单个依赖,要看组合:
|
|
12
|
+
|
|
13
|
+
| 依赖组合 | 推断业务类型 | 置信度 |
|
|
14
|
+
|----------|-------------|--------|
|
|
15
|
+
| stripe/paypal + cart/order 路由 | 电商系统 | 高 |
|
|
16
|
+
| stripe/paypal(无 cart 路由) | 支付/订阅系统 | 中 |
|
|
17
|
+
| socket.io/ws + message/chat 路由 | 即时通讯 | 高 |
|
|
18
|
+
| next + prisma + 大量 CRUD 路由 | CMS / 内容管理 | 中 |
|
|
19
|
+
| bull/bullmq + 任务相关模型 | 任务队列系统 | 中 |
|
|
20
|
+
| multer/sharp + upload 路由 | 文件/媒体管理 | 中 |
|
|
21
|
+
| cron/node-cron + 无前端路由 | 后台定时任务 | 中 |
|
|
22
|
+
|
|
23
|
+
如果依赖组合无法明确判定,结合路由端点和数据模型综合判断。
|
|
24
|
+
|
|
25
|
+
### 2. 路由模式识别
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 执行这些命令来识别路由模式
|
|
29
|
+
grep -rn "\.get\|\.post\|\.put\|\.delete\|router\." --include="*.ts" --include="*.js" <repoPath>/src/ | head -150
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
关键路由关键词与业务类型映射:
|
|
33
|
+
|
|
34
|
+
| 路由关键词 | 业务类型 |
|
|
35
|
+
|-----------|---------|
|
|
36
|
+
| `/product` `/cart` `/order` `/inventory` `/catalog` | 电商 |
|
|
37
|
+
| `/lottery` `/draw` `/prize` `/raffle` `/spin` | 抽奖/活动 |
|
|
38
|
+
| `/pay` `/checkout` `/subscription` `/invoice` `/billing` | 支付 |
|
|
39
|
+
| `/chat` `/message` `/conversation` `/room` `/channel` | 即时通讯 |
|
|
40
|
+
| `/post` `/article` `/page` `/content` `/blog` | CMS/内容管理 |
|
|
41
|
+
| `/task` `/job` `/queue` `/worker` | 任务系统 |
|
|
42
|
+
| `/upload` `/media` `/file` `/image` `/asset` | 文件管理 |
|
|
43
|
+
| `/admin` `/dashboard` `/analytics` `/report` | 后台管理 |
|
|
44
|
+
| `/auth` `/login` `/register` `/user` `/profile` | 用户系统(通常是子模块) |
|
|
45
|
+
|
|
46
|
+
### 3. 数据模型辅助判定
|
|
47
|
+
|
|
48
|
+
模型名称是强信号:
|
|
49
|
+
|
|
50
|
+
| 模型名称 | 指向 |
|
|
51
|
+
|---------|------|
|
|
52
|
+
| Product, Category, Cart, CartItem, Order, OrderItem | 电商 |
|
|
53
|
+
| Prize, LotteryRecord, DrawResult, Winner | 抽奖 |
|
|
54
|
+
| Payment, Transaction, Subscription, Invoice | 支付 |
|
|
55
|
+
| Message, Conversation, ChatRoom, Participant | 即时通讯 |
|
|
56
|
+
| Post, Article, Page, Comment, Tag | CMS |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 业务特性检查点清单
|
|
61
|
+
|
|
62
|
+
识别出业务类型后,根据以下映射生成检查点。每个检查点有唯一 ID、名称、描述、严重等级和具体检查方法。
|
|
63
|
+
|
|
64
|
+
### 电商系统检查点
|
|
65
|
+
|
|
66
|
+
| ID | 检查点 | 严重等级 | 检查方法 |
|
|
67
|
+
|----|--------|---------|---------|
|
|
68
|
+
| BIZ-EC-001 | 超卖防护 | CRITICAL | 查找库存扣减逻辑,确认是否使用原子操作(如 `UPDATE ... SET stock = stock - 1 WHERE stock > 0`)或 ORM 的 `increment/decrement`。如果是先 `findOne` 再 `save`,且无 `version` 字段或 `FOR UPDATE` 锁,则判定为风险 |
|
|
69
|
+
| BIZ-EC-002 | 订单状态机完整性 | HIGH | 检查订单是否有明确的状态流转(pending→paid→shipped→completed),是否有非法状态跳转的防护 |
|
|
70
|
+
| BIZ-EC-003 | 价格篡改防护 | CRITICAL | 检查下单时价格是否从服务端重新查询,而非信任前端传入的价格 |
|
|
71
|
+
| BIZ-EC-004 | 库存回滚 | HIGH | 支付失败或订单取消时,库存是否有回滚机制 |
|
|
72
|
+
|
|
73
|
+
### 支付系统检查点
|
|
74
|
+
|
|
75
|
+
| ID | 检查点 | 严重等级 | 检查方法 |
|
|
76
|
+
|----|--------|---------|---------|
|
|
77
|
+
| BIZ-PAY-001 | 支付幂等性 | CRITICAL | 在支付创建的 handler 中查找 idempotencyKey / requestId / 幂等标识。Stripe 调用检查是否传了 `idempotencyKey` 参数 |
|
|
78
|
+
| BIZ-PAY-002 | 金额精度 | HIGH | 检查金额计算是否使用整数(分为单位)或 Decimal 库,而非浮点数运算 |
|
|
79
|
+
| BIZ-PAY-003 | Webhook 签名验证 | CRITICAL | 支付回调(如 Stripe webhook)是否验证签名(`stripe.webhooks.constructEvent`),防止伪造回调 |
|
|
80
|
+
| BIZ-PAY-004 | 敏感信息脱敏 | HIGH | 支付相关日志中是否泄露完整卡号、CVV 等信息 |
|
|
81
|
+
|
|
82
|
+
### 抽奖/活动系统检查点
|
|
83
|
+
|
|
84
|
+
| ID | 检查点 | 严重等级 | 检查方法 |
|
|
85
|
+
|----|--------|---------|---------|
|
|
86
|
+
| BIZ-LT-001 | 随机算法安全性 | CRITICAL | 查找抽奖核心逻辑中的随机函数。如果使用 `Math.random()`,判定为 CRITICAL(应使用 `crypto.randomInt()` 或 `crypto.randomBytes()`) |
|
|
87
|
+
| BIZ-LT-002 | 抽奖频率限制 | HIGH | 检查抽奖接口是否有频率限制(rate limiter),防止脚本刷奖 |
|
|
88
|
+
| BIZ-LT-003 | 概率配置可审计 | HIGH | 奖品概率是否有配置化管理和修改日志,而非硬编码 |
|
|
89
|
+
| BIZ-LT-004 | 奖品库存原子扣减 | CRITICAL | 奖品发放是否有库存扣减的原子保障(与超卖防护同理) |
|
|
90
|
+
| BIZ-LT-005 | 抽奖审计日志 | HIGH | 每次抽奖结果是否记录包含 userId、timestamp、奖品、随机种子的审计日志 |
|
|
91
|
+
|
|
92
|
+
### 即时通讯系统检查点
|
|
93
|
+
|
|
94
|
+
| ID | 检查点 | 严重等级 | 检查方法 |
|
|
95
|
+
|----|--------|---------|---------|
|
|
96
|
+
| BIZ-IM-001 | WebSocket 连接数限制 | HIGH | 检查是否限制单用户最大连接数,防止资源耗尽 |
|
|
97
|
+
| BIZ-IM-002 | 心跳与死连接清理 | HIGH | 是否有 ping/pong 心跳机制,是否定时清理未响应连接 |
|
|
98
|
+
| BIZ-IM-003 | 消息大小限制 | MEDIUM | 是否限制单条消息体积(`maxPayload`),防止大消息攻击 |
|
|
99
|
+
| BIZ-IM-004 | 消息持久化 | MEDIUM | 离线消息是否有持久化和补推机制 |
|
|
100
|
+
|
|
101
|
+
### 高流量场景检查点(适用于所有高并发业务)
|
|
102
|
+
|
|
103
|
+
| ID | 检查点 | 严重等级 | 检查方法 |
|
|
104
|
+
|----|--------|---------|---------|
|
|
105
|
+
| BIZ-HT-001 | 连接池配置 | CRITICAL | 数据库连接池是否有显式配置(非默认值)。对于 Prisma 检查 `connection_limit`,对于原生驱动检查 `max` 参数 |
|
|
106
|
+
| BIZ-HT-002 | API 限流 | HIGH | 是否有全局或关键路由级别的 rate limiter(express-rate-limit / 自定义中间件) |
|
|
107
|
+
| BIZ-HT-003 | 缓存 TTL | HIGH | Redis/缓存的 SET 操作是否都设置了过期时间,避免缓存永不失效 |
|
|
108
|
+
| BIZ-HT-004 | 缓存穿透防护 | MEDIUM | 不存在的 key 是否有空值缓存或布隆过滤器防护 |
|
|
109
|
+
|
|
110
|
+
### 高并发读写检查点
|
|
111
|
+
|
|
112
|
+
| ID | 检查点 | 严重等级 | 检查方法 |
|
|
113
|
+
|----|--------|---------|---------|
|
|
114
|
+
| BIZ-CR-001 | 乐观锁/悲观锁 | CRITICAL | 涉及读-修改-写模式的操作(如余额变更、库存扣减)是否有版本号或行锁保护。查找 `findOne` 后紧跟 `save/update` 且无 `version`/`@Version`/`FOR UPDATE` 的模式 |
|
|
115
|
+
| BIZ-CR-002 | 原子操作 | CRITICAL | 数值增减(如 `count += 1` 后 `save()`)是否使用 DB 原子操作(`increment`/`decrement`/`UPDATE SET x = x + 1`) |
|
|
116
|
+
| BIZ-CR-003 | 分布式锁 | HIGH | 跨进程的关键操作是否有分布式锁(如 Redis `SETNX`) |
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 扩展口设计
|
|
121
|
+
|
|
122
|
+
业务检查点是可扩展的。将来新增业务类型时,按以下格式追加到上面的清单中:
|
|
123
|
+
|
|
124
|
+
```markdown
|
|
125
|
+
### [新业务类型] 检查点
|
|
126
|
+
|
|
127
|
+
| ID | 检查点 | 严重等级 | 检查方法 |
|
|
128
|
+
|----|--------|---------|---------|
|
|
129
|
+
| BIZ-XX-001 | [检查点名称] | [CRITICAL/HIGH/MEDIUM/LOW] | [具体检查方法描述] |
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
ID 命名规则:`BIZ-{业务缩写}-{三位序号}`
|
|
133
|
+
|
|
134
|
+
预留的业务类型(暂未定义检查点,待后续补充):
|
|
135
|
+
- 金融合规(BIZ-FIN-*)
|
|
136
|
+
- GDPR 数据合规(BIZ-GDPR-*)
|
|
137
|
+
- 多租户隔离(BIZ-MT-*)
|
|
138
|
+
- 搜索引擎(BIZ-SE-*)
|
|
139
|
+
- IoT 数据采集(BIZ-IOT-*)
|