opencode-sonarqube 0.2.6 → 0.2.8
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 +44 -19
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -20095,7 +20095,8 @@ function getSeveritiesFromLevel(level) {
|
|
|
20095
20095
|
// src/index.ts
|
|
20096
20096
|
import { appendFileSync as appendFileSync4 } from "node:fs";
|
|
20097
20097
|
try {
|
|
20098
|
-
|
|
20098
|
+
const moduleLoadId = Math.random().toString(36).substring(7);
|
|
20099
|
+
appendFileSync4("/tmp/sonarqube-plugin-debug.log", `${new Date().toISOString()} [LOAD] Module loaded! id=${moduleLoadId} cwd=${process.cwd()} import.meta.url=${import.meta.url}
|
|
20099
20100
|
`);
|
|
20100
20101
|
} catch {}
|
|
20101
20102
|
var IGNORED_FILE_PATTERNS2 = [
|
|
@@ -20125,7 +20126,27 @@ var SonarQubePlugin = async ({ client, directory, worktree }) => {
|
|
|
20125
20126
|
safeLog(` worktree param: "${worktree}"`);
|
|
20126
20127
|
safeLog(` process.cwd(): "${process.cwd()}"`);
|
|
20127
20128
|
safeLog(` import.meta.url: "${import.meta.url}"`);
|
|
20129
|
+
const pluginImportUrl = import.meta.url;
|
|
20130
|
+
const resolveDirectoryFromImportUrl = () => {
|
|
20131
|
+
try {
|
|
20132
|
+
const pluginPath = decodeURIComponent(pluginImportUrl.replace("file://", ""));
|
|
20133
|
+
const pathParts = pluginPath.split("/");
|
|
20134
|
+
const nodeModulesIndex = pathParts.indexOf("node_modules");
|
|
20135
|
+
if (nodeModulesIndex > 0) {
|
|
20136
|
+
const projectPath = pathParts.slice(0, nodeModulesIndex).join("/");
|
|
20137
|
+
if (projectPath && projectPath !== "/" && projectPath.length > 1) {
|
|
20138
|
+
return projectPath;
|
|
20139
|
+
}
|
|
20140
|
+
}
|
|
20141
|
+
} catch {}
|
|
20142
|
+
return null;
|
|
20143
|
+
};
|
|
20128
20144
|
const resolveValidDirectory = () => {
|
|
20145
|
+
const fromImportUrl = resolveDirectoryFromImportUrl();
|
|
20146
|
+
if (fromImportUrl) {
|
|
20147
|
+
safeLog(`USING import.meta.url derived path=${fromImportUrl}`);
|
|
20148
|
+
return fromImportUrl;
|
|
20149
|
+
}
|
|
20129
20150
|
if (worktree && worktree !== "/" && worktree.length > 1) {
|
|
20130
20151
|
safeLog(`USING worktree=${worktree}`);
|
|
20131
20152
|
return worktree;
|
|
@@ -20139,19 +20160,6 @@ var SonarQubePlugin = async ({ client, directory, worktree }) => {
|
|
|
20139
20160
|
safeLog(`USING cwd=${cwd}`);
|
|
20140
20161
|
return cwd;
|
|
20141
20162
|
}
|
|
20142
|
-
try {
|
|
20143
|
-
const pluginUrl = import.meta.url;
|
|
20144
|
-
const pluginPath = decodeURIComponent(pluginUrl.replace("file://", ""));
|
|
20145
|
-
const pathParts = pluginPath.split("/");
|
|
20146
|
-
const nodeModulesIndex = pathParts.indexOf("node_modules");
|
|
20147
|
-
if (nodeModulesIndex > 0) {
|
|
20148
|
-
const projectPath = pathParts.slice(0, nodeModulesIndex).join("/");
|
|
20149
|
-
if (projectPath && projectPath !== "/" && projectPath.length > 1) {
|
|
20150
|
-
safeLog(`USING import.meta.url derived path=${projectPath}`);
|
|
20151
|
-
return projectPath;
|
|
20152
|
-
}
|
|
20153
|
-
}
|
|
20154
|
-
} catch {}
|
|
20155
20163
|
const homeDir = process.env["HOME"] || "/Users";
|
|
20156
20164
|
safeLog(`FALLBACK home=${homeDir}`);
|
|
20157
20165
|
return homeDir;
|
|
@@ -20173,7 +20181,13 @@ var SonarQubePlugin = async ({ client, directory, worktree }) => {
|
|
|
20173
20181
|
let pluginConfig;
|
|
20174
20182
|
let lastAnalysisResult;
|
|
20175
20183
|
const getConfig = () => pluginConfig;
|
|
20176
|
-
const getDirectory = () =>
|
|
20184
|
+
const getDirectory = () => {
|
|
20185
|
+
const fromImportUrl = resolveDirectoryFromImportUrl();
|
|
20186
|
+
if (fromImportUrl) {
|
|
20187
|
+
return fromImportUrl;
|
|
20188
|
+
}
|
|
20189
|
+
return effectiveDirectory;
|
|
20190
|
+
};
|
|
20177
20191
|
const loadPluginConfig = async () => {
|
|
20178
20192
|
if (pluginConfig)
|
|
20179
20193
|
return;
|
|
@@ -20530,6 +20544,9 @@ Git operation completed with changes. Consider running:
|
|
|
20530
20544
|
}
|
|
20531
20545
|
};
|
|
20532
20546
|
};
|
|
20547
|
+
safeLog(`=== PLUGIN INIT COMPLETE, returning hooks ===`);
|
|
20548
|
+
safeLog(` This instance's pluginImportUrl: "${pluginImportUrl}"`);
|
|
20549
|
+
safeLog(` This instance's effectiveDirectory: "${effectiveDirectory}"`);
|
|
20533
20550
|
const returnHooks = {
|
|
20534
20551
|
event: safeAsync(async ({ event }) => {
|
|
20535
20552
|
handleSessionTrackingEvent(event);
|
|
@@ -20565,16 +20582,24 @@ Git operation completed with changes. Consider running:
|
|
|
20565
20582
|
}
|
|
20566
20583
|
}, "experimental.session.compacting"),
|
|
20567
20584
|
"experimental.chat.system.transform": safeAsync(async (_input, output) => {
|
|
20568
|
-
safeLog(
|
|
20585
|
+
safeLog(`=== system.transform ENTERED ===`);
|
|
20586
|
+
safeLog(` _input keys: ${JSON.stringify(Object.keys(_input || {}))}`);
|
|
20587
|
+
safeLog(` _input: ${JSON.stringify(_input, null, 2)?.substring(0, 1000)}`);
|
|
20588
|
+
safeLog(` output keys: ${JSON.stringify(Object.keys(output || {}))}`);
|
|
20589
|
+
safeLog(` pluginImportUrl: "${pluginImportUrl}"`);
|
|
20590
|
+
safeLog(` effectiveDirectory: "${effectiveDirectory}"`);
|
|
20591
|
+
const inputAny = _input;
|
|
20592
|
+
const contextDir = inputAny?.directory || inputAny?.worktree || inputAny?.cwd || inputAny?.context?.directory;
|
|
20593
|
+
safeLog(` contextDir from input: "${contextDir}"`);
|
|
20569
20594
|
await loadPluginConfig();
|
|
20570
20595
|
const sonarConfig = pluginConfig?.["sonarqube"];
|
|
20571
20596
|
const config2 = loadConfig(sonarConfig);
|
|
20572
20597
|
if (!config2 || config2.level === "off") {
|
|
20598
|
+
safeLog(` config level is off or null, returning early`);
|
|
20573
20599
|
return;
|
|
20574
20600
|
}
|
|
20575
|
-
const dir = getDirectory();
|
|
20576
|
-
safeLog(`
|
|
20577
|
-
safeLog(`system.transform: effectiveDirectory is: "${effectiveDirectory}"`);
|
|
20601
|
+
const dir = contextDir || getDirectory();
|
|
20602
|
+
safeLog(` FINAL dir used: "${dir}"`);
|
|
20578
20603
|
const state = await getProjectState(dir);
|
|
20579
20604
|
if (!state?.projectKey)
|
|
20580
20605
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-sonarqube",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"homepage": "https://github.com/mguttmann/opencode-sonarqube#readme",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@opencode-ai/plugin": "^1.1.34",
|
|
41
|
-
"opencode-sonarqube": "0.2.
|
|
41
|
+
"opencode-sonarqube": "0.2.7",
|
|
42
42
|
"zod": "^3.24.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|