termpilot
v0.2.2
Published
AI-powered CLI assistant
Readme
🛡️ TermPilot
TermPilot is an AI-powered command-line assistant that transforms natural language into secure shell commands and explains existing commands with safety guidance. It’s designed to help developers and sysadmins work faster and more confidently! 🚀
✨ Features
- 🗣️ Natural Language to CLI: Convert English prompts into one-line shell commands.
- 🕵️♂️ Explain Mode: Analyze and explain any shell command, highlighting risks and suggesting improvements.
- 🔒 Interactive Safety: Confirm non-destructive commands with
y/N; type the command exactly to authorize destructive operations. - 🖥️ Local Context Aware: Detect OS, shell, Node.js version, current directory, and Git branch.
- 🔑 Secure Config Persistence: Safely store your OpenAI API key in
~/.termpilot.json.
🎥 Demo

🛠️ Prerequisites
- Node.js v18.0.0 or higher
- An OpenAI API key (get one at: https://platform.openai.com/account/api-keys) 🔑
🚀 Installation & Setup
Clone the repo
git clone https://github.com/your-username/termpilot.git cd termpilotInstall dependencies
npm installBuild
npm run buildLink globally
- Development:
npm link - Or one-time:
npm install -g .
- Development:
🔑 Configuration: OpenAI API Key
First Run: TermPilot prompts for your API key and saves it to
~/.termpilot.json.Environment Variable: Add to your shell config to skip prompts:
export OPENAI_API_KEY="sk-..."
💡 Usage
1️⃣ Generate & Execute Commands
termpilot run "<natural language task>"Example:
termpilot run "list files in the current directory"- Non-destructive: Confirm with
yorn. - Destructive: Type the full command to confirm. 🚨
2️⃣ Explain Commands
termpilot explain "<shell command>"Example:
termpilot explain "rm -rf ./build"- Provides human-readable explanation, potential risks, and safety tips. 🛡️
⚙️ Configuration Options
Model Selection: Set default LLM:
export OPENAI_MODEL="gpt-3.5-turbo"
🧪 Testing
Manual:
termpilot run "print the current working directory" termpilot run "delete all .tmp files interactively" termpilot explain "find . -type f -size +100M"Automated (Vitest):
npm test
🤝 Contributing
- Fork the repo 🌱
- Create a branch (
git checkout -b feature/xyz) - Commit your changes (
git commit -m "feat: add xyz feature") - Push and open a PR 🚀
Please adhere to existing style and add tests for new code.
📄 License
MIT License © Gaurav Mahidhariya
