@withone/cli 1.13.8 → 1.13.9
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.
|
@@ -451,6 +451,11 @@ function createSandboxedRequire() {
|
|
|
451
451
|
return cache[clean];
|
|
452
452
|
};
|
|
453
453
|
}
|
|
454
|
+
function stripCodeFences(text) {
|
|
455
|
+
const trimmed = text.trim();
|
|
456
|
+
const match = trimmed.match(/^```(?:\w*)\s*\n([\s\S]*?)\n\s*```\s*$/);
|
|
457
|
+
return match ? match[1].trim() : trimmed;
|
|
458
|
+
}
|
|
454
459
|
async function executeActionStep(step, context, api, permissions, allowedActionIds) {
|
|
455
460
|
const action = step.action;
|
|
456
461
|
const platform = resolveValue(action.platform, context);
|
|
@@ -607,7 +612,7 @@ function executeFileReadStep(step, context) {
|
|
|
607
612
|
const filePath = resolveValue(config.path, context);
|
|
608
613
|
const resolvedPath = path.resolve(filePath);
|
|
609
614
|
const content = fs.readFileSync(resolvedPath, "utf-8");
|
|
610
|
-
const output = config.parseJson ? JSON.parse(content) : content;
|
|
615
|
+
const output = config.parseJson ? JSON.parse(stripCodeFences(content)) : content;
|
|
611
616
|
return { status: "success", output, response: output };
|
|
612
617
|
}
|
|
613
618
|
function executeFileWriteStep(step, context) {
|
|
@@ -662,7 +667,7 @@ async function executeSubflowStep(step, context, api, permissions, allowedAction
|
|
|
662
667
|
if (flowStack.includes(resolvedKey)) {
|
|
663
668
|
throw new Error(`Circular flow detected: ${[...flowStack, resolvedKey].join(" \u2192 ")}`);
|
|
664
669
|
}
|
|
665
|
-
const { loadFlow: loadFlow2 } = await import("./flow-runner-
|
|
670
|
+
const { loadFlow: loadFlow2 } = await import("./flow-runner-Y6GBCOM7.js");
|
|
666
671
|
const subFlow = loadFlow2(resolvedKey);
|
|
667
672
|
const subContext = await executeFlow(
|
|
668
673
|
subFlow,
|
|
@@ -743,7 +748,7 @@ async function executeBashStep(step, context, options) {
|
|
|
743
748
|
env,
|
|
744
749
|
maxBuffer: 10 * 1024 * 1024
|
|
745
750
|
});
|
|
746
|
-
const output = config.parseJson ? JSON.parse(stdout) : stdout.trim();
|
|
751
|
+
const output = config.parseJson ? JSON.parse(stripCodeFences(stdout)) : stdout.trim();
|
|
747
752
|
return {
|
|
748
753
|
status: "success",
|
|
749
754
|
output,
|
package/dist/index.js
CHANGED