@azure-devops/mcp 2.2.0-nightly.20251002 → 2.2.0-nightly.20251003
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/dist/tools/repositories.js +35 -4
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { PullRequestStatus, GitVersionType, GitPullRequestQueryType, CommentThreadStatus, } from "azure-devops-node-api/interfaces/GitInterfaces.js";
|
|
3
|
+
import { PullRequestStatus, GitVersionType, GitPullRequestQueryType, CommentThreadStatus, GitPullRequestMergeStrategy, } from "azure-devops-node-api/interfaces/GitInterfaces.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { getCurrentUserDetails, getUserIdFromEmail } from "./auth.js";
|
|
6
6
|
import { getEnumKeys } from "../utils.js";
|
|
@@ -193,7 +193,7 @@ function configureRepoTools(server, tokenProvider, connectionProvider, userAgent
|
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
|
-
server.tool(REPO_TOOLS.update_pull_request, "Update a Pull Request by ID with specified fields.", {
|
|
196
|
+
server.tool(REPO_TOOLS.update_pull_request, "Update a Pull Request by ID with specified fields, including setting autocomplete with various completion options.", {
|
|
197
197
|
repositoryId: z.string().describe("The ID of the repository where the pull request exists."),
|
|
198
198
|
pullRequestId: z.number().describe("The ID of the pull request to update."),
|
|
199
199
|
title: z.string().optional().describe("The new title for the pull request."),
|
|
@@ -201,7 +201,15 @@ function configureRepoTools(server, tokenProvider, connectionProvider, userAgent
|
|
|
201
201
|
isDraft: z.boolean().optional().describe("Whether the pull request should be a draft."),
|
|
202
202
|
targetRefName: z.string().optional().describe("The new target branch name (e.g., 'refs/heads/main')."),
|
|
203
203
|
status: z.enum(["Active", "Abandoned"]).optional().describe("The new status of the pull request. Can be 'Active' or 'Abandoned'."),
|
|
204
|
-
|
|
204
|
+
autoComplete: z.boolean().optional().describe("Set the pull request to autocomplete when all requirements are met."),
|
|
205
|
+
mergeStrategy: z
|
|
206
|
+
.enum(getEnumKeys(GitPullRequestMergeStrategy))
|
|
207
|
+
.optional()
|
|
208
|
+
.describe("The merge strategy to use when the pull request autocompletes. Defaults to 'NoFastForward'."),
|
|
209
|
+
deleteSourceBranch: z.boolean().optional().default(false).describe("Whether to delete the source branch when the pull request autocompletes. Defaults to false."),
|
|
210
|
+
transitionWorkItems: z.boolean().optional().default(true).describe("Whether to transition associated work items to the next state when the pull request autocompletes. Defaults to true."),
|
|
211
|
+
bypassReason: z.string().optional().describe("Reason for bypassing branch policies. When provided, branch policies will be automatically bypassed during autocompletion."),
|
|
212
|
+
}, async ({ repositoryId, pullRequestId, title, description, isDraft, targetRefName, status, autoComplete, mergeStrategy, deleteSourceBranch, transitionWorkItems, bypassReason }) => {
|
|
205
213
|
const connection = await connectionProvider();
|
|
206
214
|
const gitApi = await connection.getGitApi();
|
|
207
215
|
// Build update object with only provided fields
|
|
@@ -217,10 +225,33 @@ function configureRepoTools(server, tokenProvider, connectionProvider, userAgent
|
|
|
217
225
|
if (status !== undefined) {
|
|
218
226
|
updateRequest.status = status === "Active" ? PullRequestStatus.Active.valueOf() : PullRequestStatus.Abandoned.valueOf();
|
|
219
227
|
}
|
|
228
|
+
if (autoComplete !== undefined) {
|
|
229
|
+
if (autoComplete) {
|
|
230
|
+
const data = await getCurrentUserDetails(tokenProvider, connectionProvider, userAgentProvider);
|
|
231
|
+
const autoCompleteUserId = data.authenticatedUser.id;
|
|
232
|
+
updateRequest.autoCompleteSetBy = { id: autoCompleteUserId };
|
|
233
|
+
const completionOptions = {
|
|
234
|
+
deleteSourceBranch: deleteSourceBranch || false,
|
|
235
|
+
transitionWorkItems: transitionWorkItems !== false, // Default to true unless explicitly set to false
|
|
236
|
+
bypassPolicy: !!bypassReason, // Automatically set to true if bypassReason is provided
|
|
237
|
+
};
|
|
238
|
+
if (mergeStrategy) {
|
|
239
|
+
completionOptions.mergeStrategy = GitPullRequestMergeStrategy[mergeStrategy];
|
|
240
|
+
}
|
|
241
|
+
if (bypassReason) {
|
|
242
|
+
completionOptions.bypassReason = bypassReason;
|
|
243
|
+
}
|
|
244
|
+
updateRequest.completionOptions = completionOptions;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
updateRequest.autoCompleteSetBy = null;
|
|
248
|
+
updateRequest.completionOptions = null;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
220
251
|
// Validate that at least one field is provided for update
|
|
221
252
|
if (Object.keys(updateRequest).length === 0) {
|
|
222
253
|
return {
|
|
223
|
-
content: [{ type: "text", text: "Error: At least one field (title, description, isDraft, targetRefName, or
|
|
254
|
+
content: [{ type: "text", text: "Error: At least one field (title, description, isDraft, targetRefName, status, or autoComplete options) must be provided for update." }],
|
|
224
255
|
isError: true,
|
|
225
256
|
};
|
|
226
257
|
}
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageVersion = "2.2.0-nightly.
|
|
1
|
+
export const packageVersion = "2.2.0-nightly.20251003";
|