Skip to content

Experience the power of Command AI: your AI-powered command line companion that makes complex tasks simple and intuitive.

License

Notifications You must be signed in to change notification settings

ThinkThinkAI/CommandAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ‰ Command AI

 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—
โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘
โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘
โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘
โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘ โ•šโ•โ• โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ•šโ•โ• โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘
 โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•     โ•šโ•โ•โ•šโ•โ•     โ•šโ•โ•โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•  โ•šโ•โ•โ•โ•โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•

Maintainability

Welcome to Command AI, your new AI-powered command-line buddies! These programs makes handling tasks a breeze. Whether you need to automate routine tasks, set up new projects, run background operations, or simply start a chat. Just tell it what you want, and it'll get to work. Check out some cool things it can do:

  • Automate Your Routine Tasks: Need a cron job that checks your IP and pings a specific URL if it changes? Just ask!

    ai "make a cron job that checks my IP and calls https://myipchanged.com when it changes"
  • Set Up Projects on the Fly: Want to start an npm project that spins up a configurable web server greeting you with "hello world"? No problem.

    ai "create an npm project in ~/hello-world that starts a webserver saying 'hello world' and reads configs from a .env file"
  • Run Background Jobs: Need to list all the JavaScript files on your computer and save them in a file? It can handle that in the background.

    ai "in the background, list all the JS files on this computer and put them in ~/js.txt"
  • Query Databases with AI: Want to interact with a database using natural language? Use aiq! Suports MYSQL, Postgres, and SQLite.

  aiq my_database "list all users where age is over 30"
  • Start an AI conversation: Want to have a conversation with an AI? It can do that too.

    aic "what is the meaning of life?"

Just type your request into the CLI with ai "your requests here", and watch the magic happen. It's like having a personal assistant for your terminal!

๐Ÿšง ALPHA Stage Alert ๐Ÿšง

This tool is still in its alpha stage, so expect some hiccups as we fine-tune our prompts for different models. The default settings show you execution plans and descriptions before running scripts to keep you in the loop / safe.

๐Ÿ”ฅ Features

  • AI Service Selection: Pick between Ollama, ChatGPT, and any OpenAI compatable server.
  • Easy Configuration: Set everything up quickly with a few prompts.
  • Command Line Power: Ask the AI to do any task(s) you would want to do at the command line.
  • DB Power: Ask the AI for any information from your DB in plain language.
  • Conversational AI: Start a conversation with the AI.

๐Ÿ“‹ Requirements

  • Node.js
  • npm

๐Ÿš€ Installation

  1. Install globally via npm:

    npm install -g command-ai
  2. Upgrade:

    ai upgrade

๐ŸŽฎ Usage

Initial Setup

The first time you run it, youโ€™ll set up your AI service and other settings. It saves everything in ~/.commandai/config.json.

ai

Provide Command Input

Type your command either as an argument or enter it when prompted.

ai "your requests here"

# Example requests (use quotes if your shell needs them):
ai make a cron job that checks my IP and calls https://myipchanged.com when it changes

ai create an npm project in ~/hello-world that starts a webserver saying "hello world" and reads configs from a .env file

ai in the background, list all the JS files on this computer and put them in ~/js.txt

# Start AI Database Query (first param is the database name, second is the query)
aiq my_database "list all users where age is over 30"
# or
aiq my_database "list all users where age is over 30

# Don't start a AI Database Query Session.. Just get one response in JSON format.
aiq! my_database "list all users where age is over 30"

# Start an AI conversation
aic "what is the meaning of life?"

# Get only one response from AI
aic! "what is the meaning of life?"

More commands..

# If you don't provide prompt, `ai` will just ask you to enter it.
ai

# If you are feeling lucky an exclamation will execute without confirmation.
ai! list all the dot files

# Reconfigure 
ai config
aic config

#configure db connections
aiq config

# Upgrade Command AI
ai upgrade

Execution Plans & Descriptions

After you enter a command, Command AI will fetch a script and show you the plan and description. You decide if you want to run it!

Logging

If you turn logging on, commands and results are stored so you can revisit them anytime. (also please turn on and send if you open up a bug ticket)

โš™๏ธ Configuration

AI Settings for all utilies are stored at ~/.commandai/config.json. Hereโ€™s what it looks like:

{
  "aiService": "",                   // Pick "Ollama" "ChatGPT" "OpenAI"
  "ollamaUrl": "",                   // Ollama server URL
  "ollamaModel": "",                 // Model for Ollama
  "openAIApiKey": "",                // ChatGPT / OpenAI API key
  "openAIModel": "",                 // Model for OpenAI
  "openAIUrl": "",                   // URL for OpenAI not needed for ChatGPT
  "showExecutionDescription": true,  // Show descriptions
  "showExecutionPlan": true,         // Show plans
  "enableLogging": false             // Enable logging
}

DB Settings for aiq are stored at ~/.commandai/db.json. You can setup as many connections as you like. Hereโ€™s what it looks like:

[
  {
    "name": "PostgreSQL_Connection",
    "type": "postgres",
    "config": {
      "user": "postgres_user",
      "host": "localhost",
      "database": "postgres_db",
      "password": "postgres_password",
      "port": 5432
    }
  },
  {
    "name": "MySQL_Connection",
    "type": "mysql",
    "config": {
      "user": "mysql_user",
      "host": "localhost",
      "database": "mysql_db",
      "password": "mysql_password",
      "port": 3306
    }
  },
  {
    "name": "SQLite_Connection",
    "type": "sqlite",
    "config": {
      "filename": "/path/to/sqlite.db"
    }
  }
]

NOTE! sqlite does not require to be in the config you can just list the file as the first param.

๐Ÿ’ป Development

Want to help out? Great! Clone the repo and install dependencies:

git clone https://github.com/username/command-ai.git
cd command-ai
npm install

Run the project:

npm start

๐Ÿค Contributing

Weโ€™d love your help! Fork the repo, checkout the pre-release branch, make some changes, and send over a pull request. If you want to use the code for your local usage instead of installing it globally, follow these steps:

  1. Clone your forked repo:
    git clone https://github.com/your-username/command-ai.git
    cd command-ai
  2. Checkout the pre-release branch:
    git checkout pre-release
    This branch is where we merge all the new features and bug fixes before they are released.
  3. Link the project locally:
    npm link
    After these steps, you can use the commands (ai, aic, aiq, etc.) from your local development environment without installing the package globally.

๐Ÿ“œ License

This project is licensed under the MIT License.


Enjoy making your CLI life easier with Command AI!