Your AI-powered codebase companion that speaks your language
Code Bandit transforms how you interact with your codebase. Instead of memorizing complex commands or digging through documentation, just tell your AI assistant what you want to do in plain English β and watch the magic happen.
Stop context switching. Start conversing.
- π¬ Chat with your codebase β Ask questions like "What does this function do?" or "Add error handling to this API"
- π Instant code analysis β "Find all unused imports" or "Show me the database schema"
- β‘ AI-powered refactoring β "Convert this class to TypeScript" or "Add unit tests for this module"
- π οΈ Smart automation β "Set up ESLint" or "Generate API documentation"
- π Safe by default β Built-in safety modes and confirmation prompts
- π― Multiple interfaces β CLI, VS Code extension, and programmatic API
Perfect for:
- π§βπ» Developers exploring new codebases
- ποΈ Code reviews and refactoring sessions
- π Learning from existing projects
- π Debugging and troubleshooting
- π Documentation and analysis
- π Automated commit message generation
npm install -g @janole/code-bandit
cd your-awesome-project
coba -p ollama -m llama3.2:3b
You: Show me the main entry points of this project
AI: I found 3 main entry points...
You: Add error handling to the API routes
AI: I'll add comprehensive error handling. Let me update the files...
npm install -g @janole/code-bandit
npx @janole/code-bandit -p ollama -m magistral:24b
# Install the official VS Code extension
coba install-extension
# Or install a specific version
coba install-extension --tag v0.3.13
With OpenAI:
# Set your API key
export OPENAI_API_KEY="your-key-here"
coba -p openai -m gpt-5
With Ollama (local):
# Install Ollama first: https://ollama.ai
ollama pull llama3.2:3b
coba -p ollama -m llama3.2:3b
With Google Gemini:
export GOOGLE_API_KEY="your-key-here"
coba -p gemini -m gemini-2.5-pro
With Anthropic Claude:
export ANTHROPIC_API_KEY="your-key-here"
coba -p anthropic -m claude-sonnet-4-20250514
You: "What's the architecture of this project?"
You: "Find all TODO comments"
You: "Explain this complex function in simple terms"
You: "Add TypeScript types to this JavaScript file"
You: "Generate unit tests for the user service"
You: "Create a README for this component"
You: "Extract this logic into a reusable utility"
You: "Remove unused imports from all files"
You: "Convert this callback to async/await"
You: "Set up ESLint with TypeScript"
You: "Add a pre-commit hook for formatting"
You: "Configure Jest for testing"
# One-shot commit message generation
echo "Brief context about changes" | coba exec "Generate a conventional commit message" -o -
# Interactive documentation help
You: "Update the API documentation for the new endpoints"
You: "Generate a changelog from recent commits"
coba
orcoba chat [options]
β Start an interactive chat session (default command)coba exec <message...> [options]
β Run a one-off, non-interactive requestcoba install-extension [--tag <tag>]
β Install the official VS Code extension
Option | Description | Default / Examples |
---|---|---|
-p, --provider <provider> |
Model provider to use | env: CODE_BANDIT_PROVIDER (e.g. ollama , openai , anthropic , gemini ) |
-m, --model <model> |
Model identifier | env: CODE_BANDIT_MODEL (e.g. gpt-5 , gpt-oss , claude-sonnet-4-20250514 ) |
-u, --api-url <url> |
API base URL for provider | e.g. self-hosted endpoint |
-k, --api-key <key> |
API key passed to the provider | Your API key |
--context-size <size> |
Max context window (tokens) used for chat history | Default: 8192 for ollama , provider default otherwise |
--max-messages <count> |
Max number of messages to retain in history | Default: 10 |
-R, --repo-path <path> |
Git repository directory to work in | Default: . |
--read-only |
Use read-only tool mode (no file changes) | Safe exploration |
--write-mode |
Enable YOLO write mode for tools (destructive) | Use with caution |
--no-agent-rules |
Disable loading of AGENTS.md, .cursorrules, etc. | β |
--debug |
Show debug information | β |
Option | Description |
---|---|
-C, --continue-session <filename> |
Continue with a previous session file |
--start-message <message> |
Start the chat by sending an initial message |
--no-stream |
Disable streaming responses |
Option | Description |
---|---|
-o <file> |
Write the model's final text output to a file (- for stdout) |
Notes:
exec
also reads from stdin and appends it to the message. Example:echo "extra context" | coba exec "Summarize this" -p openai -m gpt-4o
.- Environment variables
CODE_BANDIT_PROVIDER
andCODE_BANDIT_MODEL
can be used to set default provider/model.
Command | Description |
---|---|
coba install-extension --tag <tag> |
Download and install the official VS Code extension. Use --tag vX.Y.Z for a specific version or omit for latest . Requires the code CLI in PATH. |
Extension Features:
- Smart Commit Messages: Auto-generate conventional commit messages from your staged changes
- Keyboard Shortcut:
Ctrl+Alt+C
(Windows/Linux) orCmd+Alt+C
(Mac) - Configurable Models: Choose your preferred AI model for commit generation
Code Bandit is designed with safety in mind:
confirm
(Default) β Asks permission before any file changesread-only
β Pure analysis mode, no modifications allowedyolo
β Full automation mode (use in git repositories!)
- All shell commands run in isolated Docker containers, protecting your system from potentially harmful operations.
list-directory
β Browse project structureread-file
β Examine file contentsfind-files
β Search by patterns (**/*.ts
,src/**/*.js
)search-in-files
β Find text across your codebasegit-diff
β View git changesgit-log
β Check commit historycopy-to-clipboard
β Copy content for external use
write-file
β Create or modify filesdelete-file
β Remove files permanentlymove-file
β Rename or relocate filescreate-directory
β Create new foldersexecute-command
β Run shell commands
- Always use git: Work in git repositories so you can easily review and revert changes
- Review changes: Use
git diff
to review all modifications before committing - Session continuity: Use
--continue-session
to maintain context across multiple interactions
- π₯ TypeScript β Type-safe development experience
- βοΈ Ink + React β Beautiful, responsive terminal UI
- π¦ LangChain.js β Multi-provider AI integration with tool calling
- β‘ ESBuild β Lightning-fast builds and bundling
- π― Commander.js β Robust CLI argument parsing
- π± VS Code API β Native editor integration
We love contributions! Code Bandit is actively developed and there's exciting work ahead.
git clone https://github.com/janole/code-bandit.git
cd code-bandit
npm install
npm run dev
Check out our development guide for more details.
π§ Alpha Release β Code Bandit is experimental but rapidly evolving. We recommend using it in git repositories so you can easily review and revert changes.
Recent Additions:
- π― VS Code extension with smart commit messages
- π Comprehensive command options and session management
- π§ Enhanced tool safety and file system operations
- π Multiple output formats and stdin support
- π Expanded AI provider support
Roadmap:
- π Web interface and dashboard
- π Plugin ecosystem for custom tools
- π± Mobile companion app
- π€ Advanced code understanding and suggestions
MIT Β© Jan Ole Suhr
β Star us on GitHub if Code Bandit makes your coding life easier!