CLI-115 Generic API tool for any sonarqube cloud api#80
Conversation
Remediation Agent Summary 📊
Issues requiring manual fix (1)
Note Help us improve the Agent! |
|
Hi @subdavis! Thanks for the contribution 🙏 We are reconsidering our command tree and discussing with the team what the top-level commands should be. We will definitely consider this PR and use case in the reflection. Give me a couple of days and I will come back to you |
|
@subdavis small update, we have this epic planned at the beginning of Q2: https://sonarsource.atlassian.net/browse/CLI-100. We likely won't touch this PR until then |
kirill-knize-sonarsource
left a comment
There was a problem hiding this comment.
Auth is not compliant to principles. Auth resolver should be used.
b7b5f6a to
42c25d5
Compare
dd826a6 to
f25cad4
Compare
b929a5d to
796c969
Compare
796c969 to
74634be
Compare
SummaryThis PR adds a generic The implementation includes smart automatic routing: it detects whether an endpoint uses the V1 API (form-encoded request body) or V2 API (JSON body) based on the path, so users don't need to know the API version differences. For SonarCloud, it correctly routes requests to either What reviewers should knowWhere to start reading:
Key design decisions to review:
Test coverage:
|
See above
True! After looking at the existing API specs, I believe the heuristic is correct, but someone else should verify. I believe there's value in intelligently handling content-type instead of making this the user's responsibility. |
Co-authored-by: sonar-review-alpha[bot] <266116024+sonar-review-alpha[bot]@users.noreply.github.com>
|
| # | Story | Endpoints | Status |
|---|---|---|---|
| 1 | Auth & project health | authentication/validate, qualitygates/project_status, favorites/search |
Pass |
| 2 | Issue triage | issues/search, issues/changelog, issues/tags |
Pass |
| 3 | Rules & quality profiles | rules/search, qualityprofiles/search, languages/list |
Pass |
| 4 | Metrics & measures | measures/component, measures/component_tree, metrics/search |
Pass |
| 5 | V2 APIs & user info | v2/sca/* (404 expected), v2/users-management/* (404 expected), users/current, system/status |
Pass |
| 6 | Security & analysis | hotspots/search, ce/component, duplications/show, components/search |
Pass |
|
kirill-knize-sonarsource
left a comment
There was a problem hiding this comment.
LGTM!
Thanks a lot for this valuable contribution!



General API client using built-in templates
Give power users the ability to build reusable automations and agent skills to do anything through the SonarQube Cloud API.
Slack thread: https://sonarsource.slack.com/archives/C0ADT7VMGHW/p1772447653087179
Template variables
{organization}{project}Examples
sonar api get '/api/issues/search?projects={project}&organization={organization}sonar api post '/api/user_tokens/generate' --data '{"name":"test-cli-token"}'sonar api get '/api/system/status'sonar api get '/api/organizations/search?member=true'sonar api get '/sca/releases?projectKey={project}'V1 vs V2 Behavior
/apiuseSONARCLOUD_API_URL