blun-king-cli 7.2.4 → 7.2.6

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.
Files changed (3) hide show
  1. package/lib/chat.js +2 -2
  2. package/lib/ui.js +47 -1
  3. package/package.json +1 -1
package/lib/chat.js CHANGED
@@ -40,7 +40,7 @@ var SLASH_COMMANDS = [
40
40
  var slashNames = SLASH_COMMANDS.map(function (c) { return c[0]; });
41
41
 
42
42
  // ── Layout Constants ─────────────────────────────────────
43
- var INPUT_PANEL_HEIGHT = 7; // 2 gap + top-frame + input + blank + status + bottom-frame
43
+ var INPUT_PANEL_HEIGHT = 10; // 5 gap + top-frame + input + blank + status + bottom-frame
44
44
 
45
45
  function getRows() { return process.stdout.rows || 24; }
46
46
  function getCols() { return process.stdout.columns || 80; }
@@ -102,7 +102,7 @@ function startChat() {
102
102
  var rows = getRows();
103
103
  var cols = getCols();
104
104
  var t = ui.getTheme();
105
- var panelTop = rows - INPUT_PANEL_HEIGHT + 3; // +3 to leave 2 empty rows at top of panel area
105
+ var panelTop = rows - INPUT_PANEL_HEIGHT + 6; // +6 to leave 5 empty rows below panel
106
106
  var inner = cols - 2;
107
107
 
108
108
  // Permission label
package/lib/ui.js CHANGED
@@ -318,6 +318,39 @@ function stopSpinner(success, message) {
318
318
  activeSpinner = null;
319
319
  }
320
320
 
321
+ // ── Word Wrap ────────────────────────────────────────────
322
+ function wordWrap(text, width) {
323
+ if (!width) width = getWidth();
324
+ var lines = text.split("\n");
325
+ var result = [];
326
+ for (var i = 0; i < lines.length; i++) {
327
+ var line = lines[i];
328
+ // Strip ANSI for length calculation
329
+ var plain = line.replace(/\x1b\[[0-9;]*m/g, "");
330
+ if (plain.length <= width) {
331
+ result.push(line);
332
+ continue;
333
+ }
334
+ // Word wrap: work on plain text, rebuild with breaks
335
+ var words = line.split(/( +)/);
336
+ var current = "";
337
+ var currentPlain = "";
338
+ for (var j = 0; j < words.length; j++) {
339
+ var wordPlain = words[j].replace(/\x1b\[[0-9;]*m/g, "");
340
+ if (currentPlain.length + wordPlain.length > width && currentPlain.length > 0) {
341
+ result.push(current);
342
+ current = words[j];
343
+ currentPlain = wordPlain;
344
+ } else {
345
+ current += words[j];
346
+ currentPlain += wordPlain;
347
+ }
348
+ }
349
+ if (current) result.push(current);
350
+ }
351
+ return result.join("\n");
352
+ }
353
+
321
354
  // ── Markdown Rendering ────────────────────────────────────
322
355
  function renderMarkdown(text) {
323
356
  var out = text;
@@ -342,7 +375,20 @@ function renderMarkdown(text) {
342
375
  out = out.replace(/`([^`]+)`/g, function (_, c) { return chalk.bgGray.white(" " + c + " "); });
343
376
  out = out.replace(/^(\s*)[-*] (.+)$/gm, function (_, sp, t) { return sp + chalk.green("\u25cf") + " " + t; });
344
377
  out = out.replace(/^(\s*)\d+\. (.+)$/gm, function (_, sp, t) { return sp + chalk.yellow("\u25b8") + " " + t; });
345
- return out;
378
+ // Word wrap the final output (skip code block lines)
379
+ var wrapWidth = (process.stdout.columns || 80) - 4;
380
+ var outLines = out.split("\n");
381
+ var wrapped = [];
382
+ for (var wi = 0; wi < outLines.length; wi++) {
383
+ var ol = outLines[wi];
384
+ // Don't wrap code block lines (they have │ prefix)
385
+ if (ol.indexOf("\u2502") >= 0 || ol.indexOf("\u250c") >= 0 || ol.indexOf("\u2514") >= 0) {
386
+ wrapped.push(ol);
387
+ } else {
388
+ wrapped.push(wordWrap(ol, wrapWidth));
389
+ }
390
+ }
391
+ return wrapped.join("\n");
346
392
  }
347
393
 
348
394
  // ── Token Tracking ────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "7.2.4",
3
+ "version": "7.2.6",
4
4
  "description": "BLUN AI Assistant - Command Line Interface",
5
5
  "bin": {
6
6
  "blun": "./bin/blun.js"