@genfeedai/cli 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +415 -394
- 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
|
-
|
|
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() {
|
|
@@ -29537,8 +29537,8 @@ async function setActiveProfileName(name) {
|
|
|
29537
29537
|
async function listProfiles() {
|
|
29538
29538
|
const config2 = await loadConfig();
|
|
29539
29539
|
return Object.entries(config2.profiles).map(([name, profile]) => ({
|
|
29540
|
-
name,
|
|
29541
29540
|
active: name === config2.activeProfile,
|
|
29541
|
+
name,
|
|
29542
29542
|
profile
|
|
29543
29543
|
}));
|
|
29544
29544
|
}
|
|
@@ -29547,11 +29547,48 @@ function getConfigPath() {
|
|
|
29547
29547
|
}
|
|
29548
29548
|
|
|
29549
29549
|
// src/utils/errors.ts
|
|
29550
|
-
class
|
|
29550
|
+
class BaseCliError extends Error {
|
|
29551
29551
|
suggestion;
|
|
29552
29552
|
constructor(message, suggestion) {
|
|
29553
29553
|
super(message);
|
|
29554
|
+
this.name = "BaseCliError";
|
|
29554
29555
|
this.suggestion = suggestion;
|
|
29556
|
+
}
|
|
29557
|
+
}
|
|
29558
|
+
|
|
29559
|
+
class ApiError extends BaseCliError {
|
|
29560
|
+
statusCode;
|
|
29561
|
+
constructor(message, statusCode, suggestion) {
|
|
29562
|
+
super(message, suggestion);
|
|
29563
|
+
this.name = "ApiError";
|
|
29564
|
+
this.statusCode = statusCode;
|
|
29565
|
+
}
|
|
29566
|
+
}
|
|
29567
|
+
function formatError2(error49) {
|
|
29568
|
+
if (error49 instanceof BaseCliError) {
|
|
29569
|
+
let output = source_default.red(`✖ ${error49.message}`);
|
|
29570
|
+
if (error49.suggestion) {
|
|
29571
|
+
output += `
|
|
29572
|
+
${source_default.dim(error49.suggestion)}`;
|
|
29573
|
+
}
|
|
29574
|
+
return output;
|
|
29575
|
+
}
|
|
29576
|
+
if (error49 instanceof Error) {
|
|
29577
|
+
return source_default.red(`✖ ${error49.message}`);
|
|
29578
|
+
}
|
|
29579
|
+
return source_default.red("✖ An unknown error occurred");
|
|
29580
|
+
}
|
|
29581
|
+
function baseHandleError(error49, options) {
|
|
29582
|
+
console.error(formatError2(error49));
|
|
29583
|
+
if (options?.replMode) {
|
|
29584
|
+
throw error49;
|
|
29585
|
+
}
|
|
29586
|
+
process.exit(1);
|
|
29587
|
+
}
|
|
29588
|
+
|
|
29589
|
+
class GenfeedError extends BaseCliError {
|
|
29590
|
+
constructor(message, suggestion) {
|
|
29591
|
+
super(message, suggestion);
|
|
29555
29592
|
this.name = "GenfeedError";
|
|
29556
29593
|
}
|
|
29557
29594
|
}
|
|
@@ -29570,15 +29607,6 @@ class AdminRequiredError extends GenfeedError {
|
|
|
29570
29607
|
}
|
|
29571
29608
|
}
|
|
29572
29609
|
|
|
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
29610
|
class NoBrandError extends GenfeedError {
|
|
29583
29611
|
constructor() {
|
|
29584
29612
|
super("No brand selected", "Run `gf brands select` to choose a brand");
|
|
@@ -29592,30 +29620,12 @@ class DarkroomApiError extends GenfeedError {
|
|
|
29592
29620
|
this.name = "DarkroomApiError";
|
|
29593
29621
|
}
|
|
29594
29622
|
}
|
|
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
29623
|
var replMode = false;
|
|
29610
29624
|
function setReplMode(enabled) {
|
|
29611
29625
|
replMode = enabled;
|
|
29612
29626
|
}
|
|
29613
29627
|
function handleError(error49) {
|
|
29614
|
-
|
|
29615
|
-
if (replMode) {
|
|
29616
|
-
throw error49;
|
|
29617
|
-
}
|
|
29618
|
-
process.exit(1);
|
|
29628
|
+
baseHandleError(error49, { replMode });
|
|
29619
29629
|
}
|
|
29620
29630
|
|
|
29621
29631
|
// src/api/client.ts
|
|
@@ -29651,7 +29661,7 @@ async function get(path2) {
|
|
|
29651
29661
|
}
|
|
29652
29662
|
async function post(path2, body) {
|
|
29653
29663
|
const client = await createClient();
|
|
29654
|
-
return client(path2, { method: "POST"
|
|
29664
|
+
return client(path2, { body, method: "POST" });
|
|
29655
29665
|
}
|
|
29656
29666
|
async function requireAuth() {
|
|
29657
29667
|
const apiKey = await getApiKey();
|
|
@@ -29673,21 +29683,21 @@ async function getBrand(id) {
|
|
|
29673
29683
|
|
|
29674
29684
|
// src/ui/theme.ts
|
|
29675
29685
|
var colors = {
|
|
29676
|
-
|
|
29677
|
-
|
|
29686
|
+
bold: source_default.bold,
|
|
29687
|
+
dim: source_default.dim,
|
|
29678
29688
|
error: source_default.red,
|
|
29679
|
-
warning: source_default.yellow,
|
|
29680
29689
|
info: source_default.blue,
|
|
29681
|
-
|
|
29682
|
-
|
|
29690
|
+
primary: source_default.hex("#7C3AED"),
|
|
29691
|
+
success: source_default.green,
|
|
29692
|
+
warning: source_default.yellow
|
|
29683
29693
|
};
|
|
29684
29694
|
var symbols = {
|
|
29685
|
-
|
|
29695
|
+
arrow: source_default.dim("→"),
|
|
29696
|
+
bullet: source_default.dim("•"),
|
|
29686
29697
|
error: source_default.red("✖"),
|
|
29687
|
-
warning: source_default.yellow("⚠"),
|
|
29688
29698
|
info: source_default.blue("ℹ"),
|
|
29689
|
-
|
|
29690
|
-
|
|
29699
|
+
success: source_default.green("✓"),
|
|
29700
|
+
warning: source_default.yellow("⚠")
|
|
29691
29701
|
};
|
|
29692
29702
|
function formatSuccess(message) {
|
|
29693
29703
|
return `${symbols.success} ${message}`;
|
|
@@ -29701,6 +29711,17 @@ function formatWarning(message) {
|
|
|
29701
29711
|
function formatLabel(label, value) {
|
|
29702
29712
|
return ` ${colors.dim(`${label}:`)} ${value}`;
|
|
29703
29713
|
}
|
|
29714
|
+
function formatHeader(text) {
|
|
29715
|
+
return colors.bold(text);
|
|
29716
|
+
}
|
|
29717
|
+
function print(message = "") {
|
|
29718
|
+
process.stdout.write(`${message}
|
|
29719
|
+
`);
|
|
29720
|
+
}
|
|
29721
|
+
function printJson(data) {
|
|
29722
|
+
process.stdout.write(`${JSON.stringify(data, null, 2)}
|
|
29723
|
+
`);
|
|
29724
|
+
}
|
|
29704
29725
|
|
|
29705
29726
|
// src/commands/brands.ts
|
|
29706
29727
|
var brandsCommand = new Command("brands").description("Manage brands").option("--json", "Output as JSON").action(async (options) => {
|
|
@@ -29711,36 +29732,36 @@ var brandsCommand = new Command("brands").description("Manage brands").option("-
|
|
|
29711
29732
|
spinner.stop();
|
|
29712
29733
|
const activeBrandId = await getActiveBrand();
|
|
29713
29734
|
if (options.json) {
|
|
29714
|
-
|
|
29735
|
+
printJson({
|
|
29736
|
+
activeBrandId,
|
|
29715
29737
|
brands: brands.map((b) => ({
|
|
29716
|
-
|
|
29717
|
-
name: b.name,
|
|
29738
|
+
active: b.id === activeBrandId,
|
|
29718
29739
|
description: b.description,
|
|
29719
|
-
|
|
29720
|
-
|
|
29721
|
-
|
|
29722
|
-
}
|
|
29740
|
+
id: b.id,
|
|
29741
|
+
name: b.name
|
|
29742
|
+
}))
|
|
29743
|
+
});
|
|
29723
29744
|
return;
|
|
29724
29745
|
}
|
|
29725
29746
|
if (brands.length === 0) {
|
|
29726
|
-
|
|
29727
|
-
|
|
29747
|
+
print(formatWarning("No brands found."));
|
|
29748
|
+
print(source_default.dim("Create one at https://app.genfeed.ai"));
|
|
29728
29749
|
return;
|
|
29729
29750
|
}
|
|
29730
|
-
|
|
29751
|
+
print(formatHeader(`Your brands:
|
|
29731
29752
|
`));
|
|
29732
29753
|
for (const brand of brands) {
|
|
29733
29754
|
const isActive = brand.id === activeBrandId;
|
|
29734
29755
|
const marker = isActive ? source_default.green("●") : source_default.dim("○");
|
|
29735
29756
|
const name = isActive ? source_default.bold(brand.name) : brand.name;
|
|
29736
29757
|
const activeLabel = isActive ? source_default.dim(" (active)") : "";
|
|
29737
|
-
|
|
29758
|
+
print(` ${marker} ${name}${activeLabel}`);
|
|
29738
29759
|
if (brand.description) {
|
|
29739
|
-
|
|
29760
|
+
print(` ${source_default.dim(brand.description)}`);
|
|
29740
29761
|
}
|
|
29741
29762
|
}
|
|
29742
|
-
|
|
29743
|
-
|
|
29763
|
+
print();
|
|
29764
|
+
print(source_default.dim("Run `gf brands select` to change the active brand"));
|
|
29744
29765
|
} catch (error49) {
|
|
29745
29766
|
handleError(error49);
|
|
29746
29767
|
}
|
|
@@ -29756,18 +29777,18 @@ brandsCommand.command("select").description("Select the active brand").action(as
|
|
|
29756
29777
|
}
|
|
29757
29778
|
const activeBrandId = await getActiveBrand();
|
|
29758
29779
|
const selected = await dist_default5({
|
|
29759
|
-
message: "Select a brand:",
|
|
29760
29780
|
choices: brands.map((brand) => ({
|
|
29781
|
+
description: brand.description,
|
|
29761
29782
|
name: brand.id === activeBrandId ? `${brand.name} (current)` : brand.name,
|
|
29762
|
-
value: brand.id
|
|
29763
|
-
description: brand.description
|
|
29783
|
+
value: brand.id
|
|
29764
29784
|
})),
|
|
29765
|
-
default: activeBrandId
|
|
29785
|
+
default: activeBrandId,
|
|
29786
|
+
message: "Select a brand:"
|
|
29766
29787
|
});
|
|
29767
29788
|
await setActiveBrand(selected);
|
|
29768
29789
|
const selectedBrand = brands.find((b) => b.id === selected);
|
|
29769
|
-
|
|
29770
|
-
|
|
29790
|
+
print();
|
|
29791
|
+
print(formatSuccess(`Active brand: ${source_default.bold(selectedBrand?.name)}`));
|
|
29771
29792
|
} catch (error49) {
|
|
29772
29793
|
handleError(error49);
|
|
29773
29794
|
}
|
|
@@ -29778,29 +29799,29 @@ brandsCommand.command("current").description("Show the current active brand").op
|
|
|
29778
29799
|
const activeBrandId = await getActiveBrand();
|
|
29779
29800
|
if (!activeBrandId) {
|
|
29780
29801
|
if (options.json) {
|
|
29781
|
-
|
|
29802
|
+
printJson({ activeBrand: null });
|
|
29782
29803
|
return;
|
|
29783
29804
|
}
|
|
29784
|
-
|
|
29785
|
-
|
|
29805
|
+
print(formatWarning("No active brand selected"));
|
|
29806
|
+
print(source_default.dim("Run `gf brands select` to choose a brand"));
|
|
29786
29807
|
return;
|
|
29787
29808
|
}
|
|
29788
29809
|
const spinner = ora("Fetching brand...").start();
|
|
29789
29810
|
const brand = await getBrand(activeBrandId);
|
|
29790
29811
|
spinner.stop();
|
|
29791
29812
|
if (options.json) {
|
|
29792
|
-
|
|
29813
|
+
printJson({
|
|
29793
29814
|
activeBrand: {
|
|
29815
|
+
description: brand.description,
|
|
29794
29816
|
id: brand.id,
|
|
29795
|
-
name: brand.name
|
|
29796
|
-
description: brand.description
|
|
29817
|
+
name: brand.name
|
|
29797
29818
|
}
|
|
29798
|
-
}
|
|
29819
|
+
});
|
|
29799
29820
|
return;
|
|
29800
29821
|
}
|
|
29801
|
-
|
|
29822
|
+
print(formatSuccess(`Active brand: ${source_default.bold(brand.name)}`));
|
|
29802
29823
|
if (brand.description) {
|
|
29803
|
-
|
|
29824
|
+
print(formatLabel("Description", brand.description));
|
|
29804
29825
|
}
|
|
29805
29826
|
} catch (error49) {
|
|
29806
29827
|
handleError(error49);
|
|
@@ -29817,9 +29838,9 @@ async function darkroomRequest(method, path2, body) {
|
|
|
29817
29838
|
const url2 = `${baseUrl}${path2}`;
|
|
29818
29839
|
try {
|
|
29819
29840
|
const response = await fetch(url2, {
|
|
29820
|
-
|
|
29841
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
29821
29842
|
headers: body ? { "Content-Type": "application/json" } : undefined,
|
|
29822
|
-
|
|
29843
|
+
method
|
|
29823
29844
|
});
|
|
29824
29845
|
if (!response.ok) {
|
|
29825
29846
|
const text = await response.text();
|
|
@@ -29870,7 +29891,7 @@ async function uploadDataset(persona, filePaths) {
|
|
|
29870
29891
|
formData.append("files", blob, basename(filePath));
|
|
29871
29892
|
}
|
|
29872
29893
|
try {
|
|
29873
|
-
const response = await fetch(url2, { method: "POST"
|
|
29894
|
+
const response = await fetch(url2, { body: formData, method: "POST" });
|
|
29874
29895
|
if (!response.ok) {
|
|
29875
29896
|
const text = await response.text();
|
|
29876
29897
|
throw new DarkroomApiError(`Darkroom API POST /datasets/${persona}/upload failed: ${response.status} ${text}`);
|
|
@@ -29925,8 +29946,8 @@ async function startFaceTest(handle, personaConfig) {
|
|
|
29925
29946
|
async function startBootstrap(handle, promptCount, personaConfig) {
|
|
29926
29947
|
return darkroomRequest("POST", "/generate/bootstrap", {
|
|
29927
29948
|
handle,
|
|
29928
|
-
|
|
29929
|
-
|
|
29949
|
+
persona_config: personaConfig,
|
|
29950
|
+
prompt_count: promptCount ?? 50
|
|
29930
29951
|
});
|
|
29931
29952
|
}
|
|
29932
29953
|
async function startPulid(handle, mode = "scenes", personaConfig) {
|
|
@@ -29968,11 +29989,11 @@ var captionCommand = new Command("caption").description("Run Florence-2 auto-cap
|
|
|
29968
29989
|
});
|
|
29969
29990
|
spinner.succeed("Captioning complete");
|
|
29970
29991
|
if (options.json) {
|
|
29971
|
-
|
|
29992
|
+
printJson(result);
|
|
29972
29993
|
return;
|
|
29973
29994
|
}
|
|
29974
29995
|
if (result.output) {
|
|
29975
|
-
|
|
29996
|
+
print(source_default.dim(result.output));
|
|
29976
29997
|
}
|
|
29977
29998
|
} catch (error49) {
|
|
29978
29999
|
handleError(error49);
|
|
@@ -29998,7 +30019,7 @@ var chatCommand = new Command("chat").description("Start an interactive agent ch
|
|
|
29998
30019
|
throw error49;
|
|
29999
30020
|
}
|
|
30000
30021
|
}
|
|
30001
|
-
|
|
30022
|
+
print(source_default.dim(`Type your message (Ctrl+C to exit)
|
|
30002
30023
|
`));
|
|
30003
30024
|
while (true) {
|
|
30004
30025
|
const message = await dist_default3({
|
|
@@ -30013,11 +30034,11 @@ var chatCommand = new Command("chat").description("Start an interactive agent ch
|
|
|
30013
30034
|
const messages = response.messages ?? [];
|
|
30014
30035
|
const lastMessage = messages[messages.length - 1];
|
|
30015
30036
|
if (lastMessage && lastMessage.role === "assistant") {
|
|
30016
|
-
|
|
30017
|
-
Assistant:`)
|
|
30037
|
+
print(`${source_default.green(`
|
|
30038
|
+
Assistant:`)} ${lastMessage.content}
|
|
30018
30039
|
`);
|
|
30019
30040
|
} else {
|
|
30020
|
-
|
|
30041
|
+
print(source_default.dim(`
|
|
30021
30042
|
Message sent.
|
|
30022
30043
|
`));
|
|
30023
30044
|
}
|
|
@@ -30055,27 +30076,27 @@ var darkroomCommand = new Command("darkroom").description("Darkroom infrastructu
|
|
|
30055
30076
|
const health = await getDarkroomHealth();
|
|
30056
30077
|
spinner.stop();
|
|
30057
30078
|
if (options.json) {
|
|
30058
|
-
|
|
30079
|
+
printJson(health);
|
|
30059
30080
|
return;
|
|
30060
30081
|
}
|
|
30061
30082
|
const gpu = health.gpu;
|
|
30062
30083
|
const vramUsedGb = (gpu.memory_used / 1024).toFixed(1);
|
|
30063
30084
|
const vramTotalGb = (gpu.memory_total / 1024).toFixed(1);
|
|
30064
30085
|
const vramPercent = (gpu.memory_used / gpu.memory_total * 100).toFixed(0);
|
|
30065
|
-
|
|
30086
|
+
print(formatHeader(`Darkroom Status
|
|
30066
30087
|
`));
|
|
30067
|
-
|
|
30068
|
-
|
|
30069
|
-
|
|
30070
|
-
|
|
30071
|
-
|
|
30072
|
-
|
|
30088
|
+
print(formatLabel("GPU", gpu.name));
|
|
30089
|
+
print(formatLabel("VRAM", `${vramUsedGb}/${vramTotalGb} GB (${vramPercent}%)`));
|
|
30090
|
+
print(formatLabel("Utilization", `${gpu.utilization}%`));
|
|
30091
|
+
print(formatLabel("Temperature", `${gpu.temperature}°C`));
|
|
30092
|
+
print();
|
|
30093
|
+
print(formatHeader(`Disk
|
|
30073
30094
|
`));
|
|
30074
30095
|
const root = health.disk.root;
|
|
30075
|
-
|
|
30096
|
+
print(formatLabel("Root", `${root.used}/${root.total} (${root.percent})`));
|
|
30076
30097
|
if (health.disk.comfyui) {
|
|
30077
30098
|
const comfy = health.disk.comfyui;
|
|
30078
|
-
|
|
30099
|
+
print(formatLabel("ComfyUI", `${comfy.used}/${comfy.total} (${comfy.percent})`));
|
|
30079
30100
|
}
|
|
30080
30101
|
} catch (error49) {
|
|
30081
30102
|
handleError(error49);
|
|
@@ -30084,26 +30105,26 @@ var darkroomCommand = new Command("darkroom").description("Darkroom infrastructu
|
|
|
30084
30105
|
try {
|
|
30085
30106
|
const validActions = ["start", "stop", "restart", "status"];
|
|
30086
30107
|
if (!validActions.includes(action)) {
|
|
30087
|
-
console.error(
|
|
30108
|
+
console.error(formatError3(`Invalid action: ${action}. Use: ${validActions.join(", ")}`));
|
|
30088
30109
|
process.exit(1);
|
|
30089
30110
|
}
|
|
30090
30111
|
const spinner = ora(`${action === "status" ? "Checking" : `${action.charAt(0).toUpperCase()}${action.slice(1)}ing`} ComfyUI...`).start();
|
|
30091
30112
|
const result = await comfyAction(action);
|
|
30092
30113
|
spinner.stop();
|
|
30093
30114
|
if (options.json) {
|
|
30094
|
-
|
|
30115
|
+
printJson(result);
|
|
30095
30116
|
return;
|
|
30096
30117
|
}
|
|
30097
30118
|
if (result.returncode === 0) {
|
|
30098
|
-
|
|
30119
|
+
print(formatSuccess(`ComfyUI ${action}: success`));
|
|
30099
30120
|
} else {
|
|
30100
|
-
|
|
30121
|
+
print(formatError3(`ComfyUI ${action}: failed (exit code ${result.returncode})`));
|
|
30101
30122
|
}
|
|
30102
30123
|
if (result.stdout) {
|
|
30103
|
-
|
|
30124
|
+
print(source_default.dim(result.stdout));
|
|
30104
30125
|
}
|
|
30105
30126
|
if (result.stderr) {
|
|
30106
|
-
|
|
30127
|
+
print(formatWarning(result.stderr));
|
|
30107
30128
|
}
|
|
30108
30129
|
} catch (error49) {
|
|
30109
30130
|
handleError(error49);
|
|
@@ -30114,19 +30135,19 @@ var darkroomCommand = new Command("darkroom").description("Darkroom infrastructu
|
|
|
30114
30135
|
const result = await listLoras();
|
|
30115
30136
|
spinner.stop();
|
|
30116
30137
|
if (options.json) {
|
|
30117
|
-
|
|
30138
|
+
printJson(result);
|
|
30118
30139
|
return;
|
|
30119
30140
|
}
|
|
30120
30141
|
if (result.loras.length === 0) {
|
|
30121
|
-
|
|
30142
|
+
print(formatWarning("No LoRA models found."));
|
|
30122
30143
|
return;
|
|
30123
30144
|
}
|
|
30124
|
-
|
|
30145
|
+
print(formatHeader(`LoRA Models (${result.loras.length})
|
|
30125
30146
|
`));
|
|
30126
30147
|
for (const lora of result.loras) {
|
|
30127
30148
|
const date5 = new Date(lora.modified).toLocaleDateString();
|
|
30128
|
-
|
|
30129
|
-
|
|
30149
|
+
print(` ${source_default.bold(lora.name)}`);
|
|
30150
|
+
print(` ${source_default.dim(`${lora.size_mb.toFixed(1)} MB | ${date5}`)}`);
|
|
30130
30151
|
}
|
|
30131
30152
|
} catch (error49) {
|
|
30132
30153
|
handleError(error49);
|
|
@@ -30137,22 +30158,22 @@ var darkroomCommand = new Command("darkroom").description("Darkroom infrastructu
|
|
|
30137
30158
|
const result = await listPersonas();
|
|
30138
30159
|
spinner.stop();
|
|
30139
30160
|
if (options.json) {
|
|
30140
|
-
|
|
30161
|
+
printJson(result);
|
|
30141
30162
|
return;
|
|
30142
30163
|
}
|
|
30143
30164
|
if (result.personas.length === 0) {
|
|
30144
|
-
|
|
30165
|
+
print(formatWarning("No persona configs found."));
|
|
30145
30166
|
return;
|
|
30146
30167
|
}
|
|
30147
|
-
|
|
30168
|
+
print(formatHeader(`Personas (${result.personas.length})
|
|
30148
30169
|
`));
|
|
30149
30170
|
for (const p2 of result.personas) {
|
|
30150
30171
|
if (p2.error) {
|
|
30151
|
-
|
|
30172
|
+
print(` ${source_default.red(p2.handle)} ${source_default.dim(`(${p2.error})`)}`);
|
|
30152
30173
|
} else {
|
|
30153
30174
|
const pulid = p2.has_pulid ? source_default.green("pulid") : source_default.dim("no pulid");
|
|
30154
|
-
|
|
30155
|
-
|
|
30175
|
+
print(` ${source_default.bold(p2.handle)}`);
|
|
30176
|
+
print(` ${source_default.dim(`LoRA: ${p2.lora_file} | ${pulid}`)}`);
|
|
30156
30177
|
}
|
|
30157
30178
|
}
|
|
30158
30179
|
} catch (error49) {
|
|
@@ -30167,14 +30188,14 @@ function buildGenerateCommand() {
|
|
|
30167
30188
|
const result = await startFaceTest(handle);
|
|
30168
30189
|
spinner.succeed("Face test started");
|
|
30169
30190
|
if (options.json && !options.wait) {
|
|
30170
|
-
|
|
30191
|
+
printJson(result);
|
|
30171
30192
|
return;
|
|
30172
30193
|
}
|
|
30173
|
-
|
|
30174
|
-
|
|
30194
|
+
print(formatLabel("Job ID", result.job_id));
|
|
30195
|
+
print(formatLabel("Images", String(result.images_total)));
|
|
30175
30196
|
if (!options.wait) {
|
|
30176
|
-
|
|
30177
|
-
|
|
30197
|
+
print();
|
|
30198
|
+
print(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
|
|
30178
30199
|
return;
|
|
30179
30200
|
}
|
|
30180
30201
|
await pollGenerateJob(result.job_id, options.json);
|
|
@@ -30189,14 +30210,14 @@ function buildGenerateCommand() {
|
|
|
30189
30210
|
const result = await startBootstrap(handle, count);
|
|
30190
30211
|
spinner.succeed("Bootstrap started");
|
|
30191
30212
|
if (options.json && !options.wait) {
|
|
30192
|
-
|
|
30213
|
+
printJson(result);
|
|
30193
30214
|
return;
|
|
30194
30215
|
}
|
|
30195
|
-
|
|
30196
|
-
|
|
30216
|
+
print(formatLabel("Job ID", result.job_id));
|
|
30217
|
+
print(formatLabel("Images", String(result.images_total)));
|
|
30197
30218
|
if (!options.wait) {
|
|
30198
|
-
|
|
30199
|
-
|
|
30219
|
+
print();
|
|
30220
|
+
print(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
|
|
30200
30221
|
return;
|
|
30201
30222
|
}
|
|
30202
30223
|
await pollGenerateJob(result.job_id, options.json);
|
|
@@ -30211,14 +30232,14 @@ function buildGenerateCommand() {
|
|
|
30211
30232
|
const result = await startPulid(handle, mode);
|
|
30212
30233
|
spinner.succeed("PuLID generation started");
|
|
30213
30234
|
if (options.json && !options.wait) {
|
|
30214
|
-
|
|
30235
|
+
printJson(result);
|
|
30215
30236
|
return;
|
|
30216
30237
|
}
|
|
30217
|
-
|
|
30218
|
-
|
|
30238
|
+
print(formatLabel("Job ID", result.job_id));
|
|
30239
|
+
print(formatLabel("Images", String(result.images_total)));
|
|
30219
30240
|
if (!options.wait) {
|
|
30220
|
-
|
|
30221
|
-
|
|
30241
|
+
print();
|
|
30242
|
+
print(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
|
|
30222
30243
|
return;
|
|
30223
30244
|
}
|
|
30224
30245
|
await pollGenerateJob(result.job_id, options.json);
|
|
@@ -30232,14 +30253,14 @@ function buildGenerateCommand() {
|
|
|
30232
30253
|
const result = await startContentGenerate(handle);
|
|
30233
30254
|
spinner.succeed("Content generation started");
|
|
30234
30255
|
if (options.json && !options.wait) {
|
|
30235
|
-
|
|
30256
|
+
printJson(result);
|
|
30236
30257
|
return;
|
|
30237
30258
|
}
|
|
30238
|
-
|
|
30239
|
-
|
|
30259
|
+
print(formatLabel("Job ID", result.job_id));
|
|
30260
|
+
print(formatLabel("Images", String(result.images_total)));
|
|
30240
30261
|
if (!options.wait) {
|
|
30241
|
-
|
|
30242
|
-
|
|
30262
|
+
print();
|
|
30263
|
+
print(source_default.dim(`Check progress: gf darkroom generate status ${result.job_id}`));
|
|
30243
30264
|
return;
|
|
30244
30265
|
}
|
|
30245
30266
|
await pollGenerateJob(result.job_id, options.json);
|
|
@@ -30253,21 +30274,21 @@ function buildGenerateCommand() {
|
|
|
30253
30274
|
const status = await getGenerateStatus(jobId);
|
|
30254
30275
|
spinner.stop();
|
|
30255
30276
|
if (options.json && !options.watch) {
|
|
30256
|
-
|
|
30277
|
+
printJson(status);
|
|
30257
30278
|
return;
|
|
30258
30279
|
}
|
|
30259
|
-
|
|
30260
|
-
|
|
30261
|
-
|
|
30262
|
-
|
|
30263
|
-
|
|
30264
|
-
|
|
30265
|
-
|
|
30280
|
+
print(formatLabel("Job ID", status.job_id));
|
|
30281
|
+
print(formatLabel("Type", status.job_type));
|
|
30282
|
+
print(formatLabel("Status", status.status));
|
|
30283
|
+
print(formatLabel("Persona", status.persona));
|
|
30284
|
+
print(formatLabel("Images", `${status.images_completed}/${status.images_total}`));
|
|
30285
|
+
print(formatLabel("Progress", formatProgress(status.progress)));
|
|
30286
|
+
print(formatLabel("Started", new Date(status.started_at).toLocaleString()));
|
|
30266
30287
|
if (status.completed_at) {
|
|
30267
|
-
|
|
30288
|
+
print(formatLabel("Completed", new Date(status.completed_at).toLocaleString()));
|
|
30268
30289
|
}
|
|
30269
30290
|
if (status.error) {
|
|
30270
|
-
|
|
30291
|
+
print(formatLabel("Error", source_default.red(status.error)));
|
|
30271
30292
|
}
|
|
30272
30293
|
if (!options.watch || status.status === "completed" || status.status === "failed") {
|
|
30273
30294
|
return;
|
|
@@ -30280,7 +30301,7 @@ function buildGenerateCommand() {
|
|
|
30280
30301
|
return generate;
|
|
30281
30302
|
}
|
|
30282
30303
|
async function pollGenerateJob(jobId, json2) {
|
|
30283
|
-
|
|
30304
|
+
print();
|
|
30284
30305
|
const pollSpinner = ora("Generating...").start();
|
|
30285
30306
|
const pollStart = Date.now();
|
|
30286
30307
|
while (true) {
|
|
@@ -30294,15 +30315,15 @@ async function pollGenerateJob(jobId, json2) {
|
|
|
30294
30315
|
if (status.status === "completed") {
|
|
30295
30316
|
pollSpinner.succeed(`Generation complete: ${status.images_completed}/${status.images_total} images`);
|
|
30296
30317
|
if (json2) {
|
|
30297
|
-
|
|
30318
|
+
printJson(status);
|
|
30298
30319
|
} else if (status.filenames.length > 0) {
|
|
30299
|
-
|
|
30320
|
+
print(source_default.dim(`
|
|
30300
30321
|
Generated files:`));
|
|
30301
30322
|
for (const f2 of status.filenames.slice(0, 20)) {
|
|
30302
|
-
|
|
30323
|
+
print(source_default.dim(` ${f2}`));
|
|
30303
30324
|
}
|
|
30304
30325
|
if (status.filenames.length > 20) {
|
|
30305
|
-
|
|
30326
|
+
print(source_default.dim(` ... and ${status.filenames.length - 20} more`));
|
|
30306
30327
|
}
|
|
30307
30328
|
}
|
|
30308
30329
|
break;
|
|
@@ -30322,22 +30343,22 @@ datasetCommand.command("info").description("Show dataset info for a persona").ar
|
|
|
30322
30343
|
const dataset = await getDataset(handle);
|
|
30323
30344
|
spinner.stop();
|
|
30324
30345
|
if (options.json) {
|
|
30325
|
-
|
|
30346
|
+
printJson(dataset);
|
|
30326
30347
|
return;
|
|
30327
30348
|
}
|
|
30328
|
-
|
|
30349
|
+
print(formatHeader(`Dataset: ${handle}
|
|
30329
30350
|
`));
|
|
30330
|
-
|
|
30331
|
-
|
|
30332
|
-
|
|
30351
|
+
print(formatLabel("Path", dataset.path));
|
|
30352
|
+
print(formatLabel("Images", String(dataset.image_count)));
|
|
30353
|
+
print(formatLabel("Captions", String(dataset.caption_count)));
|
|
30333
30354
|
if (dataset.images.length > 0) {
|
|
30334
|
-
|
|
30335
|
-
|
|
30355
|
+
print();
|
|
30356
|
+
print(source_default.dim("Files:"));
|
|
30336
30357
|
for (const img of dataset.images.slice(0, 20)) {
|
|
30337
|
-
|
|
30358
|
+
print(source_default.dim(` ${img}`));
|
|
30338
30359
|
}
|
|
30339
30360
|
if (dataset.images.length > 20) {
|
|
30340
|
-
|
|
30361
|
+
print(source_default.dim(` ... and ${dataset.images.length - 20} more`));
|
|
30341
30362
|
}
|
|
30342
30363
|
}
|
|
30343
30364
|
} catch (error49) {
|
|
@@ -30357,7 +30378,7 @@ datasetCommand.command("upload").description("Upload training images to darkroom
|
|
|
30357
30378
|
return imageExts.has(ext) || ext === ".txt";
|
|
30358
30379
|
}).map((f2) => join(resolvedPath, f2)).filter((f2) => statSync(f2).isFile());
|
|
30359
30380
|
if (filePaths.length === 0) {
|
|
30360
|
-
|
|
30381
|
+
print(formatError3(`No image or caption files found in ${resolvedPath}`));
|
|
30361
30382
|
return;
|
|
30362
30383
|
}
|
|
30363
30384
|
const spinner = ora(`Uploading ${filePaths.length} files for ${handle}...`).start();
|
|
@@ -33212,7 +33233,7 @@ async function waitForCompletion(options) {
|
|
|
33212
33233
|
}
|
|
33213
33234
|
try {
|
|
33214
33235
|
const result = await getResult();
|
|
33215
|
-
resolve({
|
|
33236
|
+
resolve({ elapsed, result });
|
|
33216
33237
|
} catch (err) {
|
|
33217
33238
|
reject(err);
|
|
33218
33239
|
}
|
|
@@ -33228,10 +33249,10 @@ async function waitForCompletion(options) {
|
|
|
33228
33249
|
auth: {
|
|
33229
33250
|
token: apiKey
|
|
33230
33251
|
},
|
|
33231
|
-
transports: ["websocket"],
|
|
33232
33252
|
reconnection: true,
|
|
33233
33253
|
reconnectionAttempts: 5,
|
|
33234
|
-
reconnectionDelay: 1000
|
|
33254
|
+
reconnectionDelay: 1000,
|
|
33255
|
+
transports: ["websocket"]
|
|
33235
33256
|
});
|
|
33236
33257
|
socket.on("connect", () => {
|
|
33237
33258
|
if (spinner) {
|
|
@@ -33292,50 +33313,50 @@ var imageCommand = new Command("image").description("Generate an AI image").argu
|
|
|
33292
33313
|
const model = options.model ?? profile.defaults.imageModel;
|
|
33293
33314
|
const spinner = ora("Creating image...").start();
|
|
33294
33315
|
const image = await createImage({
|
|
33295
|
-
text: prompt,
|
|
33296
33316
|
brand: brandId,
|
|
33317
|
+
height: options.height,
|
|
33297
33318
|
model,
|
|
33298
|
-
|
|
33299
|
-
|
|
33319
|
+
text: prompt,
|
|
33320
|
+
width: options.width
|
|
33300
33321
|
});
|
|
33301
33322
|
if (!options.wait) {
|
|
33302
33323
|
spinner.succeed("Image generation started");
|
|
33303
33324
|
if (options.json) {
|
|
33304
|
-
|
|
33325
|
+
printJson({ id: image.id, status: image.status });
|
|
33305
33326
|
} else {
|
|
33306
|
-
|
|
33307
|
-
|
|
33308
|
-
|
|
33309
|
-
|
|
33327
|
+
print(formatLabel("ID", image.id));
|
|
33328
|
+
print(formatLabel("Status", image.status));
|
|
33329
|
+
print();
|
|
33330
|
+
print(source_default.dim(`Check status with: gf status ${image.id}`));
|
|
33310
33331
|
}
|
|
33311
33332
|
return;
|
|
33312
33333
|
}
|
|
33313
33334
|
spinner.text = "Generating image...";
|
|
33314
33335
|
const { result, elapsed } = await waitForCompletion({
|
|
33315
|
-
taskId: image.id,
|
|
33316
|
-
taskType: "IMAGE",
|
|
33317
33336
|
getResult: () => getImage(image.id),
|
|
33318
33337
|
spinner,
|
|
33338
|
+
taskId: image.id,
|
|
33339
|
+
taskType: "IMAGE",
|
|
33319
33340
|
timeout: 300000
|
|
33320
33341
|
});
|
|
33321
33342
|
const elapsedSec = (elapsed / 1000).toFixed(1);
|
|
33322
33343
|
spinner.succeed(`Image generated (${elapsedSec}s)`);
|
|
33323
33344
|
if (options.json) {
|
|
33324
|
-
|
|
33345
|
+
printJson({
|
|
33346
|
+
elapsed,
|
|
33347
|
+
height: result.height,
|
|
33325
33348
|
id: result.id,
|
|
33349
|
+
model: result.model,
|
|
33326
33350
|
status: result.status,
|
|
33327
33351
|
url: result.url,
|
|
33328
|
-
width: result.width
|
|
33329
|
-
|
|
33330
|
-
model: result.model,
|
|
33331
|
-
elapsed
|
|
33332
|
-
}, null, 2));
|
|
33352
|
+
width: result.width
|
|
33353
|
+
});
|
|
33333
33354
|
} else {
|
|
33334
|
-
|
|
33355
|
+
print(formatLabel("URL", result.url ?? "N/A"));
|
|
33335
33356
|
if (result.width && result.height) {
|
|
33336
|
-
|
|
33357
|
+
print(formatLabel("Dimensions", `${result.width} × ${result.height}`));
|
|
33337
33358
|
}
|
|
33338
|
-
|
|
33359
|
+
print(formatLabel("Model", result.model));
|
|
33339
33360
|
}
|
|
33340
33361
|
if (options.output && result.url) {
|
|
33341
33362
|
const downloadSpinner = ora("Downloading image...").start();
|
|
@@ -33383,53 +33404,53 @@ var videoCommand = new Command("video").description("Generate an AI video").argu
|
|
|
33383
33404
|
const model = options.model ?? profile.defaults.videoModel;
|
|
33384
33405
|
const spinner = ora("Creating video...").start();
|
|
33385
33406
|
const video = await createVideo({
|
|
33386
|
-
text: prompt,
|
|
33387
33407
|
brand: brandId,
|
|
33388
|
-
model,
|
|
33389
33408
|
duration: options.duration,
|
|
33390
|
-
|
|
33409
|
+
model,
|
|
33410
|
+
resolution: options.resolution,
|
|
33411
|
+
text: prompt
|
|
33391
33412
|
});
|
|
33392
33413
|
if (!options.wait) {
|
|
33393
33414
|
spinner.succeed("Video generation started");
|
|
33394
33415
|
if (options.json) {
|
|
33395
|
-
|
|
33416
|
+
printJson({ id: video.id, status: video.status });
|
|
33396
33417
|
} else {
|
|
33397
|
-
|
|
33398
|
-
|
|
33399
|
-
|
|
33400
|
-
|
|
33418
|
+
print(formatLabel("ID", video.id));
|
|
33419
|
+
print(formatLabel("Status", video.status));
|
|
33420
|
+
print();
|
|
33421
|
+
print(source_default.dim(`Check status with: gf status ${video.id}`));
|
|
33401
33422
|
}
|
|
33402
33423
|
return;
|
|
33403
33424
|
}
|
|
33404
33425
|
spinner.text = "Generating video...";
|
|
33405
33426
|
const { result, elapsed } = await waitForCompletion({
|
|
33406
|
-
taskId: video.id,
|
|
33407
|
-
taskType: "VIDEO",
|
|
33408
33427
|
getResult: () => getVideo(video.id),
|
|
33409
33428
|
spinner,
|
|
33429
|
+
taskId: video.id,
|
|
33430
|
+
taskType: "VIDEO",
|
|
33410
33431
|
timeout: 600000
|
|
33411
33432
|
});
|
|
33412
33433
|
const elapsedSec = (elapsed / 1000).toFixed(1);
|
|
33413
33434
|
spinner.succeed(`Video generated (${elapsedSec}s)`);
|
|
33414
33435
|
if (options.json) {
|
|
33415
|
-
|
|
33416
|
-
id: result.id,
|
|
33417
|
-
status: result.status,
|
|
33418
|
-
url: result.url,
|
|
33436
|
+
printJson({
|
|
33419
33437
|
duration: result.duration,
|
|
33420
|
-
|
|
33438
|
+
elapsed,
|
|
33439
|
+
id: result.id,
|
|
33421
33440
|
model: result.model,
|
|
33422
|
-
|
|
33423
|
-
|
|
33441
|
+
resolution: result.resolution,
|
|
33442
|
+
status: result.status,
|
|
33443
|
+
url: result.url
|
|
33444
|
+
});
|
|
33424
33445
|
} else {
|
|
33425
|
-
|
|
33446
|
+
print(formatLabel("URL", result.url ?? "N/A"));
|
|
33426
33447
|
if (result.duration) {
|
|
33427
|
-
|
|
33448
|
+
print(formatLabel("Duration", `${result.duration}s`));
|
|
33428
33449
|
}
|
|
33429
33450
|
if (result.resolution) {
|
|
33430
|
-
|
|
33451
|
+
print(formatLabel("Resolution", result.resolution));
|
|
33431
33452
|
}
|
|
33432
|
-
|
|
33453
|
+
print(formatLabel("Model", result.model));
|
|
33433
33454
|
}
|
|
33434
33455
|
if (options.output && result.url) {
|
|
33435
33456
|
const downloadSpinner = ora("Downloading video...").start();
|
|
@@ -33468,25 +33489,25 @@ var libraryCommand = new Command("library").description("Browse content library"
|
|
|
33468
33489
|
spinner.stop();
|
|
33469
33490
|
const items = response.data ?? [];
|
|
33470
33491
|
if (items.length === 0) {
|
|
33471
|
-
|
|
33492
|
+
print(source_default.dim("No items found."));
|
|
33472
33493
|
return;
|
|
33473
33494
|
}
|
|
33474
33495
|
if (options.json) {
|
|
33475
|
-
|
|
33496
|
+
printJson(items);
|
|
33476
33497
|
return;
|
|
33477
33498
|
}
|
|
33478
|
-
|
|
33499
|
+
print(formatHeader(`
|
|
33479
33500
|
Library (${items.length} items):
|
|
33480
33501
|
`));
|
|
33481
33502
|
for (const item of items) {
|
|
33482
33503
|
const category = source_default.blue(`[${item.category}]`);
|
|
33483
33504
|
const status = item.status === "generated" ? source_default.green(item.status) : source_default.dim(item.status);
|
|
33484
33505
|
const id = source_default.dim(`(${item._id})`);
|
|
33485
|
-
|
|
33506
|
+
print(` ${category} ${status} ${id}`);
|
|
33486
33507
|
if (item.prompt?.text) {
|
|
33487
|
-
|
|
33508
|
+
print(` ${source_default.dim(item.prompt.text.slice(0, 80))}...`);
|
|
33488
33509
|
}
|
|
33489
|
-
|
|
33510
|
+
print();
|
|
33490
33511
|
}
|
|
33491
33512
|
} catch (error49) {
|
|
33492
33513
|
spinner.fail("Failed to fetch library");
|
|
@@ -33510,7 +33531,7 @@ async function validateApiKey() {
|
|
|
33510
33531
|
}
|
|
33511
33532
|
|
|
33512
33533
|
// src/commands/login.ts
|
|
33513
|
-
var AUTH_URL = "https://app.genfeed.ai/cli
|
|
33534
|
+
var AUTH_URL = "https://app.genfeed.ai/oauth/cli";
|
|
33514
33535
|
var CALLBACK_TIMEOUT = 120000;
|
|
33515
33536
|
function waitForOAuthCallback() {
|
|
33516
33537
|
return new Promise((resolve, reject) => {
|
|
@@ -33553,10 +33574,10 @@ function waitForOAuthCallback() {
|
|
|
33553
33574
|
if (addr && typeof addr === "object") {
|
|
33554
33575
|
const port = addr.port;
|
|
33555
33576
|
const authUrl = `${AUTH_URL}?port=${port}`;
|
|
33556
|
-
|
|
33557
|
-
|
|
33558
|
-
|
|
33559
|
-
|
|
33577
|
+
print();
|
|
33578
|
+
print(formatHeader("Opening browser to authenticate..."));
|
|
33579
|
+
print(source_default.dim(authUrl));
|
|
33580
|
+
print();
|
|
33560
33581
|
openBrowser(authUrl);
|
|
33561
33582
|
}
|
|
33562
33583
|
});
|
|
@@ -33606,34 +33627,34 @@ async function completeLogin(apiKey) {
|
|
|
33606
33627
|
try {
|
|
33607
33628
|
const whoamiData = await validateApiKey();
|
|
33608
33629
|
spinner.succeed();
|
|
33609
|
-
|
|
33610
|
-
|
|
33611
|
-
|
|
33612
|
-
|
|
33630
|
+
print();
|
|
33631
|
+
print(formatSuccess(`Logged in as ${source_default.bold(whoamiData.organization.name)}`));
|
|
33632
|
+
print(formatLabel("Email", whoamiData.user.email));
|
|
33633
|
+
print(formatLabel("Scopes", whoamiData.scopes.join(", ")));
|
|
33613
33634
|
if (whoamiData.scopes.includes("admin") || whoamiData.scopes.includes("superadmin")) {
|
|
33614
33635
|
await setRole("admin");
|
|
33615
|
-
|
|
33636
|
+
print(formatLabel("Role", source_default.green("admin")));
|
|
33616
33637
|
}
|
|
33617
|
-
|
|
33638
|
+
print();
|
|
33618
33639
|
const brands = await listBrands();
|
|
33619
33640
|
if (brands.length === 0) {
|
|
33620
|
-
|
|
33641
|
+
print(formatWarning("No brands found. Create one at https://app.genfeed.ai"));
|
|
33621
33642
|
} else if (brands.length === 1) {
|
|
33622
33643
|
await setActiveBrand(brands[0].id);
|
|
33623
|
-
|
|
33644
|
+
print(formatSuccess(`Active brand: ${source_default.bold(brands[0].name)}`));
|
|
33624
33645
|
} else {
|
|
33625
33646
|
const selected = await dist_default5({
|
|
33626
|
-
message: "Select a brand:",
|
|
33627
33647
|
choices: brands.map((brand) => ({
|
|
33648
|
+
description: brand.description,
|
|
33628
33649
|
name: brand.name,
|
|
33629
|
-
value: brand.id
|
|
33630
|
-
|
|
33631
|
-
|
|
33650
|
+
value: brand.id
|
|
33651
|
+
})),
|
|
33652
|
+
message: "Select a brand:"
|
|
33632
33653
|
});
|
|
33633
33654
|
await setActiveBrand(selected);
|
|
33634
33655
|
const selectedBrand = brands.find((b) => b.id === selected);
|
|
33635
|
-
|
|
33636
|
-
|
|
33656
|
+
print();
|
|
33657
|
+
print(formatSuccess(`Active brand: ${source_default.bold(selectedBrand?.name)}`));
|
|
33637
33658
|
}
|
|
33638
33659
|
} catch (error49) {
|
|
33639
33660
|
spinner.fail("Invalid API key");
|
|
@@ -33651,11 +33672,11 @@ var loginCommand = new Command("login").description("Authenticate with Genfeed (
|
|
|
33651
33672
|
return;
|
|
33652
33673
|
}
|
|
33653
33674
|
if (options.interactive) {
|
|
33654
|
-
|
|
33675
|
+
print(source_default.dim(`Get your API key at: https://app.genfeed.ai/settings/api-keys
|
|
33655
33676
|
`));
|
|
33656
33677
|
const apiKey = await dist_default4({
|
|
33657
|
-
message: "Enter your Genfeed API key:",
|
|
33658
33678
|
mask: "*",
|
|
33679
|
+
message: "Enter your Genfeed API key:",
|
|
33659
33680
|
validate: (value2) => {
|
|
33660
33681
|
if (!value2)
|
|
33661
33682
|
return "API key is required";
|
|
@@ -33689,12 +33710,12 @@ var logoutCommand = new Command("logout").description("Remove stored credentials
|
|
|
33689
33710
|
try {
|
|
33690
33711
|
const hasKey = await getApiKey();
|
|
33691
33712
|
if (!hasKey) {
|
|
33692
|
-
|
|
33713
|
+
print(formatWarning("You are not logged in"));
|
|
33693
33714
|
return;
|
|
33694
33715
|
}
|
|
33695
33716
|
await clearApiKey();
|
|
33696
33717
|
await clearActiveBrand();
|
|
33697
|
-
|
|
33718
|
+
print(formatSuccess("Logged out successfully"));
|
|
33698
33719
|
} catch (error49) {
|
|
33699
33720
|
handleError(error49);
|
|
33700
33721
|
}
|
|
@@ -33708,23 +33729,23 @@ var personasCommand = new Command("personas").description("List and manage perso
|
|
|
33708
33729
|
spinner.stop();
|
|
33709
33730
|
const personas = response.data;
|
|
33710
33731
|
if (options.json) {
|
|
33711
|
-
|
|
33732
|
+
printJson(response);
|
|
33712
33733
|
return;
|
|
33713
33734
|
}
|
|
33714
33735
|
if (personas.length === 0) {
|
|
33715
|
-
|
|
33736
|
+
print(formatWarning("No personas found."));
|
|
33716
33737
|
return;
|
|
33717
33738
|
}
|
|
33718
|
-
|
|
33739
|
+
print(formatHeader(`Personas (${personas.length})
|
|
33719
33740
|
`));
|
|
33720
33741
|
for (const persona of personas) {
|
|
33721
33742
|
const status = persona.status === "active" ? source_default.green("●") : source_default.dim("○");
|
|
33722
|
-
|
|
33743
|
+
print(` ${status} ${source_default.bold(persona.handle)} ${source_default.dim(`(${persona.name})`)}`);
|
|
33723
33744
|
if (persona.description) {
|
|
33724
|
-
|
|
33745
|
+
print(` ${source_default.dim(persona.description.slice(0, 80))}`);
|
|
33725
33746
|
}
|
|
33726
33747
|
if (persona.triggerWord) {
|
|
33727
|
-
|
|
33748
|
+
print(` ${source_default.dim(`trigger: ${persona.triggerWord}`)}`);
|
|
33728
33749
|
}
|
|
33729
33750
|
}
|
|
33730
33751
|
} catch (error49) {
|
|
@@ -33738,25 +33759,25 @@ personasCommand.command("show").description("Show persona details").argument("<h
|
|
|
33738
33759
|
spinner.stop();
|
|
33739
33760
|
const persona = response.data;
|
|
33740
33761
|
if (options.json) {
|
|
33741
|
-
|
|
33762
|
+
printJson(persona);
|
|
33742
33763
|
return;
|
|
33743
33764
|
}
|
|
33744
|
-
|
|
33765
|
+
print(formatHeader(`${persona.name} (@${persona.handle})
|
|
33745
33766
|
`));
|
|
33746
|
-
|
|
33767
|
+
print(formatLabel("ID", persona.id));
|
|
33747
33768
|
if (persona.description) {
|
|
33748
|
-
|
|
33769
|
+
print(formatLabel("Description", persona.description));
|
|
33749
33770
|
}
|
|
33750
33771
|
if (persona.triggerWord) {
|
|
33751
|
-
|
|
33772
|
+
print(formatLabel("Trigger Word", persona.triggerWord));
|
|
33752
33773
|
}
|
|
33753
33774
|
if (persona.platform) {
|
|
33754
|
-
|
|
33775
|
+
print(formatLabel("Platform", persona.platform));
|
|
33755
33776
|
}
|
|
33756
33777
|
if (persona.status) {
|
|
33757
|
-
|
|
33778
|
+
print(formatLabel("Status", persona.status));
|
|
33758
33779
|
}
|
|
33759
|
-
|
|
33780
|
+
print(formatLabel("Created", new Date(persona.createdAt).toLocaleDateString()));
|
|
33760
33781
|
} catch (error49) {
|
|
33761
33782
|
handleError(error49);
|
|
33762
33783
|
}
|
|
@@ -33768,23 +33789,23 @@ profileCommand.command("list").description("List all profiles").option("--json",
|
|
|
33768
33789
|
try {
|
|
33769
33790
|
const profiles = await listProfiles();
|
|
33770
33791
|
if (options.json) {
|
|
33771
|
-
|
|
33792
|
+
printJson(profiles);
|
|
33772
33793
|
return;
|
|
33773
33794
|
}
|
|
33774
|
-
|
|
33795
|
+
print(formatHeader(`Profiles
|
|
33775
33796
|
`));
|
|
33776
33797
|
for (const { name, active, profile } of profiles) {
|
|
33777
33798
|
const marker = active ? source_default.green("●") : source_default.dim("○");
|
|
33778
33799
|
const label = active ? source_default.bold(name) : name;
|
|
33779
33800
|
const activeLabel = active ? source_default.dim(" (active)") : "";
|
|
33780
33801
|
const apiUrl = source_default.dim(profile.apiUrl);
|
|
33781
|
-
|
|
33802
|
+
print(` ${marker} ${label}${activeLabel} ${apiUrl}`);
|
|
33782
33803
|
if (profile.darkroomHost !== "100.106.229.81") {
|
|
33783
|
-
|
|
33804
|
+
print(` ${source_default.dim(`darkroom: ${profile.darkroomHost}`)}`);
|
|
33784
33805
|
}
|
|
33785
33806
|
}
|
|
33786
|
-
|
|
33787
|
-
|
|
33807
|
+
print();
|
|
33808
|
+
print(source_default.dim(`Config: ${getConfigPath()}`));
|
|
33788
33809
|
} catch (error49) {
|
|
33789
33810
|
handleError(error49);
|
|
33790
33811
|
}
|
|
@@ -33792,7 +33813,7 @@ profileCommand.command("list").description("List all profiles").option("--json",
|
|
|
33792
33813
|
profileCommand.command("use").description("Set the active profile").argument("<name>", "Profile name").action(async (name) => {
|
|
33793
33814
|
try {
|
|
33794
33815
|
await setActiveProfileName(name);
|
|
33795
|
-
|
|
33816
|
+
print(formatSuccess(`Active profile: ${source_default.bold(name)}`));
|
|
33796
33817
|
} catch (error49) {
|
|
33797
33818
|
handleError(error49);
|
|
33798
33819
|
}
|
|
@@ -33800,13 +33821,13 @@ profileCommand.command("use").description("Set the active profile").argument("<n
|
|
|
33800
33821
|
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
33822
|
try {
|
|
33802
33823
|
await createProfile(name, {
|
|
33803
|
-
apiUrl: options.apiUrl,
|
|
33804
33824
|
apiKey: options.apiKey,
|
|
33825
|
+
apiUrl: options.apiUrl,
|
|
33805
33826
|
darkroomHost: options.darkroomHost,
|
|
33806
33827
|
role: options.role
|
|
33807
33828
|
});
|
|
33808
|
-
|
|
33809
|
-
|
|
33829
|
+
print(formatSuccess(`Profile "${name}" created`));
|
|
33830
|
+
print(source_default.dim(`Switch to it with: gf profile use ${name}`));
|
|
33810
33831
|
} catch (error49) {
|
|
33811
33832
|
handleError(error49);
|
|
33812
33833
|
}
|
|
@@ -33814,32 +33835,32 @@ profileCommand.command("create").description("Create a new profile").argument("<
|
|
|
33814
33835
|
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
33836
|
try {
|
|
33816
33837
|
const fieldMap = {
|
|
33817
|
-
"
|
|
33838
|
+
"active-brand": "activeBrand",
|
|
33839
|
+
"active-persona": "activePersona",
|
|
33818
33840
|
"api-key": "apiKey",
|
|
33841
|
+
"api-url": "apiUrl",
|
|
33819
33842
|
"darkroom-host": "darkroomHost",
|
|
33820
33843
|
"darkroom-port": "darkroomApiPort",
|
|
33821
|
-
role: "role"
|
|
33822
|
-
"active-persona": "activePersona",
|
|
33823
|
-
"active-brand": "activeBrand"
|
|
33844
|
+
role: "role"
|
|
33824
33845
|
};
|
|
33825
33846
|
const mappedField = fieldMap[field];
|
|
33826
33847
|
if (!mappedField) {
|
|
33827
|
-
console.error(
|
|
33828
|
-
|
|
33848
|
+
console.error(formatError3(`Unknown field: ${field}`));
|
|
33849
|
+
print(source_default.dim(`Valid fields: ${Object.keys(fieldMap).join(", ")}`));
|
|
33829
33850
|
process.exit(1);
|
|
33830
33851
|
}
|
|
33831
33852
|
let finalValue = value2;
|
|
33832
33853
|
if (mappedField === "darkroomApiPort") {
|
|
33833
33854
|
finalValue = Number.parseInt(value2, 10);
|
|
33834
33855
|
if (Number.isNaN(finalValue)) {
|
|
33835
|
-
console.error(
|
|
33856
|
+
console.error(formatError3(`Invalid port number: ${value2}`));
|
|
33836
33857
|
process.exit(1);
|
|
33837
33858
|
}
|
|
33838
33859
|
}
|
|
33839
33860
|
await setProfileField(mappedField, finalValue, options.profile);
|
|
33840
|
-
|
|
33861
|
+
print(formatSuccess(`Set ${field} = ${value2}`));
|
|
33841
33862
|
if (options.profile) {
|
|
33842
|
-
|
|
33863
|
+
print(formatLabel("Profile", options.profile));
|
|
33843
33864
|
}
|
|
33844
33865
|
} catch (error49) {
|
|
33845
33866
|
handleError(error49);
|
|
@@ -33865,7 +33886,7 @@ var publishCommand = new Command("publish").description("Publish content to soci
|
|
|
33865
33886
|
});
|
|
33866
33887
|
}
|
|
33867
33888
|
if (platforms.length === 0) {
|
|
33868
|
-
|
|
33889
|
+
print(formatWarning("No platforms selected."));
|
|
33869
33890
|
return;
|
|
33870
33891
|
}
|
|
33871
33892
|
let caption = options.caption ?? "";
|
|
@@ -33882,7 +33903,7 @@ var publishCommand = new Command("publish").description("Publish content to soci
|
|
|
33882
33903
|
platforms
|
|
33883
33904
|
});
|
|
33884
33905
|
spinner.stop();
|
|
33885
|
-
|
|
33906
|
+
print(formatSuccess(`Published to ${platforms.join(", ")}`));
|
|
33886
33907
|
} catch (error49) {
|
|
33887
33908
|
spinner.fail("Failed to publish");
|
|
33888
33909
|
throw error49;
|
|
@@ -33914,29 +33935,29 @@ var statusCommand = new Command("status").description("Check the status of a gen
|
|
|
33914
33935
|
if (options.type === "video") {
|
|
33915
33936
|
const video = await getVideo(id);
|
|
33916
33937
|
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
33938
|
completedAt: video.completedAt,
|
|
33939
|
+
createdAt: video.createdAt,
|
|
33925
33940
|
duration: video.duration,
|
|
33926
|
-
|
|
33941
|
+
error: video.error,
|
|
33942
|
+
id: video.id,
|
|
33943
|
+
model: video.model,
|
|
33944
|
+
resolution: video.resolution,
|
|
33945
|
+
status: video.status,
|
|
33946
|
+
type: "video",
|
|
33947
|
+
url: video.url
|
|
33927
33948
|
};
|
|
33928
33949
|
} else {
|
|
33929
33950
|
const image = await getImage(id);
|
|
33930
33951
|
result = {
|
|
33931
|
-
|
|
33932
|
-
|
|
33933
|
-
|
|
33934
|
-
url: image.url,
|
|
33952
|
+
completedAt: image.completedAt,
|
|
33953
|
+
createdAt: image.createdAt,
|
|
33954
|
+
dimensions: image.width && image.height ? { height: image.height, width: image.width } : undefined,
|
|
33935
33955
|
error: image.error,
|
|
33956
|
+
id: image.id,
|
|
33936
33957
|
model: image.model,
|
|
33937
|
-
|
|
33938
|
-
|
|
33939
|
-
|
|
33958
|
+
status: image.status,
|
|
33959
|
+
type: "image",
|
|
33960
|
+
url: image.url
|
|
33940
33961
|
};
|
|
33941
33962
|
}
|
|
33942
33963
|
} catch (err) {
|
|
@@ -33944,16 +33965,16 @@ var statusCommand = new Command("status").description("Check the status of a gen
|
|
|
33944
33965
|
try {
|
|
33945
33966
|
const video = await getVideo(id);
|
|
33946
33967
|
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
33968
|
completedAt: video.completedAt,
|
|
33969
|
+
createdAt: video.createdAt,
|
|
33955
33970
|
duration: video.duration,
|
|
33956
|
-
|
|
33971
|
+
error: video.error,
|
|
33972
|
+
id: video.id,
|
|
33973
|
+
model: video.model,
|
|
33974
|
+
resolution: video.resolution,
|
|
33975
|
+
status: video.status,
|
|
33976
|
+
type: "video",
|
|
33977
|
+
url: video.url
|
|
33957
33978
|
};
|
|
33958
33979
|
} catch {
|
|
33959
33980
|
throw err;
|
|
@@ -33964,36 +33985,36 @@ var statusCommand = new Command("status").description("Check the status of a gen
|
|
|
33964
33985
|
}
|
|
33965
33986
|
spinner.stop();
|
|
33966
33987
|
if (options.json) {
|
|
33967
|
-
|
|
33988
|
+
printJson(result);
|
|
33968
33989
|
return;
|
|
33969
33990
|
}
|
|
33970
|
-
|
|
33971
|
-
|
|
33972
|
-
|
|
33973
|
-
|
|
33991
|
+
print(formatLabel("ID", result.id));
|
|
33992
|
+
print(formatLabel("Type", result.type));
|
|
33993
|
+
print(formatLabel("Status", formatStatus(result.status)));
|
|
33994
|
+
print(formatLabel("Model", result.model));
|
|
33974
33995
|
if (result.status === "completed" && result.url) {
|
|
33975
|
-
|
|
33996
|
+
print(formatLabel("URL", result.url));
|
|
33976
33997
|
if (result.dimensions) {
|
|
33977
|
-
|
|
33998
|
+
print(formatLabel("Dimensions", `${result.dimensions.width} × ${result.dimensions.height}`));
|
|
33978
33999
|
}
|
|
33979
34000
|
if (result.duration) {
|
|
33980
|
-
|
|
34001
|
+
print(formatLabel("Duration", `${result.duration}s`));
|
|
33981
34002
|
}
|
|
33982
34003
|
if (result.resolution) {
|
|
33983
|
-
|
|
34004
|
+
print(formatLabel("Resolution", result.resolution));
|
|
33984
34005
|
}
|
|
33985
34006
|
if (result.completedAt) {
|
|
33986
34007
|
const completedDate = new Date(result.completedAt);
|
|
33987
|
-
|
|
34008
|
+
print(formatLabel("Completed", completedDate.toLocaleString()));
|
|
33988
34009
|
}
|
|
33989
34010
|
}
|
|
33990
34011
|
if (result.status === "failed" && result.error) {
|
|
33991
|
-
|
|
33992
|
-
|
|
34012
|
+
print();
|
|
34013
|
+
print(formatError3(`Error: ${result.error}`));
|
|
33993
34014
|
}
|
|
33994
34015
|
if (result.status === "pending" || result.status === "processing") {
|
|
33995
|
-
|
|
33996
|
-
|
|
34016
|
+
print();
|
|
34017
|
+
print(source_default.dim("Generation is still in progress. Check again later."));
|
|
33997
34018
|
}
|
|
33998
34019
|
} catch (error49) {
|
|
33999
34020
|
handleError(error49);
|
|
@@ -34007,11 +34028,11 @@ var trainCommand = new Command("train").description("LoRA training management [a
|
|
|
34007
34028
|
const dataset = await getDataset(handle);
|
|
34008
34029
|
datasetSpinner.stop();
|
|
34009
34030
|
if (dataset.image_count === 0) {
|
|
34010
|
-
|
|
34011
|
-
|
|
34031
|
+
print(formatError3(`No training images found for "${handle}".`));
|
|
34032
|
+
print(source_default.dim(`Upload images with: gf dataset upload ${handle} <path>`));
|
|
34012
34033
|
return;
|
|
34013
34034
|
}
|
|
34014
|
-
|
|
34035
|
+
print(formatLabel("Dataset", `${dataset.image_count} images, ${dataset.caption_count} captions`));
|
|
34015
34036
|
const triggerWord = options.trigger ?? handle;
|
|
34016
34037
|
const loraName = `${handle}_zimage`;
|
|
34017
34038
|
let steps = options.steps;
|
|
@@ -34027,31 +34048,31 @@ var trainCommand = new Command("train").description("LoRA training management [a
|
|
|
34027
34048
|
}
|
|
34028
34049
|
const spinner = ora("Starting training...").start();
|
|
34029
34050
|
const result = await startTraining({
|
|
34030
|
-
|
|
34031
|
-
trigger_word: triggerWord,
|
|
34051
|
+
learning_rate: options.lr ?? 0.0004,
|
|
34032
34052
|
lora_name: loraName,
|
|
34033
|
-
steps,
|
|
34034
34053
|
lora_rank: options.rank ?? 16,
|
|
34035
|
-
|
|
34054
|
+
persona_slug: handle,
|
|
34055
|
+
steps,
|
|
34056
|
+
trigger_word: triggerWord
|
|
34036
34057
|
});
|
|
34037
34058
|
spinner.succeed("Training started");
|
|
34038
34059
|
if (options.json) {
|
|
34039
|
-
|
|
34060
|
+
printJson(result);
|
|
34040
34061
|
if (!options.wait)
|
|
34041
34062
|
return;
|
|
34042
34063
|
} else {
|
|
34043
|
-
|
|
34044
|
-
|
|
34045
|
-
|
|
34046
|
-
|
|
34047
|
-
|
|
34064
|
+
print(formatLabel("Job ID", result.job_id));
|
|
34065
|
+
print(formatLabel("Images", String(result.image_count)));
|
|
34066
|
+
print(formatLabel("Steps", String(steps)));
|
|
34067
|
+
print(formatLabel("Trigger", triggerWord));
|
|
34068
|
+
print(formatLabel("LoRA Name", loraName));
|
|
34048
34069
|
}
|
|
34049
34070
|
if (!options.wait) {
|
|
34050
|
-
|
|
34051
|
-
|
|
34071
|
+
print();
|
|
34072
|
+
print(source_default.dim(`Check progress with: gf train status ${result.job_id}`));
|
|
34052
34073
|
return;
|
|
34053
34074
|
}
|
|
34054
|
-
|
|
34075
|
+
print();
|
|
34055
34076
|
const pollSpinner = ora("Training in progress...").start();
|
|
34056
34077
|
const pollStart = Date.now();
|
|
34057
34078
|
while (true) {
|
|
@@ -34081,30 +34102,30 @@ trainCommand.command("status").description("Check training job status").argument
|
|
|
34081
34102
|
let status = await getTrainingStatus(jobId);
|
|
34082
34103
|
spinner.stop();
|
|
34083
34104
|
if (options.json && !options.watch) {
|
|
34084
|
-
|
|
34105
|
+
printJson(status);
|
|
34085
34106
|
return;
|
|
34086
34107
|
}
|
|
34087
34108
|
const printStatus = (s) => {
|
|
34088
|
-
|
|
34089
|
-
|
|
34090
|
-
|
|
34091
|
-
|
|
34092
|
-
|
|
34093
|
-
|
|
34094
|
-
|
|
34095
|
-
|
|
34109
|
+
print(formatLabel("Job ID", s.job_id));
|
|
34110
|
+
print(formatLabel("Status", s.status));
|
|
34111
|
+
print(formatLabel("Stage", s.stage));
|
|
34112
|
+
print(formatLabel("Progress", formatProgress(s.progress)));
|
|
34113
|
+
print(formatLabel("Persona", s.persona_slug));
|
|
34114
|
+
print(formatLabel("LoRA", s.lora_name));
|
|
34115
|
+
print(formatLabel("Images", String(s.image_count)));
|
|
34116
|
+
print(formatLabel("Started", new Date(s.started_at).toLocaleString()));
|
|
34096
34117
|
if (s.completed_at) {
|
|
34097
|
-
|
|
34118
|
+
print(formatLabel("Completed", new Date(s.completed_at).toLocaleString()));
|
|
34098
34119
|
}
|
|
34099
34120
|
if (s.error) {
|
|
34100
|
-
|
|
34121
|
+
print(formatLabel("Error", source_default.red(s.error)));
|
|
34101
34122
|
}
|
|
34102
34123
|
};
|
|
34103
34124
|
printStatus(status);
|
|
34104
34125
|
if (!options.watch || status.status === "completed" || status.status === "failed") {
|
|
34105
34126
|
return;
|
|
34106
34127
|
}
|
|
34107
|
-
|
|
34128
|
+
print();
|
|
34108
34129
|
const watchSpinner = ora("Watching training...").start();
|
|
34109
34130
|
const watchStart = Date.now();
|
|
34110
34131
|
while (true) {
|
|
@@ -34144,25 +34165,25 @@ var whoamiCommand = new Command("whoami").description("Show current user and org
|
|
|
34144
34165
|
} catch {}
|
|
34145
34166
|
}
|
|
34146
34167
|
if (options.json) {
|
|
34147
|
-
|
|
34148
|
-
|
|
34168
|
+
printJson({
|
|
34169
|
+
activeBrand: activeBrand ? { id: activeBrand.id, name: activeBrand.name } : null,
|
|
34149
34170
|
organization: info2.organization,
|
|
34150
34171
|
scopes: info2.scopes,
|
|
34151
|
-
|
|
34152
|
-
}
|
|
34172
|
+
user: info2.user
|
|
34173
|
+
});
|
|
34153
34174
|
return;
|
|
34154
34175
|
}
|
|
34155
|
-
|
|
34156
|
-
|
|
34157
|
-
|
|
34158
|
-
|
|
34159
|
-
|
|
34176
|
+
print(formatSuccess(`Logged in as ${source_default.bold(info2.user.name)}`));
|
|
34177
|
+
print();
|
|
34178
|
+
print(formatLabel("Email", info2.user.email));
|
|
34179
|
+
print(formatLabel("Organization", info2.organization.name));
|
|
34180
|
+
print(formatLabel("Scopes", info2.scopes.join(", ")));
|
|
34160
34181
|
if (activeBrand) {
|
|
34161
|
-
|
|
34182
|
+
print(formatLabel("Active Brand", activeBrand.name));
|
|
34162
34183
|
} else if (activeBrandId) {
|
|
34163
|
-
|
|
34184
|
+
print(formatLabel("Active Brand", source_default.dim("(not found - run gf brands select)")));
|
|
34164
34185
|
} else {
|
|
34165
|
-
|
|
34186
|
+
print(formatLabel("Active Brand", source_default.dim("(none - run gf brands select)")));
|
|
34166
34187
|
}
|
|
34167
34188
|
} catch (error49) {
|
|
34168
34189
|
handleError(error49);
|
|
@@ -34179,22 +34200,22 @@ var workflowCommand = new Command("workflow").description("Manage and execute wo
|
|
|
34179
34200
|
spinner.stop();
|
|
34180
34201
|
const workflows = response.data ?? [];
|
|
34181
34202
|
if (workflows.length === 0) {
|
|
34182
|
-
|
|
34203
|
+
print(source_default.dim("No workflows found."));
|
|
34183
34204
|
return;
|
|
34184
34205
|
}
|
|
34185
34206
|
if (options.json) {
|
|
34186
|
-
|
|
34207
|
+
printJson(workflows);
|
|
34187
34208
|
return;
|
|
34188
34209
|
}
|
|
34189
|
-
|
|
34210
|
+
print(formatHeader(`
|
|
34190
34211
|
Workflows:
|
|
34191
34212
|
`));
|
|
34192
34213
|
for (const wf of workflows) {
|
|
34193
|
-
|
|
34214
|
+
print(` ${source_default.cyan(wf.label ?? wf.name)} ${source_default.dim(`(${wf._id})`)}`);
|
|
34194
34215
|
if (wf.description) {
|
|
34195
|
-
|
|
34216
|
+
print(` ${source_default.dim(wf.description)}`);
|
|
34196
34217
|
}
|
|
34197
|
-
|
|
34218
|
+
print();
|
|
34198
34219
|
}
|
|
34199
34220
|
} catch (error49) {
|
|
34200
34221
|
spinner.fail("Failed to fetch workflows");
|
|
@@ -34212,7 +34233,7 @@ Workflows:
|
|
|
34212
34233
|
workflowId: id
|
|
34213
34234
|
});
|
|
34214
34235
|
spinner.succeed("Workflow execution started");
|
|
34215
|
-
|
|
34236
|
+
print(source_default.dim(`Execution ID: ${response._id ?? response.id}`));
|
|
34216
34237
|
} catch (error49) {
|
|
34217
34238
|
spinner.fail("Failed to execute workflow");
|
|
34218
34239
|
throw error49;
|
|
@@ -34235,48 +34256,48 @@ program2.name("gf").description("Unified CLI for Genfeed.ai").version("0.2.0").a
|
|
|
34235
34256
|
program2.addCommand(darkroomCommand).addCommand(trainCommand).addCommand(personasCommand).addCommand(captionCommand).addCommand(datasetCommand);
|
|
34236
34257
|
program2.exitOverride();
|
|
34237
34258
|
async function printBanner() {
|
|
34238
|
-
|
|
34239
|
-
|
|
34259
|
+
print(BANNER);
|
|
34260
|
+
print(source_default.dim(" Unified CLI for Genfeed.ai"));
|
|
34240
34261
|
const role = await getRole();
|
|
34241
34262
|
if (role === "admin") {
|
|
34242
|
-
|
|
34263
|
+
print(source_default.dim(" Mode: ") + source_default.green("admin"));
|
|
34243
34264
|
}
|
|
34244
|
-
|
|
34265
|
+
print();
|
|
34245
34266
|
}
|
|
34246
34267
|
async function printHelp() {
|
|
34247
34268
|
const role = await getRole();
|
|
34248
|
-
|
|
34269
|
+
print(formatHeader(`User Commands:
|
|
34249
34270
|
`));
|
|
34250
|
-
|
|
34251
|
-
|
|
34252
|
-
|
|
34253
|
-
|
|
34254
|
-
|
|
34255
|
-
|
|
34256
|
-
|
|
34257
|
-
|
|
34258
|
-
|
|
34259
|
-
|
|
34260
|
-
|
|
34271
|
+
print(" login Authenticate with your Genfeed API key");
|
|
34272
|
+
print(" logout Remove stored credentials");
|
|
34273
|
+
print(" whoami Show current user and organization");
|
|
34274
|
+
print(" brands Manage brands");
|
|
34275
|
+
print(" generate Generate AI content (image, video)");
|
|
34276
|
+
print(" status Check the status of a generation job");
|
|
34277
|
+
print(" chat Start an interactive agent chat session");
|
|
34278
|
+
print(" workflow Manage and execute workflows");
|
|
34279
|
+
print(" publish Publish content to social media");
|
|
34280
|
+
print(" library Browse content library");
|
|
34281
|
+
print(" profile Manage CLI profiles");
|
|
34261
34282
|
if (role === "admin") {
|
|
34262
|
-
|
|
34263
|
-
|
|
34283
|
+
print();
|
|
34284
|
+
print(formatHeader(`Admin Commands:
|
|
34264
34285
|
`));
|
|
34265
|
-
|
|
34266
|
-
|
|
34267
|
-
|
|
34268
|
-
|
|
34269
|
-
|
|
34286
|
+
print(" darkroom Darkroom infrastructure (health, comfy, loras)");
|
|
34287
|
+
print(" train LoRA training (start, status)");
|
|
34288
|
+
print(" personas List and manage personas");
|
|
34289
|
+
print(" caption Run Florence-2 auto-captioning");
|
|
34290
|
+
print(" dataset Manage training datasets");
|
|
34270
34291
|
}
|
|
34271
|
-
|
|
34272
|
-
|
|
34273
|
-
|
|
34292
|
+
print();
|
|
34293
|
+
print(source_default.dim(" Run `gf <command> --help` for command details"));
|
|
34294
|
+
print(source_default.dim(" Run `gf` with no args for interactive mode"));
|
|
34274
34295
|
}
|
|
34275
34296
|
async function startRepl() {
|
|
34276
34297
|
setReplMode(true);
|
|
34277
34298
|
await printBanner();
|
|
34278
34299
|
await printHelp();
|
|
34279
|
-
|
|
34300
|
+
print();
|
|
34280
34301
|
const rl2 = createInterface2({
|
|
34281
34302
|
input: process.stdin,
|
|
34282
34303
|
output: process.stdout
|
|
@@ -34293,7 +34314,7 @@ async function startRepl() {
|
|
|
34293
34314
|
if (!trimmed)
|
|
34294
34315
|
continue;
|
|
34295
34316
|
if (trimmed === "exit" || trimmed === "quit" || trimmed === "q") {
|
|
34296
|
-
|
|
34317
|
+
print(source_default.dim("Goodbye!"));
|
|
34297
34318
|
break;
|
|
34298
34319
|
}
|
|
34299
34320
|
if (trimmed === "help" || trimmed === "?") {
|
|
@@ -34311,14 +34332,14 @@ async function startRepl() {
|
|
|
34311
34332
|
continue;
|
|
34312
34333
|
}
|
|
34313
34334
|
if (error49.message.includes("unknown command") || code === "commander.unknownCommand") {
|
|
34314
|
-
|
|
34315
|
-
|
|
34335
|
+
print(formatError3(`Unknown command: ${args[0]}`));
|
|
34336
|
+
print(source_default.dim("Type `help` to see available commands"));
|
|
34316
34337
|
} else {
|
|
34317
|
-
console.error(
|
|
34338
|
+
console.error(formatError3(error49.message));
|
|
34318
34339
|
}
|
|
34319
34340
|
}
|
|
34320
34341
|
}
|
|
34321
|
-
|
|
34342
|
+
print();
|
|
34322
34343
|
}
|
|
34323
34344
|
rl2.close();
|
|
34324
34345
|
process.exit(0);
|
|
@@ -34357,7 +34378,7 @@ function parseReplInput(input) {
|
|
|
34357
34378
|
}
|
|
34358
34379
|
if (process.argv.length <= 2) {
|
|
34359
34380
|
startRepl().catch((error49) => {
|
|
34360
|
-
console.error(
|
|
34381
|
+
console.error(formatError3(`Fatal: ${error49 instanceof Error ? error49.message : String(error49)}`));
|
|
34361
34382
|
process.exit(1);
|
|
34362
34383
|
});
|
|
34363
34384
|
} else {
|
|
@@ -34368,7 +34389,7 @@ if (process.argv.length <= 2) {
|
|
|
34368
34389
|
process.exit(0);
|
|
34369
34390
|
}
|
|
34370
34391
|
}
|
|
34371
|
-
console.error(
|
|
34392
|
+
console.error(formatError3(error49 instanceof Error ? error49.message : String(error49)));
|
|
34372
34393
|
process.exit(1);
|
|
34373
34394
|
});
|
|
34374
34395
|
}
|