owndesign 0.2.1 → 0.2.2
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/dist/index.js +1 -1
- package/dist/server/index.js +10 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -56843,6 +56843,7 @@ var DESCRIPTION = [
|
|
|
56843
56843
|
"- When editing text from read tool output, preserve the exact indentation after the line number prefix.",
|
|
56844
56844
|
"- The line number prefix format is `<line>: `. Everything after that prefix is the actual file content to match.",
|
|
56845
56845
|
"- Never include any part of the line number prefix in oldString or newString.",
|
|
56846
|
+
"- Provide oldString as the literal file content. Do not add backslash escapes to quotes or backticks (\\\" \\' \\`), even when the text is inside a JavaScript template literal or string.",
|
|
56846
56847
|
"- Prefer editing existing files. Only create new files when the user request explicitly requires it.",
|
|
56847
56848
|
"- Only use emojis if the user explicitly requests them.",
|
|
56848
56849
|
"- The edit will fail if oldString is not found in the file.",
|
|
@@ -57981,6 +57982,12 @@ function applyTextEdit(content, oldText, newText, replaceAll = false, relativePa
|
|
|
57981
57982
|
const normalizedNewText = convertToLineEnding(newText, detectLineEnding(content));
|
|
57982
57983
|
const firstIndex = content.indexOf(normalizedOldText);
|
|
57983
57984
|
if (firstIndex === -1) {
|
|
57985
|
+
const deEscaped = deEscapeQuotes(normalizedOldText);
|
|
57986
|
+
if (deEscaped !== normalizedOldText && content.includes(deEscaped)) {
|
|
57987
|
+
throw new Error(
|
|
57988
|
+
`oldText was not found in Project Workspace file: ${relativePath}. It looks like oldText contains backslash-escaped quotes/backticks (\\" \\' \\\`) that are not in the file. Provide oldText as the literal file content without adding escape characters.`
|
|
57989
|
+
);
|
|
57990
|
+
}
|
|
57984
57991
|
throw new Error(`oldText was not found in Project Workspace file: ${relativePath}`);
|
|
57985
57992
|
}
|
|
57986
57993
|
const replacements = countOccurrences(content, normalizedOldText);
|
|
@@ -57992,6 +57999,9 @@ function applyTextEdit(content, oldText, newText, replaceAll = false, relativePa
|
|
|
57992
57999
|
replacements: replaceAll ? replacements : 1
|
|
57993
58000
|
};
|
|
57994
58001
|
}
|
|
58002
|
+
function deEscapeQuotes(text2) {
|
|
58003
|
+
return text2.replaceAll('\\"', '"').replaceAll("\\'", "'").replaceAll("\\`", "`");
|
|
58004
|
+
}
|
|
57995
58005
|
function detectLineEnding(text2) {
|
|
57996
58006
|
return text2.includes("\r\n") ? "\r\n" : "\n";
|
|
57997
58007
|
}
|