refacgo

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 4 Imported by: 0

README

refacgo

A Go-based command-line tool that evaluates the code in a specified Go file and provides refactoring suggestions powered by AI.

Installation

$ go install github.com/kakkky/refacgo
Setup
  1. Prepare an .env file in the root directory.
  2. Please write your Gemini API key as follows For information on obtaining an API key, please refer to the official document of gemini. This will allow gemini to be used on your account.
GEMINI_API_KEY=XXXXXXXXXXX

Usage

refacgo <command> [options] <filepath>

Commands

Available commands:

  • eval - Evaluates the specified file only.
  • refac - Evaluates and refactors the specified file.
eval
$ refacgo eval [option] <filepath>

This command evaluates the file specified as an argument (provide the relative path from the current directory). The default language is English, but you can use a flag to get a eval in Japanese.

In addition, having a description of the code written in the specified file will allow for a more accurate review. It is recommended that this option be written when business concepts are important.

Option Default Description
--japanese
-j
English Can change language to Japanese
--desc
-d
- Write a description of the code in the file as an argument to the --desc flag
refac

This command evaluates and refactors the file specified as an argument (provide the relative path from the current directory). When the command is executed, the specified file is temporarily modified. You can decide whether to apply the changes based on a y/n prompt. If n is chosen, the file is reverted to its original state. If y is selected, the file will be saved.

The temporarily refactored code will show differences using + and - symbols, making the changes easy to spot. Once the changes are confirmed, the + and - symbols will be removed, and the file will be saved.

Option Default Description
--japanese
-j
English Can change language to Japanese
--desc
-d
- Write a description of the code in the file as an argument to the --desc flag

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cli
internal
domain
Package domain is a generated GoMock package.
Package domain is a generated GoMock package.
presenter
Package presenter is a generated GoMock package.
Package presenter is a generated GoMock package.
presenter/indicater
Package indicater is a generated GoMock package.
Package indicater is a generated GoMock package.
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL