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

khodkar-cli

v1.1.0

Published

A TypeScript CLI application that extracts business rules and logic from codebases for customer support knowledge bases

Downloads

66

Readme

Khodkar CLI

Khodkar CLI is a powerful tool developed by khodkar.dezh.tech that helps teams extract business flow and logic documentation from their codebase. It's specifically designed to create comprehensive knowledge base documentation that helps support teams understand the business rules embedded in the code.

npm install -g khodkar-cli
khodkar analyze --directory ./my-project --output ./docs.md \
  --llm-base-url https://api.openai.com/v1 \
  --llm-api-key your-api-key-here \
  --llm-model gpt-4

Key Features

  • 2-Phase Sequential Analysis: Uses AI SDK's sequential generations pattern for comprehensive rule extraction
    • Repository Discovery: Identifies files containing customer-facing business logic using MCP filesystem tools
    • Rule Extraction & Documentation: Extracts and documents rules in customer-support-friendly language
  • Model Context Protocol (MCP) Integration: Leverages MCP servers for advanced file system operations and analysis
  • Supports multiple programming languages and frameworks
  • Generates documentation in Markdown format optimized for customer support teams
  • Uses advanced LLM technology with configurable providers (OpenAI, Anthropic, OpenAI-compatible)
  • Real-time progress tracking with phase-by-phase updates
  • Built-in Langfuse OpenTelemetry integration for comprehensive LLM observability and tracing
  • Organizes rules into 5 key categories: User Management, Authentication, Business Logic, Security Rules, and Workflow Rules

How It Works: 2-Phase Sequential Analysis

Khodkar CLI uses a sophisticated 2-phase sequential processing approach powered by the AI SDK's sequential generations pattern and Model Context Protocol (MCP) integration:

Phase 1: Repository Discovery

  • Purpose: Identifies files containing customer-facing business logic
  • Tools: Uses MCP filesystem server with list_directory, search_files, and read_text_file tools
  • Focus: Files that help answer support questions like "Why can't a user do X?" or "What are the limits for Y?"
  • Strategy: Systematic exploration prioritizing user workflows, validation rules, controllers, and business constraints
  • Output: Curated list of relevant files with customer support relevance

Phase 2: Rule Extraction & Documentation

  • Purpose: Extracts business rules and creates comprehensive documentation in one integrated step
  • Process: Reads identified files and transforms code logic into customer-support-friendly documentation
  • Format: Structured Markdown with sections for rule descriptions, customer impact, troubleshooting steps, and examples
  • Output: Complete customer support knowledge base document

This sequential approach ensures comprehensive coverage while maintaining focus on customer-support-relevant information, with each phase building upon the previous phase's output.

Basic Usage

khodkar analyze \
  --directory ./my-project \
  --output ./business-rules.md \
  --llm-base-url https://api.openai.com/v1 \
  --llm-api-key your-api-key-here \
  --llm-model gpt-4o-mini

Model Recommendations

Choosing the right LLM model is crucial for balancing cost, performance, and quality in business rule extraction:

Recommended: gpt-4o-mini

  • Best for: Most users seeking cost-effective analysis with solid performance
  • Strengths: Excellent cost-to-performance ratio, good at understanding business logic patterns
  • Use case: Regular business rule extraction, documentation generation, medium to large codebases
  • Cost: ~90% less expensive than GPT-4 while maintaining high quality output

Alternative Providers

# Anthropic Claude (excellent for code analysis)
--llm-base-url https://api.anthropic.com \
--llm-model claude-3-sonnet-20240229

# OpenAI-compatible providers (e.g., local models, other services)
--llm-base-url https://your-provider.com/v1 \
--llm-model your-model-name

💡 Tip: Start with gpt-4o-mini for most projects. It provides excellent results at a fraction of the cost, making it ideal for regular use and experimentation.

Langfuse Integration

Khodkar CLI includes built-in Langfuse OpenTelemetry integration for comprehensive LLM observability and tracing. All LLM calls are automatically traced and sent to your Langfuse dashboard.

Configuration

You can configure Langfuse using environment variables:

export LANGFUSE_SECRET_KEY=sk-lf-your-secret-key
export LANGFUSE_PUBLIC_KEY=pk-lf-your-public-key
export LANGFUSE_BASEURL=https://cloud.langfuse.com

Or copy .env.example to .env and fill in your credentials.

Features

  • Phase-specific tracing: Separate traces for Repository Discovery and Rule Extraction phases
  • Sequential workflow monitoring: Track how each phase builds upon the previous phase's output
  • ✅ Automatic trace collection for all LLM calls
  • ✅ Debug logging for troubleshooting
  • ✅ Proper trace flushing and cleanup between phases
  • ✅ Custom metadata and function IDs for each processing phase
  • ✅ Error tracking and performance monitoring

Documentation

License

MIT License - see LICENSE file for details.

Support

Visit khodkar.dezh.tech for support or create an issue on GitHub.