trimprompt 1.0.30 → 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/index.js CHANGED
@@ -1 +1,185 @@
1
- 'use strict';const a0_0x1a8d2d=a0_0x552f;(function(_0x5e0343,_0x4d325c){const _0x175db1=a0_0x552f,_0x1708ac=_0x5e0343();while(!![]){try{const _0x2dbc9f=-parseInt(_0x175db1(0xe5))/0x1*(-parseInt(_0x175db1(0xfd))/0x2)+parseInt(_0x175db1(0xd4))/0x3*(-parseInt(_0x175db1(0xfc))/0x4)+parseInt(_0x175db1(0x102))/0x5+parseInt(_0x175db1(0xf9))/0x6+parseInt(_0x175db1(0xe7))/0x7*(-parseInt(_0x175db1(0x109))/0x8)+-parseInt(_0x175db1(0x104))/0x9*(-parseInt(_0x175db1(0xf7))/0xa)+-parseInt(_0x175db1(0xb0))/0xb;if(_0x2dbc9f===_0x4d325c)break;else _0x1708ac['push'](_0x1708ac['shift']());}catch(_0x3c7c25){_0x1708ac['push'](_0x1708ac['shift']());}}}(a0_0x4cec,0xa19da));Object[a0_0x1a8d2d(0xd6)](exports,a0_0x1a8d2d(0x11a),{'value':!![]}),exports[a0_0x1a8d2d(0xf8)]=exports[a0_0x1a8d2d(0xe8)]=void 0x0,exports['compressOutput']=compressOutput,exports[a0_0x1a8d2d(0xdd)]=rewriteCommand;const generic_1=require('./generic'),git_1=require('./git'),python_1=require(a0_0x1a8d2d(0xd7)),js_1=require(a0_0x1a8d2d(0xe9)),shell_1=require('./shell'),rust_1=require(a0_0x1a8d2d(0xd3)),go_1=require(a0_0x1a8d2d(0xbc)),devops_1=require(a0_0x1a8d2d(0xeb)),redactor_1=require('../redactor'),tracker_1=require('../tracker');exports[a0_0x1a8d2d(0xe8)]={'secretsFound':0x0,'secretTypes':[]},exports[a0_0x1a8d2d(0xf8)]=[];function a0_0x4cec(){const _0x466b16=['trim\x20cargo','23476794CKauoZ','\x20tree\x20','filterTree','\x20tree','trim\x20kubectl','filterNpmInstall','cargo\x20build','match','yadm\x20log','trim\x20grep','secretsFound','tracker','./go','[minified\x20file]','filterJestVitest','filterDockerPs','jest','push','text','filterPipInstall','git\x20show','trim\x20glab','secretTypes','filterDockerLogs','trim','npm\x20run\x20test','trim\x20ls','some','trim\x20git','startsWith','go\x20vet','---','trim\x20gh','pattern','toLowerCase','./rust','222bIDshD','cargo\x20clippy','defineProperty','./python','filterGoVet','ansi_strip','npm\x20i\x20','trim\x20docker','pnpm\x20install','rewriteCommand','endsWith','trim\x20npx','ruff\x20check','filterRuff','filterGitDiff','filterKubectl','getConfig','12114WuBctG','\x20ls','539LaTHfW','lastRedactAudit','./js','filter','./devops','yarn\x20test','collapseWhitespace','filterDockerImages','pip3\x20install','yadm\x20diff','softTruncate','includes','[code\x20skeleton]','ruff\x20','npm\x20i','npm\x20test','1746790cVNLNP','lastFeatures','7472892JhmAiy','trim\x20pytest','trim\x20pip','38860LjDxbZ','158ixMFKU','filterGitStatus','[lock\x20file]','filterPytest','get','5106510ACxMhN','whitespace','45wNfGfm','binary','filterFind','\x20ls\x20','redactWithAudit','60472CPQfUd','collapseDuplicates','test','trim\x20go','kubectl','filterGrep','git\x20log','redact','filterCat','skeleton','features_enabled','json_crusher','trim\x20','yadm\x20status','length','lines\x20truncated','cargo\x20test','__esModule'];a0_0x4cec=function(){return _0x466b16;};return a0_0x4cec();}function isFeatureEnabled(_0x93c8bd){const _0x15e11a=a0_0x1a8d2d;try{const _0x5050e0=tracker_1[_0x15e11a(0xbb)][_0x15e11a(0xe4)](),_0x5e6dfe=_0x5050e0[_0x15e11a(0x113)];if(!_0x5e6dfe||_0x5e6dfe[_0x93c8bd]===undefined)return!![];return _0x5e6dfe[_0x93c8bd]!==![];}catch{return!![];}}function a0_0x552f(_0x2036f8,_0x2f3cbc){_0x2036f8=_0x2036f8-0xaf;const _0x4cecc4=a0_0x4cec();let _0x552f4b=_0x4cecc4[_0x2036f8];return _0x552f4b;}function compressOutput(_0x437124,_0x1e3714,_0x49e54d,_0x1aa897=!![]){const _0xe8a016=a0_0x1a8d2d,_0x3c67f1=_0x437124['trim']();let _0x1fafc3=_0x1e3714;_0x49e54d[_0xe8a016(0xc8)]()[_0xe8a016(0x117)]>0x0&&(_0x1fafc3=_0x1e3714+'\x0a'+_0x49e54d);let _0xce41cd=isFeatureEnabled(_0xe8a016(0xd9))?(0x0,generic_1['stripAnsi'])(_0x1fafc3):_0x1fafc3;const _0x21a06c=[];if(_0xce41cd['length']<_0x1fafc3['length'])_0x21a06c[_0xe8a016(0xc1)](_0xe8a016(0xd9));const _0x16b3d6=(_0x181282,_0x5dade6)=>{const _0x4d45ab=_0xe8a016;return _0x21a06c[_0x4d45ab(0xc1)](_0x181282),exports[_0x4d45ab(0xf8)]=_0x21a06c,_0x5dade6;};if(_0x1aa897&&isFeatureEnabled(_0xe8a016(0x110))){const _0x300300=redactor_1['redactor'][_0xe8a016(0x108)](_0xce41cd);_0xce41cd=_0x300300[_0xe8a016(0xc2)],exports['lastRedactAudit']={'secretsFound':_0x300300[_0xe8a016(0xba)],'secretTypes':_0x300300[_0xe8a016(0xc6)]};if(_0x300300[_0xe8a016(0xba)]>0x0)_0x21a06c[_0xe8a016(0xc1)](_0xe8a016(0x110));}else exports[_0xe8a016(0xe8)]={'secretsFound':0x0,'secretTypes':[]};const _0x53caef=_0x3c67f1[_0xe8a016(0xd2)](),_0x4fc495=isFeatureEnabled('filter');try{if(_0x4fc495){if(_0x53caef['includes']('git\x20status')||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0x116)))return _0x16b3d6(_0xe8a016(0xea),(0x0,git_1[_0xe8a016(0xfe)])(_0xce41cd));if(_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0x10f))||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xb8)))return _0x16b3d6(_0xe8a016(0xea),(0x0,git_1['filterGitLog'])(_0xce41cd));if(_0x53caef[_0xe8a016(0xf2)]('git\x20diff')||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xc4))||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xf0)))return _0x16b3d6('filter',(0x0,git_1[_0xe8a016(0xe2)])(_0xce41cd));if(_0x53caef['includes']('pytest')||_0x53caef[_0xe8a016(0xb7)](/python3?\s+-m\s+pytest/))return _0x16b3d6(_0xe8a016(0xea),(0x0,python_1[_0xe8a016(0x100)])(_0xce41cd));if(_0x53caef[_0xe8a016(0xf2)]('pip\x20install')||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xef)))return _0x16b3d6('filter',(0x0,python_1[_0xe8a016(0xc3)])(_0xce41cd));if(_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xe0))||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xf4)))return _0x16b3d6('filter',(0x0,devops_1[_0xe8a016(0xe1)])(_0xce41cd));if(_0x53caef[_0xe8a016(0xf2)]('npm\x20install')||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xda))||_0x53caef[_0xe8a016(0xde)](_0xe8a016(0xf5))||_0x53caef['includes'](_0xe8a016(0xdc))||_0x53caef['includes']('yarn\x20install'))return _0x16b3d6(_0xe8a016(0xea),(0x0,js_1[_0xe8a016(0xb5)])(_0xce41cd));if(_0x53caef['includes'](_0xe8a016(0xc0))||_0x53caef[_0xe8a016(0xf2)]('vitest'))return _0x16b3d6(_0xe8a016(0xea),(0x0,js_1[_0xe8a016(0xbe)])(_0xce41cd));if(_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xf6))||_0x53caef[_0xe8a016(0xf2)]('pnpm\x20test')||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xec))||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xc9)))return _0x16b3d6('filter',(0x0,js_1[_0xe8a016(0xbe)])(_0xce41cd));if(_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0x119)))return _0x16b3d6('filter',(0x0,rust_1['filterCargoTest'])(_0xce41cd));if(_0x53caef['includes'](_0xe8a016(0xb6))||_0x53caef[_0xe8a016(0xf2)]('cargo\x20check')||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xd5)))return _0x16b3d6(_0xe8a016(0xea),(0x0,rust_1['filterCargoBuild'])(_0xce41cd));if(_0x53caef['includes']('go\x20test'))return _0x16b3d6(_0xe8a016(0xea),(0x0,go_1['filterGoTest'])(_0xce41cd));if(_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xce)))return _0x16b3d6(_0xe8a016(0xea),(0x0,go_1[_0xe8a016(0xd8)])(_0xce41cd));if(_0x53caef[_0xe8a016(0xb7)](/docker\s+ps/))return _0x16b3d6('filter',(0x0,devops_1[_0xe8a016(0xbf)])(_0xce41cd));if(_0x53caef[_0xe8a016(0xb7)](/docker\s+images/))return _0x16b3d6(_0xe8a016(0xea),(0x0,devops_1[_0xe8a016(0xee)])(_0xce41cd));if(_0x53caef[_0xe8a016(0xb7)](/docker\s+logs/))return _0x16b3d6(_0xe8a016(0xea),(0x0,devops_1[_0xe8a016(0xc7)])(_0xce41cd));if(_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0x10d))){const _0x3c103=_0x53caef[_0xe8a016(0xb7)](/kubectl\s+(get|logs|describe|apply)/),_0x484187=_0x3c103?_0x3c103[0x1]:_0xe8a016(0x101);return _0x16b3d6('filter',(0x0,devops_1[_0xe8a016(0xe3)])(_0xce41cd,_0x484187));}if(_0x53caef[_0xe8a016(0xb7)](/^(ls|dir)(\s|$)/)||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0x107))||_0x53caef[_0xe8a016(0xde)](_0xe8a016(0xe6)))return _0x16b3d6(_0xe8a016(0xea),(0x0,shell_1['filterLs'])(_0xce41cd));if(_0x53caef['match'](/^tree(\s|$)/)||_0x53caef[_0xe8a016(0xf2)](_0xe8a016(0xb1))||_0x53caef[_0xe8a016(0xde)](_0xe8a016(0xb3)))return _0x16b3d6(_0xe8a016(0xea),(0x0,shell_1[_0xe8a016(0xb2)])(_0xce41cd));if(_0x53caef['match'](/^(cat|head|tail|read|bat)(\s|$)/)){const _0x2da928=(0x0,shell_1[_0xe8a016(0x111)])(_0xce41cd,_0x3c67f1);if(_0x2da928['includes'](_0xe8a016(0xff)))_0x21a06c['push']('lock');else{if(_0x2da928['includes']('[binary')||_0x2da928[_0xe8a016(0xf2)](_0xe8a016(0xbd)))_0x21a06c['push'](_0xe8a016(0x105));else{if(_0x2da928['includes'](_0xe8a016(0xf3)))_0x21a06c[_0xe8a016(0xc1)](_0xe8a016(0x112));else{if(_0x2da928['includes']('|\x20')&&_0x2da928[_0xe8a016(0xf2)](_0xe8a016(0xcf))&&_0x2da928[_0xe8a016(0x117)]<_0xce41cd[_0xe8a016(0x117)]*0.5)_0x21a06c[_0xe8a016(0xc1)](_0xe8a016(0x114));else{if(_0x2da928[_0xe8a016(0xf2)](_0xe8a016(0x118)))_0x21a06c['push'](_0xe8a016(0xea));}}}}if(_0x2da928[_0xe8a016(0x117)]<_0xce41cd[_0xe8a016(0x117)]&&!_0x21a06c[_0xe8a016(0xcb)](_0xfa0fe4=>_0xfa0fe4!==_0xe8a016(0xd9)&&_0xfa0fe4!=='redact'))_0x21a06c[_0xe8a016(0xc1)](_0xe8a016(0xea));return exports[_0xe8a016(0xf8)]=_0x21a06c,_0x2da928;}if(_0x53caef[_0xe8a016(0xb7)](/^find(\s|$)/))return _0x16b3d6(_0xe8a016(0xea),(0x0,shell_1[_0xe8a016(0x106)])(_0xce41cd));if(_0x53caef['match'](/^(grep|rg|ripgrep)(\s|$)/))return _0x16b3d6(_0xe8a016(0xea),(0x0,shell_1[_0xe8a016(0x10e)])(_0xce41cd));}}catch(_0x4eb51b){}return isFeatureEnabled('whitespace')&&(_0xce41cd=(0x0,generic_1[_0xe8a016(0xed)])(_0xce41cd),_0x21a06c[_0xe8a016(0xc1)](_0xe8a016(0x103))),_0xce41cd=(0x0,generic_1[_0xe8a016(0x10a)])(_0xce41cd),_0xce41cd=(0x0,generic_1[_0xe8a016(0xf1)])(_0xce41cd,0x4e20),exports['lastFeatures']=_0x21a06c,_0xce41cd;}const REWRITE_RULES=[{'pattern':/^(?:git|yadm)\s+(?:-[Cc]\s+\S+\s+)*(status|log|diff|show|add|commit|push|pull|branch|fetch|stash|worktree)/,'prefix':a0_0x1a8d2d(0xcc)},{'pattern':/^gh\s+(pr|issue|run|repo|api|release)/,'prefix':a0_0x1a8d2d(0xd0)},{'pattern':/^glab\s+(mr|issue|ci|pipeline|api|release)/,'prefix':a0_0x1a8d2d(0xc5)},{'pattern':/^cargo\s+(build|test|clippy|check|fmt|install)/,'prefix':a0_0x1a8d2d(0xaf)},{'pattern':/^pnpm\s+(exec|i|install|list|ls|outdated|run|run-script)/,'prefix':'trim\x20pnpm'},{'pattern':/^npm\s+(exec|run|run-script|rum|urn|x|test)(\s|$)/,'prefix':'trim\x20npm'},{'pattern':/^npx\s+/,'prefix':a0_0x1a8d2d(0xdf)},{'pattern':/^(cat|head|tail)\s+/,'prefix':'trim\x20read'},{'pattern':/^(rg|grep)\s+/,'prefix':a0_0x1a8d2d(0xb9)},{'pattern':/^ls(\s|$)/,'prefix':a0_0x1a8d2d(0xca)},{'pattern':/^tree(\s|$)/,'prefix':'trim\x20tree'},{'pattern':/^find\s+/,'prefix':'trim\x20find'},{'pattern':/^docker\s+(ps|images|logs|run|exec|build|compose)/,'prefix':a0_0x1a8d2d(0xdb)},{'pattern':/^kubectl\s+(get|logs|describe|apply)/,'prefix':a0_0x1a8d2d(0xb4)},{'pattern':/^(python3?\s+-m\s+)?pytest(\s|$)/,'prefix':a0_0x1a8d2d(0xfa)},{'pattern':/^ruff\s+(check|format)/,'prefix':'trim\x20ruff'},{'pattern':/^(pip3?|uv\s+pip)\s+(list|outdated|install|show)/,'prefix':a0_0x1a8d2d(0xfb)},{'pattern':/^go\s+(test|build|vet)/,'prefix':a0_0x1a8d2d(0x10c)}];function rewriteCommand(_0x3fd896){const _0x3f1dc6=a0_0x1a8d2d,_0x3e327b=_0x3fd896[_0x3f1dc6(0xc8)]();if(_0x3e327b[_0x3f1dc6(0xcd)](_0x3f1dc6(0x115)))return _0x3e327b;for(const _0x445cac of REWRITE_RULES){if(_0x445cac[_0x3f1dc6(0xd1)][_0x3f1dc6(0x10b)](_0x3e327b))return _0x3f1dc6(0x115)+_0x3e327b;}return _0x3e327b;}
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
- 'use strict';function a0_0x3807(_0x2822d9,_0x581890){_0x2822d9=_0x2822d9-0xd1;const _0x5673e6=a0_0x5673();let _0x38071b=_0x5673e6[_0x2822d9];return _0x38071b;}const a0_0xd4eeed=a0_0x3807;function a0_0x5673(){const _0x3af87f=['removed\x20','\x20passed','PASS','push','\x0aFailures:','\x20failed\x20(','40fHIOqm','Test\x20Suites:','10136WJieIG','FAIL','filterJestVitest','1225554uHtxGv','split','trim','startsWith','\x20lines\x20of\x20trace\x20details\x20truncated)','match','5061hHvBsu','found\x20','1729580LtLwva','1331596hTfGkh','added\x20','join','\x20total)','up\x20to\x20date','NPM:\x20Packages\x20verified/installed\x20successfully','FAIL\x20\x20','20BRnEke','__esModule','Test\x20Files:','length','49663zQwyHm','2523288gxzthw','\x20\x20...\x20(','Test\x20Runner:\x20','Tests:','842103kwugNL','audited\x20','includes'];a0_0x5673=function(){return _0x3af87f;};return a0_0x5673();}(function(_0x243586,_0x1c78a5){const _0x35ceb9=a0_0x3807,_0x230f45=_0x243586();while(!![]){try{const _0x25187c=-parseInt(_0x35ceb9(0xdd))/0x1*(parseInt(_0x35ceb9(0xeb))/0x2)+parseInt(_0x35ceb9(0xf0))/0x3+parseInt(_0x35ceb9(0xd2))/0x4+-parseInt(_0x35ceb9(0xd1))/0x5+parseInt(_0x35ceb9(0xde))/0x6+parseInt(_0x35ceb9(0xf6))/0x7*(parseInt(_0x35ceb9(0xed))/0x8)+parseInt(_0x35ceb9(0xe2))/0x9*(-parseInt(_0x35ceb9(0xd9))/0xa);if(_0x25187c===_0x1c78a5)break;else _0x230f45['push'](_0x230f45['shift']());}catch(_0x145473){_0x230f45['push'](_0x230f45['shift']());}}}(a0_0x5673,0x86b10));Object['defineProperty'](exports,a0_0xd4eeed(0xda),{'value':!![]}),exports['filterNpmInstall']=filterNpmInstall,exports[a0_0xd4eeed(0xef)]=filterJestVitest;function filterNpmInstall(_0x398c6f){const _0x5c215f=a0_0xd4eeed,_0x365970=_0x398c6f['replace'](/\r/g,'\x0a'),_0x26ee90=_0x365970[_0x5c215f(0xf1)]('\x0a'),_0xb20589=[];for(const _0x41b768 of _0x26ee90){const _0x5b6d8e=_0x41b768[_0x5c215f(0xf2)]();(_0x5b6d8e[_0x5c215f(0xe4)](_0x5c215f(0xd3))||_0x5b6d8e['includes'](_0x5c215f(0xe5))||_0x5b6d8e[_0x5c215f(0xe4)](_0x5c215f(0xe3))||_0x5b6d8e[_0x5c215f(0xe4)](_0x5c215f(0xd6))||_0x5b6d8e[_0x5c215f(0xe4)](_0x5c215f(0xf7)))&&(!_0x5b6d8e[_0x5c215f(0xe4)]('%')&&!_0x5b6d8e[_0x5c215f(0xf3)]('⠋')&&!_0x5b6d8e[_0x5c215f(0xf3)]('⠙')&&_0xb20589[_0x5c215f(0xe8)](_0x5b6d8e));}const _0x39f0fa=_0xb20589[_0x5c215f(0xd4)]('\x0a')[_0x5c215f(0xf2)]();return _0x39f0fa[_0x5c215f(0xdc)]>0x0?_0x39f0fa:_0x5c215f(0xd7);}function filterJestVitest(_0x35a39c){const _0x20108d=a0_0xd4eeed,_0x380072=_0x35a39c[_0x20108d(0xf1)]('\x0a');let _0x52fdc3=0x0,_0x2684d6=0x0,_0x4006d1=0x0;const _0x356b1c=[];let _0x342556=![];for(const _0x1ef14b of _0x380072){const _0x14e643=_0x1ef14b[_0x20108d(0xf2)]();if(_0x14e643['startsWith'](_0x20108d(0xe1))||_0x14e643[_0x20108d(0xe4)](_0x20108d(0xdb))){const _0x3c8c3c=_0x14e643[_0x20108d(0xf5)](/(\d+)\s+passed/),_0x5c097c=_0x14e643[_0x20108d(0xf5)](/(\d+)\s+failed/),_0x36ff57=_0x14e643[_0x20108d(0xf5)](/(\d+)\s+total/);if(_0x3c8c3c)_0x52fdc3=parseInt(_0x3c8c3c[0x1]);if(_0x5c097c)_0x2684d6=parseInt(_0x5c097c[0x1]);if(_0x36ff57)_0x4006d1=parseInt(_0x36ff57[0x1]);continue;}(_0x14e643['startsWith']('❯')||_0x14e643['startsWith']('●')||_0x14e643[_0x20108d(0xf3)](_0x20108d(0xd8)))&&(_0x342556=!![]),_0x342556&&(_0x14e643[_0x20108d(0xdc)]>0x0&&!_0x14e643[_0x20108d(0xf3)](_0x20108d(0xec))&&!_0x14e643[_0x20108d(0xf3)]('Tests:')&&_0x356b1c[_0x20108d(0xe8)](_0x1ef14b));}if(_0x4006d1===0x0&&_0x52fdc3===0x0&&_0x2684d6===0x0){if(_0x35a39c[_0x20108d(0xe4)](_0x20108d(0xe7))&&!_0x35a39c[_0x20108d(0xe4)](_0x20108d(0xee))){const _0x4bc5f8=_0x35a39c[_0x20108d(0xf5)](/(\d+)\s+passed/),_0x345f94=_0x4bc5f8?_0x4bc5f8[0x1]:'all';return _0x20108d(0xe0)+_0x345f94+'\x20passed';}return _0x35a39c;}if(_0x2684d6===0x0&&_0x52fdc3>0x0)return _0x20108d(0xe0)+_0x52fdc3+_0x20108d(0xe6);const _0x52749f=[_0x20108d(0xe0)+_0x52fdc3+'\x20passed,\x20'+_0x2684d6+_0x20108d(0xea)+_0x4006d1+_0x20108d(0xd5)];if(_0x356b1c[_0x20108d(0xdc)]>0x0){_0x52749f[_0x20108d(0xe8)](_0x20108d(0xe9));const _0x494180=0x19,_0x28cef6=_0x356b1c['slice'](0x0,_0x494180);for(const _0x33022e of _0x28cef6){_0x52749f[_0x20108d(0xe8)]('\x20\x20'+_0x33022e);}_0x356b1c[_0x20108d(0xdc)]>_0x494180&&_0x52749f[_0x20108d(0xe8)](_0x20108d(0xdf)+(_0x356b1c[_0x20108d(0xdc)]-_0x494180)+_0x20108d(0xf4));}return _0x52749f[_0x20108d(0xd4)]('\x0a');}
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
+ }
package/filters/python.js CHANGED
@@ -1 +1,130 @@
1
- 'use strict';function a0_0x178f(){const _0x313fc5=['\x20lines\x20of\x20stacktrace\x20truncated)','failed','replace','push','348580QfJeXs','\x20in\x20','AssertionError:','.\x20[FAIL]\x20','match','===\x20short\x20test\x20summary\x20info\x20===','\x20skipped','defineProperty','79480GlXzCT','join','30QeuKNu','392864zSWDbE','730XwUwEr','length','7pUtbGe','__esModule','Requirement\x20already\x20satisfied','trim','includes','passed','\x20\x20\x20\x20...\x20(','1848534XHvCUb','Downloading','244044pKVZTa','E\x20\x20\x20','split','\x0aFailures:','\x20xpassed\x20(warning!)','\x20xfailed','Using\x20cached','5063592bBCNRZ','\x20passed','===','Pytest:\x20All\x20tests\x20passed','slice','filterPytest','___','filterPipInstall','5600256BrQuQW','\x20\x20...\x20+','startsWith','Pytest:\x20','.py:','\x20more\x20failures\x20truncated'];a0_0x178f=function(){return _0x313fc5;};return a0_0x178f();}const a0_0x4a4c7c=a0_0x5257;(function(_0x515719,_0xbdb938){const _0x171c17=a0_0x5257,_0x1a65ab=_0x515719();while(!![]){try{const _0x1c3fc9=-parseInt(_0x171c17(0x205))/0x1+-parseInt(_0x171c17(0x1fd))/0x2+parseInt(_0x171c17(0x212))/0x3+parseInt(_0x171c17(0x208))/0x4*(parseInt(_0x171c17(0x207))/0x5)+-parseInt(_0x171c17(0x21b))/0x6*(-parseInt(_0x171c17(0x20b))/0x7)+parseInt(_0x171c17(0x1f3))/0x8+-parseInt(_0x171c17(0x214))/0x9*(parseInt(_0x171c17(0x209))/0xa);if(_0x1c3fc9===_0xbdb938)break;else _0x1a65ab['push'](_0x1a65ab['shift']());}catch(_0x5f1fa4){_0x1a65ab['push'](_0x1a65ab['shift']());}}}(a0_0x178f,0x7e068));function a0_0x5257(_0x102e1b,_0x22c059){_0x102e1b=_0x102e1b-0x1f3;const _0x178fe7=a0_0x178f();let _0x5257de=_0x178fe7[_0x102e1b];return _0x5257de;}Object[a0_0x4a4c7c(0x204)](exports,a0_0x4a4c7c(0x20c),{'value':!![]}),exports[a0_0x4a4c7c(0x220)]=filterPytest,exports[a0_0x4a4c7c(0x222)]=filterPipInstall;function filterPytest(_0x552b1a){const _0x4a03df=a0_0x4a4c7c,_0x529db6=_0x552b1a['split']('\x0a');let _0x5d921f=0x0,_0x33ae70=0x0,_0x31deb1=0x0,_0x185242=0x0,_0x2741a7=0x0;const _0x542ea2=[];let _0x460025=[],_0xb6872b=![];for(const _0x230161 of _0x529db6){const _0x4e1327=_0x230161[_0x4a03df(0x20e)]();if(_0x4e1327[_0x4a03df(0x1f5)]('===\x20FAILURES\x20===')||_0x4e1327[_0x4a03df(0x1f5)]('===\x20ERRORS\x20===')){_0xb6872b=!![];continue;}else(_0x4e1327['startsWith'](_0x4a03df(0x202))||_0x4e1327[_0x4a03df(0x1f5)](_0x4a03df(0x21d))&&_0x4e1327[_0x4a03df(0x20f)](_0x4a03df(0x210)))&&(_0xb6872b=![],_0x460025[_0x4a03df(0x20a)]>0x0&&(_0x542ea2[_0x4a03df(0x1fc)](_0x460025),_0x460025=[]));if(_0xb6872b){if(_0x4e1327[_0x4a03df(0x1f5)](_0x4a03df(0x221)))_0x460025[_0x4a03df(0x20a)]>0x0&&(_0x542ea2['push'](_0x460025),_0x460025=[]),_0x460025[_0x4a03df(0x1fc)](_0x4e1327);else _0x4e1327[_0x4a03df(0x20a)]>0x0&&_0x460025[_0x4a03df(0x1fc)](_0x230161);continue;}if(_0x4e1327['startsWith']('===')&&_0x4e1327[_0x4a03df(0x20f)](_0x4a03df(0x1fe))){const _0x5a645d=_0x4e1327[_0x4a03df(0x201)](/(\d+)\s+passed/),_0x48d3ac=_0x4e1327[_0x4a03df(0x201)](/(\d+)\s+failed/),_0x58aa45=_0x4e1327['match'](/(\d+)\s+skipped/),_0xd07a4d=_0x4e1327[_0x4a03df(0x201)](/(\d+)\s+xfailed/),_0x3eeed7=_0x4e1327[_0x4a03df(0x201)](/(\d+)\s+xpassed/);if(_0x5a645d)_0x5d921f=parseInt(_0x5a645d[0x1]);if(_0x48d3ac)_0x33ae70=parseInt(_0x48d3ac[0x1]);if(_0x58aa45)_0x31deb1=parseInt(_0x58aa45[0x1]);if(_0xd07a4d)_0x185242=parseInt(_0xd07a4d[0x1]);if(_0x3eeed7)_0x2741a7=parseInt(_0x3eeed7[0x1]);}}_0x460025[_0x4a03df(0x20a)]>0x0&&_0x542ea2[_0x4a03df(0x1fc)](_0x460025);if(_0x5d921f===0x0&&_0x33ae70===0x0&&_0x31deb1===0x0&&_0x185242===0x0&&_0x2741a7===0x0){if(_0x552b1a[_0x4a03df(0x20f)]('passed')&&!_0x552b1a[_0x4a03df(0x20f)](_0x4a03df(0x1fa)))return _0x4a03df(0x21e);return _0x552b1a;}if(_0x33ae70===0x0&&_0x5d921f>0x0&&_0x31deb1===0x0&&_0x185242===0x0&&_0x2741a7===0x0)return _0x4a03df(0x1f6)+_0x5d921f+_0x4a03df(0x21c);const _0x446e7a=[];_0x446e7a['push'](_0x4a03df(0x1f6)+_0x5d921f+_0x4a03df(0x21c));if(_0x33ae70>0x0)_0x446e7a[_0x4a03df(0x1fc)](_0x33ae70+'\x20failed');if(_0x31deb1>0x0)_0x446e7a[_0x4a03df(0x1fc)](_0x31deb1+_0x4a03df(0x203));if(_0x185242>0x0)_0x446e7a[_0x4a03df(0x1fc)](_0x185242+_0x4a03df(0x219));if(_0x2741a7>0x0)_0x446e7a[_0x4a03df(0x1fc)](_0x2741a7+_0x4a03df(0x218));const _0x5842ab=[_0x446e7a[_0x4a03df(0x206)](',\x20')];if(_0x542ea2[_0x4a03df(0x20a)]>0x0){_0x5842ab[_0x4a03df(0x1fc)](_0x4a03df(0x217));const _0x4ecacc=0x3,_0x29a4a4=_0x542ea2[_0x4a03df(0x21f)](0x0,_0x4ecacc);for(let _0xe46b7a=0x0;_0xe46b7a<_0x29a4a4['length'];_0xe46b7a++){const _0x132e05=_0x29a4a4[_0xe46b7a],_0x2ae0fb=_0x132e05[0x0][_0x4a03df(0x1fb)](/_/g,'')[_0x4a03df(0x20e)]();_0x5842ab[_0x4a03df(0x1fc)]('\x20\x20'+(_0xe46b7a+0x1)+_0x4a03df(0x200)+_0x2ae0fb);const _0x15d5d4=_0x132e05[_0x4a03df(0x21f)](0x1),_0x2dd1e0=_0x15d5d4['filter'](_0x238331=>{const _0x941fbb=_0x4a03df,_0x59d684=_0x238331[_0x941fbb(0x20e)]();return _0x59d684[_0x941fbb(0x1f5)]('>')||_0x59d684[_0x941fbb(0x1f5)](_0x941fbb(0x215))||_0x59d684[_0x941fbb(0x20f)](_0x941fbb(0x1f7))||_0x59d684[_0x941fbb(0x20f)](_0x941fbb(0x1ff));});for(const _0x577446 of _0x2dd1e0[_0x4a03df(0x21f)](0x0,0x8)){_0x5842ab[_0x4a03df(0x1fc)]('\x20\x20\x20\x20'+_0x577446);}_0x2dd1e0[_0x4a03df(0x20a)]>0x8&&_0x5842ab[_0x4a03df(0x1fc)](_0x4a03df(0x211)+(_0x2dd1e0[_0x4a03df(0x20a)]-0x8)+_0x4a03df(0x1f9));}_0x542ea2[_0x4a03df(0x20a)]>_0x4ecacc&&_0x5842ab[_0x4a03df(0x1fc)](_0x4a03df(0x1f4)+(_0x542ea2[_0x4a03df(0x20a)]-_0x4ecacc)+_0x4a03df(0x1f8));}return _0x5842ab[_0x4a03df(0x206)]('\x0a');}function filterPipInstall(_0x3337e5){const _0x477030=a0_0x4a4c7c,_0x576374=_0x3337e5[_0x477030(0x216)]('\x0a'),_0x4fd23d=[];for(const _0x2f5a26 of _0x576374){const _0x48b35c=_0x2f5a26[_0x477030(0x20e)]();_0x48b35c[_0x477030(0x1f5)]('Successfully\x20installed')&&_0x4fd23d[_0x477030(0x1fc)](_0x48b35c);}if(_0x4fd23d['length']>0x0)return _0x4fd23d[_0x477030(0x206)]('\x0a');return _0x576374['filter'](_0x4e3e3e=>{const _0x44a040=_0x477030,_0x341858=_0x4e3e3e[_0x44a040(0x20e)]();return!_0x341858[_0x44a040(0x1f5)]('Collecting')&&!_0x341858['startsWith'](_0x44a040(0x213))&&!_0x341858['includes'](_0x44a040(0x21a))&&!_0x341858[_0x44a040(0x1f5)](_0x44a040(0x20d));})[_0x477030(0x206)]('\x0a')[_0x477030(0x20e)]();}
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_0x4e35da=a0_0x1bed;(function(_0x51d96e,_0x29eacc){const _0xa6c1bb=a0_0x1bed,_0x35c08d=_0x51d96e();while(!![]){try{const _0x1d1aa4=-parseInt(_0xa6c1bb(0x165))/0x1+-parseInt(_0xa6c1bb(0x187))/0x2+parseInt(_0xa6c1bb(0x163))/0x3*(parseInt(_0xa6c1bb(0x172))/0x4)+-parseInt(_0xa6c1bb(0x183))/0x5*(-parseInt(_0xa6c1bb(0x17f))/0x6)+parseInt(_0xa6c1bb(0x169))/0x7+-parseInt(_0xa6c1bb(0x179))/0x8+-parseInt(_0xa6c1bb(0x166))/0x9;if(_0x1d1aa4===_0x29eacc)break;else _0x35c08d['push'](_0x35c08d['shift']());}catch(_0x141a0f){_0x35c08d['push'](_0x35c08d['shift']());}}}(a0_0xf1e1,0x26f98));function a0_0x1bed(_0x2cd423,_0x4a0a54){_0x2cd423=_0x2cd423-0x161;const _0xf1e169=a0_0xf1e1();let _0x1bed50=_0xf1e169[_0x2cd423];return _0x1bed50;}Object['defineProperty'](exports,a0_0x4e35da(0x16a),{'value':!![]}),exports[a0_0x4e35da(0x16b)]=filterCargoTest,exports[a0_0x4e35da(0x16d)]=filterCargoBuild;function filterCargoTest(_0x12d57b){const _0x29f7eb=a0_0x4e35da,_0x3667b6=_0x12d57b[_0x29f7eb(0x167)]('\x0a');let _0x4f4c02=0x0,_0x2f7701=0x0,_0xf4fdb0=0x0,_0xa2f9a5=0x0;const _0x3888ce=[];let _0x5aa83e=![],_0x5a6d6e=[];for(const _0x43dd19 of _0x3667b6){const _0x4b016f=_0x43dd19['trim'](),_0x288df8=_0x4b016f['match'](/test result:\s*(\w+)\.\s*(\d+)\s+passed;\s*(\d+)\s+failed;\s*(\d+)\s+ignored;\s*(\d+)\s+measured/);if(_0x288df8){_0x4f4c02+=parseInt(_0x288df8[0x2]),_0x2f7701+=parseInt(_0x288df8[0x3]),_0xf4fdb0+=parseInt(_0x288df8[0x4]),_0xa2f9a5+=parseInt(_0x288df8[0x5]);continue;}if(_0x4b016f===_0x29f7eb(0x170)||_0x4b016f==='----\x20failures\x20----'){_0x5aa83e=!![];continue;}if(_0x5aa83e){if(_0x4b016f[_0x29f7eb(0x18b)](_0x29f7eb(0x18f))&&_0x4b016f[_0x29f7eb(0x16e)]('\x20----')){if(_0x5a6d6e[_0x29f7eb(0x171)]>0x0)_0x3888ce[_0x29f7eb(0x190)](_0x5a6d6e[_0x29f7eb(0x184)]('\x0a'));_0x5a6d6e=[_0x4b016f[_0x29f7eb(0x180)](/^-+\s*/,'')[_0x29f7eb(0x180)](/\s*-+$/,'')];}else{if(_0x4b016f==='failures:'||_0x4b016f[_0x29f7eb(0x18b)](_0x29f7eb(0x162))){if(_0x5a6d6e['length']>0x0)_0x3888ce[_0x29f7eb(0x190)](_0x5a6d6e['join']('\x0a'));_0x5a6d6e=[],_0x5aa83e=![];}else _0x4b016f[_0x29f7eb(0x171)]>0x0&&_0x5a6d6e[_0x29f7eb(0x190)](_0x43dd19);}}}if(_0x5a6d6e[_0x29f7eb(0x171)]>0x0)_0x3888ce[_0x29f7eb(0x190)](_0x5a6d6e[_0x29f7eb(0x184)]('\x0a'));if(_0x4f4c02===0x0&&_0x2f7701===0x0&&_0xf4fdb0===0x0){if(_0x12d57b[_0x29f7eb(0x174)]('test\x20result:\x20ok'))return _0x29f7eb(0x176);return _0x12d57b;}if(_0x2f7701===0x0){const _0x548574=[_0x29f7eb(0x182)+_0x4f4c02+_0x29f7eb(0x18d)];if(_0xf4fdb0>0x0)_0x548574['push'](_0xf4fdb0+'\x20ignored');return _0x548574[_0x29f7eb(0x184)](',\x20');}const _0x3238e6=[_0x29f7eb(0x182)+_0x4f4c02+'\x20passed,\x20'+_0x2f7701+_0x29f7eb(0x177)+_0xf4fdb0+_0x29f7eb(0x16f)];if(_0x3888ce[_0x29f7eb(0x171)]>0x0){_0x3238e6[_0x29f7eb(0x190)](_0x29f7eb(0x17a));const _0x5b761e=0x3;for(let _0x179c7e=0x0;_0x179c7e<Math['min'](_0x3888ce[_0x29f7eb(0x171)],_0x5b761e);_0x179c7e++){const _0x336c73=_0x3888ce[_0x179c7e]['split']('\x0a');_0x3238e6[_0x29f7eb(0x190)]('\x20\x20'+(_0x179c7e+0x1)+'.\x20'+_0x336c73[0x0]);const _0x13aa11=_0x336c73[_0x29f7eb(0x188)](0x1),_0x164d60=_0x13aa11[_0x29f7eb(0x17b)](_0x78604c=>_0x78604c['trim']()[_0x29f7eb(0x18b)]('thread')||_0x78604c['includes'](_0x29f7eb(0x178))||_0x78604c['includes'](_0x29f7eb(0x181))||_0x78604c[_0x29f7eb(0x174)](_0x29f7eb(0x16c))||_0x78604c['includes'](_0x29f7eb(0x17e)));for(const _0xefbf2b of _0x164d60[_0x29f7eb(0x188)](0x0,0x5)){_0x3238e6[_0x29f7eb(0x190)](_0x29f7eb(0x17d)+_0xefbf2b['trim']());}}_0x3888ce['length']>_0x5b761e&&_0x3238e6[_0x29f7eb(0x190)]('\x20\x20...\x20+'+(_0x3888ce['length']-_0x5b761e)+_0x29f7eb(0x18a));}return _0x3238e6['join']('\x0a');}function a0_0xf1e1(){const _0x8ad673=['warning:','69511epTmqf','291249AyxRmY','split','trim','1366617IvqAoU','__esModule','filterCargoTest','left:','filterCargoBuild','endsWith','\x20ignored','failures:','length','7236VEOvxI','error[','includes','\x0aErrors:','Cargo\x20test:\x20all\x20tests\x20passed','\x20failed,\x20','panicked','2257744LGeqWD','\x0aFailures:','filter','warning[','\x20\x20\x20\x20','right:','109128byfBxw','replace','assert','Cargo\x20test:\x20','85QACAuT','join','\x20more\x20errors','Cargo:\x20compiled\x20','359172NalwSy','slice','Compiling\x20','\x20more\x20failures','startsWith','\x20errors,\x20','\x20passed','\x20crates\x20successfully','----\x20','push','\x20warnings','test\x20result:','363DMgSEh'];a0_0xf1e1=function(){return _0x8ad673;};return a0_0xf1e1();}function filterCargoBuild(_0x2cbee6){const _0x4447a4=a0_0x4e35da,_0x3a6d6b=_0x2cbee6['split']('\x0a'),_0x70b029=[],_0x22f6eb=[];let _0x4704e3=0x0;for(const _0x12c177 of _0x3a6d6b){const _0x205d44=_0x12c177['trim']();if(_0x205d44[_0x4447a4(0x18b)](_0x4447a4(0x189)))_0x4704e3++;else{if(_0x205d44[_0x4447a4(0x18b)](_0x4447a4(0x17c))||_0x205d44[_0x4447a4(0x18b)](_0x4447a4(0x164)))_0x70b029['push'](_0x205d44);else{if(_0x205d44['startsWith'](_0x4447a4(0x173))||_0x205d44[_0x4447a4(0x18b)]('error:'))_0x22f6eb[_0x4447a4(0x190)](_0x205d44);}}}if(_0x22f6eb[_0x4447a4(0x171)]===0x0&&_0x70b029[_0x4447a4(0x171)]===0x0)return _0x4704e3>0x0?_0x4447a4(0x186)+_0x4704e3+_0x4447a4(0x18e):_0x2cbee6[_0x4447a4(0x168)]();const _0x51eecd=[];if(_0x22f6eb['length']>0x0){_0x51eecd['push']('Cargo:\x20'+_0x22f6eb[_0x4447a4(0x171)]+_0x4447a4(0x18c)+_0x70b029[_0x4447a4(0x171)]+_0x4447a4(0x161)),_0x51eecd[_0x4447a4(0x190)](_0x4447a4(0x175));for(const _0x5b9c11 of _0x22f6eb['slice'](0x0,0x5))_0x51eecd['push']('\x20\x20'+_0x5b9c11);if(_0x22f6eb['length']>0x5)_0x51eecd['push']('\x20\x20...\x20+'+(_0x22f6eb[_0x4447a4(0x171)]-0x5)+_0x4447a4(0x185));}else _0x51eecd[_0x4447a4(0x190)](_0x4447a4(0x186)+_0x4704e3+'\x20crates,\x20'+_0x70b029['length']+_0x4447a4(0x161));if(_0x70b029[_0x4447a4(0x171)]>0x0&&_0x70b029[_0x4447a4(0x171)]<=0x5){_0x51eecd['push']('\x0aWarnings:');for(const _0x55cbed of _0x70b029)_0x51eecd['push']('\x20\x20'+_0x55cbed);}else _0x70b029['length']>0x5&&_0x51eecd[_0x4447a4(0x190)]('\x0a('+_0x70b029[_0x4447a4(0x171)]+'\x20warnings\x20—\x20run\x20cargo\x20clippy\x20for\x20details)');return _0x51eecd[_0x4447a4(0x184)]('\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
+ }