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

rice-gpt

v1.0.1

Published

A Node.js CLI tool to send files to the OpenAI Completion API and save the response in an output file

Downloads

1

Readme

rice-gpt

A node.js cli tool that uses GPT to automate a lot of different javascript programming tasks, like unit testing, repositories generation, etc

All tests in this project have been created using the tool

DEMO VIDEO NPM

How to run locally

  1. Set your OpenAI API key to the env
// This adds the OPENAI_API_KEY env variable to the current terminal session temporarily (until it closes)
export OPENAI_API_KEY=<YOUR_API_KEY>
  1. Install rice-gpt globally
// From npm
npm install rice-gpt -g
// From local code
npm install -g
  1. Run the project using the following command. The input file should be provided without the .js extension
rice-gpt <command> <input-file>

Available commands:

  • generate-unit-tests: Generates a jest describe fixture for the input file. The file will be generated in the same with input-file.test.js
  • tdd-helper: A wizard that will generate a jest unit test suite for the provided rules, and optionally generate the function that is being tested
  • freestyle: Receives any command you provide and executes the prompt. The output will be saved on the provided input-file.
  • refactor: Receives a command and refactor the provided file accordingly

Generate unit tests

rice-gpt generate-unit-tests files/sample

It will generate a file called files/sample.test.js

generate-unit-tests

TDD Wizard

rice-gpt tdd-helper files/fizzBuzz

The wizard will use fizzBuzz as the name of the function you want to create. After that, it will ask you for more information before generating the tests

What is the function main goal?
It will return 'Fizz', 'Buzz', 'FizzBuzz' or the number itself, depending of the input

What are the input parameters of this function?
A number from 0 to 100

What are the output parameters of this function?
A string with 'Fizz', 'Buzz', 'FizzBuzz', or the number itself in a string format

What dependencies does it have? (any imported function that you will want to mock.
isDivisibleFor(number, number)

Include the next rule. (Type enter to finish)

A number is a multiple of 3, return 'Fizz'

Include the next rule. (Type enter to finish)
A number is a multiple of 5, return 'Buzz'

Include the next rule. (Type enter to finish)
A number is a multiple of both 3 and 5, return 'FizzBuzz'

Include the next rule. (Type enter to finish)
A number is not divisible by 3 or 5, return the number itself

Include the next rule. (Type enter to finish)

It will generate a file called files/fizzBuzz.test.js and will ask you if you want to create the function itself.

Do you wanna generate the function that passes the unit tests? [y/n]
y

It will generate a file called files/fizzBuzz.js with the actual function

Free style

rice-gpt freestyle extractHtmlHeaders.js

The cli will ask for your prompt and will generate the output on extractHtmlHeaders.js

Insert your prompt:

Generate a function that receives a string in the html format and extracts all header tags to an array

Refactor

rice-gpt refactor sample.js

The cli will ask for your prompt and will refactor sample.js accordingly

Insert your prompt
Refactor the function to receive 3 numbers instead of two