Skip to content

Add non-interactive exec and input prompt support #96

Closed

Description

@flynnhandley

Describe the feature or problem you'd like to solve

No response

Proposed solution

Benefits

  • Enables scripting, automation, and CI use cases.

Proposed Solution

Add a new subcommand:

copilot exec [OPTIONS] [PROMPT]

  • PROMPT: natural language instructions. If - or omitted, read from stdin.
  • Options: --model, --sandbox, --full-auto, --dangerously-bypass-approvals, --json, --output-schema, --resume, etc. (aligning closely with Codex CLI).
  • Default: propose a command and ask for approval.
  • --full-auto: run automatically in a safe sandbox.
  • --json: emit JSONL output for scripting and pipelines.

Example prompts or workflows

  • Log parsing
    cat app.log | copilot exec "print only lines with status 500 and count them"

  • Scaffold a project
    copilot exec "init a Node project, install express, add GET /health route"

  • jq help
    curl -s https://api.example.com/items | copilot exec - "write a jq command to list id and name"

  • Safe repo search
    copilot exec "grep for TODOs excluding node_modules"

  • Python quick test
    copilot exec "create venv, install requests, fetch https://example.com"

Additional context

Problem

Copilot CLI currently only works in interactive mode.

There’s no way to:

  • Run a one-off prompt non-interactively.
  • Pipe stdin into the agent and get a command back.
  • Use Copilot CLI inside scripts, CI/CD, or makefiles.

Codex CLI provided this via codex exec. Users migrating from Codex expect similar functionality.

Activity

  1. lostintangent commented on Sep 27, 2025

    @lostintangent
    Member

    If you run copilot -p <prompt>, that allows you to run prompts headlessly (vs. with the TUI). If you get a chance to check it out, I'd love to hear how well that suits your use cases, since we definitely want it to be well-suited for automation/scripting 👍

  2. flynnhandley commented on Sep 28, 2025

    @flynnhandley
    Author

    If you run copilot -p <prompt>, that allows you to run prompts headlessly (vs. with the TUI). If you get a chance to check it out, I'd love to hear how well that suits your use cases, since we definitely want it to be well-suited for automation/scripting 👍

    Excellent, that works for me!

    I assumed this feature isn't available, because running copilot "do something" returned:
    error: too many arguments. Expected 0 arguments but got 1.

    Perhaps the error message could reference copilot --help?

    Image
  3. avanderhoorn commented on Sep 29, 2025

    @avanderhoorn

    If you run copilot -p <prompt>, that allows you to run prompts headlessly (vs. with the TUI). If you get a chance to check it out, I'd love to hear how well that suits your use cases, since we definitely want it to be well-suited for automation/scripting 👍

    Excellent, that works for me!

    I assumed this feature isn't available, because running copilot "do something" returned: error: too many arguments. Expected 0 arguments but got 1.

    Perhaps the error message could reference copilot --help?

    @flynnhandley Addressed in daily!

  4. RyanHecht commented on Sep 29, 2025

    @RyanHecht
    Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions