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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@buxuku/ai-code-reviewer

v1.2.2

Published

## 介绍

Downloads

17

Readme

@buxuku/ai-code-reviewer

介绍

@buxuku/ai-code-reviewer 是一款应用于 GitLab Merge Request 代码审查的小工具,支持调用私有化部署的 GitLab API,并使用 OpenAI API 获取审查结果。请注意,在使用它时,需要确保符合公司合规要求。😉

特点

  • 🛠️ 支持配置 GitLab API 地址
  • 🌍 支持配置 OpenAI 代理 API 地址,解决国内可能无法访问 OpenAI API 的问题
  • 🆔 支持配置 OpenAI 组织 ID
  • ⚙️ 支持配置多个 OpenAI API Key 实现接口调用的负载均衡(多个 Key 以逗号分隔)
  • 🚦 超过速率限制时,自动等待并重试
  • 💬 审查结果以评论的方式追加到对应的代码块所在位置

安装

npm i @buxuku/ai-code-reviewer

使用

通过 Shell 脚本使用

Usage: ai-code-reviewer [options]

Options:
  -g, --gitlab-api-url <string>       GitLab API URL (default: " https://gitlab.com/api/v4")
  -t, --gitlab-access-token <string>  GitLab Access Token
  -o, --openai-api-url <string>       OpenAI API URL (default: "https://api.openai.com")
  -a, --openai-access-token <string>  OpenAI Access Token
  -p, --project-id <number>           GitLab Project ID
  -m, --merge-request-id <string>     GitLab Merge Request ID
  -org, --organization-id <number>    organization ID
  -h, --help                          display help for command

示例:

ai-code-reviewer -g https://gitlab.com/api/v4 -t glpat-xxxxxxx -o https://api.openai.com -a skxxxxxxx,skxxxxxxx -p 432288 -m 8

在 CI 中使用

在 GitLab CI/CD 中设置 GITLAB_TOKENCHATGPT_KEY 变量,.gitlab-ci.yml 如下:

stages:
  - merge-request

Code Review:
  stage: merge-request  
  image: node:latest
  script:
    - npm i @buxuku/ai-code-reviewer -g
    - ai-code-reviewer -t "$GITLAB_TOKEN" -a "$CHATGPT_KEY"  -p "$CI_MERGE_REQUEST_PROJECT_ID" -m "$CI_MERGE_REQUEST_IID"
  only:
    - merge_requests
  when: on_success

贡献

欢迎贡献代码,提出问题和建议!👏

许可证

本项目基于 MIT 许可证。详细信息请参见 LICENSE 文件。📜