@gguf/coder 0.3.8 → 0.3.9
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.
|
@@ -112,17 +112,17 @@ async function formatStringReplacePreview(args, result, colors) {
|
|
|
112
112
|
const language = getLanguageFromExtension(ext);
|
|
113
113
|
// In result mode, skip validation since file has already been modified
|
|
114
114
|
if (isResult) {
|
|
115
|
-
const messageContent = (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: themeColors.tool, children: "\u2615\uFE0E string
|
|
115
|
+
const messageContent = (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: themeColors.tool, children: "\u2615\uFE0E replace string" }), _jsxs(Box, { children: [_jsx(Text, { color: themeColors.secondary, children: "Path: " }), _jsx(Text, { color: themeColors.primary, children: path })] }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: _jsx(Text, { color: themeColors.success, children: "\u2713 String replacement completed successfully" }) })] }));
|
|
116
116
|
return _jsx(ToolMessage, { message: messageContent, hideBox: true });
|
|
117
117
|
}
|
|
118
118
|
// Preview mode - validate old_str exists and is unique
|
|
119
119
|
const occurrences = fileContent.split(old_str).length - 1;
|
|
120
120
|
if (occurrences === 0) {
|
|
121
|
-
const errorContent = (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: themeColors.tool, children: "\u2615\uFE0E string
|
|
121
|
+
const errorContent = (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: themeColors.tool, children: "\u2615\uFE0E replace string" }), _jsxs(Box, { children: [_jsx(Text, { color: themeColors.secondary, children: "Path: " }), _jsx(Text, { color: themeColors.primary, children: path })] }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: _jsx(Text, { color: themeColors.error, children: "\u2717 Error: Content not found in file. The file may have changed since you last read it." }) }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { color: themeColors.secondary, children: "Searching for:" }), old_str.split('\n').map((line, i) => (_jsx(Text, { color: themeColors.white, children: line }, i)))] })] }));
|
|
122
122
|
return _jsx(ToolMessage, { message: errorContent, hideBox: true });
|
|
123
123
|
}
|
|
124
124
|
if (occurrences > 1) {
|
|
125
|
-
const errorContent = (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: themeColors.tool, children: "\u2615\uFE0E string
|
|
125
|
+
const errorContent = (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: themeColors.tool, children: "\u2615\uFE0E replace string" }), _jsxs(Box, { children: [_jsx(Text, { color: themeColors.secondary, children: "Path: " }), _jsx(Text, { color: themeColors.primary, children: path })] }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Text, { color: themeColors.error, children: ["\u2717 Error: Found ", occurrences, " matches"] }), _jsx(Text, { color: themeColors.secondary, children: "Add more surrounding context to make the match unique." })] }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { color: themeColors.secondary, children: "Searching for:" }), old_str.split('\n').map((line, i) => (_jsx(Text, { color: themeColors.white, children: line }, i)))] })] }));
|
|
126
126
|
return _jsx(ToolMessage, { message: errorContent, hideBox: true });
|
|
127
127
|
}
|
|
128
128
|
// Find location of the match in the file
|
|
@@ -229,7 +229,7 @@ async function formatStringReplacePreview(args, result, colors) {
|
|
|
229
229
|
const rangeDesc = startLine === endLine
|
|
230
230
|
? `line ${startLine}`
|
|
231
231
|
: `lines ${startLine}-${endLine}`;
|
|
232
|
-
const messageContent = (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: themeColors.tool, children: "\u2615\uFE0E string
|
|
232
|
+
const messageContent = (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: themeColors.tool, children: "\u2615\uFE0E replace string" }), _jsxs(Box, { children: [_jsx(Text, { color: themeColors.secondary, children: "Path: " }), _jsx(Text, { color: themeColors.primary, children: path })] }), _jsxs(Box, { children: [_jsx(Text, { color: themeColors.secondary, children: "Location: " }), _jsx(Text, { color: themeColors.white, children: rangeDesc })] }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Text, { color: themeColors.success, children: [isResult ? '✓ Replace completed' : '✓ Replacing', ' ', oldStrLines.length, " line", oldStrLines.length > 1 ? 's' : '', " with", ' ', newStrLines.length, " line", newStrLines.length > 1 ? 's' : ''] }), _jsxs(Box, { flexDirection: "column", children: [contextBefore, removedLines, addedLines, contextAfter] })] })] }));
|
|
233
233
|
return _jsx(ToolMessage, { message: messageContent, hideBox: true });
|
|
234
234
|
}
|
|
235
235
|
catch (error) {
|