@zzp123/mcp-zentao 1.3.1 → 1.4.0
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/api/zentaoApi.d.ts +2 -2
- package/dist/api/zentaoApi.js +19 -17
- package/dist/index.js +23 -17
- package/dist/types/zentao.d.ts +7 -5
- package/package.json +1 -1
package/dist/api/zentaoApi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssignFeedbackRequest, Bug,
|
|
1
|
+
import { AssignFeedbackRequest, Bug, BugStatus, Build, CloseFeedbackRequest, CreateBuildRequest, CreateBugRequest, CreateExecutionRequest, CreateFeedbackRequest, CreatePlanRequest, CreateProductRequest, CreateProgramRequest, CreateProjectRequest, CreateStoryRequest, CreateTaskRequest, CreateTestCaseRequest, CreateTicketRequest, CreateUserRequest, Execution, Feedback, FileUploadResponse, Module, ModuleType, Plan, Product, Program, Project, Release, ResolveBugRequest, Story, Task, TaskStatus, TaskUpdate, TestCase, Ticket, UpdateBuildRequest, UpdateBugRequest, UpdateExecutionRequest, UpdateFeedbackRequest, UpdatePlanRequest, UpdateProductRequest, UpdateProgramRequest, UpdateProjectRequest, UpdateStoryRequest, UpdateTestCaseRequest, UpdateTicketRequest, UpdateUserRequest, UploadFileRequest, UserDetail, ZentaoConfig } from '../types/zentao';
|
|
2
2
|
export declare class ZentaoAPI {
|
|
3
3
|
private config;
|
|
4
4
|
private client;
|
|
@@ -11,9 +11,9 @@ export declare class ZentaoAPI {
|
|
|
11
11
|
getProducts(): Promise<Product[]>;
|
|
12
12
|
getMyBugs(status?: BugStatus, productId?: number): Promise<Bug[]>;
|
|
13
13
|
getBugDetail(bugId: number): Promise<Bug>;
|
|
14
|
+
resolveBug(bugId: number, resolution: ResolveBugRequest): Promise<Bug>;
|
|
14
15
|
updateTask(taskId: number, update: TaskUpdate): Promise<Task>;
|
|
15
16
|
finishTask(taskId: number, update?: TaskUpdate): Promise<Task>;
|
|
16
|
-
resolveBug(bugId: number, resolution: BugResolution): Promise<Bug>;
|
|
17
17
|
createTask(task: CreateTaskRequest): Promise<Task>;
|
|
18
18
|
getPrograms(order?: string): Promise<Program[]>;
|
|
19
19
|
getProductPlans(productId: number, branch?: number, begin?: string, end?: string, status?: string, parent?: number): Promise<Plan[]>;
|
package/dist/api/zentaoApi.js
CHANGED
|
@@ -158,6 +158,25 @@ export class ZentaoAPI {
|
|
|
158
158
|
throw error;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
+
async resolveBug(bugId, resolution) {
|
|
162
|
+
try {
|
|
163
|
+
console.log(`正在解决Bug ${bugId}...`);
|
|
164
|
+
// 验证必填字段
|
|
165
|
+
if (resolution.resolution === 'fixed' && !resolution.resolvedBuild) {
|
|
166
|
+
throw new Error('当解决方案为"已解决(fixed)"时,必须提供解决版本(resolvedBuild)');
|
|
167
|
+
}
|
|
168
|
+
if (resolution.resolution === 'duplicate' && !resolution.duplicateBug) {
|
|
169
|
+
throw new Error('当解决方案为"重复Bug(duplicate)"时,必须提供重复Bug的ID(duplicateBug)');
|
|
170
|
+
}
|
|
171
|
+
const response = await this.request('POST', `/bugs/${bugId}/resolve`, undefined, resolution);
|
|
172
|
+
console.log('Bug解决响应:', response);
|
|
173
|
+
return response;
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
console.error('解决Bug失败:', error);
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
161
180
|
async updateTask(taskId, update) {
|
|
162
181
|
try {
|
|
163
182
|
console.log(`正在更新任务 ${taskId}...`);
|
|
@@ -188,23 +207,6 @@ export class ZentaoAPI {
|
|
|
188
207
|
throw error;
|
|
189
208
|
}
|
|
190
209
|
}
|
|
191
|
-
async resolveBug(bugId, resolution) {
|
|
192
|
-
try {
|
|
193
|
-
console.log(`正在解决Bug ${bugId}...`);
|
|
194
|
-
const response = await this.request('PUT', `/bugs/${bugId}`, undefined, {
|
|
195
|
-
status: 'resolved',
|
|
196
|
-
assignedTo: this.config.username,
|
|
197
|
-
...resolution,
|
|
198
|
-
resolvedDate: new Date().toISOString(),
|
|
199
|
-
});
|
|
200
|
-
console.log('Bug解决响应:', response);
|
|
201
|
-
return response;
|
|
202
|
-
}
|
|
203
|
-
catch (error) {
|
|
204
|
-
console.error('解决Bug失败:', error);
|
|
205
|
-
throw error;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
210
|
async createTask(task) {
|
|
209
211
|
try {
|
|
210
212
|
console.log('正在创建新任务...');
|
package/dist/index.js
CHANGED
|
@@ -109,6 +109,29 @@ server.tool("getBugDetail", {
|
|
|
109
109
|
content: [{ type: "text", text: JSON.stringify(bug, null, 2) }]
|
|
110
110
|
};
|
|
111
111
|
});
|
|
112
|
+
// Add resolveBug tool
|
|
113
|
+
server.tool("resolveBug", {
|
|
114
|
+
bugId: z.number(),
|
|
115
|
+
resolution: z.enum(['fixed', 'bydesign', 'duplicate', 'external', 'notrepro', 'postponed', 'willnotfix']),
|
|
116
|
+
resolvedBuild: z.string().optional(),
|
|
117
|
+
assignedTo: z.string().optional(),
|
|
118
|
+
comment: z.string().optional(),
|
|
119
|
+
duplicateBug: z.number().optional()
|
|
120
|
+
}, async ({ bugId, resolution, resolvedBuild, assignedTo, comment, duplicateBug }) => {
|
|
121
|
+
if (!zentaoApi)
|
|
122
|
+
throw new Error("Please initialize Zentao API first");
|
|
123
|
+
const resolveBugRequest = {
|
|
124
|
+
resolution,
|
|
125
|
+
resolvedBuild,
|
|
126
|
+
assignedTo,
|
|
127
|
+
comment,
|
|
128
|
+
duplicateBug
|
|
129
|
+
};
|
|
130
|
+
const bug = await zentaoApi.resolveBug(bugId, resolveBugRequest);
|
|
131
|
+
return {
|
|
132
|
+
content: [{ type: "text", text: JSON.stringify(bug, null, 2) }]
|
|
133
|
+
};
|
|
134
|
+
});
|
|
112
135
|
// Add updateTask tool
|
|
113
136
|
server.tool("updateTask", {
|
|
114
137
|
taskId: z.number(),
|
|
@@ -143,23 +166,6 @@ server.tool("finishTask", {
|
|
|
143
166
|
content: [{ type: "text", text: JSON.stringify(task, null, 2) }]
|
|
144
167
|
};
|
|
145
168
|
});
|
|
146
|
-
// Add resolveBug tool
|
|
147
|
-
server.tool("resolveBug", {
|
|
148
|
-
bugId: z.number(),
|
|
149
|
-
resolution: z.object({
|
|
150
|
-
resolution: z.enum(['fixed', 'notrepro', 'duplicate', 'bydesign', 'willnotfix', 'tostory', 'external']),
|
|
151
|
-
resolvedBuild: z.string().optional(),
|
|
152
|
-
duplicateBug: z.number().optional(),
|
|
153
|
-
comment: z.string().optional()
|
|
154
|
-
})
|
|
155
|
-
}, async ({ bugId, resolution }) => {
|
|
156
|
-
if (!zentaoApi)
|
|
157
|
-
throw new Error("Please initialize Zentao API first");
|
|
158
|
-
const bug = await zentaoApi.resolveBug(bugId, resolution);
|
|
159
|
-
return {
|
|
160
|
-
content: [{ type: "text", text: JSON.stringify(bug, null, 2) }]
|
|
161
|
-
};
|
|
162
|
-
});
|
|
163
169
|
// Add getPrograms tool
|
|
164
170
|
server.tool("getPrograms", {
|
|
165
171
|
order: z.string().optional()
|
package/dist/types/zentao.d.ts
CHANGED
|
@@ -48,14 +48,16 @@ export interface TaskUpdate {
|
|
|
48
48
|
finishedDate?: string;
|
|
49
49
|
comment?: string;
|
|
50
50
|
}
|
|
51
|
-
export
|
|
52
|
-
|
|
51
|
+
export type TaskStatus = 'wait' | 'doing' | 'done' | 'all';
|
|
52
|
+
export type BugStatus = 'active' | 'resolved' | 'closed' | 'all';
|
|
53
|
+
export type ResolutionType = 'fixed' | 'bydesign' | 'duplicate' | 'external' | 'notrepro' | 'postponed' | 'willnotfix';
|
|
54
|
+
export interface ResolveBugRequest {
|
|
55
|
+
resolution: ResolutionType;
|
|
53
56
|
resolvedBuild?: string;
|
|
54
|
-
|
|
57
|
+
assignedTo?: string;
|
|
55
58
|
comment?: string;
|
|
59
|
+
duplicateBug?: number;
|
|
56
60
|
}
|
|
57
|
-
export type TaskStatus = 'wait' | 'doing' | 'done' | 'all';
|
|
58
|
-
export type BugStatus = 'active' | 'resolved' | 'closed' | 'all';
|
|
59
61
|
export interface User {
|
|
60
62
|
id: number;
|
|
61
63
|
account: string;
|