dsh-mnemon-source-runtime 0.5.6 → 0.5.8
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/lib/index.js +9 -3
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -50,7 +50,8 @@ function resolveGitBranch(cwd) {
|
|
|
50
50
|
"ignore",
|
|
51
51
|
"pipe",
|
|
52
52
|
"ignore"
|
|
53
|
-
]
|
|
53
|
+
],
|
|
54
|
+
windowsHide: true
|
|
54
55
|
}).trim();
|
|
55
56
|
return branch === "" ? void 0 : branch;
|
|
56
57
|
} catch {
|
|
@@ -207,7 +208,9 @@ function prepareMutation(before, request, now) {
|
|
|
207
208
|
};
|
|
208
209
|
}
|
|
209
210
|
const oldText = normalizeContent(request.oldText, "oldText");
|
|
210
|
-
const
|
|
211
|
+
const substringMatches = entries.map((entry, index) => entry.target === request.target && entry.content.includes(oldText) ? index : -1).filter((index) => index >= 0);
|
|
212
|
+
const exactMatches = substringMatches.filter((index) => entries[index].content === oldText);
|
|
213
|
+
const matches = exactMatches.length > 0 ? exactMatches : substringMatches;
|
|
211
214
|
if (matches.length === 0) throw new Error(`No ${request.target} entry contains ${JSON.stringify(oldText)}.`);
|
|
212
215
|
if (matches.length > 1) throw new Error(`Multiple ${request.target} entries contain ${JSON.stringify(oldText)}; use a unique substring.`);
|
|
213
216
|
const index = matches[0];
|
|
@@ -732,7 +735,10 @@ function createRuntimeMemorySource(config = {}) {
|
|
|
732
735
|
enum: ["memory", "user"]
|
|
733
736
|
},
|
|
734
737
|
content: { type: "string" },
|
|
735
|
-
oldText: {
|
|
738
|
+
oldText: {
|
|
739
|
+
type: "string",
|
|
740
|
+
description: "Full content of the existing entry, or a unique substring. A unique full-content match takes precedence within the selected target. Required for replace and remove."
|
|
741
|
+
},
|
|
736
742
|
importance: {
|
|
737
743
|
type: "string",
|
|
738
744
|
enum: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon-source-runtime",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "Self-contained runtime Source for Composable View Memory.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@types/node": "^22.0.0",
|
|
62
62
|
"@types/react": "^18.3.0",
|
|
63
63
|
"@types/react-dom": "^18.3.0",
|
|
64
|
-
"dsh-mnemon": "^0.5.
|
|
64
|
+
"dsh-mnemon": "^0.5.11",
|
|
65
65
|
"jsdom": "^26.0.0",
|
|
66
66
|
"react": "^18.2.0",
|
|
67
67
|
"react-dom": "^18.2.0",
|