This README was generated using readit. It may not be accurate.
ReadIt is a Node.js script that automatically generates README files for Github repositories, summarizing the code using the OpenAI API. By using this package, developers can save time writing a README file from scratch, ensuring a consistent structure and decreasing the probability of missing important details. A well-written README file can help other developers use the code, learn how to contribute, and even encourage people to support the project.
To use ReadIt, follow these steps:
- Clone the repository:
git clone https://github.com/aramperes/readit.git
- Install dependencies:
npm install
- Create a
.env
file in the root directory, containing your OpenAI API Key:
OPENAI_API_KEY=<your API key>
- Run the script with the desired arguments:
node . <path to repo> <url of repo> <primary language>
Note that this package requires Node.js and an API key from the OpenAI API.
The script is executed by running index.js
, which imports modules from openai
, ./lib
, and ./lib/prompt.js
. It then reads the command line arguments, creates an instance of the OpenAI API, and defines the function createReadme
, which performs the core functionality of generating a README for a repository.
Firstly, createReadme
uses the readSourceFiles
function from ./lib/source.js
to read the source code of a repository and returns a collection of SourceBag
objects containing the code. Then, the function generates prompts using the codeSummaryPrompt
and readmePrompt
functions from ./lib/prompt.js
. The prompts are then used to generate summaries of the code using the OpenAI API.
Finally, createReadme
generates the final README by combining the prompts and the response generated by the OpenAI API. It does this by first creating a default prompt and then appending prompts for each file in the repository. The response generated by the OpenAI API is then appended, resulting in the final README.
If you find any issues with the package or would like to contribute, feel free to submit an issue or a pull request on the GitHub repository page. All contributions are welcome and greatly appreciated!
ReadIt is open source and available under the MIT License. Please see the LICENSE file for more information.