@theokit/sdk-tools 0.27.4-next.1 → 0.27.5
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 +26 -0
- package/dist/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.27.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#664](https://github.com/usetheokit/theokit-sdk/pull/664) [`d18d0d8`](https://github.com/usetheokit/theokit-sdk/commit/d18d0d8237ee26315b6693947bd2a476a1e004b0) Thanks [@usetheodev](https://github.com/usetheodev)! - A V4A patch opening with `*** Begin Patch ***` now gets an error that names the near miss.
|
|
8
|
+
|
|
9
|
+
The message was `Invalid patch: missing '*** Begin Patch'`. That is true about the exact match and
|
|
10
|
+
misleading about the text on screen: the symmetric form CONTAINS the string it says is missing, so a
|
|
11
|
+
writer greps for an absent line while the defect is three characters at the end of a line already
|
|
12
|
+
there.
|
|
13
|
+
|
|
14
|
+
Measured on a live run: a model wrote the symmetric form by analogy with the `*** Add File: …`
|
|
15
|
+
headers this format also uses, spent three attempts against the old message, and abandoned the step.
|
|
16
|
+
The analogy is the reason the mistake is common — every other marker in V4A carries a trailing
|
|
17
|
+
token, and this one does not.
|
|
18
|
+
|
|
19
|
+
The variant is **not** accepted. V4A is parsed by other tools, and widening it here would make a
|
|
20
|
+
patch this runtime writes unreadable elsewhere. The error teaches the exact spelling instead: it
|
|
21
|
+
quotes the offending line back and says which part to drop.
|
|
22
|
+
|
|
23
|
+
Detection is a near-miss test — a line that starts with the marker and is not equal to it — so it
|
|
24
|
+
also covers `*** Begin Patch v2` and any other trailing suffix, not the one spelling that prompted
|
|
25
|
+
it. A patch with no marker at all keeps the original message.
|
|
26
|
+
|
|
27
|
+
## 0.27.4
|
|
28
|
+
|
|
3
29
|
## 0.27.4-next.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -33,11 +33,19 @@ var V4APatchError = class extends Error {
|
|
|
33
33
|
this.name = "V4APatchError";
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
+
function missingBeginMessage(lines) {
|
|
37
|
+
const nearMiss = lines.find((l) => {
|
|
38
|
+
const t = l.trim();
|
|
39
|
+
return t !== BEGIN && t.startsWith(BEGIN);
|
|
40
|
+
});
|
|
41
|
+
if (nearMiss === void 0) return `Invalid patch: missing '${BEGIN}'`;
|
|
42
|
+
return `Invalid patch: the opening marker must be exactly '${BEGIN}', and this patch has '${nearMiss.trim()}'. Drop everything after '${BEGIN}' on that line \u2014 the trailing '***' belongs to no marker in this format.`;
|
|
43
|
+
}
|
|
36
44
|
function parseV4A(patch) {
|
|
37
45
|
const lines = patch.split("\n").map((l) => l.endsWith("\r") ? l.slice(0, -1) : l);
|
|
38
46
|
let i = 0;
|
|
39
47
|
while (i < lines.length && lines[i].trim() !== BEGIN) i++;
|
|
40
|
-
if (i >= lines.length) throw new V4APatchError(
|
|
48
|
+
if (i >= lines.length) throw new V4APatchError(missingBeginMessage(lines));
|
|
41
49
|
i++;
|
|
42
50
|
const hunks = [];
|
|
43
51
|
while (i < lines.length) {
|