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

@hero-page/hero-ai-package-creator

v1.0.10

Published

Create complete NPM packages quickly and easily with the power of AI. The hero-ai-package-creator generates all necessary files and configurations for your NPM package, saving you time and effort in the development process.

Downloads

11

Readme

hero-ai-package-creator

Hi! I'm Sam Chahine, and I'm pretty obsessed with pushing AI to its limits. It's like a tiny magic realm from whence I can extract wisdom from masters past... oh, it's just like a book. Anyway!

Table of Contents

Comment

So to use this package, you'll need an API key for GPT4. I'm not sure when the waitlist format will end, and everyone will gain access. But till then, I'm happy to create any AI packages you recommend 😊

If you wanna chat, I'm on Twitter, LinkedIn, Hero (most of my work is on Hero)

Here are some packages I've created & published so far:

  1. hero-emoji-strings
  2. hero-ai-built-regex-utilities
  3. hero-regex
  4. hero-date-time-utils
  5. hero-math-functions
  6. hero-array-utils
  7. hero-string-manipulation

Each AI-created package takes anywhere between 10-20 minutes, depending on how many functions you want the package to have.

Here's a non-techy visual of which prompts were used to create this magical creator:

  1. Prompts
  2. Format & Linting Rules for Code Output from GPT

Silly Errors from AI

I've seen that sometimes, AI is over-confident in its ability to write proper regex, and ends up corrupting a file.

Worst case scenario is the script will catch this & stop (everything is tested at the end automatically), and you could either decided to fix the function yourself, or create another "simpler" package. Up to you!

Installation

npm install @hero-page/hero-ai-package-creator

It has 2 dependencies (which have their own dependencies):

  1. openai
  2. jsdoc

They will probably be installed since they're in the package.json, just wanted to be transparent 😊

Usage

const {creator} = require("@hero-page/hero-ai-package-creator");

const config = {
    "AUTHOR_NAME": "Sam Chahine",
    "AUTHOR_URL": "https://github.com/kingmeers",
    "AUTHOR_ORG_NAME": "Hero",
    "AUTHOR_ORG_URL": "https://hero.page",
    "GITHUB_USERNAME": "hero-page",
    "GITHUB_OWNER_ID": "YOUR_GITHUB_OWNER_ID",
    "REPO_VISIBILITY": "PUBLIC",
    "REPO_PREFIX": "hero",
    "SHOULD_PUBLISH_TO_NPM": false,
    "GPT_MODEL": "gpt-4", // Can be any model for which you have access
    "GPT_KEY": "GPT-KEY" // Must be a key that corresponds to above model's access
};

const ideas = [
    {
        prompt: "A set of functions for string manipulating emojis",
        number_of_functions: 12,
        name_prefix: "hero"
    }
]


creator({
    config,
    ideas
});

Configuration

You can customize the behavior of this package by providing a configuration object when initializing it. The available configuration options are described below, along with their default values:

{
  "AUTHOR_NAME": "Sam Chahine",
  "AUTHOR_URL": "https://github.com/kingmeers",
  "AUTHOR_ORG_NAME": "Hero",
  "AUTHOR_ORG_URL": "https://hero.page",
  "GITHUB_USERNAME": "hero-page",
  "GITHUB_OWNER_ID": "YOUR_GITHUB_OWNER_ID",
  "REPO_VISIBILITY": "PUBLIC",
  "REPO_PREFIX": "hero",
  "SHOULD_PUBLISH_TO_NPM": false,
  "GPT_MODEL": "gpt-4", // Can be any model for which you have access
  "GPT_KEY": "GPT-KEY"
}

To obtain your GitHub owner ID, follow these steps:

  1. Install the gh CLI tool: brew install gh
  2. Log in to your GitHub account: gh auth login
  3. Run the following command, replacing "YOUR_GITHUB_USERNAME/ORG" with your actual GitHub username or organization name: gh api graphql -f query='{ organization(login:"YOUR_GITHUB_USERNAME/ORG") { id } }'
  4. Replace "YOUR_GITHUB_OWNER_ID" with the owner ID obtained from the query.

Schema

The type of Schema this package currently creates & uses is quite simple, it looks like this:

{
   "packages":[
      {
         "name":"hero-emoji-strings",
         "description":"A library to manage strings with emojis, making it easier to manipulate, count and sanitize strings that contain emojis",
         "functions":[
            {
               "function_name":"emojiCount",
               "function_summary":"Counts the number of emojis in a given string. Handles Unicode and shortcodes emojis. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and long strings with emojis. Extreme cases: strings with special characters, strings with a mixture of letters, numbers, and emojis. Ignored cases: malformed shortcodes."
            },
            {
               "function_name":"replaceEmoji",
               "function_summary":"Replaces all occurrences of a specific emoji in a string with another string (could be another emoji). Test cases: strings with single emoji, multiple emojis, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: invalid input emoji."
            },
            {
               "function_name":"splitByEmoji",
               "function_summary":"Splits a string into an array of strings divided by emojis. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and strings with various delimiters. Extreme cases: strings with special characters and long strings with emojis. Ignored cases: malformed shortcodes."
            },
         ]
      }
   ]
}

It is generated with GPT4, and then fed back into GPT4 one by one, for further elaboration, function writing & tests too!

The purpose of this experiment is more research than anything. I have a visual output of the tests passed/failed, and some pass with flying colors, while others fail some.

What's interesting, is that GPT4 writes better tests than it does error-handling-functions!

Explore Schemas

If you want to see more schemas without having to run any GPT4, you can find several examples in the ./schemas folder.

I've also uploaded several packages under ./published_hero_modules incase you just want to browse!

Contributing

Contributions and issues are welcome. However, please note that I may have limited time to fix issues and review contributions. Your help is appreciated!

License

This project is licensed under the MIT License.