tars-cli 0.1.10__tar.gz → 1.0.1__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.10 → tars_cli-1.0.1}/PKG-INFO +69 -2
- {tars_cli-0.1.10 → tars_cli-1.0.1}/README.md +68 -1
- {tars_cli-0.1.10 → tars_cli-1.0.1}/pyproject.toml +2 -1
- tars_cli-1.0.1/tars_cli/__init__.py +1 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/client.py +9 -6
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/commands/auth_cmd.py +44 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli.egg-info/PKG-INFO +69 -2
- tars_cli-0.1.10/tars_cli/__init__.py +0 -1
- {tars_cli-0.1.10 → tars_cli-1.0.1}/setup.cfg +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/__main__.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/app.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/auth.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/commands/__init__.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/commands/dataset_cmd.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/commands/eval_cmd.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/commands/plugin_cmd.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/commands/template_cmd.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/config.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/hints.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/output.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/utils/__init__.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/utils/polling.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli/utils/progress.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli.egg-info/SOURCES.txt +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli.egg-info/dependency_links.txt +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli.egg-info/entry_points.txt +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli.egg-info/requires.txt +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tars_cli.egg-info/top_level.txt +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tests/test_auth.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tests/test_client.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tests/test_config.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tests/test_hints.py +0 -0
- {tars_cli-0.1.10 → tars_cli-1.0.1}/tests/test_output.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tars-cli
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: tars 平台命令行工具
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -32,7 +32,7 @@ pip install tars-cli
|
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
$ tars --version
|
|
35
|
-
tars-cli 0.
|
|
35
|
+
tars-cli 1.0.0
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
### 升级
|
|
@@ -72,6 +72,8 @@ $ tars plugin export-report <plugin_id>
|
|
|
72
72
|
|
|
73
73
|
### 认证
|
|
74
74
|
|
|
75
|
+
#### 用户名密码登录
|
|
76
|
+
|
|
75
77
|
```bash
|
|
76
78
|
$ tars auth login -s <server_url>
|
|
77
79
|
登录 tars 平台
|
|
@@ -85,6 +87,18 @@ $ tars auth logout
|
|
|
85
87
|
✓ 已登出,本地凭证已清除
|
|
86
88
|
```
|
|
87
89
|
|
|
90
|
+
#### API 密钥登录
|
|
91
|
+
|
|
92
|
+
适用于 CLI 和 CI/CD 场景。先在 Web 端「个人设置 → API 密钥」中创建密钥,然后使用 `--token` 参数登录:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
$ tars auth login -s <server_url> --token trs_xxxxxxxxxxxx
|
|
96
|
+
✓ 登录成功
|
|
97
|
+
服务器: <server_url>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
> **注意**: API 密钥明文只展示一次,创建后请立即复制保存。密钥不会过期,无需刷新。
|
|
101
|
+
|
|
88
102
|
### 插件管理
|
|
89
103
|
|
|
90
104
|
> Git 导入可选参数:`--branch`(分支,默认 main)、`--path`(子目录路径)、`--auth-type`(认证方式:none/token/ssh-key)、`--auth-token`(认证凭证)。本地文件导入支持 `--overwrite` 覆盖。
|
|
@@ -297,3 +311,56 @@ tars -o json -q eval run <plugin_id> \
|
|
|
297
311
|
|--------|------|
|
|
298
312
|
| 0 | 成功 |
|
|
299
313
|
| 2 | 执行错误(网络、参数、认证等) |
|
|
314
|
+
|
|
315
|
+
## Claude Code 集成
|
|
316
|
+
|
|
317
|
+
tars-cli 提供了 Claude Code Plugin(技能说明书),安装后可在 Claude Code 中使用自然语言调用 tars 命令(如"帮我评估 xxx 插件"),无需记忆 CLI 参数。
|
|
318
|
+
|
|
319
|
+
### 安装
|
|
320
|
+
|
|
321
|
+
tars-cli 的 Skill 作为独立 Plugin 分发,与 pip 包完全解耦。Plugin 源码位于仓库 `apps/plugins/tars-cli/` 目录。
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
# 第1步:安装 CLI 命令
|
|
325
|
+
pip install tars-cli
|
|
326
|
+
|
|
327
|
+
# 第2步:从 GitLab 仓库下载 skill 文件到全局 skill 目录
|
|
328
|
+
cd /tmp
|
|
329
|
+
git -c http.sslVerify=false clone --depth 1 --sparse https://git.easyops.local/anyclouds/tars-p.git /tmp/tars-plugin
|
|
330
|
+
cd /tmp/tars-plugin && git sparse-checkout set apps/plugins/tars-cli
|
|
331
|
+
mkdir -p ~/.claude/skills && cp -r apps/plugins/tars-cli/skills/tars-cli ~/.claude/skills/tars-cli
|
|
332
|
+
rm -rf /tmp/tars-plugin
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
> 也可直接从 GitLab 网页下载 `apps/plugins/tars-cli/skills/tars-cli` 目录后手动放置到 `~/.claude/skills/tars-cli`。
|
|
336
|
+
|
|
337
|
+
安装后的目录结构:
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
~/.claude/skills/tars-cli/
|
|
341
|
+
├── SKILL.md # Skill 主文件(命令映射 + 执行流程)
|
|
342
|
+
└── references/
|
|
343
|
+
├── auth.md # 登录/登出流程
|
|
344
|
+
└── workflows.md # 完整评估工作流 + 错误处理
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
已有同名 skill 时直接覆盖即可更新。
|
|
348
|
+
|
|
349
|
+
### 支持的自然语言指令
|
|
350
|
+
|
|
351
|
+
| 示例 | 实际执行的命令 |
|
|
352
|
+
|------|---------------|
|
|
353
|
+
| "登录 tars" | `tars auth login` |
|
|
354
|
+
| "导入插件 https://github.com/xxx/xxx.git" | `tars plugin import <git_url>` |
|
|
355
|
+
| "帮我评估 xxx 插件" | 完整评估流程(生成数据集 → 发布 → 运行评估 → 导出报告) |
|
|
356
|
+
| "生成数据集" | `tars dataset generate ...` |
|
|
357
|
+
| "查看评估状态" | `tars eval status ...` |
|
|
358
|
+
| "下载模板" | `tars template download ...` |
|
|
359
|
+
| "导出报告" | `tars plugin export-report ...` |
|
|
360
|
+
|
|
361
|
+
### 前置条件
|
|
362
|
+
|
|
363
|
+
- 已安装 tars-cli:`pip install tars-cli`
|
|
364
|
+
- 已安装 tars-cli skill:从 GitLab 仓库下载到 `~/.claude/skills/tars-cli`
|
|
365
|
+
- 已登录:`tars auth login -s <server_url>`
|
|
366
|
+
- Claude Code 版本 >= 1.0(支持 Skill 功能)
|
|
@@ -12,7 +12,7 @@ pip install tars-cli
|
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
$ tars --version
|
|
15
|
-
tars-cli 0.
|
|
15
|
+
tars-cli 1.0.0
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
### 升级
|
|
@@ -52,6 +52,8 @@ $ tars plugin export-report <plugin_id>
|
|
|
52
52
|
|
|
53
53
|
### 认证
|
|
54
54
|
|
|
55
|
+
#### 用户名密码登录
|
|
56
|
+
|
|
55
57
|
```bash
|
|
56
58
|
$ tars auth login -s <server_url>
|
|
57
59
|
登录 tars 平台
|
|
@@ -65,6 +67,18 @@ $ tars auth logout
|
|
|
65
67
|
✓ 已登出,本地凭证已清除
|
|
66
68
|
```
|
|
67
69
|
|
|
70
|
+
#### API 密钥登录
|
|
71
|
+
|
|
72
|
+
适用于 CLI 和 CI/CD 场景。先在 Web 端「个人设置 → API 密钥」中创建密钥,然后使用 `--token` 参数登录:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
$ tars auth login -s <server_url> --token trs_xxxxxxxxxxxx
|
|
76
|
+
✓ 登录成功
|
|
77
|
+
服务器: <server_url>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
> **注意**: API 密钥明文只展示一次,创建后请立即复制保存。密钥不会过期,无需刷新。
|
|
81
|
+
|
|
68
82
|
### 插件管理
|
|
69
83
|
|
|
70
84
|
> Git 导入可选参数:`--branch`(分支,默认 main)、`--path`(子目录路径)、`--auth-type`(认证方式:none/token/ssh-key)、`--auth-token`(认证凭证)。本地文件导入支持 `--overwrite` 覆盖。
|
|
@@ -277,3 +291,56 @@ tars -o json -q eval run <plugin_id> \
|
|
|
277
291
|
|--------|------|
|
|
278
292
|
| 0 | 成功 |
|
|
279
293
|
| 2 | 执行错误(网络、参数、认证等) |
|
|
294
|
+
|
|
295
|
+
## Claude Code 集成
|
|
296
|
+
|
|
297
|
+
tars-cli 提供了 Claude Code Plugin(技能说明书),安装后可在 Claude Code 中使用自然语言调用 tars 命令(如"帮我评估 xxx 插件"),无需记忆 CLI 参数。
|
|
298
|
+
|
|
299
|
+
### 安装
|
|
300
|
+
|
|
301
|
+
tars-cli 的 Skill 作为独立 Plugin 分发,与 pip 包完全解耦。Plugin 源码位于仓库 `apps/plugins/tars-cli/` 目录。
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# 第1步:安装 CLI 命令
|
|
305
|
+
pip install tars-cli
|
|
306
|
+
|
|
307
|
+
# 第2步:从 GitLab 仓库下载 skill 文件到全局 skill 目录
|
|
308
|
+
cd /tmp
|
|
309
|
+
git -c http.sslVerify=false clone --depth 1 --sparse https://git.easyops.local/anyclouds/tars-p.git /tmp/tars-plugin
|
|
310
|
+
cd /tmp/tars-plugin && git sparse-checkout set apps/plugins/tars-cli
|
|
311
|
+
mkdir -p ~/.claude/skills && cp -r apps/plugins/tars-cli/skills/tars-cli ~/.claude/skills/tars-cli
|
|
312
|
+
rm -rf /tmp/tars-plugin
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
> 也可直接从 GitLab 网页下载 `apps/plugins/tars-cli/skills/tars-cli` 目录后手动放置到 `~/.claude/skills/tars-cli`。
|
|
316
|
+
|
|
317
|
+
安装后的目录结构:
|
|
318
|
+
|
|
319
|
+
```
|
|
320
|
+
~/.claude/skills/tars-cli/
|
|
321
|
+
├── SKILL.md # Skill 主文件(命令映射 + 执行流程)
|
|
322
|
+
└── references/
|
|
323
|
+
├── auth.md # 登录/登出流程
|
|
324
|
+
└── workflows.md # 完整评估工作流 + 错误处理
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
已有同名 skill 时直接覆盖即可更新。
|
|
328
|
+
|
|
329
|
+
### 支持的自然语言指令
|
|
330
|
+
|
|
331
|
+
| 示例 | 实际执行的命令 |
|
|
332
|
+
|------|---------------|
|
|
333
|
+
| "登录 tars" | `tars auth login` |
|
|
334
|
+
| "导入插件 https://github.com/xxx/xxx.git" | `tars plugin import <git_url>` |
|
|
335
|
+
| "帮我评估 xxx 插件" | 完整评估流程(生成数据集 → 发布 → 运行评估 → 导出报告) |
|
|
336
|
+
| "生成数据集" | `tars dataset generate ...` |
|
|
337
|
+
| "查看评估状态" | `tars eval status ...` |
|
|
338
|
+
| "下载模板" | `tars template download ...` |
|
|
339
|
+
| "导出报告" | `tars plugin export-report ...` |
|
|
340
|
+
|
|
341
|
+
### 前置条件
|
|
342
|
+
|
|
343
|
+
- 已安装 tars-cli:`pip install tars-cli`
|
|
344
|
+
- 已安装 tars-cli skill:从 GitLab 仓库下载到 `~/.claude/skills/tars-cli`
|
|
345
|
+
- 已登录:`tars auth login -s <server_url>`
|
|
346
|
+
- Claude Code 版本 >= 1.0(支持 Skill 功能)
|
|
@@ -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 = "1.0.1"
|
|
8
8
|
description = "tars 平台命令行工具"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = [
|
|
@@ -28,6 +28,7 @@ dev = [
|
|
|
28
28
|
"build>=1.0",
|
|
29
29
|
]
|
|
30
30
|
|
|
31
|
+
|
|
31
32
|
[project.scripts]
|
|
32
33
|
tars = "tars_cli.app:app"
|
|
33
34
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.1"
|
|
@@ -82,13 +82,16 @@ class TarsAPIClient:
|
|
|
82
82
|
self._log_response(resp)
|
|
83
83
|
|
|
84
84
|
if resp.status_code == 401:
|
|
85
|
-
if self.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
if self._credentials.refresh_token:
|
|
86
|
+
if self._refresh_token():
|
|
87
|
+
kwargs["headers"].update(self._headers())
|
|
88
|
+
self._log_request(method, url, **kwargs)
|
|
89
|
+
resp = self._client.request(method, url, **kwargs)
|
|
90
|
+
self._log_response(resp)
|
|
91
|
+
else:
|
|
92
|
+
raise AuthExpiredError("认证已过期,请重新执行 tars auth login")
|
|
90
93
|
else:
|
|
91
|
-
raise AuthExpiredError("
|
|
94
|
+
raise AuthExpiredError("API 密钥已过期或被撤销,请重新生成密钥后执行 tars auth login --token <新密钥>")
|
|
92
95
|
|
|
93
96
|
return resp
|
|
94
97
|
|
|
@@ -16,11 +16,47 @@ from tars_cli.output import render
|
|
|
16
16
|
@auth_app.command()
|
|
17
17
|
def login(
|
|
18
18
|
server: str = typer.Option("", "--server", "-s", help="服务端地址"),
|
|
19
|
+
token: str = typer.Option("", "--token", "-t", help="API 密钥(trs_ 开头),跳过密码登录"),
|
|
19
20
|
) -> None:
|
|
20
21
|
"""登录 tars 平台"""
|
|
21
22
|
output_fmt, quiet, verbose, global_server = get_global_options()
|
|
22
23
|
server_url = resolve_server_url(server or global_server)
|
|
23
24
|
|
|
25
|
+
# FEAT-053: API 密钥登录模式
|
|
26
|
+
if token:
|
|
27
|
+
if not token.startswith("trs_"):
|
|
28
|
+
typer.echo("API 密钥格式错误:应以 trs_ 开头", err=True)
|
|
29
|
+
raise typer.Exit(code=2)
|
|
30
|
+
|
|
31
|
+
client = httpx.Client(base_url=f"{server_url}/api/v1", timeout=30.0, transport=HTTPTransport(proxy=None))
|
|
32
|
+
try:
|
|
33
|
+
resp = client.get("/user/profile", headers={"Authorization": f"Bearer {token}"})
|
|
34
|
+
if resp.status_code != 200:
|
|
35
|
+
detail = resp.json().get("detail", f"HTTP {resp.status_code}") if resp.headers.get("content-type", "").startswith("application/json") else f"HTTP {resp.status_code}"
|
|
36
|
+
typer.echo(f"API 密钥无效或已过期: {detail}", err=True)
|
|
37
|
+
raise typer.Exit(code=2)
|
|
38
|
+
finally:
|
|
39
|
+
client.close()
|
|
40
|
+
|
|
41
|
+
creds = Credentials(
|
|
42
|
+
server_url=server_url,
|
|
43
|
+
access_token=token,
|
|
44
|
+
refresh_token="",
|
|
45
|
+
expires_at="",
|
|
46
|
+
)
|
|
47
|
+
save_credentials(creds)
|
|
48
|
+
|
|
49
|
+
result = {
|
|
50
|
+
"message": "登录成功(API 密钥)",
|
|
51
|
+
"server": server_url,
|
|
52
|
+
}
|
|
53
|
+
web_url, next_step = print_hints(server_url, "auth_login", quiet=quiet)
|
|
54
|
+
render(result, output_format=output_fmt, quiet=quiet, web_url=web_url, next_step=next_step)
|
|
55
|
+
if next_step and not quiet:
|
|
56
|
+
typer.echo(f"👉 下一步: {next_step}")
|
|
57
|
+
return
|
|
58
|
+
|
|
59
|
+
# 原有密码登录流程
|
|
24
60
|
username = typer.prompt("用户名")
|
|
25
61
|
password = typer.prompt("密码", hide_input=True)
|
|
26
62
|
|
|
@@ -33,6 +69,14 @@ def login(
|
|
|
33
69
|
except Exception:
|
|
34
70
|
detail = resp.text or f"HTTP {resp.status_code}"
|
|
35
71
|
typer.echo(f"登录失败: {detail}", err=True)
|
|
72
|
+
|
|
73
|
+
# FEAT-053: sso_only 模式下密码登录失败时提示生成 API 密钥
|
|
74
|
+
if resp.status_code in (400, 401, 403):
|
|
75
|
+
typer.echo("", err=True)
|
|
76
|
+
typer.echo("提示:密码登录不可用时,可使用 API 密钥登录:", err=True)
|
|
77
|
+
typer.echo(" tars auth login --server <服务地址> --token <API密钥>", err=True)
|
|
78
|
+
typer.echo(" 或在 Web 端个人设置中生成 API 密钥", err=True)
|
|
79
|
+
|
|
36
80
|
raise typer.Exit(code=2)
|
|
37
81
|
|
|
38
82
|
data = resp.json()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tars-cli
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: tars 平台命令行工具
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -32,7 +32,7 @@ pip install tars-cli
|
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
$ tars --version
|
|
35
|
-
tars-cli 0.
|
|
35
|
+
tars-cli 1.0.0
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
### 升级
|
|
@@ -72,6 +72,8 @@ $ tars plugin export-report <plugin_id>
|
|
|
72
72
|
|
|
73
73
|
### 认证
|
|
74
74
|
|
|
75
|
+
#### 用户名密码登录
|
|
76
|
+
|
|
75
77
|
```bash
|
|
76
78
|
$ tars auth login -s <server_url>
|
|
77
79
|
登录 tars 平台
|
|
@@ -85,6 +87,18 @@ $ tars auth logout
|
|
|
85
87
|
✓ 已登出,本地凭证已清除
|
|
86
88
|
```
|
|
87
89
|
|
|
90
|
+
#### API 密钥登录
|
|
91
|
+
|
|
92
|
+
适用于 CLI 和 CI/CD 场景。先在 Web 端「个人设置 → API 密钥」中创建密钥,然后使用 `--token` 参数登录:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
$ tars auth login -s <server_url> --token trs_xxxxxxxxxxxx
|
|
96
|
+
✓ 登录成功
|
|
97
|
+
服务器: <server_url>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
> **注意**: API 密钥明文只展示一次,创建后请立即复制保存。密钥不会过期,无需刷新。
|
|
101
|
+
|
|
88
102
|
### 插件管理
|
|
89
103
|
|
|
90
104
|
> Git 导入可选参数:`--branch`(分支,默认 main)、`--path`(子目录路径)、`--auth-type`(认证方式:none/token/ssh-key)、`--auth-token`(认证凭证)。本地文件导入支持 `--overwrite` 覆盖。
|
|
@@ -297,3 +311,56 @@ tars -o json -q eval run <plugin_id> \
|
|
|
297
311
|
|--------|------|
|
|
298
312
|
| 0 | 成功 |
|
|
299
313
|
| 2 | 执行错误(网络、参数、认证等) |
|
|
314
|
+
|
|
315
|
+
## Claude Code 集成
|
|
316
|
+
|
|
317
|
+
tars-cli 提供了 Claude Code Plugin(技能说明书),安装后可在 Claude Code 中使用自然语言调用 tars 命令(如"帮我评估 xxx 插件"),无需记忆 CLI 参数。
|
|
318
|
+
|
|
319
|
+
### 安装
|
|
320
|
+
|
|
321
|
+
tars-cli 的 Skill 作为独立 Plugin 分发,与 pip 包完全解耦。Plugin 源码位于仓库 `apps/plugins/tars-cli/` 目录。
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
# 第1步:安装 CLI 命令
|
|
325
|
+
pip install tars-cli
|
|
326
|
+
|
|
327
|
+
# 第2步:从 GitLab 仓库下载 skill 文件到全局 skill 目录
|
|
328
|
+
cd /tmp
|
|
329
|
+
git -c http.sslVerify=false clone --depth 1 --sparse https://git.easyops.local/anyclouds/tars-p.git /tmp/tars-plugin
|
|
330
|
+
cd /tmp/tars-plugin && git sparse-checkout set apps/plugins/tars-cli
|
|
331
|
+
mkdir -p ~/.claude/skills && cp -r apps/plugins/tars-cli/skills/tars-cli ~/.claude/skills/tars-cli
|
|
332
|
+
rm -rf /tmp/tars-plugin
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
> 也可直接从 GitLab 网页下载 `apps/plugins/tars-cli/skills/tars-cli` 目录后手动放置到 `~/.claude/skills/tars-cli`。
|
|
336
|
+
|
|
337
|
+
安装后的目录结构:
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
~/.claude/skills/tars-cli/
|
|
341
|
+
├── SKILL.md # Skill 主文件(命令映射 + 执行流程)
|
|
342
|
+
└── references/
|
|
343
|
+
├── auth.md # 登录/登出流程
|
|
344
|
+
└── workflows.md # 完整评估工作流 + 错误处理
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
已有同名 skill 时直接覆盖即可更新。
|
|
348
|
+
|
|
349
|
+
### 支持的自然语言指令
|
|
350
|
+
|
|
351
|
+
| 示例 | 实际执行的命令 |
|
|
352
|
+
|------|---------------|
|
|
353
|
+
| "登录 tars" | `tars auth login` |
|
|
354
|
+
| "导入插件 https://github.com/xxx/xxx.git" | `tars plugin import <git_url>` |
|
|
355
|
+
| "帮我评估 xxx 插件" | 完整评估流程(生成数据集 → 发布 → 运行评估 → 导出报告) |
|
|
356
|
+
| "生成数据集" | `tars dataset generate ...` |
|
|
357
|
+
| "查看评估状态" | `tars eval status ...` |
|
|
358
|
+
| "下载模板" | `tars template download ...` |
|
|
359
|
+
| "导出报告" | `tars plugin export-report ...` |
|
|
360
|
+
|
|
361
|
+
### 前置条件
|
|
362
|
+
|
|
363
|
+
- 已安装 tars-cli:`pip install tars-cli`
|
|
364
|
+
- 已安装 tars-cli skill:从 GitLab 仓库下载到 `~/.claude/skills/tars-cli`
|
|
365
|
+
- 已登录:`tars auth login -s <server_url>`
|
|
366
|
+
- Claude Code 版本 >= 1.0(支持 Skill 功能)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.10"
|
|
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
|