flowsh-cli 0.4.0__tar.gz → 0.4.2__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.
- {flowsh_cli-0.4.0 → flowsh_cli-0.4.2}/PKG-INFO +1 -1
- {flowsh_cli-0.4.0 → flowsh_cli-0.4.2}/pyproject.toml +1 -1
- {flowsh_cli-0.4.0 → flowsh_cli-0.4.2}/src/flowsh_cli/__init__.py +1 -1
- {flowsh_cli-0.4.0 → flowsh_cli-0.4.2}/src/flowsh_cli/models.py +19 -2
- {flowsh_cli-0.4.0 → flowsh_cli-0.4.2}/src/flowsh_cli/render.py +11 -2
- {flowsh_cli-0.4.0 → flowsh_cli-0.4.2}/README.md +0 -0
- {flowsh_cli-0.4.0 → flowsh_cli-0.4.2}/src/flowsh_cli/__main__.py +0 -0
- {flowsh_cli-0.4.0 → flowsh_cli-0.4.2}/src/flowsh_cli/cli.py +0 -0
|
@@ -73,7 +73,14 @@ class BashStep(BaseStep):
|
|
|
73
73
|
|
|
74
74
|
class AgentStep(BaseStep):
|
|
75
75
|
type: Literal["agent"]
|
|
76
|
-
prompt: str
|
|
76
|
+
prompt: str = Field(
|
|
77
|
+
description=(
|
|
78
|
+
"The prompt text sent to the agent. "
|
|
79
|
+
"May contain markdown, code fences, backticks, $(...), and other shell syntax freely — "
|
|
80
|
+
"the prompt is never passed through a shell. "
|
|
81
|
+
"Use expandPrompt: true to substitute ${VAR} / $VAR tokens from vars steps."
|
|
82
|
+
)
|
|
83
|
+
)
|
|
77
84
|
agent: str | None = None
|
|
78
85
|
model: str | None = None
|
|
79
86
|
command: str | None = None
|
|
@@ -84,7 +91,17 @@ class AgentStep(BaseStep):
|
|
|
84
91
|
"dangerously-skip-permissions",
|
|
85
92
|
),
|
|
86
93
|
)
|
|
87
|
-
expandPrompt: bool =
|
|
94
|
+
expandPrompt: bool = Field(
|
|
95
|
+
default=False,
|
|
96
|
+
description=(
|
|
97
|
+
"When true, substitutes ${VAR} and $VAR tokens from vars steps into the prompt "
|
|
98
|
+
"at runtime using safe plain-text replacement. "
|
|
99
|
+
"Shell expressions such as $(cmd), `cmd`, $((expr)), and globs are NOT evaluated — "
|
|
100
|
+
"they pass through to the agent literally. "
|
|
101
|
+
"Only uppercase variable names matching [A-Z_][A-Z0-9_]* found in the prompt text "
|
|
102
|
+
"are replaced. All other shell syntax in the prompt is safe to use."
|
|
103
|
+
),
|
|
104
|
+
)
|
|
88
105
|
|
|
89
106
|
@model_validator(mode="before")
|
|
90
107
|
@classmethod
|
|
@@ -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 {
|
|
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
|
|
File without changes
|
|
File without changes
|