openyida 2026.4.2 → 2026.4.14-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 (108) hide show
  1. package/README.md +3 -0
  2. package/bin/yida.js +160 -100
  3. package/lib/app/app-list.js +133 -0
  4. package/lib/app/create-app.js +1 -1
  5. package/lib/app/create-form.js +56 -9
  6. package/lib/app/create-page.js +2 -2
  7. package/lib/app/get-schema.js +1 -1
  8. package/lib/app/publish.js +105 -0
  9. package/lib/app/update-app.js +202 -0
  10. package/lib/auth/login.js +10 -14
  11. package/lib/auth/qr-login.js +4 -2
  12. package/lib/connector/action-generator.js +23 -9
  13. package/lib/connector/connector-smart-create.js +3 -1
  14. package/lib/core/check-data.js +514 -0
  15. package/lib/core/doctor.js +4 -4
  16. package/lib/core/env-cmd.js +384 -0
  17. package/lib/core/env-manager.js +218 -0
  18. package/lib/core/i18n.js +1 -1
  19. package/lib/core/locales/ar.js +93 -0
  20. package/lib/core/locales/de.js +93 -0
  21. package/lib/core/locales/en.js +326 -21
  22. package/lib/core/locales/es.js +93 -0
  23. package/lib/core/locales/fr.js +93 -0
  24. package/lib/core/locales/hi.js +93 -0
  25. package/lib/core/locales/ja.js +176 -21
  26. package/lib/core/locales/ko.js +93 -0
  27. package/lib/core/locales/pt.js +93 -0
  28. package/lib/core/locales/vi.js +93 -0
  29. package/lib/core/locales/zh-TW.js +191 -21
  30. package/lib/core/locales/zh.js +326 -21
  31. package/lib/core/query-data.js +36 -2
  32. package/lib/core/sample.js +145 -0
  33. package/lib/core/update.js +148 -0
  34. package/lib/core/utils.js +91 -9
  35. package/lib/db/db-seq-fix.js +436 -0
  36. package/lib/dws/dws-wrapper.js +21 -3
  37. package/lib/page-config/get-page-config.js +1 -1
  38. package/lib/page-config/save-share-config.js +1 -1
  39. package/lib/page-config/verify-short-url.js +2 -2
  40. package/lib/process/configure-process.js +8 -2
  41. package/lib/process/create-process.js +13 -0
  42. package/lib/process/preview-process.js +878 -0
  43. package/{yida-skills/skills/yida-custom-page/templates → lib/samples/yida-custom-page}/custom-page-template.js +48 -18
  44. package/package.json +1 -1
  45. package/project/pages/src/demo-chip-insight.js +3 -1
  46. package/project/pages/src/demo-ppt.js +1192 -0
  47. package/yida-skills/SKILL.md +32 -2
  48. package/yida-skills/references/yida-api.md +24 -1
  49. package/yida-skills/skills/large-file-write/SKILL.md +32 -43
  50. package/yida-skills/skills/large-file-write/references/write-patterns.md +124 -0
  51. package/yida-skills/skills/yida-app/SKILL.md +47 -14
  52. package/yida-skills/skills/yida-chart/SKILL.md +5 -5
  53. package/yida-skills/skills/yida-chart/{reference → references}/echarts-code-template.md +3 -3
  54. package/yida-skills/skills/yida-chart/references/examples.md +164 -0
  55. package/yida-skills/skills/yida-connector/SKILL.md +41 -1
  56. package/yida-skills/skills/yida-create-app/SKILL.md +19 -3
  57. package/yida-skills/skills/yida-create-form-page/SKILL.md +25 -1
  58. package/yida-skills/skills/yida-create-page/SKILL.md +23 -2
  59. package/yida-skills/skills/yida-create-process/SKILL.md +42 -2
  60. package/yida-skills/skills/yida-custom-page/SKILL.md +101 -239
  61. package/yida-skills/skills/yida-custom-page/examples/attachment-upload.js +223 -0
  62. package/yida-skills/skills/yida-custom-page/references/assets-guide.md +3 -3
  63. package/yida-skills/skills/yida-custom-page/references/attachment-upload-guide.md +459 -0
  64. package/yida-skills/skills/yida-custom-page/references/coding-guide.md +116 -86
  65. package/yida-skills/skills/yida-custom-page/references/design-system.md +4 -0
  66. package/yida-skills/skills/yida-data-management/SKILL.md +51 -0
  67. package/yida-skills/skills/yida-db-seq-fix/SKILL.md +110 -0
  68. package/yida-skills/skills/yida-density/SKILL.md +65 -246
  69. package/yida-skills/skills/yida-export-conversation/SKILL.md +39 -2
  70. package/yida-skills/skills/yida-flash-note-to-prd/SKILL.md +42 -250
  71. package/yida-skills/skills/yida-flash-note-to-prd/references/examples.md +124 -0
  72. package/yida-skills/skills/yida-flash-note-to-prd/references/flash-note-prd-template.md +42 -0
  73. package/yida-skills/skills/yida-flash-note-to-prd/references/flash-note-prompt.md +197 -0
  74. package/yida-skills/skills/yida-flash-note-to-prd/references/yida-field-types.md +20 -0
  75. package/yida-skills/skills/yida-form-permission/SKILL.md +36 -2
  76. package/yida-skills/skills/yida-formula/SKILL.md +37 -21
  77. package/yida-skills/skills/yida-formula/references/examples.md +149 -0
  78. package/yida-skills/skills/yida-get-schema/SKILL.md +35 -1
  79. package/yida-skills/skills/yida-integration/SKILL.md +71 -127
  80. package/yida-skills/skills/yida-integration/references/examples.md +119 -0
  81. package/yida-skills/skills/yida-integration/references/integration-node-schemas.md +377 -0
  82. package/yida-skills/skills/yida-login/SKILL.md +24 -2
  83. package/yida-skills/skills/yida-logout/SKILL.md +33 -1
  84. package/yida-skills/skills/yida-page-config/SKILL.md +36 -1
  85. package/yida-skills/skills/yida-ppt-slider/SKILL.md +750 -1
  86. package/yida-skills/skills/yida-ppt-slider/references/examples.md +381 -0
  87. package/yida-skills/skills/yida-process-rule/SKILL.md +30 -320
  88. package/yida-skills/skills/yida-process-rule/references/examples.md +344 -0
  89. package/yida-skills/skills/yida-publish-page/SKILL.md +56 -1
  90. package/yida-skills/skills/yida-report/SKILL.md +25 -341
  91. package/yida-skills/skills/yida-report/references/examples.md +145 -0
  92. package/yida-skills/skills/yida-report/references/report-api-guide.md +287 -0
  93. package/yida-skills/skills/yida-table-form/SKILL.md +65 -437
  94. package/yida-skills/skills/yida-table-form/references/examples.md +113 -0
  95. /package/{yida-skills/skills/yida-chart/examples → lib/samples/yida-chart}/china-map.js +0 -0
  96. /package/{yida-skills/skills/yida-chart/examples → lib/samples/yida-chart}/dashboard-bindform.js +0 -0
  97. /package/{yida-skills/skills/yida-chart/examples → lib/samples/yida-chart}/line-trend.js +0 -0
  98. /package/{yida-skills/skills/yida-chart/examples → lib/samples/yida-chart}/multi-bar-compare.js +0 -0
  99. /package/{yida-skills/skills/yida-chart/examples → lib/samples/yida-chart}/radar-chart.js +0 -0
  100. /package/{yida-skills/skills/yida-chart/examples → lib/samples/yida-chart}/scatter-bindform.js +0 -0
  101. /package/{yida-skills/skills/yida-chart/examples → lib/samples/yida-chart}/stacked-area.js +0 -0
  102. /package/{yida-skills/skills/yida-create-app/templates → lib/samples/yida-create-app}/ipd-app-template.js +0 -0
  103. /package/{yida-skills/skills/yida-custom-page/examples → lib/samples/yida-custom-page}/design-tokens.js +0 -0
  104. /package/{yida-skills/skills/yida-data-management/templates → lib/samples/yida-data-management}/form-field-template.js +0 -0
  105. /package/{yida-skills/skills/yida-density/examples → lib/samples/yida-density}/density-switch-page.js +0 -0
  106. /package/{yida-skills/skills/yida-table-form/examples → lib/samples/yida-table-form}/table-form-batch-submit.js +0 -0
  107. /package/yida-skills/skills/yida-chart/{reference → references}/echarts-bindding-guide.md +0 -0
  108. /package/yida-skills/skills/yida-chart/{reference → references}/echarts-design-spec.md +0 -0
package/README.md CHANGED
@@ -99,7 +99,9 @@ openyida create-form # Create / update a form page
99
99
  openyida create-page # Create a custom display page
100
100
  openyida create-process # Create a process form (integrated)
101
101
  openyida create-report # Create a Yida report
102
+ openyida process preview # Preview process instance (generate visual flowchart)
102
103
  openyida data # Unified data management (form/process/task/subform)
104
+ openyida data check <appType> <formUuid> <rules.json> [options] # Detect anomalous records in process forms based on custom rules
103
105
  openyida doctor # Environment diagnostics and auto-repair
104
106
  openyida dws <command> [args] # DingTalk CLI (Contacts/Calendar/Todo/Approval, etc.)
105
107
  openyida env # Detect current AI tool environment and login status
@@ -205,6 +207,7 @@ Thanks to everyone who has contributed to OpenYida! Read the [Contributing Guide
205
207
  <a href="https://github.com/liug0911"><img src="https://avatars.githubusercontent.com/u/1578814?v=4&s=48" width="48" height="48" alt="LIUG" title="LIUG"/></a>
206
208
  <a href="https://github.com/sunliz-xiuli"><img src="https://avatars.githubusercontent.com/u/76982855?v=4&s=48" width="48" height="48" alt="sunliz-xiuli" title="sunliz-xiuli"/></a>
207
209
  <a href="https://github.com/M12REDX"><img src="https://avatars.githubusercontent.com/u/22703542?v=4&s=48" width="48" height="48" alt="M12REDX" title="M12REDX"/></a>
210
+ <a href="https://github.com/key-668"><img src="https://avatars.githubusercontent.com/u/270536058?v=4&s=48" width="48" height="48" alt="再不喝汽水" title="再不喝汽水"/></a>
208
211
  </p>
209
212
 
210
213
  ---
package/bin/yida.js CHANGED
@@ -26,6 +26,7 @@
26
26
  * openyida save-share-config <appType> <formUuid> <url> <isOpen> [openAuth] 保存公开访问/分享配置
27
27
  * openyida get-page-config <appType> <formUuid> 查询页面公开访问/分享配置
28
28
  * openyida update-form-config <appType> <formUuid> <isRenderNav> <title> 更新表单配置
29
+ * openyida update-app <appType> --name "新名称" [--desc "描述"] [--icon "图标"] 更新应用信息
29
30
  * openyida data <action> <resource> [args] 统一数据管理(表单/流程/任务/子表单)
30
31
  * openyida task-center <type> [--page N] [--size N] [--keyword TEXT] 全局任务中心(待办/我创建的/我已处理/抄送/代提交)
31
32
  * openyida doctor [选项] 检查环境依赖,诊断应用问题
@@ -33,6 +34,7 @@
33
34
  * openyida import <file> [name] 导入迁移包,在目标环境重建应用
34
35
  * openyida get-permission <appType> <formUuid> 查询表单权限配置
35
36
  * openyida save-permission <appType> <formUuid> [--data-permission <json>] [--action-permission <json>] 保存表单权限配置
37
+ * openyida process preview <appType> <processInstanceId> [--output <path>] 预览流程实例(生成可视化流程图)
36
38
  * openyida connector list [选项] 列出 HTTP 连接器
37
39
  * openyida connector create "名称" "域名" --operations <file> [选项] 创建连接器
38
40
  * openyida connector detail <connector-id> 查看连接器详情
@@ -50,6 +52,7 @@
50
52
  * openyida create-report <appType> "<报表名称>" <图表定义JSON或文件路径> 创建宜搭报表
51
53
  * openyida append-chart <appType> <reportId> <图表定义JSON或文件路径> 向已有报表追加图表
52
54
  * openyida dws <command> [args] 钉钉 CLI(通讯录/日历/待办/审批等)
55
+ * openyida update 检查并更新 openyida 到最新版本
53
56
  */
54
57
 
55
58
  'use strict';
@@ -65,106 +68,127 @@ const command = process.argv[2];
65
68
  const args = process.argv.slice(3);
66
69
 
67
70
  function printHelp() {
68
- console.log(`
69
- openyida - 宜搭命令行工具
70
-
71
- 用法:
72
- openyida <命令> [参数...](别名:yida)
73
-
74
- 命令:
75
- env 检测当前 AI 工具环境和登录态
76
- copy [--force] 复制 project 工作目录到当前 AI 工具环境
77
- login 登录态管理(优先缓存,否则扫码)
78
- logout 退出登录 / 切换账号
79
- create-app "<名称>" [描述] [图标] [颜色] [主题色] [导航风格] [布局] 创建应用,输出 appType
80
- create-page <appType> "<页面名>" 创建自定义页面,输出 pageId
81
- create-form create <appType> "<表单名>" <字段JSON> [--layout <布局>] [--theme <主题>] [--label-align <对齐>] 创建表单页面
82
- create-form update <appType> <formUuid> <修改JSON> 更新表单页面
83
- get-schema <appType> <formUuid> 获取表单 Schema
84
- publish <源文件路径> <appType> <formUuid> 编译并发布自定义页面
85
- verify-short-url <appType> <formUuid> <url> 验证短链接 URL 是否可用
86
- save-share-config <appType> <formUuid> <url> <isOpen> [auth] 保存公开访问/分享配置
87
- get-page-config <appType> <formUuid> 查询页面公开访问/分享配置
88
- update-form-config <appType> <formUuid> <isRenderNav> <title> 更新表单配置
89
- data <action> <resource> [args] 统一数据管理(表单/流程/任务/子表单)
90
- doctor [选项] 检查环境依赖,诊断应用问题
91
- --fix / --repair 诊断并自动修复
92
- --production --app <appId> 线上应用诊断
93
- --monitor 启动实时健康度监控
94
- --report <format> 生成诊断报告(json | markdown | html)
95
- --create-ticket 根据诊断结果创建工单
96
- --create-voc 创建 VOC(需求反馈)
97
- --auto-submit 自动判断并提交工单或 VOC
98
- auth status 查看当前登录状态
99
- auth login 执行登录
100
- auth refresh 刷新登录态
101
- auth logout 退出登录
102
- org list 列出可访问的组织
103
- org switch --corp-id <corpId> 切换组织(无需重新登录)
104
- get-permission <appType> <formUuid> 查询表单权限配置
105
- save-permission <appType> <formUuid> [--data-permission <json>] [--action-permission <json>] 保存表单权限配置
106
- configure-process <appType> <formUuid> <processDefinitionFile> [processCode] 配置并发布流程
107
- create-process <appType> <formTitle> <fieldsJsonFile> <processDefinitionFile> 创建流程表单(一体化)
108
- create-process <appType> --formUuid <formUuid> <processDefinitionFile> 复用已有表单创建流程
109
- connector list [选项] 列出 HTTP 连接器
110
- connector create "名称" "域名" --operations <file> [选项] 创建连接器
111
- connector detail <connector-id> 查看连接器详情
112
- connector delete <connector-id> [--force] 删除连接器
113
- connector add-action --operations <file> --connector-id <id> 添加执行动作到连接器
114
- connector list-actions <connector-id> 列出执行动作
115
- connector delete-action <connector-id> <operation-id> 删除执行动作
116
- connector test --connector-id <id> --action <actionId> 测试执行动作
117
- connector list-connections <connector-id> 列出鉴权账号
118
- connector create-connection <connector-id> <name> [选项] 创建鉴权账号
119
- connector smart-create --curl "curl命令" [选项] 智能创建连接器
120
- connector parse-api [选项] 解析接口信息
121
- connector gen-template [输出路径] 生成接口文档模板
122
- dws <command> [args] 钉钉 CLI(通讯录/日历/待办/审批等)
123
- create-report <appType> "<报表名称>" <图表定义 JSON 或文件路径> 创建宜搭报表
124
- append-chart <appType> <reportId> <图表定义 JSON 或文件路径> 向已有报表追加图表
125
- export-conversation [选项] 导出 AI 对话记录
126
- --output, -o <path> 指定输出文件路径
127
- --input, -i <file> 指定输入对话文件
128
- --latest 只导出最新对话(默认)
129
- --list 列出可用的对话记录
130
-
131
- 示例:
132
- openyida login
133
- openyida logout
134
- openyida create-app "考勤管理"
135
- openyida create-app "考勤管理" "员工考勤系统" "xian-daka" "#00B853" "deepBlue" "dark" "slide"
136
- openyida create-app "党建管理" "党员管理系统" "xian-zhengfu" "#FF4D4F" "red" "light" "ver"
137
- openyida create-page APP_XXX "游戏主页"
138
- openyida create-form create APP_XXX "员工信息" fields.json
139
- openyida create-form update APP_XXX FORM-XXX '[{"action":"add","field":{"type":"TextField","label":"备注"}}]'
140
- openyida get-schema APP_XXX FORM-XXX
141
- openyida publish pages/src/home.jsx APP_XXX FORM-XXX
142
- openyida verify-short-url APP_XXX FORM-XXX /o/myapp
143
- openyida save-share-config APP_XXX FORM-XXX /o/myapp y n
144
- openyida get-page-config APP_XXX FORM-XXX
145
- openyida update-form-config APP_XXX FORM-XXX false "页面标题"
146
- openyida data query form APP_XXX FORM-XXX --page 1 --size 20
147
- openyida dws contact user search --keyword "悟空"
148
- openyida dws calendar event list
149
- openyida dws todo task create --title "任务"
150
- openyida create-report APP_XXX "销售报表" charts.json
151
- openyida append-chart APP_XXX REPORT-XXX charts.json
152
- openyida configure-process APP_XXX FORM-YYY process-def.json
153
- openyida create-process APP_XXX "订单处理表" fields.json process-def.json
154
- openyida create-process APP_XXX --formUuid FORM-YYY process-def.json
155
- openyida doctor 完整诊断
156
- openyida doctor --fix 诊断并自动修复
157
- openyida doctor --production --app APP_XXX 线上应用诊断
158
- openyida doctor --monitor 实时监控
159
- openyida doctor --report markdown 生成 Markdown 报告
160
- openyida doctor --create-ticket 创建工单
161
- openyida doctor --create-voc 创建 VOC
162
- openyida doctor --auto-submit 自动判断并提交
163
- openyida export-conversation 导出当前对话记录
164
- openyida export-conversation -o output.md 指定输出路径
165
- openyida export-conversation --list 列出可用对话
166
- `);
167
- console.log(t('cli.help'));
71
+ const RESET = '\x1b[0m';
72
+ const BOLD = '\x1b[1m';
73
+ const DIM = '\x1b[2m';
74
+ const CYAN = '\x1b[36m';
75
+ const GREEN = '\x1b[32m';
76
+ const YELLOW = '\x1b[33m';
77
+
78
+ const SEP = `${DIM}${'─'.repeat(60)}${RESET}`;
79
+
80
+ /**
81
+ * 渲染一组命令列表。
82
+ * @param {string} groupTitle - 分组标题
83
+ * @param {Array<[string, string]>} commands - [命令, 描述] 数组
84
+ */
85
+ function renderGroup(groupTitle, commands) {
86
+ console.log(`\n ${BOLD}${CYAN}${groupTitle}${RESET}`);
87
+ const maxCmdLen = Math.max(...commands.map(([cmd]) => cmd.length));
88
+ const padWidth = Math.min(maxCmdLen + 2, 50);
89
+ for (const [cmd, desc] of commands) {
90
+ console.log(` ${GREEN}${cmd.padEnd(padWidth)}${RESET}${DIM}${desc}${RESET}`);
91
+ }
92
+ }
93
+
94
+ // ── 标题 ──
95
+ console.log('');
96
+ console.log(` ${BOLD}${CYAN}OpenYida${RESET} ${DIM}v${currentVersion}${RESET}`);
97
+ console.log(` ${DIM}${t('help.subtitle')}${RESET}`);
98
+ console.log('');
99
+ console.log(` ${YELLOW}${t('help.usage')}${RESET} openyida <command> [args...]`);
100
+ console.log(` ${DIM}${t('help.alias')}${RESET} yida`);
101
+ console.log(SEP);
102
+
103
+ // ── 环境 & 认证 ──
104
+ renderGroup(t('help.group_auth'), [
105
+ ['login [--qr]', t('help.cmd_login')],
106
+ ['logout', t('help.cmd_logout')],
107
+ ['auth <status|login|refresh|logout>', t('help.cmd_auth')],
108
+ ['org <list|switch>', t('help.cmd_org')],
109
+ ['env', t('help.cmd_env')],
110
+ ]);
111
+
112
+ // ── 应用管理 ──
113
+ renderGroup(t('help.group_app'), [
114
+ ['create-app "<name>" [options]', t('help.cmd_create_app')],
115
+ ['update-app <appType> --name "..."', t('help.cmd_update_app')],
116
+ ['export <appType> [output]', t('help.cmd_export')],
117
+ ['import <file> [name]', t('help.cmd_import')],
118
+ ]);
119
+
120
+ // ── 表单 & 页面 ──
121
+ renderGroup(t('help.group_form'), [
122
+ ['create-form create <appType> ...', t('help.cmd_create_form')],
123
+ ['create-form update <appType> ...', t('help.cmd_update_form')],
124
+ ['get-schema <appType> <formUuid>', t('help.cmd_get_schema')],
125
+ ['create-page <appType> "<name>"', t('help.cmd_create_page')],
126
+ ['publish <src> <appType> <formUuid>', t('help.cmd_publish')],
127
+ ['update-form-config <appType> ...', t('help.cmd_update_form_config')],
128
+ ]);
129
+
130
+ // ── 数据 & 权限 ──
131
+ renderGroup(t('help.group_data'), [
132
+ ['data <action> <resource> [args]', t('help.cmd_data')],
133
+ ['task-center <type> [options]', t('help.cmd_task_center')],
134
+ ['get-permission <appType> <formUuid>', t('help.cmd_get_permission')],
135
+ ['save-permission <appType> <formUuid> ...', t('help.cmd_save_permission')],
136
+ ]);
137
+
138
+ // ── 流程 ──
139
+ renderGroup(t('help.group_process'), [
140
+ ['configure-process <appType> ...', t('help.cmd_configure_process')],
141
+ ['create-process <appType> ...', t('help.cmd_create_process')],
142
+ ['process preview <appType> ...', t('help.cmd_process_preview')],
143
+ ]);
144
+
145
+ // ── 页面配置 & 分享 ──
146
+ renderGroup(t('help.group_share'), [
147
+ ['verify-short-url <appType> ...', t('help.cmd_verify_url')],
148
+ ['save-share-config <appType> ...', t('help.cmd_save_share')],
149
+ ['get-page-config <appType> <formUuid>', t('help.cmd_get_page_config')],
150
+ ]);
151
+
152
+ // ── 报表 ──
153
+ renderGroup(t('help.group_report'), [
154
+ ['create-report <appType> "<name>" ...', t('help.cmd_create_report')],
155
+ ['append-chart <appType> <reportId> ...', t('help.cmd_append_chart')],
156
+ ]);
157
+
158
+ // ── 连接器 ──
159
+ renderGroup(t('help.group_connector'), [
160
+ ['connector list', t('help.cmd_connector_list')],
161
+ ['connector create "name" "domain" ...', t('help.cmd_connector_create')],
162
+ ['connector detail <id>', t('help.cmd_connector_detail')],
163
+ ['connector delete <id>', t('help.cmd_connector_delete')],
164
+ ['connector smart-create --curl "..."', t('help.cmd_connector_smart')],
165
+ ['connector <sub-command> --help', t('help.cmd_connector_more')],
166
+ ]);
167
+
168
+ // ── 集成 & 钉钉 ──
169
+ renderGroup(t('help.group_integration'), [
170
+ ['integration create <appType> ...', t('help.cmd_integration')],
171
+ ['dws <command> [args]', t('help.cmd_dws')],
172
+ ]);
173
+
174
+ // ── 工具 ──
175
+ renderGroup(t('help.group_utility'), [
176
+ ['copy [--force]', t('help.cmd_copy')],
177
+ ['doctor [--fix]', t('help.cmd_doctor')],
178
+ ['update', t('help.cmd_update')],
179
+ ['export-conversation [options]', t('help.cmd_export_conversation')],
180
+ ['cdn-config / cdn-upload / cdn-refresh', t('help.cmd_cdn')],
181
+ ]);
182
+
183
+ // ── 快速上手 ──
184
+ console.log(SEP);
185
+ console.log(`\n ${BOLD}${CYAN}${t('help.quickstart_title')}${RESET}`);
186
+ console.log(` ${DIM}${RESET} openyida login`);
187
+ console.log(` ${DIM}${RESET} openyida create-app "${t('help.quickstart_app_name')}"`);
188
+ console.log(` ${DIM}${RESET} openyida create-form create APP_XXX "${t('help.quickstart_form_name')}" fields.json`);
189
+ console.log('');
190
+ console.log(` ${DIM}${t('help.docs')} https://github.com/openyida/openyida${RESET}`);
191
+ console.log('');
168
192
  }
169
193
 
170
194
  /**
@@ -432,6 +456,17 @@ async function main() {
432
456
  break;
433
457
  }
434
458
 
459
+ case 'update-app': {
460
+ if (args.length < 2) {
461
+ console.error(t('cli.update_app_usage'));
462
+ console.error(t('cli.update_app_example'));
463
+ process.exit(1);
464
+ }
465
+ const { run: runUpdateApp } = require('../lib/app/update-app');
466
+ await runUpdateApp(args);
467
+ break;
468
+ }
469
+
435
470
  case 'data': {
436
471
  if (args.length < 2) {
437
472
  console.error('用法: openyida data <action> <resource> [args] [options]');
@@ -517,6 +552,25 @@ async function main() {
517
552
  break;
518
553
  }
519
554
 
555
+ case 'process': {
556
+ const subCommand = args[0];
557
+ const subArgs = args.slice(1);
558
+
559
+ if (subCommand === 'preview') {
560
+ if (subArgs.length < 2) {
561
+ console.error(t('cli.process_preview_usage'));
562
+ console.error(t('cli.process_preview_example'));
563
+ process.exit(1);
564
+ }
565
+ const { run: runPreviewProcess } = require('../lib/process/preview-process');
566
+ await runPreviewProcess(subArgs);
567
+ } else {
568
+ console.error(t('cli.process_usage'));
569
+ process.exit(1);
570
+ }
571
+ break;
572
+ }
573
+
520
574
  case 'create-report': {
521
575
  const { run } = require('../lib/report/create-report');
522
576
  await run(args);
@@ -659,6 +713,12 @@ async function main() {
659
713
  break;
660
714
  }
661
715
 
716
+ case 'update': {
717
+ const { runUpdate } = require('../lib/core/update');
718
+ await runUpdate(currentVersion);
719
+ break;
720
+ }
721
+
662
722
  default: {
663
723
  console.error(t('cli.unknown_command', command));
664
724
  console.error(t('cli.run_help'));
@@ -0,0 +1,133 @@
1
+ /**
2
+ * app-list.js - 查询我的应用列表
3
+ *
4
+ * 用法:openyida app-list [--page <页码>] [--size <每页数量>]
5
+ *
6
+ * 输出字段:
7
+ * appName - 应用名称(zh_CN)
8
+ * appType - 应用唯一标识
9
+ * systemLink - 应用访问地址
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ const {
15
+ loadCookieData,
16
+ triggerLogin,
17
+ resolveBaseUrl,
18
+ extractInfoFromCookies,
19
+ httpGet,
20
+ requestWithAutoLogin,
21
+ } = require('../core/utils');
22
+ const { t } = require('../core/i18n');
23
+
24
+ const API_PATH = '/query/app/getAppList.json';
25
+
26
+ /**
27
+ * 拉取单页应用列表
28
+ */
29
+ function fetchAppListPage(auth, pageIndex, pageSize) {
30
+ const queryParams = {
31
+ _api: 'nattyFetch',
32
+ _mock: 'false',
33
+ pageIndex,
34
+ pageSize,
35
+ creator: auth.userId,
36
+ _csrf_token: auth.csrfToken,
37
+ _stamp: Date.now(),
38
+ };
39
+ return httpGet(auth.baseUrl, API_PATH, queryParams, auth.cookies);
40
+ }
41
+
42
+ /**
43
+ * 拉取全量应用列表(自动翻页)
44
+ */
45
+ async function fetchAllApps(auth, pageSize) {
46
+ const firstResult = await fetchAppListPage(auth, 1, pageSize);
47
+
48
+ if (!firstResult.success) {
49
+ throw new Error(firstResult.errorMsg || '查询应用列表失败');
50
+ }
51
+
52
+ const { data: firstPageData, totalCount } = firstResult.content;
53
+ const allApps = [...firstPageData];
54
+
55
+ const totalPages = Math.ceil(totalCount / pageSize);
56
+ const remainingFetches = [];
57
+
58
+ for (let pageIndex = 2; pageIndex <= totalPages; pageIndex++) {
59
+ remainingFetches.push(fetchAppListPage(auth, pageIndex, pageSize));
60
+ }
61
+
62
+ const remainingResults = await Promise.all(remainingFetches);
63
+ for (const result of remainingResults) {
64
+ if (result.success && result.content && result.content.data) {
65
+ allApps.push(...result.content.data);
66
+ }
67
+ }
68
+
69
+ return allApps;
70
+ }
71
+
72
+ /**
73
+ * 将应用原始数据提取为输出字段
74
+ */
75
+ function formatApp(app) {
76
+ return {
77
+ appName: (app.appName && app.appName.zh_CN) || '',
78
+ appType: app.appType || '',
79
+ systemLink: app.systemLink || '',
80
+ };
81
+ }
82
+
83
+ /**
84
+ * app-list 命令主入口
85
+ * @param {string[]} args
86
+ */
87
+ async function run(args) {
88
+ const pageSizeIndex = args.indexOf('--size');
89
+ const pageSize = pageSizeIndex !== -1 && args[pageSizeIndex + 1]
90
+ ? parseInt(args[pageSizeIndex + 1], 10)
91
+ : 20;
92
+
93
+ let cookieData = await loadCookieData();
94
+ if (!cookieData) {
95
+ cookieData = await triggerLogin();
96
+ }
97
+
98
+ const baseUrl = resolveBaseUrl(cookieData);
99
+ const { csrfToken, userId } = extractInfoFromCookies(cookieData.cookies);
100
+ const authRef = { baseUrl, cookies: cookieData.cookies, csrfToken, userId };
101
+
102
+ let apps;
103
+ try {
104
+ apps = await requestWithAutoLogin(
105
+ (auth) => fetchAllApps(
106
+ { baseUrl: auth.baseUrl, cookies: auth.cookies, csrfToken: auth.csrfToken, userId: auth.userId },
107
+ pageSize
108
+ ),
109
+ authRef
110
+ );
111
+ } catch (err) {
112
+ console.error(`查询应用列表失败:${err.message}`);
113
+ process.exit(1);
114
+ }
115
+
116
+ if (!apps || apps.length === 0) {
117
+ console.log('暂无应用');
118
+ return;
119
+ }
120
+
121
+ const formattedApps = apps.map(formatApp);
122
+
123
+ // stdout 输出 JSON,方便 AI 工具解析
124
+ console.log(JSON.stringify(formattedApps, null, 2));
125
+
126
+ // stderr 输出人类可读摘要
127
+ console.error(`\n共找到 ${formattedApps.length} 个应用:`);
128
+ for (const app of formattedApps) {
129
+ console.error(` • ${app.appName} [${app.appType}] ${app.systemLink}`);
130
+ }
131
+ }
132
+
133
+ module.exports = { run };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * create-app.js - 宜搭应用创建命令
3
3
  *
4
- * 用法:yidacli create-app "<appName>" [description] [icon] [iconColor] [colour] [navTheme] [layoutDirection]
4
+ * 用法:openyida create-app "<appName>" [description] [icon] [iconColor] [colour] [navTheme] [layoutDirection]
5
5
  */
6
6
 
7
7
  'use strict';
@@ -101,7 +101,7 @@ function parseArgs() {
101
101
  // 复制一份 args 用于解析(避免修改原始数组影响后续处理)
102
102
  const args = [...rawArgs];
103
103
 
104
- // 解析 --layout, --theme, --label-align 参数
104
+ // 解析 --layout, --theme, --label-align, --force 参数
105
105
  for (let i = 0; i < args.length; i++) {
106
106
  if (args[i] === '--layout' && i + 1 < args.length) {
107
107
  options.layout = args[i + 1];
@@ -115,6 +115,10 @@ function parseArgs() {
115
115
  options.labelAlign = args[i + 1];
116
116
  args.splice(i, 2);
117
117
  i--;
118
+ } else if (args[i] === '--force') {
119
+ options.force = true;
120
+ args.splice(i, 1);
121
+ i--;
118
122
  }
119
123
  }
120
124
 
@@ -1463,8 +1467,11 @@ function buildFormSchema(formTitle, fields, formUuid, corpId, appType, layout, t
1463
1467
  type: 'FUNCTION',
1464
1468
  list: [
1465
1469
  {
1466
- id: 'didMount',
1467
- title: 'didMount',
1470
+ id: nextNodeId(),
1471
+ type: 'lifeCycleEvent',
1472
+ name: 'didMount',
1473
+ relatedEventId: 'lifecycle:didMount',
1474
+ params: {},
1468
1475
  },
1469
1476
  ],
1470
1477
  },
@@ -2404,8 +2411,48 @@ async function mainUpdate(parsedArgs, csrfToken, cookies, baseUrl, cookieData) {
2404
2411
  console.error(t('create_form.schema_got_empty'));
2405
2412
  }
2406
2413
 
2407
- // Step 3: 读取修改定义
2408
- console.error(t('create_form.step_read_changes', 3));
2414
+ // Step 3: 检查表单是否已有数据
2415
+ console.error(t('create_form.step_check_data', 3));
2416
+ const dataCheckResult = await requestWithAutoLogin(function (auth) {
2417
+ return sendGetRequest(
2418
+ auth.baseUrl, auth.cookies,
2419
+ '/dingtalk/web/' + appType + '/v1/form/searchFormDatas.json',
2420
+ { formUuid: formUuid, appType: appType, currentPage: '1', pageSize: '1' }
2421
+ );
2422
+ }, authRef);
2423
+
2424
+ let existingDataCount = 0;
2425
+ if (dataCheckResult && dataCheckResult.content && typeof dataCheckResult.content.totalCount === 'number') {
2426
+ existingDataCount = dataCheckResult.content.totalCount;
2427
+ } else if (dataCheckResult && typeof dataCheckResult.totalCount === 'number') {
2428
+ existingDataCount = dataCheckResult.totalCount;
2429
+ }
2430
+
2431
+ if (existingDataCount > 0) {
2432
+ console.error(t('create_form.data_exists_warning', existingDataCount));
2433
+ console.error(t('create_form.data_exists_impact'));
2434
+
2435
+ if (!parsedArgs.force) {
2436
+ console.error(t('create_form.data_exists_abort'));
2437
+ console.log(JSON.stringify({
2438
+ success: false,
2439
+ requiresConfirmation: true,
2440
+ formUuid: formUuid,
2441
+ appType: appType,
2442
+ existingDataCount: existingDataCount,
2443
+ message: t('create_form.data_exists_confirm_message', existingDataCount),
2444
+ hint: t('create_form.data_exists_force_hint'),
2445
+ }));
2446
+ process.exit(0);
2447
+ }
2448
+
2449
+ console.error(t('create_form.data_exists_force_proceed', existingDataCount));
2450
+ } else {
2451
+ console.error(t('create_form.data_check_empty'));
2452
+ }
2453
+
2454
+ // Step 4: 读取修改定义
2455
+ console.error(t('create_form.step_read_changes', 4));
2409
2456
  const changes = readChangesDefinition(changesJsonOrFile);
2410
2457
  console.error(t('create_form.changes_loaded', changes.length));
2411
2458
  changes.forEach(function (change, changeIndex) {
@@ -2418,8 +2465,8 @@ async function mainUpdate(parsedArgs, csrfToken, cookies, baseUrl, cookieData) {
2418
2465
  }
2419
2466
  });
2420
2467
 
2421
- // Step 4: 应用修改
2422
- console.error(t('create_form.step_apply_changes', 4));
2468
+ // Step 5: 应用修改
2469
+ console.error(t('create_form.step_apply_changes', 5));
2423
2470
  const appliedChanges = applyChangesToSchema(schema, changes);
2424
2471
 
2425
2472
  // 为 SerialNumberField 补全 formula(若尚未设置)
@@ -2433,8 +2480,8 @@ async function mainUpdate(parsedArgs, csrfToken, cookies, baseUrl, cookieData) {
2433
2480
  fillSerialNumberFormulas(formContainerUpdate.children, corpId, appType, formUuid);
2434
2481
  }
2435
2482
 
2436
- // Step 5 & 6: 保存 Schema 并更新表单配置
2437
- const { configResult } = await saveSchemaAndUpdateConfig(authRef, appType, formUuid, schema, version, 5);
2483
+ // Step 6 & 7: 保存 Schema 并更新表单配置
2484
+ const { configResult } = await saveSchemaAndUpdateConfig(authRef, appType, formUuid, schema, version, 6);
2438
2485
 
2439
2486
  // 输出结果
2440
2487
  const SEP2 = '='.repeat(50);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * create-page.js - 宜搭自定义页面创建命令
3
3
  *
4
- * 用法:yidacli create-page <appType> "<pageName>"
4
+ * 用法:openyida create-page <appType> "<pageName>"
5
5
  */
6
6
 
7
7
  'use strict';
@@ -81,7 +81,7 @@ async function run(args) {
81
81
 
82
82
  console.log(JSON.stringify({ success: true, pageId, pageName, appType, url: pageUrl }));
83
83
  } else {
84
- const errorMsg = response ? response.errorMsg || t('common.unknown_error') : t('common.request_failed');
84
+ const errorMsg = response ? response.errorMsg || response.error || t('common.unknown_error') : t('common.request_failed');
85
85
  console.error(t('create_page.failed', errorMsg));
86
86
  console.error(SEP2);
87
87
  console.log(JSON.stringify({ success: false, error: errorMsg }));
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * get-schema.js - 宜搭表单 Schema 获取命令
3
3
  *
4
- * 用法:yidacli get-schema <appType> <formUuid>
4
+ * 用法:openyida get-schema <appType> <formUuid>
5
5
  */
6
6
 
7
7
  'use strict';