gobananas-cli 1.0.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/bin/gobananas-mcp.js +10 -0
- package/bin/gobananas.js +8 -0
- package/dist/commands/account.d.ts +8 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +200 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/character.d.ts +8 -0
- package/dist/commands/character.d.ts.map +1 -0
- package/dist/commands/character.js +493 -0
- package/dist/commands/character.js.map +1 -0
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +232 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/edit.d.ts +19 -0
- package/dist/commands/edit.d.ts.map +1 -0
- package/dist/commands/edit.js +279 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/generate.d.ts +8 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +177 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/image.d.ts +8 -0
- package/dist/commands/image.d.ts.map +1 -0
- package/dist/commands/image.js +212 -0
- package/dist/commands/image.js.map +1 -0
- package/dist/commands/index.d.ts +19 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +19 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/mcp-help.d.ts +8 -0
- package/dist/commands/mcp-help.d.ts.map +1 -0
- package/dist/commands/mcp-help.js +264 -0
- package/dist/commands/mcp-help.js.map +1 -0
- package/dist/commands/mcp.d.ts +9 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +25 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/product.d.ts +8 -0
- package/dist/commands/product.d.ts.map +1 -0
- package/dist/commands/product.js +316 -0
- package/dist/commands/product.js.map +1 -0
- package/dist/commands/scene.d.ts +8 -0
- package/dist/commands/scene.d.ts.map +1 -0
- package/dist/commands/scene.js +448 -0
- package/dist/commands/scene.js.map +1 -0
- package/dist/commands/search.d.ts +8 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +123 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/session.d.ts +8 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +167 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/style.d.ts +8 -0
- package/dist/commands/style.d.ts.map +1 -0
- package/dist/commands/style.js +297 -0
- package/dist/commands/style.js.map +1 -0
- package/dist/commands/usage.d.ts +8 -0
- package/dist/commands/usage.d.ts.map +1 -0
- package/dist/commands/usage.js +144 -0
- package/dist/commands/usage.js.map +1 -0
- package/dist/config/config.d.ts +65 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +156 -0
- package/dist/config/config.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +130 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/stdio-proxy.d.ts +8 -0
- package/dist/mcp/stdio-proxy.d.ts.map +1 -0
- package/dist/mcp/stdio-proxy.js +297 -0
- package/dist/mcp/stdio-proxy.js.map +1 -0
- package/dist/mcp-stdio.d.ts +3 -0
- package/dist/mcp-stdio.d.ts.map +1 -0
- package/dist/mcp-stdio.js +8 -0
- package/dist/mcp-stdio.js.map +1 -0
- package/dist/transport/index.d.ts +29 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +72 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/mcp-client.d.ts +342 -0
- package/dist/transport/mcp-client.d.ts.map +1 -0
- package/dist/transport/mcp-client.js +478 -0
- package/dist/transport/mcp-client.js.map +1 -0
- package/dist/transport/rest-client.d.ts +297 -0
- package/dist/transport/rest-client.d.ts.map +1 -0
- package/dist/transport/rest-client.js +461 -0
- package/dist/transport/rest-client.js.map +1 -0
- package/dist/types/responses.d.ts +230 -0
- package/dist/types/responses.d.ts.map +1 -0
- package/dist/types/responses.js +46 -0
- package/dist/types/responses.js.map +1 -0
- package/dist/utils/file-handler.d.ts +51 -0
- package/dist/utils/file-handler.d.ts.map +1 -0
- package/dist/utils/file-handler.js +189 -0
- package/dist/utils/file-handler.js.map +1 -0
- package/dist/utils/output.d.ts +111 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +240 -0
- package/dist/utils/output.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response type definitions for Go Bananas CLI
|
|
3
|
+
*
|
|
4
|
+
* Provides structured types for MCP and REST API responses
|
|
5
|
+
* to replace fragile regex parsing.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Common image result structure
|
|
9
|
+
*/
|
|
10
|
+
export interface ImageResult {
|
|
11
|
+
id: number;
|
|
12
|
+
sessionId?: string;
|
|
13
|
+
prompt: string;
|
|
14
|
+
negativePrompt?: string;
|
|
15
|
+
aspectRatio?: string;
|
|
16
|
+
operation: 'generate' | 'edit';
|
|
17
|
+
createdAt: string;
|
|
18
|
+
sizeBytes?: number;
|
|
19
|
+
width?: number;
|
|
20
|
+
height?: number;
|
|
21
|
+
fullUrl: string;
|
|
22
|
+
thumbnailUrl?: string;
|
|
23
|
+
r2Key?: string;
|
|
24
|
+
parentImageId?: number;
|
|
25
|
+
editDepth?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Generate image response
|
|
29
|
+
*/
|
|
30
|
+
export interface GenerateImageResponse {
|
|
31
|
+
success: boolean;
|
|
32
|
+
images?: ImageResult[];
|
|
33
|
+
image?: ImageResult;
|
|
34
|
+
error?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Edit image response
|
|
38
|
+
*/
|
|
39
|
+
export interface EditImageResponse {
|
|
40
|
+
success: boolean;
|
|
41
|
+
image?: ImageResult;
|
|
42
|
+
error?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Character result structure
|
|
46
|
+
*/
|
|
47
|
+
export interface CharacterResult {
|
|
48
|
+
id: number;
|
|
49
|
+
characterName: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
basePrompt: string;
|
|
52
|
+
negativePrompt?: string;
|
|
53
|
+
systemInstruction?: string;
|
|
54
|
+
referenceImageIds?: number[];
|
|
55
|
+
preferredAspectRatio?: string;
|
|
56
|
+
tags?: string[];
|
|
57
|
+
timesUsed: number;
|
|
58
|
+
createdAt: string;
|
|
59
|
+
lastUsedAt?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Product reference result structure
|
|
63
|
+
*/
|
|
64
|
+
export interface ProductResult {
|
|
65
|
+
id: number;
|
|
66
|
+
productName: string;
|
|
67
|
+
productUrl: string;
|
|
68
|
+
productDescription?: string;
|
|
69
|
+
tags?: string;
|
|
70
|
+
r2Key: string;
|
|
71
|
+
thumbnailUrl?: string;
|
|
72
|
+
fullUrl?: string;
|
|
73
|
+
width?: number;
|
|
74
|
+
height?: number;
|
|
75
|
+
sizeBytes?: number;
|
|
76
|
+
timesUsed: number;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
lastUsedAt?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Style preset result structure
|
|
82
|
+
*/
|
|
83
|
+
export interface StylePresetResult {
|
|
84
|
+
id: number;
|
|
85
|
+
name: string;
|
|
86
|
+
prompt?: string;
|
|
87
|
+
negativePrompt?: string;
|
|
88
|
+
systemInstruction?: string;
|
|
89
|
+
aspectRatio?: string;
|
|
90
|
+
createdAt: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Session info structure
|
|
94
|
+
*/
|
|
95
|
+
export interface SessionResult {
|
|
96
|
+
sessionId: string;
|
|
97
|
+
lastImageId?: number;
|
|
98
|
+
totalImages: number;
|
|
99
|
+
totalEdits: number;
|
|
100
|
+
isActive: boolean;
|
|
101
|
+
lastActivityAt: string;
|
|
102
|
+
createdAt: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Usage stats bucket
|
|
106
|
+
*/
|
|
107
|
+
export interface UsageBucket {
|
|
108
|
+
bucketStart: string;
|
|
109
|
+
operations: number;
|
|
110
|
+
imagesGenerated: number;
|
|
111
|
+
totalSizeBytes: number;
|
|
112
|
+
averageDurationMs: number;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Usage stats response
|
|
116
|
+
*/
|
|
117
|
+
export interface UsageStatsResponse {
|
|
118
|
+
summary: {
|
|
119
|
+
totalOperations: number;
|
|
120
|
+
totalImages: number;
|
|
121
|
+
totalSizeBytes: number;
|
|
122
|
+
averageDurationMs: number;
|
|
123
|
+
estimatedCostCents?: number;
|
|
124
|
+
};
|
|
125
|
+
buckets: UsageBucket[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Account summary response
|
|
129
|
+
*/
|
|
130
|
+
export interface AccountSummaryResponse {
|
|
131
|
+
tenant: {
|
|
132
|
+
tenantId: string;
|
|
133
|
+
name: string;
|
|
134
|
+
isActive: boolean;
|
|
135
|
+
};
|
|
136
|
+
quotas: {
|
|
137
|
+
monthlyQuotaMb: number;
|
|
138
|
+
usedMb: number;
|
|
139
|
+
remainingMb: number;
|
|
140
|
+
percentUsed: number;
|
|
141
|
+
};
|
|
142
|
+
libraries: {
|
|
143
|
+
characters: number;
|
|
144
|
+
stylePresets: number;
|
|
145
|
+
productReferences: number;
|
|
146
|
+
};
|
|
147
|
+
images: {
|
|
148
|
+
total: number;
|
|
149
|
+
generated: number;
|
|
150
|
+
edited: number;
|
|
151
|
+
};
|
|
152
|
+
sessions: {
|
|
153
|
+
total: number;
|
|
154
|
+
active: number;
|
|
155
|
+
};
|
|
156
|
+
mostUsed?: {
|
|
157
|
+
characters: Array<{
|
|
158
|
+
name: string;
|
|
159
|
+
timesUsed: number;
|
|
160
|
+
}>;
|
|
161
|
+
stylePresets: Array<{
|
|
162
|
+
name: string;
|
|
163
|
+
timesUsed: number;
|
|
164
|
+
}>;
|
|
165
|
+
productReferences: Array<{
|
|
166
|
+
name: string;
|
|
167
|
+
timesUsed: number;
|
|
168
|
+
}>;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Image info with lineage
|
|
173
|
+
*/
|
|
174
|
+
export interface ImageInfoResponse {
|
|
175
|
+
image: ImageResult;
|
|
176
|
+
lineage?: ImageResult[];
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Search images response
|
|
180
|
+
*/
|
|
181
|
+
export interface SearchImagesResponse {
|
|
182
|
+
images: ImageResult[];
|
|
183
|
+
pagination: {
|
|
184
|
+
limit: number;
|
|
185
|
+
offset: number;
|
|
186
|
+
total: number;
|
|
187
|
+
hasMore: boolean;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Help response structure
|
|
192
|
+
*/
|
|
193
|
+
export interface HelpResponse {
|
|
194
|
+
overview?: string;
|
|
195
|
+
tool?: {
|
|
196
|
+
name: string;
|
|
197
|
+
description: string;
|
|
198
|
+
parameters: Array<{
|
|
199
|
+
name: string;
|
|
200
|
+
type: string;
|
|
201
|
+
required: boolean;
|
|
202
|
+
description: string;
|
|
203
|
+
}>;
|
|
204
|
+
examples?: string[];
|
|
205
|
+
relatedTools?: string[];
|
|
206
|
+
};
|
|
207
|
+
category?: {
|
|
208
|
+
name: string;
|
|
209
|
+
tools: Array<{
|
|
210
|
+
name: string;
|
|
211
|
+
description: string;
|
|
212
|
+
}>;
|
|
213
|
+
};
|
|
214
|
+
workflow?: {
|
|
215
|
+
name: string;
|
|
216
|
+
description: string;
|
|
217
|
+
steps: string[];
|
|
218
|
+
examples?: string[];
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Parse MCP text response to extract structured data
|
|
223
|
+
* Falls back to regex extraction for backwards compatibility
|
|
224
|
+
*/
|
|
225
|
+
export declare function parseMcpTextResponse(text: string): Partial<ImageResult>;
|
|
226
|
+
/**
|
|
227
|
+
* Normalize field names from snake_case to camelCase
|
|
228
|
+
*/
|
|
229
|
+
export declare function normalizeResponse<T>(data: Record<string, unknown>): T;
|
|
230
|
+
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/types/responses.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,UAAU,GAAG,MAAM,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAA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AAE,CAAC;KACzB,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,KAAK,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;YACb,WAAW,EAAE,MAAM,CAAC;SACrB,CAAC,CAAC;KACJ,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAuBvE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAUrE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response type definitions for Go Bananas CLI
|
|
3
|
+
*
|
|
4
|
+
* Provides structured types for MCP and REST API responses
|
|
5
|
+
* to replace fragile regex parsing.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Parse MCP text response to extract structured data
|
|
9
|
+
* Falls back to regex extraction for backwards compatibility
|
|
10
|
+
*/
|
|
11
|
+
export function parseMcpTextResponse(text) {
|
|
12
|
+
// First try to find JSON in the response
|
|
13
|
+
const jsonMatch = text.match(/\{[\s\S]*\}/);
|
|
14
|
+
if (jsonMatch) {
|
|
15
|
+
try {
|
|
16
|
+
const parsed = JSON.parse(jsonMatch[0]);
|
|
17
|
+
return parsed;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// Fall through to regex parsing
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Fallback: regex extraction for legacy text responses
|
|
24
|
+
const urlMatch = text.match(/https?:\/\/[^\s)]+/);
|
|
25
|
+
const idMatch = text.match(/ID:\s*(\d+)/i);
|
|
26
|
+
const widthMatch = text.match(/(\d+)\s*x\s*(\d+)/);
|
|
27
|
+
return {
|
|
28
|
+
id: idMatch ? parseInt(idMatch[1], 10) : undefined,
|
|
29
|
+
fullUrl: urlMatch?.[0],
|
|
30
|
+
width: widthMatch ? parseInt(widthMatch[1], 10) : undefined,
|
|
31
|
+
height: widthMatch ? parseInt(widthMatch[2], 10) : undefined,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Normalize field names from snake_case to camelCase
|
|
36
|
+
*/
|
|
37
|
+
export function normalizeResponse(data) {
|
|
38
|
+
const result = {};
|
|
39
|
+
for (const [key, value] of Object.entries(data)) {
|
|
40
|
+
// Convert snake_case to camelCase
|
|
41
|
+
const camelKey = key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
42
|
+
result[camelKey] = value;
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=responses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/types/responses.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4NH;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,yCAAyC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC5C,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YACxC,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,MAAM,CAAC;YACP,gCAAgC;QAClC,CAAC;IACH,CAAC;IAED,uDAAuD;IACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAEnD,OAAO;QACL,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;QAClD,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;QACtB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;QAC3D,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;KAC7D,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAI,IAA6B;IAChE,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,kCAAkC;QAClC,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QAC/E,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Handler Utilities for Go Bananas CLI
|
|
3
|
+
*
|
|
4
|
+
* Handles file operations like downloading images and saving to disk.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Download an image from a URL and save to disk
|
|
8
|
+
*/
|
|
9
|
+
export declare function downloadImage(url: string, outputPath?: string): Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Generate a unique filename to avoid overwrites
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateUniqueFilename(baseName: string, extension: string, outputDir: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get the extension for a MIME type
|
|
16
|
+
*/
|
|
17
|
+
export declare function getExtensionForMimeType(mimeType: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Sanitize a filename to remove invalid characters
|
|
20
|
+
*/
|
|
21
|
+
export declare function sanitizeFilename(filename: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Create a filename from a prompt
|
|
24
|
+
*/
|
|
25
|
+
export declare function filenameFromPrompt(prompt: string, maxLength?: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a path is a URL
|
|
28
|
+
*/
|
|
29
|
+
export declare function isUrl(path: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Resolve a path relative to current directory
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolvePath(path: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Result from reading a local image file
|
|
36
|
+
*/
|
|
37
|
+
export interface LocalImageResult {
|
|
38
|
+
base64Data: string;
|
|
39
|
+
mimeType: string;
|
|
40
|
+
fileName: string;
|
|
41
|
+
sizeBytes: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Read a local image file and convert to base64 for upload
|
|
45
|
+
*
|
|
46
|
+
* @param filePath - Path to the local image file (absolute or relative)
|
|
47
|
+
* @returns Object containing base64 data, MIME type, and metadata
|
|
48
|
+
* @throws Error if file doesn't exist, is too large, or has unsupported format
|
|
49
|
+
*/
|
|
50
|
+
export declare function readLocalImageAsBase64(filePath: string): Promise<LocalImageResult>;
|
|
51
|
+
//# sourceMappingURL=file-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-handler.d.ts","sourceRoot":"","sources":["../../src/utils/file-handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH;;GAEG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CA+CjB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,CAYR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAUhE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,SAAK,GAAG,MAAM,CAazE;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO3C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKhD;AAoBD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAmDxF"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Handler Utilities for Go Bananas CLI
|
|
3
|
+
*
|
|
4
|
+
* Handles file operations like downloading images and saving to disk.
|
|
5
|
+
*/
|
|
6
|
+
import { writeFile, mkdir, readFile, stat } from 'fs/promises';
|
|
7
|
+
import { existsSync } from 'fs';
|
|
8
|
+
import { join, dirname, basename, extname } from 'path';
|
|
9
|
+
import { getConfig } from '../config/config.js';
|
|
10
|
+
/**
|
|
11
|
+
* Download an image from a URL and save to disk
|
|
12
|
+
*/
|
|
13
|
+
export async function downloadImage(url, outputPath) {
|
|
14
|
+
const config = getConfig();
|
|
15
|
+
const outputDir = config.outputDir;
|
|
16
|
+
// Ensure output directory exists
|
|
17
|
+
if (!existsSync(outputDir)) {
|
|
18
|
+
await mkdir(outputDir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
// Determine output filename
|
|
21
|
+
let filename;
|
|
22
|
+
if (outputPath) {
|
|
23
|
+
filename = outputPath;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// Extract filename from URL or generate one
|
|
27
|
+
const urlPath = new URL(url).pathname;
|
|
28
|
+
const urlFilename = basename(urlPath);
|
|
29
|
+
if (urlFilename && extname(urlFilename)) {
|
|
30
|
+
filename = urlFilename;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// Generate a filename with timestamp
|
|
34
|
+
const timestamp = Date.now();
|
|
35
|
+
filename = `gobananas-${timestamp}.png`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Build full output path
|
|
39
|
+
const fullPath = filename.includes('/') || filename.includes('\\')
|
|
40
|
+
? filename
|
|
41
|
+
: join(outputDir, filename);
|
|
42
|
+
// Ensure parent directory exists
|
|
43
|
+
const parentDir = dirname(fullPath);
|
|
44
|
+
if (!existsSync(parentDir)) {
|
|
45
|
+
await mkdir(parentDir, { recursive: true });
|
|
46
|
+
}
|
|
47
|
+
// Download the image
|
|
48
|
+
const response = await fetch(url);
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
throw new Error(`Failed to download image: HTTP ${response.status}`);
|
|
51
|
+
}
|
|
52
|
+
const buffer = await response.arrayBuffer();
|
|
53
|
+
await writeFile(fullPath, Buffer.from(buffer));
|
|
54
|
+
return fullPath;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Generate a unique filename to avoid overwrites
|
|
58
|
+
*/
|
|
59
|
+
export function generateUniqueFilename(baseName, extension, outputDir) {
|
|
60
|
+
let counter = 0;
|
|
61
|
+
let filename = `${baseName}${extension}`;
|
|
62
|
+
let fullPath = join(outputDir, filename);
|
|
63
|
+
while (existsSync(fullPath)) {
|
|
64
|
+
counter++;
|
|
65
|
+
filename = `${baseName}-${counter}${extension}`;
|
|
66
|
+
fullPath = join(outputDir, filename);
|
|
67
|
+
}
|
|
68
|
+
return fullPath;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get the extension for a MIME type
|
|
72
|
+
*/
|
|
73
|
+
export function getExtensionForMimeType(mimeType) {
|
|
74
|
+
const mimeToExt = {
|
|
75
|
+
'image/png': '.png',
|
|
76
|
+
'image/jpeg': '.jpg',
|
|
77
|
+
'image/jpg': '.jpg',
|
|
78
|
+
'image/webp': '.webp',
|
|
79
|
+
'image/gif': '.gif',
|
|
80
|
+
};
|
|
81
|
+
return mimeToExt[mimeType.toLowerCase()] || '.png';
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Sanitize a filename to remove invalid characters
|
|
85
|
+
*/
|
|
86
|
+
export function sanitizeFilename(filename) {
|
|
87
|
+
// Remove or replace invalid characters
|
|
88
|
+
return filename
|
|
89
|
+
.replace(/[<>:"/\\|?*]/g, '-')
|
|
90
|
+
.replace(/\s+/g, '_')
|
|
91
|
+
.substring(0, 200); // Limit length
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Create a filename from a prompt
|
|
95
|
+
*/
|
|
96
|
+
export function filenameFromPrompt(prompt, maxLength = 50) {
|
|
97
|
+
// Take first few words of prompt
|
|
98
|
+
const words = prompt
|
|
99
|
+
.toLowerCase()
|
|
100
|
+
.replace(/[^a-z0-9\s]/g, '')
|
|
101
|
+
.split(/\s+/)
|
|
102
|
+
.filter(Boolean)
|
|
103
|
+
.slice(0, 5);
|
|
104
|
+
const base = words.join('-') || 'image';
|
|
105
|
+
const timestamp = Date.now();
|
|
106
|
+
return sanitizeFilename(`${base}-${timestamp}`);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Check if a path is a URL
|
|
110
|
+
*/
|
|
111
|
+
export function isUrl(path) {
|
|
112
|
+
try {
|
|
113
|
+
const url = new URL(path);
|
|
114
|
+
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Resolve a path relative to current directory
|
|
122
|
+
*/
|
|
123
|
+
export function resolvePath(path) {
|
|
124
|
+
if (path.startsWith('/') || path.startsWith('~')) {
|
|
125
|
+
return path;
|
|
126
|
+
}
|
|
127
|
+
return join(process.cwd(), path);
|
|
128
|
+
}
|
|
129
|
+
// ============================================
|
|
130
|
+
// Local File Upload Support
|
|
131
|
+
// ============================================
|
|
132
|
+
/**
|
|
133
|
+
* Extension to MIME type mapping for local file uploads
|
|
134
|
+
*/
|
|
135
|
+
const EXTENSION_TO_MIME = {
|
|
136
|
+
'.png': 'image/png',
|
|
137
|
+
'.jpg': 'image/jpeg',
|
|
138
|
+
'.jpeg': 'image/jpeg',
|
|
139
|
+
'.webp': 'image/webp',
|
|
140
|
+
'.gif': 'image/gif',
|
|
141
|
+
};
|
|
142
|
+
const SUPPORTED_EXTENSIONS = Object.keys(EXTENSION_TO_MIME);
|
|
143
|
+
const MAX_FILE_SIZE_BYTES = 20 * 1024 * 1024; // 20MB
|
|
144
|
+
/**
|
|
145
|
+
* Read a local image file and convert to base64 for upload
|
|
146
|
+
*
|
|
147
|
+
* @param filePath - Path to the local image file (absolute or relative)
|
|
148
|
+
* @returns Object containing base64 data, MIME type, and metadata
|
|
149
|
+
* @throws Error if file doesn't exist, is too large, or has unsupported format
|
|
150
|
+
*/
|
|
151
|
+
export async function readLocalImageAsBase64(filePath) {
|
|
152
|
+
// 1. Resolve path (handle relative paths)
|
|
153
|
+
const resolvedPath = resolvePath(filePath);
|
|
154
|
+
// 2. Check file exists
|
|
155
|
+
if (!existsSync(resolvedPath)) {
|
|
156
|
+
throw new Error(`File not found: ${filePath}`);
|
|
157
|
+
}
|
|
158
|
+
// 3. Get file stats and validate size
|
|
159
|
+
const stats = await stat(resolvedPath);
|
|
160
|
+
if (stats.size > MAX_FILE_SIZE_BYTES) {
|
|
161
|
+
const sizeMB = (stats.size / 1024 / 1024).toFixed(2);
|
|
162
|
+
throw new Error(`File too large: ${sizeMB}MB (max: 20MB). ` +
|
|
163
|
+
`Consider compressing the image before uploading.`);
|
|
164
|
+
}
|
|
165
|
+
if (stats.size < 100) {
|
|
166
|
+
throw new Error(`File too small: ${stats.size} bytes. ` +
|
|
167
|
+
`The file may be empty or corrupted.`);
|
|
168
|
+
}
|
|
169
|
+
// 4. Validate file extension
|
|
170
|
+
const ext = extname(filePath).toLowerCase();
|
|
171
|
+
if (!SUPPORTED_EXTENSIONS.includes(ext)) {
|
|
172
|
+
throw new Error(`Unsupported image format: ${ext}. ` +
|
|
173
|
+
`Supported formats: ${SUPPORTED_EXTENSIONS.join(', ')}`);
|
|
174
|
+
}
|
|
175
|
+
// 5. Read file and convert to base64
|
|
176
|
+
const buffer = await readFile(resolvedPath);
|
|
177
|
+
const base64Data = buffer.toString('base64');
|
|
178
|
+
// 6. Determine MIME type
|
|
179
|
+
const mimeType = EXTENSION_TO_MIME[ext] || 'image/png';
|
|
180
|
+
// 7. Extract filename
|
|
181
|
+
const fileName = basename(resolvedPath);
|
|
182
|
+
return {
|
|
183
|
+
base64Data,
|
|
184
|
+
mimeType,
|
|
185
|
+
fileName,
|
|
186
|
+
sizeBytes: stats.size,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=file-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-handler.js","sourceRoot":"","sources":["../../src/utils/file-handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAA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BAAkB;YACzC,kDAAkD,CACrD,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,mBAAmB,KAAK,CAAC,IAAI,UAAU;YACrC,qCAAqC,CACxC,CAAC;IACJ,CAAC;IAED,6BAA6B;IAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CACb,6BAA6B,GAAG,IAAI;YAClC,sBAAsB,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC1D,CAAC;IACJ,CAAC;IAED,qCAAqC;IACrC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC5C,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE7C,yBAAyB;IACzB,MAAM,QAAQ,GAAG,iBAAiB,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC;IAEvD,sBAAsB;IACtB,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IAExC,OAAO;QACL,UAAU;QACV,QAAQ;QACR,QAAQ;QACR,SAAS,EAAE,KAAK,CAAC,IAAI;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output Utilities for Go Bananas CLI
|
|
3
|
+
*
|
|
4
|
+
* Provides formatted console output with colors and spinners.
|
|
5
|
+
*/
|
|
6
|
+
import { Ora } from 'ora';
|
|
7
|
+
/**
|
|
8
|
+
* Print success message
|
|
9
|
+
*/
|
|
10
|
+
export declare function success(message: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Print error message
|
|
13
|
+
*/
|
|
14
|
+
export declare function error(message: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Print warning message
|
|
17
|
+
*/
|
|
18
|
+
export declare function warn(message: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Alias for warn
|
|
21
|
+
*/
|
|
22
|
+
export declare const warning: typeof warn;
|
|
23
|
+
/**
|
|
24
|
+
* Print info message
|
|
25
|
+
*/
|
|
26
|
+
export declare function info(message: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Print a section header
|
|
29
|
+
*/
|
|
30
|
+
export declare function header(title: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Print a key-value pair
|
|
33
|
+
*/
|
|
34
|
+
export declare function keyValue(key: string, value: string | number | boolean | null | undefined): void;
|
|
35
|
+
/**
|
|
36
|
+
* Print a table row
|
|
37
|
+
*/
|
|
38
|
+
export declare function tableRow(...columns: (string | number)[]): void;
|
|
39
|
+
/**
|
|
40
|
+
* Print a list item
|
|
41
|
+
*/
|
|
42
|
+
export declare function listItem(text: string, indent?: number): void;
|
|
43
|
+
/**
|
|
44
|
+
* Print a numbered list item
|
|
45
|
+
*/
|
|
46
|
+
export declare function numberedItem(index: number, text: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Create a loading spinner
|
|
49
|
+
*/
|
|
50
|
+
export declare function spinner(text: string): Ora;
|
|
51
|
+
/**
|
|
52
|
+
* Print an image result
|
|
53
|
+
*/
|
|
54
|
+
export declare function imageResult(result: {
|
|
55
|
+
id?: number;
|
|
56
|
+
url?: string;
|
|
57
|
+
fullUrl?: string;
|
|
58
|
+
width?: number;
|
|
59
|
+
height?: number;
|
|
60
|
+
sizeBytes?: number;
|
|
61
|
+
}): void;
|
|
62
|
+
/**
|
|
63
|
+
* Print character info
|
|
64
|
+
*/
|
|
65
|
+
export declare function characterInfo(char: Record<string, unknown>): void;
|
|
66
|
+
/**
|
|
67
|
+
* Print product info
|
|
68
|
+
*/
|
|
69
|
+
export declare function productInfo(product: Record<string, unknown>): void;
|
|
70
|
+
/**
|
|
71
|
+
* Print scene preset info
|
|
72
|
+
*/
|
|
73
|
+
export declare function sceneInfo(scene: Record<string, unknown>): void;
|
|
74
|
+
/**
|
|
75
|
+
* Print style preset info
|
|
76
|
+
*/
|
|
77
|
+
export declare function stylePresetInfo(preset: {
|
|
78
|
+
id: number;
|
|
79
|
+
name: string;
|
|
80
|
+
prompt?: string;
|
|
81
|
+
aspectRatio?: string;
|
|
82
|
+
}): void;
|
|
83
|
+
/**
|
|
84
|
+
* Format bytes to human-readable
|
|
85
|
+
*/
|
|
86
|
+
export declare function formatBytes(bytes: number): string;
|
|
87
|
+
/**
|
|
88
|
+
* Format duration in milliseconds to human-readable
|
|
89
|
+
*/
|
|
90
|
+
export declare function formatDuration(ms: number): string;
|
|
91
|
+
/**
|
|
92
|
+
* Print JSON data (for debugging or raw output)
|
|
93
|
+
*/
|
|
94
|
+
export declare function json(data: unknown): void;
|
|
95
|
+
/**
|
|
96
|
+
* Print empty line
|
|
97
|
+
*/
|
|
98
|
+
export declare function newline(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Print a horizontal rule
|
|
101
|
+
*/
|
|
102
|
+
export declare function hr(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Print connection info
|
|
105
|
+
*/
|
|
106
|
+
export declare function connectionInfo(type: 'mcp' | 'rest', serverUrl: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* Print a tip or hint
|
|
109
|
+
*/
|
|
110
|
+
export declare function tip(message: string): void;
|
|
111
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;A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