@zzp123/mcp-zentao 1.8.7 → 1.8.9

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/CHANGELOG.md CHANGED
@@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.8.9] - 2025-11-06
9
+
10
+ ### Fixed
11
+ - **修复 resolveBug 工具必须提供 resolvedBuild 参数的问题**
12
+ - 当 resolution 为 "fixed" 时,如果未提供 resolvedBuild,自动设置为 "trunk"(主干版本)
13
+ - 消除了使用 resolveBug 工具时的常见错误:"当解决方案为"已解决(fixed)"时,必须提供解决版本(resolvedBuild)"
14
+ - 简化了解决Bug的操作流程,提升用户体验
15
+
16
+ ### Improved
17
+ - 添加了自动默认值设置的日志输出,便于调试和追踪
18
+
19
+ ## [1.8.8] - 2025-11-06
20
+
21
+ ### Fixed
22
+ - **修复 getMyBugs 工具返回Bug数量为0的问题**
23
+ - 移除了硬编码的 `assignedTo` 过滤条件
24
+ - 默认获取所有Bug,不再只获取分配给当前用户的Bug
25
+ - 添加 `onlyAssignedToMe` 参数,让用户可以选择是否只获取分配给自己的Bug
26
+
27
+ ### Changed
28
+ - **优化默认产品选择逻辑**
29
+ - 当未指定 productId 时,默认使用第二个产品(如果存在)
30
+ - 如果只有一个产品,则使用第一个产品
31
+
32
+ ### Improved
33
+ - 为 getMyBugs 工具添加更清晰的描述:"获取Bug列表 - 默认获取所有Bug,可选择只获取分配给我的Bug"
34
+ - 增强了工具的灵活性,满足不同使用场景
35
+
8
36
  ## [1.8.7] - 2025-11-06
9
37
 
10
38
  ### Fixed
@@ -9,7 +9,7 @@ export declare class ZentaoAPI {
9
9
  getMyTasks(status?: TaskStatus): Promise<Task[]>;
10
10
  getTaskDetail(taskId: number): Promise<Task>;
11
11
  getProducts(): Promise<Product[]>;
12
- getMyBugs(status?: BugStatus, productId?: number, page?: number, limit?: number): Promise<{
12
+ getMyBugs(status?: BugStatus, productId?: number, page?: number, limit?: number, onlyAssignedToMe?: boolean): Promise<{
13
13
  page: number;
14
14
  total: number;
15
15
  limit: number;
@@ -111,26 +111,30 @@ export class ZentaoAPI {
111
111
  throw error;
112
112
  }
113
113
  }
114
- async getMyBugs(status, productId, page, limit) {
114
+ async getMyBugs(status, productId, page, limit, onlyAssignedToMe = false) {
115
115
  if (!productId) {
116
- // 如果没有提供产品ID,获取第一个可用的产品
116
+ // 如果没有提供产品ID,获取第二个可用的产品(索引为1)
117
117
  const products = await this.getProducts();
118
118
  if (products.length === 0) {
119
119
  throw new Error('没有可用的产品');
120
120
  }
121
- productId = products[0].id;
122
- console.log(`使用第一个可用的产品ID: ${productId}`);
121
+ // 使用第二个产品(如果存在),否则使用第一个
122
+ productId = products.length > 1 ? products[1].id : products[0].id;
123
+ console.log(`使用产品ID: ${productId} (${products.length > 1 ? '第二个' : '第一个'})`);
123
124
  }
124
125
  // 默认每页20条,最多100条
125
126
  const finalLimit = limit ? Math.min(limit, 100) : 20;
126
127
  const finalPage = page || 1;
127
128
  const params = {
128
- assignedTo: this.config.username,
129
129
  status: status || 'all',
130
130
  product: productId,
131
131
  page: finalPage,
132
132
  limit: finalLimit
133
133
  };
134
+ // 只有当明确指定时才过滤 assignedTo
135
+ if (onlyAssignedToMe) {
136
+ params.assignedTo = this.config.username;
137
+ }
134
138
  try {
135
139
  console.log(`正在获取Bug列表 (page=${finalPage}, limit=${finalLimit}),参数:`, params);
136
140
  const response = await this.request('GET', '/bugs', params);
@@ -245,9 +249,10 @@ export class ZentaoAPI {
245
249
  async resolveBug(bugId, resolution) {
246
250
  try {
247
251
  console.log(`正在解决Bug ${bugId}...`);
248
- // 验证必填字段
252
+ // 验证必填字段并设置默认值
249
253
  if (resolution.resolution === 'fixed' && !resolution.resolvedBuild) {
250
- throw new Error('当解决方案为"已解决(fixed)"时,必须提供解决版本(resolvedBuild)');
254
+ console.log('解决方案为"fixed"时未提供resolvedBuild,自动设置为"trunk"');
255
+ resolution.resolvedBuild = 'trunk';
251
256
  }
252
257
  if (resolution.resolution === 'duplicate' && !resolution.duplicateBug) {
253
258
  throw new Error('当解决方案为"重复Bug(duplicate)"时,必须提供重复Bug的ID(duplicateBug)');
package/dist/index.js CHANGED
@@ -87,15 +87,16 @@ server.tool("getProducts", {}, async () => {
87
87
  };
88
88
  });
89
89
  // Add getMyBugs tool
90
- server.tool("getMyBugs", {
90
+ server.tool("getMyBugs", "获取Bug列表 - 默认获取所有Bug,可选择只获取分配给我的Bug", {
91
91
  status: z.enum(['active', 'resolved', 'closed', 'all']).optional(),
92
92
  productId: z.number().optional(),
93
93
  page: z.number().optional().describe("页码,从1开始,默认为1"),
94
- limit: z.number().optional().describe("每页数量,默认20,最大100")
95
- }, async ({ status, productId, page, limit }) => {
94
+ limit: z.number().optional().describe("每页数量,默认20,最大100"),
95
+ onlyAssignedToMe: z.boolean().optional().describe("是否只获取分配给我的Bug,默认false(获取所有Bug)")
96
+ }, async ({ status, productId, page, limit, onlyAssignedToMe }) => {
96
97
  if (!zentaoApi)
97
98
  throw new Error("Please initialize Zentao API first");
98
- const result = await zentaoApi.getMyBugs(status, productId, page, limit);
99
+ const result = await zentaoApi.getMyBugs(status, productId, page, limit, onlyAssignedToMe || false);
99
100
  // 返回分页信息和数据
100
101
  const summary = {
101
102
  summary: `当前第 ${result.page} 页,共 ${result.total} 个Bug,本页显示 ${result.bugs.length} 个`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzp123/mcp-zentao",
3
- "version": "1.8.7",
3
+ "version": "1.8.9",
4
4
  "description": "禅道项目管理系统的高级API集成包,提供任务管理、Bug跟踪等功能的完整封装,专为Cursor IDE设计的MCP扩展",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",