text-to-design-mcp 0.2.0 → 0.3.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 (3) hide show
  1. package/README.md +32 -49
  2. package/dist/index.js +1425 -439
  3. package/package.json +5 -2
package/README.md CHANGED
@@ -16,13 +16,24 @@
16
16
 
17
17
  ## 安装(三步)
18
18
 
19
- **第一步:安装后台服务**(任选一种包管理器)
19
+ **第一步:告诉 AI 工具**
20
20
 
21
- | 管理器 | 命令 |
22
- | --- | --- |
23
- | npm | `npm i -g text-to-design-mcp` |
24
- | pnpm | `pnpm add -g text-to-design-mcp` |
25
- | yarn | `yarn global add text-to-design-mcp` |
21
+ 后台服务不用手动安装,注册命令统一为 `npx -y text-to-design-mcp@latest`,任意 AI 工具都会自动化拉取运行。把下面需求丢给 AI,它会按自己工具的格式注册 MCP 服务:
22
+
23
+ ```
24
+ 请为你在当前 AI 工具里注册 text-to-design MCP 服务:
25
+
26
+ 1. 后台服务无需手动安装,调用时你会通过 npx 自动拉取运行。
27
+ 2. 用你工具原生的方式注册一个 stdio MCP server:
28
+ 命令: npx -y text-to-design-mcp@latest
29
+ (按你自己的配置文件格式写入即可)
30
+ 3. 验证服务能启动:
31
+ timeout 5 npx -y text-to-design-mcp@latest
32
+ 预期输出含 "[text-to-design-mcp] shim 模式" 或 "daemon 就绪"(首次会自动拉起常驻服务)
33
+ 4. 完成注册后告诉我「已就绪」。
34
+ ```
35
+
36
+ 若希望全局安装(装一次、不依赖联网拉取),可 `npm i -g text-to-design-mcp`,注册命令可简化为 `text-to-design-mcp`。
26
37
 
27
38
  **第二步:安装设计软件插件**
28
39
 
@@ -36,25 +47,9 @@
36
47
 
37
48
  解压得到的安装包里有个 `dist` 文件夹。在即时设计里点「插件 → 导入」,选择里面的 `manifest.json`,然后回到画布运行插件。面板显示「已连接」就是准备好了。
38
49
 
39
- **第三步:告诉 AI 工具**
40
-
41
- 在项目根目录的 `opencode.json`(没有就新建)里加:
42
-
43
- ```json
44
- {
45
- "mcp": {
46
- "text-to-design": {
47
- "type": "local",
48
- "command": ["text-to-design-mcp"],
49
- "enabled": true
50
- }
51
- }
52
- }
53
- ```
54
-
55
- (没做全局安装的话,把 command 换成 `["npx", "text-to-design-mcp"]` 也可以)
50
+ **第三步:重启 AI 工具**
56
51
 
57
- 改完重启 AI 工具会话。
52
+ 改完重启 AI 工具会话(首次使用会自动拉取后台服务并常驻运行)。
58
53
 
59
54
  ## 怎么用
60
55
 
@@ -64,7 +59,7 @@
64
59
  - 「在画布中心画一个 300x200 的卡片,标题叫发布页,背景浅灰」
65
60
  - 「把选中的按钮导出成 PNG 存到 /tmp/btn.png」
66
61
 
67
- 想确认插件通不通,先让它调 `text_to_design_ping`。
62
+ 想确认插件通不通,先让它调 `jsd_ping`。
68
63
 
69
64
  ## 常见问题
70
65
 
@@ -95,30 +90,18 @@ pkill -f text-to-design-mcp
95
90
 
96
91
  | 工具 | 用途 |
97
92
  | --- | --- |
98
- | `text_to_design_ping` | 检查插件是否在线 |
99
- | `text_to_design_get_selection` | 读取画布当前选中的节点 |
100
- | `text_to_design_execute` | 按描述创建节点(frame/rect/text 等,支持阴影/描边/渐变/文本样式) |
101
- | `text_to_design_create_svg` | 直接导入 SVG 字符串(保留 path/矢量数据,不经降级) |
102
- | `text_to_design_html_to_design` | 把 HTML 转成设计节点 |
103
- | `text_to_design_update_selection` | 修改选中节点的属性(位置/颜色/文字/圆角等) |
104
- | `text_to_design_find` | 按名称/类型查找节点 |
105
- | `text_to_design_set_selection` | 设置画布选中节点 |
106
- | `text_to_design_remove` | 删除节点 |
107
- | `text_to_design_clone` | 复制节点 |
108
- | `text_to_design_group` | 编组 / 取消编组 |
109
- | `text_to_design_flatten` | 把多个节点合并成单个矢量 |
110
- | `text_to_design_outline_stroke` | 把节点描边转成矢量轮廓 |
111
- | `text_to_design_reparent` | 移动节点到目标父节点下 |
112
- | `text_to_design_create_component` | 把节点固化成组件 |
113
- | `text_to_design_create_instance` | 从组件创建实例 |
114
- | `text_to_design_swap_component` | 交换实例的组件 |
115
- | `text_to_design_set_instance_properties` | 设置实例的变体属性 |
116
- | `text_to_design_import_component` | 按 key 从团队库导入组件 |
117
- | `text_to_design_combine_as_variants` | 把多个组件合并成组件集 |
118
- | `text_to_design_detach_instance` | 解绑实例为普通帧 |
119
- | `text_to_design_export` | 导出节点为 PNG/JPG/SVG/PDF |
120
- | `text_to_design_list_fonts` | 列出可用字体 |
121
- | `text_to_design_fill_image` | 用本地图片填充节点 |
93
+ | `jsd_ping` | 检查插件是否在线 |
94
+ | `jsd_get_selection` | 读取画布当前选中的节点 |
95
+ | `jsd_execute` | 按描述创建节点(frame/rect/text 等,支持阴影/描边/渐变/文本样式) |
96
+ | `jsd_create_svg` | 直接导入 SVG 字符串(保留 path/矢量数据,不经降级) |
97
+ | `jsd_html_to_design` | 把 HTML 转成设计节点 |
98
+ | `jsd_update_selection` | 修改选中节点的属性(位置/颜色/文字/圆角等) |
99
+ | `jsd_find` | 按名称/类型查找节点 |
100
+ | `jsd_manage_nodes` | 节点结构操作,op 含 select/remove/clone/group/ungroup/flatten/outline_stroke/reparent/repair(清理引擎残留失效节点) |
101
+ | `jsd_manage_components` | 组件/实例操作,op 含 create_component(建空壳,子节点用 reparent 归入)/create_instance/detach_instance/import_component/swap_component/set_instance_properties/combine_as_variants |
102
+ | `jsd_export` | 导出节点为 PNG/JPG/SVG/PDF |
103
+ | `jsd_list_fonts` | 列出可用字体 |
104
+ | `jsd_fill_image` | 用本地图片填充节点 |
122
105
 
123
106
  ### 工作原理(简版)
124
107