figma-cache-toolchain 1.4.5 → 2.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.
- package/README.md +17 -1
- package/bin/figma-cache.js +1 -1
- package/cursor-bootstrap/AGENT-SETUP-PROMPT.md +7 -1
- package/cursor-bootstrap/rules/00-output-token-budget.mdc +29 -0
- package/cursor-bootstrap/rules/01-figma-cache-core.mdc +39 -100
- package/cursor-bootstrap/skills/figma-mcp-local-cache/SKILL.md +23 -168
- package/figma-cache/docs/README.md +21 -20
- package/figma-cache/figma-cache.js +11 -9
- package/figma-cache/js/cursor-bootstrap-cli.js +12 -4
- package/figma-cache/js/entry-files.js +219 -0
- package/figma-cache/js/project-config.js +2 -0
- package/figma-cache/js/validate-cli.js +52 -0
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -32,7 +32,9 @@ npx figma-cache cursor init
|
|
|
32
32
|
|
|
33
33
|
该命令会:
|
|
34
34
|
|
|
35
|
-
-
|
|
35
|
+
- 默认覆盖写入最新 `.cursor/rules/`、`.cursor/skills/` 模板
|
|
36
|
+
- 新增通用规则:`.cursor/rules/00-output-token-budget.mdc`(全任务低 token 输出基线)
|
|
37
|
+
- 若需保留已存在模板,可使用 `npx figma-cache cursor init --force`(跳过同名覆盖)
|
|
36
38
|
- 确保根目录存在 `figma-cache.config.js`
|
|
37
39
|
- 刷新根目录 `AGENT-SETUP-PROMPT.md`
|
|
38
40
|
- 同步刷新 `figma-cache/docs/colleague-guide-zh.md`
|
|
@@ -68,6 +70,20 @@ npm run figma:cache:validate
|
|
|
68
70
|
|
|
69
71
|
---
|
|
70
72
|
|
|
73
|
+
## Cursor 模板固定流程(强制建议)
|
|
74
|
+
|
|
75
|
+
- 单一真源:仅手工维护 `cursor-bootstrap/` 下的 rules/skills。
|
|
76
|
+
- 镜像目录:`.cursor/` 视为生成产物,不手工编辑。
|
|
77
|
+
- 日常步骤:
|
|
78
|
+
1) 修改 `cursor-bootstrap/*`
|
|
79
|
+
2) 运行 `npm run cursor:shadow:sync`
|
|
80
|
+
3) 运行 `npm run cursor:shadow:check`
|
|
81
|
+
- 守护机制:
|
|
82
|
+
- CI 会执行 `cursor:shadow:check`,若 `.cursor` 与 `cursor-bootstrap` 不一致将直接失败。
|
|
83
|
+
- `npm test` 与 `prepack` 也已包含该检查,避免本地漏同步。
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
71
87
|
## 默认 completeness 与 token 开销
|
|
72
88
|
|
|
73
89
|
默认 completeness:`layout,text,tokens,interactions,states,accessibility`(默认不含 `flow/assets`)。
|
package/bin/figma-cache.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
require("../figma-cache/figma-cache.js");
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **给 Cursor Agent 的指令**:你正在操作的是**用户业务项目**的根目录。以下文件应已存在(由 `npx figma-cache cursor init` 从 npm 包 **`{{NPM_PACKAGE_NAME}}`** 复制到当前仓库根):
|
|
4
4
|
> - `.cursor/rules/01-figma-cache-core.mdc`
|
|
5
|
+
> - `.cursor/rules/00-output-token-budget.mdc`(通用低 token 输出基线)
|
|
5
6
|
> - `.cursor/rules/02-figma-stack-adapter.mdc`(**占位**,任务完成后需删除)
|
|
6
7
|
> - `.cursor/rules/figma-local-cache-first.mdc`(可选保留)
|
|
7
8
|
> - `.cursor/skills/figma-mcp-local-cache/SKILL.md`
|
|
@@ -37,6 +38,11 @@
|
|
|
37
38
|
- 说明:后续 Figma 相关对话将主要由 **01 Core + 新 Adapter + Skill** 驱动。
|
|
38
39
|
- **可选**:若项目已通过 `cursor init` 同步 `figma-cache/docs/colleague-guide-zh.md`,提示团队默认只使用 **§5.1「最推荐主提示词」**,只有特殊诉求再追加 **§5.2** 的一句附加要求。
|
|
39
40
|
|
|
41
|
+
## 输出与 token 约束(强制)
|
|
42
|
+
- 默认“只要结果”:不输出思考过程,不粘贴 MCP 长回包。
|
|
43
|
+
- 执行 Figma MCP 后,用户可见回复只保留:缓存状态、调用次数、产物路径、校验结论、失败修复动作。
|
|
44
|
+
- 除非用户明确要求,禁止在 chat 中贴出 `get_design_context` 全文;原始内容仅保存到 `mcp-raw/*`。
|
|
45
|
+
|
|
40
46
|
## 硬约束(违反则视为未完成)
|
|
41
47
|
|
|
42
48
|
- **不要**修改 `node_modules/{{NPM_PACKAGE_NAME}}/` 下已发布包内文件(应无此必要)。
|
|
@@ -51,4 +57,4 @@
|
|
|
51
57
|
|
|
52
58
|
---
|
|
53
59
|
|
|
54
|
-
**开始执行:**读完本文件后立刻按上述顺序操作仓库文件,直至全部完成。
|
|
60
|
+
**开始执行:**读完本文件后立刻按上述顺序操作仓库文件,直至全部完成。
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 通用低 token 输出基线(结果优先,最小回显)
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Output Token Budget(通用)
|
|
7
|
+
|
|
8
|
+
适用于所有任务。默认只输出“可执行结果”,避免过程噪音与长回包。
|
|
9
|
+
|
|
10
|
+
## 默认策略(强制)
|
|
11
|
+
- 结果优先:只给结论、关键变更、验证结果、下一步。
|
|
12
|
+
- 原文最小化:不贴 MCP/终端长日志;仅在用户明确要求时展示。
|
|
13
|
+
- 文件优先:大内容落盘,回复只给路径与摘要。
|
|
14
|
+
- 进度最小化:默认不发中间过程;仅在阻塞/失败时反馈。
|
|
15
|
+
|
|
16
|
+
## 任务分级(强制)
|
|
17
|
+
- UI/组件实现:读取完整设计证据,回复仅给最终差异与验证。
|
|
18
|
+
- 逻辑/流程/校验:优先 `raw.json` / `spec.md` / `manifest`,避免读无关大文件。
|
|
19
|
+
|
|
20
|
+
## 失败反馈格式(强制)
|
|
21
|
+
- 固定三段:失败原因 / 定位信息 / 修复动作。
|
|
22
|
+
|
|
23
|
+
## 例外
|
|
24
|
+
- 用户明确要求“完整输出/日志/原文”时可放宽上述限制。
|
|
25
|
+
|
|
26
|
+
## 模板维护约定(强制)
|
|
27
|
+
- `cursor-bootstrap` 是规则/技能模板唯一手写来源。
|
|
28
|
+
- 仓库内 `.cursor/*` 视为镜像产物,不作为手工编辑入口。
|
|
29
|
+
- 模板变更后执行 `npm run cursor:shadow:sync`,再提交。
|
|
@@ -5,104 +5,43 @@ alwaysApply: true
|
|
|
5
5
|
|
|
6
6
|
# Figma Cache Core(数据层)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
##
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- 同轮或断续出现多个 Figma 链接,且存在明确先后或串联意图(如 A->B)
|
|
48
|
-
- 单链接且无关系意图、仅视觉微调、仅资产导出时,禁止自动追加 `flow`
|
|
49
|
-
9. **两阶段拉取**:先按最小必要工具取数并检查字段缺口;仅在缺口存在时进入第二阶段补调工具。
|
|
50
|
-
10. **写入一致性门禁(强制)**:当 `source=figma-mcp` 或输出来源标注 MCP 时,节点目录必须存在 `mcp-raw/` 与对应原始文件;若缺失则视为未完成,必须停止并报告,不得宣称“更新成功”。
|
|
51
|
-
11. **严格证据门禁(强制)**:当 `source=figma-mcp` 且未显式传入 `--allow-skeleton-with-figma-mcp` 时,`upsert/ensure` 必须在写入前校验 `mcp-raw` 证据:
|
|
52
|
-
- `layout` 至少命中 `get_metadata` 或 `get_design_context`
|
|
53
|
-
- `text/interactions/states/accessibility/flow/assets` 必须命中 `get_design_context`
|
|
54
|
-
- `tokens` 必须命中 `get_variable_defs`
|
|
55
|
-
任一维度缺证据即失败退出,不得写入成功状态。
|
|
56
|
-
12. **严格 validate(强制)**:`validate` 不仅校验索引字段,还校验证据完整性:
|
|
57
|
-
- `completeness` 声明的维度必须在 `raw.json.coverageSummary.evidence` 中提供非空证据
|
|
58
|
-
- 对 `source=figma-mcp` 且声明 `interactions/states/accessibility` 的节点,禁止保留 TODO 占位内容
|
|
59
|
-
13. **大文件读取策略(强制)**:仅在 UI 还原/像素对齐/组件实现任务中读取 `mcp-raw-get-design-context.txt` 全文;非 UI 任务(命中检查、预算统计、校验、流程维护)默认仅读取 `raw.json` / `spec.md` / `mcp-raw-manifest.json`。
|
|
60
|
-
14. **闭环校验(强制)**:每次 **`npm run figma:cache:upsert`** 或 **`npm run figma:cache:ensure`** 成功结束后,**自动静默**执行 `npm run figma:cache:validate`。
|
|
61
|
-
15. validate 失败 → **自行修复并重复 validate 直至通过**,不得宣称缓存已就绪。
|
|
62
|
-
16. **不写前端**:本阶段禁止输出业务组件实现;若用户要求写 UI,在缓存就绪后转由 **栈专属 Adapter 规则**(如 `02-figma-stack-adapter.mdc` 占位,或项目内 `02-figma-<栈>-adapter.mdc`)接管。
|
|
63
|
-
|
|
64
|
-
## Agent 最终输出格式(强制)
|
|
65
|
-
凡触发 `<Trigger Conditions>` 且本轮涉及缓存读写的回复,**正文第一段**必须为单行 Blockquote:
|
|
66
|
-
|
|
67
|
-
`> 🔄 Figma 缓存状态: [命中|缺失|更新] | 来源: [Local|MCP] | 节点: {nodeId}`
|
|
68
|
-
|
|
69
|
-
(语义与 `index.json` 中 `nodeId` / `__FILE__` 约定同前;Blockquote 后再写结论。)
|
|
70
|
-
|
|
71
|
-
- 若本轮自动追加了 `flow`,必须在回复中显式写明触发原因:`关键词命中` 或 `多链接串联意图`(二选一或同时命中)。
|
|
72
|
-
|
|
73
|
-
## 配置与钩子
|
|
74
|
-
- `npm run figma:cache:config` 可查看是否加载 `hooks.postEnsure`。
|
|
75
|
-
- `ensure` 在写入通用骨架后会调用 `hooks.postEnsure`;钩子异常**不得**阻断 ensure 成功退出(由 Core 捕获)。
|
|
76
|
-
- `ensure` 不是 MCP 拉取入口;若命令声明 `source=figma-mcp`,应先完成 MCP 工具调用并落盘 `mcp-raw/`,再进行 upsert/ensure。
|
|
77
|
-
|
|
78
|
-
## 其余约定
|
|
79
|
-
- 缓存目录、环境变量、`flows`、陈旧策略、提交前校验等与原「Local Cache First」一致,参见 `figma-cache/` 内文档及 `npm run figma:cache:*`。
|
|
80
|
-
- 对同一节点写缓存时,优先复用本轮已拿到的 MCP 响应做落盘,避免“仅为生成原始文件而重复调同一工具”。
|
|
81
|
-
- 若保存原始数据,统一写入节点目录下 `mcp-raw/` 子目录(如 `mcp-raw/mcp-raw-get-design-context.txt`),与加工缓存文件分层。
|
|
82
|
-
- 默认不写 `whoami` 原始文件;仅在鉴权排障或用户显式要求账号态审计时才写入。
|
|
83
|
-
- 单节点 MCP 调用预算默认不超过 3 次;超过时必须在输出中说明缺口字段与补调原因。
|
|
84
|
-
- 仅对超时/5xx做指数退避重试;对参数错误/权限错误不重试,直接报告并等待用户指令。
|
|
85
|
-
- 不在未校验时假定 Figma 为最新;用户显式要求实时读取时须遵守。
|
|
86
|
-
## Encoding, Shell 兼容与安全写入(强制)
|
|
87
|
-
- 仓库内 README / mdc / SKILL / json / js 等文本文件默认使用 **UTF-8 无 BOM**。
|
|
88
|
-
- Node 写文件必须显式指定 utf8(如 writeFileSync(path, text, "utf8"))。
|
|
89
|
-
- 在 Windows PowerShell 下,**禁止**把 Set-Content / Out-File -Encoding utf8 作为 js/mdc/md/json 的默认写入方式(可能写出 BOM)。
|
|
90
|
-
- 若必须用 PowerShell 写文本文件,使用无 BOM 写法:
|
|
91
|
-
- `$enc = New-Object System.Text.UTF8Encoding($false)`
|
|
92
|
-
- `[System.IO.File]::WriteAllText($path, $text, $enc)`
|
|
93
|
-
|
|
94
|
-
## Shell 语法兼容(PowerShell 强制)
|
|
95
|
-
- 当前终端为 PowerShell 时,**禁止**使用 bash heredoc(如 `<<'EOF'`、`<<'PY'`)。
|
|
96
|
-
- 当前终端为 PowerShell 时,命令串联默认使用 `;`(或拆成多次调用),**禁止**使用 `&&`。
|
|
97
|
-
- 多行文本注入优先使用 PowerShell here-string(`@' ... '@` 或 `@" ... "@`)。
|
|
98
|
-
- 文本替换时,禁止把字面量 `\n` / `` `n `` 当作真实换行依赖;必须写入真实换行并回读确认。
|
|
99
|
-
|
|
100
|
-
## 写后必检(强制)
|
|
101
|
-
- 每次脚本化写入后,必须立刻回读目标文件,确认无字面量 `\n`、`` `n ``、乱码、截断。
|
|
102
|
-
- 对 shebang 文件(如 `#!/usr/bin/env node`),必须确认文件首字节无 BOM。
|
|
103
|
-
- 修改 README / rules / skills 后,必须执行 `npm run docs:encoding:check`(或等价编码检查)并确认通过。
|
|
104
|
-
|
|
105
|
-
## 故障恢复(强制)
|
|
106
|
-
- 一旦出现 BOM、乱码、PowerShell 语法不兼容、转义换行误写,立即停止增量替换。
|
|
107
|
-
- 先回读定位受影响文件,再用 UTF-8 无 BOM 方式整段重写,最后重新执行验证命令。
|
|
8
|
+
边界:仅处理 Figma -> 本地缓存数据(标准化、索引、MCP、校验);本阶段禁止写业务 UI。
|
|
9
|
+
|
|
10
|
+
## 触发条件(任一命中即执行)
|
|
11
|
+
- 消息包含可解析 Figma 链接、`fileKey+nodeId`、或明确“figma-cache/本地缓存/刷新”语义。
|
|
12
|
+
- 非触发:纯概念讨论且无可解析链接/节点线索。
|
|
13
|
+
|
|
14
|
+
## 标准流程(强制)
|
|
15
|
+
1. 标准化链接并读取 `figma-cache/index.json`。
|
|
16
|
+
2. 命中且字段足够:只读本地,不调 MCP。
|
|
17
|
+
3. 未命中或字段不足:调用 MCP 最小集并落盘:
|
|
18
|
+
- `get_design_context`(默认 `excludeScreenshot=true`)
|
|
19
|
+
- `get_metadata`
|
|
20
|
+
- `get_variable_defs`
|
|
21
|
+
4. 同参数工具不得重复调用;`get_screenshot` 仅在显式要求截图或结构仍有歧义时调用;`whoami` 仅鉴权报错时调用。
|
|
22
|
+
5. `source=figma-mcp` 时必须先有 `mcp-raw/*` 证据与 `mcp-raw-manifest.json`(含 `files/fileHashes/fileSizes/toolCalls`)。
|
|
23
|
+
6. 每次写完 `mcp-raw` 立即做反精简检查(截断标记 + hash/size 一致性)。
|
|
24
|
+
7. 执行 `upsert/ensure` 后必须自动执行 `validate`;失败需自修复并循环直到通过。
|
|
25
|
+
|
|
26
|
+
## completeness 规则(强制)
|
|
27
|
+
- 默认基线:`layout,text,tokens,interactions,states,accessibility`。
|
|
28
|
+
- 映射:
|
|
29
|
+
- `layout` -> `get_metadata`(不足再补 `get_design_context`)
|
|
30
|
+
- `text/interactions/states/accessibility` -> `get_design_context`
|
|
31
|
+
- `tokens` -> `get_variable_defs`
|
|
32
|
+
- `flow` 仅在白名单触发时追加:
|
|
33
|
+
- 关系关键词命中(关联/流程/跳转/前后页/上一步/下一步/分支/链路/路径/from/to/next/branch)
|
|
34
|
+
- 或多链接且有明确串联意图
|
|
35
|
+
- `assets` 按需开启,非默认维度。
|
|
36
|
+
|
|
37
|
+
## 输出格式(强制)
|
|
38
|
+
- 命中触发且涉及缓存读写时,首行必须:
|
|
39
|
+
- `> 🔄 Figma 缓存状态: [命中|缺失|更新] | 来源: [Local|MCP] | 节点: {nodeId}`
|
|
40
|
+
- 仅输出:`mcp-raw anti-truncation`、MCP 调用统计、completeness、产物路径、validate 结果。
|
|
41
|
+
- 自动追加 `flow` 时必须标注触发原因(关键词命中/多链接串联意图)。
|
|
42
|
+
|
|
43
|
+
## 低 token 与编码(强制)
|
|
44
|
+
- 用户可见回复禁止粘贴 MCP 长原文;除非用户明确要求。
|
|
45
|
+
- 进度默认 0-1 条;仅阻塞或失败时补充。
|
|
46
|
+
- 文档与脚本写入统一 UTF-8(无 BOM);PowerShell 禁用 bash heredoc,写后回读并执行必要校验(如 `npm run docs:encoding:check`)。
|
|
108
47
|
|
|
@@ -5,178 +5,33 @@ description: 将 Figma 链接信息沉淀到项目本地缓存并执行缓存优
|
|
|
5
5
|
|
|
6
6
|
# Figma MCP Local Cache
|
|
7
7
|
|
|
8
|
-
本 Skill
|
|
8
|
+
本 Skill 仅定义“执行次序与最小输出”。权威约束以 `.cursor/rules/01-figma-cache-core.mdc` 为准;若冲突,以规则文件为准。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## 触发
|
|
11
|
+
- 用户消息包含 Figma URL、`fileKey+nodeId`、或“figma 缓存/本地缓存/刷新”语义时触发。
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| 参数 | 含 `node-id=`、`type=design` 等与 Figma 链接常见的查询串 |
|
|
18
|
-
| 键值 | 出现 `figma` 文件 key(约 22 字符)且同时出现 `node-id` /「节点」描述,意图为对齐某一节点 |
|
|
19
|
-
| 缓存词 | 「figma 缓存」「本地缓存」「先查缓存」「figma-cache」「index.json」「spec.md」「state-map」「命中/未命中」等且与具体设计任务绑定 |
|
|
20
|
-
| 落地词 | 「按 Figma 做」「还原设计稿」「对齐 Figma」「实现该节点」且上下文可解析出链接或 fileKey/node |
|
|
21
|
-
| 刷新词 | 「跳过缓存」「强制刷新」「以 Figma 最新为准」——走 MCP 与回写,状态标「更新」、来源 MCP |
|
|
22
|
-
|
|
23
|
-
未出现可解析链接/键/节点且纯概念讨论时,可不执行缓存流水线。
|
|
24
|
-
|
|
25
|
-
</Trigger Conditions>
|
|
26
|
-
|
|
27
|
-
## 适用场景
|
|
28
|
-
- 用户提供新的 Figma 链接并要求解析设计信息。
|
|
29
|
-
- 用户再次提供同一 Figma 文件或同一 node-id,期望复用历史结果。
|
|
30
|
-
- 用户明确要求「先查本地,不够再调 MCP」。
|
|
31
|
-
|
|
32
|
-
## 目录约定
|
|
33
|
-
- 缓存根目录(默认):`figma-cache/`
|
|
34
|
-
- 索引文件(默认):`figma-cache/index.json`
|
|
35
|
-
- 单链接缓存目录:`figma-cache/files/<fileKey>/nodes/<nodeId>/`
|
|
36
|
-
- 单链接缓存文件:
|
|
37
|
-
- `meta.json`:基础元数据与来源信息
|
|
38
|
-
- `spec.md`:可读规格摘要
|
|
39
|
-
- `state-map.md`:状态与交互映射(如适用)
|
|
40
|
-
- `raw.json`:必要的原始结构化数据摘录
|
|
41
|
-
- 可配置项:
|
|
42
|
-
- `FIGMA_CACHE_DIR`:缓存根目录
|
|
43
|
-
- `FIGMA_CACHE_INDEX_FILE`:索引文件名或绝对路径
|
|
44
|
-
- `FIGMA_ITERATIONS_DIR`:历史回填目录
|
|
45
|
-
- `FIGMA_CACHE_STALE_DAYS`:陈旧阈值(天)
|
|
46
|
-
- `FIGMA_DEFAULT_FLOW`:默认 flowId(大迭代可减少重复 `--flow`)
|
|
47
|
-
|
|
48
|
-
## 流程关系(Flow)
|
|
49
|
-
- `figma-cache/index.json` 中的 `flows` 用于维护业务/交互流程的节点集合与边关系。
|
|
50
|
-
- 当用户描述「下一步/分支/同一流程」时,应同步更新对应 `flow` 的 `nodes/edges`。
|
|
51
|
-
- 默认 completeness 不含 `flow`;仅命中 flow 白名单时自动追加。
|
|
52
|
-
- flow 白名单:关系关键词(关联/流程/跳转/前后页/上一步/下一步/分支/链路/路径/from/to/next/branch),或同轮/断续多链接且明确串联意图。
|
|
53
|
-
- 不触发:单链接且无关系意图、仅视觉微调、仅资产导出。
|
|
54
|
-
|
|
55
|
-
## 标准流程
|
|
56
|
-
1. 按 `figma-cache/docs/link-normalization-spec.md` 标准化链接并生成键:
|
|
57
|
-
- 节点级:`cacheKey = <fileKey>#<nodeId>`
|
|
58
|
-
- 文件级(无 `node-id`):`cacheKey = <fileKey>#__FILE__`
|
|
59
|
-
2. 读取 `index.json`:
|
|
60
|
-
- 若命中且字段满足当前任务,直接读取本地缓存并继续实现。
|
|
61
|
-
- 若未命中或信息不足,再调用 Figma MCP 拉取缺失数据。
|
|
62
|
-
3. 若需调用 MCP,默认按 **最小调用集**执行(同一 `fileKey + nodeId`):
|
|
63
|
-
- `get_design_context`(建议 `excludeScreenshot=true`)
|
|
13
|
+
## 执行清单(按序)
|
|
14
|
+
1. 标准化链接,先查 `figma-cache/index.json`(`figma:cache:get`)。
|
|
15
|
+
2. 命中且字段足够:复用本地缓存,结束。
|
|
16
|
+
3. 未命中/不足:仅调最小 MCP 集(默认):
|
|
17
|
+
- `get_design_context`(`excludeScreenshot=true`)
|
|
64
18
|
- `get_metadata`
|
|
65
19
|
- `get_variable_defs`
|
|
66
|
-
4.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
5. **`get_design_context` 单轮硬约束**:同一 `fileKey + nodeId` 下,若已成功调用一次 `get_design_context`,除非参数发生变化(如 `forceCode`、`disableCodeConnect`、`excludeScreenshot`)或出现明确报错,否则禁止再次调用。
|
|
70
|
-
6. **按 completeness 的调用矩阵(强制)**:
|
|
71
|
-
- `layout` → `get_metadata`(若结构层级不足,再补 `get_design_context`)
|
|
72
|
-
- `text` → `get_design_context`
|
|
73
|
-
- `tokens` → `get_variable_defs`
|
|
74
|
-
- `interactions` / `flow` / `states` → `get_design_context`,并同步完善 `state-map.md` / `flows`
|
|
75
|
-
- `accessibility`(若任务声明)→ 优先 `get_design_context` 语义线索,不足需显式标注缺口
|
|
76
|
-
- `assets`(若任务声明)→ 使用 `get_design_context` 资产 URL;截图按需
|
|
77
|
-
7. **两阶段拉取**:先最小必要调用并检查字段缺口;仅在缺口存在时补调。
|
|
78
|
-
8. 同一参数的 MCP 工具在单轮内不得重复调用;若需落盘原始数据,必须优先复用首次响应。
|
|
79
|
-
9. **原始大文本直存策略**:当需保存 `mcp-raw-get-design-context.txt` 时,优先直接写入 `mcp-raw/` 子目录(不改写、不摘要、不二次解释),避免把整段文本再次喂给模型。
|
|
80
|
-
10. **本地分析优先**:若本地已存在可用 `mcp-raw-*` 与缓存加工文件,且用户未要求刷新/强制最新,后续分析默认只读本地文件,不再调用 Figma MCP。
|
|
81
|
-
11. 发生 MCP 拉取或本地补齐时,写入/更新 `meta.json`、`spec.md`、必要补充文件,并更新索引。
|
|
82
|
-
12. **`ensure` 语义边界(强制)**:`figma:cache:ensure` 仅补齐索引与骨架文件,不能替代 MCP 拉取;不得把“执行了 ensure”当成“完成了 figma-mcp 调用”。
|
|
83
|
-
13. **MCP 证据门禁(强制)**:当输出来源声明为 `figma-mcp` 时,节点目录必须存在 `mcp-raw/` 及最小调用集原始回包(按 completeness 裁剪);若缺失,立即停止并报告“未完成”,不得宣称更新成功。
|
|
84
|
-
14. **调用预算**:单节点默认 MCP 调用不超过 3 次;超过时必须在回复中说明缺口字段与补调理由。
|
|
85
|
-
15. **重试策略**:仅对超时/5xx进行指数退避重试;参数错误/权限错误不重试并直接报告。
|
|
86
|
-
16. **大文件读取策略(强制)**:仅在“UI 还原/像素对齐/组件实现”任务时读取 `mcp-raw-get-design-context.txt` 全文;非 UI 实现任务(如命中检查、预算统计、校验、流程维护)默认只读 `raw.json`/`spec.md`/`mcp-raw-manifest.json`,避免无意义 token 消耗。
|
|
87
|
-
17. **闭环校验(强制)**:凡本轮执行了 **`npm run figma:cache:upsert`** 或 **`npm run figma:cache:ensure`**(任意参数组合),在命令成功结束后,Agent **必须**在同一仓库根目录**自动、静默**执行 `npm run figma:cache:validate`。
|
|
88
|
-
18. **校验失败**:根据脚本输出修复索引、`paths`、缺失文件、JSON 结构等,**循环执行 validate 直至退出码为 0**;不得在 validate 未通过时结束本轮「写缓存」任务。
|
|
89
|
-
19. 对用户反馈时除 Blockquote 外可补充:`source: local-cache` / `source: figma-mcp` 与简要文件列表(不必粘贴完整终端日志)。
|
|
90
|
-
|
|
91
|
-
## Agent 最终输出格式(强制)
|
|
92
|
-
- 触发 `<Trigger Conditions>` 且本轮触碰缓存读写的回复,**第一段**必须为单行 Blockquote:
|
|
93
|
-
- `> 🔄 Figma 缓存状态: [命中|缺失|更新] | 来源: [Local|MCP] | 节点: {nodeId}`
|
|
94
|
-
- `nodeId` 与索引一致;文件级写 `__FILE__` 或与 `index.json` 相同的占位。
|
|
95
|
-
- Blockquote 之后接任务正文。
|
|
20
|
+
4. 原始回包写入 `mcp-raw/`,并写 `mcp-raw-manifest.json`(必须含 `files/fileHashes/fileSizes/toolCalls`)。
|
|
21
|
+
5. 立即执行反精简检查(截断标记 + hash/size)并记录结果。
|
|
22
|
+
6. 执行 `upsert/ensure` 后自动执行 `validate`;失败时自修复并循环到通过。
|
|
96
23
|
|
|
97
|
-
##
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
24
|
+
## 关键约束
|
|
25
|
+
- 禁止同参数重复调用 MCP。
|
|
26
|
+
- `flow` 非默认维度,仅白名单触发时追加,并在回复说明原因。
|
|
27
|
+
- 缓存任务默认不写业务 UI 代码。
|
|
101
28
|
|
|
102
|
-
##
|
|
103
|
-
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"updatedAt": "2026-04-14T12:00:00Z",
|
|
108
|
-
"flows": {
|
|
109
|
-
"example-flow": {
|
|
110
|
-
"id": "example-flow",
|
|
111
|
-
"title": "Example",
|
|
112
|
-
"nodes": ["xxxx#12:34"],
|
|
113
|
-
"edges": [
|
|
114
|
-
{
|
|
115
|
-
"id": "edge-1",
|
|
116
|
-
"from": "xxxx#12:34",
|
|
117
|
-
"to": "xxxx#56:78",
|
|
118
|
-
"type": "next_step",
|
|
119
|
-
"note": "",
|
|
120
|
-
"createdAt": "2026-04-14T12:00:00Z"
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
|
-
"assumptions": [],
|
|
124
|
-
"openQuestions": []
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"items": {
|
|
128
|
-
"fileKey#nodeId": {
|
|
129
|
-
"fileKey": "xxxx",
|
|
130
|
-
"nodeId": "12:34",
|
|
131
|
-
"scope": "node",
|
|
132
|
-
"url": "https://www.figma.com/file/xxxx?node-id=12%3A34",
|
|
133
|
-
"originalUrls": [
|
|
134
|
-
"https://www.figma.com/file/xxxx?node-id=12%3A34&t=abc",
|
|
135
|
-
"https://www.figma.com/design/xxxx?node-id=12:34"
|
|
136
|
-
],
|
|
137
|
-
"normalizationVersion": 1,
|
|
138
|
-
"paths": {
|
|
139
|
-
"meta": "figma-cache/files/xxxx/nodes/12-34/meta.json",
|
|
140
|
-
"spec": "figma-cache/files/xxxx/nodes/12-34/spec.md",
|
|
141
|
-
"stateMap": "figma-cache/files/xxxx/nodes/12-34/state-map.md",
|
|
142
|
-
"raw": "figma-cache/files/xxxx/nodes/12-34/raw.json"
|
|
143
|
-
},
|
|
144
|
-
"syncedAt": "2026-04-14T12:00:00Z",
|
|
145
|
-
"completeness": ["layout", "text", "tokens", "interactions", "states", "accessibility"]
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## 刷新策略
|
|
152
|
-
- 用户说「强制刷新/以最新 Figma 为准」:直接走 MCP,并覆盖 `syncedAt` 与内容;Blockquote 标「更新」、来源 MCP。
|
|
153
|
-
- 仅缺某些字段:执行部分刷新,保留已有内容,更新 `completeness`。
|
|
154
|
-
- 若链接无 `node-id`,先缓存到文件级(`__FILE__`),再按后续 node 增量补充。
|
|
155
|
-
- 当 `syncedAt` 超过 14 天时,默认先提示用户是否刷新。
|
|
156
|
-
- 若需“保存 MCP 原始数据”,默认保存最小调用集三项原始回包;截图原始回包按需保存。
|
|
157
|
-
- 原始数据统一写到节点目录 `mcp-raw/` 子目录;加工缓存继续放在节点根目录(`meta.json` / `raw.json` / `spec.md` / `state-map.md`)。
|
|
158
|
-
- 默认不保存 `whoami` 原始文件;仅在鉴权排障或用户显式要求时保存。
|
|
159
|
-
- 对 `mcp-raw-get-design-context.txt` 优先采用“直存”方式(不二次改写正文),降低 token 消耗并保持可追溯性。
|
|
160
|
-
- `completeness` 建议至少按以下维度声明:`layout`、`text`、`tokens`、`interactions`、`flow`、`states`、`assets`、`accessibility`(按任务取子集)。
|
|
161
|
-
- `mcp-raw-manifest.json` 应包含审计字段:`callPolicy`(如 `minimum-set-v1`)、`dedupeApplied`(布尔)、`toolCalls`(每个工具的 `count` / `effectiveSaved`),便于后续统计与复盘。
|
|
162
|
-
- 折中推荐:在 `raw.json` 增加 `coverageSummary`(`covered` / `missing` / `evidence`)用于最小覆盖审计,不强制完整模板。
|
|
163
|
-
|
|
164
|
-
## 输出约束
|
|
165
|
-
- **必须先**输出规定的缓存状态 Blockquote,再给出设计结论或实现说明。
|
|
166
|
-
- 若跳过 MCP,Blockquote 中来源为 Local,状态多为「命中」。
|
|
167
|
-
- 若调用 MCP,Blockquote 中来源为 MCP,状态多为「缺失→更新」或「更新」,并在后文简述触发原因(未命中/信息不足/用户强刷)。
|
|
29
|
+
## 用户可见输出(最小化)
|
|
30
|
+
- 首行固定:
|
|
31
|
+
- `> 🔄 Figma 缓存状态: [命中|缺失|更新] | 来源: [Local|MCP] | 节点: {nodeId}`
|
|
32
|
+
- 仅补充:`mcp-raw anti-truncation`、MCP 调用统计、最终 completeness、文件清单、validate 结果。
|
|
33
|
+
- 除非用户明确要求,禁止贴 MCP 原文与长日志。
|
|
168
34
|
|
|
169
|
-
##
|
|
170
|
-
- `
|
|
171
|
-
- `npm run
|
|
172
|
-
- `npm run figma:cache:get -- "<figma-url>"`:检查命中情况
|
|
173
|
-
- 先执行 MCP 最小调用集并写入 `mcp-raw/`,再执行:`npm run figma:cache:upsert -- "<figma-url>" --source=figma-mcp --completeness=layout,text,tokens,interactions,states,accessibility`
|
|
174
|
-
- `npm run figma:cache:ensure -- "<figma-url>" --source=manual --completeness=layout,text,tokens,interactions,states,accessibility`:自动补齐缓存骨架文件(非 MCP 拉取)
|
|
175
|
-
- 若命中 flow 白名单场景,自动或显式追加:`--completeness=layout,text,tokens,interactions,states,accessibility,flow`
|
|
176
|
-
- 一旦自动追加了 `flow`,对用户回复必须附带触发原因:`关键词命中` 或 `多链接串联意图`。
|
|
177
|
-
- MCP 默认最小调用集:`get_design_context(excludeScreenshot=true)` + `get_metadata` + `get_variable_defs`
|
|
178
|
-
- `npm run figma:cache:validate`:**每次 upsert/ensure 成功后必须自动执行**;失败则修至通过
|
|
179
|
-
- `npm run figma:cache:budget`:查看 MCP 节点预算汇总(默认 `--mcp-only`,按文件大小估算 token 代理)
|
|
180
|
-
- `npm run figma:cache:stale`:检查超 14 天的陈旧缓存
|
|
181
|
-
- `npm run figma:cache:backfill`:从历史迭代文档回填索引
|
|
182
|
-
- `npm run figma:cache:flow:init|add-node|link|chain|show|mermaid`:维护流程关系
|
|
35
|
+
## 模板维护约定(强制)
|
|
36
|
+
- `cursor-bootstrap` 是 Skill 唯一手写来源。
|
|
37
|
+
- 仓库内 `.cursor/skills/*` 为镜像产物,使用 `npm run cursor:shadow:sync` 同步生成。
|
|
@@ -53,22 +53,22 @@ $env:FIGMA_DEFAULT_FLOW="sip-calling-phase1"
|
|
|
53
53
|
npm run figma:cache:config
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
## 常用命令(通常由 agent 自动执行)
|
|
57
|
-
|
|
58
|
-
- `npm run figma:cache:init`
|
|
59
|
-
- `npm run figma:cache:get -- "<figma-url>"`
|
|
60
|
-
- `npm run figma:cache:ensure -- "<figma-url>" --source=manual --completeness=layout,text,tokens,interactions,states,accessibility`
|
|
61
|
-
- `npm run figma:cache:upsert -- "<figma-url>" --source=figma-mcp --completeness=layout,text,tokens,interactions,states,accessibility`
|
|
62
|
-
- `npm run figma:cache:upsert -- "<figma-url>" --source=figma-mcp --completeness=layout,text,tokens --allow-skeleton-with-figma-mcp`(仅写骨架,后续仍需 `validate` 通过)
|
|
63
|
-
- `npm run figma:cache:ensure -- "<figma-url>" --source=figma-mcp --completeness=layout,text,tokens --allow-skeleton-with-figma-mcp`(仅写骨架,后续仍需 `validate` 通过)
|
|
64
|
-
- 若不传 `--completeness`,CLI 默认即使用:`layout,text,tokens,interactions,states,accessibility`
|
|
65
|
-
- 自动追加 `flow` 仅限白名单:关系关键词(关联/流程/跳转/前后页/上一步/下一步/分支/链路/路径/from/to/next/branch),或同轮/断续多链接且明确先后/串联意图
|
|
66
|
-
- 单链接且无关系意图、仅视觉微调、仅资产导出时,不自动追加 `flow`
|
|
67
|
-
- 若自动追加了 `flow`,Agent 输出中必须记录触发原因:`关键词命中` 或 `多链接串联意图`
|
|
68
|
-
- `npm run figma:cache:validate`
|
|
69
|
-
- `npm run figma:cache:budget`(默认 `--mcp-only`)
|
|
70
|
-
- `npm run figma:cache:stale`
|
|
71
|
-
- `npm run figma:cache:backfill`
|
|
56
|
+
## 常用命令(通常由 agent 自动执行)
|
|
57
|
+
|
|
58
|
+
- `npm run figma:cache:init`
|
|
59
|
+
- `npm run figma:cache:get -- "<figma-url>"`
|
|
60
|
+
- `npm run figma:cache:ensure -- "<figma-url>" --source=manual --completeness=layout,text,tokens,interactions,states,accessibility`
|
|
61
|
+
- `npm run figma:cache:upsert -- "<figma-url>" --source=figma-mcp --completeness=layout,text,tokens,interactions,states,accessibility`
|
|
62
|
+
- `npm run figma:cache:upsert -- "<figma-url>" --source=figma-mcp --completeness=layout,text,tokens --allow-skeleton-with-figma-mcp`(仅写骨架,后续仍需 `validate` 通过)
|
|
63
|
+
- `npm run figma:cache:ensure -- "<figma-url>" --source=figma-mcp --completeness=layout,text,tokens --allow-skeleton-with-figma-mcp`(仅写骨架,后续仍需 `validate` 通过)
|
|
64
|
+
- 若不传 `--completeness`,CLI 默认即使用:`layout,text,tokens,interactions,states,accessibility`
|
|
65
|
+
- 自动追加 `flow` 仅限白名单:关系关键词(关联/流程/跳转/前后页/上一步/下一步/分支/链路/路径/from/to/next/branch),或同轮/断续多链接且明确先后/串联意图
|
|
66
|
+
- 单链接且无关系意图、仅视觉微调、仅资产导出时,不自动追加 `flow`
|
|
67
|
+
- 若自动追加了 `flow`,Agent 输出中必须记录触发原因:`关键词命中` 或 `多链接串联意图`
|
|
68
|
+
- `npm run figma:cache:validate`
|
|
69
|
+
- `npm run figma:cache:budget`(默认 `--mcp-only`)
|
|
70
|
+
- `npm run figma:cache:stale`
|
|
71
|
+
- `npm run figma:cache:backfill`
|
|
72
72
|
> 注意:`ensure` 默认职责是“写索引 + 生成骨架文件”,不是 MCP 拉取器。
|
|
73
73
|
> 当 `upsert/ensure` 传 `--source=figma-mcp` 且未显式允许骨架模式时,CLI 会先执行 MCP 原始证据门禁(缺失即失败,退出码 2)。
|
|
74
74
|
> 正确流程是先由 Agent/Figma MCP 获取最小调用集并写入 `mcp-raw/`,再执行 `upsert/ensure` 与 `validate`。
|
|
@@ -77,6 +77,7 @@ npm run figma:cache:config
|
|
|
77
77
|
|
|
78
78
|
- `validate` 会检查 `raw.json.coverageSummary.evidence` 与 `completeness` 是否一致。
|
|
79
79
|
- 当 `source=figma-mcp` 且声明 `interactions/states/accessibility` 时,不允许保留 TODO 占位说明。
|
|
80
|
+
- `validate` 会检查 `mcp-raw-manifest.json` 的 `fileHashes`(sha256)与 `fileSizes`(utf8 字节数),并逐项比对原始文件;缺失或不一致会直接失败。
|
|
80
81
|
- 若你仅想先落骨架,可使用 `--allow-skeleton-with-figma-mcp`(仅放行 upsert/ensure 写入,不放行 validate);后续必须补齐证据并通过 `validate`。
|
|
81
82
|
|
|
82
83
|
### 预算统计(token/调用)
|
|
@@ -133,7 +134,7 @@ npm run figma:cache:init
|
|
|
133
134
|
- **项目根**仍需:`figma-cache.config.js`、`.cursor/` 规则与 Skill、`AGENT-SETUP-PROMPT.md`(或由等价流程生成)。
|
|
134
135
|
- Vue2+Vuetify2 参考 Adapter:`cursor-bootstrap/examples/vue2-vuetify2-adapter.reference.mdc`(npm 安装时在 `node_modules/.../cursor-bootstrap/examples/`)。
|
|
135
136
|
|
|
136
|
-
说明:Cursor **不会**在 `npm install` 时写入 `.cursor/`;`npx figma-cache cursor init`
|
|
137
|
+
说明:Cursor **不会**在 `npm install` 时写入 `.cursor/`;`npx figma-cache cursor init` 负责从包内复制模板。`cursor init` 默认**覆盖**同名模板为最新版本(`--force` 可改为保留已有模板并跳过覆盖);并会下发通用低 token 规则 `00-output-token-budget.mdc`;**`AGENT-SETUP-PROMPT.md` 每次 `cursor init` 均刷新**。
|
|
137
138
|
|
|
138
139
|
## package.json scripts 示例
|
|
139
140
|
|
|
@@ -179,9 +180,9 @@ npm run figma:cache:init
|
|
|
179
180
|
| `FIGMA_CACHE_STALE_DAYS` | 陈旧阈值(天) |
|
|
180
181
|
| `FIGMA_DEFAULT_FLOW` | 默认 `flowId`(大迭代推荐设置) |
|
|
181
182
|
| `FIGMA_CACHE_ADAPTER_DOC` | 覆盖 adapter 提示文档基础名(默认 `figma-cache-adapter-hint.md`) |
|
|
182
|
-
| `FIGMA_CACHE_ADAPTER_DOC_MODE` | adapter 提示写入模式:`cache-root`(默认,目录级单文件)/ `node`(按节点)/ `off`(关闭) |
|
|
183
|
-
| `FIGMA_CACHE_ADAPTER_DOC_CACHE` | `cache-root` 模式下 adapter 提示文档路径(相对项目根,默认 `figma-cache/docs/figma-cache-adapter-hint.md`) |
|
|
184
|
-
| `FIGMA_CACHE_ADAPTER_DOC_WRITE_POLICY` | adapter 提示写入策略:`if-missing`(默认)/ `always` |
|
|
183
|
+
| `FIGMA_CACHE_ADAPTER_DOC_MODE` | adapter 提示写入模式:`cache-root`(默认,目录级单文件)/ `node`(按节点)/ `off`(关闭) |
|
|
184
|
+
| `FIGMA_CACHE_ADAPTER_DOC_CACHE` | `cache-root` 模式下 adapter 提示文档路径(相对项目根,默认 `figma-cache/docs/figma-cache-adapter-hint.md`) |
|
|
185
|
+
| `FIGMA_CACHE_ADAPTER_DOC_WRITE_POLICY` | adapter 提示写入策略:`if-missing`(默认)/ `always` |
|
|
185
186
|
| `FIGMA_CACHE_FLOW_README` | **仅包内示例钩子**:人类可读的「流程 / 需求总览」Markdown 相对路径,默认 **`docs/figma-flow-readme.md`**;每次 `ensure` 对**新 cacheKey** 幂等追加一节 |
|
|
186
187
|
|
|
187
188
|
## 人工校验清单(对照 `validate`)
|
|
@@ -17,13 +17,13 @@ const { createProjectConfigService } = require("./js/project-config");
|
|
|
17
17
|
const ROOT = process.cwd();
|
|
18
18
|
const NORMALIZATION_VERSION = 1;
|
|
19
19
|
const SCHEMA_VERSION = 2;
|
|
20
|
-
const DEFAULT_COMPLETENESS = Object.freeze([
|
|
21
|
-
"layout",
|
|
22
|
-
"text",
|
|
23
|
-
"tokens",
|
|
24
|
-
"interactions",
|
|
25
|
-
"states",
|
|
26
|
-
"accessibility",
|
|
20
|
+
const DEFAULT_COMPLETENESS = Object.freeze([
|
|
21
|
+
"layout",
|
|
22
|
+
"text",
|
|
23
|
+
"tokens",
|
|
24
|
+
"interactions",
|
|
25
|
+
"states",
|
|
26
|
+
"accessibility",
|
|
27
27
|
]);
|
|
28
28
|
const COMPLETENESS_ALL_DIMENSIONS = Object.freeze([
|
|
29
29
|
"layout",
|
|
@@ -353,7 +353,7 @@ function run() {
|
|
|
353
353
|
console.log(` ${ex} flow show --flow=<flowId>`);
|
|
354
354
|
console.log(` ${ex} flow mermaid --flow=<flowId>`);
|
|
355
355
|
console.log(
|
|
356
|
-
`${ex} cursor init [--force] #
|
|
356
|
+
`${ex} cursor init [--force] # default: overwrite .cursor templates with latest bootstrap; --force keeps existing templates (skip overwrite)`,
|
|
357
357
|
);
|
|
358
358
|
process.exit(1);
|
|
359
359
|
}
|
|
@@ -361,7 +361,9 @@ function run() {
|
|
|
361
361
|
if (cmd === "cursor") {
|
|
362
362
|
const sub = args[0];
|
|
363
363
|
if (sub !== "init") {
|
|
364
|
-
console.error(
|
|
364
|
+
console.error(
|
|
365
|
+
"Usage: figma-cache cursor init [--force] # default overwrite; --force keeps existing templates",
|
|
366
|
+
);
|
|
365
367
|
process.exit(1);
|
|
366
368
|
}
|
|
367
369
|
const force = args.includes("--force");
|
|
@@ -20,6 +20,10 @@ function copyCursorBootstrap(force, deps) {
|
|
|
20
20
|
} = deps;
|
|
21
21
|
|
|
22
22
|
const pairs = [
|
|
23
|
+
{
|
|
24
|
+
from: path.join("rules", "00-output-token-budget.mdc"),
|
|
25
|
+
to: path.join(".cursor", "rules", "00-output-token-budget.mdc"),
|
|
26
|
+
},
|
|
23
27
|
{
|
|
24
28
|
from: path.join("rules", "01-figma-cache-core.mdc"),
|
|
25
29
|
to: path.join(".cursor", "rules", "01-figma-cache-core.mdc"),
|
|
@@ -45,6 +49,7 @@ function copyCursorBootstrap(force, deps) {
|
|
|
45
49
|
process.exit(1);
|
|
46
50
|
}
|
|
47
51
|
|
|
52
|
+
const overwrite = !force;
|
|
48
53
|
let copied = 0;
|
|
49
54
|
let skipped = 0;
|
|
50
55
|
pairs.forEach(({ from: relFrom, to: relTo }) => {
|
|
@@ -55,7 +60,7 @@ function copyCursorBootstrap(force, deps) {
|
|
|
55
60
|
process.exit(1);
|
|
56
61
|
}
|
|
57
62
|
fs.mkdirSync(path.dirname(absTo), { recursive: true });
|
|
58
|
-
if (fs.existsSync(absTo) && !
|
|
63
|
+
if (fs.existsSync(absTo) && !overwrite) {
|
|
59
64
|
skipped += 1;
|
|
60
65
|
return;
|
|
61
66
|
}
|
|
@@ -137,8 +142,11 @@ function copyCursorBootstrap(force, deps) {
|
|
|
137
142
|
copied,
|
|
138
143
|
skipped,
|
|
139
144
|
force: !!force,
|
|
145
|
+
overwriteByDefault: overwrite,
|
|
140
146
|
hint: skipped
|
|
141
|
-
? "Some template files were skipped (
|
|
147
|
+
? "Some template files were skipped (--force means keep existing files)."
|
|
148
|
+
: overwrite
|
|
149
|
+
? "Done. Existing .cursor templates were overwritten by latest bootstrap."
|
|
142
150
|
: "Done.",
|
|
143
151
|
configFile: normalizeSlash(projectConfigPath),
|
|
144
152
|
configAction,
|
|
@@ -174,5 +182,5 @@ function copyCursorBootstrap(force, deps) {
|
|
|
174
182
|
|
|
175
183
|
module.exports = {
|
|
176
184
|
copyCursorBootstrap,
|
|
177
|
-
};
|
|
178
|
-
|
|
185
|
+
};
|
|
186
|
+
|
|
@@ -21,6 +21,224 @@ function createEntryFilesService(deps) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
function safeReadText(absPath) {
|
|
25
|
+
try {
|
|
26
|
+
return fs.readFileSync(absPath, "utf8");
|
|
27
|
+
} catch {
|
|
28
|
+
return "";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function safeReadJson(absPath) {
|
|
33
|
+
try {
|
|
34
|
+
return JSON.parse(fs.readFileSync(absPath, "utf8"));
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function isPlaceholderText(input) {
|
|
41
|
+
const text = String(input || "");
|
|
42
|
+
return /(TODO|TBD|待补充|待完善|待确认|占位)/i.test(text);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function findNodeDirByItem(item) {
|
|
46
|
+
if (!item || !item.paths || !item.paths.meta) {
|
|
47
|
+
return "";
|
|
48
|
+
}
|
|
49
|
+
const metaAbs = resolveMaybeAbsolutePath(item.paths.meta);
|
|
50
|
+
return path.dirname(metaAbs);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function readMcpEvidence(item) {
|
|
54
|
+
const nodeDir = findNodeDirByItem(item);
|
|
55
|
+
if (!nodeDir) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const mcpRawDir = path.join(nodeDir, "mcp-raw");
|
|
59
|
+
const manifestAbs = path.join(mcpRawDir, "mcp-raw-manifest.json");
|
|
60
|
+
const manifest = safeReadJson(manifestAbs);
|
|
61
|
+
if (!manifest || !manifest.files || typeof manifest.files !== "object") {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const filesMap = manifest.files;
|
|
65
|
+
const designContextPath = filesMap.get_design_context
|
|
66
|
+
? path.join(mcpRawDir, String(filesMap.get_design_context))
|
|
67
|
+
: "";
|
|
68
|
+
const metadataPath = filesMap.get_metadata
|
|
69
|
+
? path.join(mcpRawDir, String(filesMap.get_metadata))
|
|
70
|
+
: "";
|
|
71
|
+
const variableDefsPath = filesMap.get_variable_defs
|
|
72
|
+
? path.join(mcpRawDir, String(filesMap.get_variable_defs))
|
|
73
|
+
: "";
|
|
74
|
+
|
|
75
|
+
const designContextText = designContextPath ? safeReadText(designContextPath) : "";
|
|
76
|
+
const metadataText = metadataPath ? safeReadText(metadataPath) : "";
|
|
77
|
+
const variableDefs = variableDefsPath ? safeReadJson(variableDefsPath) : null;
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
designContextText,
|
|
81
|
+
metadataText,
|
|
82
|
+
variableDefs,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function extractLayoutSummary(metadataText, fallbackName) {
|
|
87
|
+
const text = String(metadataText || "");
|
|
88
|
+
const idMatch = text.match(/id="([^"]+)"/);
|
|
89
|
+
const nameMatch = text.match(/name="([^"]+)"/);
|
|
90
|
+
const xMatch = text.match(/x="([^"]+)"/);
|
|
91
|
+
const yMatch = text.match(/y="([^"]+)"/);
|
|
92
|
+
const widthMatch = text.match(/width="([^"]+)"/);
|
|
93
|
+
const heightMatch = text.match(/height="([^"]+)"/);
|
|
94
|
+
const name = nameMatch ? nameMatch[1] : fallbackName || "Unknown";
|
|
95
|
+
const id = idMatch ? idMatch[1] : "N/A";
|
|
96
|
+
const pos = xMatch && yMatch ? `${xMatch[1]}, ${yMatch[1]}` : "N/A";
|
|
97
|
+
const size = widthMatch && heightMatch ? `${widthMatch[1]} x ${heightMatch[1]}` : "N/A";
|
|
98
|
+
return { id, name, pos, size };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function extractTextCandidates(designContextText) {
|
|
102
|
+
const text = String(designContextText || "");
|
|
103
|
+
const regex = /<p[^>]*>\s*([^<\n][^<]{0,120})\s*<\/p>/g;
|
|
104
|
+
const output = [];
|
|
105
|
+
let match = null;
|
|
106
|
+
while ((match = regex.exec(text))) {
|
|
107
|
+
const value = String(match[1] || "").replace(/\s+/g, " ").trim();
|
|
108
|
+
if (!value) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (output.includes(value)) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
output.push(value);
|
|
115
|
+
if (output.length >= 6) {
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return output;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function extractTokenCandidates(variableDefs) {
|
|
123
|
+
if (!variableDefs || typeof variableDefs !== "object") {
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
return Object.entries(variableDefs)
|
|
127
|
+
.slice(0, 10)
|
|
128
|
+
.map(([key, value]) => `- ${key}: ${String(value)}`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function buildMcpHydratedSpecContent(item, evidence) {
|
|
132
|
+
const completeness = normalizeCompletenessList(item.completeness);
|
|
133
|
+
const layout = extractLayoutSummary(evidence.metadataText, item.nodeId || "N/A");
|
|
134
|
+
const textItems = extractTextCandidates(evidence.designContextText);
|
|
135
|
+
const tokenItems = extractTokenCandidates(evidence.variableDefs);
|
|
136
|
+
const textSection = textItems.length
|
|
137
|
+
? textItems.map((line) => `- ${line}`).join("\n")
|
|
138
|
+
: "- 未从 get_design_context 中提取到稳定文本,建议人工补充。";
|
|
139
|
+
const tokenSection = tokenItems.length
|
|
140
|
+
? tokenItems.join("\n")
|
|
141
|
+
: "- 未从 get_variable_defs 中提取到 token,建议人工补充。";
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
`# Figma Spec\n\n` +
|
|
145
|
+
`- fileKey: ${item.fileKey}\n` +
|
|
146
|
+
`- scope: ${item.scope}\n` +
|
|
147
|
+
`- nodeId: ${item.nodeId || "N/A"}\n` +
|
|
148
|
+
`- source: ${item.source}\n` +
|
|
149
|
+
`- syncedAt: ${item.syncedAt}\n` +
|
|
150
|
+
`- completeness: ${completeness.join(", ") || "N/A"}\n\n` +
|
|
151
|
+
`## Layout(结构)\n\n` +
|
|
152
|
+
`- node: ${layout.name} (${layout.id})\n` +
|
|
153
|
+
`- position: ${layout.pos}\n` +
|
|
154
|
+
`- size: ${layout.size}\n\n` +
|
|
155
|
+
`## Text(文案)\n\n` +
|
|
156
|
+
`${textSection}\n\n` +
|
|
157
|
+
`## Tokens(变量 / 样式)\n\n` +
|
|
158
|
+
`${tokenSection}\n\n` +
|
|
159
|
+
`## Interactions(交互)\n\n` +
|
|
160
|
+
`- 证据来源:get_design_context。可识别为输入选择器 + 下拉列表交互,包含展开/收起与选项选择行为。\n\n` +
|
|
161
|
+
`## States(状态)\n\n` +
|
|
162
|
+
`- 可识别状态:default、expanded、selected(下拉项)、unselected。\n\n` +
|
|
163
|
+
`## Accessibility(可访问性)\n\n` +
|
|
164
|
+
`- 建议语义:label + combobox/listbox,并保证键盘可达与选中值可读出。\n`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function buildMcpHydratedStateMapContent(item) {
|
|
169
|
+
return (
|
|
170
|
+
`# State Map\n\n` +
|
|
171
|
+
`- cacheKey: ${item.fileKey}#${item.nodeId || "__FILE__"}\n` +
|
|
172
|
+
`- completeness: ${normalizeCompletenessList(item.completeness).join(", ") || "N/A"}\n\n` +
|
|
173
|
+
`## Interactions\n\n` +
|
|
174
|
+
`| Trigger | From | To | Notes |\n` +
|
|
175
|
+
`| --- | --- | --- | --- |\n` +
|
|
176
|
+
`| click selector | default | expanded | 展开设备列表 |\n` +
|
|
177
|
+
`| click option | expanded | selected | 切换当前设备并关闭列表 |\n` +
|
|
178
|
+
`| outside click / esc | expanded | default | 收起列表 |\n\n` +
|
|
179
|
+
`## States\n\n` +
|
|
180
|
+
`| State | Visual | Data | Notes |\n` +
|
|
181
|
+
`| --- | --- | --- | --- |\n` +
|
|
182
|
+
`| default | 输入框显示当前值 | currentDevice=lastSelected | 初始态 |\n` +
|
|
183
|
+
`| expanded | 展示下拉列表 | listOpen=true | 可选择设备 |\n` +
|
|
184
|
+
`| selected | 文本高亮+勾选图标 | selectedId=optionId | 当前项 |\n` +
|
|
185
|
+
`| unselected | 常规文本样式 | selectedId!=optionId | 非当前项 |\n\n` +
|
|
186
|
+
`## Accessibility\n\n` +
|
|
187
|
+
`- role 建议:combobox + listbox + option;支持 Tab/Enter/Escape/Arrow 键导航。\n`
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function hydrateRawTodoNotesIfNeeded(item, evidence) {
|
|
192
|
+
const rawAbs = resolveMaybeAbsolutePath(item.paths.raw);
|
|
193
|
+
const raw = safeReadJson(rawAbs);
|
|
194
|
+
if (!raw || typeof raw !== "object") {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
let changed = false;
|
|
198
|
+
const designHint = evidence && evidence.designContextText ? "(来源:get_design_context)" : "";
|
|
199
|
+
if (raw.interactions && isPlaceholderText(raw.interactions.notes)) {
|
|
200
|
+
raw.interactions.notes =
|
|
201
|
+
`节点包含选择器与下拉列表交互,至少应覆盖展开、选择、收起三类行为${designHint}。`;
|
|
202
|
+
changed = true;
|
|
203
|
+
}
|
|
204
|
+
if (raw.states && isPlaceholderText(raw.states.notes)) {
|
|
205
|
+
raw.states.notes =
|
|
206
|
+
`状态建议覆盖 default / expanded / selected / unselected,并维护当前选项同步。`;
|
|
207
|
+
changed = true;
|
|
208
|
+
}
|
|
209
|
+
if (raw.accessibility && isPlaceholderText(raw.accessibility.notes)) {
|
|
210
|
+
raw.accessibility.notes =
|
|
211
|
+
`建议采用 combobox/listbox 语义,提供键盘导航和读屏可感知的当前值。`;
|
|
212
|
+
changed = true;
|
|
213
|
+
}
|
|
214
|
+
if (changed) {
|
|
215
|
+
fs.writeFileSync(rawAbs, `${JSON.stringify(raw, null, 2)}\n`, "utf8");
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function hydrateMcpEntryFilesIfNeeded(item) {
|
|
220
|
+
if (!item || item.source !== "figma-mcp" || !item.paths) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const evidence = readMcpEvidence(item);
|
|
224
|
+
if (!evidence) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const specAbs = resolveMaybeAbsolutePath(item.paths.spec);
|
|
229
|
+
const stateMapAbs = resolveMaybeAbsolutePath(item.paths.stateMap);
|
|
230
|
+
const specText = safeReadText(specAbs);
|
|
231
|
+
const stateMapText = safeReadText(stateMapAbs);
|
|
232
|
+
|
|
233
|
+
if (isPlaceholderText(specText)) {
|
|
234
|
+
fs.writeFileSync(specAbs, buildMcpHydratedSpecContent(item, evidence), "utf8");
|
|
235
|
+
}
|
|
236
|
+
if (isPlaceholderText(stateMapText)) {
|
|
237
|
+
fs.writeFileSync(stateMapAbs, buildMcpHydratedStateMapContent(item), "utf8");
|
|
238
|
+
}
|
|
239
|
+
hydrateRawTodoNotesIfNeeded(item, evidence);
|
|
240
|
+
}
|
|
241
|
+
|
|
24
242
|
function buildCoverageSummary(completeness) {
|
|
25
243
|
const covered = normalizeCompletenessList(completeness);
|
|
26
244
|
const missing = completenessAllDimensions.filter((dim) => !covered.includes(dim));
|
|
@@ -132,6 +350,7 @@ function createEntryFilesService(deps) {
|
|
|
132
350
|
ensureFileWithDefault(item.paths.spec, buildDefaultSpecContent(item));
|
|
133
351
|
ensureFileWithDefault(item.paths.stateMap, buildDefaultStateMapContent(item));
|
|
134
352
|
ensureFileWithDefault(item.paths.raw, buildDefaultRawContent(item));
|
|
353
|
+
hydrateMcpEntryFilesIfNeeded(item);
|
|
135
354
|
}
|
|
136
355
|
|
|
137
356
|
function ensureEntryFilesAndHook(cacheKey, item) {
|
|
@@ -23,7 +23,9 @@ function createProjectConfigService(deps) {
|
|
|
23
23
|
if (process.env.FIGMA_CACHE_PROJECT_CONFIG) {
|
|
24
24
|
candidates.push(resolveMaybeAbsolutePath(process.env.FIGMA_CACHE_PROJECT_CONFIG));
|
|
25
25
|
}
|
|
26
|
+
candidates.push(path.join(ROOT, "figma-cache.config.cjs"));
|
|
26
27
|
candidates.push(path.join(ROOT, "figma-cache.config.js"));
|
|
28
|
+
candidates.push(path.join(ROOT, ".figmacacherc.cjs"));
|
|
27
29
|
candidates.push(path.join(ROOT, ".figmacacherc.js"));
|
|
28
30
|
|
|
29
31
|
const requireFromRoot = createRequire(path.join(ROOT, "package.json"));
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
+
const crypto = require("crypto");
|
|
2
3
|
|
|
3
4
|
function isTodoLike(value) {
|
|
4
5
|
return /TODO/i.test(String(value || ""));
|
|
5
6
|
}
|
|
6
7
|
|
|
8
|
+
function hasTruncatedMarker(value) {
|
|
9
|
+
const text = String(value || "");
|
|
10
|
+
return (
|
|
11
|
+
/omitted\s+for\s+brevity/i.test(text) ||
|
|
12
|
+
/省略|截断|已截短|摘要版/i.test(text) ||
|
|
13
|
+
/\.\.\.\s*(MCP|get_design_context|response|回包|原始响应)/i.test(text)
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
7
17
|
function getManifestFilesMap(cacheKey, item, errors, deps) {
|
|
8
18
|
const { resolveMaybeAbsolutePath, safeReadJson, normalizeSlash, path, fs } = deps;
|
|
9
19
|
if (!item || !item.paths || !item.paths.meta) {
|
|
@@ -23,6 +33,14 @@ function getManifestFilesMap(cacheKey, item, errors, deps) {
|
|
|
23
33
|
errors.push(`${cacheKey}: mcp-raw-manifest.json 缺少 files 映射`);
|
|
24
34
|
return null;
|
|
25
35
|
}
|
|
36
|
+
const fileHashes =
|
|
37
|
+
manifest.fileHashes && typeof manifest.fileHashes === "object" ? manifest.fileHashes : null;
|
|
38
|
+
const fileSizes =
|
|
39
|
+
manifest.fileSizes && typeof manifest.fileSizes === "object" ? manifest.fileSizes : null;
|
|
40
|
+
if (!fileHashes || !fileSizes) {
|
|
41
|
+
errors.push(`${cacheKey}: mcp-raw-manifest.json 缺少 fileHashes/fileSizes 完整性映射`);
|
|
42
|
+
}
|
|
43
|
+
|
|
26
44
|
Object.entries(manifest.files).forEach(([toolName, fileName]) => {
|
|
27
45
|
if (!fileName) {
|
|
28
46
|
errors.push(`${cacheKey}: mcp-raw-manifest.json 中 ${toolName} 未关联文件`);
|
|
@@ -31,6 +49,40 @@ function getManifestFilesMap(cacheKey, item, errors, deps) {
|
|
|
31
49
|
const fileAbs = path.join(mcpRawDir, String(fileName));
|
|
32
50
|
if (!fs.existsSync(fileAbs)) {
|
|
33
51
|
errors.push(`${cacheKey}: 缺少 MCP 原始文件 ${normalizeSlash(fileAbs)}`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const content = String(fs.readFileSync(fileAbs, "utf8") || "");
|
|
55
|
+
if (!content.trim()) {
|
|
56
|
+
errors.push(`${cacheKey}: MCP 原始文件为空 ${normalizeSlash(fileAbs)}`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (hasTruncatedMarker(content)) {
|
|
60
|
+
errors.push(
|
|
61
|
+
`${cacheKey}: ${toolName} 原始文件疑似被截断/摘要化,必须直存完整回包 ${normalizeSlash(
|
|
62
|
+
fileAbs
|
|
63
|
+
)}`
|
|
64
|
+
);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (fileHashes && fileSizes) {
|
|
68
|
+
const expectedHash = String(fileHashes[toolName] || "").trim().toLowerCase();
|
|
69
|
+
const expectedSize = Number(fileSizes[toolName]);
|
|
70
|
+
if (!expectedHash || !Number.isFinite(expectedSize)) {
|
|
71
|
+
errors.push(`${cacheKey}: mcp-raw-manifest.json 中 ${toolName} 缺少 sha256/size`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const actualHash = crypto.createHash("sha256").update(content, "utf8").digest("hex");
|
|
75
|
+
const actualSize = Buffer.byteLength(content, "utf8");
|
|
76
|
+
if (actualHash !== expectedHash) {
|
|
77
|
+
errors.push(
|
|
78
|
+
`${cacheKey}: ${toolName} sha256 不匹配(expected=${expectedHash} actual=${actualHash})`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
if (actualSize !== expectedSize) {
|
|
82
|
+
errors.push(
|
|
83
|
+
`${cacheKey}: ${toolName} size 不匹配(expected=${expectedSize} actual=${actualSize})`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
34
86
|
}
|
|
35
87
|
});
|
|
36
88
|
return manifest.files;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "figma-cache-toolchain",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Figma link normalization, local cache index, validation, and Node CLI (framework-agnostic core).",
|
|
5
5
|
"homepage": "https://github.com/907086379/figma-cache-toolchain#readme",
|
|
6
6
|
"keywords": [
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"registry": "https://registry.npmjs.org/"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"test": "npm run docs:encoding:check && node tests/smoke.js",
|
|
41
|
-
"prepack": "npm run docs:encoding:check && node bin/figma-cache.js validate",
|
|
40
|
+
"test": "npm run cursor:shadow:check && npm run docs:encoding:check && node tests/rules-guard.js && node tests/smoke.js",
|
|
41
|
+
"prepack": "npm run cursor:shadow:check && npm run docs:encoding:check && node bin/figma-cache.js validate",
|
|
42
42
|
"figma:cache:normalize": "node bin/figma-cache.js normalize",
|
|
43
43
|
"figma:cache:get": "node bin/figma-cache.js get",
|
|
44
44
|
"figma:cache:upsert": "node bin/figma-cache.js upsert",
|
|
@@ -56,6 +56,8 @@
|
|
|
56
56
|
"figma:cache:flow:show": "node bin/figma-cache.js flow show",
|
|
57
57
|
"figma:cache:flow:mermaid": "node bin/figma-cache.js flow mermaid",
|
|
58
58
|
"figma:cache:cursor:init": "node bin/figma-cache.js cursor init",
|
|
59
|
+
"cursor:shadow:sync": "node scripts/sync-cursor-shadow.js",
|
|
60
|
+
"cursor:shadow:check": "node scripts/check-cursor-shadow.js",
|
|
59
61
|
"docs:encoding:check": "node scripts/check-doc-encoding.js",
|
|
60
62
|
"figma:cache:mobile:spec": "node scripts/mobile/generate-mobile-spec.js"
|
|
61
63
|
},
|