openyida 2026.4.2-beta.3 → 2026.4.2-beta.5
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 +56 -7
- package/package.json +1 -1
- package/yida-skills/SKILL.md +1 -1
package/lib/core/doctor.js
CHANGED
|
@@ -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.AUTO,
|
|
233
|
+
fixAction: '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() {
|
|
@@ -715,6 +742,28 @@ class FixEngine {
|
|
|
715
742
|
};
|
|
716
743
|
}
|
|
717
744
|
|
|
745
|
+
case 'install-chromium': {
|
|
746
|
+
try {
|
|
747
|
+
const { execSync } = require('child_process');
|
|
748
|
+
console.log('\n 🌐 正在安装 Chromium 浏览器(请稍候)...');
|
|
749
|
+
execSync('npx playwright install chromium', {
|
|
750
|
+
stdio: 'inherit',
|
|
751
|
+
timeout: 300_000,
|
|
752
|
+
});
|
|
753
|
+
return {
|
|
754
|
+
id: issue.id,
|
|
755
|
+
fixed: true,
|
|
756
|
+
message: 'Chromium 安装完成',
|
|
757
|
+
};
|
|
758
|
+
} catch (error) {
|
|
759
|
+
return {
|
|
760
|
+
id: issue.id,
|
|
761
|
+
fixed: false,
|
|
762
|
+
message: `Chromium 安装失败,请手动运行:npx playwright install chromium(${error.message})`,
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
718
767
|
case 'init-project': {
|
|
719
768
|
try {
|
|
720
769
|
const copy = require('./copy');
|
package/package.json
CHANGED
package/yida-skills/SKILL.md
CHANGED