@youcloud/mantis-mcp 1.0.2 → 1.0.4

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
@@ -1,5 +1,11 @@
1
1
  # 更新记录
2
2
 
3
+ ## [1.0.4] - 2026-10-19
4
+
5
+ - 修复 Windows 下操作账本目录同步失败导致所有写工具及操作核查不可用的问题;保留文件同步与替换失败的阻断行为,并清理失败的临时文件。
6
+ - 本地异常诊断保留已知系统错误码,不暴露路径、凭据或底层异常正文。
7
+ - 增加跨平台账本、`submit_fix` / `add_note` 写入与恢复回归,覆盖 Windows 故障模拟及真实文件错误。
8
+
3
9
  ## [1.0.1] - 2026-10-18
4
10
 
5
11
  - `MANTIS_BASE_URL` 未设置或为空白时默认使用 `https://mantis.umlife.net`,仍可显式指定其他部署地址。
package/README.md CHANGED
@@ -2,20 +2,20 @@
2
2
 
3
3
  内部研发团队使用的 MantisBT MCP 服务,通过 stdio 为 Coding Agent 提供缺陷查询、修复登记、附件上传和可恢复的工作流操作。
4
4
 
5
- 项目与问题反馈:[内部 GitLab](https://git.umlife.net/ai-tools/mantis-mcp)。npm 包:[@youcloud/mantis-mcp](https://www.npmjs.com/package/@youcloud/mantis-mcp)。
5
+ 项目与问题反馈:[内部 GitLab](https://git.umlife.net/ai-tools/mantis-mcp/-/work_items)。npm 包:[@youcloud/mantis-mcp](https://www.npmjs.com/package/@youcloud/mantis-mcp)。
6
6
 
7
- ## 开始使用
7
+ ## 三分钟上手
8
8
 
9
- 需要 Node.js ≥ 22(至少 22.12),并准备 MantisBT API 令牌(在“我的账户 → 个人资料 → API令牌”下创建)。
9
+ 需要 Node.js ≥ 22(至少 22.12),并准备 [MantisBT](https://mantis.umlife.net) API 令牌(在“我的账号 → 个人资料 → API令牌”下创建)。
10
10
 
11
- ### CodeX
11
+ #### CodeX
12
12
  ```bash
13
13
  codex mcp add mantis \
14
14
  --env MANTIS_API_KEY="$MANTIS_API_KEY" \
15
15
  -- npx -y @youcloud/mantis-mcp@latest
16
16
  ```
17
17
 
18
- ### Claude Code
18
+ #### Claude Code
19
19
  ```bash
20
20
  # Claude Code 不加 --scope user 时,默认仅在添加时所在的项目中生效
21
21
  claude mcp add --scope user mantis \
@@ -23,12 +23,12 @@ claude mcp add --scope user mantis \
23
23
  -- npx -y @youcloud/mantis-mcp@latest
24
24
  ```
25
25
 
26
- ### 全局安装
26
+ #### 全局安装
27
27
  ```bash
28
28
  npm install -g @youcloud/mantis-mcp
29
29
  ```
30
30
 
31
- ### 自定义配置
31
+ #### 自定义配置
32
32
 
33
33
  1. 在 Mantis 生成个人 API Key,通过 `MANTIS_API_KEY` 传入;默认连接内部 Mantis,详见[服务配置](docs/configuration.md)。
34
34
  2. 按[客户端接入](docs/clients.md)配置 Codex、Claude Code、Cursor 或 Trae。
@@ -38,16 +38,27 @@ npm install -g @youcloud/mantis-mcp
38
38
 
39
39
  修改已有对象前须读取最新 context,真实写入使用独立 `operation_id`。遇到 `partial_success/unknown` 时按原编号核查,不能直接重发。
40
40
 
41
+ ## 日常使用场景
42
+
43
+ - 目前分配给我的缺陷有哪些?
44
+ - 获取一下问题 #22474 的详细内容
45
+ - 问题 #22474 的状态是什么?
46
+ - 问题 #18133 是由于样式加载异常导致,已修复且自测通过,请把状态调整已修复
47
+ - 显示创意管家项目中所有未解决的问题
48
+ - ...
49
+
50
+
51
+
41
52
  ## 文档
42
53
 
43
54
  | 文档 | 内容 |
44
55
  |---|---|
45
- | [客户端接入](docs/clients.md) | 安装配置、凭据传入与连接排障 |
46
- | [服务配置](docs/configuration.md) | 环境变量、动作映射与部署边界 |
47
- | [调用手册](docs/cookbook.md) | 工具、常用场景及写入恢复 |
56
+ | [客户端接入](https://git.umlife.net/ai-tools/mantis-mcp/-/blob/main/docs/clients.md) | 安装配置、凭据传入与连接排障 |
57
+ | [服务配置](https://git.umlife.net/ai-tools/mantis-mcp/-/blob/main/docs/configuration.md) | 环境变量、动作映射与部署边界 |
58
+ | [调用手册](https://git.umlife.net/ai-tools/mantis-mcp/-/blob/main/docs/cookbook.md) | 工具、常用场景及写入恢复 |
48
59
  | [项目设计](https://git.umlife.net/ai-tools/mantis-mcp/-/blob/main/docs/design.md) | 架构、契约、状态持久化与安全边界 |
49
60
  | [开发指南](https://git.umlife.net/ai-tools/mantis-mcp/-/blob/main/CONTRIBUTING.md) | 本地开发、验证和文档维护 |
50
61
  | [发布流程](https://git.umlife.net/ai-tools/mantis-mcp/-/blob/main/docs/releasing.md) | GitLab 与 npm 发布检查 |
51
- | [更新记录](CHANGELOG.md) | 版本变化 |
62
+ | [更新记录](https://git.umlife.net/ai-tools/mantis-mcp/-/blob/main/CHANGELOG.md) | 版本变化 |
52
63
 
53
64
  采用 [MIT 许可证](LICENSE)。
@@ -1,6 +1,8 @@
1
1
  import { z } from 'zod';
2
+ import { getSystemErrorMap } from 'node:util';
2
3
  import { RestError } from '../client.js';
3
4
  import { ConnectionConfigError } from '../connection-config.js';
5
+ const systemErrorCodes = new Set([...getSystemErrorMap().values()].map(([name]) => name));
4
6
  export const id = z.number().int().positive().describe('正整数编号');
5
7
  export const text = z.string().refine(v => v.trim().length > 0, '不可为空白').describe('非空正文');
6
8
  const ref = z.union([z.literal('me'), id]).describe('当前用户 me 或明确的用户编号');
@@ -87,7 +89,10 @@ export function problem(error) {
87
89
  : error.status === 403 || error.status === 401 ? 'MANTIS_FORBIDDEN'
88
90
  : error.status === 404 ? 'NOT_FOUND_OR_NOT_VISIBLE' : error.status === 412 ? 'REVISION_CONFLICT'
89
91
  : !error.definiteRejection ? error.method === 'GET' ? 'SERVICE_UNAVAILABLE' : 'WRITE_OUTCOME_UNKNOWN' : 'MANTIS_REJECTED', message: error.message };
90
- return { code: 'SERVICE_UNAVAILABLE', message: '本地服务或读取不可用;未包含敏感错误正文' };
92
+ // 只展示 Node.js 已知的系统错误码,不回显任意 code、路径或底层异常正文。
93
+ const code = error instanceof Error ? error.code : undefined;
94
+ const diagnostic = typeof code === 'string' && systemErrorCodes.has(code) ? `(系统错误:${code})` : '';
95
+ return { code: 'SERVICE_UNAVAILABLE', message: `本地服务或读取不可用${diagnostic};未包含敏感错误正文` };
91
96
  }
92
97
  const record = z.record(z.string(), z.unknown());
93
98
  export const stepSchema = z.strictObject({ name: z.string(), state: z.enum(['not_started', 'in_flight', 'succeeded', 'failed', 'unknown']),
@@ -35,20 +35,23 @@ export class Operations {
35
35
  const temp = join(this.dir, `${record.operation_id}.${randomUUID()}.tmp`);
36
36
  const handle = await open(temp, 'wx', 0o600);
37
37
  try {
38
- await handle.writeFile(JSON.stringify(record));
39
- await handle.sync();
40
- }
41
- finally {
42
- await handle.close();
43
- }
44
- try {
45
- await rename(temp, join(this.dir, `${record.operation_id}.json`));
46
- const directory = await open(this.dir, 'r');
47
38
  try {
48
- await directory.sync();
39
+ await handle.writeFile(JSON.stringify(record));
40
+ await handle.sync();
49
41
  }
50
42
  finally {
51
- await directory.close();
43
+ await handle.close();
44
+ }
45
+ await rename(temp, join(this.dir, `${record.operation_id}.json`));
46
+ // Windows 不支持此目录同步方式;文件写入、同步和替换失败仍须阻断后续业务写入。
47
+ if (process.platform !== 'win32') {
48
+ const directory = await open(this.dir, 'r');
49
+ try {
50
+ await directory.sync();
51
+ }
52
+ finally {
53
+ await directory.close();
54
+ }
52
55
  }
53
56
  }
54
57
  finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youcloud/mantis-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "面向研发工作流的 MantisBT MCP 服务,支持缺陷查询、修复登记、附件和可恢复操作",
5
5
  "license": "MIT",
6
6
  "homepage": "https://git.umlife.net/ai-tools/mantis-mcp",