@clipwright/cli 0.85.0 → 0.87.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/README.md +65 -6
- package/dist/guided.js +122 -0
- package/dist/index.js +222 -128
- package/dist/native.js +276 -0
- package/dist/output.js +162 -0
- package/dist/payload.js +120 -0
- package/dist/retry.js +34 -0
- package/dist/wait.js +120 -0
- package/dist/workflows.js +2 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -24,15 +24,15 @@ the price, are in the [`@clipwright/mcp-server` README](https://www.npmjs.com/pa
|
|
|
24
24
|
| `quote --script <text>` | Estimates the credit cost. Spends nothing. |
|
|
25
25
|
| `make --script <text>` | Renders a clip and waits for it. **Costs credits.** Prints the video URL to stdout, progress and warnings to stderr. |
|
|
26
26
|
| `upload <path>` | Uploads a local PNG/JPEG and prints the https url to pass as `--image`. Free. |
|
|
27
|
-
| `runs <id>` | Prints the state of one run. |
|
|
27
|
+
| `runs <id>` | Prints the state of one run; `--wait` waits until it ends, `--output <path>` saves its video. |
|
|
28
28
|
| `feedback --kind <kind> --text <text>` | Tells us what is missing, confusing, wrong or slow; `--run <id>` names the run it is about. We read every one. Free. |
|
|
29
29
|
| `voices` | Lists voices for `--voice` on `make`: the presets, the voices of `gemini-3.8-flash-tts`, then the catalog. `--skill make_faceless` lists the narration voices for `make-faceless` instead. Narrow it with `--language`, `--gender`, `--age`, `--use-case` and `--model`. Free. |
|
|
30
30
|
| `actors` | Lists the actors this account can use: the Clipwright catalog and your own. Free. |
|
|
31
31
|
| `quote-actor` | Estimates the cost of a personal actor. Spends nothing. |
|
|
32
32
|
| `create-actor` | Creates a personal actor from a description. **Costs credits** — one charge per requested format. Prints the run; follow it with `runs <id>`. |
|
|
33
33
|
| `quote-faceless` | Estimates the cost of a faceless video. Spends nothing. |
|
|
34
|
-
| `make-faceless` | Starts a faceless video: narration over an opening animated clip and image scenes. **Costs credits.** Prints the run; follow it with `runs <id>`. |
|
|
35
|
-
| `delete-actor <id>` | Deletes a personal actor of this account. Videos already made with it stay as they are. Free. |
|
|
34
|
+
| `make-faceless` | Starts a faceless video: narration over an opening animated clip and image scenes. **Costs credits.** Prints the run; follow it with `runs <id>`, or pass `--wait` or `--output <path>`. |
|
|
35
|
+
| `delete-actor <id>` | Deletes a personal actor of this account. Videos already made with it stay as they are. Asks first at a terminal; anywhere else it needs `--yes`. Free. |
|
|
36
36
|
| `shots <run>` | Lists the shots of a finished video: span, kind, start of the description and preview link of each. Free. |
|
|
37
37
|
| `edit-show <run>` | Prints the draft of an edit of a run as JSON. Version 0 means nothing is stored. Free. |
|
|
38
38
|
| `edit-save <run> --file <path>` | Saves the draft from a file `edit-show` printed. Charges nothing and renders nothing. |
|
|
@@ -50,6 +50,64 @@ the price, are in the [`@clipwright/mcp-server` README](https://www.npmjs.com/pa
|
|
|
50
50
|
| `plan-approve <plan> --file <path>` | Explicitly approve `{ revision, content_digest }`. Free; starts no run. |
|
|
51
51
|
| `plan-quote <plan>` | Print the approved plan's quote as JSON. Free. |
|
|
52
52
|
| `plan-run <plan> --file <path>` | Start one explicitly keyed paid workflow and print its receipt and native run immediately. |
|
|
53
|
+
| `guided --goal <text>` | Picks the way to make what the goal describes and prints the quote and start command of each step; asks when the goal does not say. Free, offline, needs no key. |
|
|
54
|
+
| `template <command>` | Prints the request a command takes: its JSON Schema, a request to fill in and the fields still to fill. Free, offline. |
|
|
55
|
+
|
|
56
|
+
## Commands named after the MCP tools
|
|
57
|
+
|
|
58
|
+
Each MCP tool in the table below is also a command, with dashes for underscores:
|
|
59
|
+
`find_trends` is `clipwright find-trends`. They print JSON. The request comes from
|
|
60
|
+
a JSON file, and `--set` overrides single fields:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
clipwright template generate-image
|
|
64
|
+
clipwright quote-image --set prompt="a lighthouse at dusk" --set model=<model> --set aspect_ratio=9:16
|
|
65
|
+
clipwright generate-image --file image.json --set aspect_ratio=1:1 --max-credits 20 --output image.png
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`--set a.b=text` sets a string and `--set a.b:=<json>` sets any JSON value; a
|
|
69
|
+
number segment is a list index (`--set clips.0.run_id=run_…`). `--file -` reads
|
|
70
|
+
the request from stdin. On a paid start, `--dry-run` prints the quote of that exact
|
|
71
|
+
request and starts nothing.
|
|
72
|
+
|
|
73
|
+
| Group | Commands |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| Runs | `get-run`, `quote-ugc`, `make-ugc` |
|
|
76
|
+
| Trends | `quote-trends`, `find-trends`, `get-trend-search`, `trend-niches` |
|
|
77
|
+
| Analysis | `quote-analysis`, `analyze-reference`, `get-reference-analysis`, `quote-creator-profile`, `analyze-creator`, `get-creator-profile`, `delete-creator-profile` |
|
|
78
|
+
| Images and clips | `list-generation-models`, `quote-image`, `generate-image`, `quote-video`, `generate-video` |
|
|
79
|
+
| Your own videos | `quote-voice`, `make-voice`, `quote-edit`, `render-edit`, `create-cut`, `get-cut`, `update-cut`, `check-cut`, `quote-cut`, `render-cut`, `quote-cut-preview`, `preview-cut`, `quote-take-check`, `check-take`, `take-frames`, `create-film-draft`, `get-film-draft`, `put-film-files`, `check-film`, `quote-render`, `render-film`, `get-film-run`, `get-film-kit`, `get-film-guide`, `get-ad-guide` |
|
|
80
|
+
| Assets and uploads | `create-asset` (also `--from-file <path>`), `list-assets`, `get-asset`, `delete-asset`, `create-upload`, `get-upload`, `delete-upload`, `delete-run-media` |
|
|
81
|
+
|
|
82
|
+
## Output for scripts and agents
|
|
83
|
+
|
|
84
|
+
When stdout or stderr is not a terminal, each stderr line is one JSON object: a
|
|
85
|
+
progress note is `{"note": …}`, a warning is `{"warning": …}`, and a failure is
|
|
86
|
+
the line `{"ok":false,"error":{…}}`. The error has a `code`, a `message`,
|
|
87
|
+
`retryable` and `fix`, the steps to take, written as commands of this CLI. When
|
|
88
|
+
they apply, it also has `choices` (the values a flag takes), `resume` (the exact
|
|
89
|
+
command to run next, quoted for a shell), `issues`, `warnings` and `next`, the
|
|
90
|
+
call that fixes the refusal. `CLIPWRIGHT_OUTPUT=text` keeps the prose;
|
|
91
|
+
`CLIPWRIGHT_OUTPUT=json` turns the JSON on at a terminal. What a command prints on
|
|
92
|
+
success does not change.
|
|
93
|
+
|
|
94
|
+
### Waiting
|
|
95
|
+
|
|
96
|
+
`--wait` waits until the run succeeds or fails and prints it. `--timeout <seconds>`
|
|
97
|
+
(600 by default) bounds the wait, and `--output <path>` saves the delivered file.
|
|
98
|
+
When the time runs out, the work goes on and the error names the command that keeps
|
|
99
|
+
waiting, such as `clipwright get-run run_… --wait`.
|
|
100
|
+
|
|
101
|
+
### Lost answers
|
|
102
|
+
|
|
103
|
+
When the answer to a paid start is lost, the CLI sends it again with the same
|
|
104
|
+
idempotency key, up to two times, so the server returns the run it started. If the
|
|
105
|
+
answer is still lost, `resume` is the same command: run it later unchanged. A new
|
|
106
|
+
`--attempt` is a new paid run.
|
|
107
|
+
|
|
108
|
+
### Deletions
|
|
109
|
+
|
|
110
|
+
At a terminal a deletion asks first; anywhere else it needs `--yes`.
|
|
53
111
|
|
|
54
112
|
## Workflow files and explicit purchases
|
|
55
113
|
|
|
@@ -160,7 +218,8 @@ Captions are on; `--no-captions`
|
|
|
160
218
|
turns them off. `--style-reference <url>` and `--character-reference <url>` take
|
|
161
219
|
public https images. `--voice <name>` picks the narration voice: take a name
|
|
162
220
|
from `voices --skill make_faceless`, where each line shows the voice's language
|
|
163
|
-
and gender. Without it the narration is read by
|
|
221
|
+
and gender. Without it the narration is read by a voice of the script's
|
|
222
|
+
language, which the quote names; `narrator_en_wise_lady` where we have none. A
|
|
164
223
|
`make` voice such as `george` and an unknown name are refused before any
|
|
165
224
|
charge. Quote first: both commands take the same flags, so the
|
|
166
225
|
quote prices exactly the request `make-faceless` would send.
|
|
@@ -200,10 +259,10 @@ one that fails is charged nothing. The same request and take sent again return t
|
|
|
200
259
|
makes another candidate, charged again. While shot candidates are closed on the
|
|
201
260
|
server, the three commands answer `editing_disabled`.
|
|
202
261
|
|
|
203
|
-
`make` retries are explicit: `--retry 2` deliberately starts a *new* run for the
|
|
262
|
+
`make` retries are explicit: `--attempt 2` (or `--retry 2`) deliberately starts a *new* run for the
|
|
204
263
|
same script. Without it a repeated call returns the run you already paid for,
|
|
205
264
|
because every request carries an idempotency key derived from the input and from
|
|
206
|
-
this installation's id. A non-numeric `--
|
|
265
|
+
this installation's id. A non-numeric `--attempt` is rejected rather than coerced:
|
|
207
266
|
the value ends up in that key, so a silent `NaN` would buy you a second render.
|
|
208
267
|
|
|
209
268
|
Set `CLIPWRIGHT_CLIENT_ID` to a stable per-install value, or leave `~/.clipwright/`
|
package/dist/guided.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { FACELESS_ROUTES } from "@clipwright/core";
|
|
2
|
+
import { commandLine } from "./output.js";
|
|
3
|
+
export const GUIDE_PATHS = ["ad", "talking_head", "faceless", "image", "clip", "remake", "trends"];
|
|
4
|
+
const routeName = (route) => FACELESS_ROUTES.find((entry) => entry.route === route).name;
|
|
5
|
+
const ROUTE_NAMES = FACELESS_ROUTES.map((entry) => entry.name.toLowerCase()).join(", ");
|
|
6
|
+
const free = (what, words) => ({ what, start_command: commandLine(words), requires_approval: false });
|
|
7
|
+
const paid = (what, quote, start) => ({ what, quote_command: commandLine(quote), start_command: commandLine(start), requires_approval: true });
|
|
8
|
+
const PATHS = {
|
|
9
|
+
remake: {
|
|
10
|
+
title: "A video like a reel you bring",
|
|
11
|
+
when: "The user brings a reel or a link to make one like it.",
|
|
12
|
+
cues: [/https?:\/\/\S*(instagram|tiktok|youtu|reel)/, /\b(like|similar to|same as|remake|recreate|copy) (this|that|the) (reel|video|tiktok|short)/,
|
|
13
|
+
/\bremake\b/, /как (в )?(этом|этот|том|тот) (рилс|ролик|видео)/, /ремейк|повтори(ть)? (этот|такой) ролик/],
|
|
14
|
+
steps: () => [
|
|
15
|
+
paid("Break the reel down: its hook, beats, shots and words.", ["quote-analysis", "--set", "source_url=<link>"], ["analyze-reference", "--set", "source_url=<link>", "--max-credits", "<credits>", "--wait"]),
|
|
16
|
+
free("Pick the format the breakdown shows, then run guided again with that path.", ["guided", "--goal", "<goal>", "--path", "<path>"]),
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
talking_head: {
|
|
20
|
+
title: "A person talking to camera",
|
|
21
|
+
when: "The user asks for a presenter, a testimonial or someone speaking to camera.",
|
|
22
|
+
cues: [/\b(talking head|talks? (to|into) (the )?camera|speak(s|ing)? (to|into) (the )?camera|to camera|testimonial|presenter|spokesperson|ugc|avatar)\b/,
|
|
23
|
+
/в камеру|говорящ|ведущ(ий|ая|его|ей)|отзыв|блогер (говорит|рассказывает)|аватар/],
|
|
24
|
+
steps: () => [
|
|
25
|
+
free("Write the spoken script from the goal, show it to the user, and pick a voice from this list.", ["voices"]),
|
|
26
|
+
paid("Price the video for that script, then start it.", ["quote", "--script", "<script>"], ["make", "--script", "<script>", "--max-credits", "<credits>"]),
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
trends: {
|
|
30
|
+
title: "Find what took off first",
|
|
31
|
+
when: "The user wants to know what works on a topic before making anything.",
|
|
32
|
+
cues: [/\b(trend(s|ing)?|viral|went viral|what works|took off|blew up)\b/, /тренд|вирусн|что заходит|залетел/],
|
|
33
|
+
steps: () => [
|
|
34
|
+
paid("Find reels on the topic that took off in the last 7 days.", ["quote-trends", "--set", "keywords=<topic in a few words>"], ["find-trends", "--set", "keywords=<topic in a few words>", "--max-credits", "<credits>", "--wait"]),
|
|
35
|
+
free("Show 3 to 5 of them with views and x_median; the user picks one, then run guided with --path remake.", ["guided", "--goal", "<goal>", "--path", "remake"]),
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
ad: {
|
|
39
|
+
title: "An ad made of several shots",
|
|
40
|
+
when: "The user wants an ad or a product video and has not asked for a person talking to camera.",
|
|
41
|
+
cues: [/\b(ad|ads|advert|advertisement|commercial|promo|product video|launch video)\b/, /реклам|промо|продающ/],
|
|
42
|
+
steps: () => [
|
|
43
|
+
free("Read the ad workflow: shots, voice and edit, in order.", ["get-ad-guide", "--set", "section=workflow"]),
|
|
44
|
+
free("List the image and clip models to choose from.", ["list-generation-models"]),
|
|
45
|
+
paid("Make each shot's picture.", ["quote-image", "--file", "<shot picture.json>"], ["generate-image", "--file", "<shot picture.json>", "--wait"]),
|
|
46
|
+
paid("Make each shot's clip from its picture.", ["quote-video", "--file", "<shot clip.json>"], ["generate-video", "--file", "<shot clip.json>", "--wait"]),
|
|
47
|
+
paid("Record the voice-over.", ["quote-voice", "--set", "text=<script>"], ["make-voice", "--set", "text=<script>", "--wait"]),
|
|
48
|
+
paid("Cut the clips, voice and captions into the ad.", ["quote-edit", "--file", "<edit.json>"], ["render-edit", "--file", "<edit.json>", "--max-credits", "<credits>", "--output", "ad.mp4"]),
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
faceless: {
|
|
52
|
+
title: "A video without a presenter",
|
|
53
|
+
when: "A story, list, how-to, kids or cartoon video, or a topic with no product.",
|
|
54
|
+
cues: [/\b(faceless|story|stories|list|top \d+|\d+ (facts|reasons|ways|tips)|facts|how[- ]to|explainer|cartoon|animated|kids|slideshow|narrat)/,
|
|
55
|
+
/без лица|истори|факт|топ[- ]?\d|список|как сделать|объясн|мульт|для детей|слайд/],
|
|
56
|
+
steps: (goal) => [
|
|
57
|
+
free(`Price it and show the user the ways the quote lists, each with its price: ${ROUTE_NAMES}. The user picks one; ` +
|
|
58
|
+
"the price is no go-ahead.", ["quote-faceless", "--brief", goal, "--duration", "30"]),
|
|
59
|
+
{ ...paid(`${routeName("pictures")}: start it once the user agrees to the quoted credits.`, ["quote-faceless", "--brief", goal, "--duration", "30"], ["make-faceless", "--brief", goal, "--duration", "30", "--max-credits", "<credits>", "--output", "video.mp4"]), pick: "pictures" },
|
|
60
|
+
{ ...free(`${routeName("cartoon")}: read its workflow and follow it; each paid step there has its own quote.`, ["get-film-guide", "--set", "format=cartoon", "--set", "section=workflow"]), pick: "cartoon" },
|
|
61
|
+
{ ...free(`${routeName("explainer")}: read its guide and follow it; each paid step there has its own quote.`, ["get-film-guide", "--set", "format=explainer"]), pick: "explainer" },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
image: {
|
|
65
|
+
title: "One image",
|
|
66
|
+
when: "The user asks for a single picture: a poster, a cover or a product shot.",
|
|
67
|
+
cues: [/\b(an? |one |single )(image|picture|photo|poster|thumbnail|cover)\b/, /\b(image|picture|poster|thumbnail) of\b/,
|
|
68
|
+
/картинк|изображени|постер|обложк|фото (для|с)/],
|
|
69
|
+
steps: (goal) => [
|
|
70
|
+
free("Pick a model and its size.", ["list-generation-models"]),
|
|
71
|
+
paid("Make the image.", ["quote-image", "--set", `prompt=${goal}`, "--set", "model=<model>", "--set", "aspect_ratio=9:16"], ["generate-image", "--set", `prompt=${goal}`, "--set", "model=<model>", "--set", "aspect_ratio=9:16", "--output", "image.png"]),
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
clip: {
|
|
75
|
+
title: "One short clip",
|
|
76
|
+
when: "The user asks for a single clip or a b-roll shot, not a finished video.",
|
|
77
|
+
cues: [/\b(an? |one |single )(clip|shot|b-roll|broll)\b/, /\bb-?roll\b/, /клип|футаж|один кадр|короткий план/],
|
|
78
|
+
steps: (goal) => [
|
|
79
|
+
free("Pick a model, its mode and length.", ["list-generation-models"]),
|
|
80
|
+
paid("Make the clip.", ["quote-video", "--set", `prompt=${goal}`, "--set", "model=<model>", "--set", "mode=<mode>",
|
|
81
|
+
"--set", "aspect_ratio=9:16", "--set", "duration_s:=5"], ["generate-video", "--set", `prompt=${goal}`, "--set", "model=<model>", "--set", "mode=<mode>", "--set", "aspect_ratio=9:16",
|
|
82
|
+
"--set", "duration_s:=5", "--output", "clip.mp4"]),
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
const NOT_RECOMMENDED = {
|
|
87
|
+
ad: [{ path: "talking_head", why: "Only when the user asks for a person talking to camera." }],
|
|
88
|
+
faceless: [{ path: "talking_head", why: "The goal names no presenter." }],
|
|
89
|
+
talking_head: [{ path: "faceless", why: "The user asked for a person on screen." }],
|
|
90
|
+
image: [{ path: "faceless", why: "The user asked for one picture, not a video." }],
|
|
91
|
+
clip: [{ path: "ad", why: "The user asked for one clip, not a finished video." }],
|
|
92
|
+
};
|
|
93
|
+
const PRODUCT = /\b(product|brand|shop|store|app|business|service|cafe|restaurant|salon|startup)\b|продукт|бренд|магазин|кафе|приложени|бизнес|сервис|салон/;
|
|
94
|
+
export function guidedPlan(goal, chosen) {
|
|
95
|
+
const text = goal.toLowerCase();
|
|
96
|
+
const scores = GUIDE_PATHS.map((path) => ({ path, score: PATHS[path].cues.filter((cue) => cue.test(text)).length }))
|
|
97
|
+
.filter((entry) => entry.score > 0).sort((a, b) => b.score - a.score);
|
|
98
|
+
const matched = new Set(scores.map((entry) => entry.path));
|
|
99
|
+
const pick = chosen ?? (matched.has("remake") ? "remake" : matched.has("talking_head") ? "talking_head"
|
|
100
|
+
: scores.length === 1 || (scores.length > 1 && scores[0].score > scores[1].score) ? scores[0].path : undefined);
|
|
101
|
+
const describe = (path) => ({ path, title: PATHS[path].title, when: PATHS[path].when });
|
|
102
|
+
if (pick === undefined) {
|
|
103
|
+
const choices = scores.length > 1 ? scores.map((entry) => entry.path)
|
|
104
|
+
: PRODUCT.test(text) ? ["ad", "talking_head", "faceless", "trends"] : ["ad", "talking_head", "faceless", "image", "clip"];
|
|
105
|
+
return {
|
|
106
|
+
goal, recommended: null,
|
|
107
|
+
questions: [{ question: "Which of these should it be?", flag: "--path",
|
|
108
|
+
choices: choices.map((path) => ({ value: path, description: `${PATHS[path].title}: ${PATHS[path].when}` })) }],
|
|
109
|
+
next: commandLine(["guided", "--goal", goal, "--path", "<choice>"]),
|
|
110
|
+
...(PRODUCT.test(text) && { hint: "Not sure which? Start from what took off on the topic: --path trends." }),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
goal,
|
|
115
|
+
recommended: { ...describe(pick), why: chosen === undefined ? `Picked from the words of the goal. ${PATHS[pick].when}` : "Chosen with --path.",
|
|
116
|
+
steps: PATHS[pick].steps(goal) },
|
|
117
|
+
alternatives: GUIDE_PATHS.filter((path) => path !== pick && matched.has(path)).map(describe),
|
|
118
|
+
not_recommended: NOT_RECOMMENDED[pick] ?? [],
|
|
119
|
+
rule: "Run each quote_command first and show its credits; run a start_command marked requires_approval only after the user agrees. " +
|
|
120
|
+
"Fill each <blank>; <credits> is the number the quote shows. A step with pick applies only to the way the user picked.",
|
|
121
|
+
};
|
|
122
|
+
}
|