@aslepenkov/ai-shell-mistral v1.1.4
⚠️ This is a fork of ai-shell-mistral by Builder.io.
This project includes modifications for using Mistral
Original project: Builder.io’s ai-shell
Inspired by the GitHub Copilot X CLI, but open source for everyone.
AI Shell
Setup
The minimum supported version of Node.js is v14
Install ai shell:
npm install -g @aslepenkov/ai-shell-mistralRetrieve your API key from Mistral
Note: If you haven't already, you'll have to create an account and set up billing.
Set the key so ai-shell can use it:
ai config set MISTRAL_KEY=<your token>This will create a
.ai-shellfile in your home directory.
Usage
ai <prompt>For example:
ai list all log filesThen you will get an output like this, where you can choose to run the suggested command, revise the command via a prompt, or cancel:
◇ Your script:
│
│ find . -name "*.log"
│
◇ Explanation:
│
│ 1. Searches for all files with the extension ".log" in the current directory and any subdirectories.
│
◆ Run this script?
│ ● ✅ Yes (Lets go!)
│ ○ 📝 Revise
│ ○ ❌ Cancel
└Special characters
Note that some shells handle certain characters like the ? or * or things that look like file paths specially. If you are getting strange behaviors, you can wrap the prompt in quotes to avoid issues, like below:
ai 'what is my ip address'Chat mode

ai chatWith this mode, you can engage in a conversation with the AI and receive helpful responses in a natural, conversational manner directly through the CLI:
┌ Starting new conversation
│
◇ You:
│ how do I serve a redirect in express
│
◇ AI Shell:
In Express, you can use the `redirect()` method to serve a redirect. The `redirect()` method takes one argument, which is the URL that you want to redirect to.
Here's an example:
\`\`\`js
app.get('/oldurl', (req, res) => {
res.redirect('/newurl');
});
\`\`\`Silent mode (skip explanations)
You can disable and skip the explanation section by using the flag -s or --silent
ai -s list all log filesor save the option as a preference using this command:
ai config set SILENT_MODE=trueSet Language

The AI Shell's default language is English, but you can easily switch to your preferred language by using the corresponding language keys, as shown below:
| Language | Key |
|---|---|
| English | en |
| Simplified Chinese | zh-Hans |
| Traditional Chinese | zh-Hant |
| Spanish | es |
| Japanese | jp |
| Korean | ko |
| French | fr |
| German | de |
| Russian | ru |
| Ukrainian | uk |
| Vietnamese | vi |
| Arabic | ar |
| Portuguese | pt |
| Turkish | tr |
For instance, if you want to switch to Simplified Chinese, you can do so by setting the LANGUAGE value to zh-Hans:
ai config set LANGUAGE=zh-HansThis will set your language to Simplified Chinese.
Config UI
To use a more visual interface to view and set config options you can type:
ai configTo get an interactive UI like below:
◆ Set config:
│ ○ Mistral Key
│ ○ Silent Mode
│ ○ Language
│ ○ Cancel
└Upgrading
Check the installed version with:
ai --versionIf it's not the latest version, run:
npm update -g @aslepenkov/ai-shell-mistralOr just use AI shell:
ai update