@commitsage/mcp-server 1.0.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.
Files changed (90) hide show
  1. package/README.md +434 -0
  2. package/dist/adapters/sse.d.ts +26 -0
  3. package/dist/adapters/sse.d.ts.map +1 -0
  4. package/dist/adapters/sse.js +45 -0
  5. package/dist/adapters/sse.js.map +1 -0
  6. package/dist/auth/jwt.d.ts +70 -0
  7. package/dist/auth/jwt.d.ts.map +1 -0
  8. package/dist/auth/jwt.js +171 -0
  9. package/dist/auth/jwt.js.map +1 -0
  10. package/dist/auth/oauth.d.ts +71 -0
  11. package/dist/auth/oauth.d.ts.map +1 -0
  12. package/dist/auth/oauth.js +213 -0
  13. package/dist/auth/oauth.js.map +1 -0
  14. package/dist/index.d.ts +7 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +19 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/models/errors.d.ts +34 -0
  19. package/dist/models/errors.d.ts.map +1 -0
  20. package/dist/models/errors.js +67 -0
  21. package/dist/models/errors.js.map +1 -0
  22. package/dist/models/types.d.ts +39 -0
  23. package/dist/models/types.d.ts.map +1 -0
  24. package/dist/models/types.js +9 -0
  25. package/dist/models/types.js.map +1 -0
  26. package/dist/server/mcpServer.d.ts +11 -0
  27. package/dist/server/mcpServer.d.ts.map +1 -0
  28. package/dist/server/mcpServer.js +216 -0
  29. package/dist/server/mcpServer.js.map +1 -0
  30. package/dist/server/tools.d.ts +93 -0
  31. package/dist/server/tools.d.ts.map +1 -0
  32. package/dist/server/tools.js +272 -0
  33. package/dist/server/tools.js.map +1 -0
  34. package/dist/services/aiService.d.ts +12 -0
  35. package/dist/services/aiService.d.ts.map +1 -0
  36. package/dist/services/aiService.js +86 -0
  37. package/dist/services/aiService.js.map +1 -0
  38. package/dist/services/baseAIService.d.ts +47 -0
  39. package/dist/services/baseAIService.d.ts.map +1 -0
  40. package/dist/services/baseAIService.js +153 -0
  41. package/dist/services/baseAIService.js.map +1 -0
  42. package/dist/services/codestralService.d.ts +7 -0
  43. package/dist/services/codestralService.d.ts.map +1 -0
  44. package/dist/services/codestralService.js +49 -0
  45. package/dist/services/codestralService.js.map +1 -0
  46. package/dist/services/geminiService.d.ts +18 -0
  47. package/dist/services/geminiService.d.ts.map +1 -0
  48. package/dist/services/geminiService.js +139 -0
  49. package/dist/services/geminiService.js.map +1 -0
  50. package/dist/services/gitBlameAnalyzer.d.ts +15 -0
  51. package/dist/services/gitBlameAnalyzer.d.ts.map +1 -0
  52. package/dist/services/gitBlameAnalyzer.js +135 -0
  53. package/dist/services/gitBlameAnalyzer.js.map +1 -0
  54. package/dist/services/gitService.d.ts +54 -0
  55. package/dist/services/gitService.d.ts.map +1 -0
  56. package/dist/services/gitService.js +394 -0
  57. package/dist/services/gitService.js.map +1 -0
  58. package/dist/services/ollamaService.d.ts +7 -0
  59. package/dist/services/ollamaService.d.ts.map +1 -0
  60. package/dist/services/ollamaService.js +43 -0
  61. package/dist/services/ollamaService.js.map +1 -0
  62. package/dist/services/openaiService.d.ts +9 -0
  63. package/dist/services/openaiService.d.ts.map +1 -0
  64. package/dist/services/openaiService.js +69 -0
  65. package/dist/services/openaiService.js.map +1 -0
  66. package/dist/services/promptService.d.ts +10 -0
  67. package/dist/services/promptService.d.ts.map +1 -0
  68. package/dist/services/promptService.js +136 -0
  69. package/dist/services/promptService.js.map +1 -0
  70. package/dist/utils/config.d.ts +27 -0
  71. package/dist/utils/config.d.ts.map +1 -0
  72. package/dist/utils/config.js +80 -0
  73. package/dist/utils/config.js.map +1 -0
  74. package/dist/utils/httpUtils.d.ts +33 -0
  75. package/dist/utils/httpUtils.d.ts.map +1 -0
  76. package/dist/utils/httpUtils.js +54 -0
  77. package/dist/utils/httpUtils.js.map +1 -0
  78. package/dist/utils/logger.d.ts +14 -0
  79. package/dist/utils/logger.d.ts.map +1 -0
  80. package/dist/utils/logger.js +59 -0
  81. package/dist/utils/logger.js.map +1 -0
  82. package/dist/utils/retryUtils.d.ts +29 -0
  83. package/dist/utils/retryUtils.d.ts.map +1 -0
  84. package/dist/utils/retryUtils.js +49 -0
  85. package/dist/utils/retryUtils.js.map +1 -0
  86. package/dist/utils/textProcessing.d.ts +8 -0
  87. package/dist/utils/textProcessing.d.ts.map +1 -0
  88. package/dist/utils/textProcessing.js +10 -0
  89. package/dist/utils/textProcessing.js.map +1 -0
  90. package/package.json +47 -0
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Git blame analyzer for MCP server
3
+ * Adapted from VSCode extension
4
+ */
5
+ import * as path from 'path';
6
+ import { Logger } from '../utils/logger.js';
7
+ import { GitService } from './gitService.js';
8
+ const errorMessages = {
9
+ fileNotFound: 'File not found',
10
+ noCommitsYet: 'No commits yet in this repository',
11
+ fileNotCommitted: 'File not committed yet',
12
+ fileDeleted: 'File is deleted',
13
+ };
14
+ export class GitBlameAnalyzer {
15
+ static async getGitBlame(filePath, repoPath) {
16
+ try {
17
+ if (!(await GitService.hasHead(repoPath))) {
18
+ throw new Error(errorMessages.noCommitsYet);
19
+ }
20
+ if (await GitService.isNewFile(filePath, repoPath)) {
21
+ throw new Error(errorMessages.fileNotCommitted);
22
+ }
23
+ const blameOutput = await this.executeGitBlame(filePath, repoPath);
24
+ return this.parseBlameOutput(blameOutput);
25
+ }
26
+ catch (error) {
27
+ Logger.error('Error getting blame info:', error);
28
+ throw error;
29
+ }
30
+ }
31
+ static async executeGitBlame(filePath, repoPath) {
32
+ const { stdout } = await GitService.execGit(['blame', '--line-porcelain', '--', filePath], repoPath);
33
+ return stdout;
34
+ }
35
+ static parseBlameOutput(blameOutput) {
36
+ const lines = blameOutput.split('\n');
37
+ const blameInfos = [];
38
+ let currentBlame = {};
39
+ for (const line of lines) {
40
+ if (line.startsWith('author ')) {
41
+ currentBlame.author = line.substring(7);
42
+ }
43
+ else if (line.startsWith('author-mail ')) {
44
+ currentBlame.email = line.substring(12).replace(/[<>]/g, '');
45
+ }
46
+ else if (line.startsWith('author-time ')) {
47
+ currentBlame.timestamp = parseInt(line.substring(11), 10);
48
+ currentBlame.date = new Date(currentBlame.timestamp * 1000).toISOString();
49
+ }
50
+ else if (line.startsWith('\t')) {
51
+ currentBlame.line = line.substring(1);
52
+ if (currentBlame.author &&
53
+ currentBlame.email &&
54
+ currentBlame.date &&
55
+ currentBlame.timestamp &&
56
+ currentBlame.line) {
57
+ blameInfos.push(currentBlame);
58
+ }
59
+ currentBlame = {};
60
+ }
61
+ else if (line.match(/^[0-9a-f]{40}/)) {
62
+ currentBlame.commit = line.split(' ')[0];
63
+ }
64
+ }
65
+ return blameInfos;
66
+ }
67
+ static async getDiff(repoPath, filePath) {
68
+ const { stdout } = await GitService.execGit(['diff', '--unified=0', '--', filePath], repoPath);
69
+ return stdout;
70
+ }
71
+ static async analyzeChanges(repoPath, filePath) {
72
+ try {
73
+ const normalizedPath = path.normalize(filePath.replace(/^\/+/, ''));
74
+ if (await GitService.isFileDeleted(normalizedPath, repoPath)) {
75
+ Logger.log(`Skipping blame analysis for deleted file: ${normalizedPath}`);
76
+ return `Deleted file: ${normalizedPath}`;
77
+ }
78
+ if (await GitService.isNewFile(normalizedPath, repoPath)) {
79
+ Logger.log(`Skipping blame analysis for new file: ${normalizedPath}`);
80
+ return `New file: ${normalizedPath}`;
81
+ }
82
+ const blame = await this.getGitBlame(normalizedPath, repoPath);
83
+ const diff = await this.getDiff(repoPath, normalizedPath);
84
+ const changedLines = this.parseChangedLines(diff);
85
+ const authorChanges = this.analyzeBlameInfo(blame, changedLines);
86
+ return this.formatAnalysis(authorChanges);
87
+ }
88
+ catch (error) {
89
+ Logger.error('Error analyzing changes:', error);
90
+ throw error;
91
+ }
92
+ }
93
+ static parseChangedLines(diff) {
94
+ const changedLines = new Set();
95
+ const lines = diff.split('\n');
96
+ let currentLine = 0;
97
+ for (const line of lines) {
98
+ const match = line.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/);
99
+ if (match) {
100
+ currentLine = parseInt(match[1], 10);
101
+ }
102
+ else if (line.startsWith('+') && !line.startsWith('+++')) {
103
+ changedLines.add(currentLine);
104
+ currentLine++;
105
+ }
106
+ else if (!line.startsWith('-') && !line.startsWith('---')) {
107
+ currentLine++;
108
+ }
109
+ }
110
+ return changedLines;
111
+ }
112
+ static analyzeBlameInfo(blame, changedLines) {
113
+ const authorChanges = new Map();
114
+ blame.forEach((info, index) => {
115
+ if (changedLines.has(index + 1)) {
116
+ const key = `${info.author} <${info.email}>`;
117
+ const current = authorChanges.get(key) || { count: 0, lines: [] };
118
+ current.count++;
119
+ current.lines.push(index + 1);
120
+ authorChanges.set(key, current);
121
+ }
122
+ });
123
+ return authorChanges;
124
+ }
125
+ static formatAnalysis(authorChanges) {
126
+ if (authorChanges.size === 0) {
127
+ return 'No changes detected.';
128
+ }
129
+ const sortedAuthors = Array.from(authorChanges.entries()).sort((a, b) => b[1].count - a[1].count);
130
+ return sortedAuthors
131
+ .map(([author, { count, lines }]) => `${author} modified ${count} line${count === 1 ? '' : 's'} (${lines.join(', ')})`)
132
+ .join('\n');
133
+ }
134
+ }
135
+ //# sourceMappingURL=gitBlameAnalyzer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitBlameAnalyzer.js","sourceRoot":"","sources":["../../src/services/gitBlameAnalyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAW7C,MAAM,aAAa,GAAG;IACpB,YAAY,EAAE,gBAAgB;IAC9B,YAAY,EAAE,mCAAmC;IACjD,gBAAgB,EAAE,wBAAwB;IAC1C,WAAW,EAAE,iBAAiB;CAC/B,CAAC;AAEF,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAC,KAAK,CAAC,WAAW,CAC9B,QAAgB,EAChB,QAAgB;QAEhB,IA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AE,KAAK,EAAE,EAAE,EAAE,CAAC;gBAClE,OAAO,CAAC,KAAK,EAAE,CAAC;gBAChB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;gBAC9B,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,aAAa,CAAC;IACvB,CAAC;IAEO,MAAM,CAAC,cAAc,CAC3B,aAA8D;QAE9D,IAAI,aAAa,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,sBAAsB,CAAC;QAChC,CAAC;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAC5D,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAClC,CAAC;QAEF,OAAO,aAAa;aACjB,GAAG,CACF,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAC7B,GAAG,MAAM,aAAa,KAAK,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACpF;aACA,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Git service for MCP server
3
+ * Adapted from VSCode extension to work with Node.js child_process
4
+ */
5
+ export declare class GitService {
6
+ /**
7
+ * Validates that git is available
8
+ */
9
+ static validateGit(): Promise<void>;
10
+ /**
11
+ * Sanitizes and validates repository path
12
+ */
13
+ static sanitizeRepoPath(repoPath: string): string;
14
+ /**
15
+ * Validates that the path is a valid git repository
16
+ */
17
+ static validateRepository(repoPath: string): Promise<void>;
18
+ /**
19
+ * Executes a git command with timeout and improved error handling
20
+ */
21
+ static execGit(args: string[], cwd: string, timeoutMs?: number): Promise<{
22
+ stdout: string;
23
+ stderr: string;
24
+ }>;
25
+ /**
26
+ * Checks if repository has HEAD (initial commit exists)
27
+ */
28
+ static hasHead(repoPath: string): Promise<boolean>;
29
+ /**
30
+ * Checks if repository has changes of a specific type
31
+ */
32
+ static hasChanges(repoPath: string, type: "staged" | "unstaged" | "untracked" | "deleted"): Promise<boolean>;
33
+ /**
34
+ * Gets the diff for the repository
35
+ */
36
+ static getDiff(repoPath: string, onlyStagedChanges: boolean): Promise<string>;
37
+ /**
38
+ * Gets list of changed files
39
+ */
40
+ static getChangedFiles(repoPath: string, onlyStaged?: boolean): Promise<string[]>;
41
+ /**
42
+ * Checks if a file is new (untracked or added)
43
+ */
44
+ static isNewFile(filePath: string, repoPath: string): Promise<boolean>;
45
+ /**
46
+ * Checks if a file is deleted
47
+ */
48
+ static isFileDeleted(filePath: string, repoPath: string): Promise<boolean>;
49
+ /**
50
+ * Calculate simple hash for file content
51
+ */
52
+ private static calculateFileHash;
53
+ }
54
+ //# sourceMappingURL=gitService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitService.d.ts","sourceRoot":"","sources":["../../src/services/gitService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2DH,qBAAa,UAAU;IACrB;;OAEG;WACU,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IASzC;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAejD;;OAEG;WACU,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwChE;;OAEG;WACU,OAAO,CAClB,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,EACX,SAAS,GAAE,MAAc,GACxB,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAsD9C;;OAEG;WACU,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASxD;;OAEG;WACU,UAAU,CACrB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GACpD,OAAO,CAAC,OAAO,CAAC;IA4BnB;;OAEG;WACU,OAAO,CAClB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,OAAO,GACzB,OAAO,CAAC,MAAM,CAAC;IA4LlB;;OAEG;WACU,eAAe,CAC1B,QAAQ,EAAE,MAAM,EAChB,UAAU,GAAE,OAAe,GAC1B,OAAO,CAAC,MAAM,EAAE,CAAC;IAwCpB;;OAEG;WACU,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAU5E;;OAEG;WACU,aAAa,CACxB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC;IAUnB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;CAIjC"}
@@ -0,0 +1,394 @@
1
+ /**
2
+ * Git service for MCP server
3
+ * Adapted from VSCode extension to work with Node.js child_process
4
+ */
5
+ import { spawn } from "child_process";
6
+ import { promises as fs } from "fs";
7
+ import * as path from "path";
8
+ import { Logger } from "../utils/logger.js";
9
+ import { GitExtensionNotFoundError, NoChangesDetectedError, InvalidRepositoryPathError, GitCommandError, TimeoutError, } from "../models/errors.js";
10
+ const GIT_STATUS_CODES = {
11
+ modified: "M",
12
+ added: "A",
13
+ deleted: "D",
14
+ renamed: "R",
15
+ untracked: "??",
16
+ submodule: "S",
17
+ };
18
+ const STAGED_STATUS_CODES = [
19
+ GIT_STATUS_CODES.modified,
20
+ GIT_STATUS_CODES.added,
21
+ GIT_STATUS_CODES.deleted,
22
+ GIT_STATUS_CODES.renamed,
23
+ ];
24
+ /**
25
+ * Unquotes a file path returned by git
26
+ */
27
+ function unquoteGitPath(filePath) {
28
+ if (!filePath.startsWith('"') || !filePath.endsWith('"')) {
29
+ return filePath;
30
+ }
31
+ let unquoted = filePath.slice(1, -1);
32
+ // Unescape octal sequences
33
+ unquoted = unquoted.replace(/\\([0-7]{3})/g, (_, octal) => {
34
+ return String.fromCharCode(parseInt(octal, 8));
35
+ });
36
+ try {
37
+ const bytes = new Uint8Array([...unquoted].map((c) => c.charCodeAt(0)));
38
+ unquoted = new TextDecoder("utf-8").decode(bytes);
39
+ }
40
+ catch {
41
+ // If decoding fails, keep the string as-is
42
+ }
43
+ unquoted = unquoted.replace(/\\"/g, '"');
44
+ unquoted = unquoted.replace(/\\\\/g, "\\");
45
+ return unquoted;
46
+ }
47
+ export class GitService {
48
+ /**
49
+ * Validates that git is available
50
+ */
51
+ static async validateGit() {
52
+ try {
53
+ await this.execGit(["--version"], process.cwd());
54
+ Logger.log("Git is available");
55
+ }
56
+ catch (error) {
57
+ throw new GitExtensionNotFoundError();
58
+ }
59
+ }
60
+ /**
61
+ * Sanitizes and validates repository path
62
+ */
63
+ static sanitizeRepoPath(repoPath) {
64
+ // Remove any potential command injection characters
65
+ const sanitized = path
66
+ .normalize(repoPath)
67
+ .replace(/[;&|`$()]/g, "")
68
+ .trim();
69
+ // Ensure it's an absolute path
70
+ if (!path.isAbsolute(sanitized)) {
71
+ throw new InvalidRepositoryPathError(repoPath, "Path must be absolute");
72
+ }
73
+ return sanitized;
74
+ }
75
+ /**
76
+ * Validates that the path is a valid git repository
77
+ */
78
+ static async validateRepository(repoPath) {
79
+ const sanitizedPath = this.sanitizeRepoPath(repoPath);
80
+ try {
81
+ // Check if path exists and is accessible
82
+ const stats = await fs.stat(sanitizedPath);
83
+ if (!stats.isDirectory()) {
84
+ throw new InvalidRepositoryPathError(repoPath, "Path is not a directory");
85
+ }
86
+ }
87
+ catch (error) {
88
+ if (error.code === "ENOENT") {
89
+ throw new InvalidRepositoryPathError(repoPath, "Path does not exist");
90
+ }
91
+ if (error.code === "EACCES") {
92
+ throw new InvalidRepositoryPathError(repoPath, "Permission denied to access path");
93
+ }
94
+ throw error;
95
+ }
96
+ try {
97
+ // Verify it's a git repository
98
+ const result = await this.execGit(["rev-parse", "--git-dir"], sanitizedPath);
99
+ Logger.debug(`Git directory found: ${result.stdout.trim()}`);
100
+ }
101
+ catch (error) {
102
+ throw new InvalidRepositoryPathError(repoPath, "Not a valid git repository (no .git directory found)");
103
+ }
104
+ }
105
+ /**
106
+ * Executes a git command with timeout and improved error handling
107
+ */
108
+ static async execGit(args, cwd, timeoutMs = 30000) {
109
+ return new Promise((resolve, reject) => {
110
+ const gitProcess = spawn("git", args, { cwd });
111
+ let stdout = "";
112
+ let stderr = "";
113
+ let isTimedOut = false;
114
+ // Set timeout
115
+ const timeout = setTimeout(() => {
116
+ isTimedOut = true;
117
+ gitProcess.kill("SIGTERM");
118
+ reject(new TimeoutError(`git ${args.join(" ")}`, timeoutMs));
119
+ }, timeoutMs);
120
+ gitProcess.stdout.on("data", (data) => {
121
+ stdout += data.toString();
122
+ });
123
+ gitProcess.stderr.on("data", (data) => {
124
+ stderr += data.toString();
125
+ });
126
+ gitProcess.on("close", (code) => {
127
+ clearTimeout(timeout);
128
+ if (isTimedOut) {
129
+ return; // Already rejected by timeout
130
+ }
131
+ if (code === 0) {
132
+ Logger.debug(`Git command succeeded: git ${args.join(" ")}`);
133
+ resolve({ stdout, stderr });
134
+ }
135
+ else {
136
+ Logger.error(`Git command failed: git ${args.join(" ")}`, new Error(stderr));
137
+ reject(new GitCommandError(`git ${args.join(" ")}`, code, stderr));
138
+ }
139
+ });
140
+ gitProcess.on("error", (error) => {
141
+ clearTimeout(timeout);
142
+ Logger.error(`Git process error: ${error.message}`);
143
+ if (error.code === "ENOENT") {
144
+ reject(new GitExtensionNotFoundError());
145
+ }
146
+ else {
147
+ reject(error);
148
+ }
149
+ });
150
+ });
151
+ }
152
+ /**
153
+ * Checks if repository has HEAD (initial commit exists)
154
+ */
155
+ static async hasHead(repoPath) {
156
+ try {
157
+ await this.execGit(["rev-parse", "HEAD"], repoPath);
158
+ return true;
159
+ }
160
+ catch {
161
+ return false;
162
+ }
163
+ }
164
+ /**
165
+ * Checks if repository has changes of a specific type
166
+ */
167
+ static async hasChanges(repoPath, type) {
168
+ try {
169
+ let command;
170
+ switch (type) {
171
+ case "staged":
172
+ command = ["diff", "--cached", "--name-only"];
173
+ break;
174
+ case "unstaged":
175
+ command = ["diff", "--name-only"];
176
+ break;
177
+ case "untracked":
178
+ command = ["ls-files", "--others", "--exclude-standard"];
179
+ break;
180
+ case "deleted":
181
+ command = ["ls-files", "--deleted"];
182
+ break;
183
+ default:
184
+ throw new Error(`Invalid change type: ${type}`);
185
+ }
186
+ const { stdout } = await this.execGit(command, repoPath);
187
+ return stdout.trim().length > 0;
188
+ }
189
+ catch (error) {
190
+ Logger.error(`Error checking for ${type} changes:`, error);
191
+ return false;
192
+ }
193
+ }
194
+ /**
195
+ * Gets the diff for the repository
196
+ */
197
+ static async getDiff(repoPath, onlyStagedChanges) {
198
+ try {
199
+ const hasHead = await this.hasHead(repoPath);
200
+ const hasStagedChanges = await this.hasChanges(repoPath, "staged");
201
+ const hasUnstagedChanges = !onlyStagedChanges && (await this.hasChanges(repoPath, "unstaged"));
202
+ const hasUntrackedFiles = !onlyStagedChanges &&
203
+ !hasStagedChanges &&
204
+ (await this.hasChanges(repoPath, "untracked"));
205
+ const hasDeletedFiles = hasHead &&
206
+ !onlyStagedChanges &&
207
+ !hasStagedChanges &&
208
+ (await this.hasChanges(repoPath, "deleted"));
209
+ if (!hasStagedChanges &&
210
+ !hasUnstagedChanges &&
211
+ !hasUntrackedFiles &&
212
+ !hasDeletedFiles) {
213
+ throw new NoChangesDetectedError();
214
+ }
215
+ const diffs = [];
216
+ // Check if file is a submodule
217
+ const isSubmodule = async (file) => {
218
+ try {
219
+ const { stdout } = await this.execGit(["ls-files", "--stage", "--", file], repoPath);
220
+ return stdout.includes("160000");
221
+ }
222
+ catch {
223
+ return false;
224
+ }
225
+ };
226
+ // If we only want staged changes and there are some, return only those
227
+ if (onlyStagedChanges && hasStagedChanges) {
228
+ const { stdout } = await this.execGit(["diff", "--cached", "--name-only"], repoPath);
229
+ const stagedFiles = stdout
230
+ .split("\n")
231
+ .filter((file) => file.trim())
232
+ .map(unquoteGitPath);
233
+ for (const file of stagedFiles) {
234
+ if (!(await isSubmodule(file))) {
235
+ const { stdout: fileDiff } = await this.execGit(["diff", "--cached", "--", file], repoPath);
236
+ if (fileDiff.trim()) {
237
+ diffs.push(fileDiff);
238
+ }
239
+ }
240
+ }
241
+ return diffs.join("\n\n").trim();
242
+ }
243
+ // Otherwise, get all changes
244
+ if (hasStagedChanges) {
245
+ const { stdout } = await this.execGit(["diff", "--cached", "--name-only"], repoPath);
246
+ const stagedFiles = stdout
247
+ .split("\n")
248
+ .filter((file) => file.trim())
249
+ .map(unquoteGitPath);
250
+ for (const file of stagedFiles) {
251
+ if (!(await isSubmodule(file))) {
252
+ const { stdout: fileDiff } = await this.execGit(["diff", "--cached", "--", file], repoPath);
253
+ if (fileDiff.trim()) {
254
+ diffs.push("# Staged changes:\n" + fileDiff);
255
+ }
256
+ }
257
+ }
258
+ }
259
+ if (hasUnstagedChanges) {
260
+ const { stdout } = await this.execGit(["diff", "--name-only"], repoPath);
261
+ const unstagedFiles = stdout
262
+ .split("\n")
263
+ .filter((file) => file.trim())
264
+ .map(unquoteGitPath);
265
+ for (const file of unstagedFiles) {
266
+ if (!(await isSubmodule(file))) {
267
+ const { stdout: fileDiff } = await this.execGit(["diff", "--", file], repoPath);
268
+ if (fileDiff.trim()) {
269
+ diffs.push("# Unstaged changes:\n" + fileDiff);
270
+ }
271
+ }
272
+ }
273
+ }
274
+ if (hasUntrackedFiles) {
275
+ const { stdout } = await this.execGit(["ls-files", "--others", "--exclude-standard"], repoPath);
276
+ const untrackedDiff = await Promise.all(stdout
277
+ .split("\n")
278
+ .filter((file) => file.trim())
279
+ .map(unquoteGitPath)
280
+ .map(async (file) => {
281
+ try {
282
+ const content = await fs.readFile(path.join(repoPath, file), "utf-8");
283
+ const lines = content.split("\n");
284
+ const contentDiff = lines
285
+ .map((line) => `+${line}`)
286
+ .join("\n");
287
+ return `diff --git a/${file} b/${file}\nnew file mode 100644\nindex 0000000..${this.calculateFileHash(content)}\n--- /dev/null\n+++ b/${file}\n@@ -0,0 +1,${lines.length} @@\n${contentDiff}`;
288
+ }
289
+ catch (error) {
290
+ Logger.error(`Error reading new file ${file}:`, error);
291
+ return "";
292
+ }
293
+ }));
294
+ const validUntrackedDiffs = untrackedDiff.filter((diff) => diff.trim());
295
+ if (validUntrackedDiffs.length > 0) {
296
+ diffs.push("# New files:\n" + validUntrackedDiffs.join("\n"));
297
+ }
298
+ }
299
+ if (hasDeletedFiles) {
300
+ const { stdout } = await this.execGit(["ls-files", "--deleted"], repoPath);
301
+ const deletedDiff = await Promise.all(stdout
302
+ .split("\n")
303
+ .filter((file) => file.trim())
304
+ .map(unquoteGitPath)
305
+ .map(async (file) => {
306
+ try {
307
+ const { stdout: oldContent } = await this.execGit(["show", `HEAD:${file}`], repoPath);
308
+ return `diff --git a/${file} b/${file}\ndeleted file mode 100644\n--- a/${file}\n+++ /dev/null\n@@ -1 +0,0 @@\n-${oldContent.trim()}\n`;
309
+ }
310
+ catch {
311
+ return "";
312
+ }
313
+ }));
314
+ const validDeletedDiffs = deletedDiff.filter((diff) => diff.trim());
315
+ if (validDeletedDiffs.length > 0) {
316
+ diffs.push("# Deleted files:\n" + validDeletedDiffs.join("\n"));
317
+ }
318
+ }
319
+ const combinedDiff = diffs.join("\n\n").trim();
320
+ if (!combinedDiff) {
321
+ throw new NoChangesDetectedError();
322
+ }
323
+ return combinedDiff;
324
+ }
325
+ catch (error) {
326
+ if (error instanceof NoChangesDetectedError) {
327
+ throw error;
328
+ }
329
+ Logger.error("Error getting diff:", error);
330
+ throw new Error(`Failed to get diff: ${error.message}`);
331
+ }
332
+ }
333
+ /**
334
+ * Gets list of changed files
335
+ */
336
+ static async getChangedFiles(repoPath, onlyStaged = false) {
337
+ try {
338
+ const { stdout } = await this.execGit(["status", "--porcelain"], repoPath);
339
+ return stdout
340
+ .split("\n")
341
+ .filter((line) => line.trim() !== "")
342
+ .filter((line) => {
343
+ if (line.includes("Subproject commit") || line.includes("Entering")) {
344
+ return false;
345
+ }
346
+ if (onlyStaged) {
347
+ return STAGED_STATUS_CODES.includes(line[0]);
348
+ }
349
+ const [staged, unstaged] = [line[0], line[1]];
350
+ return staged !== " " || unstaged !== " ";
351
+ })
352
+ .map((line) => {
353
+ const status = line.substring(0, 2);
354
+ let filePath = line.substring(3).trim();
355
+ // Handle renamed files
356
+ if (status.startsWith("R")) {
357
+ filePath = filePath.split(" -> ")[1];
358
+ }
359
+ filePath = unquoteGitPath(filePath);
360
+ return filePath;
361
+ });
362
+ }
363
+ catch (error) {
364
+ Logger.error("Error getting changed files:", error);
365
+ return [];
366
+ }
367
+ }
368
+ /**
369
+ * Checks if a file is new (untracked or added)
370
+ */
371
+ static async isNewFile(filePath, repoPath) {
372
+ const normalizedPath = path.normalize(filePath.replace(/^\/+/, ""));
373
+ const { stdout } = await this.execGit(["status", "--porcelain", "--", normalizedPath], repoPath);
374
+ const status = stdout.slice(0, 2);
375
+ return status === "??" || status === "A ";
376
+ }
377
+ /**
378
+ * Checks if a file is deleted
379
+ */
380
+ static async isFileDeleted(filePath, repoPath) {
381
+ const normalizedPath = path.normalize(filePath.replace(/^\/+/, ""));
382
+ const { stdout } = await this.execGit(["status", "--porcelain", "--", normalizedPath], repoPath);
383
+ const status = stdout.slice(0, 2);
384
+ return status === " D" || status === "D ";
385
+ }
386
+ /**
387
+ * Calculate simple hash for file content
388
+ */
389
+ static calculateFileHash(content) {
390
+ const hash = Buffer.from(content).toString("base64");
391
+ return hash.substring(0, 7);
392
+ }
393
+ }
394
+ //# sourceMappingURL=gitService.js.map
@@ -0,0 +1 @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,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ import { CommitMessage, ProgressReporter } from '../models/types.js';
2
+ export declare class OllamaService {
3
+ private static readonly defaultModel;
4
+ static generateCommitMessage(prompt: string, progress: ProgressReporter, attempt?: number): Promise<CommitMessage>;
5
+ private static extractCommitMessage;
6
+ }
7
+ //# sourceMappingURL=ollamaService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ollamaService.d.ts","sourceRoot":"","sources":["../../src/services/ollamaService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAmBrE,qBAAa,aAAa;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAc;WAErC,qBAAqB,CAC9B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,GAAE,MAAU,GACpB,OAAO,CAAC,aAAa,CAAC;IA0CzB,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAMtC"}