flowsh-cli 0.4.0__tar.gz → 0.4.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flowsh-cli
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Generate Bash harness scripts from workflow YAML files.
5
5
  License-Expression: MIT
6
6
  Classifier: Programming Language :: Python :: 3.11
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "flowsh-cli"
7
- version = "0.4.0"
7
+ version = "0.4.1"
8
8
  description = "Generate Bash harness scripts from workflow YAML files."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -3,7 +3,7 @@
3
3
  from flowsh_cli.models import Workflow, WorkflowParseError, parse_workflows
4
4
  from flowsh_cli.render import harness_path, render_harness
5
5
 
6
- __version__ = "0.4.0"
6
+ __version__ = "0.4.1"
7
7
 
8
8
  __all__ = [
9
9
  "Workflow",
@@ -257,16 +257,25 @@ def render_step(index: int, step: Step, used_function_names: set[str] | None = N
257
257
  )
258
258
  elif isinstance(step, AgentStep):
259
259
  delimiter = heredoc_delimiter("PROMPT", step.prompt)
260
- heredoc = f"<<{delimiter}" if step.expandPrompt else f"<<'{delimiter}'"
261
260
  lines.extend(
262
261
  [
263
262
  " local prompt",
264
- f" prompt=$(cat {heredoc}",
263
+ f" prompt=$(cat <<'{delimiter}'",
265
264
  *step.prompt.splitlines(),
266
265
  delimiter,
267
266
  " )",
268
267
  ]
269
268
  )
269
+ if step.expandPrompt:
270
+ braced = re.findall(r"\$\{([A-Z_][A-Z0-9_]*)\}", step.prompt)
271
+ bare = re.findall(r"\$([A-Z_][A-Z0-9_]*)(?!\w)", step.prompt)
272
+ seen: dict[str, None] = {}
273
+ for var in braced + bare:
274
+ seen[var] = None
275
+ for var in seen:
276
+ lines.append(f' _p=\'${{{var}}}\'; prompt="${{prompt//"$_p"/"${var}"}}"')
277
+ lines.append(f' _p=\'${var}\'; prompt="${{prompt//"$_p"/"${var}"}}"')
278
+
270
279
  lines.append(f" local agent={bash_quote(step.agent or '')}")
271
280
  lines.append(f" local model={bash_quote(step.model or '')}")
272
281
  lines.append(f" local command={bash_quote(step.command or '')}")
File without changes