tars-cli 0.1.0__tar.gz → 0.1.2__tar.gz
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.
- tars_cli-0.1.2/PKG-INFO +198 -0
- tars_cli-0.1.2/README.md +178 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/pyproject.toml +3 -1
- tars_cli-0.1.2/tars_cli.egg-info/PKG-INFO +198 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli.egg-info/SOURCES.txt +1 -0
- tars_cli-0.1.0/PKG-INFO +0 -18
- tars_cli-0.1.0/tars_cli.egg-info/PKG-INFO +0 -18
- {tars_cli-0.1.0 → tars_cli-0.1.2}/setup.cfg +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/__init__.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/__main__.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/app.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/auth.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/client.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/commands/__init__.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/commands/auth_cmd.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/commands/dataset_cmd.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/commands/eval_cmd.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/commands/plugin_cmd.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/commands/template_cmd.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/config.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/hints.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/output.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/utils/__init__.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/utils/polling.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli/utils/progress.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli.egg-info/dependency_links.txt +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli.egg-info/entry_points.txt +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli.egg-info/requires.txt +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tars_cli.egg-info/top_level.txt +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tests/test_auth.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tests/test_client.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tests/test_config.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tests/test_hints.py +0 -0
- {tars_cli-0.1.0 → tars_cli-0.1.2}/tests/test_output.py +0 -0
tars_cli-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tars-cli
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: tars 平台命令行工具
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: typer>=0.12
|
|
8
|
+
Requires-Dist: httpx>=0.27
|
|
9
|
+
Requires-Dist: rich>=13.0
|
|
10
|
+
Requires-Dist: pyyaml>=6.0
|
|
11
|
+
Requires-Dist: platformdirs>=4.0
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
14
|
+
Requires-Dist: pytest-mock>=3.12; extra == "dev"
|
|
15
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
16
|
+
Requires-Dist: respx>=0.21; extra == "dev"
|
|
17
|
+
Requires-Dist: mypy>=1.8; extra == "dev"
|
|
18
|
+
Requires-Dist: ruff>=0.3; extra == "dev"
|
|
19
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
20
|
+
|
|
21
|
+
# tars-cli
|
|
22
|
+
|
|
23
|
+
tars 平台命令行工具,支持插件导入、数据集管理、评估执行和报告导出。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install tars-cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 安装验证
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
$ tars --version
|
|
35
|
+
tars-cli 0.1.1
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 升级
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install --upgrade tars-cli
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 环境要求
|
|
45
|
+
|
|
46
|
+
- Python >= 3.11
|
|
47
|
+
- 依赖:typer >= 0.12, httpx >= 0.27, rich >= 13.0, pyyaml >= 6.0, platformdirs >= 4.0
|
|
48
|
+
|
|
49
|
+
## 快速开始
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# 登录
|
|
53
|
+
tars auth login -s https://your-tars-server.com
|
|
54
|
+
|
|
55
|
+
# 导入插件
|
|
56
|
+
tars plugin import https://github.com/org/agent.git
|
|
57
|
+
|
|
58
|
+
# 智能生成数据集并执行评估
|
|
59
|
+
tars dataset generate <plugin_id> --agent-name my-agent
|
|
60
|
+
tars eval run <plugin_id> --agent-name my-agent --dataset-version <version_id>
|
|
61
|
+
|
|
62
|
+
# 导出测评报告
|
|
63
|
+
tars plugin export-report <plugin_id>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 命令测试结果
|
|
67
|
+
|
|
68
|
+
### 认证
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
$ tars auth login -s https://your-tars-server.com
|
|
72
|
+
登录 tars 平台
|
|
73
|
+
用户名: admin
|
|
74
|
+
密码: ********
|
|
75
|
+
✓ 登录成功
|
|
76
|
+
服务器: https://your-tars-server.com
|
|
77
|
+
用户: admin
|
|
78
|
+
|
|
79
|
+
$ tars auth logout
|
|
80
|
+
✓ 已登出,本地凭证已清除
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 插件管理
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
$ tars plugin import https://github.com/example/agent-eval.git
|
|
87
|
+
正在验证插件...
|
|
88
|
+
✓ 插件验证通过
|
|
89
|
+
正在导入插件...
|
|
90
|
+
✓ 插件导入成功
|
|
91
|
+
插件ID: 46a387de-f10b-4e6a-be0e-04f634f53915
|
|
92
|
+
查看详情: https://your-tars-server.com/plugins/46a387de-f10b-4e6a-be0e-04f634f53915
|
|
93
|
+
|
|
94
|
+
$ tars plugin export-report 46a387de-f10b-4e6a-be0e-04f634f53915
|
|
95
|
+
✓ 报告已导出
|
|
96
|
+
文件: report_46a387de_20260518120000.html
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 模板下载
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
$ tars template download plan -f yaml
|
|
103
|
+
✓ 模板已下载
|
|
104
|
+
文件: plan-template.yaml
|
|
105
|
+
|
|
106
|
+
$ tars template download testcase-single
|
|
107
|
+
✓ 模板已下载
|
|
108
|
+
文件: testcase-single-template.yaml
|
|
109
|
+
|
|
110
|
+
$ tars template download testcase-multi
|
|
111
|
+
✓ 模板已下载
|
|
112
|
+
文件: testcase-multi-template.yaml
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 数据集管理
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
$ tars dataset generate 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval
|
|
119
|
+
正在创建数据集版本...
|
|
120
|
+
✓ 版本已创建: fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2
|
|
121
|
+
正在生成评估计划...
|
|
122
|
+
███████████████████████████████████████ 100%
|
|
123
|
+
✓ 评估计划生成完成
|
|
124
|
+
正在生成测试用例...
|
|
125
|
+
███████████████████████████████████████ 100%
|
|
126
|
+
✓ 测试用例生成完成 (15 条)
|
|
127
|
+
|
|
128
|
+
$ tars dataset list 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval
|
|
129
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓
|
|
130
|
+
┃ Version ID ┃ Status ┃ Cases ┃ Created At ┃
|
|
131
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩
|
|
132
|
+
│ fbe88a2a-b830-4b1f... │ published│ 15 │ 2026-05-18 12:00 │
|
|
133
|
+
│ 35839ba6-824b-4581... │ draft │ 10 │ 2026-05-17 09:30 │
|
|
134
|
+
└──────────────────────────────┴──────────┴────────┴────────────────────┘
|
|
135
|
+
|
|
136
|
+
$ tars dataset publish fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2
|
|
137
|
+
✓ 数据集版本已发布
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 评估
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
$ tars eval run 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval --dataset-version fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2
|
|
144
|
+
正在创建评估任务...
|
|
145
|
+
✓ 评估任务已创建: 6612b197-6b3c-461b-a412-ae0176ea1b31
|
|
146
|
+
正在执行评估...
|
|
147
|
+
███████████████████████████████████████ 100%
|
|
148
|
+
✓ 评估完成
|
|
149
|
+
总分: 0.75
|
|
150
|
+
通过: 12/15 (80%)
|
|
151
|
+
查看详情: https://your-tars-server.com/plugins/46a387de-f10b-4e6a-be0e-04f634f53915/evaluation/6612b197-6b3c-461b-a412-ae0176ea1b31
|
|
152
|
+
|
|
153
|
+
$ tars eval run 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval --dataset-version fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2 --threshold 0.8
|
|
154
|
+
...
|
|
155
|
+
总分: 0.75
|
|
156
|
+
阈值: 0.8
|
|
157
|
+
✗ 评估未通过:总分 0.75 低于阈值 0.8
|
|
158
|
+
|
|
159
|
+
$ tars eval status 6612b197-6b3c-461b-a412-ae0176ea1b31
|
|
160
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
|
|
161
|
+
┃ Task ID ┃ Status ┃ Score ┃ Total ┃ Passed ┃ Failed ┃
|
|
162
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━┩
|
|
163
|
+
│ 6612b197-6b3c-461b-a412-ae0176ea... │completed│ 0.75 │ 15 │ 12 │ 3 │
|
|
164
|
+
└──────────────────────────────────────┴─────────┴──────────┴───────┴─────────┴─────────┘
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## 全局选项
|
|
168
|
+
|
|
169
|
+
| 选项 | 说明 |
|
|
170
|
+
|------|------|
|
|
171
|
+
| `-o, --output FORMAT` | 输出格式:`table`(默认)/ `json` / `yaml` |
|
|
172
|
+
| `-q, --quiet` | 安静模式 |
|
|
173
|
+
| `--verbose` | 打印 HTTP 请求日志 |
|
|
174
|
+
| `--server URL` | 覆盖服务地址(优先级:`--server` > `TARS_SERVER_URL` 环境变量 > 默认 `http://localhost:8001`) |
|
|
175
|
+
| `-V, --version` | 查看版本 |
|
|
176
|
+
|
|
177
|
+
## CI/CD 集成
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
export TARS_ACCESS_TOKEN=<token>
|
|
181
|
+
export TARS_SERVER_URL=https://your-tars-server.com
|
|
182
|
+
|
|
183
|
+
tars eval run <plugin_id> \
|
|
184
|
+
--agent-name my-agent \
|
|
185
|
+
--dataset-version <version_id> \
|
|
186
|
+
--threshold 0.8 \
|
|
187
|
+
-o json -q
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
评分低于阈值时退出码为 1,可用于流水线门禁。
|
|
191
|
+
|
|
192
|
+
## 退出码
|
|
193
|
+
|
|
194
|
+
| 退出码 | 含义 |
|
|
195
|
+
|--------|------|
|
|
196
|
+
| 0 | 成功 / 评估通过 |
|
|
197
|
+
| 1 | 评估未通过(评分低于 `--threshold`) |
|
|
198
|
+
| 2 | 执行错误(网络、参数、认证等) |
|
tars_cli-0.1.2/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# tars-cli
|
|
2
|
+
|
|
3
|
+
tars 平台命令行工具,支持插件导入、数据集管理、评估执行和报告导出。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install tars-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### 安装验证
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
$ tars --version
|
|
15
|
+
tars-cli 0.1.1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 升级
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install --upgrade tars-cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 环境要求
|
|
25
|
+
|
|
26
|
+
- Python >= 3.11
|
|
27
|
+
- 依赖:typer >= 0.12, httpx >= 0.27, rich >= 13.0, pyyaml >= 6.0, platformdirs >= 4.0
|
|
28
|
+
|
|
29
|
+
## 快速开始
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# 登录
|
|
33
|
+
tars auth login -s https://your-tars-server.com
|
|
34
|
+
|
|
35
|
+
# 导入插件
|
|
36
|
+
tars plugin import https://github.com/org/agent.git
|
|
37
|
+
|
|
38
|
+
# 智能生成数据集并执行评估
|
|
39
|
+
tars dataset generate <plugin_id> --agent-name my-agent
|
|
40
|
+
tars eval run <plugin_id> --agent-name my-agent --dataset-version <version_id>
|
|
41
|
+
|
|
42
|
+
# 导出测评报告
|
|
43
|
+
tars plugin export-report <plugin_id>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 命令测试结果
|
|
47
|
+
|
|
48
|
+
### 认证
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
$ tars auth login -s https://your-tars-server.com
|
|
52
|
+
登录 tars 平台
|
|
53
|
+
用户名: admin
|
|
54
|
+
密码: ********
|
|
55
|
+
✓ 登录成功
|
|
56
|
+
服务器: https://your-tars-server.com
|
|
57
|
+
用户: admin
|
|
58
|
+
|
|
59
|
+
$ tars auth logout
|
|
60
|
+
✓ 已登出,本地凭证已清除
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 插件管理
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
$ tars plugin import https://github.com/example/agent-eval.git
|
|
67
|
+
正在验证插件...
|
|
68
|
+
✓ 插件验证通过
|
|
69
|
+
正在导入插件...
|
|
70
|
+
✓ 插件导入成功
|
|
71
|
+
插件ID: 46a387de-f10b-4e6a-be0e-04f634f53915
|
|
72
|
+
查看详情: https://your-tars-server.com/plugins/46a387de-f10b-4e6a-be0e-04f634f53915
|
|
73
|
+
|
|
74
|
+
$ tars plugin export-report 46a387de-f10b-4e6a-be0e-04f634f53915
|
|
75
|
+
✓ 报告已导出
|
|
76
|
+
文件: report_46a387de_20260518120000.html
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 模板下载
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
$ tars template download plan -f yaml
|
|
83
|
+
✓ 模板已下载
|
|
84
|
+
文件: plan-template.yaml
|
|
85
|
+
|
|
86
|
+
$ tars template download testcase-single
|
|
87
|
+
✓ 模板已下载
|
|
88
|
+
文件: testcase-single-template.yaml
|
|
89
|
+
|
|
90
|
+
$ tars template download testcase-multi
|
|
91
|
+
✓ 模板已下载
|
|
92
|
+
文件: testcase-multi-template.yaml
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 数据集管理
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
$ tars dataset generate 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval
|
|
99
|
+
正在创建数据集版本...
|
|
100
|
+
✓ 版本已创建: fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2
|
|
101
|
+
正在生成评估计划...
|
|
102
|
+
███████████████████████████████████████ 100%
|
|
103
|
+
✓ 评估计划生成完成
|
|
104
|
+
正在生成测试用例...
|
|
105
|
+
███████████████████████████████████████ 100%
|
|
106
|
+
✓ 测试用例生成完成 (15 条)
|
|
107
|
+
|
|
108
|
+
$ tars dataset list 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval
|
|
109
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓
|
|
110
|
+
┃ Version ID ┃ Status ┃ Cases ┃ Created At ┃
|
|
111
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩
|
|
112
|
+
│ fbe88a2a-b830-4b1f... │ published│ 15 │ 2026-05-18 12:00 │
|
|
113
|
+
│ 35839ba6-824b-4581... │ draft │ 10 │ 2026-05-17 09:30 │
|
|
114
|
+
└──────────────────────────────┴──────────┴────────┴────────────────────┘
|
|
115
|
+
|
|
116
|
+
$ tars dataset publish fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2
|
|
117
|
+
✓ 数据集版本已发布
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 评估
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
$ tars eval run 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval --dataset-version fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2
|
|
124
|
+
正在创建评估任务...
|
|
125
|
+
✓ 评估任务已创建: 6612b197-6b3c-461b-a412-ae0176ea1b31
|
|
126
|
+
正在执行评估...
|
|
127
|
+
███████████████████████████████████████ 100%
|
|
128
|
+
✓ 评估完成
|
|
129
|
+
总分: 0.75
|
|
130
|
+
通过: 12/15 (80%)
|
|
131
|
+
查看详情: https://your-tars-server.com/plugins/46a387de-f10b-4e6a-be0e-04f634f53915/evaluation/6612b197-6b3c-461b-a412-ae0176ea1b31
|
|
132
|
+
|
|
133
|
+
$ tars eval run 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval --dataset-version fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2 --threshold 0.8
|
|
134
|
+
...
|
|
135
|
+
总分: 0.75
|
|
136
|
+
阈值: 0.8
|
|
137
|
+
✗ 评估未通过:总分 0.75 低于阈值 0.8
|
|
138
|
+
|
|
139
|
+
$ tars eval status 6612b197-6b3c-461b-a412-ae0176ea1b31
|
|
140
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
|
|
141
|
+
┃ Task ID ┃ Status ┃ Score ┃ Total ┃ Passed ┃ Failed ┃
|
|
142
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━┩
|
|
143
|
+
│ 6612b197-6b3c-461b-a412-ae0176ea... │completed│ 0.75 │ 15 │ 12 │ 3 │
|
|
144
|
+
└──────────────────────────────────────┴─────────┴──────────┴───────┴─────────┴─────────┘
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## 全局选项
|
|
148
|
+
|
|
149
|
+
| 选项 | 说明 |
|
|
150
|
+
|------|------|
|
|
151
|
+
| `-o, --output FORMAT` | 输出格式:`table`(默认)/ `json` / `yaml` |
|
|
152
|
+
| `-q, --quiet` | 安静模式 |
|
|
153
|
+
| `--verbose` | 打印 HTTP 请求日志 |
|
|
154
|
+
| `--server URL` | 覆盖服务地址(优先级:`--server` > `TARS_SERVER_URL` 环境变量 > 默认 `http://localhost:8001`) |
|
|
155
|
+
| `-V, --version` | 查看版本 |
|
|
156
|
+
|
|
157
|
+
## CI/CD 集成
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
export TARS_ACCESS_TOKEN=<token>
|
|
161
|
+
export TARS_SERVER_URL=https://your-tars-server.com
|
|
162
|
+
|
|
163
|
+
tars eval run <plugin_id> \
|
|
164
|
+
--agent-name my-agent \
|
|
165
|
+
--dataset-version <version_id> \
|
|
166
|
+
--threshold 0.8 \
|
|
167
|
+
-o json -q
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
评分低于阈值时退出码为 1,可用于流水线门禁。
|
|
171
|
+
|
|
172
|
+
## 退出码
|
|
173
|
+
|
|
174
|
+
| 退出码 | 含义 |
|
|
175
|
+
|--------|------|
|
|
176
|
+
| 0 | 成功 / 评估通过 |
|
|
177
|
+
| 1 | 评估未通过(评分低于 `--threshold`) |
|
|
178
|
+
| 2 | 执行错误(网络、参数、认证等) |
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tars-cli"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.2"
|
|
8
8
|
description = "tars 平台命令行工具"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = [
|
|
@@ -15,6 +15,8 @@ dependencies = [
|
|
|
15
15
|
"platformdirs>=4.0",
|
|
16
16
|
]
|
|
17
17
|
|
|
18
|
+
readme = "README.md"
|
|
19
|
+
|
|
18
20
|
[project.optional-dependencies]
|
|
19
21
|
dev = [
|
|
20
22
|
"pytest>=8.0",
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tars-cli
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: tars 平台命令行工具
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: typer>=0.12
|
|
8
|
+
Requires-Dist: httpx>=0.27
|
|
9
|
+
Requires-Dist: rich>=13.0
|
|
10
|
+
Requires-Dist: pyyaml>=6.0
|
|
11
|
+
Requires-Dist: platformdirs>=4.0
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
14
|
+
Requires-Dist: pytest-mock>=3.12; extra == "dev"
|
|
15
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
16
|
+
Requires-Dist: respx>=0.21; extra == "dev"
|
|
17
|
+
Requires-Dist: mypy>=1.8; extra == "dev"
|
|
18
|
+
Requires-Dist: ruff>=0.3; extra == "dev"
|
|
19
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
20
|
+
|
|
21
|
+
# tars-cli
|
|
22
|
+
|
|
23
|
+
tars 平台命令行工具,支持插件导入、数据集管理、评估执行和报告导出。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install tars-cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 安装验证
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
$ tars --version
|
|
35
|
+
tars-cli 0.1.1
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 升级
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install --upgrade tars-cli
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 环境要求
|
|
45
|
+
|
|
46
|
+
- Python >= 3.11
|
|
47
|
+
- 依赖:typer >= 0.12, httpx >= 0.27, rich >= 13.0, pyyaml >= 6.0, platformdirs >= 4.0
|
|
48
|
+
|
|
49
|
+
## 快速开始
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# 登录
|
|
53
|
+
tars auth login -s https://your-tars-server.com
|
|
54
|
+
|
|
55
|
+
# 导入插件
|
|
56
|
+
tars plugin import https://github.com/org/agent.git
|
|
57
|
+
|
|
58
|
+
# 智能生成数据集并执行评估
|
|
59
|
+
tars dataset generate <plugin_id> --agent-name my-agent
|
|
60
|
+
tars eval run <plugin_id> --agent-name my-agent --dataset-version <version_id>
|
|
61
|
+
|
|
62
|
+
# 导出测评报告
|
|
63
|
+
tars plugin export-report <plugin_id>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 命令测试结果
|
|
67
|
+
|
|
68
|
+
### 认证
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
$ tars auth login -s https://your-tars-server.com
|
|
72
|
+
登录 tars 平台
|
|
73
|
+
用户名: admin
|
|
74
|
+
密码: ********
|
|
75
|
+
✓ 登录成功
|
|
76
|
+
服务器: https://your-tars-server.com
|
|
77
|
+
用户: admin
|
|
78
|
+
|
|
79
|
+
$ tars auth logout
|
|
80
|
+
✓ 已登出,本地凭证已清除
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 插件管理
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
$ tars plugin import https://github.com/example/agent-eval.git
|
|
87
|
+
正在验证插件...
|
|
88
|
+
✓ 插件验证通过
|
|
89
|
+
正在导入插件...
|
|
90
|
+
✓ 插件导入成功
|
|
91
|
+
插件ID: 46a387de-f10b-4e6a-be0e-04f634f53915
|
|
92
|
+
查看详情: https://your-tars-server.com/plugins/46a387de-f10b-4e6a-be0e-04f634f53915
|
|
93
|
+
|
|
94
|
+
$ tars plugin export-report 46a387de-f10b-4e6a-be0e-04f634f53915
|
|
95
|
+
✓ 报告已导出
|
|
96
|
+
文件: report_46a387de_20260518120000.html
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 模板下载
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
$ tars template download plan -f yaml
|
|
103
|
+
✓ 模板已下载
|
|
104
|
+
文件: plan-template.yaml
|
|
105
|
+
|
|
106
|
+
$ tars template download testcase-single
|
|
107
|
+
✓ 模板已下载
|
|
108
|
+
文件: testcase-single-template.yaml
|
|
109
|
+
|
|
110
|
+
$ tars template download testcase-multi
|
|
111
|
+
✓ 模板已下载
|
|
112
|
+
文件: testcase-multi-template.yaml
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 数据集管理
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
$ tars dataset generate 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval
|
|
119
|
+
正在创建数据集版本...
|
|
120
|
+
✓ 版本已创建: fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2
|
|
121
|
+
正在生成评估计划...
|
|
122
|
+
███████████████████████████████████████ 100%
|
|
123
|
+
✓ 评估计划生成完成
|
|
124
|
+
正在生成测试用例...
|
|
125
|
+
███████████████████████████████████████ 100%
|
|
126
|
+
✓ 测试用例生成完成 (15 条)
|
|
127
|
+
|
|
128
|
+
$ tars dataset list 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval
|
|
129
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓
|
|
130
|
+
┃ Version ID ┃ Status ┃ Cases ┃ Created At ┃
|
|
131
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩
|
|
132
|
+
│ fbe88a2a-b830-4b1f... │ published│ 15 │ 2026-05-18 12:00 │
|
|
133
|
+
│ 35839ba6-824b-4581... │ draft │ 10 │ 2026-05-17 09:30 │
|
|
134
|
+
└──────────────────────────────┴──────────┴────────┴────────────────────┘
|
|
135
|
+
|
|
136
|
+
$ tars dataset publish fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2
|
|
137
|
+
✓ 数据集版本已发布
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 评估
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
$ tars eval run 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval --dataset-version fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2
|
|
144
|
+
正在创建评估任务...
|
|
145
|
+
✓ 评估任务已创建: 6612b197-6b3c-461b-a412-ae0176ea1b31
|
|
146
|
+
正在执行评估...
|
|
147
|
+
███████████████████████████████████████ 100%
|
|
148
|
+
✓ 评估完成
|
|
149
|
+
总分: 0.75
|
|
150
|
+
通过: 12/15 (80%)
|
|
151
|
+
查看详情: https://your-tars-server.com/plugins/46a387de-f10b-4e6a-be0e-04f634f53915/evaluation/6612b197-6b3c-461b-a412-ae0176ea1b31
|
|
152
|
+
|
|
153
|
+
$ tars eval run 46a387de-f10b-4e6a-be0e-04f634f53915 --agent-name agent-eval --dataset-version fbe88a2a-b830-4b1f-89d9-2ec6c158aaa2 --threshold 0.8
|
|
154
|
+
...
|
|
155
|
+
总分: 0.75
|
|
156
|
+
阈值: 0.8
|
|
157
|
+
✗ 评估未通过:总分 0.75 低于阈值 0.8
|
|
158
|
+
|
|
159
|
+
$ tars eval status 6612b197-6b3c-461b-a412-ae0176ea1b31
|
|
160
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
|
|
161
|
+
┃ Task ID ┃ Status ┃ Score ┃ Total ┃ Passed ┃ Failed ┃
|
|
162
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━┩
|
|
163
|
+
│ 6612b197-6b3c-461b-a412-ae0176ea... │completed│ 0.75 │ 15 │ 12 │ 3 │
|
|
164
|
+
└──────────────────────────────────────┴─────────┴──────────┴───────┴─────────┴─────────┘
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## 全局选项
|
|
168
|
+
|
|
169
|
+
| 选项 | 说明 |
|
|
170
|
+
|------|------|
|
|
171
|
+
| `-o, --output FORMAT` | 输出格式:`table`(默认)/ `json` / `yaml` |
|
|
172
|
+
| `-q, --quiet` | 安静模式 |
|
|
173
|
+
| `--verbose` | 打印 HTTP 请求日志 |
|
|
174
|
+
| `--server URL` | 覆盖服务地址(优先级:`--server` > `TARS_SERVER_URL` 环境变量 > 默认 `http://localhost:8001`) |
|
|
175
|
+
| `-V, --version` | 查看版本 |
|
|
176
|
+
|
|
177
|
+
## CI/CD 集成
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
export TARS_ACCESS_TOKEN=<token>
|
|
181
|
+
export TARS_SERVER_URL=https://your-tars-server.com
|
|
182
|
+
|
|
183
|
+
tars eval run <plugin_id> \
|
|
184
|
+
--agent-name my-agent \
|
|
185
|
+
--dataset-version <version_id> \
|
|
186
|
+
--threshold 0.8 \
|
|
187
|
+
-o json -q
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
评分低于阈值时退出码为 1,可用于流水线门禁。
|
|
191
|
+
|
|
192
|
+
## 退出码
|
|
193
|
+
|
|
194
|
+
| 退出码 | 含义 |
|
|
195
|
+
|--------|------|
|
|
196
|
+
| 0 | 成功 / 评估通过 |
|
|
197
|
+
| 1 | 评估未通过(评分低于 `--threshold`) |
|
|
198
|
+
| 2 | 执行错误(网络、参数、认证等) |
|
tars_cli-0.1.0/PKG-INFO
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: tars-cli
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: tars 平台命令行工具
|
|
5
|
-
Requires-Python: >=3.11
|
|
6
|
-
Requires-Dist: typer>=0.12
|
|
7
|
-
Requires-Dist: httpx>=0.27
|
|
8
|
-
Requires-Dist: rich>=13.0
|
|
9
|
-
Requires-Dist: pyyaml>=6.0
|
|
10
|
-
Requires-Dist: platformdirs>=4.0
|
|
11
|
-
Provides-Extra: dev
|
|
12
|
-
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
13
|
-
Requires-Dist: pytest-mock>=3.12; extra == "dev"
|
|
14
|
-
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
15
|
-
Requires-Dist: respx>=0.21; extra == "dev"
|
|
16
|
-
Requires-Dist: mypy>=1.8; extra == "dev"
|
|
17
|
-
Requires-Dist: ruff>=0.3; extra == "dev"
|
|
18
|
-
Requires-Dist: build>=1.0; extra == "dev"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: tars-cli
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: tars 平台命令行工具
|
|
5
|
-
Requires-Python: >=3.11
|
|
6
|
-
Requires-Dist: typer>=0.12
|
|
7
|
-
Requires-Dist: httpx>=0.27
|
|
8
|
-
Requires-Dist: rich>=13.0
|
|
9
|
-
Requires-Dist: pyyaml>=6.0
|
|
10
|
-
Requires-Dist: platformdirs>=4.0
|
|
11
|
-
Provides-Extra: dev
|
|
12
|
-
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
13
|
-
Requires-Dist: pytest-mock>=3.12; extra == "dev"
|
|
14
|
-
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
15
|
-
Requires-Dist: respx>=0.21; extra == "dev"
|
|
16
|
-
Requires-Dist: mypy>=1.8; extra == "dev"
|
|
17
|
-
Requires-Dist: ruff>=0.3; extra == "dev"
|
|
18
|
-
Requires-Dist: build>=1.0; extra == "dev"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|