git clone https://github.com/sathreddy/code-explorer.git
cd code-explorer
bun install
bun test # Verify everything worksRequires Bun v1.0+.
- Create a branch for your change
- Write tests first (TDD) — add to
tests/ - Implement the feature
- Run
bun test— all tests must pass - Run
bun run build— binary must compile - Commit with a concise imperative message
# Development (no build needed)
bun run dev <source> "<question>" [options]
# Production binary
bun run build
./bin/code-explorer <source> "<question>" [options]bun test # All tests
bun test tests/detect.test.ts # Specific file
bun test --watch # Watch modeTest fixtures live in tests/fixtures/ — each subdirectory is a minimal project skeleton for a specific language/framework.
See CLAUDE.md for a detailed architecture walkthrough. The key modules:
| Module | Responsibility |
|---|---|
explorer.ts |
Orchestrates source resolution, LLM loop, tool execution |
llm/provider.ts |
Unified interface for Gemini, Anthropic, OpenAI, OpenRouter |
detect.ts |
Identifies project type from config files |
prompts.ts |
System prompts for 4 exploration modes |
output.ts |
Parses structured LLM responses, extracts Mermaid diagrams |
interactive.ts |
REPL for follow-up questions |
tools/* |
File system tools (tree, read, grep, glob) |
remote/* |
GitHub/GitLab API and git clone support |
- Add a class implementing
LLMProviderinsrc/llm/provider.ts - Add an entry to
MODEL_ALIASESandKNOWN_PRICING - Add a case to
detectProvider()andcreateProvider() - Add tests in
tests/llm-provider.test.ts
- Add a fixture directory in
tests/fixtures/ - Add detection logic in
src/detect.ts - Add focus areas in
buildFocusAreas() - Add tests in
tests/detect.test.ts
- Add the mode name to the
ExplorationModetype insrc/prompts.ts - Add a mode-specific prompt in
MODE_PROMPTS - Update the
VALID_MODESarray insrc/index.ts - Add tests in
tests/exploration.test.ts
- Self-documenting code — clear names, no inline comments
- No docstrings or change-tracking comments
- TypeScript strict mode
- Imperative commit messages ("Add feature" not "Added feature")
At least one API key is required:
| Variable | Provider |
|---|---|
GEMINI_API_KEY |
Google Gemini (default) |
ANTHROPIC_API_KEY |
Anthropic Claude |
OPENAI_API_KEY |
OpenAI GPT |
OPENROUTER_API_KEY |
OpenRouter (DeepSeek, Mistral, etc.) |
Optional:
GITHUB_TOKEN— for private repos and higher rate limitsGITLAB_TOKEN— for private GitLab repos