feat(workflows): support file-backed inputs#2420
feat(workflows): support file-backed inputs#2420Adr1an04 wants to merge 4 commits intogithub:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds generic CLI support for providing workflow inputs from files (single values via key=@path and bulk values via --input-file JSON), keeping existing inline --input key=value behavior and defining clear precedence/validation at the CLI boundary.
Changes:
- Added
_parse_workflow_inputs(plus helpers) to normalize--inputand--input-fileinto the workflow engine input dict. - Extended
workflow runCLI options with--input-fileand--input key=@pathsemantics (CLI values override file values). - Added regression tests for parsing/precedence/error cases and updated workflow CLI documentation examples.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/specify_cli/__init__.py |
Implements file-backed input parsing helpers and wires them into workflow run via new CLI options. |
tests/test_workflows.py |
Adds targeted tests covering @file inputs, --input-file JSON loading, precedence, and failure modes. |
docs/reference/workflows.md |
Updates CLI reference docs with the new options and usage examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@mnriem I handled Copilots feedback and made sure to take into account your message in the issue. Let me know if you need me to edit anything! :D |
There was a problem hiding this comment.
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
Refs #2405
Summary
This PR adds support for passing workflow inputs from files.
You can still pass inputs inline with repeated
--input key=valueflags. For longer values, you can now usekey=@path, and for multiple values you can use a JSON file with--input-file.This is handled generically for workflow inputs/parameters, not just for
spec.What changed
--input key=@pathfor any workflow input key.--input-file payload.jsonto load multiple inputs from a JSON object.--inputvalues override values loaded from--input-file.Examples
Notes
File references are not
spec-specific. They work for any workflow input key.Values starting with
@are only read from a file when that file exists. This keeps literal values like@aliceor@working as normal strings.--input-filevalues are loaded first, then direct--inputvalues are applied after that. This lets command-line values override the JSON file.What did not change
WorkflowEnginebehavior.--input-fileonly accepts a JSON object.--input key=@pathvalues are read as UTF-8 text.Testing
I ran focused workflow input regression tests:
uv run python -m pytest tests/test_workflows.py -k WorkflowCliInputs -v # 12 passed, 126 deselected in 0.15sI also ran the full workflow test file:
uv run python -m pytest tests/test_workflows.py -v # 138 passed in 0.30sI used the existing agent config consistency test:
uv run python -m pytest tests/test_agent_config_consistency.py -q # 24 passed in 0.13sI ran the full test suite:
uv run python -m pytest -q # 1833 passed, 29 skipped, 18 warnings in 20.25sCLI-level validation
I tested the workflow CLI directly in a temporary Spec Kit project.
Covered cases:
--input key=@pathreads an existing UTF-8 text file.promptanddescription, not onlyspec.--input key=valuevalues still work.@aliceand bare@stay unchanged.@pathvalues stay literal.--input-file payload.jsonloads multiple inputs from a JSON object.--inputvalues override values loaded from--input-file.key=@path.--input-fileexits cleanly with code 1.Smoke test output:
I also checked the command help and confirmed the new CLI options are exposed:
AI assistance note
I used ChatGPT to help think through edge cases and wording. I wrote, reviewed, and tested the code locally before opening this PR.