trimprompt 1.0.29 → 1.0.31
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/README.md +13 -0
- package/api-proxy.js +1 -1
- package/cache-manager.js +1 -0
- package/cache.js +1 -1
- package/ccr.js +1 -1
- package/cli.js +1 -1
- package/dashboard.js +1 -1
- package/executor.js +1 -1
- package/file-watcher.js +1 -0
- package/filters/devops.js +1 -1
- package/filters/generic.js +1 -1
- package/filters/git.js +1 -1
- package/filters/go.js +99 -1
- package/filters/index.js +185 -1
- package/filters/js.js +78 -1
- package/filters/python.js +130 -1
- package/filters/rust.js +115 -1
- package/filters/shell.js +395 -1
- package/hooks/claude-hook.js +79 -0
- package/index.html +339 -119
- package/mcp.js +132 -1
- package/package.json +1 -4
- package/proxy-conv.js +181 -1
- package/proxy-daemon.js +382 -1
- package/proxy-resp.js +1 -1
- package/redactor.js +1 -1
- package/seed.js +1 -1
- package/shims.js +1 -1
- package/simulate.js +1 -1
- package/sync.js +1 -1
- package/tracker.js +1 -1
- package/traffic-interceptor.js +1 -1
package/filters/python.js
CHANGED
|
@@ -1 +1,130 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterPytest = filterPytest;
|
|
4
|
+
exports.filterPipInstall = filterPipInstall;
|
|
5
|
+
function filterPytest(stdout) {
|
|
6
|
+
const lines = stdout.split('\n');
|
|
7
|
+
let passed = 0;
|
|
8
|
+
let failed = 0;
|
|
9
|
+
let skipped = 0;
|
|
10
|
+
let xfailed = 0;
|
|
11
|
+
let xpassed = 0;
|
|
12
|
+
const failureBlocks = [];
|
|
13
|
+
let currentFailure = [];
|
|
14
|
+
let inFailureSection = false;
|
|
15
|
+
for (const line of lines) {
|
|
16
|
+
const trimmed = line.trim();
|
|
17
|
+
if (trimmed.startsWith('=== FAILURES ===') || trimmed.startsWith('=== ERRORS ===')) {
|
|
18
|
+
inFailureSection = true;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
else if (trimmed.startsWith('=== short test summary info ===') || (trimmed.startsWith('===') && trimmed.includes('passed'))) {
|
|
22
|
+
inFailureSection = false;
|
|
23
|
+
if (currentFailure.length > 0) {
|
|
24
|
+
failureBlocks.push(currentFailure);
|
|
25
|
+
currentFailure = [];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (inFailureSection) {
|
|
29
|
+
if (trimmed.startsWith('___')) {
|
|
30
|
+
if (currentFailure.length > 0) {
|
|
31
|
+
failureBlocks.push(currentFailure);
|
|
32
|
+
currentFailure = [];
|
|
33
|
+
}
|
|
34
|
+
currentFailure.push(trimmed);
|
|
35
|
+
}
|
|
36
|
+
else if (trimmed.length > 0) {
|
|
37
|
+
currentFailure.push(line);
|
|
38
|
+
}
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (trimmed.startsWith('===') && trimmed.includes(' in ')) {
|
|
42
|
+
const matchPassed = trimmed.match(/(\d+)\s+passed/);
|
|
43
|
+
const matchFailed = trimmed.match(/(\d+)\s+failed/);
|
|
44
|
+
const matchSkipped = trimmed.match(/(\d+)\s+skipped/);
|
|
45
|
+
const matchXfailed = trimmed.match(/(\d+)\s+xfailed/);
|
|
46
|
+
const matchXpassed = trimmed.match(/(\d+)\s+xpassed/);
|
|
47
|
+
if (matchPassed)
|
|
48
|
+
passed = parseInt(matchPassed[1]);
|
|
49
|
+
if (matchFailed)
|
|
50
|
+
failed = parseInt(matchFailed[1]);
|
|
51
|
+
if (matchSkipped)
|
|
52
|
+
skipped = parseInt(matchSkipped[1]);
|
|
53
|
+
if (matchXfailed)
|
|
54
|
+
xfailed = parseInt(matchXfailed[1]);
|
|
55
|
+
if (matchXpassed)
|
|
56
|
+
xpassed = parseInt(matchXpassed[1]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (currentFailure.length > 0) {
|
|
60
|
+
failureBlocks.push(currentFailure);
|
|
61
|
+
}
|
|
62
|
+
if (passed === 0 && failed === 0 && skipped === 0 && xfailed === 0 && xpassed === 0) {
|
|
63
|
+
if (stdout.includes('passed') && !stdout.includes('failed')) {
|
|
64
|
+
return "Pytest: All tests passed";
|
|
65
|
+
}
|
|
66
|
+
return stdout;
|
|
67
|
+
}
|
|
68
|
+
if (failed === 0 && passed > 0 && skipped === 0 && xfailed === 0 && xpassed === 0) {
|
|
69
|
+
return `Pytest: ${passed} passed`;
|
|
70
|
+
}
|
|
71
|
+
const summaryParts = [];
|
|
72
|
+
summaryParts.push(`Pytest: ${passed} passed`);
|
|
73
|
+
if (failed > 0)
|
|
74
|
+
summaryParts.push(`${failed} failed`);
|
|
75
|
+
if (skipped > 0)
|
|
76
|
+
summaryParts.push(`${skipped} skipped`);
|
|
77
|
+
if (xfailed > 0)
|
|
78
|
+
summaryParts.push(`${xfailed} xfailed`);
|
|
79
|
+
if (xpassed > 0)
|
|
80
|
+
summaryParts.push(`${xpassed} xpassed (warning!)`);
|
|
81
|
+
const result = [summaryParts.join(', ')];
|
|
82
|
+
if (failureBlocks.length > 0) {
|
|
83
|
+
result.push("\nFailures:");
|
|
84
|
+
const limit = 3;
|
|
85
|
+
const printedFailures = failureBlocks.slice(0, limit);
|
|
86
|
+
for (let i = 0; i < printedFailures.length; i++) {
|
|
87
|
+
const block = printedFailures[i];
|
|
88
|
+
const header = block[0].replace(/_/g, '').trim();
|
|
89
|
+
result.push(` ${i + 1}. [FAIL] ${header}`);
|
|
90
|
+
const body = block.slice(1);
|
|
91
|
+
const essentialLines = body.filter(line => {
|
|
92
|
+
const t = line.trim();
|
|
93
|
+
return t.startsWith('>') || t.startsWith('E ') || t.includes('.py:') || t.includes('AssertionError:');
|
|
94
|
+
});
|
|
95
|
+
for (const line of essentialLines.slice(0, 8)) {
|
|
96
|
+
result.push(` ${line}`);
|
|
97
|
+
}
|
|
98
|
+
if (essentialLines.length > 8) {
|
|
99
|
+
result.push(` ... (${essentialLines.length - 8} lines of stacktrace truncated)`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (failureBlocks.length > limit) {
|
|
103
|
+
result.push(` ... +${failureBlocks.length - limit} more failures truncated`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return result.join('\n');
|
|
107
|
+
}
|
|
108
|
+
function filterPipInstall(stdout) {
|
|
109
|
+
const lines = stdout.split('\n');
|
|
110
|
+
const installed = [];
|
|
111
|
+
for (const line of lines) {
|
|
112
|
+
const trimmed = line.trim();
|
|
113
|
+
if (trimmed.startsWith('Successfully installed')) {
|
|
114
|
+
installed.push(trimmed);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (installed.length > 0) {
|
|
118
|
+
return installed.join('\n');
|
|
119
|
+
}
|
|
120
|
+
return lines
|
|
121
|
+
.filter(line => {
|
|
122
|
+
const t = line.trim();
|
|
123
|
+
return !t.startsWith('Collecting') &&
|
|
124
|
+
!t.startsWith('Downloading') &&
|
|
125
|
+
!t.includes('Using cached') &&
|
|
126
|
+
!t.startsWith('Requirement already satisfied');
|
|
127
|
+
})
|
|
128
|
+
.join('\n')
|
|
129
|
+
.trim();
|
|
130
|
+
}
|
package/filters/rust.js
CHANGED
|
@@ -1 +1,115 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterCargoTest = filterCargoTest;
|
|
4
|
+
exports.filterCargoBuild = filterCargoBuild;
|
|
5
|
+
function filterCargoTest(stdout) {
|
|
6
|
+
const lines = stdout.split('\n');
|
|
7
|
+
let passed = 0;
|
|
8
|
+
let failed = 0;
|
|
9
|
+
let ignored = 0;
|
|
10
|
+
let measured = 0;
|
|
11
|
+
const failedTests = [];
|
|
12
|
+
let inFailures = false;
|
|
13
|
+
let currentFailure = [];
|
|
14
|
+
for (const line of lines) {
|
|
15
|
+
const trimmed = line.trim();
|
|
16
|
+
const resultMatch = trimmed.match(/test result:\s*(\w+)\.\s*(\d+)\s+passed;\s*(\d+)\s+failed;\s*(\d+)\s+ignored;\s*(\d+)\s+measured/);
|
|
17
|
+
if (resultMatch) {
|
|
18
|
+
passed += parseInt(resultMatch[2]);
|
|
19
|
+
failed += parseInt(resultMatch[3]);
|
|
20
|
+
ignored += parseInt(resultMatch[4]);
|
|
21
|
+
measured += parseInt(resultMatch[5]);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (trimmed === 'failures:' || trimmed === '---- failures ----') {
|
|
25
|
+
inFailures = true;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (inFailures) {
|
|
29
|
+
if (trimmed.startsWith('---- ') && trimmed.endsWith(' ----')) {
|
|
30
|
+
if (currentFailure.length > 0)
|
|
31
|
+
failedTests.push(currentFailure.join('\n'));
|
|
32
|
+
currentFailure = [trimmed.replace(/^-+\s*/, '').replace(/\s*-+$/, '')];
|
|
33
|
+
}
|
|
34
|
+
else if (trimmed === 'failures:' || trimmed.startsWith('test result:')) {
|
|
35
|
+
if (currentFailure.length > 0)
|
|
36
|
+
failedTests.push(currentFailure.join('\n'));
|
|
37
|
+
currentFailure = [];
|
|
38
|
+
inFailures = false;
|
|
39
|
+
}
|
|
40
|
+
else if (trimmed.length > 0) {
|
|
41
|
+
currentFailure.push(line);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (currentFailure.length > 0)
|
|
46
|
+
failedTests.push(currentFailure.join('\n'));
|
|
47
|
+
if (passed === 0 && failed === 0 && ignored === 0) {
|
|
48
|
+
if (stdout.includes('test result: ok'))
|
|
49
|
+
return "Cargo test: all tests passed";
|
|
50
|
+
return stdout;
|
|
51
|
+
}
|
|
52
|
+
if (failed === 0) {
|
|
53
|
+
const parts = [`Cargo test: ${passed} passed`];
|
|
54
|
+
if (ignored > 0)
|
|
55
|
+
parts.push(`${ignored} ignored`);
|
|
56
|
+
return parts.join(', ');
|
|
57
|
+
}
|
|
58
|
+
const result = [`Cargo test: ${passed} passed, ${failed} failed, ${ignored} ignored`];
|
|
59
|
+
if (failedTests.length > 0) {
|
|
60
|
+
result.push("\nFailures:");
|
|
61
|
+
const limit = 3;
|
|
62
|
+
for (let i = 0; i < Math.min(failedTests.length, limit); i++) {
|
|
63
|
+
const failLines = failedTests[i].split('\n');
|
|
64
|
+
result.push(` ${i + 1}. ${failLines[0]}`);
|
|
65
|
+
const body = failLines.slice(1);
|
|
66
|
+
const essential = body.filter(l => l.trim().startsWith('thread') || l.includes('panicked') || l.includes('assert') || l.includes('left:') || l.includes('right:'));
|
|
67
|
+
for (const l of essential.slice(0, 5)) {
|
|
68
|
+
result.push(` ${l.trim()}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (failedTests.length > limit) {
|
|
72
|
+
result.push(` ... +${failedTests.length - limit} more failures`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return result.join('\n');
|
|
76
|
+
}
|
|
77
|
+
function filterCargoBuild(stdout) {
|
|
78
|
+
const lines = stdout.split('\n');
|
|
79
|
+
const warnings = [];
|
|
80
|
+
const errors = [];
|
|
81
|
+
let compiled = 0;
|
|
82
|
+
for (const line of lines) {
|
|
83
|
+
const trimmed = line.trim();
|
|
84
|
+
if (trimmed.startsWith('Compiling '))
|
|
85
|
+
compiled++;
|
|
86
|
+
else if (trimmed.startsWith('warning[') || trimmed.startsWith('warning:'))
|
|
87
|
+
warnings.push(trimmed);
|
|
88
|
+
else if (trimmed.startsWith('error[') || trimmed.startsWith('error:'))
|
|
89
|
+
errors.push(trimmed);
|
|
90
|
+
}
|
|
91
|
+
if (errors.length === 0 && warnings.length === 0) {
|
|
92
|
+
return compiled > 0 ? `Cargo: compiled ${compiled} crates successfully` : stdout.trim();
|
|
93
|
+
}
|
|
94
|
+
const result = [];
|
|
95
|
+
if (errors.length > 0) {
|
|
96
|
+
result.push(`Cargo: ${errors.length} errors, ${warnings.length} warnings`);
|
|
97
|
+
result.push("\nErrors:");
|
|
98
|
+
for (const e of errors.slice(0, 5))
|
|
99
|
+
result.push(` ${e}`);
|
|
100
|
+
if (errors.length > 5)
|
|
101
|
+
result.push(` ... +${errors.length - 5} more errors`);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
result.push(`Cargo: compiled ${compiled} crates, ${warnings.length} warnings`);
|
|
105
|
+
}
|
|
106
|
+
if (warnings.length > 0 && warnings.length <= 5) {
|
|
107
|
+
result.push("\nWarnings:");
|
|
108
|
+
for (const w of warnings)
|
|
109
|
+
result.push(` ${w}`);
|
|
110
|
+
}
|
|
111
|
+
else if (warnings.length > 5) {
|
|
112
|
+
result.push(`\n(${warnings.length} warnings — run cargo clippy for details)`);
|
|
113
|
+
}
|
|
114
|
+
return result.join('\n');
|
|
115
|
+
}
|