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

revu-cli

v0.4.0

Published

revu is a comprehensive command-line tool designed to enhance your coding workflow. It utilizes the advanced capabilities of GPT-4 and the GitHub API to provide insightful code analysis.

Downloads

13

Readme

revu is a comprehensive command-line tool designed to streamline the code review process. Leveraging the advanced capabilities of GPT-4 and the GitHub API, it can analyze and provide insightful reviews on pull requests, local changes, and individual files. Additionally, revu offers an intuitive commit message generator that uses local diffs and commit history to propose appropriate commit messages. Its flexible nature aims to cover various aspects of code review, offering an efficient toolset for developers.

⚠️ Disclaimer: This is a test project. The reviews generated by this tool may not always be accurate, useful, or make sense. Always perform manual code reviews to ensure the quality of your code.

Getting Started

Prerequisites

  • You'll need to have Node.js and npm installed on your machine.
  • An OpenAI API key for using GPT-4 and a GitHub token for accessing the GitHub API.

Switching to GPT-4 Model

revu is initially set to use the GPT-3.5-turbo model. If you wish to switch to GPT-4, you can do so by modifying your revu.json config file:

  1. Run the config command if you haven't done so already. This will generate the revu.json config file:
revu config
  1. Locate your revu.json config file. By default, it is saved in the .revu directory in your home directory (~/.revu).
  2. Find the llm section and then the openai subsection within it.
  3. Change the value of openaiModel from gpt-3.5-turbo to gpt-4.
  4. Save and close your revu.json config file.

Remember that using GPT-4 may result in increased API costs. Please refer to OpenAI's pricing for more information.

Installation

You can install revu globally using npm by running the following command:

npm i -g revu-cli

Alternatively, you can clone the repository and install the dependencies locally:

  1. Clone the repository:
git clone https://github.com/phmz/revu-cli.git
  1. Navigate to the project directory:
cd revu-cli
  1. Install dependencies:
npm install
  1. Build the project:
npm run build

Usage

Before using revu, you need to set up the configuration with your OpenAI API key and GitHub token. You can do this with the following command:

revu config

This will prompt you to enter your OpenAI API key and GitHub token.

For a comprehensive list of all available commands and options in revu, run the help command:

revu help

This will display a list of all the available commands, their descriptions, and options you can use with revu.

Environment Variables

revu can also be configured using environment variables. If an environment variable is not provided, revu will use the default value.

Here are the available environment variables:

  • GIT_MAX_COMMIT_HISTORY: Maximum number of commit history entries to fetch (default: 10).
  • GIT_IGNORE_PATTERNS: A comma-separated list of regular expression patterns of files to ignore (default: []).
  • GITHUB_API_URL: Custom URL for the GitHub API (default: https://api.github.com).
  • GITHUB_TOKEN: GitHub personal access token.
  • OPENAI_API_URL: Custom URL for the OpenAI API (default: https://api.openai.com).
  • OPENAI_API_KEY: OpenAI API key for accessing the OpenAI API.
  • OPENAI_MODEL: OpenAI model to use (default: gpt-3.5-turbo).
  • OPENAI_TEMPERATURE: Temperature parameter for OpenAI model (default: 0).

Local Code Review

revu can analyze local changes in two ways:

1. Analyzing all local changes

If you want to analyze your local changes, navigate to the root directory of your local Git repository and run the following command:

revu local

revu will then analyze your local changes and provide you with a review.

2. Analyzing a specific file

If you want to analyze a specific file in your local directory, navigate to the root directory of your local Git repository and run the following command:

revu local --directory <directory> --filename <filename>

Replace <directory> with the relative path of the directory to search and <filename> with the name of the file to review.

Generate Commit Message

revu can propose commit messages based on local diffs and commit history. To use this feature, run the following command:

revu commit

revu will prompt you to select the files you wish to commit. Once the files are selected, revu fetches the commit history and proposes a commit message. If you agree with the suggested commit message, you can proceed to commit your changes right away. If there are unselected files left, revu will ask you if you wish to continue the commit process.

Pull Request Review

If you want to analyze a pull request, run the following command:

revu pr <repository> <pull_request_number>

Replace <repository> with the repository to review in the format owner/repository, and <pull_request_number> with the number of the pull request to review. For example:

revu pr phmz/revu 42

revu will then fetch the pull request details, analyze the changes, and provide you with a review.

Ignoring Files

The revu CLI tool allows you to ignore certain files during your review process by using regular expression patterns. You can define these patterns either through a configuration file or via an environment variable. The CLI tool will ignore files that match any of the provided patterns.

Via Configuration File

You can define an array of ignorePatterns under the git section in your revu.json configuration file, like so:

{
  "git": {
    "ignorePatterns": [".*lock.*", "another_pattern", "..."]
  }
}

Via Environment Variable

Alternatively, you can use the GIT_IGNORE_PATTERNS environment variable to define a comma-separated list of regular expression patterns:

export GIT_IGNORE_PATTERNS=.*lock.*,another_pattern,...

Development

revu is built with TypeScript. Contributions are welcome!

Code style

This project uses ESLint for linting.

You can run the linter with:

npm run lint