@mingfuyun/star-allinone 0.4.5 → 0.4.7

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/README.md CHANGED
@@ -33,7 +33,8 @@ pnpm add @mingfuyun/star-allinone
33
33
  AGENTS.md ← 常驻约定,不要加 .cursor/rules
34
34
  .agents/skills/
35
35
  ├── shared-* ← npm 包同步,不能在业务项目直接改
36
- └── custom-* ← 业务项目自己维护
36
+ ├── custom-entry/ ← 可选:唯一对话入口 + references/project-rules.md
37
+ └── custom-* ← 其他业务特例(项目自己维护)
37
38
  ```
38
39
 
39
40
  完整约定见 [skills/README.md](skills/README.md)。
@@ -91,7 +92,7 @@ StarLink 示例见 `examples/projects/`。
91
92
  pnpm exec star-allinone skills sync
92
93
  ```
93
94
 
94
- 4. 把真正的业务特例放到 `.agents/skills/custom-*`。审查、提交、发布、单接口、页面生成不要做成 `custom-*`。全量契约重建(若需要)必须 `disable-model-invocation`,并在 `AGENTS.md` 写清命令。
95
+ 4. 领域规则放 `.agents/skills/custom-entry/references/`。可用 `custom-entry` 做唯一对话编排入口(内部委托 `shared-*`)。不要再拆第二套审查/提交/发布/单接口/页面入口。全量契约重建(若需要)必须 `disable-model-invocation`,并在 `AGENTS.md` 写清命令。
95
96
 
96
97
  5. 仓库根放 `AGENTS.md`(可从包内 `examples/AGENTS.md` 复制)。`skills sync` 只在该文件缺失时补一份,不会覆盖已有内容。常驻约定只写这一份,不要加 `.cursor/rules`。
97
98
 
@@ -128,7 +129,7 @@ git commit -m "chore(skill): 接入公共 skill"
128
129
  使用 $shared-tracking,为本项目接入埋点并全站补齐按钮埋点。
129
130
  ```
130
131
 
131
- 公共流程用 `shared-*`,项目专属规则用 `custom-*`。`custom-*` 不能再实现一遍 Service/页面生成/审查。全量契约重建若需要,写成不可调用的脚本,并在 `AGENTS.md` 写命令。业务定制需要复用公共流程时,读取对应的 `.agents/skills/shared-*/SKILL.md`,不要再抛一个入口。
132
+ 公共流程用 `shared-*`;领域规则优先 `custom-entry/references/`。`custom-entry` 只编排、不复制 shared 正文。全量契约重建若需要,写成不可调用的脚本,并在 `AGENTS.md` 写命令。
132
133
 
133
134
  ### 业务项目:更新公共 skill
134
135
 
@@ -174,7 +175,7 @@ import { CustomDrawer, HocModal } from '@mingfuyun/star-allinone';
174
175
  **1. 安装能力包并同步 Skill**
175
176
 
176
177
  ```bash
177
- pnpm add @mingfuyun/star-allinone@^0.4.5
178
+ pnpm add @mingfuyun/star-allinone@^0.4.6
178
179
  pnpm exec star-allinone skills sync
179
180
  ```
180
181
 
@@ -198,7 +199,7 @@ pnpm exec star-allinone skills sync
198
199
  | 加载 SDK | 在 Umi `headScripts` 插入 OSS 内联脚本 |
199
200
  | 应用初始化 | 改 `src/app.tsx`:`markTrackingReady`、`syncTrackingRoute` |
200
201
  | 接口失败上报 | 改 `src/services/request.tsx`:失败时 `reportApiTracking` |
201
- | 全站按钮埋点 | 扫描页面,补齐五类按钮以及 **带 `onClick` 的 `a` / `div` / `span` 等** |
202
+ | 全站按钮埋点 | 扫描页面,补齐按钮、**带 `onClick` 的元素**、**Tabs 页签**、**下载 `href`** |
202
203
  | 验证 | 跑 `pnpm typecheck`;必要时说明浏览器验收项 |
203
204
 
204
205
  非默认 import 路径时,Agent 可读 `.star-allinone.json` 的 `trackingModule`(如 `@/utils/tracking`)。
@@ -235,8 +236,10 @@ pnpm exec star-allinone skills sync
235
236
  | 4 | 表单提交/重置 | `ProForm` submitter、`Form` 按钮 |
236
237
  | 5 | 复制 | 操作列、工具栏、「复制 IP」等 |
237
238
  | 6 | 带 `onClick` 的元素 | `a`、`div`、`span`、`Typography.Link`、可点击卡片 |
239
+ | 7 | Tabs / 分段切换 | `Tabs` / `Segmented` 每个页签 `label` |
240
+ | 8 | 文件下载 | `<a href>` 带 `download` 或文件 URL,**无 `onClick` 也要报** |
238
241
 
239
- **不上报:** 列设置、表格「更多」省略号 icon(菜单内各项仍要 track)、无权限未渲染的按钮、**没有** `onClick` 的纯展示节点。
242
+ **不上报:** 列设置、表格「更多」省略号 icon(菜单内各项仍要 track)、无权限未渲染的按钮、**没有** `onClick` 且**不是下载**的纯展示 / 纯外链。
240
243
 
241
244
  ### 按钮写法速查
242
245
 
@@ -262,6 +265,20 @@ track: getTrackData('edit', '编辑', { key: 'action', name: '操作' })
262
265
  >
263
266
  {record.name}
264
267
  </a>
268
+
269
+ // Tabs 页签
270
+ <span data-track={getTrackData('switch_tab', '列表', { key: 'tabs', name: '页签' })}>
271
+ 列表
272
+ </span>
273
+
274
+ // 文件下载(无 onClick 也要 data-track)
275
+ <a
276
+ href={fileUrl}
277
+ download
278
+ data-track={getTrackData('download', '下载', { key: 'file', name: '导出' })}
279
+ >
280
+ 下载
281
+ </a>
265
282
  ```
266
283
 
267
284
  点击由 SDK 监听 `data-track`,**不要在** `onClick` 里再调 `track()`。
@@ -1,6 +1,6 @@
1
1
  # Agent instructions
2
2
 
3
- This is a Umi Max + Ant Design 5 PC admin app. Shared skills live in `.agents/skills/shared-*` and are synced from `@mingfuyun/star-allinone`. Do not edit `shared-*`. Put project-only rules in `.agents/skills/custom-*` or `.agents/project/`.
3
+ This is a Umi Max + Ant Design 5 PC admin app. Shared skills live in `.agents/skills/shared-*` and are synced from `@mingfuyun/star-allinone`. Do not edit `shared-*`. Put project-only rules in `.agents/skills/custom-entry/references/` (preferred) or legacy `.agents/project/`.
4
4
 
5
5
  Always-on instructions are this file. Do not add `.cursor/rules`.
6
6
 
@@ -36,4 +36,4 @@ User-facing shared entries only:
36
36
  - After TypeScript changes run `pnpm typecheck`.
37
37
  - Do not treat `pnpm test` as unit tests unless that script actually runs a test runner.
38
38
  - Heavy modules (`xlsx`, editors, charts) must be `import()`. Do not add them to `src/app.ts`.
39
- - If `.agents/project/conventions.md` or `.agents/project/review-rules.md` exists, apply them as additions only.
39
+ - Prefer `.agents/skills/custom-entry/references/{project-rules,conventions}.md`; else legacy `.agents/project/{review-rules,conventions}.md`. Apply as additions only.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mingfuyun/star-allinone",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "星系运维前端能力包",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/skills/README.md CHANGED
@@ -18,21 +18,31 @@ business-app/
18
18
  │ ├── shared-publish-test/
19
19
  │ ├── shared-project-conventions/ ← 无 SKILL.md,给入口读
20
20
  │ ├── shared-i-have-adhd/ ← 无 SKILL.md,给入口读
21
- │ └── custom-* ← 仅真正的业务特例
22
- └── project/
23
- ├── conventions.md
24
- ├── review-rules.md
21
+ │ ├── custom-entry/ ← 可选:唯一对话编排入口 + 领域规则正文
22
+ │ │ └── references/
23
+ │ │ ├── project-rules.md
24
+ │ │ └── conventions.md
25
+ │ └── custom-* ← 其他业务特例(如全量 swagger,勿再拆对外入口)
26
+ └── project/ ← legacy;openapi 等仍可放这里
25
27
  └── openapi.json
26
28
  ```
27
29
 
28
30
  命名约定:
29
31
 
30
32
  ```text
31
- shared-* 公共内容,由 star-allinone 提供,经 CLI 同步后提交到业务仓库
32
- custom-* 业务定制,由业务项目维护;禁止做成第二套页面/审查/单接口生成入口
33
+ shared-* 公共内容,由 star-allinone 提供,经 CLI 同步后提交到业务仓库
34
+ custom-entry 可选唯一对话入口;领域规则正文在其 references/
35
+ custom-* 其他业务定制;禁止再做成第二套页面/审查/单接口生成入口
33
36
  ```
34
37
 
35
- Cursor / Codex 的常驻说明只放仓库根 `AGENTS.md`(模板见 `examples/AGENTS.md`)。项目差异放 `.agents/project/`。不要新增 `.cursor/rules`。
38
+ 项目 overlay 探测顺序(存在则应用,只补充不削弱硬规则):
39
+
40
+ ```text
41
+ review-rules: custom-entry/references/project-rules.md → legacy .agents/project/review-rules.md
42
+ conventions: custom-entry/references/conventions.md → legacy .agents/project/conventions.md
43
+ ```
44
+
45
+ Cursor / Codex 的常驻说明只放仓库根 `AGENTS.md`(模板见 `examples/AGENTS.md`)。不要新增 `.cursor/rules`。
36
46
 
37
47
  ## npm 包的职责
38
48
 
@@ -55,7 +65,7 @@ Cursor / Codex 的常驻说明只放仓库根 `AGENTS.md`(模板见 `examples/
55
65
 
56
66
  接入或升级后跑 `pnpm exec star-allinone doctor`。
57
67
 
58
- 业务项目的 `.agents/project/` 只写差异:路径、权限体系、OpenAPI 位置、领域特例。项目文件可以补充,但不能削弱公共硬规则。
68
+ 领域差异优先写 `.agents/skills/custom-entry/references/`。`.agents/project/` 仍可放 OpenAPI 路径等 legacy 文件。项目文件可以补充,但不能削弱公共硬规则。
59
69
 
60
70
  CLI 只做同步:
61
71
 
@@ -95,13 +105,15 @@ git commit -m "chore(skill): 更新公共 skill"
95
105
 
96
106
  ## 新增或修改业务定制
97
107
 
98
- `custom-*` 只用于真正的业务特例:领域不变量、全量契约脚本、度量。审查、提交、测发、单接口、页面生成都走公共入口。
108
+ 推荐用 `custom-entry` 做 **唯一对话编排入口**:先读本仓 `references/project-rules.md`(与可选 `conventions.md`),再 **Read 并执行** 对应 `shared-*`,不要复制 shared 正文。
109
+
110
+ 其他 `custom-*` 只用于真正的业务特例:领域不变量、全量契约脚本、度量。不要再做成第二套审查/提交/测发/单接口/页面入口。
99
111
 
100
112
  全量契约重建若必须留在 custom:加上 `disable-model-invocation: true`,在 `AGENTS.md` 写清要跑的命令,不要作为用户入口。度量类 custom 不得生成代码。
101
113
 
102
114
  ## 公共部分和业务定制组合
103
115
 
104
- 业务定制需要复用公共流程时,在 `custom-*` 里 **读取** 对应入口的 `SKILL.md`,不要再做一个可 `$` 调用的生成入口。领域规则示例见 `examples/skills/custom-domain-invariants/`。
116
+ `custom-entry`(或其他 `custom-*`)复用公共流程时,**读取** 对应入口的 `SKILL.md` 并原样执行确认门。领域规则示例见 `examples/skills/custom-domain-invariants/`。
105
117
 
106
118
  ## 项目配置
107
119
 
@@ -127,7 +139,7 @@ git commit -m "chore(skill): 更新公共 skill"
127
139
  | `shared-design-to-page` | 页面:标准列表内部 `gen page`,其余按设计稿实现 |
128
140
  | `shared-review-and-submit` | 审查并提交 |
129
141
  | `shared-publish-test` | 测发 |
130
- | `shared-tracking` | 埋点接入与全站可点击补齐(含 onClick 的 a/div/span) |
142
+ | `shared-tracking` | 埋点接入(含 onClick、Tabs、下载 href) |
131
143
 
132
144
  ## 公共规则写在哪里
133
145
 
@@ -137,7 +149,7 @@ git commit -m "chore(skill): 更新公共 skill"
137
149
  | `shared-design-to-page` | SKILL + `page-conventions.md`、`overlays.md`、`list-page-template.md`、`tracking.md` | 页面分层、标准列表 CLI、弹层合同、按钮埋点 |
138
150
  | `shared-review-and-submit` | SKILL + `impact-analysis.md`、`verify.md`、`ai-review.md`、`commit.md` | 影响分析 → 验证(含埋点完整性)→ 确认后提交 |
139
151
  | `shared-publish-test` | SKILL + `scripts/publish-current-branch.sh` | 云效测发;只读 `publishPipelineId` |
140
- | `shared-tracking` | [SKILL.md](./shared/tracking/SKILL.md) | 埋点接入:业务接入、五类按钮、带 onClick 的 a/div/span |
152
+ | `shared-tracking` | [SKILL.md](./shared/tracking/SKILL.md) | 埋点接入:按钮、onClick、Tabs 切换、下载 href |
141
153
  | (非入口)`shared-project-conventions` | `architecture.md`、`mfprotable.md`、`component-contract.md`、`review-checklist.md`(含埋点审查)、`quality-checklist.md` | 架构、导入合同、质量清单 |
142
154
  | (非入口)`shared-i-have-adhd` | `i-have-adhd.md` | 用户输出格式 |
143
155
 
@@ -1,6 +1,6 @@
1
1
  # Service Conventions
2
2
 
3
- Read `.star-allinone.json` first. `serviceDir` defaults to `src/services`. Overlay extra domain paths only when `.agents/project/conventions.md` exists.
3
+ Read `.star-allinone.json` first. `serviceDir` defaults to `src/services`. Prefer `.agents/skills/custom-entry/references/conventions.md`; else legacy `.agents/project/conventions.md`. Overlay extra domain paths only when that file exists.
4
4
 
5
5
  ## Layout
6
6
 
@@ -17,7 +17,7 @@ Before implementation, read:
17
17
  4. `.agents/skills/shared-project-conventions/references/architecture.md`
18
18
  5. [references/tracking.md](references/tracking.md) when `src/utils/tracking/index.ts` exists (or the project tracking path in conventions)
19
19
 
20
- If `.agents/project/conventions.md` exists, use it only for extra paths.
20
+ Prefer `.agents/skills/custom-entry/references/conventions.md`; else legacy `.agents/project/conventions.md`. If either exists, use it only for extra paths.
21
21
 
22
22
  Inspect the nearest existing page of the same type before proposing files.
23
23
 
@@ -52,7 +52,7 @@ Add `--permission-create`, `--permission-edit`, `--permission-delete` when codes
52
52
  3. The CLI fills columns and drawer fields from the OpenAPI schema (required, enum → `ProFormSelect`, dates/numbers). Review labels and permission codes; do not recreate the file tree. See [references/list-page-template.md](references/list-page-template.md).
53
53
  4. If `src/components/Page/Container/config.tsx` exists, `gen page` writes a Container `index.tsx`, puts the table in `components/List.tsx`, and registers a Tab with `loader: () => import(...)`. Do not invent a second page shell.
54
54
  5. Do not overwrite existing page files. Tell the user the CLI refused, then edit in place.
55
- 6. **Tracking:** When the project has tracking configured, `gen page` auto-wires default button tracking. Agent must scan and wire **all** in-scope clickables per [references/tracking.md](references/tracking.md) and `$shared-tracking` (permission, drawer/modal footers, action column, ProForm, copy, **`onClick` on `a` / `div` / `span`**)—do not leave manual steps for the user. If tracking is not set up yet, tell the user to run `$shared-tracking` first; do not invent a second tracking helper.
55
+ 6. **Tracking:** When the project has tracking configured, `gen page` auto-wires default button tracking. Agent must scan and wire **all** in-scope clickables per [references/tracking.md](references/tracking.md) and `$shared-tracking` (permission, drawer/modal footers, action column, ProForm, copy, **`onClick` on `a` / `div` / `span`**, **Tabs labels**, **download `href`**)—do not leave manual steps for the user. If tracking is not set up yet, tell the user to run `$shared-tracking` first; do not invent a second tracking helper.
56
56
 
57
57
  ## Design path
58
58
 
@@ -65,7 +65,7 @@ For non-standard layouts:
65
65
  5. API-backed pages include types, `MFRequest` methods, aggregate exports, and page consumption in the same change. Use `.agents/skills/shared-api-to-service/SKILL.md` for missing services. Use `.agents/skills/shared-api-to-service/references/mock.md` for extra mock scenarios. Do not embed production fake data.
66
66
  6. Compare desktop and narrow layouts against the design. Fix structure and spacing before decoration.
67
67
  7. Run focused verification. Do not claim visual fidelity without inspecting the rendered page.
68
- 8. When tracking is enabled, Agent applies [references/tracking.md](references/tracking.md) for every toolbar, action, copy, drawer, confirm, form submit, standalone permission button, and **`onClick` on `a` / `div` / `span` / links**.
68
+ 8. When tracking is enabled, Agent applies [references/tracking.md](references/tracking.md) for every toolbar, action, copy, drawer, confirm, form submit, standalone permission button, **`onClick` on `a` / `div` / `span` / links**, **Tabs / Segmented**, and **download `href`**.
69
69
 
70
70
  ## Hard rules
71
71
 
@@ -79,7 +79,7 @@ For non-standard layouts:
79
79
  - Do not use `Modal.confirm` or feature-level Ant Design `Modal` / `Drawer` shells.
80
80
  - Do not add a UI library, state library, or CSS-in-JS system without approval.
81
81
  - Do not refactor unrelated code.
82
- - When `src/utils/tracking/index.ts` exists, Agent wires `getTrackData` on every control covered by [references/tracking.md](references/tracking.md), including copy and **any `onClick` on `a` / `div` / `span` / links**. Do not call `track()` in handlers. Do not ask the user to add tracks manually.
82
+ - When `src/utils/tracking/index.ts` exists, Agent wires `getTrackData` on every control covered by [references/tracking.md](references/tracking.md), including copy, **any `onClick` on `a` / `div` / `span` / links**, **Tabs**, and **download `href`**. Do not call `track()` in handlers. Do not ask the user to add tracks manually.
83
83
 
84
84
  ## Verification
85
85
 
@@ -90,7 +90,7 @@ pnpm typecheck
90
90
 
91
91
  Run `pnpm lint` for broad or shared changes. Run the project's documented build command when routes, entry, or multiple pages change.
92
92
 
93
- When tracking is configured, scan changed page files: toolbar `track`, action `track`, copy `track`, drawer `cancelTrack` / `okTrack` or custom-footer `data-track`, confirm modal buttons, ProForm submitters, standalone permission buttons, and **`onClick` on `a` / `div` / `span` / `Typography.Link`**. Agent fixes missing wiring before calling the page done; do not defer to the user.
93
+ When tracking is configured, scan changed page files: toolbar `track`, action `track`, copy `track`, drawer `cancelTrack` / `okTrack` or custom-footer `data-track`, confirm modal buttons, ProForm submitters, standalone permission buttons, **`onClick` on `a` / `div` / `span` / `Typography.Link`**, **Tabs / Segmented labels**, and **download `href`**. Agent fixes missing wiring before calling the page done; do not defer to the user.
94
94
 
95
95
  ## User-facing output
96
96
 
@@ -1,6 +1,6 @@
1
1
  # Page Conventions
2
2
 
3
- Read `.star-allinone.json` first. Use extra component paths or permission helpers from `.agents/project/conventions.md` only when that file exists.
3
+ Read `.star-allinone.json` first. Prefer `.agents/skills/custom-entry/references/conventions.md`; else legacy `.agents/project/conventions.md`. Use extra component paths or permission helpers only when that file exists.
4
4
 
5
5
  ## Stack and locations
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Apply when the business project already has `src/utils/tracking/index.ts` (or the path documented in project conventions). Full SDK setup and **Agent 全站批量补齐规则** live in `.agents/skills/shared-tracking/SKILL.md`. This file covers **page / 生成场景**。
4
4
 
5
- **Agent 规则:** 生成或修改页面时,由 Agent 写入全部可点击埋点,**不要**留给用户手工补。与「接入埋点」同一套扫描标准:五类按钮 + **任何带 `onClick` 的元素**(`a`、`div`、`span`、`Typography.Link` 等)。
5
+ **Agent 规则:** 生成或修改页面时,由 Agent 写入全部可点击埋点,**不要**留给用户手工补。与「接入埋点」同一套扫描标准:标准按钮 + **任何带 `onClick` 的元素** + **Tabs 切换** + **下载 `href`**。
6
6
 
7
7
  Import:
8
8
 
@@ -25,6 +25,8 @@ Click reporting uses `data-track` JSON from `getTrackData`. Do not call `track()
25
25
  | Confirm dialog | `BaseModal` | custom footer + `data-track` when button props unavailable |
26
26
  | Inline form submit | `ProForm` / `Form` | `submitButtonProps` / `resetButtonProps` |
27
27
  | Clickable `a` / `div` / `span` / `Typography.Link` | any node with `onClick` | `data-track={getTrackData(...)}` on **that** node |
28
+ | Tabs / Segmented | `Tabs` `items[].label`, `Segmented` options | wrap label with `data-track` (`switch_tab`) |
29
+ | File download `<a href>` | `download` attr, file URL, 下载 text | `data-track` on the `<a>` even without `onClick` |
28
30
 
29
31
  `MFProTable` query and reset are handled inside the table (`filter_query` / `查询`, `filter_reset` / `重置`). Do not duplicate in page code.
30
32
 
@@ -50,18 +52,22 @@ Every business `Button` in custom `footer` needs `data-track`. Do not replace th
50
52
  - Column settings only.
51
53
  - Table overflow 「更多」 ellipsis icon (menu items inside still need `track`).
52
54
  - Buttons hidden by permission (no render → no track).
53
- - Nodes with **no** `onClick` (plain text, static `href` links).
55
+ - Nodes with **no** `onClick` **except file-download `<a href>`** (plain text, non-download static `href`).
54
56
 
55
57
  **Copy buttons must be tracked** — see shared-tracking §5.
56
58
 
57
- **Any `onClick` node must be tracked** — see shared-tracking §6 (`a`, `div`, `span`, `Typography.Link`, clickable cards).
59
+ **Any `onClick` node must be tracked** — see shared-tracking §6.
60
+
61
+ **Tabs `onChange` / tab labels must be tracked** — see shared-tracking §7.
62
+
63
+ **Download `<a href>` must be tracked even without `onClick`** — see shared-tracking §8.
58
64
 
59
65
  ## After `gen page`
60
66
 
61
- When `src/utils/tracking/index.ts` exists, `gen page` wires toolbar, action edit/delete, drawer, and modal by default. Agent still reviews and adds tracking for extra buttons (copy, batch, custom footer, ProForm) and **every `onClick` on `a` / `div` / `span` / links**. Pass `--no-tracking` only when user explicitly asks.
67
+ When `src/utils/tracking/index.ts` exists, `gen page` wires toolbar, action edit/delete, drawer, and modal by default. Agent still reviews and adds tracking for extra buttons (copy, batch, custom footer, ProForm), **every `onClick` on `a` / `div` / `span` / links**, **Tabs labels**, and **download `href`**. Pass `--no-tracking` only when user explicitly asks.
62
68
 
63
69
  For pages **not** from `gen page`, Agent scans and wires the full set per shared-tracking — not a user manual task.
64
70
 
65
71
  ## Verification
66
72
 
67
- Static scan changed files: every toolbar / action / copy / drawer / modal / form button, plus every `onClick` on `a` / `div` / `span` / `Typography.Link`, has `track`, `cancelTrack`, `okTrack`, or `data-track`.
73
+ Static scan changed files: every toolbar / action / copy / drawer / modal / form button, every `onClick` on `a` / `div` / `span` / `Typography.Link`, **Tabs / Segmented labels**, and **download `href`**, has `track`, `cancelTrack`, `okTrack`, or `data-track`.
@@ -1,6 +1,6 @@
1
1
  # Review Checklist
2
2
 
3
- This checklist is complete for shared review and commit. If `.agents/project/review-rules.md` exists, apply extra domain checks only; do not weaken the rules below.
3
+ This checklist is complete for shared review and commit. Prefer `.agents/skills/custom-entry/references/project-rules.md`; else legacy `.agents/project/review-rules.md`. If either exists, apply extra domain checks only; do not weaken the rules below.
4
4
 
5
5
  ## Permissions
6
6
 
@@ -34,10 +34,12 @@ Apply when the project has `src/utils/tracking/index.ts` (or the path in project
34
34
  - Action column entries need `track` beside `permission` when present.
35
35
  - Standalone permission buttons need `data-track={getTrackData(...)}`.
36
36
  - Clickable `a` / `div` / `span` / `Typography.Link` with `onClick` need `data-track` on **that** node.
37
+ - `Tabs` / `Segmented` / `Radio.Group` page labels need `data-track` on each tab (see shared-tracking §7).
38
+ - File-download `<a href>` (`download` attribute, file URL, 下载) need `data-track` even without `onClick`.
37
39
  - `CustomDrawer` with the default footer needs `cancelTrack` and `okTrack`; custom footers need `data-track` on each business button.
38
40
  - `BaseModal` confirm dialogs need `cancelButtonProps` / `okButtonProps` with `'data-track'`.
39
41
  - `ProForm` with a visible default submitter needs submit/reset button props; when `submitter={false}`, tracking belongs on the overlay footer only.
40
- - Require tracking on copy actions and **any node with `onClick`** (`a`, `div`, `span`, `Typography.Link`, clickable cards). Do not require tracking on column settings, table overflow ellipsis icon, buttons hidden by permission, or nodes without `onClick`.
42
+ - Require tracking on copy actions, **any node with `onClick`**, **Tabs / Segmented switches**, and **download `<a href>`**. Do not require tracking on column settings, table overflow ellipsis icon, buttons hidden by permission, or non-download nodes without `onClick`.
41
43
  - Missing in-scope button tracking on a changed page is **P1**.
42
44
 
43
45
  ## Shared components and regression
@@ -9,7 +9,7 @@ User-facing entry for review, submit, and commit. Read the files under `referenc
9
9
 
10
10
  This is the unified pre-submit entry and is fully shared. Do not mutate Git until the user confirms the exact reviewed scope.
11
11
 
12
- If `.agents/project/review-rules.md` exists, apply extra domain checks only; do not weaken shared hard rules.
12
+ Prefer `.agents/skills/custom-entry/references/project-rules.md`; else legacy `.agents/project/review-rules.md`. If either exists, apply extra domain checks only; do not weaken shared hard rules.
13
13
 
14
14
  ## Workflow
15
15
 
@@ -32,7 +32,7 @@ Follow [references/verify.md](references/verify.md). Output:
32
32
  - P0/P1/P2 blockers
33
33
  - Completeness of route, permission, API, types, mock, page states, and click tracking when the project has tracking configured
34
34
  - Async, loading, overlay, and list-reload behavior
35
- - Missing `track` / `data-track` / `cancelTrack` / `okTrack` on in-scope clickables (buttons, copy, **`onClick` on `a` / `div` / `span`**) per `shared-tracking` (P1 when tracking is enabled)
35
+ - Missing `track` / `data-track` / `cancelTrack` / `okTrack` on in-scope clickables (buttons, copy, **`onClick` on `a` / `div` / `span`**, **Tabs**, **download `href`**) per `shared-tracking` (P1 when tracking is enabled)
36
36
  - Prettier, TypeScript, lint, and build results
37
37
  - Uncovered risks
38
38
 
@@ -8,14 +8,14 @@ Review the current diff plus relevant callers and types. Before reviewing, read:
8
8
  2. `.agents/skills/shared-project-conventions/references/quality-checklist.md`
9
9
  3. `.agents/skills/shared-tracking/SKILL.md` and `.agents/skills/shared-design-to-page/references/tracking.md` when the project has tracking configured
10
10
 
11
- If `.agents/project/review-rules.md` exists, apply extra domain checks only; do not weaken shared hard rules.
11
+ Prefer `.agents/skills/custom-entry/references/project-rules.md`; else legacy `.agents/project/review-rules.md`. If either exists, apply extra domain checks only; do not weaken shared hard rules.
12
12
 
13
13
  ## Required checks
14
14
 
15
15
  1. React Hooks: stale closures, incomplete dependencies, request races, updates after unmount, unnecessary rerenders.
16
16
  2. API contracts: method/path/params, response unwrapping, pagination, nullability, enum drift, error handling, DTO mismatch.
17
17
  3. Permissions: route access, button visibility, mutation authorization, client-only enforcement.
18
- 4. **Tracking** (when `src/utils/tracking/index.ts` or project equivalent exists): scan changed pages for missing `track` / `cancelTrack` / `okTrack` / `data-track` on in-scope buttons—toolbar, action column, permission buttons, drawer and confirm footers (default and custom), inline form submitters, **copy** actions, and **any `onClick` on `a` / `div` / `span` / `Typography.Link`**. Flag missing wiring as **P1**. Do not require tracking on column settings, table overflow ellipsis icon, permission-hidden buttons, or nodes without `onClick`. Do not flag handlers that call `track()` when `data-track` is the project standard.
18
+ 4. **Tracking** (when `src/utils/tracking/index.ts` or project equivalent exists): scan changed pages for missing `track` / `cancelTrack` / `okTrack` / `data-track` on in-scope clickables—toolbar, action column, permission buttons, drawer and confirm footers, inline form submitters, **copy**, **any `onClick` on `a` / `div` / `span` / `Typography.Link`**, **Tabs / Segmented labels**, and **download `<a href>`**. Flag missing wiring as **P1**. Do not require tracking on column settings, table overflow ellipsis icon, permission-hidden buttons, or non-download nodes without `onClick`. Do not flag handlers that call `track()` when `data-track` is the project standard.
19
19
  5. Forms/tables: validation, reset, duplicate submit, refresh after mutation, column-state, long text, empty/error.
20
20
  6. Performance (hard checks):
21
21
  - New or changed files must not statically `import 'xlsx'`, `@uiw/react-codemirror`, `@codemirror/*`, `echarts`, `@ant-design/charts`, or `react-json-view` at module top level. Those must be `import()`.
@@ -26,7 +26,7 @@ Read:
26
26
  3. `.agents/skills/shared-project-conventions/references/architecture.md`
27
27
  4. [ai-review.md](ai-review.md)
28
28
 
29
- If `.agents/project/review-rules.md` exists, apply extra domain checks only; do not weaken shared hard rules.
29
+ Prefer `.agents/skills/custom-entry/references/project-rules.md`; else legacy `.agents/project/review-rules.md`. If either exists, apply extra domain checks only; do not weaken shared hard rules.
30
30
 
31
31
  Classify only concrete security, data-loss, runtime, contract, validation, performance, accessibility, or maintainability risks as P0–P2.
32
32
 
@@ -11,7 +11,7 @@ Step 1 of `shared-review-and-submit`. Do not modify files.
11
11
  5. Classify impact: direct callers, indirect pages, API/permission contracts, build/release risk.
12
12
  6. Give a minimal automated and manual regression path for each item. An import is not proof of runtime impact.
13
13
 
14
- Read `.agents/skills/shared-project-conventions/references/review-checklist.md` for shared files that must be expanded. If `.agents/project/review-rules.md` exists, also expand any extra domain files it names.
14
+ Read `.agents/skills/shared-project-conventions/references/review-checklist.md` for shared files that must be expanded. Prefer `.agents/skills/custom-entry/references/project-rules.md`; else legacy `.agents/project/review-rules.md`. If either exists, also expand any extra domain files it names.
15
15
 
16
16
  ## Output
17
17
 
@@ -8,7 +8,7 @@ Read the current diff, related callers, and:
8
8
  2. `.agents/skills/shared-project-conventions/references/architecture.md`
9
9
  3. `.agents/skills/shared-tracking/SKILL.md` when the project has `src/utils/tracking/index.ts` (or the tracking path in project conventions)
10
10
 
11
- Do not auto-fix. If `.agents/project/review-rules.md` exists, apply extra domain checks only.
11
+ Do not auto-fix. Prefer `.agents/skills/custom-entry/references/project-rules.md`; else legacy `.agents/project/review-rules.md`. If either exists, apply extra domain checks only.
12
12
 
13
13
  ## Checks
14
14
 
@@ -19,7 +19,7 @@ Do not auto-fix. If `.agents/project/review-rules.md` exists, apply extra domain
19
19
  5. Empty table values, duplicate-submit guards, permission wrappers, and narrow-screen overflow.
20
20
  6. Heavy deps (`xlsx`, editors, charts) are `import()`; nothing new lands in `src/app.ts`.
21
21
  7. No `MFTablePro` / table-from-package imports; overlays come from `@mingfuyun/star-allinone`.
22
- 8. **Tracking** (when tracking is configured): every in-scope clickable has `track`, `cancelTrack`, `okTrack`, or `data-track` per `.agents/skills/shared-tracking/SKILL.md` and `.agents/skills/shared-design-to-page/references/tracking.md`. Check toolbar items, action column entries, standalone permission buttons, drawer default or custom footers, confirm modals, inline `ProForm` submitters, **copy** buttons, and **`onClick` on `a` / `div` / `span` / `Typography.Link`**. Missing wiring is **P1** when the control is user-visible and in scope. Excluded controls (column settings, table overflow ellipsis icon, nodes without `onClick`) must not be flagged. Permission-hidden buttons may omit tracking.
22
+ 8. **Tracking** (when tracking is configured): every in-scope clickable has `track`, `cancelTrack`, `okTrack`, or `data-track` per `.agents/skills/shared-tracking/SKILL.md` and `.agents/skills/shared-design-to-page/references/tracking.md`. Check toolbar items, action column entries, standalone permission buttons, drawer default or custom footers, confirm modals, inline `ProForm` submitters, **copy** buttons, **`onClick` on `a` / `div` / `span` / `Typography.Link`**, **Tabs / Segmented labels**, and **download `<a href>`**. Missing wiring is **P1** when the control is user-visible and in scope. Excluded controls (column settings, table overflow ellipsis icon, non-download nodes without `onClick`) must not be flagged. Permission-hidden buttons may omit tracking.
23
23
 
24
24
  ## Commands
25
25
 
@@ -16,7 +16,7 @@ description: User-facing. Connect a galaxy admin app to the shared tracking SDK.
16
16
  完成标准:
17
17
 
18
18
  1. 基础设施(SDK、`tracking/index.ts`、`app.tsx`、请求封装)已就绪。
19
- 2. **全站**带用户点击意图的控件均已带 `track` / `cancelTrack` / `okTrack` / `data-track`(无权限未渲染的除外)。覆盖五类标准按钮,以及 **任何写了 `onClick` / `onClickCapture` 的元素**(`a`、`div`、`span`、`Typography.Link` 等)。
19
+ 2. **全站**带用户点击意图的控件均已带 `track` / `cancelTrack` / `okTrack` / `data-track`(无权限未渲染的除外)。覆盖标准按钮、**带 `onClick` 的元素**、**Tabs / 分段器切换**、以及 **文件下载 `<a href>`**。
20
20
  3. `pnpm typecheck` 通过。
21
21
  4. 向用户汇报已覆盖的文件范围,而不是留 TODO 让用户自己改。
22
22
 
@@ -30,8 +30,10 @@ description: User-facing. Connect a galaxy admin app to the shared tracking SDK.
30
30
  | 4 | **ProForm / Form** | `submitter` 默认栏、`submitter.render`、antd `Form` 提交/重置 | `submitButtonProps` / `resetButtonProps` 的 `data-track` |
31
31
  | 5 | **复制相关按钮** | 文案含「复制」「一键复制」、`key` 含 `copy`;含复制 IP | `getTrackData('copy', '…', …)` |
32
32
  | 6 | **任意带 `onClick` 的可点击元素** | `onClick` / `onClickCapture` 写在 `a`、`div`、`span`、`p`、`li`、`Typography.Link`、`Typography.Text`、antd `Link` 等上 | 该节点加 `data-track={getTrackData(...)}`。不要只给外层容器埋点而漏掉真正被点的子节点 |
33
+ | 7 | **Tabs / 分段切换** | antd `Tabs`、`Segmented`、`Radio.Group`、业务 Tab 容器的 `onChange` | 每个页签 `label` 包一层带 `data-track` 的节点;不要只写 `onChange` 不埋点 |
34
+ | 8 | **文件下载链接** | `<a href>` 带 `download`、文件 URL、blob、文案含「下载」 | 该 `<a>` 加 `data-track`,**即使没有 `onClick`** |
33
35
 
34
- 硬规则:**只要业务代码给节点绑了点击回调,该节点就要上报。** 不限 `Button`。链接、可点击文字、卡片区域、状态标签、图标容器都算。
36
+ 硬规则:**只要业务代码给节点绑了点击回调,该节点就要上报。** 不限 `Button`。链接、可点击文字、卡片区域、状态标签、图标容器都算。**Tab 切换和文件下载链接同样必须上报。**
35
37
 
36
38
  另需覆盖(同属 Agent 批量任务):
37
39
 
@@ -48,10 +50,12 @@ rg "withAuth|AccessButton" src/pages -g "*.tsx"
48
50
  rg "ProForm|submitter" src/pages -g "*.tsx"
49
51
  rg "复制|copy|Copy" src/pages src/components -g "*.tsx"
50
52
  rg "onClick(Capture)?=" src/pages src/components -g "*.tsx"
53
+ rg "<Tabs|<Segmented|Radio.Group" src/pages src/components -g "*.tsx"
54
+ rg "download=|href=.+\.(xlsx|xls|csv|zip|pdf|png|jpg)|下载" src/pages src/components -g "*.tsx"
51
55
  rg "<a |<div |<span " src/pages -g "*.tsx"
52
56
  ```
53
57
 
54
- 对每个命中文件:**打开、判断是否在范围内、补全、保存**。带 `onClick` 的 `a`/`div`/`span` 与 Button 同一标准。历史页与 `gen page` 新页同一标准。
58
+ 对每个命中文件:**打开、判断是否在范围内、补全、保存**。带 `onClick` 的 `a`/`div`/`span`、Tabs 页签、下载 `href` 与 Button 同一标准。历史页与 `gen page` 新页同一标准。
55
59
 
56
60
  ### 不要做的「半套接入」
57
61
 
@@ -60,8 +64,10 @@ rg "<a |<div |<span " src/pages -g "*.tsx"
60
64
  - ❌ 在组件层做 track 自动推断(不改 `withAuth` / `TableActions` 自动生成 track)
61
65
  - ❌ 把复制按钮排除在补齐范围外
62
66
  - ❌ 只给 `Button` 加埋点,漏掉带 `onClick` 的 `a` / `div` / `span` / `Typography.Link`
67
+ - ❌ 漏掉 `Tabs` / `Segmented` 切换
68
+ - ❌ 漏掉带 `href` 的文件下载 `<a>`(没有 `onClick` 也要报)
63
69
 
64
- 仍不上报:**列设置**、表格 **「更多」省略号**(仅展开菜单的 icon;菜单内各项仍要 track)、纯展示且**没有** `onClick` 的节点。
70
+ 仍不上报:**列设置**、表格 **「更多」省略号**(仅展开菜单的 icon;菜单内各项仍要 track)、纯展示且**没有** `onClick` 的节点(**文件下载 `href` 除外**)、无下载意图的纯外链 `href`。
65
71
 
66
72
  ---
67
73
 
@@ -303,7 +309,91 @@ track: getTrackData('copy', '复制IP', { key: 'toolbar', name: '群看板' })
303
309
 
304
310
  `onClick` 写在包裹组件上时,把 `data-track` 也写在同一组件。子节点没有独立点击时不要重复上报。
305
311
 
306
- 路由跳转用 `history.push` / `navigate` 且绑了 `onClick` 的,同样要 `data-track`。纯 `href`、没有 `onClick` 的外链可以不上报。
312
+ 路由跳转用 `history.push` / `navigate` 且绑了 `onClick` 的,同样要 `data-track`。无下载意图、纯 `href`、没有 `onClick` 的外链可以不上报。**文件下载见第 8 节,必须上报。**
313
+
314
+ #### 7. Tabs / 分段器 `onChange`
315
+
316
+ antd `Tabs`、`Segmented`、`Radio.Group` 以及业务页签容器,切换时必须上报。优先在**每个页签的可点击文案**上写 `data-track`(SDK 监听点击,不要在 `onChange` 里再调 `track()`)。`items` 里 `label` 若是纯字符串,改成带 `data-track` 的节点。
317
+
318
+ ```tsx
319
+ <Tabs
320
+ items={[
321
+ {
322
+ key: 'list',
323
+ label: (
324
+ <span
325
+ data-track={getTrackData('switch_tab', '列表', { key: 'tabs', name: '页签' })}
326
+ >
327
+ 列表
328
+ </span>
329
+ ),
330
+ },
331
+ {
332
+ key: 'detail',
333
+ label: (
334
+ <span
335
+ data-track={getTrackData('switch_tab', '详情', { key: 'tabs', name: '页签' })}
336
+ >
337
+ 详情
338
+ </span>
339
+ ),
340
+ },
341
+ ]}
342
+ onChange={handleTabChange}
343
+ />
344
+ ```
345
+
346
+ ```tsx
347
+ <Segmented
348
+ options={[
349
+ {
350
+ label: (
351
+ <span data-track={getTrackData('switch_tab', '日', { key: 'tabs', name: '时间' })}>
352
+ 日
353
+ </span>
354
+ ),
355
+ value: 'day',
356
+ },
357
+ {
358
+ label: (
359
+ <span data-track={getTrackData('switch_tab', '周', { key: 'tabs', name: '时间' })}>
360
+ 周
361
+ </span>
362
+ ),
363
+ value: 'week',
364
+ },
365
+ ]}
366
+ onChange={handleRangeChange}
367
+ />
368
+ ```
369
+
370
+ `action` 用 `switch_tab`(或项目已有惯例)。`name` 用页签文案。不要只给 `Tabs` 根节点加一个 `data-track`。
371
+
372
+ #### 8. 文件下载 `<a href>`
373
+
374
+ 下载文件的 `<a>` **即使没有 `onClick` 也要上报**。识别:`download` 属性、href 指向文件(xlsx/xls/csv/zip/pdf/png 等)、blob URL、文案含「下载」。
375
+
376
+ ```tsx
377
+ <a
378
+ href={fileUrl}
379
+ download
380
+ data-track={getTrackData('download', '下载', { key: 'file', name: '导出' })}
381
+ >
382
+ 下载
383
+ </a>
384
+ ```
385
+
386
+ ```tsx
387
+ <Typography.Link
388
+ href={record.file_url}
389
+ target="_blank"
390
+ data-track={getTrackData('download', '下载附件', { key: 'cell', name: '附件' })}
391
+ >
392
+ {record.file_name}
393
+ </Typography.Link>
394
+ ```
395
+
396
+ 点击由 SDK 监听 `data-track`。不要为了埋点去掉 `href` 改成纯 `onClick` 除非业务本来就走接口下载。接口下载按钮按第 1 / 6 节写 `data-track` 或 `track`。
307
397
 
308
398
  ## 不要做的事
309
399
 
@@ -322,6 +412,6 @@ track: getTrackData('copy', '复制IP', { key: 'toolbar', name: '群看板' })
322
412
  1. 页面请求了 OSS 上的脚本,并且出现 `window.TrackingSDK`。
323
413
  2. 进入业务页、初始状态完成后存在 `window.__tracker`。`/` 上可以还没有。
324
414
  3. 一次失败请求发出事件名 `api_request`。
325
- 4. 五类标准按钮(含复制),以及带 `onClick` 的 `a` / `div` / `span` / `Typography.Link` 等,带 `data-track` / `cancelTrack` / `okTrack`。
415
+ 4. 标准按钮(含复制)、带 `onClick` 的 `a` / `div` / `span`、**Tabs 页签**、**下载 `href`** 带 `data-track` / `cancelTrack` / `okTrack`。
326
416
 
327
417
  `appId` 与平台不一致时,只改 `src/utils/tracking/index.ts`。