Skip to content

cfstcyr/cli-ai

Repository files navigation

cli-ai

This CLI app utilizes chatgpt to interpret natural language queries, enabling users to converse, ask questions and generate CLI commands easily and efficiently.

Usage

Ask AI

This mode allows you to ask a question.

Ask AI

Generate CLI command

The feature to simply ask a question allows users to type or speak a question in natural language, and the CLI app will use the chatgpt language model to interpret the query and generate a CLI command.

For example, a user can ask "How do I create a new file?" and the CLI app will generate the appropriate command to create a new file, such as "touch filename".

You can then run it or copy it to your clipboard.

Generate CLI command

Conversational

Start a chat conversation with ChatGPT.

Conversational

SQL Generator

Generate SQL queries from natural language. It displays properly in the terminal and you can copy it to you clipboard.

SQL Generator

You can also specify a modification to make for the query.

SQL Generator modification

Installation

Manual

  1. Clone this repo
  2. Install dependencies npm ci
  3. Build the project npm run build
  4. Package the project
    • This app has only been tested on a M2 Mac and the command only exists for this architecture. npm run package:macos
    • If you don't have a Mac, you might need to checkout the pkg documentation.
  5. Add ./bin to you path.
    • With zsh from this directory: echo "\n# cli-ai\nexport PATH=\"\$PATH:$PWD/bin\"" >> ~/.zshrc
    • With bash from this directory: echo "\n# cli-ai\nexport PATH=\"\$PATH:$PWD/bin\"" >> ~/.bashrc
  6. Add your OpenAI API key with ai config set api-key <my api key>

About

CLI command that uses OpenAI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published