SourceCraft Code Assistant agent mode in the JetBrains IDE

Warning

The agent mode in the JetBrains IDE is at the Preview stage and available for testing.

In the JetBrains IDE, the Code Assistant agent mode is based on the SourceCraft CLI with an integrated OpenCode AI agent. The agent runs in the IDE terminal, enhanced with editor capabilities.

IDE integration unlocks the following features:

  • Displaying diff when editing files with an option to apply or discard changes.
  • Getting diagnostics from files, such as errors, warnings, etc.
  • Access to the active file and list of opened files.
  • Opening and closing tabs.

Note

The AI assistant chat feature is unaffected and remains available by clicking SourceCraft Code Assistant Chat in the editor’s right-hand panel.

To use the agent mode:

  1. Install the SourceCraft Code Assistant plugin for the JetBrains IDE and get authenticated in SourceCraft.

  2. If you have already installed the plugin, update to its latest version.

  3. In the editor’s top panel, click SourceCraft Code Assistant Agent [Beta].

    image

    Alternatively, you can enable the agent mode from the top panel of the chat by clicking Open Agent.

    This opens a tool window and automatically starts the SourceCraft CLI installation.

    Tip

    If the automatic installation fails for any reason, close the IDE and install the SourceCraft CLI manually via the terminal. When prompted, confirm the OpenCode installation.

    Once the installation is complete, the agent will start in the tool window.

    image

  4. One by one, submit natural-language requests to the AI agent.

    To restart the agent, click Restart in the top panel of the tool window.

For more information about working with the SourceCraft CLI and OpenCode, see these guides:

Working with file changes

When editing a file, the agent displays a diff view highlighting the proposed changes. Here is what you can do:

  • Reject: Discard the changes.
  • Apply: Accept the changes.
  • Auto Apply: Automatically apply all changes within the current session.

image

Tip

To automatically apply changes suggested by the agent, click Auto-apply in the top panel of the tool window.

image

You can also enable auto-approval in the editor settings. In the top-right corner, click Settings...SourceCraft Code AssistantAuto-apply code agent edits.

Useful links