This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
阿让和博览会
使用 Argent 让你的 AI 代理在 Android 模拟器和 iOS 模拟器上控制、调试和分析你的 Expo 项目。
Argent 是来自 Software Mansion 的一个智能工具包。当像 Claude Code 或 Codex 这样的 AI 代理阅读你的代码和文档时,Argent 让同样的代理可以直接访问你正在运行的应用:它可以控制、调试和分析你在 Android 模拟器或 iOS 模拟器上的 Expo 应用。你只需设置一次,然后通过 Model Context Protocol (MCP) 将其连接到你的编辑器。
信息 Argent 由 Software Mansion 构建和维护,并且可以免费使用。有关其全部功能列表,请参阅 Argent 网站。
2 要求
2 要求
1.
Argent 的 CLI 需要 Node.js 版本 18 或更高版本。
2.
对于 Android,请安装 Android SDK 平台工具 (adb),确保 adb 在你的 PATH 上,并且有可用的模拟器。对于 iOS,请使用安装了 Xcode 的 macOS。
快速开始
🌐 Quick start
1
设置 Argent
🌐 Set up Argent
在你的 Expo 项目的根目录下,运行 init 命令。向导会检测你的编辑器,注册 Argent MCP 服务器,并将其技能和代理定义复制到你的工作区中。
🌐 From your Expo project's root directory, run the init command. The wizard detects your editor, registers the Argent MCP server, and copies its skills and agent definitions into your workspace.
- npx @swmansion/argent init你的编辑器通过 argent 命令启动 Argent MCP 服务器,因此请全局安装 Argent 并确保该命令在你的 PATH 上。然后重启你的编辑器,以便它获取新的配置。
🌐 Your editor launches the Argent MCP server with the argent command, so install Argent globally and make sure that command is on your PATH. Then restart your editor so it picks up the new configuration.
- npm install -g @swmansion/argent2
在模拟器或模拟器上运行你的应用
🌐 Run your app on an emulator or simulator
Argent 在运行的应用上操作,因此请在 Android 模拟器或 iOS 模拟器上启动你的 Expo 应用。使用开发版本或在 Expo Go 中测试,并确保开发服务器正在运行。
🌐 Argent acts on a running app, so start your Expo app on an Android Emulator or iOS Simulator. Use a development build or test in Expo Go, with the development server running.
# Run a development build on an emulator or simulator- npx expo run:android- npx expo run:ios# Or start the development server and test in Expo Go- npx expo start3
4
验证设置
🌐 Verify setup
在你的代理面板中,输入以下提示以确认 Argent 可以访问正在运行的应用:
🌐 In your agent panel, enter the following prompt to confirm Argent can reach the running app:
Take a screenshot of the running app and describe what's on screen.
如果代理返回截图并描述你应用的当前屏幕,则 Argent 已正确连接。
🌐 If the agent returns a screenshot and describes your app's current screen, Argent is connected correctly.
Arget让你的代理做什么
🌐 What Argent lets your agent do
连接后,你的代理可以在模拟器或模拟器上的实时应用上工作:
🌐 Once connected, your agent can work against the live app on the emulator or simulator:
- 控制:启动应用,点击,滑动,在字段中输入,打开深层链接,并通过辅助功能树导航以运行多步流程。
- 调试:读取控制台日志,探索视图层次结构,检查 React 组件树,并在 JavaScript 和原生层面检查网络请求及其负载。
- 简介:将 React 和原生性能概况一起记录,追踪导致慢 React 提交的原生堆栈帧,并显示 UI 卡顿、渲染级联和内存泄漏。
示例提示
🌐 Example prompts
设置完成后,用简单的语言描述任务。例如:
🌐 After setup, describe tasks in plain language. For example:
| 任务 | 示例提示 |
|---|---|
| 流程冒烟测试 | 启动应用,点击完成新手引导,并告诉我从日志中哪里出错。 |
| 验证界面 | 截取主屏幕的截图,并确认产品列表已渲染。 |
| 调试网络请求 | 打开购物车界面,向我展示失败的请求及其响应内容。 |
| 检查 React 状态 | 打开设置界面,向我展示切换行的 React 组件树。 |
| 分析性能下降 | 分析滚动产品列表的性能,并指出最慢的提交。 |
| 测试深度链接 | 通过深度链接打开应用,并确认加载了正确的界面。 |
将 Argent 与其他 Expo AI 工具一起使用
🌐 Use Argent with the rest of the Expo AI tooling
Argent 通过 MCP 连接,因此它可以与 Expo 自有的代理工具一起使用。将其与 Expo Skills 和 Expo MCP 服务器配合使用,这样你的代理在 Argent 驱动应用时就能了解 Expo 的约定。
🌐 Argent connects through MCP, so it works alongside Expo's own agent tooling. Pair it with Expo Skills and the Expo MCP Server so your agent knows Expo conventions while Argent drives the app.
连接远程 Expo MCP 服务器以让代理实时访问 Expo 文档和 EAS。
安装教授代理已知良好 Expo 模式的插件。
管理银币
🌐 Manage Argent
# Refresh to the latest version and configuration- argent update# List feature flags and their state- argent flags# Unregister the MCP server and remove Argent- argent remove限制与提示
🌐 Limitations and tips
- Argent 支持 Android 模拟器和 iOS 模拟器。
- 让 Argent 在可以的时候在设备上启动或重新启动应用。如果你自己启动设备,Argent 可能无法看到系统对话框或原生模态窗口。
- 在 Expo Go 中,Argent 可以控制应用、读取 React 组件树并运行 React 性能分析器。原生性能分析需要开发版本,因为在 Expo Go 中它分析的是 Expo Go 主机应用,而不是你的代码。
- React 组件树和 React 分析器依赖于 JavaScript 调试连接,因此请保持开发服务器运行。
- 有关完整和最新的功能列表,请参见 Argent 文档。