zerocut-cli 0.1.0
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/.eslintrc.js +11 -0
- package/.prettierignore +3 -0
- package/.prettierrc.json +6 -0
- package/README.md +205 -0
- package/dist/bin/zerocut.d.ts +2 -0
- package/dist/bin/zerocut.js +5 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +24 -0
- package/dist/commands/config.d.ts +4 -0
- package/dist/commands/config.js +129 -0
- package/dist/commands/ffmpeg.d.ts +4 -0
- package/dist/commands/ffmpeg.js +32 -0
- package/dist/commands/foo.d.ts +4 -0
- package/dist/commands/foo.js +14 -0
- package/dist/commands/help.d.ts +4 -0
- package/dist/commands/help.js +14 -0
- package/dist/commands/image.d.ts +4 -0
- package/dist/commands/image.js +149 -0
- package/dist/commands/music.d.ts +4 -0
- package/dist/commands/music.js +74 -0
- package/dist/commands/pandoc.d.ts +4 -0
- package/dist/commands/pandoc.js +32 -0
- package/dist/commands/skill.d.ts +4 -0
- package/dist/commands/skill.js +24 -0
- package/dist/commands/tts.d.ts +4 -0
- package/dist/commands/tts.js +74 -0
- package/dist/commands/video.d.ts +4 -0
- package/dist/commands/video.js +166 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -0
- package/dist/services/cerevox.d.ts +34 -0
- package/dist/services/cerevox.js +256 -0
- package/dist/services/commandLoader.d.ts +3 -0
- package/dist/services/commandLoader.js +80 -0
- package/dist/services/config.d.ts +15 -0
- package/dist/services/config.js +235 -0
- package/dist/skill/SKILL.md +133 -0
- package/dist/types/command.d.ts +6 -0
- package/dist/types/command.js +2 -0
- package/dist/utils/progress.d.ts +1 -0
- package/dist/utils/progress.js +13 -0
- package/eslint.config.js +30 -0
- package/package.json +52 -0
- package/scripts/copy-skill-md.cjs +8 -0
- package/src/bin/zerocut.ts +3 -0
- package/src/cli.ts +25 -0
- package/src/commands/config.ts +130 -0
- package/src/commands/ffmpeg.ts +37 -0
- package/src/commands/help.ts +13 -0
- package/src/commands/image.ts +194 -0
- package/src/commands/music.ts +78 -0
- package/src/commands/pandoc.ts +37 -0
- package/src/commands/skill.ts +20 -0
- package/src/commands/tts.ts +80 -0
- package/src/commands/video.ts +202 -0
- package/src/index.ts +1 -0
- package/src/services/cerevox.ts +296 -0
- package/src/services/commandLoader.ts +42 -0
- package/src/services/config.ts +230 -0
- package/src/skill/SKILL.md +209 -0
- package/src/types/command.ts +7 -0
- package/src/utils/progress.ts +10 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "zerocut-cli-tools"
|
|
3
|
+
description: "Use ZeroCut CLI media and document tools. Invoke when user needs generate media, run ffmpeg/pandoc, sync resources, or save outputs."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ZeroCut CLI Tools
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
This skill provides a single reference for using ZeroCut CLI commands:
|
|
11
|
+
|
|
12
|
+
- image generation
|
|
13
|
+
- video generation
|
|
14
|
+
- music generation
|
|
15
|
+
- text-to-speech
|
|
16
|
+
- ffmpeg sandbox execution
|
|
17
|
+
- pandoc sandbox execution
|
|
18
|
+
|
|
19
|
+
## When To Invoke
|
|
20
|
+
|
|
21
|
+
Invoke this skill when the user asks to:
|
|
22
|
+
|
|
23
|
+
- generate image, video, music, or speech audio
|
|
24
|
+
- run ffmpeg or ffprobe command in sandbox
|
|
25
|
+
- run pandoc conversion in sandbox
|
|
26
|
+
- sync local/remote resources into sandbox
|
|
27
|
+
- save generated results to local output files
|
|
28
|
+
|
|
29
|
+
## Required Pre-Check
|
|
30
|
+
|
|
31
|
+
Before every task, the agent must check configuration first:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx zerocut-cli config list
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If `apiKey` is missing or empty, require user to configure via OTT exchange first:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx zerocut-cli config --ott <token> --region <cn|us>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Notes:
|
|
44
|
+
|
|
45
|
+
- `region` must be `cn` or `us`
|
|
46
|
+
- OTT exchange writes `apiKey` and `region` into config
|
|
47
|
+
- when running `config key` without direct key, region must be `cn|us` and OTT is required
|
|
48
|
+
|
|
49
|
+
## Command Reference
|
|
50
|
+
|
|
51
|
+
### image
|
|
52
|
+
|
|
53
|
+
Default action: `create`
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx zerocut-cli image --prompt "a cat on a bike" --output out.png
|
|
57
|
+
npx zerocut-cli image create --prompt "a cat on a bike" --model seedream-5l --aspectRatio 1:1 --resolution 1K --refs ref1.png,ref2.jpg --output out.png
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Options:
|
|
61
|
+
|
|
62
|
+
- `--prompt <prompt>` required
|
|
63
|
+
- `--model <model>`
|
|
64
|
+
- `--aspectRatio <ratio>`
|
|
65
|
+
- `--resolution <resolution>`
|
|
66
|
+
- `--refs <refs>` comma-separated local paths or URLs
|
|
67
|
+
- `--output <file>` save generated file
|
|
68
|
+
|
|
69
|
+
Validation rules:
|
|
70
|
+
|
|
71
|
+
- `--prompt` must be non-empty
|
|
72
|
+
- `--model` allowed: `seedream|seedream-pro|seedream-5l|banana|banana2|banana-pro|wan`
|
|
73
|
+
- `--aspectRatio` allowed: `1:1|3:4|4:3|16:9|9:16|2:3|3:2|21:9|1:4|4:1|1:8|8:1`
|
|
74
|
+
- `--resolution` allowed: `1K|2K|4K`
|
|
75
|
+
|
|
76
|
+
### video
|
|
77
|
+
|
|
78
|
+
Default action: `create`
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npx zerocut-cli video --prompt "city night drive" --model vidu --duration 8 --output out.mp4
|
|
82
|
+
npx zerocut-cli video create --prompt "city night drive" --model vidu --aspectRatio 1:1 --refs ref1.png,ref2.png --output out.mp4
|
|
83
|
+
npx zerocut-cli video --prompt "remix this clip" --model vidu --sourceVideo input.mp4 --duration 6 --output edited.mp4
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Options:
|
|
87
|
+
|
|
88
|
+
- `--prompt <prompt>` required
|
|
89
|
+
- `--model <model>`
|
|
90
|
+
- `--duration <seconds>` integer in 1-16
|
|
91
|
+
- `--sourceVideo <video>` base video for edit mode
|
|
92
|
+
- `--seed <seed>`
|
|
93
|
+
- `--firstFrame <image>`
|
|
94
|
+
- `--lastFrame <image>`
|
|
95
|
+
- `--refs <assets>`
|
|
96
|
+
- `--resolution <resolution>`
|
|
97
|
+
- `--aspectRatio <ratio>`
|
|
98
|
+
- `--withAudio`
|
|
99
|
+
- `--optimizeCameraMotion`
|
|
100
|
+
- `--output <file>`
|
|
101
|
+
|
|
102
|
+
Validation rules:
|
|
103
|
+
|
|
104
|
+
- `--prompt` must be non-empty
|
|
105
|
+
- `--model` allowed: `zerocut3.0|seedance-1.5-pro|vidu|vidu-pro|viduq3|viduq3-turbo|kling|kling-v3|wan|wan-flash|sora2|sora2-pro|veo3.1|veo3.1-pro`
|
|
106
|
+
- `--duration` must be integer in `1-16`
|
|
107
|
+
- `--aspectRatio` allowed: `9:16|16:9|1:1`
|
|
108
|
+
|
|
109
|
+
Long video guidance:
|
|
110
|
+
|
|
111
|
+
- if required duration is over 16s, split into multiple video generations (each 1-16s)
|
|
112
|
+
- then concatenate clips with ffmpeg
|
|
113
|
+
- example:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
printf "file 'part1.mp4'\nfile 'part2.mp4'\nfile 'part3.mp4'\n" > concat.txt
|
|
117
|
+
npx zerocut-cli ffmpeg --args -f concat -safe 0 -i concat.txt -c copy final.mp4 --resources concat.txt part1.mp4 part2.mp4 part3.mp4
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### music
|
|
121
|
+
|
|
122
|
+
Default action: `create`
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npx zerocut-cli music --prompt "lofi beat" --output music.mp3
|
|
126
|
+
npx zerocut-cli music create --prompt "lofi beat" --output music.mp3
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Options:
|
|
130
|
+
|
|
131
|
+
- `--prompt <prompt>` required
|
|
132
|
+
- `--output <file>`
|
|
133
|
+
|
|
134
|
+
Validation rules:
|
|
135
|
+
|
|
136
|
+
- `--prompt` must be non-empty
|
|
137
|
+
|
|
138
|
+
### tts
|
|
139
|
+
|
|
140
|
+
Default action: `create`
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npx zerocut-cli tts --text "你好,欢迎使用 ZeroCut" --voiceId voice_xxx --output speech.mp3
|
|
144
|
+
npx zerocut-cli tts create --prompt "calm tone" --text "Hello world" --voiceId voice_xxx --output speech.mp3
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Options:
|
|
148
|
+
|
|
149
|
+
- `--prompt <prompt>`
|
|
150
|
+
- `--text <text>` required
|
|
151
|
+
- `--voiceId <voiceId>`
|
|
152
|
+
- `--output <file>`
|
|
153
|
+
|
|
154
|
+
Validation rules:
|
|
155
|
+
|
|
156
|
+
- `--text` must be non-empty
|
|
157
|
+
|
|
158
|
+
### ffmpeg
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
npx zerocut-cli ffmpeg --args -i input.mp4 -vn output.mp3 --resources input.mp4
|
|
162
|
+
npx zerocut-cli ffmpeg --args -i input.mp4 -vf scale=1280:720 output.mp4 --resources input.mp4
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Options:
|
|
166
|
+
|
|
167
|
+
- `--args <args...>` required, arguments appended after `ffmpeg`
|
|
168
|
+
- `--resources <resources...>` optional, files/URLs to sync into sandbox materials
|
|
169
|
+
|
|
170
|
+
Behavior:
|
|
171
|
+
|
|
172
|
+
- `--args` must be provided
|
|
173
|
+
- command prefix is fixed as `ffmpeg`
|
|
174
|
+
- for `ffmpeg`, `-y` is auto-injected when absent
|
|
175
|
+
- output file is auto-downloaded from sandbox to local current directory
|
|
176
|
+
|
|
177
|
+
### pandoc
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npx zerocut-cli pandoc --args input.md -o output.pdf --resources input.md
|
|
181
|
+
npx zerocut-cli pandoc --args input.md --output=output.docx --resources input.md template.docx
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Options:
|
|
185
|
+
|
|
186
|
+
- `--args <args...>` required, arguments appended after `pandoc`
|
|
187
|
+
- `--resources <resources...>` optional, files/URLs to sync into sandbox materials
|
|
188
|
+
|
|
189
|
+
Behavior:
|
|
190
|
+
|
|
191
|
+
- `--args` must be provided
|
|
192
|
+
- command prefix is fixed as `pandoc`
|
|
193
|
+
- output file is auto-downloaded only when args include `-o`, `--output`, or `--output=...`
|
|
194
|
+
|
|
195
|
+
## Output And Sync Rules
|
|
196
|
+
|
|
197
|
+
- Media URLs from generation are synced to TOS when available.
|
|
198
|
+
- `--output` saves files to an absolute path resolved from current working directory.
|
|
199
|
+
- Missing parent directories for `--output` are created automatically.
|
|
200
|
+
- File type constraints:
|
|
201
|
+
- image output uses `.png`
|
|
202
|
+
- video output uses `.mp4`
|
|
203
|
+
- audio output (`music`/`tts`) uses `.mp3`
|
|
204
|
+
- If user does not explicitly provide output file name, agent must generate one in current directory:
|
|
205
|
+
- use 3-digit incremental prefix to avoid collisions, like `001_...`, `002_...`
|
|
206
|
+
- keep file name meaningful by task content, e.g. `001_city-night-drive.mp4`, `002_lofi-beat.mp3`
|
|
207
|
+
- ffmpeg and pandoc outputs follow the same naming rule:
|
|
208
|
+
- if output path is not explicitly specified by user, agent should generate a meaningful file name with `NNN_` prefix and correct extension
|
|
209
|
+
- for pandoc, keep extension aligned with conversion target format
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function createProgressSpinner(label = "inferencing") {
|
|
2
|
+
const frames = ["|", "/", "-", "\\"];
|
|
3
|
+
let si = 0;
|
|
4
|
+
const t0 = Date.now();
|
|
5
|
+
return () => {
|
|
6
|
+
const f = frames[si++ % frames.length];
|
|
7
|
+
const sec = Math.floor((Date.now() - t0) / 1000);
|
|
8
|
+
process.stdout.write(`\r${f} ${label}... ${sec}s`);
|
|
9
|
+
};
|
|
10
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
"rootDir": "./src",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"],
|
|
14
|
+
"exclude": ["node_modules", "dist", "tests"]
|
|
15
|
+
}
|
|
16
|
+
|