@qingflow-tech/qingflow-cli 1.1.42 → 1.1.43-beta.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 (42) hide show
  1. package/README.md +4 -4
  2. package/package.json +2 -1
  3. package/pyproject.toml +3 -2
  4. package/src/qingflow_mcp/app_form_compat.py +115 -0
  5. package/src/qingflow_mcp/app_form_validator.py +199 -0
  6. package/src/qingflow_mcp/builder_facade/app_form.py +2836 -0
  7. package/src/qingflow_mcp/builder_facade/app_form_schema.py +269 -0
  8. package/src/qingflow_mcp/builder_facade/schemas/app_form/manifest.json +37 -0
  9. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/complete.json +1766 -0
  10. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/address.json +76 -0
  11. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/amount.json +76 -0
  12. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/attachment.json +76 -0
  13. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/code_block.json +223 -0
  14. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/data_relation.json +538 -0
  15. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/date.json +76 -0
  16. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/datetime.json +76 -0
  17. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/department.json +149 -0
  18. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/email.json +76 -0
  19. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/link.json +76 -0
  20. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/long_text.json +76 -0
  21. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/member.json +76 -0
  22. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/multi_select.json +92 -0
  23. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/number.json +76 -0
  24. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/phone.json +76 -0
  25. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/q_linker.json +338 -0
  26. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/relation.json +137 -0
  27. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/single_choice.json +92 -0
  28. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/single_select.json +92 -0
  29. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/subtable.json +810 -0
  30. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/fields/text.json +76 -0
  31. package/src/qingflow_mcp/builder_facade/schemas/app_form/v1alpha1/summary.json +713 -0
  32. package/src/qingflow_mcp/builder_facade/service.py +5 -2
  33. package/src/qingflow_mcp/cli/commands/builder.py +91 -28
  34. package/src/qingflow_mcp/cli/json_io.py +21 -2
  35. package/src/qingflow_mcp/cli/main.py +3 -39
  36. package/src/qingflow_mcp/cloud_oauth_proxy.py +96 -3
  37. package/src/qingflow_mcp/public_surface.py +5 -2
  38. package/src/qingflow_mcp/response_trim.py +8 -0
  39. package/src/qingflow_mcp/server_app_builder.py +38 -86
  40. package/src/qingflow_mcp/server_cloud.py +66 -1
  41. package/src/qingflow_mcp/tools/ai_builder_tools.py +93 -100
  42. package/src/qingflow_mcp/tools/app_tools.py +46 -65
@@ -0,0 +1,76 @@
1
+ {
2
+ "$defs": {
3
+ "EmptyConfig": {
4
+ "additionalProperties": false,
5
+ "description": "该字段类型没有特殊配置。",
6
+ "type": "object"
7
+ },
8
+ "FieldCommon": {
9
+ "description": "顶层业务字段的公共属性;字段类型由 TopField 的判别分支定义。",
10
+ "properties": {
11
+ "dataCover": {
12
+ "description": "是否作为数据封面;仅顶层附件字段可设为 true。",
13
+ "type": "boolean"
14
+ },
15
+ "dataTitle": {
16
+ "description": "是否作为数据标题;整个 body 最多且必须按规则存在一个。",
17
+ "type": "boolean"
18
+ },
19
+ "description": {
20
+ "description": "字段说明;null 或空字符串表示清空。",
21
+ "type": [
22
+ "string",
23
+ "null"
24
+ ]
25
+ },
26
+ "name": {
27
+ "description": "字段展示名称;同一父级内唯一,不单独作为字段身份。",
28
+ "minLength": 1,
29
+ "type": "string"
30
+ },
31
+ "queId": {
32
+ "description": "已有字段的后端 ID;get 返回,新增字段省略。",
33
+ "minimum": 1,
34
+ "type": "integer"
35
+ },
36
+ "required": {
37
+ "description": "是否必填;缺失时保留已有字段当前值。",
38
+ "type": "boolean"
39
+ },
40
+ "width": {
41
+ "description": "字段在所在行的宽度百分比;同一行要么全部提供且合计 100,要么全部省略。",
42
+ "maximum": 100,
43
+ "minimum": 1,
44
+ "type": "integer"
45
+ }
46
+ },
47
+ "required": [
48
+ "name"
49
+ ],
50
+ "type": "object"
51
+ }
52
+ },
53
+ "$id": "https://builder.qingflow.com/schemas/app-form-apply/v1alpha1/fields/phone.json",
54
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
55
+ "allOf": [
56
+ {
57
+ "$ref": "#/$defs/FieldCommon"
58
+ },
59
+ {
60
+ "properties": {
61
+ "config": {
62
+ "$ref": "#/$defs/EmptyConfig"
63
+ },
64
+ "type": {
65
+ "const": "phone"
66
+ }
67
+ },
68
+ "required": [
69
+ "type"
70
+ ]
71
+ }
72
+ ],
73
+ "title": "Qingflow AppForm v1alpha1 phone field",
74
+ "type": "object",
75
+ "unevaluatedProperties": false
76
+ }
@@ -0,0 +1,338 @@
1
+ {
2
+ "$defs": {
3
+ "FieldCommon": {
4
+ "description": "顶层业务字段的公共属性;字段类型由 TopField 的判别分支定义。",
5
+ "properties": {
6
+ "dataCover": {
7
+ "description": "是否作为数据封面;仅顶层附件字段可设为 true。",
8
+ "type": "boolean"
9
+ },
10
+ "dataTitle": {
11
+ "description": "是否作为数据标题;整个 body 最多且必须按规则存在一个。",
12
+ "type": "boolean"
13
+ },
14
+ "description": {
15
+ "description": "字段说明;null 或空字符串表示清空。",
16
+ "type": [
17
+ "string",
18
+ "null"
19
+ ]
20
+ },
21
+ "name": {
22
+ "description": "字段展示名称;同一父级内唯一,不单独作为字段身份。",
23
+ "minLength": 1,
24
+ "type": "string"
25
+ },
26
+ "queId": {
27
+ "description": "已有字段的后端 ID;get 返回,新增字段省略。",
28
+ "minimum": 1,
29
+ "type": "integer"
30
+ },
31
+ "required": {
32
+ "description": "是否必填;缺失时保留已有字段当前值。",
33
+ "type": "boolean"
34
+ },
35
+ "width": {
36
+ "description": "字段在所在行的宽度百分比;同一行要么全部提供且合计 100,要么全部省略。",
37
+ "maximum": 100,
38
+ "minimum": 1,
39
+ "type": "integer"
40
+ }
41
+ },
42
+ "required": [
43
+ "name"
44
+ ],
45
+ "type": "object"
46
+ },
47
+ "FieldSelector": {
48
+ "additionalProperties": false,
49
+ "anyOf": [
50
+ {
51
+ "required": [
52
+ "queId"
53
+ ]
54
+ },
55
+ {
56
+ "required": [
57
+ "name"
58
+ ]
59
+ }
60
+ ],
61
+ "description": "跨字段引用选择器;至少提供 queId 或 name,两者同时提供时必须指向同一字段。",
62
+ "properties": {
63
+ "name": {
64
+ "description": "字段名称;仅在当前作用域内唯一时可用于解析。",
65
+ "minLength": 1,
66
+ "type": "string"
67
+ },
68
+ "queId": {
69
+ "description": "已有字段的后端 ID;优先用于精确解析。",
70
+ "minimum": 1,
71
+ "type": "integer"
72
+ }
73
+ },
74
+ "type": "object"
75
+ },
76
+ "QLinkerBinding": {
77
+ "additionalProperties": false,
78
+ "description": "Q-Linker 的输入映射、请求配置和输出映射。",
79
+ "properties": {
80
+ "inputs": {
81
+ "description": "将当前表单字段映射到请求参数的规则。",
82
+ "items": {
83
+ "$ref": "#/$defs/QLinkerInputBinding"
84
+ },
85
+ "type": "array"
86
+ },
87
+ "outputs": {
88
+ "description": "将响应路径映射到目标字段的规则;至少一个。",
89
+ "items": {
90
+ "$ref": "#/$defs/QLinkerOutputBinding"
91
+ },
92
+ "minItems": 1,
93
+ "type": "array"
94
+ },
95
+ "request": {
96
+ "$ref": "#/$defs/QLinkerRequest",
97
+ "description": "远程请求配置。"
98
+ }
99
+ },
100
+ "required": [
101
+ "request",
102
+ "outputs"
103
+ ],
104
+ "type": "object"
105
+ },
106
+ "QLinkerConfig": {
107
+ "additionalProperties": false,
108
+ "description": "Q-Linker 的高层声明;无法无损还原为该结构时阻断处理。",
109
+ "properties": {
110
+ "qLinkerBinding": {
111
+ "$ref": "#/$defs/QLinkerBinding"
112
+ }
113
+ },
114
+ "required": [
115
+ "qLinkerBinding"
116
+ ],
117
+ "type": "object"
118
+ },
119
+ "QLinkerInputBinding": {
120
+ "additionalProperties": false,
121
+ "description": "一个表单字段到请求参数的映射。",
122
+ "properties": {
123
+ "field": {
124
+ "$ref": "#/$defs/FieldSelector",
125
+ "description": "输入来源字段。"
126
+ },
127
+ "key": {
128
+ "description": "请求中的参数名。",
129
+ "minLength": 1,
130
+ "type": "string"
131
+ },
132
+ "source": {
133
+ "description": "参数写入请求的位置。",
134
+ "enum": [
135
+ "query_param",
136
+ "header",
137
+ "url_encoded",
138
+ "json_path"
139
+ ]
140
+ }
141
+ },
142
+ "required": [
143
+ "field",
144
+ "key",
145
+ "source"
146
+ ],
147
+ "type": "object"
148
+ },
149
+ "QLinkerKeyValue": {
150
+ "additionalProperties": false,
151
+ "description": "HTTP 请求中的键值对。",
152
+ "properties": {
153
+ "key": {
154
+ "description": "参数名。",
155
+ "minLength": 1,
156
+ "type": "string"
157
+ },
158
+ "value": {
159
+ "description": "参数值;null 表示空值。",
160
+ "type": [
161
+ "string",
162
+ "null"
163
+ ]
164
+ }
165
+ },
166
+ "required": [
167
+ "key"
168
+ ],
169
+ "type": "object"
170
+ },
171
+ "QLinkerOutputBinding": {
172
+ "additionalProperties": false,
173
+ "description": "一个响应值到表单目标字段的映射。",
174
+ "properties": {
175
+ "alias": {
176
+ "description": "输出别名;用于后续数据关联引用。",
177
+ "minLength": 1,
178
+ "type": "string"
179
+ },
180
+ "aliasId": {
181
+ "description": "后端生成的输出别名 ID;新增输出时可省略,get 返回后必须保留。",
182
+ "minimum": 1,
183
+ "type": "integer"
184
+ },
185
+ "path": {
186
+ "description": "从响应中取值的 JSONPath。",
187
+ "minLength": 1,
188
+ "type": "string"
189
+ },
190
+ "targetField": {
191
+ "$ref": "#/$defs/FieldSelector",
192
+ "description": "接收结果的当前表单字段。"
193
+ }
194
+ },
195
+ "required": [
196
+ "alias",
197
+ "path",
198
+ "targetField"
199
+ ],
200
+ "type": "object"
201
+ },
202
+ "QLinkerRequest": {
203
+ "additionalProperties": false,
204
+ "description": "Q-Linker 远程 HTTP 请求配置。",
205
+ "properties": {
206
+ "autoTrigger": {
207
+ "description": "是否在输入变化时自动触发请求。",
208
+ "type": [
209
+ "boolean",
210
+ "null"
211
+ ]
212
+ },
213
+ "bodyType": {
214
+ "default": "url_encoded",
215
+ "description": "请求体格式;分别映射后端 bodyType 1、2、3。",
216
+ "enum": [
217
+ "url_encoded",
218
+ "json",
219
+ "xml"
220
+ ]
221
+ },
222
+ "customButtonText": {
223
+ "description": "自定义触发按钮文案。",
224
+ "type": [
225
+ "string",
226
+ "null"
227
+ ]
228
+ },
229
+ "customButtonTextEnabled": {
230
+ "description": "是否启用自定义触发按钮文案。",
231
+ "type": [
232
+ "boolean",
233
+ "null"
234
+ ]
235
+ },
236
+ "headers": {
237
+ "description": "请求头键值对。",
238
+ "items": {
239
+ "$ref": "#/$defs/QLinkerKeyValue"
240
+ },
241
+ "type": "array"
242
+ },
243
+ "hideOnForm": {
244
+ "description": "是否在表单填写界面隐藏该 Q-Linker 字段。",
245
+ "type": [
246
+ "boolean",
247
+ "null"
248
+ ]
249
+ },
250
+ "insertValueDirectly": {
251
+ "description": "是否把请求结果直接写入目标字段。",
252
+ "type": [
253
+ "boolean",
254
+ "null"
255
+ ]
256
+ },
257
+ "jsonValue": {
258
+ "description": "bodyType 为 json 时的 JSON 请求体字符串。",
259
+ "type": [
260
+ "string",
261
+ "null"
262
+ ]
263
+ },
264
+ "method": {
265
+ "default": "GET",
266
+ "description": "HTTP 方法;当前 Q-Linker 仅支持 GET 和 POST,缺失时按 GET 处理。",
267
+ "enum": [
268
+ "GET",
269
+ "POST"
270
+ ]
271
+ },
272
+ "queryParams": {
273
+ "description": "URL 查询参数键值对。",
274
+ "items": {
275
+ "$ref": "#/$defs/QLinkerKeyValue"
276
+ },
277
+ "type": "array"
278
+ },
279
+ "resultType": {
280
+ "default": "json",
281
+ "description": "响应解析格式;分别映射后端 resultType 1、2、3。",
282
+ "enum": [
283
+ "json",
284
+ "xml",
285
+ "text"
286
+ ]
287
+ },
288
+ "url": {
289
+ "description": "请求 URL。",
290
+ "minLength": 1,
291
+ "type": "string"
292
+ },
293
+ "urlEncodedValue": {
294
+ "description": "bodyType 为 url_encoded 时的表单键值对。",
295
+ "items": {
296
+ "$ref": "#/$defs/QLinkerKeyValue"
297
+ },
298
+ "type": "array"
299
+ },
300
+ "xmlValue": {
301
+ "description": "bodyType 为 xml 时的 XML 请求体字符串。",
302
+ "type": [
303
+ "string",
304
+ "null"
305
+ ]
306
+ }
307
+ },
308
+ "required": [
309
+ "url"
310
+ ],
311
+ "type": "object"
312
+ }
313
+ },
314
+ "$id": "https://builder.qingflow.com/schemas/app-form-apply/v1alpha1/fields/q_linker.json",
315
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
316
+ "allOf": [
317
+ {
318
+ "$ref": "#/$defs/FieldCommon"
319
+ },
320
+ {
321
+ "properties": {
322
+ "config": {
323
+ "$ref": "#/$defs/QLinkerConfig"
324
+ },
325
+ "type": {
326
+ "const": "q_linker"
327
+ }
328
+ },
329
+ "required": [
330
+ "type",
331
+ "config"
332
+ ]
333
+ }
334
+ ],
335
+ "title": "Qingflow AppForm v1alpha1 q_linker field",
336
+ "type": "object",
337
+ "unevaluatedProperties": false
338
+ }
@@ -0,0 +1,137 @@
1
+ {
2
+ "$defs": {
3
+ "FieldCommon": {
4
+ "description": "顶层业务字段的公共属性;字段类型由 TopField 的判别分支定义。",
5
+ "properties": {
6
+ "dataCover": {
7
+ "description": "是否作为数据封面;仅顶层附件字段可设为 true。",
8
+ "type": "boolean"
9
+ },
10
+ "dataTitle": {
11
+ "description": "是否作为数据标题;整个 body 最多且必须按规则存在一个。",
12
+ "type": "boolean"
13
+ },
14
+ "description": {
15
+ "description": "字段说明;null 或空字符串表示清空。",
16
+ "type": [
17
+ "string",
18
+ "null"
19
+ ]
20
+ },
21
+ "name": {
22
+ "description": "字段展示名称;同一父级内唯一,不单独作为字段身份。",
23
+ "minLength": 1,
24
+ "type": "string"
25
+ },
26
+ "queId": {
27
+ "description": "已有字段的后端 ID;get 返回,新增字段省略。",
28
+ "minimum": 1,
29
+ "type": "integer"
30
+ },
31
+ "required": {
32
+ "description": "是否必填;缺失时保留已有字段当前值。",
33
+ "type": "boolean"
34
+ },
35
+ "width": {
36
+ "description": "字段在所在行的宽度百分比;同一行要么全部提供且合计 100,要么全部省略。",
37
+ "maximum": 100,
38
+ "minimum": 1,
39
+ "type": "integer"
40
+ }
41
+ },
42
+ "required": [
43
+ "name"
44
+ ],
45
+ "type": "object"
46
+ },
47
+ "FieldSelector": {
48
+ "additionalProperties": false,
49
+ "anyOf": [
50
+ {
51
+ "required": [
52
+ "queId"
53
+ ]
54
+ },
55
+ {
56
+ "required": [
57
+ "name"
58
+ ]
59
+ }
60
+ ],
61
+ "description": "跨字段引用选择器;至少提供 queId 或 name,两者同时提供时必须指向同一字段。",
62
+ "properties": {
63
+ "name": {
64
+ "description": "字段名称;仅在当前作用域内唯一时可用于解析。",
65
+ "minLength": 1,
66
+ "type": "string"
67
+ },
68
+ "queId": {
69
+ "description": "已有字段的后端 ID;优先用于精确解析。",
70
+ "minimum": 1,
71
+ "type": "integer"
72
+ }
73
+ },
74
+ "type": "object"
75
+ },
76
+ "RelationConfig": {
77
+ "additionalProperties": false,
78
+ "description": "引用字段配置;引用其他应用中的数据。",
79
+ "properties": {
80
+ "displayField": {
81
+ "$ref": "#/$defs/FieldSelector",
82
+ "description": "引用值的主展示字段。"
83
+ },
84
+ "relationMode": {
85
+ "default": "single",
86
+ "description": "单条引用或多条引用;缺失时按 single 处理。",
87
+ "enum": [
88
+ "single",
89
+ "multiple"
90
+ ]
91
+ },
92
+ "targetAppKey": {
93
+ "description": "被引用应用的 appKey。",
94
+ "minLength": 1,
95
+ "type": "string"
96
+ },
97
+ "visibleFields": {
98
+ "description": "引用选择界面额外展示的字段。",
99
+ "items": {
100
+ "$ref": "#/$defs/FieldSelector"
101
+ },
102
+ "type": "array",
103
+ "uniqueItems": true
104
+ }
105
+ },
106
+ "required": [
107
+ "targetAppKey",
108
+ "displayField"
109
+ ],
110
+ "type": "object"
111
+ }
112
+ },
113
+ "$id": "https://builder.qingflow.com/schemas/app-form-apply/v1alpha1/fields/relation.json",
114
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
115
+ "allOf": [
116
+ {
117
+ "$ref": "#/$defs/FieldCommon"
118
+ },
119
+ {
120
+ "properties": {
121
+ "config": {
122
+ "$ref": "#/$defs/RelationConfig"
123
+ },
124
+ "type": {
125
+ "const": "relation"
126
+ }
127
+ },
128
+ "required": [
129
+ "type",
130
+ "config"
131
+ ]
132
+ }
133
+ ],
134
+ "title": "Qingflow AppForm v1alpha1 relation field",
135
+ "type": "object",
136
+ "unevaluatedProperties": false
137
+ }
@@ -0,0 +1,92 @@
1
+ {
2
+ "$defs": {
3
+ "ChoiceConfig": {
4
+ "additionalProperties": false,
5
+ "description": "选择类字段配置。",
6
+ "properties": {
7
+ "options": {
8
+ "description": "非空有序选项文案;缺失选项表示从该字段配置中删除。",
9
+ "items": {
10
+ "minLength": 1,
11
+ "type": "string"
12
+ },
13
+ "minItems": 1,
14
+ "type": "array",
15
+ "uniqueItems": true
16
+ }
17
+ },
18
+ "required": [
19
+ "options"
20
+ ],
21
+ "type": "object"
22
+ },
23
+ "FieldCommon": {
24
+ "description": "顶层业务字段的公共属性;字段类型由 TopField 的判别分支定义。",
25
+ "properties": {
26
+ "dataCover": {
27
+ "description": "是否作为数据封面;仅顶层附件字段可设为 true。",
28
+ "type": "boolean"
29
+ },
30
+ "dataTitle": {
31
+ "description": "是否作为数据标题;整个 body 最多且必须按规则存在一个。",
32
+ "type": "boolean"
33
+ },
34
+ "description": {
35
+ "description": "字段说明;null 或空字符串表示清空。",
36
+ "type": [
37
+ "string",
38
+ "null"
39
+ ]
40
+ },
41
+ "name": {
42
+ "description": "字段展示名称;同一父级内唯一,不单独作为字段身份。",
43
+ "minLength": 1,
44
+ "type": "string"
45
+ },
46
+ "queId": {
47
+ "description": "已有字段的后端 ID;get 返回,新增字段省略。",
48
+ "minimum": 1,
49
+ "type": "integer"
50
+ },
51
+ "required": {
52
+ "description": "是否必填;缺失时保留已有字段当前值。",
53
+ "type": "boolean"
54
+ },
55
+ "width": {
56
+ "description": "字段在所在行的宽度百分比;同一行要么全部提供且合计 100,要么全部省略。",
57
+ "maximum": 100,
58
+ "minimum": 1,
59
+ "type": "integer"
60
+ }
61
+ },
62
+ "required": [
63
+ "name"
64
+ ],
65
+ "type": "object"
66
+ }
67
+ },
68
+ "$id": "https://builder.qingflow.com/schemas/app-form-apply/v1alpha1/fields/single_choice.json",
69
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
70
+ "allOf": [
71
+ {
72
+ "$ref": "#/$defs/FieldCommon"
73
+ },
74
+ {
75
+ "properties": {
76
+ "config": {
77
+ "$ref": "#/$defs/ChoiceConfig"
78
+ },
79
+ "type": {
80
+ "const": "single_choice"
81
+ }
82
+ },
83
+ "required": [
84
+ "type",
85
+ "config"
86
+ ]
87
+ }
88
+ ],
89
+ "title": "Qingflow AppForm v1alpha1 single_choice field",
90
+ "type": "object",
91
+ "unevaluatedProperties": false
92
+ }