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

musag

v1.0.3

Published

CLI for generating programming project ideas with GPT3

Downloads

2

Readme

musag

musag is a CLI tool used by Musa to generate programming project ideas using AI.

Want to see it on practice? See projects generated by musag on musa.dikson.xyz →

Introduction

Model

Musa uses GPT3, a natural language generation model.

To interact with the model (and generate projects), a API key is required. In order to have access to the API, you need to register an account on OpenAI's Website.

Pricing

The OpenAI GPT3 API is pay-as-you-go, with $18 in free credits for the first three months for new users.

Generating projects with musag uses credits. The amount of credits is variable and depend on factors like the length of the theme and generated project.

If you need a rough rule of thumb, projects on musa.dikson.xyz use about 85 tokens each - around $0.005 for each project.

For more information about pricing, see OpenAI's API Pricing.

Terms & Policies

To use the OpenAI's GPT3 API, you must follow OpenAI's API Terms & Policies. In particular, users are prohibited from knowingly generating — or allowing others to knowingly generate some categories of content, such as hate, harassment, violence, self-harm, sexual, political, deception and malware.

To mitigate the possible risks of AI-generated content, OpenAI has set a policy on permitted sharing of generated content. You can read it on OpenAI's API Sharing & Publication Policy.

Installation

Installing with npm:

$ npm install -g musag

You're good to go! Type musag --help to see all the available commands.

Usage

Initialization

Before generating any content, you must provide musag with your OpenAI API key. This info is stored locally and never leaves your computer.

$ musag setkey
Setting API key...
? Insert your OpenAI API key: ▒

Quickstart

Use musag theme <project_theme> to generate a project based on a theme.

$ musag theme ship
Sail Away

Design a program that can help ship captains navigate through
treacherous waters. The program would need to take into account
the ship's current location, the weather conditions, the tides,
and any other potential hazards.

To use a theme with multiple words, wrap it in quotes:

$ musag theme "hip hop"
Hip Hop Hooray!

Design a program that generates random hip hop lyrics.

Advanced commands

The command musag gen is a more complete version of musag theme. When given a path to a file with a list of themes (one theme per line) as and the path of output file, musag gen stores the generated projects in the output file in the JSON format and with additional information.

Usage: musag gen <path_to_input_file> <path_to_output_file>

To exemplify this, suppose you have a file called themes.txt with the lines "ship" and "hip hop" in your current folder.

$ cat themes.txt
ship
hip hop

Running musag gen:

$ musag gen themes.txt generated.json
0.0% | Passed: 0s | ETA: ∞ | Generating project related to "ship"...
50.0% | Passed: 5s | ETA: 5s | Generating project related to "hip hop"...
[8s] Done! Stored projects on 'generated.json'
$ cat generated.json
{
  "projects": [
    {
      "theme": "ship",
      "title": {
        "text": "Sail Away",
        "content_label": 0,
        "finish_reason": "stop"
      },
      "description": {
        "text": "Design a program (...)", // Shortened for readability
        "content_label": 0,
        "finish_reason": "stop"
      }
    },
    {
      "theme": "hip hop",
      ...
    }
  ]
}

The generated.json above will have additional info about the projects, such as the content_label and finish_reason.

finish_reason is a internal variable from the API that indicates the reason why the generation finished.

content_label is the label of the content, generated by OpenAI's Content filter. It classifies the text into three categories:

  • 0 - The text is safe.

  • 1 - This text is sensitive. This means that the text could be talking about a sensitive topic, something political, religious, or talking about a protected class such as race or nationality.

  • 2 - This text is unsafe. This means that the text contains profane language, prejudiced or hateful language, something that could be NSFW, or text that portrays certain groups/people in a harmful manner.

It is possible to filter the generated projects based on the content_label using the command musag purify. It keeps only the projects that have "content_label": 0 and keeps only the title and description of each project.

$ musag purify generated.json purified.json
$ cat purified.json
{
  "projects": [
    {
      "title": "Sail Away",
      "description": "Design a program that can be used to (...)"
    },
    {
      "title": "Hip Hop Hooray!",
      "description": "Design a program that generates random hip hop lyrics."
    }
  ]
}