npx reftool
This tool provides essential information for understanding the total volume of a codebase, detecting duplicate code, and conducting efficient refactoring.
By setting up an OpenAI token, it can offer refactoring advice based on the diagnosed code data.
RefTool combines various refactoring tools into a user-friendly package, saving you the hassle of remembering different instructions for each tool.
It can be easily launched using npx, ensuring a hassle-free experience.
In the future, it is planned to include features like dead code detection and evaluation of code readability.
Start it from the command line:
npx reftool
You can also specify a project path:
npx reftool ./path/to/project
Or check two projects for duplicate code:
npx reftool ./path/to/project1 ./path/to/project2
Tip: If the detection doesn’t complete, try specifying the source code directory. Maybe you have a lot of files in your project that aren’t source code.
npx reftool ./src
RefTool uses tools like cloc and jscpd. It runs a local server to monitor and analyze files.
Future plans include integrating more tools like ts-prune. Suggestions for other tools are appreciated.
TODO
- モック画面の作成
- とりあえず static な path でいいから jscpd を実行して値をパースして一覧画面に飛ばす
- パース結果はメモリに保持しておく
- 一覧画面でそれを受け取り、リスト表示する
- 詳細画面に遷移する
- 遷移時にメモリに保持しておいたパース結果を ID or index でサーチして渡す
- ChatGPT をコールしてマークダウンとして表示する
- diff を表示する -> 一旦できたが使いずらいのでモナコを使う
- 節約できるコードのポテンシャルは重複コードの行数とイコールで良い(アバウトで OK)
- 一覧画面上ではポテンシャルセーブで並び替えするべき
- cloc と組み合わせると良さそう
- 全体を把握するのに役に立つ
- プロジェクト全体の行数と重複コードの行数を比較すると良さそう
- 増えた減ったが後から追えると見える化ができて良さそう
- 複数(2 つ)の調査対象に対応する
- watch で指定しているディレクトリが更新されたら診断を再実行する
- 初期のローディング画面
- npx で起動してローカルでサーバーが立ち上がる(インストール不要)
- Open AI のトークンを設定できるようにする(ローカルストレージ)、ストリームできるようにする
- How it works、How to use の説明を README に書く
- beta リリース
- カスタマイズ
- jscpd のオプションをカスタマイズできるよにする
- ChatGPT のプロンプトをカスタマイズできるようにする
- cloc をスナップショットを撮れるようにする?
- ts-prune を使う
- Duplicated Code の read more