github / github/copilot-cli

Add a CLI flag to temporarily trust a workspace in non-interactive sessions (e.g. --temporarily-trust-workspace)

未关闭
#4,878 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

triage
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

Describe the feature or problem you'd like to solve

Workspace .mcp.json config is only honored once a workspace has been marked "trusted," and the only way to grant that trust today is by starting an interactive session and answering "Yes" to the trust prompt. There is currently no way to trust a workspace from a non-interactive (-p) session, a scripted/CI environment, or any headless context. This was confirmed by a maintainer on #4542: workspace .mcp.json loading was fixed in 1.0.85, but only takes effect if the workspace is already trusted, and there's no CLI-only way to establish that trust. This makes committed, repo-scoped .mcp.json files effectively unusable in automated or headless workflows (CI pipelines, containers, scripted invocations) even though the underlying loading bug is fixed, because there's no non-interactive path to the trust step.

Proposed solution

Add a flag (e.g. --temporarily-trust-workspace, name open to maintainer preference) that grants the current working directory workspace trust for the duration of that single invocation, without requiring the interactive TUI trust prompt.

This would let users and CI systems opt into trusting a specific workspace explicitly and auditably per-invocation, rather than requiring either a persisted trust decision made interactively beforehand, or the --additional-mcp-config workaround that duplicates the already-committed .mcp.json.

Benefits:

  • Unblocks CI/automation and headless use of workspace-scoped .mcp.json
  • Avoids requiring users to persist trust ahead of time via the interactive flow
  • Avoids the --additional-mcp-config duplication workaround
  • Keeps trust explicit and scoped to one invocation, rather than silently trusting all workspaces
Example prompts or workflows
  1. CI pipeline step: copilot --temporarily-trust-workspace --allow-all-tools -p "Run the test suite and summarize failures" — using the repo's committed .mcp.json without a prior interactive trust step.

  2. Docker/headless container: running scripted copilot -p "..." invocations where no TTY is available to answer the interactive trust prompt.

  3. One-off automation script that clones a repo, trusts it for a single non-interactive Copilot invocation, and never persists that trust decision to the user's config.

Additional context

#4542

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先跟踪非交互式 -p 会话如何处理 workspace 信任提示,以及 workspace .mcp.json 的加载如何依赖信任;查看 issue #4542 了解相关背景。完成的标准是:一个有文档说明的 flag 能够为单次 invocation 授予信任,允许在没有 TTY 的情况下加载已提交的 workspace 配置,并且不会持久化信任决定。

由索引模型根据 Issue 内容生成。

评估

技术栈
shell
领域
cli
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
58/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。