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.
Describe the feature or problem you'd like to solve
No response
Proposed solution
Benefits
Proposed Solution
Add a new subcommand:
copilot exec [OPTIONS] [PROMPT]
-or omitted, read from stdin.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:
Codex CLI provided this via
codex exec. Users migrating from Codex expect similar functionality.