bravecode-cli 0.1.12 → 0.1.14
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.mjs +65 -88
- package/dist/cli.mjs.map +4 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -38047,7 +38047,7 @@ var APP_VERSION;
|
|
|
38047
38047
|
var init_version = __esm({
|
|
38048
38048
|
"src/version.ts"() {
|
|
38049
38049
|
"use strict";
|
|
38050
|
-
APP_VERSION = "0.1.
|
|
38050
|
+
APP_VERSION = "0.1.14";
|
|
38051
38051
|
}
|
|
38052
38052
|
});
|
|
38053
38053
|
|
|
@@ -41142,8 +41142,8 @@ var init_default = __esm({
|
|
|
41142
41142
|
darkTheme = {
|
|
41143
41143
|
name: "dark",
|
|
41144
41144
|
colors: {
|
|
41145
|
-
// Background
|
|
41146
|
-
background: "
|
|
41145
|
+
// Background - use terminal default dark background
|
|
41146
|
+
background: "#1e1e1e",
|
|
41147
41147
|
backgroundSecondary: "#1a1a2e",
|
|
41148
41148
|
backgroundHighlight: "#16213e",
|
|
41149
41149
|
// Text
|
|
@@ -41583,19 +41583,13 @@ import { Box, Text } from "ink";
|
|
|
41583
41583
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
41584
41584
|
function Logo({ width = 80 }) {
|
|
41585
41585
|
const logo = [
|
|
41586
|
-
"
|
|
41587
|
-
"
|
|
41588
|
-
"
|
|
41589
|
-
"
|
|
41590
|
-
"
|
|
41591
|
-
"\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u255D\u255A\u2550\u2550\u255D "
|
|
41586
|
+
" ____ _ ____ __ ",
|
|
41587
|
+
"| __ ) ___ ___ | | _____ | __ ) ___ / _| ",
|
|
41588
|
+
"| _ \\ / _ \\ / _ \\| |/ / _ \\ | _ \\ / _ \\ | |_ ",
|
|
41589
|
+
"| |_) | (_) | (_) | < __/ | |_) | (_) || _| ",
|
|
41590
|
+
"|____/ \\___/ \\___/|_|\\_\\___| |____/ \\___/ |_| "
|
|
41592
41591
|
];
|
|
41593
|
-
|
|
41594
|
-
const centeredLines = logo.map((line) => {
|
|
41595
|
-
const padding = Math.max(0, Math.floor((width - line.length) / 2));
|
|
41596
|
-
return " ".repeat(padding) + line;
|
|
41597
|
-
});
|
|
41598
|
-
return /* @__PURE__ */ jsx6(Box, { flexDirection: "column", alignItems: "center", children: centeredLines.map((line, i) => /* @__PURE__ */ jsx6(Text, { color: "gray", children: line }, i)) });
|
|
41592
|
+
return /* @__PURE__ */ jsx6(Box, { flexDirection: "column", alignItems: "center", children: logo.map((line, i) => /* @__PURE__ */ jsx6(Text, { color: "gray", bold: true, children: line }, i)) });
|
|
41599
41593
|
}
|
|
41600
41594
|
var init_logo = __esm({
|
|
41601
41595
|
"src/core/tui/components/logo.tsx"() {
|
|
@@ -41953,19 +41947,17 @@ var init_input_editor = __esm({
|
|
|
41953
41947
|
// src/core/tui/components/status-bar.tsx
|
|
41954
41948
|
import "react";
|
|
41955
41949
|
import { Box as Box5, Text as Text5 } from "ink";
|
|
41956
|
-
import {
|
|
41950
|
+
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
41957
41951
|
function StatusBar() {
|
|
41958
41952
|
const { colors } = useTheme();
|
|
41959
41953
|
const { currentAgent, isRunning } = useAgent();
|
|
41960
41954
|
const width = process.stdout.columns || 80;
|
|
41961
41955
|
const cwd = process.cwd().replace(process.env.HOME || "", "~");
|
|
41962
41956
|
return /* @__PURE__ */ jsxs4(Box5, { justifyContent: "space-between", width, children: [
|
|
41963
|
-
/* @__PURE__ */ jsxs4(Box5, { gap:
|
|
41957
|
+
/* @__PURE__ */ jsxs4(Box5, { gap: 2, children: [
|
|
41964
41958
|
/* @__PURE__ */ jsx10(Text5, { color: colors.textMuted, children: cwd }),
|
|
41965
|
-
|
|
41966
|
-
|
|
41967
|
-
/* @__PURE__ */ jsx10(Text5, { color: colors.warning, children: "\u25CF running" })
|
|
41968
|
-
] })
|
|
41959
|
+
/* @__PURE__ */ jsx10(Text5, { color: colors.textMuted, children: "\u25CF 1 MCP" }),
|
|
41960
|
+
/* @__PURE__ */ jsx10(Text5, { color: colors.textMuted, children: "/status" })
|
|
41969
41961
|
] }),
|
|
41970
41962
|
/* @__PURE__ */ jsx10(Text5, { color: colors.textMuted, children: APP_VERSION })
|
|
41971
41963
|
] });
|
|
@@ -42028,32 +42020,17 @@ var init_toast2 = __esm({
|
|
|
42028
42020
|
}
|
|
42029
42021
|
});
|
|
42030
42022
|
|
|
42031
|
-
// src/core/tui/components/
|
|
42023
|
+
// src/core/tui/components/model-selector.tsx
|
|
42032
42024
|
import { useState as useState7 } from "react";
|
|
42033
42025
|
import { Box as Box7, Text as Text7, useInput as useInput2 } from "ink";
|
|
42034
42026
|
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
42035
|
-
var init_command_palette = __esm({
|
|
42036
|
-
"src/core/tui/components/command-palette.tsx"() {
|
|
42037
|
-
"use strict";
|
|
42038
|
-
init_theme();
|
|
42039
|
-
init_dialog();
|
|
42040
|
-
init_agent2();
|
|
42041
|
-
init_session();
|
|
42042
|
-
init_toast();
|
|
42043
|
-
}
|
|
42044
|
-
});
|
|
42045
|
-
|
|
42046
|
-
// src/core/tui/components/model-selector.tsx
|
|
42047
|
-
import { useState as useState8 } from "react";
|
|
42048
|
-
import { Box as Box8, Text as Text8, useInput as useInput3 } from "ink";
|
|
42049
|
-
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
42050
42027
|
function ModelSelector() {
|
|
42051
42028
|
const { colors } = useTheme();
|
|
42052
42029
|
const { currentModel, setModel } = useAgent();
|
|
42053
42030
|
const { closeDialog } = useDialog();
|
|
42054
42031
|
const toast = useToast();
|
|
42055
|
-
const [selectedIndex, setSelectedIndex] =
|
|
42056
|
-
const [filter3, setFilter] =
|
|
42032
|
+
const [selectedIndex, setSelectedIndex] = useState7(0);
|
|
42033
|
+
const [filter3, setFilter] = useState7("");
|
|
42057
42034
|
const models = models_default.models.map((m) => ({
|
|
42058
42035
|
id: m.id,
|
|
42059
42036
|
name: m.name,
|
|
@@ -42063,7 +42040,7 @@ function ModelSelector() {
|
|
|
42063
42040
|
const filteredModels = models.filter(
|
|
42064
42041
|
(m) => m.tags.includes("free") && (m.name.toLowerCase().includes(filter3.toLowerCase()) || m.id.toLowerCase().includes(filter3.toLowerCase()))
|
|
42065
42042
|
);
|
|
42066
|
-
|
|
42043
|
+
useInput2((input, key) => {
|
|
42067
42044
|
if (key.escape) {
|
|
42068
42045
|
closeDialog();
|
|
42069
42046
|
return;
|
|
@@ -42097,9 +42074,9 @@ function ModelSelector() {
|
|
|
42097
42074
|
const renderModel = (model, index) => {
|
|
42098
42075
|
const isSelected = model.id === currentModel;
|
|
42099
42076
|
const isHighlighted = index === selectedIndex;
|
|
42100
|
-
return /* @__PURE__ */
|
|
42101
|
-
/* @__PURE__ */
|
|
42102
|
-
|
|
42077
|
+
return /* @__PURE__ */ jsxs6(Box7, { children: [
|
|
42078
|
+
/* @__PURE__ */ jsxs6(
|
|
42079
|
+
Text7,
|
|
42103
42080
|
{
|
|
42104
42081
|
bold: isHighlighted,
|
|
42105
42082
|
color: isSelected ? colors.primary : isHighlighted ? colors.accent : colors.text,
|
|
@@ -42109,16 +42086,16 @@ function ModelSelector() {
|
|
|
42109
42086
|
]
|
|
42110
42087
|
}
|
|
42111
42088
|
),
|
|
42112
|
-
/* @__PURE__ */
|
|
42089
|
+
/* @__PURE__ */ jsxs6(Text7, { color: colors.textMuted, children: [
|
|
42113
42090
|
" (",
|
|
42114
42091
|
model.provider,
|
|
42115
42092
|
")"
|
|
42116
42093
|
] }),
|
|
42117
|
-
model.tags.includes("free") && /* @__PURE__ */
|
|
42094
|
+
model.tags.includes("free") && /* @__PURE__ */ jsx12(Text7, { color: colors.success, children: " free" })
|
|
42118
42095
|
] }, model.id);
|
|
42119
42096
|
};
|
|
42120
|
-
return /* @__PURE__ */
|
|
42121
|
-
|
|
42097
|
+
return /* @__PURE__ */ jsxs6(
|
|
42098
|
+
Box7,
|
|
42122
42099
|
{
|
|
42123
42100
|
flexDirection: "column",
|
|
42124
42101
|
borderStyle: "double",
|
|
@@ -42128,17 +42105,17 @@ function ModelSelector() {
|
|
|
42128
42105
|
top: "50%",
|
|
42129
42106
|
left: "50%",
|
|
42130
42107
|
children: [
|
|
42131
|
-
/* @__PURE__ */
|
|
42132
|
-
/* @__PURE__ */
|
|
42133
|
-
/* @__PURE__ */
|
|
42134
|
-
/* @__PURE__ */
|
|
42135
|
-
/* @__PURE__ */
|
|
42108
|
+
/* @__PURE__ */ jsx12(Box7, { paddingX: 1, children: /* @__PURE__ */ jsx12(Text7, { bold: true, color: colors.primary, children: "Select Model" }) }),
|
|
42109
|
+
/* @__PURE__ */ jsxs6(Box7, { paddingX: 1, children: [
|
|
42110
|
+
/* @__PURE__ */ jsx12(Text7, { color: colors.textMuted, children: "Search: " }),
|
|
42111
|
+
/* @__PURE__ */ jsx12(Text7, { children: filter3 }),
|
|
42112
|
+
/* @__PURE__ */ jsx12(Text7, { inverse: true, children: " " })
|
|
42136
42113
|
] }),
|
|
42137
|
-
/* @__PURE__ */
|
|
42138
|
-
/* @__PURE__ */
|
|
42114
|
+
/* @__PURE__ */ jsxs6(Box7, { flexDirection: "column", paddingX: 1, maxHeight: 15, children: [
|
|
42115
|
+
/* @__PURE__ */ jsx12(Text7, { color: colors.textMuted, children: "Available Models (free):" }),
|
|
42139
42116
|
filteredModels.map((model, index) => renderModel(model, index))
|
|
42140
42117
|
] }),
|
|
42141
|
-
/* @__PURE__ */
|
|
42118
|
+
/* @__PURE__ */ jsx12(Box7, { paddingX: 1, children: /* @__PURE__ */ jsx12(Text7, { color: colors.textMuted, children: "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc close" }) })
|
|
42142
42119
|
]
|
|
42143
42120
|
}
|
|
42144
42121
|
);
|
|
@@ -42155,14 +42132,14 @@ var init_model_selector = __esm({
|
|
|
42155
42132
|
});
|
|
42156
42133
|
|
|
42157
42134
|
// src/core/tui/hooks/use-agent.ts
|
|
42158
|
-
import { useCallback as
|
|
42135
|
+
import { useCallback as useCallback7, useRef as useRef3 } from "react";
|
|
42159
42136
|
function useAgent2() {
|
|
42160
42137
|
const { addMessage, updateMessage, addToolCall, updateToolCall } = useSession();
|
|
42161
42138
|
const { currentAgent, currentModel, setRunning } = useAgent();
|
|
42162
42139
|
const toast = useToast();
|
|
42163
42140
|
const agentRef = useRef3(null);
|
|
42164
42141
|
const abortRef = useRef3(null);
|
|
42165
|
-
const sendMessage =
|
|
42142
|
+
const sendMessage = useCallback7(async (content) => {
|
|
42166
42143
|
const userMessage = addMessage({
|
|
42167
42144
|
role: "user",
|
|
42168
42145
|
content,
|
|
@@ -42222,7 +42199,7 @@ function useAgent2() {
|
|
|
42222
42199
|
setRunning,
|
|
42223
42200
|
toast
|
|
42224
42201
|
]);
|
|
42225
|
-
const cancelCurrent =
|
|
42202
|
+
const cancelCurrent = useCallback7(() => {
|
|
42226
42203
|
if (abortRef.current) {
|
|
42227
42204
|
abortRef.current.abort();
|
|
42228
42205
|
abortRef.current = null;
|
|
@@ -42251,8 +42228,8 @@ var init_use_agent = __esm({
|
|
|
42251
42228
|
|
|
42252
42229
|
// src/core/tui/app.tsx
|
|
42253
42230
|
import "react";
|
|
42254
|
-
import { Box as
|
|
42255
|
-
import { jsx as
|
|
42231
|
+
import { Box as Box8, Text as Text8, useInput as useInput3, useApp as useApp2 } from "ink";
|
|
42232
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
42256
42233
|
function App() {
|
|
42257
42234
|
const { colors } = useTheme();
|
|
42258
42235
|
const { messages } = useSession();
|
|
@@ -42260,7 +42237,7 @@ function App() {
|
|
|
42260
42237
|
const { isOpen, openDialog, closeDialog, dialog } = useDialog();
|
|
42261
42238
|
const { sendMessage, cancelCurrent } = useAgent2();
|
|
42262
42239
|
const { exit } = useApp2();
|
|
42263
|
-
|
|
42240
|
+
useInput3((input, key) => {
|
|
42264
42241
|
if (key.ctrl && input === "p") {
|
|
42265
42242
|
openDialog("model");
|
|
42266
42243
|
return;
|
|
@@ -42300,10 +42277,6 @@ function App() {
|
|
|
42300
42277
|
case "agent":
|
|
42301
42278
|
openDialog("agent");
|
|
42302
42279
|
return;
|
|
42303
|
-
case "sessions":
|
|
42304
|
-
case "session":
|
|
42305
|
-
openDialog("sessions");
|
|
42306
|
-
return;
|
|
42307
42280
|
case "clear":
|
|
42308
42281
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
42309
42282
|
return;
|
|
@@ -42318,20 +42291,20 @@ function App() {
|
|
|
42318
42291
|
await sendMessage(value);
|
|
42319
42292
|
};
|
|
42320
42293
|
const hasMessages = messages.length > 0;
|
|
42321
|
-
return /* @__PURE__ */
|
|
42322
|
-
|
|
42294
|
+
return /* @__PURE__ */ jsxs7(
|
|
42295
|
+
Box8,
|
|
42323
42296
|
{
|
|
42324
42297
|
flexDirection: "column",
|
|
42325
42298
|
width: "100%",
|
|
42326
42299
|
height: "100%",
|
|
42327
42300
|
backgroundColor: colors.background,
|
|
42328
42301
|
children: [
|
|
42329
|
-
/* @__PURE__ */
|
|
42302
|
+
/* @__PURE__ */ jsx13(Box8, { flexDirection: "column", flexGrow: 1, justifyContent: hasMessages ? "flex-start" : "center", children: hasMessages ? /* @__PURE__ */ jsx13(MessageContainer, {}) : (
|
|
42330
42303
|
/* Welcome screen - centered layout like OpenCode */
|
|
42331
|
-
/* @__PURE__ */
|
|
42332
|
-
/* @__PURE__ */
|
|
42333
|
-
/* @__PURE__ */
|
|
42334
|
-
|
|
42304
|
+
/* @__PURE__ */ jsxs7(Box8, { flexDirection: "column", alignItems: "center", gap: 1, children: [
|
|
42305
|
+
/* @__PURE__ */ jsx13(Logo, {}),
|
|
42306
|
+
/* @__PURE__ */ jsx13(
|
|
42307
|
+
Box8,
|
|
42335
42308
|
{
|
|
42336
42309
|
flexDirection: "column",
|
|
42337
42310
|
width: 60,
|
|
@@ -42339,7 +42312,7 @@ function App() {
|
|
|
42339
42312
|
borderColor: colors.border,
|
|
42340
42313
|
paddingX: 2,
|
|
42341
42314
|
paddingY: 1,
|
|
42342
|
-
children: /* @__PURE__ */
|
|
42315
|
+
children: /* @__PURE__ */ jsx13(
|
|
42343
42316
|
InputEditor,
|
|
42344
42317
|
{
|
|
42345
42318
|
onSubmit: handleSubmit,
|
|
@@ -42348,20 +42321,20 @@ function App() {
|
|
|
42348
42321
|
)
|
|
42349
42322
|
}
|
|
42350
42323
|
),
|
|
42351
|
-
/* @__PURE__ */
|
|
42352
|
-
/* @__PURE__ */
|
|
42353
|
-
/* @__PURE__ */
|
|
42354
|
-
/* @__PURE__ */
|
|
42324
|
+
/* @__PURE__ */ jsxs7(Box8, { gap: 1, children: [
|
|
42325
|
+
/* @__PURE__ */ jsx13(Text8, { bold: true, color: colors.primary, children: currentAgent.name }),
|
|
42326
|
+
/* @__PURE__ */ jsx13(Text8, { color: colors.textMuted, children: "\xB7" }),
|
|
42327
|
+
/* @__PURE__ */ jsx13(Text8, { color: colors.textSecondary, children: currentModel })
|
|
42355
42328
|
] }),
|
|
42356
|
-
/* @__PURE__ */
|
|
42357
|
-
/* @__PURE__ */
|
|
42358
|
-
/* @__PURE__ */
|
|
42329
|
+
/* @__PURE__ */ jsxs7(Box8, { gap: 2, children: [
|
|
42330
|
+
/* @__PURE__ */ jsx13(Text8, { color: colors.textMuted, children: "tab agents" }),
|
|
42331
|
+
/* @__PURE__ */ jsx13(Text8, { color: colors.textMuted, children: "ctrl+p commands" })
|
|
42359
42332
|
] })
|
|
42360
42333
|
] })
|
|
42361
42334
|
) }),
|
|
42362
|
-
/* @__PURE__ */
|
|
42363
|
-
isOpen && dialog.type === "model" && /* @__PURE__ */
|
|
42364
|
-
/* @__PURE__ */
|
|
42335
|
+
/* @__PURE__ */ jsx13(StatusBar, {}),
|
|
42336
|
+
isOpen && dialog.type === "model" && /* @__PURE__ */ jsx13(ModelSelector, {}),
|
|
42337
|
+
/* @__PURE__ */ jsx13(ToastContainer, {})
|
|
42365
42338
|
]
|
|
42366
42339
|
}
|
|
42367
42340
|
);
|
|
@@ -42378,7 +42351,6 @@ var init_app = __esm({
|
|
|
42378
42351
|
init_input_editor();
|
|
42379
42352
|
init_status_bar();
|
|
42380
42353
|
init_toast2();
|
|
42381
|
-
init_command_palette();
|
|
42382
42354
|
init_model_selector();
|
|
42383
42355
|
init_use_agent();
|
|
42384
42356
|
}
|
|
@@ -42391,7 +42363,7 @@ __export(tui_exports, {
|
|
|
42391
42363
|
});
|
|
42392
42364
|
import "react";
|
|
42393
42365
|
import { render } from "ink";
|
|
42394
|
-
import { jsx as
|
|
42366
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
42395
42367
|
var TUILauncher;
|
|
42396
42368
|
var init_tui = __esm({
|
|
42397
42369
|
"src/core/tui/index.tsx"() {
|
|
@@ -42408,15 +42380,20 @@ var init_tui = __esm({
|
|
|
42408
42380
|
this.options = options;
|
|
42409
42381
|
}
|
|
42410
42382
|
async start() {
|
|
42383
|
+
process.stdout.write("\x1B[2J\x1B[H");
|
|
42411
42384
|
const { waitUntilExit } = render(
|
|
42412
|
-
/* @__PURE__ */
|
|
42385
|
+
/* @__PURE__ */ jsx14(ThemeProvider, { children: /* @__PURE__ */ jsx14(SessionProvider, { children: /* @__PURE__ */ jsx14(
|
|
42413
42386
|
AgentProvider,
|
|
42414
42387
|
{
|
|
42415
42388
|
initialAgent: this.options.agent || "build",
|
|
42416
42389
|
initialModel: this.options.model,
|
|
42417
|
-
children: /* @__PURE__ */
|
|
42390
|
+
children: /* @__PURE__ */ jsx14(DialogProvider, { children: /* @__PURE__ */ jsx14(ToastProvider, { children: /* @__PURE__ */ jsx14(App, {}) }) })
|
|
42418
42391
|
}
|
|
42419
|
-
) }) })
|
|
42392
|
+
) }) }),
|
|
42393
|
+
{
|
|
42394
|
+
// Ensure Ink takes over the terminal
|
|
42395
|
+
exitOnCtrlC: true
|
|
42396
|
+
}
|
|
42420
42397
|
);
|
|
42421
42398
|
await waitUntilExit();
|
|
42422
42399
|
}
|