code-refactor-tool
v1.0.3
Published
This CLI tool automates the process of refactoring `.js`, `.jsx`, `.ts`, `.tsx` files by using the OpenAI Codex model. It reads files from a "src" directory, including subdirectories, sends them to the OpenAI API for refactoring suggestions, and then writ
Downloads
10
Readme
Code Refactor Tool
This CLI tool automates the process of refactoring .js, .jsx, .ts, .tsx files by using the OpenAI Codex model. It reads files from a "src" directory, including subdirectories, sends them to the OpenAI API for refactoring suggestions, and then writes the suggested refactorings back to the original files.
Features
- Processes all
.js,.jsx,.ts,.tsxfiles in the specified directory and its subdirectories. - Uses the OpenAI Codex model to generate refactoring suggestions.
- Writes the refactored code back to the original files, replacing the old content.
Prerequisites
Before you install and use the Code Refactor Tool, you need:
- Node.js installed on your machine.
- An API key from OpenAI (ensure you have the appropriate permissions and quota to use the Codex model).
Installation
To use the Code Refactor Tool, install this package and its dependencies:
npm install code-refactor-tool
or run it directly:
npx code-refactor-tool YOUR_OPENAI_API_KEY
Usage
Run the tool with your OpenAI API key as arguments:
code-refactor YOUR_OPENAI_API_KEY
