@gobi-ai/cli 0.9.1 → 0.9.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.
@@ -4,12 +4,12 @@
4
4
  "name": "gobi-ai"
5
5
  },
6
6
  "description": "Claude Code plugin for the Gobi collaborative knowledge platform CLI",
7
- "version": "0.9.0",
7
+ "version": "0.9.2",
8
8
  "plugins": [
9
9
  {
10
10
  "name": "gobi",
11
11
  "description": "Manage the Gobi collaborative knowledge platform from the command line. Search and ask brains, publish brain documents, create threads, manage sessions, generate images and videos.",
12
- "version": "0.9.0",
12
+ "version": "0.9.2",
13
13
  "author": {
14
14
  "name": "gobi-ai"
15
15
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gobi",
3
3
  "description": "Manage the Gobi collaborative knowledge platform from the command line",
4
- "version": "0.9.0",
4
+ "version": "0.9.2",
5
5
  "author": {
6
6
  "name": "gobi-ai"
7
7
  },
@@ -246,7 +246,7 @@ export function registerMediaCommand(program) {
246
246
  .command("image-generate")
247
247
  .description("Generate an image from a text prompt. Types: image (default), thumbnail (YouTube-optimized), asset (logo/product). Aspect ratios: 1:1, 16:9, 9:16, 4:3, 3:4")
248
248
  .requiredOption("--prompt <prompt>", "Text prompt for image generation")
249
- .requiredOption("--name <name>", "Name for the generated image")
249
+ .option("--name <name>", "Name for the generated image (auto-generated from prompt if omitted)")
250
250
  .option("--type <type>", "Generation type: image (default), thumbnail (YouTube-optimized), asset (logo/product)")
251
251
  .option("--aspect-ratio <aspectRatio>", "Aspect ratio (1:1, 16:9, 9:16, 4:3, 3:4)")
252
252
  .option("--negative-prompt <negativePrompt>", "Negative prompt")
@@ -254,9 +254,10 @@ export function registerMediaCommand(program) {
254
254
  .option("--reference-media-id <referenceMediaId>", "Reference image media ID")
255
255
  .option("--wait", "Poll until generation completes")
256
256
  .action(async (opts) => {
257
+ const name = opts.name || opts.prompt.slice(0, 50).replace(/[^a-zA-Z0-9-_ ]/g, "").trim().replace(/\s+/g, "-");
257
258
  const body = {
258
259
  prompt: opts.prompt,
259
- name: opts.name,
260
+ name,
260
261
  };
261
262
  if (opts.type)
262
263
  body.type = opts.type;
@@ -403,6 +404,7 @@ export function registerMediaCommand(program) {
403
404
  .description("Download a generated image.")
404
405
  .option("--wait", "Poll until generation completes before downloading")
405
406
  .option("--type <type>", "Image type (image, thumbnail, asset)")
407
+ .option("-o, --output <path>", "Output file path (default: {jobId}.{ext} in current directory)")
406
408
  .action(async (jobId, opts) => {
407
409
  if (opts.wait) {
408
410
  console.log(`Waiting for image job ${jobId} to complete…`);
@@ -427,16 +429,22 @@ export function registerMediaCommand(program) {
427
429
  const ext = contentType.includes("jpeg") || contentType.includes("jpg") ? "jpg"
428
430
  : contentType.includes("webp") ? "webp"
429
431
  : "png";
430
- const filename = `${jobId}.${ext}`;
432
+ const filename = opts.output || `${jobId}.${ext}`;
431
433
  if (isJsonMode(media)) {
432
- // In JSON mode, return base64-encoded image
434
+ // In JSON mode, save to file and return metadata
435
+ const { writeFile, mkdir } = await import("fs/promises");
436
+ const { dirname } = await import("path");
433
437
  const buffer = Buffer.from(await res.arrayBuffer());
434
- jsonOut({ filename, contentType, size: buffer.length, base64: buffer.toString("base64") });
438
+ await mkdir(dirname(filename), { recursive: true });
439
+ await writeFile(filename, buffer);
440
+ jsonOut({ filename, contentType, size: buffer.length });
435
441
  return;
436
442
  }
437
443
  // Write to file
438
- const { writeFile } = await import("fs/promises");
444
+ const { writeFile, mkdir } = await import("fs/promises");
445
+ const { dirname } = await import("path");
439
446
  const buffer = Buffer.from(await res.arrayBuffer());
447
+ await mkdir(dirname(filename), { recursive: true });
440
448
  await writeFile(filename, buffer);
441
449
  console.log(`Image saved to ${filename} (${buffer.length} bytes)`);
442
450
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobi-ai/cli",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "CLI client for the Gobi collaborative knowledge platform",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,6 +25,27 @@ For programmatic/agent usage, always pass `--json` as a **global** option (befor
25
25
  gobi --json media image-generate --prompt "a sunset over mountains"
26
26
  ```
27
27
 
28
+ ## Typical Workflow (Image Generation)
29
+
30
+ Always follow this two-step flow — generate, then download to vault:
31
+
32
+ ```bash
33
+ # Step 1: Generate (use --wait to poll until complete)
34
+ gobi --json media image-generate --prompt "a sunset over mountains" --wait
35
+ # → returns JSON with jobId
36
+
37
+ # Step 2: Download to vault media/ folder
38
+ gobi --json media image-download <jobId> -o media/<name>.png
39
+ ```
40
+
41
+ Then show the result as an embedded vault link: `![[media/<name>.png]]`
42
+
43
+ ### Key rules
44
+ - `--name` is **optional** — auto-derived from prompt if omitted.
45
+ - `--wait` avoids needing a separate `image-status` call.
46
+ - Always download with `-o media/<name>.png` — pick a short descriptive name (e.g., `happy-family.png`).
47
+ - `image-status` takes a **positional** jobId (NOT `--job-id`): `gobi media image-status <jobId>`
48
+
28
49
  ## Available Commands
29
50
 
30
51
  ### Upload
@@ -6,23 +6,24 @@ Usage: gobi media [options] [command]
6
6
  Media generation commands (videos, images).
7
7
 
8
8
  Options:
9
- -h, --help display help for command
9
+ -h, --help display help for command
10
10
 
11
11
  Commands:
12
- upload-init [options] Get a presigned upload URL for a media file.
13
- upload-finalize [options] Confirm that a media upload is complete.
14
- avatars List available avatars.
15
- voices List available voices.
16
- video-create [options] Create an avatar video generation job.
17
- video-list List all videos.
18
- video-get <id> Get video metadata.
19
- video-status [options] <id> Poll video generation status.
20
- video-download <id> Get the download URL for a completed video.
21
- image-generate [options] Generate an image from a text prompt. Types: image (default), thumbnail (YouTube-optimized), asset (logo/product). Aspect ratios: 1:1, 16:9, 9:16, 4:3, 3:4
22
- image-edit [options] Edit an existing image with a prompt (image-to-image).
23
- image-inpaint [options] Inpaint an image region using a mask.
24
- image-status [options] <jobId> Check image generation job status.
25
- help [command] display help for command
12
+ upload-init [options] Get a presigned upload URL for a media file.
13
+ upload-finalize [options] Confirm that a media upload is complete.
14
+ avatars List available avatars.
15
+ voices List available voices.
16
+ video-create [options] Create an avatar video generation job.
17
+ video-list List all videos.
18
+ video-get <id> Get video metadata.
19
+ video-status [options] <id> Poll video generation status.
20
+ video-download <id> Get the download URL for a completed video.
21
+ image-generate [options] Generate an image from a text prompt. Types: image (default), thumbnail (YouTube-optimized), asset (logo/product). Aspect ratios: 1:1, 16:9, 9:16, 4:3, 3:4
22
+ image-edit [options] Edit an existing image with a prompt (image-to-image).
23
+ image-inpaint [options] Inpaint an image region using a mask.
24
+ image-status [options] <jobId> Check image generation job status.
25
+ image-download [options] <jobId> Download a generated image.
26
+ help [command] display help for command
26
27
  ```
27
28
 
28
29
  ## upload-init
@@ -144,7 +145,7 @@ Generate an image from a text prompt. Types: image (default), thumbnail (YouTube
144
145
 
145
146
  Options:
146
147
  --prompt <prompt> Text prompt for image generation
147
- --name <name> Name for the generated image
148
+ --name <name> Name for the generated image (auto-generated from prompt if omitted)
148
149
  --type <type> Generation type: image (default), thumbnail (YouTube-optimized), asset (logo/product)
149
150
  --aspect-ratio <aspectRatio> Aspect ratio (1:1, 16:9, 9:16, 4:3, 3:4)
150
151
  --negative-prompt <negativePrompt> Negative prompt
@@ -196,3 +197,17 @@ Options:
196
197
  --wait Poll until a terminal state is reached
197
198
  -h, --help display help for command
198
199
  ```
200
+
201
+ ## image-download
202
+
203
+ ```
204
+ Usage: gobi media image-download [options] <jobId>
205
+
206
+ Download a generated image.
207
+
208
+ Options:
209
+ --wait Poll until generation completes before downloading
210
+ --type <type> Image type (image, thumbnail, asset)
211
+ -o, --output <path> Output file path (default: {jobId}.{ext} in current directory)
212
+ -h, --help display help for command
213
+ ```