List, download and index github repos for trigram-based search on your machine using zoekt.
- Install node >= 12
- You need to have golang installed
- You need a github personal access token and it needs to be accessible in the environment as
GITHUB_PAT
when running
repo-zoek
.
go install github.com/google/zoekt/cmd/zoekt-index@latest
go install github.com/google/zoekt/cmd/zoekt@latest
# make sure npm does not try to install the script to /usr/local/bin or similar
npm config set prefix ~/.npm-pkg
# (TAKE CARE: if you use nvm or similar,
# make sure that your prefix setting does
# not interfere with nvm. In case of nvm, you
# can probably skip it.)
# install repo-zoek
npm install --global <https://link-to-latest-release.tgz>
# (SEE BELOW for the releases page)
(see release page for newest version)
make sure the go & npm bin path is in your $PATH
. You can get the path with
# $GOPATH/bin
go env GOPATH
# npm bin dir
npm bin --global
Example:
export PATH="$(go env GOPATH)/bin:$(npm bin -g):$PATH"
You need a
github personal access token
and it needs to be accessible in the environment as GITHUB_PAT
when running
repo-zoek
.
Help:
repo-zoek help
Initial setup of a new "project":
repo-zoek init
repo-zoek org list -d /path/to/project/dir
To download everything:
repo-zoek sync all
Search with
zoekt -r -index_dir path/to/search/index 'regex file:scala'
(I would alias zoekt -r -index_dir path/to/search/index
to a more convenient command)
jq -r '.name' </path/to/repos.ndjson | xargs -IREPO echo "abc REPO def"
- look for
.repo-zoek.json
in the current path - handle
GITHUB_PAT
better?