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.
- package/lib/core/doctor.js +32 -9
- package/package.json +1 -1
- package/yida-skills/SKILL.md +1 -1
package/lib/core/doctor.js
CHANGED
|
@@ -426,18 +426,23 @@ class ProjectInitChecker {
|
|
|
426
426
|
}
|
|
427
427
|
|
|
428
428
|
async check() {
|
|
429
|
-
|
|
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/ 工作目录已初始化' :
|
|
440
|
+
label: passed ? 'project/ 工作目录已初始化' : 'project/ 工作目录检测',
|
|
436
441
|
passed,
|
|
437
|
-
severity: passed ? Severity.INFO : Severity.
|
|
438
|
-
message: passed ? null : 'project/
|
|
439
|
-
fixType: passed ? null : FixType.
|
|
440
|
-
|
|
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
package/yida-skills/SKILL.md
CHANGED