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 🙏

© 2026 – Pkg Stats / Ryan Hefner

babar-ai

v0.2.0

Published

An intelligent codebase analyzer that creates AI-friendly documentation

Readme

Babar :elephant:

Babar is an intelligent codebase analyzer designed to bridge the gap between your existing codebase and modern AI-powered development workflows. By recursively analyzing your project's directory structure and creating smart summaries, Babar helps both developers and AI tools better understand and work with your codebase.

Why Babar?

  • 🤖 AI-First Documentation: Creates documentation that's optimized for both humans and AI assistants
  • 📦 Codebase Understanding: Helps new developers and AI tools quickly understand your project structure
  • 🔄 Living Documentation: Automatically updates as your codebase evolves
  • 🎯 Contextual Analysis: Provides deep insights about components, patterns, and technical debt
  • 🚀 Fast & Efficient: Processes directories in parallel and caches results

Getting Started

Installation

npm install -g babar-ai

Environment Variables

OPENAI_API_KEY=your-api-key-here
DEBUG=false  # Set to true to see OpenAI requests and responses

Configuration

Babar can be customized using a .babar.json file in your project root. This allows you to define:

  • Custom analysis sections
  • Prompt templates
  • OpenAI settings
  • File patterns

Configuration Options

| Option | Description | Default | | --------------------- | ------------------------------- | ------------------------------ | | sections | Define custom analysis sections | See default config | | promptTemplate | Template for the AI prompt | See default config | | model | OpenAI model to use | "gpt-4" | | temperature | AI response creativity (0-1) | 0.1 | | maxTokensPerRequest | Max tokens per API call | 4000 | | includeFiles | File patterns to analyze | ["**/*.js", "**/*.jsx", ...] | | excludePatterns | File patterns to ignore | ["**/node_modules/**", ...] |

Each section in the sections object requires:

  • type: Either "string" or "array"
  • description: What the section should contain
  • required: Whether the section is required

The promptTemplate supports these variables:

  • {fileCount}: Number of files being analyzed
  • {childCount}: Number of subdirectories
  • {sections}: Auto-generated section prompts
  • {includeSubdirs}: Subdirectory analysis prompt

Default Configuration

By default, Babar analyzes your codebase with these sections:

{
  "sections": {
    "components": {
      "type": "array",
      "description": "Key components and modules",
      "required": true
    },
    "architecture": {
      "type": "string",
      "description": "Component interactions and patterns",
      "required": true
    },
    "conventions": {
      "type": "string",
      "description": "Coding standards and practices",
      "required": true
    },
    "refactoringOpportunities": {
      "type": "array",
      "description": "Potential improvements",
      "required": true
    },
    "technicalDebt": {
      "type": "string",
      "description": "Areas needing attention",
      "required": true
    }
  },
  "promptTemplate": "You are a technical documentation expert analyzing {fileCount} files and {childCount} subdirectories.\n\nCreate a comprehensive analysis following this structure:\n\n{sections}\n\n{includeSubdirs}\n\nFocus on clarity and maintainability. Explain complex concepts clearly.",
  "model": "gpt-4",
  "temperature": 0.1,
  "maxTokensPerRequest": 4000,
  "includeFiles": ["**/*.js", "**/*.py", "**/*.rb"],
  "excludePatterns": ["**/node_modules/**", "**/dist/**"]
}

Configuration Priority

  1. Environment variables take highest precedence
  2. Project-specific .babar.json
  3. Default configuration

Usage

# Analyze current directory
babar -d .

# Analyze specific directory
babar -d /path/to/project

# Show help
babar --help

How It Works

  1. Babar recursively scans your project directory
  2. For each directory, it:
    • Lists all files and subdirectories
    • Analyzes the contents using GPT-4
    • Generates a .babar.md file with the analysis
  3. The analysis includes:
    • Key components and their purposes
    • Architecture patterns
    • Coding conventions
    • Potential improvements
    • Technical debt notes

Using with AI Assistants

To help AI assistants understand your codebase, add this to your assistant's configuration:

{
  "contextRules": {
    "includeFiles": ["**/.babar.md"],
    "maxFilesToSearch": 500,
    "maxCharsPerFile": 100000
  },
  "fileSearch": {
    "include": ["**/.babar.md"],
    "exclude": [],
    "maxResults": 10
  }
}

This configuration:

  1. Includes .babar.md files in the context provided to AI assistants
  2. Prioritizes .babar.md files during codebase searches
  3. Ensures the AI has access to Babar's hierarchical documentation when answering questions about your codebase

For the best results:

  • Run Babar before starting new development sessions to ensure up-to-date context
  • Consider adding .babar.md files to your version control to share context with your team
  • Exclude .babar.md files from your .gitignore if you want to preserve the analysis across clones

License

MIT