@taole/deploy-helper 1.0.1 → 1.0.3

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.
Files changed (29) hide show
  1. package/README.md +1 -4
  2. package/lib/offlinePkg.mjs +21 -2
  3. package/lib/pipelineApi.mjs +17 -16
  4. package/lib/yunxiaoFlowApi.mjs +115 -0
  5. package/package.json +4 -5
  6. package/modules/alibabacloud-devops-mcp-server/dist/common/errors.js +0 -69
  7. package/modules/alibabacloud-devops-mcp-server/dist/common/modularTemplates.js +0 -483
  8. package/modules/alibabacloud-devops-mcp-server/dist/common/pipelineTemplates.js +0 -19
  9. package/modules/alibabacloud-devops-mcp-server/dist/common/types.js +0 -1119
  10. package/modules/alibabacloud-devops-mcp-server/dist/common/utils.js +0 -353
  11. package/modules/alibabacloud-devops-mcp-server/dist/common/version.js +0 -1
  12. package/modules/alibabacloud-devops-mcp-server/dist/index.js +0 -1067
  13. package/modules/alibabacloud-devops-mcp-server/dist/operations/codeup/branches.js +0 -144
  14. package/modules/alibabacloud-devops-mcp-server/dist/operations/codeup/changeRequestComments.js +0 -89
  15. package/modules/alibabacloud-devops-mcp-server/dist/operations/codeup/changeRequests.js +0 -203
  16. package/modules/alibabacloud-devops-mcp-server/dist/operations/codeup/compare.js +0 -26
  17. package/modules/alibabacloud-devops-mcp-server/dist/operations/codeup/files.js +0 -233
  18. package/modules/alibabacloud-devops-mcp-server/dist/operations/codeup/repositories.js +0 -64
  19. package/modules/alibabacloud-devops-mcp-server/dist/operations/flow/hostGroup.js +0 -48
  20. package/modules/alibabacloud-devops-mcp-server/dist/operations/flow/pipeline.js +0 -514
  21. package/modules/alibabacloud-devops-mcp-server/dist/operations/flow/pipelineJob.js +0 -113
  22. package/modules/alibabacloud-devops-mcp-server/dist/operations/flow/serviceConnection.js +0 -23
  23. package/modules/alibabacloud-devops-mcp-server/dist/operations/organization/members.js +0 -94
  24. package/modules/alibabacloud-devops-mcp-server/dist/operations/organization/organization.js +0 -73
  25. package/modules/alibabacloud-devops-mcp-server/dist/operations/packages/artifacts.js +0 -64
  26. package/modules/alibabacloud-devops-mcp-server/dist/operations/packages/repositories.js +0 -35
  27. package/modules/alibabacloud-devops-mcp-server/dist/operations/projex/project.js +0 -206
  28. package/modules/alibabacloud-devops-mcp-server/dist/operations/projex/sprint.js +0 -30
  29. package/modules/alibabacloud-devops-mcp-server/dist/operations/projex/workitem.js +0 -264
@@ -1,264 +0,0 @@
1
- import { yunxiaoRequest } from "../../common/utils.js";
2
- import { WorkItemSchema } from "../../common/types.js";
3
- import { getCurrentUserFunc } from "../organization/organization.js";
4
- export async function getWorkItemFunc(organizationId, workItemId) {
5
- const url = `/oapi/v1/projex/organizations/${organizationId}/workitems/${workItemId}`;
6
- const response = await yunxiaoRequest(url, {
7
- method: "GET",
8
- });
9
- return WorkItemSchema.parse(response);
10
- }
11
- export async function searchWorkitemsFunc(organizationId, category, spaceId, subject, status, createdAfter, createdBefore, updatedAfter, updatedBefore, creator, assignedTo, advancedConditions, orderBy = "gmtCreate", includeDetails = false // 新增参数:是否自动补充缺失的description等详细信息
12
- ) {
13
- // 处理assignedTo为"self"的情况,自动获取当前用户ID
14
- let finalAssignedTo = assignedTo;
15
- let finalCreator = creator;
16
- if (assignedTo === "self" || creator === "self") {
17
- try {
18
- const currentUser = await getCurrentUserFunc();
19
- if (currentUser.id) {
20
- if (assignedTo === "self") {
21
- finalAssignedTo = currentUser.id;
22
- }
23
- if (creator === "self") {
24
- finalCreator = currentUser.id;
25
- }
26
- }
27
- else {
28
- finalAssignedTo = assignedTo;
29
- finalCreator = creator;
30
- }
31
- }
32
- catch (error) {
33
- finalAssignedTo = assignedTo;
34
- finalCreator = creator;
35
- }
36
- }
37
- const url = `/oapi/v1/projex/organizations/${organizationId}/workitems:search`;
38
- const payload = {
39
- category: category,
40
- spaceId: spaceId,
41
- };
42
- const conditions = buildWorkitemConditions({
43
- subject,
44
- status,
45
- createdAfter,
46
- createdBefore,
47
- updatedAfter,
48
- updatedBefore,
49
- creator: finalCreator,
50
- assignedTo: finalAssignedTo,
51
- advancedConditions
52
- });
53
- if (conditions) {
54
- payload.conditions = conditions;
55
- }
56
- payload.orderBy = orderBy;
57
- const response = await yunxiaoRequest(url, {
58
- method: "POST",
59
- body: payload,
60
- });
61
- if (!Array.isArray(response)) {
62
- return [];
63
- }
64
- const workItems = response.map(workitem => WorkItemSchema.parse(workitem));
65
- // 如果需要补充详细信息,使用分批并发方式获取
66
- if (includeDetails) {
67
- const itemsNeedingDetails = workItems.filter(item => item.id.length > 0 &&
68
- (item.description === null || item.description === undefined || item.description === ""));
69
- if (itemsNeedingDetails.length > 0) {
70
- // 分批并发获取详情
71
- const descriptionMap = await batchGetWorkItemDetails(organizationId, itemsNeedingDetails);
72
- // 更新workItems中的description
73
- return workItems.map(item => {
74
- if (descriptionMap.has(item.id)) {
75
- return {
76
- ...item,
77
- description: descriptionMap.get(item.id) || item.description
78
- };
79
- }
80
- return item;
81
- });
82
- }
83
- }
84
- return workItems;
85
- }
86
- // 分批并发获取工作项详情
87
- async function batchGetWorkItemDetails(organizationId, workItems, batchSize = 10, // 每批处理10个
88
- maxItems = 100 // 最多处理100个
89
- ) {
90
- const descriptionMap = new Map();
91
- // 限制处理数量
92
- const limitedItems = workItems.slice(0, maxItems);
93
- // 分批处理
94
- for (let i = 0; i < limitedItems.length; i += batchSize) {
95
- const batch = limitedItems.slice(i, i + batchSize);
96
- // 批次内并发执行
97
- const batchResults = await Promise.allSettled(batch.map(async (item) => {
98
- // 再次检查item.id是否为有效字符串
99
- if (typeof item.id !== 'string' || item.id.length === 0) {
100
- return {
101
- id: item.id || 'unknown',
102
- description: null,
103
- success: false
104
- };
105
- }
106
- const itemId = item.id;
107
- try {
108
- const detailedItem = await getWorkItemFunc(organizationId, itemId);
109
- return {
110
- id: itemId,
111
- description: detailedItem.description,
112
- success: true
113
- };
114
- }
115
- catch (error) {
116
- return {
117
- id: itemId,
118
- description: null,
119
- success: false
120
- };
121
- }
122
- }));
123
- // 处理批次结果
124
- batchResults.forEach((result) => {
125
- if (result.status === 'fulfilled') {
126
- // 确保description类型正确,将undefined转换为null
127
- const description = result.value.description === undefined ? null : result.value.description;
128
- descriptionMap.set(result.value.id, description);
129
- }
130
- });
131
- }
132
- return descriptionMap;
133
- }
134
- function buildWorkitemConditions(args) {
135
- if (args.advancedConditions) {
136
- return args.advancedConditions;
137
- }
138
- const filterConditions = [];
139
- if (args.subject) {
140
- filterConditions.push({
141
- className: "string",
142
- fieldIdentifier: "subject",
143
- format: "input",
144
- operator: "CONTAINS",
145
- toValue: null,
146
- value: [args.subject],
147
- });
148
- }
149
- if (args.status) {
150
- const statusValues = args.status.split(",");
151
- const values = statusValues.map(v => v.trim());
152
- filterConditions.push({
153
- className: "status",
154
- fieldIdentifier: "status",
155
- format: "list",
156
- operator: "CONTAINS",
157
- toValue: null,
158
- value: values,
159
- });
160
- }
161
- if (args.createdAfter) {
162
- const createdBefore = args.createdBefore ? `${args.createdBefore} 23:59:59` : null;
163
- filterConditions.push({
164
- className: "dateTime",
165
- fieldIdentifier: "gmtCreate",
166
- format: "input",
167
- operator: "BETWEEN",
168
- toValue: createdBefore,
169
- value: [`${args.createdAfter} 00:00:00`],
170
- });
171
- }
172
- if (args.updatedAfter) {
173
- const updatedBefore = args.updatedBefore ? `${args.updatedBefore} 23:59:59` : null;
174
- filterConditions.push({
175
- className: "dateTime",
176
- fieldIdentifier: "gmtModified",
177
- format: "input",
178
- operator: "BETWEEN",
179
- toValue: updatedBefore,
180
- value: [`${args.updatedAfter} 00:00:00`],
181
- });
182
- }
183
- if (args.creator) {
184
- const creatorValues = args.creator.split(",");
185
- const values = creatorValues.map(v => v.trim());
186
- filterConditions.push({
187
- className: "user",
188
- fieldIdentifier: "creator",
189
- format: "list",
190
- operator: "CONTAINS",
191
- toValue: null,
192
- value: values,
193
- });
194
- }
195
- if (args.assignedTo) {
196
- const assignedToValues = args.assignedTo.split(",");
197
- const values = assignedToValues.map(v => v.trim());
198
- filterConditions.push({
199
- className: "user",
200
- fieldIdentifier: "assignedTo",
201
- format: "list",
202
- operator: "CONTAINS",
203
- toValue: null,
204
- value: values,
205
- });
206
- }
207
- if (filterConditions.length === 0) {
208
- return undefined;
209
- }
210
- const conditions = {
211
- conditionGroups: [filterConditions],
212
- };
213
- return JSON.stringify(conditions);
214
- }
215
- export async function createWorkItemFunc(organizationId, assignedTo, spaceId, subject, workitemTypeId, customFieldValues, description, labels, parentId, participants, sprint, trackers, verifier, versions) {
216
- const url = `/oapi/v1/projex/organizations/${organizationId}/workitems`;
217
- const payload = {
218
- assignedTo,
219
- spaceId,
220
- subject,
221
- workitemTypeId
222
- };
223
- if (customFieldValues) {
224
- payload.customFieldValues = customFieldValues;
225
- }
226
- if (description !== undefined) {
227
- payload.description = description;
228
- }
229
- if (labels && labels.length > 0) {
230
- payload.labels = labels;
231
- }
232
- if (parentId !== undefined) {
233
- payload.parentId = parentId;
234
- }
235
- if (participants && participants.length > 0) {
236
- payload.participants = participants;
237
- }
238
- if (sprint !== undefined) {
239
- payload.sprint = sprint;
240
- }
241
- if (trackers && trackers.length > 0) {
242
- payload.trackers = trackers;
243
- }
244
- if (verifier !== undefined) {
245
- payload.verifier = verifier;
246
- }
247
- if (versions && versions.length > 0) {
248
- payload.versions = versions;
249
- }
250
- const response = await yunxiaoRequest(url, {
251
- method: "POST",
252
- body: payload,
253
- });
254
- return WorkItemSchema.parse(response);
255
- }
256
- export async function getWorkItemTypesFunc(organizationId, id, // 项目唯一标识
257
- category // 工作项类型,可选值为 Req,Bug,Task 等。
258
- ) {
259
- const url = `/oapi/v1/projex/organizations/${organizationId}/projects/${id}/workitemTypes?category=${encodeURIComponent(category)}`;
260
- const response = await yunxiaoRequest(url, {
261
- method: "GET",
262
- });
263
- return response;
264
- }