codeep 1.0.41 → 1.0.43

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/README.md CHANGED
@@ -53,6 +53,13 @@ When started in a project directory, Codeep automatically:
53
53
  - Copy code blocks to clipboard with `/copy [n]`
54
54
  - Code blocks are numbered for easy reference
55
55
 
56
+ ### Clipboard Paste
57
+ - **`/paste` command** - Paste content from clipboard into chat
58
+ - Type `/paste` and press Enter to read clipboard content
59
+ - Shows preview with character/line count before sending
60
+ - Press Enter to send, Escape to cancel
61
+ - Works reliably in all terminals (no Ctrl+V issues)
62
+
56
63
  ### Autonomous Agent Mode
57
64
 
58
65
  Codeep works as a **full AI coding agent** that autonomously:
@@ -22,6 +22,7 @@ const COMMANDS = [
22
22
  { cmd: '/commit', desc: 'Generate commit message' },
23
23
  { cmd: '/apply', desc: 'Apply file changes' },
24
24
  { cmd: '/copy', desc: 'Copy code block' },
25
+ { cmd: '/paste', desc: 'Paste from clipboard' },
25
26
  { cmd: '/clear', desc: 'Clear chat' },
26
27
  { cmd: '/login', desc: 'Change API key' },
27
28
  { cmd: '/logout', desc: 'Logout' },
@@ -33,10 +34,11 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
33
34
  const [selectedIndex, setSelectedIndex] = useState(0);
34
35
  const [pasteInfo, setPasteInfo] = useState(null);
35
36
  const [historyIndex, setHistoryIndex] = useState(-1);
36
- // Paste detection using timing - chars arriving < 5ms apart = paste
37
+ // Paste detection using timing - chars arriving fast = paste
37
38
  const inputBuffer = useRef('');
38
39
  const lastInputTime = useRef(0);
39
40
  const pasteTimeout = useRef(null);
41
+ const charTimings = useRef([]);
40
42
  // Clear input when clearTrigger changes
41
43
  useEffect(() => {
42
44
  if (clearTrigger > 0) {
@@ -112,9 +114,23 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
112
114
  return;
113
115
  // Handle Enter - submit
114
116
  if (key.return) {
115
- if (value.trim()) {
117
+ const trimmedValue = value.trim();
118
+ // Handle /paste command - read from clipboard
119
+ if (trimmedValue === '/paste') {
120
+ try {
121
+ const clipboardText = clipboardy.readSync();
122
+ if (clipboardText && clipboardText.trim()) {
123
+ handlePastedText(clipboardText.trim(), true);
124
+ }
125
+ }
126
+ catch {
127
+ // Clipboard read failed
128
+ }
129
+ return;
130
+ }
131
+ if (trimmedValue) {
116
132
  // If we have paste info, submit the full pasted text
117
- const submitValue = pasteInfo ? pasteInfo.fullText : value.trim();
133
+ const submitValue = pasteInfo ? pasteInfo.fullText : trimmedValue;
118
134
  onSubmit(submitValue);
119
135
  setValue('');
120
136
  setCursorPos(0);
@@ -255,17 +271,38 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
255
271
  const now = Date.now();
256
272
  const timeSinceLastInput = now - lastInputTime.current;
257
273
  lastInputTime.current = now;
258
- // If chars arrive very fast (< 5ms apart), buffer them as paste
259
- if (timeSinceLastInput < 5 || inputBuffer.current.length > 0) {
274
+ // Track timing for paste detection
275
+ // Paste typically sends many chars with < 10ms between them
276
+ const isPasteLikeTiming = timeSinceLastInput < 15;
277
+ if (isPasteLikeTiming || inputBuffer.current.length > 0) {
278
+ // Add to buffer
260
279
  inputBuffer.current += input;
280
+ charTimings.current.push(timeSinceLastInput);
261
281
  // Clear existing timeout
262
282
  if (pasteTimeout.current) {
263
283
  clearTimeout(pasteTimeout.current);
264
284
  }
265
- // Set timeout to process buffer
285
+ // Set timeout to process buffer - wait a bit longer to collect all paste chars
266
286
  pasteTimeout.current = setTimeout(() => {
267
- processBuffer();
268
- }, 10);
287
+ const buffer = inputBuffer.current;
288
+ const timings = charTimings.current;
289
+ inputBuffer.current = '';
290
+ charTimings.current = [];
291
+ if (!buffer)
292
+ return;
293
+ // Calculate average timing - if most chars came fast, it's a paste
294
+ const fastChars = timings.filter(t => t < 15).length;
295
+ const isPaste = buffer.length > 5 && (fastChars / timings.length) > 0.5;
296
+ if (isPaste && (buffer.length > 30 || buffer.includes('\n'))) {
297
+ // Treat as paste
298
+ handlePastedText(buffer, true);
299
+ }
300
+ else {
301
+ // Just fast typing, add normally
302
+ setValue(prev => prev + buffer);
303
+ setCursorPos(prev => prev + buffer.length);
304
+ }
305
+ }, 50); // Wait 50ms to collect all paste chars
269
306
  return; // Don't add to value yet
270
307
  }
271
308
  // Normal single character input (slow typing)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
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",