Skip to content

Commit 60a3528

Browse files
authored
V4 (#311)
Sourcebot V4 introduces authentication, performance improvements and code navigation. Checkout the [migration guide](https://docs.sourcebot.dev/self-hosting/upgrade/v3-to-v4-guide) for information on upgrading your instance to v4. ### Changed - [**Breaking Change**] Authentication is now required by default. Notes: - When setting up your instance, email / password login will be the default authentication provider. - The first user that logs into the instance is given the `owner` role. ([docs](https://docs.sourcebot.dev/docs/more/roles-and-permissions)). - Subsequent users can request to join the instance. The `owner` can approve / deny requests to join the instance via `Settings` > `Members` > `Pending Requests`. - If a user is approved to join the instance, they are given the `member` role. - Additional login providers, including email links and SSO, can be configured with additional environment variables. ([docs](https://docs.sourcebot.dev/self-hosting/configuration/authentication)). - Clicking on a search result now takes you to the `/browse` view. Files can still be previewed by clicking the "Preview" button or holding `Cmd` / `Ctrl` when clicking on a search result. [#315](#315) ### Added - [Sourcebot EE] Added search-based code navigation, allowing you to jump between symbol definition and references when viewing source files. [Read the documentation](https://docs.sourcebot.dev/docs/search/code-navigation). [#315](#315) - Added collapsible filter panel. [#315](#315) ### Fixed - Improved scroll performance for large numbers of search results. [#315](#315)
1 parent 536bf8a commit 60a3528

File tree

169 files changed

+7127
-1775
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+7127
-1775
lines changed

.cursor/rules/style.mdc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
- Always use 4 spaces for indentation
7+
- Filenames should always be camelCase. Exception: if there are filenames in the same directory with a format other than camelCase, use that format to keep things consistent.

.env.development

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ SRC_TENANT_ENFORCEMENT_MODE=strict
1818
AUTH_SECRET="00000000000000000000000000000000000000000000"
1919
AUTH_URL="http://localhost:3000"
2020
# AUTH_CREDENTIALS_LOGIN_ENABLED=true
21-
# AUTH_GITHUB_CLIENT_ID=""
22-
# AUTH_GITHUB_CLIENT_SECRET=""
23-
# AUTH_GOOGLE_CLIENT_ID=""
24-
# AUTH_GOOGLE_CLIENT_SECRET=""
21+
# AUTH_EE_GITHUB_CLIENT_ID=""
22+
# AUTH_EE_GITHUB_CLIENT_SECRET=""
23+
# AUTH_EE_GOOGLE_CLIENT_ID=""
24+
# AUTH_EE_GOOGLE_CLIENT_SECRET=""
2525

2626
DATA_CACHE_DIR=${PWD}/.sourcebot # Path to the sourcebot cache dir (ex. ~/sourcebot/.sourcebot)
2727
# CONFIG_PATH=${PWD}/config.json # Path to the sourcebot config file (if one exists)

CHANGELOG.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
Sourcebot V4 introduces authentication, performance improvements and code navigation. Checkout the [migration guide](https://docs.sourcebot.dev/self-hosting/upgrade/v3-to-v4-guide) for information on upgrading your instance to v4.
11+
12+
### Changed
13+
- [**Breaking Change**] Authentication is now required by default. Notes:
14+
- When setting up your instance, email / password login will be the default authentication provider.
15+
- The first user that logs into the instance is given the `owner` role. ([docs](https://docs.sourcebot.dev/docs/more/roles-and-permissions)).
16+
- Subsequent users can request to join the instance. The `owner` can approve / deny requests to join the instance via `Settings` > `Members` > `Pending Requests`.
17+
- If a user is approved to join the instance, they are given the `member` role.
18+
- Additional login providers, including email links and SSO, can be configured with additional environment variables. ([docs](https://docs.sourcebot.dev/self-hosting/configuration/authentication)).
19+
- Clicking on a search result now takes you to the `/browse` view. Files can still be previewed by clicking the "Preview" button or holding `Cmd` / `Ctrl` when clicking on a search result. [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
20+
21+
### Added
22+
- [Sourcebot EE] Added search-based code navigation, allowing you to jump between symbol definition and references when viewing source files. [Read the documentation](https://docs.sourcebot.dev/docs/search/code-navigation). [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
23+
- Added collapsible filter panel. [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
24+
- Added Sourcebot API key management for external clients. [#311](https://github.com/sourcebot-dev/sourcebot/pull/311)
25+
26+
### Fixed
27+
- Improved scroll performance for large numbers of search results. [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
28+
1029
## [3.2.1] - 2025-05-15
1130

1231
### Added
@@ -93,8 +112,8 @@ Sourcebot v3 is here and brings a number of structural changes to the tool's fou
93112
### Added
94113
- Added parallelized repo indexing and connection syncing via Redis & BullMQ. See the [architecture overview](https://docs.sourcebot.dev/self-hosting/overview#architecture).
95114
- Added repo indexing progress indicators in the navbar.
96-
- Added authentication support via OAuth or email/password. For instructions on enabling, see [this doc](https://docs.sourcebot.dev/self-hosting/more/authentication).
97-
- Added the following UI for managing your deployment when **[auth is enabled](https://docs.sourcebot.dev/self-hosting/more/authentication)**:
115+
- Added authentication support via OAuth or email/password. For instructions on enabling, see [this doc](https://docs.sourcebot.dev/self-hosting/configuration/authentication).
116+
- Added the following UI for managing your deployment when **[auth is enabled](https://docs.sourcebot.dev/self-hosting/configuration/authentication)**:
98117
- connection management: create and manage your JSON configs via a integrated web-editor.
99118
- secrets: import personal access tokens (PAT) into Sourcebot (AES-256 encrypted). Reference secrets in your connection config by name.
100119
- team & invite management: invite users to your instance to give them access. Configure team [roles & permissions](https://docs.sourcebot.dev/docs/more/roles-and-permissions).

docs/docs.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"pages": [
5151
"docs/search/syntax-reference",
5252
"docs/search/multi-branch-indexing",
53+
"docs/search/code-navigation",
5354
"docs/search/search-contexts"
5455
]
5556
},
@@ -63,6 +64,7 @@
6364
{
6465
"group": "More",
6566
"pages": [
67+
"docs/more/api-keys",
6668
"docs/more/roles-and-permissions",
6769
"docs/more/mcp-server"
6870
]
@@ -77,17 +79,16 @@
7779
"group": "Getting Started",
7880
"pages": [
7981
"self-hosting/overview",
80-
"self-hosting/configuration",
8182
"self-hosting/license-key"
8283
]
8384
},
8485
{
85-
"group": "More",
86+
"group": "Configuration",
8687
"pages": [
87-
"self-hosting/more/authentication",
88-
"self-hosting/more/tenancy",
89-
"self-hosting/more/transactional-emails",
90-
"self-hosting/more/declarative-config"
88+
"self-hosting/configuration/environment-variables",
89+
"self-hosting/configuration/authentication",
90+
"self-hosting/configuration/transactional-emails",
91+
"self-hosting/configuration/declarative-config"
9192
]
9293
},
9394
{
@@ -98,6 +99,7 @@
9899
{
99100
"group": "Upgrade",
100101
"pages": [
102+
"self-hosting/upgrade/v3-to-v4-guide",
101103
"self-hosting/upgrade/v2-to-v3-guide"
102104
]
103105
}

docs/docs/agents/review-agent.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Before you get started, make sure you have an OpenAPI account that you can creat
5353
directory that you mount to Sourcebot
5454
![GitHub App Private Key](/images/github_app_private_key.png)
5555
- `OPENAI_API_KEY`: Your OpenAI API key
56+
- `REVIEW_AGENT_API_KEY`: The Sourcebot API key that the review agent uses to hit the Sourcebot API to fetch code context
5657
- `REVIEW_AGENT_AUTO_REVIEW_ENABLED` (default: `false`): If enabled, the review agent will automatically review any new or updated PR. If disabled, you must invoke it using the command defined by `REVIEW_AGENT_REVIEW_COMMAND`
5758
- `REVIEW_AGENT_REVIEW_COMMAND` (default: `review`): The command that invokes the review agent (ex. `/review`) when a user comments on the PR. Don't include the slash character in this value.
5859

@@ -76,6 +77,7 @@ Before you get started, make sure you have an OpenAPI account that you can creat
7677
GITHUB_APP_ID: "my-github-app-id"
7778
GITHUB_APP_WEBHOOK_SECRET: "my-github-app-webhook-secret"
7879
GITHUB_APP_PRIVATE_KEY_PATH: "/data/review-agent-key.pem"
80+
REVIEW_AGENT_API_KEY: "sourcebot-my-key"
7981
OPENAI_API_KEY: "sk-proj-my-open-api-key"
8082
```
8183
</Step>

docs/docs/connections/gitea.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Next, provide the access token via the `token` property, either as an environmen
8282

8383
<Tabs>
8484
<Tab title="Environment Variable">
85-
<Note>Environment variables are only supported in a [declarative config](/self-hosting/more/declarative-config) and cannot be used in the web UI.</Note>
85+
<Note>Environment variables are only supported in a [declarative config](/self-hosting/configuration/declarative-config) and cannot be used in the web UI.</Note>
8686

8787
1. Add the `token` property to your connection config:
8888
```json
@@ -107,7 +107,7 @@ Next, provide the access token via the `token` property, either as an environmen
107107
</Tab>
108108

109109
<Tab title="Secret">
110-
<Note>Secrets are only supported when [authentication](/self-hosting/more/authentication) is enabled.</Note>
110+
<Note>Secrets are only supported when [authentication](/self-hosting/configuration/authentication) is enabled.</Note>
111111

112112
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
113113

docs/docs/connections/github.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Next, provide the PAT via the `token` property, either as an environment variabl
111111

112112
<Tabs>
113113
<Tab title="Environment Variable">
114-
<Note>Environment variables are only supported in a [declarative config](/self-hosting/more/declarative-config) and cannot be used in the web UI.</Note>
114+
<Note>Environment variables are only supported in a [declarative config](/self-hosting/configuration/declarative-config) and cannot be used in the web UI.</Note>
115115

116116
1. Add the `token` property to your connection config:
117117
```json
@@ -136,7 +136,7 @@ Next, provide the PAT via the `token` property, either as an environment variabl
136136
</Tab>
137137

138138
<Tab title="Secret">
139-
<Note>Secrets are only supported when [authentication](/self-hosting/more/authentication) is enabled.</Note>
139+
<Note>Secrets are only supported when [authentication](/self-hosting/configuration/authentication) is enabled.</Note>
140140

141141
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
142142

docs/docs/connections/gitlab.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Next, provide the PAT via the `token` property, either as an environment variabl
116116

117117
<Tabs>
118118
<Tab title="Environment Variable">
119-
<Note>Environment variables are only supported in a [declarative config](/self-hosting/more/declarative-config) and cannot be used in the web UI.</Note>
119+
<Note>Environment variables are only supported in a [declarative config](/self-hosting/configuration/declarative-config) and cannot be used in the web UI.</Note>
120120

121121
1. Add the `token` property to your connection config:
122122
```json
@@ -141,7 +141,7 @@ Next, provide the PAT via the `token` property, either as an environment variabl
141141
</Tab>
142142

143143
<Tab title="Secret">
144-
<Note>Secrets are only supported when [authentication](/self-hosting/more/authentication) is enabled.</Note>
144+
<Note>Secrets are only supported when [authentication](/self-hosting/configuration/authentication) is enabled.</Note>
145145

146146
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
147147

docs/docs/connections/overview.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ There are two ways to define connections:
1111

1212
<AccordionGroup>
1313
<Accordion title="Declarative configuration file">
14-
This is only supported when self-hosting, and is the default mechanism to define connections. Connections are defined in a [JSON file](/self-hosting/more/declarative-config)
14+
This is only supported when self-hosting, and is the default mechanism to define connections. Connections are defined in a [JSON file](/self-hosting/configuration/declarative-config)
1515
and the path to the file is provided through the `CONFIG_PATH` environment variable
1616
</Accordion>
1717
<Accordion title="UI connection management">
18-
This is the only way to define connections when using Sourcebot Cloud, and can be configured when self-hosting by enabling [authentication](/self-hosting/more/authentications).
18+
This is the only way to define connections when using Sourcebot Cloud, and can be configured when self-hosting by enabling [authentication](/self-hosting/configuration/authentications).
1919

2020
In this method, connections are defined and managed within the webapp:
2121

docs/docs/more/api-keys.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: API Keys
3+
---
4+
5+
An API Key is required when querying Sourcebot outside the context of the web app client (ex. MCP server, review agent). To create an API key, login to your Sourcebot instance and navigate to
6+
**Settings -> API Keys**:
7+
8+
![API Keys UI](/images/api_key.png)

docs/docs/more/mcp-server.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebarTitle: Sourcebot MCP server
44
---
55

66
<Note>
7-
This feature is only available when [self-hosting](/self-hosting) with [authentication](/self-hosting/more/authentication) disabled.
7+
This feature is only available when [self-hosting](/self-hosting)
88
</Note>
99

1010
The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) is an open standard for providing context to LLMs. The [@sourcebot/mcp](https://www.npmjs.com/package/@sourcebot/mcp) package is a MCP server that enables LLMs to interface with your Sourcebot instance, enabling MCP clients like Cursor, Vscode, and others to have context over your entire codebase.
@@ -176,6 +176,7 @@ Parameters:
176176
| Name | Default | Description |
177177
|:-------------------------|:-----------------------|:--------------------------------------------------|
178178
| `SOURCEBOT_HOST` | http://localhost:3000 | URL of your Sourcebot instance. |
179+
| `SOURCEBOT_API_KEY` | - | Sourcebot API key. |
179180
| `DEFAULT_MINIMUM_TOKENS` | 10000 | Minimum number of tokens to return in responses. |
180181
| `DEFAULT_MATCHES` | 10000 | Number of code matches to fetch per search. |
181182
| `DEFAULT_CONTEXT_LINES` | 5 | Lines of context to include above/below matches. |

docs/docs/more/roles-and-permissions.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ title: Roles and Permissions
44

55
<Note>Looking to sync permissions with your identify provider? We're working on it - [reach out](https://www.sourcebot.dev/contact) to us to learn more</Note>
66

7-
If you're using Sourcebot Cloud, or are self-hosting with [authentication](/self-hosting/more/authentication) enabled, you may have multiple members in your organization. Each
8-
member has a role which defines their permissions:
7+
Each member has a role which defines their permissions within an organization:
98

109
| Role | Permission |
1110
| :--- | :--------- |

docs/docs/search/code-navigation.mdx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: Code navigation
3+
sidebarTitle: Code navigation
4+
---
5+
6+
import SearchContextSchema from '/snippets/schemas/v3/searchContext.schema.mdx'
7+
8+
<Note>
9+
This feature is only available in [Sourcebot cloud](app.sourcebot.dev) or with an active Enterprise license when [self-hosting](/self-hosting). Please add your [license key](/self-hosting/license-key) to activate it.
10+
</Note>
11+
12+
**Code navigation** allows you to jump between symbol definition and references when viewing source files in Sourcebot. This feature is enabled **automatically** when a valid license key is present and works with all popular programming languages.
13+
14+
15+
<video src="https://framerusercontent.com/assets/B9ZxrlsUeO9NJyzkKyvVV2KSU4.mp4" className="w-full aspect-video" controls></video>
16+
17+
## Features
18+
19+
| Feature | Description |
20+
|:--------|:------------|
21+
| **Hover popover** | Hovering over a symbol reveals the symbol's definition signature as a inline preview. |
22+
| **Go to definition** | Clicking the "go to definition" button in the popover or clicking the symbol name navigates to the symbol's definition. |
23+
| **Find references** | Clicking the "find all references" button in the popover lists all references in the explore panel. |
24+
| **Explore panel** | Lists all references and definitions for the symbol selected in the popover. |
25+
26+
## How does it work?
27+
28+
Code navigation is **search-based**, meaning it uses the same code search engine and [query language](/docs/search/syntax-reference) to estimate a symbol's references and definitions. We refer to these estimations as "search heuristics". We have two search heuristics to enable the following operations:
29+
30+
### Find references
31+
Given a `symbolName`, along with information about the file the symbol is contained within (`git_revision`, and `language`), runs the following search:
32+
33+
```bash
34+
\\b{symbolName}\\b rev:{git_revision} lang:{language} case:yes
35+
```
36+
37+
### Find definitions
38+
Given a `symbolName`, along with information about the file the symbol is contained within (`git_revision`, and `language`), runs the following search:
39+
40+
```bash
41+
sym:\\b{symbolName}\\b rev:{git_revision} lang:{language}
42+
```
43+
44+
Note that the `sym:` prefix is used to filter the search by symbol definitions. These are created at index time by [universal ctags](https://ctags.io/).

docs/docs/search/search-contexts.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Search contexts
3-
sidebarTitle: Search contexts (EE)
3+
sidebarTitle: Search contexts
44
---
55

66
import SearchContextSchema from '/snippets/schemas/v3/searchContext.schema.mdx'
@@ -16,7 +16,7 @@ A **search context** is a user-defined grouping of repositories that helps focus
1616
- `( context:project1 or context:project2 ) logger\.debug` - search for debug log calls in project1 and project2
1717

1818

19-
Search contexts are defined in the `context` object inside of a [declarative config](/self-hosting/more/declarative-config). Repositories can be included / excluded from a search context by specifying the repo's URL in either the `include` array or `exclude` array. Glob patterns are supported.
19+
Search contexts are defined in the `context` object inside of a [declarative config](/self-hosting/configuration/declarative-config). Repositories can be included / excluded from a search context by specifying the repo's URL in either the `include` array or `exclude` array. Glob patterns are supported.
2020

2121
## Example
2222

@@ -41,7 +41,7 @@ shared/
4141
├─ ...
4242
```
4343

44-
To make searching easier, we can create three search contexts in our [config.json](/self-hosting/more/declarative-config):
44+
To make searching easier, we can create three search contexts in our [config.json](/self-hosting/configuration/declarative-config):
4545
- `web`: For all frontend-related code
4646
- `backend`: For backend services and shared APIs
4747
- `pipelines`: For all CI/CD configurations

docs/images/api_key.png

140 KB
Loading

docs/images/demo.mp4

-9.78 MB
Binary file not shown.

docs/images/join_request_email.png

149 KB
Loading

docs/images/login.png

-18.4 KB
Loading

docs/images/login_basic.png

90.4 KB
Loading

docs/images/pending_approval.png

77.6 KB
Loading

0 commit comments

Comments
 (0)