codeep 1.0.53 → 1.0.55

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.
@@ -140,9 +140,36 @@ const isSectionBreak = (line, prevLine) => {
140
140
  return false;
141
141
  };
142
142
  export const LiveCodeStream = ({ actions, isRunning }) => {
143
+ // State for streaming effect - sliding window showing last 10 lines
144
+ const [visibleEndLine, setVisibleEndLine] = useState(0);
145
+ const [lastActionId, setLastActionId] = useState(null);
143
146
  // Find the current write/edit action with code content
144
147
  const currentAction = actions.length > 0 ? actions[actions.length - 1] : null;
145
- // Only show for write/edit actions with content
148
+ // Create a unique ID for the current action
149
+ const actionId = currentAction ? `${currentAction.target}-${currentAction.timestamp}` : null;
150
+ // Reset and stream progressively when action changes
151
+ useEffect(() => {
152
+ if (!currentAction || !currentAction.details) {
153
+ setVisibleEndLine(0);
154
+ return;
155
+ }
156
+ // If this is a new action, reset and start streaming
157
+ if (actionId !== lastActionId) {
158
+ setLastActionId(actionId);
159
+ setVisibleEndLine(10); // Start with first 10 lines
160
+ return;
161
+ }
162
+ // Stream more lines progressively (sliding window moves forward)
163
+ const totalLines = currentAction.details.split('\n').length;
164
+ if (visibleEndLine < totalLines) {
165
+ const timer = setTimeout(() => {
166
+ // Move window forward by 10 lines every 100ms
167
+ setVisibleEndLine(prev => Math.min(prev + 10, totalLines));
168
+ }, 100);
169
+ return () => clearTimeout(timer);
170
+ }
171
+ }, [currentAction, actionId, lastActionId, visibleEndLine]);
172
+ // Only show for write/edit actions with content while running
146
173
  if (!isRunning || !currentAction)
147
174
  return null;
148
175
  if (currentAction.type !== 'write' && currentAction.type !== 'edit')
@@ -158,21 +185,17 @@ export const LiveCodeStream = ({ actions, isRunning }) => {
158
185
  const totalLines = allLines.length;
159
186
  const actionLabel = currentAction.type === 'write' ? '✨ Creating' : '✏️ Editing';
160
187
  const actionColor = currentAction.type === 'write' ? 'green' : 'yellow';
161
- // Calculate code stats
162
- const nonEmptyLines = allLines.filter(l => l.trim()).length;
163
- const commentLines = allLines.filter(l => {
164
- const t = l.trim();
165
- return t.startsWith('//') || t.startsWith('#') || t.startsWith('/*') || t.startsWith('*');
166
- }).length;
167
- return (_jsxs(Box, { flexDirection: "column", marginY: 1, children: [_jsxs(Box, { flexDirection: "row", justifyContent: "space-between", children: [_jsxs(Box, { children: [_jsxs(Text, { color: actionColor, bold: true, children: [actionLabel, " "] }), _jsx(Text, { color: "white", bold: true, children: filename })] }), _jsxs(Box, { children: [_jsxs(Text, { color: "gray", children: [langLabel, " \u2022 "] }), _jsx(Text, { color: "cyan", children: totalLines }), _jsx(Text, { color: "gray", children: " lines" }), commentLines > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { color: "gray", children: " \u2022 " }), _jsxs(Text, { color: "gray", dimColor: true, children: [commentLines, " comments"] })] }))] })] }), fullPath !== filename && (_jsxs(Text, { color: "gray", dimColor: true, children: [" \uD83D\uDCC1 ", fullPath] })), _jsx(Text, { color: actionColor, children: '┌' + '─'.repeat(78) + '┐' }), _jsx(Box, { flexDirection: "column", children: allLines.map((line, i) => {
168
- const lineNum = i + 1;
169
- const prevLine = i > 0 ? allLines[i - 1] : null;
170
- const showSeparator = isSectionBreak(line, prevLine);
188
+ // Sliding window: show only last 10 lines of what's been "written" so far
189
+ const WINDOW_SIZE = 10;
190
+ const startLine = Math.max(0, visibleEndLine - WINDOW_SIZE);
191
+ const linesToShow = allLines.slice(startLine, visibleEndLine);
192
+ const remainingLines = totalLines - visibleEndLine;
193
+ const linesAbove = startLine;
194
+ return (_jsxs(Box, { flexDirection: "column", marginY: 1, children: [_jsxs(Box, { flexDirection: "row", justifyContent: "space-between", children: [_jsxs(Box, { children: [_jsxs(Text, { color: actionColor, bold: true, children: [actionLabel, " "] }), _jsx(Text, { color: "white", bold: true, children: filename })] }), _jsxs(Box, { children: [_jsxs(Text, { color: "gray", children: [langLabel, " \u2022 "] }), _jsx(Text, { color: "cyan", children: visibleEndLine }), _jsxs(Text, { color: "gray", children: ["/", totalLines, " lines"] }), remainingLines > 0 && (_jsx(Text, { color: "yellow", children: " \u25BC streaming..." }))] })] }), fullPath !== filename && (_jsxs(Text, { color: "gray", dimColor: true, children: [" \uD83D\uDCC1 ", fullPath] })), _jsx(Text, { color: actionColor, children: '─'.repeat(80) }), linesAbove > 0 && (_jsxs(Text, { color: "gray", dimColor: true, children: [" \u22EE ", linesAbove, " lines above"] })), _jsx(Box, { flexDirection: "column", children: linesToShow.map((line, i) => {
195
+ const lineNum = startLine + i + 1;
171
196
  const lineColor = getCodeColor(line, ext);
172
- // Zebra striping for better readability (subtle)
173
- const isEvenLine = i % 2 === 0;
174
- return (_jsxs(Box, { flexDirection: "column", children: [showSeparator && i > 0 && (_jsx(Text, { color: "gray", dimColor: true, children: '│' + ' '.repeat(78) + '│' })), _jsxs(Text, { children: [_jsx(Text, { color: actionColor, children: "\u2502" }), _jsx(Text, { color: isEvenLine ? 'gray' : 'white', dimColor: !isEvenLine, children: String(lineNum).padStart(4, ' ') }), _jsx(Text, { color: "gray", dimColor: true, children: " \u2502 " }), _jsx(Text, { color: lineColor, children: line.slice(0, 70) }), line.length > 70 && _jsx(Text, { color: "gray", children: "\u2026" }), line.length <= 70 && _jsx(Text, { children: ' '.repeat(Math.max(0, 70 - line.length)) }), _jsx(Text, { color: actionColor, children: "\u2502" })] })] }, i));
175
- }) }), _jsx(Text, { color: actionColor, children: '└' + '─'.repeat(78) + '┘' })] }));
197
+ return (_jsxs(Text, { children: [_jsx(Text, { color: "gray", dimColor: true, children: String(lineNum).padStart(4, ' ') }), _jsx(Text, { color: "gray", dimColor: true, children: " \u2502 " }), _jsx(Text, { color: lineColor, children: line.slice(0, 72) }), line.length > 72 && _jsx(Text, { color: "gray", children: "\u2026" })] }, i));
198
+ }) }), remainingLines > 0 && (_jsxs(Text, { color: "yellow", children: [" \u22EE ", remainingLines, " more lines..."] })), _jsx(Text, { color: actionColor, children: '─'.repeat(80) })] }));
176
199
  };
177
200
  // Helper functions for action display
178
201
  const getActionColor = (type) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
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",