moai-domain-adb
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesemoai-domain-adb: ADB Automation Domain Specialist
moai-domain-adb: ADB自动化领域专家
Tier 3 Modularized Skill for intelligent Android automation, game bot development, and real-time device orchestration.
三级模块化技能,适用于智能Android自动化、游戏机器人开发和实时设备编排。
🎯 Quick Reference
🎯 快速参考
Core Competencies
核心能力
| Domain | Capability | Module |
|---|---|---|
| Device Control | ADB connection, shell execution, property inspection | adb-fundamentals |
| Device Management | Multi-device orchestration, state tracking, lifecycle | device-management |
| Game Automation | Bot scripting, action sequences, timing control | game-automation |
| Vision & Detection | Template matching, OCR, region-based detection | computer-vision |
| Tauri Integration | UI-Python bridge, real-time communication, deployment | tauri-integration |
| 领域 | 能力 | 模块 |
|---|---|---|
| 设备控制 | ADB连接、Shell执行、属性检查 | adb-fundamentals |
| 设备管理 | 多设备编排、状态跟踪、生命周期管理 | device-management |
| 游戏自动化 | 机器人脚本编写、动作序列、时序控制 | game-automation |
| 视觉与检测 | 模板匹配、OCR、基于区域的检测 | computer-vision |
| Tauri集成 | UI-Python桥接、实时通信、部署 | tauri-integration |
Key Functions (Quick Access)
关键功能(快速访问)
Device Operations
python
undefined设备操作
python
undefinedCheck device status
检查设备状态
adb devices --list-long
adb devices --list-long
Execute shell command
执行Shell命令
adb shell input tap 540 960
adb shell input tap 540 960
Get device property
获取设备属性
adb shell getprop ro.build.version.sdk
adb shell getprop ro.build.version.sdk
Install APK
安装APK
adb install -r game.apk
**Bot Control**
```pythonadb install -r game.apk
**机器人控制**
```pythonStart bot
启动机器人
adb shell am start -n com.game/.MainActivity
adb shell am start -n com.game/.MainActivity
Send input sequence
发送输入序列
adb shell input tap x y && sleep 1 && adb shell input tap x2 y2
adb shell input tap x y && sleep 1 && adb shell input tap x2 y2
Capture screenshot
捕获截图
adb shell screencap -p /sdcard/screen.png
**Module Selection Guide**
Use when you need to...
- **Understand ADB fundamentals**: Load `adb-fundamentals` module
- Connection protocols, authentication, basic shell operations
- Device discovery, property reading, system interaction
- **Manage multiple devices**: Load `device-management` module
- Device state tracking, connection pooling, failover strategies
- Batch operations, monitoring, lifecycle management
- **Develop game bots**: Load `game-automation` module
- Click sequences, timing, OCR parsing, state detection
- Custom routines, action templates, bot patterns
- **Use vision for detection**: Load `computer-vision` module
- Template matching (OpenCV), OCR (Tesseract)
- Region-based detection, image analysis, pattern recognition
- **Integrate with Tauri UI**: Load `tauri-integration` module
- Real-time bot status updates, command queueing
- UI ↔ Python communication, resource management
---adb shell screencap -p /sdcard/screen.png
**模块选择指南**
当你需要以下能力时使用对应模块...
- **了解ADB基础**: 加载 `adb-fundamentals` 模块
- 连接协议、身份验证、基础Shell操作
- 设备发现、属性读取、系统交互
- **管理多台设备**: 加载 `device-management` 模块
- 设备状态跟踪、连接池、故障转移策略
- 批量操作、监控、生命周期管理
- **开发游戏机器人**: 加载 `game-automation` 模块
- 点击序列、时序控制、OCR解析、状态检测
- 自定义流程、动作模板、机器人模式
- **使用视觉检测**: 加载 `computer-vision` 模块
- 模板匹配(OpenCV)、OCR(Tesseract)
- 基于区域的检测、图像分析、模式识别
- **与Tauri UI集成**: 加载 `tauri-integration` 模块
- 实时机器人状态更新、命令排队
- UI ↔ Python通信、资源管理
---📚 Implementation Guide
📚 实施指南
Architecture Overview
架构概述
moai-domain-adb follows a 5-module progressive disclosure pattern:
moai-domain-adb/
├── SKILL.md # This file (documentation hub)
├── modules/
│ ├── adb-fundamentals.md # Level 1: Core ADB operations
│ ├── device-management.md # Level 2: Multi-device orchestration
│ ├── game-automation.md # Level 3: Bot development patterns
│ ├── computer-vision.md # Level 4: Vision-based detection
│ └── tauri-integration.md # Level 5: UI orchestration
└── scripts/ # IndieDevDan UV scripts
├── adb_device_analyzer.py # Analyze device capabilities
├── adb_bot_generator.py # Generate bot skeletons
├── adb_template_creator.py # Create action templates
├── adb_performance_profiler.py # Profile bot performance
├── adb_config_validator.py # Validate configurations
├── adb_game_tester.py # Test bot on devices
└── adb_deployment_helper.py # Deploy to productionmoai-domain-adb 遵循5模块渐进式披露模式:
moai-domain-adb/
├── SKILL.md # 本文档(文档中心)
├── modules/
│ ├── adb-fundamentals.md # 第1级:核心ADB操作
│ ├── device-management.md # 第2级:多设备编排
│ ├── game-automation.md # 第3级:机器人开发模式
│ ├── computer-vision.md # 第4级:基于视觉的检测
│ └── tauri-integration.md # 第5级:UI编排
└── scripts/ # IndieDevDan UV脚本
├── adb_device_analyzer.py # 分析设备能力
├── adb_bot_generator.py # 生成机器人骨架
├── adb_template_creator.py # 创建动作模板
├── adb_performance_profiler.py # 分析机器人性能
├── adb_config_validator.py # 验证配置
├── adb_game_tester.py # 在设备上测试机器人
└── adb_deployment_helper.py # 部署到生产环境Tier 3 Characteristics
三级技能特性
✅ Modularized: 5 independent modules (no cross-module imports)
✅ Production-Ready: 500+ line SKILL.md with comprehensive docs
✅ Scripted: 7 UV scripts following IndieDevDan 13 rules
✅ Delegatable: Works with expert-* and manager-* agents
✅ Reusable: Applicable to any Android automation project
✅ 模块化: 5个独立模块(无跨模块导入)
✅ 生产就绪: 超过500行的SKILL.md,包含全面文档
✅ 脚本化: 7个遵循IndieDevDan 13条规则的UV脚本
✅ 可委托: 可与expert-*和manager-*类型Agent协作
✅ 可复用: 适用于任何Android自动化项目
Usage Pattern
使用模式
python
undefinedpython
undefinedPattern 1: Load skill for general ADB knowledge
模式1:加载技能以获取通用ADB知识
Skill("moai-domain-adb")
Skill("moai-domain-adb")
Pattern 2: Load specific module for targeted expertise
模式2:加载特定模块以获取针对性专业能力
In agent prompt: "Use moai-domain-adb:adb-fundamentals for device operations"
在Agent提示中:"使用moai-domain-adb:adb-fundamentals进行设备操作"
Pattern 3: Reference UV script for automated tasks
模式3:参考UV脚本执行自动化任务
Command: uv run .claude/skills/moai-domain-adb/scripts/adb_device_analyzer.py --device emulator-5554
命令:uv run .claude/skills/moai-domain-adb/scripts/adb_device_analyzer.py --device emulator-5554
undefinedundefinedIntegration Points
集成点
With Agents:
- : Executes bots using game-automation patterns
adb-bot-runner - : Manages devices using device-management expertise
adb-device-manager - : Tests bots using computer-vision and game-automation
adb-game-tester - : Validates configs using config-validator script
adb-config-manager - : Coordinates all agents using tauri-integration patterns
adb-workflow-orchestrator
With Commands:
- → Uses adb-fundamentals + adb_device_analyzer
/adb:init - → Uses game-automation + adb_bot_generator
/adb:bot - → Uses computer-vision + adb_game_tester
/adb:test - → Uses tauri-integration + adb_deployment_helper
/adb:deploy
With UV Scripts:
All 7 scripts are self-contained (zero dependencies on each other), follow PEP 723, and implement dual output (human-readable + JSON).
与Agent集成:
- : 使用game-automation模式执行机器人
adb-bot-runner - : 使用device-management能力管理设备
adb-device-manager - : 使用computer-vision和game-automation测试机器人
adb-game-tester - : 使用config-validator脚本验证配置
adb-config-manager - : 使用tauri-integration模式协调所有Agent
adb-workflow-orchestrator
与命令集成:
- → 使用adb-fundamentals + adb_device_analyzer
/adb:init - → 使用game-automation + adb_bot_generator
/adb:bot - → 使用computer-vision + adb_game_tester
/adb:test - → 使用tauri-integration + adb_deployment_helper
/adb:deploy
与UV脚本集成:
所有7个脚本都是独立的(彼此无依赖),遵循PEP 723标准,并实现双输出(人类可读格式 + JSON格式)。
Progressive Disclosure Strategy
渐进式学习策略
Level 1: Getting Started
- Read: adb-fundamentals module
- Run: to list devices
adb_device_analyzer.py - Understand: Basic device connection and property reading
Level 2: Multi-Device Workflows
- Read: device-management module
- Understand: Connection pooling, state tracking, failover
- Build: Scripts that manage 5+ devices simultaneously
Level 3: Game Bot Development
- Read: game-automation module
- Understand: Click sequences, timing control, OCR integration
- Build: Custom routines for game-specific tasks
Level 4: Vision-Based Automation
- Read: computer-vision module
- Understand: Template matching, OCR parsing, region detection
- Build: Bots that adapt to UI changes dynamically
Level 5: Production Orchestration
- Read: tauri-integration module
- Understand: Real-time UI updates, command queuing, resource management
- Build: Enterprise workflows with Tauri UI control
第1级:入门
- 阅读:adb-fundamentals模块
- 运行:列出设备
adb_device_analyzer.py - 掌握:基础设备连接和属性读取
第2级:多设备工作流
- 阅读:device-management模块
- 掌握:连接池、状态跟踪、故障转移
- 构建:可同时管理5台以上设备的脚本
第3级:游戏机器人开发
- 阅读:game-automation模块
- 掌握:点击序列、时序控制、OCR集成
- 构建:针对特定游戏任务的自定义流程
第4级:基于视觉的自动化
- 阅读:computer-vision模块
- 掌握:模板匹配、OCR解析、区域检测
- 构建:可动态适配UI变化的机器人
第5级:生产环境编排
- 阅读:tauri-integration模块
- 掌握:实时UI更新、命令排队、资源管理
- 构建:带有Tauri UI控制的企业级工作流
🚀 Advanced Topics
🚀 高级主题
Skill Composition Strategy
技能组合策略
moai-domain-adb is designed for modular composition:
python
undefinedmoai-domain-adb 专为模块化组合设计:
python
undefinedExample 1: Simple device check
示例1:简单设备检查
Required: adb-fundamentals
所需模块:adb-fundamentals
agent = Task(
subagent_type="expert-backend",
prompt="Use moai-domain-adb:adb-fundamentals to list ADB devices"
)
agent = Task(
subagent_type="expert-backend",
prompt="使用moai-domain-adb:adb-fundamentals列出ADB设备"
)
Example 2: Multi-device bot deployment
示例2:多设备机器人部署
Required: device-management + game-automation + tauri-integration
所需模块:device-management + game-automation + tauri-integration
agent = Task(
subagent_type="adb-workflow-orchestrator",
prompt="Deploy game bot to 3 devices"
)
agent = Task(
subagent_type="adb-workflow-orchestrator",
prompt="将游戏机器人部署到3台设备"
)
Example 3: Vision-based testing
示例3:基于视觉的测试
Required: computer-vision + game-automation
所需模块:computer-vision + game-automation
agent = Task(
subagent_type="adb-game-tester",
prompt="Test bot with computer vision verification"
)
undefinedagent = Task(
subagent_type="adb-game-tester",
prompt="使用计算机视觉验证测试机器人"
)
undefinedPerformance Optimization
性能优化
Device Batching:
- Group commands by device to reduce round-trip latency
- Use to identify bottlenecks
adb_performance_profiler.py - Target: Execute 100 actions in <5 seconds
Caching Strategies:
- Cache device properties (refreshed every 60s)
- Cache template images (refreshed on detection failure)
- Cache bot configurations (invalidated on user edit)
Concurrency:
- Run multi-device operations with ThreadPoolExecutor
- Limit to 5 concurrent ADB operations per host
- Use queuing for >5 devices
设备批处理:
- 按设备分组命令以减少往返延迟
- 使用 识别瓶颈
adb_performance_profiler.py - 目标:在5秒内执行100个动作
缓存策略:
- 缓存设备属性(每60秒刷新一次)
- 缓存模板图像(检测失败时刷新)
- 缓存机器人配置(用户编辑时失效)
并发处理:
- 使用ThreadPoolExecutor执行多设备操作
- 限制每台主机最多5个并发ADB操作
- 超过5台设备时使用排队机制
Security Considerations
安全注意事项
Authentication:
- ADB uses RSA key exchange; validate device certificates
- Never store unencrypted device pairing keys
- Rotate pairing keys quarterly for production devices
Permissions:
- Request minimal shell commands (avoid unless necessary)
su - Use app-specific commands instead of root access
- Audit bot actions for unintended side effects
Data Protection:
- Never capture sensitive data in screenshots
- Encrypt stored configurations containing API keys
- Use secure storage for game credentials
身份验证:
- ADB使用RSA密钥交换;验证设备证书
- 绝不存储未加密的设备配对密钥
- 生产设备每季度轮换一次配对密钥
权限:
- 请求最小权限的Shell命令(除非必要,避免使用)
su - 使用应用特定命令而非root权限
- 审核机器人操作以避免意外副作用
数据保护:
- 绝不在截图中捕获敏感数据
- 对包含API密钥的存储配置进行加密
- 使用安全存储保存游戏凭据
Debugging & Troubleshooting
调试与故障排除
Common Issues:
| Issue | Diagnosis | Solution |
|---|---|---|
| Device not found | | Verify USB connection, check ADB daemon |
| Slow bot execution | | Reduce click delays, batch operations |
| Template matching fails | Check image DPI/resolution | Run |
| OCR accuracy poor | Preprocess image (contrast, threshold) | See computer-vision module for tips |
| Tauri communication lag | Check Python process CPU | Reduce log verbosity, optimize render loop |
Debug Mode:
bash
undefined常见问题:
| 问题 | 诊断 | 解决方案 |
|---|---|---|
| 设备未找到 | | 验证USB连接,检查ADB守护进程 |
| 机器人执行缓慢 | | 减少点击延迟,批量操作 |
| 模板匹配失败 | 检查图像DPI/分辨率 | 运行 |
| OCR准确率低 | 预处理图像(对比度、阈值) | 查看computer-vision模块获取技巧 |
| Tauri通信延迟 | 检查Python进程CPU使用率 | 减少日志冗余,优化渲染循环 |
调试模式:
bash
undefinedEnable verbose logging
启用详细日志
export ADB_DEBUG=1
uv run .claude/skills/moai-domain-adb/scripts/adb_device_analyzer.py --verbose
export ADB_DEBUG=1
uv run .claude/skills/moai-domain-adb/scripts/adb_device_analyzer.py --verbose
Trace ADB commands
跟踪ADB命令
adb logcat | grep "adb_bot_runner"
undefinedadb logcat | grep "adb_bot_runner"
undefinedTesting Strategy (TRUST 5 Framework)
测试策略(TRUST 5框架)
Test Coverage Target: ≥85%
- Unit Tests: Individual module functions (py.test)
- Integration Tests: Module interactions (device mock)
- E2E Tests: Full workflow with real devices (optional)
- Performance Tests: Execution time benchmarks
- Security Tests: Input validation, permission checks
Test Execution:
bash
undefined测试覆盖率目标: ≥85%
- 单元测试: 单个模块功能(py.test)
- 集成测试: 模块间交互(设备模拟)
- 端到端测试: 使用真实设备的完整工作流(可选)
- 性能测试: 执行时间基准测试
- 安全测试: 输入验证、权限检查
测试执行:
bash
undefinedRun all tests
运行所有测试
pytest tests/ -v --cov=.claude/skills/moai-domain-adb
pytest tests/ -v --cov=.claude/skills/moai-domain-adb
Run specific module tests
运行特定模块测试
pytest tests/test_device_management.py -v
pytest tests/test_device_management.py -v
Profile performance
性能分析
pytest tests/ --benchmark-only
---pytest tests/ --benchmark-only
---📖 Module Navigation
📖 模块导航
Each module builds upon previous knowledge but is independently usable:
-
adb-fundamentals (250 lines)
- ADB architecture, connection protocols, device discovery
- Shell execution, property reading, device interaction
-
device-management (280 lines)
- Multi-device orchestration, state tracking, connection pooling
- Lifecycle management, monitoring, failover strategies
-
game-automation (300 lines)
- Bot scripting patterns, click sequences, timing control
- OCR integration, state detection, action templates
-
computer-vision (270 lines)
- Template matching (OpenCV), OCR (Tesseract)
- Region detection, image preprocessing, pattern recognition
-
tauri-integration (240 lines)
- Tauri-Python IPC, real-time updates, command queueing
- Resource management, deployment strategies, monitoring
每个模块都基于之前的知识构建,但也可独立使用:
-
adb-fundamentals(250行)
- ADB架构、连接协议、设备发现
- Shell执行、属性读取、设备交互
-
device-management(280行)
- 多设备编排、状态跟踪、连接池
- 生命周期管理、监控、故障转移策略
-
game-automation(300行)
- 机器人脚本编写模式、点击序列、时序控制
- OCR集成、状态检测、动作模板
-
computer-vision(270行)
- 模板匹配(OpenCV)、OCR(Tesseract)
- 区域检测、图像预处理、模式识别
-
tauri-integration(240行)
- Tauri-Python进程间通信、实时更新、命令排队
- 资源管理、部署策略、监控
🛠️ Scripts & Tools
🛠️ 脚本与工具
All scripts follow IndieDevDan 13 Rules (PEP 723, 9-section structure, dual output):
bash
undefined所有脚本均遵循IndieDevDan 13条规则(PEP 723、9节结构、双输出):
bash
undefinedAnalyze device capabilities
分析设备能力
uv run scripts/adb_device_analyzer.py --device emulator-5554 --json
uv run scripts/adb_device_analyzer.py --device emulator-5554 --json
Generate bot skeleton
生成机器人骨架
uv run scripts/adb_bot_generator.py --game "My Game" --output my_bot.py
uv run scripts/adb_bot_generator.py --game "我的游戏" --output my_bot.py
Create action template
创建动作模板
uv run scripts/adb_template_creator.py --screenshot screen.png --region "0,0,1080,1920"
uv run scripts/adb_template_creator.py --screenshot screen.png --region "0,0,1080,1920"
Profile bot performance
分析机器人性能
uv run scripts/adb_performance_profiler.py --bot bot.py --iterations 100
uv run scripts/adb_performance_profiler.py --bot bot.py --iterations 100
Validate configuration
验证配置
uv run scripts/adb_config_validator.py --config config.yaml --strict
uv run scripts/adb_config_validator.py --config config.yaml --strict
Test bot on device
在设备上测试机器人
uv run scripts/adb_game_tester.py --bot bot.py --device emulator-5554
uv run scripts/adb_game_tester.py --bot bot.py --device emulator-5554
Prepare deployment
准备部署
uv run scripts/adb_deployment_helper.py --bot bot.py --target production
undefineduv run scripts/adb_deployment_helper.py --bot bot.py --target production
undefinedComplete Scripts Reference (36 scripts)
完整脚本参考(36个脚本)
All scripts are located in directory and organized by category. Each script supports:
scripts/- - Specify device ID (defaults to first connected)
--device/-d - - Output in TOON/YAML format for automation
--toon - - Enable verbose logging
--verbose/-v - - Show detailed help and usage examples
--help
See scripts/README.md for comprehensive documentation with 150+ usage examples.
所有脚本位于 目录,按类别组织。每个脚本支持:
scripts/- - 指定设备ID(默认使用第一个连接的设备)
--device/-d - - 输出TOON/YAML格式以用于自动化和解析
--toon - - 启用详细日志
--verbose/-v - - 显示详细帮助和使用示例
--help
查看 scripts/README.md 获取包含150+使用示例的全面文档。
🔌 Connection (4 scripts)
🔌 连接类(4个脚本)
Location:
scripts/connection/| Script | Purpose | Key Options | Example |
|---|---|---|---|
| Connect to device via IP:port | | |
| Disconnect device gracefully | | |
| Restart ADB server | | |
| List all devices and status | | |
位置:
scripts/connection/| 脚本 | 用途 | 关键选项 | 示例 |
|---|---|---|---|
| 通过IP:port连接设备 | | |
| 优雅断开设备连接 | | |
| 重启ADB服务器 | | |
| 列出所有设备及其状态 | | |
📱 Screen (6 scripts)
📱 屏幕操作类(6个脚本)
Location:
scripts/screen/| Script | Purpose | Key Options | Example |
|---|---|---|---|
| Capture screenshot | | |
| Tap at coordinates | | |
| Swipe gesture | | |
| Send key event | | |
| Type text | | |
| Record screen video | | |
位置:
scripts/screen/| 脚本 | 用途 | 关键选项 | 示例 |
|---|---|---|---|
| 捕获截图 | | |
| 在指定坐标点击 | | |
| 执行滑动手势 | | |
| 发送按键事件 | | |
| 输入文本 | | |
| 录制屏幕视频 | | |
📦 App (5 scripts)
📦 应用操作类(5个脚本)
Location:
scripts/app/| Script | Purpose | Key Options | Example |
|---|---|---|---|
| List installed apps | | |
| Start app by package | | |
| Force stop app | | |
| Install APK | | |
| Uninstall app | | |
位置:
scripts/app/| 脚本 | 用途 | 关键选项 | 示例 |
|---|---|---|---|
| 列出已安装应用 | | |
| 通过包名启动应用 | | |
| 强制停止应用 | | |
| 安装APK | | |
| 卸载应用 | | |
ℹ️ Info (4 scripts)
ℹ️ 信息查询类(4个脚本)
Location:
scripts/info/| Script | Purpose | Key Options | Example |
|---|---|---|---|
| Device specifications | | |
| Display resolution/DPI | | |
| Current foreground app | | |
| Battery status | | |
位置:
scripts/info/| 脚本 | 用途 | 关键选项 | 示例 |
|---|---|---|---|
| 获取设备规格 | | |
| 获取显示分辨率/DPI | | |
| 获取当前前台应用 | | |
| 获取电池状态 | | |
⚡ Performance (3 scripts)
⚡ 性能监控类(3个脚本)
Location:
scripts/performance/| Script | Purpose | Key Options | Example |
|---|---|---|---|
| Real-time CPU monitoring | | |
| Memory usage monitoring | | |
| Filter logcat logs | | |
位置:
scripts/performance/| 脚本 | 用途 | 关键选项 | 示例 |
|---|---|---|---|
| 实时CPU监控 | | |
| 内存使用监控 | | |
| 过滤logcat日志 | | |
🤖 Automation (4 scripts)
🤖 自动化类(4个脚本)
Location:
scripts/automation/| Script | Purpose | Key Options | Example |
|---|---|---|---|
| Execute repeating sequence | | |
| Wait for app to start | | |
| Execute sequence once | | |
| Compare screenshots | | |
位置:
scripts/automation/| 脚本 | 用途 | 关键选项 | 示例 |
|---|---|---|---|
| 执行重复动作序列 | | |
| 等待应用启动 | | |
| 执行单次动作序列 | | |
| 对比截图 | | |
🛠️ Utils (3 scripts)
🛠️ 工具类(3个脚本)
Location:
scripts/utils/| Script | Purpose | Key Options | Example |
|---|---|---|---|
| Execute shell commands | | |
| Push file to device | | |
| Pull file from device | | |
位置:
scripts/utils/| 脚本 | 用途 | 关键选项 | 示例 |
|---|---|---|---|
| 执行Shell命令 | | |
| 推送文件到设备 | | |
| 从设备拉取文件 | | |
🔧 Monitoring (7 scripts)
🔧 监控与生成类(7个脚本)
Location: (root level)
scripts/| Script | Purpose | Key Options | Example |
|---|---|---|---|
| Generate bot scripts | | |
| Validate configs | | |
| Deploy to devices | | |
| Analyze capabilities | | |
| Test game automation | | |
| Profile performance | | |
| Create templates | | |
位置: (根目录)
scripts/| 脚本 | 用途 | 关键选项 | 示例 |
|---|---|---|---|
| 生成机器人脚本 | | |
| 验证配置 | | |
| 部署到设备 | | |
| 分析设备能力 | | |
| 测试游戏自动化 | | |
| 分析性能 | | |
| 创建模板 | | |
JSON Sequence Format (Automation Scripts)
JSON序列格式(自动化脚本)
For and , use JSON format:
adb_game_loop.pyadb_click_sequence.pyjson
{
"name": "Daily Quest Automation",
"steps": [
{"action": "tap", "x": 500, "y": 1000, "delay": 2},
{"action": "swipe", "start": [500, 1500], "end": [500, 500], "duration": 300},
{"action": "wait", "duration": 3},
{"action": "screenshot", "output": "/tmp/check.png"},
{"action": "keyevent", "key": "back"},
{"action": "text_input", "text": "Hello World"}
]
}Supported Actions: tap, swipe, wait, screenshot, keyevent, text_input
对于 和 ,请使用以下JSON格式:
adb_game_loop.pyadb_click_sequence.pyjson
{
"name": "日常任务自动化",
"steps": [
{"action": "tap", "x": 500, "y": 1000, "delay": 2},
{"action": "swipe", "start": [500, 1500], "end": [500, 500], "duration": 300},
{"action": "wait", "duration": 3},
{"action": "screenshot", "output": "/tmp/check.png"},
{"action": "keyevent", "key": "back"},
{"action": "text_input", "text": "Hello World"}
]
}支持的动作: tap(点击), swipe(滑动), wait(等待), screenshot(截图), keyevent(按键事件), text_input(文本输入)
Common Utilities
通用工具类
All scripts use shared utilities from :
scripts/common/- - ADB device operations and connection management
adb_utils.py - - Click decorators, Rich formatters, output helpers
cli_utils.py - - Standardized error handling and exit codes (0, 2, 3, 4)
error_handlers.py - - Project root detection and path resolution
path_utils.py
所有脚本使用 中的共享工具:
scripts/common/- - ADB设备操作和连接管理
adb_utils.py - - Click装饰器、Rich格式化器、输出助手
cli_utils.py - - 标准化错误处理和退出码(0, 2, 3, 4)
error_handlers.py - - 项目根目录检测和路径解析
path_utils.py
Exit Codes
退出码
All scripts use standardized exit codes:
- 0 - Success
- 2 - Device offline or not found
- 3 - ADB command failed or execution error
- 4 - Invalid argument or configuration
所有脚本使用标准化退出码:
- 0 - 成功
- 2 - 设备离线或未找到
- 3 - ADB命令失败或执行错误
- 4 - 参数或配置无效
Output Formats
输出格式
Text Output (default): Rich-formatted console output with colors and tables
TOON Output (): YAML/structured format for automation and parsing
--toon文本输出(默认):带颜色和表格的Rich格式控制台输出
TOON输出():YAML/结构化格式,适用于自动化和解析
--toon📞 Support & References
📞 支持与参考
Quick Links:
- Modules: See individual module files in
modules/ - Scripts: See individual scripts in with
scripts/--help - Examples: See integration patterns in adb-* agents
- Tests: See test suite in
tests/
Context7 References:
- Android ADB Protocol (Android Developers)
- Python ADB Library (Google GitHub)
- OpenCV Documentation (OpenCV Docs)
- Tesseract OCR (GitHub)
Version: 1.0.0
Status: ✅ Production Ready (Phase 1 Foundation)
Last Updated: 2025-12-01
Next Phase: Create 5 core modules + 7 UV scripts
快速链接:
- 模块: 查看 中的各个模块文件
modules/ - 脚本: 查看 中的各个脚本,使用
scripts/获取帮助--help - 示例: 查看adb-*类型Agent中的集成模式
- 测试: 查看 中的测试套件
tests/
Context7参考资料:
- Android ADB协议(Android开发者官网)
- Python ADB库(Google GitHub)
- OpenCV文档(OpenCV官网)
- Tesseract OCR(GitHub)
版本: 1.0.0
状态: ✅ 生产就绪(第一阶段基础版)
最后更新: 2025-12-01
下一阶段: 创建5个核心模块 + 7个UV脚本