Code Documentation Assistant

The Code Documentation Assistant is an AI-powered tool that helps generate documentation for code. It uses the OpenAI GPT-3.5 Turbo model to generate readme files in GitHub-flavored markdown based on the provided code.

Usage

Importing the Code Documentation Assistant

import { draftReadme, writeReadme } from "code-doc-assistant";

Function: draftReadme

async function draftReadme(options: WriterOptions): Promise<string>

The draftReadme function generates a readme file based on the provided options.

Parameters

  • options (required): An object containing the following properties:
    • username (string): The username of the code owner.
    • valName (string): The name of the Val containing the code.
    • model (optional, default: "gpt-3.5-turbo"): The OpenAI model to use for generating the readme.
    • userPrompt (optional): Additional prompt to include in the documentation.

Return Value

A promise that resolves to a string representing the generated readme file.

Function: writeReadme

async function writeReadme(options: WriterOptions): Promise<string>

The writeReadme function generates a readme file and updates the readme of the corresponding Val with the generated content.

Parameters

  • options (required): An object containing the following properties:
    • username (string): The username of the code owner.
    • valName (string): The name of the Val containing the code.
    • model (optional, default: "gpt-3.5-turbo"): The OpenAI model to use for generating the readme.
    • userPrompt (optional): Additional prompt to include in the documentation.

Return Value

A promise that resolves to a string indicating the success of the readme update.

Example

import { draftReadme, writeReadme } from "code-doc-assistant"; const options = { username: "your-username", valName: "your-val-name", }; const generatedReadme = await draftReadme(options); console.log(generatedReadme); const successMessage = await writeReadme(options); console.log(successMessage);

License

This project is licensed under the MIT License.

Migrated from folder: projects/gptTools/draftReadme