Skip to content

Commit 93b5c55

Browse files
committed
refactor code
1 parent 4226b58 commit 93b5c55

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

common/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ export const SearchWorkitemsSchema = z.object({
703703
// Advanced parameters
704704
advancedConditions: z.string().nullable().optional().describe("Advanced filter conditions, JSON format"),
705705
orderBy: z.string().optional().default("gmtCreate").describe("Sort field, default is gmtCreate. Possible values: gmtCreate, subject, status, priority, assignedTo"),
706-
includeDetails: z.boolean().optional().describe("Whether to automatically supplement missing description and other detailed information. If the description of a work item is null, it will automatically call the getWorkitem API to get details. It's recommended to use it only when the result quantity is small (≤100), to avoid too many API calls affecting performance. Default is false")
706+
includeDetails: z.boolean().optional().describe("Set to true when you need work item descriptions/detailed content. This automatically fetches missing descriptions instead of requiring separate get_work_item calls. RECOMMENDED: Use includeDetails=true when user asks for 'detailed content', 'descriptions', or 'full information' of work items. This is more efficient than calling get_work_item multiple times. Default is false")
707707
});
708708

709709
// Codeup branches related Schema definitions

common/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = "0.1.14";
1+
export const VERSION = "0.1.17";

operations/projex/workitem.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export async function searchWorkitemsFunc(
5555
finalCreator = creator;
5656
}
5757
} catch (error) {
58-
console.warn("获取当前用户信息失败,将使用原始值:", error);
5958
finalAssignedTo = assignedTo;
6059
finalCreator = creator;
6160
}
@@ -99,10 +98,9 @@ export async function searchWorkitemsFunc(
9998

10099
// 如果需要补充详细信息,使用分批并发方式获取
101100
if (includeDetails) {
102-
// 找出description为null的工作项,同时确保id是有效的字符串
103101
const itemsNeedingDetails = workItems.filter(item =>
104-
typeof item.id === 'string' && item.id.length > 0 &&
105-
(item.description === null || item.description === undefined)
102+
item.id.length > 0 &&
103+
(item.description === null || item.description === undefined || item.description === "")
106104
);
107105

108106
if (itemsNeedingDetails.length > 0) {
@@ -111,7 +109,7 @@ export async function searchWorkitemsFunc(
111109

112110
// 更新workItems中的description
113111
return workItems.map(item => {
114-
if (typeof item.id === 'string' && descriptionMap.has(item.id)) {
112+
if (descriptionMap.has(item.id)) {
115113
return {
116114
...item,
117115
description: descriptionMap.get(item.id) || item.description
@@ -136,10 +134,6 @@ async function batchGetWorkItemDetails(
136134

137135
// 限制处理数量
138136
const limitedItems = workItems.slice(0, maxItems);
139-
140-
if (workItems.length > maxItems) {
141-
console.log(`工作项数量较多,只处理前 ${maxItems} 个`);
142-
}
143137

144138
// 分批处理
145139
for (let i = 0; i < limitedItems.length; i += batchSize) {
@@ -167,7 +161,6 @@ async function batchGetWorkItemDetails(
167161
success: true
168162
};
169163
} catch (error) {
170-
console.warn(`获取工作项 ${itemId} 详情失败:`, error);
171164
return {
172165
id: itemId,
173166
description: null,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "alibabacloud-devops-mcp-server",
3-
"version": "0.1.15",
3+
"version": "0.1.17",
44
"description": "MCP Server for using the alibabacloud-devops API: allows AI assistants to directly participate in development collaboration, helping teams optimize development processes and improve efficiency.",
55
"type": "module",
66
"license": "Apache-2.0",

0 commit comments

Comments
 (0)