px2cc 2.1.0 → 2.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.
Files changed (3) hide show
  1. package/bin.js +16 -8
  2. package/cli.js +3 -3
  3. package/package.json +2 -2
package/bin.js CHANGED
@@ -2,16 +2,24 @@
2
2
 
3
3
  /**
4
4
  * Px2CC 启动器 - 通用版本
5
- * 直接导入cli.js,跨平台兼容
5
+ * 直接调用主函数,确保跨平台兼容
6
6
  */
7
7
 
8
8
  // 设置环境变量来抑制PromptX内部日志
9
9
  process.env.LOG_LEVEL = 'silent';
10
10
 
11
- // 修改process.argv让cli.js以为自己是主模块
12
- import { fileURLToPath } from 'url';
13
- const cliJsPath = fileURLToPath(new URL('cli.js', import.meta.url));
14
- process.argv[1] = cliJsPath;
15
-
16
- // 导入并执行cli.js
17
- import('./cli.js');
11
+ // 动态导入并直接调用main函数
12
+ (async () => {
13
+ try {
14
+ const { main } = await import('./cli.js');
15
+ if (typeof main === 'function') {
16
+ await main();
17
+ } else {
18
+ // 如果没有导出main函数,直接导入模块(会自动执行)
19
+ await import('./cli.js');
20
+ }
21
+ } catch (error) {
22
+ console.error('启动失败:', error.message);
23
+ process.exit(1);
24
+ }
25
+ })();
package/cli.js CHANGED
@@ -299,7 +299,7 @@ async function installRole(selectedRole, installType, claudeDir, manager, select
299
299
  }
300
300
 
301
301
  // 主程序入口
302
- async function main() {
302
+ export async function main() {
303
303
  try {
304
304
  showWelcome();
305
305
 
@@ -373,8 +373,8 @@ async function main() {
373
373
  }
374
374
  }
375
375
 
376
- // 运行主程序
377
- if (import.meta.url === new URL(process.argv[1], 'file:').href) {
376
+ // 运行主程序 - 简化条件判断以提高兼容性
377
+ if (import.meta.url === new URL(process.argv[1], 'file:').href || process.argv[1].endsWith('cli.js')) {
378
378
  main().catch(error => {
379
379
  console.error(chalk.red('❌ 程序异常:'), error.message);
380
380
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "px2cc",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
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",
@@ -38,7 +38,7 @@
38
38
  "author": "PromptX Bridge Team",
39
39
  "license": "MIT",
40
40
  "engines": {
41
- "node": ">=16.0.0"
41
+ "node": ">=18.0.0"
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",