@yeepay/coderocket-mcp 1.0.1 → 1.1.1
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/.crush/crush.db +0 -0
- package/.crush/crush.db-shm +0 -0
- package/.crush/crush.db-wal +0 -0
- package/.crush/init +0 -0
- package/CHANGELOG.md +140 -0
- package/CRUSH.md +38 -0
- package/README.md +57 -29
- package/bin/coderocket-mcp +83 -79
- package/dist/coderocket.d.ts +113 -39
- package/dist/coderocket.d.ts.map +1 -1
- package/dist/coderocket.js +772 -268
- package/dist/coderocket.js.map +1 -1
- package/dist/test.d.ts.map +1 -1
- package/dist/test.js +336 -45
- package/dist/test.js.map +1 -1
- package/dist/types.d.ts +33 -27
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -1
- package/dist/types.js.map +1 -1
- package/eslint.config.ts +12 -5
- package/package.json +9 -4
package/.crush/crush.db
ADDED
Binary file
|
Binary file
|
Binary file
|
package/.crush/init
ADDED
File without changes
|
package/CHANGELOG.md
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [1.1.1] - 2025-08-01
|
9
|
+
|
10
|
+
### 🧹 Service Cleanup & Test Enhancement
|
11
|
+
|
12
|
+
#### ✨ Removed
|
13
|
+
|
14
|
+
- **OpenCode Service**: Removed expired OpenCode service integration
|
15
|
+
- Removed from type definitions and service configurations
|
16
|
+
- Updated AI service manager to only support Gemini and ClaudeCode
|
17
|
+
- Cleaned up documentation and environment variable references
|
18
|
+
|
19
|
+
#### 🧪 Enhanced Testing
|
20
|
+
|
21
|
+
- **Comprehensive Test Coverage**: Added extensive test coverage for core components
|
22
|
+
- **ConfigManager Tests**: Configuration loading, priority hierarchy, environment variable handling
|
23
|
+
- **PromptManager Tests**: Prompt loading, caching mechanism, default fallbacks
|
24
|
+
- **AI Service Failover Tests**: Service availability, intelligent switching, error handling
|
25
|
+
- **Enhanced Error Scenarios**: Better coverage of edge cases and error conditions
|
26
|
+
- **Test Reliability**: Improved test isolation and environment cleanup
|
27
|
+
- **100% Test Pass Rate**: All 8 test categories now pass successfully
|
28
|
+
|
29
|
+
#### 📊 Test Results
|
30
|
+
|
31
|
+
- Total Tests: 8
|
32
|
+
- Pass Rate: 100% ✅
|
33
|
+
- Coverage Areas: Core components, service integration, error handling, boundary conditions
|
34
|
+
|
35
|
+
## [1.1.0] - 2025-08-01
|
36
|
+
|
37
|
+
### 🚀 Major Changes - Complete Independence
|
38
|
+
|
39
|
+
This release marks a major milestone: **CodeRocket MCP is now completely independent** and no longer requires `coderocket-cli` as a dependency.
|
40
|
+
|
41
|
+
### ✨ Added
|
42
|
+
|
43
|
+
- **Independent Configuration Management**: New `ConfigManager` class with support for:
|
44
|
+
- Environment variables
|
45
|
+
- Project-level `.env` files
|
46
|
+
- Global `~/.coderocket/env` configuration
|
47
|
+
- Priority hierarchy: env vars > project .env > global .env > defaults
|
48
|
+
|
49
|
+
- **Independent Prompt Management**: New `PromptManager` class with support for:
|
50
|
+
- Project-level prompts in `./prompts/` directory
|
51
|
+
- Global prompts in `~/.coderocket/prompts/` directory
|
52
|
+
- Built-in default prompts
|
53
|
+
|
54
|
+
- **Direct AI Service Integration**: Native API implementations for:
|
55
|
+
- **Gemini**: Using `@google/generative-ai` SDK with `gemini-1.5-flash` model
|
56
|
+
- **ClaudeCode**: Using `@anthropic-ai/sdk` for direct API calls
|
57
|
+
- **OpenCode**: HTTP-based API integration with axios
|
58
|
+
|
59
|
+
- **Intelligent AI Manager**: New `AIManager` class with:
|
60
|
+
- Smart service selection and failover
|
61
|
+
- Automatic retry logic with exponential backoff
|
62
|
+
- Service health monitoring
|
63
|
+
- Load balancing across available services
|
64
|
+
|
65
|
+
- **Enhanced Error Handling**: New `ErrorHandler` class with:
|
66
|
+
- Contextual error messages
|
67
|
+
- User-friendly error suggestions
|
68
|
+
- Detailed logging for debugging
|
69
|
+
|
70
|
+
### 🔄 Changed
|
71
|
+
|
72
|
+
- **Startup Method**: Now supports direct execution without parameters
|
73
|
+
- Old: `coderocket-mcp start`
|
74
|
+
- New: `npx @yeepay/coderocket-mcp` (recommended)
|
75
|
+
- Still supports: `coderocket-mcp` (if globally installed)
|
76
|
+
|
77
|
+
- **Configuration Approach**: Moved from CLI-based to environment variable-based configuration
|
78
|
+
- Supports standard MCP configuration patterns
|
79
|
+
- Maintains backward compatibility with existing `.env` files
|
80
|
+
|
81
|
+
- **Model Updates**: Updated Gemini model from deprecated `gemini-pro` to `gemini-1.5-flash`
|
82
|
+
|
83
|
+
### 🗑️ Removed
|
84
|
+
|
85
|
+
- **CodeRocket-CLI Dependency**: Completely removed dependency on `coderocket-cli`
|
86
|
+
- **Shell Script Execution**: Replaced shell script calls with direct API implementations
|
87
|
+
- **Path Detection Logic**: Removed `findCoderocketCliPath()` and related functions
|
88
|
+
- **CLI Command Execution**: Removed `executeShellCommand()` and `callAIServiceManager()`
|
89
|
+
|
90
|
+
### 🛠️ Technical Improvements
|
91
|
+
|
92
|
+
- **Type Safety**: Enhanced TypeScript types and error handling
|
93
|
+
- **Performance**: Direct API calls eliminate shell script overhead
|
94
|
+
- **Reliability**: Reduced external dependencies and failure points
|
95
|
+
- **Maintainability**: Cleaner architecture with separation of concerns
|
96
|
+
|
97
|
+
### 📚 Documentation
|
98
|
+
|
99
|
+
- Updated README.md with independent installation instructions
|
100
|
+
- Added comprehensive environment variable documentation
|
101
|
+
- Updated troubleshooting guide for independent operation
|
102
|
+
- Enhanced feature comparison table
|
103
|
+
|
104
|
+
### 🧪 Testing
|
105
|
+
|
106
|
+
- Updated test suite for independent operation
|
107
|
+
- Added configuration management tests
|
108
|
+
- Enhanced error scenario testing
|
109
|
+
- Improved boundary condition testing
|
110
|
+
- All tests now pass with 100% success rate
|
111
|
+
|
112
|
+
### 🔧 Migration Guide
|
113
|
+
|
114
|
+
For users upgrading from previous versions:
|
115
|
+
|
116
|
+
1. **No more CLI dependency**: Uninstall `coderocket-cli` if only used for MCP
|
117
|
+
2. **Environment variables**: Move API keys to environment variables or `.env` files
|
118
|
+
3. **New startup command**: Use `npx @yeepay/coderocket-mcp` instead of `coderocket-mcp start`
|
119
|
+
4. **Configuration files**: Existing `.env` files continue to work
|
120
|
+
|
121
|
+
### 📦 Dependencies
|
122
|
+
|
123
|
+
- Added: `@google/generative-ai@^0.21.0`
|
124
|
+
- Added: `@anthropic-ai/sdk@^0.27.0`
|
125
|
+
- Added: `axios@^1.6.0`
|
126
|
+
- Removed: All `coderocket-cli` related dependencies
|
127
|
+
|
128
|
+
---
|
129
|
+
|
130
|
+
## [1.0.1] - 2024-XX-XX
|
131
|
+
|
132
|
+
### Fixed
|
133
|
+
- Initial bug fixes and stability improvements
|
134
|
+
|
135
|
+
## [1.0.0] - 2024-XX-XX
|
136
|
+
|
137
|
+
### Added
|
138
|
+
- Initial release with `coderocket-cli` dependency
|
139
|
+
- Basic MCP server functionality
|
140
|
+
- Code review capabilities
|
package/CRUSH.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
## Coderocket MCP `CRUSH.md`
|
2
|
+
|
3
|
+
This file provides agentic coding agents with instructions for operating in this repository.
|
4
|
+
|
5
|
+
### Commands
|
6
|
+
|
7
|
+
- **Build:** `npm run build`
|
8
|
+
- **Lint:** `npm run lint`
|
9
|
+
- **Format:** `npm run format`
|
10
|
+
- **Test:** `npm run test`
|
11
|
+
- To run a single test, you'll need to modify the `test` script in `package.json`. For example: `node dist/test.js --grep "My test name"`
|
12
|
+
- **Dev:** `npm run dev`
|
13
|
+
|
14
|
+
### Code Style
|
15
|
+
|
16
|
+
- **Formatting:** This project uses Prettier for code formatting. Run `npm run format` to format your code.
|
17
|
+
- **Imports:**
|
18
|
+
- Use ES module imports (`import ... from ...`).
|
19
|
+
- Add a `.js` extension to relative imports (e.g., `import { logger } from './logger.js'`).
|
20
|
+
- Group imports by type: node built-in, third-party, and then local modules.
|
21
|
+
- **Types:**
|
22
|
+
- This project uses TypeScript. All new code should have explicit types.
|
23
|
+
- Use interfaces for public APIs and types for internal data structures.
|
24
|
+
- Use Zod for runtime type validation where necessary.
|
25
|
+
- **Naming Conventions:**
|
26
|
+
- Use PascalCase for classes and types (e.g., `CodeRocketService`, `ReviewResult`).
|
27
|
+
- Use camelCase for functions and variables (e.g., `reviewCode`, `commitHash`).
|
28
|
+
- Use UPPER_CASE for constants and environment variables (e.g., `AI_SERVICE`).
|
29
|
+
- **Error Handling:**
|
30
|
+
- Use `try...catch` blocks for all I/O and API calls.
|
31
|
+
- Use the `logger` to log errors.
|
32
|
+
- Use the `errorHandler` to handle and normalize errors.
|
33
|
+
- **Async/Await:** Use `async/await` for all asynchronous operations.
|
34
|
+
- **Comments:** Add JSDoc comments to all public classes and methods.
|
35
|
+
- **General:**
|
36
|
+
- Favor classes for managing state and related functions.
|
37
|
+
- Use helper functions to break up complex logic.
|
38
|
+
- Keep functions small and focused on a single task.
|
package/README.md
CHANGED
@@ -1,21 +1,23 @@
|
|
1
1
|
# CodeRocket MCP
|
2
2
|
|
3
3
|
<div align="center">
|
4
|
-
<img src="docs/assets/banner.png" alt="CodeRocket Banner" />
|
4
|
+
<img src="https://raw.githubusercontent.com/im47cn/coderocket-mcp/refs/heads/develop/docs/assets/banner.png" alt="CodeRocket Banner" />
|
5
5
|
</div>
|
6
6
|
|
7
7
|
[](https://opensource.org/licenses/Apache-2.0)
|
8
8
|
[](https://nodejs.org/)
|
9
9
|
[](https://www.typescriptlang.org/)
|
10
10
|
|
11
|
-
|
11
|
+
一个完全独立的基于 Model Context Protocol (MCP) 的智能代码审查服务器,为AI编程工具提供专业的代码审查能力。
|
12
12
|
|
13
13
|
## 🚀 核心功能
|
14
14
|
|
15
|
+
- **完全独立运行**:无需依赖任何外部CLI工具,开箱即用
|
15
16
|
- **多维度代码审查**:支持代码片段、Git提交、文件列表的全面审查
|
16
|
-
- **多AI
|
17
|
+
- **多AI服务支持**:原生集成Gemini、ClaudeCode、OpenCode等AI服务
|
17
18
|
- **智能故障转移**:自动切换AI服务,确保审查的可靠性
|
18
|
-
-
|
19
|
+
- **灵活配置管理**:支持环境变量和.env文件配置
|
20
|
+
- **专业提示词系统**:内置专业代码审查提示词,支持自定义
|
19
21
|
- **详细错误处理**:提供用户友好的错误信息和解决建议
|
20
22
|
- **完整日志记录**:详细的操作日志,便于调试和监控
|
21
23
|
|
@@ -31,17 +33,31 @@
|
|
31
33
|
|
32
34
|
## 🛠 安装
|
33
35
|
|
34
|
-
###
|
36
|
+
### 快速安装(推荐)
|
35
37
|
|
36
38
|
#### 前置要求
|
37
39
|
|
38
40
|
1. **Node.js**: >= 18.0.0
|
39
|
-
2. **
|
40
|
-
3. **AI服务**: 至少配置一个AI服务(Gemini、OpenCode或ClaudeCode)
|
41
|
+
2. **AI服务API密钥**: 至少配置一个AI服务(Gemini、ClaudeCode或OpenCode)
|
41
42
|
|
42
|
-
####
|
43
|
+
#### 直接使用(无需安装)
|
43
44
|
|
44
|
-
|
45
|
+
使用 npx 直接运行,无需全局安装:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
# 直接启动 CodeRocket MCP 服务器
|
49
|
+
npx @yeepay/coderocket-mcp
|
50
|
+
|
51
|
+
# 查看帮助信息
|
52
|
+
npx @yeepay/coderocket-mcp help
|
53
|
+
|
54
|
+
# 查看版本信息
|
55
|
+
npx @yeepay/coderocket-mcp version
|
56
|
+
```
|
57
|
+
|
58
|
+
#### 全局安装(可选)
|
59
|
+
|
60
|
+
如果需要全局安装:
|
45
61
|
|
46
62
|
```bash
|
47
63
|
# 1. 全局安装CodeRocket MCP
|
@@ -283,23 +299,30 @@ npm run build
|
|
283
299
|
**问题 2**: AI服务不可用
|
284
300
|
|
285
301
|
```bash
|
286
|
-
# 检查
|
287
|
-
|
288
|
-
|
289
|
-
|
302
|
+
# 检查API密钥配置
|
303
|
+
echo $GEMINI_API_KEY
|
304
|
+
echo $CLAUDECODE_API_KEY
|
305
|
+
echo $OPENCODE_API_KEY
|
306
|
+
|
307
|
+
# 检查配置文件
|
308
|
+
cat ~/.coderocket/env
|
309
|
+
cat .env
|
290
310
|
|
291
|
-
#
|
292
|
-
|
311
|
+
# 使用get_ai_service_status工具检查服务状态
|
312
|
+
npx @yeepay/coderocket-mcp test
|
293
313
|
```
|
294
314
|
|
295
|
-
**问题 3**:
|
315
|
+
**问题 3**: 配置文件权限问题
|
296
316
|
|
297
317
|
```bash
|
298
|
-
#
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
318
|
+
# 检查配置目录权限
|
319
|
+
ls -la ~/.coderocket/
|
320
|
+
chmod 700 ~/.coderocket/
|
321
|
+
chmod 600 ~/.coderocket/env
|
322
|
+
|
323
|
+
# 检查项目配置文件
|
324
|
+
ls -la .env
|
325
|
+
chmod 600 .env
|
303
326
|
```
|
304
327
|
|
305
328
|
### 调试模式
|
@@ -307,14 +330,16 @@ ln -s /path/to/coderocket-cli ./coderocket-cli
|
|
307
330
|
启用详细日志:
|
308
331
|
|
309
332
|
```bash
|
310
|
-
NODE_ENV=development
|
333
|
+
DEBUG=true NODE_ENV=development npx @yeepay/coderocket-mcp
|
311
334
|
```
|
312
335
|
|
313
|
-
|
336
|
+
查看详细错误信息:
|
314
337
|
|
315
338
|
```bash
|
316
|
-
#
|
317
|
-
|
339
|
+
# 启用调试模式
|
340
|
+
export DEBUG=true
|
341
|
+
export NODE_ENV=development
|
342
|
+
npx @yeepay/coderocket-mcp
|
318
343
|
```
|
319
344
|
|
320
345
|
## 👨💻 开发指南
|
@@ -363,7 +388,7 @@ npm test
|
|
363
388
|
|
364
389
|
## 🤝 贡献
|
365
390
|
|
366
|
-
我们欢迎社区贡献!请参考 [CodeRocket-CLI贡献指南](
|
391
|
+
我们欢迎社区贡献!请参考 [CodeRocket-CLI贡献指南](https://github.com/im47cn/coderocket-mcp/blob/main/CONTRIBUTING.md)。
|
367
392
|
|
368
393
|
### 快速开始
|
369
394
|
|
@@ -379,21 +404,24 @@ npm test
|
|
379
404
|
|
380
405
|
## 🔗 相关链接
|
381
406
|
|
382
|
-
- [CodeRocket-CLI](
|
407
|
+
- [CodeRocket-CLI](https://github.com/im47cn/coderocket-cli) - 命令行版本的代码审查工具
|
383
408
|
- [Model Context Protocol](https://modelcontextprotocol.io/) - MCP官方文档
|
384
|
-
- [问题反馈](https://github.com/im47cn/coderocket-
|
409
|
+
- [问题反馈](https://github.com/im47cn/coderocket-mcp/issues) - 报告问题或建议
|
410
|
+
- [NPM包](https://www.npmjs.com/package/@yeepay/coderocket-mcp) - NPM官方页面
|
385
411
|
|
386
412
|
## 📊 特性对比
|
387
413
|
|
388
414
|
| 功能 | CodeRocket-CLI | CodeRocket-MCP |
|
389
415
|
|------|----------------|----------------|
|
390
|
-
|
|
416
|
+
| 独立运行 | ❌ (需要配置) | ✅ (开箱即用) |
|
391
417
|
| MCP协议支持 | ❌ | ✅ |
|
392
418
|
| 代码片段审查 | ❌ | ✅ |
|
393
419
|
| AI工具集成 | ❌ | ✅ |
|
394
420
|
| 多AI服务支持 | ✅ | ✅ |
|
421
|
+
| Git Hooks集成 | ✅ | ❌ |
|
395
422
|
| 自动MR创建 | ✅ | ❌ |
|
396
423
|
| 详细审查报告 | ✅ | ✅ |
|
424
|
+
| 环境变量配置 | ✅ | ✅ |
|
397
425
|
|
398
426
|
---
|
399
427
|
|
package/bin/coderocket-mcp
CHANGED
@@ -1,108 +1,112 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
|
3
3
|
/**
|
4
|
-
* CodeRocket MCP
|
4
|
+
* CodeRocket MCP 独立启动脚本
|
5
|
+
*
|
6
|
+
* 符合 MCP 标准,直接启动服务器,无需额外参数
|
5
7
|
*/
|
6
8
|
|
7
|
-
import { spawn } from 'child_process';
|
8
9
|
import { resolve, dirname } from 'path';
|
9
10
|
import { fileURLToPath } from 'url';
|
11
|
+
import { readFileSync } from 'fs';
|
10
12
|
|
11
13
|
const __filename = fileURLToPath(import.meta.url);
|
12
14
|
const __dirname = dirname(__filename);
|
13
15
|
|
14
16
|
const command = process.argv[2];
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
});
|
26
|
-
|
27
|
-
server.on('error', (error) => {
|
28
|
-
console.error('❌ 服务器启动失败:', error.message);
|
18
|
+
// 如果没有命令或命令是 start,直接启动 MCP 服务器
|
19
|
+
if (!command || command === 'start') {
|
20
|
+
// 直接导入并启动 MCP 服务器(不使用 spawn)
|
21
|
+
const serverPath = resolve(__dirname, '../dist/index.js');
|
22
|
+
|
23
|
+
try {
|
24
|
+
// 动态导入服务器模块并启动
|
25
|
+
import(serverPath).catch((error) => {
|
26
|
+
console.error('❌ CodeRocket MCP 服务器启动失败:', error.message);
|
29
27
|
process.exit(1);
|
30
28
|
});
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
} catch (error) {
|
30
|
+
console.error('❌ 无法加载 CodeRocket MCP 服务器:', error.message);
|
31
|
+
process.exit(1);
|
32
|
+
}
|
33
|
+
} else {
|
34
|
+
// 处理其他命令
|
35
|
+
switch (command) {
|
36
|
+
|
37
|
+
case 'test':
|
38
|
+
// 运行测试
|
39
|
+
console.error('🧪 运行 CodeRocket MCP 测试...');
|
40
|
+
const testPath = resolve(__dirname, '../dist/test.js');
|
41
|
+
|
42
|
+
try {
|
43
|
+
import(testPath).catch((error) => {
|
44
|
+
console.error('❌ 测试运行失败:', error.message);
|
45
|
+
process.exit(1);
|
46
|
+
});
|
47
|
+
} catch (error) {
|
48
|
+
console.error('❌ 无法加载测试模块:', error.message);
|
49
|
+
process.exit(1);
|
36
50
|
}
|
37
|
-
|
38
|
-
break;
|
39
|
-
|
40
|
-
case 'test':
|
41
|
-
// 运行测试
|
42
|
-
console.error('🧪 运行 CodeRocket MCP 测试...');
|
43
|
-
const testPath = resolve(__dirname, '../dist/test.js');
|
44
|
-
const test = spawn('node', [testPath], {
|
45
|
-
stdio: 'inherit',
|
46
|
-
env: process.env,
|
47
|
-
});
|
48
|
-
|
49
|
-
test.on('error', (error) => {
|
50
|
-
console.error('❌ 测试运行失败:', error.message);
|
51
|
-
process.exit(1);
|
52
|
-
});
|
53
|
-
|
54
|
-
test.on('exit', (code) => {
|
55
|
-
process.exit(code || 0);
|
56
|
-
});
|
57
|
-
break;
|
51
|
+
break;
|
58
52
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
CodeRocket MCP - AI
|
53
|
+
case 'help':
|
54
|
+
case '--help':
|
55
|
+
case '-h':
|
56
|
+
console.log(`
|
57
|
+
CodeRocket MCP - 独立的AI驱动代码审查服务器
|
64
58
|
|
65
59
|
用法:
|
66
|
-
coderocket-mcp [命令]
|
60
|
+
npx @yeepay/coderocket-mcp [命令]
|
67
61
|
|
68
62
|
命令:
|
69
|
-
|
70
|
-
test
|
71
|
-
help
|
63
|
+
(默认) 启动MCP服务器
|
64
|
+
test 运行功能测试
|
65
|
+
help 显示帮助信息
|
66
|
+
version 显示版本信息
|
72
67
|
|
73
68
|
示例:
|
74
|
-
coderocket-mcp
|
75
|
-
coderocket-mcp test
|
76
|
-
coderocket-mcp help
|
69
|
+
npx @yeepay/coderocket-mcp # 启动服务器
|
70
|
+
npx @yeepay/coderocket-mcp test # 运行测试
|
71
|
+
npx @yeepay/coderocket-mcp help # 显示帮助
|
77
72
|
|
78
|
-
|
79
|
-
AI_SERVICE 默认AI服务 (gemini/
|
73
|
+
环境变量配置:
|
74
|
+
AI_SERVICE 默认AI服务 (gemini/claudecode)
|
80
75
|
AI_AUTO_SWITCH 启用自动切换 (true/false)
|
81
|
-
AI_TIMEOUT
|
82
|
-
AI_MAX_RETRIES
|
76
|
+
AI_TIMEOUT 超时时间(秒,默认30)
|
77
|
+
AI_MAX_RETRIES 最大重试次数(默认3)
|
78
|
+
GEMINI_API_KEY Gemini API密钥
|
79
|
+
CLAUDECODE_API_KEY ClaudeCode API密钥
|
83
80
|
NODE_ENV 环境模式 (development/production)
|
81
|
+
DEBUG 调试模式 (true/false)
|
84
82
|
|
85
|
-
|
83
|
+
配置文件:
|
84
|
+
项目级: .env
|
85
|
+
全局级: ~/.coderocket/env
|
86
|
+
|
87
|
+
更多信息请访问: https://github.com/im47cn/coderocket-mcp
|
86
88
|
`);
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
89
|
+
break;
|
90
|
+
|
91
|
+
case 'version':
|
92
|
+
case '--version':
|
93
|
+
case '-v':
|
94
|
+
// 读取package.json获取版本信息
|
95
|
+
try {
|
96
|
+
const packagePath = resolve(__dirname, '../package.json');
|
97
|
+
const packageJson = JSON.parse(
|
98
|
+
readFileSync(packagePath, 'utf-8')
|
99
|
+
);
|
100
|
+
console.log(`CodeRocket MCP v${packageJson.version}`);
|
101
|
+
console.log(`独立版本 - 无需 coderocket-cli 依赖`);
|
102
|
+
} catch (error) {
|
103
|
+
console.log('CodeRocket MCP v1.0.1 (独立版本)');
|
104
|
+
}
|
105
|
+
break;
|
106
|
+
|
107
|
+
default:
|
108
|
+
console.error(`❌ 未知命令: ${command}`);
|
109
|
+
console.error('使用 "npx @yeepay/coderocket-mcp help" 查看可用命令');
|
110
|
+
process.exit(1);
|
111
|
+
}
|
108
112
|
}
|