fluxflow-cli 1.18.2 → 1.18.3
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/fluxflow.js +21 -9
- package/package.json +1 -1
package/dist/fluxflow.js
CHANGED
|
@@ -3230,16 +3230,28 @@ var init_update_file = __esm({
|
|
|
3230
3230
|
const targetPath = parsed.path;
|
|
3231
3231
|
if (!targetPath) return 'ERROR: Missing "path" argument for update_file.';
|
|
3232
3232
|
const patchPairs = [];
|
|
3233
|
-
const
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3233
|
+
const indices = /* @__PURE__ */ new Set();
|
|
3234
|
+
Object.keys(parsed).forEach((key) => {
|
|
3235
|
+
const m = key.match(/^(replaceContent|newContent|content_to_replace|content_to_add)(\d+)?$/);
|
|
3236
|
+
if (m) {
|
|
3237
|
+
const index = m[2] ? parseInt(m[2]) : 1;
|
|
3238
|
+
indices.add(index);
|
|
3239
|
+
}
|
|
3240
|
+
});
|
|
3241
|
+
const sortedIndices = Array.from(indices).sort((a, b) => a - b);
|
|
3242
|
+
for (const i of sortedIndices) {
|
|
3243
|
+
let r, n;
|
|
3244
|
+
if (i === 1) {
|
|
3245
|
+
r = parsed.replaceContent1 ?? (parsed.content_to_replace ?? parsed.replaceContent);
|
|
3246
|
+
n = parsed.newContent1 ?? (parsed.content_to_add ?? parsed.newContent);
|
|
3247
|
+
} else {
|
|
3248
|
+
r = parsed[`replaceContent${i}`] ?? parsed[`content_to_replace${i}`];
|
|
3249
|
+
n = parsed[`newContent${i}`] ?? parsed[`content_to_add${i}`];
|
|
3250
|
+
}
|
|
3251
|
+
if (r !== void 0 && n !== void 0) {
|
|
3242
3252
|
patchPairs.push({ replace: r, new: n });
|
|
3253
|
+
} else if (r !== void 0 || n !== void 0) {
|
|
3254
|
+
return `ERROR: Mismatched replacement pair for index ${i}. Both replacement and new content must be provided.`;
|
|
3243
3255
|
}
|
|
3244
3256
|
}
|
|
3245
3257
|
if (patchPairs.length === 0) {
|