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

shell_chat

v0.0.15

Published

Terminal Chat GPT

Downloads

5

Readme

Shell Chat

Demo gif

Getting Started

$ npm i -g shell_chat
$ sc

Requirements

To run this, it requires the following:

  • npm
  • node >= 18.0.0

Core Features

This project is primarily driven by the aim to integrate certain user-friendly features absent in comparable applications. Key features include:

  • "Streaming" with Syntax Highlighting: Output is somehwat "realtime" to the console while being able to retain syntax highlighting.
  • Multiline Mode: Allows input of more than one line.
  • Chat Management: Save, load, and delete past conversations.
  • File Tracking during Chats: Stuff files in to your promp in the midst of chat sessions.
  • Token Management: Change the limit of tokens sent to open AI to limit bills.

Multiline mode

Entering Multiline Mode with \

##> \
##> This is a message \

Exiting Multiline Mode with eof

eof

Chat management

List and load existing chats

##> /ls
##> /l existing-chat

NOTE: Loading chats will render your whole conversation automatically

Saving chat (or overwrite)

##> /s
##> /s save-to-a-new-name
##> /so save-to-an-existing-name

Deleting chat (or all chats)

##> /d specific-chat
##> /delete-all

Other commands

  • Rename chat /rn renaming-name
  • New chat /n new-name
  • Resetting current chat /rc (removing conversation history)

NOTE

  • Chats are saved in ~/.cache/shell-chat.json

File tracking (Experimental)

Track files in the middle of chats. The app will automatically stuff the latest version of the tracked file in to the prompt before sending your message, thus allowing you to swap files in and out as needed for a specific conversation. Tokens are automatically managed and you shouldn't encounter OPEN AI errors.

The list of commands to utilize this feature are outlined below. Glob patterns are utilized. File search occurs from the depth of current working directory.

Find and track files

Find and track all files

##> /fa **

Advanced example: Track all .rb files under controller in addition to all files under the views flder EXCEPT for .js.erb files

##> /find-add controller/**/*.rb views/**/* !**/*.js.erb
OR (/fa)

Generally better to confirm that you are going to track the correct files via /f first

##> /find <glob-pattern/s>
OR (/f)

Untrack files

##> /rf <glob-pattern/s>

Reset All

Untracks all files and erases current conversation history for the current chat.

##> /ra

Listing tracked files

This gives a detailed breakdown of which files are consuming which in addition to TOKENS REMAINING when deciding to track additional files

##> /tr

Token management

Token managements is done for you automatically and you dont have to worry about it generally. The app will notify you if you have tracked too many files in addition to conversations being truncated AUTOMATICALLY when you go over your limit.

But if you want fine-grained control, see the following sections

Token Report

Detailed breakdown of how tokens are being used. From system prompts, existing conversation history, to tracked files (if any).

##> /tr

Limit Conversation History by tokens

You can truncate the conversation history that is sent in each messages to OpenAI by determining the maximum tokens that the conversation history occupy. If the provided value is greater than the model's max tokens, the app defers to the max tokens automatically.

##> /tl <token-number>

Environment Variables

Environment Variables are stored in ~/.config/shell-chat/.env. These are the contents

# MAIN ENVIRONMENT VARIABLES
OPENAI_API_KEY=...           # Open AI api key

MODEL_NAME=gpt-3.5-turbo-16k # change to gpt-4 if needed
MAX_TOKENS=16384             # adjust with model

MAX_COMPLETION_TOKENS=500    # Max tokens in AI reponse

# APP-SPECIFIC ENVIRONMENT VARIABLES
# Minimum amount of tokens available for conversation history
# ... when tracking large/numerous files
RESERVED_CONVERSATION_TOKENS=2000

RESERVED_ERROR_CORRECTION_TOKENS=200  # Buffer for potential miscalculation
RESERVED_INPUT_TOKENS=250             # no longer used