@cli4ai/nanobanana 1.0.9 → 1.0.11
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/cli4ai.json +2 -5
- package/package.json +2 -2
- package/run.ts +3 -12
package/cli4ai.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nanobanana",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Image generation with Gemini (Nano Banana Pro)",
|
|
5
5
|
"author": "cliforai",
|
|
6
|
-
"license": "
|
|
6
|
+
"license": "BUSL-1.1",
|
|
7
7
|
"entry": "run.ts",
|
|
8
8
|
"runtime": "node",
|
|
9
9
|
"keywords": ["gemini", "image", "generation", "ai", "browser"],
|
|
@@ -15,8 +15,5 @@
|
|
|
15
15
|
"puppeteer": "^24.0.0",
|
|
16
16
|
"commander": "^14.0.0"
|
|
17
17
|
},
|
|
18
|
-
"peerDependencies": {
|
|
19
|
-
"chrome": "cli4ai chrome tool must be connected with Google account logged in"
|
|
20
|
-
},
|
|
21
18
|
"mcp": { "enabled": true, "transport": "stdio" }
|
|
22
19
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cli4ai/nanobanana",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Image generation with Gemini (Nano Banana Pro)",
|
|
5
5
|
"author": "cliforai",
|
|
6
|
-
"license": "
|
|
6
|
+
"license": "BUSL-1.1",
|
|
7
7
|
"main": "run.ts",
|
|
8
8
|
"bin": {
|
|
9
9
|
"nanobanana": "./run.ts"
|
package/run.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env npx tsx
|
|
2
2
|
import puppeteer from 'puppeteer';
|
|
3
|
-
import { readFileSync } from 'fs';
|
|
4
3
|
import { execSync } from 'child_process';
|
|
5
|
-
import { join } from 'path';
|
|
6
4
|
import { homedir } from 'os';
|
|
5
|
+
import { join } from 'path';
|
|
7
6
|
import { cli, output, outputError, withErrorHandling, sleep } from '@cli4ai/lib/cli.ts';
|
|
7
|
+
import { getBrowser } from '../../lib/browser.ts';
|
|
8
8
|
|
|
9
9
|
// List Gemini files in Downloads using shell (bypasses sandbox)
|
|
10
10
|
function getGeminiFiles(): string[] {
|
|
@@ -16,8 +16,6 @@ function getGeminiFiles(): string[] {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const __dirname = new URL('.', import.meta.url).pathname;
|
|
20
|
-
const WS_FILE = join(__dirname, '../chrome/.ws-endpoint');
|
|
21
19
|
const DOWNLOADS_DIR = join(homedir(), 'Downloads');
|
|
22
20
|
|
|
23
21
|
const program = cli('nanobanana', '1.0.0', 'Image generation with Gemini (Nano Banana Pro)');
|
|
@@ -29,14 +27,7 @@ program
|
|
|
29
27
|
// Prepend "Create an image of" if not already an image prompt
|
|
30
28
|
const imagePrompt = prompt.toLowerCase().startsWith('create') ? prompt : `Create an image of ${prompt}`;
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
ws = readFileSync(WS_FILE, 'utf-8');
|
|
35
|
-
} catch {
|
|
36
|
-
outputError('NOT_FOUND', 'Not connected to Chrome', { hint: 'Run: chrome connect' });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const browser = await puppeteer.connect({ browserWSEndpoint: ws! });
|
|
30
|
+
const browser = await getBrowser();
|
|
40
31
|
const page = await browser.newPage();
|
|
41
32
|
await page.setViewport({ width: 2560, height: 1440 });
|
|
42
33
|
|