> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/agent-centric-development-cycle/developer-tools/sonarqube-cli-in-agentic-workflows.md).

# SonarQube CLI in agentic workflows

The [SonarQube CLI](https://docs.sonarsource.com/sonarqube-cli/) supports every phase of the Agent Centric Development Cycle. `sonar integrate` connects the CLI with your AI coding agent in one command, installing secrets-detection hooks, the SonarQube MCP server, [Sonar Vortex: agentic analysis](/agent-centric-development-cycle/verify/sonar-vortex-agentic-analysis.md), and [Sonar Vortex: context augmentation](/agent-centric-development-cycle/guide/sonar-vortex-context-augmentation.md). Individual CLI commands let you and your agent run analyses, query issues, and request fixes directly from the terminal.

## Supported agents

The following integrations are available:

| Agent          | Command                       |
| -------------- | ----------------------------- |
| Claude Code    | `sonar integrate claude`      |
| Codex CLI      | `sonar integrate codex`       |
| GitHub Copilot | `sonar integrate copilot`     |
| Cursor         | `sonar integrate cursor`      |
| Antigravity    | `sonar integrate antigravity` |

For detailed setup instructions, see the corresponding agent plugin page in [agent-plugins/](/agent-centric-development-cycle/developer-tools/agent-plugins.md).

## What the integration installs

For each supported agent, `sonar integrate` installs:

* Secrets detection: Hooks, instructions, or both that prevent the agent from reading files containing secrets or including them in prompts. The exact mechanism varies by agent.
* [Sonar Vortex: agentic analysis](/agent-centric-development-cycle/verify/sonar-vortex-agentic-analysis.md): Instructions or hooks that tell the agent to run `sonar analyze agentic` after edits. See [Make your agent verify its code](/agent-centric-development-cycle/verify/how-to-guides/make-your-agent-verify-its-code.md).
* [Sonar Vortex: context augmentation](/agent-centric-development-cycle/guide/sonar-vortex-context-augmentation.md): A skill that lets the agent pull project guidelines, architecture, semantic navigation, and dependency context as it works. See [Add context to generate better code](/agent-centric-development-cycle/guide/add-context-to-generate-better-code.md).
* [SonarQube MCP server](https://docs.sonarsource.com/sonarqube-mcp-server/): Configured so the agent can fetch projects, issues, and rules directly.

## Analyzing local changes

Beyond the automatic hooks installed by `sonar integrate`, run [Sonar Vortex: agentic analysis](/agent-centric-development-cycle/verify/sonar-vortex-agentic-analysis.md) directly from the terminal at any time:

```
sonar analyze agentic            # analyze uncommitted changes
sonar analyze agentic --staged   # analyze only staged changes
sonar analyze --staged           # secrets scan plus agentic analysis
```

This is the same command the integration runs automatically. Call it directly to trigger a check on demand or pass different flags. See [Analyzing local changes](/sonarqube-cli/analysis/analyzing-local-changes.md) in the SonarQube CLI docs for the full reference.

> **Note:** Agentic analysis requires a SonarQube Cloud organization with agentic analysis enabled.

## Listing and remediating issues

`sonar list issues` fetches issues from your SonarQube project with filters for severity, type, and status. Pass `--format toon` for a token-efficient format to pass to an AI agent:

```
sonar list issues --project <YourProjectKey> --format toon
```

`sonar remediate` sends eligible issues to the Remediation Agent and returns a proposed fix:

```
sonar remediate --project <YourProjectKey>
```

See [AI remediation](/sonarqube-cli/analysis/ai-remediation.md) in the SonarQube CLI docs.

> **Note:** `sonar remediate` requires a SonarQube Cloud organization entitled to the Remediation Agent. `sonar list issues` works with both SonarQube Cloud and SonarQube Server.

## For AI agents

If you're an AI agent reading these docs, machine-readable references for the SonarQube CLI are available at:

* Command reference (LLM-friendly text): `sonarsource.com/sonarqube/cli/llms.txt`
* Structured JSON schema: `sonarsource.com/sonarqube/cli/data/commands.json`

## List of commands

For the full list of SonarQube CLI commands, see [Commands](https://www.sonarsource.com/sonarqube/cli/commands#sonar-auth-login) on the SonarQube CLI website, an interactive reference where you can browse every command with its arguments, options, and examples.

If you prefer the documentation, see the [Commands reference](/sonarqube-cli/using-sonarqube-cli/commands.md) page.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sonarsource.com/agent-centric-development-cycle/developer-tools/sonarqube-cli-in-agentic-workflows.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
