1.0.5 • Published 7 months ago
autocomment v1.0.5
About The Project
Autocomment is a Cli tool that automates the process of adding meaningful comments to your source code. By integrating with OpenAI’s language models, Autocomment generates insightful comments that enhance code readability and documentation.
Installation
Installation:
npm -i autocomment
Get a free API Key at https://console.groq.com
Create a .env file and add your api into it
```bash GROQ_API_KEY=<api-key>
<!-- USAGE EXAMPLES -->
Usage
Tool Execution:
npx autocomment <filename> ...
or if not using .env file
npx autocomment -a <api-key> <filename> ...
Options:
--version
or-v
: Shows the current version of Autocomment.--help
or-h
: Shows help menu.--save <output-filename>
or-s <output-filename>
: Saves the output to the output folder with the designated filename.--api <api-key>
or-a <api-key>
: Input api.npx autocomment -s <output-filename> <filename>...
New Feature: --token-usage
The --token-usage
flag has been added to display token statistics when generating comments. This can help monitor the number of tokens used in API requests, providing insight into the cost and efficiency of the request.
Example Command
npx autocomment --token-usage <filename>
This will print the generated comments and output token usage statistics to the console.
Example Output
{
"queue_time": 0.003453426,
"prompt_tokens": 90,
"prompt_time": 0.010868842,
"completion_tokens": 123,
"completion_time": 0.1025,
"total_tokens": 213,
"total_time": 0.113368842
}
Future features
- Customization: Allow user to specify how they want the comments to be generated
- Save the outputs to multiple files.