Add .cody/ignore support to remote context #59836
Conversation
2f3a254 to
3455612
Compare
| "github.com/sourcegraph/sourcegraph/internal/types" | ||
| ) | ||
|
|
||
| const codyIgnoreFile = ".cody/ignore" |
There was a problem hiding this comment.
@abeatrix this is correct for the ignore file right?
There was a problem hiding this comment.
Yea this is the name we use for the .cody/ignore file
There was a problem hiding this comment.
@chwarwick would this work with nested directory?
There was a problem hiding this comment.
@chwarwick would this work with nested directory?
I don't think that is an issue since I'm checking directly against the repo from gitserver and I thought it had to be at the root of the repo. I shouldn't need to handle any of the complexities that the extensions have were multiple repos in a workspace or a folder that contains subfolders with repos etc.. Is there a scenario are you thinking of?
The api is "get me context from repos [A, B, C]" so it runs a search against those repos and checks for ignore files in each of them to apply to the search results.
There was a problem hiding this comment.
thought it had to be at the root of the repo
I was wondering how it'd work with monorepos that contain sub repo but I think we should be good as long as we communicate that with the users?
abeatrix
left a comment
There was a problem hiding this comment.
Lgtm! Can't wait to test it out in the clients!
arafatkatze
left a comment
There was a problem hiding this comment.
Love the process and the idea of this PR. I wanna approve after the resolution of
Part of https://github.com/sourcegraph/cody/issues/2920 Summary: - Adding a new `check/isCodyIgnoredFile` request handler to check if a file path is being ignored by Cody - Updating tests to use this new request instead of the isCodyIgnoredFile utility method - Adding a test to confirm .cody/ignore is working on startup This PR adds integration tests for the following features to agent: - [x] autocomplete https://github.com/sourcegraph/cody/pull/2986 - [x] chat (chat submission) - [x] chat command (/explain) - [x] inline edit command (/doc) Local context source covered in the test: - [x] editor (used by commands, chat, inline-edit, auto-completes) - [x] symf (local search) (used by chat when enhanced context is enabled) - [x] local context used by autocompletion https://github.com/sourcegraph/cody/pull/2986 Also updated to allow remote context which should be filtered during sync time (https://github.com/sourcegraph/sourcegraph/pull/59836) to allow support for multi-repo context in clients. ## Follow-Up Works - [x] Add assertions for checking input context during Network Request ## Test plan <!-- Required. See https://sourcegraph.com/docs/dev/background-information/testing_principles. --> Green bots means 👍
Updates the getCodyContext resolver to filter out context if a
.cody/ignorefile is present and it matches an ignore rule. The behavior is behind an experimental feature in the site config.closes https://github.com/sourcegraph/sourcegraph/issues/59682
closes https://github.com/sourcegraph/sourcegraph/issues/59976
Test plan
updated existing context resolver tests
add new tests for filtering logic
Manual testing