Skip to content

feat(workflows): support file-backed inputs#2420

Open
Adr1an04 wants to merge 27 commits intogithub:mainfrom
Adr1an04:feat/workflow-input-file-refs
Open

feat(workflows): support file-backed inputs#2420
Adr1an04 wants to merge 27 commits intogithub:mainfrom
Adr1an04:feat/workflow-input-file-refs

Conversation

@Adr1an04
Copy link
Copy Markdown
Contributor

Refs #2405

Summary

This PR adds support for passing workflow inputs from files.

You can still pass inputs inline with repeated --input key=value flags. For longer values, you can now use key=@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

  • Added CLI-side parsing for workflow inputs.
  • Added support for --input key=@path for any workflow input key.
  • Added --input-file payload.json to load multiple inputs from a JSON object.
  • Made direct --input values override values loaded from --input-file.
  • Added clear errors for missing input files, invalid JSON, and non-object JSON.
  • Updated the workflow docs with generic examples.

Examples

specify workflow run ./workflow.yml --input prompt=@docs/prompt.md
specify workflow run ./workflow.yml --input-file payload.json
specify workflow run ./workflow.yml --input-file payload.json --input scope=full

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 @alice or @ working as normal strings.

--input-file values are loaded first, then direct --input values are applied after that. This lets command-line values override the JSON file.

What did not change

  • No changes to WorkflowEngine behavior.
  • No new workflow execution semantics.
  • Workflow definitions were not made Spec Kit-specific.
  • --input-file only accepts a JSON object.
  • File-backed --input key=@path values 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.15s

I also ran the full workflow test file:

uv run python -m pytest tests/test_workflows.py -v
# 138 passed in 0.30s

I used the existing agent config consistency test:

uv run python -m pytest tests/test_agent_config_consistency.py -q
# 24 passed in 0.13s

I ran the full test suite:

uv run python -m pytest -q
# 1833 passed, 29 skipped, 18 warnings in 20.25s

CLI-level validation

I tested the workflow CLI directly in a temporary Spec Kit project.

Covered cases:

  • --input key=@path reads an existing UTF-8 text file.
  • File references work for generic input keys like prompt and description, not only spec.
  • Repeated --input key=value values still work.
  • Literal values like @alice and bare @ stay unchanged.
  • Missing @path values stay literal.
  • --input-file payload.json loads multiple inputs from a JSON object.
  • Direct --input values override values loaded from --input-file.
  • Direct overrides can also use key=@path.
  • Missing --input-file exits cleanly with code 1.
  • Invalid JSON exits cleanly with code 1.
  • Non-object JSON exits cleanly with code 1.

Smoke test output:

PASS direct file refs and literal @ values
PASS input-file values with CLI override precedence
PASS missing @path remains literal
PASS missing --input-file exits 1
PASS invalid JSON exits 1
PASS non-object JSON exits 1
CLI smoke tests passed

I also checked the command help and confirmed the new CLI options are exposed:

uv run specify workflow run --help
# shows --input / -i with key=@path help
# shows --input-file for JSON object input files
Screenshot 2026-04-29 at 11 35 48 PM CLI smoke test screenshot showing successful file-backed inputs, JSON input-file overrides, literal `@` handling, and clean error cases for missing/invalid input files.

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.

Copilot AI review requested due to automatic review settings April 30, 2026 03:39
@Adr1an04 Adr1an04 requested a review from mnriem as a code owner April 30, 2026 03:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --input and --input-file into the workflow engine input dict.
  • Extended workflow run CLI options with --input-file and --input key=@path semantics (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.

Comment thread src/specify_cli/__init__.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/reference/workflows.md Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/specify_cli/__init__.py Outdated
Comment thread docs/reference/workflows.md Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Adr1an04
Copy link
Copy Markdown
Contributor Author

@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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Adr1an04 Adr1an04 force-pushed the feat/workflow-input-file-refs branch from 5939eab to 37d6d44 Compare May 4, 2026 14:28
@Adr1an04 Adr1an04 requested a review from Copilot May 4, 2026 14:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +5341 to +5346
)
inputs[key] = value

return inputs


Comment thread src/specify_cli/__init__.py Outdated
Comment on lines +5317 to +5318
if input_file is not None:
inputs.update(_load_workflow_input_file(input_file))
…ithub#2445)

* chore: update security-review extension to v1.4.2

* chore: update memory-md description and catalog updated_at
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/specify_cli/__init__.py Outdated
Comment on lines +5387 to +5394
if value.startswith("@"):
file_ref = value[1:].strip()
if file_ref:
candidate_path = _resolve_workflow_cli_path(file_ref)
if candidate_path.exists() and candidate_path.is_file():
_, value = _read_workflow_cli_file(
file_ref, f"input {key!r}"
)
Comment on lines +5367 to +5371
for key, value in _load_workflow_input_file(input_file).items():
inputs[key] = _normalize_workflow_cli_scalar(
value,
input_definitions.get(key),
)
Comment thread tests/test_workflows.py
Comment on lines +380 to +391
result = CliRunner().invoke(
app,
[
"workflow",
"run",
"speckit",
"--input-file",
"payload.json",
"--input",
"scope=full",
],
)
vieiraae and others added 5 commits May 4, 2026 11:35
…ithub#2413)

* feat(presets): add Spec2Cloud preset for Azure deployment workflow

Co-authored-by: Copilot <copilot@github.com>

* feat(presets): add Spec2Cloud preset details to community catalog

* fix(presets): update Spec2Cloud URL to point to the correct GitHub repository

* feat(presets): update Spec2Cloud entry with created_at and updated_at timestamps

* feat(presets): update Spec2Cloud version to 1.1.0 and adjust timestamps

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix: update spec2cloud preset details and resolve merge conflicts

* fix: reorder Spec2Cloud entry in community presets for consistency

---------

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* chore: bump version to 0.8.5

* chore: begin 0.8.6.dev0 development

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mnriem
Copy link
Copy Markdown
Collaborator

mnriem commented May 4, 2026

Please address Copilot feedback. If not applicable, please explain why

Rubiss and others added 16 commits May 4, 2026 15:50
* feat: add Architecture Guard to community catalog

- Add architecture-guard v1.4.0 extension entry to catalog
- Add entry to README community extensions table
- Includes built-in Laravel-specific governance rules

* chore: update catalog timestamp to 2026-05-05

* fix: address PR feedback

- Add 'governance' category to README legend (used by Architecture Guard)
- Update architecture-guard timestamps to 2026-05-05 (submission date)
- Align with published extension behavior (Laravel support now built-in)

* chore: update Architecture Guard category to process

- Changed from 'governance' to 'process' (official category)
- Aligns with schema in EXTENSION-PUBLISHING-GUIDE.md
- Removed 'governance' from category legend (not an official category)

* chore: update timestamps to actual UTC datetime

- Top-level updated_at: 2026-05-05T07:26:00Z
- Entry created_at/updated_at: 2026-05-05T07:26:00Z
- Replaces placeholder 00:00:00Z with actual submission time
* fix: validate URL scheme in build_github_request

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* test: add missing hostname validation test for build_github_request

* fix: update docstring and fix import grouping per Copilot feedback

* fix: sort imports and simplify url validation in build_github_request

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Simplify the community catalog submission flow to use issue templates
with manual maintainer review (no automation scripts or workflows).

- Add explicit CODEOWNERS entries for catalog.community.json files so
  submissions are automatically assigned to a maintainer for review
- Improve preset submission template:
  - Add 'Required Extensions' optional field
  - Make 'Templates Provided' optional (supports command-only presets)
  - Add 'Number of Scripts' optional field

The existing extension and preset issue templates already collect all
required catalog metadata. Maintainers review submissions and manually
update the catalog JSON files.

Closes github#2400
…ce during implementation (github#2460)

* Initial plan

* fix implement command to load constitution context

Agent-Logs-Url: https://github.com/github/spec-kit/sessions/05663d9d-149b-4c13-a22d-2552b3fa619c

Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* chore: bump version to 0.8.6

* chore: begin 0.8.7.dev0 development

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* feat(catalog): add Cost Tracker (cost) community extension

Adds a new entry for spec-kit-cost — track real LLM dollar cost across
SDD workflows with per-feature budgets, per-integration comparison,
and finance-ready exports.

Repo: https://github.com/Quratulain-bilal/spec-kit-cost
Release: v1.0.0

* docs(catalog): add Cost Tracker README row, bump updated_at

Address Copilot review feedback:
- Add Cost Tracker row to README community extensions table
- Bump top-level updated_at per EXTENSION-PUBLISHING-GUIDE.md

* fix(catalog): address Copilot feedback on cost extension entry

- Move cost entry after confluence so the c* block is alphabetized
- Bump top-level updated_at to 2026-05-05 per EXTENSION-PUBLISHING-GUIDE
- Use documented 'visibility' category in README (not 'analytics'),
  matching Token Consumption Analyzer's classification
- Replace 'analytics' tag with 'visibility' in catalog tags for consistency

* fix(catalog): bump top-level updated_at for cost entry addition

Address Copilot feedback: the file-level updated_at must be bumped on
every catalog change per EXTENSION-PUBLISHING-GUIDE.md:204-205.

---------

Co-authored-by: Quratulain-bilal <quratulain.bilal@users.noreply.github.com>
…github#2462)

* fix(forge): use hyphen notation for command refs in Forge integration

- Add invoke_separator = "-" class attribute to ForgeIntegration so
  effective_invoke_separator() returns "-" for shared-template installs
- Add "invoke_separator": "-" to ForgeIntegration.registrar_config so
  agents.py CommandRegistrar can resolve refs with the correct separator
- Pass invoke_separator to process_template() in ForgeIntegration.setup()
  so all .forge/commands/*.md bodies use /speckit-foo notation
- Replace literal /speckit.specify with __SPECKIT_COMMAND_SPECIFY__ in
  extensions/git/commands/speckit.git.feature.md so every agent resolves
  the reference through its own separator
- Apply resolve_command_refs re.sub in agents.py register_commands() after
  argument-placeholder substitution so extension commands registered for
  Forge get /speckit-foo refs; all other agents continue to get /speckit.foo

Fixes ZSH compatibility: dot-notation command invocations (/speckit.specify)
are misinterpreted by ZSH as file-path operations; hyphen notation
(/speckit-specify) works correctly in all shells.

* fix(agents): propagate invoke_separator from integration class into AGENT_CONFIGS

Skills-based agents (claude, codex, kimi, …) inherit invoke_separator="-"
from SkillsIntegration but do not repeat it in their registrar_config dicts.
_build_agent_configs() was copying registrar_config verbatim, so
register_commands() fell back to "." when resolving __SPECKIT_COMMAND_*__
tokens for those agents — emitting /speckit.specify instead of the correct
/speckit-specify for extension commands like speckit.git.feature.

Fix: after copying registrar_config, inject invoke_separator from the
integration's class attribute when it is not already declared explicitly.
This makes the integration class the single source of truth for all agents,
without requiring each SkillsIntegration subclass to duplicate the field.

Also replace the inline re.sub in register_commands() with a call to
IntegrationBase.resolve_command_refs() (deferred import to avoid the
existing circular dependency) so token-resolution logic is not duplicated.

Adds two tests in test_agent_config_consistency.py:
- test_skills_agents_have_hyphen_invoke_separator_in_agent_configs: asserts
  every /SKILL.md agent has invoke_separator="-" in AGENT_CONFIGS.
- test_skills_agent_command_token_resolves_with_hyphen: end-to-end check via
  CommandRegistrar that the git extension's speckit.git.feature command is
  installed for Claude with /speckit-specify (not /speckit.specify).

Addresses review comment on PR github#2462.
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.