prab-cli 1.2.0 → 1.2.1

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/dist/index.js CHANGED
@@ -195,8 +195,9 @@ program.action(async () => {
195
195
  tracker_1.tracker.modelInit(modelConfig.modelId, "groq", false, e.message);
196
196
  process.exit(1);
197
197
  }
198
- // Display banner
199
- (0, ui_1.banner)(modelConfig.modelId, toolRegistry.count());
198
+ // Display banner with customization
199
+ const customization = (0, config_1.getCustomization)();
200
+ (0, ui_1.banner)(modelConfig.modelId, toolRegistry.count(), customization);
200
201
  // Context Gathering
201
202
  const spinner = (0, ora_1.default)("Checking context...").start();
202
203
  const isRepo = await (0, context_1.isGitRepo)();
@@ -364,6 +365,81 @@ program.action(async () => {
364
365
  ui_1.log.success("API Key updated.");
365
366
  break;
366
367
  }
368
+ case "settings": {
369
+ console.log("\n┌─────────────────────────────────────┐");
370
+ console.log("│ CUSTOMIZATION │");
371
+ console.log("└─────────────────────────────────────┘\n");
372
+ const currentCustomization = (0, config_1.getCustomization)();
373
+ console.log(chalk_1.default.gray(` Current CLI Name: ${chalk_1.default.cyan(currentCustomization.cliName)}`));
374
+ console.log(chalk_1.default.gray(` Current User: ${chalk_1.default.cyan(currentCustomization.userName || "(not set)")}`));
375
+ console.log(chalk_1.default.gray(` Current Theme: ${chalk_1.default.cyan(currentCustomization.theme)}`));
376
+ console.log("");
377
+ try {
378
+ const settingChoice = await (0, select_1.default)({
379
+ message: "What would you like to customize?",
380
+ choices: [
381
+ { name: "Change CLI Name (banner text)", value: "cli-name" },
382
+ { name: "Set Your Name (greeting)", value: "user-name" },
383
+ {
384
+ name: "Change Theme (default, minimal, colorful)",
385
+ value: "theme",
386
+ },
387
+ { name: "Reset to Defaults", value: "reset" },
388
+ { name: "Cancel", value: "cancel" },
389
+ ],
390
+ });
391
+ if (settingChoice === "cli-name") {
392
+ const { newName } = await inquirer_1.default.prompt([
393
+ {
394
+ type: "input",
395
+ name: "newName",
396
+ message: "Enter new CLI name (e.g., 'My CLI', 'Dev Tool'):",
397
+ default: currentCustomization.cliName,
398
+ },
399
+ ]);
400
+ if (newName && newName.trim()) {
401
+ (0, config_1.setCliName)(newName.trim());
402
+ ui_1.log.success(`CLI name changed to: ${newName.trim()}`);
403
+ ui_1.log.info("Restart the CLI to see the new banner.");
404
+ }
405
+ }
406
+ else if (settingChoice === "user-name") {
407
+ const { newUserName } = await inquirer_1.default.prompt([
408
+ {
409
+ type: "input",
410
+ name: "newUserName",
411
+ message: "Enter your name (for greeting):",
412
+ default: currentCustomization.userName || "",
413
+ },
414
+ ]);
415
+ if (newUserName && newUserName.trim()) {
416
+ (0, config_1.setUserName)(newUserName.trim());
417
+ ui_1.log.success(`Welcome message will now greet: ${newUserName.trim()}`);
418
+ }
419
+ }
420
+ else if (settingChoice === "theme") {
421
+ const themeChoice = await (0, select_1.default)({
422
+ message: "Select a theme:",
423
+ choices: [
424
+ { name: "Default (Cyan)", value: "default" },
425
+ { name: "Minimal (White)", value: "minimal" },
426
+ { name: "Colorful (Magenta)", value: "colorful" },
427
+ ],
428
+ });
429
+ (0, config_1.setTheme)(themeChoice);
430
+ ui_1.log.success(`Theme changed to: ${themeChoice}`);
431
+ ui_1.log.info("Restart the CLI to see the new theme.");
432
+ }
433
+ else if (settingChoice === "reset") {
434
+ (0, config_1.resetCustomization)();
435
+ ui_1.log.success("Customization reset to defaults.");
436
+ }
437
+ }
438
+ catch {
439
+ // User cancelled
440
+ }
441
+ break;
442
+ }
367
443
  case "exit": {
368
444
  process.exit(0);
369
445
  }
@@ -3,11 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.clearSessionData = exports.setSessionData = exports.getSessionData = exports.setPreference = exports.getPreferences = exports.setActiveModel = exports.getModelConfig = exports.clearApiKey = exports.setApiKey = exports.getApiKey = exports.getConfig = void 0;
6
+ exports.resetCustomization = exports.setTheme = exports.setUserName = exports.setCliName = exports.getCustomization = exports.clearSessionData = exports.setSessionData = exports.getSessionData = exports.setPreference = exports.getPreferences = exports.setActiveModel = exports.getModelConfig = exports.clearApiKey = exports.setApiKey = exports.getApiKey = exports.getConfig = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const os_1 = __importDefault(require("os"));
10
10
  const registry_1 = require("./models/registry");
11
+ const DEFAULT_CLI_NAME = "Prab CLI";
11
12
  const CONFIG_DIR = path_1.default.join(os_1.default.homedir(), ".config", "groq-cli-tool");
12
13
  const CONFIG_FILE = path_1.default.join(CONFIG_DIR, "config.json");
13
14
  const ensureConfigDir = () => {
@@ -50,6 +51,11 @@ const getConfig = () => {
50
51
  safeMode: config.preferences?.safeMode ?? true,
51
52
  maxTokens: config.preferences?.maxTokens,
52
53
  },
54
+ customization: {
55
+ cliName: config.customization?.cliName || DEFAULT_CLI_NAME,
56
+ userName: config.customization?.userName,
57
+ theme: config.customization?.theme || "default",
58
+ },
53
59
  session: config.session || { todos: [] },
54
60
  };
55
61
  };
@@ -154,3 +160,56 @@ const clearSessionData = () => {
154
160
  writeConfig(config);
155
161
  };
156
162
  exports.clearSessionData = clearSessionData;
163
+ /**
164
+ * Get customization settings
165
+ */
166
+ const getCustomization = () => {
167
+ const config = (0, exports.getConfig)();
168
+ return config.customization;
169
+ };
170
+ exports.getCustomization = getCustomization;
171
+ /**
172
+ * Set CLI name
173
+ */
174
+ const setCliName = (name) => {
175
+ const config = readConfig();
176
+ if (!config.customization) {
177
+ config.customization = { cliName: DEFAULT_CLI_NAME };
178
+ }
179
+ config.customization.cliName = name;
180
+ writeConfig(config);
181
+ };
182
+ exports.setCliName = setCliName;
183
+ /**
184
+ * Set user name
185
+ */
186
+ const setUserName = (name) => {
187
+ const config = readConfig();
188
+ if (!config.customization) {
189
+ config.customization = { cliName: DEFAULT_CLI_NAME };
190
+ }
191
+ config.customization.userName = name;
192
+ writeConfig(config);
193
+ };
194
+ exports.setUserName = setUserName;
195
+ /**
196
+ * Set theme
197
+ */
198
+ const setTheme = (theme) => {
199
+ const config = readConfig();
200
+ if (!config.customization) {
201
+ config.customization = { cliName: DEFAULT_CLI_NAME };
202
+ }
203
+ config.customization.theme = theme;
204
+ writeConfig(config);
205
+ };
206
+ exports.setTheme = setTheme;
207
+ /**
208
+ * Reset customization to defaults
209
+ */
210
+ const resetCustomization = () => {
211
+ const config = readConfig();
212
+ config.customization = { cliName: DEFAULT_CLI_NAME, theme: "default" };
213
+ writeConfig(config);
214
+ };
215
+ exports.resetCustomization = resetCustomization;
@@ -52,6 +52,12 @@ exports.SLASH_COMMANDS = [
52
52
  description: "Update your Groq API key",
53
53
  action: "api-key",
54
54
  },
55
+ {
56
+ name: "/settings",
57
+ description: "Customize CLI name, theme, and preferences",
58
+ shortcut: "s",
59
+ action: "settings",
60
+ },
55
61
  {
56
62
  name: "/exit",
57
63
  description: "Exit the application",
package/dist/lib/ui.js CHANGED
@@ -6,6 +6,64 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.StreamFormatter = exports.formatMarkdown = exports.showToolProgress = exports.showTodoList = exports.showDiff = exports.banner = exports.log = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const diff_1 = require("diff");
9
+ // Simple ASCII art letters for custom banners
10
+ const ASCII_LETTERS = {
11
+ A: [" █ ", " █ █ ", "█████", "█ █", "█ █"],
12
+ B: ["████ ", "█ █", "████ ", "█ █", "████ "],
13
+ C: [" ████", "█ ", "█ ", "█ ", " ████"],
14
+ D: ["████ ", "█ █", "█ █", "█ █", "████ "],
15
+ E: ["█████", "█ ", "████ ", "█ ", "█████"],
16
+ F: ["█████", "█ ", "████ ", "█ ", "█ "],
17
+ G: [" ████", "█ ", "█ ██", "█ █", " ████"],
18
+ H: ["█ █", "█ █", "█████", "█ █", "█ █"],
19
+ I: ["█████", " █ ", " █ ", " █ ", "█████"],
20
+ J: ["█████", " █ ", " █ ", "█ █ ", " ██ "],
21
+ K: ["█ █", "█ █ ", "███ ", "█ █ ", "█ █"],
22
+ L: ["█ ", "█ ", "█ ", "█ ", "█████"],
23
+ M: ["█ █", "██ ██", "█ █ █", "█ █", "█ █"],
24
+ N: ["█ █", "██ █", "█ █ █", "█ ██", "█ █"],
25
+ O: [" ███ ", "█ █", "█ █", "█ █", " ███ "],
26
+ P: ["████ ", "█ █", "████ ", "█ ", "█ "],
27
+ Q: [" ███ ", "█ █", "█ █ █", "█ █ ", " ██ █"],
28
+ R: ["████ ", "█ █", "████ ", "█ █ ", "█ █"],
29
+ S: [" ████", "█ ", " ███ ", " █", "████ "],
30
+ T: ["█████", " █ ", " █ ", " █ ", " █ "],
31
+ U: ["█ █", "█ █", "█ █", "█ █", " ███ "],
32
+ V: ["█ █", "█ █", "█ █", " █ █ ", " █ "],
33
+ W: ["█ █", "█ █", "█ █ █", "██ ██", "█ █"],
34
+ X: ["█ █", " █ █ ", " █ ", " █ █ ", "█ █"],
35
+ Y: ["█ █", " █ █ ", " █ ", " █ ", " █ "],
36
+ Z: ["█████", " █ ", " █ ", " █ ", "█████"],
37
+ " ": [" ", " ", " ", " ", " "],
38
+ "-": [" ", " ", "█████", " ", " "],
39
+ _: [" ", " ", " ", " ", "█████"],
40
+ ".": [" ", " ", " ", " ", " █ "],
41
+ "!": [" █ ", " █ ", " █ ", " ", " █ "],
42
+ "0": [" ███ ", "█ █", "█ █", "█ █", " ███ "],
43
+ "1": [" █ ", " ██ ", " █ ", " █ ", " ███ "],
44
+ "2": [" ███ ", "█ █", " ██ ", " █ ", "█████"],
45
+ "3": ["████ ", " █", " ███ ", " █", "████ "],
46
+ "4": ["█ █", "█ █", "█████", " █", " █"],
47
+ "5": ["█████", "█ ", "████ ", " █", "████ "],
48
+ "6": [" ███ ", "█ ", "████ ", "█ █", " ███ "],
49
+ "7": ["█████", " █", " █ ", " █ ", " █ "],
50
+ "8": [" ███ ", "█ █", " ███ ", "█ █", " ███ "],
51
+ "9": [" ███ ", "█ █", " ████", " █", " ███ "],
52
+ };
53
+ /**
54
+ * Generate ASCII art banner from text
55
+ */
56
+ const generateAsciiBanner = (text) => {
57
+ const upperText = text.toUpperCase();
58
+ const lines = ["", "", "", "", ""];
59
+ for (const char of upperText) {
60
+ const letterArt = ASCII_LETTERS[char] || ASCII_LETTERS[" "];
61
+ for (let i = 0; i < 5; i++) {
62
+ lines[i] += letterArt[i] + " ";
63
+ }
64
+ }
65
+ return lines.join("\n");
66
+ };
9
67
  // Syntax highlighting color schemes for different languages
10
68
  const syntaxColors = {
11
69
  keyword: chalk_1.default.magenta,
@@ -442,14 +500,18 @@ exports.log = {
442
500
  console.log(formatted);
443
501
  },
444
502
  };
445
- const banner = (modelName, toolCount) => {
446
- console.log(chalk_1.default.bold.cyan(`
447
- ____ __ ________ ____
448
- / __ \\_________ _/ /_ / ____/ / / _/
449
- / /_/ / ___/ __ \`/ __ \\ / / / / / /
450
- / ____/ / / /_/ / /_/ / / /___/ /____/ /
451
- /_/ /_/ \\__,_/_.___/ \\____/_____/___/
452
- `));
503
+ const banner = (modelName, toolCount, customization) => {
504
+ const cliName = customization?.cliName || "Prab CLI";
505
+ const userName = customization?.userName;
506
+ const theme = customization?.theme || "default";
507
+ // Choose color based on theme
508
+ const titleColor = theme === "colorful" ? chalk_1.default.bold.magenta : theme === "minimal" ? chalk_1.default.white : chalk_1.default.bold.cyan;
509
+ // Generate ASCII art for the CLI name
510
+ const asciiBanner = generateAsciiBanner(cliName);
511
+ console.log(titleColor("\n" + asciiBanner));
512
+ if (userName) {
513
+ console.log(chalk_1.default.gray(` Welcome, ${chalk_1.default.cyan(userName)}!`));
514
+ }
453
515
  if (modelName) {
454
516
  console.log(chalk_1.default.gray(` Active Model: ${chalk_1.default.cyan(modelName)}`));
455
517
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prab-cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "AI-powered coding assistant for your terminal. Built with Groq's lightning-fast LLMs, featuring autonomous tool execution, syntax-highlighted output, and git integration.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {