@genfeedai/cli 0.2.0 → 0.3.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 +464 -416
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -29365,33 +29365,33 @@ function date4(params) {
29365
29365
  config(en_default());
29366
29366
  // src/config/schema.ts
29367
29367
  var profileSchema = exports_external.object({
29368
- apiUrl: exports_external.string().url().default("https://api.genfeed.ai/v1"),
29369
- apiKey: exports_external.string().optional(),
29370
- token: exports_external.string().optional(),
29371
- organizationId: exports_external.string().optional(),
29372
- userId: exports_external.string().optional(),
29373
- role: exports_external.enum(["user", "admin"]).default("user"),
29374
- darkroomHost: exports_external.string().default("100.106.229.81"),
29375
- darkroomApiPort: exports_external.number().default(8189),
29376
29368
  activeBrand: exports_external.string().optional(),
29377
29369
  activePersona: exports_external.string().optional(),
29370
+ apiKey: exports_external.string().optional(),
29371
+ apiUrl: exports_external.string().url().default("https://api.genfeed.ai/v1"),
29372
+ darkroomApiPort: exports_external.number().default(8189),
29373
+ darkroomHost: exports_external.string().default("100.106.229.81"),
29378
29374
  defaults: exports_external.object({
29379
29375
  imageModel: exports_external.string().default("imagen-4"),
29380
29376
  videoModel: exports_external.string().default("google-veo-3")
29381
- }).default({ imageModel: "imagen-4", videoModel: "google-veo-3" })
29377
+ }).default({ imageModel: "imagen-4", videoModel: "google-veo-3" }),
29378
+ organizationId: exports_external.string().optional(),
29379
+ role: exports_external.enum(["user", "admin"]).default("user"),
29380
+ token: exports_external.string().optional(),
29381
+ userId: exports_external.string().optional()
29382
29382
  });
29383
29383
  var configSchema = exports_external.object({
29384
29384
  activeProfile: exports_external.string().default("default"),
29385
29385
  profiles: exports_external.record(exports_external.string(), profileSchema).default({
29386
29386
  default: {
29387
29387
  apiUrl: "https://api.genfeed.ai/v1",
29388
- role: "user",
29389
- darkroomHost: "100.106.229.81",
29390
29388
  darkroomApiPort: 8189,
29389
+ darkroomHost: "100.106.229.81",
29391
29390
  defaults: {
29392
29391
  imageModel: "imagen-4",
29393
29392
  videoModel: "google-veo-3"
29394
- }
29393
+ },
29394
+ role: "user"
29395
29395
  }
29396
29396
  })
29397
29397
  });
@@ -29449,12 +29449,12 @@ function mergeProfileWithRuntime(profile, runtime) {
29449
29449
  ...profile,
29450
29450
  apiKey: runtime.apiKey ?? profile.apiKey,
29451
29451
  apiUrl: runtime.apiUrl ?? profile.apiUrl,
29452
- token: runtime.token ?? profile.token,
29453
- organizationId: runtime.organizationId ?? profile.organizationId,
29454
- userId: runtime.userId ?? profile.userId,
29455
- darkroomHost: runtime.darkroomHost ?? profile.darkroomHost,
29456
29452
  darkroomApiPort: runtime.darkroomApiPort ?? profile.darkroomApiPort,
29457
- role: runtime.role ?? profile.role
29453
+ darkroomHost: runtime.darkroomHost ?? profile.darkroomHost,
29454
+ organizationId: runtime.organizationId ?? profile.organizationId,
29455
+ role: runtime.role ?? profile.role,
29456
+ token: runtime.token ?? profile.token,
29457
+ userId: runtime.userId ?? profile.userId
29458
29458
  };
29459
29459
  }
29460
29460
  function readRuntimeOverrides() {
@@ -29515,6 +29515,13 @@ async function setActiveBrand(brandId, profileName) {
29515
29515
  async function clearActiveBrand(profileName) {
29516
29516
  await setProfileField("activeBrand", undefined, profileName);
29517
29517
  }
29518
+ async function getOrganizationId() {
29519
+ const { profile } = await getActiveProfile();
29520
+ return profile.organizationId;
29521
+ }
29522
+ async function setOrganizationId(organizationId, profileName) {
29523
+ await setProfileField("organizationId", organizationId, profileName);
29524
+ }
29518
29525
  async function setRole(role, profileName) {
29519
29526
  await setProfileField("role", role, profileName);
29520
29527
  }
@@ -29537,8 +29544,8 @@ async function setActiveProfileName(name) {
29537
29544
  async function listProfiles() {
29538
29545
  const config2 = await loadConfig();
29539
29546
  return Object.entries(config2.profiles).map(([name, profile]) => ({
29540
- name,
29541
29547
  active: name === config2.activeProfile,
29548
+ name,
29542
29549
  profile
29543
29550
  }));
29544
29551
  }
@@ -29547,11 +29554,48 @@ function getConfigPath() {
29547
29554
  }
29548
29555
 
29549
29556
  // src/utils/errors.ts
29550
- class GenfeedError extends Error {
29557
+ class BaseCliError extends Error {
29551
29558
  suggestion;
29552
29559
  constructor(message, suggestion) {
29553
29560
  super(message);
29561
+ this.name = "BaseCliError";
29554
29562
  this.suggestion = suggestion;
29563
+ }
29564
+ }
29565
+
29566
+ class ApiError extends BaseCliError {
29567
+ statusCode;
29568
+ constructor(message, statusCode, suggestion) {
29569
+ super(message, suggestion);
29570
+ this.name = "ApiError";
29571
+ this.statusCode = statusCode;
29572
+ }
29573
+ }
29574
+ function formatError2(error49) {
29575
+ if (error49 instanceof BaseCliError) {
29576
+ let output = source_default.red(`✖ ${error49.message}`);
29577
+ if (error49.suggestion) {
29578
+ output += `
29579
+ ${source_default.dim(error49.suggestion)}`;
29580
+ }
29581
+ return output;
29582
+ }
29583
+ if (error49 instanceof Error) {
29584
+ return source_default.red(`✖ ${error49.message}`);
29585
+ }
29586
+ return source_default.red("✖ An unknown error occurred");
29587
+ }
29588
+ function baseHandleError(error49, options) {
29589
+ console.error(formatError2(error49));
29590
+ if (options?.replMode) {
29591
+ throw error49;
29592
+ }
29593
+ process.exit(1);
29594
+ }
29595
+
29596
+ class GenfeedError extends BaseCliError {
29597
+ constructor(message, suggestion) {
29598
+ super(message, suggestion);
29555
29599
  this.name = "GenfeedError";
29556
29600
  }
29557
29601
  }
@@ -29570,15 +29614,6 @@ class AdminRequiredError extends GenfeedError {
29570
29614
  }
29571
29615
  }
29572
29616
 
29573
- class ApiError extends GenfeedError {
29574
- statusCode;
29575
- constructor(message, statusCode, suggestion) {
29576
- super(message, suggestion);
29577
- this.statusCode = statusCode;
29578
- this.name = "ApiError";
29579
- }
29580
- }
29581
-
29582
29617
  class NoBrandError extends GenfeedError {
29583
29618
  constructor() {
29584
29619
  super("No brand selected", "Run `gf brands select` to choose a brand");
@@ -29592,30 +29627,12 @@ class DarkroomApiError extends GenfeedError {
29592
29627
  this.name = "DarkroomApiError";
29593
29628
  }
29594
29629
  }
29595
- function formatError2(error49) {
29596
- if (error49 instanceof GenfeedError) {
29597
- let output = source_default.red(`✖ ${error49.message}`);
29598
- if (error49.suggestion) {
29599
- output += `
29600
- ${source_default.dim(error49.suggestion)}`;
29601
- }
29602
- return output;
29603
- }
29604
- if (error49 instanceof Error) {
29605
- return source_default.red(`✖ ${error49.message}`);
29606
- }
29607
- return source_default.red("✖ An unknown error occurred");
29608
- }
29609
29630
  var replMode = false;
29610
29631
  function setReplMode(enabled) {
29611
29632
  replMode = enabled;
29612
29633
  }
29613
29634
  function handleError(error49) {
29614
- console.error(formatError2(error49));
29615
- if (replMode) {
29616
- throw error49;
29617
- }
29618
- process.exit(1);
29635
+ baseHandleError(error49, { replMode });
29619
29636
  }
29620
29637
 
29621
29638
  // src/api/client.ts
@@ -29651,7 +29668,7 @@ async function get(path2) {
29651
29668
  }
29652
29669
  async function post(path2, body) {
29653
29670
  const client = await createClient();
29654
- return client(path2, { method: "POST", body });
29671
+ return client(path2, { body, method: "POST" });
29655
29672
  }
29656
29673
  async function requireAuth() {
29657
29674
  const apiKey = await getApiKey();
@@ -29662,8 +29679,8 @@ async function requireAuth() {
29662
29679
  }
29663
29680
 
29664
29681
  // src/api/brands.ts
29665
- async function listBrands() {
29666
- const response = await get("/brands");
29682
+ async function listBrands(organizationId) {
29683
+ const response = await get(`/organizations/${organizationId}/brands`);
29667
29684
  return response.data;
29668
29685
  }
29669
29686
  async function getBrand(id) {
@@ -29673,21 +29690,21 @@ async function getBrand(id) {
29673
29690
 
29674
29691
  // src/ui/theme.ts
29675
29692
  var colors = {
29676
- primary: source_default.hex("#7C3AED"),
29677
- success: source_default.green,
29693
+ bold: source_default.bold,
29694
+ dim: source_default.dim,
29678
29695
  error: source_default.red,
29679
- warning: source_default.yellow,
29680
29696
  info: source_default.blue,
29681
- dim: source_default.dim,
29682
- bold: source_default.bold
29697
+ primary: source_default.hex("#7C3AED"),
29698
+ success: source_default.green,
29699
+ warning: source_default.yellow
29683
29700
  };
29684
29701
  var symbols = {
29685
- success: source_default.green("✓"),
29702
+ arrow: source_default.dim("→"),
29703
+ bullet: source_default.dim("•"),
29686
29704
  error: source_default.red("✖"),
29687
- warning: source_default.yellow("⚠"),
29688
29705
  info: source_default.blue("ℹ"),
29689
- arrow: source_default.dim("→"),
29690
- bullet: source_default.dim("•")
29706
+ success: source_default.green("✓"),
29707
+ warning: source_default.yellow("⚠")
29691
29708
  };
29692
29709
  function formatSuccess(message) {
29693
29710
  return `${symbols.success} ${message}`;
@@ -29701,46 +29718,61 @@ function formatWarning(message) {
29701
29718
  function formatLabel(label, value) {
29702
29719
  return ` ${colors.dim(`${label}:`)} ${value}`;
29703
29720
  }
29721
+ function formatHeader(text) {
29722
+ return colors.bold(text);
29723
+ }
29724
+ function print(message = "") {
29725
+ process.stdout.write(`${message}
29726
+ `);
29727
+ }
29728
+ function printJson(data) {
29729
+ process.stdout.write(`${JSON.stringify(data, null, 2)}
29730
+ `);
29731
+ }
29704
29732
 
29705
29733
  // src/commands/brands.ts
29706
29734
  var brandsCommand = new Command("brands").description("Manage brands").option("--json", "Output as JSON").action(async (options) => {
29707
29735
  try {
29708
29736
  await requireAuth();
29737
+ const orgId = await getOrganizationId();
29738
+ if (!orgId) {
29739
+ throw new GenfeedError("No organization found", "Re-authenticate with `gf login` to link your organization");
29740
+ }
29709
29741
  const spinner = ora("Fetching brands...").start();
29710
- const brands = await listBrands();
29742
+ const brands = await listBrands(orgId);
29711
29743
  spinner.stop();
29712
29744
  const activeBrandId = await getActiveBrand();
29713
29745
  if (options.json) {
29714
- console.log(JSON.stringify({
29746
+ printJson({
29747
+ activeBrandId,
29715
29748
  brands: brands.map((b) => ({
29716
- id: b.id,
29717
- name: b.name,
29749
+ active: b.id === activeBrandId,
29718
29750
  description: b.description,
29719
- active: b.id === activeBrandId
29720
- })),
29721
- activeBrandId
29722
- }, null, 2));
29751
+ id: b.id,
29752
+ name: b.name
29753
+ }))
29754
+ });
29723
29755
  return;
29724
29756
  }
29725
29757
  if (brands.length === 0) {
29726
- console.log(source_default.yellow("No brands found."));
29727
- console.log(source_default.dim("Create one at https://app.genfeed.ai"));
29758
+ print(formatWarning("No brands found."));
29759
+ print(source_default.dim("Create one at https://app.genfeed.ai"));
29728
29760
  return;
29729
29761
  }
29730
- console.log(source_default.bold(`Your brands:
29762
+ print(formatHeader(`Your brands:
29731
29763
  `));
29732
29764
  for (const brand of brands) {
29733
29765
  const isActive = brand.id === activeBrandId;
29734
29766
  const marker = isActive ? source_default.green("●") : source_default.dim("○");
29735
29767
  const name = isActive ? source_default.bold(brand.name) : brand.name;
29736
29768
  const activeLabel = isActive ? source_default.dim(" (active)") : "";
29737
- console.log(` ${marker} ${name}${activeLabel}`);
29769
+ print(` ${marker} ${name}${activeLabel}`);
29738
29770
  if (brand.description) {
29739
- console.log(` ${source_default.dim(brand.description)}`);
29771
+ print(` ${source_default.dim(brand.description)}`);
29740
29772
  }
29741
29773
  }
29742
- console.log();
29743
- console.log(source_default.dim("Run `gf brands select` to change the active brand"));
29774
+ print();
29775
+ print(source_default.dim("Run `gf brands select` to change the active brand"));
29744
29776
  } catch (error49) {
29745
29777
  handleError(error49);
29746
29778
  }
@@ -29748,26 +29780,30 @@ var brandsCommand = new Command("brands").description("Manage brands").option("-
29748
29780
  brandsCommand.command("select").description("Select the active brand").action(async () => {
29749
29781
  try {
29750
29782
  await requireAuth();
29783
+ const orgId = await getOrganizationId();
29784
+ if (!orgId) {
29785
+ throw new GenfeedError("No organization found", "Re-authenticate with `gf login` to link your organization");
29786
+ }
29751
29787
  const spinner = ora("Fetching brands...").start();
29752
- const brands = await listBrands();
29788
+ const brands = await listBrands(orgId);
29753
29789
  spinner.stop();
29754
29790
  if (brands.length === 0) {
29755
29791
  throw new GenfeedError("No brands found", "Create a brand at https://app.genfeed.ai");
29756
29792
  }
29757
29793
  const activeBrandId = await getActiveBrand();
29758
29794
  const selected = await dist_default5({
29759
- message: "Select a brand:",
29760
29795
  choices: brands.map((brand) => ({
29796
+ description: brand.description,
29761
29797
  name: brand.id === activeBrandId ? `${brand.name} (current)` : brand.name,
29762
- value: brand.id,
29763
- description: brand.description
29798
+ value: brand.id
29764
29799
  })),
29765
- default: activeBrandId
29800
+ default: activeBrandId,
29801
+ message: "Select a brand:"
29766
29802
  });
29767
29803
  await setActiveBrand(selected);
29768
29804
  const selectedBrand = brands.find((b) => b.id === selected);
29769
- console.log();
29770
- console.log(formatSuccess(`Active brand: ${source_default.bold(selectedBrand?.name)}`));
29805
+ print();
29806
+ print(formatSuccess(`Active brand: ${source_default.bold(selectedBrand?.name)}`));
29771
29807
  } catch (error49) {
29772
29808
  handleError(error49);
29773
29809
  }
@@ -29778,29 +29814,29 @@ brandsCommand.command("current").description("Show the current active brand").op
29778
29814
  const activeBrandId = await getActiveBrand();
29779
29815
  if (!activeBrandId) {
29780
29816
  if (options.json) {
29781
- console.log(JSON.stringify({ activeBrand: null }, null, 2));
29817
+ printJson({ activeBrand: null });
29782
29818
  return;
29783
29819
  }
29784
- console.log(source_default.yellow("No active brand selected"));
29785
- console.log(source_default.dim("Run `gf brands select` to choose a brand"));
29820
+ print(formatWarning("No active brand selected"));
29821
+ print(source_default.dim("Run `gf brands select` to choose a brand"));
29786
29822
  return;
29787
29823
  }
29788
29824
  const spinner = ora("Fetching brand...").start();
29789
29825
  const brand = await getBrand(activeBrandId);
29790
29826
  spinner.stop();
29791
29827
  if (options.json) {
29792
- console.log(JSON.stringify({
29828
+ printJson({
29793
29829
  activeBrand: {
29830
+ description: brand.description,
29794
29831
  id: brand.id,
29795
- name: brand.name,
29796
- description: brand.description
29832
+ name: brand.name
29797
29833
  }
29798
- }, null, 2));
29834
+ });
29799
29835
  return;
29800
29836
  }
29801
- console.log(formatSuccess(`Active brand: ${source_default.bold(brand.name)}`));
29837
+ print(formatSuccess(`Active brand: ${source_default.bold(brand.name)}`));
29802
29838
  if (brand.description) {
29803
- console.log(formatLabel("Description", brand.description));
29839
+ print(formatLabel("Description", brand.description));
29804
29840
  }
29805
29841
  } catch (error49) {
29806
29842
  handleError(error49);
@@ -29817,9 +29853,9 @@ async function darkroomRequest(method, path2, body) {
29817
29853
  const url2 = `${baseUrl}${path2}`;
29818
29854
  try {
29819
29855
  const response = await fetch(url2, {
29820
- method,
29856
+ body: body ? JSON.stringify(body) : undefined,
29821
29857
  headers: body ? { "Content-Type": "application/json" } : undefined,
29822
- body: body ? JSON.stringify(body) : undefined
29858
+ method
29823
29859
  });
29824
29860
  if (!response.ok) {
29825
29861
  const text = await response.text();
@@ -29870,7 +29906,7 @@ async function uploadDataset(persona, filePaths) {
29870
29906
  formData.append("files", blob, basename(filePath));
29871
29907
  }
29872
29908
  try {
29873
- const response = await fetch(url2, { method: "POST", body: formData });
29909
+ const response = await fetch(url2, { body: formData, method: "POST" });
29874
29910
  if (!response.ok) {
29875
29911
  const text = await response.text();
29876
29912
  throw new DarkroomApiError(`Darkroom API POST /datasets/${persona}/upload failed: ${response.status} ${text}`);
@@ -29925,8 +29961,8 @@ async function startFaceTest(handle, personaConfig) {
29925
29961
  async function startBootstrap(handle, promptCount, personaConfig) {
29926
29962
  return darkroomRequest("POST", "/generate/bootstrap", {
29927
29963
  handle,
29928
- prompt_count: promptCount ?? 50,
29929
- persona_config: personaConfig
29964
+ persona_config: personaConfig,
29965
+ prompt_count: promptCount ?? 50
29930
29966
  });
29931
29967
  }
29932
29968
  async function startPulid(handle, mode = "scenes", personaConfig) {
@@ -29968,11 +30004,11 @@ var captionCommand = new Command("caption").description("Run Florence-2 auto-cap
29968
30004
  });
29969
30005
  spinner.succeed("Captioning complete");
29970
30006
  if (options.json) {
29971
- console.log(JSON.stringify(result, null, 2));
30007
+ printJson(result);
29972
30008
  return;
29973
30009
  }
29974
30010
  if (result.output) {
29975
- console.log(source_default.dim(result.output));
30011
+ print(source_default.dim(result.output));
29976
30012
  }
29977
30013
  } catch (error49) {
29978
30014
  handleError(error49);
@@ -29987,7 +30023,7 @@ var chatCommand = new Command("chat").description("Start an interactive agent ch
29987
30023
  if (!conversationId) {
29988
30024
  const spinner = ora("Starting new conversation...").start();
29989
30025
  try {
29990
- const conversation = await post("/v1/agent-conversations", {
30026
+ const conversation = await post("/agent/conversations", {
29991
30027
  source: "cli",
29992
30028
  title: "CLI Chat"
29993
30029
  });
@@ -29998,7 +30034,7 @@ var chatCommand = new Command("chat").description("Start an interactive agent ch
29998
30034
  throw error49;
29999
30035
  }
30000
30036
  }
30001
- console.log(source_default.dim(`Type your message (Ctrl+C to exit)
30037
+ print(source_default.dim(`Type your message (Ctrl+C to exit)
30002
30038
  `));
30003
30039
  while (true) {
30004
30040
  const message = await dist_default3({
@@ -30008,16 +30044,16 @@ var chatCommand = new Command("chat").description("Start an interactive agent ch
30008
30044
  continue;
30009
30045
  const spinner = ora("Thinking...").start();
30010
30046
  try {
30011
- const response = await post(`/v1/agent-conversations/${conversationId}/messages`, { content: message, role: "user" });
30047
+ const response = await post(`/agent/conversations/${conversationId}/messages`, { content: message, role: "user" });
30012
30048
  spinner.stop();
30013
30049
  const messages = response.messages ?? [];
30014
30050
  const lastMessage = messages[messages.length - 1];
30015
30051
  if (lastMessage && lastMessage.role === "assistant") {
30016
- console.log(source_default.green(`
30017
- Assistant:`), lastMessage.content, `
30052
+ print(`${source_default.green(`
30053
+ Assistant:`)} ${lastMessage.content}
30018
30054
  `);
30019
30055
  } else {
30020
- console.log(source_default.dim(`
30056
+ print(source_default.dim(`
30021
30057
  Message sent.
30022
30058
  `));
30023
30059
  }
@@ -30055,27 +30091,27 @@ var darkroomCommand = new Command("darkroom").description("Darkroom infrastructu
30055
30091
  const health = await getDarkroomHealth();
30056
30092
  spinner.stop();
30057
30093
  if (options.json) {
30058
- console.log(JSON.stringify(health, null, 2));
30094
+ printJson(health);
30059
30095
  return;
30060
30096
  }
30061
30097
  const gpu = health.gpu;
30062
30098
  const vramUsedGb = (gpu.memory_used / 1024).toFixed(1);
30063
30099
  const vramTotalGb = (gpu.memory_total / 1024).toFixed(1);
30064
30100
  const vramPercent = (gpu.memory_used / gpu.memory_total * 100).toFixed(0);
30065
- console.log(source_default.bold(`Darkroom Status
30101
+ print(formatHeader(`Darkroom Status
30066
30102
  `));
30067
- console.log(formatLabel("GPU", gpu.name));
30068
- console.log(formatLabel("VRAM", `${vramUsedGb}/${vramTotalGb} GB (${vramPercent}%)`));
30069
- console.log(formatLabel("Utilization", `${gpu.utilization}%`));
30070
- console.log(formatLabel("Temperature", `${gpu.temperature}°C`));
30071
- console.log();
30072
- console.log(source_default.bold(`Disk
30103
+ print(formatLabel("GPU", gpu.name));
30104
+ print(formatLabel("VRAM", `${vramUsedGb}/${vramTotalGb} GB (${vramPercent}%)`));
30105
+ print(formatLabel("Utilization", `${gpu.utilization}%`));
30106
+ print(formatLabel("Temperature", `${gpu.temperature}°C`));
30107
+ print();
30108
+ print(formatHeader(`Disk
30073
30109
  `));
30074
30110
  const root = health.disk.root;
30075
- console.log(formatLabel("Root", `${root.used}/${root.total} (${root.percent})`));
30111
+ print(formatLabel("Root", `${root.used}/${root.total} (${root.percent})`));
30076
30112
  if (health.disk.comfyui) {
30077
30113
  const comfy = health.disk.comfyui;
30078
- console.log(formatLabel("ComfyUI", `${comfy.used}/${comfy.total} (${comfy.percent})`));
30114
+ print(formatLabel("ComfyUI", `${comfy.used}/${comfy.total} (${comfy.percent})`));
30079
30115
  }
30080
30116
  } catch (error49) {
30081
30117
  handleError(error49);
@@ -30084,26 +30120,26 @@ var darkroomCommand = new Command("darkroom").description("Darkroom infrastructu
30084
30120
  try {
30085
30121
  const validActions = ["start", "stop", "restart", "status"];
30086
30122
  if (!validActions.includes(action)) {
30087
- console.error(source_default.red(`Invalid action: ${action}. Use: ${validActions.join(", ")}`));
30123
+ console.error(formatError3(`Invalid action: ${action}. Use: ${validActions.join(", ")}`));
30088
30124
  process.exit(1);
30089
30125
  }
30090
30126
  const spinner = ora(`${action === "status" ? "Checking" : `${action.charAt(0).toUpperCase()}${action.slice(1)}ing`} ComfyUI...`).start();
30091
30127
  const result = await comfyAction(action);
30092
30128
  spinner.stop();
30093
30129
  if (options.json) {
30094
- console.log(JSON.stringify(result, null, 2));
30130
+ printJson(result);
30095
30131
  return;
30096
30132
  }
30097
30133
  if (result.returncode === 0) {
30098
- console.log(source_default.green(`ComfyUI ${action}: success`));
30134
+ print(formatSuccess(`ComfyUI ${action}: success`));
30099
30135
  } else {
30100
- console.log(source_default.red(`ComfyUI ${action}: failed (exit code ${result.returncode})`));
30136
+ print(formatError3(`ComfyUI ${action}: failed (exit code ${result.returncode})`));
30101
30137
  }
30102
30138
  if (result.stdout) {
30103
- console.log(source_default.dim(result.stdout));
30139
+ print(source_default.dim(result.stdout));
30104
30140
  }
30105
30141
  if (result.stderr) {
30106
- console.log(source_default.yellow(result.stderr));
30142
+ print(formatWarning(result.stderr));
30107
30143
  }
30108
30144
  } catch (error49) {
30109
30145
  handleError(error49);
@@ -30114,19 +30150,19 @@ var darkroomCommand = new Command("darkroom").description("Darkroom infrastructu
30114
30150
  const result = await listLoras();
30115
30151
  spinner.stop();
30116
30152
  if (options.json) {
30117
- console.log(JSON.stringify(result, null, 2));
30153
+ printJson(result);
30118
30154
  return;
30119
30155
  }
30120
30156
  if (result.loras.length === 0) {
30121
- console.log(source_default.yellow("No LoRA models found."));
30157
+ print(formatWarning("No LoRA models found."));
30122
30158
  return;
30123
30159
  }
30124
- console.log(source_default.bold(`LoRA Models (${result.loras.length})
30160
+ print(formatHeader(`LoRA Models (${result.loras.length})
30125
30161
  `));
30126
30162
  for (const lora of result.loras) {
30127
30163
  const date5 = new Date(lora.modified).toLocaleDateString();
30128
- console.log(` ${source_default.bold(lora.name)}`);
30129
- console.log(` ${source_default.dim(`${lora.size_mb.toFixed(1)} MB | ${date5}`)}`);
30164
+ print(` ${source_default.bold(lora.name)}`);
30165
+ print(` ${source_default.dim(`${lora.size_mb.toFixed(1)} MB | ${date5}`)}`);
30130
30166
  }
30131
30167
  } catch (error49) {
30132
30168
  handleError(error49);
@@ -30137,22 +30173,22 @@ var darkroomCommand = new Command("darkroom").description("Darkroom infrastructu
30137
30173
  const result = await listPersonas();
30138
30174
  spinner.stop();
30139
30175
  if (options.json) {
30140
- console.log(JSON.stringify(result, null, 2));
30176
+ printJson(result);
30141
30177
  return;
30142
30178
  }
30143
30179
  if (result.personas.length === 0) {
30144
- console.log(source_default.yellow("No persona configs found."));
30180
+ print(formatWarning("No persona configs found."));
30145
30181
  return;
30146
30182
  }
30147
- console.log(source_default.bold(`Personas (${result.personas.length})
30183
+ print(formatHeader(`Personas (${result.personas.length})
30148
30184
  `));
30149
30185
  for (const p2 of result.personas) {
30150
30186
  if (p2.error) {
30151
- console.log(` ${source_default.red(p2.handle)} ${source_default.dim(`(${p2.error})`)}`);
30187
+ print(` ${source_default.red(p2.handle)} ${source_default.dim(`(${p2.error})`)}`);
30152
30188
  } else {
30153
30189
  const pulid = p2.has_pulid ? source_default.green("pulid") : source_default.dim("no pulid");
30154
- console.log(` ${source_default.bold(p2.handle)}`);
30155
- console.log(` ${source_default.dim(`LoRA: ${p2.lora_file} | ${pulid}`)}`);
30190
+ print(` ${source_default.bold(p2.handle)}`);
30191
+ print(` ${source_default.dim(`LoRA: ${p2.lora_file} | ${pulid}`)}`);
30156
30192
  }
30157
30193
  }
30158
30194
  } catch (error49) {
@@ -30167,14 +30203,14 @@ function buildGenerateCommand() {
30167
30203
  const result = await startFaceTest(handle);
30168
30204
  spinner.succeed("Face test started");
30169
30205
  if (options.json && !options.wait) {
30170
- console.log(JSON.stringify(result, null, 2));
30206
+ printJson(result);
30171
30207
  return;
30172
30208
  }
30173
- console.log(formatLabel("Job ID", result.job_id));
30174
- console.log(formatLabel("Images", String(result.images_total)));
30209
+ print(formatLabel("Job ID", result.job_id));
30210
+ print(formatLabel("Images", String(result.images_total)));
30175
30211
  if (!options.wait) {
30176
- console.log();
30177
- console.log(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
30212
+ print();
30213
+ print(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
30178
30214
  return;
30179
30215
  }
30180
30216
  await pollGenerateJob(result.job_id, options.json);
@@ -30189,14 +30225,14 @@ function buildGenerateCommand() {
30189
30225
  const result = await startBootstrap(handle, count);
30190
30226
  spinner.succeed("Bootstrap started");
30191
30227
  if (options.json && !options.wait) {
30192
- console.log(JSON.stringify(result, null, 2));
30228
+ printJson(result);
30193
30229
  return;
30194
30230
  }
30195
- console.log(formatLabel("Job ID", result.job_id));
30196
- console.log(formatLabel("Images", String(result.images_total)));
30231
+ print(formatLabel("Job ID", result.job_id));
30232
+ print(formatLabel("Images", String(result.images_total)));
30197
30233
  if (!options.wait) {
30198
- console.log();
30199
- console.log(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
30234
+ print();
30235
+ print(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
30200
30236
  return;
30201
30237
  }
30202
30238
  await pollGenerateJob(result.job_id, options.json);
@@ -30211,14 +30247,14 @@ function buildGenerateCommand() {
30211
30247
  const result = await startPulid(handle, mode);
30212
30248
  spinner.succeed("PuLID generation started");
30213
30249
  if (options.json && !options.wait) {
30214
- console.log(JSON.stringify(result, null, 2));
30250
+ printJson(result);
30215
30251
  return;
30216
30252
  }
30217
- console.log(formatLabel("Job ID", result.job_id));
30218
- console.log(formatLabel("Images", String(result.images_total)));
30253
+ print(formatLabel("Job ID", result.job_id));
30254
+ print(formatLabel("Images", String(result.images_total)));
30219
30255
  if (!options.wait) {
30220
- console.log();
30221
- console.log(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
30256
+ print();
30257
+ print(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
30222
30258
  return;
30223
30259
  }
30224
30260
  await pollGenerateJob(result.job_id, options.json);
@@ -30232,14 +30268,14 @@ function buildGenerateCommand() {
30232
30268
  const result = await startContentGenerate(handle);
30233
30269
  spinner.succeed("Content generation started");
30234
30270
  if (options.json && !options.wait) {
30235
- console.log(JSON.stringify(result, null, 2));
30271
+ printJson(result);
30236
30272
  return;
30237
30273
  }
30238
- console.log(formatLabel("Job ID", result.job_id));
30239
- console.log(formatLabel("Images", String(result.images_total)));
30274
+ print(formatLabel("Job ID", result.job_id));
30275
+ print(formatLabel("Images", String(result.images_total)));
30240
30276
  if (!options.wait) {
30241
- console.log();
30242
- console.log(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
30277
+ print();
30278
+ print(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
30243
30279
  return;
30244
30280
  }
30245
30281
  await pollGenerateJob(result.job_id, options.json);
@@ -30253,21 +30289,21 @@ function buildGenerateCommand() {
30253
30289
  const status = await getGenerateStatus(jobId);
30254
30290
  spinner.stop();
30255
30291
  if (options.json && !options.watch) {
30256
- console.log(JSON.stringify(status, null, 2));
30292
+ printJson(status);
30257
30293
  return;
30258
30294
  }
30259
- console.log(formatLabel("Job ID", status.job_id));
30260
- console.log(formatLabel("Type", status.job_type));
30261
- console.log(formatLabel("Status", status.status));
30262
- console.log(formatLabel("Persona", status.persona));
30263
- console.log(formatLabel("Images", `${status.images_completed}/${status.images_total}`));
30264
- console.log(formatLabel("Progress", formatProgress(status.progress)));
30265
- console.log(formatLabel("Started", new Date(status.started_at).toLocaleString()));
30295
+ print(formatLabel("Job ID", status.job_id));
30296
+ print(formatLabel("Type", status.job_type));
30297
+ print(formatLabel("Status", status.status));
30298
+ print(formatLabel("Persona", status.persona));
30299
+ print(formatLabel("Images", `${status.images_completed}/${status.images_total}`));
30300
+ print(formatLabel("Progress", formatProgress(status.progress)));
30301
+ print(formatLabel("Started", new Date(status.started_at).toLocaleString()));
30266
30302
  if (status.completed_at) {
30267
- console.log(formatLabel("Completed", new Date(status.completed_at).toLocaleString()));
30303
+ print(formatLabel("Completed", new Date(status.completed_at).toLocaleString()));
30268
30304
  }
30269
30305
  if (status.error) {
30270
- console.log(formatLabel("Error", source_default.red(status.error)));
30306
+ print(formatLabel("Error", source_default.red(status.error)));
30271
30307
  }
30272
30308
  if (!options.watch || status.status === "completed" || status.status === "failed") {
30273
30309
  return;
@@ -30280,7 +30316,7 @@ function buildGenerateCommand() {
30280
30316
  return generate;
30281
30317
  }
30282
30318
  async function pollGenerateJob(jobId, json2) {
30283
- console.log();
30319
+ print();
30284
30320
  const pollSpinner = ora("Generating...").start();
30285
30321
  const pollStart = Date.now();
30286
30322
  while (true) {
@@ -30294,15 +30330,15 @@ async function pollGenerateJob(jobId, json2) {
30294
30330
  if (status.status === "completed") {
30295
30331
  pollSpinner.succeed(`Generation complete: ${status.images_completed}/${status.images_total} images`);
30296
30332
  if (json2) {
30297
- console.log(JSON.stringify(status, null, 2));
30333
+ printJson(status);
30298
30334
  } else if (status.filenames.length > 0) {
30299
- console.log(source_default.dim(`
30335
+ print(source_default.dim(`
30300
30336
  Generated files:`));
30301
30337
  for (const f2 of status.filenames.slice(0, 20)) {
30302
- console.log(source_default.dim(` ${f2}`));
30338
+ print(source_default.dim(` ${f2}`));
30303
30339
  }
30304
30340
  if (status.filenames.length > 20) {
30305
- console.log(source_default.dim(` ... and ${status.filenames.length - 20} more`));
30341
+ print(source_default.dim(` ... and ${status.filenames.length - 20} more`));
30306
30342
  }
30307
30343
  }
30308
30344
  break;
@@ -30322,22 +30358,22 @@ datasetCommand.command("info").description("Show dataset info for a persona").ar
30322
30358
  const dataset = await getDataset(handle);
30323
30359
  spinner.stop();
30324
30360
  if (options.json) {
30325
- console.log(JSON.stringify(dataset, null, 2));
30361
+ printJson(dataset);
30326
30362
  return;
30327
30363
  }
30328
- console.log(source_default.bold(`Dataset: ${handle}
30364
+ print(formatHeader(`Dataset: ${handle}
30329
30365
  `));
30330
- console.log(formatLabel("Path", dataset.path));
30331
- console.log(formatLabel("Images", String(dataset.image_count)));
30332
- console.log(formatLabel("Captions", String(dataset.caption_count)));
30366
+ print(formatLabel("Path", dataset.path));
30367
+ print(formatLabel("Images", String(dataset.image_count)));
30368
+ print(formatLabel("Captions", String(dataset.caption_count)));
30333
30369
  if (dataset.images.length > 0) {
30334
- console.log();
30335
- console.log(source_default.dim("Files:"));
30370
+ print();
30371
+ print(source_default.dim("Files:"));
30336
30372
  for (const img of dataset.images.slice(0, 20)) {
30337
- console.log(source_default.dim(` ${img}`));
30373
+ print(source_default.dim(` ${img}`));
30338
30374
  }
30339
30375
  if (dataset.images.length > 20) {
30340
- console.log(source_default.dim(` ... and ${dataset.images.length - 20} more`));
30376
+ print(source_default.dim(` ... and ${dataset.images.length - 20} more`));
30341
30377
  }
30342
30378
  }
30343
30379
  } catch (error49) {
@@ -30357,7 +30393,7 @@ datasetCommand.command("upload").description("Upload training images to darkroom
30357
30393
  return imageExts.has(ext) || ext === ".txt";
30358
30394
  }).map((f2) => join(resolvedPath, f2)).filter((f2) => statSync(f2).isFile());
30359
30395
  if (filePaths.length === 0) {
30360
- console.log(source_default.red(`No image or caption files found in ${resolvedPath}`));
30396
+ print(formatError3(`No image or caption files found in ${resolvedPath}`));
30361
30397
  return;
30362
30398
  }
30363
30399
  const spinner = ora(`Uploading ${filePaths.length} files for ${handle}...`).start();
@@ -33212,7 +33248,7 @@ async function waitForCompletion(options) {
33212
33248
  }
33213
33249
  try {
33214
33250
  const result = await getResult();
33215
- resolve({ result, elapsed });
33251
+ resolve({ elapsed, result });
33216
33252
  } catch (err) {
33217
33253
  reject(err);
33218
33254
  }
@@ -33228,10 +33264,10 @@ async function waitForCompletion(options) {
33228
33264
  auth: {
33229
33265
  token: apiKey
33230
33266
  },
33231
- transports: ["websocket"],
33232
33267
  reconnection: true,
33233
33268
  reconnectionAttempts: 5,
33234
- reconnectionDelay: 1000
33269
+ reconnectionDelay: 1000,
33270
+ transports: ["websocket"]
33235
33271
  });
33236
33272
  socket.on("connect", () => {
33237
33273
  if (spinner) {
@@ -33292,50 +33328,50 @@ var imageCommand = new Command("image").description("Generate an AI image").argu
33292
33328
  const model = options.model ?? profile.defaults.imageModel;
33293
33329
  const spinner = ora("Creating image...").start();
33294
33330
  const image = await createImage({
33295
- text: prompt,
33296
33331
  brand: brandId,
33332
+ height: options.height,
33297
33333
  model,
33298
- width: options.width,
33299
- height: options.height
33334
+ text: prompt,
33335
+ width: options.width
33300
33336
  });
33301
33337
  if (!options.wait) {
33302
33338
  spinner.succeed("Image generation started");
33303
33339
  if (options.json) {
33304
- console.log(JSON.stringify({ id: image.id, status: image.status }, null, 2));
33340
+ printJson({ id: image.id, status: image.status });
33305
33341
  } else {
33306
- console.log(formatLabel("ID", image.id));
33307
- console.log(formatLabel("Status", image.status));
33308
- console.log();
33309
- console.log(source_default.dim(`Check status with: gf status ${image.id}`));
33342
+ print(formatLabel("ID", image.id));
33343
+ print(formatLabel("Status", image.status));
33344
+ print();
33345
+ print(source_default.dim(`Check status with: gf status ${image.id}`));
33310
33346
  }
33311
33347
  return;
33312
33348
  }
33313
33349
  spinner.text = "Generating image...";
33314
33350
  const { result, elapsed } = await waitForCompletion({
33315
- taskId: image.id,
33316
- taskType: "IMAGE",
33317
33351
  getResult: () => getImage(image.id),
33318
33352
  spinner,
33353
+ taskId: image.id,
33354
+ taskType: "IMAGE",
33319
33355
  timeout: 300000
33320
33356
  });
33321
33357
  const elapsedSec = (elapsed / 1000).toFixed(1);
33322
33358
  spinner.succeed(`Image generated (${elapsedSec}s)`);
33323
33359
  if (options.json) {
33324
- console.log(JSON.stringify({
33360
+ printJson({
33361
+ elapsed,
33362
+ height: result.height,
33325
33363
  id: result.id,
33364
+ model: result.model,
33326
33365
  status: result.status,
33327
33366
  url: result.url,
33328
- width: result.width,
33329
- height: result.height,
33330
- model: result.model,
33331
- elapsed
33332
- }, null, 2));
33367
+ width: result.width
33368
+ });
33333
33369
  } else {
33334
- console.log(formatLabel("URL", result.url ?? "N/A"));
33370
+ print(formatLabel("URL", result.url ?? "N/A"));
33335
33371
  if (result.width && result.height) {
33336
- console.log(formatLabel("Dimensions", `${result.width} × ${result.height}`));
33372
+ print(formatLabel("Dimensions", `${result.width} × ${result.height}`));
33337
33373
  }
33338
- console.log(formatLabel("Model", result.model));
33374
+ print(formatLabel("Model", result.model));
33339
33375
  }
33340
33376
  if (options.output && result.url) {
33341
33377
  const downloadSpinner = ora("Downloading image...").start();
@@ -33383,53 +33419,53 @@ var videoCommand = new Command("video").description("Generate an AI video").argu
33383
33419
  const model = options.model ?? profile.defaults.videoModel;
33384
33420
  const spinner = ora("Creating video...").start();
33385
33421
  const video = await createVideo({
33386
- text: prompt,
33387
33422
  brand: brandId,
33388
- model,
33389
33423
  duration: options.duration,
33390
- resolution: options.resolution
33424
+ model,
33425
+ resolution: options.resolution,
33426
+ text: prompt
33391
33427
  });
33392
33428
  if (!options.wait) {
33393
33429
  spinner.succeed("Video generation started");
33394
33430
  if (options.json) {
33395
- console.log(JSON.stringify({ id: video.id, status: video.status }, null, 2));
33431
+ printJson({ id: video.id, status: video.status });
33396
33432
  } else {
33397
- console.log(formatLabel("ID", video.id));
33398
- console.log(formatLabel("Status", video.status));
33399
- console.log();
33400
- console.log(source_default.dim(`Check status with: gf status ${video.id}`));
33433
+ print(formatLabel("ID", video.id));
33434
+ print(formatLabel("Status", video.status));
33435
+ print();
33436
+ print(source_default.dim(`Check status with: gf status ${video.id}`));
33401
33437
  }
33402
33438
  return;
33403
33439
  }
33404
33440
  spinner.text = "Generating video...";
33405
33441
  const { result, elapsed } = await waitForCompletion({
33406
- taskId: video.id,
33407
- taskType: "VIDEO",
33408
33442
  getResult: () => getVideo(video.id),
33409
33443
  spinner,
33444
+ taskId: video.id,
33445
+ taskType: "VIDEO",
33410
33446
  timeout: 600000
33411
33447
  });
33412
33448
  const elapsedSec = (elapsed / 1000).toFixed(1);
33413
33449
  spinner.succeed(`Video generated (${elapsedSec}s)`);
33414
33450
  if (options.json) {
33415
- console.log(JSON.stringify({
33416
- id: result.id,
33417
- status: result.status,
33418
- url: result.url,
33451
+ printJson({
33419
33452
  duration: result.duration,
33420
- resolution: result.resolution,
33453
+ elapsed,
33454
+ id: result.id,
33421
33455
  model: result.model,
33422
- elapsed
33423
- }, null, 2));
33456
+ resolution: result.resolution,
33457
+ status: result.status,
33458
+ url: result.url
33459
+ });
33424
33460
  } else {
33425
- console.log(formatLabel("URL", result.url ?? "N/A"));
33461
+ print(formatLabel("URL", result.url ?? "N/A"));
33426
33462
  if (result.duration) {
33427
- console.log(formatLabel("Duration", `${result.duration}s`));
33463
+ print(formatLabel("Duration", `${result.duration}s`));
33428
33464
  }
33429
33465
  if (result.resolution) {
33430
- console.log(formatLabel("Resolution", result.resolution));
33466
+ print(formatLabel("Resolution", result.resolution));
33431
33467
  }
33432
- console.log(formatLabel("Model", result.model));
33468
+ print(formatLabel("Model", result.model));
33433
33469
  }
33434
33470
  if (options.output && result.url) {
33435
33471
  const downloadSpinner = ora("Downloading video...").start();
@@ -33464,29 +33500,29 @@ var libraryCommand = new Command("library").description("Browse content library"
33464
33500
  if (options.type)
33465
33501
  params.set("category", options.type);
33466
33502
  params.set("limit", options.limit);
33467
- const response = await get(`/v1/ingredients?${params.toString()}`);
33503
+ const response = await get(`/ingredients?${params.toString()}`);
33468
33504
  spinner.stop();
33469
33505
  const items = response.data ?? [];
33470
33506
  if (items.length === 0) {
33471
- console.log(source_default.dim("No items found."));
33507
+ print(source_default.dim("No items found."));
33472
33508
  return;
33473
33509
  }
33474
33510
  if (options.json) {
33475
- console.log(JSON.stringify(items, null, 2));
33511
+ printJson(items);
33476
33512
  return;
33477
33513
  }
33478
- console.log(source_default.bold(`
33514
+ print(formatHeader(`
33479
33515
  Library (${items.length} items):
33480
33516
  `));
33481
33517
  for (const item of items) {
33482
33518
  const category = source_default.blue(`[${item.category}]`);
33483
33519
  const status = item.status === "generated" ? source_default.green(item.status) : source_default.dim(item.status);
33484
33520
  const id = source_default.dim(`(${item._id})`);
33485
- console.log(` ${category} ${status} ${id}`);
33521
+ print(` ${category} ${status} ${id}`);
33486
33522
  if (item.prompt?.text) {
33487
- console.log(` ${source_default.dim(item.prompt.text.slice(0, 80))}...`);
33523
+ print(` ${source_default.dim(item.prompt.text.slice(0, 80))}...`);
33488
33524
  }
33489
- console.log();
33525
+ print();
33490
33526
  }
33491
33527
  } catch (error49) {
33492
33528
  spinner.fail("Failed to fetch library");
@@ -33510,7 +33546,7 @@ async function validateApiKey() {
33510
33546
  }
33511
33547
 
33512
33548
  // src/commands/login.ts
33513
- var AUTH_URL = "https://app.genfeed.ai/cli-auth";
33549
+ var AUTH_URL = "https://app.genfeed.ai/oauth/cli";
33514
33550
  var CALLBACK_TIMEOUT = 120000;
33515
33551
  function waitForOAuthCallback() {
33516
33552
  return new Promise((resolve, reject) => {
@@ -33546,17 +33582,24 @@ function waitForOAuthCallback() {
33546
33582
  }, CALLBACK_TIMEOUT);
33547
33583
  function cleanup() {
33548
33584
  clearTimeout(timeout);
33585
+ process.removeListener("SIGINT", onSigint);
33549
33586
  server.close();
33550
33587
  }
33588
+ function onSigint() {
33589
+ cleanup();
33590
+ reject(new GenfeedError("Authentication cancelled"));
33591
+ process.exit(130);
33592
+ }
33593
+ process.on("SIGINT", onSigint);
33551
33594
  server.listen(0, "127.0.0.1", () => {
33552
33595
  const addr = server.address();
33553
33596
  if (addr && typeof addr === "object") {
33554
33597
  const port = addr.port;
33555
33598
  const authUrl = `${AUTH_URL}?port=${port}`;
33556
- console.log();
33557
- console.log(source_default.bold("Opening browser to authenticate..."));
33558
- console.log(source_default.dim(authUrl));
33559
- console.log();
33599
+ print();
33600
+ print(formatHeader("Opening browser to authenticate..."));
33601
+ print(source_default.dim(authUrl));
33602
+ print();
33560
33603
  openBrowser(authUrl);
33561
33604
  }
33562
33605
  });
@@ -33606,34 +33649,39 @@ async function completeLogin(apiKey) {
33606
33649
  try {
33607
33650
  const whoamiData = await validateApiKey();
33608
33651
  spinner.succeed();
33609
- console.log();
33610
- console.log(formatSuccess(`Logged in as ${source_default.bold(whoamiData.organization.name)}`));
33611
- console.log(formatLabel("Email", whoamiData.user.email));
33612
- console.log(formatLabel("Scopes", whoamiData.scopes.join(", ")));
33652
+ await setOrganizationId(whoamiData.organization.id);
33653
+ print();
33654
+ print(formatSuccess(`Logged in as ${source_default.bold(whoamiData.organization.name)}`));
33655
+ print(formatLabel("Email", whoamiData.user.email));
33656
+ print(formatLabel("Scopes", whoamiData.scopes.join(", ")));
33613
33657
  if (whoamiData.scopes.includes("admin") || whoamiData.scopes.includes("superadmin")) {
33614
33658
  await setRole("admin");
33615
- console.log(formatLabel("Role", source_default.green("admin")));
33659
+ print(formatLabel("Role", source_default.green("admin")));
33616
33660
  }
33617
- console.log();
33618
- const brands = await listBrands();
33619
- if (brands.length === 0) {
33620
- console.log(source_default.yellow("No brands found. Create one at https://app.genfeed.ai"));
33621
- } else if (brands.length === 1) {
33622
- await setActiveBrand(brands[0].id);
33623
- console.log(formatSuccess(`Active brand: ${source_default.bold(brands[0].name)}`));
33624
- } else {
33625
- const selected = await dist_default5({
33626
- message: "Select a brand:",
33627
- choices: brands.map((brand) => ({
33628
- name: brand.name,
33629
- value: brand.id,
33630
- description: brand.description
33631
- }))
33632
- });
33633
- await setActiveBrand(selected);
33634
- const selectedBrand = brands.find((b) => b.id === selected);
33635
- console.log();
33636
- console.log(formatSuccess(`Active brand: ${source_default.bold(selectedBrand?.name)}`));
33661
+ print();
33662
+ try {
33663
+ const brands = await listBrands(whoamiData.organization.id);
33664
+ if (brands.length === 0) {
33665
+ print(formatWarning("No brands found. Create one at https://app.genfeed.ai"));
33666
+ } else if (brands.length === 1) {
33667
+ await setActiveBrand(brands[0].id);
33668
+ print(formatSuccess(`Active brand: ${source_default.bold(brands[0].name)}`));
33669
+ } else {
33670
+ const selected = await dist_default5({
33671
+ choices: brands.map((brand) => ({
33672
+ description: brand.description,
33673
+ name: brand.name,
33674
+ value: brand.id
33675
+ })),
33676
+ message: "Select a brand:"
33677
+ });
33678
+ await setActiveBrand(selected);
33679
+ const selectedBrand = brands.find((b) => b.id === selected);
33680
+ print();
33681
+ print(formatSuccess(`Active brand: ${source_default.bold(selectedBrand?.name)}`));
33682
+ }
33683
+ } catch {
33684
+ print(formatWarning("Could not fetch brands. Set one later with `gf brands`"));
33637
33685
  }
33638
33686
  } catch (error49) {
33639
33687
  spinner.fail("Invalid API key");
@@ -33651,11 +33699,11 @@ var loginCommand = new Command("login").description("Authenticate with Genfeed (
33651
33699
  return;
33652
33700
  }
33653
33701
  if (options.interactive) {
33654
- console.log(source_default.dim(`Get your API key at: https://app.genfeed.ai/settings/api-keys
33702
+ print(source_default.dim(`Get your API key at: https://app.genfeed.ai/settings/api-keys
33655
33703
  `));
33656
33704
  const apiKey = await dist_default4({
33657
- message: "Enter your Genfeed API key:",
33658
33705
  mask: "*",
33706
+ message: "Enter your Genfeed API key:",
33659
33707
  validate: (value2) => {
33660
33708
  if (!value2)
33661
33709
  return "API key is required";
@@ -33689,12 +33737,12 @@ var logoutCommand = new Command("logout").description("Remove stored credentials
33689
33737
  try {
33690
33738
  const hasKey = await getApiKey();
33691
33739
  if (!hasKey) {
33692
- console.log(formatWarning("You are not logged in"));
33740
+ print(formatWarning("You are not logged in"));
33693
33741
  return;
33694
33742
  }
33695
33743
  await clearApiKey();
33696
33744
  await clearActiveBrand();
33697
- console.log(formatSuccess("Logged out successfully"));
33745
+ print(formatSuccess("Logged out successfully"));
33698
33746
  } catch (error49) {
33699
33747
  handleError(error49);
33700
33748
  }
@@ -33708,23 +33756,23 @@ var personasCommand = new Command("personas").description("List and manage perso
33708
33756
  spinner.stop();
33709
33757
  const personas = response.data;
33710
33758
  if (options.json) {
33711
- console.log(JSON.stringify(response, null, 2));
33759
+ printJson(response);
33712
33760
  return;
33713
33761
  }
33714
33762
  if (personas.length === 0) {
33715
- console.log(source_default.yellow("No personas found."));
33763
+ print(formatWarning("No personas found."));
33716
33764
  return;
33717
33765
  }
33718
- console.log(source_default.bold(`Personas (${personas.length})
33766
+ print(formatHeader(`Personas (${personas.length})
33719
33767
  `));
33720
33768
  for (const persona of personas) {
33721
33769
  const status = persona.status === "active" ? source_default.green("●") : source_default.dim("○");
33722
- console.log(` ${status} ${source_default.bold(persona.handle)} ${source_default.dim(`(${persona.name})`)}`);
33770
+ print(` ${status} ${source_default.bold(persona.handle)} ${source_default.dim(`(${persona.name})`)}`);
33723
33771
  if (persona.description) {
33724
- console.log(` ${source_default.dim(persona.description.slice(0, 80))}`);
33772
+ print(` ${source_default.dim(persona.description.slice(0, 80))}`);
33725
33773
  }
33726
33774
  if (persona.triggerWord) {
33727
- console.log(` ${source_default.dim(`trigger: ${persona.triggerWord}`)}`);
33775
+ print(` ${source_default.dim(`trigger: ${persona.triggerWord}`)}`);
33728
33776
  }
33729
33777
  }
33730
33778
  } catch (error49) {
@@ -33738,25 +33786,25 @@ personasCommand.command("show").description("Show persona details").argument("<h
33738
33786
  spinner.stop();
33739
33787
  const persona = response.data;
33740
33788
  if (options.json) {
33741
- console.log(JSON.stringify(persona, null, 2));
33789
+ printJson(persona);
33742
33790
  return;
33743
33791
  }
33744
- console.log(source_default.bold(`${persona.name} (@${persona.handle})
33792
+ print(formatHeader(`${persona.name} (@${persona.handle})
33745
33793
  `));
33746
- console.log(formatLabel("ID", persona.id));
33794
+ print(formatLabel("ID", persona.id));
33747
33795
  if (persona.description) {
33748
- console.log(formatLabel("Description", persona.description));
33796
+ print(formatLabel("Description", persona.description));
33749
33797
  }
33750
33798
  if (persona.triggerWord) {
33751
- console.log(formatLabel("Trigger Word", persona.triggerWord));
33799
+ print(formatLabel("Trigger Word", persona.triggerWord));
33752
33800
  }
33753
33801
  if (persona.platform) {
33754
- console.log(formatLabel("Platform", persona.platform));
33802
+ print(formatLabel("Platform", persona.platform));
33755
33803
  }
33756
33804
  if (persona.status) {
33757
- console.log(formatLabel("Status", persona.status));
33805
+ print(formatLabel("Status", persona.status));
33758
33806
  }
33759
- console.log(formatLabel("Created", new Date(persona.createdAt).toLocaleDateString()));
33807
+ print(formatLabel("Created", new Date(persona.createdAt).toLocaleDateString()));
33760
33808
  } catch (error49) {
33761
33809
  handleError(error49);
33762
33810
  }
@@ -33768,23 +33816,23 @@ profileCommand.command("list").description("List all profiles").option("--json",
33768
33816
  try {
33769
33817
  const profiles = await listProfiles();
33770
33818
  if (options.json) {
33771
- console.log(JSON.stringify(profiles, null, 2));
33819
+ printJson(profiles);
33772
33820
  return;
33773
33821
  }
33774
- console.log(source_default.bold(`Profiles
33822
+ print(formatHeader(`Profiles
33775
33823
  `));
33776
33824
  for (const { name, active, profile } of profiles) {
33777
33825
  const marker = active ? source_default.green("●") : source_default.dim("○");
33778
33826
  const label = active ? source_default.bold(name) : name;
33779
33827
  const activeLabel = active ? source_default.dim(" (active)") : "";
33780
33828
  const apiUrl = source_default.dim(profile.apiUrl);
33781
- console.log(` ${marker} ${label}${activeLabel} ${apiUrl}`);
33829
+ print(` ${marker} ${label}${activeLabel} ${apiUrl}`);
33782
33830
  if (profile.darkroomHost !== "100.106.229.81") {
33783
- console.log(` ${source_default.dim(`darkroom: ${profile.darkroomHost}`)}`);
33831
+ print(` ${source_default.dim(`darkroom: ${profile.darkroomHost}`)}`);
33784
33832
  }
33785
33833
  }
33786
- console.log();
33787
- console.log(source_default.dim(`Config: ${getConfigPath()}`));
33834
+ print();
33835
+ print(source_default.dim(`Config: ${getConfigPath()}`));
33788
33836
  } catch (error49) {
33789
33837
  handleError(error49);
33790
33838
  }
@@ -33792,7 +33840,7 @@ profileCommand.command("list").description("List all profiles").option("--json",
33792
33840
  profileCommand.command("use").description("Set the active profile").argument("<name>", "Profile name").action(async (name) => {
33793
33841
  try {
33794
33842
  await setActiveProfileName(name);
33795
- console.log(formatSuccess(`Active profile: ${source_default.bold(name)}`));
33843
+ print(formatSuccess(`Active profile: ${source_default.bold(name)}`));
33796
33844
  } catch (error49) {
33797
33845
  handleError(error49);
33798
33846
  }
@@ -33800,13 +33848,13 @@ profileCommand.command("use").description("Set the active profile").argument("<n
33800
33848
  profileCommand.command("create").description("Create a new profile").argument("<name>", "Profile name").option("--api-url <url>", "API URL").option("--api-key <key>", "API key").option("--darkroom-host <host>", "Darkroom host address").option("--role <role>", "User role (user or admin)").action(async (name, options) => {
33801
33849
  try {
33802
33850
  await createProfile(name, {
33803
- apiUrl: options.apiUrl,
33804
33851
  apiKey: options.apiKey,
33852
+ apiUrl: options.apiUrl,
33805
33853
  darkroomHost: options.darkroomHost,
33806
33854
  role: options.role
33807
33855
  });
33808
- console.log(formatSuccess(`Profile "${name}" created`));
33809
- console.log(source_default.dim(`Switch to it with: gf profile use ${name}`));
33856
+ print(formatSuccess(`Profile "${name}" created`));
33857
+ print(source_default.dim(`Switch to it with: gf profile use ${name}`));
33810
33858
  } catch (error49) {
33811
33859
  handleError(error49);
33812
33860
  }
@@ -33814,32 +33862,32 @@ profileCommand.command("create").description("Create a new profile").argument("<
33814
33862
  profileCommand.command("set").description("Update a profile field").argument("<field>", "Field name (api-url, api-key, darkroom-host, role, active-persona)").argument("<value>", "Field value").option("-p, --profile <name>", "Profile name (defaults to active)").action(async (field, value2, options) => {
33815
33863
  try {
33816
33864
  const fieldMap = {
33817
- "api-url": "apiUrl",
33865
+ "active-brand": "activeBrand",
33866
+ "active-persona": "activePersona",
33818
33867
  "api-key": "apiKey",
33868
+ "api-url": "apiUrl",
33819
33869
  "darkroom-host": "darkroomHost",
33820
33870
  "darkroom-port": "darkroomApiPort",
33821
- role: "role",
33822
- "active-persona": "activePersona",
33823
- "active-brand": "activeBrand"
33871
+ role: "role"
33824
33872
  };
33825
33873
  const mappedField = fieldMap[field];
33826
33874
  if (!mappedField) {
33827
- console.error(source_default.red(`Unknown field: ${field}`));
33828
- console.log(source_default.dim(`Valid fields: ${Object.keys(fieldMap).join(", ")}`));
33875
+ console.error(formatError3(`Unknown field: ${field}`));
33876
+ print(source_default.dim(`Valid fields: ${Object.keys(fieldMap).join(", ")}`));
33829
33877
  process.exit(1);
33830
33878
  }
33831
33879
  let finalValue = value2;
33832
33880
  if (mappedField === "darkroomApiPort") {
33833
33881
  finalValue = Number.parseInt(value2, 10);
33834
33882
  if (Number.isNaN(finalValue)) {
33835
- console.error(source_default.red(`Invalid port number: ${value2}`));
33883
+ console.error(formatError3(`Invalid port number: ${value2}`));
33836
33884
  process.exit(1);
33837
33885
  }
33838
33886
  }
33839
33887
  await setProfileField(mappedField, finalValue, options.profile);
33840
- console.log(formatSuccess(`Set ${field} = ${value2}`));
33888
+ print(formatSuccess(`Set ${field} = ${value2}`));
33841
33889
  if (options.profile) {
33842
- console.log(formatLabel("Profile", options.profile));
33890
+ print(formatLabel("Profile", options.profile));
33843
33891
  }
33844
33892
  } catch (error49) {
33845
33893
  handleError(error49);
@@ -33865,7 +33913,7 @@ var publishCommand = new Command("publish").description("Publish content to soci
33865
33913
  });
33866
33914
  }
33867
33915
  if (platforms.length === 0) {
33868
- console.log(source_default.yellow("No platforms selected."));
33916
+ print(formatWarning("No platforms selected."));
33869
33917
  return;
33870
33918
  }
33871
33919
  let caption = options.caption ?? "";
@@ -33876,13 +33924,13 @@ var publishCommand = new Command("publish").description("Publish content to soci
33876
33924
  }
33877
33925
  const spinner = ora(`Publishing to ${platforms.join(", ")}...`).start();
33878
33926
  try {
33879
- await post("/v1/posts", {
33927
+ await post("/posts", {
33880
33928
  caption,
33881
33929
  ingredientId,
33882
33930
  platforms
33883
33931
  });
33884
33932
  spinner.stop();
33885
- console.log(formatSuccess(`Published to ${platforms.join(", ")}`));
33933
+ print(formatSuccess(`Published to ${platforms.join(", ")}`));
33886
33934
  } catch (error49) {
33887
33935
  spinner.fail("Failed to publish");
33888
33936
  throw error49;
@@ -33914,29 +33962,29 @@ var statusCommand = new Command("status").description("Check the status of a gen
33914
33962
  if (options.type === "video") {
33915
33963
  const video = await getVideo(id);
33916
33964
  result = {
33917
- id: video.id,
33918
- type: "video",
33919
- status: video.status,
33920
- url: video.url,
33921
- error: video.error,
33922
- model: video.model,
33923
- createdAt: video.createdAt,
33924
33965
  completedAt: video.completedAt,
33966
+ createdAt: video.createdAt,
33925
33967
  duration: video.duration,
33926
- resolution: video.resolution
33968
+ error: video.error,
33969
+ id: video.id,
33970
+ model: video.model,
33971
+ resolution: video.resolution,
33972
+ status: video.status,
33973
+ type: "video",
33974
+ url: video.url
33927
33975
  };
33928
33976
  } else {
33929
33977
  const image = await getImage(id);
33930
33978
  result = {
33931
- id: image.id,
33932
- type: "image",
33933
- status: image.status,
33934
- url: image.url,
33979
+ completedAt: image.completedAt,
33980
+ createdAt: image.createdAt,
33981
+ dimensions: image.width && image.height ? { height: image.height, width: image.width } : undefined,
33935
33982
  error: image.error,
33983
+ id: image.id,
33936
33984
  model: image.model,
33937
- createdAt: image.createdAt,
33938
- completedAt: image.completedAt,
33939
- dimensions: image.width && image.height ? { width: image.width, height: image.height } : undefined
33985
+ status: image.status,
33986
+ type: "image",
33987
+ url: image.url
33940
33988
  };
33941
33989
  }
33942
33990
  } catch (err) {
@@ -33944,16 +33992,16 @@ var statusCommand = new Command("status").description("Check the status of a gen
33944
33992
  try {
33945
33993
  const video = await getVideo(id);
33946
33994
  result = {
33947
- id: video.id,
33948
- type: "video",
33949
- status: video.status,
33950
- url: video.url,
33951
- error: video.error,
33952
- model: video.model,
33953
- createdAt: video.createdAt,
33954
33995
  completedAt: video.completedAt,
33996
+ createdAt: video.createdAt,
33955
33997
  duration: video.duration,
33956
- resolution: video.resolution
33998
+ error: video.error,
33999
+ id: video.id,
34000
+ model: video.model,
34001
+ resolution: video.resolution,
34002
+ status: video.status,
34003
+ type: "video",
34004
+ url: video.url
33957
34005
  };
33958
34006
  } catch {
33959
34007
  throw err;
@@ -33964,36 +34012,36 @@ var statusCommand = new Command("status").description("Check the status of a gen
33964
34012
  }
33965
34013
  spinner.stop();
33966
34014
  if (options.json) {
33967
- console.log(JSON.stringify(result, null, 2));
34015
+ printJson(result);
33968
34016
  return;
33969
34017
  }
33970
- console.log(formatLabel("ID", result.id));
33971
- console.log(formatLabel("Type", result.type));
33972
- console.log(formatLabel("Status", formatStatus(result.status)));
33973
- console.log(formatLabel("Model", result.model));
34018
+ print(formatLabel("ID", result.id));
34019
+ print(formatLabel("Type", result.type));
34020
+ print(formatLabel("Status", formatStatus(result.status)));
34021
+ print(formatLabel("Model", result.model));
33974
34022
  if (result.status === "completed" && result.url) {
33975
- console.log(formatLabel("URL", result.url));
34023
+ print(formatLabel("URL", result.url));
33976
34024
  if (result.dimensions) {
33977
- console.log(formatLabel("Dimensions", `${result.dimensions.width} × ${result.dimensions.height}`));
34025
+ print(formatLabel("Dimensions", `${result.dimensions.width} × ${result.dimensions.height}`));
33978
34026
  }
33979
34027
  if (result.duration) {
33980
- console.log(formatLabel("Duration", `${result.duration}s`));
34028
+ print(formatLabel("Duration", `${result.duration}s`));
33981
34029
  }
33982
34030
  if (result.resolution) {
33983
- console.log(formatLabel("Resolution", result.resolution));
34031
+ print(formatLabel("Resolution", result.resolution));
33984
34032
  }
33985
34033
  if (result.completedAt) {
33986
34034
  const completedDate = new Date(result.completedAt);
33987
- console.log(formatLabel("Completed", completedDate.toLocaleString()));
34035
+ print(formatLabel("Completed", completedDate.toLocaleString()));
33988
34036
  }
33989
34037
  }
33990
34038
  if (result.status === "failed" && result.error) {
33991
- console.log();
33992
- console.log(formatError3(`Error: ${result.error}`));
34039
+ print();
34040
+ print(formatError3(`Error: ${result.error}`));
33993
34041
  }
33994
34042
  if (result.status === "pending" || result.status === "processing") {
33995
- console.log();
33996
- console.log(source_default.dim("Generation is still in progress. Check again later."));
34043
+ print();
34044
+ print(source_default.dim("Generation is still in progress. Check again later."));
33997
34045
  }
33998
34046
  } catch (error49) {
33999
34047
  handleError(error49);
@@ -34007,11 +34055,11 @@ var trainCommand = new Command("train").description("LoRA training management [a
34007
34055
  const dataset = await getDataset(handle);
34008
34056
  datasetSpinner.stop();
34009
34057
  if (dataset.image_count === 0) {
34010
- console.log(source_default.red(`No training images found for "${handle}".`));
34011
- console.log(source_default.dim(`Upload images with: gf dataset upload ${handle} <path>`));
34058
+ print(formatError3(`No training images found for "${handle}".`));
34059
+ print(source_default.dim(`Upload images with: gf dataset upload ${handle} <path>`));
34012
34060
  return;
34013
34061
  }
34014
- console.log(formatLabel("Dataset", `${dataset.image_count} images, ${dataset.caption_count} captions`));
34062
+ print(formatLabel("Dataset", `${dataset.image_count} images, ${dataset.caption_count} captions`));
34015
34063
  const triggerWord = options.trigger ?? handle;
34016
34064
  const loraName = `${handle}_zimage`;
34017
34065
  let steps = options.steps;
@@ -34027,31 +34075,31 @@ var trainCommand = new Command("train").description("LoRA training management [a
34027
34075
  }
34028
34076
  const spinner = ora("Starting training...").start();
34029
34077
  const result = await startTraining({
34030
- persona_slug: handle,
34031
- trigger_word: triggerWord,
34078
+ learning_rate: options.lr ?? 0.0004,
34032
34079
  lora_name: loraName,
34033
- steps,
34034
34080
  lora_rank: options.rank ?? 16,
34035
- learning_rate: options.lr ?? 0.0004
34081
+ persona_slug: handle,
34082
+ steps,
34083
+ trigger_word: triggerWord
34036
34084
  });
34037
34085
  spinner.succeed("Training started");
34038
34086
  if (options.json) {
34039
- console.log(JSON.stringify(result, null, 2));
34087
+ printJson(result);
34040
34088
  if (!options.wait)
34041
34089
  return;
34042
34090
  } else {
34043
- console.log(formatLabel("Job ID", result.job_id));
34044
- console.log(formatLabel("Images", String(result.image_count)));
34045
- console.log(formatLabel("Steps", String(steps)));
34046
- console.log(formatLabel("Trigger", triggerWord));
34047
- console.log(formatLabel("LoRA Name", loraName));
34091
+ print(formatLabel("Job ID", result.job_id));
34092
+ print(formatLabel("Images", String(result.image_count)));
34093
+ print(formatLabel("Steps", String(steps)));
34094
+ print(formatLabel("Trigger", triggerWord));
34095
+ print(formatLabel("LoRA Name", loraName));
34048
34096
  }
34049
34097
  if (!options.wait) {
34050
- console.log();
34051
- console.log(source_default.dim(`Check progress with: gf train status ${result.job_id}`));
34098
+ print();
34099
+ print(source_default.dim(`Check progress with: gf train status ${result.job_id}`));
34052
34100
  return;
34053
34101
  }
34054
- console.log();
34102
+ print();
34055
34103
  const pollSpinner = ora("Training in progress...").start();
34056
34104
  const pollStart = Date.now();
34057
34105
  while (true) {
@@ -34081,30 +34129,30 @@ trainCommand.command("status").description("Check training job status").argument
34081
34129
  let status = await getTrainingStatus(jobId);
34082
34130
  spinner.stop();
34083
34131
  if (options.json && !options.watch) {
34084
- console.log(JSON.stringify(status, null, 2));
34132
+ printJson(status);
34085
34133
  return;
34086
34134
  }
34087
34135
  const printStatus = (s) => {
34088
- console.log(formatLabel("Job ID", s.job_id));
34089
- console.log(formatLabel("Status", s.status));
34090
- console.log(formatLabel("Stage", s.stage));
34091
- console.log(formatLabel("Progress", formatProgress(s.progress)));
34092
- console.log(formatLabel("Persona", s.persona_slug));
34093
- console.log(formatLabel("LoRA", s.lora_name));
34094
- console.log(formatLabel("Images", String(s.image_count)));
34095
- console.log(formatLabel("Started", new Date(s.started_at).toLocaleString()));
34136
+ print(formatLabel("Job ID", s.job_id));
34137
+ print(formatLabel("Status", s.status));
34138
+ print(formatLabel("Stage", s.stage));
34139
+ print(formatLabel("Progress", formatProgress(s.progress)));
34140
+ print(formatLabel("Persona", s.persona_slug));
34141
+ print(formatLabel("LoRA", s.lora_name));
34142
+ print(formatLabel("Images", String(s.image_count)));
34143
+ print(formatLabel("Started", new Date(s.started_at).toLocaleString()));
34096
34144
  if (s.completed_at) {
34097
- console.log(formatLabel("Completed", new Date(s.completed_at).toLocaleString()));
34145
+ print(formatLabel("Completed", new Date(s.completed_at).toLocaleString()));
34098
34146
  }
34099
34147
  if (s.error) {
34100
- console.log(formatLabel("Error", source_default.red(s.error)));
34148
+ print(formatLabel("Error", source_default.red(s.error)));
34101
34149
  }
34102
34150
  };
34103
34151
  printStatus(status);
34104
34152
  if (!options.watch || status.status === "completed" || status.status === "failed") {
34105
34153
  return;
34106
34154
  }
34107
- console.log();
34155
+ print();
34108
34156
  const watchSpinner = ora("Watching training...").start();
34109
34157
  const watchStart = Date.now();
34110
34158
  while (true) {
@@ -34144,25 +34192,25 @@ var whoamiCommand = new Command("whoami").description("Show current user and org
34144
34192
  } catch {}
34145
34193
  }
34146
34194
  if (options.json) {
34147
- console.log(JSON.stringify({
34148
- user: info2.user,
34195
+ printJson({
34196
+ activeBrand: activeBrand ? { id: activeBrand.id, name: activeBrand.name } : null,
34149
34197
  organization: info2.organization,
34150
34198
  scopes: info2.scopes,
34151
- activeBrand: activeBrand ? { id: activeBrand.id, name: activeBrand.name } : null
34152
- }, null, 2));
34199
+ user: info2.user
34200
+ });
34153
34201
  return;
34154
34202
  }
34155
- console.log(formatSuccess(`Logged in as ${source_default.bold(info2.user.name)}`));
34156
- console.log();
34157
- console.log(formatLabel("Email", info2.user.email));
34158
- console.log(formatLabel("Organization", info2.organization.name));
34159
- console.log(formatLabel("Scopes", info2.scopes.join(", ")));
34203
+ print(formatSuccess(`Logged in as ${source_default.bold(info2.user.name)}`));
34204
+ print();
34205
+ print(formatLabel("Email", info2.user.email));
34206
+ print(formatLabel("Organization", info2.organization.name));
34207
+ print(formatLabel("Scopes", info2.scopes.join(", ")));
34160
34208
  if (activeBrand) {
34161
- console.log(formatLabel("Active Brand", activeBrand.name));
34209
+ print(formatLabel("Active Brand", activeBrand.name));
34162
34210
  } else if (activeBrandId) {
34163
- console.log(formatLabel("Active Brand", source_default.dim("(not found - run gf brands select)")));
34211
+ print(formatLabel("Active Brand", source_default.dim("(not found - run gf brands select)")));
34164
34212
  } else {
34165
- console.log(formatLabel("Active Brand", source_default.dim("(none - run gf brands select)")));
34213
+ print(formatLabel("Active Brand", source_default.dim("(none - run gf brands select)")));
34166
34214
  }
34167
34215
  } catch (error49) {
34168
34216
  handleError(error49);
@@ -34175,26 +34223,26 @@ var workflowCommand = new Command("workflow").description("Manage and execute wo
34175
34223
  await requireAuth();
34176
34224
  const spinner = ora("Fetching workflows...").start();
34177
34225
  try {
34178
- const response = await get("/v1/workflows");
34226
+ const response = await get("/workflows");
34179
34227
  spinner.stop();
34180
34228
  const workflows = response.data ?? [];
34181
34229
  if (workflows.length === 0) {
34182
- console.log(source_default.dim("No workflows found."));
34230
+ print(source_default.dim("No workflows found."));
34183
34231
  return;
34184
34232
  }
34185
34233
  if (options.json) {
34186
- console.log(JSON.stringify(workflows, null, 2));
34234
+ printJson(workflows);
34187
34235
  return;
34188
34236
  }
34189
- console.log(source_default.bold(`
34237
+ print(formatHeader(`
34190
34238
  Workflows:
34191
34239
  `));
34192
34240
  for (const wf of workflows) {
34193
- console.log(` ${source_default.cyan(wf.label ?? wf.name)} ${source_default.dim(`(${wf._id})`)}`);
34241
+ print(` ${source_default.cyan(wf.label ?? wf.name)} ${source_default.dim(`(${wf._id})`)}`);
34194
34242
  if (wf.description) {
34195
- console.log(` ${source_default.dim(wf.description)}`);
34243
+ print(` ${source_default.dim(wf.description)}`);
34196
34244
  }
34197
- console.log();
34245
+ print();
34198
34246
  }
34199
34247
  } catch (error49) {
34200
34248
  spinner.fail("Failed to fetch workflows");
@@ -34208,11 +34256,11 @@ Workflows:
34208
34256
  await requireAuth();
34209
34257
  const spinner = ora("Executing workflow...").start();
34210
34258
  try {
34211
- const response = await post("/v1/workflow-executions", {
34259
+ const response = await post("/workflow-executions", {
34212
34260
  workflowId: id
34213
34261
  });
34214
34262
  spinner.succeed("Workflow execution started");
34215
- console.log(source_default.dim(`Execution ID: ${response._id ?? response.id}`));
34263
+ print(source_default.dim(`Execution ID: ${response._id ?? response.id}`));
34216
34264
  } catch (error49) {
34217
34265
  spinner.fail("Failed to execute workflow");
34218
34266
  throw error49;
@@ -34231,52 +34279,52 @@ var BANNER = source_default.hex("#7C3AED").bold(`
34231
34279
  ██████ ██
34232
34280
  `);
34233
34281
  var program2 = new Command;
34234
- program2.name("gf").description("Unified CLI for Genfeed.ai").version("0.2.0").addCommand(loginCommand).addCommand(logoutCommand).addCommand(whoamiCommand).addCommand(brandsCommand).addCommand(generateCommand).addCommand(statusCommand).addCommand(chatCommand).addCommand(workflowCommand).addCommand(publishCommand).addCommand(libraryCommand).addCommand(profileCommand);
34282
+ program2.name("gf").description("Unified CLI for Genfeed.ai").version("0.3.0").addCommand(loginCommand).addCommand(logoutCommand).addCommand(whoamiCommand).addCommand(brandsCommand).addCommand(generateCommand).addCommand(statusCommand).addCommand(chatCommand).addCommand(workflowCommand).addCommand(publishCommand).addCommand(libraryCommand).addCommand(profileCommand);
34235
34283
  program2.addCommand(darkroomCommand).addCommand(trainCommand).addCommand(personasCommand).addCommand(captionCommand).addCommand(datasetCommand);
34236
34284
  program2.exitOverride();
34237
34285
  async function printBanner() {
34238
- console.log(BANNER);
34239
- console.log(source_default.dim(" Unified CLI for Genfeed.ai"));
34286
+ print(BANNER);
34287
+ print(source_default.dim(" Unified CLI for Genfeed.ai"));
34240
34288
  const role = await getRole();
34241
34289
  if (role === "admin") {
34242
- console.log(source_default.dim(" Mode: ") + source_default.green("admin"));
34290
+ print(source_default.dim(" Mode: ") + source_default.green("admin"));
34243
34291
  }
34244
- console.log();
34292
+ print();
34245
34293
  }
34246
34294
  async function printHelp() {
34247
34295
  const role = await getRole();
34248
- console.log(source_default.bold(`User Commands:
34296
+ print(formatHeader(`User Commands:
34249
34297
  `));
34250
- console.log(" login Authenticate with your Genfeed API key");
34251
- console.log(" logout Remove stored credentials");
34252
- console.log(" whoami Show current user and organization");
34253
- console.log(" brands Manage brands");
34254
- console.log(" generate Generate AI content (image, video)");
34255
- console.log(" status Check the status of a generation job");
34256
- console.log(" chat Start an interactive agent chat session");
34257
- console.log(" workflow Manage and execute workflows");
34258
- console.log(" publish Publish content to social media");
34259
- console.log(" library Browse content library");
34260
- console.log(" profile Manage CLI profiles");
34298
+ print(" login Authenticate with your Genfeed API key");
34299
+ print(" logout Remove stored credentials");
34300
+ print(" whoami Show current user and organization");
34301
+ print(" brands Manage brands");
34302
+ print(" generate Generate AI content (image, video)");
34303
+ print(" status Check the status of a generation job");
34304
+ print(" chat Start an interactive agent chat session");
34305
+ print(" workflow Manage and execute workflows");
34306
+ print(" publish Publish content to social media");
34307
+ print(" library Browse content library");
34308
+ print(" profile Manage CLI profiles");
34261
34309
  if (role === "admin") {
34262
- console.log();
34263
- console.log(source_default.bold(`Admin Commands:
34310
+ print();
34311
+ print(formatHeader(`Admin Commands:
34264
34312
  `));
34265
- console.log(" darkroom Darkroom infrastructure (health, comfy, loras)");
34266
- console.log(" train LoRA training (start, status)");
34267
- console.log(" personas List and manage personas");
34268
- console.log(" caption Run Florence-2 auto-captioning");
34269
- console.log(" dataset Manage training datasets");
34313
+ print(" darkroom Darkroom infrastructure (health, comfy, loras)");
34314
+ print(" train LoRA training (start, status)");
34315
+ print(" personas List and manage personas");
34316
+ print(" caption Run Florence-2 auto-captioning");
34317
+ print(" dataset Manage training datasets");
34270
34318
  }
34271
- console.log();
34272
- console.log(source_default.dim(" Run `gf <command> --help` for command details"));
34273
- console.log(source_default.dim(" Run `gf` with no args for interactive mode"));
34319
+ print();
34320
+ print(source_default.dim(" Run `gf <command> --help` for command details"));
34321
+ print(source_default.dim(" Run `gf` with no args for interactive mode"));
34274
34322
  }
34275
34323
  async function startRepl() {
34276
34324
  setReplMode(true);
34277
34325
  await printBanner();
34278
34326
  await printHelp();
34279
- console.log();
34327
+ print();
34280
34328
  const rl2 = createInterface2({
34281
34329
  input: process.stdin,
34282
34330
  output: process.stdout
@@ -34293,7 +34341,7 @@ async function startRepl() {
34293
34341
  if (!trimmed)
34294
34342
  continue;
34295
34343
  if (trimmed === "exit" || trimmed === "quit" || trimmed === "q") {
34296
- console.log(source_default.dim("Goodbye!"));
34344
+ print(source_default.dim("Goodbye!"));
34297
34345
  break;
34298
34346
  }
34299
34347
  if (trimmed === "help" || trimmed === "?") {
@@ -34311,14 +34359,14 @@ async function startRepl() {
34311
34359
  continue;
34312
34360
  }
34313
34361
  if (error49.message.includes("unknown command") || code === "commander.unknownCommand") {
34314
- console.log(source_default.red(`Unknown command: ${args[0]}`));
34315
- console.log(source_default.dim("Type `help` to see available commands"));
34362
+ print(formatError3(`Unknown command: ${args[0]}`));
34363
+ print(source_default.dim("Type `help` to see available commands"));
34316
34364
  } else {
34317
- console.error(source_default.red(`Error: ${error49.message}`));
34365
+ console.error(formatError3(error49.message));
34318
34366
  }
34319
34367
  }
34320
34368
  }
34321
- console.log();
34369
+ print();
34322
34370
  }
34323
34371
  rl2.close();
34324
34372
  process.exit(0);
@@ -34357,7 +34405,7 @@ function parseReplInput(input) {
34357
34405
  }
34358
34406
  if (process.argv.length <= 2) {
34359
34407
  startRepl().catch((error49) => {
34360
- console.error(source_default.red(`Fatal: ${error49 instanceof Error ? error49.message : String(error49)}`));
34408
+ console.error(formatError3(`Fatal: ${error49 instanceof Error ? error49.message : String(error49)}`));
34361
34409
  process.exit(1);
34362
34410
  });
34363
34411
  } else {
@@ -34368,7 +34416,7 @@ if (process.argv.length <= 2) {
34368
34416
  process.exit(0);
34369
34417
  }
34370
34418
  }
34371
- console.error(source_default.red(`Error: ${error49 instanceof Error ? error49.message : String(error49)}`));
34419
+ console.error(formatError3(error49 instanceof Error ? error49.message : String(error49)));
34372
34420
  process.exit(1);
34373
34421
  });
34374
34422
  }