@doufunao123/asset-gateway 0.13.0 → 0.14.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.
Files changed (2) hide show
  1. package/dist/index.js +172 -32
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -70,7 +70,7 @@ function normalizeError(error2) {
70
70
 
71
71
  // src/meta.ts
72
72
  var CLI_NAME = "asset-gateway";
73
- var CLI_VERSION = "0.11.1";
73
+ var CLI_VERSION = "0.13.0";
74
74
  var CLI_DESCRIPTION = "Universal asset generation gateway CLI";
75
75
  var DEFAULT_GATEWAY_URL = "https://upload.xiaomao.chat";
76
76
 
@@ -378,7 +378,7 @@ var SCHEMAS = {
378
378
  description: "Generate assets via the gateway",
379
379
  subcommands: {
380
380
  image: {
381
- description: "Generate or edit an image (Gemini / GPT Image / Grok)",
381
+ description: "Generate or edit an image",
382
382
  params: {
383
383
  "--prompt": { type: "string", required: true, description: "Image prompt" },
384
384
  "--provider": { type: "string", required: false },
@@ -393,7 +393,7 @@ var SCHEMAS = {
393
393
  }
394
394
  },
395
395
  video: {
396
- description: "Text or image-to-video (Grok)",
396
+ description: "Generate a video from text or an input image",
397
397
  params: {
398
398
  "--prompt": { type: "string", required: true },
399
399
  "--provider": { type: "string" },
@@ -402,7 +402,7 @@ var SCHEMAS = {
402
402
  }
403
403
  },
404
404
  batch: {
405
- description: "Batch image (etc.) generation; optional sprite compose",
405
+ description: "Batch-generate assets with shared parameters and optional compose step",
406
406
  params: {
407
407
  "--prompt": { type: "string[]", required: true, description: "One prompt per frame" },
408
408
  "--asset-type": { type: "string", default: "image" },
@@ -416,7 +416,7 @@ var SCHEMAS = {
416
416
  }
417
417
  },
418
418
  audio: {
419
- description: "BGM/SFX via ElevenLabs sound-generation",
419
+ description: "Generate audio from a text prompt",
420
420
  params: {
421
421
  "--prompt": { type: "string", required: true },
422
422
  "--type": { type: "string", description: "bgm | sfx" },
@@ -425,12 +425,12 @@ var SCHEMAS = {
425
425
  }
426
426
  },
427
427
  music: {
428
- description: "Music via ElevenLabs POST /v1/music (model music_v1)",
428
+ description: "Generate music using the gateway music provider",
429
429
  params: {
430
430
  "--prompt": { type: "string", required: true },
431
- "--duration": { type: "number", description: "Seconds; mapped to music_length_ms (3s\u2013600s)" },
432
- "--force-instrumental": { type: "bool", description: "Optional; passed to provider" },
433
- "--output-format": { type: "string", description: "Optional; e.g. mp3_44100_128" },
431
+ "--duration": { type: "number", description: "Seconds" },
432
+ "--force-instrumental": { type: "bool", description: "Request instrumental output when supported" },
433
+ "--output-format": { type: "string", description: "Provider-specific output format override when supported" },
434
434
  "--output-dir": { type: "string", default: "." }
435
435
  }
436
436
  },
@@ -470,6 +470,33 @@ var SCHEMAS = {
470
470
  "--max-tokens": { type: "number" },
471
471
  "--output-dir": { type: "string", default: "." }
472
472
  }
473
+ },
474
+ sprite: {
475
+ description: "Generate character animation using SpriteForge AI",
476
+ params: {
477
+ "--prompt": { type: "string", required: true, description: "Character description" },
478
+ "--input": { type: "string", description: "Reference image path or URL" },
479
+ "--animation-type": { type: "string", default: "walk" },
480
+ "--direction": { type: "string", default: "right" },
481
+ "--view": { type: "string", default: "auto", description: "Camera view: auto, side, front, back, three-quarter, none" },
482
+ "--framing": { type: "string", default: "full-body", description: "Framing: full-body, waist-up, close-up, none" },
483
+ "--background": { type: "string", default: "auto", description: "Background: auto, white, none, or free text" },
484
+ "--duration": { type: "number", default: 2, description: "Video duration in seconds" },
485
+ "--style": { type: "string" },
486
+ "--output-format": { type: "string", default: "spritesheet", description: "spritesheet | gif" },
487
+ "--fps": { type: "number", default: 8, description: "GIF frame rate" },
488
+ "--output-dir": { type: "string", default: "." }
489
+ }
490
+ },
491
+ world: {
492
+ description: "Generate a 3D world or environment",
493
+ params: {
494
+ "--prompt": { type: "string", required: true },
495
+ "--input": { type: "string", description: "Input image path or URL" },
496
+ "--model": { type: "string", default: "marble-1.1" },
497
+ "--display-name": { type: "string" },
498
+ "--output-dir": { type: "string", default: "." }
499
+ }
473
500
  }
474
501
  }
475
502
  },
@@ -526,17 +553,110 @@ var SCHEMAS = {
526
553
  process3d: {
527
554
  description: "Tripo 3D follow-up operations (chain on tripo_task_id)",
528
555
  subcommands: {
529
- convert: { description: "Export format (FBX/GLTF/\u2026)", params: { "--task-id": { required: true }, "--format": { required: true } } },
530
- texture: { description: "Re-texture", params: { "--task-id": { required: true } } },
531
- rig: { description: "Auto-rig", params: { "--task-id": { required: true } } },
532
- animate: { description: "Retarget animation", params: { "--task-id": { required: true } } },
533
- "render-sprites": { description: "Blender render to 2D frames", params: { "--task-id": { required: true } } },
534
- reduce: { description: "Low-poly", params: { "--task-id": { required: true } } },
535
- stylize: { description: "Style transfer", params: { "--task-id": { required: true } } },
536
- segment: { description: "Mesh segmentation", params: { "--task-id": { required: true } } },
537
- prerigcheck: { description: "Rig eligibility", params: { "--task-id": { required: true } } },
538
- refine: { description: "Refine quality", params: { "--task-id": { required: true } } },
539
- import: { description: "Import external model", params: { "--file-url": { type: "string" }, "--file-path": { type: "string" } } }
556
+ convert: {
557
+ description: "Convert a 3D model to another format",
558
+ params: {
559
+ "--task-id": { type: "string", required: true },
560
+ "--format": { type: "string", required: true },
561
+ "--quad": { type: "bool" },
562
+ "--face-limit": { type: "number" },
563
+ "--pack-uv": { type: "bool" },
564
+ "--bake": { type: "bool" },
565
+ "--texture-format": { type: "string" },
566
+ "--force-symmetry": { type: "bool" },
567
+ "--output-dir": { type: "string", default: "." }
568
+ }
569
+ },
570
+ texture: {
571
+ description: "Apply new textures to a 3D model",
572
+ params: {
573
+ "--task-id": { type: "string", required: true },
574
+ "--prompt": { type: "string" },
575
+ "--style-image": { type: "string" },
576
+ "--pbr": { type: "bool" },
577
+ "--quality": { type: "string" },
578
+ "--texture-alignment": { type: "string" },
579
+ "--bake": { type: "bool" },
580
+ "--texture-version": { type: "string" },
581
+ "--output-dir": { type: "string", default: "." }
582
+ }
583
+ },
584
+ rig: {
585
+ description: "Auto-rig a 3D model",
586
+ params: {
587
+ "--task-id": { type: "string", required: true },
588
+ "--format": { type: "string", default: "glb" },
589
+ "--spec": { type: "string", default: "mixamo" },
590
+ "--rig-type": { type: "string" },
591
+ "--output-dir": { type: "string", default: "." }
592
+ }
593
+ },
594
+ animate: {
595
+ description: "Apply a preset animation to a rigged model",
596
+ params: {
597
+ "--task-id": { type: "string", required: true },
598
+ "--animation": { type: "string", required: true },
599
+ "--format": { type: "string", default: "glb" },
600
+ "--output-dir": { type: "string", default: "." }
601
+ }
602
+ },
603
+ "render-sprites": {
604
+ description: "Render an animated 3D model to sprite frames",
605
+ params: {
606
+ "--task-id": { type: "string", required: true },
607
+ "--frame-count": { type: "number", default: 8 },
608
+ "--resolution": { type: "number", default: 64 },
609
+ "--camera-angle": { type: "string", default: "front" },
610
+ "--directions": { type: "number", default: 1 },
611
+ "--output-dir": { type: "string", default: "." }
612
+ }
613
+ },
614
+ reduce: {
615
+ description: "Reduce polygon count",
616
+ params: {
617
+ "--task-id": { type: "string", required: true },
618
+ "--face-limit": { type: "number" },
619
+ "--quad": { type: "bool" },
620
+ "--output-dir": { type: "string", default: "." }
621
+ }
622
+ },
623
+ stylize: {
624
+ description: "Apply a stylized look to a model",
625
+ params: {
626
+ "--task-id": { type: "string", required: true },
627
+ "--style": { type: "string", required: true },
628
+ "--output-dir": { type: "string", default: "." }
629
+ }
630
+ },
631
+ segment: {
632
+ description: "Segment a mesh into logical parts",
633
+ params: {
634
+ "--task-id": { type: "string", required: true },
635
+ "--output-dir": { type: "string", default: "." }
636
+ }
637
+ },
638
+ prerigcheck: {
639
+ description: "Check whether a model can be rigged",
640
+ params: {
641
+ "--task-id": { type: "string", required: true },
642
+ "--output-dir": { type: "string", default: "." }
643
+ }
644
+ },
645
+ refine: {
646
+ description: "Refine a draft model to higher quality",
647
+ params: {
648
+ "--task-id": { type: "string", required: true },
649
+ "--output-dir": { type: "string", default: "." }
650
+ }
651
+ },
652
+ import: {
653
+ description: "Import an external 3D model for post-processing",
654
+ params: {
655
+ "--file-url": { type: "string" },
656
+ "--file-path": { type: "string" },
657
+ "--output-dir": { type: "string", default: "." }
658
+ }
659
+ }
540
660
  }
541
661
  },
542
662
  voice: {
@@ -544,14 +664,23 @@ var SCHEMAS = {
544
664
  subcommands: {
545
665
  clone: {
546
666
  description: "Clone from audio sample",
547
- params: { "--audio": { required: true }, "--name": { required: true } }
667
+ params: {
668
+ "--audio": { type: "string", required: true },
669
+ "--name": { type: "string", required: true },
670
+ "--target-model": { type: "string" }
671
+ }
548
672
  },
549
673
  design: {
550
674
  description: "Design voice from text",
551
- params: { "--prompt": { required: true }, "--name": { required: true } }
675
+ params: {
676
+ "--prompt": { type: "string", required: true },
677
+ "--preview-text": { type: "string", required: true },
678
+ "--name": { type: "string", required: true },
679
+ "--target-model": { type: "string" }
680
+ }
552
681
  },
553
682
  list: { description: "List custom voices", params: { "--type": { type: "string" } } },
554
- delete: { description: "Delete by voice id", params: { "<voice-id>": { required: true } } }
683
+ delete: { description: "Delete by voice id", params: { "<voice-id>": { type: "string", required: true }, "--type": { type: "string" } } }
555
684
  }
556
685
  },
557
686
  upload: {
@@ -566,7 +695,7 @@ var SCHEMAS = {
566
695
  description: "Provider discovery and health",
567
696
  subcommands: {
568
697
  list: { description: "List providers" },
569
- health: { description: "Health check", params: { name: { type: "string", required: false } } }
698
+ health: { description: "Health check", params: { "[name]": { type: "string", required: false } } }
570
699
  }
571
700
  },
572
701
  job: {
@@ -579,14 +708,14 @@ var SCHEMAS = {
579
708
  "--limit": { type: "number" }
580
709
  }
581
710
  },
582
- status: { description: "Job detail", params: { id: { type: "string", required: true } } },
583
- cancel: { description: "Cancel pending/running", params: { id: { type: "string", required: true } } }
711
+ status: { description: "Job detail", params: { "<id>": { type: "string", required: true } } },
712
+ cancel: { description: "Cancel pending/running", params: { "<id>": { type: "string", required: true } } }
584
713
  }
585
714
  },
586
715
  describe: {
587
716
  description: "Command introspection (this output)",
588
717
  params: {
589
- command: { type: "string", required: false, description: "Top-level group: generate, process, \u2026" }
718
+ "[command]": { type: "string", required: false, description: "Top-level group: generate, process, \u2026" }
590
719
  }
591
720
  }
592
721
  };
@@ -630,12 +759,20 @@ function inferExtension(assetType) {
630
759
  const map = { image: "png", audio: "mp3", music: "mp3", tts: "mp3", video: "mp4", model3d: "glb", text: "txt", sprite: "png", world: "spz" };
631
760
  return map[assetType] ?? "bin";
632
761
  }
762
+ function inferExtFromResult(result) {
763
+ const meta = result.metadata;
764
+ if (!meta) return null;
765
+ const ct = meta.content_type;
766
+ if (!ct) return null;
767
+ const map = { "image/gif": "gif", "image/webp": "webp", "image/png": "png", "image/jpeg": "jpg", "video/mp4": "mp4", "audio/mpeg": "mp3" };
768
+ return map[ct] ?? null;
769
+ }
633
770
  function stripDataUri(data) {
634
771
  const idx = data.indexOf(";base64,");
635
772
  return idx >= 0 ? data.slice(idx + 8) : data;
636
773
  }
637
774
  async function saveOutput(result, assetType, outputDir) {
638
- const ext = inferExtension(assetType);
775
+ const ext = inferExtFromResult(result) ?? inferExtension(assetType);
639
776
  const timestamp = Date.now();
640
777
  const filename = `${assetType}_${timestamp}.${ext}`;
641
778
  mkdirSync2(outputDir, { recursive: true });
@@ -810,9 +947,9 @@ function createGenerateCommand() {
810
947
  })
811
948
  );
812
949
  command.addCommand(
813
- new Command3("music").description("Generate music (ElevenLabs /v1/music)").requiredOption("--prompt <text>", "Music description prompt").option("--duration <seconds>", "Duration in seconds (maps to music_length_ms)").option("--force-instrumental", "Force instrumental output (ElevenLabs)").option(
950
+ new Command3("music").description("Generate music using the gateway music provider").requiredOption("--prompt <text>", "Music description prompt").option("--duration <seconds>", "Duration in seconds").option("--force-instrumental", "Request instrumental output when supported").option(
814
951
  "--output-format <fmt>",
815
- "ElevenLabs output_format query, e.g. mp3_44100_128"
952
+ "Provider-specific output format override when supported"
816
953
  ).option("--output-dir <dir>", "Directory to save output", ".").action(async function(options) {
817
954
  try {
818
955
  const ctx = createContext(this);
@@ -914,16 +1051,19 @@ function createGenerateCommand() {
914
1051
  })
915
1052
  );
916
1053
  command.addCommand(
917
- new Command3("sprite").description("Generate sprite animation using SpriteForge AI").requiredOption("--prompt <text>", "Character description").option("--input <path>", "Reference image (local path or URL)").option("--animation-type <type>", "Animation type (idle, walk, run, attack, death, jump, cast, dance, or any custom)", "idle").option("--direction <dir>", "Facing direction: right, left, front, back", "right").option("--grid-size <size>", "Grid size: 2x2, 3x3, 4x4", "3x3").option("--style <style>", "Visual style (e.g. pixel art, hand-drawn, chibi)").option("--output-format <fmt>", "Output format: spritesheet or gif", "spritesheet").option("--fps <n>", "GIF frame rate", "8").option("--output-dir <dir>", "Directory to save output", ".").action(async function(options) {
1054
+ new Command3("sprite").description("Generate character animation using SpriteForge AI").requiredOption("--prompt <text>", "Character description").option("--input <path>", "Reference image for character consistency (local path or URL)").option("--animation-type <type>", "Animation type (idle, walk, run, attack, death, jump, cast, dance, or any custom)", "walk").option("--direction <dir>", "Facing direction: right, left, front, back", "right").option("--view <view>", "Camera view angle: auto, side, front, back, three-quarter, none", "auto").option("--framing <framing>", "Framing: full-body, waist-up, close-up, none", "full-body").option("--background <bg>", "Background: auto, white, none, or free text (e.g. 'forest clearing')", "auto").option("--duration <n>", "Video duration in seconds (1-15)", "2").option("--style <style>", "Visual style (e.g. pixel art, hand-drawn, chibi)").option("--output-format <fmt>", "Output format: spritesheet or gif", "spritesheet").option("--fps <n>", "GIF frame rate", "8").option("--output-dir <dir>", "Directory to save output", ".").action(async function(options) {
918
1055
  try {
919
1056
  const ctx = createContext(this);
920
1057
  const params = {
921
1058
  animation_type: options.animationType,
922
1059
  direction: options.direction,
923
- grid_size: options.gridSize,
1060
+ duration: Number(options.duration),
924
1061
  output_format: options.outputFormat,
925
1062
  fps: Number(options.fps)
926
1063
  };
1064
+ if (options.view && options.view !== "auto") params.view = options.view;
1065
+ if (options.framing && options.framing !== "full-body") params.framing = options.framing;
1066
+ if (options.background && options.background !== "auto") params.background = options.background;
927
1067
  if (options.style) params.style = options.style;
928
1068
  let inputFile = options.input;
929
1069
  if (inputFile && existsSync3(inputFile)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doufunao123/asset-gateway",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Universal asset generation gateway CLI",
5
5
  "type": "module",
6
6
  "bin": {