Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

Global variables in taskflows currently require editing YAML files. This adds -g/--global KEY=VALUE CLI arguments to set or override globals without file modifications.

Changes

CLI parsing (__main__.py)

  • Added -g/--global argument (repeatable) to parse_prompt_args()
  • Returns parsed globals as dictionary
  • CLI globals override file-based globals via dict merge

Tests

  • Added 5 test cases covering single/multiple globals, special characters, file-based globals

Documentation

  • Updated README.md and GRAMMAR.md with usage examples

Usage

# Override file-based global
hatch run main -t examples.taskflows.example_globals -g fruit=apples

# Set multiple globals
hatch run main -t example -g var1=value1 -g var2=value2

# Works with Docker
docker/run.sh -t example_globals -g fruit=apples

Taskflow prompts use the same {{ GLOBALS_key }} syntax. CLI values take precedence over file values when keys match.

Original prompt

This section details on the original issue you should resolve

<issue_title>Globals on the command line</issue_title>
<issue_description>Currently, the only way to set a global is by editing a taskflow file. Until we implement parameter passing, it'll be useful if we set global variables on the command line.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@kevinbackhouse kevinbackhouse marked this pull request as ready for review November 18, 2025 09:35
Copilot AI review requested due to automatic review settings November 18, 2025 09:35
Copy link
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 wasn't able to review any files in this pull request.


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

Copilot AI changed the title [WIP] Add support for setting globals on the command line Add command line support for global variables Nov 18, 2025
Copilot finished work on behalf of kevinbackhouse November 18, 2025 09:52
kevinbackhouse and others added 2 commits November 18, 2025 12:33
…ssignment

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ssignment

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ssignment

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@kevinbackhouse
Copy link
Collaborator

@p- @m-y-mo: The way that it's currently implemented, any global values that are set in the taskflow will get overridden by the values provided on the command line. Are you happy with that design?

@m-y-mo
Copy link
Contributor

m-y-mo commented Nov 18, 2025

yea I think it makes sense to overwrite with command line input.

@kevinbackhouse kevinbackhouse merged commit 8b4e420 into main Nov 19, 2025
9 checks passed
@kevinbackhouse kevinbackhouse deleted the copilot/add-globals-command-line-support branch November 19, 2025 14:28
@kevinbackhouse kevinbackhouse mentioned this pull request Nov 19, 2025
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.

Globals on the command line

3 participants