@j0hanz/code-review-analyst-mcp 1.4.4 → 1.5.0
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 +8 -8
- package/dist/lib/gemini.js +25 -8
- package/dist/lib/model-config.d.ts +33 -38
- package/dist/lib/model-config.js +55 -88
- package/dist/lib/tool-contracts.d.ts +22 -22
- package/dist/lib/tool-contracts.js +8 -8
- package/dist/lib/tool-factory.d.ts +3 -3
- package/dist/lib/tool-factory.js +2 -2
- package/dist/lib/types.d.ts +1 -1
- package/dist/prompts/index.js +3 -3
- package/dist/resources/instructions.js +3 -3
- package/dist/resources/server-config.js +4 -4
- package/dist/resources/tool-info.js +4 -4
- package/dist/schemas/outputs.d.ts +7 -7
- package/dist/tools/analyze-complexity.js +3 -3
- package/dist/tools/analyze-pr-impact.js +4 -2
- package/dist/tools/detect-api-breaking.js +3 -3
- package/dist/tools/generate-review-summary.js +4 -2
- package/dist/tools/generate-test-plan.js +4 -2
- package/dist/tools/inspect-code-quality.js +4 -2
- package/dist/tools/suggest-search-replace.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ This server accepts unified diffs and returns structured JSON results — findin
|
|
|
18
18
|
|
|
19
19
|
- **Impact Analysis** — Objective severity scoring, breaking change detection, and rollback complexity assessment.
|
|
20
20
|
- **Review Summary** — Concise PR digest with merge recommendation and change statistics.
|
|
21
|
-
- **Deep Code Inspection** — Pro model with
|
|
21
|
+
- **Deep Code Inspection** — Pro model with high thinking level for context-aware analysis using full file contents.
|
|
22
22
|
- **Search & Replace Fixes** — Verbatim, copy-paste-ready code fixes tied to specific findings.
|
|
23
23
|
- **Test Plan Generation** — Systematic test case generation with priority ranking and pseudocode.
|
|
24
24
|
- **Async Task Support** — All tools support MCP task lifecycle with progress notifications.
|
|
@@ -385,13 +385,13 @@ Create a test plan covering the changes in the diff using the Flash model with t
|
|
|
385
385
|
|
|
386
386
|
### Models
|
|
387
387
|
|
|
388
|
-
| Tool | Model
|
|
389
|
-
| ------------------------- |
|
|
390
|
-
| `analyze_pr_impact` | `gemini-
|
|
391
|
-
| `generate_review_summary` | `gemini-
|
|
392
|
-
| `inspect_code_quality` | `gemini-
|
|
393
|
-
| `suggest_search_replace` | `gemini-
|
|
394
|
-
| `generate_test_plan` | `gemini-
|
|
388
|
+
| Tool | Model | Thinking Level |
|
|
389
|
+
| ------------------------- | ------------------------ | -------------- |
|
|
390
|
+
| `analyze_pr_impact` | `gemini-3-flash-preview` | `minimal` |
|
|
391
|
+
| `generate_review_summary` | `gemini-3-flash-preview` | `minimal` |
|
|
392
|
+
| `inspect_code_quality` | `gemini-3-pro-preview` | `high` |
|
|
393
|
+
| `suggest_search_replace` | `gemini-3-pro-preview` | `high` |
|
|
394
|
+
| `generate_test_plan` | `gemini-3-flash-preview` | `medium` |
|
|
395
395
|
|
|
396
396
|
## Workflows
|
|
397
397
|
|
package/dist/lib/gemini.js
CHANGED
|
@@ -4,12 +4,12 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { performance } from 'node:perf_hooks';
|
|
5
5
|
import { setTimeout as sleep } from 'node:timers/promises';
|
|
6
6
|
import { debuglog } from 'node:util';
|
|
7
|
-
import { FinishReason, GoogleGenAI, HarmBlockThreshold, HarmCategory, } from '@google/genai';
|
|
7
|
+
import { FinishReason, GoogleGenAI, HarmBlockThreshold, HarmCategory, ThinkingLevel, } from '@google/genai';
|
|
8
8
|
import { createCachedEnvInt } from './env-config.js';
|
|
9
9
|
import { getErrorMessage, RETRYABLE_UPSTREAM_ERROR_PATTERN } from './errors.js';
|
|
10
10
|
// Lazy-cached: first call happens after parseCommandLineArgs() sets GEMINI_MODEL.
|
|
11
11
|
let _defaultModel;
|
|
12
|
-
const DEFAULT_MODEL = 'gemini-
|
|
12
|
+
const DEFAULT_MODEL = 'gemini-3-flash-preview';
|
|
13
13
|
const GEMINI_MODEL_ENV_VAR = 'GEMINI_MODEL';
|
|
14
14
|
const GEMINI_HARM_BLOCK_THRESHOLD_ENV_VAR = 'GEMINI_HARM_BLOCK_THRESHOLD';
|
|
15
15
|
const GEMINI_INCLUDE_THOUGHTS_ENV_VAR = 'GEMINI_INCLUDE_THOUGHTS';
|
|
@@ -91,14 +91,31 @@ function parseSafetyThreshold(threshold) {
|
|
|
91
91
|
}
|
|
92
92
|
return SAFETY_THRESHOLD_BY_NAME[normalizedThreshold];
|
|
93
93
|
}
|
|
94
|
-
function getThinkingConfig(
|
|
95
|
-
if (
|
|
94
|
+
function getThinkingConfig(thinkingLevel, includeThoughts) {
|
|
95
|
+
if (thinkingLevel === undefined && !includeThoughts) {
|
|
96
96
|
return undefined;
|
|
97
97
|
}
|
|
98
|
+
const config = {};
|
|
99
|
+
if (thinkingLevel !== undefined) {
|
|
100
|
+
switch (thinkingLevel) {
|
|
101
|
+
case 'minimal':
|
|
102
|
+
config.thinkingLevel = ThinkingLevel.MINIMAL;
|
|
103
|
+
break;
|
|
104
|
+
case 'low':
|
|
105
|
+
config.thinkingLevel = ThinkingLevel.LOW;
|
|
106
|
+
break;
|
|
107
|
+
case 'medium':
|
|
108
|
+
config.thinkingLevel = ThinkingLevel.MEDIUM;
|
|
109
|
+
break;
|
|
110
|
+
case 'high':
|
|
111
|
+
config.thinkingLevel = ThinkingLevel.HIGH;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
98
115
|
if (includeThoughts) {
|
|
99
|
-
|
|
116
|
+
config.includeThoughts = true;
|
|
100
117
|
}
|
|
101
|
-
return
|
|
118
|
+
return config;
|
|
102
119
|
}
|
|
103
120
|
function parseBooleanEnv(value) {
|
|
104
121
|
const normalized = value.trim().toLowerCase();
|
|
@@ -300,9 +317,9 @@ function getRetryDelayMs(attempt) {
|
|
|
300
317
|
}
|
|
301
318
|
function buildGenerationConfig(request, abortSignal) {
|
|
302
319
|
const includeThoughts = request.includeThoughts ?? getDefaultIncludeThoughts();
|
|
303
|
-
const thinkingConfig = getThinkingConfig(request.
|
|
320
|
+
const thinkingConfig = getThinkingConfig(request.thinkingLevel, includeThoughts);
|
|
304
321
|
const config = {
|
|
305
|
-
temperature: request.temperature ?? 0
|
|
322
|
+
temperature: request.temperature ?? 1.0,
|
|
306
323
|
maxOutputTokens: request.maxOutputTokens ?? DEFAULT_MAX_OUTPUT_TOKENS,
|
|
307
324
|
responseMimeType: 'application/json',
|
|
308
325
|
responseSchema: request.responseSchema,
|
|
@@ -1,44 +1,39 @@
|
|
|
1
1
|
/** Fast, cost-effective model for summarization and light analysis. */
|
|
2
|
-
export declare const FLASH_MODEL = "gemini-
|
|
2
|
+
export declare const FLASH_MODEL = "gemini-3-flash-preview";
|
|
3
3
|
/** High-capability model for deep reasoning, quality inspection, and reliable code generation. */
|
|
4
|
-
export declare const PRO_MODEL = "gemini-
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
export declare const FLASH_TRIAGE_THINKING_BUDGET: 0;
|
|
12
|
-
/** Thinking budget (tokens) for Flash analysis tasks (test plans, complexity). */
|
|
13
|
-
export declare const FLASH_THINKING_BUDGET: 16384;
|
|
14
|
-
/** Thinking budget (tokens) for Pro model deep-analysis tasks (quality, patches). */
|
|
15
|
-
export declare const PRO_THINKING_BUDGET: 24576;
|
|
16
|
-
/** Output cap for Flash triage tools (impact, summary). */
|
|
17
|
-
export declare const FLASH_TRIAGE_MAX_OUTPUT_TOKENS: 4096;
|
|
18
|
-
/** Output cap for API breaking-change detection (migration guidance needs room). */
|
|
19
|
-
export declare const FLASH_API_BREAKING_MAX_OUTPUT_TOKENS: 4096;
|
|
20
|
-
/** Output cap for test-plan generation (includes pseudocode snippets). */
|
|
21
|
-
export declare const FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS: 8192;
|
|
22
|
-
/** Output cap for Pro deep review findings. */
|
|
23
|
-
export declare const PRO_REVIEW_MAX_OUTPUT_TOKENS: 12288;
|
|
24
|
-
/** Output cap for Pro search/replace remediation blocks. */
|
|
25
|
-
export declare const PRO_PATCH_MAX_OUTPUT_TOKENS: 8192;
|
|
26
|
-
/** Output cap for Flash complexity analysis reports. */
|
|
27
|
-
export declare const FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS: 2048;
|
|
28
|
-
/** Extended timeout for Pro model calls (ms). Pro thinks longer than Flash. */
|
|
4
|
+
export declare const PRO_MODEL = "gemini-3-pro-preview";
|
|
5
|
+
/** Default language hint. */
|
|
6
|
+
export declare const DEFAULT_LANGUAGE = "detect";
|
|
7
|
+
/** Default test-framework hint. */
|
|
8
|
+
export declare const DEFAULT_FRAMEWORK = "detect";
|
|
9
|
+
/** Extended timeout for Pro model calls (ms). */
|
|
29
10
|
export declare const DEFAULT_TIMEOUT_PRO_MS = 120000;
|
|
30
|
-
/** Temperature for triage/classification tools (deterministic structured extraction). */
|
|
31
|
-
export declare const TRIAGE_TEMPERATURE: 0.1;
|
|
32
|
-
/** Temperature for analytical tools (consistent algorithmic reasoning). */
|
|
33
|
-
export declare const ANALYSIS_TEMPERATURE: 0.1;
|
|
34
|
-
/** Temperature for code patch generation (maximum precision for search blocks). */
|
|
35
|
-
export declare const PATCH_TEMPERATURE: 0;
|
|
36
|
-
/** Temperature for creative synthesis tools (test plan generation). */
|
|
37
|
-
export declare const CREATIVE_TEMPERATURE: 0.2;
|
|
38
11
|
export declare const MODEL_TIMEOUT_MS: {
|
|
39
12
|
readonly defaultPro: 120000;
|
|
40
13
|
};
|
|
41
|
-
/**
|
|
42
|
-
export declare const
|
|
43
|
-
/**
|
|
44
|
-
export declare const
|
|
14
|
+
/** Thinking level for Flash triage. */
|
|
15
|
+
export declare const FLASH_TRIAGE_THINKING_LEVEL: "minimal";
|
|
16
|
+
/** Thinking level for Flash analysis. */
|
|
17
|
+
export declare const FLASH_THINKING_LEVEL: "medium";
|
|
18
|
+
/** Thinking level for Pro deep analysis. */
|
|
19
|
+
export declare const PRO_THINKING_LEVEL: "high";
|
|
20
|
+
/** Output cap for Flash API breaking-change detection. */
|
|
21
|
+
export declare const FLASH_API_BREAKING_MAX_OUTPUT_TOKENS: 4096;
|
|
22
|
+
/** Output cap for Flash complexity analysis. */
|
|
23
|
+
export declare const FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS: 2048;
|
|
24
|
+
/** Output cap for Flash test-plan generation. */
|
|
25
|
+
export declare const FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS: 8192;
|
|
26
|
+
/** Output cap for Flash triage tools. */
|
|
27
|
+
export declare const FLASH_TRIAGE_MAX_OUTPUT_TOKENS: 4096;
|
|
28
|
+
/** Output cap for Pro patch generation. */
|
|
29
|
+
export declare const PRO_PATCH_MAX_OUTPUT_TOKENS: 8192;
|
|
30
|
+
/** Output cap for Pro deep review findings. */
|
|
31
|
+
export declare const PRO_REVIEW_MAX_OUTPUT_TOKENS: 12288;
|
|
32
|
+
/** Temperature for analytical tools. */
|
|
33
|
+
export declare const ANALYSIS_TEMPERATURE: 1;
|
|
34
|
+
/** Temperature for creative synthesis (test plans). */
|
|
35
|
+
export declare const CREATIVE_TEMPERATURE: 1;
|
|
36
|
+
/** Temperature for code patch generation. */
|
|
37
|
+
export declare const PATCH_TEMPERATURE: 1;
|
|
38
|
+
/** Temperature for triage/classification tools. */
|
|
39
|
+
export declare const TRIAGE_TEMPERATURE: 1;
|
package/dist/lib/model-config.js
CHANGED
|
@@ -1,104 +1,71 @@
|
|
|
1
1
|
/** Fast, cost-effective model for summarization and light analysis. */
|
|
2
|
-
export const FLASH_MODEL = 'gemini-
|
|
2
|
+
export const FLASH_MODEL = 'gemini-3-flash-preview';
|
|
3
3
|
/** High-capability model for deep reasoning, quality inspection, and reliable code generation. */
|
|
4
|
-
export const PRO_MODEL = 'gemini-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
4
|
+
export const PRO_MODEL = 'gemini-3-pro-preview';
|
|
5
|
+
/** Default hint for auto-detection. */
|
|
6
|
+
const DEFAULT_DETECT_HINT = 'detect';
|
|
7
|
+
/** Default language hint. */
|
|
8
|
+
export const DEFAULT_LANGUAGE = DEFAULT_DETECT_HINT;
|
|
9
|
+
/** Default test-framework hint. */
|
|
10
|
+
export const DEFAULT_FRAMEWORK = DEFAULT_DETECT_HINT;
|
|
11
|
+
/** Extended timeout for Pro model calls (ms). */
|
|
12
|
+
export const DEFAULT_TIMEOUT_PRO_MS = 120_000;
|
|
13
|
+
export const MODEL_TIMEOUT_MS = {
|
|
14
|
+
defaultPro: DEFAULT_TIMEOUT_PRO_MS,
|
|
15
|
+
};
|
|
16
|
+
Object.freeze(MODEL_TIMEOUT_MS);
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Budgets (Thinking & Output)
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
const THINKING_LEVELS = {
|
|
21
|
+
/** Minimal thinking for triage/classification. */
|
|
22
|
+
flashTriage: 'minimal',
|
|
23
|
+
/** Medium thinking for analysis tasks. */
|
|
24
|
+
flash: 'medium',
|
|
25
|
+
/** High thinking for deep review and patches. */
|
|
26
|
+
pro: 'high',
|
|
23
27
|
};
|
|
28
|
+
// Thinking budget in tokens for Flash and Pro tools. Note that these are not hard limits, but rather guidelines to encourage concise responses and manage latency/cost.
|
|
24
29
|
const OUTPUT_TOKEN_BUDGET = {
|
|
25
|
-
flashTriage: 4_096,
|
|
26
|
-
/**
|
|
27
|
-
* Raised from 4_096: 15 test cases × pseudoCode@2_000 chars ≈ 7_500 tokens;
|
|
28
|
-
* staying at 4_096 risked MAX_TOKENS truncation on moderate test plans.
|
|
29
|
-
*/
|
|
30
|
-
flashTestPlan: 8_192,
|
|
31
30
|
flashApiBreaking: 4_096,
|
|
32
31
|
flashComplexity: 2_048,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* exceed 8_192 tokens for rich, high-finding-count reviews.
|
|
36
|
-
*/
|
|
37
|
-
proReview: 12_288,
|
|
38
|
-
/**
|
|
39
|
-
* Raised from 4_096: 10 search/replace blocks with multi-line code context
|
|
40
|
-
* can exceed the previous cap and cause MAX_TOKENS truncation.
|
|
41
|
-
*/
|
|
32
|
+
flashTestPlan: 8_192,
|
|
33
|
+
flashTriage: 4_096,
|
|
42
34
|
proPatch: 8_192,
|
|
35
|
+
proReview: 12_288,
|
|
43
36
|
};
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/** Triage/classification tasks — deterministic structured extraction. */
|
|
52
|
-
triage: 0.1,
|
|
53
|
-
/** Analytical reasoning — consistent algorithmic analysis. */
|
|
54
|
-
analysis: 0.1,
|
|
55
|
-
/** Code patch generation — maximum precision for exact-match search blocks. */
|
|
56
|
-
patch: 0.0,
|
|
57
|
-
/** Test plan generation — allow modest diversity in test-case synthesis. */
|
|
58
|
-
creative: 0.2,
|
|
59
|
-
};
|
|
60
|
-
const DEFAULT_DETECT_HINT = 'detect';
|
|
61
|
-
/**
|
|
62
|
-
* Thinking budget (tokens) for Flash triage tools (impact, summary, API-breaking).
|
|
63
|
-
* Explicitly disabled (0) — these are classification/extraction tasks that do not
|
|
64
|
-
* benefit from a reasoning chain. Avoids default dynamic-thinking overhead.
|
|
65
|
-
* Flash 2.5 range: 0–24_576.
|
|
66
|
-
*/
|
|
67
|
-
export const FLASH_TRIAGE_THINKING_BUDGET = THINKING_BUDGET_TOKENS.flashTriage;
|
|
68
|
-
/** Thinking budget (tokens) for Flash analysis tasks (test plans, complexity). */
|
|
69
|
-
export const FLASH_THINKING_BUDGET = THINKING_BUDGET_TOKENS.flash;
|
|
70
|
-
/** Thinking budget (tokens) for Pro model deep-analysis tasks (quality, patches). */
|
|
71
|
-
export const PRO_THINKING_BUDGET = THINKING_BUDGET_TOKENS.pro;
|
|
72
|
-
/** Output cap for Flash triage tools (impact, summary). */
|
|
73
|
-
export const FLASH_TRIAGE_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.flashTriage;
|
|
74
|
-
/** Output cap for API breaking-change detection (migration guidance needs room). */
|
|
37
|
+
/** Thinking level for Flash triage. */
|
|
38
|
+
export const FLASH_TRIAGE_THINKING_LEVEL = THINKING_LEVELS.flashTriage;
|
|
39
|
+
/** Thinking level for Flash analysis. */
|
|
40
|
+
export const FLASH_THINKING_LEVEL = THINKING_LEVELS.flash;
|
|
41
|
+
/** Thinking level for Pro deep analysis. */
|
|
42
|
+
export const PRO_THINKING_LEVEL = THINKING_LEVELS.pro;
|
|
43
|
+
/** Output cap for Flash API breaking-change detection. */
|
|
75
44
|
export const FLASH_API_BREAKING_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.flashApiBreaking;
|
|
76
|
-
/** Output cap for
|
|
45
|
+
/** Output cap for Flash complexity analysis. */
|
|
46
|
+
export const FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.flashComplexity;
|
|
47
|
+
/** Output cap for Flash test-plan generation. */
|
|
77
48
|
export const FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.flashTestPlan;
|
|
49
|
+
/** Output cap for Flash triage tools. */
|
|
50
|
+
export const FLASH_TRIAGE_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.flashTriage;
|
|
51
|
+
/** Output cap for Pro patch generation. */
|
|
52
|
+
export const PRO_PATCH_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.proPatch;
|
|
78
53
|
/** Output cap for Pro deep review findings. */
|
|
79
54
|
export const PRO_REVIEW_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.proReview;
|
|
80
|
-
/** Output cap for Pro search/replace remediation blocks. */
|
|
81
|
-
export const PRO_PATCH_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.proPatch;
|
|
82
|
-
/** Output cap for Flash complexity analysis reports. */
|
|
83
|
-
export const FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.flashComplexity;
|
|
84
|
-
/** Extended timeout for Pro model calls (ms). Pro thinks longer than Flash. */
|
|
85
|
-
export const DEFAULT_TIMEOUT_PRO_MS = 120_000;
|
|
86
55
|
// ---------------------------------------------------------------------------
|
|
87
|
-
//
|
|
56
|
+
// Temperatures
|
|
88
57
|
// ---------------------------------------------------------------------------
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
58
|
+
const TOOL_TEMPERATURE = {
|
|
59
|
+
analysis: 1.0, // Gemini 3 recommends 1.0 for all tasks
|
|
60
|
+
creative: 1.0, // Gemini 3 recommends 1.0 for all tasks
|
|
61
|
+
patch: 1.0, // Gemini 3 recommends 1.0 for all tasks
|
|
62
|
+
triage: 1.0, // Gemini 3 recommends 1.0 for all tasks
|
|
63
|
+
};
|
|
64
|
+
/** Temperature for analytical tools. */
|
|
92
65
|
export const ANALYSIS_TEMPERATURE = TOOL_TEMPERATURE.analysis;
|
|
93
|
-
/** Temperature for
|
|
94
|
-
export const PATCH_TEMPERATURE = TOOL_TEMPERATURE.patch;
|
|
95
|
-
/** Temperature for creative synthesis tools (test plan generation). */
|
|
66
|
+
/** Temperature for creative synthesis (test plans). */
|
|
96
67
|
export const CREATIVE_TEMPERATURE = TOOL_TEMPERATURE.creative;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/** Default language hint when not specified by the user. Tells the model to auto-detect. */
|
|
102
|
-
export const DEFAULT_LANGUAGE = DEFAULT_DETECT_HINT;
|
|
103
|
-
/** Default test-framework hint when not specified by the user. Tells the model to auto-detect. */
|
|
104
|
-
export const DEFAULT_FRAMEWORK = DEFAULT_DETECT_HINT;
|
|
68
|
+
/** Temperature for code patch generation. */
|
|
69
|
+
export const PATCH_TEMPERATURE = TOOL_TEMPERATURE.patch;
|
|
70
|
+
/** Temperature for triage/classification tools. */
|
|
71
|
+
export const TRIAGE_TEMPERATURE = TOOL_TEMPERATURE.triage;
|
|
@@ -13,7 +13,7 @@ export interface ToolContract {
|
|
|
13
13
|
model: string;
|
|
14
14
|
/** Set to 0 for synchronous (non-Gemini) tools. */
|
|
15
15
|
timeoutMs: number;
|
|
16
|
-
|
|
16
|
+
thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high';
|
|
17
17
|
/** Set to 0 for synchronous (non-Gemini) tools. */
|
|
18
18
|
maxOutputTokens: number;
|
|
19
19
|
/**
|
|
@@ -48,11 +48,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
48
48
|
}, {
|
|
49
49
|
readonly name: "analyze_pr_impact";
|
|
50
50
|
readonly purpose: "Assess severity, categories, breaking changes, and rollback complexity.";
|
|
51
|
-
readonly model: "gemini-
|
|
51
|
+
readonly model: "gemini-3-flash-preview";
|
|
52
52
|
readonly timeoutMs: 90000;
|
|
53
|
-
readonly
|
|
53
|
+
readonly thinkingLevel: "minimal";
|
|
54
54
|
readonly maxOutputTokens: 4096;
|
|
55
|
-
readonly temperature:
|
|
55
|
+
readonly temperature: 1;
|
|
56
56
|
readonly params: readonly [{
|
|
57
57
|
readonly name: "repository";
|
|
58
58
|
readonly type: "string";
|
|
@@ -72,11 +72,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
72
72
|
}, {
|
|
73
73
|
readonly name: "generate_review_summary";
|
|
74
74
|
readonly purpose: "Produce PR summary, risk rating, and merge recommendation.";
|
|
75
|
-
readonly model: "gemini-
|
|
75
|
+
readonly model: "gemini-3-flash-preview";
|
|
76
76
|
readonly timeoutMs: 90000;
|
|
77
|
-
readonly
|
|
77
|
+
readonly thinkingLevel: "minimal";
|
|
78
78
|
readonly maxOutputTokens: 4096;
|
|
79
|
-
readonly temperature:
|
|
79
|
+
readonly temperature: 1;
|
|
80
80
|
readonly params: readonly [{
|
|
81
81
|
readonly name: "repository";
|
|
82
82
|
readonly type: "string";
|
|
@@ -96,11 +96,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
96
96
|
}, {
|
|
97
97
|
readonly name: "inspect_code_quality";
|
|
98
98
|
readonly purpose: "Deep code review with optional full-file context.";
|
|
99
|
-
readonly model: "gemini-
|
|
99
|
+
readonly model: "gemini-3-pro-preview";
|
|
100
100
|
readonly timeoutMs: 120000;
|
|
101
|
-
readonly
|
|
101
|
+
readonly thinkingLevel: "high";
|
|
102
102
|
readonly maxOutputTokens: 12288;
|
|
103
|
-
readonly temperature:
|
|
103
|
+
readonly temperature: 1;
|
|
104
104
|
readonly params: readonly [{
|
|
105
105
|
readonly name: "repository";
|
|
106
106
|
readonly type: "string";
|
|
@@ -139,11 +139,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
139
139
|
}, {
|
|
140
140
|
readonly name: "suggest_search_replace";
|
|
141
141
|
readonly purpose: "Generate verbatim search/replace fix blocks for one finding.";
|
|
142
|
-
readonly model: "gemini-
|
|
142
|
+
readonly model: "gemini-3-pro-preview";
|
|
143
143
|
readonly timeoutMs: 120000;
|
|
144
|
-
readonly
|
|
144
|
+
readonly thinkingLevel: "high";
|
|
145
145
|
readonly maxOutputTokens: 8192;
|
|
146
|
-
readonly temperature:
|
|
146
|
+
readonly temperature: 1;
|
|
147
147
|
readonly params: readonly [{
|
|
148
148
|
readonly name: "findingTitle";
|
|
149
149
|
readonly type: "string";
|
|
@@ -164,11 +164,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
164
164
|
}, {
|
|
165
165
|
readonly name: "generate_test_plan";
|
|
166
166
|
readonly purpose: "Generate prioritized test cases and coverage guidance.";
|
|
167
|
-
readonly model: "gemini-
|
|
167
|
+
readonly model: "gemini-3-flash-preview";
|
|
168
168
|
readonly timeoutMs: 90000;
|
|
169
|
-
readonly
|
|
169
|
+
readonly thinkingLevel: "medium";
|
|
170
170
|
readonly maxOutputTokens: 8192;
|
|
171
|
-
readonly temperature:
|
|
171
|
+
readonly temperature: 1;
|
|
172
172
|
readonly params: readonly [{
|
|
173
173
|
readonly name: "repository";
|
|
174
174
|
readonly type: "string";
|
|
@@ -200,11 +200,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
200
200
|
}, {
|
|
201
201
|
readonly name: "analyze_time_space_complexity";
|
|
202
202
|
readonly purpose: "Analyze Big-O complexity and detect degradations in changed code.";
|
|
203
|
-
readonly model: "gemini-
|
|
203
|
+
readonly model: "gemini-3-flash-preview";
|
|
204
204
|
readonly timeoutMs: 90000;
|
|
205
|
-
readonly
|
|
205
|
+
readonly thinkingLevel: "medium";
|
|
206
206
|
readonly maxOutputTokens: 2048;
|
|
207
|
-
readonly temperature:
|
|
207
|
+
readonly temperature: 1;
|
|
208
208
|
readonly params: readonly [{
|
|
209
209
|
readonly name: "language";
|
|
210
210
|
readonly type: "string";
|
|
@@ -218,11 +218,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
218
218
|
}, {
|
|
219
219
|
readonly name: "detect_api_breaking_changes";
|
|
220
220
|
readonly purpose: "Detect breaking API/interface changes in a diff.";
|
|
221
|
-
readonly model: "gemini-
|
|
221
|
+
readonly model: "gemini-3-flash-preview";
|
|
222
222
|
readonly timeoutMs: 90000;
|
|
223
|
-
readonly
|
|
223
|
+
readonly thinkingLevel: "minimal";
|
|
224
224
|
readonly maxOutputTokens: 4096;
|
|
225
|
-
readonly temperature:
|
|
225
|
+
readonly temperature: 1;
|
|
226
226
|
readonly params: readonly [{
|
|
227
227
|
readonly name: "language";
|
|
228
228
|
readonly type: "string";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ANALYSIS_TEMPERATURE, CREATIVE_TEMPERATURE, DEFAULT_TIMEOUT_PRO_MS, FLASH_API_BREAKING_MAX_OUTPUT_TOKENS, FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS, FLASH_MODEL, FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS,
|
|
1
|
+
import { ANALYSIS_TEMPERATURE, CREATIVE_TEMPERATURE, DEFAULT_TIMEOUT_PRO_MS, FLASH_API_BREAKING_MAX_OUTPUT_TOKENS, FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS, FLASH_MODEL, FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS, FLASH_THINKING_LEVEL, FLASH_TRIAGE_MAX_OUTPUT_TOKENS, FLASH_TRIAGE_THINKING_LEVEL, PATCH_TEMPERATURE, PRO_MODEL, PRO_PATCH_MAX_OUTPUT_TOKENS, PRO_REVIEW_MAX_OUTPUT_TOKENS, PRO_THINKING_LEVEL, TRIAGE_TEMPERATURE, } from './model-config.js';
|
|
2
2
|
const DEFAULT_TIMEOUT_FLASH_MS = 90_000;
|
|
3
3
|
export const INSPECTION_FOCUS_AREAS = [
|
|
4
4
|
'security',
|
|
@@ -40,7 +40,7 @@ export const TOOL_CONTRACTS = [
|
|
|
40
40
|
purpose: 'Assess severity, categories, breaking changes, and rollback complexity.',
|
|
41
41
|
model: FLASH_MODEL,
|
|
42
42
|
timeoutMs: DEFAULT_TIMEOUT_FLASH_MS,
|
|
43
|
-
|
|
43
|
+
thinkingLevel: FLASH_TRIAGE_THINKING_LEVEL,
|
|
44
44
|
maxOutputTokens: FLASH_TRIAGE_MAX_OUTPUT_TOKENS,
|
|
45
45
|
temperature: TRIAGE_TEMPERATURE,
|
|
46
46
|
params: [
|
|
@@ -73,7 +73,7 @@ export const TOOL_CONTRACTS = [
|
|
|
73
73
|
purpose: 'Produce PR summary, risk rating, and merge recommendation.',
|
|
74
74
|
model: FLASH_MODEL,
|
|
75
75
|
timeoutMs: DEFAULT_TIMEOUT_FLASH_MS,
|
|
76
|
-
|
|
76
|
+
thinkingLevel: FLASH_TRIAGE_THINKING_LEVEL,
|
|
77
77
|
maxOutputTokens: FLASH_TRIAGE_MAX_OUTPUT_TOKENS,
|
|
78
78
|
temperature: TRIAGE_TEMPERATURE,
|
|
79
79
|
params: [
|
|
@@ -106,7 +106,7 @@ export const TOOL_CONTRACTS = [
|
|
|
106
106
|
purpose: 'Deep code review with optional full-file context.',
|
|
107
107
|
model: PRO_MODEL,
|
|
108
108
|
timeoutMs: DEFAULT_TIMEOUT_PRO_MS,
|
|
109
|
-
|
|
109
|
+
thinkingLevel: PRO_THINKING_LEVEL,
|
|
110
110
|
maxOutputTokens: PRO_REVIEW_MAX_OUTPUT_TOKENS,
|
|
111
111
|
temperature: ANALYSIS_TEMPERATURE,
|
|
112
112
|
params: [
|
|
@@ -163,7 +163,7 @@ export const TOOL_CONTRACTS = [
|
|
|
163
163
|
purpose: 'Generate verbatim search/replace fix blocks for one finding.',
|
|
164
164
|
model: PRO_MODEL,
|
|
165
165
|
timeoutMs: DEFAULT_TIMEOUT_PRO_MS,
|
|
166
|
-
|
|
166
|
+
thinkingLevel: PRO_THINKING_LEVEL,
|
|
167
167
|
maxOutputTokens: PRO_PATCH_MAX_OUTPUT_TOKENS,
|
|
168
168
|
temperature: PATCH_TEMPERATURE,
|
|
169
169
|
params: [
|
|
@@ -198,7 +198,7 @@ export const TOOL_CONTRACTS = [
|
|
|
198
198
|
purpose: 'Generate prioritized test cases and coverage guidance.',
|
|
199
199
|
model: FLASH_MODEL,
|
|
200
200
|
timeoutMs: DEFAULT_TIMEOUT_FLASH_MS,
|
|
201
|
-
|
|
201
|
+
thinkingLevel: FLASH_THINKING_LEVEL,
|
|
202
202
|
maxOutputTokens: FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS,
|
|
203
203
|
temperature: CREATIVE_TEMPERATURE,
|
|
204
204
|
params: [
|
|
@@ -245,7 +245,7 @@ export const TOOL_CONTRACTS = [
|
|
|
245
245
|
purpose: 'Analyze Big-O complexity and detect degradations in changed code.',
|
|
246
246
|
model: FLASH_MODEL,
|
|
247
247
|
timeoutMs: DEFAULT_TIMEOUT_FLASH_MS,
|
|
248
|
-
|
|
248
|
+
thinkingLevel: FLASH_THINKING_LEVEL,
|
|
249
249
|
maxOutputTokens: FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS,
|
|
250
250
|
temperature: ANALYSIS_TEMPERATURE,
|
|
251
251
|
params: [
|
|
@@ -269,7 +269,7 @@ export const TOOL_CONTRACTS = [
|
|
|
269
269
|
purpose: 'Detect breaking API/interface changes in a diff.',
|
|
270
270
|
model: FLASH_MODEL,
|
|
271
271
|
timeoutMs: DEFAULT_TIMEOUT_FLASH_MS,
|
|
272
|
-
|
|
272
|
+
thinkingLevel: FLASH_TRIAGE_THINKING_LEVEL,
|
|
273
273
|
maxOutputTokens: FLASH_API_BREAKING_MAX_OUTPUT_TOKENS,
|
|
274
274
|
temperature: TRIAGE_TEMPERATURE,
|
|
275
275
|
params: [
|
|
@@ -55,10 +55,10 @@ export interface StructuredToolTaskConfig<TInput extends object = Record<string,
|
|
|
55
55
|
transformResult?: (input: TInput, result: TResult, ctx: ToolExecutionContext) => TFinal;
|
|
56
56
|
/** Optional validation hook for input parameters. */
|
|
57
57
|
validateInput?: (input: TInput, ctx: ToolExecutionContext) => Promise<ReturnType<typeof createErrorToolResponse> | undefined> | ReturnType<typeof createErrorToolResponse> | undefined;
|
|
58
|
-
/** Optional Gemini model to use (e.g. 'gemini-
|
|
58
|
+
/** Optional Gemini model to use (e.g. 'gemini-3-pro-preview'). */
|
|
59
59
|
model?: string;
|
|
60
|
-
/** Optional thinking
|
|
61
|
-
|
|
60
|
+
/** Optional thinking level. */
|
|
61
|
+
thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high';
|
|
62
62
|
/** Optional timeout in ms for the Gemini call. Defaults to 90,000 ms. Use DEFAULT_TIMEOUT_PRO_MS for Pro model calls. */
|
|
63
63
|
timeoutMs?: number;
|
|
64
64
|
/** Optional max output tokens for Gemini. */
|
package/dist/lib/tool-factory.js
CHANGED
|
@@ -31,8 +31,8 @@ function createGenerationRequest(config, promptParts, responseSchema, onLog, sig
|
|
|
31
31
|
if (config.model !== undefined) {
|
|
32
32
|
request.model = config.model;
|
|
33
33
|
}
|
|
34
|
-
if (config.
|
|
35
|
-
request.
|
|
34
|
+
if (config.thinkingLevel !== undefined) {
|
|
35
|
+
request.thinkingLevel = config.thinkingLevel;
|
|
36
36
|
}
|
|
37
37
|
if (config.timeoutMs !== undefined) {
|
|
38
38
|
request.timeoutMs = config.timeoutMs;
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface GeminiRequestExecutionOptions {
|
|
|
5
5
|
timeoutMs?: number;
|
|
6
6
|
temperature?: number;
|
|
7
7
|
maxOutputTokens?: number;
|
|
8
|
-
|
|
8
|
+
thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high';
|
|
9
9
|
includeThoughts?: boolean;
|
|
10
10
|
signal?: AbortSignal;
|
|
11
11
|
onLog?: GeminiLogHandler;
|
package/dist/prompts/index.js
CHANGED
|
@@ -43,9 +43,9 @@ function getToolGuide(tool) {
|
|
|
43
43
|
if (!contract) {
|
|
44
44
|
return `Use \`${tool}\` to analyze your code changes.`;
|
|
45
45
|
}
|
|
46
|
-
const {
|
|
47
|
-
const modelLine =
|
|
48
|
-
? `Model: ${contract.model} (thinking
|
|
46
|
+
const { thinkingLevel } = contract;
|
|
47
|
+
const modelLine = thinkingLevel !== undefined
|
|
48
|
+
? `Model: ${contract.model} (thinking level ${thinkingLevel}, output cap ${contract.maxOutputTokens}).`
|
|
49
49
|
: `Model: ${contract.model} (output cap ${contract.maxOutputTokens}).`;
|
|
50
50
|
return `Tool: ${contract.name}\n${modelLine}\nOutput: ${contract.outputShape}\nUse: ${contract.purpose}`;
|
|
51
51
|
}
|
|
@@ -23,9 +23,9 @@ function formatToolSection(contract) {
|
|
|
23
23
|
${parameterLines.join('\n')}
|
|
24
24
|
- Output shape: \`${contract.outputShape}\``;
|
|
25
25
|
}
|
|
26
|
-
const thinkingLine = contract.
|
|
27
|
-
? '- Thinking
|
|
28
|
-
: `- Thinking
|
|
26
|
+
const thinkingLine = contract.thinkingLevel === undefined
|
|
27
|
+
? '- Thinking level: disabled'
|
|
28
|
+
: `- Thinking level: ${contract.thinkingLevel}`;
|
|
29
29
|
return `### \`${contract.name}\`
|
|
30
30
|
- Purpose: ${contract.purpose}
|
|
31
31
|
- Model: \`${contract.model}\`
|
|
@@ -24,8 +24,8 @@ function formatNumber(value) {
|
|
|
24
24
|
function formatTimeout(ms) {
|
|
25
25
|
return `${Math.round(ms / 1_000)}s`;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function formatThinkingLevel(level) {
|
|
28
|
+
return level ?? '—';
|
|
29
29
|
}
|
|
30
30
|
export function buildServerConfig() {
|
|
31
31
|
const maxDiffChars = diffCharsConfig.get();
|
|
@@ -37,7 +37,7 @@ export function buildServerConfig() {
|
|
|
37
37
|
const toolRows = getToolContracts()
|
|
38
38
|
.filter((contract) => contract.model !== 'none')
|
|
39
39
|
.map((contract) => {
|
|
40
|
-
return `| \`${contract.name}\` | \`${contract.model}\` | ${
|
|
40
|
+
return `| \`${contract.name}\` | \`${contract.model}\` | ${formatThinkingLevel(contract.thinkingLevel)} | ${formatTimeout(contract.timeoutMs)} | ${formatNumber(contract.maxOutputTokens)} |`;
|
|
41
41
|
})
|
|
42
42
|
.join('\n');
|
|
43
43
|
return `# Server Configuration
|
|
@@ -55,7 +55,7 @@ export function buildServerConfig() {
|
|
|
55
55
|
|
|
56
56
|
Default model: \`${defaultModel}\` (override with \`GEMINI_MODEL\`)
|
|
57
57
|
|
|
58
|
-
| Tool | Model | Thinking
|
|
58
|
+
| Tool | Model | Thinking Level | Timeout | Max Output Tokens |
|
|
59
59
|
|------|-------|----------------|---------|-------------------|
|
|
60
60
|
${toolRows}
|
|
61
61
|
|
|
@@ -10,8 +10,8 @@ function formatNumber(value) {
|
|
|
10
10
|
function formatTimeout(timeoutMs) {
|
|
11
11
|
return `${Math.round(timeoutMs / 1_000)}s`;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function formatThinkingLevel(thinkingLevel) {
|
|
14
|
+
return thinkingLevel ?? '-';
|
|
15
15
|
}
|
|
16
16
|
function formatOutputTokens(maxOutputTokens) {
|
|
17
17
|
return formatNumber(maxOutputTokens);
|
|
@@ -29,7 +29,7 @@ function toToolInfoEntry(contract) {
|
|
|
29
29
|
name: contract.name,
|
|
30
30
|
purpose: contract.purpose,
|
|
31
31
|
model: contract.model,
|
|
32
|
-
|
|
32
|
+
thinkingLevel: formatThinkingLevel(contract.thinkingLevel),
|
|
33
33
|
timeout: formatTimeout(contract.timeoutMs),
|
|
34
34
|
maxOutputTokens: formatOutputTokens(contract.maxOutputTokens),
|
|
35
35
|
params: parameterRows.join('\n'),
|
|
@@ -62,7 +62,7 @@ function formatToolInfo(entry) {
|
|
|
62
62
|
${entry.purpose}
|
|
63
63
|
|
|
64
64
|
## Model
|
|
65
|
-
\`${entry.model}\` (thinking
|
|
65
|
+
\`${entry.model}\` (thinking level: ${entry.thinkingLevel}, timeout: ${entry.timeout}, max output tokens: ${entry.maxOutputTokens})
|
|
66
66
|
|
|
67
67
|
## Parameters
|
|
68
68
|
${entry.params}
|
|
@@ -18,9 +18,9 @@ export declare const DefaultOutputSchema: z.ZodObject<{
|
|
|
18
18
|
}, z.core.$strict>;
|
|
19
19
|
export declare const ReviewFindingSchema: z.ZodObject<{
|
|
20
20
|
severity: z.ZodEnum<{
|
|
21
|
-
low: "low";
|
|
22
21
|
medium: "medium";
|
|
23
22
|
high: "high";
|
|
23
|
+
low: "low";
|
|
24
24
|
critical: "critical";
|
|
25
25
|
}>;
|
|
26
26
|
file: z.ZodString;
|
|
@@ -31,9 +31,9 @@ export declare const ReviewFindingSchema: z.ZodObject<{
|
|
|
31
31
|
}, z.core.$strict>;
|
|
32
32
|
export declare const PrImpactResultSchema: z.ZodObject<{
|
|
33
33
|
severity: z.ZodEnum<{
|
|
34
|
-
low: "low";
|
|
35
34
|
medium: "medium";
|
|
36
35
|
high: "high";
|
|
36
|
+
low: "low";
|
|
37
37
|
critical: "critical";
|
|
38
38
|
}>;
|
|
39
39
|
categories: z.ZodArray<z.ZodEnum<{
|
|
@@ -61,9 +61,9 @@ export declare const PrImpactResultSchema: z.ZodObject<{
|
|
|
61
61
|
export declare const ReviewSummaryResultSchema: z.ZodObject<{
|
|
62
62
|
summary: z.ZodString;
|
|
63
63
|
overallRisk: z.ZodEnum<{
|
|
64
|
-
low: "low";
|
|
65
64
|
medium: "medium";
|
|
66
65
|
high: "high";
|
|
66
|
+
low: "low";
|
|
67
67
|
}>;
|
|
68
68
|
keyChanges: z.ZodArray<z.ZodString>;
|
|
69
69
|
recommendation: z.ZodString;
|
|
@@ -76,16 +76,16 @@ export declare const ReviewSummaryResultSchema: z.ZodObject<{
|
|
|
76
76
|
export declare const CodeQualityResultSchema: z.ZodObject<{
|
|
77
77
|
summary: z.ZodString;
|
|
78
78
|
overallRisk: z.ZodEnum<{
|
|
79
|
-
low: "low";
|
|
80
79
|
medium: "medium";
|
|
81
80
|
high: "high";
|
|
81
|
+
low: "low";
|
|
82
82
|
critical: "critical";
|
|
83
83
|
}>;
|
|
84
84
|
findings: z.ZodArray<z.ZodObject<{
|
|
85
85
|
severity: z.ZodEnum<{
|
|
86
|
-
low: "low";
|
|
87
86
|
medium: "medium";
|
|
88
87
|
high: "high";
|
|
88
|
+
low: "low";
|
|
89
89
|
critical: "critical";
|
|
90
90
|
}>;
|
|
91
91
|
file: z.ZodString;
|
|
@@ -101,16 +101,16 @@ export declare const CodeQualityOutputSchema: z.ZodObject<{
|
|
|
101
101
|
totalFindings: z.ZodOptional<z.ZodNumber>;
|
|
102
102
|
summary: z.ZodString;
|
|
103
103
|
overallRisk: z.ZodEnum<{
|
|
104
|
-
low: "low";
|
|
105
104
|
medium: "medium";
|
|
106
105
|
high: "high";
|
|
106
|
+
low: "low";
|
|
107
107
|
critical: "critical";
|
|
108
108
|
}>;
|
|
109
109
|
findings: z.ZodArray<z.ZodObject<{
|
|
110
110
|
severity: z.ZodEnum<{
|
|
111
|
-
low: "low";
|
|
112
111
|
medium: "medium";
|
|
113
112
|
high: "high";
|
|
113
|
+
low: "low";
|
|
114
114
|
critical: "critical";
|
|
115
115
|
}>;
|
|
116
116
|
file: z.ZodString;
|
|
@@ -23,8 +23,8 @@ export function registerAnalyzeComplexityTool(server) {
|
|
|
23
23
|
model: TOOL_CONTRACT.model,
|
|
24
24
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
25
25
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
26
|
-
...(TOOL_CONTRACT.
|
|
27
|
-
? {
|
|
26
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
27
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
28
28
|
: undefined),
|
|
29
29
|
...(TOOL_CONTRACT.temperature !== undefined
|
|
30
30
|
? { temperature: TOOL_CONTRACT.temperature }
|
|
@@ -46,7 +46,7 @@ export function registerAnalyzeComplexityTool(server) {
|
|
|
46
46
|
: '';
|
|
47
47
|
return {
|
|
48
48
|
systemInstruction: SYSTEM_INSTRUCTION,
|
|
49
|
-
prompt: `${languageLine}
|
|
49
|
+
prompt: `${languageLine}\\nDiff:\\n${diff}\\n\\nBased on the diff above, analyze the Big-O time and space complexity.`.trimStart(),
|
|
50
50
|
};
|
|
51
51
|
},
|
|
52
52
|
});
|
|
@@ -27,8 +27,8 @@ export function registerAnalyzePrImpactTool(server) {
|
|
|
27
27
|
model: TOOL_CONTRACT.model,
|
|
28
28
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
29
29
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
30
|
-
...(TOOL_CONTRACT.
|
|
31
|
-
? {
|
|
30
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
31
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
32
32
|
: undefined),
|
|
33
33
|
...(TOOL_CONTRACT.temperature !== undefined
|
|
34
34
|
? { temperature: TOOL_CONTRACT.temperature }
|
|
@@ -56,6 +56,8 @@ ${fileSummary}
|
|
|
56
56
|
|
|
57
57
|
Diff:
|
|
58
58
|
${diff}
|
|
59
|
+
|
|
60
|
+
Based on the diff and change stats above, analyze the PR impact.
|
|
59
61
|
`,
|
|
60
62
|
};
|
|
61
63
|
},
|
|
@@ -23,8 +23,8 @@ export function registerDetectApiBreakingTool(server) {
|
|
|
23
23
|
model: TOOL_CONTRACT.model,
|
|
24
24
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
25
25
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
26
|
-
...(TOOL_CONTRACT.
|
|
27
|
-
? {
|
|
26
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
27
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
28
28
|
: undefined),
|
|
29
29
|
...(TOOL_CONTRACT.temperature !== undefined
|
|
30
30
|
? { temperature: TOOL_CONTRACT.temperature }
|
|
@@ -46,7 +46,7 @@ export function registerDetectApiBreakingTool(server) {
|
|
|
46
46
|
: '';
|
|
47
47
|
return {
|
|
48
48
|
systemInstruction: SYSTEM_INSTRUCTION,
|
|
49
|
-
prompt: `${languageLine}
|
|
49
|
+
prompt: `${languageLine}\\nDiff:\\n${diff}\\n\\nBased on the diff above, detect any breaking API changes.`.trimStart(),
|
|
50
50
|
};
|
|
51
51
|
},
|
|
52
52
|
});
|
|
@@ -34,8 +34,8 @@ export function registerGenerateReviewSummaryTool(server) {
|
|
|
34
34
|
model: TOOL_CONTRACT.model,
|
|
35
35
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
36
36
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
37
|
-
...(TOOL_CONTRACT.
|
|
38
|
-
? {
|
|
37
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
38
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
39
39
|
: undefined),
|
|
40
40
|
...(TOOL_CONTRACT.temperature !== undefined
|
|
41
41
|
? { temperature: TOOL_CONTRACT.temperature }
|
|
@@ -70,6 +70,8 @@ Stats: ${files} files, +${added}, -${deleted}
|
|
|
70
70
|
|
|
71
71
|
Diff:
|
|
72
72
|
${diff}
|
|
73
|
+
|
|
74
|
+
Based on the diff and stats above, summarize the PR and provide a merge recommendation.
|
|
73
75
|
`,
|
|
74
76
|
};
|
|
75
77
|
},
|
|
@@ -27,8 +27,8 @@ export function registerGenerateTestPlanTool(server) {
|
|
|
27
27
|
model: TOOL_CONTRACT.model,
|
|
28
28
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
29
29
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
30
|
-
...(TOOL_CONTRACT.
|
|
31
|
-
? {
|
|
30
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
31
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
32
32
|
: undefined),
|
|
33
33
|
...(TOOL_CONTRACT.temperature !== undefined
|
|
34
34
|
? { temperature: TOOL_CONTRACT.temperature }
|
|
@@ -61,6 +61,8 @@ Changed Files: ${paths.join(', ')}
|
|
|
61
61
|
|
|
62
62
|
Diff:
|
|
63
63
|
${diff}
|
|
64
|
+
|
|
65
|
+
Based on the diff and stats above, generate an actionable test plan.
|
|
64
66
|
`,
|
|
65
67
|
};
|
|
66
68
|
},
|
|
@@ -63,8 +63,8 @@ export function registerInspectCodeQualityTool(server) {
|
|
|
63
63
|
model: TOOL_CONTRACT.model,
|
|
64
64
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
65
65
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
66
|
-
...(TOOL_CONTRACT.
|
|
67
|
-
? {
|
|
66
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
67
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
68
68
|
: undefined),
|
|
69
69
|
...(TOOL_CONTRACT.temperature !== undefined
|
|
70
70
|
? { temperature: TOOL_CONTRACT.temperature }
|
|
@@ -117,6 +117,8 @@ ${fileSummary}
|
|
|
117
117
|
Diff:
|
|
118
118
|
${diff}
|
|
119
119
|
${fileContext}
|
|
120
|
+
|
|
121
|
+
Based on the diff and file context above, perform a deep code review focusing on the specified areas.
|
|
120
122
|
`,
|
|
121
123
|
};
|
|
122
124
|
},
|
|
@@ -27,8 +27,8 @@ export function registerSuggestSearchReplaceTool(server) {
|
|
|
27
27
|
model: TOOL_CONTRACT.model,
|
|
28
28
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
29
29
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
30
|
-
...(TOOL_CONTRACT.
|
|
31
|
-
? {
|
|
30
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
31
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
32
32
|
: undefined),
|
|
33
33
|
...(TOOL_CONTRACT.temperature !== undefined
|
|
34
34
|
? { temperature: TOOL_CONTRACT.temperature }
|
|
@@ -58,6 +58,8 @@ Changed Files: ${paths.join(', ')}
|
|
|
58
58
|
|
|
59
59
|
Diff:
|
|
60
60
|
${diff}
|
|
61
|
+
|
|
62
|
+
Based on the diff and finding details above, generate minimal search-and-replace blocks to fix the issue.
|
|
61
63
|
`,
|
|
62
64
|
};
|
|
63
65
|
},
|