bravecode-cli 0.1.31 → 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.31";
38188
+ APP_VERSION = "0.1.33";
38189
38189
  APP_NAME = "BraveCode";
38190
38190
  }
38191
38191
  });
@@ -42131,43 +42131,16 @@ function MessageContainer() {
42131
42131
  }
42132
42132
  function CommandPalette({
42133
42133
  filter: filter3,
42134
- onSelect,
42135
- onClose
42134
+ selectedIndex
42136
42135
  }) {
42137
42136
  const { colors: colors2 } = useTheme();
42138
- const selectedIdx = React4.useRef(0);
42139
- const [, forceUpdate] = React4.useState(0);
42140
42137
  const filtered = React4.useMemo(() => {
42141
42138
  if (!filter3) return COMMANDS;
42142
42139
  const lower = filter3.toLowerCase();
42143
- return COMMANDS.filter((c) => c.name.toLowerCase().includes(lower));
42144
- }, [filter3]);
42145
- React4.useEffect(() => {
42146
- selectedIdx.current = 0;
42140
+ return COMMANDS.filter(
42141
+ (c) => c.name.toLowerCase().includes(lower) || c.description.toLowerCase().includes(lower)
42142
+ );
42147
42143
  }, [filter3]);
42148
- useKeyboard((key) => {
42149
- if (filtered.length === 0) return false;
42150
- if (key.name === "arrowDown") {
42151
- selectedIdx.current = Math.min(selectedIdx.current + 1, filtered.length - 1);
42152
- forceUpdate((n) => n + 1);
42153
- return true;
42154
- }
42155
- if (key.name === "arrowUp") {
42156
- selectedIdx.current = Math.max(0, selectedIdx.current - 1);
42157
- forceUpdate((n) => n + 1);
42158
- return true;
42159
- }
42160
- if (key.name === "return" || key.name === "enter") {
42161
- const cmd = filtered[selectedIdx.current];
42162
- if (cmd) onSelect(cmd.name);
42163
- return true;
42164
- }
42165
- if (key.name === "escape") {
42166
- onClose();
42167
- return true;
42168
- }
42169
- return false;
42170
- });
42171
42144
  if (filtered.length === 0) return null;
42172
42145
  return /* @__PURE__ */ jsxs(
42173
42146
  "box",
@@ -42175,19 +42148,22 @@ function CommandPalette({
42175
42148
  style: {
42176
42149
  position: "absolute",
42177
42150
  bottom: 6,
42178
- width: 50,
42179
- maxHeight: 12,
42151
+ width: 60,
42152
+ maxHeight: 16,
42180
42153
  border: true,
42181
42154
  borderStyle: "rounded",
42182
42155
  borderColor: colors2.primary,
42183
42156
  backgroundColor: colors2.surface2,
42184
- padding: 1,
42157
+ paddingLeft: 1,
42158
+ paddingRight: 1,
42159
+ paddingTop: 1,
42160
+ paddingBottom: 1,
42185
42161
  flexDirection: "column",
42186
42162
  zIndex: 10,
42187
42163
  marginLeft: 1
42188
42164
  },
42189
42165
  children: [
42190
- /* @__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" }) }),
42191
42167
  filtered.map((cmd, i) => /* @__PURE__ */ jsxs(
42192
42168
  "box",
42193
42169
  {
@@ -42196,22 +42172,23 @@ function CommandPalette({
42196
42172
  paddingRight: 1,
42197
42173
  paddingTop: 0,
42198
42174
  paddingBottom: 0,
42199
- backgroundColor: i === selectedIdx.current ? colors2.primaryDim : "transparent",
42175
+ backgroundColor: i === selectedIndex ? colors2.primaryDim : "transparent",
42200
42176
  flexDirection: "row",
42201
42177
  justifyContent: "space-between",
42202
42178
  width: "100%"
42203
42179
  },
42204
42180
  children: [
42205
- /* @__PURE__ */ jsx("text", { fg: i === selectedIdx.current ? colors2.primary : colors2.text, children: /* @__PURE__ */ jsx("b", { children: cmd.name }) }),
42206
- /* @__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: [
42207
42184
  " ",
42208
- cmd.description
42209
- ] })
42185
+ cmd.shortcut
42186
+ ] }) : null
42210
42187
  ]
42211
42188
  },
42212
42189
  cmd.name
42213
42190
  )),
42214
- /* @__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" })
42215
42192
  ]
42216
42193
  }
42217
42194
  );
@@ -42225,29 +42202,36 @@ function InputEditor({
42225
42202
  const { isRunning } = useAgent();
42226
42203
  const [value, setValue] = React4.useState("");
42227
42204
  const inputRef = React4.useRef(null);
42228
- const showPalette = value.startsWith("/");
42205
+ const paletteOpen = value.startsWith("/");
42229
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]);
42230
42215
  const doSubmit = () => {
42231
42216
  if (!value.trim()) return;
42232
42217
  if (isRunning) return;
42218
+ if (paletteOpen && filteredCommands.length > 0) {
42219
+ const cmd = filteredCommands[0];
42220
+ setValue("");
42221
+ onSubmit(cmd.name);
42222
+ return;
42223
+ }
42233
42224
  const v = value;
42234
42225
  setValue("");
42235
42226
  onSubmit(v);
42236
42227
  };
42237
- const handlePaletteSelect = (command) => {
42238
- setValue("");
42239
- onSubmit(command);
42240
- };
42241
- const handlePaletteClose = () => {
42242
- setValue("");
42243
- };
42244
42228
  if (showAbove) {
42245
42229
  return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column" }, children: [
42246
- showPalette ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, onSelect: handlePaletteSelect, onClose: handlePaletteClose }) : null,
42230
+ paletteOpen && filteredCommands.length > 0 ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, selectedIndex: 0 }) : null,
42247
42231
  /* @__PURE__ */ jsx("box", { style: {
42248
42232
  border: true,
42249
42233
  borderStyle: "single",
42250
- borderColor: isRunning ? colors2.warning : colors2.border,
42234
+ borderColor: isRunning ? colors2.warning : paletteOpen ? colors2.primary : colors2.border,
42251
42235
  paddingLeft: 2,
42252
42236
  paddingRight: 2,
42253
42237
  paddingTop: 1,
@@ -42260,7 +42244,7 @@ function InputEditor({
42260
42244
  "input",
42261
42245
  {
42262
42246
  ref: inputRef,
42263
- value: s(value),
42247
+ value,
42264
42248
  onChange: (val) => setValue(s(val)),
42265
42249
  onSubmit: () => doSubmit(),
42266
42250
  placeholder: s(placeholder),
@@ -42273,12 +42257,12 @@ function InputEditor({
42273
42257
  ] });
42274
42258
  }
42275
42259
  return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column" }, children: [
42276
- showPalette ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, onSelect: handlePaletteSelect, onClose: handlePaletteClose }) : null,
42260
+ paletteOpen && filteredCommands.length > 0 ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, selectedIndex: 0 }) : null,
42277
42261
  /* @__PURE__ */ jsx(AgentModelLine, { inline: false }),
42278
42262
  /* @__PURE__ */ jsx("box", { style: {
42279
42263
  border: true,
42280
42264
  borderStyle: "single",
42281
- borderColor: isRunning ? colors2.warning : colors2.border,
42265
+ borderColor: isRunning ? colors2.warning : paletteOpen ? colors2.primary : colors2.border,
42282
42266
  paddingLeft: 2,
42283
42267
  paddingRight: 2,
42284
42268
  paddingTop: 1,
@@ -42290,7 +42274,7 @@ function InputEditor({
42290
42274
  "input",
42291
42275
  {
42292
42276
  ref: inputRef,
42293
- value: s(value),
42277
+ value,
42294
42278
  onChange: (val) => setValue(s(val)),
42295
42279
  onSubmit: () => doSubmit(),
42296
42280
  placeholder: s(placeholder),
@@ -42552,6 +42536,9 @@ function App() {
42552
42536
  case "clear":
42553
42537
  process.stdout.write("\x1B[2J\x1B[H");
42554
42538
  return;
42539
+ case "status":
42540
+ openDialog("help");
42541
+ return;
42555
42542
  case "exit":
42556
42543
  case "quit":
42557
42544
  try {
@@ -42631,12 +42618,14 @@ var init_app = __esm({
42631
42618
  init_autoModel();
42632
42619
  SIDEBAR_BREAKPOINT = 90;
42633
42620
  COMMANDS = [
42634
- { name: "/help", description: "Show help and shortcuts" },
42635
- { name: "/models", description: "Switch model" },
42636
- { name: "/agents", description: "Switch agent" },
42637
- { name: "/clear", description: "Clear screen" },
42638
- { name: "/status", description: "Show session status" },
42639
- { 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" }
42640
42629
  ];
42641
42630
  }
42642
42631
  });