@miphamai/cli 0.19.5 → 0.20.0
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 +2 -1
- package/src/core/engine.ts +42 -18
- package/src/i18n-context.tsx +37 -0
- package/src/index.tsx +27 -11
- package/src/mcp/client.ts +13 -3
- package/src/mcp/oauth.ts +14 -4
- package/src/mcp/registry.ts +12 -2
- package/src/tools/index.ts +18 -8
- package/src/ui/agent-footer.tsx +3 -1
- package/src/ui/app.tsx +18 -12
- package/src/ui/chat.tsx +19 -15
- package/src/ui/command-picker.tsx +11 -6
- package/src/ui/commands.ts +309 -433
- package/src/ui/input.tsx +53 -101
- package/src/ui/picker.tsx +10 -8
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState, useMemo, useEffect } from 'react'
|
|
2
2
|
import { Box, Text, useInput } from 'ink'
|
|
3
3
|
import TextInput from 'ink-text-input'
|
|
4
|
+
import { useI18n } from '../i18n-context'
|
|
4
5
|
import { getCommandList } from './commands.js'
|
|
5
6
|
|
|
6
7
|
interface CommandPickerProps {
|
|
@@ -29,6 +30,7 @@ export function CommandPicker({
|
|
|
29
30
|
onClose,
|
|
30
31
|
maxVisible = PAGE_SIZE,
|
|
31
32
|
}: CommandPickerProps) {
|
|
33
|
+
const { t } = useI18n()
|
|
32
34
|
const allCommands = useMemo(() => getCommandList(), [])
|
|
33
35
|
const [filter, setFilter] = useState(initialFilter)
|
|
34
36
|
const [cursorIdx, setCursorIdx] = useState(0)
|
|
@@ -92,14 +94,14 @@ export function CommandPicker({
|
|
|
92
94
|
{/* Title */}
|
|
93
95
|
<Box marginBottom={1}>
|
|
94
96
|
<Text bold color="cyan">
|
|
95
|
-
|
|
97
|
+
{t('ui.command_picker.title')}
|
|
96
98
|
</Text>
|
|
97
|
-
<Text dimColor>
|
|
99
|
+
<Text dimColor> {t('ui.command_picker.nav_help')}</Text>
|
|
98
100
|
</Box>
|
|
99
101
|
|
|
100
102
|
{/* Command list */}
|
|
101
103
|
<Box flexDirection="column" marginBottom={1}>
|
|
102
|
-
{visible.length === 0 && <Text dimColor>
|
|
104
|
+
{visible.length === 0 && <Text dimColor> {t('ui.command_picker.no_matches', { filter })}</Text>}
|
|
103
105
|
{visible.map((cmd, i) => {
|
|
104
106
|
const globalIdx = i + scrollStart
|
|
105
107
|
const isCursor = globalIdx === cursorIdx
|
|
@@ -119,8 +121,11 @@ export function CommandPicker({
|
|
|
119
121
|
{filtered.length > maxVisible && (
|
|
120
122
|
<Box marginBottom={1}>
|
|
121
123
|
<Text dimColor>
|
|
122
|
-
{
|
|
123
|
-
|
|
124
|
+
{t('ui.command_picker.scroll_indicator', {
|
|
125
|
+
start: String(scrollStart + 1),
|
|
126
|
+
end: String(Math.min(scrollStart + maxVisible, filtered.length)),
|
|
127
|
+
total: String(filtered.length),
|
|
128
|
+
})}
|
|
124
129
|
</Text>
|
|
125
130
|
</Box>
|
|
126
131
|
)}
|
|
@@ -137,7 +142,7 @@ export function CommandPicker({
|
|
|
137
142
|
onSelect(selected.name)
|
|
138
143
|
}
|
|
139
144
|
}}
|
|
140
|
-
placeholder=
|
|
145
|
+
placeholder={t('ui.command_picker.placeholder')}
|
|
141
146
|
/>
|
|
142
147
|
</Box>
|
|
143
148
|
</Box>
|