openyida 2026.11.2 → 2026.11.3

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 (94) hide show
  1. package/README.md +11 -9
  2. package/bin/yida.js +2 -1
  3. package/lib/app/application-entry-urls.js +35 -1
  4. package/lib/app/check-prd-completeness.js +27 -6
  5. package/lib/app/create-app.js +17 -9
  6. package/lib/app/fast-build.js +151 -0
  7. package/lib/app/fast-theme.js +83 -0
  8. package/lib/app/form-data-contract.js +162 -0
  9. package/lib/app/services/canvas-page-schema-builder.js +10 -0
  10. package/lib/asset/ai-image.js +8 -5
  11. package/lib/asset/asset-cmd.js +24 -4
  12. package/lib/asset/asset-execution.js +25 -4
  13. package/lib/asset/asset-plan.js +4 -2
  14. package/lib/asset/asset-resolve.js +21 -7
  15. package/lib/auth/oauth-loopback.js +1 -1
  16. package/lib/auth/org.js +2 -0
  17. package/lib/auth/token-auth.js +1 -0
  18. package/lib/core/agent-capabilities.js +30 -9
  19. package/lib/core/batch.js +71 -122
  20. package/lib/core/command-manifest.js +71 -38
  21. package/lib/core/locales/en.js +20 -4
  22. package/lib/core/locales/zh.js +19 -3
  23. package/lib/core/permission-guidance.js +10 -10
  24. package/lib/core/query-data.js +67 -10
  25. package/lib/core/sample.js +73 -0
  26. package/lib/core/task-concurrency.js +96 -0
  27. package/lib/corp-efficiency/corp-efficiency.js +15 -8
  28. package/lib/design/fast-document.js +118 -0
  29. package/lib/design-plan/design-plan.js +3 -3
  30. package/lib/design-plan/init.js +90 -5
  31. package/lib/design-plan/materialize.js +2 -2
  32. package/lib/design-plan/validate.js +64 -9
  33. package/lib/flash-note/build-flash-note-prompt.js +1 -1
  34. package/lib/samples/openyida-scaffold/canvas-data-source.jsx +135 -0
  35. package/lib/samples/openyida-scaffold/canvas-file-upload.jsx +106 -0
  36. package/lib/samples/openyida-scaffold/file-upload-client.jsx +160 -0
  37. package/lib/samples/yida-app/fast-app.json +64 -0
  38. package/lib/samples/yida-design/fast-design.json +38 -0
  39. package/package.json +3 -3
  40. package/scripts/postinstall.js +6 -6
  41. package/yida-skills/SKILL.md +10 -9
  42. package/yida-skills/references/official-example-schema-patterns.md +3 -3
  43. package/yida-skills/references/qwenwork-link-presentation.md +11 -16
  44. package/yida-skills/references/user-facing-summary.md +1 -1
  45. package/yida-skills/skills/yida-app/SKILL.md +23 -12
  46. package/yida-skills/skills/yida-app/references/fast-context.md +7 -0
  47. package/yida-skills/skills/yida-app/workflow/fast-build.md +65 -0
  48. package/yida-skills/skills/yida-app/workflow/parallel-work.md +15 -5
  49. package/yida-skills/skills/yida-app/workflow/plan/workflow.md +5 -1
  50. package/yida-skills/skills/yida-app/workflow/step-2-design.md +13 -6
  51. package/yida-skills/skills/yida-app/workflow/step-3-create-or-reuse-app.md +7 -2
  52. package/yida-skills/skills/yida-app/workflow/step-4-forms-processes.md +4 -1
  53. package/yida-skills/skills/yida-app/workflow/step-5-seed-records.md +4 -1
  54. package/yida-skills/skills/yida-app/workflow/step-6-main-page.md +3 -0
  55. package/yida-skills/skills/yida-app/workflow/step-7-page-code.md +5 -2
  56. package/yida-skills/skills/yida-app/workflow/step-8-publish-navigation.md +3 -0
  57. package/yida-skills/skills/yida-app/workflow/step-9-output-finish.md +7 -2
  58. package/yida-skills/skills/yida-canvas-custom-page/SKILL.md +14 -4
  59. package/yida-skills/skills/yida-canvas-custom-page/references/data-bridge-guide.md +2 -0
  60. package/yida-skills/skills/yida-canvas-custom-page/references/file-upload.md +75 -0
  61. package/yida-skills/skills/yida-canvas-custom-page/references/native-components-bridge.md +4 -3
  62. package/yida-skills/skills/yida-canvas-custom-page/references/page-generation-guide.md +1 -1
  63. package/yida-skills/skills/yida-canvas-data-binding/SKILL.md +23 -82
  64. package/yida-skills/skills/yida-corp-efficiency/SKILL.md +3 -3
  65. package/yida-skills/skills/yida-create-app/SKILL.md +9 -5
  66. package/yida-skills/skills/yida-create-form-page/SKILL.md +1 -1
  67. package/yida-skills/skills/yida-create-form-page/references/field-definition-guide.md +1 -1
  68. package/yida-skills/skills/yida-create-form-page/references/form-field-properties.md +13 -17
  69. package/yida-skills/skills/yida-custom-page/SKILL.md +2 -0
  70. package/yida-skills/skills/yida-custom-page/references/attachment-upload-guide.md +4 -0
  71. package/yida-skills/skills/yida-data-management/SKILL.md +2 -0
  72. package/yida-skills/skills/yida-data-management/references/data-format-guide.md +9 -0
  73. package/yida-skills/skills/yida-design/SKILL.md +7 -2
  74. package/yida-skills/skills/yida-design/references/application-theme-consistency.md +4 -4
  75. package/yida-skills/skills/yida-design/references/ask-human-interaction-contract.md +2 -2
  76. package/yida-skills/skills/yida-design/references/design-mode.md +4 -2
  77. package/yida-skills/skills/yida-design/references/fast-design-spec.md +32 -0
  78. package/yida-skills/skills/yida-design/references/native-form-styles.md +2 -2
  79. package/yida-skills/skills/yida-design/templates/design-themes/app-teal/design.md +4 -4
  80. package/yida-skills/skills/yida-design/templates/design-themes/app-terminal/design.md +4 -4
  81. package/yida-skills/skills/yida-design/workflow/output-design.md +1 -1
  82. package/yida-skills/skills/yida-design/workflow/step-4-wireframe-interaction.md +1 -1
  83. package/yida-skills/skills/yida-design/workflow/step-6-handoff.md +1 -1
  84. package/yida-skills/skills/yida-dingtalk-openapi/references/api-contract.md +1 -1
  85. package/yida-skills/skills/yida-flash-note-to-prd/references/flash-note-prompt.md +1 -1
  86. package/yida-skills/skills/yida-image-assets/SKILL.md +11 -5
  87. package/yida-skills/skills/yida-login/SKILL.md +6 -0
  88. package/yida-skills/skills/yida-ppt-slider/references/examples.md +3 -3
  89. package/yida-skills/skills/yida-prd/SKILL.md +5 -1
  90. package/yida-skills/skills/yida-publish-page/SKILL.md +3 -0
  91. package/yida-skills/skills/yida-requirement-analysis/SKILL.md +4 -1
  92. package/yida-skills/skills/yida-requirement-analysis/references/handoff.md +4 -1
  93. package/yida-skills/skills/yida-requirement-analysis/workflow/prepare-brief.md +3 -0
  94. package/yida-skills/skills-index.json +2 -2
@@ -8,7 +8,9 @@ const { t } = require('./i18n');
8
8
  const { buildCommandManifest, buildEntryDeliveryPolicy } = require('./command-manifest');
9
9
  const { buildEnvironmentSnapshot } = require('./env');
10
10
  const coreUtils = require('./utils');
11
+ const { buildTaskExecutionPolicy } = require('./task-concurrency');
11
12
  const { buildHostAssetCapabilities } = require('../asset/host-capabilities');
13
+ const { preferredLinkPresentationTool, buildLinkPresentationCompletionGate } = require('../app/application-entry-urls');
12
14
  const { buildQwenWorkLoginInvocation, isQwenWorkWebRuntime } = require('./qwenwork-login-guidance');
13
15
  const { findProjectRoot, getAuthStatus } = coreUtils;
14
16
 
@@ -139,21 +141,35 @@ function buildLinkPresentationPolicy(runtime = {}) {
139
141
  }
140
142
  return {
141
143
  mode: 'host_show_link',
142
- applies_to: 'developer_admin_link_at_end_of_each_turn',
144
+ applies_to: 'current_yida_entry_at_end_of_each_turn',
143
145
  timing: 'before_final_reply',
144
146
  max_calls_per_turn: 1,
145
- target: 'current_application_confirmed_adminUrl',
146
- target_path: '/admin',
147
+ target: 'single_updated_page_workbench_entry_otherwise_adminUrl',
148
+ target_selection: {
149
+ single_page_update: {
150
+ condition: 'Only one existing page was successfully modified in this turn, with no other resource or application changes.',
151
+ count_by: 'distinct_appType_and_formUuid_in_this_turn',
152
+ repeated_updates: 'count_same_page_once',
153
+ read_only_operations: 'do_not_count',
154
+ target: 'modified_page_confirmed_workbench_entry',
155
+ target_path: '/workbench/{formUuid}',
156
+ },
157
+ otherwise: {
158
+ target: 'current_application_confirmed_adminUrl',
159
+ target_path: '/admin',
160
+ includes: 'New applications or pages, multiple modified pages, other resource or application changes, no page modification, or unconfirmed single-page scope or workbenchUrl.',
161
+ },
162
+ },
147
163
  other_links: 'preserve_existing_delivery_and_workflow',
148
164
  requires_host_tool_inventory_check: true,
149
165
  tool_availability: 'unknown_until_declared_by_host',
150
- preferred_tool: runtime.subtype === 'qwenwork_web' ? 'show_link'
151
- : runtime.subtype === 'qwenwork_desktop' ? 'artifact_show_link' : null,
166
+ preferred_tool: preferredLinkPresentationTool(runtime),
167
+ completion_gate: buildLinkPresentationCompletionGate(),
152
168
  tool_selection: 'In QwenWork cloud, prefer show_link; on desktop, prefer artifact_show_link. Otherwise use an available link presentation tool and its declared parameters and supported resources.',
153
- input: 'Use the current application confirmed adminUrl from create-app or app-list, unchanged. Never substitute a frontend, workbench or page URL.',
154
- required_action: 'Keep the existing YiDA workflow and ordinary link delivery. Only before the final reply of each turn, call the available link presentation tool once for the current application confirmed /admin developer administration URL. Repeat once in each new turn, not for every link. Respect explicit user exclusions.',
155
- scope: 'Only the current YiDA application developer administration entry.',
156
- fallback: 'If the application or adminUrl is unconfirmed, do not guess or create resources. If the tool is unavailable or fails, keep the completed work and clickable admin link without repeated calls or business writes.',
169
+ input: 'For a single-page update, use the modified page confirmed workbench entry from a successful result or targeted readback, preferring workbenchUrl; formUrl or url is also eligible when its path is /{appType}/workbench/{formUuid} for that verified page. Otherwise use the current application confirmed adminUrl from create-app or app-list. Preserve the selected URL unchanged; do not substitute a standalone /custom/ URL or hard-code example resources.',
170
+ required_action: 'Keep the existing YiDA workflow and ordinary link delivery. Before the final reply of each turn, select the single updated page workbenchUrl or otherwise the application adminUrl according to target_selection, and call the available link presentation tool once. Repeat once in each new turn, not for every link. Respect explicit user exclusions.',
171
+ scope: 'The single updated existing page entry when eligible; otherwise the current YiDA application developer administration entry.',
172
+ fallback: 'If the single-page scope or its workbenchUrl is unconfirmed, use the confirmed application adminUrl. If no eligible URL is confirmed, do not guess or create resources. If the tool is unavailable or fails, keep the completed work and selected clickable link without repeated calls or business writes.',
157
173
  user_facing_guidance: 'Explain only the business result, what the link opens and any action the user needs to take. Do not describe tool names, parameters or background processing unless the user asks for technical details.',
158
174
  success_means: 'presentation_request_accepted_only_not_registration_or_rendering',
159
175
  cli_urls: 'preserve_original_fields',
@@ -206,6 +222,7 @@ function commandBriefs(manifest, commandIds) {
206
222
  examples: entry.examples || [],
207
223
  args: entry.args || [],
208
224
  canonical: entry.canonical || null,
225
+ task_concurrency: entry.task_concurrency || null,
209
226
  notes: entry.notes || [],
210
227
  }));
211
228
  }
@@ -586,6 +603,7 @@ function buildFullAppArtifactRoute(manifest) {
586
603
  orchestrator_skill_id: workflow.orchestrator_skill_id,
587
604
  requirement_analysis_skill_id: workflow.requirement_analysis_skill_id,
588
605
  requirement_brief_path: workflow.requirement_brief_path,
606
+ fast_build: workflow.fast_build,
589
607
  visual_decision_policy: workflow.visual_decision_policy,
590
608
  user_visible_expression_policy: workflow.user_visible_expression_policy,
591
609
  optional_asset_branch: workflow.optional_asset_branch,
@@ -670,6 +688,7 @@ function buildCommandManifestDigest(manifest) {
670
688
  permission_effect: entry.permission && entry.permission.effect,
671
689
  args: entry.args || [],
672
690
  canonical: entry.canonical || null,
691
+ task_concurrency: entry.task_concurrency || null,
673
692
  notes: entry.notes || [],
674
693
  })),
675
694
  };
@@ -744,6 +763,7 @@ function buildAgentCapabilitiesSummary() {
744
763
  link_presentation_policy: buildLinkPresentationPolicy(runtime),
745
764
  runtime,
746
765
  asset_capabilities: assetCapabilities,
766
+ task_execution: buildTaskExecutionPolicy(),
747
767
  builder_path: builderPath,
748
768
  };
749
769
  }
@@ -781,6 +801,7 @@ function buildAgentCapabilities() {
781
801
  active: envSnapshot.active,
782
802
  runtime,
783
803
  asset_capabilities: assetCapabilities,
804
+ task_execution: buildTaskExecutionPolicy(),
784
805
  login: loginStatus,
785
806
  application_entry_policy: applicationEntryPolicy,
786
807
  link_presentation_policy: buildLinkPresentationPolicy(runtime),
package/lib/core/batch.js CHANGED
@@ -7,23 +7,28 @@
7
7
  * openyida batch --commands "cmd1" "cmd2" "cmd3" # 内联模式,多参数
8
8
  *
9
9
  * 可选:
10
- * --stop-on-error 遇到第一条失败命令即停止(默认继续执行)
11
- * --json 最终只输出 JSON 数组到 stdout
10
+ * --concurrency N 独立就绪任务的并发上限 1..4(默认 1)
11
+ * --stop-on-error 失败后停止排队任务,等待运行中的任务完成
12
+ * --json 最终只输出 JSON 汇总到 stdout
12
13
  * --quiet 自动注入到每条子命令(batch 本身也静默)
13
14
  *
14
15
  * 设计要点:
15
16
  * - 零侵入:不修改任何已有命令的 run() 函数
16
- * - 每条子命令通过 child_process.execFileSync 调用 bin/yida.js,
17
+ * - 每条子命令通过 child_process.execFile 调用 bin/yida.js,
17
18
  * token 文件已在磁盘上,各命令读取时直接命中缓存(零登录开销)
18
- * - 子命令自动注入 --quiet,stdout 只收 JSON,stderr 静默
19
- * - batch 启动时先做一次 loadAuthData 预检,确保登录态可用
19
+ * - 静默模式为子命令注入 --quiet,逐项保存输出和耗时,结果按输入顺序汇总
20
+ * - 需要登录的任务启动前预检登录态;纯本地检查/编译不触发登录
21
+ * - 仅 manifest 已核实的独立操作并发;资源冲突等待,其他命令串行隔离
20
22
  */
21
23
 
22
24
  'use strict';
23
25
 
24
26
  const fs = require('fs');
25
27
  const path = require('path');
26
- const { execFileSync } = require('child_process');
28
+ const { execFile } = require('child_process');
29
+ const { CliError } = require('./cli-error');
30
+ const { t } = require('./i18n');
31
+ const { describeTask, runTaskWave } = require('./task-concurrency');
27
32
  const { loadAuthData, triggerLogin } = require('./utils');
28
33
  const { banner, step, success, fail, info, warn, result, label } = require('./chalk');
29
34
 
@@ -36,11 +41,18 @@ function parseArgs(args) {
36
41
  stopOnError: false,
37
42
  json: false,
38
43
  quiet: false,
44
+ concurrency: 1,
39
45
  };
40
46
 
41
47
  for (let i = 0; i < args.length; i++) {
42
48
  const arg = args[i];
43
- if (arg === '--stop-on-error') {
49
+ if (arg === '--concurrency') {
50
+ const value = args[++i];
51
+ if (!/^[1-4]$/.test(value || '')) {
52
+ throw new CliError(t('batch.invalid_concurrency'), { code: 'BATCH_INVALID_CONCURRENCY' });
53
+ }
54
+ parsed.concurrency = Number(value);
55
+ } else if (arg === '--stop-on-error') {
44
56
  parsed.stopOnError = true;
45
57
  } else if (arg === '--json') {
46
58
  parsed.json = true;
@@ -110,74 +122,44 @@ function parseCommandLine(commandLine) {
110
122
  return tokens;
111
123
  }
112
124
 
113
- function executeCommand(commandTokens, quiet) {
114
- // 自动注入 --quiet(如果子命令中没有)
115
- const finalTokens = [...commandTokens];
116
- if (quiet && !finalTokens.includes('--quiet')) {
117
- finalTokens.push('--quiet');
125
+ function parseOutput(value) {
126
+ const text = String(value || '').trim();
127
+ if (!text) { return null; }
128
+ for (const candidate of [text, text.slice(text.lastIndexOf('\n{') + 1), ...text.split('\n').reverse()]) {
129
+ try { return JSON.parse(candidate); } catch { /* Try the next complete JSON value. */ }
118
130
  }
131
+ return text;
132
+ }
119
133
 
120
- const startTime = Date.now();
121
- try {
122
- const stdout = execFileSync(process.execPath, [YIDA_BIN, ...finalTokens], {
123
- encoding: 'utf-8',
124
- timeout: 120000, // 2 分钟超时
125
- env: {
126
- ...process.env,
127
- YIDA_QUIET: quiet ? '1' : (process.env.YIDA_QUIET || ''),
128
- },
129
- stdio: ['pipe', 'pipe', 'pipe'], // 捕获 stdout/stderr
134
+ function executeCommand(commandTokens, quiet) {
135
+ const finalTokens = [...commandTokens];
136
+ if (quiet && !finalTokens.includes('--quiet')) { finalTokens.push('--quiet'); }
137
+ const started = Date.now();
138
+ return new Promise(resolve => {
139
+ execFile(process.execPath, [YIDA_BIN, ...finalTokens], {
140
+ encoding: 'utf-8', timeout: 120000, maxBuffer: 10 * 1024 * 1024,
141
+ env: { ...process.env, YIDA_QUIET: quiet ? '1' : (process.env.YIDA_QUIET || '') },
142
+ }, (error, stdout, stderr) => {
143
+ const primary = parseOutput(stdout), diagnostic = error ? parseOutput(stderr) : null;
144
+ const output = primary && typeof primary === 'object' ? primary
145
+ : diagnostic && typeof diagnostic === 'object' ? diagnostic : primary ?? diagnostic;
146
+ const failed = !!error || output?.success === false || output?.ok === false;
147
+ resolve({ command: commandTokens.join(' '), success: !failed,
148
+ exitCode: failed ? (Number.isInteger(error?.code) && error.code !== 0 ? error.code : 1) : 0,
149
+ elapsed: Date.now() - started, startedAt: new Date(started).toISOString(), endedAt: new Date().toISOString(),
150
+ output, ...(failed ? { error: output?.errorMsg || output?.message || output?.error || String(stderr || error?.message || '').trim() } : {}),
151
+ });
130
152
  });
131
-
132
- const elapsed = Date.now() - startTime;
133
-
134
- // 尝试解析 stdout 中的 JSON
135
- const output = stdout.trim();
136
- let parsedOutput = null;
137
- if (output) {
138
- // 取最后一行非空内容(多行时前面可能有 stderr 漏到 stdout 的情况)
139
- const lines = output.split('\n').filter(Boolean);
140
- const lastLine = lines[lines.length - 1];
141
- try {
142
- parsedOutput = JSON.parse(lastLine);
143
- } catch (_parseError) {
144
- parsedOutput = output;
145
- }
146
- }
147
-
148
- return {
149
- command: commandTokens.join(' '),
150
- success: true,
151
- exitCode: 0,
152
- elapsed,
153
- output: parsedOutput,
154
- };
155
- } catch (execError) {
156
- const elapsed = Date.now() - startTime;
157
- let output = null;
158
- if (execError.stdout) {
159
- const lines = execError.stdout.toString().trim().split('\n').filter(Boolean);
160
- if (lines.length > 0) {
161
- try {
162
- output = JSON.parse(lines[lines.length - 1]);
163
- } catch (_parseError) {
164
- output = lines[lines.length - 1] || null;
165
- }
166
- }
167
- }
168
-
169
- return {
170
- command: commandTokens.join(' '),
171
- success: false,
172
- exitCode: execError.status || 1,
173
- elapsed,
174
- output,
175
- error: execError.stderr ? execError.stderr.toString().trim().split('\n').filter(Boolean).pop() : execError.message,
176
- };
177
- }
153
+ });
178
154
  }
179
155
 
180
156
  async function run(args) {
157
+ if (args.includes('--help') || args.includes('-h')) {
158
+ const entry = require('./command-manifest').flattenCommandManifest().find(item => item.id === 'batch');
159
+ console.log('openyida ' + entry.usage);
160
+ entry.notes.forEach(note => console.log(note));
161
+ return;
162
+ }
181
163
  const parsed = parseArgs(args);
182
164
  const quiet = parsed.quiet || parsed.json;
183
165
 
@@ -202,6 +184,12 @@ async function run(args) {
202
184
  return;
203
185
  }
204
186
 
187
+ const tasks = commands.map(command => {
188
+ const tokens = parseCommandLine(command);
189
+ if (tokens[0] === 'openyida') { tokens.shift(); }
190
+ return { tokens, policy: describeTask(tokens) };
191
+ }).filter(task => task.tokens.length);
192
+
205
193
  // 预检登录态
206
194
  if (!quiet) {
207
195
  banner('Batch 批量执行');
@@ -211,10 +199,10 @@ async function run(args) {
211
199
  step(1, '检查登录态');
212
200
  }
213
201
 
214
- let authData = loadAuthData();
202
+ let authData = tasks.some(task => task.policy.requiresLogin) ? loadAuthData() : {};
215
203
  if (!authData) {
216
204
  if (!quiet) { info('未找到登录缓存,触发登录...'); }
217
- authData = triggerLogin();
205
+ authData = await triggerLogin();
218
206
  }
219
207
  if (!authData) {
220
208
  fail('登录失败,无法执行批量命令');
@@ -223,56 +211,16 @@ async function run(args) {
223
211
  }
224
212
  if (!quiet) { success('登录态可用'); }
225
213
 
226
- // 逐条执行
227
- if (!quiet) { step(2, '执行命令 (' + commands.length + ' 条)'); }
228
-
229
- const results = [];
230
- let successCount = 0;
231
- let failedCount = 0;
232
- let stopped = false;
233
-
234
- for (let i = 0; i < commands.length; i++) {
235
- const commandLine = commands[i];
236
- const tokens = parseCommandLine(commandLine);
237
-
238
- // 跳过 'openyida' 前缀(用户可能写了完整命令)
239
- if (tokens[0] === 'openyida') {
240
- tokens.shift();
241
- }
242
-
243
- if (tokens.length === 0) { continue; }
244
-
245
- if (!quiet) {
246
- info('[' + (i + 1) + '/' + commands.length + '] ' + commandLine);
247
- }
248
-
249
- const commandResult = executeCommand(tokens, quiet);
250
- results.push(commandResult);
251
-
252
- if (commandResult.success) {
253
- successCount++;
254
- if (!quiet) { success(' ✓ ' + commandResult.elapsed + 'ms'); }
255
- } else {
256
- failedCount++;
257
- if (!quiet) { fail(' ✗ exit=' + commandResult.exitCode + ' ' + (commandResult.error || '')); }
258
- if (parsed.stopOnError) {
259
- if (!quiet) { warn('--stop-on-error 触发,跳过剩余 ' + (commands.length - i - 1) + ' 条命令'); }
260
- stopped = true;
261
- break;
262
- }
263
- }
264
- }
265
-
266
- // 输出结果
267
- const summary = {
268
- success: failedCount === 0,
269
- total: commands.length,
270
- executed: results.length,
271
- successCount,
272
- failedCount,
273
- stopped,
274
- results,
275
- };
214
+ if (!quiet) { step(2, t('batch.executing', String(parsed.concurrency))); }
215
+ const wave = await runTaskWave(tasks, parsed, async (task, index) => {
216
+ if (!quiet) { info('[' + (index + 1) + '/' + tasks.length + '] ' + task.tokens.join(' ')); }
217
+ return executeCommand(task.tokens, quiet);
218
+ });
219
+ const results = wave.results;
220
+ const successCount = results.filter(item => item.success).length;
221
+ const failedCount = results.length - successCount;
222
+ const summary = { success: failedCount === 0, total: tasks.length, executed: results.length,
223
+ successCount, failedCount, ...wave };
276
224
 
277
225
  if (!quiet) {
278
226
  result(failedCount === 0, 'Batch 完成: ' + successCount + ' 成功, ' + failedCount + ' 失败', [
@@ -288,6 +236,7 @@ async function run(args) {
288
236
  } else {
289
237
  console.log(JSON.stringify(summary, null, 2));
290
238
  }
239
+ return summary;
291
240
  }
292
241
 
293
- module.exports = { parseArgs, parseCommandLine, loadCommandsFromFile, run };
242
+ module.exports = { parseArgs, parseCommandLine, loadCommandsFromFile, parseOutput, executeCommand, run };