@weapp-vite/mcp 1.2.0 → 1.3.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/README.md CHANGED
@@ -47,6 +47,25 @@ await handle.close?.()
47
47
  - `compare_weapp_screenshot`: 面向“截图对比 / diff / baseline / 视觉回归”语义,执行 `weapp-vite compare --json`
48
48
  - `run_repo_command`: 执行仓库级命令(`pnpm/node/git/rg`)
49
49
 
50
+ ### DevTools Runtime Tools
51
+
52
+ 这些工具复用 `weapp-ide-cli` 的 automator 会话能力,面向已经能被微信开发者工具打开的小程序项目:
53
+
54
+ - `weapp_devtools_connect`: 确认 DevTools automator 会话可用
55
+ - `weapp_devtools_active_page` / `weapp_devtools_page_stack`: 读取当前页面与页面栈
56
+ - `weapp_devtools_route`: 执行 `navigateTo` / `redirectTo` / `reLaunch` / `switchTab` / `navigateBack`
57
+ - `weapp_devtools_capture`: 截取当前小程序视口
58
+ - `weapp_devtools_host_api`: 调用 `wx.*` API
59
+ - `weapp_devtools_console`: 读取 MCP 会话期间捕获的 console/exception 日志
60
+ - `weapp_runtime_find_node` / `weapp_runtime_find_nodes` / `weapp_runtime_wait_node`: 查询和等待页面元素
61
+ - `weapp_runtime_page_state` / `weapp_runtime_update_page_state` / `weapp_runtime_invoke_page`: 操作页面实例
62
+ - `weapp_runtime_tap_node` / `weapp_runtime_input_node`: 操作页面元素
63
+ - `weapp_runtime_component_state` / `weapp_runtime_update_component_state` / `weapp_runtime_invoke_component`: 操作组件实例
64
+ - `weapp_runtime_find_child` / `weapp_runtime_find_children`: 查询组件内部元素
65
+ - `weapp_runtime_node_markup` / `weapp_runtime_node_styles` / `weapp_runtime_node_attrs` / `weapp_runtime_measure_node`: 读取元素结构与渲染信息
66
+
67
+ 建议调用顺序:先 `weapp_devtools_connect`,再 `weapp_devtools_active_page`,之后再执行 `weapp_devtools_capture` 或 `weapp_runtime_*`。
68
+
50
69
  ## 主要 Resources
51
70
 
52
71
  - `weapp-vite://workspace/catalog`
@@ -64,6 +83,8 @@ await handle.close?.()
64
83
 
65
84
  - `plan-weapp-vite-change`: 生成 weapp-vite/wevu 改造计划提示词
66
85
  - `debug-wevu-runtime`: 生成 wevu runtime 排查提示词
86
+ - `inspect-mini-program-page`: 连接 DevTools 并检查页面渲染状态
87
+ - `recover-mini-program-connection`: 按固定顺序恢复 automator 连接
67
88
 
68
89
  ## 开发
69
90
 
package/dist/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { DevtoolsRuntimeHooks } from '@weapp-vite/devtools-runtime';
1
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
3
 
3
4
  declare const MCP_SERVER_NAME = "@weapp-vite/mcp";
@@ -86,6 +87,7 @@ declare function searchTextInDirectory(root: string, query: string, options?: {
86
87
  }): Promise<SearchMatch[]>;
87
88
 
88
89
  interface CreateServerOptions {
90
+ runtimeHooks?: DevtoolsRuntimeHooks;
89
91
  workspaceRoot?: string;
90
92
  }
91
93
  declare function createWeappViteMcpServer(options?: CreateServerOptions): Promise<{
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { DevtoolsRuntimeHooks } from '@weapp-vite/devtools-runtime';
1
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
3
 
3
4
  declare const MCP_SERVER_NAME = "@weapp-vite/mcp";
@@ -86,6 +87,7 @@ declare function searchTextInDirectory(root: string, query: string, options?: {
86
87
  }): Promise<SearchMatch[]>;
87
88
 
88
89
  interface CreateServerOptions {
90
+ runtimeHooks?: DevtoolsRuntimeHooks;
89
91
  workspaceRoot?: string;
90
92
  }
91
93
  declare function createWeappViteMcpServer(options?: CreateServerOptions): Promise<{