@codesherlock/codesherlock-beta-mcp-server 0.0.1
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/.env +9 -0
- package/README.md +185 -0
- package/build/handlers/analyzeCommitHandler.d.ts +36 -0
- package/build/handlers/analyzeCommitHandler.d.ts.map +1 -0
- package/build/handlers/analyzeCommitHandler.js +397 -0
- package/build/handlers/analyzeCommitHandler.js.map +1 -0
- package/build/handlers/events.d.ts +7 -0
- package/build/handlers/events.d.ts.map +1 -0
- package/build/handlers/events.js +15 -0
- package/build/handlers/events.js.map +1 -0
- package/build/handlers/resources.d.ts +10 -0
- package/build/handlers/resources.d.ts.map +1 -0
- package/build/handlers/resources.js +14 -0
- package/build/handlers/resources.js.map +1 -0
- package/build/handlers/tools.d.ts +6 -0
- package/build/handlers/tools.d.ts.map +1 -0
- package/build/handlers/tools.js +29 -0
- package/build/handlers/tools.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +82 -0
- package/build/index.js.map +1 -0
- package/build/schemas/toolSchemas.d.ts +50 -0
- package/build/schemas/toolSchemas.d.ts.map +1 -0
- package/build/schemas/toolSchemas.js +48 -0
- package/build/schemas/toolSchemas.js.map +1 -0
- package/build/services/backendApiService.d.ts +81 -0
- package/build/services/backendApiService.d.ts.map +1 -0
- package/build/services/backendApiService.js +265 -0
- package/build/services/backendApiService.js.map +1 -0
- package/build/services/commitReviewService.d.ts +71 -0
- package/build/services/commitReviewService.d.ts.map +1 -0
- package/build/services/commitReviewService.js +506 -0
- package/build/services/commitReviewService.js.map +1 -0
- package/build/services/gitService.d.ts +159 -0
- package/build/services/gitService.d.ts.map +1 -0
- package/build/services/gitService.js +778 -0
- package/build/services/gitService.js.map +1 -0
- package/build/services/loggingService.d.ts +64 -0
- package/build/services/loggingService.d.ts.map +1 -0
- package/build/services/loggingService.js +185 -0
- package/build/services/loggingService.js.map +1 -0
- package/build/services/zipService.d.ts +9 -0
- package/build/services/zipService.d.ts.map +1 -0
- package/build/services/zipService.js +47 -0
- package/build/services/zipService.js.map +1 -0
- package/build/tests/analysisFormatter.test.d.ts +2 -0
- package/build/tests/analysisFormatter.test.d.ts.map +1 -0
- package/build/tests/analysisFormatter.test.js +92 -0
- package/build/tests/analysisFormatter.test.js.map +1 -0
- package/build/tests/analyzeCommitHandler.test.d.ts +2 -0
- package/build/tests/analyzeCommitHandler.test.d.ts.map +1 -0
- package/build/tests/analyzeCommitHandler.test.js +111 -0
- package/build/tests/analyzeCommitHandler.test.js.map +1 -0
- package/build/tests/backendApiService.test.d.ts +2 -0
- package/build/tests/backendApiService.test.d.ts.map +1 -0
- package/build/tests/backendApiService.test.js +109 -0
- package/build/tests/backendApiService.test.js.map +1 -0
- package/build/tests/commitReviewService.test.d.ts +2 -0
- package/build/tests/commitReviewService.test.d.ts.map +1 -0
- package/build/tests/commitReviewService.test.js +120 -0
- package/build/tests/commitReviewService.test.js.map +1 -0
- package/build/tests/errorExtractor.test.d.ts +2 -0
- package/build/tests/errorExtractor.test.d.ts.map +1 -0
- package/build/tests/errorExtractor.test.js +61 -0
- package/build/tests/errorExtractor.test.js.map +1 -0
- package/build/tests/loggingService.test.d.ts +2 -0
- package/build/tests/loggingService.test.d.ts.map +1 -0
- package/build/tests/loggingService.test.js +153 -0
- package/build/tests/loggingService.test.js.map +1 -0
- package/build/tests/setup.test.d.ts +2 -0
- package/build/tests/setup.test.d.ts.map +1 -0
- package/build/tests/setup.test.js +7 -0
- package/build/tests/setup.test.js.map +1 -0
- package/build/tests/tools.test.d.ts +2 -0
- package/build/tests/tools.test.d.ts.map +1 -0
- package/build/tests/tools.test.js +58 -0
- package/build/tests/tools.test.js.map +1 -0
- package/build/utils/analysisFormatter.d.ts +40 -0
- package/build/utils/analysisFormatter.d.ts.map +1 -0
- package/build/utils/analysisFormatter.js +97 -0
- package/build/utils/analysisFormatter.js.map +1 -0
- package/build/utils/errorExtractor.d.ts +36 -0
- package/build/utils/errorExtractor.d.ts.map +1 -0
- package/build/utils/errorExtractor.js +178 -0
- package/build/utils/errorExtractor.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Service
|
|
3
|
+
* Handles all Git-related operations like getting diffs, file content, etc.
|
|
4
|
+
*
|
|
5
|
+
* NOTE: simple-git StatusResult property mappings:
|
|
6
|
+
* - not_added: Untracked files (new files never added to git, shown as ?? in git status)
|
|
7
|
+
* - created: Newly staged files (added to index with `git add`, shown as A in git status)
|
|
8
|
+
* - staged: Modified files that are staged (shown as M in index)
|
|
9
|
+
* - modified: Modified files with unstaged changes (shown as M in working tree)
|
|
10
|
+
* - deleted: Deleted files (shown as D)
|
|
11
|
+
* - renamed: Renamed files (shown as R)
|
|
12
|
+
*/
|
|
13
|
+
export declare class GitService {
|
|
14
|
+
private getGitInstance;
|
|
15
|
+
/**
|
|
16
|
+
* Get diff for a specific commit or PR
|
|
17
|
+
* @param repoPath - Path to the git repository
|
|
18
|
+
* @param commitHash - Commit hash or PR reference
|
|
19
|
+
* @returns Git diff content
|
|
20
|
+
*/
|
|
21
|
+
getDiff(repoPath: string, commitHash: string): Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Get diff for uncommitted changes (both staged and unstaged)
|
|
24
|
+
* @param repoPath - Path to the git repository
|
|
25
|
+
* @returns Git diff content for uncommitted changes
|
|
26
|
+
*/
|
|
27
|
+
getUncommittedDiff(repoPath: string): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Get file content from repository
|
|
30
|
+
* @param repoPath - Path to the git repository
|
|
31
|
+
* @param filePath - Path to the file within the repo
|
|
32
|
+
* @param ref - Git reference (branch, tag, commit hash)
|
|
33
|
+
* @returns File content as string
|
|
34
|
+
*/
|
|
35
|
+
getFileContent(repoPath: string, filePath: string, ref?: string): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Get list of changed files in a commit or PR
|
|
38
|
+
* @param repoPath - Path to the git repository
|
|
39
|
+
* @param commitHash - Commit hash or PR reference
|
|
40
|
+
* @returns Array of changed file paths
|
|
41
|
+
*/
|
|
42
|
+
getChangedFiles(repoPath: string, commitHash: string): Promise<string[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Get commit information
|
|
45
|
+
* @param repoPath - Path to the git repository
|
|
46
|
+
* @param commitHash - Commit hash
|
|
47
|
+
* @returns Commit metadata
|
|
48
|
+
*/
|
|
49
|
+
getCommitInfo(repoPath: string, commitHash: string): Promise<CommitInfo>;
|
|
50
|
+
/**
|
|
51
|
+
* Get repository status
|
|
52
|
+
* @param repoPath - Path to the git repository
|
|
53
|
+
* @returns Repository status information
|
|
54
|
+
*
|
|
55
|
+
* NOTE: simple-git uses these property names:
|
|
56
|
+
* - not_added = untracked files (files not in git)
|
|
57
|
+
* - created = newly staged files (git add on new file)
|
|
58
|
+
* - staged = modified files that are staged
|
|
59
|
+
*/
|
|
60
|
+
getRepoStatus(repoPath: string): Promise<RepoStatus>;
|
|
61
|
+
/**
|
|
62
|
+
* Get the hash of the current HEAD commit.
|
|
63
|
+
* Falls back to a placeholder when repository has no commits.
|
|
64
|
+
*/
|
|
65
|
+
getCurrentCommitHash(repoPath: string): Promise<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Get diff for a specific file
|
|
68
|
+
* @param repoPath - Path to the git repository
|
|
69
|
+
* @param filePath - Path to the file
|
|
70
|
+
* @param commitHash - Commit hash (optional, if null/empty uses HEAD)
|
|
71
|
+
* @param fileStatus - Optional file status (untracked/added/modified/deleted) to optimize diff retrieval
|
|
72
|
+
* @returns Diff content
|
|
73
|
+
*/
|
|
74
|
+
getFileDiff(repoPath: string, filePath: string, commitHash?: string, fileStatus?: string): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Build a synthetic git patch for untracked files
|
|
77
|
+
* Git does NOT diff untracked files, so we must create the patch ourselves
|
|
78
|
+
* @param repoPath - Path to the git repository
|
|
79
|
+
* @param filePath - Path to the untracked file
|
|
80
|
+
* @returns Synthetic git diff patch
|
|
81
|
+
*/
|
|
82
|
+
private buildUntrackedPatch;
|
|
83
|
+
/**
|
|
84
|
+
* Get changed files with status
|
|
85
|
+
* @param repoPath - Path to the git repository
|
|
86
|
+
* @param commitHash - Commit hash (optional)
|
|
87
|
+
* @returns Array of objects with path and status
|
|
88
|
+
*
|
|
89
|
+
* NOTE: simple-git file status codes:
|
|
90
|
+
* - file.index: status in the staging area (index)
|
|
91
|
+
* - file.working_dir: status in the working directory
|
|
92
|
+
* - '?' = untracked
|
|
93
|
+
* - 'A' = added (staged new file)
|
|
94
|
+
* - 'M' = modified
|
|
95
|
+
* - 'D' = deleted
|
|
96
|
+
* - 'R' = renamed
|
|
97
|
+
* - ' ' = unmodified
|
|
98
|
+
*/
|
|
99
|
+
getChangedFilesWithStatus(repoPath: string, commitHash?: string): Promise<Array<{
|
|
100
|
+
path: string;
|
|
101
|
+
status: string;
|
|
102
|
+
}>>;
|
|
103
|
+
/**
|
|
104
|
+
* Determine file status from simple-git's index and working_dir codes
|
|
105
|
+
* @param indexCode - Status code in the staging area
|
|
106
|
+
* @param workingDirCode - Status code in the working directory
|
|
107
|
+
* @returns Human-readable status string
|
|
108
|
+
*/
|
|
109
|
+
private determineFileStatus;
|
|
110
|
+
/**
|
|
111
|
+
* Analyze git changes for a commit or uncommitted changes
|
|
112
|
+
* @param uncommitted - If true, analyze uncommitted changes. If false, analyze HEAD.
|
|
113
|
+
* @param directory - Path to git repository
|
|
114
|
+
*/
|
|
115
|
+
analyzeGitChanges(uncommitted: boolean, directory: string): Promise<Array<{
|
|
116
|
+
filename: string;
|
|
117
|
+
status: string;
|
|
118
|
+
new_content: string;
|
|
119
|
+
patch: string;
|
|
120
|
+
}>>;
|
|
121
|
+
/**
|
|
122
|
+
* Get file changes for a commit or uncommitted changes
|
|
123
|
+
* @param uncommitted - true for unstaged changes, false for specific commit
|
|
124
|
+
* @param commitHash - Git commit hash (required when uncommitted=false)
|
|
125
|
+
* @param directory - Path to the Git repository root
|
|
126
|
+
* @returns Array of file changes with filename, status, new_content, and patch
|
|
127
|
+
*/
|
|
128
|
+
getFileChanges(uncommitted: boolean, commitHash: string | undefined, directory: string): Promise<FileChange[]>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Commit information interface
|
|
132
|
+
*/
|
|
133
|
+
export interface CommitInfo {
|
|
134
|
+
hash: string;
|
|
135
|
+
author: string;
|
|
136
|
+
email: string;
|
|
137
|
+
date: string;
|
|
138
|
+
message: string;
|
|
139
|
+
files: string[];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Repository status interface
|
|
143
|
+
*/
|
|
144
|
+
export interface RepoStatus {
|
|
145
|
+
branch: string;
|
|
146
|
+
modified: string[];
|
|
147
|
+
staged: string[];
|
|
148
|
+
untracked: string[];
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* File change interface
|
|
152
|
+
*/
|
|
153
|
+
export interface FileChange {
|
|
154
|
+
filename: string;
|
|
155
|
+
status: string;
|
|
156
|
+
new_content: string;
|
|
157
|
+
patch: string;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=gitService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitService.d.ts","sourceRoot":"","sources":["../../src/services/gitService.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,cAAc;IAItB;;;;;OAKG;IACG,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAyBpE;;;;OAIG;IACG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAoB3D;;;;;;OAMG;IACG,cAAc,CAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MA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