@zzp123/mcp-zentao 1.13.0 → 1.14.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/CHANGELOG.md +26 -0
- package/dist/index.js +127 -8
- package/dist/types/zentao.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,32 @@ 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.14.0] - 2025-11-07
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **完整的用户需求(Requirement)支持** 🎯
|
|
12
|
+
- 扩展 Story API,统一支持软件需求(story)和用户需求(requirement)
|
|
13
|
+
- 所有现有 story 工具现已支持两种需求类型,自动识别
|
|
14
|
+
- 新增4个专用的 requirement 工具:
|
|
15
|
+
- `createRequirement`: 创建用户需求
|
|
16
|
+
- `getRequirementDetail`: 获取用户需求详情
|
|
17
|
+
- `changeRequirement`: 修改用户需求
|
|
18
|
+
- `deleteRequirement`: 删除用户需求
|
|
19
|
+
- `createStory` 工具新增 `type` 参数,可选择创建 story 或 requirement
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- **更新现有需求工具描述**
|
|
23
|
+
- `getStoryDetail`: 现支持 story 和 requirement 两种类型,自动识别
|
|
24
|
+
- `changeStory`: 现支持 story 和 requirement 两种类型,自动识别
|
|
25
|
+
- `deleteStory`: 现支持 story 和 requirement 两种类型,自动识别
|
|
26
|
+
- `getProductStories`: 返回的列表可能包含两种类型的需求
|
|
27
|
+
|
|
28
|
+
### Improved
|
|
29
|
+
- **更好的语义化**
|
|
30
|
+
- 专用的 requirement 工具提供更清晰的意图表达
|
|
31
|
+
- 统一接口底层实现,减少代码重复
|
|
32
|
+
- 符合禅道 API v2.0 的最新扩展
|
|
33
|
+
|
|
8
34
|
## [1.13.0] - 2025-11-07
|
|
9
35
|
|
|
10
36
|
### Added
|
package/dist/index.js
CHANGED
|
@@ -335,10 +335,11 @@ server.tool("createTask", {
|
|
|
335
335
|
};
|
|
336
336
|
});
|
|
337
337
|
// Add createStory tool
|
|
338
|
-
server.tool("createStory", {
|
|
338
|
+
server.tool("createStory", "创建需求 - 支持创建软件需求(story)或用户需求(requirement)", {
|
|
339
339
|
title: z.string(),
|
|
340
340
|
product: z.number(),
|
|
341
341
|
pri: z.number(),
|
|
342
|
+
type: z.enum(['story', 'requirement']).optional().describe("需求类型:story=软件需求,requirement=用户需求,默认为story"),
|
|
342
343
|
category: z.string().optional(),
|
|
343
344
|
spec: z.string().optional(),
|
|
344
345
|
verify: z.string().optional(),
|
|
@@ -346,13 +347,14 @@ server.tool("createStory", {
|
|
|
346
347
|
sourceNote: z.string().optional(),
|
|
347
348
|
estimate: z.number().optional(),
|
|
348
349
|
keywords: z.string().optional()
|
|
349
|
-
}, async ({ title, product, pri, category, spec, verify, source, sourceNote, estimate, keywords }) => {
|
|
350
|
+
}, async ({ title, product, pri, type, category, spec, verify, source, sourceNote, estimate, keywords }) => {
|
|
350
351
|
if (!zentaoApi)
|
|
351
352
|
throw new Error("Please initialize Zentao API first");
|
|
352
353
|
const story = await zentaoApi.createStory({
|
|
353
354
|
title,
|
|
354
355
|
product,
|
|
355
356
|
pri,
|
|
357
|
+
type,
|
|
356
358
|
category,
|
|
357
359
|
spec,
|
|
358
360
|
verify,
|
|
@@ -465,8 +467,8 @@ server.tool("getProjectReleases", {
|
|
|
465
467
|
};
|
|
466
468
|
});
|
|
467
469
|
// Add getStoryDetail tool
|
|
468
|
-
server.tool("getStoryDetail", {
|
|
469
|
-
storyId: z.number(),
|
|
470
|
+
server.tool("getStoryDetail", "获取需求详情 - 支持软件需求(story)和用户需求(requirement),自动识别类型", {
|
|
471
|
+
storyId: z.number().describe("需求ID(可以是story或requirement类型)"),
|
|
470
472
|
fields: z.enum(['basic', 'detail', 'full']).optional().describe(`
|
|
471
473
|
字段级别:
|
|
472
474
|
- basic: 基本信息(id, title, status, stage, pri等核心字段)
|
|
@@ -585,8 +587,8 @@ server.tool("getProjects", {
|
|
|
585
587
|
};
|
|
586
588
|
});
|
|
587
589
|
// Add changeStory tool
|
|
588
|
-
server.tool("changeStory", "需求变更 -
|
|
589
|
-
storyId: z.number().describe("需求ID"),
|
|
590
|
+
server.tool("changeStory", "需求变更 - 支持软件需求(story)和用户需求(requirement),自动识别类型。支持对象或JSON字符串格式", {
|
|
591
|
+
storyId: z.number().describe("需求ID(可以是story或requirement类型)"),
|
|
590
592
|
update: z.union([
|
|
591
593
|
z.object({
|
|
592
594
|
// 基本信息
|
|
@@ -671,7 +673,7 @@ server.tool("deleteTask", {
|
|
|
671
673
|
};
|
|
672
674
|
});
|
|
673
675
|
// Add getProductStories tool
|
|
674
|
-
server.tool("getProductStories", "获取产品需求列表 -
|
|
676
|
+
server.tool("getProductStories", "获取产品需求列表 - 包含软件需求(story)和用户需求(requirement),默认只返回核心字段(id, 标题, 指派人, 创建人)", {
|
|
675
677
|
productId: z.number(),
|
|
676
678
|
page: z.number().optional().describe("页码,从1开始,默认为1"),
|
|
677
679
|
limit: z.number().optional().describe("每页数量,默认20,最大100"),
|
|
@@ -831,11 +833,128 @@ server.tool("deleteExecution", { executionId: z.number() }, async ({ executionId
|
|
|
831
833
|
return { content: [{ type: "text", text: JSON.stringify(await zentaoApi.deleteExecution(executionId), null, 2) }] };
|
|
832
834
|
});
|
|
833
835
|
// Story tools
|
|
834
|
-
server.tool("deleteStory",
|
|
836
|
+
server.tool("deleteStory", "删除需求 - 支持软件需求(story)和用户需求(requirement),自动识别类型", {
|
|
837
|
+
storyId: z.number().describe("需求ID(可以是story或requirement类型)")
|
|
838
|
+
}, async ({ storyId }) => {
|
|
835
839
|
if (!zentaoApi)
|
|
836
840
|
throw new Error("Please initialize Zentao API first");
|
|
837
841
|
return { content: [{ type: "text", text: JSON.stringify(await zentaoApi.deleteStory(storyId), null, 2) }] };
|
|
838
842
|
});
|
|
843
|
+
// Requirement tools (用户需求专用工具 - 提供更好的语义化)
|
|
844
|
+
server.tool("createRequirement", "创建用户需求(requirement) - 用户需求的专用接口,提供更好的语义化", {
|
|
845
|
+
title: z.string(),
|
|
846
|
+
product: z.number(),
|
|
847
|
+
pri: z.number(),
|
|
848
|
+
category: z.string().optional(),
|
|
849
|
+
spec: z.string().optional(),
|
|
850
|
+
verify: z.string().optional(),
|
|
851
|
+
source: z.string().optional(),
|
|
852
|
+
sourceNote: z.string().optional(),
|
|
853
|
+
estimate: z.number().optional(),
|
|
854
|
+
keywords: z.string().optional()
|
|
855
|
+
}, async ({ title, product, pri, category, spec, verify, source, sourceNote, estimate, keywords }) => {
|
|
856
|
+
if (!zentaoApi)
|
|
857
|
+
throw new Error("Please initialize Zentao API first");
|
|
858
|
+
// 调用 createStory 但强制设置 type='requirement'
|
|
859
|
+
const requirement = await zentaoApi.createStory({
|
|
860
|
+
title,
|
|
861
|
+
product,
|
|
862
|
+
pri,
|
|
863
|
+
type: 'requirement',
|
|
864
|
+
category,
|
|
865
|
+
spec,
|
|
866
|
+
verify,
|
|
867
|
+
source,
|
|
868
|
+
sourceNote,
|
|
869
|
+
estimate,
|
|
870
|
+
keywords
|
|
871
|
+
});
|
|
872
|
+
return {
|
|
873
|
+
content: [{ type: "text", text: JSON.stringify(requirement, null, 2) }]
|
|
874
|
+
};
|
|
875
|
+
});
|
|
876
|
+
server.tool("getRequirementDetail", "获取用户需求详情 - 用户需求的专用接口,提供更好的语义化", {
|
|
877
|
+
requirementId: z.number().describe("用户需求ID"),
|
|
878
|
+
fields: z.enum(['basic', 'detail', 'full']).optional().describe(`
|
|
879
|
+
字段级别:
|
|
880
|
+
- basic: 基本信息(id, title, status, stage, pri等核心字段)
|
|
881
|
+
- detail: 详细信息(包含spec和verify,但不包含executions/tasks/stages/children等关联数据)
|
|
882
|
+
- full: 完整信息(包含所有字段,默认值)
|
|
883
|
+
`.trim())
|
|
884
|
+
}, async ({ requirementId, fields }) => {
|
|
885
|
+
if (!zentaoApi)
|
|
886
|
+
throw new Error("Please initialize Zentao API first");
|
|
887
|
+
const requirement = await zentaoApi.getStoryDetail(requirementId, fields);
|
|
888
|
+
const result = {
|
|
889
|
+
fieldLevel: fields || 'full',
|
|
890
|
+
requirement: requirement
|
|
891
|
+
};
|
|
892
|
+
if (fields === 'basic') {
|
|
893
|
+
result.note = '仅显示基本信息,如需完整内容请使用 fields=detail 或 fields=full';
|
|
894
|
+
}
|
|
895
|
+
else if (fields === 'detail') {
|
|
896
|
+
result.note = '显示详细信息但不包含关联数据(executions/tasks/stages/children),如需完整内容请使用 fields=full';
|
|
897
|
+
}
|
|
898
|
+
return {
|
|
899
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
900
|
+
};
|
|
901
|
+
});
|
|
902
|
+
server.tool("changeRequirement", "用户需求变更 - 用户需求的专用接口,提供更好的语义化", {
|
|
903
|
+
requirementId: z.number().describe("用户需求ID"),
|
|
904
|
+
update: z.union([
|
|
905
|
+
z.object({
|
|
906
|
+
title: z.string().optional(),
|
|
907
|
+
product: z.number().optional(),
|
|
908
|
+
parent: z.number().optional(),
|
|
909
|
+
module: z.number().optional(),
|
|
910
|
+
pri: z.number().optional(),
|
|
911
|
+
category: z.string().optional(),
|
|
912
|
+
spec: z.string().optional(),
|
|
913
|
+
verify: z.string().optional(),
|
|
914
|
+
source: z.string().optional(),
|
|
915
|
+
sourceNote: z.string().optional(),
|
|
916
|
+
estimate: z.number().optional(),
|
|
917
|
+
keywords: z.string().optional(),
|
|
918
|
+
assignedTo: z.string().optional(),
|
|
919
|
+
reviewer: z.array(z.string()).optional(),
|
|
920
|
+
comment: z.string().optional()
|
|
921
|
+
}),
|
|
922
|
+
z.string().describe("JSON字符串格式的更新内容")
|
|
923
|
+
]).describe(`
|
|
924
|
+
更新用户需求(使用 PUT /stories/:id 接口)
|
|
925
|
+
|
|
926
|
+
此工具使用标准的"修改需求其他字段"接口(PUT /stories/:id),支持修改多个字段。
|
|
927
|
+
自动处理评审人问题,无需手动设置 needNotReview。
|
|
928
|
+
|
|
929
|
+
支持对象或JSON字符串格式。
|
|
930
|
+
`.trim())
|
|
931
|
+
}, async ({ requirementId, update }) => {
|
|
932
|
+
if (!zentaoApi)
|
|
933
|
+
throw new Error("Please initialize Zentao API first");
|
|
934
|
+
let updateData;
|
|
935
|
+
if (typeof update === 'string') {
|
|
936
|
+
try {
|
|
937
|
+
updateData = JSON.parse(update);
|
|
938
|
+
}
|
|
939
|
+
catch (e) {
|
|
940
|
+
throw new Error('Invalid JSON string for update parameter');
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
updateData = update;
|
|
945
|
+
}
|
|
946
|
+
const requirement = await zentaoApi.changeStory(requirementId, updateData);
|
|
947
|
+
return {
|
|
948
|
+
content: [{ type: "text", text: JSON.stringify(requirement, null, 2) }]
|
|
949
|
+
};
|
|
950
|
+
});
|
|
951
|
+
server.tool("deleteRequirement", "删除用户需求 - 用户需求的专用接口,提供更好的语义化", {
|
|
952
|
+
requirementId: z.number().describe("用户需求ID")
|
|
953
|
+
}, async ({ requirementId }) => {
|
|
954
|
+
if (!zentaoApi)
|
|
955
|
+
throw new Error("Please initialize Zentao API first");
|
|
956
|
+
return { content: [{ type: "text", text: JSON.stringify(await zentaoApi.deleteStory(requirementId), null, 2) }] };
|
|
957
|
+
});
|
|
839
958
|
// Bug tools
|
|
840
959
|
server.tool("updateBug", {
|
|
841
960
|
bugId: z.number(),
|
package/dist/types/zentao.d.ts
CHANGED