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

@krotovm/gitlab-ai-review

v1.0.26

Published

CLI tool to generate AI code reviews for GitLab merge requests.

Downloads

2,548

Readme

AI Code Reviewer

Gitlab AI Code Review is a CLI tool that leverages OpenAI models to automatically review code changes and post a Markdown review to GitLab merge requests from CI.

Features

  • Automatically reviews code changes in GitLab repositories
  • Provides feedback on bugs and optimization opportunities
  • Generates Markdown-formatted responses for easy readability in GitLab as merge request comment

Usage

GitLab CI/CD

Run the tool in Merge Request pipelines to post a new AI review comment to the MR.

Minimal MR review job:

stages: [review]

ai_review:
  stage: review
  image: node:20
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
  script:
    - npx -y @krotovm/gitlab-ai-review

Env variables

Set these in your project/group CI settings:

  • OPENAI_API_KEY (required)
  • OPENAI_BASE_URL (optional, for OpenAI-compatible providers/proxies)
  • AI_MODEL (optional, default: gpt-4o-mini; example: gpt-4o)
  • PROJECT_ACCESS_TOKEN (optional for public projects, but required for most private projects; token with api scope)
  • GITLAB_TOKEN (optional alias for PROJECT_ACCESS_TOKEN)
  • AI_REVIEW_ARTIFACT_HTML_FILE (optional, default: .ai-review-debug.html; used with --include-artifacts)

OPENAI_BASE_URL is passed through to the openai SDK client, so you can use any OpenAI-compatible gateway/provider endpoint.

GitLab provides these automatically in Merge Request pipelines:

  • CI_API_V4_URL
  • CI_PROJECT_ID
  • CI_MERGE_REQUEST_IID
  • CI_JOB_TOKEN (used only when PROJECT_ACCESS_TOKEN is not provided)

Flags

  • --ignore-ext=md,lock - Exclude file extensions from review (comma-separated only).
  • --max-diffs=50 - Max number of diffs included in the prompt.
  • --max-diff-chars=16000 - Max chars per diff chunk (single-pass fallback only).
  • --max-total-prompt-chars=220000 - Final hard cap for prompt size (single-pass fallback only).
  • --max-findings=5 - Max findings in the final review (CI multi-pass only).
  • --max-review-concurrency=5 - Parallel per-file review API calls (CI multi-pass only).
  • --debug - Print full error details (stack and API error fields).
  • --include-artifacts - Generate a local HTML debug artifact with per-pass outputs/tokens.
  • --help - Show help output.

Architecture

The reviewer uses a three-pass pipeline optimized for large merge requests:

  1. Triage - A fast LLM pass classifies each changed file as NEEDS_REVIEW or SKIP and generates a short MR summary.
  2. Per-file review - Only NEEDS_REVIEW files are reviewed, each in a dedicated LLM call running in parallel (with tools to fetch full files or grep the repository).
  3. Consolidate - Per-file findings are merged, deduplicated, ranked by severity, and trimmed to top N (default 5).

If the triage pass fails (API error, unparseable response), the pipeline falls back to the original single-pass approach automatically.