-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathschemas.ts
120 lines (115 loc) · 3.77 KB
/
schemas.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import { z } from 'zod';
import { WorkItemExpand } from 'azure-devops-node-api/interfaces/WorkItemTrackingInterfaces';
/**
* Schema for getting a work item
*/
export const GetWorkItemSchema = z.object({
workItemId: z.number().describe('The ID of the work item'),
expand: z
.nativeEnum(WorkItemExpand)
.optional()
.describe(
'The level of detail to include in the response. Defaults to "all" if not specified.',
),
});
/**
* Schema for listing work items
*/
export const ListWorkItemsSchema = z.object({
projectId: z.string().describe('The ID or name of the project'),
teamId: z.string().optional().describe('The ID of the team'),
queryId: z.string().optional().describe('ID of a saved work item query'),
wiql: z.string().optional().describe('Work Item Query Language (WIQL) query'),
top: z.number().optional().describe('Maximum number of work items to return'),
skip: z.number().optional().describe('Number of work items to skip'),
});
/**
* Schema for creating a work item
*/
export const CreateWorkItemSchema = z.object({
projectId: z.string().describe('The ID or name of the project'),
workItemType: z
.string()
.describe(
'The type of work item to create (e.g., "Task", "Bug", "User Story")',
),
title: z.string().describe('The title of the work item'),
description: z
.string()
.optional()
.describe('The description of the work item'),
assignedTo: z
.string()
.optional()
.describe('The email or name of the user to assign the work item to'),
areaPath: z.string().optional().describe('The area path for the work item'),
iterationPath: z
.string()
.optional()
.describe('The iteration path for the work item'),
priority: z.number().optional().describe('The priority of the work item'),
parentId: z
.number()
.optional()
.describe('The ID of the parent work item to create a relationship with'),
additionalFields: z
.record(z.string(), z.any())
.optional()
.describe('Additional fields to set on the work item'),
});
/**
* Schema for updating a work item
*/
export const UpdateWorkItemSchema = z.object({
workItemId: z.number().describe('The ID of the work item to update'),
title: z.string().optional().describe('The updated title of the work item'),
description: z
.string()
.optional()
.describe('The updated description of the work item'),
assignedTo: z
.string()
.optional()
.describe('The email or name of the user to assign the work item to'),
areaPath: z
.string()
.optional()
.describe('The updated area path for the work item'),
iterationPath: z
.string()
.optional()
.describe('The updated iteration path for the work item'),
priority: z
.number()
.optional()
.describe('The updated priority of the work item'),
state: z.string().optional().describe('The updated state of the work item'),
additionalFields: z
.record(z.string(), z.any())
.optional()
.describe('Additional fields to update on the work item'),
});
/**
* Schema for managing work item links
*/
export const ManageWorkItemLinkSchema = z.object({
sourceWorkItemId: z.number().describe('The ID of the source work item'),
targetWorkItemId: z.number().describe('The ID of the target work item'),
projectId: z.string().describe('The ID or name of the project'),
operation: z
.enum(['add', 'remove', 'update'])
.describe('The operation to perform on the link'),
relationType: z
.string()
.describe(
'The reference name of the relation type (e.g., "System.LinkTypes.Hierarchy-Forward")',
),
newRelationType: z
.string()
.optional()
.describe('The new relation type to use when updating a link'),
comment: z
.string()
.optional()
.describe('Optional comment explaining the link'),
});