bravecode-cli 0.1.32 → 0.1.33

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/cli-main.mjs CHANGED
@@ -38185,7 +38185,7 @@ var APP_VERSION, APP_NAME;
38185
38185
  var init_version = __esm({
38186
38186
  "src/version.ts"() {
38187
38187
  "use strict";
38188
- APP_VERSION = "0.1.32";
38188
+ APP_VERSION = "0.1.33";
38189
38189
  APP_NAME = "BraveCode";
38190
38190
  }
38191
38191
  });
@@ -42137,7 +42137,9 @@ function CommandPalette({
42137
42137
  const filtered = React4.useMemo(() => {
42138
42138
  if (!filter3) return COMMANDS;
42139
42139
  const lower = filter3.toLowerCase();
42140
- return COMMANDS.filter((c) => c.name.toLowerCase().includes(lower));
42140
+ return COMMANDS.filter(
42141
+ (c) => c.name.toLowerCase().includes(lower) || c.description.toLowerCase().includes(lower)
42142
+ );
42141
42143
  }, [filter3]);
42142
42144
  if (filtered.length === 0) return null;
42143
42145
  return /* @__PURE__ */ jsxs(
@@ -42146,19 +42148,22 @@ function CommandPalette({
42146
42148
  style: {
42147
42149
  position: "absolute",
42148
42150
  bottom: 6,
42149
- width: 50,
42150
- maxHeight: 12,
42151
+ width: 60,
42152
+ maxHeight: 16,
42151
42153
  border: true,
42152
42154
  borderStyle: "rounded",
42153
42155
  borderColor: colors2.primary,
42154
42156
  backgroundColor: colors2.surface2,
42155
- padding: 1,
42157
+ paddingLeft: 1,
42158
+ paddingRight: 1,
42159
+ paddingTop: 1,
42160
+ paddingBottom: 1,
42156
42161
  flexDirection: "column",
42157
42162
  zIndex: 10,
42158
42163
  marginLeft: 1
42159
42164
  },
42160
42165
  children: [
42161
- /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: /* @__PURE__ */ jsx("b", { children: "Commands" }) }),
42166
+ /* @__PURE__ */ jsx("text", { fg: colors2.primary, children: /* @__PURE__ */ jsx("b", { children: " Commands" }) }),
42162
42167
  filtered.map((cmd, i) => /* @__PURE__ */ jsxs(
42163
42168
  "box",
42164
42169
  {
@@ -42173,16 +42178,17 @@ function CommandPalette({
42173
42178
  width: "100%"
42174
42179
  },
42175
42180
  children: [
42176
- /* @__PURE__ */ jsx("text", { fg: i === selectedIndex ? colors2.primary : colors2.text, children: /* @__PURE__ */ jsx("b", { children: cmd.name }) }),
42177
- /* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
42181
+ /* @__PURE__ */ jsx("text", { fg: i === selectedIndex ? "#ffffff" : colors2.text, children: cmd.name }),
42182
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: cmd.description }),
42183
+ cmd.shortcut ? /* @__PURE__ */ jsxs("text", { fg: colors2.accent, children: [
42178
42184
  " ",
42179
- cmd.description
42180
- ] })
42185
+ cmd.shortcut
42186
+ ] }) : null
42181
42187
  ]
42182
42188
  },
42183
42189
  cmd.name
42184
42190
  )),
42185
- /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc close" })
42191
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: " \u2191\u2193 navigate \xB7 Enter select \xB7 Esc close" })
42186
42192
  ]
42187
42193
  }
42188
42194
  );
@@ -42190,26 +42196,38 @@ function CommandPalette({
42190
42196
  function InputEditor({
42191
42197
  onSubmit,
42192
42198
  placeholder,
42193
- showAbove,
42194
- inputValue,
42195
- onInputChange,
42196
- paletteOpen,
42197
- paletteFilter,
42198
- paletteSelectedIndex
42199
+ showAbove
42199
42200
  }) {
42200
42201
  const { colors: colors2 } = useTheme();
42201
42202
  const { isRunning } = useAgent();
42203
+ const [value, setValue] = React4.useState("");
42202
42204
  const inputRef = React4.useRef(null);
42205
+ const paletteOpen = value.startsWith("/");
42206
+ const paletteFilter = value.slice(1);
42207
+ const filteredCommands = React4.useMemo(() => {
42208
+ if (!paletteOpen) return [];
42209
+ const lower = paletteFilter.toLowerCase();
42210
+ if (!lower) return COMMANDS;
42211
+ return COMMANDS.filter(
42212
+ (c) => c.name.toLowerCase().includes(lower) || c.description.toLowerCase().includes(lower)
42213
+ );
42214
+ }, [paletteOpen, paletteFilter]);
42203
42215
  const doSubmit = () => {
42204
- if (!inputValue.trim()) return;
42216
+ if (!value.trim()) return;
42205
42217
  if (isRunning) return;
42206
- const v = inputValue;
42207
- onInputChange("");
42218
+ if (paletteOpen && filteredCommands.length > 0) {
42219
+ const cmd = filteredCommands[0];
42220
+ setValue("");
42221
+ onSubmit(cmd.name);
42222
+ return;
42223
+ }
42224
+ const v = value;
42225
+ setValue("");
42208
42226
  onSubmit(v);
42209
42227
  };
42210
42228
  if (showAbove) {
42211
42229
  return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column" }, children: [
42212
- paletteOpen ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, selectedIndex: paletteSelectedIndex }) : null,
42230
+ paletteOpen && filteredCommands.length > 0 ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, selectedIndex: 0 }) : null,
42213
42231
  /* @__PURE__ */ jsx("box", { style: {
42214
42232
  border: true,
42215
42233
  borderStyle: "single",
@@ -42226,8 +42244,8 @@ function InputEditor({
42226
42244
  "input",
42227
42245
  {
42228
42246
  ref: inputRef,
42229
- value: inputValue,
42230
- onChange: (val) => onInputChange(s(val)),
42247
+ value,
42248
+ onChange: (val) => setValue(s(val)),
42231
42249
  onSubmit: () => doSubmit(),
42232
42250
  placeholder: s(placeholder),
42233
42251
  placeholderColor: colors2.textMuted,
@@ -42239,7 +42257,7 @@ function InputEditor({
42239
42257
  ] });
42240
42258
  }
42241
42259
  return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column" }, children: [
42242
- paletteOpen ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, selectedIndex: paletteSelectedIndex }) : null,
42260
+ paletteOpen && filteredCommands.length > 0 ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, selectedIndex: 0 }) : null,
42243
42261
  /* @__PURE__ */ jsx(AgentModelLine, { inline: false }),
42244
42262
  /* @__PURE__ */ jsx("box", { style: {
42245
42263
  border: true,
@@ -42256,8 +42274,8 @@ function InputEditor({
42256
42274
  "input",
42257
42275
  {
42258
42276
  ref: inputRef,
42259
- value: inputValue,
42260
- onChange: (val) => onInputChange(s(val)),
42277
+ value,
42278
+ onChange: (val) => setValue(s(val)),
42261
42279
  onSubmit: () => doSubmit(),
42262
42280
  placeholder: s(placeholder),
42263
42281
  placeholderColor: colors2.textMuted,
@@ -42457,79 +42475,7 @@ function App() {
42457
42475
  const [sidebarForced, setSidebarForced] = React4.useState(false);
42458
42476
  const sidebarVisible = sidebarForced || width >= SIDEBAR_BREAKPOINT;
42459
42477
  const [infoCompact, setInfoCompact] = React4.useState(false);
42460
- const [inputValue, setInputValue] = React4.useState("");
42461
- const paletteOpen = inputValue.startsWith("/");
42462
- const paletteFilter = inputValue.slice(1);
42463
- const [paletteSelectedIndex, setPaletteSelectedIndex] = React4.useState(0);
42464
- const filteredCommands = React4.useMemo(() => {
42465
- if (!paletteOpen) return [];
42466
- const lower = paletteFilter.toLowerCase();
42467
- if (!lower) return COMMANDS;
42468
- return COMMANDS.filter((c) => c.name.toLowerCase().includes(lower));
42469
- }, [paletteOpen, paletteFilter]);
42470
- React4.useEffect(() => {
42471
- setPaletteSelectedIndex(0);
42472
- }, [paletteFilter]);
42473
- const handleSubmit = (value) => {
42474
- if (value.startsWith("/")) {
42475
- const [command, ...args] = value.slice(1).split(" ");
42476
- void args;
42477
- switch (command) {
42478
- case "help":
42479
- openDialog("help");
42480
- return;
42481
- case "models":
42482
- case "model":
42483
- openDialog("model");
42484
- return;
42485
- case "agents":
42486
- case "agent":
42487
- openDialog("model");
42488
- return;
42489
- case "clear":
42490
- process.stdout.write("\x1B[2J\x1B[H");
42491
- return;
42492
- case "status":
42493
- openDialog("help");
42494
- return;
42495
- case "exit":
42496
- case "quit":
42497
- try {
42498
- renderer.destroy();
42499
- } catch {
42500
- process.exit(0);
42501
- }
42502
- return;
42503
- default:
42504
- break;
42505
- }
42506
- }
42507
- setInputValue("");
42508
- void sendMessage(value);
42509
- };
42510
42478
  useKeyboard((key) => {
42511
- if (paletteOpen && filteredCommands.length > 0) {
42512
- if (key.name === "arrowDown") {
42513
- setPaletteSelectedIndex((i) => Math.min(i + 1, filteredCommands.length - 1));
42514
- return true;
42515
- }
42516
- if (key.name === "arrowUp") {
42517
- setPaletteSelectedIndex((i) => Math.max(0, i - 1));
42518
- return true;
42519
- }
42520
- if (key.name === "return" || key.name === "enter") {
42521
- const cmd = filteredCommands[paletteSelectedIndex];
42522
- if (cmd) {
42523
- setInputValue("");
42524
- handleSubmit(cmd.name);
42525
- }
42526
- return true;
42527
- }
42528
- if (key.name === "escape") {
42529
- setInputValue("");
42530
- return true;
42531
- }
42532
- }
42533
42479
  if (key.ctrl && key.name === "p") {
42534
42480
  openDialog("model");
42535
42481
  return true;
@@ -42571,6 +42517,42 @@ function App() {
42571
42517
  }
42572
42518
  return false;
42573
42519
  });
42520
+ const handleSubmit = (value) => {
42521
+ if (value.startsWith("/")) {
42522
+ const [command, ...args] = value.slice(1).split(" ");
42523
+ void args;
42524
+ switch (command) {
42525
+ case "help":
42526
+ openDialog("help");
42527
+ return;
42528
+ case "models":
42529
+ case "model":
42530
+ openDialog("model");
42531
+ return;
42532
+ case "agents":
42533
+ case "agent":
42534
+ openDialog("model");
42535
+ return;
42536
+ case "clear":
42537
+ process.stdout.write("\x1B[2J\x1B[H");
42538
+ return;
42539
+ case "status":
42540
+ openDialog("help");
42541
+ return;
42542
+ case "exit":
42543
+ case "quit":
42544
+ try {
42545
+ renderer.destroy();
42546
+ } catch {
42547
+ process.exit(0);
42548
+ }
42549
+ return;
42550
+ default:
42551
+ break;
42552
+ }
42553
+ }
42554
+ void sendMessage(value);
42555
+ };
42574
42556
  const hasMessages = messages.length > 0;
42575
42557
  React4.useEffect(() => {
42576
42558
  if (width < SIDEBAR_BREAKPOINT && !sidebarForced) setInfoCompact(true);
@@ -42601,12 +42583,7 @@ function App() {
42601
42583
  {
42602
42584
  onSubmit: handleSubmit,
42603
42585
  placeholder: isRunning ? "Generating\u2026 press esc to interrupt" : 'Ask anything... "What is the tech stack of this project?"',
42604
- showAbove: false,
42605
- inputValue,
42606
- onInputChange: setInputValue,
42607
- paletteOpen,
42608
- paletteFilter,
42609
- paletteSelectedIndex
42586
+ showAbove: false
42610
42587
  }
42611
42588
  ),
42612
42589
  /* @__PURE__ */ jsx(ShortcutHints, { interrupted: isRunning })
@@ -42616,12 +42593,7 @@ function App() {
42616
42593
  {
42617
42594
  onSubmit: handleSubmit,
42618
42595
  placeholder: 'Ask anything... "What is the tech stack of this project?"',
42619
- showAbove: true,
42620
- inputValue,
42621
- onInputChange: setInputValue,
42622
- paletteOpen,
42623
- paletteFilter,
42624
- paletteSelectedIndex
42596
+ showAbove: true
42625
42597
  }
42626
42598
  ) }),
42627
42599
  /* @__PURE__ */ jsx(ShortcutHints, { interrupted: isRunning })
@@ -42646,12 +42618,14 @@ var init_app = __esm({
42646
42618
  init_autoModel();
42647
42619
  SIDEBAR_BREAKPOINT = 90;
42648
42620
  COMMANDS = [
42649
- { name: "/help", description: "Show help and shortcuts" },
42650
- { name: "/models", description: "Switch model" },
42651
- { name: "/agents", description: "Switch agent" },
42652
- { name: "/clear", description: "Clear screen" },
42653
- { name: "/status", description: "Show session status" },
42654
- { name: "/exit", description: "Exit application" }
42621
+ { name: "/theme", description: "Switch terminal theme", shortcut: "" },
42622
+ { name: "/model", description: "Switch language model", shortcut: "ctrl+p" },
42623
+ { name: "/agents", description: "Switch agent", shortcut: "tab" },
42624
+ { name: "/clear", description: "Clear terminal", shortcut: "" },
42625
+ { name: "/compact", description: "Compact conversation", shortcut: "" },
42626
+ { name: "/help", description: "Show help & shortcuts", shortcut: "" },
42627
+ { name: "/status", description: "Show config status", shortcut: "" },
42628
+ { name: "/exit", description: "Exit application", shortcut: "ctrl+c" }
42655
42629
  ];
42656
42630
  }
42657
42631
  });