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

code-gate

v1.0.5

Published

Intelligent Git commit guard and code reviewer. Supports local (Ollama) and cloud models (DeepSeek, OpenAI, Anthropic, etc.) with a rich CLI UI.

Readme

English | 简体中文

Code Gate

Your Lightweight Local AI Code Review Assistant

Code Gate is an intelligent code review tool seamlessly integrated into your Git workflow. When you run git commit, it automatically analyzes staged code changes, utilizing local LLMs (Ollama) or cloud AI services to provide instant feedback on code quality, security suggestions, and optimization plans.

✨ Features

  • 🔒 Privacy First: Native support for Ollama local models.
  • ☁️ Multi-Model Support: Seamlessly integrates with DeepSeek, OpenAI, Anthropic, Aliyun Qwen, Doubao, and more.
  • 🌍 Multi-Language: Built-in support for English, Chinese (Simplified & Traditional), Japanese, Korean, German, and French.
  • ⚡️ High Performance: Intelligent concurrent processing for faster reviews across multiple files.
  • 🛠️ Highly Customizable: Custom prompts, file filtering rules, and review strategies.
  • 📊 Visual Reports: Generates intuitive HTML review reports with clear diffs and AI suggestions.
  • 📜 Review Logs: Automatically archives review history for easy reference and tracking.

🚀 Quick Start

1. Installation

Install code-gate as a development dependency:

npm i -D code-gate

2. Initialization

We provide a one-click initialization command to configure Git Hooks.

Automatic Init (Recommended)

# Interactive selection for Git Hooks or Husky
npx code-gate init

You can also specify arguments if you prefer a specific hook manager:

  • Native Git Hooks: npx code-gate init -m git
  • Husky: npx code-gate init -m husky

After initialization, you can choose to add the generated config file to .gitignore.

3. Usage

Just commit your code as usual:

git add .
git commit -m "feat: new feature"

Code Gate intercepts the commit:

  1. Analyzes code changes.
  1. Starts a local server and generates a review report.

  2. Automatically opens the report in your browser.

  3. You choose to Confirm Commit or Cancel in the terminal.


⚙️ Configuration

The code-gate.config.js in your project root controls all behaviors.

Basic Configuration

export default {
  provider: 'ollama',
  providerOptions: {
    ollama: {
      baseURL: 'http://localhost:11434',
      model: 'qwen2.5-coder',
      concurrencyFiles: 1
    },
    deepseek: {
      baseURL: 'https://api.deepseek.com',
      apiKeyEnv: 'DEEPSEEK_API_KEY',
      model: 'deepseek-chat',
      concurrencyFiles: 4
    }
    // openai: { baseURL: 'https://api.openai.com/v1', apiKeyEnv: 'OPENAI_API_KEY', model: 'gpt-4o-mini' },
    // anthropic: { baseURL: 'https://api.anthropic.com', apiKeyEnv: 'ANTHROPIC_API_KEY', model: 'claude-3-5-sonnet' },
    // azureOpenAI: { endpoint: 'https://your-endpoint.openai.azure.com', apiKeyEnv: 'AZURE_OPENAI_KEY', deployment: 'gpt-4o-mini', apiVersion: '2024-08-01-preview' },
    // aliyun: { baseURL: 'https://dashscope.aliyuncs.com/compatible-mode/v1', apiKeyEnv: 'DASHSCOPE_API_KEY', model: 'qwen-plus' },
    // volcengine: { baseURL: 'https://ark.cn-beijing.volces.com/api/v3', apiKeyEnv: 'VOLCENGINE_API_KEY', model: 'doubao-pro-32k' },
    // zhipu: { baseURL: 'https://open.bigmodel.cn/api/paas/v4', apiKeyEnv: 'ZHIPU_API_KEY', model: 'glm-4' }
  },
  language: 'en',
  fileTypes: ['ts', 'tsx', 'css'],
  ui: {
    openBrowser: true,
    port: 5175
  },
  limits: {
    maxDiffLines: 10000,
    maxFiles: 100
  },
  prompt: 'as a senior code reviewer, please review the code changes and provide feedback on security, performance, code style, and test coverage. Highlight any issues or areas for improvement, and offer concrete suggestions with code examples if possible.',
  output: {
    dir: '.review-logs'
  },
}

API Key Configuration

Choose the appropriate configuration scheme based on your project needs. Taking deepseek as an example. For security, avoid hardcoding API Keys in the config file.

Option A: Config File

Set in .code-gate.js:

export default {
  providerOptions: {
    deepseek: {
      // ...other config
      apiKey: 'your-deepseek-api-key'
    }
  }
}

Option B: Git Hook Injection

Export temporarily in .githooks/pre-commit or .husky/pre-commit:

#!/bin/sh
export DEEPSEEK_API_KEY=[your-deepseek-api-key]
./node_modules/.bin/code-gate-hook

Option C: Environment Variables (Recommended)

Set in your .env file or system environment:

export DEEPSEEK_API_KEY=[your-deepseek-api-key]

📖 Configuration Details

| Parameter | Type | Default | Description | | :--- | :--- | :--- | :--- | | provider | string | 'ollama' | AI Provider. Supports ollama, deepseek, openai, anthropic, aliyun, volcengine, zhipu, etc. | | providerOptions | object | {} | Specific configurations for each Provider (see table below) | | fileTypes | string[] | [] | List of file extensions to review (whitelist). Reviews all files if empty or undefined. | | exclude | string[] | ['**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml'] | List of files or directories to ignore (blacklist), supports glob patterns (e.g., node_modules/**). Higher priority than fileTypes. | | ui.openBrowser | boolean | true | Auto-open browser for report preview | | ui.port | number | 5175 | Preview server port | | limits.maxDiffLines | number | 10000 | Max diff lines per review. Exceeding may cause incomplete review or excessive token usage. | | limits.maxFiles | number | 100 | Max number of files to review | | reviewMode | string | 'files' | Review Mode: 'summary' (summary only), 'files' (file details only), 'both' (both) | | language | string | 'en' | UI & Prompt Language. Options: 'en', 'zh-CN', 'zh-TW', 'ja', 'ko', 'de', 'fr' | | prompt | string | ... | Universal system prompt sent to AI | | output.dir | string | '.review-logs' | Output directory for local reports and static assets |

providerOptions Configuration

Each Provider supports the following fields, with request option for timeout and retry control.

Key Parameters:

  • baseURL: API base URL (e.g., https://api.deepseek.com or http://localhost:11434)
  • apiKey: API Key (specified directly in config, not recommended for committing)
  • apiKeyEnv: Environment variable name storing the API Key (Recommended, e.g., DEEPSEEK_API_KEY)
  • model: Model name to use (e.g., deepseek-chat, qwen2.5-coder)
  • concurrencyFiles: Number of concurrent file reviews (Recommended: Cloud API 4-8, Local Model 1)
  • request: Advanced request configuration (see "Advanced Configuration" below)

| Provider | Configurable Parameters | | :--- | :--- | | deepseek | baseURL, apiKey, apiKeyEnv, model, concurrencyFiles, request | | ollama | baseURL, model, concurrencyFiles, request | | openai | baseURL, apiKey, apiKeyEnv, model, request | | anthropic | baseURL, apiKey, apiKeyEnv, model, request | | aliyun | baseURL, apiKey, apiKeyEnv, model, request | | volcengine | baseURL, apiKey, apiKeyEnv, model, request | | zhipu | baseURL, apiKey, apiKeyEnv, model, request | | azureOpenAI | endpoint, apiKey, apiKeyEnv, deployment, apiVersion, request |

Advanced Configuration (request)

Configure in providerOptions.<provider>.request to control request behavior:

| Parameter | Type | Default | Description | | :--- | :--- | :--- | :--- | | timeout | number | undefined | Request timeout (ms). Recommended to set higher for Ollama (e.g., 15000+) | | retries | number | 0 | Number of retries on request failure | | backoffMs | number | 300 | Retry interval (ms) |

Note: concurrencyFiles controls the number of concurrent file reviews (Default: DeepSeek=4, Ollama=1, Others=4).

❓ FAQ

Q: Report shows diffs but no AI suggestions?

  • Check provider configuration.
  • If using Ollama, ensure local service is running (ollama serve) and model is pulled (ollama pull qwen2.5-coder).
  • If using Cloud API, check API Key validity and network connection.

Q: How to skip review in CI/CD? Code Gate detects non-interactive environments and skips automatically. To force skip, use git commit --no-verify.

📄 License

MIT