openyida 2026.7.18 → 2026.7.21

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 (200) hide show
  1. package/README.md +37 -2
  2. package/bin/yida.js +113 -18
  3. package/docs/capabilities.md +202 -0
  4. package/lib/agent-center/agent-center.js +2 -3
  5. package/lib/app/app-list.js +3 -4
  6. package/lib/app/build-page.js +13 -6
  7. package/lib/app/check-page.js +16 -6
  8. package/lib/app/compile.js +17 -7
  9. package/lib/app/create-app.js +14 -2
  10. package/lib/app/create-form/api-path.js +25 -0
  11. package/lib/app/create-form/args.js +13 -0
  12. package/lib/app/create-form/commands.js +4 -0
  13. package/lib/app/create-form/definition-reader.js +23 -23
  14. package/lib/app/create-form/field-normalizers.js +26 -7
  15. package/lib/app/create-form/schema-patch.js +4 -1
  16. package/lib/app/create-form.js +155 -68
  17. package/lib/app/create-page.js +47 -10
  18. package/lib/app/generate-page.js +20 -1
  19. package/lib/app/get-form-config.js +2 -1
  20. package/lib/app/get-schema.js +67 -15
  21. package/lib/app/import-app.js +94 -42
  22. package/lib/app/list-forms.js +4 -8
  23. package/lib/app/page-ir.js +140 -0
  24. package/lib/app/publish.js +289 -556
  25. package/lib/app/schema-field-resolution.js +370 -0
  26. package/lib/app/services/app-reader.js +85 -0
  27. package/lib/app/services/app-service.js +235 -0
  28. package/lib/app/services/canvas-page-compiler.js +91 -0
  29. package/lib/app/services/canvas-page-schema-builder.js +149 -0
  30. package/lib/app/services/field-bindings.js +68 -0
  31. package/lib/app/services/form-compiler.js +1922 -0
  32. package/lib/app/services/form-mode-service.js +182 -0
  33. package/lib/app/services/form-schema-patcher.js +333 -0
  34. package/lib/app/services/form-schema-reader.js +59 -0
  35. package/lib/app/services/form-service.js +379 -0
  36. package/lib/app/services/form-validation.js +562 -0
  37. package/lib/app/services/native-page-compiler.js +92 -0
  38. package/lib/app/services/native-page-schema-builder.js +428 -0
  39. package/lib/app/services/page-resource-service.js +185 -0
  40. package/lib/app/update-app.js +22 -9
  41. package/lib/app/update-form-config.js +4 -2
  42. package/lib/asset/asset-cmd.js +19 -6
  43. package/lib/auth/oauth-loopback.js +376 -15
  44. package/lib/auth/token-auth.js +34 -3
  45. package/lib/auth/token-store.js +22 -4
  46. package/lib/basic-info/basic-info.js +2 -1
  47. package/lib/bridge/bridge.js +43 -18
  48. package/lib/core/agent-capabilities.js +5 -3
  49. package/lib/core/command-errors.js +38 -0
  50. package/lib/core/command-manifest.js +59 -1
  51. package/lib/core/copy.js +12 -0
  52. package/lib/core/doctor.js +15 -4
  53. package/lib/core/env-cmd.js +1 -1
  54. package/lib/core/env.js +7 -6
  55. package/lib/core/i18n.js +66 -8
  56. package/lib/core/legacy-schema-guard.js +408 -0
  57. package/lib/core/locales/en.js +38 -46
  58. package/lib/core/locales/zh.js +30 -46
  59. package/lib/core/sample.js +12 -2
  60. package/lib/core/utils.js +334 -66
  61. package/lib/core/yida-client.js +108 -5
  62. package/lib/corp-efficiency/corp-efficiency.js +2 -2
  63. package/lib/corp-manager/corp-manager.js +3 -3
  64. package/lib/formula/evaluate.js +11 -68
  65. package/lib/formula/field-refs.js +83 -0
  66. package/lib/i18n-management/i18n-management.js +2 -3
  67. package/lib/process/configure-process.js +44 -1992
  68. package/lib/process/create-process.js +54 -87
  69. package/lib/process/preview-process.js +20 -8
  70. package/lib/process/services/process-compiler.js +2056 -0
  71. package/lib/process/services/process-reader.js +232 -0
  72. package/lib/process/services/process-resource-service.js +571 -0
  73. package/lib/process/services/process-service.js +122 -0
  74. package/lib/process/services/process-stage-checkpoint.js +246 -0
  75. package/lib/report/append.js +7 -26
  76. package/lib/report/http.js +31 -5
  77. package/lib/report/index.js +10 -2
  78. package/lib/samples/yida-canvas-custom-page/business-list.canvas.jsx +63 -14
  79. package/lib/samples/yida-canvas-custom-page/dashboard-overview.canvas.jsx +176 -32
  80. package/lib/samples/yida-canvas-custom-page/dashboard-starter.canvas.jsx +5 -2
  81. package/lib/samples/yida-canvas-custom-page/data-management.canvas.jsx +228 -14
  82. package/lib/samples/yida-canvas-custom-page/portal-shell-home.canvas.jsx +2 -2
  83. package/lib/samples/yida-canvas-custom-page/split-pane-detail.canvas.jsx +206 -10
  84. package/lib/samples/yida-custom-page/data-management.oyd.jsx +14 -3
  85. package/lib/samples/yida-custom-page/design-tokens.js +2 -2
  86. package/lib/samples/yida-custom-page/detail-profile.oyd.jsx +1 -1
  87. package/lib/samples/yida-custom-page/portal-shell-home.oyd.jsx +7 -2
  88. package/lib/samples/yida-custom-page/split-pane-detail.oyd.jsx +2 -1
  89. package/lib/schema/adapters/app-adapter.js +210 -0
  90. package/lib/schema/adapters/form-adapter.js +1362 -0
  91. package/lib/schema/adapters/keys.js +19 -0
  92. package/lib/schema/adapters/page-adapter.js +566 -0
  93. package/lib/schema/adapters/process-adapter.js +519 -0
  94. package/lib/schema/applier.js +1878 -0
  95. package/lib/schema/apply-store.js +1083 -0
  96. package/lib/schema/command.js +645 -0
  97. package/lib/schema/dependency-graph.js +83 -0
  98. package/lib/schema/errors.js +481 -0
  99. package/lib/schema/hash.js +9 -0
  100. package/lib/schema/manifest-limits.js +177 -0
  101. package/lib/schema/manifest-loader.js +309 -0
  102. package/lib/schema/manifest-schema-v1.json +193 -0
  103. package/lib/schema/normalize-manifest.js +281 -0
  104. package/lib/schema/page-canvas-foundation.js +447 -0
  105. package/lib/schema/page-data-source-builder.js +561 -0
  106. package/lib/schema/page-foundation.js +556 -0
  107. package/lib/schema/page-source-loader.js +314 -0
  108. package/lib/schema/planner.js +691 -0
  109. package/lib/schema/remote-dispatch-boundary.js +39 -0
  110. package/lib/schema/remote-missing.js +21 -0
  111. package/lib/schema/remote-reader.js +189 -0
  112. package/lib/schema/resource-registry.js +157 -0
  113. package/lib/schema/server-revision.js +71 -0
  114. package/lib/schema/sort.js +28 -0
  115. package/lib/schema/state-store.js +589 -0
  116. package/package.json +10 -8
  117. package/scripts/check-release-risks.js +254 -0
  118. package/scripts/generate-command-docs.js +6 -1
  119. package/scripts/i18n-baseline.json +11 -11
  120. package/scripts/postinstall.js +8 -12
  121. package/scripts/validate-ci.sh +15 -11
  122. package/scripts/validate-i18n.js +30 -9
  123. package/scripts/validate-package-size.js +5 -2
  124. package/scripts/validate-skills.js +4 -0
  125. package/scripts/validate-structure.js +15 -0
  126. package/yida-skills/SKILL.md +117 -30
  127. package/yida-skills/references/schema-as-code-phase1.md +99 -0
  128. package/yida-skills/references/setup-and-env.md +59 -59
  129. package/yida-skills/references/task-retrospective.md +6 -6
  130. package/yida-skills/skills/yida-app/SKILL.md +78 -17
  131. package/yida-skills/skills/yida-canvas-custom-page/SKILL.md +18 -7
  132. package/yida-skills/skills/yida-canvas-custom-page/references/data-bridge-guide.md +3 -3
  133. package/yida-skills/skills/yida-canvas-custom-page/references/page-generation-guide.md +15 -0
  134. package/yida-skills/skills/yida-create-app/SKILL.md +21 -3
  135. package/yida-skills/skills/yida-create-form-page/SKILL.md +19 -1
  136. package/yida-skills/skills/yida-create-page/SKILL.md +16 -3
  137. package/yida-skills/skills/yida-create-process/SKILL.md +100 -4
  138. package/yida-skills/skills/yida-custom-page/SKILL.md +19 -4
  139. package/yida-skills/skills/yida-dashboard/SKILL.md +1 -1
  140. package/yida-skills/skills/yida-dashboard/references/pitfalls.md +1 -1
  141. package/yida-skills/skills/yida-get-schema/SKILL.md +49 -5
  142. package/yida-skills/skills/yida-i18n/SKILL.md +1 -1
  143. package/yida-skills/skills/yida-integration/SKILL.md +7 -1
  144. package/yida-skills/skills/yida-login/SKILL.md +50 -99
  145. package/yida-skills/skills/yida-page-config/SKILL.md +7 -1
  146. package/yida-skills/skills/yida-page-uiux/references/app/blueprint.md +0 -1
  147. package/yida-skills/skills/yida-page-uiux/references/app/navigation-patterns.md +0 -1
  148. package/yida-skills/skills/yida-page-uiux/references/app/role-journey.md +0 -1
  149. package/yida-skills/skills/yida-page-uiux/references/dashboard/app-blueprint.md +0 -1
  150. package/yida-skills/skills/yida-page-uiux/references/dashboard/chart-contracts.md +0 -1
  151. package/yida-skills/skills/yida-page-uiux/references/dashboard/component-contracts.md +0 -1
  152. package/yida-skills/skills/yida-page-uiux/references/dashboard/layout-patterns.md +0 -1
  153. package/yida-skills/skills/yida-page-uiux/references/dashboard/theme-recipes.md +0 -1
  154. package/yida-skills/skills/yida-page-uiux/references/detail/object-narrative.md +0 -1
  155. package/yida-skills/skills/yida-page-uiux/references/detail/section-patterns.md +0 -1
  156. package/yida-skills/skills/yida-page-uiux/references/detail/timeline-and-related.md +0 -1
  157. package/yida-skills/skills/yida-page-uiux/references/landing/assets-workflow.md +0 -1
  158. package/yida-skills/skills/yida-page-uiux/references/landing/industry-playbooks.md +0 -1
  159. package/yida-skills/skills/yida-page-uiux/references/landing/research-levels.md +0 -1
  160. package/yida-skills/skills/yida-page-uiux/references/landing/section-patterns.md +0 -1
  161. package/yida-skills/skills/yida-page-uiux/references/list/drawer-detail.md +0 -1
  162. package/yida-skills/skills/yida-page-uiux/references/list/empty-loading-error.md +0 -1
  163. package/yida-skills/skills/yida-page-uiux/references/list/filter-patterns.md +0 -1
  164. package/yida-skills/skills/yida-page-uiux/references/list/table-patterns.md +0 -1
  165. package/yida-skills/skills/yida-page-uiux/references/scenes/screen.md +0 -1
  166. package/yida-skills/skills/yida-page-uiux/references/workbench/entry-patterns.md +0 -1
  167. package/yida-skills/skills/yida-page-uiux/references/workbench/portal-layouts.md +0 -1
  168. package/yida-skills/skills/yida-page-uiux/references/workbench/task-feed.md +0 -1
  169. package/yida-skills/skills/yida-page-uiux/workflow/output-decision-block.md +1 -1
  170. package/yida-skills/skills/yida-process-rule/SKILL.md +35 -1
  171. package/yida-skills/skills/yida-publish-page/SKILL.md +46 -4
  172. package/yida-skills/skills/yida-report/SKILL.md +9 -235
  173. package/yida-skills/skills/yida-report/references/schema-builder-details.md +239 -0
  174. package/yida-skills/skills/yida-skill-evaluator/SKILL.md +170 -0
  175. package/yida-skills/skills-index.json +238 -54
  176. package/lib/core/locales/ar.js +0 -834
  177. package/lib/core/locales/de.js +0 -834
  178. package/lib/core/locales/es.js +0 -834
  179. package/lib/core/locales/fr.js +0 -834
  180. package/lib/core/locales/hi.js +0 -834
  181. package/lib/core/locales/ja.js +0 -1227
  182. package/lib/core/locales/ko.js +0 -836
  183. package/lib/core/locales/pt.js +0 -834
  184. package/lib/core/locales/vi.js +0 -834
  185. package/lib/core/locales/zh-HK.js +0 -1263
  186. package/project/pages/src/demo-birthday-game.oyd.jsx +0 -832
  187. package/project/pages/src/demo-chip-insight.oyd.jsx +0 -983
  188. package/project/pages/src/demo-compat-smoke.oyd.jsx +0 -58
  189. package/project/pages/src/demo-crm-batch-entry.oyd.jsx +0 -805
  190. package/project/pages/src/demo-crm-dashboard.oyd.jsx +0 -677
  191. package/project/pages/src/demo-future-vision-2026.oyd.jsx +0 -1102
  192. package/project/pages/src/demo-ppt.oyd.jsx +0 -1192
  193. package/project/pages/src/demo-salary-calculator.oyd.jsx +0 -904
  194. package/project/pages/src/openyida-knowledge-doc.oyd.jsx +0 -1714
  195. package/yida-skills/skills/large-file-write/SKILL.md +0 -93
  196. package/yida-skills/skills/large-file-write/references/write-patterns.md +0 -147
  197. package/yida-skills/skills/large-file-write/scripts/write.js +0 -157
  198. package/yida-skills/skills/sls-log-workbench/SKILL.md +0 -134
  199. package/yida-skills/skills/sls-log-workbench/references/workbench-reference.md +0 -130
  200. package/yida-skills/skills/sls-log-workbench/sls-query.js +0 -295
@@ -1,295 +0,0 @@
1
- /**
2
- * sls-query.js - SLS 日志查询脚本(带 corpId + 口令 权限校验)
3
- *
4
- * 用法:
5
- * node sls-query.js --passphrase <口令> traceId <traceId>
6
- * node sls-query.js --passphrase <口令> context <paramsJSON>
7
- * node sls-query.js --passphrase <口令> businessRules <paramsJSON>
8
- * node sls-query.js --passphrase <口令> flowRecord <paramsJSON>
9
- * node sls-query.js --passphrase <口令> procCondition <paramsJSON>
10
- * node sls-query.js --passphrase <口令> graySingle <paramsJSON>
11
- * node sls-query.js --passphrase <口令> grayMulti <paramsJSON>
12
- *
13
- * context 参数说明 (queryMonitorContext.json):
14
- * path - 接口路径,如 /APP_xxx/v1/form/saveFormData.json
15
- * corpId - 组织 corpId
16
- * appId - 应用标识(注意:是 appId 不是 appType)
17
- * userId - 用户 ID
18
- * searchKeys - 检索关键词,多个用 | 连接
19
- * beginTime - 开始时间戳(毫秒)
20
- * endTime - 结束时间戳(毫秒)
21
- * pageIndex - 页码
22
- * pageSize - 每页条数
23
- * reverse - 排序方式
24
- *
25
- * flowRecord 参数说明 (queryFlowRecord.json):
26
- * isLogicFlow - 是否逻辑流程
27
- * appId - 应用 ID
28
- * procInstId - 流程实例 ID
29
- * activityName - 活动名称
30
- * beginTime/endTime - 时间范围
31
- * reverse - 排序方式
32
- *
33
- * businessRules 参数说明 (queryBusinessRules.json):
34
- * executeRecordUuid - 规则执行记录 UUID
35
- *
36
- * procCondition 参数说明 (queryProcConditionLogs.json):
37
- * procInstId - 流程实例 ID
38
- * activityId - 活动 ID
39
- * searchKeys - 检索关键词
40
- * beginTime/endTime - 时间范围
41
- *
42
- * 权限控制:仅允许 corpId = ding328fe145009a4328f2c783f7214b6d69 的组织使用
43
- */
44
-
45
- 'use strict';
46
-
47
- const https = require('https');
48
- const querystring = require('querystring');
49
- const path = require('path');
50
-
51
- // ══════════════════════════════════════════════════════════════
52
- // ⛔ 权限白名单 — 硬编码,不可通过任何外部配置或参数修改
53
- // ══════════════════════════════════════════════════════════════
54
- const ALLOWED_CORP_IDS = Object.freeze([
55
- 'ding328fe145009a4328f2c783f7214b6d69',
56
- ]);
57
-
58
- // ⛔ 口令 — 硬编码,不区分大小写
59
- const VALID_PASSPHRASE = 'lbc';
60
-
61
- const REFERER_PATH = '/APP_VS2F0YQPOTTCHXNKT16K/workbench/FORM-8392A7A7B3F74D45AC9787AD4C2E4742YZ4H';
62
-
63
- const API_MAP = Object.freeze({
64
- traceId: [
65
- '/query/morning/queryMonitorContextByTraceId.json',
66
- '/query/morning/queryMonitorErrorLog.json',
67
- '/query/morning/queryMonitorBusinessLog.json',
68
- ],
69
- context: ['/query/morning/queryMonitorContext.json'],
70
- businessRules: ['/query/morning/queryBusinessRules.json'],
71
- flowRecord: ['/query/morning/queryFlowRecord.json'],
72
- procCondition: ['/query/morning/queryProcConditionLogs.json'],
73
- graySingle: ['/query/morning/grayChangeAndDescribeSimilarity.json'],
74
- grayMulti: ['/query/morning/calculateGraySimilarityForSimple.json'],
75
- });
76
-
77
- // ── openyida utils 动态定位 ───────────────────────────────────
78
-
79
- function findOpenyidaModule(relativePath) {
80
- try {
81
- const openyidaBin = require('child_process')
82
- .execSync('which openyida', { encoding: 'utf-8' })
83
- .trim();
84
- const nodeModulesRoot = path.resolve(path.dirname(openyidaBin), '..', 'lib', 'node_modules');
85
- return require(path.join(nodeModulesRoot, 'openyida', relativePath));
86
- } catch {
87
- console.error('⛔ 无法定位 openyida 工具,请确认已安装:npm install -g openyida');
88
- process.exit(1);
89
- }
90
- }
91
-
92
- function findOpenyidaUtils() {
93
- return findOpenyidaModule(path.join('lib', 'core', 'utils.js'));
94
- }
95
-
96
- function findOpenyidaTokenAuth() {
97
- return findOpenyidaModule(path.join('lib', 'auth', 'token-auth.js'));
98
- }
99
-
100
- // ── 口令校验 ──────────────────────────────────────────────────
101
-
102
- function enforcePassphraseCheck(passphrase) {
103
- if (!passphrase || passphrase.toLowerCase() !== VALID_PASSPHRASE) {
104
- console.error('⛔ 权限校验失败:当前无权使用此技能。');
105
- process.exit(1);
106
- }
107
-
108
- console.error('✅ 口令校验通过');
109
- }
110
-
111
- // ── 权限校验 ──────────────────────────────────────────────────
112
-
113
- function enforceCorpIdCheck(authData) {
114
- const corpId = authData && authData.corp_id ? authData.corp_id : '';
115
-
116
- if (!corpId) {
117
- console.error('⛔ 权限校验失败:无法从登录态中提取 corpId。');
118
- console.error('请先执行 openyida login 登录后重试。');
119
- process.exit(1);
120
- }
121
-
122
- if (!ALLOWED_CORP_IDS.includes(corpId)) {
123
- // 不输出真实 corpId,防止信息泄露
124
- console.error('⛔ 权限校验失败:当前组织无权使用此技能。');
125
- console.error('本技能仅限内部技术支持团队使用,如需使用请联系管理员。');
126
- process.exit(1);
127
- }
128
-
129
- console.error(`✅ 权限校验通过 (corpId: ${corpId.substring(0, 20)}...)`);
130
- }
131
-
132
- // ── HTTP 请求 ─────────────────────────────────────────────────
133
-
134
- function slsPost(baseUrl, requestPath, bodyParams, bearerToken) {
135
- return new Promise((resolve, reject) => {
136
- const parsedUrl = new URL(baseUrl);
137
-
138
- const postBody = querystring.stringify({
139
- ...bodyParams,
140
- _stamp: String(Date.now()),
141
- });
142
-
143
- const options = {
144
- hostname: parsedUrl.hostname,
145
- port: 443,
146
- path: requestPath,
147
- method: 'POST',
148
- headers: {
149
- 'Content-Type': 'application/x-www-form-urlencoded',
150
- 'Content-Length': Buffer.byteLength(postBody),
151
- Accept: 'application/json, text/plain, */*',
152
- Origin: baseUrl,
153
- Referer: baseUrl + REFERER_PATH,
154
- Authorization: `Bearer ${bearerToken}`,
155
- 'x-requested-with': 'XMLHttpRequest',
156
- },
157
- timeout: 30000,
158
- };
159
-
160
- const req = https.request(options, (res) => {
161
- let data = '';
162
- res.on('data', (chunk) => { data += chunk; });
163
- res.on('end', () => {
164
- try {
165
- resolve(JSON.parse(data));
166
- } catch {
167
- resolve({ success: false, errorMsg: 'Response is not JSON', raw: data.substring(0, 300) });
168
- }
169
- });
170
- });
171
-
172
- req.on('error', reject);
173
- req.on('timeout', () => {
174
- req.destroy();
175
- reject(new Error('Request timeout'));
176
- });
177
- req.write(postBody);
178
- req.end();
179
- });
180
- }
181
-
182
- // ── TraceId 查询 ──────────────────────────────────────────────
183
-
184
- async function queryByTraceId(traceId, baseUrl, bearerToken) {
185
- const apis = API_MAP.traceId;
186
- const apiNames = ['上下文日志', '系统异常日志', '业务日志'];
187
- const results = {};
188
-
189
- for (let i = 0; i < apis.length; i++) {
190
- console.error(`\n📡 查询 ${apiNames[i]}...`);
191
- const result = await slsPost(baseUrl, apis[i], { traceId }, bearerToken);
192
- console.error(` success: ${result.success}, errorCode: ${result.errorCode || 'none'}`);
193
- results[apiNames[i]] = result;
194
- }
195
-
196
- return { traceId, ...results };
197
- }
198
-
199
- // ── 通用查询 ──────────────────────────────────────────────────
200
-
201
- async function queryGeneric(queryType, paramsJson, baseUrl, bearerToken) {
202
- const apis = API_MAP[queryType];
203
- if (!apis) {
204
- console.error(`⛔ 未知的查询类型: ${queryType}`);
205
- console.error(`支持的类型: ${Object.keys(API_MAP).join(', ')}`);
206
- process.exit(1);
207
- }
208
-
209
- let params;
210
- try {
211
- params = JSON.parse(paramsJson);
212
- } catch {
213
- console.error('⛔ 参数 JSON 格式错误');
214
- process.exit(1);
215
- }
216
-
217
- const results = {};
218
- for (const api of apis) {
219
- console.error(`\n📡 查询 ${api}...`);
220
- const result = await slsPost(baseUrl, api, params, bearerToken);
221
- console.error(` success: ${result.success}, errorCode: ${result.errorCode || 'none'}`);
222
- results[api] = result;
223
- }
224
-
225
- return { queryType, params, ...results };
226
- }
227
-
228
- // ── 主流程 ────────────────────────────────────────────────────
229
-
230
- function extractPassphrase(args) {
231
- const passphraseIndex = args.indexOf('--passphrase');
232
- if (passphraseIndex === -1 || passphraseIndex + 1 >= args.length) {
233
- return { passphrase: null, remainingArgs: args };
234
- }
235
- const passphrase = args[passphraseIndex + 1];
236
- const remainingArgs = [...args.slice(0, passphraseIndex), ...args.slice(passphraseIndex + 2)];
237
- return { passphrase, remainingArgs };
238
- }
239
-
240
- async function main() {
241
- const rawArgs = process.argv.slice(2);
242
- const { passphrase, remainingArgs } = extractPassphrase(rawArgs);
243
-
244
- if (remainingArgs.length < 2) {
245
- console.error('用法: node sls-query.js --passphrase <口令> <queryType> <参数>');
246
- console.error('');
247
- console.error('查询类型:');
248
- console.error(' traceId <traceId值> - 通过 TraceId 查询完整调用链');
249
- console.error(' context <paramsJSON> - 页面/接口请求日志');
250
- console.error(' businessRules <paramsJSON> - 业务规则日志');
251
- console.error(' flowRecord <paramsJSON> - 集成自动化/流程日志');
252
- console.error(' procCondition <paramsJSON> - 流程分支计算结果');
253
- console.error(' graySingle <paramsJSON> - 单组织灰度匹配');
254
- console.error(' grayMulti <paramsJSON> - 多组织灰度匹配');
255
- process.exit(1);
256
- }
257
-
258
- // Step 0: 口令校验(硬编码,不可绕过)
259
- enforcePassphraseCheck(passphrase);
260
-
261
- const [queryType, paramValue] = remainingArgs;
262
-
263
- // Step 1: 加载登录态(不自动触发登录,防止通过重新登录绕过 corpId 校验)
264
- const utils = findOpenyidaUtils();
265
- const authData = utils.loadAuthData();
266
-
267
- if (!authData || authData.auth_mode !== 'token') {
268
- console.error('⛔ 权限校验失败:未检测到登录态。');
269
- console.error('请先执行 openyida login 登录到授权组织后重试。');
270
- process.exit(1);
271
- }
272
-
273
- // Step 2: 权限校验(硬编码,不可绕过)
274
- enforceCorpIdCheck(authData);
275
-
276
- const baseUrl = utils.resolveBaseUrl(authData);
277
- const { getAccessToken } = findOpenyidaTokenAuth();
278
- const bearerToken = await getAccessToken();
279
-
280
- // Step 3: 执行查询
281
- let output;
282
- if (queryType === 'traceId') {
283
- output = await queryByTraceId(paramValue, baseUrl, bearerToken);
284
- } else {
285
- output = await queryGeneric(queryType, paramValue, baseUrl, bearerToken);
286
- }
287
-
288
- // Step 4: 输出结果(JSON 到 stdout)
289
- console.log(JSON.stringify(output, null, 2));
290
- }
291
-
292
- main().catch((error) => {
293
- console.error(`⛔ 执行失败: ${error.message}`);
294
- process.exit(1);
295
- });