@compilr-dev/sdk 0.9.4 → 0.9.5

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.
@@ -36,9 +36,11 @@ export function compressBashOutput(command, stdout) {
36
36
  // Direct linters
37
37
  if (cmd.match(/^(eslint|tsc|ruff|cargo\s+clippy|golangci-lint)/))
38
38
  return compressLintOutput(stdout);
39
- // ls / find / tree
40
- if (cmd.match(/^(ls|find|tree|fd)\b/))
41
- return compressFileList(stdout);
39
+ // ls (strip metadata, keep filenames)
40
+ if (cmd.match(/^ls\b/))
41
+ return compressLsOutput(stdout);
42
+ // find / fd — already minimal (just paths), pass through unchanged
43
+ // tree — already structured, pass through unchanged
42
44
  // curl / wget (HTTP responses)
43
45
  if (cmd.match(/^(curl|wget)\b/))
44
46
  return compressCurlOutput(stdout);
@@ -292,34 +294,34 @@ function compressBuildOutput(output) {
292
294
  }
293
295
  return output;
294
296
  }
295
- // ─── File List (ls, find, tree) ─────────────────────────────────────────────
296
- function compressFileList(output) {
297
- const lines = output.split('\n').filter((l) => l.trim());
298
- if (lines.length <= 20)
297
+ // ─── ls Output (strip metadata, keep filenames) ────────────────────────────
298
+ function compressLsOutput(output) {
299
+ const lines = output.split('\n');
300
+ if (lines.length <= 10)
299
301
  return output;
300
- // Group by top-level directory, cap entries per directory
301
- const groups = new Map();
302
- for (const line of lines) {
303
- const parts = line.replace(/^\.\//, '').split('/');
304
- const dir = parts.length > 1 ? parts[0] : '.';
305
- const arr = groups.get(dir) ?? [];
306
- arr.push(line);
307
- groups.set(dir, arr);
308
- }
309
- const maxPerDir = 5;
302
+ // Detect ls -l style output (permissions + metadata + filename)
303
+ // e.g., "drwxr-xr-x@ 15 scozzola staff 480 Apr 11 16:16 .compilr"
304
+ const lsLongPattern = /^[dlrwx\-@+.]{10,}\s+\d+\s+\S+\s+\S+\s+\d+\s+\w+\s+\d+\s+[\d:]+\s+(.+)$/;
305
+ const hasMetadata = lines.some((l) => lsLongPattern.test(l.trim()));
306
+ if (!hasMetadata)
307
+ return output; // Plain ls or unknown format — pass through
308
+ // Strip metadata, keep only filenames with dir/file indicator
310
309
  const result = [];
311
- for (const [dir, files] of groups) {
312
- if (dir !== '.')
313
- result.push(`${dir}/ (${String(files.length)} files)`);
314
- const shown = files.slice(0, maxPerDir);
315
- for (const f of shown)
316
- result.push(f);
317
- if (files.length > maxPerDir) {
318
- result.push(` ... +${String(files.length - maxPerDir)} more`);
310
+ for (const line of lines) {
311
+ const trimmed = line.trim();
312
+ if (!trimmed)
313
+ continue;
314
+ if (trimmed.startsWith('total '))
315
+ continue; // Skip "total N" line
316
+ const match = trimmed.match(lsLongPattern);
317
+ if (match) {
318
+ const name = match[1];
319
+ const isDir = trimmed.startsWith('d');
320
+ result.push(isDir ? `${name}/` : name);
321
+ }
322
+ else {
323
+ result.push(trimmed); // Keep unrecognized lines as-is
319
324
  }
320
- }
321
- if (result.length < lines.length) {
322
- result.push(`\n(${String(lines.length)} total entries, showing ${String(result.length)} lines)`);
323
325
  }
324
326
  return result.join('\n');
325
327
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",