A CLI written in Java language that generate API interface document and UML diagrams for you using ChatGPT AI(gpt-3.5-turbo).
- Generate API interface documentation, which displays the request and response data structures in tabular form and provides sample code for calling the API in both curl and Java.
- Generate UML activity and class diagrams based on the code. method activity diagram and class diagram.
- Provide a command-line tool with autocomplete feature.
- No need for a web proxy even in mainland China.
Downloaddocgpt.jar
,start with java
command:
java -jar docgpt.jar
Please first create your OpenAI API Key. The OpenAI Platform allows you to generate a new API Key.
When using DocGPT, there are two ways to configure the OpenAI API Key.
- One is to set the environment variable using the command below
export OPENAI_API_KEY=sk-xxxxxxx
- The other is to set the OPENAI_API_KEY configuration using the conf command of DocGPT
docgpt> conf --token=sk-***
In order to assemble prompt content more effectively and save token consumption, DocGPT uses the load command to load and parse Java code.
docgpt> load --directory=<Java file directory>
Tips:
- If you have already specified the directory parameter, you can use the
load
command to quickly load it without specifying the directory parameter again later. You can useconf
to check the default directory. - The
--directory
path support auto-completion, and you can use the tab key to select the path.
The ls
command list all loaded classes and the number of methods they contain.
You can add --method=<Class Name>
to list the methods that the class contains.
By using gen
and specifying the method name with --method=
, you can generate API documentation in Markdown format.
By using gen --uml --method=<Method name>
, you can generate the activity diagram of the method, and gen --uml --class=<Class name>
generate the class diagram of the class.
Reference