opencode-sonarqube 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +10 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19313,6 +19313,10 @@ class SonarQubeAPI {
19313
19313
  };
19314
19314
  }
19315
19315
  }
19316
+ function createSonarQubeAPIWithCredentials(url2, user, password, logger4) {
19317
+ const client = createClientWithCredentials(url2, user, password, logger4?.child("client"));
19318
+ return new SonarQubeAPI(client, logger4);
19319
+ }
19316
19320
  function createSonarQubeAPIWithToken(url2, token, logger4) {
19317
19321
  const client = createClientWithToken(url2, token, logger4?.child("client"));
19318
19322
  return new SonarQubeAPI(client, logger4);
@@ -20374,6 +20378,9 @@ Please fix the failed checks before proceeding.`;
20374
20378
  return output;
20375
20379
  }
20376
20380
  // src/tools/handlers/security.ts
20381
+ function createAdminAPI(ctx) {
20382
+ return createSonarQubeAPIWithCredentials(ctx.config.url, ctx.config.user, ctx.config.password);
20383
+ }
20377
20384
  async function handleHotspots(ctx) {
20378
20385
  const { api: api2, projectKey } = ctx;
20379
20386
  const hotspots = await api2.issues.getSecurityHotspots(projectKey);
@@ -20448,12 +20455,13 @@ async function handleReviewHotspot(ctx, hotspotKey, resolution, comment) {
20448
20455
  if (!validResolutions.includes(res)) {
20449
20456
  return `**Error:** Invalid resolution "${resolution}". Must be one of: SAFE, FIXED, ACKNOWLEDGED`;
20450
20457
  }
20458
+ const adminApi = createAdminAPI(ctx);
20451
20459
  if (!hotspotKey) {
20452
20460
  const toReview = await api2.issues.getSecurityHotspotsToReview(projectKey);
20453
20461
  if (toReview.length === 0) {
20454
20462
  return formatSuccess("Review Hotspots", "No pending hotspots to review. All hotspots have already been reviewed.");
20455
20463
  }
20456
- const result = await api2.issues.bulkReviewHotspots(toReview.map((h) => h.key), res, comment ?? `Bulk reviewed as ${res} via opencode-sonarqube plugin`);
20464
+ const result = await adminApi.issues.bulkReviewHotspots(toReview.map((h) => h.key), res, comment ?? `Bulk reviewed as ${res} via opencode-sonarqube plugin`);
20457
20465
  let output = `## Hotspot Bulk Review Complete
20458
20466
 
20459
20467
  **Project:** \`${projectKey}\`
@@ -20475,7 +20483,7 @@ async function handleReviewHotspot(ctx, hotspotKey, resolution, comment) {
20475
20483
  return output;
20476
20484
  }
20477
20485
  try {
20478
- await api2.issues.reviewHotspot(hotspotKey, "REVIEWED", res, comment ?? `Reviewed as ${res} via opencode-sonarqube plugin`);
20486
+ await adminApi.issues.reviewHotspot(hotspotKey, "REVIEWED", res, comment ?? `Reviewed as ${res} via opencode-sonarqube plugin`);
20479
20487
  return `## Hotspot Reviewed
20480
20488
 
20481
20489
  **Hotspot:** \`${hotspotKey}\`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-sonarqube",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "OpenCode Plugin for SonarQube integration - Enterprise-level code quality from the start",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",