Skip to content

node.js script that integrates your bash terminal with OpenAI

Notifications You must be signed in to change notification settings

jkatnik/ai-shell

Repository files navigation

AI-shell

This project solves thefollowing problem:

I love command line! Command line doesn't love me back. It is a difficult relationship.

It uses OpenAI™ to turn user intention into the appropriate command, making it easier to interact with Bash or other shells.

bash demo

Installation

  1. Clone this project git clone git@github.com:jkatnik/ai-shell.git
  2. Register at https://beta.openai.com/signup and create secret key. Note it down.
  3. On Ubuntu-based distributions, for extra features, install xdotool
    apt install xdotool
    
  4. run installation script
    ./install.sh
    
  5. Reload shell
    source ~/.bashrc
    
  6. have fun
    ai list files in my home folder 
    

Usage

Basic usage:

$ ai list all text files in home dir

Reset conversation context and use new one

$ ai -n

Ask OpenAI a question

ai -q Who was the best soccer player ever?

If OpenAI™ fails, you can send the last question to google

$ ai -g

Materials

Reference

Development

Use Node 16 or higher.

nvm use v16

Backlog

  • configStore should check if newly entered API key is valid
  • documentation
  • prepare a blog post
  • configure license
  • provide OS and shell version in the prompt context
  • -i information (version, file locations, node version, authors, etc)

Ideas to consider

Different way of passing command

Maybe we can use standard stdin command forward

Example:

Open terminal 1

$ echo $$
296

Open terminal 2

$ echo -n 'ls -la' >> /proc/296/fd/0

Then in the terminal 1 you will see command ls -la

About

node.js script that integrates your bash terminal with OpenAI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published