@codify-ai/mcp-client 1.0.29 → 1.0.31

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
@@ -81,13 +81,9 @@ codify://getCode/{contentId}
81
81
 
82
82
  在对话中通过或直接输入 URI 引用:
83
83
 
84
- - `codify://generation-rules`
85
- - 逆向转译与代码规范:
86
- 你需要让 LLM 严格遵守转译代码规范才能完美的将它转译为 MasterGo 设计稿。当你需要将你已有的前端项目转换为设计稿的时候,必须让 LLM 读取此文档。
87
-
88
- - `codify://design-philosophy`
89
- - 核心设计哲学:
90
- Codify为你总结了一套非常实用的UI设计哲学,它能够让LLM在生成页面的时候,保持优秀的设计审美。
84
+ - `codify://rule`
85
+ - 核心规范与设计哲学:
86
+ 你需要让 LLM 严格遵守转译代码规范才能完美的将它转译为 MasterGo 设计稿。当你需要将你已有的前端项目转换为设计稿的时候,必须让 LLM 读取此文档。同时,Codify为你总结了一套非常实用的UI设计哲学,它能够让LLM在生成页面的时候,保持优秀的设计审美。
91
87
 
92
88
  ## 可用工具
93
89
 
@@ -121,6 +117,25 @@ codify://getCode/{contentId}
121
117
  - **参数**: `contentId` (必填), `projectDir` (必填), `outDir` (必填), `documentId` (可选)
122
118
  - **示例**: "从频道 demo-123 获取代码"
123
119
 
120
+ #### **get_library_list**
121
+
122
+ 获取当前文件已加载/已订阅的团队库列表(名称、ID、组件数、样式数)。
123
+
124
+ - **参数**: 无
125
+ - **示例**: "列出当前可用的团队库"
126
+
127
+ #### **get_component_info**
128
+
129
+ 拉取指定团队库组件数据并落盘到本地 `.codify/library/<teamLibraryId>/<teamLibraryName>.json`,用于组件库页面生成。
130
+
131
+ - **参数**: `projectDir` (必填), `teamLibraryId` (可选), `teamLibraryName` (可选), `includePropertyDetails` (可选, 默认 true)
132
+ - **示例**: "使用 Ant Design UIKit 团队库,拉取组件信息"
133
+
134
+ 组件库页面生成标准流程:
135
+ 1. 调用 `get_library_list` 确认团队库;
136
+ 2. 调用 `get_component_info` 拉取并落盘 JSON;
137
+ 3. 读取 JSON 结构:`components` 用于 `<ui-component>`,`icons` 用于 `<ui-icon>`;其中 `<ui-component>` 的 `props` 仅允许由 `components[].props` 推导(禁止臆造)。
138
+
124
139
  ### 🎨 生成与设计
125
140
 
126
141
  #### **design**
@@ -0,0 +1,99 @@
1
+ # MasterGo 组件生成规范(Component / Component Set)
2
+
3
+ ## 规则边界
4
+ - 本文件仅定义“生成 MasterGo 母版组件/组件集”的代码规范。
5
+ - 页面级转译硬约束(如禁用 margin、禁用原生表单、显式 Flex)仍应遵循 `page-generate.md`。
6
+ - 本文件不定义工作流编排与工具调用顺序;仅约束输出代码本身。
7
+
8
+ ## 目标
9
+ 根据需求输出可被插件识别的组件代码,生成以下两类资产:
10
+ 1. `Component`(单个母版组件)
11
+ 2. `Component Set`(带变体的组件集)
12
+
13
+ ## 输出契约(必须)
14
+ 1. 仅输出纯 HTML 代码片段,不输出 Markdown、注释或解释性文本。
15
+ 2. 根节点必须包含 `data-type`,且只能是:
16
+ - `data-type="component"`
17
+ - `data-type="component-set"`
18
+ 3. 禁止输出 `html/head/body/script/style/link/meta/title`。
19
+ 4. 所有可见节点都应包含 `data-name="..."`(语义化命名,英文或中文均可,推荐英文 kebab-case)。
20
+
21
+ ## 单组件协议(data-type="component")
22
+ 适用于仅需一个状态的组件(如 Badge、Avatar、Button 单态)。
23
+
24
+ 必填字段:
25
+ - 根节点:`data-type="component"`
26
+ - 根节点:`data-name="组件名"`
27
+
28
+ 示例:
29
+ ```html
30
+ <div data-type="component" data-name="primary-button" class="flex flex-row justify-center items-center bg-[#2563EB] rounded-[10px] px-[16px] py-[10px]">
31
+ <span data-name="label" class="text-[14px] leading-[1.2] font-[600] text-[#FFFFFF]">确认</span>
32
+ </div>
33
+ ```
34
+
35
+ ## 组件集协议(data-type="component-set")
36
+ 适用于存在多状态/多尺寸/多语义的可复用组件。
37
+
38
+ ### 结构规则(硬约束)
39
+ 1. 根节点必须为 `data-type="component-set"`,并带 `data-name`。
40
+ 2. 所有变体节点必须是 `component-set` 的直接子元素(禁止中间包裹层)。
41
+ 3. 每个变体节点必须为 `data-type="component"`。
42
+ 4. 变体属性使用扁平字段声明:`data-variant-<属性名>="<属性值>"`。
43
+
44
+ ### 变体维度规则(硬约束)
45
+ 1. 同一组件集内,所有变体必须使用同一组维度键(例如都包含 `status` 与 `size`)。
46
+ 2. 每个变体都必须完整声明全部维度键,禁止只写一部分。
47
+ 3. 维度值建议使用小写英文短词(如 `primary` / `default` / `sm` / `lg`)。
48
+ 4. 若用户未明确要求“只做子集”,应优先生成主要组合(笛卡尔组合的核心态)。
49
+
50
+ 示例(`status × size`):
51
+ ```html
52
+ <div data-type="component-set" data-name="button" class="flex flex-col justify-start items-start gap-[12px] p-[16px] bg-[#F8FAFC]">
53
+ <div data-type="component" data-name="button-primary-sm" data-variant-status="primary" data-variant-size="sm" class="flex flex-row justify-center items-center bg-[#2563EB] rounded-[8px] px-[12px] py-[8px]">
54
+ <span data-name="label" class="text-[12px] leading-[1.2] font-[600] text-[#FFFFFF]">Primary</span>
55
+ </div>
56
+
57
+ <div data-type="component" data-name="button-primary-lg" data-variant-status="primary" data-variant-size="lg" class="flex flex-row justify-center items-center bg-[#2563EB] rounded-[10px] px-[20px] py-[12px]">
58
+ <span data-name="label" class="text-[14px] leading-[1.2] font-[600] text-[#FFFFFF]">Primary</span>
59
+ </div>
60
+
61
+ <div data-type="component" data-name="button-secondary-sm" data-variant-status="secondary" data-variant-size="sm" class="flex flex-row justify-center items-center bg-[#E2E8F0] rounded-[8px] px-[12px] py-[8px]">
62
+ <span data-name="label" class="text-[12px] leading-[1.2] font-[600] text-[#0F172A]">Secondary</span>
63
+ </div>
64
+
65
+ <div data-type="component" data-name="button-secondary-lg" data-variant-status="secondary" data-variant-size="lg" class="flex flex-row justify-center items-center bg-[#E2E8F0] rounded-[10px] px-[20px] py-[12px]">
66
+ <span data-name="label" class="text-[14px] leading-[1.2] font-[600] text-[#0F172A]">Secondary</span>
67
+ </div>
68
+ </div>
69
+ ```
70
+
71
+ ## 样式与结构要求(继承 page-generate 的关键硬规则)
72
+ 1. 禁止任何 margin 写法(`m-*` / `mx-*` / `space-*` / 行内 margin)。
73
+ 2. 禁止 Grid;仅允许 Flex。
74
+ 3. 所有 Flex 容器必须显式写全:`flex` + `flex-row|flex-col` + `justify-*` + `items-*`。
75
+ 4. 禁止原生交互标签:`input/select/textarea/button/form`(用静态层模拟)。
76
+ 5. 尺寸建议使用绝对像素任意值(如 `w-[120px]`、`p-[12px]`)。
77
+
78
+ ## 图标与文本
79
+ 1. 图标优先使用 FontAwesome `<i class="fas/fa* fa-...">`。
80
+ 2. 图标必须显式声明 `text-[size]` 与 `text-[#hex]`。
81
+ 3. 长文本用 `<p>`,短文本用 `<span>`。
82
+
83
+ ## 常见错误(禁止)
84
+ 1. 在 `component-set` 与 `component` 之间加中间层。
85
+ 2. 同一组件集内变体维度不一致(如有的只有 `status`,有的有 `status+size`)。
86
+ 3. 根节点缺失 `data-type` 或 `data-name`。
87
+ 4. 输出页面容器(如 `<main w-[1440px]>`)来包裹组件集。
88
+
89
+ ## 输出前自检清单
90
+ 1. 根节点是否为 `component` 或 `component-set`。
91
+ 2. 每个节点是否都有 `data-name`。
92
+ 3. 若为 `component-set`,所有变体是否直系子节点。
93
+ 4. 变体维度键和值是否完整一致。
94
+ 5. 是否存在 margin / grid / 原生表单标签。
95
+ 6. Flex 是否显式写全。
96
+
97
+ ## 与工具参数对齐
98
+ - 提交组件时,传入字段是 `code`(不是 `htmlCode`)。
99
+ - `code` 内容必须包含 `data-type="component"` 或 `data-type="component-set"`。
@@ -0,0 +1,247 @@
1
+ # 组件引用规则(团队库模式)
2
+
3
+ ## 规则边界(先读)
4
+ - 本文档只定义“组件库模式”的专属规则。
5
+ - 所有组件模式输出,必须同时满足 `page-generate.md` 的全部硬规则。
6
+ - 若本文与 `page-generate.md` 出现冲突,以 `page-generate.md` 为最高优先级。
7
+
8
+ ## 模式入口
9
+ 仅当用户明确要求“使用某团队库/组件库生成页面”时,才进入组件库流程。
10
+
11
+ 若用户仅要求“参考团队库样式/变量/图标”:
12
+ - 不进入组件库流程
13
+ - 不使用 `<ui-component>`(除非用户明确要求组件生成)
14
+
15
+ 示例:
16
+ ```text
17
+ 使用 Element-Plus 团队库的组件生成一个后台页面
18
+ ```
19
+
20
+ ## 流程(仅组件库模式)
21
+ 1. `get_library_list`(确认目标团队库)
22
+ 2. `get_component_info`(落盘本地快照)
23
+ 3. 严格基于落盘 JSON 生成代码
24
+ 4. 如果你无法推测这个组件的形态,你可以查看 `index.json` 里 `cover` 字段的图片
25
+ 5. 使用 `variable.json` 里的样式变量
26
+
27
+ 示例:
28
+ ```text
29
+ get_library_list -> get_component_info -> 读取 index/components/icons/variable -> 生成页面 -> agent_create_page
30
+ ```
31
+
32
+ ## 数据来源(唯一事实)
33
+ 按顺序读取:
34
+ 1. `index.json`(候选组件)
35
+ 2. `components/{key}.json`(组件详情)
36
+ 3. `icons.json`
37
+ 4. `variable.json`(样式变量,必须读取)
38
+
39
+ 禁止臆造组件名、props、slot 名称、图标名或 instance_swap 值。
40
+
41
+ 示例(读取顺序):
42
+ ```text
43
+ 先从 index.json 选“卡片”
44
+ 再读 components/001-卡片.json 获取 props/slots/instance_swap
45
+ 再读 icons.json 选择图标名
46
+ 最后读 variable.json 使用设计变量
47
+ ```
48
+
49
+ ## 变量样式协议(关键)
50
+ - 在 `full-components` 与 `hybrid` 两种策略下,必须优先使用 `variable.json` 中可用变量表达样式。
51
+ - 适用范围:颜色、字号、字重、行高、圆角、边框宽度、阴影、间距(gap/padding)等关键视觉属性。
52
+ - 变量引用格式统一为 `var(...)`,并放入 Tailwind 任意值语法;引用时必须使用变量名(`name`,缺失时可用 `ukey`),禁止直接抄 `value`。
53
+ - 若变量项为 `{ name: "色彩/brand/primary", value: "#1677FF" }`,必须写 `bg-[var(色彩/brand/primary)]`,禁止写 `bg-[#1677FF]`。
54
+ - 若变量项为 `{ name: "间距/index_10/sm", value: "8px" }`,必须写 `gap-[var(间距/index_10/sm)]`,禁止写 `gap-[8px]`。
55
+ - 变量引用示例:
56
+ - `bg-[var(色彩/brand/primary)]`
57
+ - `text-[var(文字/正文/14)]`
58
+ - `gap-[var(间距/index_10/sm)]`
59
+ - `rounded-[var(圆角/index_6/md)]`
60
+ - 仅当 `variable.json` 中确实不存在可匹配变量时,才允许回退字面值(Hex/px);并需在输出前自检中标注“属性 + 缺失变量原因”。
61
+
62
+ 示例:
63
+ ```html
64
+ <div data-name="filter-wrap" class="flex flex-row justify-start items-center gap-[var(间距/index_10/sm)] p-[var(间距/index_12/md)] bg-[var(色彩/填充/容器)] rounded-[var(圆角/index_6/md)]">
65
+ <span data-name="filter-label" class="text-[var(文字/正文/14)] leading-[var(行高/正文/1.5)] font-[var(字重/medium)] text-[var(色彩/文本/主)]">筛选条件</span>
66
+ </div>
67
+ ```
68
+
69
+ ## 合法引用
70
+ - `<ui-component name="...">`
71
+ - `name` 必须来自组件详情
72
+ - `props` 字段必须存在于组件详情
73
+ - `props` / `instance_swap` / `variants` 等 JSON 属性必须使用**单引号**包裹,内部 JSON 使用双引号(合法 JSON)
74
+ - 严禁输出 HTML 实体编码到 JSON 属性中(如 `&quot;` / `&#34;` / `&#x22;`)
75
+ - 若模型生成了双引号包裹 JSON 或实体编码,必须在最终输出前改写为单引号 JSON 属性
76
+ - `instance_swap` 的值优先使用组件名(name);也可使用 ukey 或组件库 component id
77
+ - 禁止使用画布节点 ID(例如 `data-node-id` / `450:74735/414:32354`)作为 `instance_swap` 值
78
+ - 布局样式按排版需要声明:需要填充主区域时使用 `flex-1` / `self-stretch`;需要固定宽度时可写 `w-[...]`
79
+ - `class` 按需声明:若不需要额外布局/视觉覆盖可省略;若处于复杂布局容器中,建议补充布局 class 以保证排版稳定
80
+ - `<ui-icon name="...">`
81
+ - `name` 必须来自 `icons[].name`
82
+ - 仅用于“独立图标节点”或“组件明确存在可承载图标节点的 slot”
83
+ - 禁止把 `<ui-icon slot="...">` 当作 `instance_swap` 的替代写法
84
+
85
+ 示例:
86
+ ```html
87
+ <ui-component
88
+ data-name="header-action"
89
+ name="按钮"
90
+ class="flex-1"
91
+ props='{"内容":"保存","类型":"首选","显示图标":true}'
92
+ instance_swap='{"图标":"SwitchButton"}'
93
+ ></ui-component>
94
+
95
+ <ui-icon data-name="status-icon" name="@CoffeeOutlined" class="text-[16px] text-[#1F2329]"></ui-icon>
96
+ ```
97
+
98
+ 示例(JSON 属性引号规范,正确):
99
+ ```html
100
+ <ui-component
101
+ data-name="switch-button"
102
+ name="按钮"
103
+ props='{"类型":"首选","内容":"Button","显示图标":true}'
104
+ instance_swap='{"图标":"@SwitchButton"}'
105
+ ></ui-component>
106
+ ```
107
+
108
+ 示例(禁止):
109
+ ```html
110
+ <ui-component
111
+ name="按钮"
112
+ props="{&quot;类型&quot;:&quot;首选&quot;,&quot;内容&quot;:&quot;Button&quot;}"
113
+ ></ui-component>
114
+ ```
115
+
116
+ ## 子实例接入决策(instance_swap vs 子节点直写)
117
+ - 先看组件详情:
118
+ - `slots` 非空:按 slot 白名单注入内容(`<ui-slot name="...">` 或 `slot="..."`)。
119
+ - `slots` 为空但存在 `instance_swap`(如 `"图标": "10:38187"` / `"前缀": "10:xxxx"`):使用 `<ui-component instance_swap='...'>`,不要用子节点伪造替换。
120
+ - `instance_swap` 是通用“子实例替换”通道,不仅限图标;也可用于前后缀、状态标记、操作区子组件等可替换实例。
121
+ - `instance_swap` 的 value 必须来自组件能力映射(组件名/name、ukey 或组件 id),不是任意字符串。
122
+ - 若某替换目标存在对应 props 开关(如 `显示图标` / `显示右边图标` / `启用前缀`),使用替换时必须同步设为 `true`。
123
+ - `instance_swap` 与子节点直写是两条通道:前者是组件内部实例替换,后者是显式节点渲染,不能混用表达同一替换位。
124
+
125
+ 示例(按钮通过 `instance_swap` 注入图标,正确):
126
+ ```html
127
+ <ui-component
128
+ data-name="login-button"
129
+ name="按钮"
130
+ class="self-stretch"
131
+ props='{"类型":"首选","尺寸":"大号","内容":"登录","显示图标":true}'
132
+ instance_swap='{"图标":"SwitchButton"}'
133
+ ></ui-component>
134
+ ```
135
+
136
+ ## `<ui-component>` 布局样式约定
137
+ - `<ui-component>` 不强制固定尺寸;布局样式应由父容器排版需求决定。
138
+ - 需要占满剩余空间时,使用 `flex-1` / `self-stretch`。
139
+ - 需要固定宽度时,可使用 `w-[...]`。
140
+ - 默认不写固定高度 `h-[...]`,高度应优先遵循组件本身规范与内容自适应。
141
+
142
+ 示例(合规):
143
+ ```html
144
+ <ui-component data-name="table-wrap" name="表格" class="flex-1 self-stretch" props='{"尺寸":"默认"}'></ui-component>
145
+ <ui-component data-name="kpi-card" name="统计卡片" class="w-[320px]" props='{"类型":"默认"}'></ui-component>
146
+ <ui-component data-name="side-panel" name="侧边栏" class="w-[320px]" props='{"模式":"默认"}'></ui-component>
147
+ ```
148
+
149
+ ## 插槽规则
150
+ - `slots` 是白名单。
151
+ - slot 名称必须与白名单完全一致。
152
+ - 推荐结构:`<ui-slot name="...">` 只保留 `name`;插槽内第一层容器承载 `data-name` 与布局 class。
153
+ - slot 内容必须放入匹配的 `<ui-slot name="...">`(或兼容写法 `slot="..."`)。
154
+
155
+ 示例(`<ui-slot>`):
156
+ ```html
157
+ <ui-component
158
+ data-name="profile-card"
159
+ name="卡片"
160
+ class="w-[380px]"
161
+ props='{"显示头部插槽":true}'
162
+ >
163
+ <ui-slot name="内容">
164
+ <div data-name="card-content" class="flex flex-col self-stretch justify-start gap-[16px] p-[20px]">
165
+ <p data-name="card-title" class="text-[16px] leading-[1.5] font-[600] text-[#1F2329]">个人信息</p>
166
+ </div>
167
+ </ui-slot>
168
+ </ui-component>
169
+ ```
170
+
171
+
172
+ ## slot_layout 使用规则
173
+ 当组件详情含 `slot_layout` 时,插槽内容应尽量跟随该布局信息:
174
+ - `flexMode: VERTICAL`:优先使用 `flex flex-col`
175
+ - `flexMode: HORIZONTAL`:优先使用 `flex flex-row`
176
+ - 需要填满父插槽时:
177
+ - 主轴填充使用 `flex-1`
178
+ - 交叉轴填充使用 `self-stretch`
179
+
180
+ 示例:
181
+ ```json
182
+ {
183
+ "slots": ["内容"],
184
+ "slot_layout": {
185
+ "内容": { "flexMode": "VERTICAL", "padding": [20, 20, 20, 20], "gap": 16 }
186
+ }
187
+ }
188
+ ```
189
+
190
+ ```html
191
+ <ui-slot name="内容">
192
+ <div data-name="card-content" class="flex flex-col self-stretch justify-start gap-[16px] p-[20px]">
193
+ <div data-name="form-block" class="flex-1 self-stretch"></div>
194
+ </div>
195
+ </ui-slot>
196
+ ```
197
+
198
+ ## 构建策略
199
+ - `full-components`(全组件设计模式):
200
+ - 页面中的功能区块(如头部、筛选区、表单区、表格区、操作区、状态区)必须优先使用 `<ui-component>`
201
+ - 只要 `index.json + components/*.json` 中存在可用组件,就禁止改为普通 HTML 自绘
202
+ - 必须全量使用组件库样式变量与图标系统(变量优先,格式为 `var(...)`)
203
+ - 仅当本地快照中确实不存在可用组件时,才允许局部回退普通 HTML,并在输出前自检中逐项说明“缺失组件原因”
204
+ - `hybrid`(混合设计模式):
205
+ - 视觉优先,关键功能区使用组件
206
+ - 允许非关键区块自由绘制
207
+ - 但必须全量使用组件库样式变量与图标系统(变量优先,格式为 `var(...)`)
208
+
209
+ 示例:
210
+ ```text
211
+ buildStrategy = "full-components"
212
+ buildStrategy = "hybrid"
213
+ ```
214
+
215
+ ## full-components 专项硬约束
216
+ - 禁止把常见可组件化区块直接自绘:按钮、输入框、下拉、表单项、标签、卡片、表格、分页、弹窗、菜单、导航、空状态、加载态。
217
+ - 先从 `index.json` 选择候选组件,再读取对应 `components/{key}.json` 确认 props/slots;确认可用后必须使用 `<ui-component>`。
218
+ - 组件布局样式按排版需要声明:占满剩余空间使用 `flex-1/self-stretch`;仅在需要固定宽度时写 `w-[...]`。
219
+ - 若最终出现普通 HTML 区块,必须满足两条:
220
+ 1. 在组件快照中无法找到可替代组件;
221
+ 2. 在输出前自检中逐项标注“区块名 + 缺失原因”。
222
+ - 变量样式强约束:凡能匹配 `variable.json` 的样式属性必须使用 `var(...)`,不得随意写 Hex/px 字面值。
223
+ - 变量名强约束:`var(...)` 中必须写变量名(`name`/`ukey`),禁止把 `value` 直接写进 class(如 `bg-[#1677FF]`、`gap-[8px]`)。
224
+
225
+ ## 失败回退
226
+ 关键字段缺失或不确定时,允许回退普通 HTML;不要使用不确定的组件引用。
227
+ 但在 `full-components` 模式下,回退仅限“组件快照不存在可替代项”的区块,且必须在自检中逐项说明。
228
+ 变量缺失时,也仅允许该属性局部回退字面值,并在自检中说明“属性 + 缺失变量原因”。
229
+
230
+ 示例:
231
+ ```text
232
+ 未在 components/*.json 找到“图标插槽”定义 -> 使用普通 HTML 容器表达,不拼接 instance_swap
233
+ ```
234
+
235
+ ## 节点修改约束(组件场景)
236
+ - 仅“组件库图标替换”(`<ui-icon>` 或 `instance_swap` 调整)及组件 `props` 调整属于“属性修改”,必须使用 `agent_update_node`。
237
+ - 禁止因为“图标未生效”自动切换到 `agent_replace_node`。
238
+ - 仅当组件内部结构确实变化(新增/删除/重排子节点)时,才允许 `agent_replace_node`。
239
+ - 非组件库资源(`<i>`/`<img>`)修改默认使用 `agent_replace_node`:
240
+ - 图标:必须使用 FontAwesome 规范(`<i class="fas/fa* fa-xxx text-[size] text-[#hex]">`),禁止 `div/svg/path` 手绘图标(除非用户明确要求自定义 SVG)
241
+ - 图片换图:使用 `<img src="{{keyword}}" />` 语义格式
242
+
243
+ 推荐顺序:
244
+ 1. `get_selection_code` 拉取最新上下文
245
+ 2. `agent_update_node` 提交属性修改
246
+ 3. 再次 `get_selection_code` 验证结果
247
+ 4. 若仍不生效,输出诊断信息并等待下一步指令,不得自动结构替换
package/dist/en.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "getCodifyGuidelines": {
3
+ "description": "[Session entry] When the user wants to use Codify / MasterGo workflows (e.g. \"use codify mcp\", \"design with Codify\"), call this tool first. The system provides three rule sets: page-generate, component-import, and component-generate. It supports scoped rules or all aggregated rules.",
4
+ "inputSchema": "Optional: scope (all/page-generate/component-import/component-generate), default all. all returns page-generate + component-import + final hard gate."
5
+ },
6
+ "createPage": {
7
+ "description": "Send code to the Codify plugin to convert it into a design.\n\n[Performance Tip] If pure HTML is already saved as a local file, it is highly recommended to pass the absolute path via filePath. If generating code temporarily, use the code parameter directly.\n\nReverse Transpilation Warning: Strictly forbidden to directly send Vue/React business code containing dynamic bindings ({{}}) or framework directives! If you want to convert business code to a design, you MUST first perform \"Reverse Transpilation\" (refer to codify://rule) to convert it into pure HTML with static mock data before sending.",
8
+ "code": "[Optional] The HTML code content to send. Use ONLY if the code is temporarily generated and not saved as a file.",
9
+ "filePath": "[Optional] The absolute path of the local HTML file. If the file exists locally, you MUST pass this parameter; the tool will automatically read and persist it.",
10
+ "projectDir": "[Required] The absolute path of the user's current workspace root directory.",
11
+ "saveCodeToLocal": "Whether to save the rendering results returned by the plugin to the local .codify directory (persistence mechanism)."
12
+ },
13
+ "updateNode": {
14
+ "description": "Send back locally modified code. [Tool Selection Rule]: By default this is for non-structural property tweaks (text, size, color, border, shadow, effects). Hard exception: if the target is a non-library icon/image (`<i>`/`<img>`), DO NOT use agent_update_node; you MUST use agent_replace_node. Note: If modifying styles on a parent container, the returned HTML must include all original child elements to prevent data loss.",
15
+ "documentId": "Current MasterGo document ID.",
16
+ "documentPageId": "Current MasterGo page ID.",
17
+ "targetNodeId": "[Optional] Target layer ID (e.g., 123:456). Defaults to the current selection.",
18
+ "code": "[Required] Modified HTML fragment. MUST include data-node-id."
19
+ },
20
+ "replaceNode": {
21
+ "description": "Perform [Structural Replacement] on a target node. Call this when you need to significantly change the internal structure (e.g., adding, removing, or reordering child elements). This tool is also required for non-library icon/image edits (`<i>`/`<img>`). Even with major changes, the tool intelligently attempts to preserve the root ID to maintain agent context.",
22
+ "documentId": "Current MasterGo document ID.",
23
+ "documentPageId": "Current MasterGo page ID.",
24
+ "targetNodeId": "[Optional] Target layer ID (e.g., 123:456). Defaults to the current selection.",
25
+ "code": "[Required] New HTML code. Will fully replace the target node content."
26
+ },
27
+ "syncToDesign": {
28
+ "description": "Perform a [Full Sync]: overwrite the MasterGo design with your full static HTML file. Only call this when the user explicitly asks to sync to canvas; never auto-sync after local edits.",
29
+ "documentId": "Current MasterGo document ID.",
30
+ "documentPageId": "Current MasterGo page ID.",
31
+ "targetNodeId": "[Recommended] Root Node ID (rootId). Defaults to current selection if omitted.",
32
+ "filePath": "[Required] Absolute path of local static HTML file (found in .codify/...). Tool auto-reads the file. NEVER pass .vue/.tsx paths!",
33
+ "userConfirmed": "[Required] Whether the user explicitly confirmed syncing to canvas. Only pass true after explicit user request."
34
+ },
35
+ "getSelectionCode": {
36
+ "description": "Get HTML/CSS code for the currently selected layer (or a specified layer) in MasterGo and intelligently persist it to the local project directory. The generated code is typically used for partial modifications or syncing local base files.",
37
+ "projectDir": "[Required] The absolute path of the user's current workspace root directory.",
38
+ "targetNodeId": "[Optional] MasterGo layer ID (e.g., 123:456). If provided, the code for that ID will be pulled directly; if not, the code for the currently selected layer will be pulled.",
39
+ "syncToBase": "[Optional] Whether to sync the obtained child layer code back to the base HTML file in the local .codify directory (merge update). Defaults to true."
40
+ },
41
+ "createComponent": {
42
+ "description": "Create a MasterGo master component or component set (variant). It is recommended to load get_codify_guidelines(scope=\"component-generate\") first, then call this tool. This tool only sends code to plugin and does not perform fallback rule validation.",
43
+ "code": "Pure HTML string of the component. Root node must include data-type=\"component\" or \"component-set\". For component-set, variant nodes must be direct children and variant attributes must be declared with flat data-variant-* fields."
44
+ },
45
+ "getDesignDiff": {
46
+ "description": "Get the difference between the local base file and the current MasterGo canvas design. Returns a JSON Diff result to help determine what layers or styles have changed.",
47
+ "projectDir": "[Required] The absolute path of the user's current workspace root directory.",
48
+ "targetNodeId": "[Optional] MasterGo layer ID (e.g., 123:456). If not provided, the code of the currently selected layer will be fetched for comparison by default.",
49
+ "filePath": "[Optional] The absolute path of the local base HTML file. If you have updated the base file via write_to_file, pass this path directly.",
50
+ "syncType": "[Optional] Sync direction, must be codeSyncDesign (code syncs to design) or designSyncCode (design syncs to code)."
51
+ },
52
+ "getCodeList": {
53
+ "description": "Get a list of all available code items",
54
+ "inputSchema": "Get code list without parameters"
55
+ },
56
+ "design": {
57
+ "description": "Generate HTML+CSS code that complies with Codify specifications. Fixed flow: ask whether to use component library first; if yes, ask the user to pick a team library every time, then ask build strategy (full-components/hybrid), and only then generate. In component mode, read local .codify/library snapshots first; if missing, call get_library_list + get_component_info.",
58
+ "requirement": "Interface requirement description, e.g., \"a beautiful login page\", \"a modern dashboard interface\", etc.",
59
+ "code": "[Optional] If full code is already generated (can include Markdown + <main>), it will auto-extract <main> and submit directly to canvas.",
60
+ "projectDir": "[Optional] Absolute path of the user workspace root. Recommended for component-library generation so local .codify/library data can be matched first.",
61
+ "useComponentLibrary": "[Required by workflow] Whether to use component library. For each design call, the user must explicitly choose true/false first.",
62
+ "userConfirmedUseComponentLibrary": "[Required by workflow] Whether the user confirmation step for \"use component library or not\" has been explicitly completed in this page-generation flow.",
63
+ "teamLibraryName": "[Required in component mode] User-confirmed team library name. Must be reconfirmed each time; assistant must not auto-pick.",
64
+ "buildStrategy": "[Required in component mode] Build strategy: full-components (all-component mode: componentizable blocks must use components; <ui-component> layout should be declared only when needed, e.g., flex-1/self-stretch for fill or w-[...] for fixed column width, while fixed height h-[...] is avoided by default; styles should prioritize variable.json var(...), and var(...) must reference variable name/ukey instead of raw value; HTML fallback is allowed only when no matching library component exists, and the reason must be stated) or hybrid (mixed mode: only necessary components while fully using component-library styles/variables and icon system; used <ui-component> follows the same on-demand layout rule; var(...) preferred with variable name/ukey required). If omitted, ask the user to choose first."
65
+ },
66
+ "getUserInfo": {
67
+ "description": "Get current logged-in user information, including quotas, teams, etc.",
68
+ "inputSchema": "Get current user information"
69
+ },
70
+ "getCode": {
71
+ "description": "[Specific Scenario] Get code from the Codify plugin via contentId. For regular \"get selected code\" tasks, please prioritize using the get_selection_code tool.",
72
+ "contentId": "Instruction to copy layers from the Codify plugin (contentId)",
73
+ "documentId": "Current MasterGo document ID.",
74
+ "documentPageId": "Current MasterGo page ID.",
75
+ "projectDir": "[Required] The absolute path of the user's current workspace root directory.",
76
+ "outDir": "[Required] The absolute path to save code and resources"
77
+ },
78
+ "getLibraryList": {
79
+ "description": "Get team library list subscribed/loaded in current file (name, id, componentCount, styleCount). When user says \"generate page with xxx component library\", call this tool first.",
80
+ "inputSchema": "No parameters"
81
+ },
82
+ "getComponentInfo": {
83
+ "description": "Get component data of a specified team library and persist it as a \"catalog + library index + component details\" snapshot:\n- .codify/library/catalog.json\n- .codify/library/<teamLibraryId>/meta.json\n- .codify/library/<teamLibraryId>/<teamLibraryName>/index.json\n- .codify/library/<teamLibraryId>/<teamLibraryName>/components/<componentKey>.json\n- .codify/library/<teamLibraryId>/<teamLibraryName>/icons.json\n- .codify/library/<teamLibraryId>/<teamLibraryName>/variable.json\n\nIf teamLibraryId is missing, it first returns library choices; after you reply \"use xxx library\", call again with teamLibraryName to auto-match the id.\n\nSchema quick map: components[].{id,name,size,props,slots,instance_swap} + icons[].{id,name} + variables{}. Generation is strict: <ui-component>.name/props come from component detail files, instance_swap should prefer component name (name), and may also use ukey or library component id (do not use canvas data-node-id), and <ui-icon>.name comes from icons[].name. If a component has non-empty slots, you must follow the slot structure (prefer <ui-slot name=\"...\">). Before page generation, you must read index.json first (name/description), then load required component details via fixed path components/${key}.json and read variable.json for var(...) token references.",
84
+ "projectDir": "[Required] Absolute path of the user's workspace root (for persistence).",
85
+ "teamLibraryId": "[Optional] Team library ID. If provided, fetch directly.",
86
+ "teamLibraryName": "[Optional] Team library name. Used to auto-match ID when teamLibraryId is not provided.",
87
+ "includePropertyDetails": "[Optional] Include component property details. Default true."
88
+ },
89
+ "removeNode": {
90
+ "description": "Delete nodes in the MasterGo canvas. Supports specifying an ID via targetNodeId, or defaults to the currently selected layer if no ID is provided.",
91
+ "documentId": "Current MasterGo document ID.",
92
+ "documentPageId": "Current MasterGo page ID.",
93
+ "targetNodeId": "[Optional] The target layer ID to delete (e.g., 123:456). If not provided, the currently selected layer in MasterGo will be deleted by default."
94
+ }
95
+ }