gptdoc

1.0.9 • Public • Published

GPTDoc logo

Generate documentation comments with OpenAI models

InstallDocumentationLicense

Preview

Functions labeled with /** @gpt */ get an autogenerated doc comment

Before After
/** @gpt */
function Greet(name) {
    console.log(`Hello ${name}`);
}
/**
 * @autogenerated
 * @summary Generates a greeting to the passed in name
 * @param {string} name - The name to greet
 */
function Greet(name) {
    console.log(`Hello ${name}`);
}

Install in project

Install gptdoc as a dev dependency

npm i --save-dev gptdoc 

Execute

node node_modules/gptdoc [args]

Config

You can specify a configuration file:

node node_modules/gptdoc -c .myconfig

If none provided, the script will look for .gptdoc

Sample Config file

{
    "DEBUG": false,
    "framework": "JSDOC",
    "language": "JS",
    "files": {
        "src": "./src",
        "dest": "./gpt"
    },
    "openai": {
        "temperature": 0.7,
        "top_p": 1,
        "max_tokens": 256,
        "model": "text-davinci-003"
    }
}

Find more info about the config here

API Key

Add a .env file in your root directory with OPENAI_API_KEY

or set the OPENAI_API_KEY as a system environement variable.

find your API key here

Document this project

Running docself in the cloned repo will document source files in ./src/

npm run docself

Running test in the cloned repo will document ./example/example.js

npm run test

Contributing

Constructive criticism, Issues and PRs are more than welcome!


License MIT

Package Sidebar

Install

npm i gptdoc

Weekly Downloads

18

Version

1.0.9

License

MIT

Unpacked Size

40.7 kB

Total Files

23

Last publish

Collaborators

  • matiasvlevi