px2cc 2.0.5 → 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.
Files changed (3) hide show
  1. package/bin.js +1 -1
  2. package/cli.js +18 -7
  3. package/package.json +1 -1
package/bin.js CHANGED
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  // 设置环境变量来抑制PromptX内部日志
9
- process.env.PROMPTX_QUIET = 'true';
9
+ process.env.LOG_LEVEL = 'silent';
10
10
 
11
11
  // 修改process.argv让cli.js以为自己是主模块
12
12
  import { fileURLToPath } from 'url';
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: 30000 // 增加到30
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.red('MCP服务器检查超时'));
62
- console.error(chalk.gray(' 请检查网络连接或MCP服务器配置'));
62
+ console.error(chalk.yellow('⚠️ MCP服务器检查超时,将继续安装(只使用默认工具)'));
63
+ console.error(chalk.gray(' 如需使用MCP工具,请检查网络连接或使用 --skip-mcp 参数'));
63
64
  } else {
64
- console.error(chalk.red('无法获取MCP服务器列表'));
65
+ console.error(chalk.yellow('⚠️ 无法获取MCP服务器列表,将继续安装(只使用默认工具)'));
65
66
  console.error(chalk.gray(` 原因: ${error.message}`));
66
67
  }
67
- throw error;
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
- availableServers = await discoverMCPServers();
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.5",
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",