polydev-ai 1.8.19 → 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 CHANGED
@@ -75,7 +75,8 @@ class CLIManager {
75
75
  subcommands: {
76
76
  chat: ['chat'],
77
77
  version: ['--version'],
78
- auth_status: ['auth-status'] // gemini-mcp auth-status command
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 (if any)
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 uses -m flag
572
- args = ['-m', model, ...args, prompt];
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
- args = [...args, prompt];
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 {
@@ -1369,6 +1369,8 @@ class StdioMCPWrapper {
1369
1369
  const cacheAge = Date.now() - this.modelPreferencesCacheTime;
1370
1370
  if (cacheAge < this.MODEL_PREFERENCES_CACHE_TTL) {
1371
1371
  console.error('[Stdio Wrapper] Using cached model preferences');
1372
+ // Also restore cached userProviderOrder when using cache
1373
+ // (userProviderOrder was set during the initial API fetch)
1372
1374
  return this.userModelPreferences;
1373
1375
  }
1374
1376
  }
@@ -1402,6 +1404,7 @@ class StdioMCPWrapper {
1402
1404
 
1403
1405
  // Cache provider order from user's dashboard (respects display_order)
1404
1406
  // This determines which CLIs/APIs to use first
1407
+ // IMPORTANT: This is cached alongside modelPreferences and restored when cache is used
1405
1408
  this.userProviderOrder = result.providerOrder || ['claude_code', 'codex_cli', 'gemini_cli'];
1406
1409
 
1407
1410
  console.error('[Stdio Wrapper] Model preferences loaded:', JSON.stringify(result.modelPreferences));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polydev-ai",
3
- "version": "1.8.19",
3
+ "version": "1.8.21",
4
4
  "description": "Agentic workflow assistant with CLI integration - get diverse perspectives from multiple LLMs when stuck or need enhanced reasoning",
5
5
  "keywords": [
6
6
  "mcp",