Overseas access: www.kdjingpai.com
Bookmark Us

Crush is an AI programming assistant that runs in the terminal, developed by the Charmbracelet team. It helps developers efficiently code, debug, and project manage in the terminal by integrating the Large Language Model (LLM). Crush supports multiple models, allowing users to switch flexibly, Language Server Protocol (LSP) for code context, and Model Context Protocol (MCP) extensions. Compatible with a wide range of operating systems, including macOS, Linux, and Windows, for developers who prefer a terminal, Crush has a clean design that focuses on usability and performance, and is designed to make coding more efficient.

 

Function List

  • Support for multiple Large Language Models (LLMs) such as OpenAI, Anthropic, or native models (e.g., Ollama), with the ability to switch models midway.
  • Integration of Language Server Protocol (LSP), providing code completion, syntax checking and other functions.
  • Support for the Model Context Protocol (MCP) to extend functionality via HTTP, stdio, or SSE.
  • Provides multi-session management, allowing switching between projects and retaining context.
  • Supports running on all platforms, including macOS, Linux, Windows (PowerShell and WSL), FreeBSD, and more.
  • Provides flexible configuration files that support project-level or global configuration.
  • A list of community-supported models (Catwalk) to make it easy for users to add or update models.
  • Provide code generation and debugging features to optimize end-to-end workflow.

Using Help

Installation process

Crush supports multiple installation methods for different operating systems and package managers. Below are the detailed installation steps:

Installation via Homebrew (macOS/Linux)

  1. Open a terminal and run the following command:
    brew install charmbracelet/tap/crush
    
  2. Wait for the installation to complete and enter crush --version Verify that the installation was successful.

Installation via NPM (cross-platform)

  1. Make sure Node.js is installed.
  2. Runs in the terminal:
    npm install -g @charmland/crush
    
  3. Check the version:crush --versionThe

Installation via Arch Linux

  1. Use the Yay Package Manager:
    yay -S crush-bin
    
  2. Verify the installation:crush --versionThe

Installation via Nix

  1. Run the following command:
    nix run github:numtide/nix-ai-tools#crush
    
  2. or installed via NUR:
    nix-channel --add https://github.com/nix-community/NUR/archive/main.tar.gz nur
    nix-channel --update
    nix-shell -p '(import <nur> { pkgs = import <nixpkgs> {}; }).repos.charmbracelet.crush'
    

Installation via Debian/Ubuntu

  1. Add the Charm software source:
    sudo mkdir -p /etc/apt/keyrings
    curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
    echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
    
  2. Update and install:
    sudo apt update && sudo apt install crush
    

Installation via Fedora/RHEL

  1. Add the Yum repository:
    echo '[charm] name=Charm baseurl=https://repo.charm.sh/yum/ enabled=1 gpgcheck=1 gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo
    
  2. Install Crush:
    sudo yum install crush
    

Verify Installation

After the installation is complete, run crush --version Check the version information. If the version number is displayed, the installation was successful.

Configuring API Keys

Crush needs to be configured with an API key for the large language model to work properly. Below are the configuration steps:

  1. Get the API key:
    • Supported model providers include OpenAI, Anthropic, Groq, or OpenRouter.
    • Visit the provider's official website to register and get an API key.
  2. Configure the key:
    • Run the crush config Enter configuration mode.
    • Enter the API key and save when prompted.
  3. Local model support:
    • If you are using a local model (e.g. Ollama), you need to configure the OpenAPI compatibility interface. For example:
      {
      "$schema": "https://charm.land/crush.json",
      "providers": {
      "ollama": {
      "type": "openai",
      "base_url": "http://127.0.0.1:11434/v1",
      "api_key": "ollama",
      "models": [
      {
      "id": "devstral",
      "name": "devstral",
      "context_window": 131072
      }
      ]
      }
      }
      }
      
    • Save the configuration file to the project directory or ~/.crush/config.jsonThe

Key Features of Using Crush

code generation

  1. In the terminal, type crush code, and then describes the needs, such as:
    crush code "编写一个 Python 函数,计算斐波那契数列"
    
  2. Crush calls the configured LLM, generates the code and displays it.
  3. If the code does not wrap the code block correctly, the CRUSH.md file to add rules:
    ```python
    # 代码示例
    
    
    

code debugging

  1. importation crush debug, paste the problematic code.
  2. Crush analyzes the code and suggests fixes.
  3. Enhanced debugging with LSP:
    • Configure an LSP server, such as Go's gopls::
      {
      "$schema": "https://charm.land/crush.json",
      "lsp": {
      "go": { "command": "gopls" },
      "typescript": { "command": "typescript-language-server", "args": ["--stdio"] }
      }
      }
      
    • Crush utilizes LSPs to provide syntax checking and complementary suggestions.

Session Management

  1. Create a new session:crush session new <项目名>The
  2. Switching Sessions:crush session switch <项目名>The
  3. View the list of sessions:crush session listThe
  4. Sessions retain context to ensure that workflows from different projects do not conflict.

Extended functionality (MCP)

  1. Configure the MCP server:
    {
    "mcp": {
    "transport": "http",
    "endpoint": "http://example.com/mcp"
    }
    }
    
  2. Crush extends functionality by accessing external tools or services through the MCP.

Validating Release Files

Crush provides signature verification to ensure that downloaded files are secure:

  1. Download the release and signature files (e.g. checksums.txt,checksums.txt.sig).
  2. Run the verify command:
    cosign verify-blob \
    --certificate-identity 'https://github.com/charmbracelet/meta/.github/workflows/goreleaser.yml@refs/heads/main' \
    --certificate-oidc-issuer 'https://token.actions.githubusercontent.com' \
    --cert 'https://github.com/charmbracelet/crush/releases/download/v0.1.11/checksums.txt.pem' \
    --signature 'https://github.com/charmbracelet/crush/releases/download/v0.1.11/checksums.txt.sig' \
    ./checksums.txt
    
  3. The output shows "Verified OK" indicating that the file is safe.

application scenario

  1. Efficient encoding of terminals
    • As developers write code in the terminal, Crush quickly generates code snippets, offers debugging suggestions, and reduces time spent switching to a browser or IDE.
  2. cross-project management
    • For developers managing multiple projects, Crush's session management feature allows you to save the context of different projects and quickly switch between work environments.
  3. Local Model Development
    • Developers using a local model such as Ollama can use Crush to generate and debug code in a network-less environment.
  4. Teamwork
    • Teams can unify their development environment and collaborate more efficiently by sharing configuration files and Catwalk model libraries.

QA

  1. Which operating systems does Crush support?
    • Crush supports macOS, Linux, Windows (including PowerShell and WSL), FreeBSD, OpenBSD and NetBSD.
  2. How do I switch between different LLMs?
    • Running in a session crush model switch <模型名>, or specify the model in a configuration file.
  3. Does Crush support offline use?
    • With local models (such as Ollama) and local configurations, Crush can run completely offline.
  4. How to solve the code block rendering problem?
    • exist CRUSH.md file to add code block rules, or check the LLM output format settings.
0Bookmarked
0kudos

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

Top

en_USEnglish