cli-copilot v0.0.8
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-here
Features
- 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-copilot
Usage
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 index
Index 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