@forvibe/cli 1.0.4 → 1.0.5

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.
Files changed (2) hide show
  1. package/dist/index.js +54 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2027,14 +2027,36 @@ function createClaudeProvider(apiKey) {
2027
2027
  }
2028
2028
  };
2029
2029
  }
2030
- function detectProvider() {
2031
- const geminiKey = process.env.GEMINI_API_KEY || process.env.GOOGLE_AI_API_KEY;
2032
- if (geminiKey) return createGeminiProvider(geminiKey);
2033
- const openaiKey = process.env.OPENAI_API_KEY;
2034
- if (openaiKey) return createOpenAIProvider(openaiKey);
2030
+ function getAvailableProviders() {
2031
+ const providers = [];
2035
2032
  const anthropicKey = process.env.ANTHROPIC_API_KEY;
2036
- if (anthropicKey) return createClaudeProvider(anthropicKey);
2037
- throw new Error("NO_API_KEY");
2033
+ if (anthropicKey) {
2034
+ providers.push({
2035
+ id: "claude",
2036
+ name: "Claude",
2037
+ recommended: true,
2038
+ create: () => createClaudeProvider(anthropicKey)
2039
+ });
2040
+ }
2041
+ const openaiKey = process.env.OPENAI_API_KEY;
2042
+ if (openaiKey) {
2043
+ providers.push({
2044
+ id: "openai",
2045
+ name: "OpenAI",
2046
+ recommended: false,
2047
+ create: () => createOpenAIProvider(openaiKey)
2048
+ });
2049
+ }
2050
+ const geminiKey = process.env.GEMINI_API_KEY || process.env.GOOGLE_AI_API_KEY;
2051
+ if (geminiKey) {
2052
+ providers.push({
2053
+ id: "gemini",
2054
+ name: "Gemini",
2055
+ recommended: false,
2056
+ create: () => createGeminiProvider(geminiKey)
2057
+ });
2058
+ }
2059
+ return providers;
2038
2060
  }
2039
2061
 
2040
2062
  // src/commands/analyze.ts
@@ -2057,18 +2079,37 @@ async function analyzeCommand(options) {
2057
2079
  chalk.bold(" Forvibe CLI") + chalk.gray(" \u2014 AI-powered App Store automation")
2058
2080
  );
2059
2081
  console.log();
2060
- let provider;
2061
- try {
2062
- provider = detectProvider();
2063
- } catch {
2082
+ const availableProviders = getAvailableProviders();
2083
+ if (availableProviders.length === 0) {
2064
2084
  console.log(chalk.red(" \u2717 No AI API key found. Set one of the following:\n"));
2065
- console.log(chalk.cyan(" export GEMINI_API_KEY=your-key") + chalk.gray(" https://aistudio.google.com/apikey"));
2085
+ console.log(chalk.cyan(" export ANTHROPIC_API_KEY=your-key") + chalk.gray(" https://console.anthropic.com/settings/keys") + chalk.green(" (recommended)"));
2066
2086
  console.log(chalk.cyan(" export OPENAI_API_KEY=your-key") + chalk.gray(" https://platform.openai.com/api-keys"));
2067
- console.log(chalk.cyan(" export ANTHROPIC_API_KEY=your-key") + chalk.gray(" https://console.anthropic.com/settings/keys"));
2087
+ console.log(chalk.cyan(" export GEMINI_API_KEY=your-key") + chalk.gray(" https://aistudio.google.com/apikey"));
2068
2088
  console.log();
2069
2089
  console.log(chalk.gray(" Your source code is analyzed locally \u2014 it never leaves your machine.\n"));
2070
2090
  process.exit(1);
2071
2091
  }
2092
+ let provider;
2093
+ if (availableProviders.length === 1) {
2094
+ provider = availableProviders[0].create();
2095
+ } else {
2096
+ console.log(chalk.white(" Multiple AI API keys detected. Choose a provider:\n"));
2097
+ availableProviders.forEach((p, i) => {
2098
+ const label = `${i + 1}. ${p.name}${p.recommended ? chalk.green(" (recommended)") : ""}`;
2099
+ console.log(` ${label}`);
2100
+ });
2101
+ console.log();
2102
+ const answer = await askQuestion(chalk.cyan(` Enter choice (1-${availableProviders.length}): `));
2103
+ const index = parseInt(answer, 10) - 1;
2104
+ if (isNaN(index) || index < 0 || index >= availableProviders.length) {
2105
+ const recommended = availableProviders.find((p) => p.recommended) || availableProviders[0];
2106
+ provider = recommended.create();
2107
+ console.log(chalk.gray(` Using ${recommended.name} (default)
2108
+ `));
2109
+ } else {
2110
+ provider = availableProviders[index].create();
2111
+ }
2112
+ }
2072
2113
  console.log(chalk.gray(` AI Provider: ${provider.name} \u2713`));
2073
2114
  const otcCode = await askQuestion(
2074
2115
  chalk.cyan(" \u{1F517} Enter your Forvibe connection code: ")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forvibe/cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Forvibe CLI - AI-powered project analyzer for App Store automation",
5
5
  "type": "module",
6
6
  "bin": {