npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

repo-refactor

v1.2.0

Published

Convert a directory into a different one of your choosing

Readme

LLM-based Code Refactoring Tool

This TypeScript program is designed to refactor a library, repo, or directory of code written in one programming language into another programming language using Language Models (LLMs).

image

Introduction

This tool uses the OpenAI API, which provides a wide range of pre-trained LLMs for various languages. It also utilizes the glob package to match files and directories. It will do a lot of the initial heavy lifting when translating or refactoring code.

Installation

To install the required packages, run the following command:

yarn install

Usage

You will need an OpenAI API key, which can be obtained by signing up for an account here. Once you have an API key, you can set it as an environment variable by running the following command:

export OPENAI_API_KEY="<key>"

You can also pass it to the cli using the --openaiApiKey flag

To use the program, simply run the following command:

yarn refactor --src <source_directory> --dest <destination_directory> --from <source_language> --to <target_language>

Here's an example:

yarn refactor --src ./src --dest ./dist --from python --to javascript

This command will refactor all files in the src directory that have a .py extension into JavaScript files with a .js extension, and place the refactored files in the dist directory.

How It Works

The program works by recursively searching the source directory for files with the specified source language extension, and then passing the contents of each file through a pre-trained LLM for the source language.

The refactored code is then written to a file in the destination directory with the specified target language extension. Any non-code files in the source directory are simply copied to the destination directory.

Known Issues

[ ] The program currently does a poor job of converting files with >7000 tokens, due to the chunking [ ] The refactoring logic does not currently take into account common package managers - for instance, we should be able to read package.json, understand the dependencies, and lookup equivalents/pass them to the model for the destination language [ ] When there's a fundamentall different concept in a language that doesn't exist or isn't necessary in another languages (like mutex locks in rust when moving to javascript), it's difficult for the model to omit that code

Limitations

While this tool can be very useful in automating the refactoring of code from one language to another, it does have its limitations. The accuracy of the refactored code will depend largely on the quality of the pre-trained LLMs used for each language, as well as the complexity of the code being refactored. Additionally, the tool has varying degrees of success in handling any language-specific libraries or dependencies that may be present in the original code.