npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

mahabali

v1.0.33

Published

Mahabali AI multi-LLM assistant CLI

Readme

Mahabali CLI

npm version License: MIT

Mahabali is a powerful AI-powered developer CLI that brings multi-LLM intelligence directly into your workflow. Ask questions about your codebase, generate AI-powered patches, and manage code snapshots - all from your terminal.

Features

  • Multi-LLM Support - Choose between GPT, Claude, Grok, and Gemini
  • Smart Code Understanding - AI analyzes your entire codebase for context-aware responses
  • Safe Patch Application - Patches are tested in isolation before applying
  • Version Snapshots - Automatic backups before any AI-generated changes
  • Git-Aware - Respects .gitignore and integrates with your repository

Quick Start

1. Install

npm install -g mahabali

2. Login

mahabali login

Enter your email and password when prompted. Your credentials are securely stored in ~/.mahabali/config.json.

3. Link Your Project

Navigate to your project directory and run:

cd /path/to/your/project
mahabali link

Select an existing project or create a new one, then choose your preferred AI model.

4. Sync Your Codebase

mahabali sync

This uploads your code to Mahabali's backend where it's indexed for AI queries.

5. Start Using AI

# Ask questions about your code
mahabali ask "How does the authentication flow work?"

# Generate and apply AI-powered code changes
mahabali apply "Add input validation to the user registration form"

Commands

Authentication

| Command | Description | |---------|-------------| | mahabali login | Authenticate with email/password | | mahabali login --token <jwt> | Authenticate with a JWT token | | mahabali logout | Clear stored credentials |

Project Management

| Command | Description | |---------|-------------| | mahabali link | Link current directory to a Mahabali project | | mahabali status | Show project info, sync status, and pending changes | | mahabali sync | Upload code changes to Mahabali backend |

AI Interaction

| Command | Description | |---------|-------------| | mahabali ask "<query>" | Ask AI about your codebase | | mahabali ask "<query>" --model claude | Use a specific model (gpt, claude, grok, gemini) | | mahabali apply "<instruction>" | Generate and apply AI code changes | | mahabali apply "<instruction>" --model grok | Use a specific model for patch generation |

Model & Versions

| Command | Description | |---------|-------------| | mahabali model set <alias> | Set default model (gpt, claude, grok, gemini) | | mahabali versions --list | List available snapshots | | mahabali versions --save | Manually save a snapshot | | mahabali versions --revert <id> | Revert to a previous snapshot | | mahabali undo | Revert to the most recent snapshot |


Configuration

Global Config (~/.mahabali/config.json)

{
  "token": "your-jwt-token",
  "userId": "user-123",
  "email": "[email protected]",
  "baseUrl": "https://api.mahabali.ai"
}

Project Config (.mahabali/project.json)

Created automatically when you run mahabali link:

{
  "projectId": "proj-123",
  "linkedAt": "2025-01-01T00:00:00.000Z",
  "preferredModel": "gpt",
  "lastSyncHash": "abc123"
}

Environment Variables

| Variable | Description | Default | |----------|-------------|---------| | MAHABALI_BASE_URL | Backend API URL | https://api.mahabali.ai | | MAHABALI_HTTP_TIMEOUT_MS | HTTP request timeout | 30000 | | MAHABALI_DEBUG | Enable verbose logging | 0 | | MAHABALI_INSECURE_TLS | Skip TLS verification (dev only) | 0 |


Examples

Ask AI About Your Code

# Understand complex logic
mahabali ask "Explain what the processPayment function does"

# Find specific patterns
mahabali ask "Where are database connections handled?"

# Get suggestions
mahabali ask "How can I improve error handling in the API routes?"

Apply AI-Generated Changes

# Add new features
mahabali apply "Add a rate limiter middleware to all API routes"

# Refactor code
mahabali apply "Convert all callback functions to async/await"

# Fix issues
mahabali apply "Add null checks to prevent undefined errors in utils.js"

The apply command:

  1. Generates a patch based on your instruction
  2. Shows a preview of the changes
  3. Applies the patch in an isolated workspace
  4. Runs lint and tests (if available)
  5. Shows a diff for final approval
  6. Creates a snapshot backup before applying

Workflow Tips

Using Different AI Models

# Set a default model for all commands
mahabali model set claude

# Override for a single command
mahabali ask "Explain this code" --model grok

Managing Snapshots

# Before major changes, save a snapshot
mahabali versions --save

# See all available snapshots
mahabali versions --list

# Revert if something goes wrong
mahabali undo
# or
mahabali versions --revert snap-abc123

Ignoring Files

Create a .mahabaliignore file (same syntax as .gitignore) to exclude files from sync:

# .mahabaliignore
node_modules/
*.log
.env
dist/

Troubleshooting

"getaddrinfo ENOTFOUND api.mahabali.ai"

The CLI cannot reach the backend. Check your internet connection or set a custom backend URL:

mahabali login --base-url http://localhost:5000

"Project is not linked"

Run mahabali link in your project directory to connect it to Mahabali.

"Failed to apply patch"

The AI-generated patch may not apply cleanly. Try:

  1. Running mahabali sync to update the backend with your latest code
  2. Providing more specific instructions in your apply command
  3. Manually reviewing the patch and making adjustments

Enable Debug Logging

export MAHABALI_DEBUG=1
mahabali sync
# Check logs at ~/.mahabali/logs/cli.log

Requirements

  • Node.js 18+
  • npm 9+
  • Git (for patch application)

License

MIT