text-to-design-mcp 0.2.0 → 0.3.0

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 +34 -44
  2. package/dist/index.js +1425 -439
  3. package/package.json +5 -2
package/README.md CHANGED
@@ -16,7 +16,23 @@
16
16
 
17
17
  ## 安装(三步)
18
18
 
19
- **第一步:安装后台服务**(任选一种包管理器)
19
+ **第一步:告诉 AI 工具**
20
+
21
+ 后台服务不用手动安装,AI 工具需时会通过 `npx` 自动拉取运行。在项目根目录的 `opencode.json`(没有就新建)里加:
22
+
23
+ ```json
24
+ {
25
+ "mcp": {
26
+ "text-to-design": {
27
+ "type": "local",
28
+ "command": ["npx", "-y", "text-to-design-mcp@latest"],
29
+ "enabled": true
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ 如果想全局安装(装一次、不依赖联网拉取),也可以用任意包管理器:
20
36
 
21
37
  | 管理器 | 命令 |
22
38
  | --- | --- |
@@ -24,6 +40,8 @@
24
40
  | pnpm | `pnpm add -g text-to-design-mcp` |
25
41
  | yarn | `yarn global add text-to-design-mcp` |
26
42
 
43
+ 全局安装后,上面的 `command` 可简化成 `["text-to-design-mcp"]`。
44
+
27
45
  **第二步:安装设计软件插件**
28
46
 
29
47
  先拿到插件包(任选):
@@ -36,25 +54,9 @@
36
54
 
37
55
  解压得到的安装包里有个 `dist` 文件夹。在即时设计里点「插件 → 导入」,选择里面的 `manifest.json`,然后回到画布运行插件。面板显示「已连接」就是准备好了。
38
56
 
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"]` 也可以)
57
+ **第三步:重启 AI 工具**
56
58
 
57
- 改完重启 AI 工具会话。
59
+ 改完重启 AI 工具会话(首次使用会自动拉取后台服务并常驻运行)。
58
60
 
59
61
  ## 怎么用
60
62
 
@@ -64,7 +66,7 @@
64
66
  - 「在画布中心画一个 300x200 的卡片,标题叫发布页,背景浅灰」
65
67
  - 「把选中的按钮导出成 PNG 存到 /tmp/btn.png」
66
68
 
67
- 想确认插件通不通,先让它调 `text_to_design_ping`。
69
+ 想确认插件通不通,先让它调 `jsd_ping`。
68
70
 
69
71
  ## 常见问题
70
72
 
@@ -95,30 +97,18 @@ pkill -f text-to-design-mcp
95
97
 
96
98
  | 工具 | 用途 |
97
99
  | --- | --- |
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` | 用本地图片填充节点 |
100
+ | `jsd_ping` | 检查插件是否在线 |
101
+ | `jsd_get_selection` | 读取画布当前选中的节点 |
102
+ | `jsd_execute` | 按描述创建节点(frame/rect/text 等,支持阴影/描边/渐变/文本样式) |
103
+ | `jsd_create_svg` | 直接导入 SVG 字符串(保留 path/矢量数据,不经降级) |
104
+ | `jsd_html_to_design` | 把 HTML 转成设计节点 |
105
+ | `jsd_update_selection` | 修改选中节点的属性(位置/颜色/文字/圆角等) |
106
+ | `jsd_find` | 按名称/类型查找节点 |
107
+ | `jsd_manage_nodes` | 节点结构操作,op 含 select/remove/clone/group/ungroup/flatten/outline_stroke/reparent/repair(清理引擎残留失效节点) |
108
+ | `jsd_manage_components` | 组件/实例操作,op 含 create_component(建空壳,子节点用 reparent 归入)/create_instance/detach_instance/import_component/swap_component/set_instance_properties/combine_as_variants |
109
+ | `jsd_export` | 导出节点为 PNG/JPG/SVG/PDF |
110
+ | `jsd_list_fonts` | 列出可用字体 |
111
+ | `jsd_fill_image` | 用本地图片填充节点 |
122
112
 
123
113
  ### 工作原理(简版)
124
114