px2cc 2.0.4 → 2.0.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/bin.js +8 -16
- package/cli.js +18 -7
- package/package.json +1 -1
package/bin.js
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Px2CC 启动器 -
|
|
5
|
-
* 直接导入cli.js
|
|
4
|
+
* Px2CC 启动器 - 通用版本
|
|
5
|
+
* 直接导入cli.js,跨平台兼容
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
// 设置环境变量来抑制PromptX内部日志
|
|
9
|
-
process.env.
|
|
9
|
+
process.env.LOG_LEVEL = 'silent';
|
|
10
10
|
|
|
11
|
-
//
|
|
11
|
+
// 修改process.argv让cli.js以为自己是主模块
|
|
12
12
|
import { fileURLToPath } from 'url';
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const cliJsPath = fileURLToPath(new URL('cli.js', import.meta.url));
|
|
14
|
+
process.argv[1] = cliJsPath;
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// 构建cli.js的文件URL(兼容Windows)
|
|
20
|
-
const cliPath = new URL('cli.js', import.meta.url).href;
|
|
21
|
-
|
|
22
|
-
import(cliPath).catch(error => {
|
|
23
|
-
console.error('启动失败:', error.message);
|
|
24
|
-
process.exit(1);
|
|
25
|
-
});
|
|
16
|
+
// 导入并执行cli.js
|
|
17
|
+
import('./cli.js');
|
package/cli.js
CHANGED
|
@@ -30,10 +30,11 @@ async function discoverMCPServers() {
|
|
|
30
30
|
|
|
31
31
|
try {
|
|
32
32
|
console.log(chalk.gray(' 检查MCP服务器状态(可能需要一些时间)...'));
|
|
33
|
-
// 使用claude mcp list获取所有MCP
|
|
33
|
+
// 使用claude mcp list获取所有MCP服务器(增加超时时间到60秒)
|
|
34
34
|
const mcpOutput = execSync('claude mcp list', {
|
|
35
35
|
encoding: 'utf8',
|
|
36
|
-
timeout:
|
|
36
|
+
timeout: 60000, // 增加到60秒
|
|
37
|
+
stdio: 'pipe' // 确保错误输出被捕获
|
|
37
38
|
});
|
|
38
39
|
|
|
39
40
|
// 解析输出,提取服务器信息
|
|
@@ -58,13 +59,15 @@ async function discoverMCPServers() {
|
|
|
58
59
|
|
|
59
60
|
} catch (error) {
|
|
60
61
|
if (error.code === 'ETIMEDOUT') {
|
|
61
|
-
console.error(chalk.
|
|
62
|
-
console.error(chalk.gray('
|
|
62
|
+
console.error(chalk.yellow('⚠️ MCP服务器检查超时,将继续安装(只使用默认工具)'));
|
|
63
|
+
console.error(chalk.gray(' 如需使用MCP工具,请检查网络连接或使用 --skip-mcp 参数'));
|
|
63
64
|
} else {
|
|
64
|
-
console.error(chalk.
|
|
65
|
+
console.error(chalk.yellow('⚠️ 无法获取MCP服务器列表,将继续安装(只使用默认工具)'));
|
|
65
66
|
console.error(chalk.gray(` 原因: ${error.message}`));
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
+
// 不再抛出错误,而是继续执行,不使用MCP服务器
|
|
69
|
+
console.log(chalk.gray(' 将继承所有可用工具(Claude Code默认行为)'));
|
|
70
|
+
return servers;
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
return servers;
|
|
@@ -313,7 +316,15 @@ async function main() {
|
|
|
313
316
|
} else {
|
|
314
317
|
// 发现MCP服务器
|
|
315
318
|
console.log(chalk.cyan('🔍 正在发现MCP服务器...\n'));
|
|
316
|
-
|
|
319
|
+
try {
|
|
320
|
+
availableServers = await discoverMCPServers();
|
|
321
|
+
} catch (error) {
|
|
322
|
+
console.error(chalk.yellow('⚠️ MCP服务器发现失败,使用默认配置'));
|
|
323
|
+
availableServers = {
|
|
324
|
+
defaultTools: ['Read', 'Write', 'Edit', 'Bash'],
|
|
325
|
+
mcpServers: []
|
|
326
|
+
};
|
|
327
|
+
}
|
|
317
328
|
}
|
|
318
329
|
|
|
319
330
|
// 加载角色
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "px2cc",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "CLI tool that implements complete PromptX Action flow in Claude Code - role activation, dependency loading, cognition networks & memory systems",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"type": "module",
|