## Problem If a repository is added **after** a search context (e.g., a new repository is synced from the code host), then it will never be added to the context even if it should be included. The workaround is to restart the instance. ## Solution This PR adds a call to re-sync all search contexts whenever a connection is successfully synced. This PR adds the `@sourcebot/shared` package that contains `syncSearchContexts.ts` (previously in web) and it's dependencies (namely the entitlements system). ## Why another package? Because the `syncSearchContexts` call is now called from: 1. `initialize.ts` in **web** - handles syncing search contexts on startup and whenever the config is modified in watch mode. This is the same as before. 2. `connectionManager.ts` in **backend** - syncs the search contexts whenever a connection is successfully synced. ## Follow-up devex work Two things: 1. We have several very thin shared packages (i.e., `crypto`, `error`, and `logger`) that we can probably fold into this "general" shared package. `schemas` and `db` _feels_ like they should remain separate (mostly because they are "code-gen" packages). 2. When running `yarn dev`, any changes made to the shared package will only get picked if you `ctrl+c` and restart the instance. Would be nice if we have watch mode work across package dependencies in the monorepo. |
||
|---|---|---|
| .cursor/rules | ||
| .github | ||
| .vscode | ||
| .yarn/releases | ||
| configs | ||
| docs | ||
| ee | ||
| packages | ||
| schemas | ||
| vendor | ||
| .dockerignore | ||
| .env.development | ||
| .gitignore | ||
| .gitmodules | ||
| .yarnrc.yml | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| default-config.json | ||
| demo-site-config.json | ||
| docker-compose-dev.yml | ||
| Dockerfile | ||
| entrypoint.sh | ||
| fly.toml | ||
| grafana.alloy | ||
| LICENSE | ||
| Makefile | ||
| package.json | ||
| prefix-output.sh | ||
| public.pem | ||
| README.md | ||
| supervisord.conf | ||
| yarn.lock | ||
About
Sourcebot is the open source Sourcegraph alternative. Index all your repos and branches across multiple code hosts (GitHub, GitLab, Bitbucket, Gitea, or Gerrit) and search through them using a blazingly fast interface.
https://github.com/user-attachments/assets/ced355f3-967e-4f37-ae6e-74ab8c06b9ec
Features
- 💻 One-command deployment: Get started instantly using Docker on your own machine.
- 🔍 Multi-repo search: Index and search through multiple public and private repositories and branches on GitHub, GitLab, Bitbucket, Gitea, or Gerrit.
- ⚡Lightning fast performance: Built on top of the powerful Zoekt search engine.
- 🎨 Modern web app: Enjoy a sleek interface with features like syntax highlighting, light/dark mode, and vim-style navigation
- 📂 Full file visualization: Instantly view the entire file when selecting any search result.
You can try out our public hosted demo here!
Deploy Sourcebot
Sourcebot can be deployed in seconds using our official docker image. Visit our docs for more information.
- Create a config
touch config.json
echo '{
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
"connections": {
// Comments are supported
"starter-connection": {
"type": "github",
"repos": [
"sourcebot-dev/sourcebot"
]
}
}
}' > config.json
- Run the docker container
docker run \
-p 3000:3000 \
--pull=always \
--rm \
-v $(pwd):/data \
-e CONFIG_PATH=/data/config.json \
--name sourcebot \
ghcr.io/sourcebot-dev/sourcebot:latest
What does this command do?
- Pull and run the Sourcebot docker image from ghcr.io/sourcebot-dev/sourcebot:latest.
- Mount the current directory (
-v $(pwd):/data) to allow Sourcebot to persist the.sourcebotcache. - Clones sourcebot at
HEADinto.sourcebot/github/sourcebot-dev/sourcebot. - Indexes sourcebot into a .zoekt index file in
.sourcebot/index/. - Map port 3000 between your machine and the docker image.
- Starts the web server on port 3000.
- Start searching at
http://localhost:3000
To learn how to configure Sourcebot to index your own repos, please refer to our docs.
Note
Sourcebot collects anonymous usage data by default to help us improve the product. No sensitive data is collected, but if you'd like to disable this you can do so by setting the
SOURCEBOT_TELEMETRY_DISABLEDenvironment variable totrue. Please refer to our telemetry docs for more information.
Build from source
Note
Building from source is only required if you'd like to contribute. If you'd just like to use Sourcebot, we recommend checking out our self-hosting docs.
If you'd like to build from source, please checkout the CONTRIBUTING.md file for more information.