codeep 1.0.39 → 1.0.40

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.
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useMemo, useEffect, useRef } from 'react';
3
3
  import { Text, Box, useInput } from 'ink';
4
4
  import clipboardy from 'clipboardy';
@@ -82,21 +82,22 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
82
82
  const lines = trimmed.split(/\r?\n/);
83
83
  const lineCount = lines.length;
84
84
  const charCount = trimmed.length;
85
- // For multi-line, long pastes, or explicit Ctrl+V - show indicator
86
- if (lineCount > 1 || charCount > 100 || (fromCtrlV && charCount > 20)) {
87
- const firstLine = lines[0].substring(0, 60);
88
- const preview = firstLine + (lines[0].length > 60 ? '...' : '');
85
+ // For multi-line or long pastes - show info box with preview
86
+ if (lineCount > 1 || charCount > 80 || (fromCtrlV && charCount > 30)) {
87
+ // Create preview - first line truncated
88
+ const firstLine = lines[0].substring(0, 50);
89
+ const preview = firstLine + (lines[0].length > 50 || lineCount > 1 ? '...' : '');
89
90
  setPasteInfo({
90
91
  lines: lineCount,
91
92
  chars: charCount,
92
93
  preview,
93
94
  fullText: trimmed,
94
95
  });
95
- // Show only indicator in input field, NOT the actual pasted text
96
- const indicator = `📋 Paste: ${charCount} chars`;
97
- // Replace entire value with just the indicator (don't append pasted text)
98
- setValue(indicator);
99
- setCursorPos(indicator.length);
96
+ // Show truncated text in input (not ugly indicator)
97
+ const displayText = trimmed.replace(/\r?\n/g, ' ').substring(0, 60);
98
+ const inputText = displayText + (trimmed.length > 60 ? '...' : '');
99
+ setValue(inputText);
100
+ setCursorPos(inputText.length);
100
101
  }
101
102
  else {
102
103
  // Short paste - insert directly
@@ -112,11 +113,8 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
112
113
  // Handle Enter - submit
113
114
  if (key.return) {
114
115
  if (value.trim()) {
115
- let submitValue = value.trim();
116
- // Replace paste indicator with actual content
117
- if (pasteInfo && submitValue.includes('📋 Paste:')) {
118
- submitValue = submitValue.replace(/📋 Paste: \d+ chars/, pasteInfo.fullText);
119
- }
116
+ // If we have paste info, submit the full pasted text
117
+ const submitValue = pasteInfo ? pasteInfo.fullText : value.trim();
120
118
  onSubmit(submitValue);
121
119
  setValue('');
122
120
  setCursorPos(0);
@@ -128,8 +126,9 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
128
126
  // Handle Escape - clear paste info or input
129
127
  if (key.escape) {
130
128
  if (pasteInfo) {
131
- // Remove paste indicator from value
132
- setValue(prev => prev.replace(/📋 Paste: \d+ chars/, ''));
129
+ // Clear pasted content
130
+ setValue('');
131
+ setCursorPos(0);
133
132
  setPasteInfo(null);
134
133
  }
135
134
  else if (value) {
@@ -141,12 +140,15 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
141
140
  // Handle Backspace
142
141
  if (key.backspace || key.delete) {
143
142
  if (cursorPos > 0) {
144
- setValue(prev => prev.slice(0, cursorPos - 1) + prev.slice(cursorPos));
145
- setCursorPos(prev => prev - 1);
146
- // Clear paste info if we deleted the indicator
147
- if (pasteInfo && !value.includes('📋 Paste:')) {
143
+ // If paste info exists, clear everything on backspace
144
+ if (pasteInfo) {
145
+ setValue('');
146
+ setCursorPos(0);
148
147
  setPasteInfo(null);
148
+ return;
149
149
  }
150
+ setValue(prev => prev.slice(0, cursorPos - 1) + prev.slice(cursorPos));
151
+ setCursorPos(prev => prev - 1);
150
152
  }
151
153
  return;
152
154
  }
@@ -281,5 +283,5 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
281
283
  const after = value.slice(cursorPos + 1);
282
284
  return (_jsxs(Text, { children: [before, _jsx(Text, { backgroundColor: "white", color: "black", children: cursor }), after] }));
283
285
  };
284
- return (_jsxs(Box, { flexDirection: "column", children: [suggestions.length > 0 && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [suggestions.slice(0, 8).map((s, i) => (_jsxs(Text, { children: [i === selectedIndex ? _jsx(Text, { color: "#f02a30", children: "\u25B8 " }) : ' ', _jsx(Text, { color: i === selectedIndex ? '#f02a30' : undefined, bold: i === selectedIndex, children: s.cmd }), _jsxs(Text, { color: i === selectedIndex ? undefined : 'gray', children: [" - ", s.desc] })] }, s.cmd))), _jsx(Text, { color: "gray", dimColor: true, children: "\u2191\u2193 navigate \u2022 Tab complete \u2022 Esc cancel" })] })), pasteInfo && (_jsxs(Box, { borderStyle: "round", borderColor: "cyan", paddingX: 1, marginBottom: 1, flexDirection: "column", children: [_jsx(Text, { color: "cyan", bold: true, children: "\uD83D\uDCCB Pasted Content" }), _jsxs(Text, { children: [_jsx(Text, { color: "white", bold: true, children: pasteInfo.lines }), _jsxs(Text, { color: "gray", children: [" ", pasteInfo.lines === 1 ? 'line' : 'lines', " \u2022 "] }), _jsx(Text, { color: "white", bold: true, children: pasteInfo.chars }), _jsx(Text, { color: "gray", children: " characters" })] }), _jsx(Text, { color: "gray", dimColor: true, wrap: "truncate", children: pasteInfo.preview }), _jsx(Text, { color: "gray", dimColor: true, children: "Press Enter to send \u2022 Esc to remove" })] })), _jsxs(Box, { children: [_jsx(Text, { color: "#f02a30", bold: true, children: '> ' }), disabled ? (_jsx(Text, { color: "yellow", children: "Agent working... (Esc to stop)" })) : (renderInput())] })] }));
286
+ return (_jsxs(Box, { flexDirection: "column", children: [suggestions.length > 0 && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [suggestions.slice(0, 8).map((s, i) => (_jsxs(Text, { children: [i === selectedIndex ? _jsx(Text, { color: "#f02a30", children: "\u25B8 " }) : ' ', _jsx(Text, { color: i === selectedIndex ? '#f02a30' : undefined, bold: i === selectedIndex, children: s.cmd }), _jsxs(Text, { color: i === selectedIndex ? undefined : 'gray', children: [" - ", s.desc] })] }, s.cmd))), _jsx(Text, { color: "gray", dimColor: true, children: "\u2191\u2193 navigate \u2022 Tab complete \u2022 Esc cancel" })] })), pasteInfo && (_jsx(Box, { borderStyle: "round", borderColor: "green", paddingX: 1, marginBottom: 1, flexDirection: "column", children: _jsxs(Text, { children: [_jsx(Text, { color: "green", bold: true, children: "\uD83D\uDCCB " }), _jsx(Text, { color: "white", bold: true, children: pasteInfo.chars }), _jsx(Text, { color: "gray", children: " chars" }), pasteInfo.lines > 1 && (_jsxs(_Fragment, { children: [_jsx(Text, { color: "gray", children: " \u2022 " }), _jsx(Text, { color: "white", bold: true, children: pasteInfo.lines }), _jsx(Text, { color: "gray", children: " lines" })] })), _jsx(Text, { color: "gray", dimColor: true, children: " (Enter send \u2022 Esc cancel)" })] }) })), _jsxs(Box, { children: [_jsx(Text, { color: "#f02a30", bold: true, children: '> ' }), disabled ? (_jsx(Text, { color: "yellow", children: "Agent working... (Esc to stop)" })) : (renderInput())] })] }));
285
287
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
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",