jstar-reviewer 2.1.3 → 2.1.4

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/README.md CHANGED
@@ -38,7 +38,7 @@ curl -fsSL https://raw.githubusercontent.com/JStaRFilms/jstar-code-review/v2.0.0
38
38
  ### After Install:
39
39
 
40
40
  1. **Check Config**: The tool now **auto-creates** `.env.example` and `.jstar/` when you run it.
41
- 2. **Add Keys**: Copy `.env.example` → `.env.local` and add your `GOOGLE_API_KEY` and `GROQ_API_KEY`.
41
+ 2. **Add Keys**: Copy `.env.example` → `.env.local` and add your `GEMINI_API_KEY` and `GROQ_API_KEY`.
42
42
  3. **Index**: Run `jstar init` (or `pnpm run index:init`) to build the brain.
43
43
  4. **Review**: Stage changes (`git add`) and run `jstar review` (or `pnpm run review`).
44
44
 
@@ -91,7 +91,7 @@ pnpm install
91
91
  Create `.env.local`:
92
92
 
93
93
  ```env
94
- GOOGLE_API_KEY=your_gemini_key
94
+ GEMINI_API_KEY=your_gemini_key
95
95
  GROQ_API_KEY=your_groq_key
96
96
  ```
97
97
 
package/bin/jstar.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  /**
3
3
  * J-Star Reviewer CLI
4
4
  * Global command-line tool for AI-powered code review
@@ -50,7 +50,7 @@ ${COLORS.bold}EXAMPLES:${COLORS.reset}
50
50
  jstar review
51
51
 
52
52
  ${COLORS.bold}ENVIRONMENT:${COLORS.reset}
53
- GOOGLE_API_KEY Required for Gemini embeddings
53
+ GEMINI_API_KEY Required for Gemini embeddings (or GOOGLE_API_KEY)
54
54
  GROQ_API_KEY Required for Groq LLM reviews
55
55
 
56
56
  ${COLORS.dim}Report issues: https://github.com/JStaRFilms/jstar-code-review${COLORS.reset}
@@ -135,7 +135,7 @@ function runScript(scriptName) {
135
135
  }
136
136
 
137
137
  const REQUIRED_ENV_VARS = {
138
- 'GOOGLE_API_KEY': '# Required: Google API key for Gemini embeddings\nGOOGLE_API_KEY=your_google_api_key_here',
138
+ 'GEMINI_API_KEY': '# Required: Gemini API key (or GOOGLE_API_KEY)\nGEMINI_API_KEY=your_gemini_api_key_here',
139
139
  'GROQ_API_KEY': '# Required: Groq API key for LLM reviews\nGROQ_API_KEY=your_groq_api_key_here',
140
140
  'REVIEW_MODEL_NAME': '# Optional: Override the default model\n# REVIEW_MODEL_NAME=moonshotai/kimi-k2-instruct-0905'
141
141
  };
@@ -42,7 +42,7 @@ const fs = __importStar(require("fs"));
42
42
  const path = __importStar(require("path"));
43
43
  // --- Auto-Setup Logic ---
44
44
  const REQUIRED_ENV_VARS = {
45
- 'GOOGLE_API_KEY': '# Required: Google API key for Gemini embeddings\nGOOGLE_API_KEY=your_google_api_key_here',
45
+ 'GEMINI_API_KEY': '# Required: Gemini API key (or GOOGLE_API_KEY)\nGEMINI_API_KEY=your_gemini_api_key_here',
46
46
  'GROQ_API_KEY': '# Required: Groq API key for LLM reviews\nGROQ_API_KEY=your_groq_api_key_here',
47
47
  'REVIEW_MODEL_NAME': '# Optional: Override the default model\n# REVIEW_MODEL_NAME=moonshotai/kimi-k2-instruct-0905'
48
48
  };
@@ -6,9 +6,9 @@ class GeminiEmbedding {
6
6
  constructor() {
7
7
  // Stubs for BaseEmbedding compliance
8
8
  this.embedBatchSize = 10;
9
- const apiKey = process.env.GOOGLE_API_KEY;
9
+ const apiKey = process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY || process.env.GOOGLE_GENERATIVE_AI_API_KEY;
10
10
  if (!apiKey) {
11
- throw new Error("GOOGLE_API_KEY is missing from environment variables.");
11
+ throw new Error("GEMINI_API_KEY is missing from environment variables.");
12
12
  }
13
13
  this.genAI = new generative_ai_1.GoogleGenerativeAI(apiKey);
14
14
  // User requested 'text-embedding-004', which has better rate limits
@@ -77,8 +77,9 @@ function getSourceDir() {
77
77
  }
78
78
  async function main() {
79
79
  // 0. Environment Validation
80
- if (!process.env.GOOGLE_API_KEY) {
81
- console.error(chalk_1.default.red("❌ Missing GOOGLE_API_KEY!"));
80
+ const geminiKey = process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY || process.env.GOOGLE_GENERATIVE_AI_API_KEY;
81
+ if (!geminiKey) {
82
+ console.error(chalk_1.default.red("❌ Missing GEMINI_API_KEY (or GOOGLE_API_KEY)!"));
82
83
  console.log(chalk_1.default.yellow("\nPlease ensure you have a .env.local file. Check .env.example for a template.\n"));
83
84
  process.exit(1);
84
85
  }
@@ -147,7 +148,7 @@ async function main() {
147
148
  catch (e) {
148
149
  console.error(chalk_1.default.red("❌ Indexing Failed:"), e.message);
149
150
  if (e.message.includes("API") || e.message.includes("key")) {
150
- console.log(chalk_1.default.yellow("👉 Tip: Make sure you have GOOGLE_API_KEY in your .env.local file."));
151
+ console.log(chalk_1.default.yellow("👉 Tip: Make sure you have GEMINI_API_KEY in your .env.local file."));
151
152
  }
152
153
  process.exit(1);
153
154
  }
@@ -49,7 +49,8 @@ const gemini_embedding_1 = require("./gemini-embedding");
49
49
  const mock_llm_1 = require("./mock-llm");
50
50
  const dashboard_1 = require("./dashboard");
51
51
  const llamaindex_1 = require("llamaindex");
52
- const google = (0, google_1.createGoogleGenerativeAI)({ apiKey: process.env.GOOGLE_API_KEY });
52
+ const geminiKey = process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY || process.env.GOOGLE_GENERATIVE_AI_API_KEY;
53
+ const google = (0, google_1.createGoogleGenerativeAI)({ apiKey: geminiKey });
53
54
  const groq = (0, groq_1.createGroq)({ apiKey: process.env.GROQ_API_KEY });
54
55
  const embedModel = new gemini_embedding_1.GeminiEmbedding();
55
56
  const llm = new mock_llm_1.MockLLM();
@@ -126,10 +127,10 @@ function parseReviewResponse(text) {
126
127
  async function main() {
127
128
  console.log(chalk_1.default.blue("🕵️ J-Star Reviewer: Analyzing your changes...\n"));
128
129
  // 0. Environment Validation
129
- if (!process.env.GOOGLE_API_KEY || !process.env.GROQ_API_KEY) {
130
+ if (!geminiKey || !process.env.GROQ_API_KEY) {
130
131
  console.error(chalk_1.default.red("❌ Missing API Keys!"));
131
132
  console.log(chalk_1.default.yellow("\nPlease ensure you have a .env.local file with:"));
132
- console.log(chalk_1.default.white("- GOOGLE_API_KEY"));
133
+ console.log(chalk_1.default.white("- GEMINI_API_KEY (or GOOGLE_API_KEY)"));
133
134
  console.log(chalk_1.default.white("- GROQ_API_KEY"));
134
135
  console.log(chalk_1.default.white("\nCheck .env.example for a template.\n"));
135
136
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jstar-reviewer",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Local-First, Context-Aware AI Code Reviewer - Works with any language",
5
5
  "bin": {
6
6
  "jstar": "bin/jstar.js"
package/scripts/config.ts CHANGED
@@ -5,7 +5,7 @@ import { Severity } from "./types";
5
5
 
6
6
  // --- Auto-Setup Logic ---
7
7
  const REQUIRED_ENV_VARS = {
8
- 'GOOGLE_API_KEY': '# Required: Google API key for Gemini embeddings\nGOOGLE_API_KEY=your_google_api_key_here',
8
+ 'GEMINI_API_KEY': '# Required: Gemini API key (or GOOGLE_API_KEY)\nGEMINI_API_KEY=your_gemini_api_key_here',
9
9
  'GROQ_API_KEY': '# Required: Groq API key for LLM reviews\nGROQ_API_KEY=your_groq_api_key_here',
10
10
  'REVIEW_MODEL_NAME': '# Optional: Override the default model\n# REVIEW_MODEL_NAME=moonshotai/kimi-k2-instruct-0905'
11
11
  };
@@ -5,9 +5,9 @@ export class GeminiEmbedding {
5
5
  private model: any;
6
6
 
7
7
  constructor() {
8
- const apiKey = process.env.GOOGLE_API_KEY;
8
+ const apiKey = process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY || process.env.GOOGLE_GENERATIVE_AI_API_KEY;
9
9
  if (!apiKey) {
10
- throw new Error("GOOGLE_API_KEY is missing from environment variables.");
10
+ throw new Error("GEMINI_API_KEY is missing from environment variables.");
11
11
  }
12
12
  this.genAI = new GoogleGenerativeAI(apiKey);
13
13
  // User requested 'text-embedding-004', which has better rate limits
@@ -50,8 +50,9 @@ function getSourceDir(): string {
50
50
 
51
51
  async function main() {
52
52
  // 0. Environment Validation
53
- if (!process.env.GOOGLE_API_KEY) {
54
- console.error(chalk.red("❌ Missing GOOGLE_API_KEY!"));
53
+ const geminiKey = process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY || process.env.GOOGLE_GENERATIVE_AI_API_KEY;
54
+ if (!geminiKey) {
55
+ console.error(chalk.red("❌ Missing GEMINI_API_KEY (or GOOGLE_API_KEY)!"));
55
56
  console.log(chalk.yellow("\nPlease ensure you have a .env.local file. Check .env.example for a template.\n"));
56
57
  process.exit(1);
57
58
  }
@@ -126,7 +127,7 @@ async function main() {
126
127
  } catch (e: any) {
127
128
  console.error(chalk.red("❌ Indexing Failed:"), e.message);
128
129
  if (e.message.includes("API") || e.message.includes("key")) {
129
- console.log(chalk.yellow("👉 Tip: Make sure you have GOOGLE_API_KEY in your .env.local file."));
130
+ console.log(chalk.yellow("👉 Tip: Make sure you have GEMINI_API_KEY in your .env.local file."));
130
131
  }
131
132
  process.exit(1);
132
133
  }
@@ -18,7 +18,8 @@ import {
18
18
  serviceContextFromDefaults
19
19
  } from "llamaindex";
20
20
 
21
- const google = createGoogleGenerativeAI({ apiKey: process.env.GOOGLE_API_KEY });
21
+ const geminiKey = process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY || process.env.GOOGLE_GENERATIVE_AI_API_KEY;
22
+ const google = createGoogleGenerativeAI({ apiKey: geminiKey });
22
23
  const groq = createGroq({ apiKey: process.env.GROQ_API_KEY });
23
24
 
24
25
  const embedModel = new GeminiEmbedding();
@@ -110,10 +111,10 @@ async function main() {
110
111
  console.log(chalk.blue("🕵️ J-Star Reviewer: Analyzing your changes...\n"));
111
112
 
112
113
  // 0. Environment Validation
113
- if (!process.env.GOOGLE_API_KEY || !process.env.GROQ_API_KEY) {
114
+ if (!geminiKey || !process.env.GROQ_API_KEY) {
114
115
  console.error(chalk.red("❌ Missing API Keys!"));
115
116
  console.log(chalk.yellow("\nPlease ensure you have a .env.local file with:"));
116
- console.log(chalk.white("- GOOGLE_API_KEY"));
117
+ console.log(chalk.white("- GEMINI_API_KEY (or GOOGLE_API_KEY)"));
117
118
  console.log(chalk.white("- GROQ_API_KEY"));
118
119
  console.log(chalk.white("\nCheck .env.example for a template.\n"));
119
120
  return;
package/setup.js CHANGED
@@ -67,8 +67,8 @@ const SCRIPTS = {
67
67
  const ENV_EXAMPLE = `# J-Star Code Reviewer Configuration
68
68
  # Copy this to .env.local and fill in your keys
69
69
 
70
- # Required: Google API key for Gemini embeddings
71
- GOOGLE_API_KEY=your_google_api_key_here
70
+ # Required: Gemini API key (or GOOGLE_API_KEY)
71
+ GEMINI_API_KEY=your_gemini_api_key_here
72
72
 
73
73
  # Required: Groq API key for LLM reviews
74
74
  GROQ_API_KEY=your_groq_api_key_here
@@ -115,7 +115,7 @@ async function main() {
115
115
 
116
116
  // HARDCODED: Tagged release URL - NOT configurable for security
117
117
  // To update, modify this constant and publish a new version of setup.js
118
- const BASE_URL = 'https://raw.githubusercontent.com/JStaRFilms/jstar-code-review/v2.1.3';
118
+ const BASE_URL = 'https://raw.githubusercontent.com/JStaRFilms/jstar-code-review/v2.1.4';
119
119
 
120
120
  // Validate URL matches our exact expected pattern (defense in depth)
121
121
  function isValidUrl(url) {
@@ -272,7 +272,7 @@ async function main() {
272
272
  // 6. Update .env.example (intelligently merge, don't override)
273
273
  const envExamplePath = path.join(cwd, '.env.example');
274
274
  const REQUIRED_ENV_VARS = {
275
- 'GOOGLE_API_KEY': '# Required: Google API key for Gemini embeddings\nGOOGLE_API_KEY=your_google_api_key_here',
275
+ 'GEMINI_API_KEY': '# Required: Gemini API key (or GOOGLE_API_KEY)\nGEMINI_API_KEY=your_gemini_api_key_here',
276
276
  'GROQ_API_KEY': '# Required: Groq API key for LLM reviews\nGROQ_API_KEY=your_groq_api_key_here',
277
277
  'REVIEW_MODEL_NAME': '# Optional: Override the default model\n# REVIEW_MODEL_NAME=moonshotai/kimi-k2-instruct-0905'
278
278
  };
@@ -355,7 +355,7 @@ async function main() {
355
355
  console.log('\n🎉 J-Star Code Reviewer installed!\n');
356
356
  console.log('Next steps:');
357
357
  console.log(' 1. Copy .env.example to .env.local');
358
- console.log(' 2. Add your GOOGLE_API_KEY and GROQ_API_KEY');
358
+ console.log(' 2. Add your GEMINI_API_KEY and GROQ_API_KEY');
359
359
  console.log(' 3. Run: pnpm run index:init');
360
360
  console.log(' 4. Stage changes and run: pnpm run review');
361
361
  console.log('\n' + '─'.repeat(50) + '\n');