feat: 将发布预检移入内置浏览器

This commit is contained in:
2026-08-12 16:33:50 +08:00
parent be9bc84474
commit 926056a59b
16 changed files with 840 additions and 9 deletions

View File

@@ -753,3 +753,26 @@ if (gotTheLock) {
// Export for testing
export { mainWindow, opencodeManager, opencodeProjectStore };
export async function runLocalPreviewPreflightE2E(url: string): Promise<{ ok: true }> {
if (!isE2EMode || !agentBrowser) throw new Error('E2E local preview preflight is unavailable');
const projectPath = join(app.getPath('temp'), 'makelore-local-preview-preflight-e2e');
await agentBrowser.open({
projectId: 'local-preview-preflight-e2e',
projectPath,
url,
visible: false,
});
try {
return await agentBrowser.preflightCurrentProject(projectPath);
} finally {
await agentBrowser.close(projectPath).catch(() => undefined);
await agentBrowser.resetProfile(projectPath).catch(() => undefined);
}
}
if (isE2EMode) {
(globalThis as typeof globalThis & {
__niancodeRunLocalPreviewPreflightE2E?: typeof runLocalPreviewPreflightE2E;
}).__niancodeRunLocalPreviewPreflightE2E = runLocalPreviewPreflightE2E;
}