openyida 2026.4.2-beta.1 → 2026.4.2-beta.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.
@@ -426,18 +426,23 @@ class ProjectInitChecker {
426
426
  }
427
427
 
428
428
  async check() {
429
- const projectDir = path.join(this.projectRoot, 'project');
429
+ // projectRoot 本身就是 project 目录(AI 工具将工作区根识别为 project/ 子目录时),
430
+ // 则直接检测 projectRoot/config.json,避免拼出 project/project 的错误路径。
431
+ const rootBasename = path.basename(this.projectRoot);
432
+ const projectDir = rootBasename === 'project'
433
+ ? this.projectRoot
434
+ : path.join(this.projectRoot, 'project');
430
435
  const configPath = path.join(projectDir, 'config.json');
431
436
  const passed = fs.existsSync(projectDir) && fs.existsSync(configPath);
432
437
 
433
438
  return [{
434
439
  id: 'project-init',
435
- label: passed ? 'project/ 工作目录已初始化' : `project/ 工作目录检测(检测路径:${projectDir})`,
440
+ label: passed ? 'project/ 工作目录已初始化' : 'project/ 工作目录检测',
436
441
  passed,
437
- severity: passed ? Severity.INFO : Severity.WARNING,
438
- message: passed ? null : 'project/ 目录未初始化,将自动执行 openyida copy',
439
- fixType: passed ? null : FixType.COMMAND,
440
- fixCommand: passed ? null : 'openyida copy',
442
+ severity: passed ? Severity.INFO : Severity.ERROR,
443
+ message: passed ? null : 'project/ 目录未初始化,将自动初始化',
444
+ fixType: passed ? null : FixType.AUTO,
445
+ fixAction: passed ? null : 'init-project',
441
446
  }];
442
447
  }
443
448
  }
@@ -657,7 +662,7 @@ class FixEngine {
657
662
 
658
663
  for (const issue of issues) {
659
664
  if (issue.fixType === FixType.AUTO) {
660
- const result = this.applyAutoFix(issue);
665
+ const result = await this.applyAutoFix(issue);
661
666
  this.fixResults.push(result);
662
667
  } else if (issue.fixType === FixType.COMMAND) {
663
668
  this.fixResults.push({
@@ -680,9 +685,9 @@ class FixEngine {
680
685
  /**
681
686
  * 执行自动修复动作。
682
687
  * @param {object} issue
683
- * @returns {object}
688
+ * @returns {Promise<object>}
684
689
  */
685
- applyAutoFix(issue) {
690
+ async applyAutoFix(issue) {
686
691
  switch (issue.fixAction) {
687
692
  case 'create-config': {
688
693
  const configPath = path.join(this.projectRoot, 'config.json');
@@ -710,6 +715,24 @@ class FixEngine {
710
715
  };
711
716
  }
712
717
 
718
+ case 'init-project': {
719
+ try {
720
+ const copy = require('./copy');
721
+ await copy([]);
722
+ return {
723
+ id: issue.id,
724
+ fixed: true,
725
+ message: '已自动初始化 project/ 工作目录',
726
+ };
727
+ } catch (error) {
728
+ return {
729
+ id: issue.id,
730
+ fixed: false,
731
+ message: `project/ 初始化失败,请手动运行:openyida copy(${error.message})`,
732
+ };
733
+ }
734
+ }
735
+
713
736
  default:
714
737
  return {
715
738
  id: issue.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openyida",
3
- "version": "2026.04.02-beta.1",
3
+ "version": "2026.04.02-beta.3",
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.1
7
+ version: 2026.04.02-beta.3
8
8
  ---
9
9
 
10
10
  # 宜搭 AI 应用开发指南