codeep 1.0.36 → 1.0.37
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/Input.js +21 -53
- package/package.json +1 -1
package/dist/components/Input.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useMemo, useEffect
|
|
3
|
-
import { Text, Box, useInput } from 'ink';
|
|
4
|
-
import clipboard from 'clipboardy';
|
|
2
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
3
|
+
import { Text, Box, useInput, useStdin } from 'ink';
|
|
5
4
|
const COMMANDS = [
|
|
6
5
|
{ cmd: '/help', desc: 'Show help' },
|
|
7
6
|
{ cmd: '/status', desc: 'Show status' },
|
|
@@ -33,8 +32,7 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
|
|
|
33
32
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
34
33
|
const [pasteInfo, setPasteInfo] = useState(null);
|
|
35
34
|
const [historyIndex, setHistoryIndex] = useState(-1);
|
|
36
|
-
const
|
|
37
|
-
const inputBuffer = useRef('');
|
|
35
|
+
const { stdin } = useStdin();
|
|
38
36
|
// Clear input when clearTrigger changes
|
|
39
37
|
useEffect(() => {
|
|
40
38
|
if (clearTrigger > 0) {
|
|
@@ -57,28 +55,24 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
|
|
|
57
55
|
setSelectedIndex(0);
|
|
58
56
|
}
|
|
59
57
|
}, [suggestions.length]);
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
inputBuffer.current = newChars;
|
|
79
|
-
lastInputTime.current = now;
|
|
80
|
-
return false;
|
|
81
|
-
};
|
|
58
|
+
// Listen for raw stdin data to detect paste (multiple chars at once)
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (disabled || !stdin)
|
|
61
|
+
return;
|
|
62
|
+
const handleData = (data) => {
|
|
63
|
+
const str = data.toString();
|
|
64
|
+
// Detect paste: multiple printable characters arriving at once
|
|
65
|
+
// Exclude control sequences (start with ESC)
|
|
66
|
+
if (str.length > 1 && !str.startsWith('\x1b') && !str.startsWith('\x16')) {
|
|
67
|
+
// This is likely a paste - multiple chars at once
|
|
68
|
+
handlePastedText(str, true);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
stdin.on('data', handleData);
|
|
72
|
+
return () => {
|
|
73
|
+
stdin.off('data', handleData);
|
|
74
|
+
};
|
|
75
|
+
}, [disabled, stdin]);
|
|
82
76
|
const handlePastedText = (text, fromCtrlV = false) => {
|
|
83
77
|
const trimmed = text.trim();
|
|
84
78
|
if (!trimmed)
|
|
@@ -113,15 +107,6 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
|
|
|
113
107
|
useInput((input, key) => {
|
|
114
108
|
if (disabled)
|
|
115
109
|
return;
|
|
116
|
-
// Handle Ctrl+V paste
|
|
117
|
-
if (key.ctrl && input === 'v') {
|
|
118
|
-
clipboard.read().then(text => {
|
|
119
|
-
if (text) {
|
|
120
|
-
handlePastedText(text, true);
|
|
121
|
-
}
|
|
122
|
-
}).catch(() => { });
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
110
|
// Handle Enter - submit
|
|
126
111
|
if (key.return) {
|
|
127
112
|
if (value.trim()) {
|
|
@@ -254,23 +239,6 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
|
|
|
254
239
|
setCursorPos(prev => prev + input.length);
|
|
255
240
|
}
|
|
256
241
|
}, { isActive: !disabled });
|
|
257
|
-
// Process any remaining buffered input after a delay
|
|
258
|
-
useEffect(() => {
|
|
259
|
-
const timer = setTimeout(() => {
|
|
260
|
-
if (inputBuffer.current.length > 0) {
|
|
261
|
-
const buffered = inputBuffer.current;
|
|
262
|
-
inputBuffer.current = '';
|
|
263
|
-
if (buffered.length > 5) {
|
|
264
|
-
handlePastedText(buffered);
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
setValue(prev => prev + buffered);
|
|
268
|
-
setCursorPos(prev => prev + buffered.length);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}, 100);
|
|
272
|
-
return () => clearTimeout(timer);
|
|
273
|
-
}, [value]);
|
|
274
242
|
// Render input with cursor
|
|
275
243
|
const renderInput = () => {
|
|
276
244
|
if (!value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeep",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|