0.0.8 β€’ Published 5 months ago

cli-copilot v0.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

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

CommandDescription
cli-copilot chatStart an AI-powered coding chat.
cli-copilot indexIndex 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

0.0.8

5 months ago

0.0.7

5 months ago

0.0.6

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago