Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sourcegraph Docs

<!-- Working branch for October 2024 Release -->
<!-- Working branch for October 30th 2024 Release -->

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.

Expand Down
2 changes: 1 addition & 1 deletion docs.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const config = {
DOCS_LATEST_VERSION: '5.8'
DOCS_LATEST_VERSION: '5.9'
};

module.exports = config;
68 changes: 55 additions & 13 deletions docs/admin/repo/perforce.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Sourcegraph will now talk to the Perforce host and sync the configured `depots`

It's worthwhile to note some limitations of this process:

- When syncing depots either [git p4](https://git-scm.com/docs/git-p4) or [p4-fusion](https://github.com/salesforce/p4-fusion) (recommended) are used to convert Perforce depots into git repositories so that Sourcegraph can index them.
- When syncing depots [p4-fusion](https://github.com/salesforce/p4-fusion) is used to convert Perforce depots into git repositories so that Sourcegraph can index them.
- Rename of a Perforce depot, including changing the depot on the Perforce server or the `repositoryPathPattern` config option, will cause a re-import of the depot.
- Unless [permissions syncing](#repository-permissions) is enabled, Sourcegraph is not aware of the depot permissions, so it can't enforce access restrictions.

Expand Down Expand Up @@ -126,11 +126,11 @@ If file-level permissions is not enabled, Sourcegraph provides limited support f

### File-level permissions

File-level permissions make the [syncing of subdirectories to match permission boundaries](#syncing-subdirectories-to-match-permission-boundaries) unnecessary.
File-level permissions eliminate the need for [syncing subdirectories to match permission boundaries](#syncing-subdirectories-to-match-permission-boundaries).

To enable file-level permissions:

1. Enable [the feature in the site config](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@2a716bd/-/blob/schema/site.schema.json?L227-249):
1. Add the following entry to your [site configuration file](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@2a716bd/-/blob/schema/site.schema.json?L227-249):

```json
{
Expand All @@ -150,27 +150,70 @@ To enable file-level permissions:
}
```

1. Save the configuration. Permissions will be synced in the background based on your [Perforce protects file](https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_protect.html).
1. Save the configuration.

#### Handling Host rules in the protects file
Permissions will be synced in the background based on your [Perforce protects file](https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_protect.html).

When file-level permissions are enabled, Sourcegraph will read the Perforce protects file to determine what users can access. Because Sourcegraph originates all depot access from one host, protects rules with a Host field cannot be followed exactly. By default, they are parsed as if they apply to all hosts, which can result in users losing access when they should have access. If you have protects rules with hosts that are causing lost access for users, you can set `ignoreRulesWithHost` to `true` in the code host configuration.
#### Handling IP-based rules

Perforce's `protects` table allows administrators to define fine-grained access controls based on user identities and host IP addresses. By default, Sourcegraph applies all rules from the `protects` table without considering host-specific restrictions, effectively treating all host rules as the wildcard `*`. This behavior can lead to users having unintended access to repositories or files that should be restricted based on their IP addresses.

If your Perforce environment relies heavily on host-based permissions, it's crucial to configure Sourcegraph appropriately to respect these restrictions. This documentation provides detailed instructions on how to enforce or ignore host rules in Sourcegraph when integrating with Perforce.

##### Default Behavior

By default, Sourcegraph:

- **Applies all rules** in the Perforce `protects` table.
- **Ignores host-specific restrictions**, treating all host fields as `*`.

**Implication**: Users may gain access to resources that should be restricted based on their IP addresses.

##### Configuration Options

To ensure Sourcegraph handles host rules according to your requirements, you have two additional options:

1. **Enforce Host Rules**: Configure Sourcegraph to respect and enforce IP-based restrictions defined in the `protects` table.
2. **Ignore Host-Specific Rules**: Configure Sourcegraph to disregard any rules with a host value other than `*`.

##### Enforcing host rules

If you want Sourcegraph to enforce host-specific permissions, you need to enable IP restriction enforcement in your [site configuration](https://sourcegraph.com/docs/admin/config/site_config):

```json
{
"authorization": {
"subRepoPermissions": true,
"ignoreRulesWithHost": true
}
{
"experimentalFeatures": {
"subRepoPermissions": {
"enabled": true,
"enforceIPRestrictions": true
}
}
}
```
<Callout type="warning">
When `enforceIPRestrictions` is set to `true`, Sourcegraph will use the user's IP address to apply Perforce permissions at the user level. It uses the final `X-Forwarded-For` header in the request to identify the user's IP. Note that this header can be easily spoofed, so ensure your load balancer or proxy handles `X-Forwarded-For` headers securely.
</Callout>

##### Ignore rules with host

To ignore rules that have a host value other than `*`, set `ignoreRulesWithHost` to `true` in your **code host configuration**:

```json
{
"authorization": {
"subRepoPermissions": true,
"ignoreRulesWithHost": true
}
}
```

With this setting, Sourcegraph will ignore any rules with a host other than `*`, treating them as if they do not exist.

### Notes about permissions

- Sourcegraph users are mapped to Perforce users based on their verified email addresses.
- As long as a user has been granted at least `Read` permissions in Perforce they will be able to view content in Sourcegraph.
- As a special case, commits in which a user does not have permissions to read any files are hidden. If a user can read a subset of files in a commit, only those files are shown.
- [The host field from protections are not supported](#known-issues-and-limitations).
- [file-level permissions must be disabled for Batch Changes to work](#known-issues-and-limitations).
- Setting `authz.enforceForSiteAdmins` to `true` in the site configuration will enforce permissions for admin users. They may not be able to see repositories and their contents if their Sourcegraph user account email does not match with their email on the Perforce server.

Expand Down Expand Up @@ -228,7 +271,6 @@ When file-level permissions are enabled, Sourcegraph will read the Perforce prot
We are actively working to significantly improve Sourcegraph's Perforce support. Please [file an issue](https://github.com/sourcegraph/sourcegraph/issues) to help us prioritize any specific improvements you'd like to see.

- Sourcegraph was initially built for Git repositories only, so it stores Perforce depots as Git repositories when syncing. Perforce concepts and languages are expressed in the UI, but under the hood, Git tools are used.
- The [host field](https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_protect.html#Form_Fields_..361) in protections is not supported.
- Batch Changes does not support [file-level permissions](#file-level-permissions) (also known as sub-repo permissions)
- Batch Changes does not handle the shelved changelist other than to query the Perforce server for its status.
- Permalinks with Changelist Id do not work yet
Expand Down
22 changes: 1 addition & 21 deletions docs/code-search/features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,7 @@ src search --json --stream -- "/$re2_regex/" \

## Search experience

<Callout type="note">There is a new search experience in Sourcegraph `v5.6.0` and more. It is currently in the Beta stage.</Callout>

Users on Sourcegraph instance `v5.6.0` can try out the new Code Search experience by toggling the **Enable** button under **Try a new, faster UX** drop-down in the top right corner of the Code Search page.

For Sourcegraph Enterprise users, their site admins must enable the new search experience first. Admins can go to **Site admin > Feature flags** from your Enterprise Sourcegraph instance to do so. Here, you can find the following feature flags that you should configure as follows:

- `web-next`: `false`
- `web-next-rollout`: `true`
- `web-next-toggle`: `true`

This configuration will work as follows:

- `web-next`: When this flag is set the user will get the new web app for any page that is available in the new web app
- `web-next-rollout`: When this flag is set the user will get the new web app for pages that have been explicitly marked as `rolled out`
- `web-next-toggle`: When enabled users see a toggle in the top navbar that allows them to enable/disable the new web app for themselves

Which flags configuration admins should set depends on the following scenarios:

- If an admin want’s to allow users to opt-in to the new experience, then you should enable `web-next-toggle` for everyone
- If you want to enable the new web app for everyone you should set `web-next-rollout`
- If you want to allow people to opt-out they should additionally set `web-next-toggle`
Users on Sourcegraph instance `v5.9.0` or more get the improved and new Code Search experience set by default. Sourcegraph Enterprise users' site admins can optionally opt-out and revert to the old view.

You get the following improvements:

Expand Down
12 changes: 12 additions & 0 deletions docs/cody/capabilities/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ Prompts work in the same way as commands. Inside Cody's chat window there is a d

![prompts-in-dropdown](https://storage.googleapis.com/sourcegraph-assets/Docs/using-prompts.png)

## Promoted Prompts

<Callout type="note">Promoted Prompts are supported in VS Code and Cody Web.</Callout>

Promoted Prompts allow admins to highlight Prompts to users at the top of a Prompt list in Cody chat, directing users to use specific Prompts that encourage best practices within the organization. Admins can promote a Prompt by checking the Promoted box in the Prompt edit screen.

![promote-a-prompt](https://storage.googleapis.com/sourcegraph-assets/Docs/promote-promt-1024.png)

Promoted Prompts are marked with an icon next to their name and appear at the top of the Prompt list in the Cody chat window in an IDE and the Prompt Library.

![icon-promoted-prompts](https://storage.googleapis.com/sourcegraph-assets/Docs/promote-prompt-icon-1024.png)

## Commands

Cody offers quick, ready-to-use **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 autocomplete and chat, commands will search for context in your codebase to provide more contextually aware and informed answers.
Expand Down
50 changes: 25 additions & 25 deletions docs/cody/clients/feature-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@

## Chat

| **Feature** | **VS Code** | **JetBrains** | **Web** | **CLI** |
| ---------------------------------------- | ----------- | ------------- | -------------------- | ------- |
| Chat with Cody | ✅ | ✅ | ✅ | ✅ |
| Chat history | ✅ | ✅ | ✅ | |
| Clear chat history | ✅ | ✅ | ✅ | |
| Edit sent messages | ✅ | ❌ | ✅ | |
| Show context files | ✅ | ✅ | ✅ | |
| @-file | ✅ | ✅ | ✅ | |
| @-symbol | ✅ | ❌ | ✅ | |
| Ollama support (experimental) | ✅ | ✅ | ❌ | |
| LLM Selection | ✅ | ✅ | ✅ | |
| **Context Selection** | | | | |
| Single-repo context | ✅ | ✅ | ✅ | |
| Multi-repo context | ❌ | ❌ | ✅ (public code only) | ❌ |
| Local context | ✅ | ✅ | ❌ | ✅ |
| OpenCtx context providers (experimental) | ✅ | ❌ | ❌ | ❌ |
| **Prompts and Commands** | | | |
| Access to prompts and Prompt library | ✅ | ✅ | ✅ | |
| Custom commands | ✅ | ❌ | ❌ | ❌ |
| Edit code | ✅ | ✅ | ❌ | ❌ |
| Generate unit test | ✅ | ✅ | ❌ | ❌ |
| Ask Cody to Fix | ✅ | ✅ | ❌ | ❌ |
| **Feature** | **VS Code** | **JetBrains** | **Web** | **Visual Studio** | **CLI** |
| ---------------------------------------- | ----------- | ------------- | -------------------- | ----------------- | ------- |
| Chat with Cody | ✅ | ✅ | ✅ | ✅ | ✅ |
| Chat history | ✅ | ✅ | ✅ | | ❌ |
| Clear chat history | ✅ | ✅ | ✅ | ✅ | ❌ |
| Edit sent messages | ✅ | ❌ | ✅ | ✅ | ❌ |
| Show context files | ✅ | ✅ | ✅ | ✅ | ❌ |
| @-file | ✅ | ✅ | ✅ | ✅ | ❌ |
| @-symbol | ✅ | ❌ | ✅ | ✅ | ❌ |
| Ollama support (experimental) | ✅ | ✅ | ❌ | ✅ | ❌ |
| LLM Selection | ✅ | ✅ | ✅ | ✅ | ❌ |
| **Context Selection** | | | | | |
| Single-repo context | ✅ | ✅ | ✅ | ✅ | ❌ |
| Multi-repo context | ❌ | ❌ | ✅ (public code only) | ❌ | ❌ |
| Local context | ✅ | ✅ | ❌ | ✅ | ✅ |
| OpenCtx context providers (experimental) | ✅ | ❌ | ❌ | ❌ | ❌ |
| **Prompts and Commands** | | | | | |
| Access to prompts and Prompt library | ✅ | ✅ | ✅ | ✅ | ❌ |
| Promoted Prompts | ✅ | ❌ | ✅ | ❌ | ❌ |
| Edit code | ✅ | ✅ | ❌ | ❌ | ❌ |
| Generate unit test | ✅ | ✅ | ❌ | ❌ | ❌ |
| Ask Cody to Fix | ✅ | ✅ | ❌ | ❌ | ❌ |

## Code Autocomplete

Expand All @@ -46,10 +46,10 @@ Few exceptions that apply to Cody Pro and Cody Enterprise users:

<Accordion title="For Cody Enterprise">

- Admin LLM selection is suported on VS Code, JetBrains, and Web both for chat and code autocomplete
- Multi-repo context is supported on VS Code, JetBrains, and Web
- Admin LLM selection is suported on VS Code, JetBrains, Visual Studio, and Web both for chat and code autocomplete
- Multi-repo context is supported on VS Code, JetBrains, Visual Studio, and Web
- [Guardrails](/cody/clients/enable-cody-enterprise#guardrails) are supported on VS Code, JetBrains, and Web
- [Repo-based Cody Context Filters](/cody/capabilities/ignore-context#cody-context-filters) are supported on VS Code, JetBrains, and Web
- `@-mention` directories are supported on VS Code, JetBrains, and Web
- `@-mention` directories are supported on VS Code, JetBrains, Visual Studio, and Web

</Accordion>
8 changes: 3 additions & 5 deletions docs/cody/clients/install-jetbrains.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ The chat interface is designed intuitively. Your very first chat input lives at

Since your first message to Cody anchors the conversation, you can return to the top chat box anytime, edit your prompt, or re-run it using a different LLM model.

<video width="1920" height="1080" loop playsInline controls style={{ width: '100%', height: 'auto', aspectRatio: '1920 / 1080' }}>
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/jb-chat-interface-0824.mp4" type="video/mp4" />
</video>
![chat-interface](https://storage.googleapis.com/sourcegraph-assets/Docs/jb-chat-interface-102024.png)

<Callout type="info"> Users should be on the Cody for JetBrains extension v2023.2 or more to get this new and improved chat UI.</Callout>

Expand Down Expand Up @@ -138,7 +136,7 @@ For chat messages where Cody provides multiple code suggestions, you can apply e

When you start a new Cody chat, the chat input window opens with a default `@-mention` context chips for all the context it intends to use. This context is based on your current repository and current file (or a file selection if you have code highlighted).

![jb-context-retrieval](https://storage.googleapis.com/sourcegraph-assets/Docs/jb-context-retrieval-0824.jpg)
![jb-context-retrieval](https://storage.googleapis.com/sourcegraph-assets/Docs/jb-context-retrieval-102024.png)

At any point in time, you can edit these context chips or remove them completely if you do not want to use these as context. Any chat without a context chip will instruct Cody to use no codebase context. However, you can always provide an alternate `@-mention` file to let Cody use it as a new source of context.

Expand Down Expand Up @@ -210,7 +208,7 @@ Cody with JetBrains offers quick, ready-to-use [prompts and commands](/cody/capa
- **Smell Code**: Finds code smells in your file
- **Explain Code**: Expains code in your file

![jetbrains-prompts-commands](https://storage.googleapis.com/sourcegraph-assets/Docs/jb-prompts-commands-0824.jpg)
![jetbrains-prompts-commands](https://storage.googleapis.com/sourcegraph-assets/Docs/jb-prompts-commands-102024.png)

Let's learn about how to use some of these commands:

Expand Down
Loading
Loading