AICmdTools is set of command-line tools that utilize the OpenAI CahtGPT API to:
- generate shell commands based on user input.
- activate command line chat with ability to pass through system settings.
It's built with Go and designed for ease of use, providing a simple and efficient way to interact with ChatGPT API. Project inspired by https://github.com/wunderwuzzi23/yolo-ai-cmdbot.
- Simple command-line interface
- Supports multiple operating systems and shells
- Configurable safety feature to confirm command execution
- Instant error explanation and fix suggestions
- Easy installation and setup
- Clone the repository:
git clone https://github.com/piotr1215/aicmdtools.git
cd aicmdtools- Install all the command-line tools:
Use just command runner to install the commands and optionally copy the
configuration files:
just installIf running for the first time, bun the provided installation script to set up configuration files:
This will copy the config.yaml and prompt.txt files to the appropriate location in your home directory (e.g., $HOME/.config/aicmdtools).
just copy_files There are 4 separate commands that you can use:
aicmd: Generate a shell command based on user input.
Example: aicmd "create a new directory called my_project"
aichat: Start a chat with the AI modelaicompgraph: Generate plantuml diagrams based YAML files (useful for Crossplane diagrams)aifix: Analyze command errors and suggest fixes instantly
Example: After a failed command, run
aifixoraifix "your error message"
The aifix command provides instant error explanation and fix suggestions:
# Automatic error detection (after a failed command)
$ go build
# error: undefined: fmt.Println
$ aifix
# Manual error input
$ aifix "Module not found: 'react-dom'"
# Show help
$ aifix -help
# Optional shell integration for better auto-detection
$ aifix -init-shell zshFeatures:
- Analyzes errors from shell history automatically
- Provides clear explanations and exact fix commands
- Supports bash, zsh, and fish shells
- Filters noise from verbose error messages
- Context-aware suggestions based on OS, shell, and language
- Safety warnings for potentially destructive commands
-model: Display the current model being used (supported byaicmdandaifix)-version: Display the current version (supported by all CLIs)-help: Display help information (supported byaifix)
You can customize the behavior of AICmdTools by modifying the config.yaml file located in $HOME/.config/aicmdtools. The available options include:
openai_api_key: Your OpenAI API key.alternatively the api key can be passed via variable
$OPENAI_API_KEYsafety: If set totrue, AICmdTools will prompt you to confirm before executing any generated command.model: any supported model that you have access toto list all available models use
curl https://api.openai.com/v1/models \ -H "Authorization: Bearer $OPENAI_API_KEY"
It is possible to edit the promt.txt file in the config folder and make aicmdtools
behave in a different way if you want to adjust the prompt further.
Contributions are welcome! If you have any ideas for improvements or bug fixes, please submit a pull request or create an issue on the GitHub repository.
AICmdTools is released under the MIT License. See the LICENSE file for more information.