@zzp123/mcp-zentao 1.8.4 → 1.8.6

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,38 @@ 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.6] - 2025-11-06
9
+
10
+ ### Fixed
11
+ - **修复 uploadImageFromClipboard 工具路径依赖问题**
12
+ - 将 PowerShell 脚本内嵌到代码中,不再依赖外部文件
13
+ - 解决了 Claude Code 工作目录与包安装目录不匹配的问题
14
+ - 使用 Base64 编码避免转义问题
15
+
16
+ ### Improved
17
+ - **优化 uploadImageFromClipboard 工具的用户体验**
18
+ - 默认行为:直接从剪贴板获取图片并上传到禅道
19
+ - 简化了操作流程,用户只需说"上传图片"即可
20
+ - 移除了对外部脚本文件的依赖,提高了可靠性
21
+
22
+ ### Technical
23
+ - 脚本完全内嵌,提高可移植性
24
+ - 不再依赖 process.cwd() 路径解析
25
+ - 更健壮的错误处理机制
26
+
27
+ ## [1.8.5] - 2025-11-06
28
+
29
+ ### Improved
30
+ - **优化 changeStory 工具参数说明**
31
+ - 为 `reviewer` 字段添加详细描述:说明其通常为必填字段,除非设置 `needNotReview=true` 跳过评审
32
+ - 为 `needNotReview` 字段添加说明:如果不提供 `reviewer` 则应设置为 `true`
33
+ - 为 `storyId` 参数添加描述,提升工具可读性
34
+ - 为工具本身添加整体说明:"需求变更 - 支持对象或JSON字符串格式"
35
+
36
+ ### Technical
37
+ - 改进 MCP 工具的参数描述,帮助 AI 助手更好地理解参数使用规则
38
+ - 提升工具在 Claude Code 等 AI IDE 中的可用性
39
+
8
40
  ## [1.8.0] - 2025-11-06
9
41
 
10
42
  ### Changed
package/dist/index.js CHANGED
@@ -535,8 +535,8 @@ server.tool("getProjects", {
535
535
  };
536
536
  });
537
537
  // Add changeStory tool
538
- server.tool("changeStory", {
539
- storyId: z.number(),
538
+ server.tool("changeStory", "需求变更 - 支持对象或JSON字符串格式", {
539
+ storyId: z.number().describe("需求ID"),
540
540
  update: z.union([
541
541
  z.object({
542
542
  // 基本信息
@@ -563,7 +563,7 @@ server.tool("changeStory", {
563
563
  grade: z.number().optional(),
564
564
  // 人员相关
565
565
  mailto: z.array(z.string()).optional(),
566
- reviewer: z.array(z.string()).optional(),
566
+ reviewer: z.array(z.string()).optional().describe("评审人员列表(通常为必填,除非设置needNotReview=true跳过评审)"),
567
567
  assignedTo: z.string().optional(),
568
568
  closedBy: z.string().optional(),
569
569
  feedbackBy: z.string().optional(),
@@ -571,7 +571,7 @@ server.tool("changeStory", {
571
571
  closedReason: z.enum(['done', 'subdivided', 'duplicate', 'postponed', 'willnotdo', 'cancel', 'bydesign']).optional(),
572
572
  duplicateStory: z.number().optional(),
573
573
  // 评审相关
574
- needNotReview: z.boolean().optional(),
574
+ needNotReview: z.boolean().optional().describe("是否跳过评审,如果不提供reviewer则应设置为true"),
575
575
  // 通知相关
576
576
  notifyEmail: z.string().optional(),
577
577
  // 描述内容
@@ -1147,9 +1147,9 @@ server.tool("uploadFile", {
1147
1147
  }
1148
1148
  return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
1149
1149
  });
1150
- server.tool("uploadImageFromClipboard", {
1151
- filename: z.string().optional(),
1152
- uid: z.string().optional()
1150
+ server.tool("uploadImageFromClipboard", "上传剪贴板图片到禅道 - 自动获取剪贴板中的图片并上传", {
1151
+ filename: z.string().optional().describe("自定义文件名,默认为 clipboard_时间戳.png"),
1152
+ uid: z.string().optional().describe("禅道文件UID,用于关联需求或Bug")
1153
1153
  }, async ({ filename, uid }) => {
1154
1154
  if (!zentaoApi) {
1155
1155
  return {
@@ -1171,11 +1171,12 @@ server.tool("uploadImageFromClipboard", {
1171
1171
  // Windows: 使用 PowerShell 脚本读取剪贴板
1172
1172
  if (process.platform === 'win32') {
1173
1173
  console.log('[uploadImageFromClipboard] Windows平台,使用PowerShell脚本读取剪贴板...');
1174
- // 使用外部 PowerShell 脚本
1175
- const scriptPath = path.join(process.cwd(), 'scripts', 'get_clipboard.ps1');
1176
- console.log(`[uploadImageFromClipboard] 脚本路径: ${scriptPath}`);
1174
+ // 内嵌 PowerShell 脚本,避免依赖外部文件
1175
+ const psScript = `Add-Type -AssemblyName System.Windows.Forms; Add-Type -AssemblyName System.Drawing; $img = [System.Windows.Forms.Clipboard]::GetImage(); if ($img) { $ms = New-Object System.IO.MemoryStream; $img.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png); $bytes = $ms.ToArray(); $ms.Close(); $base64 = [Convert]::ToBase64String($bytes); Write-Output $base64 } else { Write-Output 'NoImage' }`;
1177
1176
  try {
1178
- const result = execSync(`powershell -ExecutionPolicy Bypass -File "${scriptPath}"`, {
1177
+ // 使用 Base64 编码 PowerShell 脚本以避免转义问题
1178
+ const psScriptBase64 = Buffer.from(psScript, 'utf16le').toString('base64');
1179
+ const result = execSync(`powershell -ExecutionPolicy Bypass -EncodedCommand ${psScriptBase64}`, {
1179
1180
  encoding: 'utf8',
1180
1181
  maxBuffer: 10 * 1024 * 1024,
1181
1182
  stdio: ['pipe', 'pipe', 'pipe']
@@ -1205,7 +1206,7 @@ server.tool("uploadImageFromClipboard", {
1205
1206
  text: JSON.stringify({
1206
1207
  error: "读取剪贴板失败",
1207
1208
  details: err.message,
1208
- tip: "请确保已复制图片到剪贴板,并且 PowerShell 脚本存在于 scripts/get_clipboard.ps1"
1209
+ tip: "请确保已复制图片到剪贴板"
1209
1210
  }, null, 2)
1210
1211
  }],
1211
1212
  isError: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzp123/mcp-zentao",
3
- "version": "1.8.4",
3
+ "version": "1.8.6",
4
4
  "description": "禅道项目管理系统的高级API集成包,提供任务管理、Bug跟踪等功能的完整封装,专为Cursor IDE设计的MCP扩展",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -22,8 +22,6 @@
22
22
  "test": "jest",
23
23
  "test:watch": "jest --watch",
24
24
  "test:manual": "ts-node test/manual-test.ts",
25
- "test:story": "node quick-test-story.js",
26
- "test:story:full": "node test-update-story.js",
27
25
  "prepublishOnly": "npm run test && npm run build",
28
26
  "start": "node json-args.js",
29
27
  "upload:clipboard": "node scripts/upload-clipboard-image.js",