openyida 2026.4.2-beta.2 → 2026.4.2-beta.4

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.
@@ -195,15 +195,9 @@ class EnvironmentChecker {
195
195
  }
196
196
 
197
197
  checkPlaywrightInstalled() {
198
+ // 1. 检查 playwright npm 包是否安装
198
199
  try {
199
200
  require.resolve('playwright');
200
- return {
201
- id: 'env-playwright',
202
- label: 'Playwright 已安装',
203
- passed: true,
204
- severity: Severity.INFO,
205
- fixType: null,
206
- };
207
201
  } catch {
208
202
  return {
209
203
  id: 'env-playwright',
@@ -215,6 +209,39 @@ class EnvironmentChecker {
215
209
  fixCommand: 'npm install playwright && npx playwright install chromium',
216
210
  };
217
211
  }
212
+
213
+ // 2. 检查 Chromium 二进制是否存在于用户目录(postinstall 已自动安装)
214
+ try {
215
+ const { chromium } = require('playwright');
216
+ const chromiumPath = chromium.executablePath();
217
+ if (chromiumPath && fs.existsSync(chromiumPath)) {
218
+ return {
219
+ id: 'env-playwright',
220
+ label: `Playwright + Chromium 已就绪`,
221
+ passed: true,
222
+ severity: Severity.INFO,
223
+ fixType: null,
224
+ };
225
+ }
226
+ return {
227
+ id: 'env-playwright',
228
+ label: 'Chromium 浏览器检测',
229
+ passed: false,
230
+ severity: Severity.ERROR,
231
+ message: `Chromium 未安装(期望路径:${chromiumPath || '未知'})`,
232
+ fixType: FixType.COMMAND,
233
+ fixCommand: 'npx playwright install chromium',
234
+ };
235
+ } catch {
236
+ // playwright API 不可用,降级为仅检查包安装
237
+ return {
238
+ id: 'env-playwright',
239
+ label: 'Playwright 已安装',
240
+ passed: true,
241
+ severity: Severity.INFO,
242
+ fixType: null,
243
+ };
244
+ }
218
245
  }
219
246
 
220
247
  checkConfig() {
@@ -439,10 +466,10 @@ class ProjectInitChecker {
439
466
  id: 'project-init',
440
467
  label: passed ? 'project/ 工作目录已初始化' : 'project/ 工作目录检测',
441
468
  passed,
442
- severity: passed ? Severity.INFO : Severity.WARNING,
443
- message: passed ? null : 'project/ 目录未初始化,将自动执行 openyida copy',
444
- fixType: passed ? null : FixType.COMMAND,
445
- fixCommand: passed ? null : 'openyida copy',
469
+ severity: passed ? Severity.INFO : Severity.ERROR,
470
+ message: passed ? null : 'project/ 目录未初始化,将自动初始化',
471
+ fixType: passed ? null : FixType.AUTO,
472
+ fixAction: passed ? null : 'init-project',
446
473
  }];
447
474
  }
448
475
  }
@@ -662,7 +689,7 @@ class FixEngine {
662
689
 
663
690
  for (const issue of issues) {
664
691
  if (issue.fixType === FixType.AUTO) {
665
- const result = this.applyAutoFix(issue);
692
+ const result = await this.applyAutoFix(issue);
666
693
  this.fixResults.push(result);
667
694
  } else if (issue.fixType === FixType.COMMAND) {
668
695
  this.fixResults.push({
@@ -685,9 +712,9 @@ class FixEngine {
685
712
  /**
686
713
  * 执行自动修复动作。
687
714
  * @param {object} issue
688
- * @returns {object}
715
+ * @returns {Promise<object>}
689
716
  */
690
- applyAutoFix(issue) {
717
+ async applyAutoFix(issue) {
691
718
  switch (issue.fixAction) {
692
719
  case 'create-config': {
693
720
  const configPath = path.join(this.projectRoot, 'config.json');
@@ -715,6 +742,24 @@ class FixEngine {
715
742
  };
716
743
  }
717
744
 
745
+ case 'init-project': {
746
+ try {
747
+ const copy = require('./copy');
748
+ await copy([]);
749
+ return {
750
+ id: issue.id,
751
+ fixed: true,
752
+ message: '已自动初始化 project/ 工作目录',
753
+ };
754
+ } catch (error) {
755
+ return {
756
+ id: issue.id,
757
+ fixed: false,
758
+ message: `project/ 初始化失败,请手动运行:openyida copy(${error.message})`,
759
+ };
760
+ }
761
+ }
762
+
718
763
  default:
719
764
  return {
720
765
  id: issue.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openyida",
3
- "version": "2026.04.02-beta.2",
3
+ "version": "2026.04.02-beta.4",
4
4
  "description": "OpenYida CLI - 宜搭低代码 AI 开发工具(安装即用,零配置)",
5
5
  "bin": {
6
6
  "openyida": "./bin/yida.js",
@@ -4,7 +4,7 @@ description: >
4
4
  宜搭低代码平台 AI 开发入口。一句话生成完整应用:创建应用、表单设计、自定义页面、流程配置、数据管理。
5
5
  当用户提到"宜搭"、"yida"、"低代码"、"创建应用"、"创建表单"、"发布页面"、"搭建"、"系统"、"应用"时触发。
6
6
  metadata:
7
- version: 2026.04.02-beta.2
7
+ version: 2026.04.02-beta.4
8
8
  ---
9
9
 
10
10
  # 宜搭 AI 应用开发指南