@vitex/tcm-cli 0.3.3 → 0.3.4

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.
package/README.md CHANGED
@@ -198,7 +198,7 @@ tcm comment list --startDate 2025-01-01 --endDate 2025-01-31 \
198
198
  ### material / draft / item — 素材 / 草稿 / 作品
199
199
 
200
200
  - `material`:`list`、`get`、`create`、`update`、`upload`
201
- - `draft`:`list`、`create`、`create-urls`、`discard`
201
+ - `draft`:`list`、`create`、`create-urls`、`update`、`discard`
202
202
  - `item`:`list`
203
203
 
204
204
  ### tool — 本地取数工具
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitex/tcm-cli",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "TCM 控制台命令行工具(面向 agent,JSON 输入输出)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,7 +26,8 @@ export default {
26
26
  title: string('标题'),
27
27
  description: string('描述'),
28
28
  tags: array('标签'),
29
- hashtags: array('话题'),
29
+ hashtags: array('话题,最多 5 个'),
30
+ musicKeyword: string('音乐关键词,发布时用于搜索配乐'),
30
31
  extra: json('扩展字段 JSON'),
31
32
  files: array('本地文件路径,可重复传入', { required: true }),
32
33
  },
@@ -37,6 +38,7 @@ export default {
37
38
  formData.append('description', p.description || '')
38
39
  formData.append('tags', JSON.stringify(p.tags || []))
39
40
  formData.append('hashtags', JSON.stringify(p.hashtags || []))
41
+ if (p.musicKeyword) formData.append('musicKeyword', p.musicKeyword)
40
42
  formData.append('extra', JSON.stringify(p.extra || {}))
41
43
  for (const file of p.files) await appendFile(formData, 'files', file)
42
44
  return { method: 'POST', path: '/api/post/draft/create', formData }
@@ -49,7 +51,8 @@ export default {
49
51
  title: string('标题'),
50
52
  description: string('描述'),
51
53
  tags: array('标签'),
52
- hashtags: array('话题'),
54
+ hashtags: array('话题,最多 5 个'),
55
+ musicKeyword: string('音乐关键词,发布时用于搜索配乐'),
53
56
  extra: json('扩展字段 JSON'),
54
57
  imageUrls: array('图片 URL 列表'),
55
58
  videoUrl: string('视频 URL'),
@@ -57,9 +60,41 @@ export default {
57
60
  build: (p) =>
58
61
  post(
59
62
  '/api/post/open/draft/create',
60
- pick(p, ['type', 'title', 'description', 'tags', 'hashtags', 'extra', 'imageUrls', 'videoUrl']),
63
+ pick(p, ['type', 'title', 'description', 'tags', 'hashtags', 'musicKeyword', 'extra', 'imageUrls', 'videoUrl']),
61
64
  ),
62
65
  },
66
+ update: {
67
+ summary: '修改草稿(仅 DRAFT 状态;整体覆盖,未传的字段会被清空或校验失败)',
68
+ params: {
69
+ id: id('草稿 ID'),
70
+ type: string('类型:VIDEO / NOTE', { required: true }),
71
+ title: string('标题'),
72
+ description: string('描述'),
73
+ tags: array('标签'),
74
+ hashtags: array('话题,最多 5 个'),
75
+ musicKeyword: string('音乐关键词,发布时用于搜索配乐'),
76
+ extra: json('扩展字段 JSON'),
77
+ medias: json(
78
+ '修改后的素材(按顺序):[{"url":"保留的已有素材地址"},{"file":0}],file 为 --files 中的下标(从 0 开始)',
79
+ { required: true },
80
+ ),
81
+ files: array('新上传的本地文件路径,可重复传入;每个文件都要在 medias 中被引用一次'),
82
+ },
83
+ build: async (p) => {
84
+ const formData = new FormData()
85
+ formData.append('id', String(p.id))
86
+ formData.append('type', p.type)
87
+ formData.append('title', p.title || '')
88
+ formData.append('description', p.description || '')
89
+ formData.append('tags', JSON.stringify(p.tags || []))
90
+ formData.append('hashtags', JSON.stringify(p.hashtags || []))
91
+ if (p.musicKeyword) formData.append('musicKeyword', p.musicKeyword)
92
+ formData.append('extra', JSON.stringify(p.extra || {}))
93
+ formData.append('medias', JSON.stringify(p.medias || []))
94
+ for (const file of p.files || []) await appendFile(formData, 'files', file)
95
+ return { method: 'POST', path: '/api/post/draft/update', formData }
96
+ },
97
+ },
63
98
  discard: {
64
99
  summary: '丢弃草稿',
65
100
  params: { id: id('草稿 ID') },