Add a `--prompt-file <path>` flag (large prompts hit ARG_MAX; stdin is awkward)
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
## 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
贡献指南
调研方向
首先定位现有的 -p/--prompt 选项处理逻辑以及非交互式 stdin 路径。添加互斥的 --prompt-file 路径,包括用于 stdin 的 '-',并验证缺失或为空的文件会产生错误,且普通文件 prompt 按描述正常工作。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- shell
- 领域
- cli
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 64/100