@taj-special/dravix-code 1.2.1 → 1.2.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/cli/repl.js +49 -6
- package/package.json +1 -1
package/dist/cli/repl.js
CHANGED
|
@@ -402,7 +402,28 @@ class MarkdownRenderer {
|
|
|
402
402
|
return ' ' + colors.dim('─'.repeat(Math.min((process.stdout.columns ?? 80) - 4, 72))) + '\n';
|
|
403
403
|
}
|
|
404
404
|
// ── Normal text ───────────────────────────────────────────
|
|
405
|
-
|
|
405
|
+
// Wrap text before right edge, but with minimal margin
|
|
406
|
+
const termWidth = process.stdout.columns ?? 80;
|
|
407
|
+
const maxTextWidth = termWidth - 1; // just 1 char from right edge
|
|
408
|
+
const rawText = applyInline(raw);
|
|
409
|
+
if (rawText.length > maxTextWidth) {
|
|
410
|
+
// Word-wrap at spaces, keeping lines close to edge
|
|
411
|
+
const words = rawText.split(' ');
|
|
412
|
+
let line = '';
|
|
413
|
+
let result = ' ';
|
|
414
|
+
for (const word of words) {
|
|
415
|
+
if (line.length + word.length + 1 > maxTextWidth && line.length > 0) {
|
|
416
|
+
result += line.trimEnd() + '\n ';
|
|
417
|
+
line = word + ' ';
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
line += word + ' ';
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
result += line.trimEnd();
|
|
424
|
+
return colors.ai(result) + '\n';
|
|
425
|
+
}
|
|
426
|
+
return ' ' + colors.ai(rawText) + '\n';
|
|
406
427
|
}
|
|
407
428
|
renderTable() {
|
|
408
429
|
const rows = this.tableRows;
|
|
@@ -2989,11 +3010,34 @@ Never guess or fabricate information.
|
|
|
2989
3010
|
return;
|
|
2990
3011
|
}
|
|
2991
3012
|
const cols = process.stdout.columns ?? 80;
|
|
2992
|
-
const boxW = Math.min(Math.max(cols -
|
|
3013
|
+
const boxW = Math.min(Math.max(cols - 6, 40), 60);
|
|
2993
3014
|
const BC = colors.dim;
|
|
2994
3015
|
const FC = colors.text;
|
|
2995
|
-
const RIGHT_W =
|
|
3016
|
+
const RIGHT_W = 8;
|
|
2996
3017
|
const LABEL_W = Math.max(boxW - 11 - RIGHT_W, 10);
|
|
3018
|
+
// Helper: shorten file path (remove common prefixes)
|
|
3019
|
+
const shortenPath = (p) => {
|
|
3020
|
+
// Remove drive letter and common prefixes
|
|
3021
|
+
let short = p.replace(/^[A-Z]:\\[^\\]+\\[^\\]+\\/i, '');
|
|
3022
|
+
// If still too long, show only last 2 parts
|
|
3023
|
+
if (short.length > 30) {
|
|
3024
|
+
const parts = short.split(/[/\\]/);
|
|
3025
|
+
short = '...' + parts.slice(-2).join('/');
|
|
3026
|
+
}
|
|
3027
|
+
return short;
|
|
3028
|
+
};
|
|
3029
|
+
// Helper: truncate long file names
|
|
3030
|
+
const truncateName = (name, maxLen) => {
|
|
3031
|
+
if (name.length <= maxLen)
|
|
3032
|
+
return name;
|
|
3033
|
+
const ext = name.lastIndexOf('.');
|
|
3034
|
+
if (ext > 0) {
|
|
3035
|
+
const base = name.slice(0, ext);
|
|
3036
|
+
const fileExt = name.slice(ext);
|
|
3037
|
+
return base.slice(0, maxLen - fileExt.length - 3) + '...' + fileExt;
|
|
3038
|
+
}
|
|
3039
|
+
return name.slice(0, maxLen - 3) + '...';
|
|
3040
|
+
};
|
|
2997
3041
|
const results = [];
|
|
2998
3042
|
for (const op of validOps) {
|
|
2999
3043
|
let spinLabel = '';
|
|
@@ -3107,9 +3151,8 @@ Never guess or fabricate information.
|
|
|
3107
3151
|
process.stdout.write(` ` + BC('╭─') + colors.primary.bold(titleText) + BC('─'.repeat(dashCount) + '╮') + `\n`);
|
|
3108
3152
|
for (const r of results) {
|
|
3109
3153
|
const icon = r.ok ? colors.success('✓') : colors.error('✗');
|
|
3110
|
-
const
|
|
3111
|
-
|
|
3112
|
-
: r.label;
|
|
3154
|
+
const shortLabel = shortenPath(r.label);
|
|
3155
|
+
const disp = truncateName(shortLabel, LABEL_W);
|
|
3113
3156
|
const labelPad = ' '.repeat(Math.max(LABEL_W - disp.length, 0));
|
|
3114
3157
|
const rightVis = stripAnsi(r.right);
|
|
3115
3158
|
const rightPad = ' '.repeat(Math.max(RIGHT_W - rightVis.length, 0));
|