wave-code 0.8.2 → 0.8.4
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/components/HelpView.d.ts.map +1 -1
- package/dist/components/HelpView.js +1 -0
- package/dist/components/RewindCommand.d.ts.map +1 -1
- package/dist/components/RewindCommand.js +10 -4
- package/package.json +3 -6
- package/src/components/HelpView.tsx +1 -0
- package/src/components/RewindCommand.tsx +21 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpView.d.ts","sourceRoot":"","sources":["../../src/components/HelpView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"HelpView.d.ts","sourceRoot":"","sources":["../../src/components/HelpView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAoK5C,CAAC"}
|
|
@@ -40,6 +40,7 @@ export const HelpView = ({ onCancel, commands = [], }) => {
|
|
|
40
40
|
const helpItems = [
|
|
41
41
|
{ key: "@", description: "Reference files" },
|
|
42
42
|
{ key: "/", description: "Commands" },
|
|
43
|
+
{ key: "!", description: "Shell commands (e.g. !ls)" },
|
|
43
44
|
{ key: "Ctrl+R", description: "Search history" },
|
|
44
45
|
{ key: "Ctrl+O", description: "Expand/collapse messages" },
|
|
45
46
|
{ key: "Ctrl+T", description: "Toggle task list" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RewindCommand.d.ts","sourceRoot":"","sources":["../../src/components/RewindCommand.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,gBAAgB,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,OAAO,CAAC;QACnC,QAAQ,EAAE,OAAO,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC,CAAC;CACJ;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"RewindCommand.d.ts","sourceRoot":"","sources":["../../src/components/RewindCommand.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,gBAAgB,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,OAAO,CAAC;QACnC,QAAQ,EAAE,OAAO,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC,CAAC;CACJ;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwJtD,CAAC"}
|
|
@@ -16,11 +16,15 @@ export const RewindCommand = ({ messages: initialMessages, onSelect, onCancel, g
|
|
|
16
16
|
const checkpoints = messages
|
|
17
17
|
.map((msg, index) => ({ msg, index }))
|
|
18
18
|
.filter(({ msg }) => msg.role === "user");
|
|
19
|
+
const MAX_VISIBLE_ITEMS = 3;
|
|
19
20
|
const [selectedIndex, setSelectedIndex] = useState(checkpoints.length - 1);
|
|
20
21
|
// Update selectedIndex when checkpoints change (after loading full thread)
|
|
21
22
|
React.useEffect(() => {
|
|
22
23
|
setSelectedIndex(checkpoints.length - 1);
|
|
23
24
|
}, [checkpoints.length]);
|
|
25
|
+
// Calculate visible window
|
|
26
|
+
const startIndex = Math.max(0, Math.min(selectedIndex - Math.floor(MAX_VISIBLE_ITEMS / 2), Math.max(0, checkpoints.length - MAX_VISIBLE_ITEMS)));
|
|
27
|
+
const visibleCheckpoints = checkpoints.slice(startIndex, startIndex + MAX_VISIBLE_ITEMS);
|
|
24
28
|
useInput((input, key) => {
|
|
25
29
|
if (key.return) {
|
|
26
30
|
if (checkpoints.length > 0 && selectedIndex >= 0) {
|
|
@@ -47,13 +51,15 @@ export const RewindCommand = ({ messages: initialMessages, onSelect, onCancel, g
|
|
|
47
51
|
if (checkpoints.length === 0) {
|
|
48
52
|
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, borderStyle: "single", borderColor: "yellow", borderLeft: false, borderRight: false, children: [_jsx(Text, { color: "yellow", children: "No user messages found to rewind to." }), _jsx(Text, { dimColor: true, children: "Press Escape to cancel" })] }));
|
|
49
53
|
}
|
|
50
|
-
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, gap: 1, borderStyle: "single", borderColor: "cyan", borderLeft: false, borderRight: false, children: [_jsx(Box, { children: _jsx(Text, { color: "cyan", bold: true, children: "Rewind: Select a message to revert to" }) }), _jsx(Box, { flexDirection: "column", children:
|
|
51
|
-
const
|
|
54
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, gap: 1, borderStyle: "single", borderColor: "cyan", borderLeft: false, borderRight: false, children: [_jsx(Box, { children: _jsx(Text, { color: "cyan", bold: true, children: "Rewind: Select a message to revert to" }) }), _jsx(Box, { flexDirection: "column", children: visibleCheckpoints.map((checkpoint, index) => {
|
|
55
|
+
const actualIndex = startIndex + index;
|
|
56
|
+
const isSelected = actualIndex === selectedIndex;
|
|
52
57
|
const content = checkpoint.msg.blocks
|
|
53
58
|
.filter((b) => b.type === "text")
|
|
54
59
|
.map((b) => b.content)
|
|
55
60
|
.join(" ")
|
|
61
|
+
.replace(/\n/g, "\\n")
|
|
56
62
|
.substring(0, 60);
|
|
57
|
-
return (_jsx(Box, { children: _jsxs(Text, { color: isSelected ? "black" : "white", backgroundColor: isSelected ? "cyan" : undefined, children: [isSelected ? "▶ " : " ", "[", checkpoint.index, "]", " ", content || "(No text content)",
|
|
58
|
-
}) }), _jsx(Box, { children: _jsx(Text, { dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter to rewind \u2022 Esc to cancel" }) }), _jsx(Box, { children: _jsx(Text, { color: "red", dimColor: true, children: "
|
|
63
|
+
return (_jsx(Box, { children: _jsxs(Text, { color: isSelected ? "black" : "white", backgroundColor: isSelected ? "cyan" : undefined, children: [isSelected ? "▶ " : " ", "[", checkpoint.index, "]", " ", content || "(No text content)", actualIndex === checkpoints.length - 1 ? " (Latest)" : ""] }) }, checkpoint.index));
|
|
64
|
+
}) }), _jsx(Box, { children: _jsx(Text, { dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter to rewind \u2022 Esc to cancel" }) }), _jsx(Box, { children: _jsx(Text, { color: "red", dimColor: true, children: "Warning: This will delete all subsequent messages and revert file and task list changes." }) })] }));
|
|
59
65
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-code",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "CLI-based code assistant powered by AI, built with React and Ink",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"react": "^19.2.4",
|
|
40
40
|
"react-dom": "19.2.4",
|
|
41
41
|
"yargs": "^17.7.2",
|
|
42
|
-
"wave-agent-sdk": "0.8.
|
|
42
|
+
"wave-agent-sdk": "0.8.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/react": "^19.1.8",
|
|
@@ -68,9 +68,6 @@
|
|
|
68
68
|
"test": "vitest run --reporter=dot",
|
|
69
69
|
"test:coverage": "vitest run --coverage --reporter=dot",
|
|
70
70
|
"lint": "eslint --cache",
|
|
71
|
-
"format": "prettier --write ."
|
|
72
|
-
"version:patch": "node ../../scripts/version.js patch",
|
|
73
|
-
"version:minor": "node ../../scripts/version.js minor",
|
|
74
|
-
"version:major": "node ../../scripts/version.js major"
|
|
71
|
+
"format": "prettier --write ."
|
|
75
72
|
}
|
|
76
73
|
}
|
|
@@ -58,6 +58,7 @@ export const HelpView: React.FC<HelpViewProps> = ({
|
|
|
58
58
|
const helpItems = [
|
|
59
59
|
{ key: "@", description: "Reference files" },
|
|
60
60
|
{ key: "/", description: "Commands" },
|
|
61
|
+
{ key: "!", description: "Shell commands (e.g. !ls)" },
|
|
61
62
|
{ key: "Ctrl+R", description: "Search history" },
|
|
62
63
|
{ key: "Ctrl+O", description: "Expand/collapse messages" },
|
|
63
64
|
{ key: "Ctrl+T", description: "Toggle task list" },
|
|
@@ -35,6 +35,7 @@ export const RewindCommand: React.FC<RewindCommandProps> = ({
|
|
|
35
35
|
.map((msg, index) => ({ msg, index }))
|
|
36
36
|
.filter(({ msg }) => msg.role === "user");
|
|
37
37
|
|
|
38
|
+
const MAX_VISIBLE_ITEMS = 3;
|
|
38
39
|
const [selectedIndex, setSelectedIndex] = useState(checkpoints.length - 1);
|
|
39
40
|
|
|
40
41
|
// Update selectedIndex when checkpoints change (after loading full thread)
|
|
@@ -42,6 +43,19 @@ export const RewindCommand: React.FC<RewindCommandProps> = ({
|
|
|
42
43
|
setSelectedIndex(checkpoints.length - 1);
|
|
43
44
|
}, [checkpoints.length]);
|
|
44
45
|
|
|
46
|
+
// Calculate visible window
|
|
47
|
+
const startIndex = Math.max(
|
|
48
|
+
0,
|
|
49
|
+
Math.min(
|
|
50
|
+
selectedIndex - Math.floor(MAX_VISIBLE_ITEMS / 2),
|
|
51
|
+
Math.max(0, checkpoints.length - MAX_VISIBLE_ITEMS),
|
|
52
|
+
),
|
|
53
|
+
);
|
|
54
|
+
const visibleCheckpoints = checkpoints.slice(
|
|
55
|
+
startIndex,
|
|
56
|
+
startIndex + MAX_VISIBLE_ITEMS,
|
|
57
|
+
);
|
|
58
|
+
|
|
45
59
|
useInput((input, key) => {
|
|
46
60
|
if (key.return) {
|
|
47
61
|
if (checkpoints.length > 0 && selectedIndex >= 0) {
|
|
@@ -114,12 +128,14 @@ export const RewindCommand: React.FC<RewindCommandProps> = ({
|
|
|
114
128
|
</Box>
|
|
115
129
|
|
|
116
130
|
<Box flexDirection="column">
|
|
117
|
-
{
|
|
118
|
-
const
|
|
131
|
+
{visibleCheckpoints.map((checkpoint, index) => {
|
|
132
|
+
const actualIndex = startIndex + index;
|
|
133
|
+
const isSelected = actualIndex === selectedIndex;
|
|
119
134
|
const content = checkpoint.msg.blocks
|
|
120
135
|
.filter((b): b is TextBlock => b.type === "text")
|
|
121
136
|
.map((b) => b.content)
|
|
122
137
|
.join(" ")
|
|
138
|
+
.replace(/\n/g, "\\n")
|
|
123
139
|
.substring(0, 60);
|
|
124
140
|
|
|
125
141
|
return (
|
|
@@ -130,7 +146,7 @@ export const RewindCommand: React.FC<RewindCommandProps> = ({
|
|
|
130
146
|
>
|
|
131
147
|
{isSelected ? "▶ " : " "}[{checkpoint.index}]{" "}
|
|
132
148
|
{content || "(No text content)"}
|
|
133
|
-
{
|
|
149
|
+
{actualIndex === checkpoints.length - 1 ? " (Latest)" : ""}
|
|
134
150
|
</Text>
|
|
135
151
|
</Box>
|
|
136
152
|
);
|
|
@@ -142,8 +158,8 @@ export const RewindCommand: React.FC<RewindCommandProps> = ({
|
|
|
142
158
|
</Box>
|
|
143
159
|
<Box>
|
|
144
160
|
<Text color="red" dimColor>
|
|
145
|
-
|
|
146
|
-
|
|
161
|
+
Warning: This will delete all subsequent messages and revert file and
|
|
162
|
+
task list changes.
|
|
147
163
|
</Text>
|
|
148
164
|
</Box>
|
|
149
165
|
</Box>
|