weapp-ide-cli 5.3.3 → 5.4.0
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/dist/{automator-session-BZzODsJi.js → automator-session-RrZjw3X5.js} +32 -16
- package/dist/{cli-CTVH50qe.js → cli-_qia2--1.js} +41 -7
- package/dist/cli.js +2 -2
- package/dist/commands-D_j5_0eE.js +2 -0
- package/dist/{commands-BynZfUJ6.js → commands-fWDebiQq.js} +4 -2
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4 -4
- package/dist/{run-mcp-TnooVQe8.js → run-mcp-By4qRg8l.js} +6 -2
- package/dist/run-mcp-CTk4KA3y.js +2 -0
- package/package.json +3 -3
- package/dist/commands-DG-3Zgd0.js +0 -2
- package/dist/run-mcp-DhujWgfX.js +0 -2
|
@@ -532,34 +532,44 @@ function extractErrorText(error) {
|
|
|
532
532
|
candidate.stdout
|
|
533
533
|
].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n");
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function normalizeAutomatorSessionId(sessionId, port) {
|
|
536
|
+
if (sessionId?.trim()) return sessionId.trim();
|
|
537
|
+
return port ? `port-${port}` : "default";
|
|
538
|
+
}
|
|
539
|
+
function resolveAutomatorSessionFilePath(projectPath, sessionId, port) {
|
|
536
540
|
const normalizedProjectPath = path.resolve(projectPath);
|
|
537
|
-
const
|
|
541
|
+
const normalizedSessionId = normalizeAutomatorSessionId(sessionId, port);
|
|
542
|
+
const sessionKey = normalizedSessionId === "default" ? normalizedProjectPath : `${normalizedProjectPath}#${normalizedSessionId}`;
|
|
543
|
+
const encodedProjectPath = Buffer.from(sessionKey).toString("base64url");
|
|
538
544
|
return path.join(AUTOMATOR_SESSION_DIR, `${encodedProjectPath}.json`);
|
|
539
545
|
}
|
|
540
|
-
async function persistAutomatorSession(
|
|
541
|
-
const filePath = resolveAutomatorSessionFilePath(projectPath);
|
|
546
|
+
async function persistAutomatorSession(options) {
|
|
547
|
+
const filePath = resolveAutomatorSessionFilePath(options.projectPath, options.sessionId, options.port);
|
|
542
548
|
const payload = {
|
|
543
|
-
|
|
549
|
+
...options.port ? { port: options.port } : {},
|
|
550
|
+
projectPath: path.resolve(options.projectPath),
|
|
551
|
+
...options.sessionId ? { sessionId: options.sessionId } : {},
|
|
544
552
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
545
|
-
wsEndpoint
|
|
553
|
+
wsEndpoint: options.wsEndpoint
|
|
546
554
|
};
|
|
547
555
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
548
556
|
await fs.writeFile(filePath, JSON.stringify(payload, null, 2), "utf8");
|
|
549
557
|
}
|
|
550
|
-
async function readPersistedAutomatorSession(projectPath) {
|
|
551
|
-
const filePath = resolveAutomatorSessionFilePath(projectPath);
|
|
558
|
+
async function readPersistedAutomatorSession(projectPath, sessionId, port) {
|
|
559
|
+
const filePath = resolveAutomatorSessionFilePath(projectPath, sessionId, port);
|
|
552
560
|
try {
|
|
553
561
|
const raw = await fs.readFile(filePath, "utf8");
|
|
554
562
|
const payload = JSON.parse(raw);
|
|
555
563
|
if (payload.projectPath !== path.resolve(projectPath) || typeof payload.wsEndpoint !== "string" || !payload.wsEndpoint.trim()) return null;
|
|
564
|
+
if (sessionId && payload.sessionId !== sessionId) return null;
|
|
565
|
+
if (port && payload.port !== port) return null;
|
|
556
566
|
return payload;
|
|
557
567
|
} catch {
|
|
558
568
|
return null;
|
|
559
569
|
}
|
|
560
570
|
}
|
|
561
|
-
async function removePersistedAutomatorSession(projectPath) {
|
|
562
|
-
const filePath = resolveAutomatorSessionFilePath(projectPath);
|
|
571
|
+
async function removePersistedAutomatorSession(projectPath, sessionId, port) {
|
|
572
|
+
const filePath = resolveAutomatorSessionFilePath(projectPath, sessionId, port);
|
|
563
573
|
try {
|
|
564
574
|
await fs.rm(filePath, { force: true });
|
|
565
575
|
} catch {}
|
|
@@ -642,7 +652,7 @@ function formatAutomatorLoginError(error) {
|
|
|
642
652
|
* @description 基于当前配置解析 CLI 路径,并通过现代化 automator 入口启动会话。
|
|
643
653
|
*/
|
|
644
654
|
async function launchAutomator(options) {
|
|
645
|
-
const { cliPath, projectPath, timeout = 3e4 } = options;
|
|
655
|
+
const { cliPath, port, projectPath, sessionId, timeout = 3e4 } = options;
|
|
646
656
|
const resolvedCliPath = cliPath ?? (await resolveCliPath()).cliPath ?? void 0;
|
|
647
657
|
const config = await readCustomConfig();
|
|
648
658
|
const resolvedTrustProject = options.trustProject ?? config.autoTrustProject ?? false;
|
|
@@ -657,12 +667,18 @@ async function launchAutomator(options) {
|
|
|
657
667
|
for (let attempt = 0; attempt < 2; attempt += 1) try {
|
|
658
668
|
const miniProgram = await launcher.launch({
|
|
659
669
|
cliPath: resolvedCliPath,
|
|
670
|
+
...port ? { port } : {},
|
|
660
671
|
projectPath,
|
|
661
672
|
timeout,
|
|
662
673
|
trustProject: resolvedTrustProject
|
|
663
674
|
});
|
|
664
675
|
const sessionMetadata = Reflect.get(miniProgram, "__WEAPP_VITE_SESSION_METADATA");
|
|
665
|
-
if (typeof sessionMetadata?.wsEndpoint === "string" && sessionMetadata.wsEndpoint) await persistAutomatorSession(
|
|
676
|
+
if (typeof sessionMetadata?.wsEndpoint === "string" && sessionMetadata.wsEndpoint) await persistAutomatorSession({
|
|
677
|
+
port: sessionMetadata.port ?? port,
|
|
678
|
+
projectPath,
|
|
679
|
+
sessionId,
|
|
680
|
+
wsEndpoint: sessionMetadata.wsEndpoint
|
|
681
|
+
});
|
|
666
682
|
return miniProgram;
|
|
667
683
|
} catch (error) {
|
|
668
684
|
lastError = error;
|
|
@@ -674,14 +690,14 @@ async function launchAutomator(options) {
|
|
|
674
690
|
* @description 连接当前项目已打开的开发者工具自动化会话,不触发新的 IDE 拉起。
|
|
675
691
|
*/
|
|
676
692
|
async function connectOpenedAutomator(options) {
|
|
677
|
-
const { projectPath } = options;
|
|
693
|
+
const { port, projectPath, sessionId } = options;
|
|
678
694
|
const launcher = new Launcher();
|
|
679
|
-
const persistedSession = await readPersistedAutomatorSession(projectPath);
|
|
680
|
-
const wsEndpoint = persistedSession?.wsEndpoint ?? DEFAULT_WECHAT_DEVTOOLS_WS_ENDPOINT;
|
|
695
|
+
const persistedSession = await readPersistedAutomatorSession(projectPath, sessionId, port);
|
|
696
|
+
const wsEndpoint = persistedSession?.wsEndpoint ?? (port ? `ws://127.0.0.1:${port}` : DEFAULT_WECHAT_DEVTOOLS_WS_ENDPOINT);
|
|
681
697
|
try {
|
|
682
698
|
return await launcher.connect({ wsEndpoint });
|
|
683
699
|
} catch (error) {
|
|
684
|
-
if (persistedSession) await removePersistedAutomatorSession(projectPath);
|
|
700
|
+
if (persistedSession) await removePersistedAutomatorSession(projectPath, sessionId, port);
|
|
685
701
|
throw error;
|
|
686
702
|
}
|
|
687
703
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as colors, B as defaultCustomConfigFilePath, F as createLocaleConfig, I as overwriteCustomConfig, L as readCustomConfig, M as createAutoBootstrapDevtoolsConfig, N as createAutoTrustProjectConfig, O as isOperatingSystemSupported, P as createCustomConfig, R as removeCustomConfigKey, S as resolveCliPath, T as resolveDevtoolsAutomationDefaults, V as resolvePath, b as bootstrapWechatDevtoolsSettings, c as i18nText, j as logger_default, k as operatingSystemName, l as validateLocaleOption, o as withMiniProgram, r as connectMiniProgram, s as configureLocaleFromArgv, w as getConfiguredLocale, x as detectWechatDevtoolsServicePort } from "./automator-session-
|
|
2
|
-
import { a as navigateBack, c as pageStack, d as remote, f as scrollTo, g as tap, i as input, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, o as navigateTo, p as switchTab, r as currentPage, s as pageData, t as audit, u as redirectTo } from "./commands-
|
|
3
|
-
import "./run-mcp-
|
|
1
|
+
import { A as colors, B as defaultCustomConfigFilePath, F as createLocaleConfig, I as overwriteCustomConfig, L as readCustomConfig, M as createAutoBootstrapDevtoolsConfig, N as createAutoTrustProjectConfig, O as isOperatingSystemSupported, P as createCustomConfig, R as removeCustomConfigKey, S as resolveCliPath, T as resolveDevtoolsAutomationDefaults, V as resolvePath, b as bootstrapWechatDevtoolsSettings, c as i18nText, j as logger_default, k as operatingSystemName, l as validateLocaleOption, o as withMiniProgram, r as connectMiniProgram, s as configureLocaleFromArgv, w as getConfiguredLocale, x as detectWechatDevtoolsServicePort } from "./automator-session-RrZjw3X5.js";
|
|
2
|
+
import { a as navigateBack, c as pageStack, d as remote, f as scrollTo, g as tap, i as input, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, o as navigateTo, p as switchTab, r as currentPage, s as pageData, t as audit, u as redirectTo } from "./commands-fWDebiQq.js";
|
|
3
|
+
import "./run-mcp-By4qRg8l.js";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fs as fs$1 } from "@weapp-core/shared/fs";
|
|
@@ -19,7 +19,7 @@ function parsePositiveInt(raw) {
|
|
|
19
19
|
return value;
|
|
20
20
|
}
|
|
21
21
|
function takesValue(optionName) {
|
|
22
|
-
return optionName === "-p" || optionName === "--project" || optionName === "-t" || optionName === "--timeout" || optionName === "-o" || optionName === "--output" || optionName === "--page" || optionName === "--login-retry" || optionName === "--login-retry-timeout" || optionName === "--lang" || optionName === "--platform" || optionName === "--runtime-url" || optionName === "--qr-output" || optionName === "-r" || optionName === "--result-output" || optionName === "--info-output" || optionName === "-i";
|
|
22
|
+
return optionName === "-p" || optionName === "--project" || optionName === "-t" || optionName === "--timeout" || optionName === "--port" || optionName === "--session-id" || optionName === "-o" || optionName === "--output" || optionName === "--page" || optionName === "--login-retry" || optionName === "--login-retry-timeout" || optionName === "--lang" || optionName === "--platform" || optionName === "--runtime-url" || optionName === "--qr-output" || optionName === "-r" || optionName === "--result-output" || optionName === "--info-output" || optionName === "-i";
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* @description 解析 automator 命令通用参数与位置参数。
|
|
@@ -28,6 +28,8 @@ function parseAutomatorArgs(argv) {
|
|
|
28
28
|
const positionals = [];
|
|
29
29
|
let projectPath = process.cwd();
|
|
30
30
|
let timeout;
|
|
31
|
+
let port;
|
|
32
|
+
let sessionId;
|
|
31
33
|
let json = false;
|
|
32
34
|
for (let index = 0; index < argv.length; index += 1) {
|
|
33
35
|
const token = argv[index];
|
|
@@ -56,6 +58,30 @@ function parseAutomatorArgs(argv) {
|
|
|
56
58
|
timeout = parsePositiveInt(token.slice(10));
|
|
57
59
|
continue;
|
|
58
60
|
}
|
|
61
|
+
if (token === "--port") {
|
|
62
|
+
const value = argv[index + 1];
|
|
63
|
+
if (typeof value === "string") {
|
|
64
|
+
port = parsePositiveInt(value);
|
|
65
|
+
index += 1;
|
|
66
|
+
}
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (token.startsWith("--port=")) {
|
|
70
|
+
port = parsePositiveInt(token.slice(7));
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (token === "--session-id") {
|
|
74
|
+
const value = argv[index + 1];
|
|
75
|
+
if (typeof value === "string" && !value.startsWith("-")) {
|
|
76
|
+
sessionId = value.trim() || void 0;
|
|
77
|
+
index += 1;
|
|
78
|
+
}
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (token.startsWith("--session-id=")) {
|
|
82
|
+
sessionId = token.slice(13).trim() || void 0;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
59
85
|
if (token === "--json") {
|
|
60
86
|
json = true;
|
|
61
87
|
continue;
|
|
@@ -71,7 +97,9 @@ function parseAutomatorArgs(argv) {
|
|
|
71
97
|
}
|
|
72
98
|
return {
|
|
73
99
|
projectPath,
|
|
74
|
-
timeout,
|
|
100
|
+
...timeout ? { timeout } : {},
|
|
101
|
+
...port ? { port } : {},
|
|
102
|
+
...sessionId ? { sessionId } : {},
|
|
75
103
|
json,
|
|
76
104
|
positionals
|
|
77
105
|
};
|
|
@@ -272,6 +300,8 @@ function parseCompareArgs(argv) {
|
|
|
272
300
|
return {
|
|
273
301
|
projectPath: parsed.projectPath,
|
|
274
302
|
timeout: parsed.timeout,
|
|
303
|
+
...parsed.port ? { port: parsed.port } : {},
|
|
304
|
+
...parsed.sessionId ? { sessionId: parsed.sessionId } : {},
|
|
275
305
|
page: readOptionValue(argv, "--page"),
|
|
276
306
|
fullPage: argv.includes("--full-page"),
|
|
277
307
|
baselinePath,
|
|
@@ -420,6 +450,8 @@ function parseScreenshotArgs(argv) {
|
|
|
420
450
|
return {
|
|
421
451
|
projectPath: parsed.projectPath,
|
|
422
452
|
...parsed.timeout ? { timeout: parsed.timeout } : {},
|
|
453
|
+
...parsed.port ? { port: parsed.port } : {},
|
|
454
|
+
...parsed.sessionId ? { sessionId: parsed.sessionId } : {},
|
|
423
455
|
...outputPath ? { outputPath } : {},
|
|
424
456
|
...page ? { page } : {},
|
|
425
457
|
...fullPage ? { fullPage: true } : {}
|
|
@@ -435,7 +467,7 @@ async function runScreenshot(argv) {
|
|
|
435
467
|
}
|
|
436
468
|
const options = parseScreenshotArgs(argv);
|
|
437
469
|
const isJsonOutput = argv.includes("--json");
|
|
438
|
-
const { takeScreenshot } = await import("./commands-
|
|
470
|
+
const { takeScreenshot } = await import("./commands-D_j5_0eE.js");
|
|
439
471
|
const result = await takeScreenshot(options);
|
|
440
472
|
if (isJsonOutput) {
|
|
441
473
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2250,8 +2282,10 @@ async function resetWechatIdeFileUtils(options) {
|
|
|
2250
2282
|
}
|
|
2251
2283
|
function createAutomatorSessionOptions(options) {
|
|
2252
2284
|
return {
|
|
2285
|
+
...options.port ? { port: options.port } : {},
|
|
2253
2286
|
preferOpenedSession: options.preferOpenedSession ?? true,
|
|
2254
2287
|
projectPath: path.resolve(options.projectPath),
|
|
2288
|
+
...options.sessionId ? { sessionId: options.sessionId } : {},
|
|
2255
2289
|
sharedSession: options.sharedSession ?? true,
|
|
2256
2290
|
timeout: options.timeout
|
|
2257
2291
|
};
|
|
@@ -2639,7 +2673,7 @@ async function parse(argv) {
|
|
|
2639
2673
|
return;
|
|
2640
2674
|
}
|
|
2641
2675
|
if (matchedCommand === "mcp") {
|
|
2642
|
-
const { runMcpCommand } = await import("./run-mcp-
|
|
2676
|
+
const { runMcpCommand } = await import("./run-mcp-CTk4KA3y.js");
|
|
2643
2677
|
await runMcpCommand(argv.slice(1));
|
|
2644
2678
|
return;
|
|
2645
2679
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { j as logger_default } from "./automator-session-
|
|
2
|
-
import { n as parse } from "./cli-
|
|
1
|
+
import { j as logger_default } from "./automator-session-RrZjw3X5.js";
|
|
2
|
+
import { n as parse } from "./cli-_qia2--1.js";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
//#region src/cli.ts
|
|
5
5
|
const argv = process.argv.slice(2);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as colors, c as i18nText, j as logger_default, n as closeSharedMiniProgram, o as withMiniProgram } from "./automator-session-
|
|
1
|
+
import { A as colors, c as i18nText, j as logger_default, n as closeSharedMiniProgram, o as withMiniProgram } from "./automator-session-RrZjw3X5.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import { PNG } from "pngjs";
|
|
@@ -302,7 +302,9 @@ async function takeScreenshot(options) {
|
|
|
302
302
|
} catch (error) {
|
|
303
303
|
const isProtocolTimeout = error instanceof Error && error.message === "DEVTOOLS_PROTOCOL_TIMEOUT";
|
|
304
304
|
if (!Boolean(options.sharedSession && !options.miniProgram && isProtocolTimeout)) throw error;
|
|
305
|
-
|
|
305
|
+
const sessionIdOrPort = options.sessionId || options.port;
|
|
306
|
+
if (sessionIdOrPort) await closeSharedMiniProgram(options.projectPath, sessionIdOrPort);
|
|
307
|
+
else await closeSharedMiniProgram(options.projectPath);
|
|
306
308
|
logger_default.warn(i18nText("当前共享 DevTools 会话截图超时,正在改用全新自动化会话重试一次...", "The current shared DevTools session timed out while capturing screenshot. Retrying once with a fresh automation session..."));
|
|
307
309
|
screenshotBuffer = await captureScreenshotBuffer({
|
|
308
310
|
...options,
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ interface AutomatorOptions {
|
|
|
7
7
|
projectPath: string;
|
|
8
8
|
timeout?: number;
|
|
9
9
|
cliPath?: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
sessionId?: string;
|
|
10
12
|
trustProject?: boolean;
|
|
11
13
|
preferOpenedSession?: boolean;
|
|
12
14
|
}
|
|
@@ -55,6 +57,8 @@ declare function connectOpenedAutomator(options: AutomatorOptions): Promise<unkn
|
|
|
55
57
|
interface ParsedAutomatorArgs {
|
|
56
58
|
projectPath: string;
|
|
57
59
|
timeout?: number;
|
|
60
|
+
port?: number;
|
|
61
|
+
sessionId?: string;
|
|
58
62
|
json: boolean;
|
|
59
63
|
positionals: string[];
|
|
60
64
|
}
|
|
@@ -567,8 +571,10 @@ interface ResetWechatIdeFileUtilsOptions {
|
|
|
567
571
|
projectPath: string;
|
|
568
572
|
}
|
|
569
573
|
interface WechatIdeAutomatorSessionOptions {
|
|
574
|
+
port?: number;
|
|
570
575
|
preferOpenedSession?: boolean;
|
|
571
576
|
projectPath: string;
|
|
577
|
+
sessionId?: string;
|
|
572
578
|
sharedSession?: boolean;
|
|
573
579
|
timeout?: number;
|
|
574
580
|
}
|
|
@@ -854,8 +860,10 @@ interface ToolRegistrar {
|
|
|
854
860
|
interface WeappIdeMcpRuntimeHooks {
|
|
855
861
|
withMiniProgram: <T>(options: {
|
|
856
862
|
preferOpenedSession?: boolean;
|
|
863
|
+
port?: number;
|
|
857
864
|
projectPath: string;
|
|
858
865
|
sharedSession?: boolean;
|
|
866
|
+
sessionId?: string;
|
|
859
867
|
timeout?: number;
|
|
860
868
|
}, runner: (miniProgram: MiniProgramLike) => Promise<T>) => Promise<T>;
|
|
861
869
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as defaultCustomConfigFilePath, C as getConfig, D as getDefaultCliPath, E as SupportedPlatformsMap, F as createLocaleConfig, I as overwriteCustomConfig, L as readCustomConfig, M as createAutoBootstrapDevtoolsConfig, N as createAutoTrustProjectConfig, O as isOperatingSystemSupported, P as createCustomConfig, R as removeCustomConfigKey, S as resolveCliPath, T as resolveDevtoolsAutomationDefaults, V as resolvePath, _ as isDevtoolsHttpPortError, a as releaseSharedMiniProgram, b as bootstrapWechatDevtoolsSettings, d as formatAutomatorLoginError, f as getAutomatorProtocolTimeoutMethod, g as isDevtoolsExtensionContextInvalidatedError, h as isAutomatorWsConnectError, i as getSharedMiniProgramSessionCount, k as operatingSystemName, m as isAutomatorProtocolTimeoutError, n as closeSharedMiniProgram, o as withMiniProgram, p as isAutomatorLoginError, r as connectMiniProgram, t as acquireSharedMiniProgram, u as connectOpenedAutomator, v as isRetryableAutomatorLaunchError, w as getConfiguredLocale, x as detectWechatDevtoolsServicePort, y as launchAutomator, z as defaultCustomConfigDirPath } from "./automator-session-
|
|
2
|
-
import { $ as requestWechatDevtoolsHttp, A as RETRY_CANCEL_KEYS, B as waitForRetryKeypress, C as refreshWechatIdeTicket, Ct as readOptionValue, D as validateWechatCliCommandArgs, E as uploadWechatIde, F as formatRetryHotkeyPrompt, G as transformArgv, H as execute, I as formatWechatIdeLoginRequiredError, J as runWechatIdeEngineBuild, K as startForwardConsole, L as isWechatIdeLoginRequiredError, M as RETRY_PROMPT_INITIAL_IGNORE_MS, N as createWechatIdeLoginRequiredExitError, O as runWechatCliWithRetry, P as extractExecutionErrorText, Q as pollWechatIdeEngineBuildResultByHttp, R as promptRetryKeypress, S as quitWechatIde, St as readBooleanOption, T as setWechatIdeTicket, U as createAlias, V as runMinidev, W as createPathCompat, X as WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, Y as runWechatIdeEngineBuildByHttp, Z as openWechatIdeProjectByHttp, _ as isWechatIdeLoggedIn, _t as parseScreenshotArgs, a as autoReplayWechatIde, at as runWithSuspendedSharedInput, b as openWechatIdeOtherProject, bt as printCompareHelp, c as buildWechatIdeIpa, ct as MCP_COMMAND_NAME, d as clearWechatIdeCacheByAutomator, dt as WECHAT_CLI_COMMAND_NAMES, et as resetWechatIdeFileUtilsByHttp, f as closeWechatIdeProject, ft as isWeappIdeTopLevelCommand, g as getWechatIdeToolInfo, gt as runAutomatorCommand, h as getWechatIdeTicket, ht as isAutomatorCommand, i as autoPreviewWechatIde, it as createSharedInputSession, j as RETRY_CONFIRM_KEYS, k as runRetryableCommand, l as buildWechatIdeNpm, lt as MINIDEV_NAMESPACE_COMMAND_NAMES, m as getWechatIdeTestAccounts, mt as getAutomatorCommandHelp, n as parse, nt as handleConfigCommand, o as autoWechatIde, ot as waitForExclusiveKeypress, p as compileWechatIdeByAutomator, pt as AUTOMATOR_COMMAND_NAMES, q as isWechatIdeEngineBuildEndpointMissingError, r as dispatchWechatCliCommand, rt as promptForCliPath, s as buildWechatIdeApk, st as CONFIG_COMMAND_NAME, t as createCli, tt as startWechatIdeEngineBuildByHttp, u as clearWechatIdeCache, ut as WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, v as loginWechatIde, vt as printScreenshotHelp, w as resetWechatIdeFileUtils, wt as removeOption, x as previewWechatIde, xt as parseAutomatorArgs, y as openWechatIde, yt as parseCompareArgs, z as promptWechatIdeLoginRetry } from "./cli-
|
|
3
|
-
import { a as navigateBack, c as pageStack, d as remote, f as scrollTo, g as tap, h as takeScreenshot, i as input, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, o as navigateTo, p as switchTab, r as currentPage, s as pageData, t as audit, u as redirectTo } from "./commands-
|
|
4
|
-
import { a as readElementSnapshot, i as registerWeappIdeMcpTools, n as startWeappIdeMcpServer, o as resolveProjectPath, r as createWeappIdeMcpServer, s as toSerializableValue, t as runMcpCommand } from "./run-mcp-
|
|
1
|
+
import { B as defaultCustomConfigFilePath, C as getConfig, D as getDefaultCliPath, E as SupportedPlatformsMap, F as createLocaleConfig, I as overwriteCustomConfig, L as readCustomConfig, M as createAutoBootstrapDevtoolsConfig, N as createAutoTrustProjectConfig, O as isOperatingSystemSupported, P as createCustomConfig, R as removeCustomConfigKey, S as resolveCliPath, T as resolveDevtoolsAutomationDefaults, V as resolvePath, _ as isDevtoolsHttpPortError, a as releaseSharedMiniProgram, b as bootstrapWechatDevtoolsSettings, d as formatAutomatorLoginError, f as getAutomatorProtocolTimeoutMethod, g as isDevtoolsExtensionContextInvalidatedError, h as isAutomatorWsConnectError, i as getSharedMiniProgramSessionCount, k as operatingSystemName, m as isAutomatorProtocolTimeoutError, n as closeSharedMiniProgram, o as withMiniProgram, p as isAutomatorLoginError, r as connectMiniProgram, t as acquireSharedMiniProgram, u as connectOpenedAutomator, v as isRetryableAutomatorLaunchError, w as getConfiguredLocale, x as detectWechatDevtoolsServicePort, y as launchAutomator, z as defaultCustomConfigDirPath } from "./automator-session-RrZjw3X5.js";
|
|
2
|
+
import { $ as requestWechatDevtoolsHttp, A as RETRY_CANCEL_KEYS, B as waitForRetryKeypress, C as refreshWechatIdeTicket, Ct as readOptionValue, D as validateWechatCliCommandArgs, E as uploadWechatIde, F as formatRetryHotkeyPrompt, G as transformArgv, H as execute, I as formatWechatIdeLoginRequiredError, J as runWechatIdeEngineBuild, K as startForwardConsole, L as isWechatIdeLoginRequiredError, M as RETRY_PROMPT_INITIAL_IGNORE_MS, N as createWechatIdeLoginRequiredExitError, O as runWechatCliWithRetry, P as extractExecutionErrorText, Q as pollWechatIdeEngineBuildResultByHttp, R as promptRetryKeypress, S as quitWechatIde, St as readBooleanOption, T as setWechatIdeTicket, U as createAlias, V as runMinidev, W as createPathCompat, X as WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, Y as runWechatIdeEngineBuildByHttp, Z as openWechatIdeProjectByHttp, _ as isWechatIdeLoggedIn, _t as parseScreenshotArgs, a as autoReplayWechatIde, at as runWithSuspendedSharedInput, b as openWechatIdeOtherProject, bt as printCompareHelp, c as buildWechatIdeIpa, ct as MCP_COMMAND_NAME, d as clearWechatIdeCacheByAutomator, dt as WECHAT_CLI_COMMAND_NAMES, et as resetWechatIdeFileUtilsByHttp, f as closeWechatIdeProject, ft as isWeappIdeTopLevelCommand, g as getWechatIdeToolInfo, gt as runAutomatorCommand, h as getWechatIdeTicket, ht as isAutomatorCommand, i as autoPreviewWechatIde, it as createSharedInputSession, j as RETRY_CONFIRM_KEYS, k as runRetryableCommand, l as buildWechatIdeNpm, lt as MINIDEV_NAMESPACE_COMMAND_NAMES, m as getWechatIdeTestAccounts, mt as getAutomatorCommandHelp, n as parse, nt as handleConfigCommand, o as autoWechatIde, ot as waitForExclusiveKeypress, p as compileWechatIdeByAutomator, pt as AUTOMATOR_COMMAND_NAMES, q as isWechatIdeEngineBuildEndpointMissingError, r as dispatchWechatCliCommand, rt as promptForCliPath, s as buildWechatIdeApk, st as CONFIG_COMMAND_NAME, t as createCli, tt as startWechatIdeEngineBuildByHttp, u as clearWechatIdeCache, ut as WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, v as loginWechatIde, vt as printScreenshotHelp, w as resetWechatIdeFileUtils, wt as removeOption, x as previewWechatIde, xt as parseAutomatorArgs, y as openWechatIde, yt as parseCompareArgs, z as promptWechatIdeLoginRetry } from "./cli-_qia2--1.js";
|
|
3
|
+
import { a as navigateBack, c as pageStack, d as remote, f as scrollTo, g as tap, h as takeScreenshot, i as input, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, o as navigateTo, p as switchTab, r as currentPage, s as pageData, t as audit, u as redirectTo } from "./commands-fWDebiQq.js";
|
|
4
|
+
import { a as readElementSnapshot, i as registerWeappIdeMcpTools, n as startWeappIdeMcpServer, o as resolveProjectPath, r as createWeappIdeMcpServer, s as toSerializableValue, t as runMcpCommand } from "./run-mcp-By4qRg8l.js";
|
|
5
5
|
export { AUTOMATOR_COMMAND_NAMES, CONFIG_COMMAND_NAME, MCP_COMMAND_NAME, MINIDEV_NAMESPACE_COMMAND_NAMES, RETRY_CANCEL_KEYS, RETRY_CONFIRM_KEYS, RETRY_PROMPT_INITIAL_IGNORE_MS, SupportedPlatformsMap, WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, WECHAT_CLI_COMMAND_NAMES, WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, acquireSharedMiniProgram, audit, autoPreviewWechatIde, autoReplayWechatIde, autoWechatIde, bootstrapWechatDevtoolsSettings, buildWechatIdeApk, buildWechatIdeIpa, buildWechatIdeNpm, captureScreenshotBuffer, clearWechatIdeCache, clearWechatIdeCacheByAutomator, closeSharedMiniProgram, closeWechatIdeProject, compileWechatIdeByAutomator, connectMiniProgram, connectOpenedAutomator, createAlias, createAutoBootstrapDevtoolsConfig, createAutoTrustProjectConfig, createCli, createCustomConfig, createLocaleConfig, createPathCompat, createSharedInputSession, createWeappIdeMcpServer, createWechatIdeLoginRequiredExitError, currentPage, defaultCustomConfigDirPath, defaultCustomConfigFilePath, detectWechatDevtoolsServicePort, dispatchWechatCliCommand, execute, extractExecutionErrorText, formatAutomatorLoginError, formatRetryHotkeyPrompt, formatWechatIdeLoginRequiredError, getAutomatorCommandHelp, getAutomatorProtocolTimeoutMethod, getConfig, getConfiguredLocale, getDefaultCliPath, getSharedMiniProgramSessionCount, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, handleConfigCommand, input, isAutomatorCommand, isAutomatorLoginError, isAutomatorProtocolTimeoutError, isAutomatorWsConnectError, isDevtoolsExtensionContextInvalidatedError, isDevtoolsHttpPortError, isOperatingSystemSupported, isRetryableAutomatorLaunchError, isWeappIdeTopLevelCommand, isWechatIdeEngineBuildEndpointMissingError, isWechatIdeLoggedIn, isWechatIdeLoginRequiredError, launchAutomator, loginWechatIde, navigateBack, navigateTo, openWechatIde, openWechatIdeOtherProject, openWechatIdeProjectByHttp, operatingSystemName, overwriteCustomConfig, pageData, pageStack, parse, parseAutomatorArgs, parseCompareArgs, parseScreenshotArgs, pollWechatIdeEngineBuildResultByHttp, previewWechatIde, printCompareHelp, printScreenshotHelp, promptForCliPath, promptRetryKeypress, promptWechatIdeLoginRetry, quitWechatIde, reLaunch, readBooleanOption, readCustomConfig, readElementSnapshot, readOptionValue, redirectTo, refreshWechatIdeTicket, registerWeappIdeMcpTools, releaseSharedMiniProgram, remote, removeCustomConfigKey, removeOption, requestWechatDevtoolsHttp, resetWechatIdeFileUtils, resetWechatIdeFileUtilsByHttp, resolveCliPath, resolveDevtoolsAutomationDefaults, resolvePath, resolveProjectPath, runAutomatorCommand, runMcpCommand, runMinidev, runRetryableCommand, runWechatCliWithRetry, runWechatIdeEngineBuild, runWechatIdeEngineBuildByHttp, runWithSuspendedSharedInput, scrollTo, setWechatIdeTicket, startForwardConsole, startWeappIdeMcpServer, startWechatIdeEngineBuildByHttp, switchTab, systemInfo, takeScreenshot, tap, toSerializableValue, transformArgv, uploadWechatIde, validateWechatCliCommandArgs, waitForExclusiveKeypress, waitForRetryKeypress, withMiniProgram };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as withMiniProgram$1 } from "./automator-session-
|
|
1
|
+
import { o as withMiniProgram$1 } from "./automator-session-RrZjw3X5.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
@@ -17,7 +17,9 @@ function createResolvedOutputPath(workspaceRoot, outputPath) {
|
|
|
17
17
|
async function withConnectedMiniProgram(runtimeHooks, workspaceRoot, input, runner) {
|
|
18
18
|
return await runtimeHooks.withMiniProgram({
|
|
19
19
|
preferOpenedSession: input.preferOpenedSession,
|
|
20
|
+
port: input.port,
|
|
20
21
|
projectPath: createResolvedProjectPath(workspaceRoot, input.projectPath),
|
|
22
|
+
sessionId: input.sessionId,
|
|
21
23
|
sharedSession: true,
|
|
22
24
|
timeout: input.timeout
|
|
23
25
|
}, runner);
|
|
@@ -31,7 +33,9 @@ function defineConnectionSchema() {
|
|
|
31
33
|
return {
|
|
32
34
|
projectPath: z.string().trim().min(1).describe("小程序项目路径,支持 workspaceRoot 相对路径"),
|
|
33
35
|
timeout: z.number().int().positive().optional(),
|
|
34
|
-
|
|
36
|
+
port: z.number().int().positive().optional(),
|
|
37
|
+
preferOpenedSession: z.boolean().optional(),
|
|
38
|
+
sessionId: z.string().trim().min(1).optional()
|
|
35
39
|
};
|
|
36
40
|
}
|
|
37
41
|
function defineElementSchema() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-ide-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.4.0",
|
|
5
5
|
"description": "让微信开发者工具,用起来更加方便!",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"zod": "^4.4.3",
|
|
72
72
|
"@weapp-core/logger": "3.1.1",
|
|
73
73
|
"@weapp-core/shared": "3.0.4",
|
|
74
|
-
"@weapp-vite/devtools-runtime": "0.
|
|
75
|
-
"@weapp-vite/miniprogram-automator": "1.
|
|
74
|
+
"@weapp-vite/devtools-runtime": "0.4.0",
|
|
75
|
+
"@weapp-vite/miniprogram-automator": "1.2.0"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"dev": "tsdown -w --sourcemap",
|
package/dist/run-mcp-DhujWgfX.js
DELETED