@flatkey-ai/cli 0.2.2 → 0.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatkey-ai/cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Flatkey media generation CLI for image, video, audio, credits, status, and models.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/artifacts.js CHANGED
@@ -101,6 +101,8 @@ function extractItems(response) {
101
101
  if (typeof response?.metadata?.url === "string") return [{ url: response.metadata.url }];
102
102
  if (typeof response?.url === "string") return [response];
103
103
  if (typeof response?.video_url?.url === "string") return [{ url: response.video_url.url }];
104
+ if (typeof response?.video?.url === "string") return [{ url: response.video.url }];
105
+ if (typeof response?.video?.temp_url === "string") return [{ url: response.video.temp_url }];
104
106
  return [];
105
107
  }
106
108
 
package/src/cli.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { join } from "node:path";
2
+
1
3
  const COMMANDS = new Set([
2
4
  "audio",
3
5
  "credits",
@@ -548,11 +550,14 @@ async function handleGenerate(command, deps) {
548
550
  const output = await writeTextOutput(text, command.options.output);
549
551
  return { kind: command.group, text, output, response };
550
552
  }
553
+ const outDir = command.options.out ?? "flatkey-output";
554
+ const output = command.options.output
555
+ ?? (command.group === "video" ? join(outDir, "video-01.mp4") : undefined);
551
556
  const artifacts = await persistArtifacts({
552
557
  kind: command.group,
553
558
  response: artifactResponse,
554
- outDir: command.options.out ?? "flatkey-output",
555
- output: command.options.output,
559
+ outDir,
560
+ output,
556
561
  fetch: deps.fetch,
557
562
  });
558
563
  return { kind: command.group, artifacts, response: scrubArtifactResponse(artifactResponse) };
@@ -649,6 +654,8 @@ function hasArtifact(response) {
649
654
  || response?.url
650
655
  || response?.temp_url
651
656
  || response?.video_url?.url
657
+ || response?.video?.url
658
+ || response?.video?.temp_url
652
659
  || response?.data?.some?.((item) => item?.url || item?.temp_url || item?.b64_json || item?.base64 || item?.data)
653
660
  || response?.artifacts?.some?.((item) => item?.url || item?.temp_url || item?.path)
654
661
  || response?.content?.some?.((item) => item?.url || item?.video_url?.url || item?.data_url || item?.b64_json || item?.base64 || item?.data),
@@ -660,7 +667,7 @@ function videoTaskId(response) {
660
667
  }
661
668
 
662
669
  function isVideoDone(response) {
663
- return ["completed", "succeeded", "success"].includes(String(response?.status ?? "").toLowerCase());
670
+ return ["completed", "done", "succeeded", "success"].includes(String(response?.status ?? "").toLowerCase());
664
671
  }
665
672
 
666
673
  function isVideoFailed(response) {