@jonathan0823/pi-sonarqube
SonarQube extension for Pi — run local analysis and browse issues.
Package details
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.2- Published
- Jun 19, 2026
- Downloads
- not available
- Author
- jonathan0823
- License
- MIT
- Types
- extension
- Size
- 120.5 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-scanneravailable 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 add a user-defined alias and optional path:
/sonarqube init fe apps/web
/sonarqube init be 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. Alias mappings live in the repo root .pi/sonarqube.workspaces.json.
2. Run analysis
/sonarqube analyze
/sonarqube analyze fe
/sonarqube analyze apps/web
Pi will:
- Run
sonar-scanneragainst your server - Wait for the analysis to complete
- Fetch the latest issues
- Return a concise summary
3. Browse issues
/sonarqube issues
/sonarqube issues fe
Use Up/Down to move, Enter to preview the affected source code, and Esc to close.
4. Open a specific issue
/sonarqube open 3
/sonarqube open fe 3
Commands
| Command | Description |
|---|---|
/sonarqube init [alias] [path] |
Set up project config and optional alias |
/sonarqube analyze [target] |
Run analysis for an alias 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 analysisissues— list issuesopen— open an issue with its index
Targets can be an alias like fe or a path like apps/web.
Configuration sources (precedence order)
- Environment variables (highest)
SONARQUBE_URL/SONAR_HOST_URLSONARQUBE_TOKEN/SONAR_TOKENSONAR_PROJECT_KEY
- Project config —
.pi/sonarqube.json(set via/sonarqube init) - Scan properties —
sonar-project.properties - Defaults —
http://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