dsh-better-edit 0.8.0 → 0.8.1
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/CHANGELOG.md +14 -4
- package/lib/fs-bridge.js +40 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
|
+
## [0.8.1](https://github.com/Rianico/dsh-better-edit/compare/v0.8.0...v0.8.1) (2026-09-11)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **str-replace:** record real fs version so view/read authorizes str_replace/insert ([#70](https://github.com/Rianico/dsh-better-edit/issues/70)) ([06b76ff](https://github.com/Rianico/dsh-better-edit/commit/06b76ffec4c0393f790d2195c06910328b611059))
|
|
6
|
+
|
|
7
|
+
### Documentation
|
|
8
|
+
|
|
9
|
+
* add PR template and document PR requirements via git scaffolding ([#68](https://github.com/Rianico/dsh-better-edit/issues/68)) ([b341fbc](https://github.com/Rianico/dsh-better-edit/commit/b341fbc778868496bdee2e49801c5cf3745d1c99))
|
|
10
|
+
|
|
1
11
|
## [0.8.0](https://github.com/Rianico/dsh-better-edit/compare/v0.7.1...v0.8.0) (2026-09-09)
|
|
2
12
|
|
|
3
13
|
### Features
|
|
4
14
|
|
|
5
|
-
|
|
6
|
-
|
|
15
|
+
- **edit:** accept object-form edits entries ({remove_from, remove_to, replacement_text}), closes [#64](https://github.com/Rianico/dsh-better-edit/issues/64) ([#66](https://github.com/Rianico/dsh-better-edit/issues/66)) ([a14ef4c](https://github.com/Rianico/dsh-better-edit/commit/a14ef4cee1c4d8126f40516624b6811d57041bf8))
|
|
16
|
+
- **str-replace:** add governed editor shadow ([#67](https://github.com/Rianico/dsh-better-edit/issues/67)) ([a015629](https://github.com/Rianico/dsh-better-edit/commit/a0156296ce615069f10acf60e3d96c4dc3fa9e14))
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
|
9
19
|
|
|
10
|
-
|
|
20
|
+
- **script:** correct repo inference and headless dispatch for gh-release ([b517646](https://github.com/Rianico/dsh-better-edit/commit/b5176465f8363ff80bb48e96cdfa86e6254f2ebf)), closes [#51](https://github.com/Rianico/dsh-better-edit/issues/51)
|
|
11
21
|
|
|
12
22
|
### Documentation
|
|
13
23
|
|
|
14
|
-
|
|
24
|
+
- **agents:** sync AGENTS.md — remove tag-first releasing, fix git guide and upstream cursor ([d1088d1](https://github.com/Rianico/dsh-better-edit/commit/d1088d1f43f151f80f204fc5189268a5945066f8))
|
|
15
25
|
|
|
16
26
|
## [0.7.1](https://github.com/Rianico/dsh-better-edit/compare/v0.7.0...v0.7.1) (2026-09-06)
|
|
17
27
|
|
package/lib/fs-bridge.js
CHANGED
|
@@ -79,11 +79,16 @@ const UTF8_BOM_LEN = UTF8_BOM_BYTES.length;
|
|
|
79
79
|
* https://github.com/Rianico/dsh-better-edit/issues/23
|
|
80
80
|
*/
|
|
81
81
|
async function restoreStrippedUtf8Bom(fs, target, text, signal) {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
// BOM already preserved: one metadata stat for the read-first gate version
|
|
83
|
+
// (issue #69). No byte probe here — readBytes stays forbidden in this branch.
|
|
84
|
+
if (text.startsWith(UTF8_BOM)) {
|
|
85
|
+
const info = await fs.stat(target, signal).catch(() => undefined);
|
|
86
|
+
return { text, version: info?.version };
|
|
87
|
+
}
|
|
84
88
|
const info = await fs.stat(target, signal);
|
|
89
|
+
const version = info?.version;
|
|
85
90
|
if (info?.size === undefined || info.size !== Buffer.byteLength(text, "utf-8") + UTF8_BOM_LEN) {
|
|
86
|
-
return text;
|
|
91
|
+
return { text, version };
|
|
87
92
|
}
|
|
88
93
|
const bytes = await fs.readBytes(target, signal, info.size);
|
|
89
94
|
const encodedText = Buffer.from(text, "utf-8");
|
|
@@ -91,13 +96,13 @@ async function restoreStrippedUtf8Bom(fs, target, text, signal) {
|
|
|
91
96
|
bytes[0] !== UTF8_BOM_BYTES[0] ||
|
|
92
97
|
bytes[1] !== UTF8_BOM_BYTES[1] ||
|
|
93
98
|
bytes[2] !== UTF8_BOM_BYTES[2]) {
|
|
94
|
-
return text;
|
|
99
|
+
return { text, version };
|
|
95
100
|
}
|
|
96
101
|
for (let i = 0; i < encodedText.length; i += 1) {
|
|
97
102
|
if (bytes[i + UTF8_BOM_LEN] !== encodedText[i])
|
|
98
|
-
return text;
|
|
103
|
+
return { text, version };
|
|
99
104
|
}
|
|
100
|
-
return `${UTF8_BOM}${text}
|
|
105
|
+
return { text: `${UTF8_BOM}${text}`, version };
|
|
101
106
|
}
|
|
102
107
|
/** FileIO over the deployment's `ctx.fs` service. */
|
|
103
108
|
export function ctxFsIO(fs, ctx) {
|
|
@@ -125,8 +130,16 @@ export function ctxFsIO(fs, ctx) {
|
|
|
125
130
|
});
|
|
126
131
|
const targetKey = String(target.targetKey ?? absolutePath);
|
|
127
132
|
recordOpenState(targetKey, decoded.text, decoded.encoding, decoded.hasBOM, info?.version);
|
|
128
|
-
|
|
133
|
+
// Gate looks up by resolved absolutePath; targetKey may differ
|
|
134
|
+
// (symlink/case) — mirror under both keys (issue #69 note).
|
|
135
|
+
if (targetKey !== absolutePath) {
|
|
136
|
+
recordOpenState(absolutePath, decoded.text, decoded.encoding, decoded.hasBOM, info?.version);
|
|
137
|
+
}
|
|
138
|
+
if (decoded.footer) {
|
|
129
139
|
recordFooter(targetKey, decoded.footer);
|
|
140
|
+
if (targetKey !== absolutePath)
|
|
141
|
+
recordFooter(absolutePath, decoded.footer);
|
|
142
|
+
}
|
|
130
143
|
return decoded.text;
|
|
131
144
|
}
|
|
132
145
|
try {
|
|
@@ -134,19 +147,24 @@ export function ctxFsIO(fs, ctx) {
|
|
|
134
147
|
...(signal === undefined ? {} : { signal }),
|
|
135
148
|
});
|
|
136
149
|
const text = await fs.readText(target, signal);
|
|
137
|
-
|
|
150
|
+
// Thread the restore path's stat version into the encoding memo so the
|
|
151
|
+
// read-first gate validates against the real version (issue #69 fix 2).
|
|
152
|
+
// The BOM-preserved branch stats for version only — no byte probe.
|
|
153
|
+
const { text: restored, version } = await restoreStrippedUtf8Bom(fs, target, text, signal);
|
|
138
154
|
// record file encoding state for round-trip (BOM + lineEnding)
|
|
139
|
-
// Do not probe fs.stat when BOM is already preserved — keep the no-probe guarantee
|
|
140
|
-
// tested in fs-bridge.policy.test.ts (keeps a BOM already preserved without probing)
|
|
141
155
|
try {
|
|
142
156
|
const targetKey = String(target.targetKey ?? absolutePath);
|
|
143
157
|
const hasBOM = restored.startsWith(UTF8_BOM);
|
|
144
158
|
const clean = hasBOM ? restored.slice(1) : restored;
|
|
145
|
-
// use seam to record with correct lineEnding detection
|
|
146
|
-
|
|
147
|
-
|
|
159
|
+
// use seam to record with correct lineEnding detection
|
|
160
|
+
recordOpenState(targetKey, clean, hasBOM ? "utf8bom" : "utf8", hasBOM, version);
|
|
161
|
+
if (targetKey !== absolutePath) {
|
|
162
|
+
recordOpenState(absolutePath, clean, hasBOM ? "utf8bom" : "utf8", hasBOM, version);
|
|
163
|
+
}
|
|
148
164
|
// clear any stale autoGuess footer on clean UTF-8 read
|
|
149
165
|
_clearAutoGuessFooter(targetKey);
|
|
166
|
+
if (targetKey !== absolutePath)
|
|
167
|
+
_clearAutoGuessFooter(absolutePath);
|
|
150
168
|
}
|
|
151
169
|
catch {
|
|
152
170
|
// best-effort
|
|
@@ -169,8 +187,14 @@ export function ctxFsIO(fs, ctx) {
|
|
|
169
187
|
// Delegate deterministic admission to the deep seam
|
|
170
188
|
const decoded = await decodeForOpen(bytes, cfg, { displayPath: absolutePath });
|
|
171
189
|
recordOpenState(targetKey, decoded.text, decoded.encoding, decoded.hasBOM, info?.version);
|
|
172
|
-
if (
|
|
190
|
+
if (targetKey !== absolutePath) {
|
|
191
|
+
recordOpenState(absolutePath, decoded.text, decoded.encoding, decoded.hasBOM, info?.version);
|
|
192
|
+
}
|
|
193
|
+
if (decoded.footer) {
|
|
173
194
|
recordFooter(targetKey, decoded.footer);
|
|
195
|
+
if (targetKey !== absolutePath)
|
|
196
|
+
recordFooter(absolutePath, decoded.footer);
|
|
197
|
+
}
|
|
174
198
|
return decoded.text;
|
|
175
199
|
}
|
|
176
200
|
return mapFsError(error, absolutePath);
|
|
@@ -185,6 +209,8 @@ export function ctxFsIO(fs, ctx) {
|
|
|
185
209
|
const key = String(targetTmp.targetKey ?? absolutePath);
|
|
186
210
|
const info = await fs.stat(targetTmp, signal).catch(() => undefined);
|
|
187
211
|
invalidateIfStale(key, info?.version);
|
|
212
|
+
if (key !== absolutePath)
|
|
213
|
+
invalidateIfStale(absolutePath, info?.version);
|
|
188
214
|
}
|
|
189
215
|
catch { } // biome-ignore: best-effort
|
|
190
216
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-better-edit",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Hash-anchored read/edit/undo_last_edit tools for DeepSeek Harness (dsh). Every line gets a unique 3-char hash (A-Za-z0-9) that stays stable across edits; stale or ambiguous anchors are rejected, never fuzzy-matched. Undo persists across restarts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anchors",
|