CLI Code Docs

Installation

Detailed Installation Guide for CLI Code

Video Guide

PS: Will add later

Step-by-Step Guide

This comprehensive guide will walk you through the complete installation and setup process for CLI Code. Follow each step carefully to ensure a smooth setup experience.

Prerequisites

Before you begin, make sure you have the following installed on your system:

  • Node.js (version 16 or higher)
  • npm (comes with Node.js)
  • Git (for version control)
  • VS Code or Cursor (recommended editors)

You can check your installations by running:

node --version
npm --version
git --version

Step 1: Login to Website

  1. Open your web browser and navigate to clicode.vercel.app
  2. Click the "Sign In" button in the top-right corner
  3. Choose GitHub as your authentication method
  4. Authorize CLI Code to access your GitHub account
  5. Complete the sign-in process

Note: CLI Code uses GitHub OAuth for secure authentication. Your GitHub credentials are never stored or accessed by CLI Code.

Step 2: Generate Refresh Token

  1. After successful login, navigate to the Dashboard Page
  2. Look for the "Refresh Token" section
  3. Click the "Generate New Token" button
  4. Copy the generated token immediately - it will only be shown once!
  5. Store the token securely (you'll need it for CLI configuration)

Security Tip: Treat your refresh token like a password. Don't share it publicly or commit it to version control.

Step 3: Install CLI Code

Open your terminal and run the following command:

npm i cli-code

This will:

  • Download and install CLI Code globally on your system
  • Make the cli-code command available from anywhere in your terminal
  • Install all necessary dependencies
  • Create a config file in ~/.config/cli-code/config.json
  • It will also install the VS Code Context Bridge Extension on your VS Code.
  • You have to manually install the extension in your Cursor. follow this guide

Alternative Installation Methods:

  • Using yarn: yarn global add cli-code
  • Using pnpm: pnpm add -g cli-code

Step 4: Configure CLI Code

Run the configuration command:

cli-code

This will start an interactive setup process on first run. Follow the prompts:

  1. Enter Refresh Token: Paste the token you copied from the dashboard

  2. Select AI Provider: Choose from available options:

    • OpenAI (GPT-4, GPT-3.5-turbo)
    • Anthropic (Claude-3, Claude-2)
    • Google (Gemini Pro, Gemini Flash)
    • OpenRouter (access to multiple models)
    • Custom (for other compatible APIs)
  3. Get API Key: Visit your chosen provider's website:

  4. Enter API Key: Paste your provider's API key when prompted

  5. Select Model: Choose from available models for your provider

Configuration File Location: Your settings are stored in ~/.cli-code/config.json (Linux/Mac) or %APPDATA%\cli-code\config.json (Windows)

Step 5: Open Codebase in Editor

  1. Launch VS Code (or Cursor) and wait for it to fully initialize

  2. Open your project folder:

    • Use File > Open Folder or Ctrl/Cmd + K, Ctrl/Cmd + O
    • Navigate to your project directory
    • Select the folder and click "Open"
  3. Verify Editor Integration:

    • Ensure VS Code/Cursor is properly loaded with your project
    • Check that your file explorer shows your project structure
    • Open a code file to confirm everything is working

Step 6: Start Using CLI Code

  1. Open Terminal in your editor:

    • VS Code: `Ctrl/Cmd + `` (backtick)
    • Or use Terminal > New Terminal from the menu
  2. Navigate to your project directory (if not already there):

    cd /path/to/your/project
  3. Launch CLI Code:

    cli-code
  4. Begin coding with AI assistance:

    • CLI Code will detect your current file and context
    • Ask questions about your code
    • Request code generation or modifications
    • Get explanations for complex functions

Step 7: Verify Installation

Test that everything is working correctly:

  1. Check CLI Code version:

    cli-code --version
  2. Test basic functionality:

    cli-code --help

Troubleshooting

Common Issues and Solutions

Issue: "Command not found: cli-code"

  • Solution: Ensure Node.js and npm are properly installed, then reinstall CLI Code

Issue: "Invalid refresh token"

  • Solution: Generate a new token from the dashboard and reconfigure

Issue: "API key error"

  • Solution: Verify your API key is correct and has sufficient credits/quota

Issue: "Editor integration not working"

  • Solution: Ensure VS Code/Cursor is fully loaded and you're in the correct project directory

Getting Help

If you encounter any issues:

  1. Check the CLI Code documentation
  2. Visit the GitHub repository for issues
  3. Contact support through the website

Next Steps

Now that CLI Code is installed and configured, you can:

  • Explore the documentation to learn advanced features
  • Try different AI models to find the best fit for your workflow
  • Set up custom prompts for your specific use cases
  • Integrate with your existing tools and workflows
  • Join the community to share tips and get help

🚀 Congratulations! You're now ready to supercharge your coding workflow with AI assistance directly in your terminal.