cli-copilot
v0.0.8
Published
AI-powered coding assistant for the terminal.
Downloads
18
Maintainers
Readme
CLI Copilot
CLI Copilot is an AI-powered command-line assistant designed to enhance your development workflow. It provides features like AI-powered chat, workspace insights, and file debugging directly from your terminal.
Prerequisites
Before using CLI Copilot, ensure that you have stored your OpenAI API key in a .env file with the following variable name:
OPENAI_API_KEY=your-api-key-hereFeatures
- AI Chat: Engage in interactive AI-powered conversations.
- Workspace Indexing: Index your project files for AI-powered insights.
- Workspace Queries: Ask questions about your indexed workspace.
- AI Debugging: Analyze and debug specific JavaScript files.
Installation
Install CLI Copilot globally via npm:
npm install -g cli-copilotUsage
CLI Copilot provides various commands to assist developers. Below is the detailed documentation of each command.
1️⃣ Start AI Chat
Use this command to start an AI-powered coding chat in the terminal:
cli-copilot chat💡 Example:
> cli-copilot chat
🔹 AI Chat Mode Activated. Type 'exit' to quit.
> How do I create an async function in JavaScript?
💡 AI Response:
┌───────────────────────────────────────────────────┐
│ You can create an async function using the `async`│
│ keyword before the function definition. Example: │
│ async function fetchData() { │
│ const response = await fetch('https://api...');│
│ return await response.json(); │
│ } │
└───────────────────────────────────────────────────┘2️⃣ Index Workspace
Index your entire project or a specific file for workspace-based AI queries.
Index the entire workspace
cli-copilot indexIndex a specific file
cli-copilot index src/app.js💡 Example Output:
📂 Indexing workspace...
✅ Workspace indexed successfully!📌 Note: Indexing generates a .workspace_index.json file, used for workspace queries.
3️⃣ Query Workspace
Ask questions about your indexed workspace.
cli-copilot workspace "How does authentication work?"💡 Example Output:
🔍 Fetching AI-powered insights from workspace...
💡 AI Response:
┌───────────────────────────────────────────────────┐
│ Your authentication system is implemented in │
│ `auth.js`. It verifies JWT tokens and manages │
│ user sessions using Express middleware. │
└───────────────────────────────────────────────────┘📌 Note: This command requires the workspace to be indexed first.
4️⃣ Debug a File
Debug a specific JavaScript file using AI analysis.
cli-copilot debug src/utils.js💡 Example Output:
🐞 Debugging file: src/utils.js...
🤖 Analyzing file for potential issues...
💡 Debugging Report:
┌───────────────────────────────────────────────────┐
│ ❌ Error in line 23: `user` is undefined. │
│ 🛠️ Fix: Ensure `user` is defined before accessing│
│ `user.name`. Consider adding a null check. │
└───────────────────────────────────────────────────┘📌 Note: Debugging does NOT require workspace indexing.
Summary of Commands
| Command | Description |
|---------|-------------|
| cli-copilot chat | Start an AI-powered coding chat. |
| cli-copilot index | Index the entire workspace for AI analysis. |
| cli-copilot index <filepath> | Index a specific file for AI analysis. |
| cli-copilot workspace "<query>" | Query AI about the indexed workspace. |
| cli-copilot debug <filepath> | Debug a specific file. |
Future Enhancements
- ✅ AI-powered code refactoring suggestions.
- ✅ Enhanced debugging with suggested fixes.
License
This project is licensed under the MIT License.
🚀 Start coding smarter with CLI Copilot!
Demo Video : https://youtu.be/MaYEdmUtNRU
