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

@vasudevshetty/docu-cli

v0.3.4

Published

Blazing-fast, AI-powered CLI to fetch, cache, and search developer docs right from your terminal with smart explanations

Readme

📚 docu-cli – AI-Powered Offline Documentation CLI

Blazing-fast, AI-enhanced CLI to fetch, cache,## 🤖 AI Integration

Quick Setup

# Interactive setup (recommended)
docu setup

Manual Setup

  1. Get your free API key from Groq Console
  2. Configure using setup command or manually create config:
# Using setup command
docu setup

# Or manually in ~/.docu/.env
echo "GROQ_API_KEY=your_api_key_here" > ~/.docu/.env
```veloper docs with smart explanations and paginated display - right from your terminal.

---

## 🚀 Features

### Core Features

- 📶 **Offline-first**: Access popular docs (React, Vue, Angular, Node, Python, Docker, etc.) without internet
- 🔍 **Smart Search**: Full-text fuzzy search with SQLite FTS5 and BM25 scoring
- ⚡ **Lightning Fast**: Instant indexed results with highlighted matches
- 📁 **Local Cache**: Persistent storage for each docset
- 🧱 **Clean Architecture**: Modular TypeScript codebase with clear separation

### AI-Enhanced Features ✨

- 🤖 **AI Explanations**: Get detailed explanations powered by Groq AI
- 📖 **Smart Insights**: AI-enhanced search results with contextual guidance
- 💡 **Quick Reference**: AI-generated syntax examples and best practices
- � **Intelligent Context**: Search results enhanced with AI understanding

### Display & UX

- 📄 **Paginated Viewer**: Git-like pager for comfortable reading
- 🎨 **Markdown Rendering**: Beautiful formatted output with syntax highlighting
- 🌈 **Rich CLI**: Colorized output with emojis and progress indicators
- � **Multiple Formats**: JSON, Markdown, Plain text, and Table outputs

---

## 🎯 Use Cases

- 💻 **Offline Development**: Code anywhere without internet dependency
- 🚀 **Productivity Boost**: Instant access to docs with AI explanations
- 📦 **DevOps Integration**: Embed in containers and development environments
- 🎓 **Learning Enhancement**: AI-powered explanations for complex concepts
- 🔍 **Knowledge Base**: Personal offline documentation archive with smart search

---

## 📦 Installation

### NPM Installation (Recommended)

```bash
# Install globally from npm
npm install -g @vasudevshetty/docu-cli

# Verify installation
docu --version

# Quick setup with AI features (optional)
docu setup

From Source

# Clone the repository
git clone https://github.com/Vasudevshetty/docu.git
cd docu

# Install dependencies
npm install

# Build the project
npm run build

# Install globally
npm install -g .

First Time Setup

# Setup API key for AI features (optional)
docu setup

# Fetch your first docset
docu fetch react

# Start searching
docu search "useState"

⚙️ Tech Stack

| Layer | Tech Stack | | ---------------- | -------------------------------------- | | Language | TypeScript | | CLI Framework | commander, yargs | | TUI (Optional) | ink, blessed | | Web Scraping | axios, cheerio, playwright | | Search Engine | SQLite + FTS5, fallback: Lunr.js | | DB Driver | better-sqlite3 or sqlite3 | | Packaging | pkg, esbuild, npx | | Storage Location | ~/.docu/ (cross-platform local data) |


� AI Integration

Setting Up Groq AI

  1. Get your free API key from Groq Console
  2. Create a .env file in your project:
# Copy the example file
cp .env.example .env

# Add your API key
GROQ_API_KEY=your_api_key_here

AI Features

  • Smart Explanations: docu explain useState --simple
  • Enhanced Search: docu search "react hooks" --ai
  • Quick Reference: docu quick "useEffect" --ai
  • Paginated Display: docu search "typescript" --pager

📖 Usage Examples

Basic Search

# Simple search
docu search "useState hook"

# Search with AI insights
docu search "react lifecycle" --ai

# Paginated results (like git log)
docu search "typescript generics" --pager

AI Explanations

# Get detailed explanation
docu explain "useEffect"

# Simple explanation for beginners
docu explain "async await" --simple

# With code examples
docu explain "useState" --examples --pager

Quick Reference

# Quick syntax lookup
docu quick "array methods"

# AI-powered quick reference
docu quick "promises" --ai

�🧠 Implementation Plan

🏗️ 1. Project Setup

  • Scaffold project using TypeScript
  • Setup tsconfig, linting, prettier, ESModules
  • Setup folder structure based on clean architecture

🧪 2. CLI Interface ✅

Core commands implemented:

  • docu fetch <docset> - Download and cache documentation
  • docu search <query> - Search with AI insights and pagination
  • docu list - Show installed docsets
  • docu remove <docset> - Delete cached documentation
  • docu explain <query> - AI-powered explanations
  • docu quick <query> - Quick reference with AI
  • docu copy <query> - Copy code examples
  • docu update - Update cached content
  • docu interactive - Interactive search mode
  • docu available - Browse available docsets

📥 3. Fetch & Normalize Docs ✅

  • Enhanced Cheerio scraper with markdown extraction
  • Clean content filtering and structure preservation
  • Metadata storage with version tracking
  • 10 popular docsets: React, Vue, Angular, Node.js, Express, TypeScript, Docker, Python, Django, FastAPI

📊 4. Indexing Engine ✅

  • SQLite FTS5 full-text search with BM25 scoring
  • Optimized tokenization and ranking
  • Persistent storage in ~/.docu/index/<docset>.db

🔎 5. Enhanced Search ✅

  • Multi-format output (table, JSON, markdown, plain)
  • AI-enhanced results with Groq integration
  • Paginated display with navigation controls
  • Syntax highlighting and emoji indicators

🤖 6. AI Integration ✅

  • Groq LLM integration for smart explanations
  • Context-aware responses using search results
  • Fallback mechanisms for offline usage
  • Environment-based configuration

� 7. Advanced Features ✅

  • Interactive TUI mode with real-time search
  • Export functionality for search results
  • Global npm installation support
  • Cross-platform compatibility

🗂️ Folder Structure (Clean Architecture)

docu-cli/
├── bin/
│   └── index.ts                # CLI entry
├── src/
│   ├── core/                   # Use-cases (business logic)
│   │   ├── FetchDocs.ts
│   │   ├── SearchDocs.ts
│   │   └── IndexDocs.ts
│   ├── domain/                 # Entities & interfaces
│   │   └── Docset.ts
│   ├── infrastructure/         # Services (DB, scraping)
│   │   ├── scraper/
│   │   │   └── CheerioScraper.ts
│   │   ├── indexer/
│   │   │   └── SQLiteIndexer.ts
│   │   └── storage/
│   │       └── FileSystemAdapter.ts
│   ├── cli/                    # CLI handlers
│   │   ├── fetch.ts
│   │   ├── search.ts
│   │   ├── list.ts
│   │   └── remove.ts
│   └── config/
│       └── docsets.json        # Supported docset rules
├── .docu/                      # User cache directory
│   ├── react/
│   ├── nodejs/
│   └── index/
├── tsconfig.json
└── README.md

🧰 Example Commands

# Fetch a docset
docu fetch react

# Search offline docs
docu search useEffect

# List available docsets
docu list

# Remove cached docset
docu remove nodejs

🌱 Future Enhancements

  • 🔎 AI-powered summary: docu explain useEffect
  • 💡 VS Code Extension: inline doc search
  • 📄 Export results/snippets to PDF
  • 🔖 Bookmarks and annotations
  • 📤 Share docsets with team over LAN
  • 🔄 Automatic background updates

🤖 Contribution Guidelines

  • Maintain SOLID principles
  • Follow clean architecture folder layout
  • Add tests using jest
  • Open issues before large changes

📦 Packaging & Distribution

  • Build: npm run build
  • Package: pkg .
  • Install globally: npm i -g .
  • Publish: npm publish

🧪 Sample Test Case (Jest)

test('should fetch and index React docs', async () => {
  const fetcher = new FetchDocs('react');
  const docs = await fetcher.run();
  expect(docs.length).toBeGreaterThan(100);

  const indexer = new SQLiteIndexer();
  await indexer.index('react', docs);
});

📌 Notes

  • SQLite is preferred for long-term performance
  • Modular scrapers support Markdown/HTML/JSON docs
  • You can build your own docset with simple config