vigthoria-cli 1.12.2 → 1.12.3
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/commands/chat.js +7 -1
- package/dist/index.js +6 -1
- package/dist/utils/logger.js +6 -1
- package/package.json +1 -1
package/dist/commands/chat.js
CHANGED
|
@@ -921,7 +921,13 @@ export class ChatCommand {
|
|
|
921
921
|
}
|
|
922
922
|
terminalColumns() {
|
|
923
923
|
const raw = Number(process.stdout.columns || process.stderr.columns || 80);
|
|
924
|
-
|
|
924
|
+
const safe = Number.isFinite(raw) && raw > 0 ? raw : 80;
|
|
925
|
+
// process.stdout.columns is not always a reliable indicator of how many
|
|
926
|
+
// columns actually render visually (seen mismatching badly in some
|
|
927
|
+
// embedded/split-pane terminal hosts on Windows) -- cap at a
|
|
928
|
+
// conservative width so wrapped/fitted text never overflows even when
|
|
929
|
+
// the reported column count is larger than the real usable width.
|
|
930
|
+
return Math.min(safe, 60);
|
|
925
931
|
}
|
|
926
932
|
fitTerminalText(text, reserve = 0) {
|
|
927
933
|
const width = Math.max(24, this.terminalColumns() - reserve);
|
package/dist/index.js
CHANGED
|
@@ -585,8 +585,13 @@ export async function main(args) {
|
|
|
585
585
|
!jsonOutputRequested &&
|
|
586
586
|
!directPromptRequested &&
|
|
587
587
|
!helpOrVersionRequested) {
|
|
588
|
+
// process.stdout.columns is not always a reliable indicator of how
|
|
589
|
+
// many columns actually render visually (seen mismatching badly in some
|
|
590
|
+
// embedded/split-pane terminal hosts on Windows) -- cap the box at a
|
|
591
|
+
// conservative width so it never overflows even when the reported
|
|
592
|
+
// column count is larger than the real usable width.
|
|
588
593
|
const terminalWidth = Math.max(36, Number(process.stdout.columns || 80));
|
|
589
|
-
const boxWidth = Math.max(34, Math.min(
|
|
594
|
+
const boxWidth = Math.max(34, Math.min(44, terminalWidth - 8));
|
|
590
595
|
const innerWidth = boxWidth;
|
|
591
596
|
const fit = (text) => {
|
|
592
597
|
const clean = String(text || '').replace(/\s+/g, ' ').trim();
|
package/dist/utils/logger.js
CHANGED
|
@@ -162,11 +162,16 @@ export class Logger {
|
|
|
162
162
|
}
|
|
163
163
|
// Section header
|
|
164
164
|
section(title) {
|
|
165
|
+
// process.stdout.columns is not always a reliable indicator of how many
|
|
166
|
+
// columns actually render visually (seen mismatching badly in some
|
|
167
|
+
// embedded/split-pane terminal hosts on Windows) -- cap at a
|
|
168
|
+
// conservative width so the separator line never overflows even when
|
|
169
|
+
// the reported column count is larger than the real usable width.
|
|
165
170
|
const width = Math.max(24, Number(process.stdout.columns || 80));
|
|
166
171
|
const cleanTitle = String(title || '').replace(/\s+/g, ' ').trim();
|
|
167
172
|
const maxTitle = Math.max(10, width - 10);
|
|
168
173
|
const fittedTitle = cleanTitle.length > maxTitle ? `${cleanTitle.slice(0, maxTitle - 1)}…` : cleanTitle;
|
|
169
|
-
const side = Math.max(3, Math.floor((Math.min(width,
|
|
174
|
+
const side = Math.max(3, Math.floor((Math.min(width, 44) - fittedTitle.length - 2) / 2));
|
|
170
175
|
console.log();
|
|
171
176
|
console.log(chalk.bold.cyan(`${CH.hDouble.repeat(side)} ${fittedTitle} ${CH.hDouble.repeat(side)}`));
|
|
172
177
|
console.log();
|