@vibe-agent-toolkit/utils 0.1.39-rc.9 → 0.1.39
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/fs/file-hash.d.ts +17 -0
- package/dist/fs/file-hash.d.ts.map +1 -0
- package/dist/fs/file-hash.js +23 -0
- package/dist/fs/file-hash.js.map +1 -0
- package/dist/glob/glob-pattern.d.ts +65 -0
- package/dist/glob/glob-pattern.d.ts.map +1 -0
- package/dist/glob/glob-pattern.js +133 -0
- package/dist/glob/glob-pattern.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/link-auth/resolve-token.d.ts +7 -1
- package/dist/link-auth/resolve-token.d.ts.map +1 -1
- package/dist/link-auth/resolve-token.js +8 -3
- package/dist/link-auth/resolve-token.js.map +1 -1
- package/dist/link-auth/resolve.d.ts +44 -0
- package/dist/link-auth/resolve.d.ts.map +1 -1
- package/dist/link-auth/resolve.js +12 -1
- package/dist/link-auth/resolve.js.map +1 -1
- package/dist/path-utils.d.ts +30 -0
- package/dist/path-utils.d.ts.map +1 -1
- package/dist/path-utils.js +34 -0
- package/dist/path-utils.js.map +1 -1
- package/dist/skill-test/env-scrub.d.ts +58 -0
- package/dist/skill-test/env-scrub.d.ts.map +1 -1
- package/dist/skill-test/env-scrub.js +148 -2
- package/dist/skill-test/env-scrub.js.map +1 -1
- package/dist/skill-test/index.d.ts +1 -1
- package/dist/skill-test/index.d.ts.map +1 -1
- package/dist/skill-test/index.js +1 -1
- package/dist/skill-test/index.js.map +1 -1
- package/dist/skill-test/spawn-claude.d.ts +34 -9
- package/dist/skill-test/spawn-claude.d.ts.map +1 -1
- package/dist/skill-test/spawn-claude.js +60 -14
- package/dist/skill-test/spawn-claude.js.map +1 -1
- package/dist/yaml/surgical-yaml.d.ts +71 -0
- package/dist/yaml/surgical-yaml.d.ts.map +1 -0
- package/dist/yaml/surgical-yaml.js +314 -0
- package/dist/yaml/surgical-yaml.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Byte-surgical YAML value updater.
|
|
3
|
+
*
|
|
4
|
+
* The motivating problem: editing one value in an adopter's config file with the
|
|
5
|
+
* naive `doc.setIn(...); doc.toString()` round-trip reflows the ENTIRE document —
|
|
6
|
+
* collapsing flow sequences, re-wrapping long scalars, shifting comment alignment,
|
|
7
|
+
* normalising quote styles. That destroys hand-authored formatting the user never
|
|
8
|
+
* asked us to touch.
|
|
9
|
+
*
|
|
10
|
+
* This module instead changes the **minimum bytes possible**:
|
|
11
|
+
*
|
|
12
|
+
* - **Replace** an existing scalar: locate its source byte range via the parsed
|
|
13
|
+
* node and splice the new serialized token in place. Every other byte is
|
|
14
|
+
* identical.
|
|
15
|
+
* - **Insert** a new key: render ONLY the new nested fragment, indent it to the
|
|
16
|
+
* target map's child column, and splice it in after the map's last item. The
|
|
17
|
+
* rest of the document is never re-rendered.
|
|
18
|
+
*
|
|
19
|
+
* `verifyConfinedYamlEdit` is the double-checker: it re-parses before/after and
|
|
20
|
+
* asserts the edit landed, no other leaf value drifted, and no comment was lost.
|
|
21
|
+
* `updateYamlIn` calls it internally as a defensive post-condition.
|
|
22
|
+
*
|
|
23
|
+
* No filesystem access — these are pure string transforms.
|
|
24
|
+
*/
|
|
25
|
+
import { Document, isCollection, isMap, isScalar, parseDocument, visit, } from 'yaml';
|
|
26
|
+
/** yaml's `toString` options — `lineWidth: 0` disables line-wrapping/folding. */
|
|
27
|
+
const NO_WRAP = { lineWidth: 0 };
|
|
28
|
+
/**
|
|
29
|
+
* Upsert a single scalar at `path` in `text`, changing the minimum bytes possible.
|
|
30
|
+
*
|
|
31
|
+
* - If `path` already resolves to a scalar, its source token is replaced in place
|
|
32
|
+
* (byte-identical output except the one value, including surrounding comments,
|
|
33
|
+
* alignment whitespace, flow-collection padding, and sibling formatting).
|
|
34
|
+
* - If `path` does not yet exist, a new nested fragment is rendered and spliced
|
|
35
|
+
* into the deepest existing ancestor map at the correct child indentation —
|
|
36
|
+
* without re-rendering (and thus reflowing) the rest of the document.
|
|
37
|
+
*
|
|
38
|
+
* The input's EOL style (`\n` vs `\r\n`) is detected and preserved.
|
|
39
|
+
*
|
|
40
|
+
* @param text - The full YAML source document.
|
|
41
|
+
* @param path - Key/index path to the scalar to set.
|
|
42
|
+
* @param value - The scalar value to write (string, number, boolean, or null).
|
|
43
|
+
* @returns The updated document text.
|
|
44
|
+
* @throws If `text` is not valid YAML, if `path` is empty, or if `path` resolves
|
|
45
|
+
* to a collection that would be clobbered by a scalar (or an intermediate
|
|
46
|
+
* ancestor is a scalar that cannot hold a child).
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* updateYamlIn('model: haiku # note\n', ['model'], 'opus')
|
|
50
|
+
* // => 'model: opus # note\n' (alignment + comment preserved)
|
|
51
|
+
*/
|
|
52
|
+
export function updateYamlIn(text, path, value) {
|
|
53
|
+
if (path.length === 0) {
|
|
54
|
+
throw new Error('updateYamlIn: path must have at least one segment');
|
|
55
|
+
}
|
|
56
|
+
const eol = detectEol(text);
|
|
57
|
+
const doc = parseDocument(text, { prettyErrors: true });
|
|
58
|
+
if (doc.errors.length > 0) {
|
|
59
|
+
throw new Error(`updateYamlIn: input is not valid YAML: ${doc.errors[0]?.message ?? 'unknown'}`);
|
|
60
|
+
}
|
|
61
|
+
const existing = doc.getIn(path, true);
|
|
62
|
+
let result;
|
|
63
|
+
if (isScalar(existing)) {
|
|
64
|
+
result = replaceScalarToken(text, existing.range, value, eol);
|
|
65
|
+
}
|
|
66
|
+
else if (isCollection(existing)) {
|
|
67
|
+
throw new Error(`updateYamlIn: refusing to overwrite the collection at [${path.join(', ')}] with a scalar`);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
result = insertNewKey(text, doc, path, value, eol);
|
|
71
|
+
}
|
|
72
|
+
// Defensive post-condition: prove the edit was actually confined.
|
|
73
|
+
verifyConfinedYamlEdit(text, result, [path]);
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Re-parse `before` and `after` and assert the edit was correct and confined:
|
|
78
|
+
*
|
|
79
|
+
* 1. **Correctness** — every entry in `changedPaths` resolves in `after`.
|
|
80
|
+
* 2. **Confinement** — every other leaf path present in `before` has a deep-equal
|
|
81
|
+
* value in `after` (no collateral value edits).
|
|
82
|
+
* 3. **Comment preservation** — the multiset of all comment strings is unchanged.
|
|
83
|
+
*
|
|
84
|
+
* Safe to call as an internal assertion from {@link updateYamlIn}.
|
|
85
|
+
*
|
|
86
|
+
* @param before - The original document text.
|
|
87
|
+
* @param after - The edited document text.
|
|
88
|
+
* @param changedPaths - The paths the caller intended to change.
|
|
89
|
+
* @throws A descriptive `Error` naming the offending path or lost comment on any
|
|
90
|
+
* violation.
|
|
91
|
+
*/
|
|
92
|
+
export function verifyConfinedYamlEdit(before, after, changedPaths) {
|
|
93
|
+
const beforeDoc = parseDocument(before, { prettyErrors: true });
|
|
94
|
+
const afterDoc = parseDocument(after, { prettyErrors: true });
|
|
95
|
+
if (afterDoc.errors.length > 0) {
|
|
96
|
+
throw new Error(`verifyConfinedYamlEdit: 'after' is not valid YAML: ${afterDoc.errors[0]?.message ?? 'unknown'}`);
|
|
97
|
+
}
|
|
98
|
+
assertChangedPathsLanded(afterDoc, changedPaths);
|
|
99
|
+
assertConfinement(beforeDoc, afterDoc, changedPaths);
|
|
100
|
+
assertCommentsPreserved(beforeDoc, afterDoc);
|
|
101
|
+
}
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
// Replace path
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
/** Splice a freshly serialized scalar token over the source range `[start, valueEnd]`. */
|
|
106
|
+
function replaceScalarToken(text, range, value, eol) {
|
|
107
|
+
if (range == null) {
|
|
108
|
+
throw new Error('updateYamlIn: target scalar has no source range (cannot locate it to replace)');
|
|
109
|
+
}
|
|
110
|
+
const [start, valueEnd] = range;
|
|
111
|
+
return text.slice(0, start) + serializeScalar(value, eol) + text.slice(valueEnd);
|
|
112
|
+
}
|
|
113
|
+
/** Render a value as a single bare YAML token (no key, no trailing newline). */
|
|
114
|
+
function serializeScalar(value, eol) {
|
|
115
|
+
const token = new Document(value).toString(NO_WRAP).trimEnd();
|
|
116
|
+
return applyEol(token, eol);
|
|
117
|
+
}
|
|
118
|
+
// ---------------------------------------------------------------------------
|
|
119
|
+
// Insert path
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
/** Insert a not-yet-existing key by rendering only the new nested fragment. */
|
|
122
|
+
function insertNewKey(text, doc, path, value, eol) {
|
|
123
|
+
const target = findInsertionTarget(doc, path);
|
|
124
|
+
if (target.map === null) {
|
|
125
|
+
// Root is empty (or document had no content) — nothing to preserve, so a
|
|
126
|
+
// plain render of the whole nested object is acceptable.
|
|
127
|
+
return applyEol(new Document(buildNested(path, value)).toString(NO_WRAP), eol);
|
|
128
|
+
}
|
|
129
|
+
return spliceFragmentIntoMap(text, target.map, target.remaining, value, eol);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Walk `path` from deepest to shallowest to find the deepest existing ancestor
|
|
133
|
+
* map and the remaining (not-yet-existing) key chain to create under it.
|
|
134
|
+
*/
|
|
135
|
+
function findInsertionTarget(doc, path) {
|
|
136
|
+
for (let i = path.length - 1; i >= 0; i--) {
|
|
137
|
+
const prefix = path.slice(0, i);
|
|
138
|
+
const node = prefix.length === 0 ? doc.contents : doc.getIn(prefix, true);
|
|
139
|
+
if (node === null || node === undefined) {
|
|
140
|
+
continue; // This ancestor does not exist yet — try a shallower one.
|
|
141
|
+
}
|
|
142
|
+
if (isMap(node)) {
|
|
143
|
+
return { map: node, remaining: path.slice(i) };
|
|
144
|
+
}
|
|
145
|
+
throw new Error(`updateYamlIn: cannot insert at [${path.join(', ')}] — ancestor [${prefix.join(', ')}] is not a map`);
|
|
146
|
+
}
|
|
147
|
+
return { map: null, remaining: path };
|
|
148
|
+
}
|
|
149
|
+
/** Build a right-nested plain object from a key chain and a leaf value. */
|
|
150
|
+
function buildNested(keys, value) {
|
|
151
|
+
let acc = value;
|
|
152
|
+
for (let i = keys.length - 1; i >= 0; i--) {
|
|
153
|
+
acc = { [String(keys[i])]: acc };
|
|
154
|
+
}
|
|
155
|
+
return acc;
|
|
156
|
+
}
|
|
157
|
+
/** Render the new fragment, indent it to the map's child column, and splice it in. */
|
|
158
|
+
function spliceFragmentIntoMap(text, map, remaining, value, eol) {
|
|
159
|
+
const indent = childIndentOf(text, map);
|
|
160
|
+
const rendered = new Document(buildNested(remaining, value)).toString(NO_WRAP).replace(/\n$/, '');
|
|
161
|
+
const indented = rendered
|
|
162
|
+
.split('\n')
|
|
163
|
+
.map((line) => (line.length > 0 ? indent + line : line))
|
|
164
|
+
.join(eol);
|
|
165
|
+
const insertAt = insertionOffset(map);
|
|
166
|
+
const needsLeadingEol = insertAt > 0 && text[insertAt - 1] !== '\n';
|
|
167
|
+
const piece = (needsLeadingEol ? eol : '') + indented + eol;
|
|
168
|
+
return text.slice(0, insertAt) + piece + text.slice(insertAt);
|
|
169
|
+
}
|
|
170
|
+
/** The leading whitespace string for `map`'s children, derived from its first item's key. */
|
|
171
|
+
function childIndentOf(text, map) {
|
|
172
|
+
const firstKey = map.items[0]?.key;
|
|
173
|
+
const keyRange = firstKey?.range;
|
|
174
|
+
if (!keyRange) {
|
|
175
|
+
throw new Error('updateYamlIn: cannot determine child indentation for an empty map (insert target has no existing items)');
|
|
176
|
+
}
|
|
177
|
+
return ' '.repeat(columnAt(text, keyRange[0]));
|
|
178
|
+
}
|
|
179
|
+
/** Byte offset to splice a new item at: the end of the map's content. */
|
|
180
|
+
function insertionOffset(map) {
|
|
181
|
+
if (map.range == null) {
|
|
182
|
+
throw new Error('updateYamlIn: insertion target map has no source range');
|
|
183
|
+
}
|
|
184
|
+
return map.range[1];
|
|
185
|
+
}
|
|
186
|
+
// ---------------------------------------------------------------------------
|
|
187
|
+
// verifyConfinedYamlEdit helpers
|
|
188
|
+
// ---------------------------------------------------------------------------
|
|
189
|
+
function assertChangedPathsLanded(afterDoc, changedPaths) {
|
|
190
|
+
for (const path of changedPaths) {
|
|
191
|
+
if (!afterDoc.hasIn(path)) {
|
|
192
|
+
throw new Error(`verifyConfinedYamlEdit: changed path [${path.join(', ')}] did not land in 'after'`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function assertConfinement(beforeDoc, afterDoc, changedPaths) {
|
|
197
|
+
const changed = new Set(changedPaths.map((p) => JSON.stringify(p)));
|
|
198
|
+
const beforeJs = beforeDoc.toJS() ?? {};
|
|
199
|
+
const afterJs = afterDoc.toJS() ?? {};
|
|
200
|
+
const leaves = [];
|
|
201
|
+
collectLeafPaths(beforeJs, [], leaves);
|
|
202
|
+
for (const leaf of leaves) {
|
|
203
|
+
if (changed.has(JSON.stringify(leaf.path))) {
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
const found = getAtPath(afterJs, leaf.path);
|
|
207
|
+
if (!found.present || !Object.is(found.value, leaf.value)) {
|
|
208
|
+
const actual = found.present ? JSON.stringify(found.value) : '(removed)';
|
|
209
|
+
throw new Error(`verifyConfinedYamlEdit: value at [${leaf.path.join(', ')}] changed from ` +
|
|
210
|
+
`${JSON.stringify(leaf.value)} to ${actual} — edit was not confined`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function assertCommentsPreserved(beforeDoc, afterDoc) {
|
|
215
|
+
const before = collectComments(beforeDoc).sort((a, b) => a.localeCompare(b));
|
|
216
|
+
const after = collectComments(afterDoc).sort((a, b) => a.localeCompare(b));
|
|
217
|
+
if (before.length === after.length && before.every((c, i) => c === after[i])) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const dropped = multisetDifference(before, after);
|
|
221
|
+
const added = multisetDifference(after, before);
|
|
222
|
+
throw new Error(`verifyConfinedYamlEdit: comment set changed — dropped ${JSON.stringify(dropped)}, ` +
|
|
223
|
+
`added ${JSON.stringify(added)}`);
|
|
224
|
+
}
|
|
225
|
+
/** Recursively collect every leaf (primitive/null) path and its value. */
|
|
226
|
+
function collectLeafPaths(node, prefix, out) {
|
|
227
|
+
if (Array.isArray(node)) {
|
|
228
|
+
for (const [index, item] of node.entries()) {
|
|
229
|
+
collectLeafPaths(item, [...prefix, index], out);
|
|
230
|
+
}
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (node !== null && typeof node === 'object') {
|
|
234
|
+
for (const [key, val] of Object.entries(node)) {
|
|
235
|
+
collectLeafPaths(val, [...prefix, key], out);
|
|
236
|
+
}
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
out.push({ path: prefix, value: node });
|
|
240
|
+
}
|
|
241
|
+
/** Walk a plain JS structure by path; report presence to distinguish `undefined` from missing. */
|
|
242
|
+
function getAtPath(root, path) {
|
|
243
|
+
let current = root;
|
|
244
|
+
for (const segment of path) {
|
|
245
|
+
if (current === null || typeof current !== 'object') {
|
|
246
|
+
return { present: false, value: undefined };
|
|
247
|
+
}
|
|
248
|
+
const key = String(segment);
|
|
249
|
+
if (!Object.hasOwn(current, key)) {
|
|
250
|
+
return { present: false, value: undefined };
|
|
251
|
+
}
|
|
252
|
+
current = current[key];
|
|
253
|
+
}
|
|
254
|
+
return { present: true, value: current };
|
|
255
|
+
}
|
|
256
|
+
/** Collect every comment string attached anywhere in the document. */
|
|
257
|
+
function collectComments(doc) {
|
|
258
|
+
const comments = [];
|
|
259
|
+
pushComment(comments, doc.commentBefore);
|
|
260
|
+
pushComment(comments, doc.comment);
|
|
261
|
+
visit(doc, {
|
|
262
|
+
Node(_key, node) {
|
|
263
|
+
pushComment(comments, node.commentBefore);
|
|
264
|
+
pushComment(comments, node.comment);
|
|
265
|
+
},
|
|
266
|
+
Pair(_key, pair) {
|
|
267
|
+
const keyNode = pair.key;
|
|
268
|
+
const valueNode = pair.value;
|
|
269
|
+
pushComment(comments, keyNode?.commentBefore);
|
|
270
|
+
pushComment(comments, valueNode?.comment);
|
|
271
|
+
},
|
|
272
|
+
});
|
|
273
|
+
return comments;
|
|
274
|
+
}
|
|
275
|
+
function pushComment(out, comment) {
|
|
276
|
+
if (comment != null && comment !== '') {
|
|
277
|
+
out.push(comment);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/** Items in `a` that are not balanced by an equal item in `b` (multiset semantics). */
|
|
281
|
+
function multisetDifference(a, b) {
|
|
282
|
+
const remaining = [...b];
|
|
283
|
+
const diff = [];
|
|
284
|
+
for (const item of a) {
|
|
285
|
+
const idx = remaining.indexOf(item);
|
|
286
|
+
if (idx === -1) {
|
|
287
|
+
diff.push(item);
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
remaining.splice(idx, 1);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return diff;
|
|
294
|
+
}
|
|
295
|
+
// ---------------------------------------------------------------------------
|
|
296
|
+
// Shared text helpers
|
|
297
|
+
// ---------------------------------------------------------------------------
|
|
298
|
+
/** Detect the document's EOL convention. Mixed/absent endings default to `\n`. */
|
|
299
|
+
function detectEol(text) {
|
|
300
|
+
return text.includes('\r\n') ? '\r\n' : '\n';
|
|
301
|
+
}
|
|
302
|
+
/** Rewrite `\n` line breaks in `token` to the target EOL (no-op for `\n`). */
|
|
303
|
+
function applyEol(token, eol) {
|
|
304
|
+
return eol === '\n' ? token : token.split('\n').join(eol);
|
|
305
|
+
}
|
|
306
|
+
/** The 0-based column (in characters) of byte `offset` within its line. */
|
|
307
|
+
function columnAt(text, offset) {
|
|
308
|
+
let column = 0;
|
|
309
|
+
for (let i = 0; i < offset; i++) {
|
|
310
|
+
column = text[i] === '\n' ? 0 : column + 1;
|
|
311
|
+
}
|
|
312
|
+
return column;
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=surgical-yaml.js.map
|
|
@@ -0,0 +1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