trimprompt 1.0.31 → 1.0.32
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/api-proxy.js +1 -1
- package/cache-manager.js +1 -1
- 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 -1
- package/filters/devops.js +1 -1
- package/filters/generic.js +1 -1
- package/filters/git.js +1 -1
- package/filters/go.js +1 -99
- package/filters/index.js +1 -185
- package/filters/js.js +1 -78
- package/filters/python.js +1 -130
- package/filters/rust.js +1 -115
- package/filters/shell.js +1 -395
- package/hooks/claude-hook.js +1 -79
- package/mcp.js +1 -132
- package/package.json +1 -1
- package/proxy-conv.js +1 -181
- package/proxy-daemon.js +1 -382
- 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/shell.js
CHANGED
|
@@ -1,395 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.filterLs = filterLs;
|
|
37
|
-
exports.filterTree = filterTree;
|
|
38
|
-
exports.filterCat = filterCat;
|
|
39
|
-
exports.filterGrep = filterGrep;
|
|
40
|
-
exports.filterFind = filterFind;
|
|
41
|
-
const path = __importStar(require("path"));
|
|
42
|
-
const generic_1 = require("./generic");
|
|
43
|
-
const tracker_1 = require("../tracker");
|
|
44
|
-
function isFeatureEnabled(key) {
|
|
45
|
-
try {
|
|
46
|
-
const config = tracker_1.tracker.getConfig();
|
|
47
|
-
const fe = config.features_enabled;
|
|
48
|
-
if (!fe || fe[key] === undefined)
|
|
49
|
-
return true;
|
|
50
|
-
return fe[key] !== false;
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
const LOCK_FILES = [
|
|
57
|
-
'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'Cargo.lock',
|
|
58
|
-
'go.sum', 'poetry.lock', 'composer.lock', 'Gemfile.lock', 'bun.lockb'
|
|
59
|
-
];
|
|
60
|
-
const BINARY_EXTENSIONS = [
|
|
61
|
-
'.min.js', '.min.css', '.map', '.wasm',
|
|
62
|
-
'.png', '.jpg', '.jpeg', '.gif', '.ico', '.bmp', '.webp', '.svg',
|
|
63
|
-
'.pdf', '.zip', '.tar.gz', '.tgz', '.gz', '.bz2', '.7z', '.rar',
|
|
64
|
-
'.exe', '.dll', '.so', '.dylib', '.bin', '.dat',
|
|
65
|
-
'.sqlite', '.db', '.sqlite3',
|
|
66
|
-
'.woff', '.woff2', '.ttf', '.eot', '.otf',
|
|
67
|
-
'.mp3', '.mp4', '.wav', '.avi', '.mov', '.webm',
|
|
68
|
-
'.pyc', '.pyo', '.class', '.o', '.obj'
|
|
69
|
-
];
|
|
70
|
-
function extractFilename(command) {
|
|
71
|
-
const parts = command.trim().split(/\s+/);
|
|
72
|
-
for (let i = 1; i < parts.length; i++) {
|
|
73
|
-
if (!parts[i].startsWith('-'))
|
|
74
|
-
return parts[i];
|
|
75
|
-
}
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
function filterLockFile(stdout, filename) {
|
|
79
|
-
try {
|
|
80
|
-
const base = path.basename(filename).toLowerCase();
|
|
81
|
-
if (!LOCK_FILES.some(lf => base === lf.toLowerCase()))
|
|
82
|
-
return null;
|
|
83
|
-
const size = stdout.length;
|
|
84
|
-
let depCount = 0;
|
|
85
|
-
if (base === 'package-lock.json') {
|
|
86
|
-
try {
|
|
87
|
-
const parsed = JSON.parse(stdout);
|
|
88
|
-
depCount = Object.keys(parsed.packages || parsed.dependencies || {}).length;
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
depCount = (stdout.match(/"resolved":/g) || []).length;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else if (base === 'yarn.lock') {
|
|
95
|
-
depCount = (stdout.match(/^"?[^#\s][^:]*:$/gm) || []).length;
|
|
96
|
-
}
|
|
97
|
-
else if (base === 'cargo.lock' || base === 'poetry.lock') {
|
|
98
|
-
depCount = (stdout.match(/\[\[package\]\]/g) || []).length;
|
|
99
|
-
}
|
|
100
|
-
else if (base === 'go.sum') {
|
|
101
|
-
depCount = Math.floor(stdout.split('\n').filter(l => l.trim()).length / 2);
|
|
102
|
-
}
|
|
103
|
-
else if (base === 'composer.lock') {
|
|
104
|
-
try {
|
|
105
|
-
depCount = JSON.parse(stdout).packages?.length || 0;
|
|
106
|
-
}
|
|
107
|
-
catch { }
|
|
108
|
-
}
|
|
109
|
-
else if (base === 'pnpm-lock.yaml') {
|
|
110
|
-
depCount = (stdout.match(/^\s{2}['"@a-z]/gm) || []).length;
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
depCount = stdout.split('\n').filter(l => l.trim()).length;
|
|
114
|
-
}
|
|
115
|
-
return `[lock file] ${path.basename(filename)}: ${depCount} dependencies, ${size.toLocaleString()} chars (content omitted — lock files are not useful for LLM context)`;
|
|
116
|
-
}
|
|
117
|
-
catch {
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
function filterBinaryOrMinified(stdout, filename) {
|
|
122
|
-
try {
|
|
123
|
-
if (filename) {
|
|
124
|
-
const lower = filename.toLowerCase();
|
|
125
|
-
for (const ext of BINARY_EXTENSIONS) {
|
|
126
|
-
if (lower.endsWith(ext)) {
|
|
127
|
-
return `[binary/minified file] ${path.basename(filename)}, ${stdout.length.toLocaleString()} chars, type: ${ext} (content omitted — not useful for LLM context)`;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
const sample = stdout.substring(0, 1000);
|
|
132
|
-
let nullCount = 0;
|
|
133
|
-
for (let i = 0; i < sample.length; i++) {
|
|
134
|
-
if (sample.charCodeAt(i) === 0)
|
|
135
|
-
nullCount++;
|
|
136
|
-
}
|
|
137
|
-
if (nullCount > 0) {
|
|
138
|
-
return `[binary file] ${stdout.length.toLocaleString()} chars (contains null bytes — binary content omitted)`;
|
|
139
|
-
}
|
|
140
|
-
let nonPrintable = 0;
|
|
141
|
-
for (let i = 0; i < sample.length; i++) {
|
|
142
|
-
const code = sample.charCodeAt(i);
|
|
143
|
-
if (code < 32 && code !== 10 && code !== 13 && code !== 9)
|
|
144
|
-
nonPrintable++;
|
|
145
|
-
}
|
|
146
|
-
if (sample.length > 100 && nonPrintable > sample.length * 0.1) {
|
|
147
|
-
return `[binary file] ${stdout.length.toLocaleString()} chars (high non-printable ratio — content omitted)`;
|
|
148
|
-
}
|
|
149
|
-
const lines = stdout.split('\n');
|
|
150
|
-
if (lines.length <= 3 && stdout.length > 5000) {
|
|
151
|
-
return `[minified file] ${stdout.length.toLocaleString()} chars across ${lines.length} line(s) (content omitted — not human-readable)`;
|
|
152
|
-
}
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function filterJsonMinify(stdout) {
|
|
160
|
-
try {
|
|
161
|
-
const trimmed = stdout.trim();
|
|
162
|
-
if (!trimmed.startsWith('{') && !trimmed.startsWith('['))
|
|
163
|
-
return null;
|
|
164
|
-
const lines = trimmed.split('\n');
|
|
165
|
-
if (lines.length <= 20)
|
|
166
|
-
return null;
|
|
167
|
-
const parsed = JSON.parse(trimmed);
|
|
168
|
-
const minified = JSON.stringify(parsed);
|
|
169
|
-
if (minified.length < trimmed.length)
|
|
170
|
-
return minified;
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
catch {
|
|
174
|
-
return null;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
function filterLs(stdout) {
|
|
178
|
-
const lines = stdout.split('\n').filter(l => l.trim().length > 0);
|
|
179
|
-
if (lines.length === 0)
|
|
180
|
-
return "Empty directory";
|
|
181
|
-
if (lines.length <= 30)
|
|
182
|
-
return stdout.trim();
|
|
183
|
-
const dirs = [];
|
|
184
|
-
const files = [];
|
|
185
|
-
for (const line of lines) {
|
|
186
|
-
const trimmed = line.trim();
|
|
187
|
-
if (trimmed.startsWith('total ') || trimmed.startsWith('d') && trimmed.includes('..'))
|
|
188
|
-
continue;
|
|
189
|
-
if (trimmed.endsWith('/') || (trimmed.startsWith('d') && trimmed.includes(' '))) {
|
|
190
|
-
dirs.push(trimmed);
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
files.push(trimmed);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
const result = [];
|
|
197
|
-
if (dirs.length > 0) {
|
|
198
|
-
if (dirs.length <= 15) {
|
|
199
|
-
result.push(...dirs);
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
result.push(...dirs.slice(0, 10));
|
|
203
|
-
result.push(`... +${dirs.length - 10} more directories`);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
if (files.length > 0) {
|
|
207
|
-
if (files.length <= 20) {
|
|
208
|
-
result.push(...files);
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
result.push(...files.slice(0, 15));
|
|
212
|
-
result.push(`... +${files.length - 15} more files`);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
result.push(`\n(${dirs.length} directories, ${files.length} files)`);
|
|
216
|
-
return result.join('\n');
|
|
217
|
-
}
|
|
218
|
-
function filterTree(stdout) {
|
|
219
|
-
const lines = stdout.split('\n');
|
|
220
|
-
if (lines.length <= 50)
|
|
221
|
-
return stdout.trim();
|
|
222
|
-
const result = [];
|
|
223
|
-
let depth0Count = 0;
|
|
224
|
-
let totalFiles = 0;
|
|
225
|
-
let totalDirs = 0;
|
|
226
|
-
for (const line of lines) {
|
|
227
|
-
const summaryMatch = line.match(/(\d+)\s+director/);
|
|
228
|
-
const fileMatch = line.match(/(\d+)\s+file/);
|
|
229
|
-
if (summaryMatch)
|
|
230
|
-
totalDirs = parseInt(summaryMatch[1]);
|
|
231
|
-
if (fileMatch)
|
|
232
|
-
totalFiles = parseInt(fileMatch[1]);
|
|
233
|
-
const depth = (line.match(/^[│├└\s─]+/) || [''])[0].length;
|
|
234
|
-
if (depth <= 4) {
|
|
235
|
-
result.push(line);
|
|
236
|
-
depth0Count++;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
if (lines.length > result.length) {
|
|
240
|
-
result.push(`\n... (${totalDirs} directories, ${totalFiles} files total — deep entries truncated)`);
|
|
241
|
-
}
|
|
242
|
-
return result.join('\n');
|
|
243
|
-
}
|
|
244
|
-
function filterCat(stdout, command = '') {
|
|
245
|
-
const filename = extractFilename(command);
|
|
246
|
-
try {
|
|
247
|
-
if (filename && isFeatureEnabled('lock')) {
|
|
248
|
-
const lockResult = filterLockFile(stdout, filename);
|
|
249
|
-
if (lockResult)
|
|
250
|
-
return lockResult;
|
|
251
|
-
}
|
|
252
|
-
if (isFeatureEnabled('binary')) {
|
|
253
|
-
const binaryResult = filterBinaryOrMinified(stdout, filename);
|
|
254
|
-
if (binaryResult)
|
|
255
|
-
return binaryResult;
|
|
256
|
-
}
|
|
257
|
-
if (isFeatureEnabled('json_crusher')) {
|
|
258
|
-
const crushed = (0, generic_1.smartCrushJson)(stdout);
|
|
259
|
-
if (crushed)
|
|
260
|
-
return crushed;
|
|
261
|
-
}
|
|
262
|
-
const jsonResult = filterJsonMinify(stdout);
|
|
263
|
-
if (jsonResult)
|
|
264
|
-
return jsonResult;
|
|
265
|
-
if (filename && isFeatureEnabled('skeleton')) {
|
|
266
|
-
const ext = path.extname(filename).toLowerCase();
|
|
267
|
-
const codeExts = ['.ts', '.js', '.tsx', '.jsx', '.py', '.go', '.rs', '.java', '.c', '.cpp', '.cs', '.rb', '.swift', '.kt'];
|
|
268
|
-
if (codeExts.includes(ext)) {
|
|
269
|
-
const lines = stdout.split('\n');
|
|
270
|
-
if (lines.length > 100) {
|
|
271
|
-
const skeleton = [];
|
|
272
|
-
skeleton.push(`[code skeleton] ${path.basename(filename)} (${lines.length} lines)`);
|
|
273
|
-
skeleton.push('');
|
|
274
|
-
for (const line of lines) {
|
|
275
|
-
const t = line.trim();
|
|
276
|
-
if (t.startsWith('import ') || t.startsWith('from ') || t.startsWith('require(') ||
|
|
277
|
-
t.match(/=\s*require\(/) || t.startsWith('#include ') || t.startsWith('use ') ||
|
|
278
|
-
t.startsWith('package ')) {
|
|
279
|
-
skeleton.push(line);
|
|
280
|
-
}
|
|
281
|
-
else if (t.match(/^(export\s+)?(async\s+)?function\s+/) || t.match(/^(export\s+)?(default\s+)?class\s+/) ||
|
|
282
|
-
t.match(/^(export\s+)?(type|interface|enum)\s+/) || t.match(/^(async\s+)?def\s+/) ||
|
|
283
|
-
t.match(/^func\s+/) || t.match(/^type\s+\w+\s+(struct|interface)/) ||
|
|
284
|
-
t.match(/^(pub\s+)?(async\s+)?fn\s+/) || t.match(/^(pub\s+)?(struct|enum|trait|impl)\s+/) ||
|
|
285
|
-
t.match(/^(public|private|protected|static)\s+/)) {
|
|
286
|
-
skeleton.push(line);
|
|
287
|
-
}
|
|
288
|
-
else if (t.startsWith('export ') && !t.includes('=>') && t.length < 120) {
|
|
289
|
-
skeleton.push(line);
|
|
290
|
-
}
|
|
291
|
-
else if (t.startsWith('@') && !t.startsWith('@param') && !t.startsWith('@return')) {
|
|
292
|
-
skeleton.push(line);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
skeleton.push('');
|
|
296
|
-
skeleton.push(`(${lines.length} lines total, ${skeleton.length - 2} structural lines shown)`);
|
|
297
|
-
const skeletonResult = skeleton.join('\n');
|
|
298
|
-
if (skeletonResult.length < stdout.length)
|
|
299
|
-
return skeletonResult;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
catch {
|
|
305
|
-
}
|
|
306
|
-
let processed = (0, generic_1.collapseWhitespace)(stdout);
|
|
307
|
-
if (filename) {
|
|
308
|
-
const ext = path.extname(filename).toLowerCase();
|
|
309
|
-
processed = (0, generic_1.stripComments)(processed, ext);
|
|
310
|
-
}
|
|
311
|
-
const lines = processed.split('\n');
|
|
312
|
-
if (lines.length <= 100)
|
|
313
|
-
return processed;
|
|
314
|
-
const result = [];
|
|
315
|
-
result.push(...lines.slice(0, 50));
|
|
316
|
-
result.push(`\n... [${lines.length - 80} lines truncated] ...\n`);
|
|
317
|
-
result.push(...lines.slice(-30));
|
|
318
|
-
result.push(`\n(${lines.length} lines total)`);
|
|
319
|
-
return result.join('\n');
|
|
320
|
-
}
|
|
321
|
-
function filterGrep(stdout) {
|
|
322
|
-
const lines = stdout.split('\n').filter(l => l.trim().length > 0);
|
|
323
|
-
if (lines.length === 0)
|
|
324
|
-
return "No matches found";
|
|
325
|
-
if (lines.length <= 50)
|
|
326
|
-
return stdout.trim();
|
|
327
|
-
const fileGroups = {};
|
|
328
|
-
const ungrouped = [];
|
|
329
|
-
for (const line of lines) {
|
|
330
|
-
const colonIdx = line.indexOf(':');
|
|
331
|
-
if (colonIdx > 0 && colonIdx < 200) {
|
|
332
|
-
const prefix = line.substring(0, colonIdx);
|
|
333
|
-
if (prefix.includes('/') || prefix.includes('\\') || prefix.includes('.')) {
|
|
334
|
-
if (!fileGroups[prefix])
|
|
335
|
-
fileGroups[prefix] = [];
|
|
336
|
-
fileGroups[prefix].push(line.substring(colonIdx + 1).trim());
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
ungrouped.push(line);
|
|
341
|
-
}
|
|
342
|
-
const result = [];
|
|
343
|
-
const fileKeys = Object.keys(fileGroups);
|
|
344
|
-
if (fileKeys.length > 0) {
|
|
345
|
-
const maxFiles = 20;
|
|
346
|
-
const shownFiles = fileKeys.slice(0, maxFiles);
|
|
347
|
-
for (const file of shownFiles) {
|
|
348
|
-
const matches = fileGroups[file];
|
|
349
|
-
if (matches.length <= 3) {
|
|
350
|
-
for (const m of matches) {
|
|
351
|
-
result.push(`${file}: ${m}`);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
else {
|
|
355
|
-
result.push(`${file}: ${matches[0]}`);
|
|
356
|
-
result.push(`${file}: ... (${matches.length} matches in this file)`);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
if (fileKeys.length > maxFiles) {
|
|
360
|
-
result.push(`... +${fileKeys.length - maxFiles} more files with matches`);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
if (ungrouped.length > 0) {
|
|
364
|
-
const maxUngrouped = 30;
|
|
365
|
-
result.push(...ungrouped.slice(0, maxUngrouped));
|
|
366
|
-
if (ungrouped.length > maxUngrouped) {
|
|
367
|
-
result.push(`... +${ungrouped.length - maxUngrouped} more matches`);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
const totalMatches = lines.length;
|
|
371
|
-
result.push(`\n(${totalMatches} matches across ${fileKeys.length || '?'} files)`);
|
|
372
|
-
return result.join('\n');
|
|
373
|
-
}
|
|
374
|
-
function filterFind(stdout) {
|
|
375
|
-
const lines = stdout.split('\n').filter(l => l.trim().length > 0);
|
|
376
|
-
if (lines.length === 0)
|
|
377
|
-
return "No files found";
|
|
378
|
-
if (lines.length <= 50)
|
|
379
|
-
return stdout.trim();
|
|
380
|
-
const dirGroups = {};
|
|
381
|
-
for (const line of lines) {
|
|
382
|
-
const dir = path.dirname(line.trim()) || '.';
|
|
383
|
-
dirGroups[dir] = (dirGroups[dir] || 0) + 1;
|
|
384
|
-
}
|
|
385
|
-
const sorted = Object.entries(dirGroups).sort((a, b) => b[1] - a[1]);
|
|
386
|
-
const result = [`${lines.length} files found across ${sorted.length} directories`, ''];
|
|
387
|
-
const maxDirs = 30;
|
|
388
|
-
for (const [dir, count] of sorted.slice(0, maxDirs)) {
|
|
389
|
-
result.push(` ${dir}/ (${count} files)`);
|
|
390
|
-
}
|
|
391
|
-
if (sorted.length > maxDirs) {
|
|
392
|
-
result.push(` ... +${sorted.length - maxDirs} more directories`);
|
|
393
|
-
}
|
|
394
|
-
return result.join('\n');
|
|
395
|
-
}
|
|
1
|
+
'use strict';const a0_0x1cce56=a0_0x3e23;(function(_0x32dfee,_0x474652){const _0x2a3af6=a0_0x3e23,_0x492530=_0x32dfee();while(!![]){try{const _0x2d6bf7=-parseInt(_0x2a3af6(0x11e))/0x1+-parseInt(_0x2a3af6(0x14b))/0x2*(parseInt(_0x2a3af6(0xc4))/0x3)+parseInt(_0x2a3af6(0x109))/0x4+parseInt(_0x2a3af6(0x142))/0x5+parseInt(_0x2a3af6(0x125))/0x6*(parseInt(_0x2a3af6(0xd7))/0x7)+parseInt(_0x2a3af6(0xe8))/0x8*(-parseInt(_0x2a3af6(0x10e))/0x9)+-parseInt(_0x2a3af6(0xfb))/0xa*(-parseInt(_0x2a3af6(0xc3))/0xb);if(_0x2d6bf7===_0x474652)break;else _0x492530['push'](_0x492530['shift']());}catch(_0x2fa67e){_0x492530['push'](_0x492530['shift']());}}}(a0_0x20f1,0x4e4d1));var __createBinding=this&&this[a0_0x1cce56(0xd5)]||(Object[a0_0x1cce56(0x105)]?function(_0x55118a,_0x11d2e3,_0x30b69c,_0x3ced2d){const _0x39b3b8=a0_0x1cce56;if(_0x3ced2d===undefined)_0x3ced2d=_0x30b69c;var _0x1e27a9=Object[_0x39b3b8(0xc5)](_0x11d2e3,_0x30b69c);(!_0x1e27a9||(_0x39b3b8(0xcb)in _0x1e27a9?!_0x11d2e3['__esModule']:_0x1e27a9[_0x39b3b8(0x122)]||_0x1e27a9[_0x39b3b8(0x13c)]))&&(_0x1e27a9={'enumerable':!![],'get':function(){return _0x11d2e3[_0x30b69c];}}),Object[_0x39b3b8(0x117)](_0x55118a,_0x3ced2d,_0x1e27a9);}:function(_0x4ef868,_0x386bd0,_0x41e2c0,_0x5944e4){if(_0x5944e4===undefined)_0x5944e4=_0x41e2c0;_0x4ef868[_0x5944e4]=_0x386bd0[_0x41e2c0];}),__setModuleDefault=this&&this[a0_0x1cce56(0x118)]||(Object['create']?function(_0x5001a9,_0x456331){const _0x5625e0=a0_0x1cce56;Object[_0x5625e0(0x117)](_0x5001a9,'default',{'enumerable':!![],'value':_0x456331});}:function(_0x3355ce,_0x5af9fe){_0x3355ce['default']=_0x5af9fe;}),__importStar=this&&this['__importStar']||(function(){var _0x209bab=function(_0x4ead27){return _0x209bab=Object['getOwnPropertyNames']||function(_0x6b9c81){const _0x3f16e6=a0_0x3e23;var _0x2c3ddc=[];for(var _0x399498 in _0x6b9c81)if(Object[_0x3f16e6(0x13f)][_0x3f16e6(0xc2)]['call'](_0x6b9c81,_0x399498))_0x2c3ddc[_0x2c3ddc['length']]=_0x399498;return _0x2c3ddc;},_0x209bab(_0x4ead27);};return function(_0xfc58c1){const _0x593741=a0_0x3e23;if(_0xfc58c1&&_0xfc58c1[_0x593741(0xf9)])return _0xfc58c1;var _0x266f92={};if(_0xfc58c1!=null){for(var _0x3a4e64=_0x209bab(_0xfc58c1),_0x26d648=0x0;_0x26d648<_0x3a4e64[_0x593741(0x147)];_0x26d648++)if(_0x3a4e64[_0x26d648]!=='default')__createBinding(_0x266f92,_0xfc58c1,_0x3a4e64[_0x26d648]);}return __setModuleDefault(_0x266f92,_0xfc58c1),_0x266f92;};}());Object[a0_0x1cce56(0x117)](exports,'__esModule',{'value':!![]}),exports[a0_0x1cce56(0x127)]=filterLs,exports[a0_0x1cce56(0x10c)]=filterTree,exports[a0_0x1cce56(0xd9)]=filterCat,exports[a0_0x1cce56(0x115)]=filterGrep,exports['filterFind']=filterFind;const path=__importStar(require(a0_0x1cce56(0x103))),generic_1=require('./generic'),tracker_1=require('../tracker');function isFeatureEnabled(_0x26f05c){const _0x459e36=a0_0x1cce56;try{const _0x14494f=tracker_1[_0x459e36(0x11a)][_0x459e36(0xec)](),_0x1c5cef=_0x14494f[_0x459e36(0xf8)];if(!_0x1c5cef||_0x1c5cef[_0x26f05c]===undefined)return!![];return _0x1c5cef[_0x26f05c]!==![];}catch{return!![];}}const LOCK_FILES=[a0_0x1cce56(0xf3),'yarn.lock',a0_0x1cce56(0x100),a0_0x1cce56(0x152),a0_0x1cce56(0xd3),a0_0x1cce56(0xd4),a0_0x1cce56(0x12e),a0_0x1cce56(0xfd),a0_0x1cce56(0x143)],BINARY_EXTENSIONS=[a0_0x1cce56(0x131),a0_0x1cce56(0x121),a0_0x1cce56(0xea),a0_0x1cce56(0x14e),a0_0x1cce56(0x116),'.jpg',a0_0x1cce56(0xd6),'.gif',a0_0x1cce56(0xdf),a0_0x1cce56(0xca),a0_0x1cce56(0x14c),'.svg','.pdf','.zip',a0_0x1cce56(0xe5),a0_0x1cce56(0xf1),a0_0x1cce56(0x14d),a0_0x1cce56(0x13d),a0_0x1cce56(0x155),a0_0x1cce56(0x130),a0_0x1cce56(0x154),a0_0x1cce56(0x12b),'.so','.dylib',a0_0x1cce56(0x123),a0_0x1cce56(0x110),'.sqlite',a0_0x1cce56(0xdb),a0_0x1cce56(0xcf),a0_0x1cce56(0xdd),'.woff2',a0_0x1cce56(0x12c),'.eot',a0_0x1cce56(0x12a),'.mp3',a0_0x1cce56(0x145),'.wav',a0_0x1cce56(0x104),a0_0x1cce56(0xfe),a0_0x1cce56(0x12d),a0_0x1cce56(0x124),'.pyo',a0_0x1cce56(0x158),'.o','.obj'];function extractFilename(_0x11b4c5){const _0x2015cd=a0_0x1cce56,_0x53749f=_0x11b4c5[_0x2015cd(0x10a)]()['split'](/\s+/);for(let _0x12bd90=0x1;_0x12bd90<_0x53749f[_0x2015cd(0x147)];_0x12bd90++){if(!_0x53749f[_0x12bd90]['startsWith']('-'))return _0x53749f[_0x12bd90];}return null;}function filterLockFile(_0x15ed6a,_0x277ea5){const _0x1d9b91=a0_0x1cce56;try{const _0x8433c5=path[_0x1d9b91(0x137)](_0x277ea5)[_0x1d9b91(0xcd)]();if(!LOCK_FILES[_0x1d9b91(0x126)](_0x5789b8=>_0x8433c5===_0x5789b8[_0x1d9b91(0xcd)]()))return null;const _0x181ee8=_0x15ed6a['length'];let _0x3700cb=0x0;if(_0x8433c5===_0x1d9b91(0xf3))try{const _0x4068b7=JSON[_0x1d9b91(0x153)](_0x15ed6a);_0x3700cb=Object[_0x1d9b91(0x101)](_0x4068b7[_0x1d9b91(0x151)]||_0x4068b7[_0x1d9b91(0x136)]||{})['length'];}catch{_0x3700cb=(_0x15ed6a[_0x1d9b91(0x132)](/"resolved":/g)||[])[_0x1d9b91(0x147)];}else{if(_0x8433c5===_0x1d9b91(0x119))_0x3700cb=(_0x15ed6a[_0x1d9b91(0x132)](/^"?[^#\s][^:]*:$/gm)||[])['length'];else{if(_0x8433c5===_0x1d9b91(0x159)||_0x8433c5===_0x1d9b91(0xd4))_0x3700cb=(_0x15ed6a[_0x1d9b91(0x132)](/\[\[package\]\]/g)||[])[_0x1d9b91(0x147)];else{if(_0x8433c5===_0x1d9b91(0xd3))_0x3700cb=Math[_0x1d9b91(0xf4)](_0x15ed6a[_0x1d9b91(0xe2)]('\x0a')[_0x1d9b91(0x141)](_0x7d28c3=>_0x7d28c3[_0x1d9b91(0x10a)]())[_0x1d9b91(0x147)]/0x2);else{if(_0x8433c5===_0x1d9b91(0x12e))try{_0x3700cb=JSON[_0x1d9b91(0x153)](_0x15ed6a)[_0x1d9b91(0x151)]?.[_0x1d9b91(0x147)]||0x0;}catch{}else _0x8433c5===_0x1d9b91(0x100)?_0x3700cb=(_0x15ed6a[_0x1d9b91(0x132)](/^\s{2}['"@a-z]/gm)||[])[_0x1d9b91(0x147)]:_0x3700cb=_0x15ed6a[_0x1d9b91(0xe2)]('\x0a')['filter'](_0x176dc1=>_0x176dc1['trim']())['length'];}}}}return _0x1d9b91(0x10f)+path['basename'](_0x277ea5)+':\x20'+_0x3700cb+_0x1d9b91(0x128)+_0x181ee8[_0x1d9b91(0x146)]()+_0x1d9b91(0xda);}catch{return null;}}function a0_0x3e23(_0x4beaef,_0x1468d1){const _0x20f19e=a0_0x20f1();return a0_0x3e23=function(_0x3e231e,_0x47d3e2){_0x3e231e=_0x3e231e-0xbf;let _0x42caf8=_0x20f19e[_0x3e231e];return _0x42caf8;},a0_0x3e23(_0x4beaef,_0x1468d1);}function filterBinaryOrMinified(_0x2aa3fe,_0x29502a){const _0x17f135=a0_0x1cce56;try{if(_0x29502a){const _0x742ffc=_0x29502a[_0x17f135(0xcd)]();for(const _0x6a733d of BINARY_EXTENSIONS){if(_0x742ffc[_0x17f135(0x14a)](_0x6a733d))return _0x17f135(0xc8)+path[_0x17f135(0x137)](_0x29502a)+',\x20'+_0x2aa3fe['length']['toLocaleString']()+_0x17f135(0x114)+_0x6a733d+'\x20(content\x20omitted\x20—\x20not\x20useful\x20for\x20LLM\x20context)';}}const _0x520ae2=_0x2aa3fe[_0x17f135(0x106)](0x0,0x3e8);let _0x195884=0x0;for(let _0x58370e=0x0;_0x58370e<_0x520ae2[_0x17f135(0x147)];_0x58370e++){if(_0x520ae2['charCodeAt'](_0x58370e)===0x0)_0x195884++;}if(_0x195884>0x0)return _0x17f135(0xd8)+_0x2aa3fe['length']['toLocaleString']()+_0x17f135(0x120);let _0x4cb310=0x0;for(let _0x2a85d2=0x0;_0x2a85d2<_0x520ae2[_0x17f135(0x147)];_0x2a85d2++){const _0x4fc427=_0x520ae2[_0x17f135(0x10d)](_0x2a85d2);if(_0x4fc427<0x20&&_0x4fc427!==0xa&&_0x4fc427!==0xd&&_0x4fc427!==0x9)_0x4cb310++;}if(_0x520ae2[_0x17f135(0x147)]>0x64&&_0x4cb310>_0x520ae2[_0x17f135(0x147)]*0.1)return _0x17f135(0xd8)+_0x2aa3fe[_0x17f135(0x147)][_0x17f135(0x146)]()+_0x17f135(0x138);const _0x592b46=_0x2aa3fe[_0x17f135(0xe2)]('\x0a');if(_0x592b46[_0x17f135(0x147)]<=0x3&&_0x2aa3fe[_0x17f135(0x147)]>0x1388)return'[minified\x20file]\x20'+_0x2aa3fe[_0x17f135(0x147)]['toLocaleString']()+_0x17f135(0xfa)+_0x592b46[_0x17f135(0x147)]+_0x17f135(0x139);return null;}catch{return null;}}function a0_0x20f1(){const _0x57d8dd=['.go','prototype','indexOf','filter','955375KZgTvE','bun.lockb','\x20matches\x20in\x20this\x20file)','.mp4','toLocaleString','length','\x20directories','\x20files\x20found\x20across\x20','endsWith','86vHZAhX','.webp','.gz','.wasm','stringify','\x20\x20...\x20+','packages','Cargo.lock','parse','.exe','.7z','\x20structural\x20lines\x20shown)','lock','.class','cargo.lock','collapseWhitespace','\x20more\x20files\x20with\x20matches','No\x20files\x20found','hasOwnProperty','8514sRsNtE','33807pWjsKL','getOwnPropertyDescriptor','sort','binary','[binary/minified\x20file]\x20','startsWith','.bmp','get','...\x20+','toLowerCase','.jsx','.sqlite3','.swift','\x20files)','includes','go.sum','poetry.lock','__createBinding','.jpeg','28XozTds','[binary\x20file]\x20','filterCat','\x20chars\x20(content\x20omitted\x20—\x20lock\x20files\x20are\x20not\x20useful\x20for\x20LLM\x20context)','.db','.tsx','.woff','\x20files\x20total\x20—\x20deep\x20entries\x20truncated)','.ico','entries','from\x20','split','export\x20','\x0a...\x20[','.tar.gz',':\x20...\x20(','.cs','8QXqfUb','require(','.map','\x20matches\x20across\x20','getConfig','use\x20','\x20lines)','\x20more\x20files','\x0a...\x20(','.tgz','[code\x20skeleton]\x20','package-lock.json','floor','join','@param','.java','features_enabled','__esModule','\x20chars\x20across\x20','3990hoVDxv','@return','Gemfile.lock','.mov','.rs','pnpm-lock.yaml','keys','push','path','.avi','create','substring','#include\x20','json_crusher','2438852fwSnPV','trim','No\x20matches\x20found','filterTree','charCodeAt','1441197ZwicHL','[lock\x20file]\x20','.dat','\x20directories,\x20','\x20more\x20directories','skeleton','\x20chars,\x20type:\x20','filterGrep','.png','defineProperty','__setModuleDefault','yarn.lock','tracker','extname','.kt','\x20more\x20matches','225309JBHGXt','.cpp','\x20chars\x20(contains\x20null\x20bytes\x20—\x20binary\x20content\x20omitted)','.min.css','writable','.bin','.pyc','121674cXDhwu','some','filterLs','\x20dependencies,\x20','\x20lines\x20truncated]\x20...\x0a','.otf','.dll','.ttf','.webm','composer.lock','/\x20(','.rar','.min.js','match','import\x20','stripComments','slice','dependencies','basename','\x20chars\x20(high\x20non-printable\x20ratio\x20—\x20content\x20omitted)','\x20line(s)\x20(content\x20omitted\x20—\x20not\x20human-readable)','.rb','smartCrushJson','configurable','.bz2'];a0_0x20f1=function(){return _0x57d8dd;};return a0_0x20f1();}function filterJsonMinify(_0xc1628e){const _0x193774=a0_0x1cce56;try{const _0x4d1573=_0xc1628e[_0x193774(0x10a)]();if(!_0x4d1573['startsWith']('{')&&!_0x4d1573[_0x193774(0xc9)]('['))return null;const _0x44a2ec=_0x4d1573[_0x193774(0xe2)]('\x0a');if(_0x44a2ec[_0x193774(0x147)]<=0x14)return null;const _0x3e6989=JSON[_0x193774(0x153)](_0x4d1573),_0xaeee0a=JSON[_0x193774(0x14f)](_0x3e6989);if(_0xaeee0a[_0x193774(0x147)]<_0x4d1573[_0x193774(0x147)])return _0xaeee0a;return null;}catch{return null;}}function filterLs(_0x16cb91){const _0x484d40=a0_0x1cce56,_0x30e324=_0x16cb91[_0x484d40(0xe2)]('\x0a')['filter'](_0x2057cc=>_0x2057cc[_0x484d40(0x10a)]()[_0x484d40(0x147)]>0x0);if(_0x30e324[_0x484d40(0x147)]===0x0)return'Empty\x20directory';if(_0x30e324[_0x484d40(0x147)]<=0x1e)return _0x16cb91[_0x484d40(0x10a)]();const _0x4641cb=[],_0x233cff=[];for(const _0xd40203 of _0x30e324){const _0x1a2532=_0xd40203[_0x484d40(0x10a)]();if(_0x1a2532['startsWith']('total\x20')||_0x1a2532[_0x484d40(0xc9)]('d')&&_0x1a2532[_0x484d40(0xd2)]('..'))continue;_0x1a2532['endsWith']('/')||_0x1a2532[_0x484d40(0xc9)]('d')&&_0x1a2532[_0x484d40(0xd2)]('\x20')?_0x4641cb[_0x484d40(0x102)](_0x1a2532):_0x233cff[_0x484d40(0x102)](_0x1a2532);}const _0x420416=[];return _0x4641cb[_0x484d40(0x147)]>0x0&&(_0x4641cb[_0x484d40(0x147)]<=0xf?_0x420416['push'](..._0x4641cb):(_0x420416['push'](..._0x4641cb[_0x484d40(0x135)](0x0,0xa)),_0x420416[_0x484d40(0x102)](_0x484d40(0xcc)+(_0x4641cb[_0x484d40(0x147)]-0xa)+_0x484d40(0x112)))),_0x233cff['length']>0x0&&(_0x233cff[_0x484d40(0x147)]<=0x14?_0x420416[_0x484d40(0x102)](..._0x233cff):(_0x420416['push'](..._0x233cff['slice'](0x0,0xf)),_0x420416[_0x484d40(0x102)]('...\x20+'+(_0x233cff[_0x484d40(0x147)]-0xf)+_0x484d40(0xef)))),_0x420416[_0x484d40(0x102)]('\x0a('+_0x4641cb[_0x484d40(0x147)]+_0x484d40(0x111)+_0x233cff['length']+_0x484d40(0xd1)),_0x420416[_0x484d40(0xf5)]('\x0a');}function filterTree(_0x16677d){const _0x387101=a0_0x1cce56,_0x5c2153=_0x16677d['split']('\x0a');if(_0x5c2153[_0x387101(0x147)]<=0x32)return _0x16677d[_0x387101(0x10a)]();const _0x23c197=[];let _0x41346a=0x0,_0x165639=0x0,_0x304fdd=0x0;for(const _0x2eb1f9 of _0x5c2153){const _0x27c324=_0x2eb1f9[_0x387101(0x132)](/(\d+)\s+director/),_0x3665e5=_0x2eb1f9['match'](/(\d+)\s+file/);if(_0x27c324)_0x304fdd=parseInt(_0x27c324[0x1]);if(_0x3665e5)_0x165639=parseInt(_0x3665e5[0x1]);const _0x2ce2e9=(_0x2eb1f9['match'](/^[│├└\s─]+/)||[''])[0x0][_0x387101(0x147)];_0x2ce2e9<=0x4&&(_0x23c197['push'](_0x2eb1f9),_0x41346a++);}return _0x5c2153['length']>_0x23c197[_0x387101(0x147)]&&_0x23c197[_0x387101(0x102)](_0x387101(0xf0)+_0x304fdd+_0x387101(0x111)+_0x165639+_0x387101(0xde)),_0x23c197[_0x387101(0xf5)]('\x0a');}function filterCat(_0x32471e,_0x43944f=''){const _0x429dea=a0_0x1cce56,_0x539212=extractFilename(_0x43944f);try{if(_0x539212&&isFeatureEnabled(_0x429dea(0x157))){const _0x269d26=filterLockFile(_0x32471e,_0x539212);if(_0x269d26)return _0x269d26;}if(isFeatureEnabled(_0x429dea(0xc7))){const _0x45bea4=filterBinaryOrMinified(_0x32471e,_0x539212);if(_0x45bea4)return _0x45bea4;}if(isFeatureEnabled(_0x429dea(0x108))){const _0x5875dc=(0x0,generic_1[_0x429dea(0x13b)])(_0x32471e);if(_0x5875dc)return _0x5875dc;}const _0x3faece=filterJsonMinify(_0x32471e);if(_0x3faece)return _0x3faece;if(_0x539212&&isFeatureEnabled(_0x429dea(0x113))){const _0xa268f7=path[_0x429dea(0x11b)](_0x539212)[_0x429dea(0xcd)](),_0x20de49=['.ts','.js',_0x429dea(0xdc),_0x429dea(0xce),'.py',_0x429dea(0x13e),_0x429dea(0xff),_0x429dea(0xf7),'.c',_0x429dea(0x11f),_0x429dea(0xe7),_0x429dea(0x13a),_0x429dea(0xd0),_0x429dea(0x11c)];if(_0x20de49[_0x429dea(0xd2)](_0xa268f7)){const _0x2e40ef=_0x32471e['split']('\x0a');if(_0x2e40ef[_0x429dea(0x147)]>0x64){const _0x2f1a4d=[];_0x2f1a4d[_0x429dea(0x102)](_0x429dea(0xf2)+path[_0x429dea(0x137)](_0x539212)+'\x20('+_0x2e40ef[_0x429dea(0x147)]+_0x429dea(0xee)),_0x2f1a4d[_0x429dea(0x102)]('');for(const _0x277dc9 of _0x2e40ef){const _0x558fd3=_0x277dc9[_0x429dea(0x10a)]();if(_0x558fd3[_0x429dea(0xc9)](_0x429dea(0x133))||_0x558fd3['startsWith'](_0x429dea(0xe1))||_0x558fd3[_0x429dea(0xc9)](_0x429dea(0xe9))||_0x558fd3[_0x429dea(0x132)](/=\s*require\(/)||_0x558fd3[_0x429dea(0xc9)](_0x429dea(0x107))||_0x558fd3['startsWith'](_0x429dea(0xed))||_0x558fd3[_0x429dea(0xc9)]('package\x20'))_0x2f1a4d[_0x429dea(0x102)](_0x277dc9);else{if(_0x558fd3[_0x429dea(0x132)](/^(export\s+)?(async\s+)?function\s+/)||_0x558fd3['match'](/^(export\s+)?(default\s+)?class\s+/)||_0x558fd3[_0x429dea(0x132)](/^(export\s+)?(type|interface|enum)\s+/)||_0x558fd3[_0x429dea(0x132)](/^(async\s+)?def\s+/)||_0x558fd3['match'](/^func\s+/)||_0x558fd3[_0x429dea(0x132)](/^type\s+\w+\s+(struct|interface)/)||_0x558fd3[_0x429dea(0x132)](/^(pub\s+)?(async\s+)?fn\s+/)||_0x558fd3['match'](/^(pub\s+)?(struct|enum|trait|impl)\s+/)||_0x558fd3[_0x429dea(0x132)](/^(public|private|protected|static)\s+/))_0x2f1a4d['push'](_0x277dc9);else{if(_0x558fd3['startsWith'](_0x429dea(0xe3))&&!_0x558fd3[_0x429dea(0xd2)]('=>')&&_0x558fd3['length']<0x78)_0x2f1a4d['push'](_0x277dc9);else _0x558fd3[_0x429dea(0xc9)]('@')&&!_0x558fd3[_0x429dea(0xc9)](_0x429dea(0xf6))&&!_0x558fd3[_0x429dea(0xc9)](_0x429dea(0xfc))&&_0x2f1a4d[_0x429dea(0x102)](_0x277dc9);}}}_0x2f1a4d[_0x429dea(0x102)](''),_0x2f1a4d['push']('('+_0x2e40ef[_0x429dea(0x147)]+'\x20lines\x20total,\x20'+(_0x2f1a4d['length']-0x2)+_0x429dea(0x156));const _0x49da79=_0x2f1a4d[_0x429dea(0xf5)]('\x0a');if(_0x49da79['length']<_0x32471e[_0x429dea(0x147)])return _0x49da79;}}}}catch{}let _0x194c4a=(0x0,generic_1[_0x429dea(0xbf)])(_0x32471e);if(_0x539212){const _0xda505e=path['extname'](_0x539212)[_0x429dea(0xcd)]();_0x194c4a=(0x0,generic_1[_0x429dea(0x134)])(_0x194c4a,_0xda505e);}const _0x308a9c=_0x194c4a[_0x429dea(0xe2)]('\x0a');if(_0x308a9c[_0x429dea(0x147)]<=0x64)return _0x194c4a;const _0x3554e7=[];return _0x3554e7['push'](..._0x308a9c[_0x429dea(0x135)](0x0,0x32)),_0x3554e7[_0x429dea(0x102)](_0x429dea(0xe4)+(_0x308a9c[_0x429dea(0x147)]-0x50)+_0x429dea(0x129)),_0x3554e7[_0x429dea(0x102)](..._0x308a9c[_0x429dea(0x135)](-0x1e)),_0x3554e7['push']('\x0a('+_0x308a9c[_0x429dea(0x147)]+'\x20lines\x20total)'),_0x3554e7[_0x429dea(0xf5)]('\x0a');}function filterGrep(_0xb41253){const _0x562fe3=a0_0x1cce56,_0x3d5334=_0xb41253[_0x562fe3(0xe2)]('\x0a')[_0x562fe3(0x141)](_0x57d7a5=>_0x57d7a5[_0x562fe3(0x10a)]()[_0x562fe3(0x147)]>0x0);if(_0x3d5334[_0x562fe3(0x147)]===0x0)return _0x562fe3(0x10b);if(_0x3d5334[_0x562fe3(0x147)]<=0x32)return _0xb41253['trim']();const _0xf7a67a={},_0x17400e=[];for(const _0x4ab7c3 of _0x3d5334){const _0x51abe6=_0x4ab7c3[_0x562fe3(0x140)](':');if(_0x51abe6>0x0&&_0x51abe6<0xc8){const _0x2175f5=_0x4ab7c3[_0x562fe3(0x106)](0x0,_0x51abe6);if(_0x2175f5[_0x562fe3(0xd2)]('/')||_0x2175f5[_0x562fe3(0xd2)]('\x5c')||_0x2175f5['includes']('.')){if(!_0xf7a67a[_0x2175f5])_0xf7a67a[_0x2175f5]=[];_0xf7a67a[_0x2175f5][_0x562fe3(0x102)](_0x4ab7c3[_0x562fe3(0x106)](_0x51abe6+0x1)[_0x562fe3(0x10a)]());continue;}}_0x17400e[_0x562fe3(0x102)](_0x4ab7c3);}const _0x5edb72=[],_0x5594d3=Object[_0x562fe3(0x101)](_0xf7a67a);if(_0x5594d3['length']>0x0){const _0xe6102f=0x14,_0x1f382b=_0x5594d3[_0x562fe3(0x135)](0x0,_0xe6102f);for(const _0xe8919c of _0x1f382b){const _0xe4f0b7=_0xf7a67a[_0xe8919c];if(_0xe4f0b7[_0x562fe3(0x147)]<=0x3)for(const _0x35981b of _0xe4f0b7){_0x5edb72[_0x562fe3(0x102)](_0xe8919c+':\x20'+_0x35981b);}else _0x5edb72[_0x562fe3(0x102)](_0xe8919c+':\x20'+_0xe4f0b7[0x0]),_0x5edb72[_0x562fe3(0x102)](_0xe8919c+_0x562fe3(0xe6)+_0xe4f0b7[_0x562fe3(0x147)]+_0x562fe3(0x144));}_0x5594d3['length']>_0xe6102f&&_0x5edb72[_0x562fe3(0x102)]('...\x20+'+(_0x5594d3[_0x562fe3(0x147)]-_0xe6102f)+_0x562fe3(0xc0));}if(_0x17400e['length']>0x0){const _0x15a240=0x1e;_0x5edb72['push'](..._0x17400e[_0x562fe3(0x135)](0x0,_0x15a240)),_0x17400e[_0x562fe3(0x147)]>_0x15a240&&_0x5edb72[_0x562fe3(0x102)]('...\x20+'+(_0x17400e['length']-_0x15a240)+_0x562fe3(0x11d));}const _0x274c9f=_0x3d5334[_0x562fe3(0x147)];return _0x5edb72[_0x562fe3(0x102)]('\x0a('+_0x274c9f+_0x562fe3(0xeb)+(_0x5594d3[_0x562fe3(0x147)]||'?')+'\x20files)'),_0x5edb72['join']('\x0a');}function filterFind(_0x5120d5){const _0x144ef5=a0_0x1cce56,_0x2d90bb=_0x5120d5[_0x144ef5(0xe2)]('\x0a')['filter'](_0x325305=>_0x325305['trim']()[_0x144ef5(0x147)]>0x0);if(_0x2d90bb['length']===0x0)return _0x144ef5(0xc1);if(_0x2d90bb[_0x144ef5(0x147)]<=0x32)return _0x5120d5[_0x144ef5(0x10a)]();const _0x22600d={};for(const _0x54bdfe of _0x2d90bb){const _0x40a779=path['dirname'](_0x54bdfe['trim']())||'.';_0x22600d[_0x40a779]=(_0x22600d[_0x40a779]||0x0)+0x1;}const _0x591e4e=Object[_0x144ef5(0xe0)](_0x22600d)[_0x144ef5(0xc6)]((_0x1ce05a,_0x3ecb6f)=>_0x3ecb6f[0x1]-_0x1ce05a[0x1]),_0x55a6fd=[_0x2d90bb['length']+_0x144ef5(0x149)+_0x591e4e[_0x144ef5(0x147)]+_0x144ef5(0x148),''],_0x5e68e2=0x1e;for(const [_0x2439e3,_0x1b90ef]of _0x591e4e[_0x144ef5(0x135)](0x0,_0x5e68e2)){_0x55a6fd[_0x144ef5(0x102)]('\x20\x20'+_0x2439e3+_0x144ef5(0x12f)+_0x1b90ef+_0x144ef5(0xd1));}return _0x591e4e[_0x144ef5(0x147)]>_0x5e68e2&&_0x55a6fd[_0x144ef5(0x102)](_0x144ef5(0x150)+(_0x591e4e[_0x144ef5(0x147)]-_0x5e68e2)+_0x144ef5(0x112)),_0x55a6fd[_0x144ef5(0xf5)]('\x0a');}
|
package/hooks/claude-hook.js
CHANGED
|
@@ -1,79 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.installClaudeHooks = installClaudeHooks;
|
|
37
|
-
const fs = __importStar(require("fs"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
const os = __importStar(require("os"));
|
|
40
|
-
function installClaudeHooks() {
|
|
41
|
-
try {
|
|
42
|
-
const claudeHooksDir = path.join(os.homedir(), '.claude', 'hooks');
|
|
43
|
-
if (!fs.existsSync(claudeHooksDir)) {
|
|
44
|
-
fs.mkdirSync(claudeHooksDir, { recursive: true });
|
|
45
|
-
}
|
|
46
|
-
const hookScriptPath = path.join(claudeHooksDir, 'post_tool_use.js');
|
|
47
|
-
const hookCode = `// TrimPrompt Native PostToolUse Hook for Claude Code
|
|
48
|
-
const fs = require('fs');
|
|
49
|
-
const path = require('path');
|
|
50
|
-
const os = require('os');
|
|
51
|
-
|
|
52
|
-
module.exports = async function postToolUse(event) {
|
|
53
|
-
try {
|
|
54
|
-
if (!event || !event.result) return event;
|
|
55
|
-
let contentStr = typeof event.result === 'string' ? event.result : JSON.stringify(event.result);
|
|
56
|
-
if (contentStr.length > 500) {
|
|
57
|
-
const cacheDir = path.join(os.homedir(), '.trimprompt', 'cache');
|
|
58
|
-
if (!fs.existsSync(cacheDir)) fs.mkdirSync(cacheDir, { recursive: true });
|
|
59
|
-
const chunkId = 'chunk_' + Math.random().toString(36).substring(2, 11);
|
|
60
|
-
fs.writeFileSync(path.join(cacheDir, chunkId + '.json'), JSON.stringify({ raw_payload: contentStr, timestamp: new Date().toISOString() }));
|
|
61
|
-
|
|
62
|
-
const snippet = contentStr.substring(0, 200).replace(/\\n/g, ' ');
|
|
63
|
-
const replacement = \`> [!NOTE]\\n> **[TrimPrompt Context Offloaded]** Raw tool output (\${contentStr.length.toLocaleString()} chars) side-cached locally.\\n> Preview: \${snippet}...\\n> Retrieve raw: \`trim retrieve \${chunkId}\`\`;
|
|
64
|
-
|
|
65
|
-
if (typeof event.result === 'string') {
|
|
66
|
-
event.result = replacement;
|
|
67
|
-
} else if (event.result && typeof event.result === 'object') {
|
|
68
|
-
event.result.content = replacement;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
} catch (e) {}
|
|
72
|
-
return event;
|
|
73
|
-
};
|
|
74
|
-
`;
|
|
75
|
-
fs.writeFileSync(hookScriptPath, hookCode, 'utf8');
|
|
76
|
-
}
|
|
77
|
-
catch (err) {
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
'use strict';function a0_0x1a8e(_0x5e0d6d,_0x51143b){var _0x1d3d98=a0_0x1d3d();return a0_0x1a8e=function(_0x1a8e14,_0xad6a94){_0x1a8e14=_0x1a8e14-0x157;var _0x34ed3b=_0x1d3d98[_0x1a8e14];return _0x34ed3b;},a0_0x1a8e(_0x5e0d6d,_0x51143b);}var a0_0x3670e6=a0_0x1a8e;(function(_0x33be57,_0x109525){var _0x5468f9=a0_0x1a8e,_0x53140a=_0x33be57();while(!![]){try{var _0x151081=parseInt(_0x5468f9(0x169))/0x1*(-parseInt(_0x5468f9(0x164))/0x2)+parseInt(_0x5468f9(0x175))/0x3*(-parseInt(_0x5468f9(0x157))/0x4)+parseInt(_0x5468f9(0x176))/0x5*(parseInt(_0x5468f9(0x16d))/0x6)+parseInt(_0x5468f9(0x158))/0x7+parseInt(_0x5468f9(0x171))/0x8*(-parseInt(_0x5468f9(0x168))/0x9)+-parseInt(_0x5468f9(0x15e))/0xa+-parseInt(_0x5468f9(0x160))/0xb*(-parseInt(_0x5468f9(0x172))/0xc);if(_0x151081===_0x109525)break;else _0x53140a['push'](_0x53140a['shift']());}catch(_0x1c4141){_0x53140a['push'](_0x53140a['shift']());}}}(a0_0x1d3d,0x5a341));var __createBinding=this&&this['__createBinding']||(Object['create']?function(_0xf47aaa,_0x25e549,_0x3fd418,_0x37628c){var _0x16fee8=a0_0x1a8e;if(_0x37628c===undefined)_0x37628c=_0x3fd418;var _0x3a10b6=Object[_0x16fee8(0x15f)](_0x25e549,_0x3fd418);(!_0x3a10b6||(_0x16fee8(0x167)in _0x3a10b6?!_0x25e549[_0x16fee8(0x177)]:_0x3a10b6[_0x16fee8(0x16e)]||_0x3a10b6[_0x16fee8(0x16c)]))&&(_0x3a10b6={'enumerable':!![],'get':function(){return _0x25e549[_0x3fd418];}}),Object[_0x16fee8(0x16f)](_0xf47aaa,_0x37628c,_0x3a10b6);}:function(_0x3e4773,_0x354e62,_0x201fe0,_0x3505e7){if(_0x3505e7===undefined)_0x3505e7=_0x201fe0;_0x3e4773[_0x3505e7]=_0x354e62[_0x201fe0];}),__setModuleDefault=this&&this[a0_0x3670e6(0x15d)]||(Object[a0_0x3670e6(0x15b)]?function(_0x128a23,_0x4b44bc){var _0xa468b2=a0_0x3670e6;Object[_0xa468b2(0x16f)](_0x128a23,'default',{'enumerable':!![],'value':_0x4b44bc});}:function(_0x28daac,_0x58fbe5){var _0x12e486=a0_0x3670e6;_0x28daac[_0x12e486(0x170)]=_0x58fbe5;}),__importStar=this&&this[a0_0x3670e6(0x165)]||(function(){var _0x314b27=function(_0x31dd43){var _0x148d3e=a0_0x1a8e;return _0x314b27=Object[_0x148d3e(0x15a)]||function(_0x48a608){var _0x490f8a=_0x148d3e,_0x4c39c2=[];for(var _0x237c03 in _0x48a608)if(Object[_0x490f8a(0x166)][_0x490f8a(0x16b)][_0x490f8a(0x16a)](_0x48a608,_0x237c03))_0x4c39c2[_0x4c39c2[_0x490f8a(0x163)]]=_0x237c03;return _0x4c39c2;},_0x314b27(_0x31dd43);};return function(_0x155d43){var _0x229d33=a0_0x1a8e;if(_0x155d43&&_0x155d43['__esModule'])return _0x155d43;var _0x4719fb={};if(_0x155d43!=null){for(var _0x4478b5=_0x314b27(_0x155d43),_0x5a20a0=0x0;_0x5a20a0<_0x4478b5[_0x229d33(0x163)];_0x5a20a0++)if(_0x4478b5[_0x5a20a0]!==_0x229d33(0x170))__createBinding(_0x4719fb,_0x155d43,_0x4478b5[_0x5a20a0]);}return __setModuleDefault(_0x4719fb,_0x155d43),_0x4719fb;};}());Object[a0_0x3670e6(0x16f)](exports,'__esModule',{'value':!![]}),exports[a0_0x3670e6(0x179)]=installClaudeHooks;const fs=__importStar(require('fs')),path=__importStar(require('path')),os=__importStar(require('os'));function a0_0x1d3d(){var _0xb1bf15=['mkdirSync','45rqoDuY','681095DAaDSM','__esModule','utf8','installClaudeHooks','133708DsMQQh','2139592FGgjlX','post_tool_use.js','getOwnPropertyNames','create','.claude','__setModuleDefault','3109120qBlxrq','getOwnPropertyDescriptor','11FUWiNx','homedir','join','length','832054SnSWVl','__importStar','prototype','get','9GTYomd','1Onjtpz','call','hasOwnProperty','configurable','6SxKcGB','writable','defineProperty','default','4669648wPiRYH','20875776pxsOLf','//\x20TrimPrompt\x20Native\x20PostToolUse\x20Hook\x20for\x20Claude\x20Code\x0aconst\x20fs\x20=\x20require(\x27fs\x27);\x0aconst\x20path\x20=\x20require(\x27path\x27);\x0aconst\x20os\x20=\x20require(\x27os\x27);\x0a\x0amodule.exports\x20=\x20async\x20function\x20postToolUse(event)\x20{\x0a\x20\x20try\x20{\x0a\x20\x20\x20\x20if\x20(!event\x20||\x20!event.result)\x20return\x20event;\x0a\x20\x20\x20\x20let\x20contentStr\x20=\x20typeof\x20event.result\x20===\x20\x27string\x27\x20?\x20event.result\x20:\x20JSON.stringify(event.result);\x0a\x20\x20\x20\x20if\x20(contentStr.length\x20>\x20500)\x20{\x0a\x20\x20\x20\x20\x20\x20const\x20cacheDir\x20=\x20path.join(os.homedir(),\x20\x27.trimprompt\x27,\x20\x27cache\x27);\x0a\x20\x20\x20\x20\x20\x20if\x20(!fs.existsSync(cacheDir))\x20fs.mkdirSync(cacheDir,\x20{\x20recursive:\x20true\x20});\x0a\x20\x20\x20\x20\x20\x20const\x20chunkId\x20=\x20\x27chunk_\x27\x20+\x20Math.random().toString(36).substring(2,\x2011);\x0a\x20\x20\x20\x20\x20\x20fs.writeFileSync(path.join(cacheDir,\x20chunkId\x20+\x20\x27.json\x27),\x20JSON.stringify({\x20raw_payload:\x20contentStr,\x20timestamp:\x20new\x20Date().toISOString()\x20}));\x0a\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20const\x20snippet\x20=\x20contentStr.substring(0,\x20200).replace(/\x5cn/g,\x20\x27\x20\x27);\x0a\x20\x20\x20\x20\x20\x20const\x20replacement\x20=\x20`>\x20[!NOTE]\x5cn>\x20**[TrimPrompt\x20Context\x20Offloaded]**\x20Raw\x20tool\x20output\x20(${contentStr.length.toLocaleString()}\x20chars)\x20side-cached\x20locally.\x5cn>\x20Preview:\x20${snippet}...\x5cn>\x20Retrieve\x20raw:\x20`trim\x20retrieve\x20${chunkId}``;\x0a\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20if\x20(typeof\x20event.result\x20===\x20\x27string\x27)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20event.result\x20=\x20replacement;\x0a\x20\x20\x20\x20\x20\x20}\x20else\x20if\x20(event.result\x20&&\x20typeof\x20event.result\x20===\x20\x27object\x27)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20event.result.content\x20=\x20replacement;\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20}\x0a\x20\x20}\x20catch\x20(e)\x20{}\x0a\x20\x20return\x20event;\x0a};\x0a'];a0_0x1d3d=function(){return _0xb1bf15;};return a0_0x1d3d();}function installClaudeHooks(){var _0x11864d=a0_0x3670e6;try{const _0x131449=path[_0x11864d(0x162)](os[_0x11864d(0x161)](),_0x11864d(0x15c),'hooks');!fs['existsSync'](_0x131449)&&fs[_0x11864d(0x174)](_0x131449,{'recursive':!![]});const _0x2db70c=path[_0x11864d(0x162)](_0x131449,_0x11864d(0x159)),_0xa0ed3b=_0x11864d(0x173);fs['writeFileSync'](_0x2db70c,_0xa0ed3b,_0x11864d(0x178));}catch(_0x471694){}}
|