vibex-sh 0.12.0 → 0.12.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/index.js +29 -29
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -663,6 +663,32 @@ async function handleSendLogs(options) {
|
|
|
663
663
|
// Track if this is a new session (not reusing an existing one)
|
|
664
664
|
const isNewSession = !options.sessionId;
|
|
665
665
|
|
|
666
|
+
// Stats tracking for piped input (declared early so sendLogViaHTTP can access it)
|
|
667
|
+
let stats = {
|
|
668
|
+
logsRead: 0,
|
|
669
|
+
logsSent: 0,
|
|
670
|
+
logsFailed: 0,
|
|
671
|
+
startTime: Date.now(),
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
// Progress bar for piped input (declared early so sendLogViaHTTP can access it)
|
|
675
|
+
let progressBar = null;
|
|
676
|
+
if (hasStdin) {
|
|
677
|
+
progressBar = new cliProgress.SingleBar({
|
|
678
|
+
format: chalk.cyan('{bar}') + ' | ' + chalk.white('{percentage}%') + ' | ' + chalk.green('{value}/{total}') + ' logs sent | ' + chalk.blue('{eta}s remaining'),
|
|
679
|
+
barCompleteChar: '\u2588',
|
|
680
|
+
barIncompleteChar: '\u2591',
|
|
681
|
+
hideCursor: true,
|
|
682
|
+
clearOnComplete: false,
|
|
683
|
+
etaBuffer: 10,
|
|
684
|
+
});
|
|
685
|
+
// Start with 1 to avoid division by zero, will update as we read logs
|
|
686
|
+
progressBar.start(1, 0, {
|
|
687
|
+
value: 0,
|
|
688
|
+
total: 1,
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
|
|
666
692
|
// Graceful shutdown function
|
|
667
693
|
const closeWebSocket = () => {
|
|
668
694
|
return new Promise((resolve) => {
|
|
@@ -1088,42 +1114,16 @@ async function handleSendLogs(options) {
|
|
|
1088
1114
|
}
|
|
1089
1115
|
};
|
|
1090
1116
|
|
|
1091
|
-
// Only start WebSocket connection if we have stdin (piped input)
|
|
1092
|
-
// Don't connect WebSocket when run without parameters
|
|
1093
|
-
if (hasStdin) {
|
|
1094
|
-
connectWebSocket();
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
1117
|
// Only read from stdin if we have piped input
|
|
1098
1118
|
if (!hasStdin) {
|
|
1099
1119
|
// No stdin - exit after showing session info
|
|
1100
1120
|
process.exit(0);
|
|
1101
1121
|
}
|
|
1102
1122
|
|
|
1103
|
-
//
|
|
1104
|
-
|
|
1105
|
-
logsRead: 0,
|
|
1106
|
-
logsSent: 0,
|
|
1107
|
-
logsFailed: 0,
|
|
1108
|
-
startTime: Date.now(),
|
|
1109
|
-
};
|
|
1110
|
-
|
|
1111
|
-
// Progress bar for piped input
|
|
1112
|
-
let progressBar = null;
|
|
1123
|
+
// Only start WebSocket connection if we have stdin (piped input)
|
|
1124
|
+
// Don't connect WebSocket when run without parameters
|
|
1113
1125
|
if (hasStdin) {
|
|
1114
|
-
|
|
1115
|
-
format: chalk.cyan('{bar}') + ' | ' + chalk.white('{percentage}%') + ' | ' + chalk.green('{value}/{total}') + ' logs sent | ' + chalk.blue('{eta}s remaining'),
|
|
1116
|
-
barCompleteChar: '\u2588',
|
|
1117
|
-
barIncompleteChar: '\u2591',
|
|
1118
|
-
hideCursor: true,
|
|
1119
|
-
clearOnComplete: false,
|
|
1120
|
-
etaBuffer: 10,
|
|
1121
|
-
});
|
|
1122
|
-
// Start with 1 to avoid division by zero, will update as we read logs
|
|
1123
|
-
progressBar.start(1, 0, {
|
|
1124
|
-
value: 0,
|
|
1125
|
-
total: 1,
|
|
1126
|
-
});
|
|
1126
|
+
connectWebSocket();
|
|
1127
1127
|
}
|
|
1128
1128
|
|
|
1129
1129
|
// Rate limiting queue for piped input
|