@makemidas/cli 0.3.0 → 0.3.1

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/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.3.0';
4
+ export const VERSION = '0.3.1';
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/films.js CHANGED
@@ -101,7 +101,26 @@ export async function waitForFilm(api, film, wait) {
101
101
  const pause = wait.sleep ?? sleep;
102
102
  const deadline = Date.now() + wait.timeoutMin * 60_000;
103
103
  let current = film;
104
- while (WORKING.has(current.next) && Date.now() < deadline) {
104
+ let asked = false;
105
+ while (Date.now() < deadline) {
106
+ // Every piece is made: ask for the assembly (free) once, then follow it.
107
+ if (current.next === 'assemble' && !asked) {
108
+ asked = true;
109
+ try {
110
+ current = await api.assembleFilm(current.id);
111
+ }
112
+ catch (error) {
113
+ // No render service: the pieces are there to cut by hand.
114
+ if (error instanceof CliError && error.code === 'unavailable') {
115
+ log(error.message);
116
+ return current;
117
+ }
118
+ throw error;
119
+ }
120
+ continue;
121
+ }
122
+ if (!WORKING.has(current.next))
123
+ break;
105
124
  log(`${current.next.replace('_', ' ')}… (${short(current.id)})`);
106
125
  const seconds = current.next === 'assembling' ? POLL_SECONDS.assembling : POLL_SECONDS.other;
107
126
  await pause(seconds * 1000);
@@ -117,6 +136,9 @@ function settle(film, waited) {
117
136
  if (film.assembly?.status === 'failed' && film.next !== 'done') {
118
137
  throw new CliError(`Assembly failed: ${film.assembly.error ?? 'unknown error'}. Run \`makemidas film assemble ${film.id}\` again, or \`makemidas film download ${film.id} --pieces\` to cut it yourself.`, EXIT.FAILED, 'generation_failed');
119
138
  }
139
+ if (waited && film.next === 'assemble') {
140
+ throw new CliError(`Every piece is made but the film was not assembled. Run \`makemidas film assemble ${film.id} --wait\`, or \`makemidas film download ${film.id} --pieces\` to cut it yourself.`, EXIT.NOT_READY, 'not_ready');
141
+ }
120
142
  if (waited && WORKING.has(film.next)) {
121
143
  throw new CliError(`Still working (${film.next}). Run \`makemidas film get ${film.id} --wait\` later.`, EXIT.NOT_READY, 'not_ready');
122
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makemidas/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "AI image and video generation CLI for AI agents (Claude Code, Cursor, Codex) and people: Nano Banana, GPT Image, Seedream, Seedance, Kling, Veo and more through MakeMidas.",
5
5
  "keywords": [
6
6
  "ai-image-generator",