@zzp123/mcp-zentao 1.1.0 → 1.1.2

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.
@@ -80,23 +80,16 @@ export class ZentaoAPI {
80
80
  return response.tasks;
81
81
  }
82
82
  async getTaskDetail(taskId) {
83
- console.log(`正在获取任务 ${taskId} 的详情`);
84
- const response = await this.request('GET', `/tasks/${taskId}`);
85
- console.log('任务详情响应:', response);
86
- if (!response) {
87
- throw new Error(`获取任务详情失败: 响应为空`);
88
- }
89
- // 检查响应格式
90
- if (response && typeof response === 'object') {
91
- if ('task' in response) {
92
- return response.task;
93
- }
94
- else {
95
- // 如果响应本身就是任务对象
96
- return response;
97
- }
83
+ try {
84
+ console.log(`正在获取任务 ${taskId} 的详情...`);
85
+ const response = await this.request('GET', `/tasks/${taskId}`);
86
+ console.log('任务详情响应:', response);
87
+ return response;
88
+ }
89
+ catch (error) {
90
+ console.error('获取任务详情失败:', error);
91
+ throw error;
98
92
  }
99
- throw new Error(`获取任务详情失败: 响应格式不正确 ${JSON.stringify(response)}`);
100
93
  }
101
94
  async getProducts() {
102
95
  try {
@@ -154,8 +147,16 @@ export class ZentaoAPI {
154
147
  }
155
148
  }
156
149
  async getBugDetail(bugId) {
157
- const response = await this.request('GET', `/bugs/${bugId}`);
158
- return response.bug;
150
+ try {
151
+ console.log(`正在获取Bug ${bugId} 的详情...`);
152
+ const response = await this.request('GET', `/bugs/${bugId}`);
153
+ console.log('Bug详情响应:', response);
154
+ return response;
155
+ }
156
+ catch (error) {
157
+ console.error('获取Bug详情失败:', error);
158
+ throw error;
159
+ }
159
160
  }
160
161
  async updateTask(taskId, update) {
161
162
  try {
@@ -294,18 +295,9 @@ export class ZentaoAPI {
294
295
  async getPlanDetail(planId) {
295
296
  try {
296
297
  console.log(`正在获取计划 ${planId} 的详情...`);
297
- const response = await this.request('GET', `/products/plans/${planId}`);
298
+ const response = await this.request('GET', `/productplans/${planId}`);
298
299
  console.log('计划详情响应:', response);
299
- if (response && typeof response === 'object') {
300
- if ('plan' in response) {
301
- return response.plan;
302
- }
303
- else {
304
- // 如果响应本身就是计划对象
305
- return response;
306
- }
307
- }
308
- throw new Error(`获取计划详情失败: 响应格式不正确 ${JSON.stringify(response)}`);
300
+ return response;
309
301
  }
310
302
  catch (error) {
311
303
  console.error('获取计划详情失败:', error);
@@ -417,15 +409,7 @@ export class ZentaoAPI {
417
409
  console.log(`正在获取需求 ${storyId} 的详情...`);
418
410
  const response = await this.request('GET', `/stories/${storyId}`);
419
411
  console.log('需求详情响应:', response);
420
- if (response && typeof response === 'object') {
421
- if ('story' in response) {
422
- return response.story;
423
- }
424
- else {
425
- return response;
426
- }
427
- }
428
- throw new Error(`获取需求详情失败: 响应格式不正确 ${JSON.stringify(response)}`);
412
+ return response;
429
413
  }
430
414
  catch (error) {
431
415
  console.error('获取需求详情失败:', error);
package/dist/index.js CHANGED
@@ -380,11 +380,12 @@ server.tool("createBug", {
380
380
  task: z.number().optional(),
381
381
  story: z.number().optional(),
382
382
  deadline: z.string().optional(),
383
- openedBuild: z.array(z.string()).optional()
383
+ openedBuild: z.array(z.string()).optional().default(["trunk"])
384
384
  }, async ({ productId, title, severity, pri, type, branch, module, execution, keywords, os, browser, steps, task, story, deadline, openedBuild }) => {
385
385
  if (!zentaoApi)
386
386
  throw new Error("Please initialize Zentao API first");
387
- const bug = await zentaoApi.createBug(productId, {
387
+ // 如果未提供 openedBuild,使用默认值 ["trunk"] 表示主干版本
388
+ const bugData = {
388
389
  title,
389
390
  severity,
390
391
  pri,
@@ -399,8 +400,9 @@ server.tool("createBug", {
399
400
  task,
400
401
  story,
401
402
  deadline,
402
- openedBuild
403
- });
403
+ openedBuild: openedBuild || ["trunk"]
404
+ };
405
+ const bug = await zentaoApi.createBug(productId, bugData);
404
406
  return {
405
407
  content: [{ type: "text", text: JSON.stringify(bug, null, 2) }]
406
408
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzp123/mcp-zentao",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "禅道项目管理系统的高级API集成包,提供任务管理、Bug跟踪等功能的完整封装,专为Cursor IDE设计的MCP扩展",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -42,6 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@modelcontextprotocol/sdk": "^1.6.1",
45
+ "@zzp123/mcp-zentao": "^1.1.0",
45
46
  "axios": "^1.6.7",
46
47
  "chalk": "^4.1.2",
47
48
  "fs": "^0.0.1-security",