code-refactor-tool

1.0.3 • Public • Published

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, .tsx files 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

Readme

Keywords

none

Package Sidebar

Install

npm i code-refactor-tool

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

4.18 kB

Total Files

3

Last publish

Collaborators

  • akshaykamble