opencode-account-manager 0.4.4 → 0.5.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/dist/cli.js +1 -1
- package/dist/tui/Dashboard.d.ts.map +1 -1
- package/dist/tui/Dashboard.js +172 -156
- package/dist/tui/Dashboard.js.map +1 -1
- package/dist/tui/components/ActionPalette.d.ts +16 -0
- package/dist/tui/components/ActionPalette.d.ts.map +1 -0
- package/dist/tui/components/ActionPalette.js +106 -0
- package/dist/tui/components/ActionPalette.js.map +1 -0
- package/dist/tui/components/index.d.ts +1 -0
- package/dist/tui/components/index.d.ts.map +1 -1
- package/dist/tui/components/index.js +3 -1
- package/dist/tui/components/index.js.map +1 -1
- package/docs/ROADMAP.md +19 -1
- package/package.json +1 -1
- package/src/cli.ts +1 -1
- package/src/tui/Dashboard.tsx +205 -173
- package/src/tui/components/ActionPalette.tsx +120 -0
- package/src/tui/components/index.ts +1 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Box, Text, useInput } from "ink";
|
|
3
|
+
|
|
4
|
+
export interface PaletteAction {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
shortcut?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
category?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface ActionPaletteProps {
|
|
13
|
+
actions: PaletteAction[];
|
|
14
|
+
onSelect: (actionId: string) => void;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function ActionPalette({ actions, onSelect, onClose }: ActionPaletteProps) {
|
|
19
|
+
const [search, setSearch] = useState("");
|
|
20
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
21
|
+
|
|
22
|
+
// Filter actions by search
|
|
23
|
+
const filteredActions = actions.filter(action => {
|
|
24
|
+
const searchLower = search.toLowerCase();
|
|
25
|
+
return (
|
|
26
|
+
action.label.toLowerCase().includes(searchLower) ||
|
|
27
|
+
action.id.toLowerCase().includes(searchLower) ||
|
|
28
|
+
(action.description?.toLowerCase().includes(searchLower))
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
useInput((input, key) => {
|
|
33
|
+
// Close on Escape
|
|
34
|
+
if (key.escape) {
|
|
35
|
+
onClose();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Navigate up
|
|
40
|
+
if (key.upArrow) {
|
|
41
|
+
setSelectedIndex(prev => Math.max(0, prev - 1));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Navigate down
|
|
46
|
+
if (key.downArrow) {
|
|
47
|
+
setSelectedIndex(prev => Math.min(filteredActions.length - 1, prev + 1));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Select on Enter
|
|
52
|
+
if (key.return) {
|
|
53
|
+
const action = filteredActions[selectedIndex];
|
|
54
|
+
if (action) {
|
|
55
|
+
onSelect(action.id);
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Backspace
|
|
61
|
+
if (key.backspace || key.delete) {
|
|
62
|
+
setSearch(prev => prev.slice(0, -1));
|
|
63
|
+
setSelectedIndex(0);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Type to search (printable characters)
|
|
68
|
+
if (input && input.length === 1 && !key.ctrl && !key.meta) {
|
|
69
|
+
setSearch(prev => prev + input);
|
|
70
|
+
setSelectedIndex(0);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Box
|
|
76
|
+
flexDirection="column"
|
|
77
|
+
borderStyle="round"
|
|
78
|
+
borderColor="cyan"
|
|
79
|
+
paddingX={1}
|
|
80
|
+
paddingY={0}
|
|
81
|
+
>
|
|
82
|
+
{/* Search input */}
|
|
83
|
+
<Box marginBottom={1}>
|
|
84
|
+
<Text color="cyan" bold>{">"} </Text>
|
|
85
|
+
<Text>{search}</Text>
|
|
86
|
+
<Text color="gray">_</Text>
|
|
87
|
+
</Box>
|
|
88
|
+
|
|
89
|
+
{/* Actions list */}
|
|
90
|
+
<Box flexDirection="column" marginBottom={1}>
|
|
91
|
+
{filteredActions.length === 0 ? (
|
|
92
|
+
<Text dimColor>No matching actions</Text>
|
|
93
|
+
) : (
|
|
94
|
+
filteredActions.slice(0, 10).map((action, index) => {
|
|
95
|
+
const isSelected = index === selectedIndex;
|
|
96
|
+
return (
|
|
97
|
+
<Box key={action.id}>
|
|
98
|
+
<Text
|
|
99
|
+
backgroundColor={isSelected ? "cyan" : undefined}
|
|
100
|
+
color={isSelected ? "black" : "white"}
|
|
101
|
+
>
|
|
102
|
+
{isSelected ? "▸ " : " "}
|
|
103
|
+
{action.label}
|
|
104
|
+
</Text>
|
|
105
|
+
{action.shortcut && (
|
|
106
|
+
<Text dimColor> [{action.shortcut}]</Text>
|
|
107
|
+
)}
|
|
108
|
+
</Box>
|
|
109
|
+
);
|
|
110
|
+
})
|
|
111
|
+
)}
|
|
112
|
+
</Box>
|
|
113
|
+
|
|
114
|
+
{/* Help */}
|
|
115
|
+
<Box>
|
|
116
|
+
<Text dimColor>↑↓ navigate • Enter select • Esc close</Text>
|
|
117
|
+
</Box>
|
|
118
|
+
</Box>
|
|
119
|
+
);
|
|
120
|
+
}
|