You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- Explain the changes introduced in your PR -->
## Pull Request approval
You will need to get your PR approved by at least one member of the
Sourcegraph team. For reviews of docs formatting, styles, and component
usage, please tag the docs team via the #docs Slack channel.
---------
Co-authored-by: Maedah Batool <[email protected]>
<Callouttype="note">Cody Context Filters is available only for Enterprise users on all supported [clients](/cody/clients).</Callout>
7
6
8
-
## Cody Context Filters
7
+
## Context Filters
9
8
10
-
<Callouttype="note">Context Filters is available only for Cody Enterprise users.</Callout>
11
-
12
-
Admins on the Sourcegraph Enterprise instance can use the Cody Context Filters to determine which repositories Cody can use as the context in its requests to third-party LLMs. Cody Context Filters can be used when the following conditions are met:
9
+
Admins on the Sourcegraph Enterprise instance can use the Cody Context Filters to determine which repositories Cody can use as the context in its requests to third-party LLMs. You can use Context Filters if you have:
13
10
14
11
- A valid Cody Enterprise license running on Sourcegraph instance version `>=5.4.0`
15
12
- Running the supported Cody client versions: VS Code `>=1.20.0` and JetBrains `>=6.0.0`
16
13
- Setting the `cody-context-filters-enabled` feature flag to `true`
17
14
18
-
Administrators can configure the `cody.contextFilters` field in the site configuration with the repos that they wish Cody to exclude or only include using the following structure:
15
+
Site admins can customize the `cody.contextFilters` field in the site configuration to specify which repositories Cody should `include` or `exclude`, using the following structure:
19
16
20
17
```json
21
18
{
@@ -41,17 +38,19 @@ Administrators can configure the `cody.contextFilters` field in the site configu
41
38
42
39
```
43
40
44
-
###How include and exclude rules work
41
+
## How `include` and `exclude` rules work
45
42
46
43
The `include` and `exclude` rules define the repositories Cody can use as context. The rules can be defined in the following combination:
47
44
48
-
1.`cody.contextFilters` field is not defined
45
+
### `cody.contextFilters` field is not defined
46
+
47
+
By default, Cody can access all repositories for context when making requests to third-party LLMs, with no restrictions on inclusion or exclusion.
49
48
50
-
By default, there are no restrictions on the repositories Cody can use for context in requests to third-party LLMs. All repositories are included, and none are excluded.
49
+
### Only `include` rules are specified
51
50
52
-
2. Only `include` rules are specified
51
+
Cody is restricted to using content only from repositories whose names match the patterns specified in the `include`field. No repositories are explicitly excluded if no `exclude`rules are defined.
53
52
54
-
Cody is restricted from using content from repositories whose names match any specified patterns in the `include` field. Since no `exclude` rules are specified, no repositories are explicitly excluded. An `include` field might contain a catch-all pattern (e.g., a `regexp`matching any string). In this case, Cody can access content from any repository, as a single match in the `include` rules is sufficient for inclusion. For example,
53
+
The `include` field can also contain a catch-all pattern (e.g., a `regexp`that matches any string), allowing Cody to access content from all repositories. A single match in the `include` rules is enough for a repository to be included. For example:
55
54
56
55
```json
57
56
{
@@ -67,11 +66,13 @@ Cody is restricted from using content from repositories whose names match any sp
67
66
68
67
```
69
68
70
-
The `include` rules allow Cody to access the repository matching the `regexp`. This means Cody can now fully access the repository and its content to fetch context.
69
+
These `include` rules allow Cody only to utilize the repository matching the `regexp` with full access to fetch context.
70
+
71
+
### Only `exclude` rules are specified
71
72
72
-
1. Only `exclude` rules are specified
73
+
By default, all repositories are included unless specific `include` rules are defined. If **only**`exclude` rules are specified, Cody will not use content from any repository whose name matches at least one pattern in the `exclude` field.
73
74
74
-
All repositories are considered included by default without the `include` rules. Cody is prohibited from using content from any repository whose name matches at least one pattern specified in the exclude field. An `exclude` field may contain a catch-all condition (e.g., a `regexp`matching any string). If such a match occurs, Cody is restricted from using content from any repository. For example,
75
+
The `exclude` field can also include a catch-all condition, such as a `regexp`that matches any string. When such a condition is present, Cody is entirely restricted from accessing content from any repository. For example:
75
76
76
77
```json
77
78
{
@@ -87,19 +88,15 @@ All repositories are considered included by default without the `include` rules.
87
88
88
89
```
89
90
90
-
In this case, Cody's commands are disabled, and you cannot use them for context fetching. If you try running any of these, you'll be prompted with an error message. However, Cody chat will still work, and you can use it to ask questions.
The demo shows what happens when you try to run commands due to the `exclude` rules.
93
+
Some Cody features, such as using **Prompts**, will not work if the `exclude` rules are defined. They appear to be disabled in the Cody chat interface. If you try running any of these, you'll be prompted with an error message. However, Cody chat will still work; you can use it to ask questions.
1. Both `include` and `exclude` rules are specified
97
+
###Both `include` and `exclude` rules are specified
101
98
102
-
When making requests to third-party LLMs, Cody can use content from a repository if its name matches any of the `include` patterns and does not match any of the `exclude` patterns. Thus, the `exclude` rules filter only the repositories allowed by the `include` rules. For example,
99
+
When requesting third-party LLMs, Cody can use content from a repository if its name matches any of the `include` patterns and does not match any of the `exclude` patterns. Thus, the `exclude` rules filter only the repositories allowed by the `include` rules. For example,
103
100
104
101
```json
105
102
{
@@ -127,39 +124,11 @@ In this case, Cody can access content from repositories whose names start with `
127
124
128
125
Depending on the client type, here's a breakdown of versions supported and the behavior for unsupported versions:
<Callouttype="note">The Cody Ignore feature has been sunsetted and will no longer be maintained. We recommend using Cody Context Filters with Cody Enterprise for more flexible file exclusion and inclusion rules.</Callout>
142
-
143
-
Cody users can configure the `.cody/ignore` file to specify files or folders from your codebase to be ignored as context by Cody through the following steps:
144
-
145
-
## Enabling Unstable Features
146
-
147
-
To use the ignore context feature, you first need to enable unstable features in Cody. Here's how:
148
-
149
-
1. Open your settings in Cody Extension
150
-
2. Next, go to the `settings.json` file
151
-
3. Add a new line: `"cody.unstableFeatures": true`.
152
-
153
-
This will enable experimental features, including the ignore context feature.
154
-
155
-
## Using the Ignore Context Feature
156
-
157
-
To ignore specific files or folders from the context Cody took, you need to create an `ignore` file for your project. Here's how:
158
-
159
-
1. Create a new folder in your project root named `.cody`.
160
-
2. Inside the `.cody` folder, create a file named `ignore`.
161
-
3. In the `ignore` file, specify the files or folders you want to ignore.
162
-
163
-
The `.cody/ignore` file works similarly to a `.gitignore` file. If you want to ignore a file named `secret.json`, you would add `secret.json` to your `.cody/ignore` file. If you're going to ignore a folder called `lib/shared`, you would add `lib/shared/` to your `.cody/ignore` file.
164
-
165
-
Once a file or folder is added to the `.cody/ignore` file, Cody will no longer provide autocomplete suggestions for that file or folder, and it will not appear in your chat results.
0 commit comments