artdam-cli 0.6.1__tar.gz → 0.7.0__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.6.1/artdam_cli.egg-info → artdam_cli-0.7.0}/PKG-INFO +19 -1
- artdam_cli-0.6.1/PKG-INFO → artdam_cli-0.7.0/README.md +296 -290
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/client.py +10 -0
- artdam_cli-0.7.0/artdam_cli/commands/share.py +68 -0
- artdam_cli-0.7.0/artdam_cli/commands/share_errors.py +39 -0
- artdam_cli-0.7.0/artdam_cli/commands/share_support.py +246 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/config.py +15 -8
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/main.py +2 -0
- artdam_cli-0.6.1/README.md → artdam_cli-0.7.0/artdam_cli.egg-info/PKG-INFO +308 -278
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli.egg-info/SOURCES.txt +9 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/pyproject.toml +1 -1
- artdam_cli-0.7.0/tests/test_share.py +206 -0
- artdam_cli-0.7.0/tests/test_share_lifecycle.py +102 -0
- artdam_cli-0.7.0/tests/test_share_revision.py +165 -0
- artdam_cli-0.7.0/tests/test_share_security.py +106 -0
- artdam_cli-0.7.0/tests/test_share_validation.py +96 -0
- artdam_cli-0.7.0/tests/test_share_wait.py +198 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/__init__.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/__init__.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/ai_model.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/comment.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/delete_cmd.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/download.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/engine.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/favorite.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/folder_cmd.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/folders.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/get.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/login.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/project.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/projects.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/rate.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/restore.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/search.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/tag_cmd.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/tags.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/update.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/commands/upload.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/display.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/search_query.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/update_check.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli/uploader.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli.egg-info/dependency_links.txt +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli.egg-info/entry_points.txt +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli.egg-info/requires.txt +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/artdam_cli.egg-info/top_level.txt +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/setup.cfg +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/tests/test_ai_model.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/tests/test_display_policy.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/tests/test_login.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/tests/test_main_entry.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/tests/test_search_notices.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/tests/test_search_pagination.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/tests/test_search_scope_contract.py +0 -0
- {artdam_cli-0.6.1 → artdam_cli-0.7.0}/tests/test_uploader.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: artdam-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: ArtDAM 数字资产管理平台命令行工具
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -146,6 +146,24 @@ artdam folders --project 1
|
|
|
146
146
|
artdam folders --project 1 --json
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
+
### 批量直链分享(0.7.0)
|
|
150
|
+
|
|
151
|
+
使用含 `read`、`write` 的个人 API Key,默认 **7 天**有效;永久须显式 `--permanent`。只读 Key 和 OAuth read 令牌不能创建。直链无需登录即可打开,请谨慎传播。
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
artdam login --api-key
|
|
155
|
+
artdam share direct --folder 1234 --out links.csv
|
|
156
|
+
artdam share direct --assets 101,102,103 --expires 30d --out links.csv
|
|
157
|
+
artdam share direct --assets-file ids.txt --format json --out links.json
|
|
158
|
+
artdam share links 5678 --out links.csv
|
|
159
|
+
artdam share revoke 5678
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
CSV/JSON 字段固定为 `asset_id,filename,kind,url`,自动取全分页。`--out PATH` 指定 UTF-8 文件,否则写 stdout;分享摘要写 stderr。
|
|
163
|
+
`--out` 文件仅当前用户可访问(POSIX 0600,Windows 当前用户 ACL);权限在写入内容前收紧,失败立即停止、清理临时文件并保留旧输出。符号链接会被替换为普通文件,需要目标目录写权限。
|
|
164
|
+
|
|
165
|
+
全部参数、原子输出规则、409等待和422字段错误处理见[批量分享说明](SHARING.md)。
|
|
166
|
+
|
|
149
167
|
### 资产管理(member 及以上)
|
|
150
168
|
|
|
151
169
|
#### `artdam upload`
|
|
@@ -1,290 +1,296 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
#
|
|
33
|
-
artdam
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
#
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
|
|
67
|
-
artdam
|
|
68
|
-
artdam
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
artdam
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
artdam
|
|
146
|
-
artdam
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
artdam update
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
```bash
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
#
|
|
199
|
-
artdam tag
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
#
|
|
223
|
-
artdam
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
artdam
|
|
252
|
-
artdam
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
artdam
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
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 install artdam-cli@latest
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 快速开始
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 登录(首次使用,浏览器 SSO 授权)
|
|
21
|
+
artdam login
|
|
22
|
+
|
|
23
|
+
# 个人 API Key 登录(隐藏输入,适合本机长期使用)
|
|
24
|
+
artdam login --api-key
|
|
25
|
+
|
|
26
|
+
# 搜索资产
|
|
27
|
+
artdam search "关键词" --project 1
|
|
28
|
+
|
|
29
|
+
# 查看资产详情
|
|
30
|
+
artdam get 123
|
|
31
|
+
|
|
32
|
+
# 下载资产
|
|
33
|
+
artdam download 123 --out ./downloads
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 命令说明
|
|
37
|
+
|
|
38
|
+
### 素材名的显示口径
|
|
39
|
+
|
|
40
|
+
开了「只显示 public_id」的项目,`search` 的「素材名」列、`get` 的「素材名」行、`delete` 的
|
|
41
|
+
确认文案都显示 `public_id`(规则同网页端)。
|
|
42
|
+
|
|
43
|
+
`download` 落盘名、`get` 的「路径」行、`--json` 原始响应**照旧给真实文件名**——脱敏只在对外面
|
|
44
|
+
(发布空间 / 分享链接 / ZIP)由后端做,内部下载不变,见 PR #1036。写脚本时按
|
|
45
|
+
`display_asset_public_id_only` 字段自己判断,别拿显示名当文件名用。
|
|
46
|
+
|
|
47
|
+
### 查询命令(viewer 及以上)
|
|
48
|
+
|
|
49
|
+
#### `artdam login`
|
|
50
|
+
|
|
51
|
+
登录 ArtDAM。默认使用浏览器 SSO,也可使用个人 API Key 或账号密码。
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
artdam login # 浏览器 SSO
|
|
55
|
+
artdam login --api-key # 隐藏输入个人 ab_ API Key
|
|
56
|
+
artdam login --password # 账号密码(仅 admin / 服务账号)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`--api-key` 会通过只读的 `GET /api/auth/me` 验证密钥,再保存到
|
|
60
|
+
`~/.artdam/config.json`(Linux/macOS 为 `0600`,Windows 收紧为仅当前用户 ACL)。
|
|
61
|
+
命令行参数和输出都不会显示密钥。
|
|
62
|
+
|
|
63
|
+
无人值守脚本和 Agent 可直接使用环境变量,无需执行登录,也不会把密钥写入配置文件:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
export ARTDAM_API_KEY='ab_...'
|
|
67
|
+
export ARTDAM_BASE_URL='https://artdam.xindong.com' # 可选
|
|
68
|
+
artdam search "头盔" --project 1 --json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
个人 API Key 代表创建它的用户,最终能力始终是**用户在项目中的角色权限 ∩ Key 的权限范围
|
|
72
|
+
(scope)**。例如 viewer 用户即使 Key 含 `write` 也不能上传;只有 `read` 的 Key 不能执行写操作。
|
|
73
|
+
|
|
74
|
+
#### `artdam search`
|
|
75
|
+
|
|
76
|
+
搜索资产,返回匹配列表。默认只取首页(`--limit` 条);加 `--all` 自动翻页取全部结果
|
|
77
|
+
(Agent 场景推荐,避免结果被截断)。`--all` 最多返回 1000 条,超出会提示用更精确的关键词或
|
|
78
|
+
`--ext` / `--folder` 收窄,避免在几万条资产上卡死。
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
artdam search "头盔" --project 1
|
|
82
|
+
artdam search "头盔" --project 1 --limit 50
|
|
83
|
+
artdam search "头盔" --project 1 --all # 自动翻页,取全部匹配
|
|
84
|
+
artdam search "头盔" --project 1 --all --json # 全量 JSON 输出(AI Agent 用)
|
|
85
|
+
artdam search "头盔" --project 1 --ext jpg # 按扩展名过滤
|
|
86
|
+
artdam search "头盔" --project 1 --ext jpg,png # 多个扩展名
|
|
87
|
+
artdam search "头盔" --project 1 --folder 10
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
| 参数 | 说明 |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `KEYWORD` | 搜索关键词 |
|
|
93
|
+
| `-p, --project` | 项目 ID(必填) |
|
|
94
|
+
| `-n, --limit` | 返回数量上限,默认 20(不与 `--all` 共用) |
|
|
95
|
+
| `--all` | 自动翻页取全部匹配结果(最多 1000 条) |
|
|
96
|
+
| `-e, --ext` | 按文件扩展名过滤,逗号分隔,如 `jpg,png` |
|
|
97
|
+
| `--folder` | 限定文件夹 ID |
|
|
98
|
+
| `--json` | 输出原始 JSON |
|
|
99
|
+
|
|
100
|
+
#### `artdam get`
|
|
101
|
+
|
|
102
|
+
查看单个资产详情(含预览链接)。
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
artdam get 123
|
|
106
|
+
artdam get 123 --json # 输出原始 JSON(AI Agent 用)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### `artdam download`
|
|
110
|
+
|
|
111
|
+
下载资产文件到本地。
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
artdam download 123
|
|
115
|
+
artdam download 123 --out ./downloads
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### `artdam tags`
|
|
119
|
+
|
|
120
|
+
列出项目标签。
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
artdam tags --project 1
|
|
124
|
+
artdam tags --project 1 --search "角色"
|
|
125
|
+
artdam tags --project 1 --json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### `artdam folders`
|
|
129
|
+
|
|
130
|
+
查看文件夹结构。
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
artdam folders --project 1
|
|
134
|
+
artdam folders --project 1 --json
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 批量直链分享(0.7.0)
|
|
138
|
+
|
|
139
|
+
使用含 `read`、`write` 的个人 API Key,默认 **7 天**有效;永久须显式 `--permanent`。只读 Key 和 OAuth read 令牌不能创建。直链无需登录即可打开,请谨慎传播。
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
artdam login --api-key
|
|
143
|
+
artdam share direct --folder 1234 --out links.csv
|
|
144
|
+
artdam share direct --assets 101,102,103 --expires 30d --out links.csv
|
|
145
|
+
artdam share direct --assets-file ids.txt --format json --out links.json
|
|
146
|
+
artdam share links 5678 --out links.csv
|
|
147
|
+
artdam share revoke 5678
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
CSV/JSON 字段固定为 `asset_id,filename,kind,url`,自动取全分页。`--out PATH` 指定 UTF-8 文件,否则写 stdout;分享摘要写 stderr。
|
|
151
|
+
`--out` 文件仅当前用户可访问(POSIX 0600,Windows 当前用户 ACL);权限在写入内容前收紧,失败立即停止、清理临时文件并保留旧输出。符号链接会被替换为普通文件,需要目标目录写权限。
|
|
152
|
+
|
|
153
|
+
全部参数、原子输出规则、409等待和422字段错误处理见[批量分享说明](SHARING.md)。
|
|
154
|
+
|
|
155
|
+
### 资产管理(member 及以上)
|
|
156
|
+
|
|
157
|
+
#### `artdam upload`
|
|
158
|
+
|
|
159
|
+
上传文件到指定项目和文件夹。采用分块上传,支持大文件(最大 10GB),带进度条;
|
|
160
|
+
上传前按内容计算 SHA-256,库中已有相同文件则**秒传**(直接复用,不重复传输)。
|
|
161
|
+
单个分块遇到网络抖动(超时 / 5xx)会自动重试,中断时清理服务端会话。
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
artdam upload ./image.jpg --project 1
|
|
165
|
+
artdam upload ./image.jpg --project 1 --folder 10
|
|
166
|
+
artdam upload ./big_scene.zip --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
|
+
# 创建新标签
|
|
205
|
+
artdam tag create "标签名" --project 1
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 文件夹管理(member 及以上)
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# 创建文件夹
|
|
212
|
+
artdam folder create "文件夹名" --project 1
|
|
213
|
+
artdam folder create "子文件夹" --project 1 --parent 10
|
|
214
|
+
|
|
215
|
+
# 删除文件夹
|
|
216
|
+
artdam folder delete 10
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### 互动操作(member 及以上)
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
# 评论
|
|
223
|
+
artdam comment 123 "评论内容"
|
|
224
|
+
|
|
225
|
+
# 评分(1-5 星)
|
|
226
|
+
artdam rate 123 4
|
|
227
|
+
|
|
228
|
+
# 收藏 / 取消收藏
|
|
229
|
+
artdam favorite 123
|
|
230
|
+
artdam favorite 123 --remove
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## AI Agent 使用指南
|
|
234
|
+
|
|
235
|
+
所有查询命令支持 `--json` 输出原始 JSON,适合 Agent 解析:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
artdam search "安妮" --project 1 --json
|
|
239
|
+
artdam get 123 --json
|
|
240
|
+
artdam tags --project 1 --json
|
|
241
|
+
artdam folders --project 1 --json
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### 典型 Agent 工作流
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# 1. 登录(本机可用 SSO;无人值守 Agent 推荐 ARTDAM_API_KEY)
|
|
248
|
+
export ARTDAM_API_KEY='ab_...'
|
|
249
|
+
|
|
250
|
+
# 2. 搜索 → 确认 → 下载
|
|
251
|
+
artdam search "头盔" --project 1 --json
|
|
252
|
+
artdam get 50707 --json
|
|
253
|
+
artdam download 50707 --out ./assets
|
|
254
|
+
|
|
255
|
+
# 3. 搜索 → 批量打标签
|
|
256
|
+
artdam search "安妮" --project 1 --json
|
|
257
|
+
artdam tag add 50707 5
|
|
258
|
+
artdam tag add 50708 5
|
|
259
|
+
|
|
260
|
+
# 4. 上传并更新描述
|
|
261
|
+
artdam upload ./new_asset.jpg --project 1 --folder 10
|
|
262
|
+
artdam update <asset_id> --description "AI 生成的场景描述"
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## 注意事项
|
|
266
|
+
|
|
267
|
+
- `--project` 参数为**数字 ID**,不是项目名称
|
|
268
|
+
- `--json` 返回原始 JSON,适合程序解析
|
|
269
|
+
- SSO/JWT 或手动输入的 API Key 保存在 `~/.artdam/config.json`,仅当前用户可读写
|
|
270
|
+
- `ARTDAM_API_KEY` 优先于配置文件中的登录凭据,且不会被写入配置或输出
|
|
271
|
+
- API Key 能力受用户项目角色和 Key scope 双重限制
|
|
272
|
+
- `artdam delete` 是软删除,可用 `artdam restore` 恢复
|
|
273
|
+
|
|
274
|
+
## 配置文件
|
|
275
|
+
|
|
276
|
+
登录信息保存在 `~/.artdam/config.json`:
|
|
277
|
+
|
|
278
|
+
```json
|
|
279
|
+
{
|
|
280
|
+
"base_url": "https://artdam.xindong.com",
|
|
281
|
+
"api_key": "ab_..."
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
SSO 或密码登录时凭据字段为 `"token": "eyJ..."`。请勿提交此配置文件或在日志中打印其内容。
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
### 搜索范围与分页契约
|
|
289
|
+
|
|
290
|
+
artdam search 默认 --scope project,与网页项目工作区相同,包含自有素材与引用。仅查自有请显式使用 --scope owned;--scope global 查当前凭证可见全库;--scope published 查发布空间(可用 --project 显式筛选)。
|
|
291
|
+
|
|
292
|
+
artdam search "游戏特效" --project 1 --page 2 --limit 50 --json
|
|
293
|
+
artdam search "鞋子" --scope global --json
|
|
294
|
+
artdam search "特效设计" --scope published --project 1 --json
|
|
295
|
+
|
|
296
|
+
--json 现在返回分页对象,素材数组在 items,并保留 total、page、page_size、truncated。已有把 JSON 顶层当数组的脚本需改读 items。truncated=true 表示服务端召回不完整;--all 的 1000 条本地上限另用 fetch_capped 表达,不修改服务端截断语义。CLI 不再本地匹配、排序或去重。
|
|
@@ -83,6 +83,16 @@ def post(path: str, json: dict | None = None) -> dict:
|
|
|
83
83
|
return r.json() if r.status_code != 204 else {}
|
|
84
84
|
|
|
85
85
|
|
|
86
|
+
def post_direct_share(body: dict) -> httpx.Response:
|
|
87
|
+
"""Single creation attempt; caller handles readiness/disabled/validation errors.
|
|
88
|
+
|
|
89
|
+
Never retry POST on transport errors or 5xx: the server may already have
|
|
90
|
+
created the share. Only an explicit readiness conflict is safe to retry.
|
|
91
|
+
"""
|
|
92
|
+
with _make_client() as c:
|
|
93
|
+
return c.post("/api/share-links/", json=body)
|
|
94
|
+
|
|
95
|
+
|
|
86
96
|
def patch(path: str, json: dict) -> dict:
|
|
87
97
|
with _make_client() as c:
|
|
88
98
|
r = c.patch(path, json=json)
|