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

ai-reviewer

v1.0.6-beta.8

Published

This package reviews the changes in each PR, generates summaries per file, adds relevant comments, suggestions, and highlights areas that need fixing.

Downloads

30

Readme

AI Reviewer

AI Reviewer is an intelligent tool designed to automate the review process of pull requests (PRs). It reviews the changes in each PR, generates summaries per file, adds relevant comments, suggestions, and highlights areas that need fixing. This ensures code quality and faster reviews.

Features

  • Automated Workflow Creation: Automatically creates a workflow on installation.
  • PR Review Automation: Reviews pull requests and provides detailed feedback.
  • File-based Summaries: Summarize each files in short description.
  • Comments & Suggestions: Add comments and suggestions on areas of improvement.
  • Fix Recommendations: Suggest potential fixes for code issues.
  • Improves Code Quality: Helps maintain high coding standards with automated reviews.

Installation

To install ai-reviewer and set up the workflow, use the following command:

npm install ai-reviewer --save-dev

Usage

Once installed, ai-reviewer will automatically create a workflow file in your repository.

Adding OpenAI API Key to GitHub Secrets and setting permissions for GITHUB_TOKEN

In order for AI Reviewer to leverage OpenAI's API to provide intelligent comments, suggestions, and summaries, you need to add your OpenAI API key to GitHub Secrets and allow workflow read, write permissions

Adding OpenAI API Key

  1. Obtain Your OpenAI API Key:

    • Go to OpenAI and generate your API key.
  2. Add the Key to GitHub Secrets:

    • Go to your GitHub repository.
    • Navigate to Settings > Secrets and variables > Actions > New repository secret.
    • Add a new secret with the following details:
      • Name: OPENAI_API_KEY
      • Value: Your OpenAI API key (copied from the OpenAI dashboard).
  3. Accessing the API Key in Your Workflow: In your GitHub Actions workflow, ensure that the OpenAI key is used by referencing the secret:

    jobs:
    review:
        runs-on: ubuntu-latest
        steps:
        # Job Previous Steps...
            env:
            OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

This ensures that the AI Reviewer tool has access to your OpenAI API key to generate intelligent code reviews.

Setting Permissions for GITHUB_TOKEN

  1. Navigate to Your Repository on GitHub:

    • Go to GitHub and open your repository.
  2. Open Actions Settings:

    • Navigate to Settings > Actions > General.
    • Scroll down to the Workflow permissions section.
  3. Modify Workflow Permissions:

    • Select Read and write permissions.
    • Click the Save button to apply the changes.

Workflow Configuration

The workflow file created by ai-reviewer will be located in the .github/workflows directory. You can customize it as needed.

Here is an example of what the workflow file might look like:

name: OpenAI Code Review

on:
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  ai-review:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '20'
      
      - name: Install dependencies
        run: npm install
      
      - name: Run AI Review and Summary
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SRC_FOLDER_PATTERN: "**/src/**/*.js, **/src/**/*.ts, **/src/**/*.html, **/src/**/*.scss"
          AI_MODEL: "gpt-4o-mini"
        run: node node_modules/ai-reviewer/src/scripts/openai/index.js

Contributing

We welcome contributions to ai-reviewer. Please follow these steps to contribute:

  1. Fork the repository.

  2. Create a new branch (git checkout -b feat/feature-branch).

  3. Make your changes.

  4. Commit your changes (git commit -m 'Add new feature'). We use @commitlint/config-conventional so make sure following it's guidelines while committing.

  5. Push to the branch (git push origin feature-branch).

  6. Open a pull request.

License

ai-reviewer is licensed under the MIT License. See the LICENSE file for more details.

Contact

For any questions or feedback, please open an issue.