@commitsage/mcp-server 1.0.1 → 1.1.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 +56 -0
- package/dist/models/errors.d.ts +0 -12
- package/dist/models/errors.d.ts.map +1 -1
- package/dist/models/errors.js +0 -24
- package/dist/models/errors.js.map +1 -1
- package/dist/models/types.d.ts +0 -19
- package/dist/models/types.d.ts.map +1 -1
- package/dist/models/types.js.map +1 -1
- package/dist/server/mcpServer.d.ts.map +1 -1
- package/dist/server/mcpServer.js +2 -6
- package/dist/server/mcpServer.js.map +1 -1
- package/dist/server/tools.d.ts +1 -4
- package/dist/server/tools.d.ts.map +1 -1
- package/dist/server/tools.js +20 -18
- package/dist/server/tools.js.map +1 -1
- package/dist/services/baseAIService.d.ts +15 -26
- package/dist/services/baseAIService.d.ts.map +1 -1
- package/dist/services/baseAIService.js +53 -62
- package/dist/services/baseAIService.js.map +1 -1
- package/dist/services/codestralService.d.ts.map +1 -1
- package/dist/services/codestralService.js +11 -35
- package/dist/services/codestralService.js.map +1 -1
- package/dist/services/geminiService.d.ts +2 -6
- package/dist/services/geminiService.d.ts.map +1 -1
- package/dist/services/geminiService.js +61 -84
- package/dist/services/geminiService.js.map +1 -1
- package/dist/services/ollamaService.d.ts +1 -2
- package/dist/services/ollamaService.d.ts.map +1 -1
- package/dist/services/ollamaService.js +16 -35
- package/dist/services/ollamaService.js.map +1 -1
- package/dist/services/openaiService.d.ts +0 -1
- package/dist/services/openaiService.d.ts.map +1 -1
- package/dist/services/openaiService.js +12 -33
- package/dist/services/openaiService.js.map +1 -1
- package/dist/utils/config.d.ts +1 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +3 -0
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/httpUtils.d.ts +1 -2
- package/dist/utils/httpUtils.d.ts.map +1 -1
- package/dist/utils/httpUtils.js +7 -8
- package/dist/utils/httpUtils.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -202,6 +202,7 @@ Zed will call the `generate_commit_message` tool and show you the result.
|
|
|
202
202
|
| `DEFAULT_COMMIT_FORMAT` | Default commit format | `conventional` | No |
|
|
203
203
|
| `DEFAULT_COMMIT_LANGUAGE` | Default language | `english` | No |
|
|
204
204
|
| `API_REQUEST_TIMEOUT` | API timeout in seconds | `30` | No |
|
|
205
|
+
| `ONLY_STAGED` | Analyze only staged changes | `false` | No |
|
|
205
206
|
| `LOG_LEVEL` | Logging level | `info` | No |
|
|
206
207
|
| `USE_CUSTOM_INSTRUCTIONS` | Enable custom instructions | `false` | No |
|
|
207
208
|
| `CUSTOM_INSTRUCTIONS` | Custom prompt instructions | - | If `USE_CUSTOM_INSTRUCTIONS` is `true` |
|
|
@@ -241,6 +242,52 @@ npm install
|
|
|
241
242
|
npm run dev
|
|
242
243
|
```
|
|
243
244
|
|
|
245
|
+
### Run locally via index.ts
|
|
246
|
+
|
|
247
|
+
You can run the MCP server directly from source using `tsx`:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
GEMINI_API_KEY=your-key npx tsx src/index.ts
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
On Windows (PowerShell):
|
|
254
|
+
|
|
255
|
+
```powershell
|
|
256
|
+
$env:GEMINI_API_KEY="your-key"; npx tsx src/index.ts
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
You can also point your MCP client to the local source instead of the npm package:
|
|
260
|
+
|
|
261
|
+
```json
|
|
262
|
+
{
|
|
263
|
+
"mcpServers": {
|
|
264
|
+
"commitsage": {
|
|
265
|
+
"command": "npx",
|
|
266
|
+
"args": ["tsx", "/absolute/path/to/CommitSage-MCP/src/index.ts"],
|
|
267
|
+
"env": {
|
|
268
|
+
"GEMINI_API_KEY": "your-api-key-here"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Or use the compiled version after `npm run build`:
|
|
276
|
+
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"mcpServers": {
|
|
280
|
+
"commitsage": {
|
|
281
|
+
"command": "node",
|
|
282
|
+
"args": ["/absolute/path/to/CommitSage-MCP/dist/index.js"],
|
|
283
|
+
"env": {
|
|
284
|
+
"GEMINI_API_KEY": "your-api-key-here"
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
244
291
|
### Build
|
|
245
292
|
|
|
246
293
|
```bash
|
|
@@ -354,6 +401,15 @@ Built on top of the [CommitSage VSCode Extension](https://marketplace.visualstud
|
|
|
354
401
|
|
|
355
402
|
## Changelog
|
|
356
403
|
|
|
404
|
+
### v1.1.0 (2026-02-07)
|
|
405
|
+
|
|
406
|
+
- **Security:** Gemini API key moved from URL query parameter to `x-goog-api-key` header
|
|
407
|
+
- **Security:** Removed unused `apiKey` parameter from `validate_api_key` tool
|
|
408
|
+
- **Feature:** Added `ONLY_STAGED` environment variable to analyze only staged changes
|
|
409
|
+
- **UX:** Tool descriptions now specify that `repoPath` must be an absolute path
|
|
410
|
+
- **Refactor:** Unified AI service logic via shared `BaseAIService.generateWithRetry` method, reducing code duplication across OpenAI, Codestral, Ollama, and Gemini services
|
|
411
|
+
- **Cleanup:** Removed unused interfaces (`IAIService`, `GitDiffOptions`, `CommitMessageOptions`, `AnalyzeChangesOptions`), error classes (`NoRepositoriesFoundError`, `NoRepositorySelectedError`, `UserCancelledError`, `AIServiceError`), and dead code
|
|
412
|
+
|
|
357
413
|
### v1.0.0 (2026-02-06)
|
|
358
414
|
|
|
359
415
|
- Initial release
|
package/dist/models/errors.d.ts
CHANGED
|
@@ -4,18 +4,9 @@
|
|
|
4
4
|
export declare class GitExtensionNotFoundError extends Error {
|
|
5
5
|
constructor();
|
|
6
6
|
}
|
|
7
|
-
export declare class NoRepositoriesFoundError extends Error {
|
|
8
|
-
constructor();
|
|
9
|
-
}
|
|
10
7
|
export declare class NoChangesDetectedError extends Error {
|
|
11
8
|
constructor();
|
|
12
9
|
}
|
|
13
|
-
export declare class NoRepositorySelectedError extends Error {
|
|
14
|
-
constructor();
|
|
15
|
-
}
|
|
16
|
-
export declare class UserCancelledError extends Error {
|
|
17
|
-
constructor(message?: string);
|
|
18
|
-
}
|
|
19
10
|
export declare class ApiKeyInvalidError extends Error {
|
|
20
11
|
constructor(provider: string);
|
|
21
12
|
}
|
|
@@ -25,9 +16,6 @@ export declare class InvalidRepositoryPathError extends Error {
|
|
|
25
16
|
export declare class GitCommandError extends Error {
|
|
26
17
|
constructor(command: string, exitCode: number, stderr: string);
|
|
27
18
|
}
|
|
28
|
-
export declare class AIServiceError extends Error {
|
|
29
|
-
constructor(provider: string, message: string);
|
|
30
|
-
}
|
|
31
19
|
export declare class TimeoutError extends Error {
|
|
32
20
|
constructor(operation: string, timeoutMs: number);
|
|
33
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/models/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,yBAA0B,SAAQ,KAAK;;CAKnD;AAED,qBAAa,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/models/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,yBAA0B,SAAQ,KAAK;;CAKnD;AAED,qBAAa,sBAAuB,SAAQ,KAAK;;CAKhD;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,QAAQ,EAAE,MAAM;CAI7B;AAED,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAO1C;AAED,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAM9D;AAED,qBAAa,YAAa,SAAQ,KAAK;gBACzB,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAIjD"}
|
package/dist/models/errors.js
CHANGED
|
@@ -7,30 +7,12 @@ export class GitExtensionNotFoundError extends Error {
|
|
|
7
7
|
this.name = "GitExtensionNotFoundError";
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export class NoRepositoriesFoundError extends Error {
|
|
11
|
-
constructor() {
|
|
12
|
-
super("No Git repositories found");
|
|
13
|
-
this.name = "NoRepositoriesFoundError";
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
10
|
export class NoChangesDetectedError extends Error {
|
|
17
11
|
constructor() {
|
|
18
12
|
super("No changes detected in the repository");
|
|
19
13
|
this.name = "NoChangesDetectedError";
|
|
20
14
|
}
|
|
21
15
|
}
|
|
22
|
-
export class NoRepositorySelectedError extends Error {
|
|
23
|
-
constructor() {
|
|
24
|
-
super("No repository selected");
|
|
25
|
-
this.name = "NoRepositorySelectedError";
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export class UserCancelledError extends Error {
|
|
29
|
-
constructor(message = "Operation cancelled by user") {
|
|
30
|
-
super(message);
|
|
31
|
-
this.name = "UserCancelledError";
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
16
|
export class ApiKeyInvalidError extends Error {
|
|
35
17
|
constructor(provider) {
|
|
36
18
|
super(`Invalid or expired API key for ${provider}`);
|
|
@@ -52,12 +34,6 @@ export class GitCommandError extends Error {
|
|
|
52
34
|
this.name = "GitCommandError";
|
|
53
35
|
}
|
|
54
36
|
}
|
|
55
|
-
export class AIServiceError extends Error {
|
|
56
|
-
constructor(provider, message) {
|
|
57
|
-
super(`AI Service error (${provider}): ${message}`);
|
|
58
|
-
this.name = "AIServiceError";
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
37
|
export class TimeoutError extends Error {
|
|
62
38
|
constructor(operation, timeoutMs) {
|
|
63
39
|
super(`Operation timed out: ${operation} (timeout: ${timeoutMs}ms)`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/models/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD;QACE,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/models/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD;QACE,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C;QACE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,QAAgB;QAC1B,KAAK,CAAC,kCAAkC,QAAQ,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,YAAY,IAAY,EAAE,MAAe;QACvC,MAAM,OAAO,GAAG,MAAM;YACpB,CAAC,CAAC,4BAA4B,IAAI,aAAa,MAAM,EAAE;YACvD,CAAC,CAAC,4BAA4B,IAAI,EAAE,CAAC;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;IAC3C,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe,EAAE,QAAgB,EAAE,MAAc;QAC3D,KAAK,CACH,uBAAuB,OAAO,gBAAgB,QAAQ,YAAY,MAAM,EAAE,CAC3E,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,SAAiB,EAAE,SAAiB;QAC9C,KAAK,CAAC,wBAAwB,SAAS,cAAc,SAAS,KAAK,CAAC,CAAC;QACrE,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF"}
|
package/dist/models/types.d.ts
CHANGED
|
@@ -11,25 +11,6 @@ export interface ProgressReporter {
|
|
|
11
11
|
increment?: number;
|
|
12
12
|
}): void;
|
|
13
13
|
}
|
|
14
|
-
export interface IAIService {
|
|
15
|
-
generateCommitMessage(prompt: string, progress: ProgressReporter, attempt?: number): Promise<CommitMessage>;
|
|
16
|
-
}
|
|
17
|
-
export interface GitDiffOptions {
|
|
18
|
-
repoPath: string;
|
|
19
|
-
onlyStaged?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface CommitMessageOptions {
|
|
22
|
-
repoPath: string;
|
|
23
|
-
provider?: string;
|
|
24
|
-
format?: string;
|
|
25
|
-
language?: string;
|
|
26
|
-
onlyStaged?: boolean;
|
|
27
|
-
customInstructions?: string;
|
|
28
|
-
}
|
|
29
|
-
export interface AnalyzeChangesOptions {
|
|
30
|
-
repoPath: string;
|
|
31
|
-
onlyStaged?: boolean;
|
|
32
|
-
}
|
|
33
14
|
export declare class NoopProgressReporter implements ProgressReporter {
|
|
34
15
|
report(_value: {
|
|
35
16
|
message?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/models/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,KAAK,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC/D;AAED,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/models/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,KAAK,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC/D;AAED,qBAAa,oBAAqB,YAAW,gBAAgB;IAC3D,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAG/D"}
|
package/dist/models/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/models/types.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/models/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,MAAM,OAAO,oBAAoB;IAC/B,MAAM,CAAC,MAAgD;QACrD,uBAAuB;IACzB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../../src/server/mcpServer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAS;;IAmBvB,OAAO,CAAC,iBAAiB;
|
|
1
|
+
{"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../../src/server/mcpServer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAS;;IAmBvB,OAAO,CAAC,iBAAiB;IAqFzB,OAAO,CAAC,kBAAkB;IAkBpB,KAAK;CAoBZ"}
|
package/dist/server/mcpServer.js
CHANGED
|
@@ -29,13 +29,13 @@ export class CommitSageMCPServer {
|
|
|
29
29
|
tools: [
|
|
30
30
|
{
|
|
31
31
|
name: "generate_commit_message",
|
|
32
|
-
description: "Generate an AI-powered commit message for a Git repository. Analyzes
|
|
32
|
+
description: "Generate an AI-powered commit message for a Git repository. Analyzes changes using configuration from MCP server environment variables. Set ONLY_STAGED=true to analyze only staged changes.",
|
|
33
33
|
inputSchema: {
|
|
34
34
|
type: "object",
|
|
35
35
|
properties: {
|
|
36
36
|
repoPath: {
|
|
37
37
|
type: "string",
|
|
38
|
-
description: "
|
|
38
|
+
description: "Absolute path to the git repository (e.g. /home/user/project or C:\\Users\\user\\project)",
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
required: ["repoPath"],
|
|
@@ -52,10 +52,6 @@ export class CommitSageMCPServer {
|
|
|
52
52
|
enum: ["gemini", "openai", "codestral", "ollama"],
|
|
53
53
|
description: "Provider to validate",
|
|
54
54
|
},
|
|
55
|
-
apiKey: {
|
|
56
|
-
type: "string",
|
|
57
|
-
description: "API key to validate (optional, uses env if not provided)",
|
|
58
|
-
},
|
|
59
55
|
},
|
|
60
56
|
required: ["provider"],
|
|
61
57
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpServer.js","sourceRoot":"","sources":["../../src/server/mcpServer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAA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ACd,CAAC;IACH,CAAC;CACF"}
|
package/dist/server/tools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MCP Tools definitions for CommitSage
|
|
3
3
|
*/
|
|
4
|
-
import { z } from
|
|
4
|
+
import { z } from "zod";
|
|
5
5
|
export declare const GenerateCommitMessageSchema: z.ZodObject<{
|
|
6
6
|
repoPath: z.ZodString;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -11,13 +11,10 @@ export declare const GenerateCommitMessageSchema: z.ZodObject<{
|
|
|
11
11
|
}>;
|
|
12
12
|
export declare const ValidateApiKeySchema: z.ZodObject<{
|
|
13
13
|
provider: z.ZodEnum<["gemini", "openai", "codestral", "ollama"]>;
|
|
14
|
-
apiKey: z.ZodOptional<z.ZodString>;
|
|
15
14
|
}, "strip", z.ZodTypeAny, {
|
|
16
15
|
provider: "gemini" | "openai" | "codestral" | "ollama";
|
|
17
|
-
apiKey?: string | undefined;
|
|
18
16
|
}, {
|
|
19
17
|
provider: "gemini" | "openai" | "codestral" | "ollama";
|
|
20
|
-
apiKey?: string | undefined;
|
|
21
18
|
}>;
|
|
22
19
|
export declare function handleGenerateCommitMessage(args: z.infer<typeof GenerateCommitMessageSchema>): Promise<{
|
|
23
20
|
content: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/server/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/server/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,2BAA2B;;;;;;EAMtC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;EAI/B,CAAC;AAGH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC;;;;;;;;;;;;GA+ClD;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC;;;;;;;;;;;;GAgE3C"}
|
package/dist/server/tools.js
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MCP Tools definitions for CommitSage
|
|
3
3
|
*/
|
|
4
|
-
import { z } from
|
|
5
|
-
import { AIService } from
|
|
6
|
-
import { Logger } from
|
|
7
|
-
import { ConfigService } from
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { AIService } from "../services/aiService.js";
|
|
6
|
+
import { Logger } from "../utils/logger.js";
|
|
7
|
+
import { ConfigService } from "../utils/config.js";
|
|
8
8
|
// Tool schemas
|
|
9
9
|
export const GenerateCommitMessageSchema = z.object({
|
|
10
|
-
repoPath: z
|
|
10
|
+
repoPath: z
|
|
11
|
+
.string()
|
|
12
|
+
.describe("Absolute path to the git repository (e.g. /home/user/project or C:\\Users\\user\\project)"),
|
|
11
13
|
});
|
|
12
14
|
export const ValidateApiKeySchema = z.object({
|
|
13
15
|
provider: z
|
|
14
|
-
.enum([
|
|
15
|
-
.describe(
|
|
16
|
-
apiKey: z.string().optional().describe('API key to validate (optional, uses env if not provided)'),
|
|
16
|
+
.enum(["gemini", "openai", "codestral", "ollama"])
|
|
17
|
+
.describe("Provider to validate"),
|
|
17
18
|
});
|
|
18
19
|
// Tool handlers
|
|
19
20
|
export async function handleGenerateCommitMessage(args) {
|
|
20
21
|
try {
|
|
21
22
|
Logger.log(`Generating commit message for: ${args.repoPath}`);
|
|
22
|
-
const
|
|
23
|
+
const onlyStaged = ConfigService.getOnlyStaged();
|
|
24
|
+
const result = await AIService.generateCommitMessageForRepo(args.repoPath, onlyStaged);
|
|
23
25
|
return {
|
|
24
26
|
content: [
|
|
25
27
|
{
|
|
26
|
-
type:
|
|
28
|
+
type: "text",
|
|
27
29
|
text: JSON.stringify({
|
|
28
30
|
success: true,
|
|
29
31
|
message: result.message,
|
|
@@ -35,11 +37,11 @@ export async function handleGenerateCommitMessage(args) {
|
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
catch (error) {
|
|
38
|
-
Logger.error(
|
|
40
|
+
Logger.error("Error generating commit message:", error);
|
|
39
41
|
return {
|
|
40
42
|
content: [
|
|
41
43
|
{
|
|
42
|
-
type:
|
|
44
|
+
type: "text",
|
|
43
45
|
text: JSON.stringify({
|
|
44
46
|
success: false,
|
|
45
47
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -54,15 +56,15 @@ export async function handleValidateApiKey(args) {
|
|
|
54
56
|
try {
|
|
55
57
|
const provider = args.provider;
|
|
56
58
|
// Ollama doesn't require API key
|
|
57
|
-
if (provider ===
|
|
59
|
+
if (provider === "ollama") {
|
|
58
60
|
return {
|
|
59
61
|
content: [
|
|
60
62
|
{
|
|
61
|
-
type:
|
|
63
|
+
type: "text",
|
|
62
64
|
text: JSON.stringify({
|
|
63
65
|
success: true,
|
|
64
66
|
valid: true,
|
|
65
|
-
message:
|
|
67
|
+
message: "Ollama does not require an API key",
|
|
66
68
|
}),
|
|
67
69
|
},
|
|
68
70
|
],
|
|
@@ -73,7 +75,7 @@ export async function handleValidateApiKey(args) {
|
|
|
73
75
|
return {
|
|
74
76
|
content: [
|
|
75
77
|
{
|
|
76
|
-
type:
|
|
78
|
+
type: "text",
|
|
77
79
|
text: JSON.stringify({
|
|
78
80
|
success: false,
|
|
79
81
|
valid: false,
|
|
@@ -86,7 +88,7 @@ export async function handleValidateApiKey(args) {
|
|
|
86
88
|
return {
|
|
87
89
|
content: [
|
|
88
90
|
{
|
|
89
|
-
type:
|
|
91
|
+
type: "text",
|
|
90
92
|
text: JSON.stringify({
|
|
91
93
|
success: true,
|
|
92
94
|
valid: true,
|
|
@@ -100,7 +102,7 @@ export async function handleValidateApiKey(args) {
|
|
|
100
102
|
return {
|
|
101
103
|
content: [
|
|
102
104
|
{
|
|
103
|
-
type:
|
|
105
|
+
type: "text",
|
|
104
106
|
text: JSON.stringify({
|
|
105
107
|
success: false,
|
|
106
108
|
error: error instanceof Error ? error.message : String(error),
|
package/dist/server/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/server/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/server/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,eAAe;AACf,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CACP,2FAA2F,CAC5F;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,CAAC;SACR,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;SACjD,QAAQ,CAAC,sBAAsB,CAAC;CACpC,CAAC,CAAC;AAEH,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,IAAiD;IAEjD,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,CAAC,kCAAkC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE9D,MAAM,UAA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AE,oCAAoC;yBAC9C,CAAC;qBACH;iBACF;aACF,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAEjD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,OAAO,EAAE,KAAK;4BACd,KAAK,EAAE,KAAK;4BACZ,OAAO,EAAE,wBAAwB,QAAQ,EAAE;yBAC5C,CAAC;qBACH;iBACF;aACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,IAAI;wBACb,KAAK,EAAE,IAAI;wBACX,OAAO,EAAE,qBAAqB,QAAQ,EAAE;qBACzC,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBAC9D,CAAC;iBACH;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,46 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Base AI service utilities
|
|
3
|
-
* Adapted from VSCode extension
|
|
4
3
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { ApiErrorResult } from "../utils/retryUtils.js";
|
|
5
|
+
import { CommitMessage, ProgressReporter } from "../models/types.js";
|
|
6
|
+
export interface ProviderRequestConfig {
|
|
7
|
+
url: string;
|
|
8
|
+
payload: unknown;
|
|
9
|
+
headers: Record<string, string>;
|
|
10
|
+
model: string;
|
|
11
|
+
providerName: string;
|
|
12
|
+
}
|
|
7
13
|
export declare class BaseAIService {
|
|
8
|
-
/**
|
|
9
|
-
* Clean commit message
|
|
10
|
-
*/
|
|
11
|
-
static cleanCommitMessage(message: string): string;
|
|
12
14
|
/**
|
|
13
15
|
* Validate commit message is not empty
|
|
14
16
|
*/
|
|
15
17
|
static validateCommitMessage(message: string): string;
|
|
16
|
-
static createRequestHeaders: typeof HttpUtils.createRequestHeaders;
|
|
17
|
-
static createRequestConfig: typeof HttpUtils.createRequestConfig;
|
|
18
|
-
static updateProgressForAttempt: typeof RetryUtils.updateProgressForAttempt;
|
|
19
|
-
static calculateRetryDelay: typeof RetryUtils.calculateRetryDelay;
|
|
20
|
-
static delay: typeof RetryUtils.delay;
|
|
21
|
-
static handleGenerationError: typeof RetryUtils.handleGenerationError;
|
|
22
18
|
/**
|
|
23
19
|
* Extract and validate commit message from response
|
|
24
20
|
*/
|
|
25
21
|
static extractAndValidateMessage(content: string | undefined | null, serviceName: string): string;
|
|
26
22
|
/**
|
|
27
|
-
*
|
|
23
|
+
* Shared generation method with retry logic for all providers.
|
|
24
|
+
* Handles: request, response extraction, 401 → ApiKeyInvalidError, retry.
|
|
28
25
|
*/
|
|
29
|
-
static
|
|
26
|
+
static generateWithRetry<TResponse>(config: ProviderRequestConfig, extractMessage: (data: TResponse) => string, errorHandler: (error: Error) => ApiErrorResult, progress: ProgressReporter, attempt: number, generateFn: (prompt: string, progress: ProgressReporter, attempt: number) => Promise<CommitMessage>, prompt: string): Promise<CommitMessage>;
|
|
30
27
|
/**
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
static handleGeminiError(error: Error): ApiErrorResult;
|
|
34
|
-
/**
|
|
35
|
-
* OpenAI-specific error handling
|
|
36
|
-
*/
|
|
37
|
-
static handleOpenAIError(error: Error): ApiErrorResult;
|
|
38
|
-
/**
|
|
39
|
-
* Codestral-specific error handling
|
|
28
|
+
* Universal HTTP error handler for all AI services
|
|
40
29
|
*/
|
|
41
|
-
static
|
|
30
|
+
static handleHttpError(error: Error, serviceName: string): ApiErrorResult;
|
|
42
31
|
/**
|
|
43
|
-
* Ollama-specific error handling
|
|
32
|
+
* Ollama-specific error handling (has extra cases for 404 and connection)
|
|
44
33
|
*/
|
|
45
34
|
static handleOllamaError(error: Error): ApiErrorResult;
|
|
46
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseAIService.d.ts","sourceRoot":"","sources":["../../src/services/baseAIService.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"baseAIService.d.ts","sourceRoot":"","sources":["../../src/services/baseAIService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAc,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAWrE,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,aAAa;IACxB;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAQrD;;OAEG;IACH,MAAM,CAAC,yBAAyB,CAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EAClC,WAAW,EAAE,MAAM,GAClB,MAAM;IAOT;;;OAGG;WACU,iBAAiB,CAAC,SAAS,EACtC,MAAM,EAAE,qBAAqB,EAC7B,cAAc,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,MAAM,EAC3C,YAAY,EAAE,C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