Skip to content

Commit 1d554c5

Browse files
MaedahBatoolzahidalidevtaras-yemetsEmi (stephen) Gutekanstaramaraju
authored
Docs working branch for Sourcegraph November release (#805)
This is the docs working branch for SG Nov 25th release. It has release docs for: - Sunsetting commands and custom commands - New docs for prompts and prompts library - Admin pre-instructions for Cody - Enterprise model configuration --------- Co-authored-by: Zahid Ali <[email protected]> Co-authored-by: Taras Yemets <[email protected]> Co-authored-by: Emi (stephen) Gutekanst <[email protected]> Co-authored-by: Aravind Ramaraju <[email protected]> Co-authored-by: David Veszelovszki <[email protected]>
1 parent 9b99f04 commit 1d554c5

24 files changed

+1685
-1010
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sourcegraph Docs
22

3-
<!-- Working branch for October 30th 2024 Release -->
3+
<!-- Working branch for Nov 25th 2024 Release -->
44

55
Welcome to the Sourcegraph documentation! We're excited to have you contribute to our docs. We've recently rearchitectured our docs tech stack — powered by Next.js, TailwindCSS and deployed on Vercel. This guide will walk you through the process of contributing to our documentation using the new tech stack.
66

@@ -148,7 +148,7 @@ As you make changes to the documentation, the development server will automatica
148148

149149
### Previewing Vercel Deployments
150150

151-
When you open a PR Vercel deploys and provides you with a preview deployment link. To view your deployment, click the "Visit Preview" and then append `/docs` at the end of the URL. The original link gives you a `404`.
151+
When you open a PR Vercel deploys and provides you with a preview deployment link. To view your deployment, click the "Visit Preview" and then append `/docs` at the end of the URL. The original link gives you a `404`.
152152

153153
![CleanShot 2024-11-05 at 10 11 29@2x](https://github.com/user-attachments/assets/b0911e2e-95a7-4f56-b2ff-b659d13077d8)
154154

docs.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const config = {
2-
DOCS_LATEST_VERSION: '5.9'
2+
DOCS_LATEST_VERSION: '5.10'
33
};
44

55
module.exports = config;

docs/cody/capabilities/chat.mdx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,9 @@ Smart Apply also supports the executing of commands in the terminal. When you as
8686

8787
Cody keeps a history of your chat sessions. You can view it by clicking the **History** button in the chat panel. You can **Export** it to a JSON file for later use or click the **Delete all** button to clear the chat history.
8888

89-
## Prompts and Commands
89+
## Prompts
9090

91-
Cody offers quick, ready-to-use [prompts and commands](/cody/capabilities/commands) for common actions to write, describe, fix, and smell code. These allow you to run predefined actions with smart context-fetching anywhere in the editor, like:
92-
93-
- **New Chat**: Ask Cody a question
94-
- **Document Code**: Add code documentation
95-
- **Edit Code**: Edit code with instructions
96-
- **Explain Code**: Describe your code with more details
97-
- **Generate Unit Tests**: Write tests for your code
98-
99-
<video width="1920" height="1080" loop playsInline controls style={{ width: '100%', height: 'auto' }}>
100-
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/cody-prompts-102024-2.mp4" type="video/mp4" />
101-
</video>
102-
103-
Read more about [prompts and commands](/cody/capabilities/commands).
91+
Cody offers quick, ready-to-use [prompts](/cody/capabilities/commands) for common actions to write, describe, fix, and smell code. Read more about [prompts](/cody/capabilities/commands) here.
10492

10593
## Ask Cody to write code
10694

docs/cody/capabilities/commands.mdx

Lines changed: 54 additions & 281 deletions
Large diffs are not rendered by default.

docs/cody/capabilities/debug-code.mdx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ sum(3 , 4);
2323

2424
When you try to `console.log` the `result`, it does not print the correct summed value. Cody can help you both identify the error and provide a solution to fix it. Let's debug the code snippet. Paste the code snippet inside the Cody chat window and ask Cody to fix it.
2525

26-
<video width="1920" height="1080" loop playsInline controls style={{ width: '100%', height: 'auto' }}>
27-
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/fix-code.mp4" type="video/mp4" />
28-
</video>
29-
3026
In addition, Cody helps you reduce the chances of getting syntax and typo errors. The Cody IDE extensions provide context-aware suggestions based on your codebase, helping you avoid common mistakes and reduce debugging time.
3127

3228
## Detecting code smell
3329

3430
Cody can detect early code smells to ensure coding best practices and quality and provide suggestions to improve your code. By detecting such potential errors early on, you can avoid scalability and code maintainability issues that might arise in the future.
3531

36-
You can detect code smells by the **Find Code Smells** command from the Prompts drop-down menu in the chat panel.
32+
You can detect code smells by the **find-code-smells** prompt from the Prompts drop-down menu in the chat panel. If you want to refine your debugging process, you can create a new prompt from the Prompt Library and use it to debug your code.
3733

3834
## Code Actions
3935

docs/cody/capabilities/ignore-context.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ The `exclude` field can also include a catch-all condition, such as a `regexp` t
9292

9393
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.
9494

95-
![commands-disabled-exclude-rules](https://storage.googleapis.com/sourcegraph-assets/Docs/commands-disabled-082024.png)
96-
9795
### Both `include` and `exclude` rules are specified
9896

9997
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,

docs/cody/capabilities/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<QuickLink title="Autocomplete" icon='installation' href="/cody/capabilities/autocomplete" description="Suggests code completions as you type, utilizing context from your code, open files, and file history." />
1212

13-
<QuickLink title="Prompts & Commands" icon='theming' href="/cody/capabilities/commands" description="Automate key tasks in your workflow with premade and customizable prompts." />
13+
<QuickLink title="Prompts & Prompt Library" icon='theming' href="/cody/capabilities/commands" description="Automate key tasks in your workflow with premade and customizable prompts." />
1414

1515
<QuickLink title="OpenCtx Context Providers" icon='presets' href="/cody/capabilities/openctx" description="Add additional context sources from outside of your code base by leveraging OpenCtx Providers." />
1616

docs/cody/clients/cody-with-sourcegraph.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,9 @@ If Cody's answer isn't helpful, you can try asking again with a different contex
5555
![re-run-prompts](https://storage.googleapis.com/sourcegraph-assets/Docs/rerun-prompt-web-0724.jpg)
5656

5757
<Callout type="tip">For a detailed breakdown of Cody's capabilities across different clients [read these feature parity docs](/cody/clients/feature-reference).</Callout>
58+
59+
## Prompts
60+
61+
Cody allows you create quick, ready-to-use [prompts](/cody/capabilities/commands) to automate key tasks in your workflow. Prompts are created and saved in the Prompt Library and can be accessed from the **Tools > Prompt Library** in the top navigation bar in your Sourcegraph instance.
62+
63+
![cody-web-prompts](https://storage.googleapis.com/sourcegraph-assets/Docs/cody-web-prompts-1124.png)
Lines changed: 73 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,117 @@
1-
# Cody on Sourcegraph Enterprise
1+
# Cody for Enterprise
22

33
<p className="subtitle">Cody enhances your coding experience by providing intelligent code suggestions, context-aware completions, and advanced code analysis. These docs will help you use Cody on your Sourcegraph Enterprise instance.</p>
44

55
<LinkCards>
66
<LinkCard href="https://sourcegraph.com/contact/request-info" imgSrc="https://sourcegraph.com/.assets/img/sourcegraph-mark.svg" imgAlt="Cody Enterprise" title="Cody Enterprise" description="Get in touch with our team to try Cody for Sourcegraph Enterprise." />
77
</LinkCards>
88

9-
## Cody Enterprise features
9+
## Setting up Cody Enterprise
1010

11-
To cater to your Enterprise requirements, Cody offers the following features:
11+
You can set up Cody for your Enterprise instance by two methods:
1212

13-
### IDE token expiry
13+
1. Sourcegraph Cloud
14+
2. Self-hosted Sourcegraph
1415

15-
Site administrators can set the duration of access tokens for users connecting Cody from their IDEs (VS Code, JetBrains, etc.). This can be configured from the **Site admin** page of the Sourcegraph Enterprise instance. Available options include **7, 14, 30, 60, and 90 days**.
16+
## Cody on Sourcegraph Cloud
1617

17-
![ide-token-expiry](https://storage.googleapis.com/sourcegraph-assets/Docs/token-expiry.png)
18+
With [Sourcegraph Cloud](/cloud/), you get Cody as a managed service, and you **do not** need to enable Cody as is required for self-hosted setup. However, by contacting your account manager, Cody can still be enabled or disabled on-demand on your Sourcegraph instance.
1819

19-
### Guardrails
20+
## Self-hosted Sourcegraph Enterprise
2021

21-
<Callout type= "note">Guardrails for public code is currently in Beta and is supported with VS Code and JetBrains IDEs extensions.</Callout>
22+
### Prerequisites
2223

23-
Open source attribution guardrails for public code, commonly called copyright guardrails, reduce the exposure to copyrighted code. This involves implementing a verification mechanism within Cody to ensure that any code generated by the platform does not replicate open source code.
24+
- You have Sourcegraph version `5.1.0` or more
25+
- A Sourcegraph Enterprise subscription with [Cody Gateway](/cody/core-concepts/cody-gateway) or an account with a third-party LLM provider
2426

25-
Guardrails for public code are available to all Sourcegraph Enterprise instances and are **disabled** by default. You can enable them from the Site configuration section by setting `attribution.enabled` to `true`.
27+
### Enable Cody on your Sourcegraph instance
2628

27-
Guardrails don't differentiate between license types. It matches any code snippet that is at least **ten lines** long from the **290,000** indexed open source repositories.
29+
Site admins can only enable Cody on the Sourcegraph instance. To do so,
2830

29-
### Admin controls
31+
- First, configure your desired LLM provider either by [using Sourcegraph Cody Gateway](/cody/core-concepts/cody-gateway) or by directly using a third-party LLM provider
32+
- Next, go to **Site admin > Site configuration** (`/site-admin/configuration`) on your instance and set:
3033

31-
<Callout type="note">Admin controls are supported with VS Code and JetBrains IDE extension.</Callout>
34+
```json
35+
{
36+
// [...]
37+
"cody.enabled": true,
38+
"completions": {
39+
"provider": "sourcegraph"
40+
}
41+
}
42+
```
3243

33-
Site administrators have selective control over users' access to Cody Enterprise, which is managed via the Sourcegraph role-based access control system. This provides a more intuitive user interface for assigning permission to use Cody.
44+
- Cody is enabled on your self-hosted Sourcegraph enterprise instance
3445

35-
### Analytics
46+
## Disable Cody
3647

37-
<Callout type= "note">Cody Analytics are supported with VS Code IDE extension and on the latest versions of JetBrains IDEs.</Callout>
48+
To turn Cody off:
3849

39-
Cody Enterprise users can view analytics for their instance. A separately managed cloud service for Cody analytics handles user auth, gets metrics data from Sourcegraph's BigQuery instance, and visualizes the metrics data.
50+
- Go to **Site admin > Site configuration** (`/site-admin/configuration`) on your instance and set:
4051

41-
The following metrics are available for Cody Enterprise users:
52+
```json
53+
{
54+
// [...]
55+
"cody.enabled": false
56+
}
57+
```
4258

43-
| **Metric Type** | **What is measured?** |
44-
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45-
| Active users | - Total active users <br /> - Average daily users <br /> - Average no. of days each user used Cody (of last 30 days) <br /> - Cody users by day (last 30 days) <br /> - Cody users by month (last two months) <br /> - Cody users by number of days used |
46-
| Completions | - Total accepted completions <br /> - Minutes saved per completion <br /> - Hours saved by completions <br /> - Cody completions by day <br /> - Completions acceptance rate <br /> - Weighted completions acceptance rate <br /> - Average completion latency <br /> - Acceptance rate by language <br /> |
47-
| Chat | - Total chat events <br /> - Minutes saved per chat <br /> - Hours saved by chats <br /> - Cody chats by day |
48-
| Commands | - Total command events <br /> - Minutes saved per command <br /> - Hours saved by commands <br /> - Cody commands by day <br /> - Most used commands |
59+
## Enable Cody only for some users
4960

50-
To enable Cody Analytics:
61+
How to enable Cody only for _some_ users depends on what version of Sourcegraph you are running.
5162

52-
- Create an account on [Sourcegraph Accounts](https://accounts.sourcegraph.com/)
53-
- A user already having a Sourcegraph.com account gets automatically migrated to Sourcegraph Accounts. Users can sign in to Cody Analytics using their email and password
54-
- Users without a Sourcegraph.com account should contact one of our team members. They can help with both the account setup and assigning instances to specific users
55-
- Map your user account to a Sourcegraph instance, and this gives you access to Cody analytics
63+
### Sourcegraph v5.3+
5664

57-
### Multi-repository context
65+
In Sourcegraph v5.3+, access to Cody is managed via user roles. By default, all users have access.
5866

59-
Cody supports multi-repository context, allowing you to search up to 10 repositories simultaneously for relevant information. Open a new chat, type `@`, and select `Remote Repositories.`
67+
First, ensure Cody is enabled in your site configuration. Go to **Site admin > Site configuration** (`/site-admin/configuration`) on your instance and set:
6068

61-
Keep @-mentioning repos that you want to include in your context. This flexibility lets you get more comprehensive and accurate responses by leveraging information across multiple codebases.
69+
```json
70+
{
71+
// [...]
72+
"cody.enabled": true,
73+
// Make sure cody.restrictUsersFeatureFlag is not in your configuration! If it is, remove it.
74+
}
75+
```
6276

63-
### @-mention directory
77+
<Callout type="info"> Ensure `cody.restrictUsersFeatureFlag` is **not** in your site configuration. If it is, remove it or else the old feature-flag approach from Sourcegraph 5.2 and earlier will be used.</Callout>
6478

65-
To better support teams working with large monorepos, Enterprise users can `@-mention` directories when chatting with Cody. This helps you define more specific directories and sub-directories within that monorepo to give more precise context.
79+
Next, go to **Site admin > Users & Auth > Roles** (`/site-admin/roles`) on your instance. On that page, you can:
6680

67-
To do this, type `@` in the chat, and then select **Directories** to search other repositories for context in your codebase.
81+
- Control whether users **by default** have access to Cody (expand `User [System]` and toggle **Cody** > **Access** as desired)
82+
- Control whether groups of users have access to Cody (`+Create role` and enable the **Cody** > **Access** toggle as desired)
6883

69-
![@-mention-directory](https://storage.googleapis.com/sourcegraph-assets/Docs/cody-ent-at-mention-dir-1124.png)
84+
### Sourcegraph v5.2 and earlier
7085

71-
Please note that you can only `@-mention` remote directories (i.e., directories in your Sourcegraph instance) but not local directories. This means any recent changes to your directories can't be utilized as context until your Sourcegraph instance re-indexes any changes.
86+
In Sourcegraph v5.2 and earlier, you should use the feature flag `cody` to turn Cody on selectively for some users. To do so:
7287

73-
If you want to include recent changes that haven't been indexed in your Sourcegraph instance, you can `@-mention` specific files, lines of code, or symbols.
88+
- Go to **Site admin > Site configuration** (`/site-admin/configuration`) on your instance and set:
7489

75-
## Supported LLM models
90+
```json
91+
{
92+
// [...]
93+
"cody.enabled": true,
94+
"cody.restrictUsersFeatureFlag": true
95+
}
96+
```
7697

77-
Sourcegraph Enterprise supports different LLM providers and models, such as models from Anthropic and OpenAI. You can do this by adjusting your Sourcegraph instance configuration.
98+
- Next, go to **Site admin > Feature flags** (`/site-admin/feature-flags`)
99+
- Add a feature flag called `cody`
100+
- Select the `boolean` type and set it to `false`
101+
- Once added, click on the feature flag and use **add overrides** to pick users that will have access to Cody
78102

79-
<FeatureParity type='ent' />
80-
For the supported LLM models listed above, refer to the following notes:
103+
![add-overrides](https://user-images.githubusercontent.com/25070988/235454594-9f1a6b27-6882-44d9-be32-258d6c244880.png)
81104

82-
1. Microsoft Azure is planning to deprecate the APIs used in Sourcegraph version `>5.3.3` on July 1, 2024 [Source](https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation)
83-
2. Claude 2.1 is not recommended
84-
3. Sourcegraph doesn’t recommend using the GPT-4 (non-Turbo), Claude 1, or Claude 2 models anymore
85-
4. Only supported through legacy completions API
86-
5. BYOK (Bring Your Own Key) with managed services are only supported for Self-hosted Sourcegraph instances
87-
6. GPT-4 and GPT-4o for completions have a bug that is resulting in many failed completions
105+
## Configure Cody for LLM providers
88106

89-
### Supported model configuration
107+
Cody supports several LLM providers and models. You can access these models via the Cody Gateway, directly using your own model provider account or infrastructure.
90108

91-
Use the drop-down menu to make your desired selection and get a detailed breakdown of the supported model configuration for each provider on Cody Enterprise. This is an on-site configuration. Admins should pick a value from the table for `chatModel` to configure their chat model.
109+
There are two ways of configuring Cody for LLM providers:
92110

93-
<FeatureParity type='configuration' />
111+
<QuickLinks>
94112

95-
For the supported LLM model configuration listed above, refer to the following notes:
113+
<QuickLink title="Completions" icon='lightbulb' href="/cody/enterprise/completions-configuration" description="How to configure Cody using the completions." />
96114

97-
1. Microsoft Azure is planning to deprecate the APIs used in Sourcegraph version `>5.3.3` on July 1, 2024 [Source](https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation)
98-
2. Claude 2.1 is not recommended
99-
3. Sourcegraph doesn't recommend GPT-4 non-turbo, Claude 1 or 2 models
100-
4. Only supported through legacy completions API
101-
5. BYOK (Bring Your Own Key) with managed services are only supported for Self-hosted Sourcegraph instances
115+
<QuickLink title="Model Configuration" icon='installation' href="/cody/enterprise/model-configuration" description="How to configure Cody using the model configuration." />
116+
117+
</QuickLinks>

0 commit comments

Comments
 (0)