@compilr-dev/sdk 0.9.3 → 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);
@@ -173,7 +175,7 @@ function compressNpmInstall(output) {
173
175
  // ─── Test Output ────────────────────────────────────────────────────────────
174
176
  function compressTestOutput(output) {
175
177
  const lines = output.split('\n');
176
- if (lines.length <= 30)
178
+ if (lines.length <= 15)
177
179
  return output;
178
180
  const result = [];
179
181
  let inFailure = false;
@@ -181,11 +183,15 @@ function compressTestOutput(output) {
181
183
  const maxFailureLines = 20;
182
184
  for (const line of lines) {
183
185
  const t = line.trim();
184
- // Always keep: summary lines, failures, errors
185
- if (t.match(/^(Tests?|Test Suites?|FAIL|PASS|ERROR|✓|✗|✘|×|●|Ran \d|passed|failed|\d+ passing|\d+ failing|Test Files|Duration)/i)) {
186
+ // Always keep: summary lines, suite headers, failure markers
187
+ if (t.match(/^(Tests?:|Test Suites?:|FAIL |PASS |ERROR|✗|✘|×|●|Ran \d|passed|failed|\d+ passing|\d+ failing|Test Files|Duration)/i)) {
186
188
  result.push(line);
187
189
  continue;
188
190
  }
191
+ // Skip passing test lines (✓ checkmarks) — these are the bulk of output
192
+ if (t.match(/^✓|^✔|^\s*✓|^\s*✔/)) {
193
+ continue;
194
+ }
189
195
  // Keep failure context (limited)
190
196
  if (t.match(/^(FAIL|✗|✘|×|Error:|AssertionError|Expected|Received|at\s)/i) || inFailure) {
191
197
  if (t.match(/^(FAIL|✗|✘|×)/i)) {
@@ -213,7 +219,7 @@ function compressTestOutput(output) {
213
219
  // ─── Lint Output ────────────────────────────────────────────────────────────
214
220
  function compressLintOutput(output) {
215
221
  const lines = output.split('\n');
216
- if (lines.length <= 30)
222
+ if (lines.length <= 15)
217
223
  return output;
218
224
  // Group errors by rule, cap per rule
219
225
  const errors = [];
@@ -288,41 +294,41 @@ function compressBuildOutput(output) {
288
294
  }
289
295
  return output;
290
296
  }
291
- // ─── File List (ls, find, tree) ─────────────────────────────────────────────
292
- function compressFileList(output) {
293
- const lines = output.split('\n').filter((l) => l.trim());
294
- 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)
295
301
  return output;
296
- // Group by top-level directory, cap entries per directory
297
- const groups = new Map();
298
- for (const line of lines) {
299
- const parts = line.replace(/^\.\//, '').split('/');
300
- const dir = parts.length > 1 ? parts[0] : '.';
301
- const arr = groups.get(dir) ?? [];
302
- arr.push(line);
303
- groups.set(dir, arr);
304
- }
305
- 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
306
309
  const result = [];
307
- for (const [dir, files] of groups) {
308
- if (dir !== '.')
309
- result.push(`${dir}/ (${String(files.length)} files)`);
310
- const shown = files.slice(0, maxPerDir);
311
- for (const f of shown)
312
- result.push(f);
313
- if (files.length > maxPerDir) {
314
- 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
315
324
  }
316
- }
317
- if (result.length < lines.length) {
318
- result.push(`\n(${String(lines.length)} total entries, showing ${String(result.length)} lines)`);
319
325
  }
320
326
  return result.join('\n');
321
327
  }
322
328
  // ─── curl / wget ────────────────────────────────────────────────────────────
323
329
  function compressCurlOutput(output) {
324
330
  const lines = output.split('\n');
325
- if (lines.length <= 30)
331
+ if (lines.length <= 10)
326
332
  return output;
327
333
  // Strip progress bars (curl -# output), keep headers and body
328
334
  const kept = lines.filter((l) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.9.3",
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",