@qodo/sdk 0.4.0 → 0.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/.claude/skills/qodo-agent/SKILL.md +658 -0
- package/.claude/skills/qodo-agent/assets/programmatic-agent.ts +317 -0
- package/.claude/skills/qodo-agent/references/builtin-tools.md +342 -0
- package/.claude/skills/qodo-agent/references/common-issues.md +430 -0
- package/dist/api/agent.d.ts +0 -1
- package/dist/api/agent.d.ts.map +1 -1
- package/dist/api/agent.js +5 -127
- package/dist/api/agent.js.map +1 -1
- package/dist/bin/install-skill.d.ts +14 -0
- package/dist/bin/install-skill.d.ts.map +1 -0
- package/dist/bin/install-skill.js +125 -0
- package/dist/bin/install-skill.js.map +1 -0
- package/dist/mcp/MCPManager.d.ts +0 -16
- package/dist/mcp/MCPManager.d.ts.map +1 -1
- package/dist/mcp/MCPManager.js +0 -41
- package/dist/mcp/MCPManager.js.map +1 -1
- package/dist/mcp/builtinServers.d.ts.map +1 -1
- package/dist/mcp/builtinServers.js +0 -12
- package/dist/mcp/builtinServers.js.map +1 -1
- package/dist/mcp/index.d.ts +0 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +0 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/servers/filesystem.d.ts +0 -31
- package/dist/mcp/servers/filesystem.d.ts.map +1 -1
- package/dist/mcp/servers/filesystem.js +0 -222
- package/dist/mcp/servers/filesystem.js.map +1 -1
- package/dist/mcp/servers/shell.d.ts.map +1 -1
- package/dist/mcp/servers/shell.js +21 -105
- package/dist/mcp/servers/shell.js.map +1 -1
- package/dist/mcp/serversRegistry.js +2 -2
- package/dist/mcp/serversRegistry.js.map +1 -1
- package/dist/mcp/toolProcessor.d.ts.map +1 -1
- package/dist/mcp/toolProcessor.js +0 -43
- package/dist/mcp/toolProcessor.js.map +1 -1
- package/dist/sdk/QodoSDK.d.ts.map +1 -1
- package/dist/sdk/QodoSDK.js +0 -9
- package/dist/sdk/QodoSDK.js.map +1 -1
- package/package.json +5 -1
- package/dist/mcp/servers/gerrit.d.ts +0 -19
- package/dist/mcp/servers/gerrit.d.ts.map +0 -1
- package/dist/mcp/servers/gerrit.js +0 -515
- package/dist/mcp/servers/gerrit.js.map +0 -1
|
@@ -1,515 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Makes an HTTP request to Gerrit REST API with authentication
|
|
3
|
-
*/
|
|
4
|
-
async function makeGerritRequest(url, username, password) {
|
|
5
|
-
console.debug(`[GerritServer] makeGerritRequest starting for URL: ${url}`);
|
|
6
|
-
try {
|
|
7
|
-
console.debug(`[GerritServer] Sending fetch request...`);
|
|
8
|
-
const response = await fetch(url, {
|
|
9
|
-
method: 'GET',
|
|
10
|
-
headers: {
|
|
11
|
-
'Authorization': `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`,
|
|
12
|
-
'Accept': 'application/json',
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
console.debug(`[GerritServer] Response received - status: ${response.status}, statusText: ${response.statusText}`);
|
|
16
|
-
if (!response.ok) {
|
|
17
|
-
console.debug(`[GerritServer] Request failed with status: ${response.status}`);
|
|
18
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
19
|
-
}
|
|
20
|
-
console.debug(`[GerritServer] Reading response text...`);
|
|
21
|
-
const text = await response.text();
|
|
22
|
-
console.debug(`[GerritServer] Response text length: ${text.length}, starts with: ${text.substring(0, 50)}...`);
|
|
23
|
-
// Gerrit returns JSON with a security prefix ")]}'" - remove it
|
|
24
|
-
const jsonText = text.startsWith(")]}'") ? text.substring(4) : text;
|
|
25
|
-
console.debug(`[GerritServer] Parsing JSON response...`);
|
|
26
|
-
const result = JSON.parse(jsonText);
|
|
27
|
-
console.debug(`[GerritServer] JSON parsed successfully`);
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
console.debug(`[GerritServer] makeGerritRequest error: ${error}`);
|
|
32
|
-
if (error instanceof Error) {
|
|
33
|
-
throw new Error(`Gerrit API request failed: ${error.message}`);
|
|
34
|
-
}
|
|
35
|
-
throw new Error(`Gerrit API request failed: ${String(error)}`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Gets file content from Gerrit for a specific revision
|
|
40
|
-
*/
|
|
41
|
-
async function getGerritFileContent(baseUrl, changeId, fileName, revision, username, password) {
|
|
42
|
-
try {
|
|
43
|
-
// Handle null revision (for initial commits with no parent)
|
|
44
|
-
if (revision === null) {
|
|
45
|
-
return ''; // No parent revision, so "before" content is empty
|
|
46
|
-
}
|
|
47
|
-
const url = `${baseUrl}/a/changes/${changeId}/revisions/${revision}/files/${encodeURIComponent(fileName)}/content`;
|
|
48
|
-
const response = await fetch(url, {
|
|
49
|
-
method: 'GET',
|
|
50
|
-
headers: {
|
|
51
|
-
'Authorization': `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`,
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
if (!response.ok) {
|
|
55
|
-
if (response.status === 404) {
|
|
56
|
-
return ''; // File doesn't exist in this revision
|
|
57
|
-
}
|
|
58
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
59
|
-
}
|
|
60
|
-
const content = await response.text();
|
|
61
|
-
// Gerrit returns base64-encoded content, decode it
|
|
62
|
-
return Buffer.from(content, 'base64').toString('utf-8');
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
if (error instanceof Error && error.message.includes('404')) {
|
|
66
|
-
return ''; // File doesn't exist
|
|
67
|
-
}
|
|
68
|
-
throw error;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Parses a Gerrit change URL to extract base URL and change ID
|
|
73
|
-
* Supports URLs like: https://gerrit.example.com/c/project/+/12345
|
|
74
|
-
*/
|
|
75
|
-
function parseGerritChangeUrl(changeUrl) {
|
|
76
|
-
try {
|
|
77
|
-
const url = new URL(changeUrl);
|
|
78
|
-
const baseUrl = `${url.protocol}//${url.host}`;
|
|
79
|
-
// Extract change ID from URL path
|
|
80
|
-
// Gerrit URLs can be in formats like:
|
|
81
|
-
// - https://gerrit.example.com/c/project/+/12345
|
|
82
|
-
// - https://gerrit.example.com/#/c/12345/
|
|
83
|
-
// - https://gerrit.example.com/12345
|
|
84
|
-
const pathMatch = url.pathname.match(/\/(?:c\/[^\/]+\/\+\/|#\/c\/)?(\d+)/);
|
|
85
|
-
if (!pathMatch) {
|
|
86
|
-
throw new Error('Could not extract change ID from URL path');
|
|
87
|
-
}
|
|
88
|
-
const changeId = pathMatch[1];
|
|
89
|
-
return { baseUrl, changeId };
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
if (error instanceof Error) {
|
|
93
|
-
throw new Error(`Invalid Gerrit change URL: ${error.message}`);
|
|
94
|
-
}
|
|
95
|
-
throw new Error(`Invalid Gerrit change URL: ${String(error)}`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Validates and filters line comments to ensure they have valid parameters
|
|
100
|
-
*/
|
|
101
|
-
function validateAndFilterComments(comments) {
|
|
102
|
-
const validatedComments = {};
|
|
103
|
-
for (const [fileName, fileComments] of Object.entries(comments)) {
|
|
104
|
-
// Skip if fileName is empty or invalid
|
|
105
|
-
if (!fileName || typeof fileName !== 'string' || fileName.trim() === '') {
|
|
106
|
-
console.warn(`[GerritServer] Skipping comments for invalid file name: "${fileName}"`);
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
const validFileComments = [];
|
|
110
|
-
for (const comment of fileComments) {
|
|
111
|
-
// Validate comment structure
|
|
112
|
-
if (!comment || typeof comment !== 'object') {
|
|
113
|
-
console.warn(`[GerritServer] Skipping invalid comment object for file ${fileName}`);
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
// Validate message
|
|
117
|
-
if (!comment.message || typeof comment.message !== 'string' || comment.message.trim() === '') {
|
|
118
|
-
console.warn(`[GerritServer] Skipping comment with invalid message for file ${fileName}`);
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
// Validate line number if provided
|
|
122
|
-
if (comment.line !== undefined) {
|
|
123
|
-
if (typeof comment.line !== 'number' || comment.line < 1 || !Number.isInteger(comment.line)) {
|
|
124
|
-
console.warn(`[GerritServer] Skipping comment with invalid line number ${comment.line} for file ${fileName}`);
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
// Validate range if provided
|
|
129
|
-
if (comment.range !== undefined) {
|
|
130
|
-
const { range } = comment;
|
|
131
|
-
if (!range || typeof range !== 'object' ||
|
|
132
|
-
typeof range.start_line !== 'number' || range.start_line < 1 || !Number.isInteger(range.start_line) ||
|
|
133
|
-
typeof range.start_character !== 'number' || range.start_character < 0 || !Number.isInteger(range.start_character) ||
|
|
134
|
-
typeof range.end_line !== 'number' || range.end_line < 1 || !Number.isInteger(range.end_line) ||
|
|
135
|
-
typeof range.end_character !== 'number' || range.end_character < 0 || !Number.isInteger(range.end_character) ||
|
|
136
|
-
range.end_line < range.start_line ||
|
|
137
|
-
(range.end_line === range.start_line && range.end_character < range.start_character)) {
|
|
138
|
-
console.warn(`[GerritServer] Skipping comment with invalid range for file ${fileName}:`, range);
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// If we have neither line nor range, skip the comment
|
|
143
|
-
if (comment.line === undefined && comment.range === undefined) {
|
|
144
|
-
console.warn(`[GerritServer] Skipping comment without line number or range for file ${fileName}`);
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
validFileComments.push(comment);
|
|
148
|
-
}
|
|
149
|
-
// Only add file to result if it has valid comments
|
|
150
|
-
if (validFileComments.length > 0) {
|
|
151
|
-
validatedComments[fileName] = validFileComments;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return validatedComments;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Posts a review comment to a Gerrit change using the HTTP API
|
|
158
|
-
*/
|
|
159
|
-
async function gerrit_comment(params) {
|
|
160
|
-
const { gerrit_change_url, message, tag, comments } = params;
|
|
161
|
-
if (!gerrit_change_url) {
|
|
162
|
-
throw new Error('gerrit_change_url parameter is required');
|
|
163
|
-
}
|
|
164
|
-
if (!message || message.trim() === '') {
|
|
165
|
-
throw new Error('message parameter is required and cannot be empty');
|
|
166
|
-
}
|
|
167
|
-
// Parse the change URL to extract base URL and change ID
|
|
168
|
-
const { baseUrl: gerritBaseUrl, changeId: change_id } = parseGerritChangeUrl(gerrit_change_url);
|
|
169
|
-
// Get configuration from environment variables
|
|
170
|
-
const gerritUser = process.env.GERRIT_USER;
|
|
171
|
-
const gerritPassword = process.env.GERRIT_PASSWORD;
|
|
172
|
-
if (!gerritUser) {
|
|
173
|
-
throw new Error('GERRIT_USER environment variable is required');
|
|
174
|
-
}
|
|
175
|
-
if (!gerritPassword) {
|
|
176
|
-
throw new Error('GERRIT_PASSWORD environment variable is required');
|
|
177
|
-
}
|
|
178
|
-
try {
|
|
179
|
-
// Get the current revision to post the comment on
|
|
180
|
-
const changeUrl = `${gerritBaseUrl}/a/changes/${change_id}?o=CURRENT_REVISION`;
|
|
181
|
-
const changeData = await makeGerritRequest(changeUrl, gerritUser, gerritPassword);
|
|
182
|
-
if (!changeData.current_revision) {
|
|
183
|
-
throw new Error(`No current revision found for change ${change_id}`);
|
|
184
|
-
}
|
|
185
|
-
const currentRevision = changeData.current_revision;
|
|
186
|
-
// Validate and filter line comments if provided
|
|
187
|
-
let validatedComments;
|
|
188
|
-
if (comments && Object.keys(comments).length > 0) {
|
|
189
|
-
validatedComments = validateAndFilterComments(comments);
|
|
190
|
-
if (Object.keys(validatedComments).length === 0) {
|
|
191
|
-
console.warn('[GerritServer] All provided comments were invalid and filtered out');
|
|
192
|
-
validatedComments = undefined;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
// Prepare the review input
|
|
196
|
-
const reviewInput = {
|
|
197
|
-
message: message.trim(),
|
|
198
|
-
...(tag && { tag: tag.trim() }),
|
|
199
|
-
...(validatedComments && { comments: validatedComments })
|
|
200
|
-
};
|
|
201
|
-
// Post the review comment
|
|
202
|
-
const reviewUrl = `${gerritBaseUrl}/a/changes/${change_id}/revisions/${currentRevision}/review`;
|
|
203
|
-
const response = await fetch(reviewUrl, {
|
|
204
|
-
method: 'POST',
|
|
205
|
-
headers: {
|
|
206
|
-
'Authorization': `Basic ${Buffer.from(`${gerritUser}:${gerritPassword}`).toString('base64')}`,
|
|
207
|
-
'Content-Type': 'application/json',
|
|
208
|
-
},
|
|
209
|
-
body: JSON.stringify(reviewInput),
|
|
210
|
-
});
|
|
211
|
-
if (!response.ok) {
|
|
212
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
213
|
-
}
|
|
214
|
-
const responseText = await response.text();
|
|
215
|
-
// Gerrit returns JSON with a security prefix ")]}'" - remove it
|
|
216
|
-
const jsonText = responseText.startsWith(")]}' ") ? responseText.substring(4) : responseText;
|
|
217
|
-
// For successful review posting, Gerrit typically returns an empty response or minimal data
|
|
218
|
-
const lineCommentsCount = validatedComments ?
|
|
219
|
-
Object.values(validatedComments).reduce((total, comments) => total + comments.length, 0) : 0;
|
|
220
|
-
const successMessage = lineCommentsCount > 0 ?
|
|
221
|
-
`Review comment posted successfully to change ${change_id} with ${lineCommentsCount} line comment(s) across ${Object.keys(validatedComments).length} file(s)` :
|
|
222
|
-
`Review comment posted successfully to change ${change_id}`;
|
|
223
|
-
return {
|
|
224
|
-
success: true,
|
|
225
|
-
message: successMessage
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
catch (error) {
|
|
229
|
-
if (error instanceof Error) {
|
|
230
|
-
throw new Error(`Failed to post comment to Gerrit: ${error.message}`);
|
|
231
|
-
}
|
|
232
|
-
throw new Error(`Failed to post comment to Gerrit: ${String(error)}`);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Implements the gerrit_diff_files tool that fetches file changes from Gerrit
|
|
237
|
-
*/
|
|
238
|
-
async function gerrit_diff_files(params) {
|
|
239
|
-
console.debug(`[GerritServer] gerrit_diff_files started with params: ${JSON.stringify(params)}`);
|
|
240
|
-
const { gerrit_change_url, files } = params;
|
|
241
|
-
if (!gerrit_change_url) {
|
|
242
|
-
console.debug(`[GerritServer] Error: gerrit_change_url parameter is required`);
|
|
243
|
-
throw new Error('gerrit_change_url parameter is required');
|
|
244
|
-
}
|
|
245
|
-
console.debug(`[GerritServer] Parsing change URL: ${gerrit_change_url}`);
|
|
246
|
-
// Parse the change URL to extract base URL and change ID
|
|
247
|
-
const { baseUrl: gerritBaseUrl, changeId: change_id } = parseGerritChangeUrl(gerrit_change_url);
|
|
248
|
-
console.debug(`[GerritServer] Parsed URL - baseUrl: ${gerritBaseUrl}, changeId: ${change_id}`);
|
|
249
|
-
// Get configuration from environment variables
|
|
250
|
-
const gerritUser = process.env.GERRIT_USER;
|
|
251
|
-
const gerritPassword = process.env.GERRIT_PASSWORD;
|
|
252
|
-
if (!gerritUser) {
|
|
253
|
-
console.debug(`[GerritServer] Error: GERRIT_USER environment variable is required`);
|
|
254
|
-
throw new Error('GERRIT_USER environment variable is required');
|
|
255
|
-
}
|
|
256
|
-
if (!gerritPassword) {
|
|
257
|
-
console.debug(`[GerritServer] Error: GERRIT_PASSWORD environment variable is required`);
|
|
258
|
-
throw new Error('GERRIT_PASSWORD environment variable is required');
|
|
259
|
-
}
|
|
260
|
-
console.debug(`[GerritServer] Environment variables validated for user: ${gerritUser}`);
|
|
261
|
-
try {
|
|
262
|
-
// Get change details including revisions with commit information
|
|
263
|
-
const changeUrl = `${gerritBaseUrl}/a/changes/${change_id}?o=CURRENT_REVISION&o=ALL_REVISIONS&o=ALL_FILES&o=ALL_COMMITS`;
|
|
264
|
-
console.debug(`[GerritServer] Making request to: ${changeUrl}`);
|
|
265
|
-
const changeData = await makeGerritRequest(changeUrl, gerritUser, gerritPassword);
|
|
266
|
-
console.debug(`[GerritServer] Change data received, keys: ${Object.keys(changeData).join(', ')}`);
|
|
267
|
-
if (!changeData.revisions) {
|
|
268
|
-
throw new Error(`No revisions found for change ${change_id}`);
|
|
269
|
-
}
|
|
270
|
-
// Get the current revision (latest patchset)
|
|
271
|
-
const currentRevision = changeData.current_revision;
|
|
272
|
-
const revisionData = changeData.revisions[currentRevision];
|
|
273
|
-
if (!revisionData) {
|
|
274
|
-
throw new Error(`Current revision ${currentRevision} not found in change data`);
|
|
275
|
-
}
|
|
276
|
-
// Get parent revision for comparison (base)
|
|
277
|
-
console.debug(`[GerritServer] Revision data keys: ${Object.keys(revisionData).join(', ')}`);
|
|
278
|
-
// With ALL_COMMITS option, parent information should be in revisionData.commit.parents
|
|
279
|
-
if (!revisionData.commit) {
|
|
280
|
-
console.debug(`[GerritServer] No commit data found in revision. Full revision data: ${JSON.stringify(revisionData, null, 2)}`);
|
|
281
|
-
throw new Error(`No commit data found for revision ${currentRevision}. This may indicate the ALL_COMMITS option didn't work.`);
|
|
282
|
-
}
|
|
283
|
-
console.debug(`[GerritServer] Commit data keys: ${Object.keys(revisionData.commit).join(', ')}`);
|
|
284
|
-
const parents = revisionData.commit.parents || [];
|
|
285
|
-
console.debug(`[GerritServer] Found ${parents.length} parents: ${JSON.stringify(parents)}`);
|
|
286
|
-
let parentRevision = null;
|
|
287
|
-
if (parents.length === 0) {
|
|
288
|
-
console.debug(`[GerritServer] No parents found. This might be the initial commit or root commit.`);
|
|
289
|
-
console.debug(`[GerritServer] Using null parent for initial commit comparison`);
|
|
290
|
-
parentRevision = null;
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
parentRevision = parents[0].commit || parents[0];
|
|
294
|
-
console.debug(`[GerritServer] Using parent revision: ${parentRevision}`);
|
|
295
|
-
}
|
|
296
|
-
// Get the list of files to process
|
|
297
|
-
const filesToProcess = files && files.length > 0
|
|
298
|
-
? files
|
|
299
|
-
: Object.keys(revisionData.files || {});
|
|
300
|
-
if (filesToProcess.length === 0) {
|
|
301
|
-
throw new Error(`No files found for change ${change_id}`);
|
|
302
|
-
}
|
|
303
|
-
const result = {};
|
|
304
|
-
console.debug(`[GerritServer] Processing ${filesToProcess.length} files: ${filesToProcess.slice(0, 5).join(', ')}${filesToProcess.length > 5 ? '...' : ''}`);
|
|
305
|
-
// Fetch content for each file
|
|
306
|
-
for (const fileName of filesToProcess) {
|
|
307
|
-
try {
|
|
308
|
-
console.debug(`[GerritServer] Processing file: ${fileName}`);
|
|
309
|
-
// Get file content from parent revision (before)
|
|
310
|
-
const beforeContent = await getGerritFileContent(gerritBaseUrl, change_id, fileName, parentRevision, gerritUser, gerritPassword);
|
|
311
|
-
// Get file content from current revision (after)
|
|
312
|
-
const afterContent = await getGerritFileContent(gerritBaseUrl, change_id, fileName, currentRevision, gerritUser, gerritPassword);
|
|
313
|
-
result[fileName] = [beforeContent, afterContent];
|
|
314
|
-
console.debug(`[GerritServer] File ${fileName} processed successfully (before: ${beforeContent.length} chars, after: ${afterContent.length} chars)`);
|
|
315
|
-
}
|
|
316
|
-
catch (error) {
|
|
317
|
-
console.warn(`[GerritServer] Failed to fetch content for file ${fileName}: ${error}`);
|
|
318
|
-
result[fileName] = ['', ''];
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
console.debug(`[GerritServer] All files processed, returning result with ${Object.keys(result).length} files`);
|
|
322
|
-
return result;
|
|
323
|
-
}
|
|
324
|
-
catch (error) {
|
|
325
|
-
if (error instanceof Error) {
|
|
326
|
-
throw new Error(`Failed to fetch diff files from Gerrit: ${error.message}`);
|
|
327
|
-
}
|
|
328
|
-
throw new Error(`Failed to fetch diff files from Gerrit: ${String(error)}`);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
export class GerritServerEnhanced {
|
|
332
|
-
name = 'gerrit';
|
|
333
|
-
version = '1.0.0';
|
|
334
|
-
initialized = false;
|
|
335
|
-
initializationError = null;
|
|
336
|
-
async initialize() {
|
|
337
|
-
try {
|
|
338
|
-
// Check for required environment variables
|
|
339
|
-
const gerritUser = process.env.GERRIT_USER;
|
|
340
|
-
const gerritPassword = process.env.GERRIT_PASSWORD;
|
|
341
|
-
if (!gerritUser) {
|
|
342
|
-
this.initializationError = 'GERRIT_USER environment variable is required';
|
|
343
|
-
console.error(`[GerritServer] ${this.initializationError}`);
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
if (!gerritPassword) {
|
|
347
|
-
this.initializationError = 'GERRIT_PASSWORD environment variable is required';
|
|
348
|
-
console.error(`[GerritServer] ${this.initializationError}`);
|
|
349
|
-
return false;
|
|
350
|
-
}
|
|
351
|
-
// Since base URL is now provided via gerrit_change_url parameter,
|
|
352
|
-
// we can't test connection during initialization.
|
|
353
|
-
// Connection will be tested when the tool is actually used.
|
|
354
|
-
this.initialized = true;
|
|
355
|
-
console.log(`[GerritServer] Gerrit server initialized (connection will be tested when used)`);
|
|
356
|
-
return true;
|
|
357
|
-
}
|
|
358
|
-
catch (error) {
|
|
359
|
-
this.initializationError = `Initialization failed: ${error}`;
|
|
360
|
-
console.error(`[GerritServer] ${this.initializationError}`);
|
|
361
|
-
return false;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
async listTools() {
|
|
365
|
-
const tools = !this.initialized ? [] : [
|
|
366
|
-
{
|
|
367
|
-
name: 'gerrit_diff_files',
|
|
368
|
-
description: 'Get file changes (before/after content) from a Gerrit change',
|
|
369
|
-
inputSchema: {
|
|
370
|
-
type: 'object',
|
|
371
|
-
properties: {
|
|
372
|
-
gerrit_change_url: {
|
|
373
|
-
type: 'string',
|
|
374
|
-
description: 'Full Gerrit change URL (e.g., "https://gerrit.example.com/c/project/+/12345")'
|
|
375
|
-
},
|
|
376
|
-
files: {
|
|
377
|
-
type: 'array',
|
|
378
|
-
items: { type: 'string' },
|
|
379
|
-
description: 'Optional list of specific files to get. If not provided, all changed files will be returned'
|
|
380
|
-
}
|
|
381
|
-
},
|
|
382
|
-
required: ['gerrit_change_url']
|
|
383
|
-
}
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
name: 'gerrit_comment',
|
|
387
|
-
description: 'Post a review comment to a Gerrit change with optional line-specific comments',
|
|
388
|
-
inputSchema: {
|
|
389
|
-
type: 'object',
|
|
390
|
-
properties: {
|
|
391
|
-
gerrit_change_url: {
|
|
392
|
-
type: 'string',
|
|
393
|
-
description: 'Full Gerrit change URL (e.g., "https://gerrit.example.com/c/project/+/12345")'
|
|
394
|
-
},
|
|
395
|
-
message: {
|
|
396
|
-
type: 'string',
|
|
397
|
-
description: 'The review comment message to post'
|
|
398
|
-
},
|
|
399
|
-
tag: {
|
|
400
|
-
type: 'string',
|
|
401
|
-
description: 'Optional tag for the review comment (e.g., "autoreview", "bot")'
|
|
402
|
-
},
|
|
403
|
-
comments: {
|
|
404
|
-
type: 'object',
|
|
405
|
-
description: 'Optional line-specific comments mapped by file path (relative paths)',
|
|
406
|
-
additionalProperties: {
|
|
407
|
-
type: 'array',
|
|
408
|
-
items: {
|
|
409
|
-
type: 'object',
|
|
410
|
-
properties: {
|
|
411
|
-
line: {
|
|
412
|
-
type: 'number',
|
|
413
|
-
description: 'Line number for the comment (1-based, required if range is not provided)'
|
|
414
|
-
},
|
|
415
|
-
message: {
|
|
416
|
-
type: 'string',
|
|
417
|
-
description: 'The comment message'
|
|
418
|
-
},
|
|
419
|
-
range: {
|
|
420
|
-
type: 'object',
|
|
421
|
-
description: 'Range for multi-line comments (alternative to line)',
|
|
422
|
-
properties: {
|
|
423
|
-
start_line: {
|
|
424
|
-
type: 'number',
|
|
425
|
-
description: 'Starting line number (1-based)'
|
|
426
|
-
},
|
|
427
|
-
start_character: {
|
|
428
|
-
type: 'number',
|
|
429
|
-
description: 'Starting character position (0-based)'
|
|
430
|
-
},
|
|
431
|
-
end_line: {
|
|
432
|
-
type: 'number',
|
|
433
|
-
description: 'Ending line number (1-based)'
|
|
434
|
-
},
|
|
435
|
-
end_character: {
|
|
436
|
-
type: 'number',
|
|
437
|
-
description: 'Ending character position (0-based)'
|
|
438
|
-
}
|
|
439
|
-
},
|
|
440
|
-
required: ['start_line', 'start_character', 'end_line', 'end_character']
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
|
-
required: ['message']
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
},
|
|
448
|
-
required: ['gerrit_change_url', 'message']
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
];
|
|
452
|
-
return { tools };
|
|
453
|
-
}
|
|
454
|
-
async callTool(request, _extra) {
|
|
455
|
-
console.debug(`[GerritServer] callTool called with: ${JSON.stringify(request)}`);
|
|
456
|
-
if (!this.initialized) {
|
|
457
|
-
console.debug(`[GerritServer] Server not initialized: ${this.initializationError}`);
|
|
458
|
-
return {
|
|
459
|
-
content: [{
|
|
460
|
-
type: 'text',
|
|
461
|
-
text: `GerritServer not initialized: ${this.initializationError || 'Unknown error'}`
|
|
462
|
-
}],
|
|
463
|
-
isError: true
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
const { name, arguments: args } = request;
|
|
467
|
-
console.debug(`[GerritServer] Executing tool: ${name} with args: ${JSON.stringify(args)}`);
|
|
468
|
-
try {
|
|
469
|
-
switch (name) {
|
|
470
|
-
case 'gerrit_diff_files': {
|
|
471
|
-
console.debug(`[GerritServer] Starting gerrit_diff_files execution`);
|
|
472
|
-
const result = await gerrit_diff_files(args);
|
|
473
|
-
console.debug(`[GerritServer] gerrit_diff_files completed successfully, files: ${Object.keys(result).length}`);
|
|
474
|
-
const response = {
|
|
475
|
-
content: [{
|
|
476
|
-
type: 'text',
|
|
477
|
-
text: JSON.stringify(result, null, 2)
|
|
478
|
-
}],
|
|
479
|
-
isError: false
|
|
480
|
-
};
|
|
481
|
-
console.debug(`[GerritServer] Returning response to MCP client`);
|
|
482
|
-
return response;
|
|
483
|
-
}
|
|
484
|
-
case 'gerrit_comment': {
|
|
485
|
-
const result = await gerrit_comment(args);
|
|
486
|
-
return {
|
|
487
|
-
content: [{
|
|
488
|
-
type: 'text',
|
|
489
|
-
text: JSON.stringify(result, null, 2)
|
|
490
|
-
}],
|
|
491
|
-
isError: false
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
default:
|
|
495
|
-
return {
|
|
496
|
-
content: [{
|
|
497
|
-
type: 'text',
|
|
498
|
-
text: `Unknown tool: ${name}`
|
|
499
|
-
}],
|
|
500
|
-
isError: true
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
catch (error) {
|
|
505
|
-
return {
|
|
506
|
-
content: [{
|
|
507
|
-
type: 'text',
|
|
508
|
-
text: error instanceof Error ? error.message : String(error)
|
|
509
|
-
}],
|
|
510
|
-
isError: true
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
//# sourceMappingURL=gerrit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gerrit.js","sourceRoot":"","sources":["../../../src/mcp/servers/gerrit.ts"],"names":[],"mappings":"AA6BA;;GAEG;AACH,KAAK,UAAU,iBAAiB,CAAC,GAAW,EAAE,QAAgB,EAAE,QAAgB;IAC9E,OAAO,CAAC,KAAK,CAAC,sDAAsD,GAAG,EAAE,CAAC,CAAC;IAE3E,IAAI,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,eAAe,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;gBACrF,QAAQ,EAAE,kBAAkB;aAC7B;SACF,CAAC,CAAC;QAEH,OAAO,CAAC,KAAK,CAAC,8CAA8C,QAAQ,CAAC,MAAM,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