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/filters/python.js CHANGED
@@ -1 +1,130 @@
1
- 'use strict';const a0_0x5a8fe4=a0_0x46aa;(function(_0x4aed3e,_0x5ba894){const _0x557360=a0_0x46aa,_0x365737=_0x4aed3e();while(!![]){try{const _0x58f91c=parseInt(_0x557360(0xa6))/0x1*(-parseInt(_0x557360(0x90))/0x2)+parseInt(_0x557360(0x82))/0x3+-parseInt(_0x557360(0x8f))/0x4*(-parseInt(_0x557360(0xa3))/0x5)+-parseInt(_0x557360(0x9d))/0x6+parseInt(_0x557360(0x80))/0x7*(-parseInt(_0x557360(0xa9))/0x8)+parseInt(_0x557360(0x96))/0x9*(-parseInt(_0x557360(0x8a))/0xa)+parseInt(_0x557360(0xa4))/0xb;if(_0x58f91c===_0x5ba894)break;else _0x365737['push'](_0x365737['shift']());}catch(_0x3bbd37){_0x365737['push'](_0x365737['shift']());}}}(a0_0xfed0,0x5ed1b));Object['defineProperty'](exports,a0_0x5a8fe4(0x9a),{'value':!![]}),exports[a0_0x5a8fe4(0x97)]=filterPytest,exports['filterPipInstall']=filterPipInstall;function filterPytest(_0x5795c0){const _0x1ab9a1=a0_0x5a8fe4,_0x18ec43=_0x5795c0[_0x1ab9a1(0x7e)]('\x0a');let _0x566d9d=0x0,_0x16f0d5=0x0,_0x1fc553=0x0,_0x49ee59=0x0,_0x249184=0x0;const _0x279c89=[];let _0x48a8d9=[],_0x57fcf4=![];for(const _0xafd2c2 of _0x18ec43){const _0x354f2d=_0xafd2c2[_0x1ab9a1(0x88)]();if(_0x354f2d[_0x1ab9a1(0x91)](_0x1ab9a1(0x98))||_0x354f2d['startsWith'](_0x1ab9a1(0x9f))){_0x57fcf4=!![];continue;}else(_0x354f2d[_0x1ab9a1(0x91)]('===\x20short\x20test\x20summary\x20info\x20===')||_0x354f2d['startsWith']('===')&&_0x354f2d[_0x1ab9a1(0x7b)]('passed'))&&(_0x57fcf4=![],_0x48a8d9[_0x1ab9a1(0x95)]>0x0&&(_0x279c89[_0x1ab9a1(0x86)](_0x48a8d9),_0x48a8d9=[]));if(_0x57fcf4){if(_0x354f2d[_0x1ab9a1(0x91)](_0x1ab9a1(0x93)))_0x48a8d9[_0x1ab9a1(0x95)]>0x0&&(_0x279c89['push'](_0x48a8d9),_0x48a8d9=[]),_0x48a8d9['push'](_0x354f2d);else _0x354f2d[_0x1ab9a1(0x95)]>0x0&&_0x48a8d9[_0x1ab9a1(0x86)](_0xafd2c2);continue;}if(_0x354f2d['startsWith'](_0x1ab9a1(0x87))&&_0x354f2d[_0x1ab9a1(0x7b)](_0x1ab9a1(0x9e))){const _0x79c8b4=_0x354f2d[_0x1ab9a1(0x94)](/(\d+)\s+passed/),_0x5e410b=_0x354f2d[_0x1ab9a1(0x94)](/(\d+)\s+failed/),_0x5e2b8e=_0x354f2d[_0x1ab9a1(0x94)](/(\d+)\s+skipped/),_0x3d8e1c=_0x354f2d[_0x1ab9a1(0x94)](/(\d+)\s+xfailed/),_0x235069=_0x354f2d[_0x1ab9a1(0x94)](/(\d+)\s+xpassed/);if(_0x79c8b4)_0x566d9d=parseInt(_0x79c8b4[0x1]);if(_0x5e410b)_0x16f0d5=parseInt(_0x5e410b[0x1]);if(_0x5e2b8e)_0x1fc553=parseInt(_0x5e2b8e[0x1]);if(_0x3d8e1c)_0x49ee59=parseInt(_0x3d8e1c[0x1]);if(_0x235069)_0x249184=parseInt(_0x235069[0x1]);}}_0x48a8d9['length']>0x0&&_0x279c89['push'](_0x48a8d9);if(_0x566d9d===0x0&&_0x16f0d5===0x0&&_0x1fc553===0x0&&_0x49ee59===0x0&&_0x249184===0x0){if(_0x5795c0[_0x1ab9a1(0x7b)](_0x1ab9a1(0xa8))&&!_0x5795c0[_0x1ab9a1(0x7b)]('failed'))return _0x1ab9a1(0x85);return _0x5795c0;}if(_0x16f0d5===0x0&&_0x566d9d>0x0&&_0x1fc553===0x0&&_0x49ee59===0x0&&_0x249184===0x0)return'Pytest:\x20'+_0x566d9d+_0x1ab9a1(0x7d);const _0x381f23=[];_0x381f23[_0x1ab9a1(0x86)](_0x1ab9a1(0x8c)+_0x566d9d+_0x1ab9a1(0x7d));if(_0x16f0d5>0x0)_0x381f23['push'](_0x16f0d5+_0x1ab9a1(0xa1));if(_0x1fc553>0x0)_0x381f23['push'](_0x1fc553+_0x1ab9a1(0xa5));if(_0x49ee59>0x0)_0x381f23['push'](_0x49ee59+'\x20xfailed');if(_0x249184>0x0)_0x381f23[_0x1ab9a1(0x86)](_0x249184+_0x1ab9a1(0x99));const _0x33e506=[_0x381f23[_0x1ab9a1(0x9c)](',\x20')];if(_0x279c89[_0x1ab9a1(0x95)]>0x0){_0x33e506[_0x1ab9a1(0x86)](_0x1ab9a1(0x8e));const _0xf45c68=0x3,_0x454015=_0x279c89[_0x1ab9a1(0x8b)](0x0,_0xf45c68);for(let _0x19776a=0x0;_0x19776a<_0x454015[_0x1ab9a1(0x95)];_0x19776a++){const _0x34fa4a=_0x454015[_0x19776a],_0x546e4e=_0x34fa4a[0x0][_0x1ab9a1(0x8d)](/_/g,'')[_0x1ab9a1(0x88)]();_0x33e506['push']('\x20\x20'+(_0x19776a+0x1)+_0x1ab9a1(0x7c)+_0x546e4e);const _0x4009de=_0x34fa4a[_0x1ab9a1(0x8b)](0x1),_0x356808=_0x4009de[_0x1ab9a1(0xa7)](_0x5c1a32=>{const _0x3f9174=_0x1ab9a1,_0x12460c=_0x5c1a32[_0x3f9174(0x88)]();return _0x12460c[_0x3f9174(0x91)]('>')||_0x12460c['startsWith'](_0x3f9174(0x83))||_0x12460c[_0x3f9174(0x7b)](_0x3f9174(0x9b))||_0x12460c[_0x3f9174(0x7b)]('AssertionError:');});for(const _0x48dfe2 of _0x356808[_0x1ab9a1(0x8b)](0x0,0x8)){_0x33e506[_0x1ab9a1(0x86)](_0x1ab9a1(0x89)+_0x48dfe2);}_0x356808[_0x1ab9a1(0x95)]>0x8&&_0x33e506[_0x1ab9a1(0x86)](_0x1ab9a1(0x92)+(_0x356808[_0x1ab9a1(0x95)]-0x8)+_0x1ab9a1(0xa2));}_0x279c89['length']>_0xf45c68&&_0x33e506[_0x1ab9a1(0x86)](_0x1ab9a1(0x81)+(_0x279c89[_0x1ab9a1(0x95)]-_0xf45c68)+'\x20more\x20failures\x20truncated');}return _0x33e506[_0x1ab9a1(0x9c)]('\x0a');}function a0_0x46aa(_0x9b426a,_0x39393c){_0x9b426a=_0x9b426a-0x7b;const _0xfed0bd=a0_0xfed0();let _0x46aa88=_0xfed0bd[_0x9b426a];return _0x46aa88;}function filterPipInstall(_0x4eb4fc){const _0x12f62b=a0_0x5a8fe4,_0x19d663=_0x4eb4fc[_0x12f62b(0x7e)]('\x0a'),_0x14aad6=[];for(const _0x49fd68 of _0x19d663){const _0x331534=_0x49fd68[_0x12f62b(0x88)]();_0x331534[_0x12f62b(0x91)](_0x12f62b(0x7f))&&_0x14aad6[_0x12f62b(0x86)](_0x331534);}if(_0x14aad6[_0x12f62b(0x95)]>0x0)return _0x14aad6[_0x12f62b(0x9c)]('\x0a');return _0x19d663[_0x12f62b(0xa7)](_0x2f7aba=>{const _0x4210d1=_0x12f62b,_0x20b474=_0x2f7aba[_0x4210d1(0x88)]();return!_0x20b474[_0x4210d1(0x91)]('Collecting')&&!_0x20b474[_0x4210d1(0x91)](_0x4210d1(0xa0))&&!_0x20b474[_0x4210d1(0x7b)](_0x4210d1(0x84))&&!_0x20b474['startsWith']('Requirement\x20already\x20satisfied');})[_0x12f62b(0x9c)]('\x0a')[_0x12f62b(0x88)]();}function a0_0xfed0(){const _0x171bd8=['\x20\x20...\x20+','2047401XQtuVO','E\x20\x20\x20','Using\x20cached','Pytest:\x20All\x20tests\x20passed','push','===','trim','\x20\x20\x20\x20','25770IAYSYQ','slice','Pytest:\x20','replace','\x0aFailures:','2487464ZkBpOu','5318azXHzl','startsWith','\x20\x20\x20\x20...\x20(','___','match','length','963ZRDPnK','filterPytest','===\x20FAILURES\x20===','\x20xpassed\x20(warning!)','__esModule','.py:','join','2072466XhNzdK','\x20in\x20','===\x20ERRORS\x20===','Downloading','\x20failed','\x20lines\x20of\x20stacktrace\x20truncated)','5XjwZMX','93830dNZUtm','\x20skipped','71sbdSVN','filter','passed','29560OEOKoh','includes','.\x20[FAIL]\x20','\x20passed','split','Successfully\x20installed','217boQcHZ'];a0_0xfed0=function(){return _0x171bd8;};return a0_0xfed0();}
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
- 'use strict';const a0_0x385f06=a0_0x151e;(function(_0x379fe6,_0x4f59da){const _0x1662cd=a0_0x151e,_0x14e857=_0x379fe6();while(!![]){try{const _0x3d4cf6=parseInt(_0x1662cd(0x10b))/0x1*(parseInt(_0x1662cd(0x10f))/0x2)+-parseInt(_0x1662cd(0x12c))/0x3+-parseInt(_0x1662cd(0x108))/0x4*(parseInt(_0x1662cd(0xf9))/0x5)+parseInt(_0x1662cd(0x107))/0x6+-parseInt(_0x1662cd(0x113))/0x7*(-parseInt(_0x1662cd(0x11c))/0x8)+parseInt(_0x1662cd(0x11f))/0x9+parseInt(_0x1662cd(0x109))/0xa*(-parseInt(_0x1662cd(0x118))/0xb);if(_0x3d4cf6===_0x4f59da)break;else _0x14e857['push'](_0x14e857['shift']());}catch(_0xb7b984){_0x14e857['push'](_0x14e857['shift']());}}}(a0_0x4d4b,0x86849));Object[a0_0x385f06(0x115)](exports,a0_0x385f06(0x116),{'value':!![]}),exports['filterCargoTest']=filterCargoTest,exports[a0_0x385f06(0x128)]=filterCargoBuild;function filterCargoTest(_0xec6b6e){const _0x3b27ba=a0_0x385f06,_0x4c2b1b=_0xec6b6e[_0x3b27ba(0xff)]('\x0a');let _0x39a84c=0x0,_0x3b4906=0x0,_0x327e31=0x0,_0x222831=0x0;const _0x361819=[];let _0x13ad8e=![],_0x9a5a80=[];for(const _0x46464b of _0x4c2b1b){const _0x4dfc78=_0x46464b['trim'](),_0x363320=_0x4dfc78[_0x3b27ba(0x12f)](/test result:\s*(\w+)\.\s*(\d+)\s+passed;\s*(\d+)\s+failed;\s*(\d+)\s+ignored;\s*(\d+)\s+measured/);if(_0x363320){_0x39a84c+=parseInt(_0x363320[0x2]),_0x3b4906+=parseInt(_0x363320[0x3]),_0x327e31+=parseInt(_0x363320[0x4]),_0x222831+=parseInt(_0x363320[0x5]);continue;}if(_0x4dfc78===_0x3b27ba(0x112)||_0x4dfc78==='----\x20failures\x20----'){_0x13ad8e=!![];continue;}if(_0x13ad8e){if(_0x4dfc78[_0x3b27ba(0x10a)](_0x3b27ba(0x12b))&&_0x4dfc78['endsWith'](_0x3b27ba(0x111))){if(_0x9a5a80[_0x3b27ba(0xf8)]>0x0)_0x361819[_0x3b27ba(0xfb)](_0x9a5a80['join']('\x0a'));_0x9a5a80=[_0x4dfc78['replace'](/^-+\s*/,'')[_0x3b27ba(0xfc)](/\s*-+$/,'')];}else{if(_0x4dfc78===_0x3b27ba(0x112)||_0x4dfc78[_0x3b27ba(0x10a)](_0x3b27ba(0x120))){if(_0x9a5a80[_0x3b27ba(0xf8)]>0x0)_0x361819['push'](_0x9a5a80[_0x3b27ba(0x119)]('\x0a'));_0x9a5a80=[],_0x13ad8e=![];}else _0x4dfc78[_0x3b27ba(0xf8)]>0x0&&_0x9a5a80[_0x3b27ba(0xfb)](_0x46464b);}}}if(_0x9a5a80[_0x3b27ba(0xf8)]>0x0)_0x361819['push'](_0x9a5a80[_0x3b27ba(0x119)]('\x0a'));if(_0x39a84c===0x0&&_0x3b4906===0x0&&_0x327e31===0x0){if(_0xec6b6e[_0x3b27ba(0x126)](_0x3b27ba(0x12a)))return'Cargo\x20test:\x20all\x20tests\x20passed';return _0xec6b6e;}if(_0x3b4906===0x0){const _0x5db8a6=['Cargo\x20test:\x20'+_0x39a84c+_0x3b27ba(0x121)];if(_0x327e31>0x0)_0x5db8a6[_0x3b27ba(0xfb)](_0x327e31+_0x3b27ba(0x103));return _0x5db8a6[_0x3b27ba(0x119)](',\x20');}const _0x1111e9=[_0x3b27ba(0x125)+_0x39a84c+_0x3b27ba(0x11b)+_0x3b4906+_0x3b27ba(0x10c)+_0x327e31+_0x3b27ba(0x103)];if(_0x361819[_0x3b27ba(0xf8)]>0x0){_0x1111e9[_0x3b27ba(0xfb)](_0x3b27ba(0x114));const _0x15dca5=0x3;for(let _0x359913=0x0;_0x359913<Math[_0x3b27ba(0xfe)](_0x361819[_0x3b27ba(0xf8)],_0x15dca5);_0x359913++){const _0x2e3e4d=_0x361819[_0x359913][_0x3b27ba(0xff)]('\x0a');_0x1111e9[_0x3b27ba(0xfb)]('\x20\x20'+(_0x359913+0x1)+'.\x20'+_0x2e3e4d[0x0]);const _0x2f3eb0=_0x2e3e4d[_0x3b27ba(0x101)](0x1),_0x38a27e=_0x2f3eb0[_0x3b27ba(0x127)](_0x52cdba=>_0x52cdba[_0x3b27ba(0x123)]()[_0x3b27ba(0x10a)](_0x3b27ba(0x100))||_0x52cdba[_0x3b27ba(0x126)](_0x3b27ba(0xfa))||_0x52cdba[_0x3b27ba(0x126)](_0x3b27ba(0x129))||_0x52cdba[_0x3b27ba(0x126)](_0x3b27ba(0x110))||_0x52cdba['includes'](_0x3b27ba(0x102)));for(const _0x1fd884 of _0x38a27e['slice'](0x0,0x5)){_0x1111e9[_0x3b27ba(0xfb)](_0x3b27ba(0x10e)+_0x1fd884[_0x3b27ba(0x123)]());}}_0x361819[_0x3b27ba(0xf8)]>_0x15dca5&&_0x1111e9[_0x3b27ba(0xfb)](_0x3b27ba(0xfd)+(_0x361819['length']-_0x15dca5)+_0x3b27ba(0x104));}return _0x1111e9['join']('\x0a');}function a0_0x151e(_0x510612,_0x1e94cf){_0x510612=_0x510612-0xf8;const _0x4d4b0c=a0_0x4d4b();let _0x151ef2=_0x4d4b0c[_0x510612];return _0x151ef2;}function a0_0x4d4b(){const _0x43a1c3=['1738404ZVKvzz','test\x20result:','\x20passed','\x0aErrors:','trim','warning:','Cargo\x20test:\x20','includes','filter','filterCargoBuild','assert','test\x20result:\x20ok','----\x20','975891WcTOqf','Cargo:\x20compiled\x20','\x20warnings\x20—\x20run\x20cargo\x20clippy\x20for\x20details)','match','length','235PFNDWt','panicked','push','replace','\x20\x20...\x20+','min','split','thread','slice','right:','\x20ignored','\x20more\x20failures','error[','\x20more\x20errors','6046440MIFkvc','4684OPxqvh','670NFSsLw','startsWith','322589hJCbbd','\x20failed,\x20','\x20errors,\x20','\x20\x20\x20\x20','6LEynyK','left:','\x20----','failures:','7HVXBYC','\x0aFailures:','defineProperty','__esModule','\x20crates\x20successfully','211541nRLIhm','join','\x20warnings','\x20passed,\x20','409064MVEoXm','Cargo:\x20','\x20crates,\x20'];a0_0x4d4b=function(){return _0x43a1c3;};return a0_0x4d4b();}function filterCargoBuild(_0x44854e){const _0x338319=a0_0x385f06,_0x3528c6=_0x44854e[_0x338319(0xff)]('\x0a'),_0x49e7b6=[],_0x35fd5e=[];let _0x4a8468=0x0;for(const _0x1a52c9 of _0x3528c6){const _0x5efec3=_0x1a52c9[_0x338319(0x123)]();if(_0x5efec3[_0x338319(0x10a)]('Compiling\x20'))_0x4a8468++;else{if(_0x5efec3[_0x338319(0x10a)]('warning[')||_0x5efec3[_0x338319(0x10a)](_0x338319(0x124)))_0x49e7b6['push'](_0x5efec3);else{if(_0x5efec3[_0x338319(0x10a)](_0x338319(0x105))||_0x5efec3['startsWith']('error:'))_0x35fd5e[_0x338319(0xfb)](_0x5efec3);}}}if(_0x35fd5e['length']===0x0&&_0x49e7b6[_0x338319(0xf8)]===0x0)return _0x4a8468>0x0?_0x338319(0x12d)+_0x4a8468+_0x338319(0x117):_0x44854e['trim']();const _0x1a3b27=[];if(_0x35fd5e[_0x338319(0xf8)]>0x0){_0x1a3b27[_0x338319(0xfb)](_0x338319(0x11d)+_0x35fd5e['length']+_0x338319(0x10d)+_0x49e7b6[_0x338319(0xf8)]+_0x338319(0x11a)),_0x1a3b27[_0x338319(0xfb)](_0x338319(0x122));for(const _0x31cf47 of _0x35fd5e[_0x338319(0x101)](0x0,0x5))_0x1a3b27[_0x338319(0xfb)]('\x20\x20'+_0x31cf47);if(_0x35fd5e[_0x338319(0xf8)]>0x5)_0x1a3b27['push'](_0x338319(0xfd)+(_0x35fd5e['length']-0x5)+_0x338319(0x106));}else _0x1a3b27[_0x338319(0xfb)](_0x338319(0x12d)+_0x4a8468+_0x338319(0x11e)+_0x49e7b6[_0x338319(0xf8)]+'\x20warnings');if(_0x49e7b6[_0x338319(0xf8)]>0x0&&_0x49e7b6[_0x338319(0xf8)]<=0x5){_0x1a3b27[_0x338319(0xfb)]('\x0aWarnings:');for(const _0x4a8814 of _0x49e7b6)_0x1a3b27[_0x338319(0xfb)]('\x20\x20'+_0x4a8814);}else _0x49e7b6[_0x338319(0xf8)]>0x5&&_0x1a3b27[_0x338319(0xfb)]('\x0a('+_0x49e7b6[_0x338319(0xf8)]+_0x338319(0x12e));return _0x1a3b27[_0x338319(0x119)]('\x0a');}
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
+ }