@involvex/super-agent-cli 0.0.45 → 0.0.46
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/bunfig.toml +43 -0
- package/dist/index.js +9 -15
- package/dist/super-agent-cli.exe +0 -0
- package/package.json +4 -1
- package/.grok/settings.json +0 -3
- package/.super-agent/settings.json +0 -23
- package/dist/agent/grok-agent.d.ts +0 -54
- package/dist/agent/grok-agent.js +0 -638
- package/dist/agent/grok-agent.js.map +0 -1
- package/dist/agent/index.d.ts +0 -14
- package/dist/agent/index.js +0 -139
- package/dist/agent/index.js.map +0 -1
- package/dist/agent/super-agent.d.ts +0 -54
- package/dist/agent/super-agent.js +0 -638
- package/dist/agent/super-agent.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -2
- package/dist/commands/mcp.js +0 -247
- package/dist/commands/mcp.js.map +0 -1
- package/dist/core/client.d.ts +0 -49
- package/dist/core/client.js +0 -81
- package/dist/core/client.js.map +0 -1
- package/dist/core/tools.d.ts +0 -8
- package/dist/core/tools.js +0 -351
- package/dist/core/tools.js.map +0 -1
- package/dist/grok/client.d.ts +0 -49
- package/dist/grok/client.js +0 -81
- package/dist/grok/client.js.map +0 -1
- package/dist/grok/tools.d.ts +0 -8
- package/dist/grok/tools.js +0 -351
- package/dist/grok/tools.js.map +0 -1
- package/dist/hooks/use-enhanced-input.d.ts +0 -37
- package/dist/hooks/use-enhanced-input.js +0 -228
- package/dist/hooks/use-enhanced-input.js.map +0 -1
- package/dist/hooks/use-input-handler.d.ts +0 -34
- package/dist/hooks/use-input-handler.js +0 -607
- package/dist/hooks/use-input-handler.js.map +0 -1
- package/dist/hooks/use-input-history.d.ts +0 -9
- package/dist/hooks/use-input-history.js +0 -62
- package/dist/hooks/use-input-history.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js.map +0 -1
- package/dist/mcp/client.d.ts +0 -29
- package/dist/mcp/client.js +0 -127
- package/dist/mcp/client.js.map +0 -1
- package/dist/mcp/config.d.ts +0 -13
- package/dist/mcp/config.js +0 -45
- package/dist/mcp/config.js.map +0 -1
- package/dist/mcp/transports.d.ts +0 -51
- package/dist/mcp/transports.js +0 -229
- package/dist/mcp/transports.js.map +0 -1
- package/dist/tools/bash.d.ts +0 -10
- package/dist/tools/bash.js +0 -76
- package/dist/tools/bash.js.map +0 -1
- package/dist/tools/confirmation-tool.d.ts +0 -16
- package/dist/tools/confirmation-tool.js +0 -77
- package/dist/tools/confirmation-tool.js.map +0 -1
- package/dist/tools/index.d.ts +0 -6
- package/dist/tools/index.js +0 -7
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/morph-editor.d.ts +0 -36
- package/dist/tools/morph-editor.js +0 -324
- package/dist/tools/morph-editor.js.map +0 -1
- package/dist/tools/search.d.ts +0 -69
- package/dist/tools/search.js +0 -307
- package/dist/tools/search.js.map +0 -1
- package/dist/tools/text-editor.d.ts +0 -26
- package/dist/tools/text-editor.js +0 -583
- package/dist/tools/text-editor.js.map +0 -1
- package/dist/tools/todo-tool.d.ts +0 -20
- package/dist/tools/todo-tool.js +0 -134
- package/dist/tools/todo-tool.js.map +0 -1
- package/dist/types/index.d.ts +0 -30
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/ui/app.d.ts +0 -6
- package/dist/ui/app.js +0 -76
- package/dist/ui/app.js.map +0 -1
- package/dist/ui/components/api-key-input.d.ts +0 -6
- package/dist/ui/components/api-key-input.js +0 -70
- package/dist/ui/components/api-key-input.js.map +0 -1
- package/dist/ui/components/chat-history.d.ts +0 -7
- package/dist/ui/components/chat-history.js +0 -136
- package/dist/ui/components/chat-history.js.map +0 -1
- package/dist/ui/components/chat-input.d.ts +0 -8
- package/dist/ui/components/chat-input.js +0 -47
- package/dist/ui/components/chat-input.js.map +0 -1
- package/dist/ui/components/chat-interface.d.ts +0 -7
- package/dist/ui/components/chat-interface.js +0 -213
- package/dist/ui/components/chat-interface.js.map +0 -1
- package/dist/ui/components/command-suggestions.d.ts +0 -16
- package/dist/ui/components/command-suggestions.js +0 -18
- package/dist/ui/components/command-suggestions.js.map +0 -1
- package/dist/ui/components/confirmation-dialog.d.ts +0 -10
- package/dist/ui/components/confirmation-dialog.js +0 -70
- package/dist/ui/components/confirmation-dialog.js.map +0 -1
- package/dist/ui/components/diff-renderer.d.ts +0 -13
- package/dist/ui/components/diff-renderer.js +0 -200
- package/dist/ui/components/diff-renderer.js.map +0 -1
- package/dist/ui/components/loading-spinner.d.ts +0 -7
- package/dist/ui/components/loading-spinner.js +0 -52
- package/dist/ui/components/loading-spinner.js.map +0 -1
- package/dist/ui/components/mcp-status.d.ts +0 -4
- package/dist/ui/components/mcp-status.js +0 -37
- package/dist/ui/components/mcp-status.js.map +0 -1
- package/dist/ui/components/model-selection.d.ts +0 -11
- package/dist/ui/components/model-selection.js +0 -9
- package/dist/ui/components/model-selection.js.map +0 -1
- package/dist/ui/shared/max-sized-box.d.ts +0 -8
- package/dist/ui/shared/max-sized-box.js +0 -6
- package/dist/ui/shared/max-sized-box.js.map +0 -1
- package/dist/ui/utils/code-colorizer.d.ts +0 -2
- package/dist/ui/utils/code-colorizer.js +0 -7
- package/dist/ui/utils/code-colorizer.js.map +0 -1
- package/dist/ui/utils/colors.d.ts +0 -14
- package/dist/ui/utils/colors.js +0 -15
- package/dist/ui/utils/colors.js.map +0 -1
- package/dist/ui/utils/markdown-renderer.d.ts +0 -3
- package/dist/ui/utils/markdown-renderer.js +0 -23
- package/dist/ui/utils/markdown-renderer.js.map +0 -1
- package/dist/utils/confirmation-service.d.ts +0 -33
- package/dist/utils/confirmation-service.js +0 -110
- package/dist/utils/confirmation-service.js.map +0 -1
- package/dist/utils/custom-instructions.d.ts +0 -1
- package/dist/utils/custom-instructions.js +0 -23
- package/dist/utils/custom-instructions.js.map +0 -1
- package/dist/utils/model-config.d.ts +0 -28
- package/dist/utils/model-config.js +0 -42
- package/dist/utils/model-config.js.map +0 -1
- package/dist/utils/settings-manager.d.ts +0 -99
- package/dist/utils/settings-manager.js +0 -286
- package/dist/utils/settings-manager.js.map +0 -1
- package/dist/utils/settings.d.ts +0 -1
- package/dist/utils/settings.js +0 -4
- package/dist/utils/settings.js.map +0 -1
- package/dist/utils/text-utils.d.ts +0 -80
- package/dist/utils/text-utils.js +0 -191
- package/dist/utils/text-utils.js.map +0 -1
- package/dist/utils/token-counter.d.ts +0 -33
- package/dist/utils/token-counter.js +0 -79
- package/dist/utils/token-counter.js.map +0 -1
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { ConfirmationService, } from "../../utils/confirmation-service";
|
|
3
|
-
import { useInputHandler } from "../../hooks/use-input-handler";
|
|
4
|
-
import { CommandSuggestions } from "./command-suggestions";
|
|
5
|
-
import ConfirmationDialog from "./confirmation-dialog";
|
|
6
|
-
import { useEffect, useRef, useState } from "react";
|
|
7
|
-
import { ModelSelection } from "./model-selection";
|
|
8
|
-
import { LoadingSpinner } from "./loading-spinner";
|
|
9
|
-
import { ChatHistory } from "./chat-history";
|
|
10
|
-
import ApiKeyInput from "./api-key-input";
|
|
11
|
-
import { MCPStatus } from "./mcp-status";
|
|
12
|
-
import { ChatInput } from "./chat-input";
|
|
13
|
-
import { Box, Text } from "ink";
|
|
14
|
-
import cfonts from "cfonts";
|
|
15
|
-
// Main chat component that handles input when agent is available
|
|
16
|
-
function ChatInterfaceWithAgent({ agent, initialMessage, }) {
|
|
17
|
-
const [chatHistory, setChatHistory] = useState([]);
|
|
18
|
-
const [isProcessing, setIsProcessing] = useState(false);
|
|
19
|
-
const [processingTime, setProcessingTime] = useState(0);
|
|
20
|
-
const [tokenCount, setTokenCount] = useState(0);
|
|
21
|
-
const [isStreaming, setIsStreaming] = useState(false);
|
|
22
|
-
const [confirmationOptions, setConfirmationOptions] = useState(null);
|
|
23
|
-
const scrollRef = useRef();
|
|
24
|
-
const processingStartTime = useRef(0);
|
|
25
|
-
const confirmationService = ConfirmationService.getInstance();
|
|
26
|
-
const { input, cursorPosition, showCommandSuggestions, selectedCommandIndex, showModelSelection, selectedModelIndex, commandSuggestions, availableModels, autoEditEnabled, } = useInputHandler({
|
|
27
|
-
agent,
|
|
28
|
-
chatHistory,
|
|
29
|
-
setChatHistory,
|
|
30
|
-
setIsProcessing,
|
|
31
|
-
setIsStreaming,
|
|
32
|
-
setTokenCount,
|
|
33
|
-
setProcessingTime,
|
|
34
|
-
processingStartTime,
|
|
35
|
-
isProcessing,
|
|
36
|
-
isStreaming,
|
|
37
|
-
isConfirmationActive: !!confirmationOptions,
|
|
38
|
-
});
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
// Only clear console on non-Windows platforms or if not PowerShell
|
|
41
|
-
// Windows PowerShell can have issues with console.clear() causing flickering
|
|
42
|
-
const isWindows = process.platform === "win32";
|
|
43
|
-
const isPowerShell = process.env.ComSpec?.toLowerCase().includes("powershell") ||
|
|
44
|
-
process.env.PSModulePath !== undefined;
|
|
45
|
-
if (!isWindows || !isPowerShell) {
|
|
46
|
-
console.clear();
|
|
47
|
-
}
|
|
48
|
-
// Add top padding
|
|
49
|
-
console.log(" ");
|
|
50
|
-
// Generate logo with margin to match Ink paddingX={2}
|
|
51
|
-
const logoOutput = cfonts.render("SUPER|AGENT", {
|
|
52
|
-
font: "3d",
|
|
53
|
-
align: "left",
|
|
54
|
-
colors: ["magenta", "gray"],
|
|
55
|
-
space: true,
|
|
56
|
-
maxLength: "0",
|
|
57
|
-
gradient: ["magenta", "cyan"],
|
|
58
|
-
independentGradient: false,
|
|
59
|
-
transitionGradient: true,
|
|
60
|
-
env: "node",
|
|
61
|
-
});
|
|
62
|
-
// Add horizontal margin (2 spaces) to match Ink paddingX={2}
|
|
63
|
-
const logoLines = logoOutput.string.split("\n");
|
|
64
|
-
logoLines.forEach((line) => {
|
|
65
|
-
if (line.trim()) {
|
|
66
|
-
console.log(" " + line); // Add 2 spaces for horizontal margin
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
console.log(line); // Keep empty lines as-is
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
console.log(" "); // Spacing after logo
|
|
73
|
-
setChatHistory([]);
|
|
74
|
-
}, []);
|
|
75
|
-
// Process initial message if provided (streaming for faster feedback)
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
if (initialMessage && agent) {
|
|
78
|
-
const userEntry = {
|
|
79
|
-
type: "user",
|
|
80
|
-
content: initialMessage,
|
|
81
|
-
timestamp: new Date(),
|
|
82
|
-
};
|
|
83
|
-
setChatHistory([userEntry]);
|
|
84
|
-
const processInitialMessage = async () => {
|
|
85
|
-
setIsProcessing(true);
|
|
86
|
-
setIsStreaming(true);
|
|
87
|
-
try {
|
|
88
|
-
let streamingEntry = null;
|
|
89
|
-
for await (const chunk of agent.processUserMessageStream(initialMessage)) {
|
|
90
|
-
switch (chunk.type) {
|
|
91
|
-
case "content":
|
|
92
|
-
if (chunk.content) {
|
|
93
|
-
if (!streamingEntry) {
|
|
94
|
-
const newStreamingEntry = {
|
|
95
|
-
type: "assistant",
|
|
96
|
-
content: chunk.content,
|
|
97
|
-
timestamp: new Date(),
|
|
98
|
-
isStreaming: true,
|
|
99
|
-
};
|
|
100
|
-
setChatHistory(prev => [...prev, newStreamingEntry]);
|
|
101
|
-
streamingEntry = newStreamingEntry;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
setChatHistory(prev => prev.map((entry, idx) => idx === prev.length - 1 && entry.isStreaming
|
|
105
|
-
? { ...entry, content: entry.content + chunk.content }
|
|
106
|
-
: entry));
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
break;
|
|
110
|
-
case "token_count":
|
|
111
|
-
if (chunk.tokenCount !== undefined) {
|
|
112
|
-
setTokenCount(chunk.tokenCount);
|
|
113
|
-
}
|
|
114
|
-
break;
|
|
115
|
-
case "tool_calls":
|
|
116
|
-
if (chunk.toolCalls) {
|
|
117
|
-
// Stop streaming for the current assistant message
|
|
118
|
-
setChatHistory(prev => prev.map(entry => entry.isStreaming
|
|
119
|
-
? {
|
|
120
|
-
...entry,
|
|
121
|
-
isStreaming: false,
|
|
122
|
-
toolCalls: chunk.toolCalls,
|
|
123
|
-
}
|
|
124
|
-
: entry));
|
|
125
|
-
streamingEntry = null;
|
|
126
|
-
// Add individual tool call entries to show tools are being executed
|
|
127
|
-
chunk.toolCalls.forEach(toolCall => {
|
|
128
|
-
const toolCallEntry = {
|
|
129
|
-
type: "tool_call",
|
|
130
|
-
content: "Executing...",
|
|
131
|
-
timestamp: new Date(),
|
|
132
|
-
toolCall: toolCall,
|
|
133
|
-
};
|
|
134
|
-
setChatHistory(prev => [...prev, toolCallEntry]);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
break;
|
|
138
|
-
case "done":
|
|
139
|
-
if (streamingEntry) {
|
|
140
|
-
setChatHistory(prev => prev.map(entry => entry.isStreaming
|
|
141
|
-
? { ...entry, isStreaming: false }
|
|
142
|
-
: entry));
|
|
143
|
-
}
|
|
144
|
-
setIsStreaming(false);
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
const errorEntry = {
|
|
151
|
-
type: "assistant",
|
|
152
|
-
content: `Error: ${error.message}`,
|
|
153
|
-
timestamp: new Date(),
|
|
154
|
-
};
|
|
155
|
-
setChatHistory(prev => [...prev, errorEntry]);
|
|
156
|
-
setIsStreaming(false);
|
|
157
|
-
}
|
|
158
|
-
setIsProcessing(false);
|
|
159
|
-
processingStartTime.current = 0;
|
|
160
|
-
};
|
|
161
|
-
processInitialMessage();
|
|
162
|
-
}
|
|
163
|
-
}, [initialMessage, agent]);
|
|
164
|
-
useEffect(() => {
|
|
165
|
-
const handleConfirmationRequest = (options) => {
|
|
166
|
-
setConfirmationOptions(options);
|
|
167
|
-
};
|
|
168
|
-
confirmationService.on("confirmation-requested", handleConfirmationRequest);
|
|
169
|
-
return () => {
|
|
170
|
-
confirmationService.off("confirmation-requested", handleConfirmationRequest);
|
|
171
|
-
};
|
|
172
|
-
}, [confirmationService]);
|
|
173
|
-
useEffect(() => {
|
|
174
|
-
if (!isProcessing && !isStreaming) {
|
|
175
|
-
setProcessingTime(0);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
if (processingStartTime.current === 0) {
|
|
179
|
-
processingStartTime.current = Date.now();
|
|
180
|
-
}
|
|
181
|
-
const interval = setInterval(() => {
|
|
182
|
-
setProcessingTime(Math.floor((Date.now() - processingStartTime.current) / 1000));
|
|
183
|
-
}, 1000);
|
|
184
|
-
return () => clearInterval(interval);
|
|
185
|
-
}, [isProcessing, isStreaming]);
|
|
186
|
-
const handleConfirmation = (dontAskAgain) => {
|
|
187
|
-
confirmationService.confirmOperation(true, dontAskAgain);
|
|
188
|
-
setConfirmationOptions(null);
|
|
189
|
-
};
|
|
190
|
-
const handleRejection = (feedback) => {
|
|
191
|
-
confirmationService.rejectOperation(feedback);
|
|
192
|
-
setConfirmationOptions(null);
|
|
193
|
-
// Reset processing states when operation is cancelled
|
|
194
|
-
setIsProcessing(false);
|
|
195
|
-
setIsStreaming(false);
|
|
196
|
-
setTokenCount(0);
|
|
197
|
-
setProcessingTime(0);
|
|
198
|
-
processingStartTime.current = 0;
|
|
199
|
-
};
|
|
200
|
-
return (_jsxs(Box, { flexDirection: "column", paddingX: 2, children: [chatHistory.length === 0 && !confirmationOptions && (_jsxs(Box, { flexDirection: "column", marginBottom: 2, children: [_jsx(Text, { color: "cyan", bold: true, children: "Tips for getting started:" }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { color: "gray", children: "1. Ask questions, edit files, or run commands." }), _jsx(Text, { color: "gray", children: "2. Be specific for the best results." }), _jsx(Text, { color: "gray", children: "3. Create SUPER_AGENT.md files to customize your interactions." }), _jsx(Text, { color: "gray", children: "4. Press Shift+Tab to toggle auto-edit mode." }), _jsx(Text, { color: "gray", children: "5. /help for more information." })] })] })), _jsx(Box, { flexDirection: "column", marginBottom: 1, children: _jsx(Text, { color: "gray", children: "Type your request in natural language. Ctrl+C to clear, 'exit' to quit." }) }), _jsx(Box, { flexDirection: "column", ref: scrollRef, children: _jsx(ChatHistory, { entries: chatHistory, isConfirmationActive: !!confirmationOptions }) }), confirmationOptions && (_jsx(ConfirmationDialog, { operation: confirmationOptions.operation, filename: confirmationOptions.filename, showVSCodeOpen: confirmationOptions.showVSCodeOpen, content: confirmationOptions.content, onConfirm: handleConfirmation, onReject: handleRejection })), !confirmationOptions && (_jsxs(_Fragment, { children: [_jsx(LoadingSpinner, { isActive: isProcessing || isStreaming, processingTime: processingTime, tokenCount: tokenCount }), _jsx(ChatInput, { input: input, cursorPosition: cursorPosition, isProcessing: isProcessing, isStreaming: isStreaming }), _jsxs(Box, { flexDirection: "row", marginTop: 1, children: [_jsxs(Box, { marginRight: 2, children: [_jsxs(Text, { color: "cyan", children: [autoEditEnabled ? "▶" : "⏸", " auto-edit:", " ", autoEditEnabled ? "on" : "off"] }), _jsxs(Text, { color: "gray", dimColor: true, children: [" ", "(shift + tab)"] })] }), _jsx(Box, { marginRight: 2, children: _jsxs(Text, { color: "yellow", children: ["\u224B ", agent.getCurrentModel()] }) }), _jsx(MCPStatus, {})] }), _jsx(CommandSuggestions, { suggestions: commandSuggestions, input: input, selectedIndex: selectedCommandIndex, isVisible: showCommandSuggestions }), _jsx(ModelSelection, { models: availableModels, selectedIndex: selectedModelIndex, isVisible: showModelSelection, currentModel: agent.getCurrentModel() })] }))] }));
|
|
201
|
-
}
|
|
202
|
-
// Main component that handles API key input or chat interface
|
|
203
|
-
export default function ChatInterface({ agent, initialMessage, }) {
|
|
204
|
-
const [currentAgent, setCurrentAgent] = useState(agent || null);
|
|
205
|
-
const handleApiKeySet = (newAgent) => {
|
|
206
|
-
setCurrentAgent(newAgent);
|
|
207
|
-
};
|
|
208
|
-
if (!currentAgent) {
|
|
209
|
-
return _jsx(ApiKeyInput, { onApiKeySet: handleApiKeySet });
|
|
210
|
-
}
|
|
211
|
-
return (_jsx(ChatInterfaceWithAgent, { agent: currentAgent, initialMessage: initialMessage }));
|
|
212
|
-
}
|
|
213
|
-
//# sourceMappingURL=chat-interface.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat-interface.js","sourceRoot":"","sources":["../../../src/ui/components/chat-interface.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAO5B,iEAAiE;AACjE,SAAS,sBAAsB,CAAC,EAC9B,KAAK,EACL,cAAc,GAIf;IACC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAc,EAAE,CAAC,CAAC;IAChE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC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,GACnD,EACN,KAAC,SAAS,KAAG,IACT,EAEN,KAAC,kBAAkB,IACjB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,oBAAoB,EACnC,SAAS,EAAE,sBAAsB,GACjC,EAEF,KAAC,cAAc,IACb,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,kBAAkB,EACjC,SAAS,EAAE,kBAAkB,EAC7B,YAAY,EAAE,KAAK,CAAC,eAAe,EAAE,GACrC,IACD,CACJ,IACG,CACP,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,KAAK,EACL,cAAc,GACK;IACnB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAC9C,KAAK,IAAI,IAAI,CACd,CAAC;IAEF,MAAM,eAAe,GAAG,CAAC,QAAoB,EAAE,EAAE;QAC/C,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,KAAC,WAAW,IAAC,WAAW,EAAE,eAAe,GAAI,CAAC;IACvD,CAAC;IAED,OAAO,CACL,KAAC,sBAAsB,IACrB,KAAK,EAAE,YAAY,EACnB,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
interface CommandSuggestion {
|
|
2
|
-
command: string;
|
|
3
|
-
description: string;
|
|
4
|
-
}
|
|
5
|
-
interface CommandSuggestionsProps {
|
|
6
|
-
suggestions: CommandSuggestion[];
|
|
7
|
-
input: string;
|
|
8
|
-
selectedIndex: number;
|
|
9
|
-
isVisible: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare const MAX_SUGGESTIONS = 8;
|
|
12
|
-
export declare function filterCommandSuggestions<T extends {
|
|
13
|
-
command: string;
|
|
14
|
-
}>(suggestions: T[], input: string): T[];
|
|
15
|
-
export declare function CommandSuggestions({ suggestions, input, selectedIndex, isVisible, }: CommandSuggestionsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import { Box, Text } from "ink";
|
|
4
|
-
export const MAX_SUGGESTIONS = 8;
|
|
5
|
-
export function filterCommandSuggestions(suggestions, input) {
|
|
6
|
-
const lowerInput = input.toLowerCase();
|
|
7
|
-
return suggestions
|
|
8
|
-
.filter(s => s.command.toLowerCase().startsWith(lowerInput))
|
|
9
|
-
.slice(0, MAX_SUGGESTIONS);
|
|
10
|
-
}
|
|
11
|
-
export function CommandSuggestions({ suggestions, input, selectedIndex, isVisible, }) {
|
|
12
|
-
if (!isVisible) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
const filteredSuggestions = useMemo(() => filterCommandSuggestions(suggestions, input), [suggestions, input]);
|
|
16
|
-
return (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [filteredSuggestions.map((suggestion, index) => (_jsxs(Box, { paddingLeft: 1, children: [_jsx(Text, { color: index === selectedIndex ? "black" : "white", backgroundColor: index === selectedIndex ? "cyan" : undefined, children: suggestion.command }), _jsx(Box, { marginLeft: 1, children: _jsx(Text, { color: "gray", children: suggestion.description }) })] }, index))), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter/Tab select \u2022 Esc cancel" }) })] }));
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=command-suggestions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-suggestions.js","sourceRoot":"","sources":["../../../src/ui/components/command-suggestions.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE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C,EACF,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,QAAQ,sFAEpB,GACH,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface ConfirmationDialogProps {
|
|
2
|
-
operation: string;
|
|
3
|
-
filename: string;
|
|
4
|
-
onConfirm: (dontAskAgain?: boolean) => void;
|
|
5
|
-
onReject: (feedback?: string) => void;
|
|
6
|
-
showVSCodeOpen?: boolean;
|
|
7
|
-
content?: string;
|
|
8
|
-
}
|
|
9
|
-
export default function ConfirmationDialog({ operation, filename, onConfirm, onReject, showVSCodeOpen, content, }: ConfirmationDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { DiffRenderer } from "./diff-renderer";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { useState } from "react";
|
|
5
|
-
export default function ConfirmationDialog({ operation, filename, onConfirm, onReject, showVSCodeOpen = false, content, }) {
|
|
6
|
-
const [selectedOption, setSelectedOption] = useState(0);
|
|
7
|
-
const [feedbackMode, setFeedbackMode] = useState(false);
|
|
8
|
-
const [feedback, setFeedback] = useState("");
|
|
9
|
-
const options = [
|
|
10
|
-
"Yes",
|
|
11
|
-
"Yes, and don't ask again this session",
|
|
12
|
-
"No",
|
|
13
|
-
"No, with feedback",
|
|
14
|
-
];
|
|
15
|
-
useInput((input, key) => {
|
|
16
|
-
if (feedbackMode) {
|
|
17
|
-
if (key.return) {
|
|
18
|
-
onReject(feedback.trim());
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (key.backspace || key.delete) {
|
|
22
|
-
setFeedback(prev => prev.slice(0, -1));
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (input && !key.ctrl && !key.meta) {
|
|
26
|
-
setFeedback(prev => prev + input);
|
|
27
|
-
}
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (key.upArrow || (key.shift && key.tab)) {
|
|
31
|
-
setSelectedOption(prev => (prev > 0 ? prev - 1 : options.length - 1));
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (key.downArrow || key.tab) {
|
|
35
|
-
setSelectedOption(prev => (prev + 1) % options.length);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (key.return) {
|
|
39
|
-
if (selectedOption === 0) {
|
|
40
|
-
onConfirm(false);
|
|
41
|
-
}
|
|
42
|
-
else if (selectedOption === 1) {
|
|
43
|
-
onConfirm(true);
|
|
44
|
-
}
|
|
45
|
-
else if (selectedOption === 2) {
|
|
46
|
-
onReject("Operation cancelled by user");
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
setFeedbackMode(true);
|
|
50
|
-
}
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (key.escape) {
|
|
54
|
-
if (feedbackMode) {
|
|
55
|
-
setFeedbackMode(false);
|
|
56
|
-
setFeedback("");
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
// Cancel the confirmation when escape is pressed from main confirmation
|
|
60
|
-
onReject("Operation cancelled by user (pressed Escape)");
|
|
61
|
-
}
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
if (feedbackMode) {
|
|
66
|
-
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Box, { flexDirection: "column", marginBottom: 1, children: _jsx(Text, { color: "gray", children: "Type your feedback and press Enter, or press Escape to go back." }) }), _jsxs(Box, { borderStyle: "round", borderColor: "yellow", paddingX: 1, marginTop: 1, children: [_jsx(Text, { color: "gray", children: "\u276F " }), _jsxs(Text, { children: [feedback, _jsx(Text, { color: "white", children: "\u2588" })] })] })] }));
|
|
67
|
-
}
|
|
68
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginTop: 1, children: _jsxs(Box, { children: [_jsx(Text, { color: "magenta", children: "\u23FA" }), _jsxs(Text, { color: "white", children: [" ", operation, "(", filename, ")"] })] }) }), _jsxs(Box, { marginLeft: 2, flexDirection: "column", children: [_jsx(Text, { color: "gray", children: "\u23BF Requesting user confirmation" }), showVSCodeOpen && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "\u23BF Opened changes in Visual Studio Code \u29C9" }) })), content && (_jsxs(_Fragment, { children: [_jsxs(Text, { color: "gray", children: ["\u23BF ", content.split("\n")[0]] }), _jsx(Box, { marginLeft: 4, flexDirection: "column", children: _jsx(DiffRenderer, { diffContent: content, filename: filename, terminalWidth: 80 }) })] }))] }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { children: "Do you want to proceed with this operation?" }) }), _jsx(Box, { flexDirection: "column", children: options.map((option, index) => (_jsx(Box, { paddingLeft: 1, children: _jsxs(Text, { color: selectedOption === index ? "black" : "white", backgroundColor: selectedOption === index ? "cyan" : undefined, children: [index + 1, ". ", option] }) }, index))) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter select \u2022 Esc cancel" }) })] })] }));
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=confirmation-dialog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"confirmation-dialog.js","sourceRoot":"","sources":["../../../src/ui/components/confirmation-dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAWxC,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAC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aAAa,EAAC,QAAQ,YACxB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9B,KAAC,GAAG,IAAa,WAAW,EAAE,CAAC,YAC7B,MAAC,IAAI,IACH,KAAK,EAAE,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACnD,eAAe,EAAE,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,aAE7D,KAAK,GAAG,CAAC,QAAI,MAAM,IACf,IANC,KAAK,CAOT,CACP,CAAC,GACE,EAEN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,QAAQ,kFAEpB,GACH,IACF,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Professional diff renderer component
|
|
3
|
-
*/
|
|
4
|
-
import React from "react";
|
|
5
|
-
interface DiffRendererProps {
|
|
6
|
-
diffContent: string;
|
|
7
|
-
filename?: string;
|
|
8
|
-
tabWidth?: number;
|
|
9
|
-
availableTerminalHeight?: number;
|
|
10
|
-
terminalWidth?: number;
|
|
11
|
-
}
|
|
12
|
-
export declare const DiffRenderer: ({ diffContent, filename, tabWidth, availableTerminalHeight, terminalWidth, }: DiffRendererProps) => React.ReactElement;
|
|
13
|
-
export {};
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { MaxSizedBox } from "../shared/max-sized-box";
|
|
3
|
-
import { Colors } from "../utils/colors";
|
|
4
|
-
import { Box, Text } from "ink";
|
|
5
|
-
import crypto from "crypto";
|
|
6
|
-
function parseDiffWithLineNumbers(diffContent) {
|
|
7
|
-
const lines = diffContent.split("\n");
|
|
8
|
-
const result = [];
|
|
9
|
-
let currentOldLine = 0;
|
|
10
|
-
let currentNewLine = 0;
|
|
11
|
-
let inHunk = false;
|
|
12
|
-
const hunkHeaderRegex = /^@@ -(\d+),?\d* \+(\d+),?\d* @@/;
|
|
13
|
-
for (const line of lines) {
|
|
14
|
-
const hunkMatch = line.match(hunkHeaderRegex);
|
|
15
|
-
if (hunkMatch) {
|
|
16
|
-
currentOldLine = parseInt(hunkMatch[1], 10);
|
|
17
|
-
currentNewLine = parseInt(hunkMatch[2], 10);
|
|
18
|
-
inHunk = true;
|
|
19
|
-
result.push({ type: "hunk", content: line });
|
|
20
|
-
// We need to adjust the starting point because the first line number applies to the *first* actual line change/context,
|
|
21
|
-
// but we increment *before* pushing that line. So decrement here.
|
|
22
|
-
currentOldLine--;
|
|
23
|
-
currentNewLine--;
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
if (!inHunk) {
|
|
27
|
-
// Skip standard Git header lines more robustly
|
|
28
|
-
if (line.startsWith("--- ") ||
|
|
29
|
-
line.startsWith("+++ ") ||
|
|
30
|
-
line.startsWith("diff --git") ||
|
|
31
|
-
line.startsWith("index ") ||
|
|
32
|
-
line.startsWith("similarity index") ||
|
|
33
|
-
line.startsWith("rename from") ||
|
|
34
|
-
line.startsWith("rename to") ||
|
|
35
|
-
line.startsWith("new file mode") ||
|
|
36
|
-
line.startsWith("deleted file mode")) {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
// If it's not a hunk or header, skip (or handle as 'other' if needed)
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (line.startsWith("+")) {
|
|
43
|
-
currentNewLine++; // Increment before pushing
|
|
44
|
-
result.push({
|
|
45
|
-
type: "add",
|
|
46
|
-
newLine: currentNewLine,
|
|
47
|
-
content: line.substring(1),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
else if (line.startsWith("-")) {
|
|
51
|
-
currentOldLine++; // Increment before pushing
|
|
52
|
-
result.push({
|
|
53
|
-
type: "del",
|
|
54
|
-
oldLine: currentOldLine,
|
|
55
|
-
content: line.substring(1),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
else if (line.startsWith(" ")) {
|
|
59
|
-
currentOldLine++; // Increment before pushing
|
|
60
|
-
currentNewLine++;
|
|
61
|
-
result.push({
|
|
62
|
-
type: "context",
|
|
63
|
-
oldLine: currentOldLine,
|
|
64
|
-
newLine: currentNewLine,
|
|
65
|
-
content: line.substring(1),
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
else if (line.startsWith("\\")) {
|
|
69
|
-
// Handle ""
|
|
70
|
-
result.push({ type: "other", content: line });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return result;
|
|
74
|
-
}
|
|
75
|
-
const DEFAULT_TAB_WIDTH = 4; // Spaces per tab for normalization
|
|
76
|
-
export const DiffRenderer = ({ diffContent, filename, tabWidth = DEFAULT_TAB_WIDTH, availableTerminalHeight, terminalWidth = 80, }) => {
|
|
77
|
-
if (!diffContent || typeof diffContent !== "string") {
|
|
78
|
-
return _jsx(Text, { color: Colors.AccentYellow, children: "No diff content." });
|
|
79
|
-
}
|
|
80
|
-
// Strip the first summary line (e.g. "Updated file.txt with 1 addition and 2 removals")
|
|
81
|
-
const lines = diffContent.split("\n");
|
|
82
|
-
const firstLine = lines[0];
|
|
83
|
-
let actualDiffContent = diffContent;
|
|
84
|
-
if (firstLine &&
|
|
85
|
-
(firstLine.startsWith("Updated ") || firstLine.startsWith("Created "))) {
|
|
86
|
-
actualDiffContent = lines.slice(1).join("\n");
|
|
87
|
-
}
|
|
88
|
-
const parsedLines = parseDiffWithLineNumbers(actualDiffContent);
|
|
89
|
-
if (parsedLines.length === 0) {
|
|
90
|
-
return _jsx(Text, { dimColor: true, children: "No changes detected." });
|
|
91
|
-
}
|
|
92
|
-
// Always render as diff format to show line numbers and + signs
|
|
93
|
-
const renderedOutput = renderDiffContent(parsedLines, filename, tabWidth, availableTerminalHeight, terminalWidth);
|
|
94
|
-
return _jsx(_Fragment, { children: renderedOutput });
|
|
95
|
-
};
|
|
96
|
-
const renderDiffContent = (parsedLines, filename, tabWidth = DEFAULT_TAB_WIDTH, availableTerminalHeight, terminalWidth) => {
|
|
97
|
-
// 1. Normalize whitespace (replace tabs with spaces) *before* further processing
|
|
98
|
-
const normalizedLines = parsedLines.map(line => ({
|
|
99
|
-
...line,
|
|
100
|
-
content: line.content.replace(/\t/g, " ".repeat(tabWidth)),
|
|
101
|
-
}));
|
|
102
|
-
// Filter out non-displayable lines (hunks, potentially 'other') using the normalized list
|
|
103
|
-
const displayableLines = normalizedLines.filter(l => l.type !== "hunk" && l.type !== "other");
|
|
104
|
-
if (displayableLines.length === 0) {
|
|
105
|
-
return _jsx(Text, { dimColor: true, children: "No changes detected." });
|
|
106
|
-
}
|
|
107
|
-
// Calculate the minimum indentation across all displayable lines
|
|
108
|
-
let baseIndentation = Infinity; // Start high to find the minimum
|
|
109
|
-
for (const line of displayableLines) {
|
|
110
|
-
// Only consider lines with actual content for indentation calculation
|
|
111
|
-
if (line.content.trim() === "") {
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
const firstCharIndex = line.content.search(/\S/); // Find index of first non-whitespace char
|
|
115
|
-
const currentIndent = firstCharIndex === -1 ? 0 : firstCharIndex; // Indent is 0 if no non-whitespace found
|
|
116
|
-
baseIndentation = Math.min(baseIndentation, currentIndent);
|
|
117
|
-
}
|
|
118
|
-
// If baseIndentation remained Infinity (e.g., no displayable lines with content), default to 0
|
|
119
|
-
if (!isFinite(baseIndentation)) {
|
|
120
|
-
baseIndentation = 0;
|
|
121
|
-
}
|
|
122
|
-
const key = filename
|
|
123
|
-
? `diff-box-${filename}`
|
|
124
|
-
: `diff-box-${crypto.createHash("sha1").update(JSON.stringify(parsedLines)).digest("hex")}`;
|
|
125
|
-
let lastLineNumber = null;
|
|
126
|
-
const MAX_CONTEXT_LINES_WITHOUT_GAP = 5;
|
|
127
|
-
return (_jsx(MaxSizedBox, { maxHeight: availableTerminalHeight, maxWidth: terminalWidth, children: displayableLines.reduce((acc, line, index) => {
|
|
128
|
-
// Determine the relevant line number for gap calculation based on type
|
|
129
|
-
let relevantLineNumberForGapCalc = null;
|
|
130
|
-
if (line.type === "add" || line.type === "context") {
|
|
131
|
-
relevantLineNumberForGapCalc = line.newLine ?? null;
|
|
132
|
-
}
|
|
133
|
-
else if (line.type === "del") {
|
|
134
|
-
// For deletions, the gap is typically in relation to the original file's line numbering
|
|
135
|
-
relevantLineNumberForGapCalc = line.oldLine ?? null;
|
|
136
|
-
}
|
|
137
|
-
if (lastLineNumber !== null &&
|
|
138
|
-
relevantLineNumberForGapCalc !== null &&
|
|
139
|
-
relevantLineNumberForGapCalc >
|
|
140
|
-
lastLineNumber + MAX_CONTEXT_LINES_WITHOUT_GAP + 1) {
|
|
141
|
-
acc.push(_jsx(Box, { children: _jsx(Text, { wrap: "truncate", children: "═".repeat(terminalWidth) }) }, `gap-${index}`));
|
|
142
|
-
}
|
|
143
|
-
const lineKey = `diff-line-${index}`;
|
|
144
|
-
let gutterNumStr = "";
|
|
145
|
-
let backgroundColor = undefined;
|
|
146
|
-
let prefixSymbol = " ";
|
|
147
|
-
let dim = false;
|
|
148
|
-
switch (line.type) {
|
|
149
|
-
case "add":
|
|
150
|
-
gutterNumStr = (line.newLine ?? "").toString();
|
|
151
|
-
backgroundColor = "#86efac"; // Light green for additions
|
|
152
|
-
prefixSymbol = "+";
|
|
153
|
-
lastLineNumber = line.newLine ?? null;
|
|
154
|
-
break;
|
|
155
|
-
case "del":
|
|
156
|
-
gutterNumStr = (line.oldLine ?? "").toString();
|
|
157
|
-
backgroundColor = "redBright"; // Light red for deletions
|
|
158
|
-
prefixSymbol = "-";
|
|
159
|
-
// For deletions, update lastLineNumber based on oldLine if it's advancing.
|
|
160
|
-
// This helps manage gaps correctly if there are multiple consecutive deletions
|
|
161
|
-
// or if a deletion is followed by a context line far away in the original file.
|
|
162
|
-
if (line.oldLine !== undefined) {
|
|
163
|
-
lastLineNumber = line.oldLine;
|
|
164
|
-
}
|
|
165
|
-
break;
|
|
166
|
-
case "context":
|
|
167
|
-
gutterNumStr = (line.newLine ?? "").toString();
|
|
168
|
-
dim = true;
|
|
169
|
-
prefixSymbol = " ";
|
|
170
|
-
lastLineNumber = line.newLine ?? null;
|
|
171
|
-
break;
|
|
172
|
-
default:
|
|
173
|
-
return acc;
|
|
174
|
-
}
|
|
175
|
-
const displayContent = line.content.substring(baseIndentation);
|
|
176
|
-
acc.push(_jsxs(Box, { flexDirection: "row", children: [_jsx(Text, { color: Colors.Gray, dimColor: dim, children: gutterNumStr.padEnd(4) }), _jsxs(Text, { color: backgroundColor ? "#000000" : undefined, backgroundColor: backgroundColor, dimColor: !backgroundColor && dim, children: [prefixSymbol, " "] }), _jsx(Text, { color: backgroundColor ? "#000000" : undefined, backgroundColor: backgroundColor, dimColor: !backgroundColor && dim, wrap: "wrap", children: displayContent })] }, lineKey));
|
|
177
|
-
return acc;
|
|
178
|
-
}, []) }, key));
|
|
179
|
-
};
|
|
180
|
-
const getLanguageFromExtension = (extension) => {
|
|
181
|
-
const languageMap = {
|
|
182
|
-
js: "javascript",
|
|
183
|
-
ts: "typescript",
|
|
184
|
-
py: "python",
|
|
185
|
-
json: "json",
|
|
186
|
-
css: "css",
|
|
187
|
-
html: "html",
|
|
188
|
-
sh: "bash",
|
|
189
|
-
md: "markdown",
|
|
190
|
-
yaml: "yaml",
|
|
191
|
-
yml: "yaml",
|
|
192
|
-
txt: "plaintext",
|
|
193
|
-
java: "java",
|
|
194
|
-
c: "c",
|
|
195
|
-
cpp: "cpp",
|
|
196
|
-
rb: "ruby",
|
|
197
|
-
};
|
|
198
|
-
return languageMap[extension] || null; // Return null if extension not found
|
|
199
|
-
};
|
|
200
|
-
//# sourceMappingURL=diff-renderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diff-renderer.js","sourceRoot":"","sources":["../../../src/ui/components/diff-renderer.tsx"],"names":[],"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
|
|
|
1
|
-
interface LoadingSpinnerProps {
|
|
2
|
-
isActive: boolean;
|
|
3
|
-
processingTime: number;
|
|
4
|
-
tokenCount: number;
|
|
5
|
-
}
|
|
6
|
-
export declare function LoadingSpinner({ isActive, processingTime, tokenCount, }: LoadingSpinnerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
-
export {};
|