blun-king-cli 7.2.2 → 7.2.4
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/bin/blun.js +23 -0
- package/lib/chat.js +16 -10
- package/package.json +1 -1
package/bin/blun.js
CHANGED
|
@@ -12,6 +12,28 @@ async function main() {
|
|
|
12
12
|
const workspace = require("../lib/workspace");
|
|
13
13
|
|
|
14
14
|
switch (command) {
|
|
15
|
+
case "update":
|
|
16
|
+
case "upgrade": {
|
|
17
|
+
const { execSync } = require("child_process");
|
|
18
|
+
const chalk = require("chalk");
|
|
19
|
+
console.log(chalk.cyan("\n Checking for updates..."));
|
|
20
|
+
try {
|
|
21
|
+
const latest = execSync("npm view blun-king-cli version", { encoding: "utf8" }).trim();
|
|
22
|
+
if (latest === pkg.version) {
|
|
23
|
+
console.log(chalk.green(" Already on latest version: v" + pkg.version + "\n"));
|
|
24
|
+
} else {
|
|
25
|
+
console.log(chalk.yellow(" Updating v" + pkg.version + " → v" + latest + "..."));
|
|
26
|
+
execSync("npm install -g blun-king-cli@latest", { stdio: "inherit" });
|
|
27
|
+
console.log(chalk.green("\n Updated to v" + latest + "!\n"));
|
|
28
|
+
}
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.error(chalk.red(" Update failed: " + e.message));
|
|
31
|
+
console.log(chalk.dim(" Try: npm install -g blun-king-cli@latest\n"));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
|
|
15
37
|
case "version":
|
|
16
38
|
case "--version":
|
|
17
39
|
case "-v":
|
|
@@ -36,6 +58,7 @@ async function main() {
|
|
|
36
58
|
"blun settings Show/change settings",
|
|
37
59
|
"blun status Show system health",
|
|
38
60
|
"blun init Initialize BLUN project in current dir",
|
|
61
|
+
"blun update Self-update to latest version",
|
|
39
62
|
"blun version Show version",
|
|
40
63
|
"blun help Show this help"
|
|
41
64
|
].join("\n"), "cyan");
|
package/lib/chat.js
CHANGED
|
@@ -129,29 +129,35 @@ function startChat() {
|
|
|
129
129
|
// Save cursor position in scroll region
|
|
130
130
|
process.stdout.write(saveCursor());
|
|
131
131
|
|
|
132
|
-
// Row 1: Top frame
|
|
132
|
+
// Row 1: Top frame ╭─ BLUN ─────...──╮
|
|
133
133
|
process.stdout.write(cursorTo(panelTop, 1) + clearLine());
|
|
134
|
-
|
|
134
|
+
var topLeft = "╭─ BLUN ";
|
|
135
|
+
var fillTop = cols - topLeft.length - 1; // -1 for ╮
|
|
136
|
+
process.stdout.write(t.frame(topLeft) + t.frame("─".repeat(Math.max(1, fillTop))) + t.frame("╮"));
|
|
135
137
|
|
|
136
|
-
// Row 2: Input line
|
|
138
|
+
// Row 2: Input line │ > text... │
|
|
137
139
|
var displayInput = inputBuffer || "";
|
|
138
|
-
var maxInputLen =
|
|
140
|
+
var maxInputLen = cols - 6; // "│ > " (4) + " │" (2)
|
|
139
141
|
var showInput = displayInput.length > maxInputLen ? displayInput.slice(displayInput.length - maxInputLen) : displayInput;
|
|
140
142
|
process.stdout.write(cursorTo(panelTop + 1, 1) + clearLine());
|
|
141
|
-
process.stdout.write(t.frame("│ ") + chalk.bold.green("> ") + chalk.white(showInput)
|
|
143
|
+
process.stdout.write(t.frame("│ ") + chalk.bold.green("> ") + chalk.white(showInput));
|
|
144
|
+
process.stdout.write(cursorTo(panelTop + 1, cols) + t.frame("│"));
|
|
142
145
|
|
|
143
|
-
// Row 3: Empty separator
|
|
146
|
+
// Row 3: Empty separator │ │
|
|
144
147
|
process.stdout.write(cursorTo(panelTop + 2, 1) + clearLine());
|
|
145
|
-
process.stdout.write(t.frame("│")
|
|
148
|
+
process.stdout.write(t.frame("│"));
|
|
149
|
+
process.stdout.write(cursorTo(panelTop + 2, cols) + t.frame("│"));
|
|
146
150
|
|
|
147
|
-
// Row 4: Status line
|
|
151
|
+
// Row 4: Status line │ normal | model:auto ... │
|
|
148
152
|
process.stdout.write(cursorTo(panelTop + 3, 1) + clearLine());
|
|
149
153
|
process.stdout.write(t.frame("│ ") + statusLine);
|
|
150
154
|
process.stdout.write(cursorTo(panelTop + 3, cols) + t.frame("│"));
|
|
151
155
|
|
|
152
|
-
// Row 5: Bottom frame
|
|
156
|
+
// Row 5: Bottom frame ╰─ Tab: ... ──╯
|
|
153
157
|
process.stdout.write(cursorTo(panelTop + 4, 1) + clearLine());
|
|
154
|
-
|
|
158
|
+
var bottomHint = "╰─ Tab: autocomplete /: commands Esc: exit ";
|
|
159
|
+
var fillBottom = cols - bottomHint.length - 1; // -1 for ╯
|
|
160
|
+
process.stdout.write(t.frame(bottomHint) + t.frame("─".repeat(Math.max(1, fillBottom))) + t.frame("╯"));
|
|
155
161
|
|
|
156
162
|
// Restore cursor back to input line
|
|
157
163
|
var cursorCol = 5 + cursorPos; // "│ > " = 4 chars + 1
|