Skip to content

Add non-interactive exec and input prompt support #96

@flynnhandley

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions