Skip to content

Latest commit

 

History

History
 
 

server

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Server

A cargo workspace which contains bleep, the Rust package which powers bloop's search and code navigation. Note that it is currently not possible to run conversational GPT-4 search from the command line (we're working on this). Calls to the /api/answer endpoint will return an error.

Setup

Install

Dependencies:

  • rust
  • openssl
  • onnxruntime
  • universal-ctags

Follow these instructions and verify the installation with ctags --version. You should see something like this:

Universal Ctags 5.9.0(6f10588d), Copyright (C) 2015-2022 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Aug 19 2022, 11:23:10
  URL: https://ctags.io/
  Optional compiled features: +wildcards, +regex, +gnulib_fnmatch, +gnulib_regex, +iconv, +option-directory, +xpath, +json, +interactive, +yaml, +case-insensitive-filenames, +packcc, +optscript

Make sure that +json is in the list of compiled features.

Build

cargo build -p bleep --release

Usage

To index and search all the repos in a directory (say, /path/to/source) run (from this repo's root dir):

$ cargo run -p bleep --release -- \
  --source-dir /path/to/dir

bleep will recursively scan /path/to/source for repositories and start indexing them. It will also start a webserver. The location of the search index can be specified with the --index-dir parameter. By default it is stored in the system cache.

bleep periodically checks for changes to local and remote repos and automatically reindexes if a change is detected. Indexing and polling can be disabled by passing the --disable-background and --disable-fsevents flags.

The log level can be customized by setting the BLOOP_LOG env var.

Sync GitHub

To sync GitHub repos, first create a GitHub Client ID. Then call bleep with the --github-client-id <token> parameter.

Query

With the server running you can start searching your code with regex search:

$ curl -v "localhost:7878/api/q?q=anyhow%20path:webserver%20repo:bloop" | jq

You can check which repos are indexed and their status:

$ curl -v "localhost:7878/api/repos/indexed" | jq

Arguments

Run this to see the full list of arguments that bleep accepts:

cargo run -p bleep -- --help

OpenAPI

You can view OpenAPI documentation (and railroad diagrams for the query language) here.

bleep uses utoipa to automatically generate an OpenAPI spec. To can manually access the OpenAPI spec with this endpoint:

$ curl "localhost:7878/api/api-doc/openapi.yaml"