Skip to main content

Terminal Assistant

Project description

# Terma Short for Terminal Asistant, Terma is An NLP based CLI application that takes in input from the user in plain language, converts that into an appropriate bash command and finally displays this generated command along with follow up actions that the user can take.

Inspired from the Translate to bash functionality in [fig.io](https://fig.io/).

# Setup

## Pre-requisite In this primitive version of terma, the queries typed out are sent directly to an [OpenAI](https://openai.com/) model. In order to use the openaI models you would have to [Sign up](https://platform.openai.com/signup) and get a token.

Once you have obtained a token, you can either set it as an environment variable before you start as shown below. ` export OPENAI_TOKEN=<your_token_here> ` The other option you have is to create a .terma file in your home directory and then just add the token there. This approach has the added advantage that you don’t have to remember to set the environment variable every time you want to use terma.

## Instalation Terma is a python based application and is available in [PyPI](https://pypi.org/project/terma/1.0.1/). This can be installed in any python virtual environment. ` pip install terma==1.0.1 `

# Usage After installing terma it can be used just by specifying the command terma in the envrionment in which the package was installed. This starts an interactive CLI session. In the session you can type in the query you have in plain english and the application would generate a CLI query based on that.

![terma example](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExMzhiNDYxODRkMDAzNTFiNjFjZWUxMGNiM2UxNDc0NzlkODMwNjNmMCZjdD1n/fLIHvZfthjK3GYSxJx/giphy.gif)

As seen in the above image, along with the generated comand terma also gives you choices on what to do with it. You can execute it in the session directly, copy it to the clipboard (for running in another terminal tab or sharing somewhere else) or you can just choose to continue with the conversation.

To exit press ctrl-D or just type exit() or quit().

# Features planned

I have a couple of ideas to improve the user experience around the application:

Output validation: In some cases, the openAI model being used generates invalid commands based on the query inputed by the user. One approach that can be used to deal with it is to pass the output from model into another one that performs this sort of validation and ensures that the generated text is a valid os command.

Interactive subprocess: Would enable the users to execute commands which trigger interactive processes from with in the terma console.

More suggestions and contributions welcome :)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

terma-1.0.2.tar.gz (7.6 kB view details)

Uploaded Source

File details

Details for the file terma-1.0.2.tar.gz.

File metadata

  • Download URL: terma-1.0.2.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for terma-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2b44d65d3afd1eb15b72e59650798f9927f7675d2cd3afbec004cba7f72c9dbb
MD5 667c65f88c81f0b2b845c20a139e3c35
BLAKE2b-256 7237c1d2d14c2bb17b83304b01c0aaa1ff37f06665e46d485b0329134e21e7aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page