mvp-ai
v1.0.1
Published
A professional AI-powered CLI tool with natural language processing capabilities
Maintainers
Readme
🤖 AI CLI - Your AI-Powered Command Line Assistant
A professional, feature-rich AI CLI tool that brings the power of artificial intelligence directly to your terminal. Built with TypeScript and powered by multiple AI providers including Groq, OpenAI, and Anthropic.
✨ Features
🎯 Core AI Capabilities
- Natural Language Processing: Ask questions in plain English and get intelligent responses
- Streaming Responses: Real-time AI responses with beautiful terminal formatting
- Multiple AI Providers: Support for Groq, OpenAI, and Anthropic models
- Context Awareness: Automatically detects your project type and provides relevant assistance
💻 Developer Tools
- Code Generation: Generate boilerplate code, components, APIs, and more
- Code Translation: Convert code between different programming languages
- Code Explanation: Get detailed explanations of commands, code snippets, and concepts
- Error Debugging: Analyze error logs and get intelligent debugging assistance
🔧 Git Integration
- Smart Commit Messages: Generate meaningful commit messages from your changes
- Diff Analysis: Understand what your changes do and their impact
- Git Workflow Assistance: Get help with branching, merging, and Git best practices
📝 Documentation & Analysis
- File Summarization: Get high-level overviews of code files and projects
- API Documentation: Quick explanations of libraries, functions, and APIs
- Project Analysis: Understand project structure and architecture
🛠️ Automation & Scripting
- Script Generation: Create automation scripts for common tasks
- Regex Helper: Generate and test regular expressions from natural language
- Task Automation: Generate deployment, backup, and monitoring scripts
🎮 Interactive Mode
- Copilot Mode: Persistent AI session for ongoing assistance
- Session Management: Save and restore conversation history
- Context Preservation: Maintain conversation context across interactions
🚀 Quick Start
Prerequisites
- Node.js 18+
- An API key from one of the supported providers (Groq, OpenAI, or Anthropic)
Installation
- Clone and setup the project:
git clone <repository-url>
cd ai-cli
npm install
npm run build- Configure your API key:
# Copy the example environment file
cp .env.example .env
# Edit .env and add your API key
# For Groq (recommended for free usage):
GROQ_API_KEY=your_groq_api_key_here- Test the installation:
node dist/index.js --help- Optional: Install globally:
npm link
# Now you can use 'ai' command anywhere
ai --help📖 Usage Examples
Basic AI Interaction
# Ask any question
ai ask "How do I reverse a string in Python?"
# Quick questions (shorthand)
ai "What is the difference between let and const in JavaScript?"Code Generation
# Generate a React component
ai gen react component UserProfile
# Generate an API endpoint
ai gen api endpoint --language python --framework fastapi
# Generate with specific features
ai gen:component LoginForm --features "validation,styling,typescript"Code Translation
# Translate Python to JavaScript
ai translate "def fibonacci(n): return n if n <= 1 else fibonacci(n-1) + fibonacci(n-2)" --from python --to javascript
# Use shortcuts
ai py2js "print('Hello World')"
ai js2ts "const greeting = 'Hello';"Debugging & Analysis
# Debug an error
ai debug "TypeError: Cannot read property 'length' of undefined"
# Analyze from file
ai debug --file error.log
# Performance analysis
ai debug:performance --file profile.logGit Integration
# Generate commit message
ai git commit
# Analyze changes
ai git diff --summary
# Get commit message suggestions
ai git commit --conventionalFile & Project Analysis
# Summarize a file
ai summarize src/app.js
# Analyze entire project
ai sum:project
# Focus on specific aspects
ai summarize . --functions --classesInteractive Mode
# Start interactive session
ai interactive
# In interactive mode:
ai> How do I optimize this React component?
ai> /help
ai> /save
ai> /exitScript Generation
# Generate automation scripts
ai script "backup database daily at 2 AM"
# Generate deployment script
ai script:deploy "Deploy Node.js app to AWS"
# Save to file
ai script:backup --file backup.shConfiguration
# View current config
ai config show
# Set API key
ai config set apiKey your_new_key
# Change model
ai config set model gpt-4
# Manage custom prompts
ai config prompts add "code-review" "Review this code for best practices" "Please review: {code}"🎨 Terminal UI Features
The AI CLI includes beautiful terminal formatting with:
- 🎨 Syntax highlighting for code blocks
- 📊 Progress indicators for long operations
- 🎯 Colored output for better readability
- 📦 Boxed content for important information
- ⚡ Streaming responses with real-time output
- 🔄 Interactive prompts for user input
🔧 Configuration
Environment Variables
# AI Provider Settings
GROQ_API_KEY=your_groq_api_key
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key
# CLI Settings
AI_CLI_DEFAULT_MODEL=llama-3.3-70b-versatile
AI_CLI_MAX_TOKENS=4096
AI_CLI_TEMPERATURE=0.7
# Debug Settings
DEBUG=false
LOG_LEVEL=infoUser Configuration
Configuration is stored in ~/.ai-cli/config.json:
{
"apiKey": "your_api_key",
"model": "llama-3.3-70b-versatile",
"provider": "groq",
"maxTokens": 4096,
"temperature": 0.7
}🏗️ Project Structure
ai-cli/
├── src/
│ ├── commands/ # Command implementations
│ │ ├── ask.ts # General AI interaction
│ │ ├── explain.ts # Code/command explanation
│ │ ├── generate.ts # Code generation
│ │ ├── translate.ts # Code translation
│ │ ├── debug.ts # Error analysis
│ │ ├── git.ts # Git integration
│ │ ├── summarize.ts # File/project analysis
│ │ ├── interactive.ts # Interactive mode
│ │ └── ...
│ ├── services/ # Core services
│ │ └── ai-service.ts # AI provider integration
│ ├── utils/ # Utility functions
│ │ ├── formatter.ts # Terminal formatting
│ │ ├── project-detector.ts # Project type detection
│ │ └── file-analyzer.ts # File analysis
│ ├── config/ # Configuration management
│ ├── types/ # TypeScript type definitions
│ └── index.ts # Main entry point
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md🎯 Supported AI Providers
Groq (Recommended)
- Free tier available
- Fast inference
- Models: llama-3.3-70b-versatile, mixtral-8x7b-32768
- Setup: Get API key from console.groq.com
OpenAI
- High quality responses
- Models: gpt-4, gpt-3.5-turbo, gpt-4-turbo
- Setup: Get API key from platform.openai.com
Anthropic
- Claude models
- Models: claude-3-sonnet, claude-3-haiku
- Setup: Get API key from console.anthropic.com
🔍 Command Reference
Core Commands
ai ask <question>- Ask any question to the AIai explain <code/command>- Explain code or commandsai generate <type> [name]- Generate code templatesai translate <code> --to <language>- Translate code between languagesai debug [error]- Debug errors and analyze logsai interactive- Start interactive copilot mode
Git Commands
ai git commit- Generate commit messagesai git diff- Analyze git differencesai git log --summary- Summarize git history
Analysis Commands
ai summarize <file/directory>- Summarize code filesai doc <library/function>- Get documentationai regex <description>- Generate regex patterns
Automation Commands
ai script <description>- Generate automation scriptsai config- Manage configuration
🚀 Advanced Usage
Custom System Prompts
# Use custom system prompt
ai ask "Explain this code" --system "You are a senior developer mentor"
# In interactive mode
ai interactive --system "You are a Python expert focused on best practices"Output Formats
# JSON output
ai ask "What is React?" --output json
# Markdown output
ai explain "docker run" --output markdownProject-Aware Assistance
The CLI automatically detects your project type and provides contextual help:
- Node.js projects: Suggests npm/yarn commands, React patterns
- Python projects: Recommends pip/poetry, Django/Flask patterns
- Java projects: Maven/Gradle assistance, Spring Boot patterns
- And more: Rust, Go, PHP, Ruby, etc.
🛠️ Development
Building from Source
# Clone the repository
git clone <repository-url>
cd ai-cli
# Install dependencies
npm install
# Build the project
npm run build
# Run in development mode
npm run dev
# Run tests
npm testContributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
📝 License
MIT License - see LICENSE file for details.
🤝 Support
- Issues: Report bugs and request features on GitHub
- Documentation: Check the wiki for detailed guides
- Community: Join our Discord for discussions
🎉 What's Next?
The AI CLI is designed to be extensible and continuously improved. Upcoming features include:
- Plugin system for custom commands
- Team collaboration features
- Integration with popular IDEs
- Advanced project templates
- Multi-language support for UI
Happy coding with AI! 🚀
