@klitchevo/code-council 0.0.1 → 0.0.2
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 +48 -16
- package/dist/index.d.ts +0 -6
- package/dist/index.js +627 -57
- package/package.json +4 -3
- package/dist/config.d.ts +0 -48
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -61
- package/dist/constants.d.ts +0 -33
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -36
- package/dist/errors.d.ts +0 -53
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -92
- package/dist/index.d.ts.map +0 -1
- package/dist/logger.d.ts +0 -22
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -62
- package/dist/prompts/backend-review.d.ts +0 -6
- package/dist/prompts/backend-review.d.ts.map +0 -1
- package/dist/prompts/backend-review.js +0 -28
- package/dist/prompts/code-review.d.ts +0 -6
- package/dist/prompts/code-review.d.ts.map +0 -1
- package/dist/prompts/code-review.js +0 -18
- package/dist/prompts/frontend-review.d.ts +0 -6
- package/dist/prompts/frontend-review.d.ts.map +0 -1
- package/dist/prompts/frontend-review.js +0 -28
- package/dist/prompts/plan-review.d.ts +0 -6
- package/dist/prompts/plan-review.d.ts.map +0 -1
- package/dist/prompts/plan-review.js +0 -29
- package/dist/review-client.d.ts +0 -75
- package/dist/review-client.d.ts.map +0 -1
- package/dist/review-client.js +0 -116
- package/dist/schemas.d.ts +0 -60
- package/dist/schemas.d.ts.map +0 -1
- package/dist/schemas.js +0 -46
- package/dist/tools/factory.d.ts +0 -20
- package/dist/tools/factory.d.ts.map +0 -1
- package/dist/tools/factory.js +0 -55
- package/dist/tools/list-config.d.ts +0 -9
- package/dist/tools/list-config.d.ts.map +0 -1
- package/dist/tools/list-config.js +0 -31
- package/dist/tools/review-backend.d.ts +0 -22
- package/dist/tools/review-backend.d.ts.map +0 -1
- package/dist/tools/review-backend.js +0 -38
- package/dist/tools/review-code.d.ts +0 -15
- package/dist/tools/review-code.d.ts.map +0 -1
- package/dist/tools/review-code.js +0 -29
- package/dist/tools/review-frontend.d.ts +0 -22
- package/dist/tools/review-frontend.d.ts.map +0 -1
- package/dist/tools/review-frontend.js +0 -38
- package/dist/tools/review-plan.d.ts +0 -22
- package/dist/tools/review-plan.d.ts.map +0 -1
- package/dist/tools/review-plan.js +0 -35
- package/dist/utils/parallel-executor.d.ts +0 -10
- package/dist/utils/parallel-executor.d.ts.map +0 -1
- package/dist/utils/parallel-executor.js +0 -21
package/dist/review-client.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Multi-model review client for code, frontend, backend, and plan reviews
|
|
3
|
-
* Uses OpenRouter API to access multiple LLM providers
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Result from a single model's review.
|
|
7
|
-
* Either contains a review or an error, never both.
|
|
8
|
-
*/
|
|
9
|
-
export interface ModelReviewResult {
|
|
10
|
-
/** The model identifier (e.g., "anthropic/claude-3.5-sonnet") */
|
|
11
|
-
model: string;
|
|
12
|
-
/** The review content from the model */
|
|
13
|
-
review: string;
|
|
14
|
-
/** Error message if the review failed */
|
|
15
|
-
error?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Client for performing multi-model code reviews.
|
|
19
|
-
* Supports parallel execution across multiple AI models for diverse perspectives.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* const client = new ReviewClient(process.env.OPENROUTER_API_KEY);
|
|
24
|
-
* const results = await client.reviewCode(
|
|
25
|
-
* 'function add(a, b) { return a + b; }',
|
|
26
|
-
* ['anthropic/claude-3.5-sonnet', 'openai/gpt-4-turbo'],
|
|
27
|
-
* 'JavaScript addition function'
|
|
28
|
-
* );
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare class ReviewClient {
|
|
32
|
-
private client;
|
|
33
|
-
constructor(apiKey: string);
|
|
34
|
-
/**
|
|
35
|
-
* Send a chat request to OpenRouter API
|
|
36
|
-
* @param model - Model identifier (e.g., "anthropic/claude-3.5-sonnet")
|
|
37
|
-
* @param systemPrompt - System prompt for the model
|
|
38
|
-
* @param userMessage - User message/question
|
|
39
|
-
* @returns The model's response content
|
|
40
|
-
* @throws {OpenRouterError} If the API call fails
|
|
41
|
-
*/
|
|
42
|
-
private chat;
|
|
43
|
-
/**
|
|
44
|
-
* Review code for quality, bugs, performance, and security
|
|
45
|
-
* @param code - Code to review
|
|
46
|
-
* @param models - Array of model identifiers to use
|
|
47
|
-
* @param context - Optional context (language, description, etc.)
|
|
48
|
-
* @returns Array of review results from each model
|
|
49
|
-
*/
|
|
50
|
-
reviewCode(code: string, models: string[], context?: string): Promise<ModelReviewResult[]>;
|
|
51
|
-
/**
|
|
52
|
-
* Review frontend code for accessibility, performance, and UX
|
|
53
|
-
*/
|
|
54
|
-
reviewFrontend(code: string, models: string[], options?: {
|
|
55
|
-
framework?: string;
|
|
56
|
-
reviewType?: "accessibility" | "performance" | "ux" | "full";
|
|
57
|
-
context?: string;
|
|
58
|
-
}): Promise<ModelReviewResult[]>;
|
|
59
|
-
/**
|
|
60
|
-
* Review backend code for security, performance, and architecture
|
|
61
|
-
*/
|
|
62
|
-
reviewBackend(code: string, models: string[], options?: {
|
|
63
|
-
language?: string;
|
|
64
|
-
reviewType?: "security" | "performance" | "architecture" | "full";
|
|
65
|
-
context?: string;
|
|
66
|
-
}): Promise<ModelReviewResult[]>;
|
|
67
|
-
/**
|
|
68
|
-
* Review implementation plans before code is written
|
|
69
|
-
*/
|
|
70
|
-
reviewPlan(plan: string, models: string[], options?: {
|
|
71
|
-
reviewType?: "feasibility" | "completeness" | "risks" | "timeline" | "full";
|
|
72
|
-
context?: string;
|
|
73
|
-
}): Promise<ModelReviewResult[]>;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=review-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review-client.d.ts","sourceRoot":"","sources":["../src/review-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,YAAY;IACxB,OAAO,CAAC,MAAM,CAAa;gBAEf,MAAM,EAAE,MAAM;IAM1B;;;;;;;OAOG;YACW,IAAI;IAoDlB;;;;;;OAMG;IACG,UAAU,CACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAQ/B;;OAEG;IACG,cAAc,CACnB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,CAAC,EAAE;QACT,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,eAAe,GAAG,aAAa,GAAG,IAAI,GAAG,MAAM,CAAC;QAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;KACjB,GACC,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAa/B;;OAEG;IACG,aAAa,CAClB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,UAAU,GAAG,aAAa,GAAG,cAAc,GAAG,MAAM,CAAC;QAClE,OAAO,CAAC,EAAE,MAAM,CAAC;KACjB,GACC,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAa/B;;OAEG;IACG,UAAU,CACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,CAAC,EAAE;QACT,UAAU,CAAC,EACR,aAAa,GACb,cAAc,GACd,OAAO,GACP,UAAU,GACV,MAAM,CAAC;QACV,OAAO,CAAC,EAAE,MAAM,CAAC;KACjB,GACC,OAAO,CAAC,iBAAiB,EAAE,CAAC;CAW/B"}
|
package/dist/review-client.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Multi-model review client for code, frontend, backend, and plan reviews
|
|
3
|
-
* Uses OpenRouter API to access multiple LLM providers
|
|
4
|
-
*/
|
|
5
|
-
import { OpenRouter } from "@openrouter/sdk";
|
|
6
|
-
import { LLM_CONFIG } from "./constants";
|
|
7
|
-
import { OpenRouterError } from "./errors";
|
|
8
|
-
import { logger } from "./logger";
|
|
9
|
-
import * as backendReviewPrompts from "./prompts/backend-review";
|
|
10
|
-
import * as codeReviewPrompts from "./prompts/code-review";
|
|
11
|
-
import * as frontendReviewPrompts from "./prompts/frontend-review";
|
|
12
|
-
import * as planReviewPrompts from "./prompts/plan-review";
|
|
13
|
-
import { executeInParallel } from "./utils/parallel-executor";
|
|
14
|
-
/**
|
|
15
|
-
* Client for performing multi-model code reviews.
|
|
16
|
-
* Supports parallel execution across multiple AI models for diverse perspectives.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const client = new ReviewClient(process.env.OPENROUTER_API_KEY);
|
|
21
|
-
* const results = await client.reviewCode(
|
|
22
|
-
* 'function add(a, b) { return a + b; }',
|
|
23
|
-
* ['anthropic/claude-3.5-sonnet', 'openai/gpt-4-turbo'],
|
|
24
|
-
* 'JavaScript addition function'
|
|
25
|
-
* );
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export class ReviewClient {
|
|
29
|
-
client;
|
|
30
|
-
constructor(apiKey) {
|
|
31
|
-
this.client = new OpenRouter({
|
|
32
|
-
apiKey,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Send a chat request to OpenRouter API
|
|
37
|
-
* @param model - Model identifier (e.g., "anthropic/claude-3.5-sonnet")
|
|
38
|
-
* @param systemPrompt - System prompt for the model
|
|
39
|
-
* @param userMessage - User message/question
|
|
40
|
-
* @returns The model's response content
|
|
41
|
-
* @throws {OpenRouterError} If the API call fails
|
|
42
|
-
*/
|
|
43
|
-
async chat(model, systemPrompt, userMessage) {
|
|
44
|
-
try {
|
|
45
|
-
logger.debug("Sending chat request", {
|
|
46
|
-
model,
|
|
47
|
-
messageLength: userMessage.length,
|
|
48
|
-
});
|
|
49
|
-
const response = await this.client.chat.send({
|
|
50
|
-
model,
|
|
51
|
-
messages: [
|
|
52
|
-
{ role: "system", content: systemPrompt },
|
|
53
|
-
{ role: "user", content: userMessage },
|
|
54
|
-
],
|
|
55
|
-
temperature: LLM_CONFIG.DEFAULT_TEMPERATURE,
|
|
56
|
-
maxTokens: LLM_CONFIG.DEFAULT_MAX_TOKENS,
|
|
57
|
-
});
|
|
58
|
-
const content = response.choices?.[0]?.message?.content;
|
|
59
|
-
if (typeof content === "string") {
|
|
60
|
-
logger.debug("Received response", { model, length: content.length });
|
|
61
|
-
return content;
|
|
62
|
-
}
|
|
63
|
-
if (Array.isArray(content)) {
|
|
64
|
-
const text = content
|
|
65
|
-
.filter((item) => item.type === "text")
|
|
66
|
-
.map((item) => item.text)
|
|
67
|
-
.join("\n");
|
|
68
|
-
logger.debug("Received array response", { model, length: text.length });
|
|
69
|
-
return text;
|
|
70
|
-
}
|
|
71
|
-
throw new OpenRouterError("No response content from model", 500);
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
if (error instanceof OpenRouterError) {
|
|
75
|
-
throw error;
|
|
76
|
-
}
|
|
77
|
-
const message = error instanceof Error ? error.message : "Unknown error";
|
|
78
|
-
logger.error("Chat request failed", error, { model });
|
|
79
|
-
const isRetryable = message.includes("429") || message.includes("rate limit");
|
|
80
|
-
throw new OpenRouterError(message, undefined, isRetryable);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Review code for quality, bugs, performance, and security
|
|
85
|
-
* @param code - Code to review
|
|
86
|
-
* @param models - Array of model identifiers to use
|
|
87
|
-
* @param context - Optional context (language, description, etc.)
|
|
88
|
-
* @returns Array of review results from each model
|
|
89
|
-
*/
|
|
90
|
-
async reviewCode(code, models, context) {
|
|
91
|
-
const userMessage = codeReviewPrompts.buildUserMessage(code, context);
|
|
92
|
-
return executeInParallel(models, (model) => this.chat(model, codeReviewPrompts.SYSTEM_PROMPT, userMessage));
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Review frontend code for accessibility, performance, and UX
|
|
96
|
-
*/
|
|
97
|
-
async reviewFrontend(code, models, options) {
|
|
98
|
-
const userMessage = frontendReviewPrompts.buildUserMessage(code, options?.reviewType || "full", options?.framework, options?.context);
|
|
99
|
-
return executeInParallel(models, (model) => this.chat(model, frontendReviewPrompts.SYSTEM_PROMPT, userMessage));
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Review backend code for security, performance, and architecture
|
|
103
|
-
*/
|
|
104
|
-
async reviewBackend(code, models, options) {
|
|
105
|
-
const userMessage = backendReviewPrompts.buildUserMessage(code, options?.reviewType || "full", options?.language, options?.context);
|
|
106
|
-
return executeInParallel(models, (model) => this.chat(model, backendReviewPrompts.SYSTEM_PROMPT, userMessage));
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Review implementation plans before code is written
|
|
110
|
-
*/
|
|
111
|
-
async reviewPlan(plan, models, options) {
|
|
112
|
-
const userMessage = planReviewPrompts.buildUserMessage(plan, options?.reviewType || "full", options?.context);
|
|
113
|
-
return executeInParallel(models, (model) => this.chat(model, planReviewPrompts.SYSTEM_PROMPT, userMessage));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=review-client.js.map
|
package/dist/schemas.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schemas for input validation across all tools.
|
|
3
|
-
* Validates structure and types, not arbitrary limits.
|
|
4
|
-
*/
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
/**
|
|
7
|
-
* Schema for code review input
|
|
8
|
-
*/
|
|
9
|
-
export declare const CodeReviewSchema: z.ZodObject<{
|
|
10
|
-
code: z.ZodString;
|
|
11
|
-
language: z.ZodOptional<z.ZodString>;
|
|
12
|
-
context: z.ZodOptional<z.ZodString>;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
|
-
/**
|
|
15
|
-
* Schema for frontend review input
|
|
16
|
-
*/
|
|
17
|
-
export declare const FrontendReviewSchema: z.ZodObject<{
|
|
18
|
-
code: z.ZodString;
|
|
19
|
-
framework: z.ZodOptional<z.ZodString>;
|
|
20
|
-
review_type: z.ZodOptional<z.ZodEnum<{
|
|
21
|
-
full: "full";
|
|
22
|
-
performance: "performance";
|
|
23
|
-
accessibility: "accessibility";
|
|
24
|
-
ux: "ux";
|
|
25
|
-
}>>;
|
|
26
|
-
context: z.ZodOptional<z.ZodString>;
|
|
27
|
-
}, z.core.$strip>;
|
|
28
|
-
/**
|
|
29
|
-
* Schema for backend review input
|
|
30
|
-
*/
|
|
31
|
-
export declare const BackendReviewSchema: z.ZodObject<{
|
|
32
|
-
code: z.ZodString;
|
|
33
|
-
language: z.ZodOptional<z.ZodString>;
|
|
34
|
-
review_type: z.ZodOptional<z.ZodEnum<{
|
|
35
|
-
full: "full";
|
|
36
|
-
security: "security";
|
|
37
|
-
performance: "performance";
|
|
38
|
-
architecture: "architecture";
|
|
39
|
-
}>>;
|
|
40
|
-
context: z.ZodOptional<z.ZodString>;
|
|
41
|
-
}, z.core.$strip>;
|
|
42
|
-
/**
|
|
43
|
-
* Schema for plan review input
|
|
44
|
-
*/
|
|
45
|
-
export declare const PlanReviewSchema: z.ZodObject<{
|
|
46
|
-
plan: z.ZodString;
|
|
47
|
-
review_type: z.ZodOptional<z.ZodEnum<{
|
|
48
|
-
full: "full";
|
|
49
|
-
feasibility: "feasibility";
|
|
50
|
-
completeness: "completeness";
|
|
51
|
-
risks: "risks";
|
|
52
|
-
timeline: "timeline";
|
|
53
|
-
}>>;
|
|
54
|
-
context: z.ZodOptional<z.ZodString>;
|
|
55
|
-
}, z.core.$strip>;
|
|
56
|
-
export type CodeReviewInput = z.infer<typeof CodeReviewSchema>;
|
|
57
|
-
export type FrontendReviewInput = z.infer<typeof FrontendReviewSchema>;
|
|
58
|
-
export type BackendReviewInput = z.infer<typeof BackendReviewSchema>;
|
|
59
|
-
export type PlanReviewInput = z.infer<typeof PlanReviewSchema>;
|
|
60
|
-
//# sourceMappingURL=schemas.d.ts.map
|
package/dist/schemas.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;iBAI3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;iBAO/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;iBAO9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;iBAM3B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/schemas.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schemas for input validation across all tools.
|
|
3
|
-
* Validates structure and types, not arbitrary limits.
|
|
4
|
-
*/
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
/**
|
|
7
|
-
* Schema for code review input
|
|
8
|
-
*/
|
|
9
|
-
export const CodeReviewSchema = z.object({
|
|
10
|
-
code: z.string().min(1, "Code cannot be empty"),
|
|
11
|
-
language: z.string().optional(),
|
|
12
|
-
context: z.string().optional(),
|
|
13
|
-
});
|
|
14
|
-
/**
|
|
15
|
-
* Schema for frontend review input
|
|
16
|
-
*/
|
|
17
|
-
export const FrontendReviewSchema = z.object({
|
|
18
|
-
code: z.string().min(1, "Code cannot be empty"),
|
|
19
|
-
framework: z.string().optional(),
|
|
20
|
-
review_type: z
|
|
21
|
-
.enum(["accessibility", "performance", "ux", "full"])
|
|
22
|
-
.optional(),
|
|
23
|
-
context: z.string().optional(),
|
|
24
|
-
});
|
|
25
|
-
/**
|
|
26
|
-
* Schema for backend review input
|
|
27
|
-
*/
|
|
28
|
-
export const BackendReviewSchema = z.object({
|
|
29
|
-
code: z.string().min(1, "Code cannot be empty"),
|
|
30
|
-
language: z.string().optional(),
|
|
31
|
-
review_type: z
|
|
32
|
-
.enum(["security", "performance", "architecture", "full"])
|
|
33
|
-
.optional(),
|
|
34
|
-
context: z.string().optional(),
|
|
35
|
-
});
|
|
36
|
-
/**
|
|
37
|
-
* Schema for plan review input
|
|
38
|
-
*/
|
|
39
|
-
export const PlanReviewSchema = z.object({
|
|
40
|
-
plan: z.string().min(1, "Plan cannot be empty"),
|
|
41
|
-
review_type: z
|
|
42
|
-
.enum(["feasibility", "completeness", "risks", "timeline", "full"])
|
|
43
|
-
.optional(),
|
|
44
|
-
context: z.string().optional(),
|
|
45
|
-
});
|
|
46
|
-
//# sourceMappingURL=schemas.js.map
|
package/dist/tools/factory.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool factory for creating MCP review tools with consistent error handling
|
|
3
|
-
*/
|
|
4
|
-
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
-
import type { z } from "zod";
|
|
6
|
-
import type { ModelReviewResult } from "../review-client";
|
|
7
|
-
/**
|
|
8
|
-
* Create a review tool with consistent error handling and logging
|
|
9
|
-
*/
|
|
10
|
-
export declare function createReviewTool(server: McpServer, config: {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
inputSchema: Record<string, z.ZodType<unknown>>;
|
|
14
|
-
handler: (input: Record<string, unknown>) => Promise<{
|
|
15
|
-
results: ModelReviewResult[];
|
|
16
|
-
models: string[];
|
|
17
|
-
reviewType?: string;
|
|
18
|
-
}>;
|
|
19
|
-
}): void;
|
|
20
|
-
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/tools/factory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AA2B1D;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE;IACP,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAChD,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;QACpD,OAAO,EAAE,iBAAiB,EAAE,CAAC;QAC7B,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;CACH,GACC,IAAI,CA0CN"}
|
package/dist/tools/factory.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool factory for creating MCP review tools with consistent error handling
|
|
3
|
-
*/
|
|
4
|
-
import { formatError } from "../errors";
|
|
5
|
-
import { logger } from "../logger";
|
|
6
|
-
/**
|
|
7
|
-
* Format review results into a readable markdown string
|
|
8
|
-
*/
|
|
9
|
-
function formatResults(results) {
|
|
10
|
-
return results
|
|
11
|
-
.map((r) => {
|
|
12
|
-
if (r.error) {
|
|
13
|
-
return `## Review from \`${r.model}\`\n\n**Error:** ${r.error}`;
|
|
14
|
-
}
|
|
15
|
-
return `## Review from \`${r.model}\`\n\n${r.review}`;
|
|
16
|
-
})
|
|
17
|
-
.join("\n\n---\n\n");
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Create a review tool with consistent error handling and logging
|
|
21
|
-
*/
|
|
22
|
-
export function createReviewTool(server, config) {
|
|
23
|
-
server.registerTool(config.name, {
|
|
24
|
-
description: config.description,
|
|
25
|
-
inputSchema: config.inputSchema,
|
|
26
|
-
}, async (input) => {
|
|
27
|
-
try {
|
|
28
|
-
logger.debug(`Starting ${config.name}`, {
|
|
29
|
-
inputKeys: Object.keys(input),
|
|
30
|
-
});
|
|
31
|
-
const { results, models, reviewType } = await config.handler(input);
|
|
32
|
-
logger.info(`Completed ${config.name}`, {
|
|
33
|
-
modelCount: models.length,
|
|
34
|
-
successCount: results.filter((r) => !r.error).length,
|
|
35
|
-
errorCount: results.filter((r) => r.error).length,
|
|
36
|
-
});
|
|
37
|
-
const title = reviewType
|
|
38
|
-
? `# ${config.name.replace("review_", "").replace("_", " ")} Review - ${reviewType} (${models.length} models)`
|
|
39
|
-
: `# ${config.name.replace("review_", "").replace("_", " ")} Review Results (${models.length} models)`;
|
|
40
|
-
return {
|
|
41
|
-
content: [
|
|
42
|
-
{
|
|
43
|
-
type: "text",
|
|
44
|
-
text: `${title}\n\n${formatResults(results)}`,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
logger.error(`Error in ${config.name}`, error instanceof Error ? error : new Error(String(error)));
|
|
51
|
-
return formatError(error);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=factory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-config.d.ts","sourceRoot":"","sources":["../../src/tools/list-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,wBAAsB,gBAAgB;;;;GA0BrC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* List configuration tool - shows current model configuration
|
|
3
|
-
*/
|
|
4
|
-
import { BACKEND_REVIEW_MODELS, CODE_REVIEW_MODELS, FRONTEND_REVIEW_MODELS, PLAN_REVIEW_MODELS, } from "../config";
|
|
5
|
-
export async function handleListConfig() {
|
|
6
|
-
const text = `## Current Configuration
|
|
7
|
-
|
|
8
|
-
**Code Review Models:**
|
|
9
|
-
${CODE_REVIEW_MODELS.map((m) => `- \`${m}\``).join("\n")}
|
|
10
|
-
|
|
11
|
-
**Frontend Review Models:**
|
|
12
|
-
${FRONTEND_REVIEW_MODELS.map((m) => `- \`${m}\``).join("\n")}
|
|
13
|
-
|
|
14
|
-
**Backend Review Models:**
|
|
15
|
-
${BACKEND_REVIEW_MODELS.map((m) => `- \`${m}\``).join("\n")}
|
|
16
|
-
|
|
17
|
-
**Plan Review Models:**
|
|
18
|
-
${PLAN_REVIEW_MODELS.map((m) => `- \`${m}\``).join("\n")}
|
|
19
|
-
|
|
20
|
-
To customize models, set environment variables in your MCP config:
|
|
21
|
-
- CODE_REVIEW_MODELS
|
|
22
|
-
- FRONTEND_REVIEW_MODELS
|
|
23
|
-
- BACKEND_REVIEW_MODELS
|
|
24
|
-
- PLAN_REVIEW_MODELS`;
|
|
25
|
-
return {
|
|
26
|
-
results: [],
|
|
27
|
-
models: [],
|
|
28
|
-
text,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=list-config.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Backend review tool - reviews backend code for security, performance, architecture
|
|
3
|
-
*/
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import type { ReviewClient } from "../review-client";
|
|
6
|
-
export declare const backendReviewSchema: {
|
|
7
|
-
code: z.ZodString;
|
|
8
|
-
language: z.ZodOptional<z.ZodString>;
|
|
9
|
-
review_type: z.ZodOptional<z.ZodEnum<{
|
|
10
|
-
full: "full";
|
|
11
|
-
security: "security";
|
|
12
|
-
performance: "performance";
|
|
13
|
-
architecture: "architecture";
|
|
14
|
-
}>>;
|
|
15
|
-
context: z.ZodOptional<z.ZodString>;
|
|
16
|
-
};
|
|
17
|
-
export declare function handleBackendReview(client: ReviewClient, input: Record<string, unknown>): Promise<{
|
|
18
|
-
results: import("../review-client").ModelReviewResult[];
|
|
19
|
-
models: string[];
|
|
20
|
-
reviewType: "full" | "security" | "performance" | "architecture";
|
|
21
|
-
}>;
|
|
22
|
-
//# sourceMappingURL=review-backend.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review-backend.d.ts","sourceRoot":"","sources":["../../src/tools/review-backend.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,eAAO,MAAM,mBAAmB;;;;;;;;;;CAW/B,CAAC;AAEF,wBAAsB,mBAAmB,CACxC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;GA2B9B"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Backend review tool - reviews backend code for security, performance, architecture
|
|
3
|
-
*/
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { BACKEND_REVIEW_MODELS } from "../config";
|
|
6
|
-
import { logger } from "../logger";
|
|
7
|
-
export const backendReviewSchema = {
|
|
8
|
-
code: z.string().describe("The backend code to review"),
|
|
9
|
-
language: z
|
|
10
|
-
.string()
|
|
11
|
-
.optional()
|
|
12
|
-
.describe("Programming language/framework (e.g., node, python, go, rust)"),
|
|
13
|
-
review_type: z
|
|
14
|
-
.enum(["security", "performance", "architecture", "full"])
|
|
15
|
-
.optional()
|
|
16
|
-
.describe("Type of review to perform (default: full)"),
|
|
17
|
-
context: z.string().optional().describe("Additional context"),
|
|
18
|
-
};
|
|
19
|
-
export async function handleBackendReview(client, input) {
|
|
20
|
-
const { code, language, review_type, context } = input;
|
|
21
|
-
logger.info("Running backend review", {
|
|
22
|
-
modelCount: BACKEND_REVIEW_MODELS.length,
|
|
23
|
-
models: BACKEND_REVIEW_MODELS,
|
|
24
|
-
language,
|
|
25
|
-
reviewType: review_type || "full",
|
|
26
|
-
});
|
|
27
|
-
const results = await client.reviewBackend(code, BACKEND_REVIEW_MODELS, {
|
|
28
|
-
language,
|
|
29
|
-
reviewType: review_type,
|
|
30
|
-
context,
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
results,
|
|
34
|
-
models: BACKEND_REVIEW_MODELS,
|
|
35
|
-
reviewType: review_type || "full",
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=review-backend.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Code review tool - reviews code for quality, bugs, performance, and security
|
|
3
|
-
*/
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import type { ReviewClient } from "../review-client";
|
|
6
|
-
export declare const codeReviewSchema: {
|
|
7
|
-
code: z.ZodString;
|
|
8
|
-
language: z.ZodOptional<z.ZodString>;
|
|
9
|
-
context: z.ZodOptional<z.ZodString>;
|
|
10
|
-
};
|
|
11
|
-
export declare function handleCodeReview(client: ReviewClient, input: Record<string, unknown>): Promise<{
|
|
12
|
-
results: import("../review-client").ModelReviewResult[];
|
|
13
|
-
models: string[];
|
|
14
|
-
}>;
|
|
15
|
-
//# sourceMappingURL=review-code.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review-code.d.ts","sourceRoot":"","sources":["../../src/tools/review-code.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;GA6B9B"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Code review tool - reviews code for quality, bugs, performance, and security
|
|
3
|
-
*/
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { CODE_REVIEW_MODELS } from "../config";
|
|
6
|
-
import { logger } from "../logger";
|
|
7
|
-
export const codeReviewSchema = {
|
|
8
|
-
code: z.string().describe("The code to review"),
|
|
9
|
-
language: z.string().optional().describe("Programming language of the code"),
|
|
10
|
-
context: z.string().optional().describe("Additional context about the code"),
|
|
11
|
-
};
|
|
12
|
-
export async function handleCodeReview(client, input) {
|
|
13
|
-
const { code, language, context } = input;
|
|
14
|
-
const fullContext = language
|
|
15
|
-
? `Language: ${language}${context ? `\n${context}` : ""}`
|
|
16
|
-
: context;
|
|
17
|
-
logger.info("Running code review", {
|
|
18
|
-
modelCount: CODE_REVIEW_MODELS.length,
|
|
19
|
-
models: CODE_REVIEW_MODELS,
|
|
20
|
-
hasLanguage: !!language,
|
|
21
|
-
hasContext: !!context,
|
|
22
|
-
});
|
|
23
|
-
const results = await client.reviewCode(code, CODE_REVIEW_MODELS, fullContext);
|
|
24
|
-
return {
|
|
25
|
-
results,
|
|
26
|
-
models: CODE_REVIEW_MODELS,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=review-code.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Frontend review tool - reviews frontend code for accessibility, performance, UX
|
|
3
|
-
*/
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import type { ReviewClient } from "../review-client";
|
|
6
|
-
export declare const frontendReviewSchema: {
|
|
7
|
-
code: z.ZodString;
|
|
8
|
-
framework: z.ZodOptional<z.ZodString>;
|
|
9
|
-
review_type: z.ZodOptional<z.ZodEnum<{
|
|
10
|
-
full: "full";
|
|
11
|
-
performance: "performance";
|
|
12
|
-
accessibility: "accessibility";
|
|
13
|
-
ux: "ux";
|
|
14
|
-
}>>;
|
|
15
|
-
context: z.ZodOptional<z.ZodString>;
|
|
16
|
-
};
|
|
17
|
-
export declare function handleFrontendReview(client: ReviewClient, input: Record<string, unknown>): Promise<{
|
|
18
|
-
results: import("../review-client").ModelReviewResult[];
|
|
19
|
-
models: string[];
|
|
20
|
-
reviewType: "full" | "performance" | "accessibility" | "ux";
|
|
21
|
-
}>;
|
|
22
|
-
//# sourceMappingURL=review-frontend.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review-frontend.d.ts","sourceRoot":"","sources":["../../src/tools/review-frontend.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,eAAO,MAAM,oBAAoB;;;;;;;;;;CAWhC,CAAC;AAEF,wBAAsB,oBAAoB,CACzC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;GA2B9B"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Frontend review tool - reviews frontend code for accessibility, performance, UX
|
|
3
|
-
*/
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { FRONTEND_REVIEW_MODELS } from "../config";
|
|
6
|
-
import { logger } from "../logger";
|
|
7
|
-
export const frontendReviewSchema = {
|
|
8
|
-
code: z.string().describe("The frontend code to review"),
|
|
9
|
-
framework: z
|
|
10
|
-
.string()
|
|
11
|
-
.optional()
|
|
12
|
-
.describe("Frontend framework (e.g., react, vue, svelte)"),
|
|
13
|
-
review_type: z
|
|
14
|
-
.enum(["accessibility", "performance", "ux", "full"])
|
|
15
|
-
.optional()
|
|
16
|
-
.describe("Type of review to perform (default: full)"),
|
|
17
|
-
context: z.string().optional().describe("Additional context"),
|
|
18
|
-
};
|
|
19
|
-
export async function handleFrontendReview(client, input) {
|
|
20
|
-
const { code, framework, review_type, context } = input;
|
|
21
|
-
logger.info("Running frontend review", {
|
|
22
|
-
modelCount: FRONTEND_REVIEW_MODELS.length,
|
|
23
|
-
models: FRONTEND_REVIEW_MODELS,
|
|
24
|
-
framework,
|
|
25
|
-
reviewType: review_type || "full",
|
|
26
|
-
});
|
|
27
|
-
const results = await client.reviewFrontend(code, FRONTEND_REVIEW_MODELS, {
|
|
28
|
-
framework,
|
|
29
|
-
reviewType: review_type,
|
|
30
|
-
context,
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
results,
|
|
34
|
-
models: FRONTEND_REVIEW_MODELS,
|
|
35
|
-
reviewType: review_type || "full",
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=review-frontend.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plan review tool - reviews implementation plans before coding
|
|
3
|
-
*/
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import type { ReviewClient } from "../review-client";
|
|
6
|
-
export declare const planReviewSchema: {
|
|
7
|
-
plan: z.ZodString;
|
|
8
|
-
review_type: z.ZodOptional<z.ZodEnum<{
|
|
9
|
-
full: "full";
|
|
10
|
-
feasibility: "feasibility";
|
|
11
|
-
completeness: "completeness";
|
|
12
|
-
risks: "risks";
|
|
13
|
-
timeline: "timeline";
|
|
14
|
-
}>>;
|
|
15
|
-
context: z.ZodOptional<z.ZodString>;
|
|
16
|
-
};
|
|
17
|
-
export declare function handlePlanReview(client: ReviewClient, input: Record<string, unknown>): Promise<{
|
|
18
|
-
results: import("../review-client").ModelReviewResult[];
|
|
19
|
-
models: string[];
|
|
20
|
-
reviewType: "full" | "feasibility" | "completeness" | "risks" | "timeline";
|
|
21
|
-
}>;
|
|
22
|
-
//# sourceMappingURL=review-plan.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review-plan.d.ts","sourceRoot":"","sources":["../../src/tools/review-plan.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,eAAO,MAAM,gBAAgB;;;;;;;;;;CAU5B,CAAC;AAEF,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;GA6B9B"}
|