huskygpt
1.0.0
Node.js CLI tools for
auto review
your code orauto generate
unit tests by OpenAIchatgpt3.5
andGPT-4
Plus Account! ✅
unit tests
by gpt-4 model:
unit test
result:
Translate
source file keep the same format and structure:
Modify
exist code by your input requirements e.g.
Please fix bugs or optimize my code. if the function is complexity, please chunk it. If it's function component, use hooks optimize it. And add en and zh comments for complexity logic steps e.g. // EN: some comments, // ZH: 一些评论.
AI
: AI-powered code review
, modify
, translate
and unit test
generationFree
: Free to use with an OpenAI Session Token
, enjoy chatgpt-3.5 or gpt-4 (Plus Account).Security
: Security-conscious function and class extraction, customize your SECURITY_REGEX
.Customizing
: Customizable prompts and model selection.File Reader
: Supports reading files from directories
or git staged files
.To install huskygpt
, run the following command:
npm install -g huskygpt
npm config set OPENAI_API_KEY <YOUR_OPENAI_KEY> -g
OpenAI Session Token
for free using chatgpt
npm config set OPENAI_SESSION_TOKEN <YOUR_OPENAI_SESSION_TOKEN> -g
.env
file to your project root directory, and set OPENAI_PROXY_URL
.Method | Free? | Robust? | Quality? |
---|---|---|---|
OpenAI Session Token |
✅ Yes | ☑️ Maybe | ✅️ Real ChatGPT |
OpenAI API Key |
No | ✅ Yes | ✅ Real ChatGPT models |
prompt
directory in the root directory of your project.review.txt
or tests.txt
in the prompt
directory."husky": {
"hooks": {
"pre-commit": "huskygpt review && huskygpt test && lint-staged --allow-empty"
}
},
.gitignore
:# review
.huskygpt_review.md
.env.local
review
your git staged files:
huskygpt review --model gpt-4 --max-tokens 2048
modify
your exist code:
huskygpt modify -r dir -d src/pages/UserRegister/RegisterList.tsx -m gpt-4
test
:
huskygpt test --model gpt-3.5-turbo --max-tokens 2048 --file-extensions .ts,.tsx --read-type dir --read-dir-name src --test-file-type test --test-file-extension .ts --test-file-dir-name tests
translate
your git staged files:
huskygpt translate -d example/i18n/test.json
-k, --api-key <key>
: Set the OpenAI API key.-t, --openai-session-token <token>
: OpenAI session token, 2 step to get token, If you don't set this, will use OPENAI_API_KEY, will cause fee by api key.-pu, --openai-proxy-url <url>
: Proxy URL to use for OpenAI API requests.-m, --model <model>
: OpenAI model to use.-p, --prompt <prompt>
: OpenAI prompt to use.-mt, --max-tokens <tokens>
: OpenAI max tokens to use.-e, --file-extensions <extensions>
: File extensions to read, example: .ts,.tsx-r, --read-type <type>
: Read files from directory or git stage, example: dir or git.-s, --read-git-status <name>
: Read files from git stage by status default: A,R,M.-d, --read-dir-name <name>
: Root name of the directory to read files from, example: src.-f, --test-file-type <type>
: Generate test file type, example: test or spec.-n, --test-file-dir-name <name>
: Generate test file directory name, example: tests.-o, --test-file-overwrite <value>
: Generate test file overwrite, default is true.-w, --review-report-webhook <url>
: Webhook URL to send review report.See .env
file.
.env
or .env.local
, that will be used as default options. Command options will override the default options.seaTalk
, if other channel need to use, please rise PR
by yourself or ask me for help.