diff --git a/.cursor/rules/style.mdc b/.cursor/rules/style.mdc
new file mode 100644
index 00000000..6d3e8046
--- /dev/null
+++ b/.cursor/rules/style.mdc
@@ -0,0 +1,7 @@
+---
+description:
+globs:
+alwaysApply: true
+---
+- Always use 4 spaces for indentation
+- 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.
\ No newline at end of file
diff --git a/.env.development b/.env.development
index f4ca1600..0309b5fb 100644
--- a/.env.development
+++ b/.env.development
@@ -18,12 +18,13 @@ SRC_TENANT_ENFORCEMENT_MODE=strict
AUTH_SECRET="00000000000000000000000000000000000000000000"
AUTH_URL="http://localhost:3000"
# AUTH_CREDENTIALS_LOGIN_ENABLED=true
-# AUTH_GITHUB_CLIENT_ID=""
-# AUTH_GITHUB_CLIENT_SECRET=""
-# AUTH_GOOGLE_CLIENT_ID=""
-# AUTH_GOOGLE_CLIENT_SECRET=""
+# AUTH_EE_GITHUB_CLIENT_ID=""
+# AUTH_EE_GITHUB_CLIENT_SECRET=""
+# AUTH_EE_GOOGLE_CLIENT_ID=""
+# AUTH_EE_GOOGLE_CLIENT_SECRET=""
DATA_CACHE_DIR=${PWD}/.sourcebot # Path to the sourcebot cache dir (ex. ~/sourcebot/.sourcebot)
+SOURCEBOT_PUBLIC_KEY_PATH=${PWD}/public.pem
# CONFIG_PATH=${PWD}/config.json # Path to the sourcebot config file (if one exists)
# Email
diff --git a/.github/workflows/_gcp-deploy.yml b/.github/workflows/_gcp-deploy.yml
index cee812a4..15fde89b 100644
--- a/.github/workflows/_gcp-deploy.yml
+++ b/.github/workflows/_gcp-deploy.yml
@@ -60,6 +60,8 @@ jobs:
NEXT_PUBLIC_SENTRY_ENVIRONMENT=${{ vars.NEXT_PUBLIC_SENTRY_ENVIRONMENT }}
NEXT_PUBLIC_SENTRY_WEBAPP_DSN=${{ vars.NEXT_PUBLIC_SENTRY_WEBAPP_DSN }}
NEXT_PUBLIC_SENTRY_BACKEND_DSN=${{ vars.NEXT_PUBLIC_SENTRY_BACKEND_DSN }}
+ NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY=${{ vars.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY }}
+ NEXT_PUBLIC_LANGFUSE_BASE_URL=${{ vars.NEXT_PUBLIC_LANGFUSE_BASE_URL }}
SENTRY_SMUAT=${{ secrets.SENTRY_SMUAT }}
SENTRY_ORG=${{ vars.SENTRY_ORG }}
SENTRY_WEBAPP_PROJECT=${{ vars.SENTRY_WEBAPP_PROJECT }}
diff --git a/.github/workflows/changelog-reminder.yml b/.github/workflows/changelog-reminder.yml
new file mode 100644
index 00000000..afb68c38
--- /dev/null
+++ b/.github/workflows/changelog-reminder.yml
@@ -0,0 +1,17 @@
+name: Changelog Reminder
+
+on:
+ pull_request:
+ types: [opened, synchronize, reopened, ready_for_review]
+
+jobs:
+ remind:
+ name: Changelog Reminder
+ runs-on: ubuntu-latest
+ if: ${{ !github.event.pull_request.draft }}
+ permissions:
+ contents: read
+ pull-requests: write
+ steps:
+ - uses: actions/checkout@v4
+ - uses: mskelton/changelog-reminder-action@v3
\ No newline at end of file
diff --git a/.github/workflows/deploy-demo.yml b/.github/workflows/deploy-demo.yml
index 50884bef..71bc9ef0 100644
--- a/.github/workflows/deploy-demo.yml
+++ b/.github/workflows/deploy-demo.yml
@@ -2,7 +2,7 @@ name: Deploy Demo
on:
push:
- tags: ["v*.*.*"]
+ branches: ["main"]
workflow_dispatch:
jobs:
diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml
deleted file mode 100644
index e9a8e64a..00000000
--- a/.github/workflows/deploy-prod.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-name: Deploy Prod
-
-on:
- push:
- tags: ["v*.*.*"]
- workflow_dispatch:
-
-jobs:
- deploy-prod:
- uses: ./.github/workflows/_gcp-deploy.yml
- secrets: inherit
- permissions:
- contents: 'read'
- # Requird for OIDC auth with GCP.
- # @see: https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
- id-token: 'write'
- with:
- environment: prod
diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml
deleted file mode 100644
index 2de85ed1..00000000
--- a/.github/workflows/deploy-staging.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-name: Deploy Staging
-
-on:
- push:
- branches: [main]
- workflow_dispatch:
-
-jobs:
- deploy-staging:
- uses: ./.github/workflows/_gcp-deploy.yml
- secrets: inherit
- permissions:
- contents: 'read'
- # Requird for OIDC auth with GCP.
- # @see: https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
- id-token: 'write'
- with:
- environment: staging
diff --git a/.github/workflows/docs-broken-links.yml b/.github/workflows/docs-broken-links.yml
new file mode 100644
index 00000000..4e410c49
--- /dev/null
+++ b/.github/workflows/docs-broken-links.yml
@@ -0,0 +1,26 @@
+name: Check for broken links in docs
+
+on:
+ pull_request:
+ branches: ["main"]
+ paths:
+ - "docs/**"
+
+jobs:
+ check-links:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Use Node.Js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20.x'
+
+ - name: Install Mintlify CLI
+ run: npm i -g mintlify
+
+ - name: Check for broken links
+ working-directory: docs
+ run: mintlify broken-links
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1b8b551b..df9d91c5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,135 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+## [4.6.0] - 2025-07-25
+
+### Added
+- Introducing Ask Sourcebot - ask natural langauge about your codebase. Get back comprehensive Markdown responses with inline citations back to the code. Bring your own LLM api key. [#392](https://github.com/sourcebot-dev/sourcebot/pull/392)
+
+### Fixed
+- Fixed onboarding infinite loop when GCP IAP Auth is enabled. [#381](https://github.com/sourcebot-dev/sourcebot/pull/381)
+
+## [4.5.3] - 2025-07-20
+
+### Changed
+- Relicense core to FSL-1.1-ALv2. [#388](https://github.com/sourcebot-dev/sourcebot/pull/388)
+
+### Added
+- Added `GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS` env var to configure the GitLab client's query timeout. [#390](https://github.com/sourcebot-dev/sourcebot/pull/390)
+
+## [4.5.2] - 2025-07-19
+
+### Changed
+- Fixed typos in UI, docs, code [#369](https://github.com/sourcebot-dev/sourcebot/pull/369)
+- Add anonymous access option to core and deprecate the `enablePublicAccess` config setting. [#385](https://github.com/sourcebot-dev/sourcebot/pull/385)
+
+## [4.5.1] - 2025-07-14
+
+### Changed
+- Revamped onboarding experience. [#376](https://github.com/sourcebot-dev/sourcebot/pull/376)
+
+### Fixed
+- Fixed issue with external source code links being broken for paths with spaces. [#364](https://github.com/sourcebot-dev/sourcebot/pull/364)
+- Makes base retry indexing configuration configurable and move from a default of `5s` to `60s`. [#377](https://github.com/sourcebot-dev/sourcebot/pull/377)
+- Fixed issue where files would sometimes never load in the code browser. [#365](https://github.com/sourcebot-dev/sourcebot/pull/365)
+
+## [4.5.0] - 2025-06-21
+
+### Added
+- Added code nav and syntax highlighting for TCL. [#362](https://github.com/sourcebot-dev/sourcebot/pull/362)
+- Added analytics dashboard. [#358](https://github.com/sourcebot-dev/sourcebot/pull/358)
+
+### Fixed
+- Fixed issue where invites appeared to be created successfully, but were not actually being created in the database. [#359](https://github.com/sourcebot-dev/sourcebot/pull/359)
+
+### Changed
+- Audit logging is now enabled by default. [#358](https://github.com/sourcebot-dev/sourcebot/pull/358)
+
+## [4.4.0] - 2025-06-18
+
+### Added
+- Added audit logging. [#355](https://github.com/sourcebot-dev/sourcebot/pull/355)
+
+
+### Fixed
+- Delete account join request when redeeming an invite. [#352](https://github.com/sourcebot-dev/sourcebot/pull/352)
+- Fix issue where a repository would not be included in a search context if the context was created before the repository. [#354](https://github.com/sourcebot-dev/sourcebot/pull/354)
+
+### Changed
+- Changed search api (and all apis that depend on it) to return raw source code instead of base64 encoded string. ([356](https://github.com/sourcebot-dev/sourcebot/pull/356)).
+
+
+## [4.3.0] - 2025-06-11
+
+### Added
+- Changed repository link in search to file tree + move external link to code host logo. [#340](https://github.com/sourcebot-dev/sourcebot/pull/340)
+- Added a basic file search dialog when browsing a repository. [#341](https://github.com/sourcebot-dev/sourcebot/pull/341)
+
+### Fixed
+- Text highlighting clarity. [#342](https://github.com/sourcebot-dev/sourcebot/pull/342)
+- Fixed repo list column header styling. [#344](https://github.com/sourcebot-dev/sourcebot/pull/344)
+- Clean up successful and failed jobs in Redis queues. [#343](https://github.com/sourcebot-dev/sourcebot/pull/343)
+- Fixed issue with files occasionally not loading after moving the cursor rapidly over the file browser. [#346](https://github.com/sourcebot-dev/sourcebot/pull/346)
+
+## [4.2.0] - 2025-06-09
+
+### Added
+- Added seperate page for signup. [#311](https://github.com/sourcebot-dev/sourcebot/pull/331)
+- Fix repo images in authed instance case and add manifest json. [#332](https://github.com/sourcebot-dev/sourcebot/pull/332)
+- Added encryption logic for license keys. [#335](https://github.com/sourcebot-dev/sourcebot/pull/335)
+- Added hover tooltip for long repo names in filter panel. [#338](https://github.com/sourcebot-dev/sourcebot/pull/338)
+- Added repo shard validation on startup. [#339](https://github.com/sourcebot-dev/sourcebot/pull/339)
+- Added support for a file explorer when browsing files. [#336](https://github.com/sourcebot-dev/sourcebot/pull/336)
+
+## [4.1.1] - 2025-06-03
+
+### Added
+- Added copy button for filenames. [#328](https://github.com/sourcebot-dev/sourcebot/pull/328)
+- Added development docker compose file. [#328](https://github.com/sourcebot-dev/sourcebot/pull/328)
+- Added keyboard shortcuts for find all refs / go to def. [#329](https://github.com/sourcebot-dev/sourcebot/pull/329)
+- Added GCP IAP JIT provisioning. [#330](https://github.com/sourcebot-dev/sourcebot/pull/330)
+
+### Fixed
+- Fixed issue with the symbol hover popover clipping at the top of the page. [#326](https://github.com/sourcebot-dev/sourcebot/pull/326)
+- Fixed slow rendering issue with large reference/definition lists. [#327](https://github.com/sourcebot-dev/sourcebot/pull/327)
+
+## [4.1.0] - 2025-06-02
+
+### Added
+- Added structured logging support. [#323](https://github.com/sourcebot-dev/sourcebot/pull/323)
+
+### Fixed
+- Fixed issue where new oauth providers weren't being display in the login page. [commit](https://github.com/sourcebot-dev/sourcebot/commit/a2e06266dbe5e5ad4c2c3f730c73d64edecedcf7)
+- Fixed client side "mark decorations may not be empty" error when viewing certain files. [#325](https://github.com/sourcebot-dev/sourcebot/pull/325)
+- Fixed issue where the symbol hover popover would not appear for large source files. [#325](https://github.com/sourcebot-dev/sourcebot/pull/325)
+
+
+## [4.0.1] - 2025-05-28
+
+### Fixed
+- Fixed issue with how entitlements are resolved for cloud. [#319](https://github.com/sourcebot-dev/sourcebot/pull/319)
+
+## [4.0.0] - 2025-05-28
+
+Sourcebot V4 introduces authentication, performance improvements and code navigation. Checkout the [migration guide](https://docs.sourcebot.dev/docs/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/configuration/auth/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/docs/configuration/auth/overview)).
+- 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)
+
+### 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/features/code-navigation). [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
+- Added collapsible filter panel. [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
+- Added Sourcebot API key management for external clients. [#311](https://github.com/sourcebot-dev/sourcebot/pull/311)
+
+### Fixed
+- Improved scroll performance for large numbers of search results. [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
+
## [3.2.1] - 2025-05-15
### Added
@@ -15,7 +144,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.2.0] - 2025-05-12
### Added
-- Added AI code review agent [#298](https://github.com/sourcebot-dev/sourcebot/pull/298). Checkout the [docs](https://docs.sourcebot.dev/docs/agents/review-agent) for more information.
+- Added AI code review agent [#298](https://github.com/sourcebot-dev/sourcebot/pull/298). Checkout the [docs](https://docs.sourcebot.dev/docs/features/agents/review-agent) for more information.
### Fixed
- Fixed issue with repos appearing in the carousel when they fail indexing for the first time. [#305](https://github.com/sourcebot-dev/sourcebot/pull/305)
@@ -84,20 +213,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.0.0] - 2025-04-01
-Sourcebot v3 is here and brings a number of structural changes to the tool's foundation, including a SQL database, parallelized indexing, authentication support, multitenancy, and more. Checkout the [migration guide](https://docs.sourcebot.dev/self-hosting/upgrade/v2-to-v3-guide) for information on upgrading your instance to v3.
+Sourcebot v3 is here and brings a number of structural changes to the tool's foundation, including a SQL database, parallelized indexing, authentication support, multitenancy, and more. Checkout the [migration guide](https://docs.sourcebot.dev/docs/upgrade/v2-to-v3-guide) for information on upgrading your instance to v3.
### Changed
-- [**Breaking Change**] Changed the config schema such that connection objects are specified in the `connection` map, instead of the `repos` array. [See migration guide](https://docs.sourcebot.dev/self-hosting/upgrade/v2-to-v3-guide).
+- [**Breaking Change**] Changed the config schema such that connection objects are specified in the `connection` map, instead of the `repos` array. [See migration guide](https://docs.sourcebot.dev/docs/upgrade/v2-to-v3-guide).
- Updated the tool's color-palette in dark mode.
### Added
-- Added parallelized repo indexing and connection syncing via Redis & BullMQ. See the [architecture overview](https://docs.sourcebot.dev/self-hosting/overview#architecture).
+- Added parallelized repo indexing and connection syncing via Redis & BullMQ. See the [architecture overview](https://docs.sourcebot.dev/docs/overview#architecture).
- Added repo indexing progress indicators in the navbar.
-- Added authentication support via OAuth or email/password. For instructions on enabling, see [this doc](https://docs.sourcebot.dev/self-hosting/more/authentication).
-- Added the following UI for managing your deployment when **[auth is enabled](https://docs.sourcebot.dev/self-hosting/more/authentication)**:
+- Added authentication support via OAuth or email/password. For instructions on enabling, see [this doc](https://docs.sourcebot.dev/docs/configuration/auth/overview).
+- Added the following UI for managing your deployment when **[auth is enabled](https://docs.sourcebot.dev/docs/configuration/auth/overview)**:
- connection management: create and manage your JSON configs via a integrated web-editor.
- secrets: import personal access tokens (PAT) into Sourcebot (AES-256 encrypted). Reference secrets in your connection config by name.
- - 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).
+ - team & invite management: invite users to your instance to give them access. Configure team [roles & permissions](https://docs.sourcebot.dev/docs/configuration/auth/roles-and-permissions).
- Added multi-tenancy support. See [this doc](https://docs.sourcebot.dev/self-hosting/more/tenancy).
### Removed
@@ -129,7 +258,7 @@ Sourcebot v3 is here and brings a number of structural changes to the tool's fou
### Added
-- Added `maxTrigramCount` to the config to control the maximum allowable of trigrams per document.
+- Added `maxTrigramCount` to the config to control the maximum allowable of trigrams per document.
### Fixed
@@ -187,7 +316,7 @@ Sourcebot v3 is here and brings a number of structural changes to the tool's fou
- Added config option `settings.maxFileSize` to control the maximum file size zoekt will index. ([#118](https://github.com/sourcebot-dev/sourcebot/pull/118))
### Fixed
-
+
- Fixed syntax highlighting for zoekt query language. ([#115](https://github.com/sourcebot-dev/sourcebot/pull/115))
- Fixed issue with Gerrit repo fetching not paginating. ([#114](https://github.com/sourcebot-dev/sourcebot/pull/114))
- Fixed visual issues with filter panel. ([#105](https://github.com/sourcebot-dev/sourcebot/pull/105))
@@ -239,13 +368,13 @@ Sourcebot v3 is here and brings a number of structural changes to the tool's fou
### Added
- Added `DOMAIN_SUB_PATH` environment variable to allow overriding the default domain subpath. ([#74](https://github.com/sourcebot-dev/sourcebot/pull/74))
-- Added option `all` to the GitLab index schema, allowing for indexing all projects in a self-hosted GitLab instance. ([#84](https://github.com/sourcebot-dev/sourcebot/pull/84))
+- Added option `all` to the GitLab index schema, allowing for indexing all projects in a self-hosted GitLab instance. ([#84](https://github.com/sourcebot-dev/sourcebot/pull/84))
## [2.4.3] - 2024-11-18
### Changed
-- Bumped NodeJS version to v20. ([#78](https://github.com/sourcebot-dev/sourcebot/pull/78))
+- Bumped NodeJS version to v20. ([#78](https://github.com/sourcebot-dev/sourcebot/pull/78))
## [2.4.2] - 2024-11-14
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3627186c..ae301793 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -2,7 +2,7 @@
>[!NOTE]
> Building from source is only required if you'd like to contribute. The recommended way to use Sourcebot is to use the [pre-built docker image](https://github.com/sourcebot-dev/sourcebot/pkgs/container/sourcebot).
-1. Install go,
NodeJS, [redis](https://redis.io/), and [postgres](https://www.postgresql.org/). Note that a NodeJS version of at least `21.1.0` is required.
+1. Install
go,
docker, and
NodeJS. Note that a NodeJS version of at least `21.1.0` is required.
2. Install [ctags](https://github.com/universal-ctags/ctags) (required by zoekt)
```sh
@@ -13,11 +13,15 @@
snap install universal-ctags
```
+3. Install `yarn`:
+ ```sh
+ npm install --global yarn
+ ```
+
3. Clone the repository with submodules:
```sh
git clone --recurse-submodules https://github.com/sourcebot-dev/sourcebot.git
```
-
4. Run `make` to build zoekt and install dependencies:
```sh
cd sourcebot
@@ -26,15 +30,21 @@
The zoekt binaries and web dependencies are placed into `bin` and `node_modules` respectively.
-5. Create a copy of `.env.development` and name it `.env.development.local`. Update the required environment variables.
+5. Start the development Docker containers for PostgreSQL and Redis.
-6. If you're using a declerative configuration file (the default behavior if you didn't enable auth), create a configuration file and update the `CONFIG_PATH` environment variable in your `.env.development.local` file.
+ ```sh
+ docker compose -f docker-compose-dev.yml up -d
+ ```
-7. Start Sourcebot with the command:
+6. Create a copy of `.env.development` and name it `.env.development.local`. Update the required environment variables.
+
+7. If you're using a declarative configuration file, create a configuration file and update the `CONFIG_PATH` environment variable in your `.env.development.local` file.
+
+8. Start Sourcebot with the command:
```sh
yarn dev
```
A `.sourcebot` directory will be created and zoekt will begin to index the repositories found in the `config.json` file.
-8. Start searching at `http://localhost:3000`.
+9. Start searching at `http://localhost:3000`.
diff --git a/Dockerfile b/Dockerfile
index e2c9c239..d04b2518 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,6 +17,8 @@ ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT
ARG NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT
ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN
ARG NEXT_PUBLIC_SENTRY_BACKEND_DSN
+ARG NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
+ARG NEXT_PUBLIC_LANGFUSE_BASE_URL
FROM node:20-alpine3.19 AS node-alpine
FROM golang:1.23.4-alpine3.19 AS go-alpine
@@ -42,11 +44,15 @@ COPY ./packages/db ./packages/db
COPY ./packages/schemas ./packages/schemas
COPY ./packages/crypto ./packages/crypto
COPY ./packages/error ./packages/error
+COPY ./packages/logger ./packages/logger
+COPY ./packages/shared ./packages/shared
RUN yarn workspace @sourcebot/db install
RUN yarn workspace @sourcebot/schemas install
RUN yarn workspace @sourcebot/crypto install
RUN yarn workspace @sourcebot/error install
+RUN yarn workspace @sourcebot/logger install
+RUN yarn workspace @sourcebot/shared install
# ------------------------------------
# ------ Build Web ------
@@ -63,6 +69,10 @@ ARG NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT
ENV NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT=$NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT
ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN
ENV NEXT_PUBLIC_SENTRY_WEBAPP_DSN=$NEXT_PUBLIC_SENTRY_WEBAPP_DSN
+ARG NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
+ENV NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY=$NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
+ARG NEXT_PUBLIC_LANGFUSE_BASE_URL
+ENV NEXT_PUBLIC_LANGFUSE_BASE_URL=$NEXT_PUBLIC_LANGFUSE_BASE_URL
# To upload source maps to Sentry, we need to set the following build-time args.
# It's important that we don't set these for oss builds, otherwise the Sentry
@@ -89,6 +99,8 @@ COPY --from=shared-libs-builder /app/packages/db ./packages/db
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
COPY --from=shared-libs-builder /app/packages/error ./packages/error
+COPY --from=shared-libs-builder /app/packages/logger ./packages/logger
+COPY --from=shared-libs-builder /app/packages/shared ./packages/shared
# Fixes arm64 timeouts
RUN yarn workspace @sourcebot/web install
@@ -128,6 +140,8 @@ COPY --from=shared-libs-builder /app/packages/db ./packages/db
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
COPY --from=shared-libs-builder /app/packages/error ./packages/error
+COPY --from=shared-libs-builder /app/packages/logger ./packages/logger
+COPY --from=shared-libs-builder /app/packages/shared ./packages/shared
RUN yarn workspace @sourcebot/backend install
RUN yarn workspace @sourcebot/backend build
@@ -156,6 +170,10 @@ ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN
ENV NEXT_PUBLIC_SENTRY_WEBAPP_DSN=$NEXT_PUBLIC_SENTRY_WEBAPP_DSN
ARG NEXT_PUBLIC_SENTRY_BACKEND_DSN
ENV NEXT_PUBLIC_SENTRY_BACKEND_DSN=$NEXT_PUBLIC_SENTRY_BACKEND_DSN
+ARG NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
+ENV NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY=$NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
+ARG NEXT_PUBLIC_LANGFUSE_BASE_URL
+ENV NEXT_PUBLIC_LANGFUSE_BASE_URL=$NEXT_PUBLIC_LANGFUSE_BASE_URL
# -----------
RUN echo "Sourcebot Version: $NEXT_PUBLIC_SOURCEBOT_VERSION"
@@ -170,6 +188,7 @@ ENV REDIS_DATA_DIR=$DATA_CACHE_DIR/redis
ENV DATABASE_URL="postgresql://postgres@localhost:5432/sourcebot"
ENV REDIS_URL="redis://localhost:6379"
ENV SRC_TENANT_ENFORCEMENT_MODE=strict
+ENV SOURCEBOT_PUBLIC_KEY_PATH=/app/public.pem
# Valid values are: debug, info, warn, error
ENV SOURCEBOT_LOG_LEVEL=info
@@ -177,7 +196,7 @@ ENV SOURCEBOT_LOG_LEVEL=info
# Sourcebot collects anonymous usage data using [PostHog](https://posthog.com/). Uncomment this line to disable.
# ENV SOURCEBOT_TELEMETRY_DISABLED=1
-COPY package.json yarn.lock* .yarnrc.yml ./
+COPY package.json yarn.lock* .yarnrc.yml public.pem ./
COPY .yarn ./.yarn
# Configure zoekt
@@ -209,6 +228,8 @@ COPY --from=shared-libs-builder /app/packages/db ./packages/db
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
COPY --from=shared-libs-builder /app/packages/error ./packages/error
+COPY --from=shared-libs-builder /app/packages/logger ./packages/logger
+COPY --from=shared-libs-builder /app/packages/shared ./packages/shared
# Configure dependencies
RUN apk add --no-cache git ca-certificates bind-tools tini jansson wget supervisor uuidgen curl perl jq redis postgresql postgresql-contrib openssl util-linux unzip
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 04fbff3a..00000000
--- a/LICENSE
+++ /dev/null
@@ -1,25 +0,0 @@
-Copyright (c) 2025 Taqla Inc.
-
-Portions of this software are licensed as follows:
-
-- All content that resides under the "ee/" and "packages/web/src/ee/" directories of this repository, if these directories exist, is licensed under the license defined in "ee/LICENSE".
-- All third party components incorporated into the Sourcebot Software are licensed under the original license provided by the owner of the applicable component.
-- Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 00000000..93c14254
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,115 @@
+Copyright (c) 2025 Taqla Inc.
+
+Portions of this software are licensed as follows:
+
+- All content that resides under the "ee/", "packages/web/src/ee/", and "packages/shared/src/ee/" directories of this repository, if these directories exist, is licensed under the license defined in "ee/LICENSE".
+- All third party components incorporated into the Sourcebot Software are licensed under the original license provided by the owner of the applicable component.
+- Content outside of the above mentioned directories or restrictions above is available under the "Functional Source License" as defined below.
+
+---
+
+# Functional Source License, Version 1.1, ALv2 Future License
+
+## Abbreviation
+
+FSL-1.1-ALv2
+
+## Notice
+
+Copyright 2025 Taqla Inc.
+
+## Terms and Conditions
+
+### Licensor ("We")
+
+The party offering the Software under these Terms and Conditions.
+
+### The Software
+
+The "Software" is each version of the software that we make available under
+these Terms and Conditions, as indicated by our inclusion of these Terms and
+Conditions with the Software.
+
+### License Grant
+
+Subject to your compliance with this License Grant and the Patents,
+Redistribution and Trademark clauses below, we hereby grant you the right to
+use, copy, modify, create derivative works, publicly perform, publicly display
+and redistribute the Software for any Permitted Purpose identified below.
+
+### Permitted Purpose
+
+A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
+means making the Software available to others in a commercial product or
+service that:
+
+1. substitutes for the Software;
+
+2. substitutes for any other product or service we offer using the Software
+ that exists as of the date we make the Software available; or
+
+3. offers the same or substantially similar functionality as the Software.
+
+Permitted Purposes specifically include using the Software:
+
+1. for your internal use and access;
+
+2. for non-commercial education;
+
+3. for non-commercial research; and
+
+4. in connection with professional services that you provide to a licensee
+ using the Software in accordance with these Terms and Conditions.
+
+### Patents
+
+To the extent your use for a Permitted Purpose would necessarily infringe our
+patents, the license grant above includes a license under our patents. If you
+make a claim against any party that the Software infringes or contributes to
+the infringement of any patent, then your patent license to the Software ends
+immediately.
+
+### Redistribution
+
+The Terms and Conditions apply to all copies, modifications and derivatives of
+the Software.
+
+If you redistribute any copies, modifications or derivatives of the Software,
+you must include a copy of or a link to these Terms and Conditions and not
+remove any copyright notices provided in or with the Software.
+
+### Disclaimer
+
+THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
+PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
+
+IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
+SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
+EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
+
+### Trademarks
+
+Except for displaying the License Details and identifying us as the origin of
+the Software, you have no right under these Terms and Conditions to use our
+trademarks, trade names, service marks or product names.
+
+## Grant of Future License
+
+We hereby irrevocably grant you an additional license to use the Software under
+the Apache License, Version 2.0 that is effective on the second anniversary of
+the date we make the Software available. On or after that date, you may use the
+Software under the Apache License, Version 2.0, in which case the following
+will apply:
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License.
+
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed
+under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 7d8f80b6..538a4e5d 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ yarn:
zoekt:
mkdir -p bin
go build -C vendor/zoekt -o $(PWD)/bin ./cmd/...
- export PATH=$(PWD)/bin:$(PATH)
+ export PATH="$(PWD)/bin:$(PATH)"
export CTAGS_COMMANDS=ctags
clean:
@@ -34,6 +34,8 @@ clean:
packages/error/dist \
packages/mcp/node_modules \
packages/mcp/dist \
+ packages/shared/node_modules \
+ packages/shared/dist \
.sourcebot
soft-reset:
diff --git a/README.md b/README.md
index 2b9e9354..e5940334 100644
--- a/README.md
+++ b/README.md
@@ -8,9 +8,6 @@
-
-
-## Code Formatting
-
-We suggest using extensions on your IDE to recognize and format MDX. If you're a VSCode user, consider the [MDX VSCode extension](https://marketplace.visualstudio.com/items?itemName=unifiedjs.vscode-mdx) for syntax highlighting, and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) for code formatting.
-
-## Troubleshooting
-
-Enables/disables authentication with basic credentials. Username and passwords are stored encrypted at rest within the postgres database. Checkout the [auth docs](/docs/configuration/auth/overview) for more info
| +| `AUTH_EMAIL_CODE_LOGIN_ENABLED` | `false` |Enables/disables authentication with a login code that's sent to a users email. `SMTP_CONNECTION_URL` and `EMAIL_FROM_ADDRESS` must also be set. Checkout the [auth docs](/docs/configuration/auth/overview) for more info
| +| `AUTH_SECRET` | Automatically generated at startup if no value is provided. Generated using `openssl rand -base64 33` |Used to validate login session cookies
| +| `AUTH_URL` | - |URL of your Sourcebot deployment, e.g., `https://example.com` or `http://localhost:3000`.
| +| `CONFIG_PATH` | `-` |The container relative path to the declerative configuration file. See [this doc](/docs/configuration/declarative-config) for more info.
| +| `DATA_CACHE_DIR` | `$DATA_DIR/.sourcebot` |The root data directory in which all data written to disk by Sourcebot will be located.
| +| `DATA_DIR` | `/data` |The directory within the container to store all persistent data. Typically, this directory will be volume mapped such that data is persisted across container restarts (e.g., `docker run -v $(pwd):/data`)
| +| `DATABASE_DATA_DIR` | `$DATA_CACHE_DIR/db` |The data directory for the default Postgres database.
| +| `DATABASE_URL` | `postgresql://postgres@ localhost:5432/sourcebot` |Connection string of your Postgres database. By default, a Postgres database is automatically provisioned at startup within the container.
If you'd like to use a non-default schema, you can provide it as a parameter in the database url
| +| `EMAIL_FROM_ADDRESS` | `-` |The email address that transactional emails will be sent from. See [this doc](/docs/configuration/transactional-emails) for more info.
| +| `FORCE_ENABLE_ANONYMOUS_ACCESS` | `false` |When enabled, [anonymous access](/docs/configuration/auth/access-settings#anonymous-access) to the organization will always be enabled
+| `REDIS_DATA_DIR` | `$DATA_CACHE_DIR/redis` |The data directory for the default Redis instance.
| +| `REDIS_URL` | `redis://localhost:6379` |Connection string of your Redis instance. By default, a Redis database is automatically provisioned at startup within the container.
| +| `REDIS_REMOVE_ON_COMPLETE` | `0` |Controls how many completed jobs are allowed to remain in Redis queues
| +| `REDIS_REMOVE_ON_FAIL` | `100` |Controls how many failed jobs are allowed to remain in Redis queues
| +| `REPO_SYNC_RETRY_BASE_SLEEP_SECONDS` | `60` |The base sleep duration (in seconds) for exponential backoff when retrying repository sync operations that fail
| +| `GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS` | `600` |The timeout duration (in seconds) for GitLab client queries
| +| `SHARD_MAX_MATCH_COUNT` | `10000` |The maximum shard count per query
| +| `SMTP_CONNECTION_URL` | `-` |The url to the SMTP service used for sending transactional emails. See [this doc](/docs/configuration/transactional-emails) for more info.
| +| `SOURCEBOT_ENCRYPTION_KEY` | Automatically generated at startup if no value is provided. Generated using `openssl rand -base64 24` |Used to encrypt connection secrets and generate API keys.
| +| `SOURCEBOT_PUBLIC_KEY_PATH` | `/app/public.pem` |Sourcebot's public key that's used to verify encrypted license key signatures.
| +| `SOURCEBOT_LOG_LEVEL` | `info` |The Sourcebot logging level. Valid values are `debug`, `info`, `warn`, `error`, in order of severity.
| +| `SOURCEBOT_STRUCTURED_LOGGING_ENABLED` | `false` |Enables/disable structured JSON logging. See [this doc](/docs/configuration/structured-logging) for more info.
| +| `SOURCEBOT_STRUCTURED_LOGGING_FILE` | - |Optional file to log to if structured logging is enabled
| +| `SOURCEBOT_TELEMETRY_DISABLED` | `false` |Enables/disables telemetry collection in Sourcebot. See [this doc](/docs/overview.mdx#telemetry) for more info.
| +| `TOTAL_MAX_MATCH_COUNT` | `100000` |The maximum number of matches per query
| +| `ZOEKT_MAX_WALL_TIME_MS` | `10000` |The maximum real world duration (in milliseconds) per zoekt query
| + +### Enterprise Environment Variables +| Variable | Default | Description | +| :------- | :------ | :---------- | +| `SOURCEBOT_EE_AUDIT_LOGGING_ENABLED` | `true` |Enables/disables audit logging
| +| `AUTH_EE_GITHUB_BASE_URL` | `https://github.com` |The base URL for GitHub Enterprise SSO authentication.
| +| `AUTH_EE_GITHUB_CLIENT_ID` | `-` |The client ID for GitHub Enterprise SSO authentication.
| +| `AUTH_EE_GITHUB_CLIENT_SECRET` | `-` |The client secret for GitHub Enterprise SSO authentication.
| +| `AUTH_EE_GITLAB_BASE_URL` | `https://gitlab.com` |The base URL for GitLab Enterprise SSO authentication.
| +| `AUTH_EE_GITLAB_CLIENT_ID` | `-` |The client ID for GitLab Enterprise SSO authentication.
| +| `AUTH_EE_GITLAB_CLIENT_SECRET` | `-` |The client secret for GitLab Enterprise SSO authentication.
| +| `AUTH_EE_GOOGLE_CLIENT_ID` | `-` |The client ID for Google SSO authentication.
| +| `AUTH_EE_GOOGLE_CLIENT_SECRET` | `-` |The client secret for Google SSO authentication.
| +| `AUTH_EE_KEYCLOAK_CLIENT_ID` | `-` |The client ID for Keycloak SSO authentication.
| +| `AUTH_EE_KEYCLOAK_CLIENT_SECRET` | `-` |The client secret for Keycloak SSO authentication.
| +| `AUTH_EE_KEYCLOAK_ISSUER` | `-` |The issuer URL for Keycloak SSO authentication.
| +| `AUTH_EE_OKTA_CLIENT_ID` | `-` |The client ID for Okta SSO authentication.
| +| `AUTH_EE_OKTA_CLIENT_SECRET` | `-` |The client secret for Okta SSO authentication.
| +| `AUTH_EE_OKTA_ISSUER` | `-` |The issuer URL for Okta SSO authentication.
| +| `AUTH_EE_GCP_IAP_ENABLED` | `false` |When enabled, allows Sourcebot to automatically register/login from a successful GCP IAP redirect
| +| `AUTH_EE_GCP_IAP_AUDIENCE` | - |The GCP IAP audience to use when verifying JWT tokens. Must be set to enable GCP IAP JIT provisioning
| + + +### Review Agent Environment Variables +| Variable | Default | Description | +| :------- | :------ | :---------- | +| `GITHUB_APP_ID` | `-` |The GitHub App ID used for review agent authentication.
| +| `GITHUB_APP_PRIVATE_KEY_PATH` | `-` |The container relative path to the private key file for the GitHub App used by the review agent.
| +| `GITHUB_APP_WEBHOOK_SECRET` | `-` |The webhook secret for the GitHub App used by the review agent.
| +| `OPENAI_API_KEY` | `-` |The OpenAI API key used by the review agent.
| +| `REVIEW_AGENT_API_KEY` | `-` |The Sourcebot API key used by the review agent.
| +| `REVIEW_AGENT_AUTO_REVIEW_ENABLED` | `false` |Enables/disables automatic code reviews by the review agent.
| +| `REVIEW_AGENT_LOGGING_ENABLED` | `true` |Enables/disables logging for the review agent. Logs are saved in `DATA_CACHE_DIR/review-agent`
| +| `REVIEW_AGENT_REVIEW_COMMAND` | `review` |The command used to trigger a code review by the review agent.
| + diff --git a/docs/docs/configuration/language-model-providers.mdx b/docs/docs/configuration/language-model-providers.mdx new file mode 100644 index 00000000..d372c83d --- /dev/null +++ b/docs/docs/configuration/language-model-providers.mdx @@ -0,0 +1,291 @@ +--- +title: Language Model Providers +sidebarTitle: Language model providers +--- + +To use [Ask Sourcebot](/docs/features/ask) you must define at least one Language Model Provider. These providers are defined within the [config file](/docs/configuration/config-file) you +provide Sourcebot. + + +```json wrap icon="code" Example config with language model provider +{ + "$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", + "models": [ + // 1. Google Vertex config for Gemini 2.5 Pro + { + "provider": "google-vertex", + "model": "gemini-2.5-pro", + "displayName": "Gemini 2.5 Pro", + "project": "sourcebot", + "credentials": { + "env": "GOOGLE_APPLICATION_CREDENTIALS" + } + }, + // 2. OpenAI config for o3 + { + "provider": "openai", + "model": "o3", + "displayName": "o3", + "token": { + "env": "OPENAI_API_KEY" + } + } + ] +} +``` + +# Supported Providers + +Sourcebot uses the [Vercel AI SDK](https://ai-sdk.dev/docs/introduction), so it can integrate with any provider the SDK supports. If you don't see your provider below please submit +a [feature request](https://github.com/sourcebot-dev/sourcebot/discussions/categories/feature-requests). + +For a detailed description of all the providers, please refer to the [schema](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/languageModel.json). + +
+
+ The Sourcebot logging level. Valid values are `debug`, `info`, `warn`, `error`, in order of severity.
| -| `DATABASE_URL` | `postgresql://postgres@ localhost:5432/sourcebot` |Connection string of your Postgres database. By default, a Postgres database is automatically provisioned at startup within the container.
If you'd like to use a non-default schema, you can provide it as a parameter in the database url
| -| `REDIS_URL` | `redis://localhost:6379` |Connection string of your Redis instance. By default, a Redis database is automatically provisioned at startup within the container.
| -| `SOURCEBOT_ENCRYPTION_KEY` | - |Used to encrypt connection secrets. Generated using `openssl rand -base64 24`. Automatically generated at startup if no value is provided.
| -| `AUTH_SECRET` | - |Used to validate login session cookies. Generated using `openssl rand -base64 33`. Automatically generated at startup if no value is provided.
| -| `AUTH_URL` | - |URL of your Sourcebot deployment, e.g., `https://example.com` or `http://localhost:3000`. Required when `SOURCEBOT_AUTH_ENABLED` is `true`.
| -| `SOURCEBOT_TENANCY_MODE` | `single` |The tenancy configuration for Sourcebot. Valid values are `single` or `multi`. See [this doc](/self-hosting/more/tenancy) for more info.
| -| `SOURCEBOT_AUTH_ENABLED` | `false` |Enables/disables authentication in Sourcebot. If set to `false`, `SOURCEBOT_TENANCY_MODE` must be `single`. See [this doc](/self-hosting/more/authentication) for more info.
| -| `SOURCEBOT_TELEMETRY_DISABLED` | `false` |Enables/disables telemetry collection in Sourcebot. See [this doc](/self-hosting/security/telemetry) for more info.
| -| `DATA_DIR` | `/data` |The directory within the container to store all persistent data. Typically, this directory will be volume mapped such that data is persisted across container restarts (e.g., `docker run -v $(pwd):/data`)
| -| `DATA_CACHE_DIR` | `$DATA_DIR/.sourcebot` |The root data directory in which all data written to disk by Sourcebot will be located.
| -| `DATABASE_DATA_DIR` | `$DATA_CACHE_DIR/db` |The data directory for the default Postgres database.
| -| `REDIS_DATA_DIR` | `$DATA_CACHE_DIR/redis` |The data directory for the default Redis instance.
| - - -## Additional Features - -There are additional features that can be enabled and configured via environment variables. - -+ Code navigation is not enabled for router.push(`/${domain}/settings/license`)}>your plan. +
+ + + Learn more + +No symbol selected
+ + Learn more + +{ + setIsRenameDialogOpen(true); + }} + > + {name ?? 'Untitled chat'} +
+Recent Chats
++ + Sign in + to access your chat history. +
+Recent chats will appear here.
+- {/* hack since to make the @ symbol look more centered with the text */} - - @ - - {`${branchDisplayName}`} -
- )} - ยท -Signing in with Google Cloud IAP...
++ {suggestionTypes[selectedSuggestionType].title} +
+ {suggestions[selectedSuggestionType].map(({ queryText, queryNode, openRepoSelector }, index) => ( +