opencode-sonarqube 1.2.2 → 1.2.4

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 (3) hide show
  1. package/README.md +19 -1
  2. package/dist/index.js +13 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -53,7 +53,18 @@ The installer will:
53
53
  4. Configure `opencode.json`
54
54
  5. Set up environment variables
55
55
 
56
- **Important: Restart OpenCode after installation!**
56
+ **After installation, complete these steps:**
57
+
58
+ ```bash
59
+ # 1. Load environment variables
60
+ source ~/.zshrc # or ~/.bashrc
61
+
62
+ # 2. Restart OpenCode (or start a new session)
63
+
64
+ # 3. Initialize SonarQube for your project (in OpenCode):
65
+ # Tell the AI: "Setup SonarQube for this project"
66
+ # Or use the tool: sonarqube({ action: "setup" })
67
+ ```
57
68
 
58
69
  ### Manual Installation
59
70
 
@@ -83,6 +94,13 @@ export SONAR_PASSWORD="your-password"
83
94
 
84
95
  Add these to your `~/.zshrc` or `~/.bashrc` to make them permanent.
85
96
 
97
+ **After installation:**
98
+
99
+ 1. Restart OpenCode (or start a new session)
100
+ 2. Initialize SonarQube for your project:
101
+ - Tell the AI: "Setup SonarQube for this project"
102
+ - Or use: `sonarqube({ action: "setup" })`
103
+
86
104
  ## Configuration
87
105
 
88
106
  ### Environment Variables (Required)
package/dist/index.js CHANGED
@@ -20733,19 +20733,27 @@ Git operation completed with changes. Consider running:
20733
20733
  await loadPluginConfig();
20734
20734
  }
20735
20735
  const isBashTool = input.tool === "bash" || input.tool === "mcp_bash";
20736
- if (isBashTool && currentSessionId) {
20736
+ safeLog(`[pre-check] tool=${input.tool}, isBash=${isBashTool}, sessionId=${currentSessionId}`);
20737
+ if (isBashTool) {
20737
20738
  const args = output.args;
20738
20739
  const command = args?.command ?? "";
20740
+ safeLog(`[pre-check] command: ${command.substring(0, 50)}...`);
20739
20741
  if (/git\s+commit\b/.test(command) && !/--amend/.test(command)) {
20742
+ safeLog(`[pre-check] Detected git commit, running quality check...`);
20740
20743
  const result = await handleGitOperationCheck(output, "commit");
20741
- if (result.block) {
20742
- safeLog(`Commit blocked by quality gate`);
20744
+ if (result.block && args) {
20745
+ args.command = `echo "\uD83D\uDEAB BLOCKED BY SONARQUBE: ${result.message || "Quality gate failed"}" && exit 1`;
20746
+ safeLog(`[pre-check] Commit BLOCKED - command replaced`);
20747
+ await showToast("Commit blocked by SonarQube quality gate!", "error");
20743
20748
  }
20744
20749
  }
20745
20750
  if (/git\s+push\b/.test(command)) {
20751
+ safeLog(`[pre-check] Detected git push, running quality check...`);
20746
20752
  const result = await handleGitOperationCheck(output, "push");
20747
- if (result.block) {
20748
- safeLog(`Push blocked by quality gate`);
20753
+ if (result.block && args) {
20754
+ args.command = `echo "\uD83D\uDEAB BLOCKED BY SONARQUBE: ${result.message || "Quality gate failed"}" && exit 1`;
20755
+ safeLog(`[pre-check] Push BLOCKED - command replaced`);
20756
+ await showToast("Push blocked by SonarQube quality gate!", "error");
20749
20757
  }
20750
20758
  }
20751
20759
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-sonarqube",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
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",