Skip to content

Feat: Add OpenCode run parameters to agent steps - #18

Merged
tbrandenburg merged 1 commit into
mainfrom
feature/add-opencode-agent-step-parameters
Jun 1, 2026
Merged

Feat: Add OpenCode run parameters to agent steps#18
tbrandenburg merged 1 commit into
mainfrom
feature/add-opencode-agent-step-parameters

Conversation

@tbrandenburg

Copy link
Copy Markdown
Owner

Problem

Flowsh agent steps could only express agent, prompt, and expandPrompt. Workflows that needed OpenCode's non-interactive --model, --command, or explicit --dangerously-skip-permissions flags were rejected by strict YAML validation instead of rendering the intended opencode run invocation.

Solution

Extend the existing Python CLI blueprint in place. The AgentStep model now accepts model, command, and dangerouslySkipPermissions, with dangerously-skip-permissions as an accepted alias. Generated harnesses keep the existing Bash array command pattern and append all optional OpenCode flags before --, so prompt text remains message content.

Changes

  • Updated src/flowsh_cli/models.py with strict optional fields, shared string validation, and duplicate dangerous-alias rejection.
  • Updated src/flowsh_cli/render.py to pass --agent, --model, --command, and --dangerously-skip-permissions through run_agent().
  • Added parser, schema, validation, and fake-OpenCode argv tests in tests/test_workflow_to_harness.py.
  • Updated README.md with the supported YAML and security-sensitive dangerous permission behavior.
  • Added the completed plan and implementation report under .claude/PRPs/.

Testing

  • make lint: passed.
  • uv run --locked pytest tests/test_workflow_to_harness.py -q: 76 passed.
  • make build && uv run --locked flowsh-cli --schema: passed; schema includes new AgentStep fields.
  • make qa: passed locally and again in the push hook with 76 tests passing and package build succeeding.

Example Output

run
--format
json
--agent
general
--model
provider/model
--command
review
--dangerously-skip-permissions
--
--help

Notes

  • model values intentionally allow provider/model IDs like openai/gpt-5; they do not reuse the stricter agent name regex.
  • If both dangerous permission aliases are present, validation rejects the step rather than relying on Pydantic alias priority.
  • No new dependencies or step types were added.

Workflow authors could only pass agent and prompt values to OpenCode, leaving model, command, and explicit permission-skip controls unavailable from strict YAML.
This extends the existing Python blueprint without adding step types or dependencies, while preserving prompt handling after the -- sentinel.

Changes:
- Add strict AgentStep fields for model, command, and dangerous permission skipping
- Render new OpenCode flags through the existing Bash array before prompt content
- Cover parser validation, schema exposure, generated harness argv, and README docs

Pattern: Follows existing AgentStep validation and run_agent Bash array composition
Decision: Reject both dangerous aliases together to avoid silent AliasChoices priority
Related: src/flowsh_cli/models.py, src/flowsh_cli/render.py, tests/test_workflow_to_harness.py
@tbrandenburg
tbrandenburg merged commit 0f8cc1a into main Jun 1, 2026
1 check passed
@tbrandenburg
tbrandenburg deleted the feature/add-opencode-agent-step-parameters branch June 1, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant