@jonathan0823/pi-sonarqube

SonarQube extension for Pi — run local analysis and browse issues.

Packages

Package details

extension

Install @jonathan0823/pi-sonarqube from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@jonathan0823/pi-sonarqube
Package
@jonathan0823/pi-sonarqube
Version
0.1.3
Published
Jun 19, 2026
Downloads
not available
Author
jonathan0823
License
MIT
Types
extension
Size
162.9 KB
Dependencies
4 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./dist/index.js"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-sonarqube

A Pi extension to run local SonarQube analysis and browse the resulting issues — all from within Pi.

Requirements

  • Pi installed
  • A running SonarQube server (e.g. http://localhost:9000)
  • sonar-scanner available in $PATH

Install

pi install npm:@jonathan0823/pi-sonarqube

Or add it to your settings.json:

{
  "packages": ["npm:@jonathan0823/pi-sonarqube"]
}

Then /reload in Pi.

Quick start

1. Init project config

Inside a project directory, run:

/sonarqube init

For monorepos, you can point at a path directly:

/sonarqube init apps/web
/sonarqube init apps/api

Pi will ask you for:

  • SonarQube server URL (prefilled with http://localhost:9000)
  • Project key (default: derived from directory name)
  • Token (optional, used when your server requires auth)

The config is saved to <project>/.pi/sonarqube.json.

2. Run analysis

/sonarqube analyze
/sonarqube analyze apps/web
/sonarqube analyze apps/api

Pi will:

  1. Run sonar-scanner against your server
  2. Wait for the analysis to complete
  3. Fetch the latest issues
  4. Return a concise summary

3. Browse issues

/sonarqube issues
/sonarqube issues apps/web

Use Up/Down to move, Enter to preview the affected source code, and Esc to close.

Tip: Tab-complete /sonarqube subcommands and filters in the editor.

4. Open a specific issue

/sonarqube open 3
/sonarqube open apps/web 3

Commands

Command Description
/sonarqube init [path] Set up project config for a path
/sonarqube analyze [target] Run analysis for a target or path
/sonarqube issues [target] Browse the latest analysis results for a target
/sonarqube open [target] <n> Preview source at issue #n

Tool (for the LLM)

The extension also registers a sonarqube tool that the LLM can call with actions:

  • analyze — run analysis
  • issues — list issues
  • open — open an issue with its index

The tool accepts optional issue filters (severities, statuses, types, rules) so the agent can fetch just blocker/critical context.

Use paths directly.

Configuration sources (precedence order)

  1. Environment variables (highest)
    • SONARQUBE_URL / SONAR_HOST_URL
    • SONARQUBE_TOKEN / SONAR_TOKEN
    • SONAR_PROJECT_KEY
  2. Project config.pi/sonarqube.json (set via /sonarqube init)
  3. Scan propertiessonar-project.properties
  4. Defaultshttp://localhost:9000, project key from directory slug

Project structure

packages/pi-sonarqube/
├── src/
│   └── index.ts          # Extension source + init command + config
├── dist/
│   ├── index.js          # Compiled output
│   ├── index.d.ts        # Type declarations
│   └── index.js.map      # Source map
├── fixtures/
│   ├── issue-project/    # Test project with known issues
│   └── clean-project/    # Test project with no issues
├── README.md
├── LICENSE
├── package.json
└── tsconfig.json

Contributing

See CONTRIBUTING.md.

License

MIT