context-cli
v0.1.3
Published
Ambient intelligence layer for your terminal - adds context-aware suggestions to any command
Maintainers
Readme
Context CLI - Ambient Intelligence for Your Terminal
Context CLI adds an intelligent layer to your terminal that learns from your command patterns and provides real-time suggestions to prevent errors and improve productivity.
📖 Complete Usage Guide & Productivity Hacks - Comprehensive guide with real-world examples
Features
- 🧠 Smart Suggestions: Warns you before running commands in the wrong context
- 🔍 Pattern Detection: Learns from your command history to identify workflows
- ⚡ Real-time Analysis: Instant feedback before command execution
- 🛡️ Safety First: Prevents dangerous commands and common mistakes
- 📊 Usage Analytics: Track your command patterns and improve workflows
Installation
npm install -g context-cli
# Install shell hooks (required)
context install --shell zsh # or bash, fishHow It Works
Context CLI integrates with your shell to:
- Analyze commands before execution
- Detect patterns in your workflow
- Provide suggestions based on context
- Learn from your command history
Example Scenarios
# Detects missing npm install
$ npm test
⚠️ package.json has changed since last npm install
Suggested: npm install
# Warns about wrong branch
$ npm run deploy
⚠️ You're on branch 'feature' but usually run this on 'main'
# Prevents disasters
$ rm -rf /
❌ This will delete your root directory!Commands
context install- Install shell hookscontext stats- View usage statisticscontext config- Configure settings and AIcontext-on- Enable context (in shell)context-off- Disable context (in shell)
AI Integration (New!)
Context CLI now supports AI-powered suggestions using OpenAI's API:
# Set your OpenAI API key
context config --set-openai-key YOUR_API_KEY
# Enable AI suggestions
context config --enable-ai
# Optional: Choose a specific model (default: gpt-4-turbo-preview)
context config --set-model gpt-4o
# View configuration
context config --showWith AI enabled, you get:
- 🧠 Smarter pattern detection across your workflow
- 🔮 Predictive suggestions based on context
- 🎯 More accurate error prevention
- 📚 Learning from your specific development style
Privacy
All data is stored locally in ~/.context-cli/. No data is sent to external servers.
Development
# Clone and install
git clone <repo>
cd context-cli
npm install
# Build
npm run build
# Watch mode
npm run devArchitecture
- Pattern Detection: Sliding window analysis of command sequences
- Context Building: Git branch, directory, file changes, environment
- Storage: SQLite database for command history and patterns
- Shell Integration: Hooks for bash, zsh, and fish
License
MIT
