A local-first AI command center for your terminal.
Ask better questions. Understand unfamiliar code. Ship with confidence.
Website · npm · Issues · Contributing
Dhruv brings a focused AI toolkit into the terminal, powered by local Ollama models. It keeps your workflow close to the codebase, works without a hosted AI account, and turns everyday developer questions into fast, actionable output.
| ✦ Think with you Explain concepts, suggest approaches, and turn errors into clear next steps. |
◈ Inspect deeply Review code, optimize files, and scan projects for common security risks. |
⌁ Fit your flow Use an interactive menu, shell completion, JSON output, or your own plugins. |
npm install -g @rahul05ranjan/dhruv-cliInstall Ollama, then run:
ollama serve
ollama pull gemma3:270mdhruv init
dhruv suggest "how should I structure this Node.js service?"Dhruv requires Node.js 20.19 or newer. The default model is gemma3:270m; choose any model available in your Ollama installation during setup.
| Command | What it does |
|---|---|
dhruv suggest <query> |
Generate practical suggestions for a development task |
dhruv explain <query> |
Explain a concept, command, or unfamiliar error |
dhruv fix <query> |
Analyze a coding issue and propose a fix |
dhruv review <file-or-dir> |
Review up to ten code files for quality and maintainability; add --diff for uncommitted changes |
dhruv optimize <file> |
Find actionable improvements for source or configuration files |
dhruv security-check [file-or-dir] |
Run a redacted local security analysis; add --strict for CI failure on high-confidence findings |
dhruv generate <type> <target> |
Preview generated tests by default; use --apply, --output, or --overwrite to write safely |
dhruv status |
Check Ollama connectivity and configured models |
dhruv health |
Show a concise health summary; use --details for diagnostics |
dhruv metrics |
Inspect local usage and performance metrics; use --raw or --reset explicitly |
dhruv project-type |
Detect the current project type |
dhruv menu |
Open the interactive command palette |
dhruv completion [shell] |
Generate Bash, Zsh, or Fish completion |
# Understand and plan
dhruv explain "git rebase vs merge"
dhruv suggest "deploy a React app to Vercel"
# Improve an existing project
dhruv review src/
dhruv review --diff .
dhruv optimize package.json
dhruv security-check src/
dhruv security-check src/ --strict
# Generate and automate
dhruv generate tests src/utils/helpers.js # preview only
dhruv generate tests src/utils/helpers.js --apply
dhruv completion zsh > ~/.zsh/completions/_dhruvRun dhruv init to set the Ollama model, response format, verbosity, terminal theme, and whether settings are project-local or user-global. Local configuration is stored in .dhruv-config.json; global settings live under your user config directory.
For one-off runs, use global flags:
dhruv suggest "summarize this migration" --model llama3.2 --json
dhruv review src/ --verbose
dhruv explain "what changed?" --timeout 60000Drop an ESM module into your project's plugins/ directory. Dhruv loads .js plugins before parsing the command line, so you can add commands without changing the core CLI.
// plugins/hello.js
export default (program) => {
program
.command('hello-plugin')
.description('Say hello from a project plugin')
.action(() => console.log('Hello from Dhruv!'));
};Then run:
dhruv hello-plugin| Resource | Link |
|---|---|
| Product site | rahul05ranjan.github.io/dhruv-cli |
| API reference | Generated TypeDoc |
| Contributing | CONTRIBUTING.md |
| Security policy | SECURITY.md |
| Publishing notes | docs/publishing-fix.md |
npm install
npm run type-check
npm test
npm run lint
npm run buildMIT © Rahul Ranjan