Metadata-Version: 2.4
Name: perfdog-service-cli
Version: 1.0.5
Summary: PerfDog Service CLI - 命令行性能测试工具（供 AI/自动化脚本使用）
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: click>=8.1.0
Requires-Dist: grpcio>=1.60.0
Requires-Dist: protobuf>=4.25.0
Requires-Dist: pyyaml>=6.0.2
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"

# perfdog-service-cli

PerfDog Service 命令行性能测试工具 — 供 AI Agent / 自动化脚本使用。

## 安装

```bash
pip install perfdog-service-cli --extra-index-url https://<username>:<token>@mirrors.tencent.com/repository/pypi/tencent_pypi/simple
```

## 快速开始

```bash
# 连接 PerfDog Service
perfdog-service connect --token YOUR_TOKEN

# 查看设备列表
perfdog-service devices

# 一键测试应用
perfdog-service test-app -d DEVICE_ID -p com.example.app --duration 60

# 手动控制测试流程（供 AI 编排）
perfdog-service start -d DEVICE_ID --package com.example.app
perfdog-service label -d DEVICE_ID -n "场景1"
perfdog-service stop -d DEVICE_ID
perfdog-service save -d DEVICE_ID --case-name "v1.0测试"
```

## 命令列表

| 类别 | 命令 | 说明 |
|------|------|------|
| 连接 | `connect` | 连接 PerfDog Service |
| 设备 | `devices` | 获取设备列表 |
| | `init-device` | 初始化设备 |
| | `status` | 获取设备状态 |
| | `device-info` | 获取设备详细信息 |
| | `cpu-info` | 获取 CPU 信息 |
| 应用 | `apps` | 获取应用列表 |
| | `app-processes` | 获取指定应用的运行进程列表 |
| | `processes` | 获取系统进程列表 |
| | `install-app` | 安装应用到设备 |
| | `uninstall-app` | 卸载设备上的应用 |
| 沙盒 | `sandbox-mkdir` | 在应用沙盒中创建目录 |
| | `sandbox-rmdir` | 删除应用沙盒中的目录 |
| | `sandbox-upload` | 上传文件到应用沙盒 |
| | `sandbox-rm` | 删除应用沙盒中的文件 |
| 一键测试 | `test-app` | 一键测试应用 |
| | `test-windows` | 一键测试 Windows 进程 |
| | `test-console` | 一键测试游戏主机 |
| | `test-network` | 弱网测试 |
| 手动控制 | `start` | 开始测试 |
| | `stop` | 停止测试 |
| | `save` | 保存数据 |
| | `label` | 添加标签 |
| | `note` | 添加注释 |
| | `update-label` | 修改标签 |
| | `remove-note` | 删除注释 |
| 配置 | `preferences` | 设置偏好（APK 安装等） |
| | `available-types` | 查看支持的数据类型 |
| | `enabled-types` | 查看已启用的类型 |
| | `set-screenshot-interval` | 设置截图间隔 |
| | `set-memory-freq` | 设置内存采样频率 |
| 弱网 | `network-templates` | 查看网络模板 |
| | `change-network-template` | 切换网络模板 |
| | `submit-network-template` | 创建网络模板 |
| | `delete-network-template` | 删除网络模板 |
| 高级 | `add-console` | 添加主机设备 |
| | `refresh-remote` | 刷新远程设备 |
| | `check-occupied` | 检查设备占用 |
| | `render-resolution` | 获取渲染分辨率 |
| | `unreal-report` | Unreal 内存报告 |
| | `launch-remote-collector` | 启动远程收集器 |
| | `set-upload-server` | 设置数据上传服务器 |
| | `clear-upload-server` | 清除数据上传服务器 |
| 管理 | `create-task` | 创建任务 |
| | `archive-case` | 归档用例 |
| | `share-case` | 分享用例 |
| | `kill` | 关闭 Service |

## 架构

```
perfdog_service_cli/
├── cli/              # Click 命令定义
│   ├── main.py       # Click 原子命令
│   └── output.py     # 终端格式化
├── service/          # gRPC 通信层
│   ├── service_client.py   # gRPC 客户端
│   ├── service_ops.py      # 原子操作（序列化边界）
│   ├── perfdog_pb2.py      # protobuf
│   └── perfdog_pb2_grpc.py # gRPC stub
└── common/           # 配置 + 日志
    ├── config.py
    └── log.py
```
