github / github/copilot-cli

Add a `--prompt-file <path>` flag (large prompts hit ARG_MAX; stdin is awkward)

Offen
#3,398 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area:non-interactive
Vorherrschende Sprache
Shell
Sterne
11.2k
Forks
1.9k
Ø Merge
14 Std. 16 Min.
Gemergte PRs (30 T.)
6

Beschreibung

## Summary

Add a `--prompt-file ` flag to read the prompt from a file instead of from `-p ` or stdin.

## Motivation

Today there are two ways to give Copilot CLI a prompt in non-interactive mode:

1. `-p "$(cat prompt.md)"` — convenient, but the whole prompt is passed on the command line, which is subject to `ARG_MAX` (~2 MB on typical Linux). For our use case (code-review bot that inlines the PR diff plus prior reviews) this is close enough to the limit to be a concern.
2. `< prompt.md` (stdin) — works, no size limit, but is awkward to thread through wrapper scripts that already use stdin for other purposes, and it's harder for new users to discover.

A first-class `--prompt-file` flag would:
- Have no size limit (just reads the file).
- Be self-documenting in scripts (`copilot --prompt-file ./review-prompt.md` vs `copilot -p "$(cat review-prompt.md)"`).
- Compose naturally with workflows that build prompts incrementally (instructions + diff + prior reviews) into a single file.

## Suggested behaviour

```bash
copilot --model gpt-5.5 --prompt-file ./prompt.md # equivalent to `-p "$(cat ./prompt.md)"` but unbounded
copilot --model gpt-5.5 --prompt-file - # explicit stdin (same as today's bare `<`)
```

Mutually exclusive with `-p`/`--prompt`. Error if the file doesn't exist or is empty.

## Why now

I just shipped a self-hosted GitHub Actions workflow that calls Copilot CLI three times per PR (two reviewers + synthesiser), each with a prompt that inlines the PR diff, repo instructions, and (for the synthesiser) the two prior reviews. The consensus prompt can approach several hundred KB; we use stdin today, which works but isn't obvious to anyone reading the workflow. `--prompt-file` would make the intent clear without a wrapper.

## Environment

- GitHub Copilot CLI: `1.0.49`
- Use case: non-interactive `-p`/stdin in GitHub Actions

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by locating the existing -p/--prompt option handling and the non-interactive stdin path. Add the mutually exclusive --prompt-file path, including '-' for stdin, and verify that missing or empty files produce errors and that normal file prompts work as described.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
shell
Bereich
cli
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
64/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.