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 +19 -18
- package/lib/workspace.js +31 -39
- package/package.json +22 -8
- package/lib/auth_test.js +0 -11
package/lib/auth.js
CHANGED
|
@@ -183,24 +183,25 @@ async function whoami() {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
async function showWelcomeMenu() {
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
console.log();
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "BLUN AI Assistant - Command Line Interface",
|
|
5
|
-
"bin": {
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
"
|
|
25
|
+
"figlet": "^1.7.0",
|
|
15
26
|
"gradient-string": "^2.0.2",
|
|
16
|
-
"
|
|
27
|
+
"inquirer": "^8.2.7",
|
|
28
|
+
"ora": "^5.4.1"
|
|
17
29
|
},
|
|
18
|
-
"engines": {
|
|
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';
|