opencode-sonarqube 1.2.3 → 1.2.5
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.
- package/dist/index.js +14 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20729,23 +20729,32 @@ Git operation completed with changes. Consider running:
|
|
|
20729
20729
|
}
|
|
20730
20730
|
}, "event"),
|
|
20731
20731
|
"tool.execute.before": safeAsync(async (input, output) => {
|
|
20732
|
+
safeLog(`=== TOOL.EXECUTE.BEFORE HOOK CALLED === tool=${input.tool}`);
|
|
20732
20733
|
if (input.tool === "sonarqube") {
|
|
20733
20734
|
await loadPluginConfig();
|
|
20734
20735
|
}
|
|
20735
20736
|
const isBashTool = input.tool === "bash" || input.tool === "mcp_bash";
|
|
20736
|
-
|
|
20737
|
+
safeLog(`[pre-check] tool=${input.tool}, isBash=${isBashTool}, sessionId=${currentSessionId}`);
|
|
20738
|
+
if (isBashTool) {
|
|
20737
20739
|
const args = output.args;
|
|
20738
20740
|
const command = args?.command ?? "";
|
|
20741
|
+
safeLog(`[pre-check] command: ${command.substring(0, 50)}...`);
|
|
20739
20742
|
if (/git\s+commit\b/.test(command) && !/--amend/.test(command)) {
|
|
20743
|
+
safeLog(`[pre-check] Detected git commit, running quality check...`);
|
|
20740
20744
|
const result = await handleGitOperationCheck(output, "commit");
|
|
20741
|
-
if (result.block) {
|
|
20742
|
-
|
|
20745
|
+
if (result.block && args) {
|
|
20746
|
+
args.command = `echo "\uD83D\uDEAB BLOCKED BY SONARQUBE: ${result.message || "Quality gate failed"}" && exit 1`;
|
|
20747
|
+
safeLog(`[pre-check] Commit BLOCKED - command replaced`);
|
|
20748
|
+
await showToast("Commit blocked by SonarQube quality gate!", "error");
|
|
20743
20749
|
}
|
|
20744
20750
|
}
|
|
20745
20751
|
if (/git\s+push\b/.test(command)) {
|
|
20752
|
+
safeLog(`[pre-check] Detected git push, running quality check...`);
|
|
20746
20753
|
const result = await handleGitOperationCheck(output, "push");
|
|
20747
|
-
if (result.block) {
|
|
20748
|
-
|
|
20754
|
+
if (result.block && args) {
|
|
20755
|
+
args.command = `echo "\uD83D\uDEAB BLOCKED BY SONARQUBE: ${result.message || "Quality gate failed"}" && exit 1`;
|
|
20756
|
+
safeLog(`[pre-check] Push BLOCKED - command replaced`);
|
|
20757
|
+
await showToast("Push blocked by SonarQube quality gate!", "error");
|
|
20749
20758
|
}
|
|
20750
20759
|
}
|
|
20751
20760
|
}
|