Terminal CLI for megasthenes — ask natural-language questions about any Git repository and get a source-cited, markdown-rendered answer.
megasthenes ask --repo https://github.com/owner/repo --question "What does this project do?"Full library docs: nilenso.github.io/megasthenes.
Requires Node.js ≥ 18 plus git, ripgrep, and fd on PATH.
# macOS
brew install git ripgrep fd
# Debian / Ubuntu (fd binary may be `fdfind`)
sudo apt install git ripgrep fd-findThe package is published to JSR as @nilenso/megasthenes-cli. JSR exposes packages to npm/bun under the @jsr scope, so first point that scope at JSR's npm registry:
echo "@jsr:registry=https://npm.jsr.io" >> ~/.npmrcThen install globally with your package manager of choice:
# npm
npm install -g @jsr/nilenso__megasthenes-cli
# bun
bun install -g @jsr/nilenso__megasthenes-cliEither installs a megasthenes executable on your PATH.
Export your LLM provider's API key:
| Provider | Env var |
|---|---|
| OpenRouter | OPENROUTER_API_KEY |
| Anthropic | ANTHROPIC_API_KEY |
| OpenAI | OPENAI_API_KEY |
GOOGLE_CLOUD_API_KEY |
Pin defaults in ~/.config/megasthenes/config.json (override with the MEGASTHENES_CONFIG env var). Keys are the camelCase form of the CLI flags:
{
"provider": "openrouter",
"model": "anthropic/claude-sonnet-4.6",
"thinkingEffort": "medium"
}Precedence: CLI flags > env vars > config file > built-in defaults.
megasthenes ask --repo <url> --question "<text>" [options]# Pin to a tag
megasthenes ask --repo https://github.com/owner/repo --question "Summarize the data model." \
--commitish v2.3.0
# Suppress the activity log — handy for piping
megasthenes ask --repo https://github.com/owner/repo --question "List public APIs." \
--response-only > apis.mdRun megasthenes ask --help for the full flag reference.
For untrusted repositories, run tool execution in an isolated container via the sandbox worker and point the CLI at it with --sandbox-base-url and --sandbox-secret.
| Code | Meaning |
|---|---|
| 0 | success |
| 1 | internal_error |
| 2 | max_iterations (gave up before producing an answer) |
| 3 | context_overflow |
| 4 | provider_error / network_error / empty_response |
| 64 | invalid CLI usage |
| 130 | aborted (Ctrl-C) |
git clone https://github.com/nilenso/megasthenes-cli
cd megasthenes-cli
npm install
npm testPublished to JSR as @nilenso/megasthenes-cli.
MIT © nilenso
