blun-king-cli 5.4.0 → 6.1.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.
Files changed (56) hide show
  1. package/bin/blun.js +134 -0
  2. package/lib/auth.js +162 -0
  3. package/lib/chat.js +82 -0
  4. package/lib/client.js +65 -0
  5. package/lib/ui.js +215 -0
  6. package/lib/workspace.js +110 -0
  7. package/package.json +14 -18
  8. package/api.js +0 -965
  9. package/blun-cli.js +0 -3726
  10. package/blun-cli.js.claude +0 -3578
  11. package/blunking-api.js +0 -7
  12. package/bot.js +0 -188
  13. package/browser-controller.js +0 -116
  14. package/chat-memory.js +0 -103
  15. package/file-helper.js +0 -63
  16. package/fuzzy-match.js +0 -78
  17. package/identities.js +0 -106
  18. package/installer.js +0 -160
  19. package/job-manager.js +0 -146
  20. package/local-data.js +0 -71
  21. package/message-builder.js +0 -28
  22. package/noisy-evals.js +0 -38
  23. package/palace-memory.js +0 -246
  24. package/reference-inspector.js +0 -256
  25. package/runtime.js +0 -570
  26. package/task-executor.js +0 -104
  27. package/tests/browser-controller.test.js +0 -47
  28. package/tests/cli.test.js +0 -93
  29. package/tests/file-helper.test.js +0 -18
  30. package/tests/installer.test.js +0 -39
  31. package/tests/job-manager.test.js +0 -99
  32. package/tests/merge-compat.test.js +0 -77
  33. package/tests/messages.test.js +0 -23
  34. package/tests/noisy-evals.test.js +0 -12
  35. package/tests/noisy-intent-corpus.test.js +0 -45
  36. package/tests/reference-inspector.test.js +0 -42
  37. package/tests/runtime.test.js +0 -119
  38. package/tests/task-executor.test.js +0 -40
  39. package/tests/tools.test.js +0 -23
  40. package/tests/user-profile.test.js +0 -66
  41. package/tests/website-builder.test.js +0 -66
  42. package/tmp-build-smoke/nicrazy-landing/index.html +0 -53
  43. package/tmp-build-smoke/nicrazy-landing/style.css +0 -110
  44. package/tmp-shot-smoke/website-shot-1776006760424.png +0 -0
  45. package/tmp-shot-smoke/website-shot-1776007850007.png +0 -0
  46. package/tmp-shot-smoke/website-shot-1776007886209.png +0 -0
  47. package/tmp-shot-smoke/website-shot-1776007903766.png +0 -0
  48. package/tmp-shot-smoke/website-shot-1776008737117.png +0 -0
  49. package/tmp-shot-smoke/website-shot-1776008988859.png +0 -0
  50. package/tmp-smoke/nicrazy-landing/index.html +0 -66
  51. package/tmp-smoke/nicrazy-landing/style.css +0 -104
  52. package/tools.js +0 -177
  53. package/user-profile.js +0 -395
  54. package/website-builder.js +0 -394
  55. package/website-shot-1776010648230.png +0 -0
  56. package/website_builder.txt +0 -38
@@ -0,0 +1,110 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const os = require("os");
4
+ const readline = require("readline");
5
+ const chalk = require("chalk");
6
+
7
+ const TRUST_FILE = path.join(os.homedir(), ".blun", "trusted-folders.json");
8
+
9
+ function loadTrusted() {
10
+ try {
11
+ return JSON.parse(fs.readFileSync(TRUST_FILE, "utf8"));
12
+ } catch {
13
+ return [];
14
+ }
15
+ }
16
+
17
+ function saveTrusted(folders) {
18
+ const dir = path.dirname(TRUST_FILE);
19
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
20
+ fs.writeFileSync(TRUST_FILE, JSON.stringify(folders, null, 2));
21
+ }
22
+
23
+ function isTrusted(folder) {
24
+ return loadTrusted().includes(path.resolve(folder));
25
+ }
26
+
27
+ function trustFolder(folder) {
28
+ const abs = path.resolve(folder);
29
+ const trusted = loadTrusted();
30
+ if (!trusted.includes(abs)) {
31
+ trusted.push(abs);
32
+ saveTrusted(trusted);
33
+ }
34
+ return abs;
35
+ }
36
+
37
+ function prompt(question) {
38
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
39
+ return new Promise((resolve) => rl.question(question, (a) => { rl.close(); resolve(a.trim()); }));
40
+ }
41
+
42
+ 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): "));
63
+
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
+ }
83
+ }
84
+ }
85
+
86
+ function loadProjectConfig(folder) {
87
+ const mdPath = path.join(folder, "BLUN.md");
88
+ if (fs.existsSync(mdPath)) {
89
+ const content = fs.readFileSync(mdPath, "utf8");
90
+ console.log(chalk.green(" Found project config: BLUN.md"));
91
+ return content;
92
+ }
93
+ return null;
94
+ }
95
+
96
+ function initProject(folder) {
97
+ const dir = path.resolve(folder);
98
+ const blunDir = path.join(dir, ".blun");
99
+ if (!fs.existsSync(blunDir)) fs.mkdirSync(blunDir, { recursive: true });
100
+
101
+ const mdPath = path.join(dir, "BLUN.md");
102
+ if (!fs.existsSync(mdPath)) {
103
+ fs.writeFileSync(mdPath, `# Project Name\n\nYour project name here.\n\n## Description\n\nBrief description of the project.\n\n## Rules\n\n- Add project-specific rules here\n\n## Context\n\n- Add relevant context for the AI assistant\n`);
104
+ }
105
+ console.log(chalk.green(" ✓ Initialized BLUN project in " + dir));
106
+ console.log(chalk.dim(" Created: .blun/ directory"));
107
+ console.log(chalk.dim(" Created: BLUN.md template"));
108
+ }
109
+
110
+ module.exports = { trustFolder, isTrusted, selectFolder, initProject, loadProjectConfig };
package/package.json CHANGED
@@ -1,23 +1,19 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "5.4.0",
4
- "description": "BLUN King CLI Your local AI assistant powered by Gemma4",
5
- "type": "commonjs",
6
- "bin": {
7
- "blun": "./blun-cli.js"
8
- },
9
- "scripts": {
10
- "start": "node api.js",
11
- "cli": "node blun-cli.js",
12
- "bot": "node bot.js",
13
- "test": "node --test tests/*.test.js"
14
- },
3
+ "version": "6.1.0",
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"],
8
+ "author": "BLUN AI <info@blun.ai>",
9
+ "license": "MIT",
15
10
  "dependencies": {
16
- "express": "^5.1.0",
17
- "node-telegram-bot-api": "^0.66.0",
18
- "playwright": "^1.53.0"
11
+ "chalk": "^4.1.2",
12
+ "ora": "^5.4.1",
13
+ "cli-table3": "^0.6.3",
14
+ "boxen": "^5.1.2",
15
+ "gradient-string": "^2.0.2",
16
+ "figlet": "^1.7.0"
19
17
  },
20
- "keywords": ["ai", "cli", "blun", "gemma", "local-ai"],
21
- "author": "BLUN AI",
22
- "license": "MIT"
18
+ "engines": { "node": ">=18" }
23
19
  }