BharatCode

Getting Started

Installation

BharatCode is a single, self-contained binary — no daemon, no background service, no native dependencies. Install it with Homebrew, npm, or a one-line script (no Go toolchain required), or build from a checkout of the source.

Homebrew (macOS / Linux)

Install from the BharatCode Homebrew tap. This fetches the prebuilt binary for your platform and puts bharatcode on your PATH — no Go toolchain needed.

homebrewbash
brew install arbazkhan971/tap/bharatcode

Upgrade later with brew upgrade bharatcode.

npm / npx

If you already have Node.js, install BharatCode from npm. The package downloads the right prebuilt binary for your platform on install.

npmbash
npm install -g bharatcode-cli    # global install # or run without installing:npx bharatcode-cli

Install script

A one-line installer downloads the latest release binary for your platform. On macOS and Linux it installs to ~/.local/bin; on Windows it installs to %LOCALAPPDATA%\Programs\bharatcode and updates your user PATH.

macOS / linuxbash
curl -fsSL https://raw.githubusercontent.com/arbazkhan971/bharatcode/main/install.sh | sh
windows (powershell)powershell
irm https://raw.githubusercontent.com/arbazkhan971/bharatcode/main/install.ps1 | iex

Pin a version

Set BHARATCODE_VERSION to install a specific release tag instead of the latest — for example curl -fsSL …/install.sh | BHARATCODE_VERSION=v0.2.0 sh.

go install

If you have Go 1.24 or newer, install directly with the Go toolchain. This compiles BharatCode and places the binary in your Go bin directory ($(go env GOPATH)/bin, typically ~/go/bin) — make sure that is on your PATH.

installbash
go install github.com/arbazkhan971/bharatcode@latest

Version reporting

The go install path does not stamp the build version, so bharatcode version and bharatcode update report an unknown commit. Use Homebrew, the install script, or a source build for accurate version reporting.

Verify the installation

Once the binary is on your PATH, confirm it runs and reports a version.

check versionbash
bharatcode version

If your shell prints “command not found”, the Go bin directory is not on your PATH yet — re-open your terminal after editing your shell profile, or run the binary by its full path (for example ~/go/bin/bharatcode version) to confirm it installed.

Run the doctor

bharatcode doctor runs an environment check — it inspects your setup and surfaces anything that might get in the way, such as a missing or unreadable config file or a provider whose API key environment variable is not set.

diagnose your setupbash
bharatcode doctor

Run it any time something feels off — right after installing, after editing your config, or when a provider is not being picked up.

Build from source

Prefer to build from a checkout — to track the main branch, hack on the code, or produce a binary in a controlled environment? Clone the repository and build it with the Go toolchain.

clone & buildbash
git clone https://github.com/arbazkhan971/bharatcode.gitcd bharatcodemake build        # stamps version + commit into the binary

That produces a bharatcode binary under bin/, which you can run directly or move onto your PATH:

run it / install itbash
./bin/bharatcode version # or install into your Go bin directorymake install

CGO-free

Building from source needs Go 1.24+ and nothing else. The build isCGO_ENABLED=0 — no C compiler, no system libraries — so the binary is fully static and easy to drop onto a server or into a CI image.

Upgrading

BharatCode can check for and apply updates itself — no package manager required. Two commands and one config option cover every upgrade workflow.

Check for a newer version

Run bharatcode update to compare the installed version against the latest release. Nothing is downloaded or changed — it only reports whether an update is available.

check for updatesbash
bharatcode update

Download and apply an update

Pass --apply to fetch the latest release binary, verify its SHA-256 checksum, and replace the running binary in place.

self-updatebash
bharatcode update --apply

Checksum verification

--apply verifies the downloaded binary's SHA-256 checksum against the published digest before writing anything. A mismatch hard-fails the update — the existing binary is left untouched. --apply is also a no-op in offline mode and for unstamped builds (such as those produced by go install).

Auto-update on startup

Set auto_update to true under options in your config to let BharatCode check and apply updates automatically in the background each time it starts. The check is skipped in offline mode and for unstamped builds.

~/.config/bharatcode/config.jsonjson
{  "options": {    "auto_update": true  }}

Confirm any upgrade landed with bharatcode version.

Next steps

With the binary installed and verified, you are ready to point it at a model and start working.