npm package: @invertase/gitbash
Description: CLI for asking questions about GitHub repos through gitbash.ai
Latest version: 0.2.1

# gitbash

`gitbash` is a terminal CLI for asking questions about GitHub repositories.

Install it globally:

```bash
npm i -g @invertase/gitbash
```

Then use it locally:

```bash
gitbash --repo invertase/react-native-firebase "How does auth work?"
```

## Quick start

Set your defaults once:

```bash
gitbash config \
  --model anthropic/claude-haiku-4-5 \
  --anthropic-token "$ANTHROPIC_API_KEY"
```

Then ask questions:

```bash
gitbash --repo invertase/react-native-firebase "How does auth work?"
gitbash --repo invertase/react-native-firebase --ref next "Summarize the Firebase app setup"
gitbash "Tell me about invertase/react-native-firebase"
```

If `--repo` is omitted, `gitbash` will try to infer `owner/repo` from the prompt.

## Models

`--model` supports provider-prefixed models such as:

- `anthropic/claude-haiku-4-5`
- `openai/gpt-4.1`
- `google/gemini-2.5-flash`
- `xai/grok-4`
- `local` or `local/<model-id>`: OpenAI-compatible servers on your machine (LM Studio, Ollama `/v1`, etc.)

Examples:

```bash
gitbash --model anthropic/claude-haiku-4-5 --repo invertase/react-native-firebase "Explain auth"
gitbash --model openai/gpt-4.1 --repo invertase/react-native-firebase "Explain auth"
gitbash --model google/gemini-2.5-flash --repo invertase/react-native-firebase "Explain auth"
gitbash --model xai/grok-4 --repo invertase/react-native-firebase "Explain auth"
```

Local LLM (example: [LM Studio](https://lmstudio.ai/) serving at `http://localhost:1234/v1`):

```bash
export GITBASH_LOCAL_BASE_URL=http://localhost:1234/v1
gitbash --model local --repo invertase/react-native-firebase "Summarize the README"
# or pin a model id your server exposes:
gitbash --model local/qwen2.5-coder-7b --local-base-url http://localhost:1234/v1 --repo invertase/react-native-firebase "Explain auth"
```

`local` uses the server default model; `local/<id>` names a specific model. An API key is optional for most local servers; use `--local-token` or `GITBASH_LOCAL_API_KEY` if yours requires one.

Bare Anthropic model names also work:

```bash
gitbash --model claude-haiku-4-5 --repo invertase/react-native-firebase "Explain auth"
```

That is treated as `anthropic/claude-haiku-4-5`.

## Config

Configuration is stored in `~/.gitbash/config.json`.

Set a default model and token:

```bash
gitbash config \
  --model google/gemini-2.5-flash \
  --google-token "$GOOGLE_GENERATIVE_AI_API_KEY"
```

Store multiple provider tokens:

```bash
gitbash config \
  --anthropic-token "$ANTHROPIC_API_KEY" \
  --openai-token "$OPENAI_API_KEY" \
  --google-token "$GOOGLE_GENERATIVE_AI_API_KEY" \
  --xai-token "$XAI_API_KEY"
```

Default local OpenAI-compatible base URL and model (optional `--local-token` if your server needs it):

```bash
gitbash config \
  --model local \
  --local-base-url http://localhost:1234/v1
```

Override config for one command:

```bash
gitbash \
  --model openai/gpt-4.1 \
  --openai-token "$OPENAI_API_KEY" \
  --repo invertase/react-native-firebase \
  "How does auth work?"
```

## Flags

- `--repo <owner/repo>`: repository to inspect
- `--ref <ref>`: git ref to mount, defaults to `main`
- `--model <provider/model>`: model to use
- `--token <token>`: generic provider token
- `--anthropic-token <token>`: Anthropic API token
- `--openai-token <token>`: OpenAI API token
- `--google-token <token>`: Google API token
- `--xai-token <token>`: xAI API token
- `--local-base-url <url>`: OpenAI-compatible API base URL for `local` models (e.g. `http://localhost:1234/v1`)
- `--local-token <token>`: optional API key for local OpenAI-compatible servers
- `--api-url <url>`: override the gitbash API base URL

## Environment variables

You can use environment variables instead of flags:

- `GITBASH_MODEL`
- `GITBASH_API_URL`
- `GITBASH_API_TOKEN`
- `GITBASH_ANTHROPIC_API_KEY` or `ANTHROPIC_API_KEY`
- `GITBASH_OPENAI_API_KEY` or `OPENAI_API_KEY`
- `GITBASH_GOOGLE_API_KEY`, `GOOGLE_GENERATIVE_AI_API_KEY`, or `GOOGLE_API_KEY`
- `GITBASH_XAI_API_KEY` or `XAI_API_KEY`
- `GITBASH_LOCAL_BASE_URL`: base URL for `local` models (no trailing slash)
- `GITBASH_LOCAL_API_KEY`: optional API key for local OpenAI-compatible servers

Resolution order:

- CLI flags
- environment variables
- `~/.gitbash/config.json`
- built-in default for `apiUrl`

`model` must be set before a prompt can run. Cloud providers also need a matching API token; the `local` provider does not require a token unless your server enforces one.