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/devops.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a0_0x268fa7=a0_0x43dc;(function(_0x150307,_0x52ab1e){const _0x18d317=a0_0x43dc,_0x177bad=_0x150307();while(!![]){try{const _0x143653=-parseInt(_0x18d317(0x105))/0x1*(-parseInt(_0x18d317(0xf4))/0x2)+-parseInt(_0x18d317(0x11a))/0x3+-parseInt(_0x18d317(0x111))/0x4*(-parseInt(_0x18d317(0x10e))/0x5)+-parseInt(_0x18d317(0x113))/0x6*(parseInt(_0x18d317(0xeb))/0x7)+parseInt(_0x18d317(0xec))/0x8+-parseInt(_0x18d317(0xea))/0x9*(-parseInt(_0x18d317(0x100))/0xa)+-parseInt(_0x18d317(0xf3))/0xb;if(_0x143653===_0x52ab1e)break;else _0x177bad['push'](_0x177bad['shift']());}catch(_0x1b1f9a){_0x177bad['push'](_0x177bad['shift']());}}}(a0_0x3e74,0xd91e7));Object[a0_0x268fa7(0xf2)](exports,a0_0x268fa7(0x11c),{'value':!![]}),exports[a0_0x268fa7(0x102)]=filterDockerPs,exports[a0_0x268fa7(0x11b)]=filterDockerImages,exports[a0_0x268fa7(0x115)]=filterDockerLogs,exports[a0_0x268fa7(0xee)]=filterKubectl,exports[a0_0x268fa7(0xf0)]=filterRuff;function a0_0x43dc(_0x2da4d8,_0x313aee){const _0x3e74eb=a0_0x3e74();return a0_0x43dc=function(_0x43dc80,_0x52c78a){_0x43dc80=_0x43dc80-0xe7;let _0x19d990=_0x3e74eb[_0x43dc80];return _0x19d990;},a0_0x43dc(_0x2da4d8,_0x313aee);}function filterDockerPs(_0x27c3da){const _0x26324d=a0_0x268fa7,_0xa066a5=_0x27c3da[_0x26324d(0xe7)]('\x0a')['filter'](_0x435de1=>_0x435de1[_0x26324d(0xfb)]()[_0x26324d(0x10c)]>0x0);if(_0xa066a5[_0x26324d(0x10c)]===0x0)return _0x26324d(0x10b);if(_0xa066a5[_0x26324d(0x10c)]<=0xa)return _0x27c3da[_0x26324d(0xfb)]();const _0x1db453=_0xa066a5[0x0],_0x16d889=_0xa066a5[_0x26324d(0x107)](0x1),_0xf19ce=[];_0xf19ce[_0x26324d(0xf7)](_0x26324d(0x112)+_0x16d889['length']+_0x26324d(0xf9)),_0xf19ce[_0x26324d(0xf7)]('');for(const _0x1832b0 of _0x16d889){const _0x1403fe=_0x1832b0[_0x26324d(0xe7)](/\s{2,}/);if(_0x1403fe['length']>=0x5){const _0x587848=_0x1403fe[0x0][_0x26324d(0x10a)](0x0,0xc),_0x585e97=_0x1403fe[0x1],_0x4bf87c=_0x1403fe[_0x1403fe[_0x26324d(0x10c)]-0x2]||'',_0x3cef04=_0x1403fe[_0x1403fe[_0x26324d(0x10c)]-0x1]||'';_0xf19ce[_0x26324d(0xf7)]('\x20\x20'+_0x587848+'\x20\x20'+_0x585e97+'\x20\x20'+_0x4bf87c+'\x20\x20'+_0x3cef04);}else _0xf19ce['push']('\x20\x20'+_0x1832b0[_0x26324d(0xfb)]());}return _0xf19ce['join']('\x0a');}function filterDockerImages(_0x3a9dfd){const _0x403e40=a0_0x268fa7,_0x1ee3a0=_0x3a9dfd['split']('\x0a')[_0x403e40(0xff)](_0x1e3577=>_0x1e3577['trim']()[_0x403e40(0x10c)]>0x0);if(_0x1ee3a0[_0x403e40(0x10c)]<=0x1)return _0x403e40(0xf1);if(_0x1ee3a0[_0x403e40(0x10c)]<=0xf)return _0x3a9dfd[_0x403e40(0xfb)]();const _0x38cb04=_0x1ee3a0[_0x403e40(0x107)](0x1),_0x31082e=[_0x403e40(0xfa)+_0x38cb04[_0x403e40(0x10c)]+_0x403e40(0xf9)];_0x31082e['push']('');const _0x92dda3=_0x38cb04['slice'](0x0,0x14);for(const _0x54e548 of _0x92dda3){const _0x4a2f96=_0x54e548['split'](/\s{2,}/);if(_0x4a2f96[_0x403e40(0x10c)]>=0x3){const _0x4cfff6=_0x4a2f96[0x0],_0x281053=_0x4a2f96[0x1],_0x19640d=_0x4a2f96[_0x4a2f96[_0x403e40(0x10c)]-0x1]||'';_0x31082e[_0x403e40(0xf7)]('\x20\x20'+_0x4cfff6+':'+_0x281053+'\x20\x20'+_0x19640d);}else _0x31082e[_0x403e40(0xf7)]('\x20\x20'+_0x54e548[_0x403e40(0xfb)]());}return _0x38cb04[_0x403e40(0x10c)]>0x14&&_0x31082e['push'](_0x403e40(0xef)+(_0x38cb04[_0x403e40(0x10c)]-0x14)+_0x403e40(0x118)),_0x31082e['join']('\x0a');}function filterDockerLogs(_0x12cfb3){const _0x5f2dbb=a0_0x268fa7,_0xe6d4d1=_0x12cfb3[_0x5f2dbb(0xe7)]('\x0a');if(_0xe6d4d1[_0x5f2dbb(0x10c)]<=0x32)return _0x12cfb3;const _0x57435f=[];return _0x57435f[_0x5f2dbb(0xf7)](..._0xe6d4d1[_0x5f2dbb(0x107)](0x0,0x14)),_0x57435f[_0x5f2dbb(0xf7)](_0x5f2dbb(0x101)+(_0xe6d4d1[_0x5f2dbb(0x10c)]-0x28)+_0x5f2dbb(0x103)),_0x57435f['push'](..._0xe6d4d1['slice'](-0x14)),_0x57435f[_0x5f2dbb(0xf7)]('\x0a('+_0xe6d4d1['length']+'\x20log\x20lines\x20total)'),_0x57435f['join']('\x0a');}function a0_0x3e74(){const _0x581155=['match','Found\x200\x20error','642942qotvuj','9807ulfVqd','7484008qdJbLP','Events:','filterKubectl','\x20\x20...\x20+','filterRuff','No\x20images\x20found','defineProperty','4650844uidAak','2mfITxw','Ruff:\x20','No\x20resources\x20found','push','\x20more\x20files','\x20total','Docker\x20images:\x20','trim','\x20issues\x20in\x20','join','describe','filter','100uEARYc','\x0a...\x20[','filterDockerPs','\x20lines\x20truncated]\x20...\x0a','\x20more\x20resources','1160141orYctF','\x20more\x20lines','slice','\x20more\x20events','All\x20checks\x20passed','substring','No\x20containers\x20running','length','...\x20+','95MlqarO','includes','\x20more','150004lRlPNw','Containers:\x20','4860AanyYp','\x20resources\x20found','filterDockerLogs','startsWith','Ruff:\x20no\x20issues\x20found','\x20more\x20images','Ruff:\x20all\x20checks\x20passed','3226824KusalY','filterDockerImages','__esModule','split'];a0_0x3e74=function(){return _0x581155;};return a0_0x3e74();}function filterKubectl(_0x26a843,_0x133539){const _0xd621f8=a0_0x268fa7,_0x2eac0e=_0x26a843['split']('\x0a')[_0xd621f8(0xff)](_0x29e147=>_0x29e147[_0xd621f8(0xfb)]()[_0xd621f8(0x10c)]>0x0);if(_0x2eac0e['length']===0x0)return _0xd621f8(0xf6);if(_0x2eac0e['length']<=0x14)return _0x26a843['trim']();if(_0x133539==='get'){const _0x6d5efa=_0x2eac0e[0x0],_0x3650a9=_0x2eac0e[_0xd621f8(0x107)](0x1),_0x5494ad=[_0x3650a9[_0xd621f8(0x10c)]+_0xd621f8(0x114),'',_0x6d5efa];return _0x3650a9[_0xd621f8(0x10c)]<=0x1e?_0x5494ad[_0xd621f8(0xf7)](..._0x3650a9):(_0x5494ad['push'](..._0x3650a9['slice'](0x0,0x19)),_0x5494ad[_0xd621f8(0xf7)](_0xd621f8(0x10d)+(_0x3650a9[_0xd621f8(0x10c)]-0x19)+_0xd621f8(0x104))),_0x5494ad[_0xd621f8(0xfd)]('\x0a');}if(_0x133539===_0xd621f8(0xfe)){const _0x16cf85=[];let _0x28fa5b=![],_0x278a24=0x0;for(const _0xee532 of _0x2eac0e){if(_0xee532[_0xd621f8(0x116)](_0xd621f8(0xed))){_0x28fa5b=!![],_0x16cf85[_0xd621f8(0xf7)](_0xee532);continue;}if(_0x28fa5b){_0x278a24++;if(_0x278a24<=0x5)_0x16cf85[_0xd621f8(0xf7)](_0xee532);}else _0x16cf85[_0xd621f8(0xf7)](_0xee532);}return _0x278a24>0x5&&_0x16cf85[_0xd621f8(0xf7)](_0xd621f8(0xef)+(_0x278a24-0x5)+_0xd621f8(0x108)),_0x16cf85[_0xd621f8(0xfd)]('\x0a');}if(_0x133539==='logs')return filterDockerLogs(_0x26a843);const _0x3fe0a0=_0x2eac0e[_0xd621f8(0x107)](0x0,0x1e);return _0x2eac0e[_0xd621f8(0x10c)]>0x1e&&_0x3fe0a0['push'](_0xd621f8(0x10d)+(_0x2eac0e[_0xd621f8(0x10c)]-0x1e)+_0xd621f8(0x106)),_0x3fe0a0['join']('\x0a');}function filterRuff(_0x31ab6a){const _0x222c7c=a0_0x268fa7,_0x579774=_0x31ab6a[_0x222c7c(0xe7)]('\x0a')[_0x222c7c(0xff)](_0x46d339=>_0x46d339['trim']()['length']>0x0);if(_0x579774['length']===0x0)return _0x222c7c(0x117);if(_0x31ab6a[_0x222c7c(0x10f)](_0x222c7c(0x109))||_0x31ab6a['includes'](_0x222c7c(0xe9)))return _0x222c7c(0x119);const _0x2d72be=_0x31ab6a[_0x222c7c(0xe8)](/Found (\d+) error/),_0x227a55=_0x2d72be?parseInt(_0x2d72be[0x1]):_0x579774[_0x222c7c(0x10c)],_0x1e4c84={},_0x4700f3=[];for(const _0x593a57 of _0x579774){const _0x402711=_0x593a57[_0x222c7c(0xe8)](/^([^:]+:\d+:\d+):\s*(.*)/);if(_0x402711){const _0x1fd7a6=_0x402711[0x1],_0x3597db=_0x1fd7a6[_0x222c7c(0xe7)](':')[0x0];if(!_0x1e4c84[_0x3597db])_0x1e4c84[_0x3597db]=[];_0x1e4c84[_0x3597db][_0x222c7c(0xf7)](_0x593a57);}else _0x4700f3[_0x222c7c(0xf7)](_0x593a57);}const _0x8ac0b=Object['keys'](_0x1e4c84);if(_0x8ac0b[_0x222c7c(0x10c)]===0x0){if(_0x579774[_0x222c7c(0x10c)]<=0x14)return _0x31ab6a['trim']();return _0x579774[_0x222c7c(0x107)](0x0,0xf)[_0x222c7c(0xfd)]('\x0a')+('\x0a...\x20+'+(_0x579774[_0x222c7c(0x10c)]-0xf)+_0x222c7c(0x110));}const _0x4de67c=[_0x222c7c(0xf5)+_0x227a55+'\x20issues\x20in\x20'+_0x8ac0b[_0x222c7c(0x10c)]+'\x20files'];_0x4de67c[_0x222c7c(0xf7)]('');const _0x5094ab=0xa;for(const _0xfde25d of _0x8ac0b['slice'](0x0,_0x5094ab)){const _0x14e464=_0x1e4c84[_0xfde25d];if(_0x14e464['length']<=0x3){for(const _0x4770ae of _0x14e464)_0x4de67c[_0x222c7c(0xf7)]('\x20\x20'+_0x4770ae);}else _0x4de67c[_0x222c7c(0xf7)]('\x20\x20'+_0x14e464[0x0]),_0x4de67c[_0x222c7c(0xf7)]('\x20\x20...\x20('+_0x14e464[_0x222c7c(0x10c)]+_0x222c7c(0xfc)+_0xfde25d+')');}return _0x8ac0b[_0x222c7c(0x10c)]>_0x5094ab&&_0x4de67c['push'](_0x222c7c(0xef)+(_0x8ac0b[_0x222c7c(0x10c)]-_0x5094ab)+_0x222c7c(0xf8)),_0x4de67c[_0x222c7c(0xfd)]('\x0a');}
|
package/filters/generic.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';const a0_0x529a75=a0_0x4929;(function(_0x4bab02,_0x31161b){const _0x2c1f7d=a0_0x4929,_0x54407f=_0x4bab02();while(!![]){try{const _0x27eafc=-parseInt(_0x2c1f7d(0xdc))/0x1+-parseInt(_0x2c1f7d(0xd1))/0x2+parseInt(_0x2c1f7d(0xcc))/0x3+-parseInt(_0x2c1f7d(0xc9))/0x4+-parseInt(_0x2c1f7d(0xb7))/0x5+parseInt(_0x2c1f7d(0xcb))/0x6+-parseInt(_0x2c1f7d(0xbd))/0x7*(-parseInt(_0x2c1f7d(0xb9))/0x8);if(_0x27eafc===_0x31161b)break;else _0x54407f['push'](_0x54407f['shift']());}catch(_0x3f697c){_0x54407f['push'](_0x54407f['shift']());}}}(a0_0x4d45,0x21a2c));Object['defineProperty'](exports,a0_0x529a75(0xc2),{'value':!![]}),exports['stripAnsi']=stripAnsi,exports[a0_0x529a75(0xcf)]=collapseDuplicates,exports['collapseWhitespace']=collapseWhitespace,exports[a0_0x529a75(0xb5)]=stripComments,exports[a0_0x529a75(0xcd)]=smartCrushJson,exports[a0_0x529a75(0xca)]=softTruncate;function stripAnsi(_0x3886c2){const _0x53b8f0=a0_0x529a75,_0x4d0737=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;return _0x3886c2[_0x53b8f0(0xd5)](_0x4d0737,'');}function collapseDuplicates(_0xc7867a){const _0x461084=a0_0x529a75,_0x3e72a3=_0xc7867a[_0x461084(0xc0)]('\x0a');if(_0x3e72a3[_0x461084(0xd0)]<=0x1)return _0xc7867a;const _0x44b5f2=[];let _0x3ca40b=_0x3e72a3[0x0],_0x37547d=0x1;for(let _0x4abb3a=0x1;_0x4abb3a<_0x3e72a3['length'];_0x4abb3a++){const _0x3ac645=_0x3e72a3[_0x4abb3a];_0x3ac645===_0x3ca40b&&_0x3ac645['trim']()[_0x461084(0xd0)]>0x0?_0x37547d++:(_0x37547d>0x1?_0x44b5f2[_0x461084(0xba)](_0x3ca40b+_0x461084(0xc4)+_0x37547d+']'):_0x44b5f2['push'](_0x3ca40b),_0x3ca40b=_0x3ac645,_0x37547d=0x1);}return _0x37547d>0x1?_0x44b5f2[_0x461084(0xba)](_0x3ca40b+_0x461084(0xc4)+_0x37547d+']'):_0x44b5f2[_0x461084(0xba)](_0x3ca40b),_0x44b5f2[_0x461084(0xb2)]('\x0a');}function collapseWhitespace(_0x40a3b3){const _0x4ef8f4=a0_0x529a75;let _0x2c3f28=_0x40a3b3[_0x4ef8f4(0xd5)](/[ \t]+$/gm,'');return _0x2c3f28=_0x2c3f28[_0x4ef8f4(0xd5)](/\n{4,}/g,_0x4ef8f4(0xb6)),_0x2c3f28;}function stripComments(_0xefc7d,_0x4c0d15){const _0x3ef4fe=a0_0x529a75;if(!_0x4c0d15)return _0xefc7d;const _0x56d2d0=_0xefc7d[_0x3ef4fe(0xc0)]('\x0a');if(_0x56d2d0[_0x3ef4fe(0xd0)]<=0x96)return _0xefc7d;const _0x412b27={'.ts':/^\s*\/\//,'.js':/^\s*\/\//,'.tsx':/^\s*\/\//,'.jsx':/^\s*\/\//,'.py':/^\s*#(?!!)/,'.rb':/^\s*#(?!!)/,'.sh':/^\s*#(?!!)/,'.go':/^\s*\/\//,'.rs':/^\s*\/\//,'.java':/^\s*\/\//,'.c':/^\s*\/\//,'.cpp':/^\s*\/\//,'.cs':/^\s*\/\//,'.swift':/^\s*\/\//,'.kt':/^\s*\/\//,'.yaml':/^\s*#(?!!)/,'.yml':/^\s*#(?!!)/},_0x261851=_0x412b27[_0x4c0d15[_0x3ef4fe(0xce)]()];if(!_0x261851)return _0xefc7d;const _0x5c8590=_0x56d2d0[_0x3ef4fe(0xd4)](_0x6afd86=>!_0x261851['test'](_0x6afd86));return _0x5c8590[_0x3ef4fe(0xb2)]('\x0a');}function a0_0x4929(_0x3a63a7,_0x316b12){const _0x4d4508=a0_0x4d45();return a0_0x4929=function(_0x492946,_0x3c064b){_0x492946=_0x492946-0xb2;let _0x1d4cf2=_0x4d4508[_0x492946];return _0x1d4cf2;},a0_0x4929(_0x3a63a7,_0x316b12);}function smartCrushJson(_0xb82d84){const _0xbcce12=a0_0x529a75;try{const _0xf993f2=_0xb82d84['trim']();if(!_0xf993f2[_0xbcce12(0xc7)]('['))return null;const _0x2c57c8=JSON[_0xbcce12(0xbe)](_0xf993f2);if(!Array[_0xbcce12(0xd6)](_0x2c57c8)||_0x2c57c8[_0xbcce12(0xd0)]<0x3)return null;if(typeof _0x2c57c8[0x0]!=='object'||_0x2c57c8[0x0]===null)return null;const _0xf67c17=Object[_0xbcce12(0xd8)](_0x2c57c8[0x0]);if(_0xf67c17[_0xbcce12(0xd0)]===0x0)return null;const _0x4f173f=_0xf67c17['filter'](_0x16ad86=>{const _0x336053=_0xbcce12,_0x3f869d=_0x16ad86['toLowerCase']();return!_0x3f869d[_0x336053(0xbb)](_0x336053(0xdb))&&!_0x3f869d['includes'](_0x336053(0xd7))&&!_0x3f869d[_0x336053(0xbb)](_0x336053(0xbf))&&!_0x3f869d[_0x336053(0xbb)]('hash')&&!_0x3f869d[_0x336053(0xbb)](_0x336053(0xd3))&&!_0x3f869d['includes'](_0x336053(0xc8))&&!_0x3f869d['includes'](_0x336053(0xc3))&&_0x3f869d!==_0x336053(0xb8)&&_0x3f869d!=='engines'&&_0x3f869d!==_0x336053(0xd9)&&_0x3f869d!==_0x336053(0xda);})[_0xbcce12(0xc6)](0x0,0x6);if(_0x4f173f[_0xbcce12(0xd0)]===0x0)return null;const _0x1aed47=[];_0x1aed47[_0xbcce12(0xba)](_0x4f173f['join']('|'));const _0x4c8463=0x1e;for(let _0x4b4a85=0x0;_0x4b4a85<Math[_0xbcce12(0xb3)](_0x2c57c8[_0xbcce12(0xd0)],_0x4c8463);_0x4b4a85++){const _0x47e983=_0x4f173f['map'](_0x735a4b=>{const _0x1809c9=_0xbcce12,_0x79a549=_0x2c57c8[_0x4b4a85][_0x735a4b];if(_0x79a549===null||_0x79a549===undefined)return'';if(typeof _0x79a549===_0x1809c9(0xc5))return JSON[_0x1809c9(0xb4)](_0x79a549)[_0x1809c9(0xde)](0x0,0x28);return String(_0x79a549)[_0x1809c9(0xde)](0x0,0x3c);});_0x1aed47[_0xbcce12(0xba)](_0x47e983['join']('|'));}_0x2c57c8['length']>_0x4c8463&&_0x1aed47['push'](_0xbcce12(0xd2)+(_0x2c57c8[_0xbcce12(0xd0)]-_0x4c8463)+'\x20more\x20rows');_0x1aed47[_0xbcce12(0xba)]('\x0a('+_0x2c57c8[_0xbcce12(0xd0)]+_0xbcce12(0xdd)+_0xf67c17[_0xbcce12(0xd0)]+_0xbcce12(0xbc)+_0x4f173f[_0xbcce12(0xd0)]+_0xbcce12(0xdf));const _0x3d35bd=_0x1aed47[_0xbcce12(0xb2)]('\x0a');if(_0x3d35bd['length']<_0xf993f2['length'])return _0x3d35bd;return null;}catch{return null;}}function softTruncate(_0x30046a,_0x512b91=0x4e20){const _0x521d76=a0_0x529a75;if(_0x30046a[_0x521d76(0xd0)]<=_0x512b91)return _0x30046a;const _0xd179e1=_0x30046a[_0x521d76(0xc0)]('\x0a');if(_0xd179e1[_0x521d76(0xd0)]<=0xc8)return _0x30046a;const _0x339eef=0x32,_0x1b275e=0x96,_0x1f4f18=_0xd179e1[_0x521d76(0xc6)](0x0,_0x339eef),_0x161340=_0xd179e1[_0x521d76(0xc6)](_0xd179e1[_0x521d76(0xd0)]-_0x1b275e),_0x555600=_0x30046a['length']-(_0x1f4f18[_0x521d76(0xb2)]('\x0a')['length']+_0x161340['join']('\x0a')['length']);return[..._0x1f4f18,_0x521d76(0xc1)+_0x555600+'\x20characters\x20of\x20output]\x20...\x0a',..._0x161340][_0x521d76(0xb2)]('\x0a');}function a0_0x4d45(){const _0x274e8c=['parse','sha','split','\x0a...\x20[TrimPrompt:\x20Truncated\x20','__esModule','dev','\x20[x','object','slice','startsWith','signature','195812ZHYNeu','softTruncate','88374vrUzSm','404517qUncql','smartCrushJson','toLowerCase','collapseDuplicates','length','446866layOJC','...\x20+','checksum','filter','replace','isArray','integrity','keys','bugs','repository','resolved','27058aLzBos','\x20items,\x20','substring','\x20key\x20fields)','join','min','stringify','stripComments','\x0a\x0a\x0a','511670zzQUpv','funding','1559928SzDBeo','push','includes','\x20fields,\x20showing\x20','14rtgNXg'];a0_0x4d45=function(){return _0x274e8c;};return a0_0x4d45();}
|
package/filters/git.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a0_0x2baf71=a0_0x50e5;(function(_0x35a5b1,_0x28b95d){const _0x4ebbc3=a0_0x50e5,_0x1acf57=_0x35a5b1();while(!![]){try{const _0x1ab4ba=parseInt(_0x4ebbc3(0x19e))/0x1+parseInt(_0x4ebbc3(0x19c))/0x2*(-parseInt(_0x4ebbc3(0x196))/0x3)+parseInt(_0x4ebbc3(0x178))/0x4+-parseInt(_0x4ebbc3(0x19a))/0x5*(-parseInt(_0x4ebbc3(0x171))/0x6)+parseInt(_0x4ebbc3(0x185))/0x7*(parseInt(_0x4ebbc3(0x175))/0x8)+-parseInt(_0x4ebbc3(0x18d))/0x9+parseInt(_0x4ebbc3(0x172))/0xa*(parseInt(_0x4ebbc3(0x1a1))/0xb);if(_0x1ab4ba===_0x28b95d)break;else _0x1acf57['push'](_0x1acf57['shift']());}catch(_0x4d3b4b){_0x1acf57['push'](_0x1acf57['shift']());}}}(a0_0x15f1,0xcd95e));var __createBinding=this&&this[a0_0x2baf71(0x188)]||(Object[a0_0x2baf71(0x198)]?function(_0x5e4be3,_0x2283e0,_0x574b70,_0x37be69){const _0x5e71cf=a0_0x2baf71;if(_0x37be69===undefined)_0x37be69=_0x574b70;var _0x4737f9=Object[_0x5e71cf(0x176)](_0x2283e0,_0x574b70);(!_0x4737f9||(_0x5e71cf(0x179)in _0x4737f9?!_0x2283e0[_0x5e71cf(0x195)]:_0x4737f9[_0x5e71cf(0x189)]||_0x4737f9[_0x5e71cf(0x17e)]))&&(_0x4737f9={'enumerable':!![],'get':function(){return _0x2283e0[_0x574b70];}}),Object['defineProperty'](_0x5e4be3,_0x37be69,_0x4737f9);}:function(_0x1ffbf0,_0x1103b7,_0x394adb,_0x48e00b){if(_0x48e00b===undefined)_0x48e00b=_0x394adb;_0x1ffbf0[_0x48e00b]=_0x1103b7[_0x394adb];}),__setModuleDefault=this&&this[a0_0x2baf71(0x18e)]||(Object['create']?function(_0x3c4151,_0x277711){Object['defineProperty'](_0x3c4151,'default',{'enumerable':!![],'value':_0x277711});}:function(_0xdf7bac,_0x42faae){const _0x30a92b=a0_0x2baf71;_0xdf7bac[_0x30a92b(0x18c)]=_0x42faae;}),__importStar=this&&this[a0_0x2baf71(0x183)]||(function(){var _0x269152=function(_0xcd5811){const _0x215bd4=a0_0x50e5;return _0x269152=Object[_0x215bd4(0x177)]||function(_0x501f20){const _0x8e0164=_0x215bd4;var _0x397ce3=[];for(var _0x46bf35 in _0x501f20)if(Object[_0x8e0164(0x16e)][_0x8e0164(0x173)][_0x8e0164(0x187)](_0x501f20,_0x46bf35))_0x397ce3[_0x397ce3['length']]=_0x46bf35;return _0x397ce3;},_0x269152(_0xcd5811);};return function(_0x5c3098){const _0x4f0a88=a0_0x50e5;if(_0x5c3098&&_0x5c3098[_0x4f0a88(0x195)])return _0x5c3098;var _0x3626a7={};if(_0x5c3098!=null){for(var _0x896690=_0x269152(_0x5c3098),_0x475846=0x0;_0x475846<_0x896690[_0x4f0a88(0x191)];_0x475846++)if(_0x896690[_0x475846]!==_0x4f0a88(0x18c))__createBinding(_0x3626a7,_0x5c3098,_0x896690[_0x475846]);}return __setModuleDefault(_0x3626a7,_0x5c3098),_0x3626a7;};}());function a0_0x50e5(_0x3f7f4b,_0x1dbb2c){const _0x15f12b=a0_0x15f1();return a0_0x50e5=function(_0x50e563,_0x589cc5){_0x50e563=_0x50e563-0x16e;let _0x5bf689=_0x15f12b[_0x50e563];return _0x5bf689;},a0_0x50e5(_0x3f7f4b,_0x1dbb2c);}Object[a0_0x2baf71(0x170)](exports,'__esModule',{'value':!![]}),exports[a0_0x2baf71(0x18a)]=filterGitStatus,exports[a0_0x2baf71(0x1a4)]=filterGitLog,exports[a0_0x2baf71(0x1a3)]=filterGitDiff;function a0_0x15f1(){const _0x2d5572=['configurable','*\x20Branch:\x20','map','\x20\x20??\x20','basename','__importStar','---END---','7609bwVOjc','+++','call','__createBinding','writable','filterGitStatus','substring','default','9830763AqVUeS','__setModuleDefault','split','\x0aChanges:','length','match','slice','\x20(+','__esModule','3oBbgRJ','path','create','join','165RLMPhs','Clean\x20working\x20tree','2737346VgsEZM','No\x20modifications','1365252lDuScO','startsWith','\x20\x20...\x20+','77wnVZAV','trim','filterGitDiff','filterGitLog','dirname','diff\x20--git','entries','/\x20(','filter','prototype','push','defineProperty','44220XHXZBC','788420FEioOO','hasOwnProperty','replace','8000DUNVZj','getOwnPropertyDescriptor','getOwnPropertyNames','222808qqbqMb','get','\x20more\x20modifications','\x20\x20...\x20(+','\x20lines\x20of\x20description)','\x20untracked\x20files)'];a0_0x15f1=function(){return _0x2d5572;};return a0_0x15f1();}const path=__importStar(require(a0_0x2baf71(0x197)));function filterGitStatus(_0x2186df){const _0x1efb1f=a0_0x2baf71,_0x74d6ed=_0x2186df[_0x1efb1f(0x18f)]('\x0a')[_0x1efb1f(0x180)](_0x2ba678=>_0x2ba678[_0x1efb1f(0x1a2)]())[_0x1efb1f(0x1a9)](_0x53c192=>_0x53c192[_0x1efb1f(0x191)]>0x0);if(_0x74d6ed[_0x1efb1f(0x191)]===0x0)return _0x1efb1f(0x19b);const _0x438969=[],_0x5d2a7b=[],_0x56de78=[];for(const _0xbfcbbd of _0x74d6ed){if(_0xbfcbbd[_0x1efb1f(0x19f)]('##')){const _0x5aed20=_0xbfcbbd[_0x1efb1f(0x174)](/^##\s*/,'');_0x438969[_0x1efb1f(0x16f)](_0x1efb1f(0x17f)+_0x5aed20);}else _0xbfcbbd[_0x1efb1f(0x19f)]('??')?_0x5d2a7b[_0x1efb1f(0x16f)](_0xbfcbbd[_0x1efb1f(0x18b)](0x3)[_0x1efb1f(0x1a2)]()):_0x56de78[_0x1efb1f(0x16f)](_0xbfcbbd);}_0x56de78[_0x1efb1f(0x191)]>0x0&&(_0x438969['push'](_0x1efb1f(0x190)),_0x438969['push'](..._0x56de78['map'](_0x380843=>'\x20\x20'+_0x380843)));if(_0x5d2a7b[_0x1efb1f(0x191)]>0x0){_0x438969['push']('\x0aUntracked\x20files:');const _0x53cfda={},_0x3daa9d=[];for(const _0x5c2dc5 of _0x5d2a7b){const _0x47df02=path[_0x1efb1f(0x1a5)](_0x5c2dc5);_0x47df02==='.'||_0x47df02===''?_0x3daa9d[_0x1efb1f(0x16f)](_0x5c2dc5):(!_0x53cfda[_0x47df02]&&(_0x53cfda[_0x47df02]=[]),_0x53cfda[_0x47df02][_0x1efb1f(0x16f)](path[_0x1efb1f(0x182)](_0x5c2dc5)));}for(const [_0x2158d3,_0x368d4d]of Object[_0x1efb1f(0x1a7)](_0x53cfda)){if(_0x368d4d[_0x1efb1f(0x191)]>0x5)_0x438969[_0x1efb1f(0x16f)]('\x20\x20??\x20'+_0x2158d3+_0x1efb1f(0x1a8)+_0x368d4d['length']+_0x1efb1f(0x17d));else for(const _0x4d452d of _0x368d4d){_0x438969[_0x1efb1f(0x16f)](_0x1efb1f(0x181)+path[_0x1efb1f(0x199)](_0x2158d3,_0x4d452d));}}for(const _0x1bc3fd of _0x3daa9d){_0x438969[_0x1efb1f(0x16f)](_0x1efb1f(0x181)+_0x1bc3fd);}}return _0x438969[_0x1efb1f(0x199)]('\x0a');}function filterGitLog(_0x41d7ba){const _0x512b70=a0_0x2baf71,_0x44bba5=_0x41d7ba[_0x512b70(0x18f)](_0x512b70(0x184))['map'](_0x4f1a7f=>_0x4f1a7f['trim']())['filter'](_0x233240=>_0x233240[_0x512b70(0x191)]>0x0);if(_0x44bba5['length']===0x0)return _0x41d7ba;const _0x2c3a23=[];for(const _0x50d55c of _0x44bba5){const _0x1a9ad0=_0x50d55c['split']('\x0a'),_0x451cd5=_0x1a9ad0[0x0]||'',_0x16bce0=_0x1a9ad0['slice'](0x1)[_0x512b70(0x180)](_0x37e70e=>_0x37e70e[_0x512b70(0x1a2)]())['filter'](_0x1b0b96=>_0x1b0b96[_0x512b70(0x191)]>0x0);_0x2c3a23[_0x512b70(0x16f)]('-\x20'+_0x451cd5),_0x16bce0['length']>0x0&&(_0x2c3a23['push']('\x20\x20'+_0x16bce0[0x0]),_0x16bce0['length']>0x1&&_0x2c3a23[_0x512b70(0x16f)](_0x512b70(0x17b)+(_0x16bce0[_0x512b70(0x191)]-0x1)+_0x512b70(0x17c)));}return _0x2c3a23['join']('\x0a');}function filterGitDiff(_0x309db6){const _0x77906a=a0_0x2baf71,_0x47e737=_0x309db6[_0x77906a(0x18f)]('\x0a'),_0x7be569=[];let _0x568726='',_0x4e09c9=0x0,_0x86f9c5=0x0,_0x2b2a75=[];const _0x11563a=()=>{const _0x4f05d8=_0x77906a;if(_0x568726&&(_0x4e09c9>0x0||_0x86f9c5>0x0)){_0x7be569[_0x4f05d8(0x16f)]('[file]\x20'+_0x568726+_0x4f05d8(0x194)+_0x4e09c9+'\x20-'+_0x86f9c5+')');const _0x7e5183=0xa,_0x28a28e=_0x2b2a75[_0x4f05d8(0x193)](0x0,_0x7e5183);for(const _0x3b3c35 of _0x28a28e){_0x7be569[_0x4f05d8(0x16f)]('\x20\x20'+_0x3b3c35);}const _0x119136=_0x4e09c9+_0x86f9c5-_0x7e5183;_0x119136>0x0&&_0x7be569[_0x4f05d8(0x16f)](_0x4f05d8(0x1a0)+_0x119136+_0x4f05d8(0x17a));}_0x4e09c9=0x0,_0x86f9c5=0x0,_0x2b2a75=[];};for(const _0x585292 of _0x47e737){if(_0x585292[_0x77906a(0x19f)](_0x77906a(0x1a6))){_0x11563a();const _0x552376=_0x585292[_0x77906a(0x192)](/\sb\/(.+)$/);_0x568726=_0x552376?_0x552376[0x1]:'unknown_file';}else{if(_0x585292[_0x77906a(0x19f)]('+')&&!_0x585292[_0x77906a(0x19f)](_0x77906a(0x186)))_0x4e09c9++,_0x2b2a75[_0x77906a(0x16f)](_0x585292);else _0x585292[_0x77906a(0x19f)]('-')&&!_0x585292['startsWith']('---')&&(_0x86f9c5++,_0x2b2a75['push'](_0x585292));}}_0x11563a();const _0x41f2a5=_0x7be569[_0x77906a(0x199)]('\x0a');return _0x41f2a5['length']>0x0?_0x41f2a5:_0x77906a(0x19d);}
|
package/filters/go.js
CHANGED
|
@@ -1 +1,99 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterGoTest = filterGoTest;
|
|
4
|
+
exports.filterGoVet = filterGoVet;
|
|
5
|
+
function filterGoTest(stdout) {
|
|
6
|
+
const lines = stdout.split('\n');
|
|
7
|
+
let totalPassed = 0;
|
|
8
|
+
let totalFailed = 0;
|
|
9
|
+
let totalSkipped = 0;
|
|
10
|
+
const failedTests = [];
|
|
11
|
+
const packageResults = [];
|
|
12
|
+
let currentFail = null;
|
|
13
|
+
for (const line of lines) {
|
|
14
|
+
const trimmed = line.trim();
|
|
15
|
+
const okMatch = trimmed.match(/^ok\s+\S+\s+[\d.]+s/);
|
|
16
|
+
if (okMatch) {
|
|
17
|
+
packageResults.push(trimmed);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const failMatch = trimmed.match(/^FAIL\s+\S+/);
|
|
21
|
+
if (failMatch) {
|
|
22
|
+
packageResults.push(trimmed);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const passMatch = trimmed.match(/^--- PASS:/);
|
|
26
|
+
if (passMatch) {
|
|
27
|
+
totalPassed++;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const failTestMatch = trimmed.match(/^--- FAIL:\s+(\S+)/);
|
|
31
|
+
if (failTestMatch) {
|
|
32
|
+
if (currentFail)
|
|
33
|
+
failedTests.push(currentFail);
|
|
34
|
+
currentFail = { name: failTestMatch[1], lines: [] };
|
|
35
|
+
totalFailed++;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (trimmed.startsWith('--- SKIP:')) {
|
|
39
|
+
totalSkipped++;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (currentFail && trimmed.length > 0 && !trimmed.startsWith('=== RUN')) {
|
|
43
|
+
currentFail.lines.push(line);
|
|
44
|
+
}
|
|
45
|
+
if (trimmed.startsWith('=== RUN')) {
|
|
46
|
+
if (currentFail) {
|
|
47
|
+
failedTests.push(currentFail);
|
|
48
|
+
currentFail = null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (currentFail)
|
|
53
|
+
failedTests.push(currentFail);
|
|
54
|
+
if (totalPassed === 0 && totalFailed === 0 && totalSkipped === 0) {
|
|
55
|
+
if (stdout.includes('PASS') && !stdout.includes('FAIL'))
|
|
56
|
+
return "Go test: all tests passed";
|
|
57
|
+
if (stdout.includes('no test files'))
|
|
58
|
+
return "Go test: no test files";
|
|
59
|
+
return stdout;
|
|
60
|
+
}
|
|
61
|
+
if (totalFailed === 0) {
|
|
62
|
+
const parts = [`Go test: ${totalPassed} passed`];
|
|
63
|
+
if (totalSkipped > 0)
|
|
64
|
+
parts.push(`${totalSkipped} skipped`);
|
|
65
|
+
return parts.join(', ');
|
|
66
|
+
}
|
|
67
|
+
const result = [`Go test: ${totalPassed} passed, ${totalFailed} failed, ${totalSkipped} skipped`];
|
|
68
|
+
if (failedTests.length > 0) {
|
|
69
|
+
result.push("\nFailures:");
|
|
70
|
+
const limit = 3;
|
|
71
|
+
for (let i = 0; i < Math.min(failedTests.length, limit); i++) {
|
|
72
|
+
const ft = failedTests[i];
|
|
73
|
+
result.push(` ${i + 1}. ${ft.name}`);
|
|
74
|
+
for (const l of ft.lines.slice(0, 5)) {
|
|
75
|
+
result.push(` ${l.trim()}`);
|
|
76
|
+
}
|
|
77
|
+
if (ft.lines.length > 5) {
|
|
78
|
+
result.push(` ... +${ft.lines.length - 5} more lines`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (failedTests.length > limit) {
|
|
82
|
+
result.push(` ... +${failedTests.length - limit} more failures`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return result.join('\n');
|
|
86
|
+
}
|
|
87
|
+
function filterGoVet(stdout) {
|
|
88
|
+
const lines = stdout.split('\n').filter(l => l.trim().length > 0);
|
|
89
|
+
if (lines.length === 0)
|
|
90
|
+
return "Go vet: no issues found";
|
|
91
|
+
if (lines.length <= 20)
|
|
92
|
+
return stdout.trim();
|
|
93
|
+
const result = [`Go vet: ${lines.length} issues found`];
|
|
94
|
+
result.push(...lines.slice(0, 10));
|
|
95
|
+
if (lines.length > 10) {
|
|
96
|
+
result.push(`... +${lines.length - 10} more issues`);
|
|
97
|
+
}
|
|
98
|
+
return result.join('\n');
|
|
99
|
+
}
|
package/filters/index.js
CHANGED
|
@@ -1 +1,185 @@
|
|
|
1
|
-
'use strict';const a0_0x4fad25=a0_0x3abf;function a0_0x3abf(_0x57d98e,_0x512468){_0x57d98e=_0x57d98e-0x191;const _0x3072ff=a0_0x3072();let _0x3abf07=_0x3072ff[_0x57d98e];return _0x3abf07;}(function(_0x565287,_0x1ab17a){const _0xe92a40=a0_0x3abf,_0x2b4af8=_0x565287();while(!![]){try{const _0x407330=parseInt(_0xe92a40(0x1db))/0x1+parseInt(_0xe92a40(0x1ff))/0x2+parseInt(_0xe92a40(0x202))/0x3+-parseInt(_0xe92a40(0x1ee))/0x4*(-parseInt(_0xe92a40(0x1d7))/0x5)+-parseInt(_0xe92a40(0x193))/0x6+-parseInt(_0xe92a40(0x194))/0x7*(parseInt(_0xe92a40(0x1c3))/0x8)+parseInt(_0xe92a40(0x1b7))/0x9;if(_0x407330===_0x1ab17a)break;else _0x2b4af8['push'](_0x2b4af8['shift']());}catch(_0x7a27bc){_0x2b4af8['push'](_0x2b4af8['shift']());}}}(a0_0x3072,0x3bb62));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['lastFeatures']=exports['lastRedactAudit']=void 0x0,exports['compressOutput']=compressOutput,exports[a0_0x4fad25(0x1ab)]=rewriteCommand;const generic_1=require(a0_0x4fad25(0x1e4)),git_1=require(a0_0x4fad25(0x1f0)),python_1=require(a0_0x4fad25(0x1f6)),js_1=require(a0_0x4fad25(0x1d3)),shell_1=require(a0_0x4fad25(0x1f7)),rust_1=require(a0_0x4fad25(0x1d8)),go_1=require(a0_0x4fad25(0x196)),devops_1=require(a0_0x4fad25(0x1d6)),redactor_1=require('../redactor'),tracker_1=require(a0_0x4fad25(0x1de));function a0_0x3072(){const _0x48cbaa=['trim\x20go','collapseWhitespace','get','trim\x20pytest','yarn\x20test','\x20ls','lastRedactAudit','cargo\x20check','trim\x20pip','filterCargoTest','pnpm\x20test','vitest','rewriteCommand','getConfig','lastFeatures','toLowerCase','secretsFound','trim\x20tree','cargo\x20build','ruff\x20','[lock\x20file]','yarn\x20install','filterKubectl','trim\x20','752274qlFRUC','pip\x20install','yadm\x20log','[minified\x20file]','text','test','filterDockerImages','go\x20test','includes','npm\x20i\x20','filterGitDiff','trim\x20ruff','8TRVAJP','filterGitStatus','match','go\x20vet','filterCat','trim\x20pnpm','skeleton','git\x20show','trim\x20cargo','git\x20diff','filterGitLog','trim\x20npm','filterGrep','collapseDuplicates','secretTypes','filter','./js','filterGoVet','filterLs','./devops','925EDgPnC','./rust','redact','trim','217359PqPOzN','pytest','[code\x20skeleton]','../tracker','softTruncate','\x20tree','jest','pip3\x20install','[binary','./generic','some','push','\x20tree\x20','startsWith','\x20ls\x20','yadm\x20status','filterDockerLogs','ruff\x20check','npm\x20test','428SbYMzW','tracker','./git','stripAnsi','npm\x20install','trim\x20ls','length','features_enabled','./python','./shell','endsWith','pattern','filterTree','npm\x20i','ansi_strip','kubectl','trim\x20grep','570060vglIZh','yadm\x20diff','filterGoTest','707364YCrXNr','cargo\x20clippy','filterRuff','2162358sLRMNz','1656109NLEJIH','lines\x20truncated','./go','trim\x20find','filterPipInstall','whitespace','redactor','filterFind','filterJestVitest','trim\x20gh','---'];a0_0x3072=function(){return _0x48cbaa;};return a0_0x3072();}exports[a0_0x4fad25(0x1a5)]={'secretsFound':0x0,'secretTypes':[]},exports['lastFeatures']=[];function isFeatureEnabled(_0x25dbb7){const _0x4e4ce7=a0_0x4fad25;try{const _0x4eca99=tracker_1[_0x4e4ce7(0x1ef)][_0x4e4ce7(0x1ac)](),_0x309d9a=_0x4eca99[_0x4e4ce7(0x1f5)];if(!_0x309d9a||_0x309d9a[_0x25dbb7]===undefined)return!![];return _0x309d9a[_0x25dbb7]!==![];}catch{return!![];}}function compressOutput(_0x3b8568,_0x1debc5,_0x3831ab,_0x5c1dfd=!![]){const _0x32c5fb=a0_0x4fad25,_0x26c138=_0x3b8568[_0x32c5fb(0x1da)]();let _0x42f214=_0x1debc5;_0x3831ab[_0x32c5fb(0x1da)]()[_0x32c5fb(0x1f4)]>0x0&&(_0x42f214=_0x1debc5+'\x0a'+_0x3831ab);let _0x34a232=isFeatureEnabled(_0x32c5fb(0x1fc))?(0x0,generic_1[_0x32c5fb(0x1f1)])(_0x42f214):_0x42f214;const _0x265769=[];if(_0x34a232['length']<_0x42f214[_0x32c5fb(0x1f4)])_0x265769[_0x32c5fb(0x1e6)](_0x32c5fb(0x1fc));const _0x35177d=(_0x4930a1,_0x5390b8)=>{const _0x2ee14b=_0x32c5fb;return _0x265769[_0x2ee14b(0x1e6)](_0x4930a1),exports[_0x2ee14b(0x1ad)]=_0x265769,_0x5390b8;};if(_0x5c1dfd&&isFeatureEnabled(_0x32c5fb(0x1d9))){const _0x3be908=redactor_1[_0x32c5fb(0x19a)]['redactWithAudit'](_0x34a232);_0x34a232=_0x3be908[_0x32c5fb(0x1bb)],exports[_0x32c5fb(0x1a5)]={'secretsFound':_0x3be908['secretsFound'],'secretTypes':_0x3be908[_0x32c5fb(0x1d1)]};if(_0x3be908[_0x32c5fb(0x1af)]>0x0)_0x265769[_0x32c5fb(0x1e6)](_0x32c5fb(0x1d9));}else exports[_0x32c5fb(0x1a5)]={'secretsFound':0x0,'secretTypes':[]};const _0x9715aa=_0x26c138[_0x32c5fb(0x1ae)](),_0x10696c=isFeatureEnabled(_0x32c5fb(0x1d2));try{if(_0x10696c){if(_0x9715aa[_0x32c5fb(0x1bf)]('git\x20status')||_0x9715aa['includes'](_0x32c5fb(0x1ea)))return _0x35177d(_0x32c5fb(0x1d2),(0x0,git_1[_0x32c5fb(0x1c4)])(_0x34a232));if(_0x9715aa['includes']('git\x20log')||_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1b9)))return _0x35177d('filter',(0x0,git_1[_0x32c5fb(0x1cd)])(_0x34a232));if(_0x9715aa['includes'](_0x32c5fb(0x1cc))||_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1ca))||_0x9715aa['includes'](_0x32c5fb(0x200)))return _0x35177d('filter',(0x0,git_1[_0x32c5fb(0x1c1)])(_0x34a232));if(_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1dc))||_0x9715aa[_0x32c5fb(0x1c5)](/python3?\s+-m\s+pytest/))return _0x35177d(_0x32c5fb(0x1d2),(0x0,python_1['filterPytest'])(_0x34a232));if(_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1b8))||_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1e2)))return _0x35177d('filter',(0x0,python_1[_0x32c5fb(0x198)])(_0x34a232));if(_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1ec))||_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1b2)))return _0x35177d(_0x32c5fb(0x1d2),(0x0,devops_1[_0x32c5fb(0x192)])(_0x34a232));if(_0x9715aa['includes'](_0x32c5fb(0x1f2))||_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1c0))||_0x9715aa[_0x32c5fb(0x1f8)](_0x32c5fb(0x1fb))||_0x9715aa['includes']('pnpm\x20install')||_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1b4)))return _0x35177d(_0x32c5fb(0x1d2),(0x0,js_1['filterNpmInstall'])(_0x34a232));if(_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1e1))||_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1aa)))return _0x35177d(_0x32c5fb(0x1d2),(0x0,js_1[_0x32c5fb(0x19c)])(_0x34a232));if(_0x9715aa['includes'](_0x32c5fb(0x1ed))||_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1a9))||_0x9715aa['includes'](_0x32c5fb(0x1a3))||_0x9715aa[_0x32c5fb(0x1bf)]('npm\x20run\x20test'))return _0x35177d('filter',(0x0,js_1[_0x32c5fb(0x19c)])(_0x34a232));if(_0x9715aa[_0x32c5fb(0x1bf)]('cargo\x20test'))return _0x35177d(_0x32c5fb(0x1d2),(0x0,rust_1[_0x32c5fb(0x1a8)])(_0x34a232));if(_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1b1))||_0x9715aa['includes'](_0x32c5fb(0x1a6))||_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x191)))return _0x35177d('filter',(0x0,rust_1['filterCargoBuild'])(_0x34a232));if(_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1be)))return _0x35177d(_0x32c5fb(0x1d2),(0x0,go_1[_0x32c5fb(0x201)])(_0x34a232));if(_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1c6)))return _0x35177d(_0x32c5fb(0x1d2),(0x0,go_1[_0x32c5fb(0x1d4)])(_0x34a232));if(_0x9715aa[_0x32c5fb(0x1c5)](/docker\s+ps/))return _0x35177d(_0x32c5fb(0x1d2),(0x0,devops_1['filterDockerPs'])(_0x34a232));if(_0x9715aa['match'](/docker\s+images/))return _0x35177d(_0x32c5fb(0x1d2),(0x0,devops_1[_0x32c5fb(0x1bd)])(_0x34a232));if(_0x9715aa['match'](/docker\s+logs/))return _0x35177d(_0x32c5fb(0x1d2),(0x0,devops_1[_0x32c5fb(0x1eb)])(_0x34a232));if(_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1fd))){const _0x5e022e=_0x9715aa['match'](/kubectl\s+(get|logs|describe|apply)/),_0x2c222a=_0x5e022e?_0x5e022e[0x1]:_0x32c5fb(0x1a1);return _0x35177d(_0x32c5fb(0x1d2),(0x0,devops_1[_0x32c5fb(0x1b5)])(_0x34a232,_0x2c222a));}if(_0x9715aa[_0x32c5fb(0x1c5)](/^(ls|dir)(\s|$)/)||_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1e9))||_0x9715aa[_0x32c5fb(0x1f8)](_0x32c5fb(0x1a4)))return _0x35177d(_0x32c5fb(0x1d2),(0x0,shell_1[_0x32c5fb(0x1d5)])(_0x34a232));if(_0x9715aa['match'](/^tree(\s|$)/)||_0x9715aa[_0x32c5fb(0x1bf)](_0x32c5fb(0x1e7))||_0x9715aa[_0x32c5fb(0x1f8)](_0x32c5fb(0x1e0)))return _0x35177d('filter',(0x0,shell_1[_0x32c5fb(0x1fa)])(_0x34a232));if(_0x9715aa[_0x32c5fb(0x1c5)](/^(cat|head|tail|read|bat)(\s|$)/)){const _0x49cecf=(0x0,shell_1[_0x32c5fb(0x1c7)])(_0x34a232,_0x26c138);if(_0x49cecf[_0x32c5fb(0x1bf)](_0x32c5fb(0x1b3)))_0x265769[_0x32c5fb(0x1e6)]('lock');else{if(_0x49cecf[_0x32c5fb(0x1bf)](_0x32c5fb(0x1e3))||_0x49cecf[_0x32c5fb(0x1bf)](_0x32c5fb(0x1ba)))_0x265769[_0x32c5fb(0x1e6)]('binary');else{if(_0x49cecf['includes'](_0x32c5fb(0x1dd)))_0x265769[_0x32c5fb(0x1e6)](_0x32c5fb(0x1c9));else{if(_0x49cecf[_0x32c5fb(0x1bf)]('|\x20')&&_0x49cecf['includes'](_0x32c5fb(0x19e))&&_0x49cecf[_0x32c5fb(0x1f4)]<_0x34a232['length']*0.5)_0x265769[_0x32c5fb(0x1e6)]('json_crusher');else{if(_0x49cecf[_0x32c5fb(0x1bf)](_0x32c5fb(0x195)))_0x265769[_0x32c5fb(0x1e6)](_0x32c5fb(0x1d2));}}}}if(_0x49cecf[_0x32c5fb(0x1f4)]<_0x34a232[_0x32c5fb(0x1f4)]&&!_0x265769[_0x32c5fb(0x1e5)](_0x79a57=>_0x79a57!==_0x32c5fb(0x1fc)&&_0x79a57!==_0x32c5fb(0x1d9)))_0x265769['push'](_0x32c5fb(0x1d2));return exports[_0x32c5fb(0x1ad)]=_0x265769,_0x49cecf;}if(_0x9715aa[_0x32c5fb(0x1c5)](/^find(\s|$)/))return _0x35177d(_0x32c5fb(0x1d2),(0x0,shell_1[_0x32c5fb(0x19b)])(_0x34a232));if(_0x9715aa['match'](/^(grep|rg|ripgrep)(\s|$)/))return _0x35177d(_0x32c5fb(0x1d2),(0x0,shell_1[_0x32c5fb(0x1cf)])(_0x34a232));}}catch(_0x438572){}return isFeatureEnabled(_0x32c5fb(0x199))&&(_0x34a232=(0x0,generic_1[_0x32c5fb(0x1a0)])(_0x34a232),_0x265769[_0x32c5fb(0x1e6)](_0x32c5fb(0x199))),_0x34a232=(0x0,generic_1[_0x32c5fb(0x1d0)])(_0x34a232),_0x34a232=(0x0,generic_1[_0x32c5fb(0x1df)])(_0x34a232,0x4e20),exports[_0x32c5fb(0x1ad)]=_0x265769,_0x34a232;}const REWRITE_RULES=[{'pattern':/^(?:git|yadm)\s+(?:-[Cc]\s+\S+\s+)*(status|log|diff|show|add|commit|push|pull|branch|fetch|stash|worktree)/,'prefix':'trim\x20git'},{'pattern':/^gh\s+(pr|issue|run|repo|api|release)/,'prefix':a0_0x4fad25(0x19d)},{'pattern':/^glab\s+(mr|issue|ci|pipeline|api|release)/,'prefix':'trim\x20glab'},{'pattern':/^cargo\s+(build|test|clippy|check|fmt|install)/,'prefix':a0_0x4fad25(0x1cb)},{'pattern':/^pnpm\s+(exec|i|install|list|ls|outdated|run|run-script)/,'prefix':a0_0x4fad25(0x1c8)},{'pattern':/^npm\s+(exec|run|run-script|rum|urn|x|test)(\s|$)/,'prefix':a0_0x4fad25(0x1ce)},{'pattern':/^npx\s+/,'prefix':'trim\x20npx'},{'pattern':/^(cat|head|tail)\s+/,'prefix':'trim\x20read'},{'pattern':/^(rg|grep)\s+/,'prefix':a0_0x4fad25(0x1fe)},{'pattern':/^ls(\s|$)/,'prefix':a0_0x4fad25(0x1f3)},{'pattern':/^tree(\s|$)/,'prefix':a0_0x4fad25(0x1b0)},{'pattern':/^find\s+/,'prefix':a0_0x4fad25(0x197)},{'pattern':/^docker\s+(ps|images|logs|run|exec|build|compose)/,'prefix':'trim\x20docker'},{'pattern':/^kubectl\s+(get|logs|describe|apply)/,'prefix':'trim\x20kubectl'},{'pattern':/^(python3?\s+-m\s+)?pytest(\s|$)/,'prefix':a0_0x4fad25(0x1a2)},{'pattern':/^ruff\s+(check|format)/,'prefix':a0_0x4fad25(0x1c2)},{'pattern':/^(pip3?|uv\s+pip)\s+(list|outdated|install|show)/,'prefix':a0_0x4fad25(0x1a7)},{'pattern':/^go\s+(test|build|vet)/,'prefix':a0_0x4fad25(0x19f)}];function rewriteCommand(_0x3ff7b5){const _0xbbd57a=a0_0x4fad25,_0x47bfa2=_0x3ff7b5['trim']();if(_0x47bfa2[_0xbbd57a(0x1e8)](_0xbbd57a(0x1b6)))return _0x47bfa2;for(const _0x24f27d of REWRITE_RULES){if(_0x24f27d[_0xbbd57a(0x1f9)][_0xbbd57a(0x1bc)](_0x47bfa2))return _0xbbd57a(0x1b6)+_0x47bfa2;}return _0x47bfa2;}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lastFeatures = exports.lastRedactAudit = void 0;
|
|
4
|
+
exports.compressOutput = compressOutput;
|
|
5
|
+
exports.rewriteCommand = rewriteCommand;
|
|
6
|
+
const generic_1 = require("./generic");
|
|
7
|
+
const git_1 = require("./git");
|
|
8
|
+
const python_1 = require("./python");
|
|
9
|
+
const js_1 = require("./js");
|
|
10
|
+
const shell_1 = require("./shell");
|
|
11
|
+
const rust_1 = require("./rust");
|
|
12
|
+
const go_1 = require("./go");
|
|
13
|
+
const devops_1 = require("./devops");
|
|
14
|
+
const redactor_1 = require("../redactor");
|
|
15
|
+
const tracker_1 = require("../tracker");
|
|
16
|
+
exports.lastRedactAudit = { secretsFound: 0, secretTypes: [] };
|
|
17
|
+
exports.lastFeatures = [];
|
|
18
|
+
function isFeatureEnabled(key) {
|
|
19
|
+
try {
|
|
20
|
+
const config = tracker_1.tracker.getConfig();
|
|
21
|
+
const fe = config.features_enabled;
|
|
22
|
+
if (!fe || fe[key] === undefined)
|
|
23
|
+
return true;
|
|
24
|
+
return fe[key] !== false;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function compressOutput(commandLine, stdout, stderr, redactionEnabled = true) {
|
|
31
|
+
const cmd = commandLine.trim();
|
|
32
|
+
let combinedOutput = stdout;
|
|
33
|
+
if (stderr.trim().length > 0) {
|
|
34
|
+
combinedOutput = `${stdout}\n${stderr}`;
|
|
35
|
+
}
|
|
36
|
+
let processed = isFeatureEnabled('ansi_strip') ? (0, generic_1.stripAnsi)(combinedOutput) : combinedOutput;
|
|
37
|
+
const features = [];
|
|
38
|
+
if (processed.length < combinedOutput.length)
|
|
39
|
+
features.push('ansi_strip');
|
|
40
|
+
const tagged = (tag, result) => { features.push(tag); exports.lastFeatures = features; return result; };
|
|
41
|
+
if (redactionEnabled && isFeatureEnabled('redact')) {
|
|
42
|
+
const result = redactor_1.redactor.redactWithAudit(processed);
|
|
43
|
+
processed = result.text;
|
|
44
|
+
exports.lastRedactAudit = { secretsFound: result.secretsFound, secretTypes: result.secretTypes };
|
|
45
|
+
if (result.secretsFound > 0)
|
|
46
|
+
features.push('redact');
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
exports.lastRedactAudit = { secretsFound: 0, secretTypes: [] };
|
|
50
|
+
}
|
|
51
|
+
const cmdLower = cmd.toLowerCase();
|
|
52
|
+
const filtersOn = isFeatureEnabled('filter');
|
|
53
|
+
try {
|
|
54
|
+
if (filtersOn) {
|
|
55
|
+
if (cmdLower.includes('git status') || cmdLower.includes('yadm status')) {
|
|
56
|
+
return tagged('filter', (0, git_1.filterGitStatus)(processed));
|
|
57
|
+
}
|
|
58
|
+
if (cmdLower.includes('git log') || cmdLower.includes('yadm log')) {
|
|
59
|
+
return tagged('filter', (0, git_1.filterGitLog)(processed));
|
|
60
|
+
}
|
|
61
|
+
if (cmdLower.includes('git diff') || cmdLower.includes('git show') || cmdLower.includes('yadm diff')) {
|
|
62
|
+
return tagged('filter', (0, git_1.filterGitDiff)(processed));
|
|
63
|
+
}
|
|
64
|
+
if (cmdLower.includes('pytest') || cmdLower.match(/python3?\s+-m\s+pytest/)) {
|
|
65
|
+
return tagged('filter', (0, python_1.filterPytest)(processed));
|
|
66
|
+
}
|
|
67
|
+
if (cmdLower.includes('pip install') || cmdLower.includes('pip3 install')) {
|
|
68
|
+
return tagged('filter', (0, python_1.filterPipInstall)(processed));
|
|
69
|
+
}
|
|
70
|
+
if (cmdLower.includes('ruff check') || cmdLower.includes('ruff ')) {
|
|
71
|
+
return tagged('filter', (0, devops_1.filterRuff)(processed));
|
|
72
|
+
}
|
|
73
|
+
if (cmdLower.includes('npm install') ||
|
|
74
|
+
cmdLower.includes('npm i ') ||
|
|
75
|
+
cmdLower.endsWith('npm i') ||
|
|
76
|
+
cmdLower.includes('pnpm install') ||
|
|
77
|
+
cmdLower.includes('yarn install')) {
|
|
78
|
+
return tagged('filter', (0, js_1.filterNpmInstall)(processed));
|
|
79
|
+
}
|
|
80
|
+
if (cmdLower.includes('jest') || cmdLower.includes('vitest')) {
|
|
81
|
+
return tagged('filter', (0, js_1.filterJestVitest)(processed));
|
|
82
|
+
}
|
|
83
|
+
if (cmdLower.includes('npm test') || cmdLower.includes('pnpm test') || cmdLower.includes('yarn test') || cmdLower.includes('npm run test')) {
|
|
84
|
+
return tagged('filter', (0, js_1.filterJestVitest)(processed));
|
|
85
|
+
}
|
|
86
|
+
if (cmdLower.includes('cargo test')) {
|
|
87
|
+
return tagged('filter', (0, rust_1.filterCargoTest)(processed));
|
|
88
|
+
}
|
|
89
|
+
if (cmdLower.includes('cargo build') || cmdLower.includes('cargo check') || cmdLower.includes('cargo clippy')) {
|
|
90
|
+
return tagged('filter', (0, rust_1.filterCargoBuild)(processed));
|
|
91
|
+
}
|
|
92
|
+
if (cmdLower.includes('go test')) {
|
|
93
|
+
return tagged('filter', (0, go_1.filterGoTest)(processed));
|
|
94
|
+
}
|
|
95
|
+
if (cmdLower.includes('go vet')) {
|
|
96
|
+
return tagged('filter', (0, go_1.filterGoVet)(processed));
|
|
97
|
+
}
|
|
98
|
+
if (cmdLower.match(/docker\s+ps/)) {
|
|
99
|
+
return tagged('filter', (0, devops_1.filterDockerPs)(processed));
|
|
100
|
+
}
|
|
101
|
+
if (cmdLower.match(/docker\s+images/)) {
|
|
102
|
+
return tagged('filter', (0, devops_1.filterDockerImages)(processed));
|
|
103
|
+
}
|
|
104
|
+
if (cmdLower.match(/docker\s+logs/)) {
|
|
105
|
+
return tagged('filter', (0, devops_1.filterDockerLogs)(processed));
|
|
106
|
+
}
|
|
107
|
+
if (cmdLower.includes('kubectl')) {
|
|
108
|
+
const subMatch = cmdLower.match(/kubectl\s+(get|logs|describe|apply)/);
|
|
109
|
+
const sub = subMatch ? subMatch[1] : 'get';
|
|
110
|
+
return tagged('filter', (0, devops_1.filterKubectl)(processed, sub));
|
|
111
|
+
}
|
|
112
|
+
if (cmdLower.match(/^(ls|dir)(\s|$)/) || cmdLower.includes(' ls ') || cmdLower.endsWith(' ls')) {
|
|
113
|
+
return tagged('filter', (0, shell_1.filterLs)(processed));
|
|
114
|
+
}
|
|
115
|
+
if (cmdLower.match(/^tree(\s|$)/) || cmdLower.includes(' tree ') || cmdLower.endsWith(' tree')) {
|
|
116
|
+
return tagged('filter', (0, shell_1.filterTree)(processed));
|
|
117
|
+
}
|
|
118
|
+
if (cmdLower.match(/^(cat|head|tail|read|bat)(\s|$)/)) {
|
|
119
|
+
const catResult = (0, shell_1.filterCat)(processed, cmd);
|
|
120
|
+
if (catResult.includes('[lock file]'))
|
|
121
|
+
features.push('lock');
|
|
122
|
+
else if (catResult.includes('[binary') || catResult.includes('[minified file]'))
|
|
123
|
+
features.push('binary');
|
|
124
|
+
else if (catResult.includes('[code skeleton]'))
|
|
125
|
+
features.push('skeleton');
|
|
126
|
+
else if (catResult.includes('| ') && catResult.includes('---') && catResult.length < processed.length * 0.5)
|
|
127
|
+
features.push('json_crusher');
|
|
128
|
+
else if (catResult.includes('lines truncated'))
|
|
129
|
+
features.push('filter');
|
|
130
|
+
if (catResult.length < processed.length && !features.some(f => f !== 'ansi_strip' && f !== 'redact'))
|
|
131
|
+
features.push('filter');
|
|
132
|
+
exports.lastFeatures = features;
|
|
133
|
+
return catResult;
|
|
134
|
+
}
|
|
135
|
+
if (cmdLower.match(/^find(\s|$)/)) {
|
|
136
|
+
return tagged('filter', (0, shell_1.filterFind)(processed));
|
|
137
|
+
}
|
|
138
|
+
if (cmdLower.match(/^(grep|rg|ripgrep)(\s|$)/)) {
|
|
139
|
+
return tagged('filter', (0, shell_1.filterGrep)(processed));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
}
|
|
145
|
+
if (isFeatureEnabled('whitespace')) {
|
|
146
|
+
processed = (0, generic_1.collapseWhitespace)(processed);
|
|
147
|
+
features.push('whitespace');
|
|
148
|
+
}
|
|
149
|
+
processed = (0, generic_1.collapseDuplicates)(processed);
|
|
150
|
+
processed = (0, generic_1.softTruncate)(processed, 20000);
|
|
151
|
+
exports.lastFeatures = features;
|
|
152
|
+
return processed;
|
|
153
|
+
}
|
|
154
|
+
const REWRITE_RULES = [
|
|
155
|
+
{ pattern: /^(?:git|yadm)\s+(?:-[Cc]\s+\S+\s+)*(status|log|diff|show|add|commit|push|pull|branch|fetch|stash|worktree)/, prefix: 'trim git' },
|
|
156
|
+
{ pattern: /^gh\s+(pr|issue|run|repo|api|release)/, prefix: 'trim gh' },
|
|
157
|
+
{ pattern: /^glab\s+(mr|issue|ci|pipeline|api|release)/, prefix: 'trim glab' },
|
|
158
|
+
{ pattern: /^cargo\s+(build|test|clippy|check|fmt|install)/, prefix: 'trim cargo' },
|
|
159
|
+
{ pattern: /^pnpm\s+(exec|i|install|list|ls|outdated|run|run-script)/, prefix: 'trim pnpm' },
|
|
160
|
+
{ pattern: /^npm\s+(exec|run|run-script|rum|urn|x|test)(\s|$)/, prefix: 'trim npm' },
|
|
161
|
+
{ pattern: /^npx\s+/, prefix: 'trim npx' },
|
|
162
|
+
{ pattern: /^(cat|head|tail)\s+/, prefix: 'trim read' },
|
|
163
|
+
{ pattern: /^(rg|grep)\s+/, prefix: 'trim grep' },
|
|
164
|
+
{ pattern: /^ls(\s|$)/, prefix: 'trim ls' },
|
|
165
|
+
{ pattern: /^tree(\s|$)/, prefix: 'trim tree' },
|
|
166
|
+
{ pattern: /^find\s+/, prefix: 'trim find' },
|
|
167
|
+
{ pattern: /^docker\s+(ps|images|logs|run|exec|build|compose)/, prefix: 'trim docker' },
|
|
168
|
+
{ pattern: /^kubectl\s+(get|logs|describe|apply)/, prefix: 'trim kubectl' },
|
|
169
|
+
{ pattern: /^(python3?\s+-m\s+)?pytest(\s|$)/, prefix: 'trim pytest' },
|
|
170
|
+
{ pattern: /^ruff\s+(check|format)/, prefix: 'trim ruff' },
|
|
171
|
+
{ pattern: /^(pip3?|uv\s+pip)\s+(list|outdated|install|show)/, prefix: 'trim pip' },
|
|
172
|
+
{ pattern: /^go\s+(test|build|vet)/, prefix: 'trim go' }
|
|
173
|
+
];
|
|
174
|
+
function rewriteCommand(commandLine) {
|
|
175
|
+
const trimmed = commandLine.trim();
|
|
176
|
+
if (trimmed.startsWith('trim ')) {
|
|
177
|
+
return trimmed;
|
|
178
|
+
}
|
|
179
|
+
for (const rule of REWRITE_RULES) {
|
|
180
|
+
if (rule.pattern.test(trimmed)) {
|
|
181
|
+
return `trim ${trimmed}`;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return trimmed;
|
|
185
|
+
}
|
package/filters/js.js
CHANGED
|
@@ -1 +1,78 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterNpmInstall = filterNpmInstall;
|
|
4
|
+
exports.filterJestVitest = filterJestVitest;
|
|
5
|
+
function filterNpmInstall(stdout) {
|
|
6
|
+
const cleanText = stdout.replace(/\r/g, '\n');
|
|
7
|
+
const lines = cleanText.split('\n');
|
|
8
|
+
const result = [];
|
|
9
|
+
for (const line of lines) {
|
|
10
|
+
const trimmed = line.trim();
|
|
11
|
+
if (trimmed.includes('added ') ||
|
|
12
|
+
trimmed.includes('removed ') ||
|
|
13
|
+
trimmed.includes('audited ') ||
|
|
14
|
+
trimmed.includes('up to date') ||
|
|
15
|
+
trimmed.includes('found ')) {
|
|
16
|
+
if (!trimmed.includes('%') && !trimmed.startsWith('⠋') && !trimmed.startsWith('⠙')) {
|
|
17
|
+
result.push(trimmed);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const output = result.join('\n').trim();
|
|
22
|
+
return output.length > 0 ? output : "NPM: Packages verified/installed successfully";
|
|
23
|
+
}
|
|
24
|
+
function filterJestVitest(stdout) {
|
|
25
|
+
const lines = stdout.split('\n');
|
|
26
|
+
let passed = 0;
|
|
27
|
+
let failed = 0;
|
|
28
|
+
let total = 0;
|
|
29
|
+
const failureLines = [];
|
|
30
|
+
let inFailureSection = false;
|
|
31
|
+
for (const line of lines) {
|
|
32
|
+
const trimmed = line.trim();
|
|
33
|
+
if (trimmed.startsWith('Tests:') || trimmed.includes('Test Files:')) {
|
|
34
|
+
const matchPassed = trimmed.match(/(\d+)\s+passed/);
|
|
35
|
+
const matchFailed = trimmed.match(/(\d+)\s+failed/);
|
|
36
|
+
const matchTotal = trimmed.match(/(\d+)\s+total/);
|
|
37
|
+
if (matchPassed)
|
|
38
|
+
passed = parseInt(matchPassed[1]);
|
|
39
|
+
if (matchFailed)
|
|
40
|
+
failed = parseInt(matchFailed[1]);
|
|
41
|
+
if (matchTotal)
|
|
42
|
+
total = parseInt(matchTotal[1]);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (trimmed.startsWith('❯') || trimmed.startsWith('●') || trimmed.startsWith('FAIL ')) {
|
|
46
|
+
inFailureSection = true;
|
|
47
|
+
}
|
|
48
|
+
if (inFailureSection) {
|
|
49
|
+
if (trimmed.length > 0 && !trimmed.startsWith('Test Suites:') && !trimmed.startsWith('Tests:')) {
|
|
50
|
+
failureLines.push(line);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (total === 0 && passed === 0 && failed === 0) {
|
|
55
|
+
if (stdout.includes('PASS') && !stdout.includes('FAIL')) {
|
|
56
|
+
const match = stdout.match(/(\d+)\s+passed/);
|
|
57
|
+
const count = match ? match[1] : "all";
|
|
58
|
+
return `Test Runner: ${count} passed`;
|
|
59
|
+
}
|
|
60
|
+
return stdout;
|
|
61
|
+
}
|
|
62
|
+
if (failed === 0 && passed > 0) {
|
|
63
|
+
return `Test Runner: ${passed} passed`;
|
|
64
|
+
}
|
|
65
|
+
const result = [`Test Runner: ${passed} passed, ${failed} failed (${total} total)`];
|
|
66
|
+
if (failureLines.length > 0) {
|
|
67
|
+
result.push("\nFailures:");
|
|
68
|
+
const limit = 25;
|
|
69
|
+
const printedLines = failureLines.slice(0, limit);
|
|
70
|
+
for (const line of printedLines) {
|
|
71
|
+
result.push(` ${line}`);
|
|
72
|
+
}
|
|
73
|
+
if (failureLines.length > limit) {
|
|
74
|
+
result.push(` ... (${failureLines.length - limit} lines of trace details truncated)`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return result.join('\n');
|
|
78
|
+
}
|