Skip to main content

Codebased

Codebased is the most powerful code search tool that runs on your computer.

Here's why it's great:

  • Search, simplified: Combines semantic and full-text search to find what you're looking for, not just what you typed.
  • Search code, not just text: Searches for complete code structures, not just lines of text, in 11 languages.
  • Ignores uninteresting files: Respects your .gitignore file(s) and ignores hidden directories.
  • Instant editing: Selecting a search result opens your favorite editor at the correct file and line number.
  • Fast: Indexes your code in seconds, searches in milliseconds, and updates in real-time as you edit your code.
  • Open-source, runs locally: No code is stored on remote servers.

Getting Started

The fastest way to install Codebased is with pipx:

pipx install codebased

Verify the installation by running:

codebased --version

If this fails, please double-check your pipx installation.

Next, run the following command in a Git repository to start searching:

codebased search

The first time you run Codebased, it will create a configuration file at ~/.codebased/config.toml. It will prompt you for an OpenAI key, you can access a testing key on the Discord.

Once this is finished, codebased will create an index of your codebase, stored in .codebased at the root of your repository. This takes seconds for most projects, but can take a few minutes for large projects. Most of the time is spent creating embeddings using the OpenAI API.

Once the index is created, a terminal UI will open with a search bar. At this point, you can start typing a search query and results will appear as you type.

  • You can use the arrow keys and the mouse to navigate the results.
  • A preview of the selected result is displayed.
  • Pressing enter on the highlighted result opens the file in your editor at the correct line number.
  • Pressing escape returns to the search bar.
  • As you edit your code, the index will be updated in real-time, and future searches will reflect your changes.

Codebased will run stat on all non-ignored files in your repository, which can take a few seconds, but after that will listen for filesystem events, so it's recommended to use the TUI.

Development

If you'd like to contribute, bug fixes are welcome, as well as anything in the list of issues.

Especially welcome is support for your favorite language, as long as:

  1. There's a tree-sitter grammar for it.
  2. There are Python bindings for it maintained by the excellent amaanq.

Also, if there's anything ripgrep does that Codebased doesn't, feel free to file an issue / PR.

Clone the repository:

git clone https://github.com/codebased-sh/codebased.git

Install the project's dependencies (requires poetry, using a virtual environment is recommended):

poetry install

Run the tests (some tests require an OPENAI_API_KEY environment variable, usage is de minimis):

poetry run pytest

Appendix

Languages

  • C
  • C#
  • C++
  • Go
  • Java
  • JavaScript
  • PHP
  • Python
  • Ruby
  • Rust
  • TypeScript
  • HTML / CSS
  • SQL
  • Shell
  • Swift
  • Lua
  • Kotlin
  • Dart
  • R
  • Assembly language
  • OCaml
  • Zig
  • Haskell
  • Elixir
  • Erlang
  • TOML?
  • YAML?

Release files for codebased 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codebased 0.6.2
File Size Uploaded
codebased-0.6.2.tar.gz 31.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for codebased 0.6.2
File Interpreter ABI Platform
codebased-0.6.2-py3-none-any.whl Python 3 none any Details

Total release size: 67.4 kB

Release files / codebased-0.6.2.tar.gz

Download URL codebased-0.6.2.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cf8368885d8173b5c091f97c499d63a1a2fcafe8990247c79b35e622abb11655
BLAKE2b-256 checksum
How to use checksums
9ab066f4f7e943ddf1790d1102098a8f63f9ff7003879fb69695982e9df23b70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / codebased-0.6.2-py3-none-any.whl

Download URL codebased-0.6.2-py3-none-any.whl
Size 36.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
740a878a28f10647f2dd0db38860eeb4c42f50f184e1e273be3e82b526ef9a07
BLAKE2b-256 checksum
How to use checksums
d310f548cde04a7ebc686f2e77815bd13575063c28330e5b432b0b41c99a6c32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

0.6.2 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.22

2 release files

0.4.20

2 release files

0.4.19

2 release files

0.4.18

2 release files

0.4.17

2 release files

0.4.16

2 release files

0.4.15

2 release files

0.4.13

2 release files

0.4.12

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page