From 236f19fdb7da2820657b726362b2baa46ec39ee2 Mon Sep 17 00:00:00 2001 From: Ricardo Viera Date: Mon, 8 Dec 2025 16:16:33 -0700 Subject: [PATCH] feat: auto-wrap variables.json content in Variables object - Allow customers to use flat variables.json files without Variables wrapper - CLI automatically wraps raw variables in {Variables: ...} structure - Update help text to clarify new flat JSON format support - Maintains backward compatibility with existing variable files - Improves UX by accepting customer's existing variables.json files directly --- messages/orchestrator.rules.eval.md | 2 +- src/commands/orchestrator/rules/eval.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/messages/orchestrator.rules.eval.md b/messages/orchestrator.rules.eval.md index 907e77e..53853e9 100644 --- a/messages/orchestrator.rules.eval.md +++ b/messages/orchestrator.rules.eval.md @@ -36,7 +36,7 @@ Path to Analytics variables.json file. # flags.variables.description -Path to the variables.json file containing variable definitions used in transformations. +Path to the variables.json file containing variable definitions used in transformations. The file should contain a flat JSON object with key-value pairs. The CLI will automatically wrap these in the required Variables structure. # flags.rules.summary diff --git a/src/commands/orchestrator/rules/eval.ts b/src/commands/orchestrator/rules/eval.ts index 32a1da9..94abe2d 100644 --- a/src/commands/orchestrator/rules/eval.ts +++ b/src/commands/orchestrator/rules/eval.ts @@ -183,7 +183,9 @@ export default class TemplateEval extends SfCommand { // Read variables file this.log(`Loading variables: ${variablesFile}`); const variablesContent = await fs.readFile(variablesFile, 'utf8'); - const values = JSON.parse(variablesContent) as { Variables: Record }; + const variablesData = JSON.parse(variablesContent) as Record; + + const values = { Variables: variablesData }; // Read rules file this.log(`Loading rules: ${rulesFile}`);