@nielspeter/sonarlint-mcp-server 0.3.0 → 0.3.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.3.1](https://github.com/nielspeter/sonarlint-mcp-server/compare/v0.3.0...v0.3.1) (2026-03-30)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * use project root for scope detection instead of parent directory ([cd1591f](https://github.com/nielspeter/sonarlint-mcp-server/commit/cd1591fff30dea271ce927e6687860043c31566f))
11
+
5
12
  ## [0.3.0](https://github.com/nielspeter/sonarlint-mcp-server/compare/v0.2.8...v0.3.0) (2026-03-30)
6
13
 
7
14
 
@@ -2,7 +2,9 @@
2
2
  * Configuration scope management utilities
3
3
  */
4
4
  /**
5
- * Get or create configuration scope for a project
5
+ * Get or create configuration scope for a project.
6
+ * Uses the project root (detected via package.json, .git, etc.) so all files
7
+ * in the same project share one scope and one analysis call.
6
8
  */
7
9
  export declare function getOrCreateScope(filePath: string): string;
8
10
  //# sourceMappingURL=scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/utils/scope.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwBzD"}
1
+ {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/utils/scope.ts"],"names":[],"mappings":"AAAA;;GAEG;AA2BH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwBzD"}
@@ -1,14 +1,34 @@
1
1
  /**
2
2
  * Configuration scope management utilities
3
3
  */
4
- import { dirname } from "path";
4
+ import { dirname, join } from "path";
5
+ import { existsSync } from "fs";
5
6
  import { createHash } from "crypto";
6
7
  import { scopeMap, getSloopBridge } from "../state.js";
7
8
  /**
8
- * Get or create configuration scope for a project
9
+ * Find the project root by walking up to find package.json, .git, etc.
10
+ */
11
+ function findProjectRoot(startPath) {
12
+ let dir = startPath;
13
+ const markers = ['package.json', '.git', 'pom.xml', 'build.gradle', 'pyproject.toml', 'go.mod'];
14
+ while (dir !== dirname(dir)) { // stop at filesystem root
15
+ for (const marker of markers) {
16
+ if (existsSync(join(dir, marker))) {
17
+ return dir;
18
+ }
19
+ }
20
+ dir = dirname(dir);
21
+ }
22
+ // Fallback: use the original directory
23
+ return startPath;
24
+ }
25
+ /**
26
+ * Get or create configuration scope for a project.
27
+ * Uses the project root (detected via package.json, .git, etc.) so all files
28
+ * in the same project share one scope and one analysis call.
9
29
  */
10
30
  export function getOrCreateScope(filePath) {
11
- const projectRoot = dirname(filePath);
31
+ const projectRoot = findProjectRoot(dirname(filePath));
12
32
  const scopeId = scopeMap.get(projectRoot);
13
33
  if (scopeId) {
14
34
  return scopeId;
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/utils/scope.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE1C,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,iDAAiD;IACjD,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,C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,CAAC;YACb,CAAC;QACH,CAAC;QACD,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,uCAAuC;IACvC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE1C,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,iDAAiD;IACjD,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjF,MAAM,UAAU,GAAG,SAAS,IAAI,EAAE,CAAC;IAEnC,OAAO,CAAC,KAAK,CAAC,2CAA2C,UAAU,QAAQ,WAAW,EAAE,CAAC,CAAC;IAE1F,qBAAqB;IACrB,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,IAAI,WAAW,EAAE,CAAC;QAChB,WAAW,CAAC,qBAAqB,CAAC,UAAU,EAAE;YAC5C,IAAI,EAAE,YAAY,WAAW,EAAE;SAChC,CAAC,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACtC,OAAO,UAAU,CAAC;AACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nielspeter/sonarlint-mcp-server",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "MCP server providing SonarLint code analysis for Claude Desktop and other MCP clients",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",