@compilr-dev/sdk 0.9.0 → 0.9.2
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/dist/compressors/bash.js
CHANGED
|
@@ -83,11 +83,11 @@ function compressGitStatus(output) {
|
|
|
83
83
|
// ─── Git Log ────────────────────────────────────────────────────────────────
|
|
84
84
|
function compressGitLog(output) {
|
|
85
85
|
const lines = output.split('\n');
|
|
86
|
-
if (lines.length <=
|
|
86
|
+
if (lines.length <= 30)
|
|
87
87
|
return output;
|
|
88
|
-
// Keep first
|
|
89
|
-
const kept = lines.slice(0,
|
|
90
|
-
const remaining = lines.slice(
|
|
88
|
+
// Keep first 25 lines (recent commits), summarize the rest
|
|
89
|
+
const kept = lines.slice(0, 25);
|
|
90
|
+
const remaining = lines.slice(25).filter((l) => l.match(/^commit\s/));
|
|
91
91
|
if (remaining.length > 0) {
|
|
92
92
|
kept.push(`\n... +${String(remaining.length)} older commits omitted`);
|
|
93
93
|
}
|
|
@@ -96,7 +96,7 @@ function compressGitLog(output) {
|
|
|
96
96
|
// ─── Git Diff ───────────────────────────────────────────────────────────────
|
|
97
97
|
function compressGitDiff(output) {
|
|
98
98
|
const lines = output.split('\n');
|
|
99
|
-
if (lines.length <=
|
|
99
|
+
if (lines.length <= 50)
|
|
100
100
|
return output;
|
|
101
101
|
// Keep diff headers and first N lines of each file, collapse large hunks
|
|
102
102
|
const result = [];
|
|
@@ -291,7 +291,7 @@ function compressBuildOutput(output) {
|
|
|
291
291
|
// ─── File List (ls, find, tree) ─────────────────────────────────────────────
|
|
292
292
|
function compressFileList(output) {
|
|
293
293
|
const lines = output.split('\n').filter((l) => l.trim());
|
|
294
|
-
if (lines.length <=
|
|
294
|
+
if (lines.length <= 20)
|
|
295
295
|
return output;
|
|
296
296
|
// Group by top-level directory, cap entries
|
|
297
297
|
const groups = new Map();
|
|
@@ -41,6 +41,9 @@ export function createCompressorHook(config) {
|
|
|
41
41
|
const command = ctx.input.command ?? '';
|
|
42
42
|
const compressed = compressBashOutput(command, stdout);
|
|
43
43
|
if (compressed !== null && compressed.length < stdout.length) {
|
|
44
|
+
const saved = stdout.length - compressed.length;
|
|
45
|
+
const pct = Math.round((saved / stdout.length) * 100);
|
|
46
|
+
console.log(`[compressor] bash "${command.slice(0, 40)}" ${String(stdout.length)} → ${String(compressed.length)} chars (${String(pct)}% saved)`); // eslint-disable-line no-console
|
|
44
47
|
return {
|
|
45
48
|
result: {
|
|
46
49
|
...ctx.result,
|