polydev-ai 1.8.20 → 1.8.21
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/lib/cliManager.js +27 -5
- package/package.json +1 -1
package/lib/cliManager.js
CHANGED
|
@@ -75,7 +75,8 @@ class CLIManager {
|
|
|
75
75
|
subcommands: {
|
|
76
76
|
chat: ['chat'],
|
|
77
77
|
version: ['--version'],
|
|
78
|
-
auth_status: ['auth-status']
|
|
78
|
+
auth_status: ['auth-status'],
|
|
79
|
+
test_prompt: ['-p'] // Gemini CLI uses -p for headless prompts
|
|
79
80
|
},
|
|
80
81
|
install_instructions: 'Install Gemini CLI from Google',
|
|
81
82
|
auth_instructions: 'Authenticate with: gemini (then /auth login)'
|
|
@@ -327,7 +328,21 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
327
328
|
return false;
|
|
328
329
|
|
|
329
330
|
case 'gemini_cli':
|
|
330
|
-
// Check for Gemini CLI auth files
|
|
331
|
+
// Check for Gemini CLI auth files
|
|
332
|
+
// Gemini CLI stores OAuth credentials in ~/.gemini/oauth_creds.json
|
|
333
|
+
const geminiOauthPath = path.join(os.homedir(), '.gemini', 'oauth_creds.json');
|
|
334
|
+
if (fs.existsSync(geminiOauthPath)) {
|
|
335
|
+
try {
|
|
336
|
+
const oauthContent = fs.readFileSync(geminiOauthPath, 'utf8');
|
|
337
|
+
const oauthData = JSON.parse(oauthContent);
|
|
338
|
+
// Check for valid OAuth tokens
|
|
339
|
+
return !!(oauthData && (oauthData.access_token || oauthData.refresh_token));
|
|
340
|
+
} catch {
|
|
341
|
+
// Has OAuth file but couldn't parse - assume authenticated
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// Fallback: check legacy location
|
|
331
346
|
const geminiConfigPath = path.join(os.homedir(), '.config', 'gemini-cli', 'config.json');
|
|
332
347
|
if (fs.existsSync(geminiConfigPath)) {
|
|
333
348
|
const configContent = fs.readFileSync(geminiConfigPath, 'utf8');
|
|
@@ -568,14 +583,21 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
568
583
|
// Claude Code uses --model flag
|
|
569
584
|
args = ['--model', model, ...args, prompt];
|
|
570
585
|
} else if (providerId === 'gemini_cli') {
|
|
571
|
-
// Gemini CLI
|
|
572
|
-
|
|
586
|
+
// Gemini CLI: -m for model, -p for prompt (headless mode)
|
|
587
|
+
// Format: gemini -m gemini-2.0-flash -p "prompt"
|
|
588
|
+
args = ['-m', model, '-p', prompt];
|
|
573
589
|
} else {
|
|
574
590
|
// Default: just append prompt
|
|
575
591
|
args = [...args, prompt];
|
|
576
592
|
}
|
|
577
593
|
} else {
|
|
578
|
-
|
|
594
|
+
// No model specified
|
|
595
|
+
if (providerId === 'gemini_cli') {
|
|
596
|
+
// Gemini CLI still needs -p flag for headless mode
|
|
597
|
+
args = ['-p', prompt];
|
|
598
|
+
} else {
|
|
599
|
+
args = [...args, prompt];
|
|
600
|
+
}
|
|
579
601
|
}
|
|
580
602
|
|
|
581
603
|
try {
|
package/package.json
CHANGED