weapp-ide-cli 6.1.2 → 6.1.4

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/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Buffer } from "node:buffer";
2
2
  import { AutomatorElement, AutomatorMiniProgram, AutomatorPage, DevtoolsConnectionInput, DevtoolsContext, DevtoolsElementSnapshot, DevtoolsPageSnapshot, DevtoolsRuntimeSessionOptions, DevtoolsToolResult, MiniProgramEventMap, closeSharedMiniProgram, getSharedMiniProgramSessionCount, readDevtoolsElementSnapshot as readElementSnapshot, releaseSharedMiniProgram, resolveDevtoolsProjectPath as resolveProjectPath, toDevtoolsSerializableValue as toSerializableValue } from "@weapp-vite/devtools-runtime";
3
3
  import { McpServer } from "@modelcontextprotocol/server";
4
4
  //#region src/cli/automator.d.ts
5
- interface AutomatorOptions {
5
+ export interface AutomatorOptions {
6
6
  projectPath: string;
7
7
  timeout?: number;
8
8
  cliPath?: string;
@@ -16,54 +16,54 @@ interface AutomatorOptions {
16
16
  /**
17
17
  * @description 为项目路径派生稳定的 DevTools automator 端口,避免多个 dev:open 项目抢占默认端口。
18
18
  */
19
- declare function resolveProjectAutomatorPort(projectPath: string): number;
19
+ export declare function resolveProjectAutomatorPort(projectPath: string): number;
20
20
  /**
21
21
  * @description 判断错误是否属于开发者工具服务端口不可用。
22
22
  */
23
- declare function isDevtoolsHttpPortError(error: unknown): boolean;
23
+ export declare function isDevtoolsHttpPortError(error: unknown): boolean;
24
24
  /**
25
25
  * @description 判断错误是否属于开发者工具 automator 扩展上下文尚未就绪。
26
26
  */
27
- declare function isDevtoolsExtensionContextInvalidatedError(error: unknown): boolean;
27
+ export declare function isDevtoolsExtensionContextInvalidatedError(error: unknown): boolean;
28
28
  /**
29
29
  * @description 判断错误是否属于可重试的 automator 启动抖动。
30
30
  */
31
- declare function isRetryableAutomatorLaunchError(error: unknown): boolean;
31
+ export declare function isRetryableAutomatorLaunchError(error: unknown): boolean;
32
32
  /**
33
33
  * @description 判断错误是否属于开发者工具 websocket 连接失败。
34
34
  */
35
- declare function isAutomatorWsConnectError(error: unknown): boolean;
35
+ export declare function isAutomatorWsConnectError(error: unknown): boolean;
36
36
  /**
37
37
  * @description 判断错误是否属于目标项目 automator 端口仍被旧会话占用。
38
38
  */
39
- declare function isAutomatorPortInUseError(error: unknown): boolean;
39
+ export declare function isAutomatorPortInUseError(error: unknown): boolean;
40
40
  /**
41
41
  * @description 判断错误是否属于开发者工具协议调用超时。
42
42
  */
43
- declare function isAutomatorProtocolTimeoutError(error: unknown): boolean;
43
+ export declare function isAutomatorProtocolTimeoutError(error: unknown): boolean;
44
44
  /**
45
45
  * @description 提取协议超时的方法名。
46
46
  */
47
- declare function getAutomatorProtocolTimeoutMethod(error: unknown): string | undefined;
47
+ export declare function getAutomatorProtocolTimeoutMethod(error: unknown): string | undefined;
48
48
  /**
49
49
  * @description 判断错误是否属于开发者工具登录失效。
50
50
  */
51
- declare function isAutomatorLoginError(error: unknown): boolean;
51
+ export declare function isAutomatorLoginError(error: unknown): boolean;
52
52
  /**
53
53
  * @description 格式化开发者工具登录失效错误,便于终端展示。
54
54
  */
55
- declare function formatAutomatorLoginError(error: unknown): string;
55
+ export declare function formatAutomatorLoginError(error: unknown): string;
56
56
  /**
57
57
  * @description 基于当前配置解析 CLI 路径,并通过现代化 automator 入口启动会话。
58
58
  */
59
- declare function launchAutomator(options: AutomatorOptions): Promise<any>;
59
+ export declare function launchAutomator(options: AutomatorOptions): Promise<any>;
60
60
  /**
61
61
  * @description 连接当前项目已打开的开发者工具自动化会话,不触发新的 IDE 拉起。
62
62
  */
63
- declare function connectOpenedAutomator(options: AutomatorOptions): Promise<unknown>;
63
+ export declare function connectOpenedAutomator(options: AutomatorOptions): Promise<unknown>;
64
64
  //#endregion
65
65
  //#region src/cli/automator-argv.d.ts
66
- interface ParsedAutomatorArgs {
66
+ export interface ParsedAutomatorArgs {
67
67
  projectPath: string;
68
68
  timeout?: number;
69
69
  port?: number;
@@ -75,84 +75,82 @@ interface ParsedAutomatorArgs {
75
75
  /**
76
76
  * @description 解析 automator 命令通用参数与位置参数。
77
77
  */
78
- declare function parseAutomatorArgs(argv: readonly string[]): ParsedAutomatorArgs;
78
+ export declare function parseAutomatorArgs(argv: readonly string[]): ParsedAutomatorArgs;
79
79
  /**
80
80
  * @description 读取选项值,支持多个别名,以及 --option value 与 --option=value。
81
81
  */
82
- declare function readOptionValue(argv: readonly string[], ...optionNames: string[]): string | undefined;
82
+ export declare function readOptionValue(argv: readonly string[], ...optionNames: string[]): string | undefined;
83
83
  /**
84
84
  * @description 读取布尔选项,支持裸 flag、--flag=true/false 与 --flag true/false。
85
85
  */
86
- declare function readBooleanOption(argv: readonly string[], ...optionNames: string[]): boolean | undefined;
86
+ export declare function readBooleanOption(argv: readonly string[], ...optionNames: string[]): boolean | undefined;
87
87
  /**
88
88
  * @description 删除参数中的指定选项(同时支持 --opt value 与 --opt=value)。
89
89
  */
90
- declare function removeOption(argv: readonly string[], optionName: string): string[];
90
+ export declare function removeOption(argv: readonly string[], optionName: string): string[];
91
91
  //#endregion
92
92
  //#region src/cli/automator-session.d.ts
93
93
  type MiniProgramLike = AutomatorMiniProgram;
94
94
  type MiniProgramPage = AutomatorPage;
95
95
  type MiniProgramElement = AutomatorElement;
96
96
  interface AutomatorSessionOptions extends DevtoolsRuntimeSessionOptions {}
97
- /**
98
- * @description 建立 automator 会话,并统一处理常见连接错误提示。
99
- */
100
- declare function connectMiniProgram(options: AutomatorSessionOptions): Promise<MiniProgramLike>;
97
+ /** 建立交互式会话,并报告最终连接错误。 */
98
+ export declare function connectMiniProgram(options: AutomatorSessionOptions): Promise<MiniProgramLike>;
101
99
  /**
102
100
  * @description 获取指定项目的共享 automator 会话;若不存在则自动创建。
103
101
  */
104
- declare function acquireSharedMiniProgram(options: AutomatorSessionOptions): Promise<MiniProgramLike>;
102
+ export declare function acquireSharedMiniProgram(options: AutomatorSessionOptions): Promise<MiniProgramLike>;
105
103
  /**
106
104
  * @description 统一管理 automator 会话生命周期。
107
105
  */
108
- declare function withMiniProgram<T>(options: AutomatorSessionOptions, runner: (miniProgram: MiniProgramLike) => Promise<T>): Promise<T>;
106
+ export declare function withMiniProgram<T>(options: AutomatorSessionOptions, runner: (miniProgram: MiniProgramLike) => Promise<T>): Promise<T>;
109
107
  //#endregion
110
108
  //#region src/cli/command-catalog.d.ts
111
- declare const WECHAT_CLI_COMMAND_NAMES: readonly ["open", "login", "islogin", "preview", "auto-preview", "upload", "build-npm", "auto", "auto-replay", "reset-fileutils", "close", "quit", "cache", "engine", "open-other", "build-ipa", "build-apk", "cloud"];
112
- declare const MINIDEV_NAMESPACE_COMMAND_NAMES: readonly ["alipay", "ali", "minidev"];
113
- declare const CONFIG_COMMAND_NAME: "config";
114
- declare const MCP_COMMAND_NAME: "mcp";
115
- declare const WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES: string[];
109
+ export declare const WECHAT_CLI_COMMAND_NAMES: readonly ["open", "login", "islogin", "preview", "auto-preview", "upload", "build-npm", "auto", "auto-replay", "reset-fileutils", "close", "quit", "cache", "engine", "open-other", "build-ipa", "build-apk", "cloud"];
110
+ export declare const MINIDEV_NAMESPACE_COMMAND_NAMES: readonly ["alipay", "ali", "minidev"];
111
+ export declare const CONFIG_COMMAND_NAME: "config";
112
+ export declare const MCP_COMMAND_NAME: "mcp";
113
+ export declare const WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES: string[];
116
114
  /**
117
115
  * @description 判断是否为 weapp-ide-cli 支持的顶层命令。
118
116
  */
119
- declare function isWeappIdeTopLevelCommand(command: string | undefined): boolean;
117
+ export declare function isWeappIdeTopLevelCommand(command: string | undefined): boolean;
120
118
  //#endregion
121
119
  //#region src/cli/commands.d.ts
122
- interface AutomatorCommandOptions extends AutomatorSessionOptions {}
123
- interface NavigateOptions extends AutomatorCommandOptions {
120
+ export interface AutomatorCommandOptions extends AutomatorSessionOptions {}
121
+ export interface NavigateOptions extends AutomatorCommandOptions {
124
122
  url: string;
125
123
  }
126
- interface PageInfoOptions extends AutomatorCommandOptions {
124
+ export interface PageInfoOptions extends AutomatorCommandOptions {
127
125
  json?: boolean;
128
126
  }
129
- interface PageDataOptions extends PageInfoOptions {
127
+ export interface PageDataOptions extends PageInfoOptions {
130
128
  path?: string;
131
129
  }
132
- interface SelectorOptions extends AutomatorCommandOptions {
130
+ export interface SelectorOptions extends AutomatorCommandOptions {
133
131
  selector: string;
134
132
  }
135
- interface TapOptions extends SelectorOptions {}
136
- interface InputOptions extends SelectorOptions {
133
+ export interface TapOptions extends SelectorOptions {}
134
+ export interface InputOptions extends SelectorOptions {
137
135
  value: string;
138
136
  }
139
- interface ScrollOptions extends AutomatorCommandOptions {
137
+ export interface ScrollOptions extends AutomatorCommandOptions {
140
138
  scrollTop: number;
141
139
  }
142
- interface AuditOptions extends AutomatorCommandOptions {
140
+ export interface AuditOptions extends AutomatorCommandOptions {
143
141
  outputPath?: string;
144
142
  }
145
- interface ScreenshotOptions extends AutomatorCommandOptions {
143
+ export interface ScreenshotOptions extends AutomatorCommandOptions {
146
144
  outputPath?: string;
147
145
  page?: string;
148
146
  fullPage?: boolean;
149
147
  retryWithFreshSession?: boolean;
150
148
  }
151
- interface ScreenshotResult {
149
+ export interface ScreenshotResult {
152
150
  base64?: string;
153
151
  path?: string;
154
152
  }
155
- interface RemoteOptions extends AutomatorCommandOptions {
153
+ export interface RemoteOptions extends AutomatorCommandOptions {
156
154
  enable?: boolean;
157
155
  }
158
156
  interface PageSnapshot {
@@ -162,67 +160,67 @@ interface PageSnapshot {
162
160
  /**
163
161
  * @description 执行保留栈页面跳转。
164
162
  */
165
- declare function navigateTo(options: NavigateOptions): Promise<void>;
163
+ export declare function navigateTo(options: NavigateOptions): Promise<void>;
166
164
  /**
167
165
  * @description 执行关闭当前页的重定向。
168
166
  */
169
- declare function redirectTo(options: NavigateOptions): Promise<void>;
167
+ export declare function redirectTo(options: NavigateOptions): Promise<void>;
170
168
  /**
171
169
  * @description 返回上一页。
172
170
  */
173
- declare function navigateBack(options: AutomatorCommandOptions): Promise<void>;
171
+ export declare function navigateBack(options: AutomatorCommandOptions): Promise<void>;
174
172
  /**
175
173
  * @description 重启到指定页面。
176
174
  */
177
- declare function reLaunch(options: NavigateOptions): Promise<void>;
175
+ export declare function reLaunch(options: NavigateOptions): Promise<void>;
178
176
  /**
179
177
  * @description 切换到 tabBar 页面。
180
178
  */
181
- declare function switchTab(options: NavigateOptions): Promise<void>;
179
+ export declare function switchTab(options: NavigateOptions): Promise<void>;
182
180
  /**
183
181
  * @description 获取页面栈。
184
182
  */
185
- declare function pageStack(options: PageInfoOptions): Promise<any>;
183
+ export declare function pageStack(options: PageInfoOptions): Promise<any>;
186
184
  /**
187
185
  * @description 获取当前页面信息。
188
186
  */
189
- declare function currentPage(options: PageInfoOptions): Promise<PageSnapshot>;
187
+ export declare function currentPage(options: PageInfoOptions): Promise<PageSnapshot>;
190
188
  /**
191
189
  * @description 获取系统信息。
192
190
  */
193
- declare function systemInfo(options: PageInfoOptions): Promise<any>;
191
+ export declare function systemInfo(options: PageInfoOptions): Promise<any>;
194
192
  /**
195
193
  * @description 获取当前页面数据。
196
194
  */
197
- declare function pageData(options: PageDataOptions): Promise<any>;
195
+ export declare function pageData(options: PageDataOptions): Promise<any>;
198
196
  /**
199
197
  * @description 点击页面元素。
200
198
  */
201
- declare function tap(options: TapOptions): Promise<void>;
199
+ export declare function tap(options: TapOptions): Promise<void>;
202
200
  /**
203
201
  * @description 向页面元素输入文本。
204
202
  */
205
- declare function input(options: InputOptions): Promise<void>;
203
+ export declare function input(options: InputOptions): Promise<void>;
206
204
  /**
207
205
  * @description 滚动页面到指定位置。
208
206
  */
209
- declare function scrollTo(options: ScrollOptions): Promise<void>;
207
+ export declare function scrollTo(options: ScrollOptions): Promise<void>;
210
208
  /**
211
209
  * @description 执行体验评分审计。
212
210
  */
213
- declare function audit(options: AuditOptions): Promise<any>;
211
+ export declare function audit(options: AuditOptions): Promise<any>;
214
212
  /**
215
213
  * @description 捕获当前页面截图并返回二进制内容。
216
214
  */
217
- declare function captureScreenshotBuffer(options: ScreenshotOptions): Promise<Buffer>;
215
+ export declare function captureScreenshotBuffer(options: ScreenshotOptions): Promise<Buffer>;
218
216
  /**
219
217
  * @description 获取当前小程序截图。
220
218
  */
221
- declare function takeScreenshot(options: ScreenshotOptions): Promise<ScreenshotResult>;
219
+ export declare function takeScreenshot(options: ScreenshotOptions): Promise<ScreenshotResult>;
222
220
  /**
223
221
  * @description 开关远程调试。
224
222
  */
225
- declare function remote(options: RemoteOptions): Promise<void>;
223
+ export declare function remote(options: RemoteOptions): Promise<void>;
226
224
  //#endregion
227
225
  //#region src/cli/compare.d.ts
228
226
  interface CompareOptions extends ScreenshotOptions {
@@ -236,53 +234,54 @@ interface CompareOptions extends ScreenshotOptions {
236
234
  /**
237
235
  * @description 输出 compare 命令帮助信息。
238
236
  */
239
- declare function printCompareHelp(): void;
237
+ export declare function printCompareHelp(): void;
240
238
  /**
241
239
  * @description 解析 compare 命令参数。
242
240
  */
243
- declare function parseCompareArgs(argv: string[]): CompareOptions;
241
+ export declare function parseCompareArgs(argv: string[]): CompareOptions;
244
242
  //#endregion
245
243
  //#region src/cli/config-command.d.ts
246
244
  /**
247
245
  * @description 处理 config 子命令。
248
246
  */
249
- declare function handleConfigCommand(argv: string[]): Promise<void>;
247
+ export declare function handleConfigCommand(argv: string[]): Promise<void>;
250
248
  //#endregion
251
249
  //#region src/cli/http.d.ts
252
- interface WechatDevtoolsHttpCommandOptions {
250
+ export interface WechatDevtoolsHttpCommandOptions {
253
251
  port?: number;
252
+ signal?: AbortSignal;
254
253
  timeoutMs?: number;
255
254
  }
256
- interface WechatDevtoolsEngineBuildResult {
255
+ export interface WechatDevtoolsEngineBuildResult {
257
256
  msg?: string;
258
257
  status?: string;
259
258
  }
260
- interface StartWechatIdeEngineBuildResult {
259
+ export interface StartWechatIdeEngineBuildResult {
261
260
  body: string;
262
261
  }
263
- interface PollWechatIdeEngineBuildResult extends WechatDevtoolsEngineBuildResult {
262
+ export interface PollWechatIdeEngineBuildResult extends WechatDevtoolsEngineBuildResult {
264
263
  body: string;
265
264
  done: boolean;
266
265
  failed: boolean;
267
266
  }
268
- declare function requestWechatDevtoolsHttp(pathname: string, query: Record<string, string>, options?: WechatDevtoolsHttpCommandOptions): Promise<string>;
267
+ export declare function requestWechatDevtoolsHttp(pathname: string, query: Record<string, string>, options?: WechatDevtoolsHttpCommandOptions): Promise<string>;
269
268
  /**
270
269
  * @description 通过微信开发者工具 HTTP 服务端口重新打开项目;若项目已打开,开发者工具会刷新当前项目。
271
270
  */
272
- declare function openWechatIdeProjectByHttp(projectPath: string, options?: WechatDevtoolsHttpCommandOptions): Promise<string>;
271
+ export declare function openWechatIdeProjectByHttp(projectPath: string, options?: WechatDevtoolsHttpCommandOptions): Promise<string>;
273
272
  /**
274
273
  * @description 通过微信开发者工具 HTTP 服务端口重置当前项目的 fileutils 状态。
275
274
  */
276
- declare function resetWechatIdeFileUtilsByHttp(projectPath: string, options?: WechatDevtoolsHttpCommandOptions): Promise<string>;
275
+ export declare function resetWechatIdeFileUtilsByHttp(projectPath: string, options?: WechatDevtoolsHttpCommandOptions): Promise<string>;
277
276
  /**
278
277
  * @description 通过微信开发者工具 HTTP 服务端口触发 engine build。
279
278
  */
280
- declare function startWechatIdeEngineBuildByHttp(projectPath: string, options?: WechatDevtoolsHttpCommandOptions): Promise<StartWechatIdeEngineBuildResult>;
279
+ export declare function startWechatIdeEngineBuildByHttp(projectPath: string, options?: WechatDevtoolsHttpCommandOptions): Promise<StartWechatIdeEngineBuildResult>;
281
280
  /**
282
281
  * @description 轮询微信开发者工具 engine build 状态。
283
282
  */
284
- declare function pollWechatIdeEngineBuildResultByHttp(options?: WechatDevtoolsHttpCommandOptions): Promise<PollWechatIdeEngineBuildResult>;
285
- declare const WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES: {
283
+ export declare function pollWechatIdeEngineBuildResultByHttp(options?: WechatDevtoolsHttpCommandOptions): Promise<PollWechatIdeEngineBuildResult>;
284
+ export declare const WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES: {
286
285
  readonly BUILDING: "BUILDING";
287
286
  readonly END: "END";
288
287
  readonly ERROR: "ERROR";
@@ -291,60 +290,60 @@ declare const WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES: {
291
290
  };
292
291
  //#endregion
293
292
  //#region src/cli/engine.d.ts
294
- interface RunWechatIdeEngineBuildByHttpOptions extends WechatDevtoolsHttpCommandOptions {
293
+ export interface RunWechatIdeEngineBuildByHttpOptions extends WechatDevtoolsHttpCommandOptions {
295
294
  onProgress?: (result: PollWechatIdeEngineBuildResult) => void;
296
295
  overallTimeoutMs?: number;
297
296
  pollIntervalMs?: number;
298
297
  }
299
- interface RunWechatIdeEngineBuildOptions extends RunWechatIdeEngineBuildByHttpOptions {
298
+ export interface RunWechatIdeEngineBuildOptions extends RunWechatIdeEngineBuildByHttpOptions {
300
299
  fallbackToCli?: boolean;
301
300
  logPath?: string;
302
301
  }
303
- declare function isWechatIdeEngineBuildEndpointMissingError(error: unknown): boolean;
302
+ export declare function isWechatIdeEngineBuildEndpointMissingError(error: unknown): boolean;
304
303
  /**
305
304
  * @description 通过开发者工具 HTTP 服务端口执行 engine build,并轮询直到构建结束。
306
305
  */
307
- declare function runWechatIdeEngineBuildByHttp(projectPath: string, options?: RunWechatIdeEngineBuildByHttpOptions): Promise<PollWechatIdeEngineBuildResult>;
306
+ export declare function runWechatIdeEngineBuildByHttp(projectPath: string, options?: RunWechatIdeEngineBuildByHttpOptions): Promise<PollWechatIdeEngineBuildResult>;
308
307
  /**
309
308
  * @description 以更接近官方 CLI 的方式执行 engine build,并支持将构建日志写入文件。
310
309
  */
311
- declare function runWechatIdeEngineBuild(projectPath: string, options?: RunWechatIdeEngineBuildOptions): Promise<void | PollWechatIdeEngineBuildResult>;
310
+ export declare function runWechatIdeEngineBuild(projectPath: string, options?: RunWechatIdeEngineBuildOptions): Promise<void | PollWechatIdeEngineBuildResult>;
312
311
  //#endregion
313
312
  //#region src/cli/forwardConsole.d.ts
314
- type ForwardConsoleLogLevel = 'debug' | 'log' | 'info' | 'warn' | 'error';
315
- interface ForwardConsoleEvent {
313
+ export type ForwardConsoleLogLevel = 'debug' | 'log' | 'info' | 'warn' | 'error';
314
+ export interface ForwardConsoleEvent {
316
315
  level: ForwardConsoleLogLevel;
317
316
  message: string;
318
317
  raw: unknown;
319
318
  }
320
- interface ForwardConsoleOptions extends AutomatorSessionOptions {
319
+ export interface ForwardConsoleOptions extends AutomatorSessionOptions {
321
320
  logLevels?: ForwardConsoleLogLevel[];
322
321
  unhandledErrors?: boolean;
323
322
  onLog?: (event: ForwardConsoleEvent) => void;
324
323
  onReady?: () => void;
325
324
  }
326
- interface ForwardConsoleSession {
325
+ export interface ForwardConsoleSession {
327
326
  close: () => Promise<void>;
328
327
  }
329
328
  /**
330
329
  * @description 启动小程序控制台日志转发,并保持 automator 会话常驻。
331
330
  */
332
- declare function startForwardConsole(options: ForwardConsoleOptions): Promise<ForwardConsoleSession>;
331
+ export declare function startForwardConsole(options: ForwardConsoleOptions): Promise<ForwardConsoleSession>;
333
332
  //#endregion
334
333
  //#region src/cli/inputCoordinator.d.ts
335
- interface SharedInputSessionOptions {
334
+ export interface SharedInputSessionOptions {
336
335
  onData?: (chunk: string | Uint8Array) => void;
337
336
  onKeypress?: (str: string, key: {
338
337
  name?: string;
339
338
  ctrl?: boolean;
340
339
  } | undefined) => void;
341
340
  }
342
- interface SharedInputSession {
341
+ export interface SharedInputSession {
343
342
  close: () => void;
344
343
  resume: () => void;
345
344
  suspend: () => void;
346
345
  }
347
- interface ExclusiveKeypressOptions<T> {
346
+ export interface ExclusiveKeypressOptions<T> {
348
347
  ignoreInitialMs?: number;
349
348
  timeoutMs?: number;
350
349
  onKeypress: (str: string, key: {
@@ -352,46 +351,46 @@ interface ExclusiveKeypressOptions<T> {
352
351
  ctrl?: boolean;
353
352
  } | undefined) => T | undefined;
354
353
  }
355
- declare function createSharedInputSession(options: SharedInputSessionOptions): SharedInputSession | undefined;
356
- declare function waitForExclusiveKeypress<T>(options: ExclusiveKeypressOptions<T>): Promise<T | 'timeout'>;
357
- declare function runWithSuspendedSharedInput<T>(runner: () => Promise<T>): Promise<T>;
354
+ export declare function createSharedInputSession(options: SharedInputSessionOptions): SharedInputSession | undefined;
355
+ export declare function waitForExclusiveKeypress<T>(options: ExclusiveKeypressOptions<T>): Promise<T | 'timeout'>;
356
+ export declare function runWithSuspendedSharedInput<T>(runner: () => Promise<T>): Promise<T>;
358
357
  //#endregion
359
358
  //#region src/cli/minidev.d.ts
360
359
  /**
361
360
  * @description 运行支付宝小程序 CLI(minidev)
362
361
  */
363
- declare function runMinidev(argv: readonly string[]): Promise<void>;
362
+ export declare function runMinidev(argv: readonly string[]): Promise<void>;
364
363
  //#endregion
365
364
  //#region src/cli/prompt.d.ts
366
365
  /**
367
366
  * @description 交互式提示并保存 CLI 路径
368
367
  */
369
- declare function promptForCliPath(): Promise<string | null>;
368
+ export declare function promptForCliPath(): Promise<string | null>;
370
369
  //#endregion
371
370
  //#region src/cli/resolver.d.ts
372
371
  /**
373
372
  * @description 解析 CLI 路径并校验可用性
374
373
  */
375
- declare function resolveCliPath(): Promise<{
374
+ export declare function resolveCliPath(): Promise<{
376
375
  cliPath: string | null;
377
376
  source: ConfigSource;
378
377
  }>;
379
378
  //#endregion
380
379
  //#region src/cli/retry.d.ts
381
- interface RetryKeypressOptions {
380
+ export interface RetryKeypressOptions {
382
381
  timeoutMs?: number;
383
382
  }
384
- interface RetryPromptOptions extends RetryKeypressOptions {
383
+ export interface RetryPromptOptions extends RetryKeypressOptions {
385
384
  logger: {
386
385
  info: (message: string) => void;
387
386
  };
388
387
  }
389
- interface RetryLogger {
388
+ export interface RetryLogger {
390
389
  error: (message: string) => void;
391
390
  info: (message: string) => void;
392
391
  warn: (message: string) => void;
393
392
  }
394
- interface WechatIdeLoginRetryOptions {
393
+ export interface WechatIdeLoginRetryOptions {
395
394
  allowRetry?: boolean;
396
395
  cancelLevel?: 'info' | 'warn';
397
396
  error: unknown;
@@ -399,87 +398,87 @@ interface WechatIdeLoginRetryOptions {
399
398
  promptOpenIdeLogin?: boolean;
400
399
  retryTimeoutMs?: number;
401
400
  }
402
- type RetryPromptResult = 'retry' | 'cancel' | 'timeout';
403
- declare const RETRY_PROMPT_INITIAL_IGNORE_MS = 300;
404
- declare const RETRY_CONFIRM_KEYS: readonly ["y"];
405
- declare const RETRY_CANCEL_KEYS: readonly ["q", "Esc", "Ctrl+C"];
401
+ export type RetryPromptResult = 'retry' | 'cancel' | 'timeout';
402
+ export declare const RETRY_PROMPT_INITIAL_IGNORE_MS = 300;
403
+ export declare const RETRY_CONFIRM_KEYS: readonly ["y"];
404
+ export declare const RETRY_CANCEL_KEYS: readonly ["q", "Esc", "Ctrl+C"];
406
405
  /**
407
406
  * @description 提取执行错误文本,便于统一匹配与提示。
408
407
  */
409
- declare function extractExecutionErrorText(error: unknown): string;
408
+ export declare function extractExecutionErrorText(error: unknown): string;
410
409
  /**
411
410
  * @description 判断是否为微信开发者工具登录失效错误。
412
411
  */
413
- declare function isWechatIdeLoginRequiredError(error: unknown): boolean;
412
+ export declare function isWechatIdeLoginRequiredError(error: unknown): boolean;
414
413
  /**
415
414
  * @description 将登录失效错误格式化为更易读的摘要。
416
415
  */
417
- declare function formatWechatIdeLoginRequiredError(error: unknown): string;
416
+ export declare function formatWechatIdeLoginRequiredError(error: unknown): string;
418
417
  /**
419
418
  * @description 创建登录失效专用错误,并携带退出码语义。
420
419
  */
421
- declare function createWechatIdeLoginRequiredExitError(error: unknown, reason?: string): Error & {
420
+ export declare function createWechatIdeLoginRequiredExitError(error: unknown, reason?: string): Error & {
422
421
  code: number;
423
422
  exitCode: number;
424
423
  };
425
424
  /**
426
425
  * @description 判断错误是否为登录失效专用退出错误。
427
426
  */
428
- declare function isWechatIdeLoginRequiredExitError(error: unknown): boolean;
427
+ export declare function isWechatIdeLoginRequiredExitError(error: unknown): boolean;
429
428
  /**
430
429
  * @description 交互等待用户按 y 重试,按 q 或 Ctrl+C 取消。
431
430
  */
432
- declare function waitForRetryKeypress(options?: RetryKeypressOptions): Promise<RetryPromptResult>;
431
+ export declare function waitForRetryKeypress(options?: RetryKeypressOptions): Promise<RetryPromptResult>;
433
432
  /**
434
433
  * @description 生成重试按键提示,并高亮关键热键。
435
434
  */
436
- declare function formatRetryHotkeyPrompt(timeoutMs?: number): string;
435
+ export declare function formatRetryHotkeyPrompt(timeoutMs?: number): string;
437
436
  /**
438
437
  * @description 输出重试热键提示,并独占等待当前提示对应的按键输入。
439
438
  */
440
- declare function promptRetryKeypress(options: RetryPromptOptions): Promise<RetryPromptResult>;
439
+ export declare function promptRetryKeypress(options: RetryPromptOptions): Promise<RetryPromptResult>;
441
440
  /**
442
441
  * @description 统一处理微信开发者工具登录失效场景下的提示与重试交互。
443
442
  */
444
- declare function promptWechatIdeLoginRetry(options: WechatIdeLoginRetryOptions): Promise<"cancel" | "retry">;
443
+ export declare function promptWechatIdeLoginRetry(options: WechatIdeLoginRetryOptions): Promise<"cancel" | "retry">;
445
444
  //#endregion
446
445
  //#region src/cli/run.d.ts
447
446
  /**
448
447
  * @description 基于 cac 注册顶层命令,用于统一识别入口。
449
448
  */
450
- declare function createCli(): import("cac").CAC;
449
+ export declare function createCli(): import("cac").CAC;
451
450
  /**
452
451
  * @description CLI 入口解析与分发。
453
452
  */
454
- declare function parse(argv: string[]): Promise<void>;
453
+ export declare function parse(argv: string[]): Promise<void>;
455
454
  //#endregion
456
455
  //#region src/cli/run-automator.d.ts
457
- declare const AUTOMATOR_COMMAND_NAMES: string[];
456
+ export declare const AUTOMATOR_COMMAND_NAMES: string[];
458
457
  /**
459
458
  * @description 判断是否属于 automator 子命令。
460
459
  */
461
- declare function isAutomatorCommand(command: string | undefined): boolean;
460
+ export declare function isAutomatorCommand(command: string | undefined): boolean;
462
461
  /**
463
462
  * @description 获取 automator 子命令帮助文本。
464
463
  */
465
- declare function getAutomatorCommandHelp(command: string): string | undefined;
464
+ export declare function getAutomatorCommandHelp(command: string): string | undefined;
466
465
  /**
467
466
  * @description 执行 automator 子命令。
468
467
  */
469
- declare function runAutomatorCommand(command: string, argv: string[]): Promise<void>;
468
+ export declare function runAutomatorCommand(command: string, argv: string[]): Promise<void>;
470
469
  //#endregion
471
470
  //#region src/cli/run-login.d.ts
472
- interface RunWechatCliWithRetryOptions {
471
+ export interface RunWechatCliWithRetryOptions {
473
472
  silent?: boolean;
474
473
  timeout?: number;
475
474
  }
476
475
  /**
477
476
  * @description 运行微信开发者工具 CLI,并在登录失效时允许按键重试。
478
477
  */
479
- declare function runWechatCliWithRetry(cliPath: string, argv: string[], options?: RunWechatCliWithRetryOptions): Promise<void>;
478
+ export declare function runWechatCliWithRetry(cliPath: string, argv: string[], options?: RunWechatCliWithRetryOptions): Promise<void>;
480
479
  //#endregion
481
480
  //#region src/cli/run-login-executor.d.ts
482
- interface RetryableCommandExecutorOptions<TResult, TPromptResult> {
481
+ export interface RetryableCommandExecutorOptions<TResult, TPromptResult> {
483
482
  createCancelError: (result: TResult) => Error;
484
483
  execute: () => Promise<TResult>;
485
484
  isRetryableResult: (result: TResult) => boolean;
@@ -491,49 +490,49 @@ interface RetryableCommandExecutorOptions<TResult, TPromptResult> {
491
490
  /**
492
491
  * @description 执行可重试命令循环,并将“是否可重试”与“如何提示重试”交给调用方定义。
493
492
  */
494
- declare function runRetryableCommand<TResult, TPromptResult>(options: RetryableCommandExecutorOptions<TResult, TPromptResult>): Promise<TResult>;
493
+ export declare function runRetryableCommand<TResult, TPromptResult>(options: RetryableCommandExecutorOptions<TResult, TPromptResult>): Promise<TResult>;
495
494
  //#endregion
496
495
  //#region src/cli/run-mcp.d.ts
497
- interface McpCommandOptions {
496
+ export interface McpCommandOptions {
498
497
  workspaceRoot?: string;
499
498
  }
500
- declare function runMcpCommand(argv: string[]): Promise<void>;
499
+ export declare function runMcpCommand(argv: string[]): Promise<void>;
501
500
  //#endregion
502
501
  //#region src/cli/screenshot.d.ts
503
502
  /**
504
503
  * @description Print help for screenshot command
505
504
  */
506
- declare function printScreenshotHelp(): void;
505
+ export declare function printScreenshotHelp(): void;
507
506
  /**
508
507
  * @description Parse command line arguments for screenshot command
509
508
  */
510
- declare function parseScreenshotArgs(argv: string[]): ScreenshotOptions;
509
+ export declare function parseScreenshotArgs(argv: string[]): ScreenshotOptions;
511
510
  //#endregion
512
511
  //#region src/cli/wechat-command-schema.d.ts
513
512
  /**
514
513
  * @description 在调用官方微信 CLI 前做轻量参数校验。
515
514
  */
516
- declare function validateWechatCliCommandArgs(argv: readonly string[]): void;
515
+ export declare function validateWechatCliCommandArgs(argv: readonly string[]): void;
517
516
  //#endregion
518
517
  //#region src/cli/wechat-commands.d.ts
519
- interface LoginWechatIdeOptions {
518
+ export interface LoginWechatIdeOptions {
520
519
  qrFormat?: 'base64' | 'image' | 'terminal';
521
520
  qrOutput?: string;
522
521
  qrSize?: string;
523
522
  resultOutput?: string;
524
523
  }
525
- interface OpenWechatIdeOptions {
524
+ export interface OpenWechatIdeOptions {
526
525
  appid?: string;
527
526
  extAppid?: string;
528
527
  platform?: string;
529
528
  projectPath?: string;
530
529
  trustProject?: boolean;
531
530
  }
532
- interface BuildWechatIdeNpmOptions {
531
+ export interface BuildWechatIdeNpmOptions {
533
532
  compileType?: string;
534
533
  projectPath?: string;
535
534
  }
536
- interface PreviewWechatIdeOptions {
535
+ export interface PreviewWechatIdeOptions {
537
536
  appid?: string;
538
537
  compileCondition?: string;
539
538
  extAppid?: string;
@@ -543,14 +542,14 @@ interface PreviewWechatIdeOptions {
543
542
  qrOutput?: string;
544
543
  qrSize?: string;
545
544
  }
546
- interface AutoPreviewWechatIdeOptions {
545
+ export interface AutoPreviewWechatIdeOptions {
547
546
  appid?: string;
548
547
  compileCondition?: string;
549
548
  extAppid?: string;
550
549
  infoOutput?: string;
551
550
  projectPath?: string;
552
551
  }
553
- interface UploadWechatIdeOptions {
552
+ export interface UploadWechatIdeOptions {
554
553
  appid?: string;
555
554
  desc: string;
556
555
  extAppid?: string;
@@ -558,7 +557,7 @@ interface UploadWechatIdeOptions {
558
557
  projectPath?: string;
559
558
  version: string;
560
559
  }
561
- interface AutoWechatIdeOptions {
560
+ export interface AutoWechatIdeOptions {
562
561
  account?: string;
563
562
  appid?: string;
564
563
  extAppid?: string;
@@ -568,7 +567,7 @@ interface AutoWechatIdeOptions {
568
567
  ticket?: string;
569
568
  trustProject?: boolean;
570
569
  }
571
- interface AutoReplayWechatIdeOptions {
570
+ export interface AutoReplayWechatIdeOptions {
572
571
  account?: string;
573
572
  appid?: string;
574
573
  extAppid?: string;
@@ -580,16 +579,16 @@ interface AutoReplayWechatIdeOptions {
580
579
  ticket?: string;
581
580
  trustProject?: boolean;
582
581
  }
583
- interface OpenWechatIdeOtherProjectOptions {
582
+ export interface OpenWechatIdeOtherProjectOptions {
584
583
  projectPath?: string;
585
584
  }
586
- interface ClearWechatIdeCacheOptions {
585
+ export interface ClearWechatIdeCacheOptions {
587
586
  clean: 'all' | 'auth' | 'compile' | 'file' | 'network' | 'session' | 'storage';
588
587
  }
589
- interface ResetWechatIdeFileUtilsOptions {
588
+ export interface ResetWechatIdeFileUtilsOptions {
590
589
  projectPath: string;
591
590
  }
592
- interface WechatIdeAutomatorSessionOptions {
591
+ export interface WechatIdeAutomatorSessionOptions {
593
592
  port?: number;
594
593
  preferOpenedSession?: boolean;
595
594
  preserveProjectRoot?: boolean;
@@ -598,16 +597,16 @@ interface WechatIdeAutomatorSessionOptions {
598
597
  sharedSession?: boolean;
599
598
  timeout?: number;
600
599
  }
601
- interface CompileWechatIdeByAutomatorOptions extends WechatIdeAutomatorSessionOptions {
600
+ export interface CompileWechatIdeByAutomatorOptions extends WechatIdeAutomatorSessionOptions {
602
601
  force?: boolean;
603
602
  }
604
- interface ClearWechatIdeCacheByAutomatorOptions extends WechatIdeAutomatorSessionOptions {
603
+ export interface ClearWechatIdeCacheByAutomatorOptions extends WechatIdeAutomatorSessionOptions {
605
604
  clean: 'all' | 'auth' | 'compile' | 'file' | 'network' | 'session' | 'storage';
606
605
  }
607
- interface SetWechatIdeTicketOptions extends WechatIdeAutomatorSessionOptions {
606
+ export interface SetWechatIdeTicketOptions extends WechatIdeAutomatorSessionOptions {
608
607
  ticket: string;
609
608
  }
610
- interface BuildWechatIdeApkOptions {
609
+ export interface BuildWechatIdeApkOptions {
611
610
  desc?: string;
612
611
  isUploadResourceBundle?: boolean;
613
612
  keyAlias: string;
@@ -619,7 +618,7 @@ interface BuildWechatIdeApkOptions {
619
618
  storePass: string;
620
619
  useAab?: boolean;
621
620
  }
622
- interface BuildWechatIdeIpaOptions {
621
+ export interface BuildWechatIdeIpaOptions {
623
622
  certificateName?: string;
624
623
  isDistribute: boolean;
625
624
  isRemoteBuild?: boolean;
@@ -639,153 +638,153 @@ interface BuildWechatIdeIpaOptions {
639
638
  /**
640
639
  * @description 调用微信开发者工具 open 命令。
641
640
  */
642
- declare function openWechatIde(options?: OpenWechatIdeOptions): Promise<void>;
641
+ export declare function openWechatIde(options?: OpenWechatIdeOptions): Promise<void>;
643
642
  /**
644
643
  * @description 调用微信开发者工具 login 命令。
645
644
  */
646
- declare function loginWechatIde(options?: LoginWechatIdeOptions): Promise<void>;
645
+ export declare function loginWechatIde(options?: LoginWechatIdeOptions): Promise<void>;
647
646
  /**
648
647
  * @description 调用微信开发者工具 islogin 命令。
649
648
  */
650
- declare function isWechatIdeLoggedIn(options?: {
649
+ export declare function isWechatIdeLoggedIn(options?: {
651
650
  nonInteractive?: boolean;
652
651
  silent?: boolean;
653
652
  }): Promise<void>;
654
653
  /**
655
654
  * @description 调用微信开发者工具 build-npm 命令。
656
655
  */
657
- declare function buildWechatIdeNpm(options?: BuildWechatIdeNpmOptions): Promise<void>;
656
+ export declare function buildWechatIdeNpm(options?: BuildWechatIdeNpmOptions): Promise<void>;
658
657
  /**
659
658
  * @description 调用微信开发者工具 preview 命令。
660
659
  */
661
- declare function previewWechatIde(options?: PreviewWechatIdeOptions): Promise<void>;
660
+ export declare function previewWechatIde(options?: PreviewWechatIdeOptions): Promise<void>;
662
661
  /**
663
662
  * @description 调用微信开发者工具 auto-preview 命令。
664
663
  */
665
- declare function autoPreviewWechatIde(options?: AutoPreviewWechatIdeOptions): Promise<void>;
664
+ export declare function autoPreviewWechatIde(options?: AutoPreviewWechatIdeOptions): Promise<void>;
666
665
  /**
667
666
  * @description 调用微信开发者工具 auto 命令。
668
667
  */
669
- declare function autoWechatIde(options?: AutoWechatIdeOptions): Promise<void>;
668
+ export declare function autoWechatIde(options?: AutoWechatIdeOptions): Promise<void>;
670
669
  /**
671
670
  * @description 调用微信开发者工具 auto-replay 命令。
672
671
  */
673
- declare function autoReplayWechatIde(options?: AutoReplayWechatIdeOptions): Promise<void>;
672
+ export declare function autoReplayWechatIde(options?: AutoReplayWechatIdeOptions): Promise<void>;
674
673
  /**
675
674
  * @description 调用微信开发者工具 upload 命令。
676
675
  */
677
- declare function uploadWechatIde(options: UploadWechatIdeOptions): Promise<void>;
676
+ export declare function uploadWechatIde(options: UploadWechatIdeOptions): Promise<void>;
678
677
  /**
679
678
  * @description 调用微信开发者工具 close 命令。
680
679
  */
681
- declare function closeWechatIdeProject(): Promise<void>;
680
+ export declare function closeWechatIdeProject(): Promise<void>;
682
681
  /**
683
682
  * @description 调用微信开发者工具 quit 命令。
684
683
  */
685
- declare function quitWechatIde(): Promise<void>;
684
+ export declare function quitWechatIde(): Promise<void>;
686
685
  /**
687
686
  * @description 调用微信开发者工具 cache 命令。
688
687
  */
689
- declare function clearWechatIdeCache(options: ClearWechatIdeCacheOptions): Promise<void>;
688
+ export declare function clearWechatIdeCache(options: ClearWechatIdeCacheOptions): Promise<void>;
690
689
  /**
691
690
  * @description 调用微信开发者工具 open-other 命令。
692
691
  */
693
- declare function openWechatIdeOtherProject(_options?: OpenWechatIdeOtherProjectOptions): Promise<void>;
692
+ export declare function openWechatIdeOtherProject(_options?: OpenWechatIdeOtherProjectOptions): Promise<void>;
694
693
  /**
695
694
  * @description 通过微信开发者工具 HTTP 服务端口重置指定项目的 fileutils 状态。
696
695
  */
697
- declare function resetWechatIdeFileUtils(options: ResetWechatIdeFileUtilsOptions): Promise<void>;
696
+ export declare function resetWechatIdeFileUtils(options: ResetWechatIdeFileUtilsOptions): Promise<void>;
698
697
  /**
699
698
  * @description 通过已打开或新建的 automator 会话获取开发者工具基础信息。
700
699
  */
701
- declare function getWechatIdeToolInfo(options: WechatIdeAutomatorSessionOptions): Promise<any>;
700
+ export declare function getWechatIdeToolInfo(options: WechatIdeAutomatorSessionOptions): Promise<any>;
702
701
  /**
703
702
  * @description 通过已打开或新建的 automator 会话执行项目编译。
704
703
  */
705
- declare function compileWechatIdeByAutomator(options: CompileWechatIdeByAutomatorOptions): Promise<any>;
704
+ export declare function compileWechatIdeByAutomator(options: CompileWechatIdeByAutomatorOptions): Promise<any>;
706
705
  /**
707
706
  * @description 通过已打开或新建的 automator 会话清理开发者工具缓存。
708
707
  */
709
- declare function clearWechatIdeCacheByAutomator(options: ClearWechatIdeCacheByAutomatorOptions): Promise<any>;
708
+ export declare function clearWechatIdeCacheByAutomator(options: ClearWechatIdeCacheByAutomatorOptions): Promise<any>;
710
709
  /**
711
710
  * @description 通过已打开或新建的 automator 会话获取当前 ticket。
712
711
  */
713
- declare function getWechatIdeTicket(options: WechatIdeAutomatorSessionOptions): Promise<any>;
712
+ export declare function getWechatIdeTicket(options: WechatIdeAutomatorSessionOptions): Promise<any>;
714
713
  /**
715
714
  * @description 通过已打开或新建的 automator 会话设置 ticket。
716
715
  */
717
- declare function setWechatIdeTicket(options: SetWechatIdeTicketOptions): Promise<void>;
716
+ export declare function setWechatIdeTicket(options: SetWechatIdeTicketOptions): Promise<void>;
718
717
  /**
719
718
  * @description 通过已打开或新建的 automator 会话刷新 ticket。
720
719
  */
721
- declare function refreshWechatIdeTicket(options: WechatIdeAutomatorSessionOptions): Promise<void>;
720
+ export declare function refreshWechatIdeTicket(options: WechatIdeAutomatorSessionOptions): Promise<void>;
722
721
  /**
723
722
  * @description 通过已打开或新建的 automator 会话获取测试账号列表。
724
723
  */
725
- declare function getWechatIdeTestAccounts(options: WechatIdeAutomatorSessionOptions): Promise<any>;
724
+ export declare function getWechatIdeTestAccounts(options: WechatIdeAutomatorSessionOptions): Promise<any>;
726
725
  /**
727
726
  * @description 调用微信开发者工具 build-apk 命令。
728
727
  */
729
- declare function buildWechatIdeApk(options: BuildWechatIdeApkOptions): Promise<void>;
728
+ export declare function buildWechatIdeApk(options: BuildWechatIdeApkOptions): Promise<void>;
730
729
  /**
731
730
  * @description 调用微信开发者工具 build-ipa 命令。
732
731
  */
733
- declare function buildWechatIdeIpa(options: BuildWechatIdeIpaOptions): Promise<void>;
732
+ export declare function buildWechatIdeIpa(options: BuildWechatIdeIpaOptions): Promise<void>;
734
733
  //#endregion
735
734
  //#region src/cli/wechat-dispatch.d.ts
736
735
  /**
737
736
  * @description 优先将高频官方命令分发到 weapp-ide-cli 的稳定 helper,实现更清晰的程序化命令层。
738
737
  */
739
- declare function dispatchWechatCliCommand(argv: string[]): Promise<boolean>;
738
+ export declare function dispatchWechatCliCommand(argv: string[]): Promise<boolean>;
740
739
  //#endregion
741
740
  //#region src/cli/wechatDevtoolsRuntimePort.d.ts
742
741
  /**
743
742
  * @description 标记当前进程最近一次检测到的微信开发者工具服务端口。
744
743
  */
745
- declare function setRuntimeWechatDevtoolsServicePort(port: number | undefined): void;
744
+ export declare function setRuntimeWechatDevtoolsServicePort(port: number | undefined): void;
746
745
  /**
747
746
  * @description 读取当前进程最近一次检测到的微信开发者工具服务端口。
748
747
  */
749
- declare function getRuntimeWechatDevtoolsServicePort(): number | undefined;
748
+ export declare function getRuntimeWechatDevtoolsServicePort(): number | undefined;
750
749
  //#endregion
751
750
  //#region src/cli/wechatDevtoolsSettings.d.ts
752
- interface WechatDevtoolsSecuritySettings {
751
+ export interface WechatDevtoolsSecuritySettings {
753
752
  enableServicePort: boolean;
754
753
  port: number;
755
754
  allowGetTicket: boolean;
756
755
  trustWhenAuto: boolean;
757
756
  }
758
- interface DetectedWechatDevtoolsServicePortSettings {
757
+ export interface DetectedWechatDevtoolsServicePortSettings {
759
758
  enabled?: boolean;
760
759
  port?: number;
761
760
  }
762
- interface DetectWechatDevtoolsServicePortOptions {
761
+ export interface DetectWechatDevtoolsServicePortOptions {
763
762
  homeDir?: string;
764
763
  localAppDataDir?: string;
765
764
  platform?: NodeJS.Platform;
766
765
  }
767
- interface DetectWechatDevtoolsServicePortResult {
766
+ export interface DetectWechatDevtoolsServicePortResult {
768
767
  touchedInstanceCount: number;
769
768
  detectedSecurityCount: number;
770
769
  servicePort?: number;
771
770
  servicePortEnabled?: boolean;
772
771
  }
773
- interface BootstrapWechatDevtoolsSettingsOptions extends DetectWechatDevtoolsServicePortOptions {
772
+ export interface BootstrapWechatDevtoolsSettingsOptions extends DetectWechatDevtoolsServicePortOptions {
774
773
  projectPath?: string;
775
774
  trustProject?: boolean;
776
775
  }
777
- interface BootstrapWechatDevtoolsSettingsResult extends DetectWechatDevtoolsServicePortResult {
776
+ export interface BootstrapWechatDevtoolsSettingsResult extends DetectWechatDevtoolsServicePortResult {
778
777
  updatedSecurityCount: number;
779
778
  trustedProjectCount: number;
780
779
  }
781
780
  /**
782
781
  * @description 检测微信开发者工具当前服务端口配置,严格沿用用户已有设置。
783
782
  */
784
- declare function detectWechatDevtoolsServicePort(options?: DetectWechatDevtoolsServicePortOptions): Promise<DetectWechatDevtoolsServicePortResult>;
783
+ export declare function detectWechatDevtoolsServicePort(options?: DetectWechatDevtoolsServicePortOptions): Promise<DetectWechatDevtoolsServicePortResult>;
785
784
  /**
786
785
  * @description 在启动微信开发者工具前,检测服务端口配置,并按需写入项目信任信息。
787
786
  */
788
- declare function bootstrapWechatDevtoolsSettings(options?: BootstrapWechatDevtoolsSettingsOptions): Promise<BootstrapWechatDevtoolsSettingsResult>;
787
+ export declare function bootstrapWechatDevtoolsSettings(options?: BootstrapWechatDevtoolsSettingsOptions): Promise<BootstrapWechatDevtoolsSettingsResult>;
789
788
  //#endregion
790
789
  //#region src/types.d.ts
791
790
  /**
@@ -822,47 +821,47 @@ interface CustomConfigFile {
822
821
  autoBootstrapDevtools?: boolean;
823
822
  autoTrustProject?: boolean;
824
823
  }
825
- declare function readCustomConfig(): Promise<CustomConfigFile>;
824
+ export declare function readCustomConfig(): Promise<CustomConfigFile>;
826
825
  /**
827
826
  * @description 写入自定义 CLI 路径配置
828
827
  */
829
- declare function createCustomConfig(params: BaseConfig): Promise<string>;
828
+ export declare function createCustomConfig(params: BaseConfig): Promise<string>;
830
829
  /**
831
830
  * @description 写入语言配置(zh / en)。
832
831
  */
833
- declare function createLocaleConfig(locale: 'zh' | 'en'): Promise<"zh" | "en">;
832
+ export declare function createLocaleConfig(locale: 'zh' | 'en'): Promise<"zh" | "en">;
834
833
  /**
835
834
  * @description 写入开发者工具自动预热配置。
836
835
  */
837
- declare function createAutoBootstrapDevtoolsConfig(value: boolean): Promise<boolean>;
836
+ export declare function createAutoBootstrapDevtoolsConfig(value: boolean): Promise<boolean>;
838
837
  /**
839
838
  * @description 写入项目自动信任配置。
840
839
  */
841
- declare function createAutoTrustProjectConfig(value: boolean): Promise<boolean>;
840
+ export declare function createAutoTrustProjectConfig(value: boolean): Promise<boolean>;
842
841
  /**
843
842
  * @description 删除指定配置项。
844
843
  */
845
- declare function removeCustomConfigKey(key: keyof CustomConfigFile): Promise<void>;
844
+ export declare function removeCustomConfigKey(key: keyof CustomConfigFile): Promise<void>;
846
845
  /**
847
846
  * @description 覆盖写入配置内容(会替换原内容)。
848
847
  */
849
- declare function overwriteCustomConfig(config: CustomConfigFile): Promise<void>;
848
+ export declare function overwriteCustomConfig(config: CustomConfigFile): Promise<void>;
850
849
  //#endregion
851
850
  //#region src/config/paths.d.ts
852
851
  /**
853
852
  * @description 默认自定义配置目录
854
853
  */
855
- declare const defaultCustomConfigDirPath: string;
854
+ export declare const defaultCustomConfigDirPath: string;
856
855
  /**
857
856
  * @description 默认自定义配置文件路径
858
857
  */
859
- declare const defaultCustomConfigFilePath: string;
858
+ export declare const defaultCustomConfigFilePath: string;
860
859
  //#endregion
861
860
  //#region src/config/resolver.d.ts
862
861
  /**
863
862
  * @description 解析开发者工具自动预热相关配置的最终生效值。
864
863
  */
865
- declare function resolveDevtoolsAutomationDefaults(config: {
864
+ export declare function resolveDevtoolsAutomationDefaults(config: {
866
865
  autoBootstrapDevtools?: boolean;
867
866
  autoTrustProject?: boolean;
868
867
  }): {
@@ -872,17 +871,17 @@ declare function resolveDevtoolsAutomationDefaults(config: {
872
871
  /**
873
872
  * @description 读取并解析 CLI 配置(自定义优先)
874
873
  */
875
- declare function getConfig(): Promise<ResolvedConfig>;
874
+ export declare function getConfig(): Promise<ResolvedConfig>;
876
875
  /**
877
876
  * @description 获取用户配置的语言偏好。
878
877
  */
879
- declare function getConfiguredLocale(): Promise<"zh" | "en" | undefined>;
878
+ export declare function getConfiguredLocale(): Promise<"zh" | "en" | undefined>;
880
879
  //#endregion
881
880
  //#region src/mcp/runtime.d.ts
882
- interface StartWeappIdeMcpServerOptions {
881
+ export interface StartWeappIdeMcpServerOptions {
883
882
  workspaceRoot?: string;
884
883
  }
885
- declare function startWeappIdeMcpServer(options?: StartWeappIdeMcpServerOptions): Promise<{
884
+ export declare function startWeappIdeMcpServer(options?: StartWeappIdeMcpServerOptions): Promise<{
886
885
  close: () => Promise<void>;
887
886
  }>;
888
887
  //#endregion
@@ -890,7 +889,7 @@ declare function startWeappIdeMcpServer(options?: StartWeappIdeMcpServerOptions)
890
889
  interface ToolRegistrar {
891
890
  registerTool: McpServer['registerTool'];
892
891
  }
893
- interface WeappIdeMcpRuntimeHooks {
892
+ export interface WeappIdeMcpRuntimeHooks {
894
893
  withMiniProgram: <T>(options: {
895
894
  preferOpenedSession?: boolean;
896
895
  port?: number;
@@ -900,15 +899,15 @@ interface WeappIdeMcpRuntimeHooks {
900
899
  timeout?: number;
901
900
  }, runner: (miniProgram: MiniProgramLike) => Promise<T>) => Promise<T>;
902
901
  }
903
- interface WeappIdeMcpServerOptions {
902
+ export interface WeappIdeMcpServerOptions {
904
903
  runtimeHooks: WeappIdeMcpRuntimeHooks;
905
904
  workspaceRoot?: string;
906
905
  }
907
- interface WeappIdeMcpServerHandle {
906
+ export interface WeappIdeMcpServerHandle {
908
907
  close: () => Promise<void>;
909
908
  }
910
- declare function registerWeappIdeMcpTools(server: ToolRegistrar, options: WeappIdeMcpServerOptions): void;
911
- declare function createWeappIdeMcpServer(options: WeappIdeMcpServerOptions): Promise<{
909
+ export declare function registerWeappIdeMcpTools(server: ToolRegistrar, options: WeappIdeMcpServerOptions): void;
910
+ export declare function createWeappIdeMcpServer(options: WeappIdeMcpServerOptions): Promise<{
912
911
  close: () => Promise<undefined>;
913
912
  server: McpServer;
914
913
  }>;
@@ -918,7 +917,7 @@ declare function createWeappIdeMcpServer(options: WeappIdeMcpServerOptions): Pro
918
917
  * @description 官方微信开发者工具只支持 Windows、macOS,Linux 只有社区版。
919
918
  * https://github.com/msojocs/wechat-web-devtools-linux
920
919
  */
921
- declare const SupportedPlatformsMap: {
920
+ export declare const SupportedPlatformsMap: {
922
921
  readonly Windows_NT: "Windows_NT";
923
922
  readonly Darwin: "Darwin";
924
923
  readonly Linux: "Linux";
@@ -926,37 +925,37 @@ declare const SupportedPlatformsMap: {
926
925
  /**
927
926
  * @description 支持的系统类型。
928
927
  */
929
- type SupportedPlatform = (typeof SupportedPlatformsMap)[keyof typeof SupportedPlatformsMap];
928
+ export type SupportedPlatform = (typeof SupportedPlatformsMap)[keyof typeof SupportedPlatformsMap];
930
929
  /**
931
930
  * @description 判断当前系统是否支持微信开发者工具。
932
931
  */
933
- declare function isOperatingSystemSupported(osName?: string): osName is SupportedPlatform;
932
+ export declare function isOperatingSystemSupported(osName?: string): osName is SupportedPlatform;
934
933
  /**
935
934
  * @description 当前系统名称。
936
935
  */
937
- declare const operatingSystemName: string;
936
+ export declare const operatingSystemName: string;
938
937
  /**
939
938
  * @description 获取默认 CLI 路径(按系统)。
940
939
  */
941
- declare function getDefaultCliPath(targetOs?: string): Promise<string | undefined>;
940
+ export declare function getDefaultCliPath(targetOs?: string): Promise<string | undefined>;
942
941
  //#endregion
943
942
  //#region src/utils/argv.d.ts
944
943
  /**
945
944
  * @description argv 处理函数
946
945
  */
947
- type ArgvTransform = (argv: readonly string[]) => string[];
946
+ export type ArgvTransform = (argv: readonly string[]) => string[];
948
947
  /**
949
948
  * @description 依次应用 argv 处理函数(不修改原始 argv)
950
949
  */
951
- declare function transformArgv(argv: readonly string[], transforms: readonly ArgvTransform[]): string[];
950
+ export declare function transformArgv(argv: readonly string[], transforms: readonly ArgvTransform[]): string[];
952
951
  /**
953
952
  * @description 创建参数别名转换器
954
953
  */
955
- declare function createAlias(entry: AliasEntry): ArgvTransform;
954
+ export declare function createAlias(entry: AliasEntry): ArgvTransform;
956
955
  /**
957
956
  * @description 创建路径参数兼容转换器(补全或规范化路径)
958
957
  */
959
- declare function createPathCompat(option: string): ArgvTransform;
958
+ export declare function createPathCompat(option: string): ArgvTransform;
960
959
  //#endregion
961
960
  //#region src/utils/exec.d.ts
962
961
  interface ExecuteOptions {
@@ -967,7 +966,7 @@ interface ExecuteOptions {
967
966
  /**
968
967
  * @description 执行 CLI 命令并透传输出
969
968
  */
970
- declare function execute(cliPath: string, argv: string[], options?: ExecuteOptions): Promise<import("execa").Result<{
969
+ export declare function execute(cliPath: string, argv: string[], options?: ExecuteOptions): Promise<import("execa").Result<{
971
970
  timeout: number | undefined;
972
971
  }>>;
973
972
  //#endregion
@@ -975,6 +974,6 @@ declare function execute(cliPath: string, argv: string[], options?: ExecuteOptio
975
974
  /**
976
975
  * @description 解析为绝对路径(基于当前工作目录)
977
976
  */
978
- declare function resolvePath(filePath: string): string;
977
+ export declare function resolvePath(filePath: string): string;
979
978
  //#endregion
980
- export { AUTOMATOR_COMMAND_NAMES, ArgvTransform, AuditOptions, AutoPreviewWechatIdeOptions, AutoReplayWechatIdeOptions, AutoWechatIdeOptions, AutomatorCommandOptions, AutomatorOptions, AutomatorSessionOptions, type BaseConfig, BootstrapWechatDevtoolsSettingsOptions, BootstrapWechatDevtoolsSettingsResult, BuildWechatIdeApkOptions, BuildWechatIdeIpaOptions, BuildWechatIdeNpmOptions, CONFIG_COMMAND_NAME, ClearWechatIdeCacheByAutomatorOptions, ClearWechatIdeCacheOptions, CompileWechatIdeByAutomatorOptions, type ConfigSource, DetectWechatDevtoolsServicePortOptions, DetectWechatDevtoolsServicePortResult, DetectedWechatDevtoolsServicePortSettings, type DevtoolsConnectionInput, type DevtoolsContext, type DevtoolsElementSnapshot, type DevtoolsPageSnapshot, type DevtoolsToolResult, ExclusiveKeypressOptions, ForwardConsoleEvent, ForwardConsoleLogLevel, ForwardConsoleOptions, ForwardConsoleSession, InputOptions, LoginWechatIdeOptions, MCP_COMMAND_NAME, MINIDEV_NAMESPACE_COMMAND_NAMES, McpCommandOptions, MiniProgramElement, type MiniProgramEventMap, MiniProgramLike, MiniProgramPage, NavigateOptions, OpenWechatIdeOptions, OpenWechatIdeOtherProjectOptions, PageDataOptions, PageInfoOptions, ParsedAutomatorArgs, PollWechatIdeEngineBuildResult, PreviewWechatIdeOptions, RETRY_CANCEL_KEYS, RETRY_CONFIRM_KEYS, RETRY_PROMPT_INITIAL_IGNORE_MS, RemoteOptions, ResetWechatIdeFileUtilsOptions, type ResolvedConfig, RetryKeypressOptions, RetryLogger, RetryPromptOptions, RetryPromptResult, RetryableCommandExecutorOptions, RunWechatCliWithRetryOptions, RunWechatIdeEngineBuildByHttpOptions, RunWechatIdeEngineBuildOptions, ScreenshotOptions, ScreenshotResult, ScrollOptions, SelectorOptions, SetWechatIdeTicketOptions, SharedInputSession, SharedInputSessionOptions, StartWeappIdeMcpServerOptions, StartWechatIdeEngineBuildResult, SupportedPlatform, SupportedPlatformsMap, TapOptions, UploadWechatIdeOptions, WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, WECHAT_CLI_COMMAND_NAMES, WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, WeappIdeMcpRuntimeHooks, WeappIdeMcpServerHandle, WeappIdeMcpServerOptions, WechatDevtoolsEngineBuildResult, WechatDevtoolsHttpCommandOptions, WechatDevtoolsSecuritySettings, WechatIdeAutomatorSessionOptions, WechatIdeLoginRetryOptions, 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, getRuntimeWechatDevtoolsServicePort, getSharedMiniProgramSessionCount, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, handleConfigCommand, input, isAutomatorCommand, isAutomatorLoginError, isAutomatorPortInUseError, isAutomatorProtocolTimeoutError, isAutomatorWsConnectError, isDevtoolsExtensionContextInvalidatedError, isDevtoolsHttpPortError, isOperatingSystemSupported, isRetryableAutomatorLaunchError, isWeappIdeTopLevelCommand, isWechatIdeEngineBuildEndpointMissingError, isWechatIdeLoggedIn, isWechatIdeLoginRequiredError, isWechatIdeLoginRequiredExitError, 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, resolveProjectAutomatorPort, resolveProjectPath, runAutomatorCommand, runMcpCommand, runMinidev, runRetryableCommand, runWechatCliWithRetry, runWechatIdeEngineBuild, runWechatIdeEngineBuildByHttp, runWithSuspendedSharedInput, scrollTo, setRuntimeWechatDevtoolsServicePort, setWechatIdeTicket, startForwardConsole, startWeappIdeMcpServer, startWechatIdeEngineBuildByHttp, switchTab, systemInfo, takeScreenshot, tap, toSerializableValue, transformArgv, uploadWechatIde, validateWechatCliCommandArgs, waitForExclusiveKeypress, waitForRetryKeypress, withMiniProgram };
979
+ export { type AutomatorSessionOptions, type BaseConfig, type ConfigSource, type DevtoolsConnectionInput, type DevtoolsContext, type DevtoolsElementSnapshot, type DevtoolsPageSnapshot, type DevtoolsToolResult, type MiniProgramElement, type MiniProgramEventMap, type MiniProgramLike, type MiniProgramPage, type ResolvedConfig, closeSharedMiniProgram, getSharedMiniProgramSessionCount, readElementSnapshot, releaseSharedMiniProgram, resolveProjectPath, toSerializableValue };