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

@trellisorg/nx-ai-readme

v1.0.0

Published

## Project Description

Downloads

1

Readme

@trellisorg/nx-ai-readme

Project Description

This is an Nx executor that can be used within an Nx monorepo to generate README.md files using Google's Gemini AI models. It leverages the @google/generative-ai package to communicate with the Gemini API and uses the context of your project's files to generate comprehensive and insightful README.md files.

Table of Contents

Installation

Install the package within your Nx workspace:

nx add @trellisorg/nx-ai-readme

Setup

  1. Obtain a Google Generative AI API Key:

  2. Set your API Key:

    • You can set your API key as an environment variable in your project. For example:
      export AI_README_API_KEY="your-api-key-here"
    • Alternatively, you can define the API key in your executor configuration within your workspace.json.

Configuration Options

| Option | Type | Default | Description | | ---------------- | -------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | instructions | string | "Write a README.md file in Markdown that clearly explains how to use the library..." | Instructions to send along with the generation to ensure the model acts appropriately or includes additional context you want it to. This can be a link to a file or raw text. Will attempt to find a file (from workspace root) first, if it does not exist then the value will be used as the instructions. The file this points to should be raw text. | | include | array | [] | Additional files to include as context to the readme generation, these could be files displaying usage of the library in a demo app, documentation files or other relevant files. | | example | string | "https://raw.githubusercontent.com/othneildrew/Best-README-Template/master/BLANK_README.md" | A link to an example README.md that should be used as additional context for the model to know what a good readme is to follow the format of, or a template you have hosted publicly. This should be a link to the raw text so an HTTP GET will return the raw markdown. | | projectFiles | array | ['**/*.ts', 'package.json'] | An array of globs defining what files (relative to the project root) to include as part of the context for the project generation. | | pathToReadme | string | "README.md" | The path to the readme file that will be written to when the generation is completed, this defaults to {projectRoot}/README.md. | | model | string | "gemini-1.5-flash-latest" | The model from the Gemini family to use for generating the readme. | | temperature | number | 0 | Configure the temperature of the model, will default to: 0. | | apiKey | string | "AI_README_API_KEY" | The key in process.env the apiKey for Gemini is stored in. If this is left out it will be undefined and pull the default based on the @google/generative-ai package. |

Usage

You can use the ai-readme executor within your workspace.json file to generate a README.md file for a specific project. For example, to generate a README for the nx-ai-readme project, add the following to your workspace.json:

{
  "projects": {
    "nx-ai-readme": {
      "targets": {
        "generate-readme": {
          "executor": "@trellisorg/nx-ai-readme:ai-readme",
          "options": {
            "temperature": 1,
            "projectFiles": ["**/*.ts", "**/*.json"],
            "instructions": "Write a README.md file in Markdown that clearly explains how to use the library @trellisorg/nx-ai-readme. Provide sections for: installation, setup, configuration options, usage and all other relevant information a developer would need to use the library, An example structure/layout will be provided along with all source files and relevant example files for the project. This is an Nx executor that can be used within an Nx monorepo to generate README files, show how to use it within an Nx workspace."
          }
        }
      }
    }
  }
}

Then, you can run the following command:

nx generate-readme nx-ai-readme

This will generate a README.md file in the nx-ai-readme project root.

Contributing

We welcome contributions to this project!

  • If you have any issues or feature requests, please open an issue on the GitHub repository.
  • Before submitting a pull request, please ensure your code adheres to the existing code style and that your changes are covered by unit tests.

License

This project is licensed under the MIT License. See the LICENSE file for more information.