px2cc 2.0.1 → 2.0.3
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 +6 -69
- package/package.json +1 -1
- package/src/PromptXActionProcessor.js +4 -2
package/bin.js
CHANGED
|
@@ -1,78 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Px2CC 启动器 -
|
|
4
|
+
* Px2CC 启动器 - Windows兼容版本
|
|
5
|
+
* 直接导入cli.js,避免spawn的兼容性问题
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { dirname, join } from 'path';
|
|
8
|
+
// 设置环境变量来抑制PromptX内部日志
|
|
9
|
+
process.env.PROMPTX_QUIET = 'true';
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
const __dirname = dirname(__filename);
|
|
14
|
-
|
|
15
|
-
// CLI脚本路径
|
|
16
|
-
const cliPath = join(__dirname, 'cli.js');
|
|
17
|
-
|
|
18
|
-
// 启动CLI并过滤日志
|
|
19
|
-
const child = spawn('node', [cliPath], {
|
|
20
|
-
stdio: ['inherit', 'pipe', 'pipe']
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// 过滤stdout
|
|
24
|
-
child.stdout.on('data', (data) => {
|
|
25
|
-
const output = data.toString();
|
|
26
|
-
const lines = output.split('\n');
|
|
27
|
-
|
|
28
|
-
const filteredLines = lines.filter(line => {
|
|
29
|
-
return !(
|
|
30
|
-
line.includes('@promptx/core') ||
|
|
31
|
-
line.includes('ResourceManager') ||
|
|
32
|
-
line.includes('PackageDiscovery') ||
|
|
33
|
-
line.includes('UserDiscovery') ||
|
|
34
|
-
line.includes('ProjectDiscovery') ||
|
|
35
|
-
line.includes('项目未初始化') ||
|
|
36
|
-
line.includes('Registry loaded') ||
|
|
37
|
-
line.includes('Discovery managers') ||
|
|
38
|
-
line.includes('Initialization complete')
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
if (filteredLines.length > 0) {
|
|
43
|
-
process.stdout.write(filteredLines.join('\n'));
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// 过滤stderr
|
|
48
|
-
child.stderr.on('data', (data) => {
|
|
49
|
-
const output = data.toString();
|
|
50
|
-
const lines = output.split('\n');
|
|
51
|
-
|
|
52
|
-
const filteredLines = lines.filter(line => {
|
|
53
|
-
return !(
|
|
54
|
-
line.includes('@promptx/core') ||
|
|
55
|
-
line.includes('ResourceManager') ||
|
|
56
|
-
line.includes('PackageDiscovery') ||
|
|
57
|
-
line.includes('UserDiscovery') ||
|
|
58
|
-
line.includes('ProjectDiscovery') ||
|
|
59
|
-
line.includes('项目未初始化') ||
|
|
60
|
-
line.includes('Registry loaded') ||
|
|
61
|
-
line.includes('Discovery managers') ||
|
|
62
|
-
line.includes('Initialization complete')
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
if (filteredLines.length > 0) {
|
|
67
|
-
process.stderr.write(filteredLines.join('\n'));
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
child.on('close', (code) => {
|
|
72
|
-
process.exit(code);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
child.on('error', (error) => {
|
|
11
|
+
// 直接导入并执行cli.js
|
|
12
|
+
import('./cli.js').catch(error => {
|
|
76
13
|
console.error('启动失败:', error.message);
|
|
77
14
|
process.exit(1);
|
|
78
15
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "px2cc",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
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",
|
|
@@ -164,8 +164,8 @@ class DependencyAnalyzer {
|
|
|
164
164
|
|
|
165
165
|
const extractFromText = (text) => {
|
|
166
166
|
if (!text) return [];
|
|
167
|
-
// 匹配 @protocol://resource 格式
|
|
168
|
-
const matches = text.matchAll(
|
|
167
|
+
// 匹配 @!protocol://resource 或 @protocol://resource 格式
|
|
168
|
+
const matches = text.matchAll(/@!?([^:]+):\/\/([^\s\>\<\n]+)/g);
|
|
169
169
|
return Array.from(matches).map(match => ({
|
|
170
170
|
protocol: match[1],
|
|
171
171
|
resource: match[2]
|
|
@@ -420,6 +420,8 @@ class LayerAssembler {
|
|
|
420
420
|
// 移除PromptX资源引用标签(但保留引用内容的展开结果)
|
|
421
421
|
.replace(/<reference[^>]*>/g, '')
|
|
422
422
|
.replace(/<\/reference>/g, '')
|
|
423
|
+
// 移除@!protocol://resource引用行(因为依赖内容会单独展示)
|
|
424
|
+
.replace(/\s*@!?[^:]+:\/\/[^\s\>\<\n]+\s*/g, '')
|
|
423
425
|
// 清理多余空行
|
|
424
426
|
.replace(/\n\s*\n\s*\n/g, '\n\n')
|
|
425
427
|
// 移除开头结尾空白
|