bravecode-cli 0.1.30 → 0.1.31

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.30";
38188
+ APP_VERSION = "0.1.31";
38189
38189
  APP_NAME = "BraveCode";
38190
38190
  }
38191
38191
  });
@@ -42129,6 +42129,93 @@ function MessageContainer() {
42129
42129
  const { colors: colors2 } = useTheme();
42130
42130
  return /* @__PURE__ */ jsx("scrollbox", { style: { flexGrow: 1, backgroundColor: colors2.bg, paddingLeft: 1, paddingRight: 1 }, children: /* @__PURE__ */ jsx("box", { style: { flexDirection: "column", gap: 1, paddingTop: 1 }, children: messages.map((msg) => /* @__PURE__ */ jsx(MessageBubble, { msg }, s(msg.id))) }) });
42131
42131
  }
42132
+ function CommandPalette({
42133
+ filter: filter3,
42134
+ onSelect,
42135
+ onClose
42136
+ }) {
42137
+ const { colors: colors2 } = useTheme();
42138
+ const selectedIdx = React4.useRef(0);
42139
+ const [, forceUpdate] = React4.useState(0);
42140
+ const filtered = React4.useMemo(() => {
42141
+ if (!filter3) return COMMANDS;
42142
+ const lower = filter3.toLowerCase();
42143
+ return COMMANDS.filter((c) => c.name.toLowerCase().includes(lower));
42144
+ }, [filter3]);
42145
+ React4.useEffect(() => {
42146
+ selectedIdx.current = 0;
42147
+ }, [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
+ if (filtered.length === 0) return null;
42172
+ return /* @__PURE__ */ jsxs(
42173
+ "box",
42174
+ {
42175
+ style: {
42176
+ position: "absolute",
42177
+ bottom: 6,
42178
+ width: 50,
42179
+ maxHeight: 12,
42180
+ border: true,
42181
+ borderStyle: "rounded",
42182
+ borderColor: colors2.primary,
42183
+ backgroundColor: colors2.surface2,
42184
+ padding: 1,
42185
+ flexDirection: "column",
42186
+ zIndex: 10,
42187
+ marginLeft: 1
42188
+ },
42189
+ children: [
42190
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: /* @__PURE__ */ jsx("b", { children: "Commands" }) }),
42191
+ filtered.map((cmd, i) => /* @__PURE__ */ jsxs(
42192
+ "box",
42193
+ {
42194
+ style: {
42195
+ paddingLeft: 1,
42196
+ paddingRight: 1,
42197
+ paddingTop: 0,
42198
+ paddingBottom: 0,
42199
+ backgroundColor: i === selectedIdx.current ? colors2.primaryDim : "transparent",
42200
+ flexDirection: "row",
42201
+ justifyContent: "space-between",
42202
+ width: "100%"
42203
+ },
42204
+ 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: [
42207
+ " ",
42208
+ cmd.description
42209
+ ] })
42210
+ ]
42211
+ },
42212
+ cmd.name
42213
+ )),
42214
+ /* @__PURE__ */ jsx("text", { fg: colors2.textMuted, children: "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc close" })
42215
+ ]
42216
+ }
42217
+ );
42218
+ }
42132
42219
  function InputEditor({
42133
42220
  onSubmit,
42134
42221
  placeholder,
@@ -42138,6 +42225,8 @@ function InputEditor({
42138
42225
  const { isRunning } = useAgent();
42139
42226
  const [value, setValue] = React4.useState("");
42140
42227
  const inputRef = React4.useRef(null);
42228
+ const showPalette = value.startsWith("/");
42229
+ const paletteFilter = value.slice(1);
42141
42230
  const doSubmit = () => {
42142
42231
  if (!value.trim()) return;
42143
42232
  if (isRunning) return;
@@ -42145,8 +42234,16 @@ function InputEditor({
42145
42234
  setValue("");
42146
42235
  onSubmit(v);
42147
42236
  };
42237
+ const handlePaletteSelect = (command) => {
42238
+ setValue("");
42239
+ onSubmit(command);
42240
+ };
42241
+ const handlePaletteClose = () => {
42242
+ setValue("");
42243
+ };
42148
42244
  if (showAbove) {
42149
42245
  return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column" }, children: [
42246
+ showPalette ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, onSelect: handlePaletteSelect, onClose: handlePaletteClose }) : null,
42150
42247
  /* @__PURE__ */ jsx("box", { style: {
42151
42248
  border: true,
42152
42249
  borderStyle: "single",
@@ -42176,6 +42273,7 @@ function InputEditor({
42176
42273
  ] });
42177
42274
  }
42178
42275
  return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column" }, children: [
42276
+ showPalette ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, onSelect: handlePaletteSelect, onClose: handlePaletteClose }) : null,
42179
42277
  /* @__PURE__ */ jsx(AgentModelLine, { inline: false }),
42180
42278
  /* @__PURE__ */ jsx("box", { style: {
42181
42279
  border: true,
@@ -42522,7 +42620,7 @@ function App() {
42522
42620
  /* @__PURE__ */ jsx(ToastContainer, {})
42523
42621
  ] });
42524
42622
  }
42525
- var SIDEBAR_BREAKPOINT;
42623
+ var SIDEBAR_BREAKPOINT, COMMANDS;
42526
42624
  var init_app = __esm({
42527
42625
  "src/core/tui/app.tsx"() {
42528
42626
  "use strict";
@@ -42532,6 +42630,14 @@ var init_app = __esm({
42532
42630
  init_version();
42533
42631
  init_autoModel();
42534
42632
  SIDEBAR_BREAKPOINT = 90;
42633
+ 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" }
42640
+ ];
42535
42641
  }
42536
42642
  });
42537
42643