github / github/copilot-cli

Clarify/support .copilotignore semantics in Copilot CLI

Đang mở
#3,785 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:configuration area:permissions
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

### Summary

Please clarify and/or support `.copilotignore` semantics in Copilot CLI, especially for nested ignore files.

Related but broader issue: https://github.com/github/copilot-sdk/issues/963 asks for general `.copilotignore` support. This issue is specifically about the expected behavior in Copilot CLI and whether it should match the public VS Code Copilot Chat implementation.

### Existing public reference point

VS Code Copilot Chat has a public `.copilotignore` implementation:

- `COPILOT_IGNORE_FILE_NAME = '.copilotignore'` in `ignoreServiceImpl.ts`:
https://github.com/microsoft/vscode-copilot-chat/blob/main/src/platform/ignore/node/ignoreServiceImpl.ts#L23
- `IgnoreFile` uses the `ignore` npm package and `@humanwhocodes/gitignore-to-minimatch`, making the syntax intentionally gitignore-like:
https://github.com/microsoft/vscode-copilot-chat/blob/main/src/platform/ignore/node/ignoreFile.ts

The VS Code implementation appears to:

1. Track multiple `.copilotignore` files in a workspace.
2. Scope each ignore file to its own directory/subtree.
3. Sort ignore files deepest-first.
4. For a target path, check the deepest applicable ignore file first and stop when that file produces either an ignored or unignored result.

That is similar to gitignore-style scoped files, but it is not obviously the same as Git's full cascading merge semantics. It is closer to "nearest/deepest applicable `.copilotignore` wins when it has a matching ignore/unignore rule; otherwise broader files may still be checked."

### Problem

For Copilot CLI, the behavior is unclear:

- Does Copilot CLI support `.copilotignore` files at all, or only managed organization/repository content-exclusion policies?
- If `.copilotignore` is supported, should it match the VS Code Copilot Chat implementation linked above?
- Are multiple nested `.copilotignore` files discovered?
- Is each file scoped to its directory/subtree?
- Are patterns relative to the ignore file location or the repository/workspace root?
- How do negation patterns (`!foo`) interact across parent/child ignore files?
- Does the same exclusion decision apply consistently to file discovery, `@` file mentions, read/search tools, context loading, and edit targets?

This matters because users may assume `.copilotignore` behaves like `.gitignore`, place scoped files in nested directories, and then accidentally expose or allow edits to content they expected Copilot to ignore.

### Desired outcome

Please either:

1. Document that Copilot CLI supports `.copilotignore` and define its nested-file semantics, ideally aligning with VS Code Copilot Chat where possible; or
2. Document that Copilot CLI does not support `.copilotignore` and users should use managed content-exclusion policies instead; or
3. Add support/parity with VS Code Copilot Chat's public `.copilotignore` behavior.

### Environment

Observed while investigating Copilot CLI 1.0.61 behavior.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện hành vi đã được báo cáo của Copilot CLI 1.0.61 với các tệp `.copilotignore` lồng nhau và so sánh hành vi đó với triển khai VS Code Copilot Chat được liên kết. Theo dõi cách việc phát hiện tệp, các lượt đề cập `@`, các công cụ đọc/tìm kiếm, việc tải ngữ cảnh và các mục tiêu chỉnh sửa áp dụng các loại trừ. Công việc được xem là hoàn tất khi dự án ghi lại hoặc triển khai một quyết định nhất quán, đã được kiểm thử, cho các tệp lồng nhau, phạm vi, mẫu và phép phủ định.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
shell, vscode
Lĩnh vực
cli, tooling
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
30/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.