bimmo-cli 4.0.3 → 4.0.5
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/package.json +1 -1
- package/src/interface.js +24 -10
package/package.json
CHANGED
package/src/interface.js
CHANGED
|
@@ -27,7 +27,7 @@ const THEME = {
|
|
|
27
27
|
border: '#44475a'
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
marked.
|
|
30
|
+
marked.setOptions({
|
|
31
31
|
renderer: new TerminalRenderer({
|
|
32
32
|
heading: chalk.hex(THEME.lavender).bold,
|
|
33
33
|
code: chalk.hex(THEME.green),
|
|
@@ -90,12 +90,12 @@ const Message = ({ role, content, displayContent }) => {
|
|
|
90
90
|
);
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
const AutocompleteSuggestions = ({ suggestions }) => (
|
|
93
|
+
const AutocompleteSuggestions = ({ suggestions, selectedIndex }) => (
|
|
94
94
|
h(Box, { flexDirection: 'column', borderStyle: 'round', borderColor: THEME.border, paddingX: 1, marginBottom: 1 },
|
|
95
|
-
h(Text, { color: THEME.gray, dimColor: true, italic: true }, 'Sugestões (TAB):'),
|
|
95
|
+
h(Text, { color: THEME.gray, dimColor: true, italic: true }, 'Sugestões (↑↓ navega, TAB seleciona):'),
|
|
96
96
|
suggestions.map((f, i) => (
|
|
97
|
-
h(Text, { key: i, color: i ===
|
|
98
|
-
`${f.isDir ? '📁' : '📄'} ${f.rel}${f.isDir ? '/' : ''}`
|
|
97
|
+
h(Text, { key: i, color: i === selectedIndex ? THEME.green : THEME.gray, bold: i === selectedIndex },
|
|
98
|
+
`${i === selectedIndex ? '› ' : ' '}${f.isDir ? '📁' : '📄'} ${f.rel}${f.isDir ? '/' : ''}`
|
|
99
99
|
)
|
|
100
100
|
))
|
|
101
101
|
)
|
|
@@ -128,6 +128,7 @@ const BimmoApp = ({ initialConfig }) => {
|
|
|
128
128
|
const [messages, setMessages] = useState([]);
|
|
129
129
|
const [staticMessages, setStaticMessages] = useState([]); // Para mensagens antigas
|
|
130
130
|
const [input, setInput] = useState('');
|
|
131
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
131
132
|
const [isThinking, setIsThinking] = useState(false);
|
|
132
133
|
const [thinkingMessage, setThinkingMessage] = useState('bimmo pensando...');
|
|
133
134
|
const [exitCounter, setExitCounter] = useState(0);
|
|
@@ -163,6 +164,10 @@ const BimmoApp = ({ initialConfig }) => {
|
|
|
163
164
|
} catch (e) { return []; }
|
|
164
165
|
}, [input]);
|
|
165
166
|
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
setSelectedIndex(0);
|
|
169
|
+
}, [filePreview.length]);
|
|
170
|
+
|
|
166
171
|
const handleSubmit = async (val) => {
|
|
167
172
|
const rawInput = val.trim();
|
|
168
173
|
if (!rawInput) return;
|
|
@@ -278,10 +283,20 @@ const BimmoApp = ({ initialConfig }) => {
|
|
|
278
283
|
}
|
|
279
284
|
}
|
|
280
285
|
if (key.tab && filePreview.length > 0) {
|
|
286
|
+
const selected = filePreview[selectedIndex] || filePreview[0];
|
|
281
287
|
const words = input.split(' ');
|
|
282
|
-
words[words.length - 1] = `@${
|
|
288
|
+
words[words.length - 1] = `@${selected.rel}${selected.isDir ? '/' : ''}`;
|
|
283
289
|
setInput(words.join(' '));
|
|
284
290
|
}
|
|
291
|
+
|
|
292
|
+
if (filePreview.length > 0) {
|
|
293
|
+
if (key.downArrow) {
|
|
294
|
+
setSelectedIndex(prev => (prev + 1) % filePreview.length);
|
|
295
|
+
}
|
|
296
|
+
if (key.upArrow) {
|
|
297
|
+
setSelectedIndex(prev => (prev - 1 + filePreview.length) % filePreview.length);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
285
300
|
});
|
|
286
301
|
|
|
287
302
|
return (
|
|
@@ -300,10 +315,9 @@ const BimmoApp = ({ initialConfig }) => {
|
|
|
300
315
|
)
|
|
301
316
|
),
|
|
302
317
|
|
|
303
|
-
filePreview.length > 0 && h(AutocompleteSuggestions, { suggestions: filePreview }),
|
|
304
|
-
|
|
305
|
-
h(Box, { borderStyle: 'round', borderColor: isThinking ? THEME.gray : THEME.lavender, paddingX: 1 },
|
|
306
|
-
h(Text, { bold: true, color: mode === 'edit' ? THEME.red : mode === 'plan' ? THEME.cyan : THEME.lavender },
|
|
318
|
+
filePreview.length > 0 && h(AutocompleteSuggestions, { suggestions: filePreview, selectedIndex }),
|
|
319
|
+
|
|
320
|
+
h(Box, { borderStyle: 'round', borderColor: isThinking ? THEME.gray : THEME.lavender, paddingX: 1 }, h(Text, { bold: true, color: mode === 'edit' ? THEME.red : mode === 'plan' ? THEME.cyan : THEME.lavender },
|
|
307
321
|
`${activePersona ? `[${activePersona.toUpperCase()}] ` : ''}› `
|
|
308
322
|
),
|
|
309
323
|
h(TextInput, {
|