@zzp123/mcp-zentao 1.7.1 → 1.7.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,51 @@ 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.7.3] - 2025-11-06
9
+
10
+ ### Fixed
11
+ - **updateStory 工具参数格式优化**
12
+ - 修复 `update` 参数只能接受对象格式的问题
13
+ - 现在同时支持对象格式和 JSON 字符串格式
14
+ - 自动解析 JSON 字符串并提供友好的错误提示
15
+
16
+ ### Changed
17
+ - `update` 参数使用 `z.union()` 同时接受对象和字符串格式
18
+ - 添加 JSON 字符串解析逻辑,提升工具兼容性
19
+
20
+ ## [1.7.2] - 2025-11-06
21
+
22
+ ### Added
23
+ - **updateStory 工具重大增强**
24
+ - 新增29个可编辑字段支持,��全对接禅道最新API文档
25
+ - 支持需求基本信息编辑:title, product, parent, module, branch, plan, type
26
+ - 支持来源信息编辑:source, sourceNote(支持8种来源类型)
27
+ - 支持分类与优先级:category, pri, estimate
28
+ - 支持状态与阶段:stage, status
29
+ - 支持关键词与标识:keywords, color, grade
30
+ - 支持人员相关:mailto, reviewer, assignedTo, closedBy, feedbackBy
31
+ - 支持关闭相关:closedReason, duplicateStory(7种关闭原因)
32
+ - 支持评审相关:needNotReview
33
+ - 支持通知相关:notifyEmail
34
+ - 支持描述内容:spec, verify(HTML格式)
35
+ - 支持备注:comment
36
+
37
+ ### Changed
38
+ - `UpdateStoryRequest` 接口完全重构,从7个字段扩展到29个字段
39
+ - `updateStory` MCP 工具参数完全重新定义,支持所有新字段
40
+ - 添加了详细的字段注释和类型定义,提升开发体验
41
+
42
+ ### Technical
43
+ - 所有字段均为可选参数,支持部分更新
44
+ - `plan` 字段支持单个ID或数组格式
45
+ - `closedReason` 使用枚举类型确保数据正确性
46
+ - `mailto` 和 `reviewer` 字段支持数组格式
47
+
48
+ ### Benefits
49
+ - **功能完整性**:支持禅道需求管理的所有常用编辑功能
50
+ - **灵活性**:可以批量更新多个字段,也可以单独更新单个字段
51
+ - **类型安全**:完整的 TypeScript 类型定义,减少运行时错误
52
+
8
53
  ## [1.7.1] - 2025-11-06
9
54
 
10
55
  ### Fixed
package/dist/index.js CHANGED
@@ -463,19 +463,68 @@ server.tool("getProjects", {
463
463
  // Add updateStory tool
464
464
  server.tool("updateStory", {
465
465
  storyId: z.number(),
466
- update: z.object({
467
- module: z.number().optional(),
468
- source: z.string().optional(),
469
- sourceNote: z.string().optional(),
470
- pri: z.number().optional(),
471
- category: z.string().optional(),
472
- estimate: z.number().optional(),
473
- keywords: z.string().optional()
474
- })
466
+ update: z.union([
467
+ z.object({
468
+ // 基本信息
469
+ title: z.string().optional(),
470
+ product: z.number().optional(),
471
+ parent: z.number().optional(),
472
+ module: z.number().optional(),
473
+ branch: z.number().optional(),
474
+ plan: z.union([z.number(), z.array(z.number())]).optional(),
475
+ type: z.string().optional(),
476
+ // 来源信息
477
+ source: z.string().optional(),
478
+ sourceNote: z.string().optional(),
479
+ // 分类与优先级
480
+ category: z.string().optional(),
481
+ pri: z.number().optional(),
482
+ estimate: z.number().optional(),
483
+ // 状态与阶段
484
+ stage: z.string().optional(),
485
+ status: z.string().optional(),
486
+ // 关键词与标识
487
+ keywords: z.string().optional(),
488
+ color: z.string().optional(),
489
+ grade: z.number().optional(),
490
+ // 人员相关
491
+ mailto: z.array(z.string()).optional(),
492
+ reviewer: z.array(z.string()).optional(),
493
+ assignedTo: z.string().optional(),
494
+ closedBy: z.string().optional(),
495
+ feedbackBy: z.string().optional(),
496
+ // 关闭相关
497
+ closedReason: z.enum(['done', 'subdivided', 'duplicate', 'postponed', 'willnotdo', 'cancel', 'bydesign']).optional(),
498
+ duplicateStory: z.number().optional(),
499
+ // 评审相关
500
+ needNotReview: z.boolean().optional(),
501
+ // 通知相关
502
+ notifyEmail: z.string().optional(),
503
+ // 描述内容
504
+ spec: z.string().optional(),
505
+ verify: z.string().optional(),
506
+ // 备注
507
+ comment: z.string().optional()
508
+ }),
509
+ z.string()
510
+ ]).describe("需求更新字段 - 支持对象或JSON字符串格式")
475
511
  }, async ({ storyId, update }) => {
476
512
  if (!zentaoApi)
477
513
  throw new Error("Please initialize Zentao API first");
478
- const story = await zentaoApi.updateStory(storyId, update);
514
+ // 如果 update 是字符串,尝试解析为对象
515
+ let updateData;
516
+ if (typeof update === 'string') {
517
+ try {
518
+ updateData = JSON.parse(update);
519
+ }
520
+ catch (error) {
521
+ throw new Error(`Invalid JSON string: ${error instanceof Error ? error.message : 'Unknown error'}`);
522
+ }
523
+ }
524
+ else {
525
+ updateData = update;
526
+ }
527
+ const story = await zentaoApi.updateStory(storyId, updateData);
479
528
  return {
480
529
  content: [{ type: "text", text: JSON.stringify(story, null, 2) }]
481
530
  };
@@ -257,13 +257,35 @@ export interface Project {
257
257
  progress: number;
258
258
  }
259
259
  export interface UpdateStoryRequest {
260
+ title?: string;
261
+ product?: number;
262
+ parent?: number;
260
263
  module?: number;
264
+ branch?: number;
265
+ plan?: number | number[];
266
+ type?: string;
261
267
  source?: string;
262
268
  sourceNote?: string;
263
- pri?: number;
264
269
  category?: string;
270
+ pri?: number;
265
271
  estimate?: number;
272
+ stage?: string;
273
+ status?: string;
266
274
  keywords?: string;
275
+ color?: string;
276
+ grade?: number;
277
+ mailto?: string[];
278
+ reviewer?: string[];
279
+ assignedTo?: string;
280
+ closedBy?: string;
281
+ feedbackBy?: string;
282
+ closedReason?: 'done' | 'subdivided' | 'duplicate' | 'postponed' | 'willnotdo' | 'cancel' | 'bydesign';
283
+ duplicateStory?: number;
284
+ needNotReview?: boolean;
285
+ notifyEmail?: string;
286
+ spec?: string;
287
+ verify?: string;
288
+ comment?: string;
267
289
  }
268
290
  export interface CreateProgramRequest {
269
291
  name?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzp123/mcp-zentao",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "禅道项目管理系统的高级API集成包,提供任务管理、Bug跟踪等功能的完整封装,专为Cursor IDE设计的MCP扩展",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",