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 🙏

© 2024 – Pkg Stats / Ryan Hefner

chatgpt-tui

v0.3.1

Published

A terminal user interface for ChatGPT with an empasis on importing/exporting code (no more copy/pasting!).

Downloads

5

Readme

ChatGPT-TUI

A terminal user interface for ChatGPT with an empasis on importing/exporting code (no more copy/pasting!).

Should work for Node.js 14.15.0 and above.

basic usage

Features:

  • 🖨️ Export code blocks to files or copy to clipboard
  • 💾 Load code from files and insert into the conversation
  • 🌎 Load content from websites (i.e. documentation) and insert into the conversation
  • ✒️ Syntax highlighting for code blocks

Why not just use GitHub Copilot?

You should! But one missing feature is the ability to iterate on a solution. For non-trivial problems, its unlikely that the first solution it comes up with is correct. Having the model "think step by step" can dramatically improve its abilities on complex tasks. With ChatGPT-TUI, you can iterate on your solution and export it to a file (without all the copy/pasting).

Quick Start

To install and run, simply type the following into your terminal:

npx chatgpt-tui

If this is your first time running the program, it will prompt you for your OpenAI API key. After you've created an OpenAI account, you can get one here.

From there, you can start chatting with ChatGPT, much like you would with the ChatGPT website.

Loading Local Files

You can load local files into the conversation by using the $FILE(<path>) syntax. For example, if you wanted to load the contents of ./src/index.ts into the conversation, you would do:

The contents of ./src/index.ts are: \n\n $FILE(./src/index.ts)

loading a local file

To load specific lines of a file (as opposed to the entire thing), add brackets after the path but before the closing parenthesis. For example, to load lines 1-5 of ./src/index.ts, you would do:

This will load the first 5 lines of ./src/index.ts \n\n $FILE(./src/index.ts[1:5])

To load an entire directory, you can use the $FOLDER(<path>) syntax. Note, this is not reccomended because you will likely exceed the token limit.

Loading Content from Websites (experimental!)

You can load content from websites into the conversation by using the $URL(<url>) syntax. For example, if you wanted to load the contents of the OpenAI documentation into the conversation, you would do:

loading a website

This feature is still a work in progress, bugs are expected.

CLI Options

--user-msg

Preload the first message you type. When combined with some bash scripting, this can be used to automate the refactoring of multiple files, especially when the refactoring is non-trivial (i.e. hard to solve with a simple codegen)

For instance, to convert all the files in ./src to use ES6 modules, you could do:

for file in ./src/\*; do
  npx chatgpt-tui --user-msg "Refactor this code to use ES6 modules $file \n\n \$FILE($file)"
done

Notice we had to escape the second $ character in the user message. This is because bash will try to perform variable substitution, which we don't want, because we want it to be interpreted by ChatGPT-TUI.

--model

By default, we use the "gpt-3.5-turbo-0301" model. If you have access to the GPT4 models, you will greatly benefit from using those models.

--debug

Prints out the user message post transformations (i.e. after $FILE substitutions are made).

Future Features

I hacked this together in a few days, so it's not very polished. Here are some features I plan to add:

Support exporting multiple code blocks

Currently, the user has to select each code block individually to write to a file. I'd like to add a feature to export all code blocks at once.

Add CLI options

--log-dir

Should log the entire conversation to a directory.