@klitchevo/code-council 0.0.6 → 0.0.8

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 (3) hide show
  1. package/README.md +34 -3
  2. package/dist/index.js +79 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
  [![CI](https://github.com/klitchevo/code-council/workflows/CI/badge.svg)](https://github.com/klitchevo/code-council/actions)
6
6
  [![codecov](https://codecov.io/gh/klitchevo/code-council/branch/main/graph/badge.svg)](https://codecov.io/gh/klitchevo/code-council)
7
7
 
8
+ ![Code Council](assets/code-council.png)
9
+
8
10
  **Your AI Code Review Council** - Get diverse perspectives from multiple AI models in parallel.
9
11
 
10
12
  An MCP (Model Context Protocol) server that provides AI-powered code review using multiple models from [OpenRouter](https://openrouter.ai). Think of it as assembling a council of AI experts to review your code, each bringing their unique perspective.
@@ -15,6 +17,7 @@ An MCP (Model Context Protocol) server that provides AI-powered code review usin
15
17
  - 🎨 **Frontend Review** - Specialized reviews for accessibility, performance, and UX
16
18
  - 🔒 **Backend Review** - Security, architecture, and performance analysis
17
19
  - 📋 **Plan Review** - Review implementation plans before writing code
20
+ - 📝 **Git Changes Review** - Review staged, unstaged, branch diffs, or specific commits
18
21
  - ⚡ **Parallel Execution** - All models run concurrently for fast results
19
22
 
20
23
  ## Quick Start
@@ -232,6 +235,28 @@ Use review_plan to analyze this implementation plan:
232
235
  [paste your plan]
233
236
  ```
234
237
 
238
+ ### `review_git_changes`
239
+
240
+ Review git changes directly from your repository.
241
+
242
+ **Parameters:**
243
+ - `review_type` (optional): `staged`, `unstaged`, `diff`, or `commit` (default: `staged`)
244
+ - `staged` - Review staged changes (`git diff --cached`)
245
+ - `unstaged` - Review unstaged changes (`git diff`)
246
+ - `diff` - Review branch diff (`git diff main..HEAD`)
247
+ - `commit` - Review a specific commit (requires `commit_hash`)
248
+ - `commit_hash` (optional): Commit hash to review (required when `review_type` is `commit`)
249
+ - `context` (optional): Additional context about the changes
250
+
251
+ **Example usage in Claude:**
252
+ ```
253
+ Use review_git_changes to review my staged changes
254
+ ```
255
+
256
+ ```
257
+ Use review_git_changes with review_type=commit and commit_hash=abc123 to review that commit
258
+ ```
259
+
235
260
  ### `list_review_config`
236
261
 
237
262
  Show which AI models are currently configured for each review type.
@@ -247,8 +272,10 @@ You can customize which AI models are used for reviews by setting environment va
247
272
  - `FRONTEND_REVIEW_MODELS` - Models for frontend reviews
248
273
  - `BACKEND_REVIEW_MODELS` - Models for backend reviews
249
274
  - `PLAN_REVIEW_MODELS` - Models for plan reviews
275
+ - `TEMPERATURE` - Control response randomness (0.0-2.0, default: 0.3)
276
+ - `MAX_TOKENS` - Maximum response tokens (default: 16384)
250
277
 
251
- **Format:** Array of strings (JSON array)
278
+ **Format:** Model arrays use JSON array format
252
279
 
253
280
  **Example:**
254
281
  ```json
@@ -261,7 +288,9 @@ You can customize which AI models are used for reviews by setting environment va
261
288
  "OPENROUTER_API_KEY": "your-api-key",
262
289
  "CODE_REVIEW_MODELS": ["anthropic/claude-sonnet-4.5", "openai/gpt-4o", "google/gemini-2.0-flash-exp"],
263
290
  "FRONTEND_REVIEW_MODELS": ["anthropic/claude-sonnet-4.5"],
264
- "BACKEND_REVIEW_MODELS": ["openai/gpt-4o", "anthropic/claude-sonnet-4.5"]
291
+ "BACKEND_REVIEW_MODELS": ["openai/gpt-4o", "anthropic/claude-sonnet-4.5"],
292
+ "TEMPERATURE": "0.5",
293
+ "MAX_TOKENS": "32000"
265
294
  }
266
295
  }
267
296
  }
@@ -271,6 +300,7 @@ You can customize which AI models are used for reviews by setting environment va
271
300
  **Default Models:**
272
301
  If you don't specify models, the server uses these defaults:
273
302
  - `minimax/minimax-m2.1`
303
+ - `z-ai/glm-4.7`
274
304
  - `x-ai/grok-code-fast-1`
275
305
 
276
306
  **Finding Models:**
@@ -330,9 +360,10 @@ npm run dev
330
360
  - Each review runs across multiple models simultaneously
331
361
  - Costs vary by model - check [OpenRouter pricing](https://openrouter.ai/models)
332
362
  - You can reduce costs by:
333
- - Using fewer models (edit `src/config.ts`)
363
+ - Using fewer models in your configuration
334
364
  - Choosing cheaper models
335
365
  - Using specific `review_type` options instead of `full` reviews
366
+ - Lowering `MAX_TOKENS` (default: 16384) for shorter responses
336
367
 
337
368
  ## Troubleshooting
338
369
 
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ var LLM_CONFIG = {
13
13
  };
14
14
  var DEFAULT_MODELS = [
15
15
  "minimax/minimax-m2.1",
16
+ "z-ai/glm-4.7",
16
17
  "x-ai/grok-code-fast-1"
17
18
  ];
18
19
 
@@ -567,12 +568,80 @@ async function handleFrontendReview(client2, input) {
567
568
  };
568
569
  }
569
570
 
570
- // src/tools/review-plan.ts
571
+ // src/tools/review-git.ts
572
+ import { execSync } from "child_process";
571
573
  import { z as z4 } from "zod";
574
+ var gitReviewSchemaObj = z4.object({
575
+ review_type: z4.enum(["staged", "unstaged", "diff", "commit"]).optional().describe(
576
+ "Type of changes to review: 'staged' (git diff --cached), 'unstaged' (git diff), 'diff' (git diff main..HEAD), 'commit' (specific commit). Default: staged"
577
+ ),
578
+ commit_hash: z4.string().optional().describe("Commit hash to review (only used when review_type is 'commit')"),
579
+ context: z4.string().optional().describe("Additional context about the changes")
580
+ });
581
+ var gitReviewSchema = gitReviewSchemaObj.shape;
582
+ function getGitDiff(reviewType = "staged", commitHash) {
583
+ try {
584
+ let command;
585
+ switch (reviewType) {
586
+ case "staged":
587
+ command = "git diff --cached";
588
+ break;
589
+ case "unstaged":
590
+ command = "git diff";
591
+ break;
592
+ case "diff":
593
+ command = "git diff main..HEAD";
594
+ break;
595
+ case "commit":
596
+ if (!commitHash) {
597
+ throw new Error(
598
+ "commit_hash is required when review_type is 'commit'"
599
+ );
600
+ }
601
+ command = `git show ${commitHash}`;
602
+ break;
603
+ default:
604
+ command = "git diff --cached";
605
+ }
606
+ logger.debug("Executing git command", { command });
607
+ const diff = execSync(command, {
608
+ encoding: "utf-8",
609
+ maxBuffer: 10 * 1024 * 1024
610
+ // 10MB
611
+ });
612
+ if (!diff || diff.trim().length === 0) {
613
+ throw new Error(`No changes found for review type: ${reviewType}`);
614
+ }
615
+ return diff;
616
+ } catch (error) {
617
+ const message = error instanceof Error ? error.message : "Unknown error";
618
+ logger.error("Failed to get git diff", error);
619
+ throw new Error(`Git command failed: ${message}`);
620
+ }
621
+ }
622
+ async function handleGitReview(client2, models, input) {
623
+ const reviewType = input.review_type || "staged";
624
+ logger.info("Running git review", {
625
+ reviewType,
626
+ commitHash: input.commit_hash,
627
+ modelCount: models.length,
628
+ models
629
+ });
630
+ const diff = getGitDiff(reviewType, input.commit_hash);
631
+ const results = await client2.reviewCode(diff, models, input.context);
632
+ return {
633
+ results,
634
+ models,
635
+ reviewType
636
+ };
637
+ }
638
+
639
+ // src/tools/review-plan.ts
640
+ import { z as z5 } from "zod";
572
641
  var planReviewSchema = {
573
- plan: z4.string().describe("The implementation plan to review"),
574
- review_type: z4.enum(["feasibility", "completeness", "risks", "timeline", "full"]).optional().describe("Type of review to perform (default: full)"),
575
- context: z4.string().optional().describe("Additional context about the project or constraints")
642
+ plan: z5.string().describe("The implementation plan to review"),
643
+ review_type: z5.enum(["feasibility", "completeness", "risks", "timeline", "full"]).optional().describe("Type of review to perform (default: full)"),
644
+ context: z5.string().optional().describe("Additional context about the project or constraints")
576
645
  };
577
646
  async function handlePlanReview(client2, input) {
578
647
  const { plan, review_type, context } = input;
@@ -633,6 +702,12 @@ createReviewTool(server, {
633
702
  inputSchema: planReviewSchema,
634
703
  handler: (input) => handlePlanReview(client, input)
635
704
  });
705
+ createReviewTool(server, {
706
+ name: "review_git_changes",
707
+ description: "Review git changes (staged, unstaged, diff, or specific commit) using multiple AI models in parallel",
708
+ inputSchema: gitReviewSchema,
709
+ handler: (input) => handleGitReview(client, CODE_REVIEW_MODELS, input)
710
+ });
636
711
  server.registerTool(
637
712
  "list_review_config",
638
713
  { description: "Show current model configuration" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klitchevo/code-council",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "Multi-model AI code review server using OpenRouter - get diverse perspectives from multiple LLMs in parallel",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",