artdam-cli 0.2.2__tar.gz → 0.2.4__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.
- artdam_cli-0.2.4/PKG-INFO +292 -0
- artdam_cli-0.2.4/README.md +282 -0
- artdam_cli-0.2.4/artdam_cli/__init__.py +1 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/folder_cmd.py +4 -3
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/folders.py +4 -3
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/login.py +112 -112
- artdam_cli-0.2.4/artdam_cli/commands/project.py +28 -0
- artdam_cli-0.2.4/artdam_cli/commands/projects.py +41 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/search.py +4 -3
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/tag_cmd.py +4 -3
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/tags.py +4 -3
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/upload.py +4 -3
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/config.py +9 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/main.py +12 -0
- artdam_cli-0.2.4/artdam_cli.egg-info/PKG-INFO +292 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli.egg-info/SOURCES.txt +2 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/pyproject.toml +1 -1
- artdam_cli-0.2.2/PKG-INFO +0 -235
- artdam_cli-0.2.2/README.md +0 -225
- artdam_cli-0.2.2/artdam_cli/__init__.py +0 -1
- artdam_cli-0.2.2/artdam_cli.egg-info/PKG-INFO +0 -235
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/client.py +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/__init__.py +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/comment.py +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/delete_cmd.py +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/download.py +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/favorite.py +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/get.py +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/rate.py +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/restore.py +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli/commands/update.py +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli.egg-info/dependency_links.txt +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli.egg-info/entry_points.txt +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli.egg-info/requires.txt +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/artdam_cli.egg-info/top_level.txt +0 -0
- {artdam_cli-0.2.2 → artdam_cli-0.2.4}/setup.cfg +0 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: artdam-cli
|
|
3
|
+
Version: 0.2.4
|
|
4
|
+
Summary: ArtDAM 数字资产管理平台命令行工具
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: click>=8.1
|
|
8
|
+
Requires-Dist: httpx>=0.27
|
|
9
|
+
Requires-Dist: rich>=13.0
|
|
10
|
+
|
|
11
|
+
# artdam-cli
|
|
12
|
+
|
|
13
|
+
ArtDAM 数字资产管理平台命令行工具,支持所有主流 AI Agent工具接入
|
|
14
|
+
|
|
15
|
+
## 安装
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
uv tool install artdam-cli
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 更新
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
uv tool upgrade artdam-cli
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 快速开始
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# 登录(默认走 SSO,自动打开浏览器完成授权)
|
|
31
|
+
artdam login
|
|
32
|
+
|
|
33
|
+
# 用账号密码登录
|
|
34
|
+
artdam login --password --username <用户名>
|
|
35
|
+
|
|
36
|
+
# 查看可访问的项目列表(获取项目 ID)
|
|
37
|
+
artdam projects
|
|
38
|
+
|
|
39
|
+
# 设置默认项目(之后无需每次输入 -p)
|
|
40
|
+
artdam project use 1
|
|
41
|
+
|
|
42
|
+
# 搜索资产
|
|
43
|
+
artdam search "关键词"
|
|
44
|
+
|
|
45
|
+
# 查看资产详情
|
|
46
|
+
artdam get 123
|
|
47
|
+
|
|
48
|
+
# 下载资产
|
|
49
|
+
artdam download 123 --out ./downloads
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 命令说明
|
|
53
|
+
|
|
54
|
+
### 查询命令(viewer 及以上)
|
|
55
|
+
|
|
56
|
+
#### `artdam projects`
|
|
57
|
+
|
|
58
|
+
列出当前用户可访问的所有项目(含 ID)。
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
artdam projects
|
|
62
|
+
artdam projects --json # 输出原始 JSON(AI Agent 用)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### `artdam project use / show`
|
|
66
|
+
|
|
67
|
+
设置或查看默认项目,设置后所有命令无需再传 `-p`。
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
artdam project use 1 # 设置默认项目 ID 为 1
|
|
71
|
+
artdam project show # 查看当前默认项目
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### `artdam login`
|
|
75
|
+
|
|
76
|
+
登录 ArtDAM,保存 token 到本地 `~/.artdam/config.json`。
|
|
77
|
+
|
|
78
|
+
**默认走 SSO 浏览器授权**(推荐):
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
artdam login
|
|
82
|
+
# 自动打开浏览器 → 完成公司 SSO 授权 → token 写入本地配置
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**账号密码登录**(仅管理员 / 服务账号):
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
artdam login --password --username <用户名>
|
|
89
|
+
# 回车后提示输入密码(不回显)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
| 参数 | 说明 |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `--url` | 服务器地址(默认已内置,无需填写) |
|
|
95
|
+
| `--password` | 切换为账号密码模式(不加此 flag 默认走 SSO) |
|
|
96
|
+
| `--username` | 用户名(仅 `--password` 模式) |
|
|
97
|
+
|
|
98
|
+
#### `artdam search`
|
|
99
|
+
|
|
100
|
+
搜索资产,返回匹配列表。
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
artdam search "场景" # 使用默认项目
|
|
104
|
+
artdam search "场景" --project 1 # 临时指定项目
|
|
105
|
+
artdam search "场景" --limit 50
|
|
106
|
+
artdam search "场景" --type image/png
|
|
107
|
+
artdam search "场景" --folder 10
|
|
108
|
+
artdam search "场景" --json # 输出原始 JSON(AI Agent 用)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
| 参数 | 说明 |
|
|
112
|
+
|---|---|
|
|
113
|
+
| `KEYWORD` | 搜索关键词 |
|
|
114
|
+
| `-p, --project` | 项目 ID(省略则使用默认项目) |
|
|
115
|
+
| `-n, --limit` | 返回数量上限(默认 20) |
|
|
116
|
+
| `--type` | 文件类型,如 `image/png` |
|
|
117
|
+
| `--folder` | 限定文件夹 ID |
|
|
118
|
+
| `--json` | 输出原始 JSON |
|
|
119
|
+
|
|
120
|
+
#### `artdam get`
|
|
121
|
+
|
|
122
|
+
查看单个资产详情(含预览链接)。
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
artdam get 123
|
|
126
|
+
artdam get 123 --json # 输出原始 JSON(AI Agent 用)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### `artdam download`
|
|
130
|
+
|
|
131
|
+
下载资产文件到本地。
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
artdam download 123
|
|
135
|
+
artdam download 123 --out ./downloads
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### `artdam tags`
|
|
139
|
+
|
|
140
|
+
列出项目标签。
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
artdam tags # 使用默认项目
|
|
144
|
+
artdam tags --search "角色"
|
|
145
|
+
artdam tags --json
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### `artdam folders`
|
|
149
|
+
|
|
150
|
+
查看文件夹结构。
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
artdam folders # 使用默认项目
|
|
154
|
+
artdam folders --json
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 资产管理(member 及以上)
|
|
158
|
+
|
|
159
|
+
#### `artdam upload`
|
|
160
|
+
|
|
161
|
+
上传文件到指定项目和文件夹。
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
artdam upload ./image.jpg # 使用默认项目
|
|
165
|
+
artdam upload ./image.jpg --folder 10
|
|
166
|
+
artdam upload ./image.jpg --project 1 # 临时指定项目
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### `artdam update`
|
|
170
|
+
|
|
171
|
+
更新资产信息(可同时传多个选项)。
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
artdam update 123 --name "新文件名"
|
|
175
|
+
artdam update 123 --description "新描述"
|
|
176
|
+
artdam update 123 --folder 10
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### `artdam delete`
|
|
180
|
+
|
|
181
|
+
软删除资产(可通过 `restore` 恢复)。
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
artdam delete 123
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### `artdam restore`
|
|
188
|
+
|
|
189
|
+
恢复已删除的资产。
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
artdam restore 123
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 标签管理(member 及以上)
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# 给资产添加标签
|
|
199
|
+
artdam tag add 123 5
|
|
200
|
+
|
|
201
|
+
# 从资产移除标签
|
|
202
|
+
artdam tag remove 123 5
|
|
203
|
+
|
|
204
|
+
# 创建新标签(省略 -p 则使用默认项目)
|
|
205
|
+
artdam tag create "标签名"
|
|
206
|
+
artdam tag create "标签名" --project 1
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### 文件夹管理(member 及以上)
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# 创建文件夹(省略 -p 则使用默认项目)
|
|
213
|
+
artdam folder create "文件夹名"
|
|
214
|
+
artdam folder create "子文件夹" --parent 10
|
|
215
|
+
|
|
216
|
+
# 删除文件夹
|
|
217
|
+
artdam folder delete 10
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 互动操作(member 及以上)
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# 评论
|
|
224
|
+
artdam comment 123 "评论内容"
|
|
225
|
+
|
|
226
|
+
# 评分(1-5 星)
|
|
227
|
+
artdam rate 123 4
|
|
228
|
+
|
|
229
|
+
# 收藏 / 取消收藏
|
|
230
|
+
artdam favorite 123
|
|
231
|
+
artdam favorite 123 --remove
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## AI Agent 使用指南
|
|
235
|
+
|
|
236
|
+
所有查询命令支持 `--json` 输出原始 JSON,适合 Agent 解析:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
artdam projects --json
|
|
240
|
+
artdam search "安妮" --json
|
|
241
|
+
artdam get 123 --json
|
|
242
|
+
artdam tags --json
|
|
243
|
+
artdam folders --json
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### 典型 Agent 工作流
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
# 1. 登录(SSO 浏览器授权,完成后自动保存 token)
|
|
250
|
+
artdam login
|
|
251
|
+
|
|
252
|
+
# 2. 查询项目列表,选择目标项目并设为默认
|
|
253
|
+
artdam projects --json
|
|
254
|
+
artdam project use 1
|
|
255
|
+
|
|
256
|
+
# 3. 搜索 → 确认 → 下载
|
|
257
|
+
artdam search "头盔" --json
|
|
258
|
+
artdam get 50707 --json
|
|
259
|
+
artdam download 50707 --out ./assets
|
|
260
|
+
|
|
261
|
+
# 4. 搜索 → 批量打标签
|
|
262
|
+
artdam search "安妮" --json
|
|
263
|
+
artdam tag add 50707 5
|
|
264
|
+
artdam tag add 50708 5
|
|
265
|
+
|
|
266
|
+
# 5. 上传并更新描述
|
|
267
|
+
artdam upload ./new_asset.jpg --folder 10
|
|
268
|
+
artdam update <asset_id> --description "AI 生成的场景描述"
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## 注意事项
|
|
272
|
+
|
|
273
|
+
- 建议每次使用前更新到最新版:`uv tool upgrade artdam-cli`
|
|
274
|
+
- 首次使用先运行 `artdam projects` 获取项目 ID,再 `artdam project use <id>` 设置默认项目
|
|
275
|
+
- 设置默认项目后,`search` / `tags` / `folders` / `upload` 等命令无需再传 `-p`
|
|
276
|
+
- `-p` 仍可临时覆盖默认项目
|
|
277
|
+
- `--json` 返回原始 JSON,适合程序解析
|
|
278
|
+
- token 保存在 `~/.artdam/config.json`,登录一次长期有效
|
|
279
|
+
- `artdam delete` 是软删除,可用 `artdam restore` 恢复
|
|
280
|
+
- Windows CMD 下中文乱码时,在命令前加 `PYTHONUTF8=1`
|
|
281
|
+
|
|
282
|
+
## 配置文件
|
|
283
|
+
|
|
284
|
+
登录信息保存在 `~/.artdam/config.json`:
|
|
285
|
+
|
|
286
|
+
```json
|
|
287
|
+
{
|
|
288
|
+
"base_url": "https://artdam.xindong.com",
|
|
289
|
+
"token": "eyJ...",
|
|
290
|
+
"default_project": 1
|
|
291
|
+
}
|
|
292
|
+
```
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# artdam-cli
|
|
2
|
+
|
|
3
|
+
ArtDAM 数字资产管理平台命令行工具,支持所有主流 AI Agent工具接入
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv tool install artdam-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 更新
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
uv tool upgrade artdam-cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 快速开始
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 登录(默认走 SSO,自动打开浏览器完成授权)
|
|
21
|
+
artdam login
|
|
22
|
+
|
|
23
|
+
# 用账号密码登录
|
|
24
|
+
artdam login --password --username <用户名>
|
|
25
|
+
|
|
26
|
+
# 查看可访问的项目列表(获取项目 ID)
|
|
27
|
+
artdam projects
|
|
28
|
+
|
|
29
|
+
# 设置默认项目(之后无需每次输入 -p)
|
|
30
|
+
artdam project use 1
|
|
31
|
+
|
|
32
|
+
# 搜索资产
|
|
33
|
+
artdam search "关键词"
|
|
34
|
+
|
|
35
|
+
# 查看资产详情
|
|
36
|
+
artdam get 123
|
|
37
|
+
|
|
38
|
+
# 下载资产
|
|
39
|
+
artdam download 123 --out ./downloads
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 命令说明
|
|
43
|
+
|
|
44
|
+
### 查询命令(viewer 及以上)
|
|
45
|
+
|
|
46
|
+
#### `artdam projects`
|
|
47
|
+
|
|
48
|
+
列出当前用户可访问的所有项目(含 ID)。
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
artdam projects
|
|
52
|
+
artdam projects --json # 输出原始 JSON(AI Agent 用)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### `artdam project use / show`
|
|
56
|
+
|
|
57
|
+
设置或查看默认项目,设置后所有命令无需再传 `-p`。
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
artdam project use 1 # 设置默认项目 ID 为 1
|
|
61
|
+
artdam project show # 查看当前默认项目
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### `artdam login`
|
|
65
|
+
|
|
66
|
+
登录 ArtDAM,保存 token 到本地 `~/.artdam/config.json`。
|
|
67
|
+
|
|
68
|
+
**默认走 SSO 浏览器授权**(推荐):
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
artdam login
|
|
72
|
+
# 自动打开浏览器 → 完成公司 SSO 授权 → token 写入本地配置
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**账号密码登录**(仅管理员 / 服务账号):
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
artdam login --password --username <用户名>
|
|
79
|
+
# 回车后提示输入密码(不回显)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
| 参数 | 说明 |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `--url` | 服务器地址(默认已内置,无需填写) |
|
|
85
|
+
| `--password` | 切换为账号密码模式(不加此 flag 默认走 SSO) |
|
|
86
|
+
| `--username` | 用户名(仅 `--password` 模式) |
|
|
87
|
+
|
|
88
|
+
#### `artdam search`
|
|
89
|
+
|
|
90
|
+
搜索资产,返回匹配列表。
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
artdam search "场景" # 使用默认项目
|
|
94
|
+
artdam search "场景" --project 1 # 临时指定项目
|
|
95
|
+
artdam search "场景" --limit 50
|
|
96
|
+
artdam search "场景" --type image/png
|
|
97
|
+
artdam search "场景" --folder 10
|
|
98
|
+
artdam search "场景" --json # 输出原始 JSON(AI Agent 用)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
| 参数 | 说明 |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `KEYWORD` | 搜索关键词 |
|
|
104
|
+
| `-p, --project` | 项目 ID(省略则使用默认项目) |
|
|
105
|
+
| `-n, --limit` | 返回数量上限(默认 20) |
|
|
106
|
+
| `--type` | 文件类型,如 `image/png` |
|
|
107
|
+
| `--folder` | 限定文件夹 ID |
|
|
108
|
+
| `--json` | 输出原始 JSON |
|
|
109
|
+
|
|
110
|
+
#### `artdam get`
|
|
111
|
+
|
|
112
|
+
查看单个资产详情(含预览链接)。
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
artdam get 123
|
|
116
|
+
artdam get 123 --json # 输出原始 JSON(AI Agent 用)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### `artdam download`
|
|
120
|
+
|
|
121
|
+
下载资产文件到本地。
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
artdam download 123
|
|
125
|
+
artdam download 123 --out ./downloads
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### `artdam tags`
|
|
129
|
+
|
|
130
|
+
列出项目标签。
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
artdam tags # 使用默认项目
|
|
134
|
+
artdam tags --search "角色"
|
|
135
|
+
artdam tags --json
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### `artdam folders`
|
|
139
|
+
|
|
140
|
+
查看文件夹结构。
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
artdam folders # 使用默认项目
|
|
144
|
+
artdam folders --json
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 资产管理(member 及以上)
|
|
148
|
+
|
|
149
|
+
#### `artdam upload`
|
|
150
|
+
|
|
151
|
+
上传文件到指定项目和文件夹。
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
artdam upload ./image.jpg # 使用默认项目
|
|
155
|
+
artdam upload ./image.jpg --folder 10
|
|
156
|
+
artdam upload ./image.jpg --project 1 # 临时指定项目
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### `artdam update`
|
|
160
|
+
|
|
161
|
+
更新资产信息(可同时传多个选项)。
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
artdam update 123 --name "新文件名"
|
|
165
|
+
artdam update 123 --description "新描述"
|
|
166
|
+
artdam update 123 --folder 10
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### `artdam delete`
|
|
170
|
+
|
|
171
|
+
软删除资产(可通过 `restore` 恢复)。
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
artdam delete 123
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### `artdam restore`
|
|
178
|
+
|
|
179
|
+
恢复已删除的资产。
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
artdam restore 123
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### 标签管理(member 及以上)
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# 给资产添加标签
|
|
189
|
+
artdam tag add 123 5
|
|
190
|
+
|
|
191
|
+
# 从资产移除标签
|
|
192
|
+
artdam tag remove 123 5
|
|
193
|
+
|
|
194
|
+
# 创建新标签(省略 -p 则使用默认项目)
|
|
195
|
+
artdam tag create "标签名"
|
|
196
|
+
artdam tag create "标签名" --project 1
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 文件夹管理(member 及以上)
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# 创建文件夹(省略 -p 则使用默认项目)
|
|
203
|
+
artdam folder create "文件夹名"
|
|
204
|
+
artdam folder create "子文件夹" --parent 10
|
|
205
|
+
|
|
206
|
+
# 删除文件夹
|
|
207
|
+
artdam folder delete 10
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 互动操作(member 及以上)
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# 评论
|
|
214
|
+
artdam comment 123 "评论内容"
|
|
215
|
+
|
|
216
|
+
# 评分(1-5 星)
|
|
217
|
+
artdam rate 123 4
|
|
218
|
+
|
|
219
|
+
# 收藏 / 取消收藏
|
|
220
|
+
artdam favorite 123
|
|
221
|
+
artdam favorite 123 --remove
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## AI Agent 使用指南
|
|
225
|
+
|
|
226
|
+
所有查询命令支持 `--json` 输出原始 JSON,适合 Agent 解析:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
artdam projects --json
|
|
230
|
+
artdam search "安妮" --json
|
|
231
|
+
artdam get 123 --json
|
|
232
|
+
artdam tags --json
|
|
233
|
+
artdam folders --json
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 典型 Agent 工作流
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# 1. 登录(SSO 浏览器授权,完成后自动保存 token)
|
|
240
|
+
artdam login
|
|
241
|
+
|
|
242
|
+
# 2. 查询项目列表,选择目标项目并设为默认
|
|
243
|
+
artdam projects --json
|
|
244
|
+
artdam project use 1
|
|
245
|
+
|
|
246
|
+
# 3. 搜索 → 确认 → 下载
|
|
247
|
+
artdam search "头盔" --json
|
|
248
|
+
artdam get 50707 --json
|
|
249
|
+
artdam download 50707 --out ./assets
|
|
250
|
+
|
|
251
|
+
# 4. 搜索 → 批量打标签
|
|
252
|
+
artdam search "安妮" --json
|
|
253
|
+
artdam tag add 50707 5
|
|
254
|
+
artdam tag add 50708 5
|
|
255
|
+
|
|
256
|
+
# 5. 上传并更新描述
|
|
257
|
+
artdam upload ./new_asset.jpg --folder 10
|
|
258
|
+
artdam update <asset_id> --description "AI 生成的场景描述"
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## 注意事项
|
|
262
|
+
|
|
263
|
+
- 建议每次使用前更新到最新版:`uv tool upgrade artdam-cli`
|
|
264
|
+
- 首次使用先运行 `artdam projects` 获取项目 ID,再 `artdam project use <id>` 设置默认项目
|
|
265
|
+
- 设置默认项目后,`search` / `tags` / `folders` / `upload` 等命令无需再传 `-p`
|
|
266
|
+
- `-p` 仍可临时覆盖默认项目
|
|
267
|
+
- `--json` 返回原始 JSON,适合程序解析
|
|
268
|
+
- token 保存在 `~/.artdam/config.json`,登录一次长期有效
|
|
269
|
+
- `artdam delete` 是软删除,可用 `artdam restore` 恢复
|
|
270
|
+
- Windows CMD 下中文乱码时,在命令前加 `PYTHONUTF8=1`
|
|
271
|
+
|
|
272
|
+
## 配置文件
|
|
273
|
+
|
|
274
|
+
登录信息保存在 `~/.artdam/config.json`:
|
|
275
|
+
|
|
276
|
+
```json
|
|
277
|
+
{
|
|
278
|
+
"base_url": "https://artdam.xindong.com",
|
|
279
|
+
"token": "eyJ...",
|
|
280
|
+
"default_project": 1
|
|
281
|
+
}
|
|
282
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import click
|
|
2
2
|
|
|
3
|
-
from artdam_cli import client
|
|
3
|
+
from artdam_cli import client, config
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
@click.group(name="folder")
|
|
@@ -10,10 +10,11 @@ def folder_group() -> None:
|
|
|
10
10
|
|
|
11
11
|
@folder_group.command(name="create")
|
|
12
12
|
@click.argument("name")
|
|
13
|
-
@click.option("--project", "-p", type=int,
|
|
13
|
+
@click.option("--project", "-p", type=int, default=None, help="项目 ID(省略则使用默认项目)")
|
|
14
14
|
@click.option("--parent", type=int, default=None, help="父文件夹 ID(不填则创建在根目录)")
|
|
15
|
-
def folder_create(name: str, project: int, parent: int | None) -> None:
|
|
15
|
+
def folder_create(name: str, project: int | None, parent: int | None) -> None:
|
|
16
16
|
"""创建文件夹。"""
|
|
17
|
+
project = config.require_project(project)
|
|
17
18
|
body: dict = {"name": name, "project_id": project}
|
|
18
19
|
if parent is not None:
|
|
19
20
|
body["parent_id"] = parent
|
|
@@ -4,7 +4,7 @@ import click
|
|
|
4
4
|
from rich.console import Console
|
|
5
5
|
from rich.tree import Tree
|
|
6
6
|
|
|
7
|
-
from artdam_cli import client
|
|
7
|
+
from artdam_cli import client, config
|
|
8
8
|
|
|
9
9
|
console = Console()
|
|
10
10
|
|
|
@@ -17,10 +17,11 @@ def _build_tree(node: Tree, items: list[dict], parent_id: int | None) -> None:
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
@click.command()
|
|
20
|
-
@click.option("--project", "-p",
|
|
20
|
+
@click.option("--project", "-p", default=None, type=int, help="项目 ID(省略则使用默认项目)")
|
|
21
21
|
@click.option("--json", "as_json", is_flag=True, help="输出原始 JSON")
|
|
22
|
-
def folders(project: int, as_json: bool) -> None:
|
|
22
|
+
def folders(project: int | None, as_json: bool) -> None:
|
|
23
23
|
"""查看文件夹结构。"""
|
|
24
|
+
project = config.require_project(project)
|
|
24
25
|
data = client.get("/api/collections/", params={"project_id": project})
|
|
25
26
|
items = data if isinstance(data, list) else data.get("items", [])
|
|
26
27
|
|