gitlab-auto-reviewers 2.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.
- package/LICENSE +21 -0
- package/README.md +1878 -0
- package/dist/api/gitlab-api.d.ts +136 -0
- package/dist/api/gitlab-api.d.ts.map +1 -0
- package/dist/api/gitlab-api.js +334 -0
- package/dist/api/gitlab-api.js.map +1 -0
- package/dist/bin/cli.d.ts +10 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +186 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/bin/deprecated-mcp.d.ts +12 -0
- package/dist/bin/deprecated-mcp.d.ts.map +1 -0
- package/dist/bin/deprecated-mcp.js +73 -0
- package/dist/bin/deprecated-mcp.js.map +1 -0
- package/dist/bin/index.d.ts +18 -0
- package/dist/bin/index.d.ts.map +1 -0
- package/dist/bin/index.js +78 -0
- package/dist/bin/index.js.map +1 -0
- package/dist/bin/mcp.d.ts +11 -0
- package/dist/bin/mcp.d.ts.map +1 -0
- package/dist/bin/mcp.js +43 -0
- package/dist/bin/mcp.js.map +1 -0
- package/dist/cache/cache.service.d.ts +113 -0
- package/dist/cache/cache.service.d.ts.map +1 -0
- package/dist/cache/cache.service.js +213 -0
- package/dist/cache/cache.service.js.map +1 -0
- package/dist/cli/commands.d.ts +40 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +142 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/output.d.ts +24 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +143 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/config/config.service.d.ts +89 -0
- package/dist/config/config.service.d.ts.map +1 -0
- package/dist/config/config.service.js +169 -0
- package/dist/config/config.service.js.map +1 -0
- package/dist/datasources/git-data-source.interface.d.ts +140 -0
- package/dist/datasources/git-data-source.interface.d.ts.map +1 -0
- package/dist/datasources/git-data-source.interface.js +2 -0
- package/dist/datasources/git-data-source.interface.js.map +1 -0
- package/dist/datasources/gitlab-api-data-source.d.ts +127 -0
- package/dist/datasources/gitlab-api-data-source.d.ts.map +1 -0
- package/dist/datasources/gitlab-api-data-source.js +248 -0
- package/dist/datasources/gitlab-api-data-source.js.map +1 -0
- package/dist/datasources/local-git-data-source.d.ts +124 -0
- package/dist/datasources/local-git-data-source.d.ts.map +1 -0
- package/dist/datasources/local-git-data-source.js +580 -0
- package/dist/datasources/local-git-data-source.js.map +1 -0
- package/dist/errors/error-handler.d.ts +113 -0
- package/dist/errors/error-handler.d.ts.map +1 -0
- package/dist/errors/error-handler.js +230 -0
- package/dist/errors/error-handler.js.map +1 -0
- package/dist/index.d.ts +139 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +139 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/example.d.ts +15 -0
- package/dist/logging/example.d.ts.map +1 -0
- package/dist/logging/example.js +79 -0
- package/dist/logging/example.js.map +1 -0
- package/dist/logging/index.d.ts +7 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +7 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/logger.service.d.ts +98 -0
- package/dist/logging/logger.service.d.ts.map +1 -0
- package/dist/logging/logger.service.js +160 -0
- package/dist/logging/logger.service.js.map +1 -0
- package/dist/mcp/server.d.ts +67 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +213 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +22 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +176 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/services/blacklist.service.d.ts +32 -0
- package/dist/services/blacklist.service.d.ts.map +1 -0
- package/dist/services/blacklist.service.js +59 -0
- package/dist/services/blacklist.service.js.map +1 -0
- package/dist/services/codeowners.service.d.ts +45 -0
- package/dist/services/codeowners.service.d.ts.map +1 -0
- package/dist/services/codeowners.service.js +200 -0
- package/dist/services/codeowners.service.js.map +1 -0
- package/dist/services/comment-builder.service.d.ts +48 -0
- package/dist/services/comment-builder.service.d.ts.map +1 -0
- package/dist/services/comment-builder.service.js +61 -0
- package/dist/services/comment-builder.service.js.map +1 -0
- package/dist/services/contributors.service.d.ts +52 -0
- package/dist/services/contributors.service.d.ts.map +1 -0
- package/dist/services/contributors.service.js +144 -0
- package/dist/services/contributors.service.js.map +1 -0
- package/dist/services/reviewer-service.d.ts +125 -0
- package/dist/services/reviewer-service.d.ts.map +1 -0
- package/dist/services/reviewer-service.js +554 -0
- package/dist/services/reviewer-service.js.map +1 -0
- package/dist/services/team-members.service.d.ts +29 -0
- package/dist/services/team-members.service.d.ts.map +1 -0
- package/dist/services/team-members.service.js +45 -0
- package/dist/services/team-members.service.js.map +1 -0
- package/dist/services/whitelist.service.d.ts +31 -0
- package/dist/services/whitelist.service.d.ts.map +1 -0
- package/dist/services/whitelist.service.js +51 -0
- package/dist/services/whitelist.service.js.map +1 -0
- package/dist/tools.d.ts +22 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +176 -0
- package/dist/tools.js.map +1 -0
- package/dist/types/index.d.ts +502 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +91 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types.d.ts +219 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { MergeRequest, MergeRequestDiff, BlameLine, GitLabBranch, GitLabNote } from '../types/index.js';
|
|
2
|
+
import { Logger } from '../logging/logger.service.js';
|
|
3
|
+
/**
|
|
4
|
+
* GitLab API configuration
|
|
5
|
+
*
|
|
6
|
+
* @property baseUrl - The base URL of the GitLab instance (e.g., https://gitlab.com)
|
|
7
|
+
* @property token - Personal access token or API token for authentication
|
|
8
|
+
*/
|
|
9
|
+
export interface GitLabConfig {
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
token: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* HTTP response wrapper with pagination support
|
|
15
|
+
*
|
|
16
|
+
* @property data - The response data of type T
|
|
17
|
+
* @property nextPage - Optional next page number for paginated responses
|
|
18
|
+
*/
|
|
19
|
+
export interface HttpResponse<T> {
|
|
20
|
+
data: T;
|
|
21
|
+
nextPage?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* GitLab API client for interacting with GitLab REST API
|
|
25
|
+
*
|
|
26
|
+
* Provides methods for fetching merge requests, diffs, blame information,
|
|
27
|
+
* contributors, and posting comments. Includes automatic retry logic and
|
|
28
|
+
* pagination handling.
|
|
29
|
+
*/
|
|
30
|
+
export declare class GitLabAPI {
|
|
31
|
+
private baseUrl;
|
|
32
|
+
private token;
|
|
33
|
+
private logger;
|
|
34
|
+
/**
|
|
35
|
+
* Create a new GitLab API client
|
|
36
|
+
*
|
|
37
|
+
* @param config - GitLab configuration with base URL and token
|
|
38
|
+
* @param logger - Optional logger instance for logging API operations
|
|
39
|
+
*/
|
|
40
|
+
constructor(config: GitLabConfig, logger?: Logger);
|
|
41
|
+
/**
|
|
42
|
+
* Perform an HTTP GET request with retry logic
|
|
43
|
+
*
|
|
44
|
+
* @param url - The full URL to request
|
|
45
|
+
* @param accept - The Accept header value (default: "application/json")
|
|
46
|
+
* @returns Promise resolving to HTTP response with data and optional next page
|
|
47
|
+
* @throws {Error} If the request fails after retries
|
|
48
|
+
*/
|
|
49
|
+
private httpGet;
|
|
50
|
+
/**
|
|
51
|
+
* Get all merge requests for a project
|
|
52
|
+
*
|
|
53
|
+
* @param project - The project ID or path (URL-encoded)
|
|
54
|
+
* @param state - The merge request state to filter by (default: "opened")
|
|
55
|
+
* @returns Promise resolving to array of merge requests
|
|
56
|
+
*/
|
|
57
|
+
getMergeRequests(project: string, state?: string): Promise<MergeRequest[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Get a specific merge request by IID
|
|
60
|
+
*
|
|
61
|
+
* @param project - The project ID or path (URL-encoded)
|
|
62
|
+
* @param mr - The merge request internal ID (IID)
|
|
63
|
+
* @returns Promise resolving to merge request or null if not found
|
|
64
|
+
*/
|
|
65
|
+
getMergeRequest(project: string, mr: number): Promise<MergeRequest | null>;
|
|
66
|
+
/**
|
|
67
|
+
* Get all diffs for a merge request
|
|
68
|
+
*
|
|
69
|
+
* @param project - The project ID or path (URL-encoded)
|
|
70
|
+
* @param mr - The merge request internal ID (IID)
|
|
71
|
+
* @returns Promise resolving to array of merge request diffs
|
|
72
|
+
*/
|
|
73
|
+
getDiffs(project: string, mr: number): Promise<MergeRequestDiff[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Get git blame information for a file
|
|
76
|
+
*
|
|
77
|
+
* @param project - The project ID or path (URL-encoded)
|
|
78
|
+
* @param path - The file path within the repository (URL-encoded)
|
|
79
|
+
* @param ref - The branch, tag, or commit SHA to blame
|
|
80
|
+
* @returns Promise resolving to array of blame lines or null if file not found
|
|
81
|
+
*/
|
|
82
|
+
getBlame(project: string, path: string, ref: string): Promise<BlameLine[] | null>;
|
|
83
|
+
/**
|
|
84
|
+
* Get raw file content from repository
|
|
85
|
+
*
|
|
86
|
+
* @param project - The project ID or path (URL-encoded)
|
|
87
|
+
* @param branch - The branch name to fetch from
|
|
88
|
+
* @param path - The file path within the repository (URL-encoded)
|
|
89
|
+
* @returns Promise resolving to file content as string or null if not found
|
|
90
|
+
*/
|
|
91
|
+
getRawFile(project: string, branch: string, path: string): Promise<string | null>;
|
|
92
|
+
/**
|
|
93
|
+
* Get the default branch name for a project
|
|
94
|
+
*
|
|
95
|
+
* @param project - The project ID or path (URL-encoded)
|
|
96
|
+
* @returns Promise resolving to default branch name (defaults to 'main' if not found)
|
|
97
|
+
*/
|
|
98
|
+
getDefaultBranch(project: string): Promise<string>;
|
|
99
|
+
/**
|
|
100
|
+
* Get all branches for a project
|
|
101
|
+
*
|
|
102
|
+
* @param project - The project ID or path (URL-encoded)
|
|
103
|
+
* @returns Promise resolving to array of branches
|
|
104
|
+
*/
|
|
105
|
+
getBranches(project: string): Promise<GitLabBranch[]>;
|
|
106
|
+
/**
|
|
107
|
+
* Get project contributors by analyzing commit history
|
|
108
|
+
*
|
|
109
|
+
* Fetches up to 1000 commits from the specified branch and returns
|
|
110
|
+
* contributor email addresses sorted by commit count.
|
|
111
|
+
*
|
|
112
|
+
* @param project - The project ID or path (URL-encoded)
|
|
113
|
+
* @param branch - The branch name to analyze
|
|
114
|
+
* @returns Promise resolving to array of contributor email addresses (up to 100)
|
|
115
|
+
*/
|
|
116
|
+
getProjectContributors(project: string, branch: string): Promise<string[]>;
|
|
117
|
+
/**
|
|
118
|
+
* Get all notes (comments) for a merge request
|
|
119
|
+
*
|
|
120
|
+
* @param project - The project ID or path (URL-encoded)
|
|
121
|
+
* @param mr - The merge request internal ID (IID)
|
|
122
|
+
* @returns Promise resolving to array of notes
|
|
123
|
+
*/
|
|
124
|
+
getNotes(project: string, mr: number): Promise<GitLabNote[]>;
|
|
125
|
+
/**
|
|
126
|
+
* Post a comment to a merge request
|
|
127
|
+
*
|
|
128
|
+
* @param project - The project ID or path (URL-encoded)
|
|
129
|
+
* @param mr - The merge request internal ID (IID)
|
|
130
|
+
* @param body - The comment text (supports Markdown)
|
|
131
|
+
* @returns Promise resolving to the created note
|
|
132
|
+
* @throws {Error} If the comment fails to post after retries
|
|
133
|
+
*/
|
|
134
|
+
postComment(project: string, mr: number, body: string): Promise<GitLabNote>;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=gitlab-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-api.d.ts","sourceRoot":"","sources":["../../src/api/gitlab-api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,YAAY,EAEZ,UAAU,EACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8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W,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAgB3D;;;;;;;;;OASG;IACG,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAmChF;;;;;;OAMG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAgBlE;;;;;;;;OAQG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAyClF"}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { Logger } from '../logging/logger.service.js';
|
|
2
|
+
import { ErrorHandler } from '../errors/error-handler.js';
|
|
3
|
+
/**
|
|
4
|
+
* GitLab API client for interacting with GitLab REST API
|
|
5
|
+
*
|
|
6
|
+
* Provides methods for fetching merge requests, diffs, blame information,
|
|
7
|
+
* contributors, and posting comments. Includes automatic retry logic and
|
|
8
|
+
* pagination handling.
|
|
9
|
+
*/
|
|
10
|
+
export class GitLabAPI {
|
|
11
|
+
baseUrl;
|
|
12
|
+
token;
|
|
13
|
+
logger;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new GitLab API client
|
|
16
|
+
*
|
|
17
|
+
* @param config - GitLab configuration with base URL and token
|
|
18
|
+
* @param logger - Optional logger instance for logging API operations
|
|
19
|
+
*/
|
|
20
|
+
constructor(config, logger) {
|
|
21
|
+
this.baseUrl = `${config.baseUrl}/api/v4`;
|
|
22
|
+
this.token = config.token;
|
|
23
|
+
this.logger = logger || new Logger('GitLabAPI');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Perform an HTTP GET request with retry logic
|
|
27
|
+
*
|
|
28
|
+
* @param url - The full URL to request
|
|
29
|
+
* @param accept - The Accept header value (default: "application/json")
|
|
30
|
+
* @returns Promise resolving to HTTP response with data and optional next page
|
|
31
|
+
* @throws {Error} If the request fails after retries
|
|
32
|
+
*/
|
|
33
|
+
async httpGet(url, accept = "application/json") {
|
|
34
|
+
return ErrorHandler.withRetry(async () => {
|
|
35
|
+
this.logger.debug('HTTP GET request', { url });
|
|
36
|
+
const response = await fetch(url, {
|
|
37
|
+
headers: {
|
|
38
|
+
Accept: accept,
|
|
39
|
+
Authorization: `Bearer ${this.token}`,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
if (response.ok) {
|
|
43
|
+
const data = await response.json();
|
|
44
|
+
this.logger.debug('HTTP GET success', { url, status: response.status });
|
|
45
|
+
return {
|
|
46
|
+
data,
|
|
47
|
+
nextPage: response.headers.get("x-next-page") || undefined,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (response.status === 404) {
|
|
51
|
+
this.logger.debug('HTTP GET not found', { url, status: 404 });
|
|
52
|
+
return { data: null };
|
|
53
|
+
}
|
|
54
|
+
let errorDetails = "";
|
|
55
|
+
try {
|
|
56
|
+
const errorBody = await response.json();
|
|
57
|
+
errorDetails = `: ${JSON.stringify(errorBody)}`;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
try {
|
|
61
|
+
errorDetails = `: ${await response.text()}`;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// ignore
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const error = new Error(`${response.status} ${response.statusText}${errorDetails}`);
|
|
68
|
+
this.logger.error('HTTP GET failed', error, { url, status: response.status });
|
|
69
|
+
throw error;
|
|
70
|
+
}, {
|
|
71
|
+
maxRetries: 3,
|
|
72
|
+
delayMs: 1000,
|
|
73
|
+
backoffMultiplier: 2,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get all merge requests for a project
|
|
78
|
+
*
|
|
79
|
+
* @param project - The project ID or path (URL-encoded)
|
|
80
|
+
* @param state - The merge request state to filter by (default: "opened")
|
|
81
|
+
* @returns Promise resolving to array of merge requests
|
|
82
|
+
*/
|
|
83
|
+
async getMergeRequests(project, state = "opened") {
|
|
84
|
+
const mergeRequests = [];
|
|
85
|
+
let page = 1;
|
|
86
|
+
do {
|
|
87
|
+
const url = `${this.baseUrl}/projects/${encodeURIComponent(project)}/merge_requests?state=${state}&per_page=100&page=${page}`;
|
|
88
|
+
const { data, nextPage } = await this.httpGet(url);
|
|
89
|
+
if (data) {
|
|
90
|
+
mergeRequests.push(...data);
|
|
91
|
+
}
|
|
92
|
+
page = nextPage ? parseInt(nextPage) : 0;
|
|
93
|
+
} while (page);
|
|
94
|
+
return mergeRequests;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get a specific merge request by IID
|
|
98
|
+
*
|
|
99
|
+
* @param project - The project ID or path (URL-encoded)
|
|
100
|
+
* @param mr - The merge request internal ID (IID)
|
|
101
|
+
* @returns Promise resolving to merge request or null if not found
|
|
102
|
+
*/
|
|
103
|
+
async getMergeRequest(project, mr) {
|
|
104
|
+
const url = `${this.baseUrl}/projects/${encodeURIComponent(project)}/merge_requests/${mr}`;
|
|
105
|
+
const { data } = await this.httpGet(url);
|
|
106
|
+
return data;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Get all diffs for a merge request
|
|
110
|
+
*
|
|
111
|
+
* @param project - The project ID or path (URL-encoded)
|
|
112
|
+
* @param mr - The merge request internal ID (IID)
|
|
113
|
+
* @returns Promise resolving to array of merge request diffs
|
|
114
|
+
*/
|
|
115
|
+
async getDiffs(project, mr) {
|
|
116
|
+
const diffs = [];
|
|
117
|
+
let page = 1;
|
|
118
|
+
do {
|
|
119
|
+
const url = `${this.baseUrl}/projects/${encodeURIComponent(project)}/merge_requests/${mr}/diffs?per_page=100&page=${page}`;
|
|
120
|
+
const { data, nextPage } = await this.httpGet(url);
|
|
121
|
+
if (data) {
|
|
122
|
+
diffs.push(...data);
|
|
123
|
+
}
|
|
124
|
+
page = nextPage ? parseInt(nextPage) : 0;
|
|
125
|
+
} while (page);
|
|
126
|
+
// Warn about potential API limitations for large merge requests
|
|
127
|
+
if (diffs.length >= 100) {
|
|
128
|
+
this.logger.warn('Large merge request detected', {
|
|
129
|
+
project,
|
|
130
|
+
mr,
|
|
131
|
+
diffCount: diffs.length,
|
|
132
|
+
message: 'GitLab API may have returned limited data for this large merge request. ' +
|
|
133
|
+
'Consider using LocalGitDataSource for complete analysis of large MRs.',
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
this.logger.debug('Retrieved diffs', { project, mr, diffCount: diffs.length });
|
|
137
|
+
return diffs;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get git blame information for a file
|
|
141
|
+
*
|
|
142
|
+
* @param project - The project ID or path (URL-encoded)
|
|
143
|
+
* @param path - The file path within the repository (URL-encoded)
|
|
144
|
+
* @param ref - The branch, tag, or commit SHA to blame
|
|
145
|
+
* @returns Promise resolving to array of blame lines or null if file not found
|
|
146
|
+
*/
|
|
147
|
+
async getBlame(project, path, ref) {
|
|
148
|
+
const url = `${this.baseUrl}/projects/${encodeURIComponent(project)}/repository/files/${encodeURIComponent(path)}/blame?ref=${ref}`;
|
|
149
|
+
const { data } = await this.httpGet(url);
|
|
150
|
+
return data;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get raw file content from repository
|
|
154
|
+
*
|
|
155
|
+
* @param project - The project ID or path (URL-encoded)
|
|
156
|
+
* @param branch - The branch name to fetch from
|
|
157
|
+
* @param path - The file path within the repository (URL-encoded)
|
|
158
|
+
* @returns Promise resolving to file content as string or null if not found
|
|
159
|
+
*/
|
|
160
|
+
async getRawFile(project, branch, path) {
|
|
161
|
+
return ErrorHandler.withRetry(async () => {
|
|
162
|
+
const url = `${this.baseUrl}/projects/${encodeURIComponent(project)}/repository/files/${encodeURIComponent(path)}/raw?ref=${branch}`;
|
|
163
|
+
this.logger.debug('Getting raw file', { project, branch, path });
|
|
164
|
+
const response = await fetch(url, {
|
|
165
|
+
headers: { Authorization: `Bearer ${this.token}` },
|
|
166
|
+
});
|
|
167
|
+
if (response.ok) {
|
|
168
|
+
return await response.text();
|
|
169
|
+
}
|
|
170
|
+
if (response.status === 404) {
|
|
171
|
+
this.logger.debug('Raw file not found', { project, branch, path });
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
let errorDetails = "";
|
|
175
|
+
try {
|
|
176
|
+
const errorBody = await response.json();
|
|
177
|
+
errorDetails = `: ${JSON.stringify(errorBody)}`;
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
try {
|
|
181
|
+
errorDetails = `: ${await response.text()}`;
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
// ignore
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const error = new Error(`${response.status} ${response.statusText}${errorDetails}`);
|
|
188
|
+
this.logger.error('Failed to get raw file', error, { project, branch, path });
|
|
189
|
+
throw error;
|
|
190
|
+
}, {
|
|
191
|
+
maxRetries: 3,
|
|
192
|
+
delayMs: 1000,
|
|
193
|
+
backoffMultiplier: 2,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Get the default branch name for a project
|
|
198
|
+
*
|
|
199
|
+
* @param project - The project ID or path (URL-encoded)
|
|
200
|
+
* @returns Promise resolving to default branch name (defaults to 'main' if not found)
|
|
201
|
+
*/
|
|
202
|
+
async getDefaultBranch(project) {
|
|
203
|
+
const branches = await this.getBranches(project);
|
|
204
|
+
const defaultBranch = branches.find((branch) => branch.default);
|
|
205
|
+
return defaultBranch?.name || 'main';
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Get all branches for a project
|
|
209
|
+
*
|
|
210
|
+
* @param project - The project ID or path (URL-encoded)
|
|
211
|
+
* @returns Promise resolving to array of branches
|
|
212
|
+
*/
|
|
213
|
+
async getBranches(project) {
|
|
214
|
+
const branches = [];
|
|
215
|
+
let page = 1;
|
|
216
|
+
do {
|
|
217
|
+
const url = `${this.baseUrl}/projects/${encodeURIComponent(project)}/repository/branches?per_page=100&page=${page}`;
|
|
218
|
+
const { data, nextPage } = await this.httpGet(url);
|
|
219
|
+
if (data) {
|
|
220
|
+
branches.push(...data);
|
|
221
|
+
}
|
|
222
|
+
page = nextPage ? parseInt(nextPage) : 0;
|
|
223
|
+
} while (page);
|
|
224
|
+
return branches;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Get project contributors by analyzing commit history
|
|
228
|
+
*
|
|
229
|
+
* Fetches up to 1000 commits from the specified branch and returns
|
|
230
|
+
* contributor email addresses sorted by commit count.
|
|
231
|
+
*
|
|
232
|
+
* @param project - The project ID or path (URL-encoded)
|
|
233
|
+
* @param branch - The branch name to analyze
|
|
234
|
+
* @returns Promise resolving to array of contributor email addresses (up to 100)
|
|
235
|
+
*/
|
|
236
|
+
async getProjectContributors(project, branch) {
|
|
237
|
+
this.logger.info('Getting contributors for branch via API', { project, branch });
|
|
238
|
+
const commits = [];
|
|
239
|
+
let page = 1;
|
|
240
|
+
while (commits.length < 1000 && page <= 10) {
|
|
241
|
+
const url = `${this.baseUrl}/projects/${encodeURIComponent(project)}/repository/commits?ref_name=${branch}&per_page=100&page=${page}`;
|
|
242
|
+
const { data } = await this.httpGet(url);
|
|
243
|
+
if (!data || data.length === 0)
|
|
244
|
+
break;
|
|
245
|
+
commits.push(...data);
|
|
246
|
+
page++;
|
|
247
|
+
}
|
|
248
|
+
const contributorCounts = {};
|
|
249
|
+
commits.forEach(({ author_email }) => {
|
|
250
|
+
const email = author_email.toLowerCase();
|
|
251
|
+
contributorCounts[email] = (contributorCounts[email] || 0) + 1;
|
|
252
|
+
});
|
|
253
|
+
const result = Object.entries(contributorCounts)
|
|
254
|
+
.sort(([, a], [, b]) => b - a)
|
|
255
|
+
.slice(0, 100)
|
|
256
|
+
.map(([email]) => email);
|
|
257
|
+
this.logger.info('Returning contributors from API', {
|
|
258
|
+
project,
|
|
259
|
+
branch,
|
|
260
|
+
contributorCount: result.length,
|
|
261
|
+
totalCommits: commits.length
|
|
262
|
+
});
|
|
263
|
+
return result;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Get all notes (comments) for a merge request
|
|
267
|
+
*
|
|
268
|
+
* @param project - The project ID or path (URL-encoded)
|
|
269
|
+
* @param mr - The merge request internal ID (IID)
|
|
270
|
+
* @returns Promise resolving to array of notes
|
|
271
|
+
*/
|
|
272
|
+
async getNotes(project, mr) {
|
|
273
|
+
const notes = [];
|
|
274
|
+
let page = 1;
|
|
275
|
+
do {
|
|
276
|
+
const url = `${this.baseUrl}/projects/${encodeURIComponent(project)}/merge_requests/${mr}/notes?per_page=100&page=${page}`;
|
|
277
|
+
const { data, nextPage } = await this.httpGet(url);
|
|
278
|
+
if (data) {
|
|
279
|
+
notes.push(...data);
|
|
280
|
+
}
|
|
281
|
+
page = nextPage ? parseInt(nextPage) : 0;
|
|
282
|
+
} while (page);
|
|
283
|
+
return notes;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Post a comment to a merge request
|
|
287
|
+
*
|
|
288
|
+
* @param project - The project ID or path (URL-encoded)
|
|
289
|
+
* @param mr - The merge request internal ID (IID)
|
|
290
|
+
* @param body - The comment text (supports Markdown)
|
|
291
|
+
* @returns Promise resolving to the created note
|
|
292
|
+
* @throws {Error} If the comment fails to post after retries
|
|
293
|
+
*/
|
|
294
|
+
async postComment(project, mr, body) {
|
|
295
|
+
return ErrorHandler.withRetry(async () => {
|
|
296
|
+
const url = `${this.baseUrl}/projects/${encodeURIComponent(project)}/merge_requests/${mr}/notes`;
|
|
297
|
+
this.logger.info('Posting comment', { project, mr, bodyLength: body.length });
|
|
298
|
+
const response = await fetch(url, {
|
|
299
|
+
method: "POST",
|
|
300
|
+
headers: {
|
|
301
|
+
"Content-Type": "application/json",
|
|
302
|
+
Authorization: `Bearer ${this.token}`,
|
|
303
|
+
},
|
|
304
|
+
body: JSON.stringify({ body }),
|
|
305
|
+
});
|
|
306
|
+
if (response.ok) {
|
|
307
|
+
const note = await response.json();
|
|
308
|
+
this.logger.info('Comment posted successfully', { project, mr, noteId: note.id });
|
|
309
|
+
return note;
|
|
310
|
+
}
|
|
311
|
+
let errorDetails = "";
|
|
312
|
+
try {
|
|
313
|
+
const errorBody = await response.json();
|
|
314
|
+
errorDetails = `: ${JSON.stringify(errorBody)}`;
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
try {
|
|
318
|
+
errorDetails = `: ${await response.text()}`;
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
// ignore
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const error = new Error(`POST ${url} failed: ${response.status} ${response.statusText}${errorDetails}`);
|
|
325
|
+
this.logger.error('Failed to post comment', error, { project, mr });
|
|
326
|
+
throw error;
|
|
327
|
+
}, {
|
|
328
|
+
maxRetries: 3,
|
|
329
|
+
delayMs: 1000,
|
|
330
|
+
backoffMultiplier: 2,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=gitlab-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitlab-api.js","sourceRoot":"","sources":["../../src/api/gitlab-api.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAwB1D;;;;;;GAMG;AACH,MAAM,OAAO,SAAS;IACZ,OAAO,CAAS;IAChB,KAAK,CAAS;IACd,MAAM,CAAS;IAEvB;;;;;OAKG;IACH,YAAY,MAAoB,EAAE,MAAe;QAC/C,IAAI,CAAC,OAAO,GAAG,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,IAA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