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

gemini-cli-wrapper

v1.0.0

Published

A CLI wrapper for Gemini AI code analysis and review

Readme

Gemini CLI Wrapper

A powerful command-line interface wrapper for Google's Gemini AI, designed for code analysis, review, and improvement.

Features

  • 🤖 AI-Powered Code Analysis: Leverage Gemini AI for intelligent code review
  • 📝 Multiple Commands: Explain, summarize, improve, refactor, and review code
  • 🔍 Project Analysis: Analyze entire projects with smart file filtering
  • 🎨 Interactive Mode: Iterative improvement with user confirmation
  • 🧪 Testing Suggestions: Get AI-powered testing recommendations
  • 📋 TODO Detection: Automatically find and categorize TODOs and issues
  • 🎯 Goal-Based Refactoring: Refactor code with specific objectives

Installation

Prerequisites

  • Node.js 18+
  • Google Gemini API key

Setup

  1. Clone and install dependencies:

    git clone <repository-url>
    cd gemini-wrapper
    npm install
  2. Set up your Gemini API key:

    # Copy the example environment file
    cp env.example .env
       
    # Edit .env and add your API key
    # Get your key from: https://makersuite.google.com/app/apikey

    Or set it as an environment variable:

    export GEMINI_API_KEY="your-api-key-here"
  3. Make the CLI executable (optional):

    chmod +x bin/gmb.js

Usage

Basic Commands

# Get help
node bin/gmb.js --help

# Check version
node bin/gmb.js --version

Code Analysis Commands

Explain Code

# Explain a single file
node bin/gmb.js explain path/to/file.js

# With custom format
node bin/gmb.js explain path/to/file.js --format markdown

Summarize Code

# Summarize a file
node bin/gmb.js summarize path/to/file.js

Break Down Code

# Break file into logical sections
node bin/gmb.js breakdown path/to/file.js

Detect TODOs and Issues

# Find TODOs, FIXMEs, and issues
node bin/gmb.js detect-todos path/to/file.js

Get Testing Suggestions

# Get testing recommendations
node bin/gmb.js testing-suggestions path/to/file.js

Code Improvement Commands

Improve Code

# Improve a file with interactive confirmation
node bin/gmb.js improve path/to/file.js

# Dry run (show changes without applying)
node bin/gmb.js improve path/to/file.js --dry-run

# Iterative improvement
node bin/gmb.js improve path/to/file.js --iterative

Refactor Code

# Refactor for readability (default)
node bin/gmb.js refactor path/to/file.js

# Refactor for performance
node bin/gmb.js refactor path/to/file.js --goal performance

# Refactor to TypeScript
node bin/gmb.js refactor path/to/file.js --goal "migrate to TypeScript"

# Dry run
node bin/gmb.js refactor path/to/file.js --dry-run

Comprehensive Analysis

Code Review

# Perform comprehensive code review
node bin/gmb.js code-review path/to/file.js

Project Summary

# Analyze entire project
node bin/gmb.js project-summarize ./project-directory

# With custom file extensions
node bin/gmb.js project-summarize ./project-directory --extensions ".js,.ts,.jsx,.tsx"

Examples

Example 1: Quick Code Review

# Review a React component
node bin/gmb.js code-review src/components/Button.jsx

Example 2: Iterative Improvement

# Improve a utility function with multiple iterations
node bin/gmb.js improve src/utils/helpers.js --iterative

Example 3: Project Analysis

# Analyze a Node.js project
node bin/gmb.js project-summarize ./my-node-app --extensions ".js,.json,.md"

Example 4: Refactoring for Performance

# Refactor a slow function
node bin/gmb.js refactor src/algorithms/sort.js --goal performance --dry-run

Configuration

Environment Variables

  • GEMINI_API_KEY: Your Google Gemini API key (required)
  • GEMINI_MODEL: Gemini model to use (default: gemini-1.0-pro)
  • GEMINI_TEMPERATURE: AI response creativity (0.0-1.0, default: 0.7)
  • GEMINI_MAX_TOKENS: Maximum response length (default: 2048)
  • DEFAULT_FORMAT: Default output format (default: markdown)
  • DEBUG: Enable debug logging (default: false)

File Extensions

The project-summarize command supports custom file extensions:

  • Default: .js,.ts,.jsx,.tsx,.py,.java,.cpp,.c,.go,.rs,.php,.rb
  • Custom: --extensions ".js,.ts,.vue,.svelte"

Output Formats

Most commands support different output formats:

  • markdown (default): Formatted markdown output
  • json: JSON formatted output
  • plain: Plain text output

Testing

Run the test suite:

npm test

This will test the CLI structure and command availability without requiring an API key.

Troubleshooting

Common Issues

  1. "GEMINI_API_KEY environment variable is not set"

    • Set your API key: export GEMINI_API_KEY="your-key"
    • Or add it to a .env file
  2. "File not found"

    • Check the file path is correct
    • Ensure the file exists and is readable
  3. "Permission denied"

    • Check file/directory permissions
    • Ensure you have read/write access
  4. "No files found"

    • Check file extensions in project-summarize
    • Verify the directory contains files with specified extensions

Getting Help

# General help
node bin/gmb.js --help

# Command-specific help
node bin/gmb.js explain --help
node bin/gmb.js improve --help

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

ISC License

Support

For issues and questions:

  1. Check the troubleshooting section
  2. Review existing issues
  3. Create a new issue with detailed information