ui-ux-next-kit 0.0.0-stage → 0.0.1

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.
Files changed (35) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +161 -2
  3. package/SKILL.md +115 -0
  4. package/bin/cli.js +196 -0
  5. package/examples/admin-home/MASTER.md +36 -0
  6. package/examples/admin-home/dashboard.html +127 -0
  7. package/examples/admin-home/pages/dashboard.md +12 -0
  8. package/examples/admin-home/tokens.css +52 -0
  9. package/examples/admin-home/tokens.json +44 -0
  10. package/examples/site-home/MASTER.md +42 -0
  11. package/examples/site-home/home.html +222 -0
  12. package/examples/site-home/pages/home.md +13 -0
  13. package/examples/site-home/tokens.css +60 -0
  14. package/examples/site-home/tokens.json +48 -0
  15. package/package.json +39 -4
  16. package/references/audit-dimensions.md +60 -0
  17. package/references/exemplar-deploy.md +72 -0
  18. package/references/exemplar-rpa-architecture.md +38 -0
  19. package/references/exemplar-rpa-console.md +120 -0
  20. package/references/figma-handoff.md +36 -0
  21. package/references/public-components.md +950 -0
  22. package/references/rules-sediment.md +15 -0
  23. package/references/tech-stacks.md +48 -0
  24. package/scripts/check-globals.sh +37 -0
  25. package/scripts/check-tokens.sh +42 -0
  26. package/scripts/lib.sh +13 -0
  27. package/scripts/run-all.sh +7 -0
  28. package/skill.json +16 -0
  29. package/templates/cursor-rules/figma-handoff.mdc +21 -0
  30. package/templates/cursor-rules/frontend-stack.mdc +97 -0
  31. package/templates/fix-prompts/P-A-tokens.md +23 -0
  32. package/templates/fix-prompts/P-D-states.md +24 -0
  33. package/templates/fix-prompts/P-H-globals.md +21 -0
  34. package/templates/fix-prompts/base.md +26 -0
  35. package/templates/report-template.md +67 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 UI/UX Next Kit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,162 @@
1
- # Temporary Holding Version
1
+ # ui-ux-next-kit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Cursor Agent Skill。同事打开本文件。Cursor 读 `SKILL.md`。写界面时的尺寸、文案、顺序和时长以 `references/public-components.md` 为准。
4
+
5
+ ## 先看这里
6
+
7
+ | 谁 | 先打开 |
8
+ | --- | --- |
9
+ | 同事 | 本文件这一节 |
10
+ | Cursor | `SKILL.md`(放到 `.cursor/skills/ui-ux-next-kit` 后,说到还原或审计就会读) |
11
+ | 写某一页 | `references/public-components.md` 里那一节和它的验收清单 |
12
+
13
+ 在要写界面的项目根目录安装:
14
+
15
+ ```bash
16
+ npm install ui-ux-next-kit
17
+ ```
18
+
19
+ 安装后,技能挂在 `.cursor/skills/ui-ux-next-kit`,两条规则挂在 `.cursor/rules/`。规范改版后发布新版本,业务项目执行 `npm update ui-ux-next-kit` 即可。所有项目共用时:
20
+
21
+ ```bash
22
+ npm install -g ui-ux-next-kit
23
+ ```
24
+
25
+ 全局安装只挂技能到 `~/.cursor/skills/`。项目规则仍随各项目的 `npm install` 写入。
26
+
27
+ 还原一页时对 Agent 说:
28
+
29
+ ```text
30
+ 按 ui-ux-next-kit 还原这一页。先读 references/public-components.md 里对应的节,再读该节验收清单。
31
+ 解剖表里的每一块都要出现。同一处写了多件事要一起做。
32
+ 组件默认值不要盖过契约里的数字。对不上就改实现,不要改契约。
33
+ 交卷时每条验收写「做到了」或「做不到」,做不到要写出缺的那个数字。
34
+ UI、UX 规范未尽事宜,严格按照 antd 的规范实现。
35
+ ```
36
+
37
+ 只审计、不改代码:「按 ui-ux-next-kit 做一次 UI/UX 审计」。报告写在目标项目根目录,文件名 `YYYYMMDD-[项目名]UI-UX审计报告.md`。
38
+
39
+ 演示:
40
+
41
+ ```bash
42
+ cd demo/console && pnpm install && pnpm dev
43
+ ```
44
+
45
+ 打开 `http://127.0.0.1:5174/#/login`。账号密码任意非空,验证码看图片上的字符。演示里的产品名是「管理控制台」,字标是「UI」。
46
+
47
+ 演示里这两处还没对齐,不要当成契约:API 执行记录的「详情」没有 760px 抽屉,运行日志也没有 960px 那只;数据统计「口径说明」里仍写着「没测」。
48
+
49
+ ## 发布和应用
50
+
51
+ Cursor 读的仍是 `SKILL.md`。npm 包负责把这份目录挂进项目,并让后续版本能被 `npm update` 拉下来。包里有契约、脚本、规则和示例。`demo/` 留在 Git 仓库,不进 npm 包。
52
+
53
+ 业务项目:
54
+
55
+ ```bash
56
+ npm install ui-ux-next-kit
57
+ npm update ui-ux-next-kit
58
+ ```
59
+
60
+ 发版时把 `package.json` 和 `skill.json` 的版本一起加一档,再执行 `npm publish`。两条规则是软链。要改某一条时,先删掉软链再放自己的文件,安装器看到普通文件就不会覆盖。
61
+
62
+ 没有 `package.json` 的项目仍可用公共安装器,从 GitHub 拉取:
63
+
64
+ ```bash
65
+ npx skills add zzl81cn/ui-ux-next-kit --skill ui-ux-next-kit --agent cursor
66
+ ```
67
+
68
+ 需要把版本钉死在某次提交时,继续用 Git 标签加 submodule:
69
+
70
+ ```bash
71
+ git submodule add <git-url> .cursor/skills/ui-ux-next-kit
72
+ git -C .cursor/skills/ui-ux-next-kit checkout <tag>
73
+ mkdir -p .cursor/rules
74
+ cp .cursor/skills/ui-ux-next-kit/templates/cursor-rules/*.mdc .cursor/rules/
75
+ ```
76
+
77
+ 本机试用用软链,指到这份检出。升级时在 skill 仓库拉新标签,业务仓库更新 submodule 指针。压缩包只用于还没有 Git 的一次性传递,排除 `node_modules`、`dist`、`.DS_Store`。
78
+
79
+ 技能正文不写公司名、产品名和镜像仓库地址。范本产品名留在来源仓库。本套件的站名是「管理控制台」,字标是「UI」。
80
+
81
+ 把《UI/UX 审计套件》打包成开源、可一键安装的 **Agent Skill Kit**:对前端项目做只读 UI/UX 审计,在**项目根目录**落盘结构化报告,并输出可直接交给修复 Agent 的分组 Prompt。
82
+
83
+ **Kit** 表示这是可扩展的工程资产包——当前主能力是审计与修复分组;后续可在同一仓库下增加脚手架、DESIGN 对齐检查等 Skill,而不改品牌名。
84
+
85
+ 这样做不只是方便团队在多项目里复用同一套规则,也契合现代 **Agentic Engineering**(AI 辅助工程)的趋势——把审计基准、扫描脚本和防翻车修复 Prompt 沉淀成工程资产,而不是散落在对话里的一次性提示词。
86
+
87
+ 命名里的 **Next** 表示面向现代栈。落地范本是参考控制台(`apps/console`:React 19 + Ant Design 6 + ProLayout),不是每个新项目再选一套「也是 React」。灵感来自开源 Agent Skill 形态(如 [ui-ux-pro-max-skill](https://github.com/nextlevelbuilder/ui-ux-pro-max-skill)),但本仓库聚焦 **审计 → 报告 → 修复分组 → 规则沉淀**,而不是设计灵感库。本仓库是模板,规范里不写具体公司或产品名。
88
+
89
+ 曾用名 / 备选:`ui-ux-next-audit`(仍可作为触发别名)、`next-ui-governor`、`nextgen-ui-audit`、`ui-next-guard`。现统一为 **`ui-ux-next-kit`**。
90
+
91
+ ## 功能
92
+
93
+ - 对照范本 **参考控制台** 定档(已是这套 / 另一套完整库 / 无组件库)。版本与「不要原样抄」的部分见 `references/exemplar-rpa-console.md`
94
+ - A–I 维度扫描:Token、组件、布局、三态、表格表单、文案、a11y、框架陷阱、工程卡口
95
+ - 可选静态扫描脚本(硬编码色、内联 style、`.ant-*` 覆盖、`z-index` 等)
96
+ - 报告落盘:`YYYYMMDD-[项目名]UI-UX审计报告.md`
97
+ - 分组修复 Prompt(防翻车底线:不改数据流、不重写整文件、不碰范围外页面)
98
+
99
+ ## 工作流
100
+
101
+ Agent 读入本 Skill 的 `SKILL.md` 后,按四步执行(用户只需说「做一次 UI/UX 审计」一类意图即可触发):
102
+
103
+ 1. **确立基准**:读 `package.json` 定技术栈档位,对照 `references/tech-stacks.md` 和 `references/exemplar-rpa-console.md`(范本:参考控制台),检查全局 Token / 统一 Layout。
104
+ 2. **只读审计**:跑 `scripts/` 或用 `rg` / Grep,按 `references/audit-dimensions.md` 扫 Token、原生控件混用、异步三态、全局 `.ant-*` 污染与 `z-index` 等。
105
+ 3. **结构化报告**:严格按 `templates/report-template.md` 输出,划分 High / Medium / Low,并给出置信度;报告落在**被审计项目根目录**。
106
+ 4. **拆解修复分组 (P1–Pn)**:按「能一起改、能一起验」打包独立修复 Prompt,套用 `templates/fix-prompts/` 中的防翻车底线。
107
+
108
+ ## 目录
109
+
110
+ 标准开源 Skill 布局(可发布到 GitHub,经 Git Submodule、软链或复制到 `.cursor/skills` 一键加载):
111
+
112
+ ```text
113
+ ui-ux-next-kit/ # 仓库目录(Skill 名:ui-ux-next-kit)
114
+ ├── SKILL.md # 核心引导与指令(Agent 识别的主协议)
115
+ ├── skill.json
116
+ ├── README.md # 给人看的安装与使用说明
117
+ ├── LICENSE # MIT
118
+ ├── references/ # 运行时参考基准
119
+ │ ├── tech-stacks.md # 组织推荐栈与档位映射
120
+ │ ├── exemplar-rpa-console.md # 参考控制台范本与不要原样抄的部分
121
+ │ ├── exemplar-rpa-architecture.md # 可选:同仓、前后端分离
122
+ │ ├── exemplar-deploy.md # 默认发版:Jenkins 构建,Docker 上线
123
+ │ ├── public-components.md # 界面契约(筛选、满高表、部门树、登录、看板、壳、设置、详情、手机壳)
124
+ │ ├── figma-handoff.md # Figma 若是 Arco:手绘规格 + antd v6,不硬套
125
+ │ ├── audit-dimensions.md # A–I 维度判定与红线
126
+ │ └── rules-sediment.md # 规则沉淀说明
127
+ ├── demo/
128
+ │ └── console/ # 按规范跑起来的前端演示(本地 mock,不带公司名)
129
+ ├── scripts/ # 静态检索引擎
130
+ │ ├── check-tokens.sh # 硬编码色、内联 style 等
131
+ │ ├── check-globals.sh # 全局类名污染、z-index 等
132
+ │ ├── run-all.sh
133
+ │ └── lib.sh
134
+ └── templates/ # 强结构化输出
135
+ ├── report-template.md # 审计报告模板
136
+ ├── cursor-rules/ # 实施时复制到目标项目 .cursor/rules/
137
+ │ ├── frontend-stack.mdc # 框架版本与 antd 6 API(源自范本 console-antd-v6)
138
+ │ └── figma-handoff.mdc # 预防:Arco 不硬套,token 对齐,保留 antd 交互
139
+ └── fix-prompts/ # 分组修复 Prompt(含防翻车底线)
140
+ ├── base.md
141
+ ├── P-A-tokens.md
142
+ ├── P-D-states.md
143
+ └── P-H-globals.md
144
+ ```
145
+
146
+ 安装、还原和演示见上面「先看这里」。旧名 `ui-ux-next-audit` 仍可作为触发别名。
147
+
148
+ 手动扫描(在目标项目根):
149
+
150
+ ```bash
151
+ bash /path/to/ui-ux-next-kit/scripts/run-all.sh
152
+ ```
153
+
154
+ 正式发版不走上面这条开发命令。默认 Jenkins 构建 `demo/console` 的镜像,目标机用 `docker compose -f docker-compose.prod.yml` 拉起。任务脚本是 `demo/console/jenkins/Jenkinsfile`,说明在 `references/exemplar-deploy.md`。
155
+
156
+ ## 依赖
157
+
158
+ 扫描脚本需要 [ripgrep](https://github.com/BurntSushi/ripgrep)(`brew install ripgrep`)。Agent 也可用内置 Grep 工具代替脚本。
159
+
160
+ ## License
161
+
162
+ MIT · `0.1.0`
package/SKILL.md ADDED
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: ui-ux-next-kit
3
+ description: >-
4
+ UI/UX Next Kit. When restoring or building a page, read
5
+ references/public-components.md for that section and its checklist before
6
+ writing code. When auditing, stay read-only and write
7
+ YYYYMMDD-[project]UI-UX审计报告.md at the project root. Use when the user
8
+ asks to restore a page, follow the UI contract, audit UI/UX, check style
9
+ pollution, or run ui-ux-next-kit / ui-ux-next-audit / UI-UX审计套件.
10
+ ---
11
+
12
+ # UI/UX Next Kit
13
+
14
+ 还原界面时先读本节,再往下看审计。审计才是只读。
15
+
16
+ ## 还原界面
17
+
18
+ 用户要还原、对齐、实现某一页时:
19
+
20
+ 1. 先读 `references/public-components.md` 里对应的节,再读该节验收清单。尺寸、文案、顺序、时长以这份为准。
21
+ 2. 解剖表里的每一块都要出现。同一处写了多件事要一起做。
22
+ 3. 组件默认值不要盖过契约里的数字。对不上就改实现,不要改契约。
23
+ 4. 交卷时每条验收写「做到了」或「做不到」。做不到要写出缺的那个数字。
24
+ 5. 没写到的交互按 antd 6。
25
+ 6. `demo/` 里这两处还没对齐,不要当成契约:执行记录「详情」没有 760px 抽屉,运行日志没有 960px 那只;口径说明里仍写着「没测」。
26
+
27
+ 对前端项目做只读 UI/UX 审计时才走下面的流程:定基准 → 按 A–I 维度扫描 → 落盘结构化报告 → 拆修复分组 Prompt → 给出规则沉淀建议。
28
+
29
+ 本仓库是可扩展的 **Kit**(当前主 Skill 为审计);打包自《UI/UX 审计套件》。详细判定见 `references/`,扫描脚本见 `scripts/`,输出模板见 `templates/`。
30
+
31
+ ## 触发条件
32
+
33
+ 用户意图包含以下任一即可激活:
34
+
35
+ - 按契约还原或实现某一页
36
+ - 审计前端 UI / UX / 页面一致性
37
+ - 检查样式污染、硬编码色、`.ant-*` 全局覆盖
38
+ - 评估是否符合参考控制台的前端栈(React 19 + Ant Design 6 + ProLayout)
39
+ - 生成 UI 修复提示词 / 审计报告
40
+ - 提到 `ui-ux-next-kit`、`ui-ux-next-audit` 或「UI-UX审计套件」
41
+
42
+ ## 只读与落盘
43
+
44
+ 下面几条只约束审计。上面的「还原界面」要改目标项目的界面。
45
+
46
+ - 审计时**不改**产品代码、不提交、不开 PR、不安装依赖。
47
+ - 审计时**唯一允许写入**:目标根目录的 `YYYYMMDD-[项目名]UI-UX审计报告.md`。
48
+ - 有仓库 → 仓库根(与 `package.json` / `.git` 同级)
49
+ - 无仓库(仅 URL)→ 当前工作区根,报告开头注明「无仓库,报告落在工作区根目录」
50
+ - 不要把报告只留在对话里;不要写进 `src/`、`docs/` 或本 Skill 目录。
51
+ - 对话末尾只给**绝对路径** + 一两句摘要。
52
+
53
+ ## 工作流
54
+
55
+ ### 1. 确立基准
56
+
57
+ 1. 读 `package.json`、主题/Token 文件、公共组件目录、Layout、`.cursor/rules` / lint。
58
+ 2. 对照 `references/tech-stacks.md` 与 `references/exemplar-rpa-console.md` 划定三档之一。新项目以参考控制台为范本:框架版本看「要沿用的」,列表 / 筛选 / 空状态 / 动效看「已经验证、新项目要写成规范的」。仓库要不要前后端同仓,看 `references/exemplar-rpa-architecture.md`,那是可选项。发版默认 Jenkins 打 Docker 镜像,见 `references/exemplar-deploy.md`。规范正文不写具体公司或产品名。
59
+ 3. 有 Figma:用 MCP;`get_variable_defs` 传**具体帧** node-id,手机/PC 分开;空结果则 `get_design_context` 取色值,并写「设计稿未使用变量」。交付若是 Arco,按 `references/figma-handoff.md`:不要硬套成组件,代码仍是 antd v6,只取色、字号、间距、圆角做 token 对齐。
60
+ 4. 仅有线上地址:用 DOM 前缀 / 脚本 / 样式体积与选择器重合 / 同类控件类名套数归档;源码项标「未覆盖」。
61
+
62
+ 基准缺失或互相矛盾(两套主色、两套 Layout、两个 UI 库、有 Token 无组件层)本身就是发现,通常 ≥ Medium。
63
+
64
+ ### 2. 只读审计(A–I)
65
+
66
+ 按 `references/audit-dimensions.md` 逐维给出结论;没问题也写「查过未发现」。
67
+
68
+ 优先运行(在目标项目根目录):
69
+
70
+ ```bash
71
+ bash <skill-root>/scripts/run-all.sh
72
+ ```
73
+
74
+ 或分别运行 `check-tokens.sh`、`check-globals.sh`。脚本输出是**线索**,需人工复核后再写入报告。排除 Token 定义文件、第三方与构建产物。
75
+
76
+ 额外运行时检查(有浏览器或可点页面时):
77
+
78
+ - 同一屏数字能否加总、口径是否写明
79
+ - 空状态是否区分「没有数据」与「当前筛选为空」
80
+ - 筛选项是否覆盖列表里已出现的值
81
+ - 宽表第一屏是否包含决策所需列;仅靠颜色的状态有无图例
82
+
83
+ 用户要 Lighthouse 时另出一份只读报告,不改产品代码。一次必须带上性能、可访问性、最佳实践、SEO;当次还返回别的类别,一并写入。每类写总分和未通过项的名称、影响、地址。登录挡住时写明停在登录,不编分数。报告落在目标项目根目录:`YYYYMMDD-[项目名]控制台Lighthouse报告.md`。WCAG 清单是后期核对,不拿它当当前改动单。
84
+
85
+ ### 3. 输出报告
86
+
87
+ 严格按 `templates/report-template.md` 写完整 Markdown,并**落盘**。分级与置信度见 `references/audit-dimensions.md`。
88
+
89
+ ### 4. 修复分组 P1…Pn
90
+
91
+ 按「能一起改、能一起验」拆组。每组套用 `templates/fix-prompts/`:
92
+
93
+ - 通用底线:`base.md`(每个 Prompt 的「不要做」必须保留)
94
+ - Token:`P-A-tokens.md`
95
+ - 交互三态:`P-D-states.md`
96
+ - 全局污染 / 弹层:`P-H-globals.md`
97
+
98
+ 无仓库时 Prompt 里仓库路径与构建命令可留空,注明待补。
99
+
100
+ ### 5. 规则沉淀
101
+
102
+ 审计只把建议写进报告,不改目标项目的 `.cursor/rules`。
103
+
104
+ 实施新项目时,把两份规则都复制到目标仓库的 `.cursor/rules/`:
105
+
106
+ - `templates/cursor-rules/frontend-stack.mdc`:精确版本、antd 6 弃用 API、适配层、手机壳边界、分页。UI、UX 规范未尽事宜,严格按照 antd 的规范实现。源自范本 `console-antd-v6.mdc`。
107
+ - `templates/cursor-rules/figma-handoff.mdc`:预防把 Arco 硬套进代码。写界面或样式时拦住「按设计稿组件生成」和新增 `.ant-*` 覆盖。
108
+
109
+ 扫描脚本以范本 `scripts/verify-console-antd-v6.mts` 为底,改成扫本项目 `src`。`.ant-*` 覆盖用套件 `scripts/check-globals.sh` 当线索,命中后按 `references/figma-handoff.md` 分批收进 token。其余 High / Medium 约束见 `references/rules-sediment.md`。
110
+
111
+ ## 注意
112
+
113
+ - 不要把个人审美当发现;每条都要对照基准或分级标准。
114
+ - 同类问题合并,给数量与典型位置。
115
+ - 结尾声明:未修改产品代码、未提交、未开 PR;已写入报告文件 [绝对路径]。
package/bin/cli.js ADDED
@@ -0,0 +1,196 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("fs");
5
+ const os = require("os");
6
+ const path = require("path");
7
+
8
+ const pkgRoot = path.resolve(__dirname, "..");
9
+ const pkg = require("../package.json");
10
+ const skillName = "ui-ux-next-kit";
11
+ const ruleNames = ["frontend-stack.mdc", "figma-handoff.mdc"];
12
+ const copySkip = new Set(["node_modules", ".git", "demo", "dist", ".DS_Store"]);
13
+
14
+ function has(flag) {
15
+ return process.argv.includes(flag);
16
+ }
17
+
18
+ function lstatOrNull(target) {
19
+ try {
20
+ return fs.lstatSync(target);
21
+ } catch (error) {
22
+ if (error.code === "ENOENT") return null;
23
+ throw error;
24
+ }
25
+ }
26
+
27
+ function realOrNull(target) {
28
+ try {
29
+ return fs.realpathSync(target);
30
+ } catch (error) {
31
+ if (error.code === "ENOENT") return null;
32
+ throw error;
33
+ }
34
+ }
35
+
36
+ function insideNodeModules() {
37
+ return pkgRoot.split(path.sep).includes("node_modules");
38
+ }
39
+
40
+ function globalInstall() {
41
+ return has("--global") || process.env.npm_config_global === "true";
42
+ }
43
+
44
+ function projectRoot() {
45
+ if (globalInstall()) return null;
46
+ return process.env.npm_config_local_prefix || process.env.INIT_CWD || process.cwd();
47
+ }
48
+
49
+ function skillDest() {
50
+ if (globalInstall()) return path.join(os.homedir(), ".cursor", "skills", skillName);
51
+ return path.join(projectRoot(), ".cursor", "skills", skillName);
52
+ }
53
+
54
+ function samePath(left, right) {
55
+ if (!left || !right) return false;
56
+ return path.resolve(left) === path.resolve(right);
57
+ }
58
+
59
+ function copyTree(source, dest) {
60
+ fs.mkdirSync(dest, { recursive: true });
61
+ for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
62
+ if (copySkip.has(entry.name)) continue;
63
+ const from = path.join(source, entry.name);
64
+ const to = path.join(dest, entry.name);
65
+ if (entry.isDirectory()) copyTree(from, to);
66
+ else if (entry.isFile()) fs.copyFileSync(from, to);
67
+ }
68
+ fs.writeFileSync(
69
+ path.join(dest, ".kit-install.json"),
70
+ JSON.stringify({ name: skillName, version: pkg.version, mode: "copy" }, null, 2) + "\n",
71
+ );
72
+ }
73
+
74
+ function removeCopied(dest) {
75
+ const marker = path.join(dest, ".kit-install.json");
76
+ const stat = lstatOrNull(marker);
77
+ if (!stat || !stat.isFile()) return false;
78
+ const meta = JSON.parse(fs.readFileSync(marker, "utf8"));
79
+ if (meta.name !== skillName || meta.mode !== "copy") return false;
80
+ fs.rmSync(dest, { recursive: true, force: true });
81
+ return true;
82
+ }
83
+
84
+ function placeSkill(dest) {
85
+ const existing = lstatOrNull(dest);
86
+ if (existing && existing.isSymbolicLink()) {
87
+ if (samePath(realOrNull(dest), realOrNull(pkgRoot))) return "same";
88
+ fs.unlinkSync(dest);
89
+ } else if (existing && existing.isDirectory()) {
90
+ if (!removeCopied(dest)) return "busy";
91
+ } else if (existing) {
92
+ return "busy";
93
+ }
94
+
95
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
96
+ if (has("--copy")) {
97
+ copyTree(pkgRoot, dest);
98
+ return "copy";
99
+ }
100
+ try {
101
+ fs.symlinkSync(pkgRoot, dest, "dir");
102
+ return "link";
103
+ } catch (error) {
104
+ if (error.code !== "EPERM") throw error;
105
+ copyTree(pkgRoot, dest);
106
+ return "copy";
107
+ }
108
+ }
109
+
110
+ function placeRules(root) {
111
+ const rulesDir = path.join(root, ".cursor", "rules");
112
+ const placed = [];
113
+ const kept = [];
114
+ fs.mkdirSync(rulesDir, { recursive: true });
115
+ for (const name of ruleNames) {
116
+ const source = path.join(pkgRoot, "templates", "cursor-rules", name);
117
+ const dest = path.join(rulesDir, name);
118
+ if (!lstatOrNull(source)) continue;
119
+ const existing = lstatOrNull(dest);
120
+ if (existing && !existing.isSymbolicLink()) {
121
+ kept.push(name);
122
+ continue;
123
+ }
124
+ if (existing) fs.unlinkSync(dest);
125
+ fs.symlinkSync(source, dest, "file");
126
+ placed.push(name);
127
+ }
128
+ return { placed, kept };
129
+ }
130
+
131
+ function install() {
132
+ if (has("--from-postinstall") && !insideNodeModules() && process.env.npm_config_global !== "true") {
133
+ return;
134
+ }
135
+ const dest = skillDest();
136
+ const placed = placeSkill(dest);
137
+ if (placed === "busy") {
138
+ console.log(`ui-ux-next-kit:${dest} 已有一份目录,没有覆盖。`);
139
+ if (!has("--from-postinstall")) process.exitCode = 1;
140
+ return;
141
+ }
142
+ const root = projectRoot();
143
+ let rules = { placed: [], kept: [] };
144
+ if (root) rules = placeRules(root);
145
+ const how = placed === "copy" ? "已复制到" : "已挂到";
146
+ console.log(`ui-ux-next-kit ${pkg.version} ${how} ${dest}`);
147
+ if (rules.placed.length) console.log(`规则已挂到 .cursor/rules/${rules.placed.join("、.cursor/rules/")}`);
148
+ if (rules.kept.length) console.log(`已保留项目里的 ${rules.kept.join("、")},没有覆盖。`);
149
+ if (!root) console.log("全局安装只挂技能。项目规则随各项目的 npm install 写入。");
150
+ console.log("升级:npm update ui-ux-next-kit");
151
+ }
152
+
153
+ function unlinkIfOurs(dest) {
154
+ const existing = lstatOrNull(dest);
155
+ if (!existing) return false;
156
+ if (existing.isSymbolicLink()) {
157
+ if (!samePath(realOrNull(dest), pkgRoot)) return false;
158
+ fs.unlinkSync(dest);
159
+ return true;
160
+ }
161
+ if (existing.isDirectory()) return removeCopied(dest);
162
+ return false;
163
+ }
164
+
165
+ function uninstall() {
166
+ const dest = skillDest();
167
+ const removedSkill = unlinkIfOurs(dest);
168
+ const root = projectRoot();
169
+ const removedRules = [];
170
+ if (root) {
171
+ for (const name of ruleNames) {
172
+ const rulePath = path.join(root, ".cursor", "rules", name);
173
+ const existing = lstatOrNull(rulePath);
174
+ if (!existing || !existing.isSymbolicLink()) continue;
175
+ const current = realOrNull(rulePath);
176
+ if (!current || !current.includes(`${path.sep}templates${path.sep}cursor-rules${path.sep}`)) continue;
177
+ fs.unlinkSync(rulePath);
178
+ removedRules.push(name);
179
+ }
180
+ }
181
+ if (!removedSkill && removedRules.length === 0) {
182
+ console.log("没有找到本套件挂上的技能或规则。");
183
+ return;
184
+ }
185
+ if (removedSkill) console.log(`已卸下 ${dest}`);
186
+ if (removedRules.length) console.log(`已卸下规则 ${removedRules.join("、")}`);
187
+ }
188
+
189
+ const command = process.argv.slice(2).find((item) => !item.startsWith("--")) || "install";
190
+ if (command === "install") install();
191
+ else if (command === "uninstall") uninstall();
192
+ else {
193
+ console.log("用法:ui-ux-next-kit install [--global] [--copy]");
194
+ console.log(" ui-ux-next-kit uninstall [--global]");
195
+ process.exitCode = 1;
196
+ }
@@ -0,0 +1,36 @@
1
+ # 管理后台 · 抽出的设计系统
2
+
3
+ 来源:测试环境已登录后的「系统概况」。交互主色是 Ant Design 蓝,品牌橙只出现在 logo 和部分强调,不替代后台主按钮。
4
+
5
+ ```
6
+ +----------------------------------------------------------------------------------------+
7
+ | TARGET: 管理后台 / 系统概况 |
8
+ +----------------------------------------------------------------------------------------+
9
+ | |
10
+ | PATTERN: 左侧图标+菜单 + 顶栏 + 工作台 |
11
+ | 1. 侧栏 216,白底,当前项蓝底白字、圆角 12、高 40 |
12
+ | 2. 顶栏 56,白底,左右 24,面包屑 + 深色开关 / 账号 |
13
+ | 3. 页头壳圆角 16:标题 + 一句说明 |
14
+ | 4. 内容健康:分类柱 + 指标卡 |
15
+ | 5. 启用对比:四条斜纹进度 |
16
+ | 6. 活动 / 快捷入口 / 待办 |
17
+ | |
18
+ | COLORS: |
19
+ | Primary: #1677FF hover #4096FF active #0958D9 |
20
+ | Brand: #FF6A00 |
21
+ | Page: #F5F5F5 |
22
+ | Surface: #FFFFFF |
23
+ | Text: rgba(0,0,0,.88) |
24
+ | Bars: 产品 #FF6B1A / 楼层 #3D7EFF / Banner #8B5CF6 / 新闻 #1BBF75 |
25
+ | |
26
+ | TYPOGRAPHY: 系统中文栈,正文 14,区块标题 16/600,问候 22/700 |
27
+ | |
28
+ | RADIUS / ELEVATION: |
29
+ | 卡片 12,页壳 16,大圆角 20 |
30
+ | 顶栏阴影 0 1px 2px #0f172a0a, 0 8px 24px #0f172a0f |
31
+ | 侧栏阴影 4px 0 24px #0f172a0a |
32
+ | |
33
+ +----------------------------------------------------------------------------------------+
34
+ ```
35
+
36
+ Token:`tokens.css`、`tokens.json`。页面结构:`pages/dashboard.md`。静态页:`dashboard.html`。
@@ -0,0 +1,127 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>系统概况 · 抽出的布局</title>
7
+ <link rel="stylesheet" href="tokens.css" />
8
+ <style>
9
+ * { box-sizing: border-box; }
10
+ body {
11
+ margin: 0;
12
+ font-family: var(--font-sans);
13
+ font-size: var(--font-size-body);
14
+ color: var(--color-text);
15
+ background: var(--color-background);
16
+ }
17
+ .sider {
18
+ position: fixed;
19
+ inset: 0 auto 0 0;
20
+ width: var(--size-sider);
21
+ background: var(--color-surface);
22
+ box-shadow: var(--shadow-sider);
23
+ padding: 16px 12px;
24
+ }
25
+ .brand { display: flex; gap: 8px; align-items: center; height: 32px; margin-bottom: 16px; font-weight: 700; }
26
+ .mark {
27
+ width: 28px; height: 28px; border-radius: 8px;
28
+ background: var(--color-brand); color: #fff;
29
+ display: grid; place-items: center; font-size: 13px;
30
+ }
31
+ .menu { display: flex; flex-direction: column; gap: 4px; }
32
+ .menu a {
33
+ height: var(--size-menu-item);
34
+ border-radius: var(--radius-menu);
35
+ padding: 0 16px;
36
+ display: flex; align-items: center;
37
+ color: var(--color-text);
38
+ text-decoration: none;
39
+ }
40
+ .menu a.on { background: var(--color-primary); color: var(--color-on-primary); }
41
+ .main { margin-left: var(--size-sider); min-height: 100vh; }
42
+ .top {
43
+ height: var(--size-header);
44
+ background: var(--color-surface);
45
+ box-shadow: var(--shadow-header);
46
+ display: flex; align-items: center; justify-content: space-between;
47
+ padding: 0 var(--space-header-x);
48
+ }
49
+ .crumb { color: var(--color-text-secondary); }
50
+ .crumb b { color: var(--color-text); font-weight: 500; }
51
+ .page { padding: 16px var(--space-page) 32px; display: flex; flex-direction: column; gap: 16px; }
52
+ .shell, .panel {
53
+ background: var(--color-surface);
54
+ border-radius: var(--radius-shell);
55
+ box-shadow: var(--shadow-header);
56
+ }
57
+ .shell { padding: 16px 24px 20px; }
58
+ .shell h1 { margin: 0; font-size: 20px; }
59
+ .shell h1 span { margin-left: 8px; font-size: 14px; font-weight: 400; color: var(--color-text-secondary); }
60
+ .hello { margin: 18px 0 0; font-size: var(--font-size-hero); font-weight: var(--font-weight-hero); }
61
+ .sub { margin: 4px 0 0; color: var(--color-text-secondary); }
62
+ .grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 12px; margin-top: 16px; }
63
+ .card {
64
+ background: var(--color-background);
65
+ border-radius: var(--radius-card);
66
+ padding: 14px 16px;
67
+ min-height: 96px;
68
+ }
69
+ .card strong { display: block; font-size: 28px; line-height: 1.2; margin-top: 6px; }
70
+ .card small { color: var(--color-text-secondary); }
71
+ .panel { padding: 16px 20px 8px; }
72
+ .panel h2 { margin: 0 0 12px; font-size: var(--font-size-section); font-weight: var(--font-weight-section); }
73
+ .row { display: grid; grid-template-columns: 88px 1fr auto; gap: 12px; align-items: center; margin-bottom: 14px; }
74
+ .track { height: var(--size-bar); border-radius: var(--radius-pill); background: #f0f0f0; overflow: hidden; }
75
+ .fill { height: 100%; border-radius: inherit; }
76
+ .fill.product { width: 100%; background: repeating-linear-gradient(-45deg, var(--color-bar-product) 0 6px, #ff8a45 6px 12px); }
77
+ .fill.floor { width: 100%; background: repeating-linear-gradient(-45deg, var(--color-bar-floor) 0 6px, #6c9bff 6px 12px); }
78
+ .fill.banner { width: 100%; background: repeating-linear-gradient(-45deg, var(--color-bar-banner) 0 6px, #a78bfa 6px 12px); }
79
+ .fill.news { width: 100%; background: repeating-linear-gradient(-45deg, var(--color-bar-news) 0 6px, #45d392 6px 12px); }
80
+ .tabs { display: flex; gap: 20px; padding: 4px 4px 0; }
81
+ .tabs span { padding-bottom: 8px; color: var(--color-text-secondary); }
82
+ .tabs span.on { color: var(--color-primary); border-bottom: 2px solid var(--color-primary); }
83
+ </style>
84
+ </head>
85
+ <body>
86
+ <aside class="sider">
87
+ <div class="brand"><span class="mark">站</span> 官网CMS</div>
88
+ <nav class="menu">
89
+ <a class="on" href="#dash">系统概况</a>
90
+ <a href="#dash">内容管理</a>
91
+ <a href="#dash">联系询盘</a>
92
+ <a href="#dash">合规举报</a>
93
+ <a href="#dash">后台管理</a>
94
+ </nav>
95
+ </aside>
96
+ <div class="main">
97
+ <header class="top">
98
+ <div class="crumb">管理后台 / <b>系统概况</b></div>
99
+ <div>admin</div>
100
+ </header>
101
+ <div class="page">
102
+ <section class="shell">
103
+ <h1>系统概况 <span>内容健康与待办总览</span></h1>
104
+ <p class="hello">早上好,admin</p>
105
+ <p class="sub">内容管理工作台</p>
106
+ <div class="grid">
107
+ <article class="card"><small>分类内容</small><strong>14 · 10 · 11</strong></article>
108
+ <article class="card"><small>新闻</small><strong>75</strong><small>已发布 75/75</small></article>
109
+ <article class="card"><small>静态文章</small><strong>2</strong></article>
110
+ <article class="card"><small>媒体文件</small><strong>634</strong></article>
111
+ <article class="card"><small>门店</small><strong>144</strong></article>
112
+ <article class="card"><small>联系询盘</small><strong>0</strong></article>
113
+ <article class="card"><small>合规举报</small><strong>0</strong></article>
114
+ </div>
115
+ </section>
116
+ <section class="panel">
117
+ <h2>启用对比</h2>
118
+ <div class="row"><span>产品启用</span><div class="track"><div class="fill product"></div></div><b>107/107</b></div>
119
+ <div class="row"><span>楼层启用</span><div class="track"><div class="fill floor"></div></div><b>80/80</b></div>
120
+ <div class="row"><span>Banner 启用</span><div class="track"><div class="fill banner"></div></div><b>24/24</b></div>
121
+ <div class="row"><span>新闻发布</span><div class="track"><div class="fill news"></div></div><b>75/75</b></div>
122
+ <div class="tabs"><span class="on">活动</span><span>快捷入口</span><span>待办</span></div>
123
+ </section>
124
+ </div>
125
+ </div>
126
+ </body>
127
+ </html>