Integrating Code Assistant with Zed using the SourceCraft CLI

Zed is a fast cross-platform open-source editor written in Rust and designed for collaborative development with integrated AI agents.

To integrate Code Assistant with Zed, you need to use the SourceCraft CLI over ACP (Agent Client Protocol).

To use Code Assistant in Zed:

  1. Install and configure the SourceCraft CLI.

    Warning

    Make sure to confirm the OpenCode installation.

  2. Install Zed.

  3. Connect the SourceCraft CLI to Zed as an external custom AI agent:

    1. Open Zed settings by pressing Ctrl + , for Windows/Linux or Command + , for macOS.
    2. Go to AIGeneralExternal AgentsConfigure >.
    3. Click Add Agent and select Add Custom Agent.
    4. Fill out the fields as follows:
      • Agent Name: Agent name, e.g., SourceCraft Code Assistant.

      • Command: Path to the SourceCraft CLI executable, such as the following:

        • In Linux: /home/<username>/sourcecraft/bin/src
        • In macOS: /Users/<username>/sourcecraft/bin/src
        • In Windows: C:\Users\<username>\AppData\Local\Programs\src\src.exe
      • Arguments: Settings for running OpenCode from the SourceCraft CLI in ACP mode: code -- acp.

      • Environment Variables: Leave empty.

    5. Click Save and close the settings window.
    1. Open the settings.json Zed configuration file by pressing Ctrl + Alt + , for Windows or Linux or Command + Option + , for macOS.

    2. Add the agent_servers section:

      {
        "agent_servers": {
          "SourceCraftCA": {
            "type": "custom",
            "command": "<path_to_SourceCraft_CLI_executable>",
            "args": [
              "code",
              "--",
              "acp"
            ],
            "default_config_options": {
              "mode": "plan"
            }
          }
        }
      }
      

      Where command is the path to the SourceCraft CLI executable, such as the following:

      • In Linux: /home/<username>/sourcecraft/bin/src
      • In macOS: /Users/<username>/sourcecraft/bin/src
      • In Windows: C:\Users\<username>\AppData\Local\Programs\src\src.exe
    3. Save your changes.

  4. Open the agent panel by pressing Ctrl + Alt + B for Windows or Linux or Command + B for macOS, click on top of the panel, and select the external SourceCraft Code Assistant agent.

  5. Test the agent by typing a prompt in the chat window.

Useful links