@makemidas/cli 0.9.0 → 0.10.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 +8 -1
- package/dist/api.js +15 -0
- package/dist/args.js +1 -0
- package/dist/cli.js +22 -1
- package/dist/commands.js +45 -5
- package/dist/config.js +1 -1
- package/dist/templates.js +58 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ makemidas film new "a 15-second social video for our mugs" --style social --max-
|
|
|
51
51
|
| `characters create "<name>" <image>` (or `--from <generationId> [--image n]`), `characters add <id> <image>` | Save a character from a JPG, PNG or WebP or one of your generated images (`--description` for its notes); up to 20 characters, 10 images each. Use it with `--character <id>` |
|
|
52
52
|
| `examples [words] [--kind] [-m <model>] [--limit 1-20]` | Real results with the model and the exact prompt that made each; free |
|
|
53
53
|
| `assets upload <file\|url>… [--name] [--tag t]`, `assets delete <id>` | Keep files in the asset library, or remove one |
|
|
54
|
+
| `assets keep <generationId>[/<n>]… [--name] [--tag t]` | Keep generated results in the asset library (every finished output without `/<n>`); copied on MakeMidas, no extra credits |
|
|
54
55
|
| `get <id> [--wait]` | Fetch a generation and save its files |
|
|
55
56
|
| `list [--limit n] [--before t]` | Recent generations |
|
|
56
57
|
| `delete <id> [--yes]` | Delete a finished or failed generation and its files (no refund) |
|
|
@@ -65,7 +66,8 @@ makemidas film new "a 15-second social video for our mugs" --style social --max-
|
|
|
65
66
|
|
|
66
67
|
Common options: `--model`, `--aspect`, `--resolution`, `--count`, `--ref`
|
|
67
68
|
(file or URL, repeatable), `--style`, `--enhance`, `--duration`, `--audio`,
|
|
68
|
-
`--frame-mode`, `--out <dir>`, `--no-download`, `--no-wait`, `--
|
|
69
|
+
`--frame-mode`, `--out <dir>`, `--no-download`, `--no-wait`, `--keep` (with
|
|
70
|
+
`--tag`), `--json`. Run
|
|
69
71
|
`makemidas --help` for all of them. An option that belongs to another
|
|
70
72
|
command (say `--lyrics` on `sfx`) is a usage error.
|
|
71
73
|
|
|
@@ -193,6 +195,8 @@ makemidas video "she waves at the camera" --character <id> -d 5
|
|
|
193
195
|
makemidas assets --q "product shot" --kind image
|
|
194
196
|
makemidas image "the same bottle on a beach" --ref asset:<id>
|
|
195
197
|
makemidas assets upload logo.png bottle.jpg --tag brand
|
|
198
|
+
makemidas image "our bottle, studio shot" --keep --tag product
|
|
199
|
+
makemidas assets keep <generationId>/2 --name "hero shot"
|
|
196
200
|
makemidas assets delete <id> --yes
|
|
197
201
|
```
|
|
198
202
|
|
|
@@ -200,6 +204,9 @@ makemidas assets delete <id> --yes
|
|
|
200
204
|
images, its style pictures as references; `--brand-logo` also sends its
|
|
201
205
|
logo). `--character <id>` sends the character's pictures as references.
|
|
202
206
|
`--ref asset:<id>` uses a file from the asset library like a local one.
|
|
207
|
+
`--keep` on any generating command (and `get`, `render`, `compare`) also
|
|
208
|
+
keeps each finished result in the library, labeled with `--tag`; a full
|
|
209
|
+
library is a warning, not a failed command, since the result is paid for.
|
|
203
210
|
|
|
204
211
|
## Film projects
|
|
205
212
|
|
package/dist/api.js
CHANGED
|
@@ -421,6 +421,21 @@ export class Api {
|
|
|
421
421
|
}
|
|
422
422
|
return saved;
|
|
423
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* Keep one finished output of your own generation in the asset library:
|
|
426
|
+
* copied on MakeMidas, nothing is uploaded or charged.
|
|
427
|
+
*/
|
|
428
|
+
keepGeneration(generationId, index, opts = {}) {
|
|
429
|
+
return this.json('/assets', {
|
|
430
|
+
method: 'POST',
|
|
431
|
+
json: {
|
|
432
|
+
generationId,
|
|
433
|
+
index,
|
|
434
|
+
...(opts.name ? { name: opts.name } : {}),
|
|
435
|
+
...(opts.tags?.length ? { tags: opts.tags } : {}),
|
|
436
|
+
},
|
|
437
|
+
});
|
|
438
|
+
}
|
|
424
439
|
async deleteAsset(id) {
|
|
425
440
|
await this.request(`/assets/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
|
426
441
|
}
|
package/dist/args.js
CHANGED
|
@@ -80,6 +80,7 @@ export function parse(argv) {
|
|
|
80
80
|
description: { type: 'string' },
|
|
81
81
|
fields: { type: 'string' },
|
|
82
82
|
tag: { type: 'string', multiple: true, default: [] },
|
|
83
|
+
keep: { type: 'boolean', default: false },
|
|
83
84
|
subtitles: { type: 'string' },
|
|
84
85
|
'title-card': { type: 'string' },
|
|
85
86
|
'end-card': { type: 'string' },
|
package/dist/cli.js
CHANGED
|
@@ -43,6 +43,8 @@ Usage:
|
|
|
43
43
|
makemidas assets [--q words] [--kind image|video|audio]
|
|
44
44
|
Search the asset library
|
|
45
45
|
makemidas assets upload <file|url>… Keep files in the asset library (--name, --tag)
|
|
46
|
+
makemidas assets keep <id>[/<n>]… Keep generated results in the library
|
|
47
|
+
(all finished outputs without /n; --name, --tag)
|
|
46
48
|
makemidas assets delete <id> [--yes] Remove a file from the library
|
|
47
49
|
makemidas credits Credit balance and plan
|
|
48
50
|
makemidas credits activity Grants, charges and refunds, newest first
|
|
@@ -184,6 +186,9 @@ Output options (generating commands, get):
|
|
|
184
186
|
prints the transcript itself
|
|
185
187
|
--no-download Print signed links (valid 1 hour) instead
|
|
186
188
|
--force Overwrite existing files
|
|
189
|
+
--keep Also keep each finished result in the asset library
|
|
190
|
+
(copied there, no extra credits); --tag <t>, repeat
|
|
191
|
+
for more, labels them
|
|
187
192
|
--wait get: wait until it is done
|
|
188
193
|
--timeout <min> How long to wait (default 15)
|
|
189
194
|
|
|
@@ -322,7 +327,14 @@ async function main(argv) {
|
|
|
322
327
|
}
|
|
323
328
|
const api = new Api(resolveBaseUrl(v['base-url']));
|
|
324
329
|
const g = { json: v.json };
|
|
325
|
-
const save = {
|
|
330
|
+
const save = {
|
|
331
|
+
out: v['no-download'] ? null : v.out,
|
|
332
|
+
force: v.force,
|
|
333
|
+
keep: v.keep ? v.tag : null,
|
|
334
|
+
};
|
|
335
|
+
if (v.tag.length && !v.keep && command !== 'assets') {
|
|
336
|
+
throw usageError('--tag goes with --keep, or with `assets upload` and `assets keep`.');
|
|
337
|
+
}
|
|
326
338
|
const timeoutMin = intOption(v.timeout, 'timeout', 1, 120) ?? 15;
|
|
327
339
|
const wait = { wait: !v['no-wait'], timeoutMin };
|
|
328
340
|
switch (command) {
|
|
@@ -346,6 +358,9 @@ async function main(argv) {
|
|
|
346
358
|
case 'voiceover':
|
|
347
359
|
return commands.generate(api, g, audioInput(audioTask(command), rest.join(' '), v), [], save, wait, maxCredits(v));
|
|
348
360
|
case 'transcribe': {
|
|
361
|
+
if (v.keep) {
|
|
362
|
+
throw usageError('--keep keeps images, clips and tracks; transcripts stay in `makemidas list`.');
|
|
363
|
+
}
|
|
349
364
|
const source = sourceArg(rest, command, 'audio or video file');
|
|
350
365
|
const { input, format } = transcriptionInput(v);
|
|
351
366
|
return commands.transcribe(api, g, input, source, format, save, wait, maxCredits(v));
|
|
@@ -494,6 +509,12 @@ async function main(argv) {
|
|
|
494
509
|
tags: v.tag,
|
|
495
510
|
});
|
|
496
511
|
}
|
|
512
|
+
if (rest[0] === 'keep') {
|
|
513
|
+
return templates.assetKeep(api, g, rest.slice(1), {
|
|
514
|
+
...(v.name ? { name: v.name } : {}),
|
|
515
|
+
tags: v.tag,
|
|
516
|
+
});
|
|
517
|
+
}
|
|
497
518
|
if (rest[0] === 'delete' || rest[0] === 'rm') {
|
|
498
519
|
if (rest.length > 2)
|
|
499
520
|
throw usageError('Delete one asset at a time.');
|
package/dist/commands.js
CHANGED
|
@@ -83,6 +83,40 @@ export async function authLogout(api, g) {
|
|
|
83
83
|
else
|
|
84
84
|
print(removed ? 'Signed out.' : 'Not signed in.');
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* With `--keep`, keep every finished output in the asset library. The
|
|
88
|
+
* generation is already paid for, so a refusal (a full library, a file
|
|
89
|
+
* over the library's size limit) is a warning, not a failed command.
|
|
90
|
+
*/
|
|
91
|
+
export async function keepOutputs(api, generation, save) {
|
|
92
|
+
if (!save.keep)
|
|
93
|
+
return [];
|
|
94
|
+
const kept = [];
|
|
95
|
+
for (const [index, output] of generation.outputs.entries()) {
|
|
96
|
+
if (output.status !== 'done' || !output.url)
|
|
97
|
+
continue;
|
|
98
|
+
try {
|
|
99
|
+
const saved = await api.keepGeneration(generation.id, index, {
|
|
100
|
+
tags: save.keep,
|
|
101
|
+
});
|
|
102
|
+
kept.push({
|
|
103
|
+
index,
|
|
104
|
+
id: saved.asset.id,
|
|
105
|
+
name: saved.asset.name,
|
|
106
|
+
deduped: saved.deduped,
|
|
107
|
+
});
|
|
108
|
+
log(`Kept in the library: ${saved.asset.id} ${saved.asset.name}${saved.deduped ? ' (already kept)' : ''}`);
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (!(error instanceof CliError))
|
|
112
|
+
throw error;
|
|
113
|
+
warn(`Not kept in the library: ${error.message}`);
|
|
114
|
+
if (error.code === 'storage_full')
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return kept;
|
|
119
|
+
}
|
|
86
120
|
/** Save every finished output into `dir`; returns the file paths. */
|
|
87
121
|
export async function saveOutputs(api, generation, save) {
|
|
88
122
|
if (!save.out)
|
|
@@ -111,9 +145,9 @@ export async function waitFor(api, generation, timeoutMin) {
|
|
|
111
145
|
}
|
|
112
146
|
return current;
|
|
113
147
|
}
|
|
114
|
-
export function report(g, generation, files, links = generation.outputs.flatMap((o) => (o.url ? [o.url] : []))) {
|
|
148
|
+
export function report(g, generation, files, links = generation.outputs.flatMap((o) => (o.url ? [o.url] : [])), kept) {
|
|
115
149
|
if (g.json) {
|
|
116
|
-
printJson({ ...generation, files });
|
|
150
|
+
printJson({ ...generation, files, ...(kept ? { assets: kept } : {}) });
|
|
117
151
|
}
|
|
118
152
|
else {
|
|
119
153
|
if (files.length)
|
|
@@ -206,7 +240,8 @@ async function start(api, input, refs, wait, maxCredits, media) {
|
|
|
206
240
|
export async function generate(api, g, input, refs, save, wait, maxCredits, media) {
|
|
207
241
|
const generation = await start(api, input, refs, wait, maxCredits, media);
|
|
208
242
|
const files = await saveOutputs(api, generation, save);
|
|
209
|
-
|
|
243
|
+
const kept = save.keep ? await keepOutputs(api, generation, save) : undefined;
|
|
244
|
+
report(g, generation, files, undefined, kept);
|
|
210
245
|
}
|
|
211
246
|
// ---------------------------------------------------------------------------
|
|
212
247
|
// transcribe
|
|
@@ -265,7 +300,8 @@ export async function get(api, g, id, save, wait) {
|
|
|
265
300
|
generation = await waitFor(api, generation, wait.timeoutMin);
|
|
266
301
|
}
|
|
267
302
|
const files = await saveOutputs(api, generation, save);
|
|
268
|
-
|
|
303
|
+
const kept = save.keep ? await keepOutputs(api, generation, save) : undefined;
|
|
304
|
+
report(g, generation, files, undefined, kept);
|
|
269
305
|
}
|
|
270
306
|
// ---------------------------------------------------------------------------
|
|
271
307
|
// estimate
|
|
@@ -579,11 +615,15 @@ export async function compare(api, g, request, refs, save, maxCredits) {
|
|
|
579
615
|
log(`Comparing ${request.models.join(', ')}…`);
|
|
580
616
|
const result = await api.compare(body);
|
|
581
617
|
const files = [];
|
|
618
|
+
const kept = [];
|
|
582
619
|
for (const generation of result.generations) {
|
|
583
620
|
files.push(...(await saveOutputs(api, generation, save)));
|
|
621
|
+
for (const asset of await keepOutputs(api, generation, save)) {
|
|
622
|
+
kept.push({ generationId: generation.id, ...asset });
|
|
623
|
+
}
|
|
584
624
|
}
|
|
585
625
|
if (g.json) {
|
|
586
|
-
printJson({ ...result, files });
|
|
626
|
+
printJson({ ...result, files, ...(save.keep ? { assets: kept } : {}) });
|
|
587
627
|
}
|
|
588
628
|
else {
|
|
589
629
|
for (const generation of result.generations) {
|
package/dist/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
export const VERSION = '0.
|
|
4
|
+
export const VERSION = '0.10.0';
|
|
5
5
|
export const USER_AGENT = `makemidas-cli/${VERSION}`;
|
|
6
6
|
export const DEFAULT_BASE_URL = 'https://makemidas.com';
|
|
7
7
|
export function resolveBaseUrl(flag) {
|
package/dist/templates.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { askYesNo, report, saveOutputs, waitFor, } from "./commands.js";
|
|
2
|
+
import { askYesNo, report, keepOutputs, saveOutputs, waitFor, } from "./commands.js";
|
|
3
3
|
import { CliError, EXIT } from "./errors.js";
|
|
4
4
|
import { formatBytes, log, print, printJson } from "./output.js";
|
|
5
5
|
/*
|
|
@@ -102,12 +102,13 @@ export async function render(api, g, request, save, wait) {
|
|
|
102
102
|
generation = await waitFor(api, generation, wait.timeoutMin);
|
|
103
103
|
}
|
|
104
104
|
const files = await saveOutputs(api, generation, save);
|
|
105
|
+
const kept = save.keep ? await keepOutputs(api, generation, save) : undefined;
|
|
105
106
|
if (!g.json && result.quota) {
|
|
106
107
|
log(result.credits
|
|
107
108
|
? `${result.credits} credit (no free renders left today).`
|
|
108
109
|
: `Free: ${result.quota.freeLeft} of ${result.quota.freePerDay} free renders left today.`);
|
|
109
110
|
}
|
|
110
|
-
report(g, generation, files);
|
|
111
|
+
report(g, generation, files, undefined, kept);
|
|
111
112
|
}
|
|
112
113
|
/** `makemidas render <templateId> --set …`. */
|
|
113
114
|
export function templateRender(templateId, values, options, brandId) {
|
|
@@ -221,6 +222,61 @@ export async function assetUpload(api, g, sources, opts) {
|
|
|
221
222
|
else
|
|
222
223
|
log('Use one with --ref asset:<id>, or in a template with --set <field>=asset:<id>.');
|
|
223
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* `assets keep <id>[/<n>]…`: keep finished outputs of your generations in
|
|
227
|
+
* the library (every finished output of a generation without `/<n>`; `n`
|
|
228
|
+
* counts from 1 like the saved file names).
|
|
229
|
+
*/
|
|
230
|
+
export async function assetKeep(api, g, refs, opts) {
|
|
231
|
+
if (!refs.length) {
|
|
232
|
+
throw new CliError('Give one or more generation ids: `makemidas assets keep <id>[/<n>]`.', EXIT.USAGE, 'usage');
|
|
233
|
+
}
|
|
234
|
+
const picks = [];
|
|
235
|
+
for (const ref of refs) {
|
|
236
|
+
const match = /^(?:generation:)?([^/\s]+?)(?:[/.](\d+))?$/.exec(ref);
|
|
237
|
+
if (!match) {
|
|
238
|
+
throw new CliError(`Not a generation id: ${ref}`, EXIT.USAGE, 'usage');
|
|
239
|
+
}
|
|
240
|
+
const [, id, n] = match;
|
|
241
|
+
if (n !== undefined) {
|
|
242
|
+
if (Number(n) < 1) {
|
|
243
|
+
throw new CliError(`Outputs count from 1: ${ref}`, EXIT.USAGE, 'usage');
|
|
244
|
+
}
|
|
245
|
+
picks.push({ id, index: Number(n) - 1 });
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
const generation = await api.generation(id);
|
|
249
|
+
const done = generation.outputs.flatMap((output, index) => output.status === 'done' ? [{ id, index }] : []);
|
|
250
|
+
if (!done.length) {
|
|
251
|
+
throw new CliError(`${id} has no finished output to keep (${generation.status}).`, EXIT.NOT_READY, 'not_ready');
|
|
252
|
+
}
|
|
253
|
+
picks.push(...done);
|
|
254
|
+
}
|
|
255
|
+
if (opts.name && picks.length > 1) {
|
|
256
|
+
throw new CliError('--name goes with one output.', EXIT.USAGE, 'usage');
|
|
257
|
+
}
|
|
258
|
+
const saved = [];
|
|
259
|
+
for (const pick of picks) {
|
|
260
|
+
const result = await api.keepGeneration(pick.id, pick.index, opts);
|
|
261
|
+
saved.push({ ...pick, ...result });
|
|
262
|
+
if (!g.json) {
|
|
263
|
+
print(`${result.asset.id} ${result.asset.kind.padEnd(5)} ${formatBytes(result.asset.size).padStart(8)} ${result.asset.name}${result.deduped ? ' (already kept)' : ''}`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (g.json) {
|
|
267
|
+
printJson({
|
|
268
|
+
assets: saved.map((s) => ({
|
|
269
|
+
...s.asset,
|
|
270
|
+
deduped: s.deduped,
|
|
271
|
+
generationId: s.id,
|
|
272
|
+
index: s.index,
|
|
273
|
+
})),
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
log('Use one with --ref asset:<id>, or in a template with --set <field>=asset:<id>.');
|
|
278
|
+
}
|
|
279
|
+
}
|
|
224
280
|
export async function assetDelete(api, g, id, opts) {
|
|
225
281
|
const assetId = need(id, 'an asset id: `makemidas assets delete <id>`');
|
|
226
282
|
await confirmDelete(opts, `the asset ${assetId}`, 'Generations made with it stay.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makemidas/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "AI image, video and audio generation CLI for AI agents (Claude Code, Cursor, Codex) and people: Nano Banana, GPT Image, Seedream, Seedance, Kling, Veo, Suno and more, plus talking avatars, HTML templates and short films, through MakeMidas.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-image-generator",
|