Copilot 命令行界面(CLI)可以从终端打开GitHub问题。 无需切换到浏览器并手动填写问题单,你只需描述你的需求,Copilot 就会从你的代码库和 GitHub 收集相关上下文,然后创建问题单,让你可以继续手头的工作。
示例场景 1:由 CI 失败提交问题单
你的 CI 运行失败了,或者你在生产日志中发现了错误。 与其手动顺着堆栈跟踪追溯到某次提交,不如让 Copilot 命令行界面(CLI) 为你调查并提报该问题。
示例提示
The CI workflow on main has been failing since yesterday. Look at the failing run, figure out what's breaking and which commit likely introduced it, then create an issue with the stack trace, a link to the failing run, and the suspected PR that caused it. Label it "bug" and "regression".
The CI workflow on main has been failing since yesterday. Look at the failing
run, figure out what's breaking and which commit likely introduced it, then
create an issue with the stack trace, a link to the failing run, and the
suspected PR that caused it. Label it "bug" and "regression".
示例响应
注意
以下响应是示例。 副驾驶聊天 的回答是不确定的,因此你可能会得到与这里所显示的不同的回答。
Copilot 命令行界面(CLI) 使用其 GitHub MCP 工具来:
-
获取失败的工作流运行记录,并从日志中提取堆栈跟踪。
-
标识负责任的代码 ,例如
src/services/payment.ts:94。 -
搜索最近修改该文件的提交,并查找引入该更改的 PR。
-
创建问题,并附上已整理好的全部上下文信息:
Created issue #421: Regression: PaymentService throws TypeError after #398 What's failing: The `build` job on main has failed since commit `a3f7c21`. Stack trace: TypeError: Cannot read properties of undefined (reading 'amount') at processRefund (src/services/payment.ts:94:22) Introduced by: PR #398 (merged 2 days ago) refactored the payment types but missed updating `processRefund` to handle the new nullable `transaction` field. Failing run: Actions run #2847 Suggested fix: Add a null check for `transaction` before accessing `transaction.amount` on line 94. Labels: `bug`, `regression`
示例场景 2:将 TODO 转换为可跟踪的工作项
随着时间的推移,TODO 和 FIXME 注释累积在代码库中,没有可见性。 可以要求 Copilot 命令行界面(CLI) 扫描这些注释、评估优先级并创建问题,以便跟踪工作。
示例提示
Scan this repo for TODO and FIXME comments. Group them by area, pick the 5 most important ones based on the surrounding code context, and create an issue for each. Include the code snippet, file location, and suggest a label.
Scan this repo for TODO and FIXME comments. Group them by area, pick the 5
most important ones based on the surrounding code context, and create an issue
for each. Include the code snippet, file location, and suggest a label.
示例响应
注意
以下响应是示例。 副驾驶聊天 的回答是不确定的,因此你可能会得到与这里所显示的不同的回答。
Copilot 命令行界面(CLI) 搜索代码库,读取每个注释的上下文,并根据严重性确定优先级:
Found 23 TODO/FIXME comments across the repo. Here are the 5 I'd prioritize:
Created issue #422: FIXME: SQL injection risk in search query builder
- src/db/search.ts:34 — user input concatenated directly into query string
- Label: security, priority:high
Created issue #423: TODO: Rate limiter bypassed for internal routes
- src/middleware/rate_limit.ts:12 — comment says "temporary bypass, remove before launch"
- Label: security, technical-debt
Created issue #424: FIXME: Memory leak in WebSocket handler
- src/ws/handler.ts:87 — listeners are added on each connection but never cleaned up
- Label: bug, performance
Created issue #425: TODO: Retry logic missing for payment webhook
- src/webhooks/payment.ts:56 — failures silently dropped, no retry queue
- Label: reliability, priority:medium
Created issue #426: TODO: Migrate to new auth token format
- src/auth/token.ts:3 — comment references a closing down API version
- Label: technical-debt