blun-king-cli 6.2.1 → 6.3.0

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/lib/auth.js CHANGED
@@ -183,24 +183,25 @@ async function whoami() {
183
183
  }
184
184
 
185
185
  async function showWelcomeMenu() {
186
- const choice = await promptMenu('Welcome to BLUN CLI!', [
187
- { label: 'Login (email + password)', value: 'login' },
188
- { label: 'Register new account', value: 'register' },
189
- { label: 'Enter API Key', value: 'apikey' },
190
- { label: 'Continue without auth (local mode)', value: 'local' },
191
- { label: 'Exit', value: 'exit' }
192
- ]);
193
- switch (choice) {
194
- case 'login': try { await login(); return true; } catch(e) { console.log(chalk.red(' ' + e.message)); return false; }
195
- case 'register': try { await register(); return true; } catch(e) { console.log(chalk.red(' ' + e.message)); return false; }
196
- case 'apikey': {
197
- const key = await prompt(chalk.green(' API Key: '));
198
- try { await loginWithApiKey(key); return true; } catch(e) { console.log(chalk.red(' ' + e.message)); return false; }
199
- }
200
- case 'local': console.log(chalk.yellow('\n Running in local mode (limited functionality)\n')); return 'local';
201
- case 'exit': process.exit(0);
202
- default: return false;
203
- }
186
+ const chalk = require("chalk");
187
+ const { action } = await inquirer.prompt([{
188
+ type: "list",
189
+ name: "action",
190
+ message: chalk.cyan("Welcome to BLUN CLI"),
191
+ choices: [
192
+ { name: "Login (email + password)", value: "login" },
193
+ { name: "Register new account", value: "register" },
194
+ { name: "Enter API Key", value: "apikey" },
195
+ { name: "Continue without auth (local mode)", value: "local" },
196
+ new inquirer.Separator(),
197
+ { name: "Exit", value: "exit" }
198
+ ]
199
+ }]);
200
+ if (action === "login") { await login(); return true; }
201
+ if (action === "register") { await register(); return true; }
202
+ if (action === "apikey") { const { key } = await inquirer.prompt([{ type: "password", name: "key", message: "API Key:" }]); await loginWithApiKey(key); return true; }
203
+ if (action === "local") { console.log(chalk.yellow(" Running in local mode.")); return true; }
204
+ if (action === "exit") { process.exit(0); }
204
205
  }
205
206
 
206
207
  function logout() {
package/lib/workspace.js CHANGED
@@ -1,3 +1,4 @@
1
+ const inquirer = require("inquirer");
1
2
  const fs = require("fs");
2
3
  const path = require("path");
3
4
  const os = require("os");
@@ -40,47 +41,38 @@ function prompt(question) {
40
41
  }
41
42
 
42
43
  async function selectFolder(initialFolder) {
43
- let folder = path.resolve(initialFolder);
44
-
45
- while (true) {
46
- console.log();
47
- console.log(chalk.bold.cyan(" Workspace: ") + chalk.white(folder));
48
- console.log();
49
-
50
- if (isTrusted(folder)) {
51
- console.log(chalk.green(" ✓ Working in " + folder + " (trusted)"));
52
- return folder;
53
- }
54
-
55
- console.log(chalk.yellow(" Do you trust the files in this folder?"));
56
- console.log();
57
- console.log(" " + chalk.bold("1)") + " Yes, I trust this folder");
58
- console.log(" " + chalk.bold("2)") + " No, exit");
59
- console.log(" " + chalk.bold("3)") + " Choose a different folder");
60
- console.log();
61
-
62
- const answer = await prompt(chalk.cyan(" Your choice (1/2/3): "));
44
+ const chalk = require("chalk");
45
+ const fs = require("fs");
46
+ const folder = initialFolder || process.cwd();
47
+
48
+ if (isTrusted(folder)) {
49
+ console.log(chalk.green(" Working in " + folder + " (trusted)"));
50
+ return folder;
51
+ }
63
52
 
64
- if (answer === "1") {
65
- trustFolder(folder);
66
- console.log(chalk.green("\n Folder trusted and saved.\n"));
67
- return folder;
68
- } else if (answer === "2") {
69
- console.log(chalk.red("\n Exiting.\n"));
70
- process.exit(0);
71
- } else if (answer === "3") {
72
- const newPath = await prompt(chalk.cyan(" Enter folder path: "));
73
- if (!newPath) continue;
74
- const resolved = path.resolve(newPath);
75
- if (!fs.existsSync(resolved)) {
76
- console.log(chalk.red(" Folder does not exist: " + resolved));
77
- continue;
78
- }
79
- folder = resolved;
80
- } else {
81
- console.log(chalk.red(" Invalid choice."));
82
- }
53
+ console.log(chalk.cyan(" Workspace: ") + chalk.white(folder));
54
+
55
+ const { trust } = await inquirer.prompt([{
56
+ type: "list",
57
+ name: "trust",
58
+ message: chalk.yellow("Do you trust the files in this folder?"),
59
+ choices: [
60
+ { name: "Yes, I trust this folder", value: "yes" },
61
+ { name: "No, exit", value: "no" },
62
+ { name: "Choose a different folder", value: "choose" }
63
+ ]
64
+ }]);
65
+
66
+ if (trust === "no") { process.exit(0); }
67
+ if (trust === "choose") {
68
+ const { newFolder } = await inquirer.prompt([{ type: "input", name: "newFolder", message: "Folder path:" }]);
69
+ const resolved = require("path").resolve(newFolder);
70
+ if (!fs.existsSync(resolved)) { console.log(chalk.red(" Folder not found.")); process.exit(1); }
71
+ return selectFolder(resolved);
83
72
  }
73
+ trustFolder(folder);
74
+ console.log(chalk.green(" Folder trusted."));
75
+ return folder;
84
76
  }
85
77
 
86
78
  function loadProjectConfig(folder) {
package/package.json CHANGED
@@ -1,19 +1,33 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "6.2.1",
3
+ "version": "6.3.0",
4
4
  "description": "BLUN AI Assistant - Command Line Interface",
5
- "bin": { "blun": "./bin/blun.js" },
6
- "files": ["bin/", "lib/", "README.md"],
7
- "keywords": ["ai", "cli", "blun", "assistant"],
5
+ "bin": {
6
+ "blun": "./bin/blun.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "lib/",
11
+ "README.md"
12
+ ],
13
+ "keywords": [
14
+ "ai",
15
+ "cli",
16
+ "blun",
17
+ "assistant"
18
+ ],
8
19
  "author": "BLUN AI <info@blun.ai>",
9
20
  "license": "MIT",
10
21
  "dependencies": {
22
+ "boxen": "^5.1.2",
11
23
  "chalk": "^4.1.2",
12
- "ora": "^5.4.1",
13
24
  "cli-table3": "^0.6.3",
14
- "boxen": "^5.1.2",
25
+ "figlet": "^1.7.0",
15
26
  "gradient-string": "^2.0.2",
16
- "figlet": "^1.7.0"
27
+ "inquirer": "^8.2.7",
28
+ "ora": "^5.4.1"
17
29
  },
18
- "engines": { "node": ">=18" }
30
+ "engines": {
31
+ "node": ">=18"
32
+ }
19
33
  }
package/lib/auth_test.js DELETED
@@ -1,11 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const os = require('os');
4
- const https = require('https');
5
- const readline = require('readline');
6
- const chalk = require('chalk');
7
-
8
- const CREDS_DIR = path.join(os.homedir(), '.blun');
9
- const CREDS_FILE = path.join(CREDS_DIR, 'credentials.json');
10
- const SETTINGS_FILE = path.join(CREDS_DIR, 'settings.json');
11
- const BASE_URL = 'blun.ai';