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

smart-repomix

v1.0.4

Published

AI-powered wrapper for repomix that intelligently filters unnecessary files

Readme

Smart Repomix

An AI-powered wrapper for repomix that intelligently filters unnecessary files from your codebase using Google's Gemini AI.

What it does

Smart Repomix enhances the standard repomix tool by:

  1. Running repomix in-memory to scan your entire codebase
  2. Using AI to analyze which files are unnecessary based on your instruction
  3. Re-running repomix with intelligent ignore patterns
  4. Producing a cleaner, more focused output

Installation

Option 1: Use directly with npx (recommended)

npx smart-repomix -I "ignore test files and build artifacts"

Option 2: Install globally

npm install -g smart-repomix
smart-repomix -I "ignore test files and build artifacts"

Option 3: Install as a dev dependency

npm install --save-dev smart-repomix

Prerequisites

  • Node.js >= 14.0.0
  • A Google Gemini API key (get one here)
  • npx (comes with npm 5.2+)

Quick Start

For local development:

# Clone/download the package files
git clone <your-repo-url>
cd smart-repomix
npm install

# Set API key
export GEMINI_API_KEY="your-api-key"

# Test locally
node cli.js -I "ignore test files" --dry-run

See QUICKSTART.md for detailed setup instructions.

Configuration

Smart Repomix can be configured through your existing repomix.config.json file:

{
  // Your regular repomix config...
  "output": {
    "filePath": "my-output.xml"
  },
  
  // Smart Repomix specific config
  "smartRepomix": {
    "apiKey": "your-gemini-api-key",
    "promptTemplate": "Custom prompt with {{instruction}} and {{codebase}} placeholders"
  }
}

Configuration Options

  • smartRepomix.apiKey: Your Gemini API key (alternative to env var or CLI option)
  • smartRepomix.promptTemplate: Custom prompt template with placeholders:
    • {{instruction}}: Will be replaced with your -I instruction
    • {{codebase}}: Will be replaced with the XML codebase content

Custom Prompt Template Example

{
  "smartRepomix": {
    "promptTemplate": "Analyze this {{codebase}} and identify files to ignore based on: {{instruction}}. Return only comma-separated glob patterns."
  }
}

Usage

Basic usage

# Uses your repomix.config.json for output settings
npx smart-repomix -I "ignore test files, documentation, and build outputs"

# Or specify output explicitly
npx smart-repomix -I "ignore test files" -o my-output.xml

Advanced options

# Use a different Gemini model
npx smart-repomix -I "ignore test files" -m gemini-2.5-pro

# Verbose output
npx smart-repomix -I "ignore test files" -v

# Dry run (see what would be ignored without creating output)
npx smart-repomix -I "ignore test files" --dry-run

# Pass API key directly
npx smart-repomix -I "ignore test files" -k "your-api-key"

Command Line Options

  • -I, --instruction <instruction> - Required. Instruction for AI to determine which files to ignore
  • -o, --output <path> - Output file path (defaults to repomix config or repomix-output.xml)
  • -k, --api-key <key> - Gemini API key (or use GEMINI_API_KEY env var or config)
  • -m, --model <model> - Gemini model to use (default: gemini-2.5-flash)
  • -v, --verbose - Show verbose output
  • --dry-run - Show what files would be ignored without creating final output

API Key Priority

The API key is resolved in this order:

  1. -k command line option
  2. GEMINI_API_KEY environment variable
  3. smartRepomix.apiKey in repomix.config.json

Example Instructions

Here are some effective instruction examples:

# For sharing code for review
npx smart-repomix -I "ignore test files, build artifacts, and documentation"

# For production code analysis
npx smart-repomix -I "ignore development files, tests, examples, and build outputs"

# For debugging
npx smart-repomix -I "keep only source code and configuration files"

# For documentation
npx smart-repomix -I "ignore node_modules, build directories, and temporary files"

How it Works

  1. Initial Scan: Runs repomix --stdout to capture your entire codebase in memory
  2. AI Analysis: Sends the codebase to Gemini with your instruction
  3. Pattern Generation: AI returns glob patterns for files to ignore
  4. Filtered Output: Runs repomix again with the ignore patterns, respecting your config

Programmatic Usage

You can also use smart-repomix in your Node.js code:

import smartRepomix from 'smart-repomix';

const ignorePatterns = await smartRepomix({
  instruction: 'ignore test files and build artifacts',
  outputPath: 'output.xml', // optional, uses repomix config if not specified
  apiKey: 'your-api-key',
  model: 'gemini-2.5-flash',
  verbose: true
});

console.log('Ignored patterns:', ignorePatterns);

Tips

  • Be specific in your instructions for better results
  • Use --dry-run first to preview what will be ignored
  • The gemini-2.5-flash model is fast and works well for most cases
  • For very large codebases, consider using gemini-2.5-pro for better analysis
  • Smart Repomix respects your existing repomix.config.json settings

License

MIT