bravecode-cli 0.1.31 → 0.1.32
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 +105 -90
- package/dist/cli-main.mjs.map +2 -2
- package/package.json +1 -1
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.
|
|
38188
|
+
APP_VERSION = "0.1.32";
|
|
38189
38189
|
APP_NAME = "BraveCode";
|
|
38190
38190
|
}
|
|
38191
38191
|
});
|
|
@@ -42131,43 +42131,14 @@ function MessageContainer() {
|
|
|
42131
42131
|
}
|
|
42132
42132
|
function CommandPalette({
|
|
42133
42133
|
filter: filter3,
|
|
42134
|
-
|
|
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
42140
|
return COMMANDS.filter((c) => c.name.toLowerCase().includes(lower));
|
|
42144
42141
|
}, [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
42142
|
if (filtered.length === 0) return null;
|
|
42172
42143
|
return /* @__PURE__ */ jsxs(
|
|
42173
42144
|
"box",
|
|
@@ -42196,13 +42167,13 @@ function CommandPalette({
|
|
|
42196
42167
|
paddingRight: 1,
|
|
42197
42168
|
paddingTop: 0,
|
|
42198
42169
|
paddingBottom: 0,
|
|
42199
|
-
backgroundColor: i ===
|
|
42170
|
+
backgroundColor: i === selectedIndex ? colors2.primaryDim : "transparent",
|
|
42200
42171
|
flexDirection: "row",
|
|
42201
42172
|
justifyContent: "space-between",
|
|
42202
42173
|
width: "100%"
|
|
42203
42174
|
},
|
|
42204
42175
|
children: [
|
|
42205
|
-
/* @__PURE__ */ jsx("text", { fg: i ===
|
|
42176
|
+
/* @__PURE__ */ jsx("text", { fg: i === selectedIndex ? colors2.primary : colors2.text, children: /* @__PURE__ */ jsx("b", { children: cmd.name }) }),
|
|
42206
42177
|
/* @__PURE__ */ jsxs("text", { fg: colors2.textMuted, children: [
|
|
42207
42178
|
" ",
|
|
42208
42179
|
cmd.description
|
|
@@ -42219,35 +42190,30 @@ function CommandPalette({
|
|
|
42219
42190
|
function InputEditor({
|
|
42220
42191
|
onSubmit,
|
|
42221
42192
|
placeholder,
|
|
42222
|
-
showAbove
|
|
42193
|
+
showAbove,
|
|
42194
|
+
inputValue,
|
|
42195
|
+
onInputChange,
|
|
42196
|
+
paletteOpen,
|
|
42197
|
+
paletteFilter,
|
|
42198
|
+
paletteSelectedIndex
|
|
42223
42199
|
}) {
|
|
42224
42200
|
const { colors: colors2 } = useTheme();
|
|
42225
42201
|
const { isRunning } = useAgent();
|
|
42226
|
-
const [value, setValue] = React4.useState("");
|
|
42227
42202
|
const inputRef = React4.useRef(null);
|
|
42228
|
-
const showPalette = value.startsWith("/");
|
|
42229
|
-
const paletteFilter = value.slice(1);
|
|
42230
42203
|
const doSubmit = () => {
|
|
42231
|
-
if (!
|
|
42204
|
+
if (!inputValue.trim()) return;
|
|
42232
42205
|
if (isRunning) return;
|
|
42233
|
-
const v =
|
|
42234
|
-
|
|
42206
|
+
const v = inputValue;
|
|
42207
|
+
onInputChange("");
|
|
42235
42208
|
onSubmit(v);
|
|
42236
42209
|
};
|
|
42237
|
-
const handlePaletteSelect = (command) => {
|
|
42238
|
-
setValue("");
|
|
42239
|
-
onSubmit(command);
|
|
42240
|
-
};
|
|
42241
|
-
const handlePaletteClose = () => {
|
|
42242
|
-
setValue("");
|
|
42243
|
-
};
|
|
42244
42210
|
if (showAbove) {
|
|
42245
42211
|
return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column" }, children: [
|
|
42246
|
-
|
|
42212
|
+
paletteOpen ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, selectedIndex: paletteSelectedIndex }) : null,
|
|
42247
42213
|
/* @__PURE__ */ jsx("box", { style: {
|
|
42248
42214
|
border: true,
|
|
42249
42215
|
borderStyle: "single",
|
|
42250
|
-
borderColor: isRunning ? colors2.warning : colors2.border,
|
|
42216
|
+
borderColor: isRunning ? colors2.warning : paletteOpen ? colors2.primary : colors2.border,
|
|
42251
42217
|
paddingLeft: 2,
|
|
42252
42218
|
paddingRight: 2,
|
|
42253
42219
|
paddingTop: 1,
|
|
@@ -42260,8 +42226,8 @@ function InputEditor({
|
|
|
42260
42226
|
"input",
|
|
42261
42227
|
{
|
|
42262
42228
|
ref: inputRef,
|
|
42263
|
-
value:
|
|
42264
|
-
onChange: (val) =>
|
|
42229
|
+
value: inputValue,
|
|
42230
|
+
onChange: (val) => onInputChange(s(val)),
|
|
42265
42231
|
onSubmit: () => doSubmit(),
|
|
42266
42232
|
placeholder: s(placeholder),
|
|
42267
42233
|
placeholderColor: colors2.textMuted,
|
|
@@ -42273,12 +42239,12 @@ function InputEditor({
|
|
|
42273
42239
|
] });
|
|
42274
42240
|
}
|
|
42275
42241
|
return /* @__PURE__ */ jsxs("box", { style: { flexDirection: "column" }, children: [
|
|
42276
|
-
|
|
42242
|
+
paletteOpen ? /* @__PURE__ */ jsx(CommandPalette, { filter: paletteFilter, selectedIndex: paletteSelectedIndex }) : null,
|
|
42277
42243
|
/* @__PURE__ */ jsx(AgentModelLine, { inline: false }),
|
|
42278
42244
|
/* @__PURE__ */ jsx("box", { style: {
|
|
42279
42245
|
border: true,
|
|
42280
42246
|
borderStyle: "single",
|
|
42281
|
-
borderColor: isRunning ? colors2.warning : colors2.border,
|
|
42247
|
+
borderColor: isRunning ? colors2.warning : paletteOpen ? colors2.primary : colors2.border,
|
|
42282
42248
|
paddingLeft: 2,
|
|
42283
42249
|
paddingRight: 2,
|
|
42284
42250
|
paddingTop: 1,
|
|
@@ -42290,8 +42256,8 @@ function InputEditor({
|
|
|
42290
42256
|
"input",
|
|
42291
42257
|
{
|
|
42292
42258
|
ref: inputRef,
|
|
42293
|
-
value:
|
|
42294
|
-
onChange: (val) =>
|
|
42259
|
+
value: inputValue,
|
|
42260
|
+
onChange: (val) => onInputChange(s(val)),
|
|
42295
42261
|
onSubmit: () => doSubmit(),
|
|
42296
42262
|
placeholder: s(placeholder),
|
|
42297
42263
|
placeholderColor: colors2.textMuted,
|
|
@@ -42491,7 +42457,79 @@ function App() {
|
|
|
42491
42457
|
const [sidebarForced, setSidebarForced] = React4.useState(false);
|
|
42492
42458
|
const sidebarVisible = sidebarForced || width >= SIDEBAR_BREAKPOINT;
|
|
42493
42459
|
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
|
+
};
|
|
42494
42510
|
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
|
+
}
|
|
42495
42533
|
if (key.ctrl && key.name === "p") {
|
|
42496
42534
|
openDialog("model");
|
|
42497
42535
|
return true;
|
|
@@ -42533,39 +42571,6 @@ function App() {
|
|
|
42533
42571
|
}
|
|
42534
42572
|
return false;
|
|
42535
42573
|
});
|
|
42536
|
-
const handleSubmit = (value) => {
|
|
42537
|
-
if (value.startsWith("/")) {
|
|
42538
|
-
const [command, ...args] = value.slice(1).split(" ");
|
|
42539
|
-
void args;
|
|
42540
|
-
switch (command) {
|
|
42541
|
-
case "help":
|
|
42542
|
-
openDialog("help");
|
|
42543
|
-
return;
|
|
42544
|
-
case "models":
|
|
42545
|
-
case "model":
|
|
42546
|
-
openDialog("model");
|
|
42547
|
-
return;
|
|
42548
|
-
case "agents":
|
|
42549
|
-
case "agent":
|
|
42550
|
-
openDialog("model");
|
|
42551
|
-
return;
|
|
42552
|
-
case "clear":
|
|
42553
|
-
process.stdout.write("\x1B[2J\x1B[H");
|
|
42554
|
-
return;
|
|
42555
|
-
case "exit":
|
|
42556
|
-
case "quit":
|
|
42557
|
-
try {
|
|
42558
|
-
renderer.destroy();
|
|
42559
|
-
} catch {
|
|
42560
|
-
process.exit(0);
|
|
42561
|
-
}
|
|
42562
|
-
return;
|
|
42563
|
-
default:
|
|
42564
|
-
break;
|
|
42565
|
-
}
|
|
42566
|
-
}
|
|
42567
|
-
void sendMessage(value);
|
|
42568
|
-
};
|
|
42569
42574
|
const hasMessages = messages.length > 0;
|
|
42570
42575
|
React4.useEffect(() => {
|
|
42571
42576
|
if (width < SIDEBAR_BREAKPOINT && !sidebarForced) setInfoCompact(true);
|
|
@@ -42596,7 +42601,12 @@ function App() {
|
|
|
42596
42601
|
{
|
|
42597
42602
|
onSubmit: handleSubmit,
|
|
42598
42603
|
placeholder: isRunning ? "Generating\u2026 press esc to interrupt" : 'Ask anything... "What is the tech stack of this project?"',
|
|
42599
|
-
showAbove: false
|
|
42604
|
+
showAbove: false,
|
|
42605
|
+
inputValue,
|
|
42606
|
+
onInputChange: setInputValue,
|
|
42607
|
+
paletteOpen,
|
|
42608
|
+
paletteFilter,
|
|
42609
|
+
paletteSelectedIndex
|
|
42600
42610
|
}
|
|
42601
42611
|
),
|
|
42602
42612
|
/* @__PURE__ */ jsx(ShortcutHints, { interrupted: isRunning })
|
|
@@ -42606,7 +42616,12 @@ function App() {
|
|
|
42606
42616
|
{
|
|
42607
42617
|
onSubmit: handleSubmit,
|
|
42608
42618
|
placeholder: 'Ask anything... "What is the tech stack of this project?"',
|
|
42609
|
-
showAbove: true
|
|
42619
|
+
showAbove: true,
|
|
42620
|
+
inputValue,
|
|
42621
|
+
onInputChange: setInputValue,
|
|
42622
|
+
paletteOpen,
|
|
42623
|
+
paletteFilter,
|
|
42624
|
+
paletteSelectedIndex
|
|
42610
42625
|
}
|
|
42611
42626
|
) }),
|
|
42612
42627
|
/* @__PURE__ */ jsx(ShortcutHints, { interrupted: isRunning })
|