Google Antigravity
Install secrets-detection hooks, the SonarQube MCP Server, and Vortex analysis for Google Antigravity with the SonarQube CLI.
sonar integrate antigravity configures the SonarQube CLI to work alongside Google Antigravity. In an interactive terminal, the command shows these recommended components, then asks you to install them or customize the selection (see Install confirmation):
A secrets-detection hook: a
PreToolUsehandler onview_filethat scans files for secrets before Antigravity reads them.Prompt-secrets rules that tell the agent to refuse working with exposed tokens: a managed snippet in
~/.gemini/GEMINI.md.The SonarQube MCP Server in your user-level Antigravity MCP configuration, letting Antigravity fetch projects, issues, and rules directly.
Vortex (when your connection has a Vortex subscription: SonarQube Cloud Team (annual) or Enterprise plan, or SonarQube Server 2026.5 or newer Enterprise and Data Center editions): installs Vortex analysis as a managed snippet in
~/.gemini/GEMINI.md. The snippet tells Antigravity to runsonar analyze agenticon files you modified before ending the turn. Antigravity has no session-start hook; therefore, the CLI integration installs Vortex analysis only. To use Vortex context with Antigravity, set up a self-hosted MCP server.
Pass --non-interactive to accept every offered component without prompts (see Non-interactive install).
Prerequisites
Google Antigravity is installed.
Install
Install once for this machine:
sonar integrate antigravityThe command writes hooks under ~/.gemini/config/ and prompt-secrets plus Vortex analysis snippets in ~/.gemini/GEMINI.md. See Project versus global scope.
What the command does
The integrator runs in two phases:
Validation. It checks that your saved token can reach SonarQube. On SonarQube Cloud, your connection must include an organization. An invalid token stops setup and tells you to run
sonar auth login. An unreachable server stops setup and asks you to check the server URL and your network connection.Installation. The CLI shows a What will be installed summary of the recommended components (secrets hook, prompt-secrets rules, MCP server, and Vortex when eligible). In an interactive terminal, choose Install recommended to write that set, or Customize to accept or decline each component and then press Enter. Components that are not available are skipped with an explanation. In non-interactive mode, every eligible component is installed without prompts. The CLI then writes the accepted components under
~/.gemini/.Common skip reasons include:
Your connection does not have a Vortex subscription (only available with SonarQube Cloud Team (annual) or Enterprise plan, or SonarQube Server 2026.5 or newer Enterprise and Data Center editions).
Options
--non-interactive
Non-interactive mode (no prompts).
--global, -g
Deprecated since 1.9.0. The install is already global; using the flag prints a warning and does not change the installation scope.
Where files are installed
Antigravity uses user-level files under ~/.gemini/. The MCP server entry is always written to the user-level MCP configuration file, because Antigravity supports only one MCP config location.
User home
~/.gemini/config/ (hooks, MCP config); prompt-secrets and Vortex analysis snippets in ~/.gemini/GEMINI.md
Shared binaries
~/.sonar/sonarqube-cli/bin/
State for installed integrations is recorded in ~/.sonar/sonarqube-cli/state.json. See State and storage.
Restart Antigravity
Antigravity reads hooks, rules, and MCP configuration at startup. Restart Antigravity for the integration to take effect.
Vortex analysis
When you run sonar integrate antigravity, the command writes Vortex analysis instructions that tell Antigravity to run sonar analyze agentic --depth DEEP on every file it modified that turn in a single command (repeat --file for each path, or fall back to the git change set). The instructions go in ~/.gemini/GEMINI.md as a managed snippet, because Antigravity has no global rules directory. The instructions omit --project because each file is analyzed against the project that owns it. In a repository with several projects, they tell Antigravity to run that command from a directory that contains every file changed in the turn, usually the repository root. Re-run sonar integrate antigravity so an existing snippet picks up that paragraph. If analysis reports that no project is configured, the instructions tell the agent to stay silent for the rest of the session instead of repeating a skip notice. See Files and the project root. Antigravity's hook model does not support injecting analysis findings back into the conversation the way Claude Code and Codex hooks do, which is why the CLI uses the same rules-based pattern as GitHub Copilot CLI and Cursor.
Antigravity has no session-start hook; therefore, the CLI integration installs Vortex analysis only. To use Vortex context with Antigravity, set up a self-hosted MCP server. If an earlier CLI version wrote .agents/skills/sonar-context-augmentation/SKILL.md, update to SonarQube CLI 1.8.0 or newer, then re-run sonar integrate antigravity to remove that leftover file.
For an overview of Vortex analysis, see Vortex analysis.
Verify it works
Test the secrets hook
Create a file in your project with a fake-looking but secret-shaped value:
Ask Antigravity to read it: "Read secrets.js."
Antigravity should block the read and explain that the file contains a secret.
Once you've confirmed the hook is active, delete the test file.
Run sonar system status to confirm the Antigravity integration reports Secrets Hook: CONFIGURED. If the hook entry exists but the backing script is missing or malformed, status shows CONFIGURED / INVALID CONFIG and recommends re-running sonar integrate antigravity. See Check system status.
Test the MCP server
Ask Antigravity to list your SonarQube projects via the MCP server. If the call fails, run sonar auth status to confirm the underlying token is healthy and restart Antigravity.
Test Vortex analysis
Make a code change through Antigravity (for example, ask it to edit a file). Before ending the turn, Antigravity should run Vortex analysis on the modified files per the installed rules. This requires a Sonar Vortex subscription.
Non-interactive install
For provisioning scripts, dotfiles, and onboarding automation:
In non-interactive mode, the CLI does not prompt for feature selection, install confirmation, token repair, or feature removal. Every component that is not explicitly skipped is installed automatically. When you authenticate with environment variables, integrate commands also run in non-interactive mode even without the flag. Run sonar auth status afterward to confirm everything is configured correctly.
Uninstall
Run sonar integrate antigravity again in an interactive terminal and choose Customize. For each installed feature, the CLI asks Keep?: answer No, confirm Proceed with removal?, and the CLI removes hooks, rules, and state for that feature. Vortex is removed as one unit (Vortex analysis rules). See integrations/README.md for the full flow.
For a manual cleanup or non-interactive environments:
Delete the SonarQube hook files and rules written under your Antigravity configuration directories.
Remove the SonarQube MCP Server entry from your Antigravity configuration.
Remove the integration entry from
~/.sonar/sonarqube-cli/state.json(underintegrations.installed).
See Uninstalling for the full removal procedure.
Migrate from Gemini CLI
Antigravity replaces Gemini CLI. If you previously used the SonarQube Gemini extension, migrate your platform configuration first, then run:
agy plugin import gemini scans your existing Gemini directories and migrates the SonarQube MCP entry into mcp_config.json. After verifying Antigravity works, remove any duplicate legacy extension install if the import created a copy.
For a fresh install on a machine that never had Gemini, use the steps in Install above.
Related pages
Last updated
Was this helpful?

