@azure-devops/mcp 2.1.0-nightly.20250917 → 2.1.0-nightly.20250918
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/work-items.js +8 -7
- package/dist/utils.js +13 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/tools/work-items.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { WorkItemExpand } from "azure-devops-node-api/interfaces/WorkItemTrackingInterfaces.js";
|
|
4
4
|
import { QueryExpand } from "azure-devops-node-api/interfaces/WorkItemTrackingInterfaces.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import { batchApiVersion, markdownCommentsApiVersion, getEnumKeys, safeEnumConvert } from "../utils.js";
|
|
6
|
+
import { batchApiVersion, markdownCommentsApiVersion, getEnumKeys, safeEnumConvert, encodeFormattedValue } from "../utils.js";
|
|
7
7
|
const WORKITEM_TOOLS = {
|
|
8
8
|
my_work_items: "wit_my_work_items",
|
|
9
9
|
list_backlogs: "wit_list_backlogs",
|
|
@@ -218,6 +218,7 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
|
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
220
|
const body = items.map((item, x) => {
|
|
221
|
+
const encodedDescription = encodeFormattedValue(item.description, item.format);
|
|
221
222
|
const ops = [
|
|
222
223
|
{
|
|
223
224
|
op: "add",
|
|
@@ -232,12 +233,12 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
|
|
|
232
233
|
{
|
|
233
234
|
op: "add",
|
|
234
235
|
path: "/fields/System.Description",
|
|
235
|
-
value:
|
|
236
|
+
value: encodedDescription,
|
|
236
237
|
},
|
|
237
238
|
{
|
|
238
239
|
op: "add",
|
|
239
240
|
path: "/fields/Microsoft.VSTS.TCM.ReproSteps",
|
|
240
|
-
value:
|
|
241
|
+
value: encodedDescription,
|
|
241
242
|
},
|
|
242
243
|
{
|
|
243
244
|
op: "add",
|
|
@@ -428,10 +429,10 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
|
|
|
428
429
|
try {
|
|
429
430
|
const connection = await connectionProvider();
|
|
430
431
|
const workItemApi = await connection.getWorkItemTrackingApi();
|
|
431
|
-
const document = fields.map(({ name, value }) => ({
|
|
432
|
+
const document = fields.map(({ name, value, format }) => ({
|
|
432
433
|
op: "add",
|
|
433
434
|
path: `/fields/${name}`,
|
|
434
|
-
value: value,
|
|
435
|
+
value: encodeFormattedValue(value, format),
|
|
435
436
|
}));
|
|
436
437
|
// Check if any field has format === "Markdown" and add the multilineFieldsFormat operation
|
|
437
438
|
// this should only happen for large text fields, but since we dont't know by field name, lets assume if the users
|
|
@@ -512,10 +513,10 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
|
|
|
512
513
|
const uniqueIds = Array.from(new Set(updates.map((update) => update.id)));
|
|
513
514
|
const body = uniqueIds.map((id) => {
|
|
514
515
|
const workItemUpdates = updates.filter((update) => update.id === id);
|
|
515
|
-
const operations = workItemUpdates.map(({ op, path, value }) => ({
|
|
516
|
+
const operations = workItemUpdates.map(({ op, path, value, format }) => ({
|
|
516
517
|
op: op,
|
|
517
518
|
path: path,
|
|
518
|
-
value: value,
|
|
519
|
+
value: encodeFormattedValue(value, format),
|
|
519
520
|
}));
|
|
520
521
|
// Add format operations for Markdown fields
|
|
521
522
|
workItemUpdates.forEach(({ path, value, format }) => {
|
package/dist/utils.js
CHANGED
|
@@ -54,3 +54,16 @@ export function safeEnumConvert(enumObject, key) {
|
|
|
54
54
|
}
|
|
55
55
|
return enumObject[key];
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Encodes `>` and `<` for Markdown formatted fields.
|
|
59
|
+
*
|
|
60
|
+
* @param value The text value to encode
|
|
61
|
+
* @param format The format of the field ('Markdown' or 'Html')
|
|
62
|
+
* @returns The encoded text, or original text if format is not Markdown
|
|
63
|
+
*/
|
|
64
|
+
export function encodeFormattedValue(value, format) {
|
|
65
|
+
if (!value || format !== "Markdown")
|
|
66
|
+
return value;
|
|
67
|
+
const result = value.replace(/</g, "<").replace(/>/g, ">");
|
|
68
|
+
return result;
|
|
69
|
+
}
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageVersion = "2.1.0-nightly.
|
|
1
|
+
export const packageVersion = "2.1.0-nightly.20250918";
|