Skip to content

Allow prompts to be passed via stdin for advanced scripting and usability #1046

@waldekmastykarz

Description

@waldekmastykarz

Describe the feature or problem you'd like to solve

It's currently inconvenient to pass complex, multiline prompts with code samples and quotes to copilot-cli through the -p argument, as the CLI requires escaping quotes and line breaks, making scripting and interactive use cumbersome.

Proposed solution

Support passing the prompt to copilot-cli via standard input (stdin), enabling users to pipe in content directly or redirect from files. This would streamline interactive use and scripting, reducing the need for cumbersome escaping and making it easier to work with prompts that include code and formatting.

Example prompts or workflows

  • echo "Suggest a git alias for rebasing." | copilot <command> --stdin
  • cat elaborate_prompt.txt | copilot <command> --stdin

Additional context

  • This feature is particularly useful when prompts are generated programmatically or authored in external editors.
  • It would maintain parity with other CLI tools that support stdin (such as git, jq, etc).
  • Could help standardize CI/CD and scripting scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions