@nielspeter/sonarlint-mcp-server 0.5.2 → 0.5.3
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 +7 -0
- package/dist/utils/scope.d.ts +6 -1
- package/dist/utils/scope.d.ts.map +1 -1
- package/dist/utils/scope.js +16 -6
- package/dist/utils/scope.js.map +1 -1
- package/package.json +1 -1
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.5.3](https://github.com/nielspeter/sonarlint-mcp-server/compare/v0.5.2...v0.5.3) (2026-04-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* prefer .git over package.json in findProjectRoot ([a421881](https://github.com/nielspeter/sonarlint-mcp-server/commit/a4218819a50d8d3109fe636487987f79f4f4d7b6))
|
|
11
|
+
|
|
5
12
|
### [0.5.2](https://github.com/nielspeter/sonarlint-mcp-server/compare/v0.5.1...v0.5.2) (2026-04-03)
|
|
6
13
|
|
|
7
14
|
|
package/dist/utils/scope.d.ts
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* Configuration scope management utilities
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Find the project root by walking up to find
|
|
5
|
+
* Find the project root by walking up to find .git, package.json, etc.
|
|
6
|
+
*
|
|
7
|
+
* Strategy: walk up from startPath, tracking both the first package.json
|
|
8
|
+
* and any .git directory. Prefer .git (true repo root) over package.json
|
|
9
|
+
* (which in monorepos appears in every workspace). This ensures sonarlint.json
|
|
10
|
+
* at the repo root is found, not a nested workspace's package.json.
|
|
6
11
|
*/
|
|
7
12
|
export declare function findProjectRoot(startPath: string): string;
|
|
8
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/utils/scope.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/utils/scope.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAqBzD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA2C9F"}
|
package/dist/utils/scope.js
CHANGED
|
@@ -7,22 +7,32 @@ import { createHash } from 'crypto';
|
|
|
7
7
|
import { scopeMap, scopeToProjectRoot, scopeFiles, getSloopBridge } from '../state.js';
|
|
8
8
|
import { buildClientFileDtos } from './file-registration.js';
|
|
9
9
|
/**
|
|
10
|
-
* Find the project root by walking up to find
|
|
10
|
+
* Find the project root by walking up to find .git, package.json, etc.
|
|
11
|
+
*
|
|
12
|
+
* Strategy: walk up from startPath, tracking both the first package.json
|
|
13
|
+
* and any .git directory. Prefer .git (true repo root) over package.json
|
|
14
|
+
* (which in monorepos appears in every workspace). This ensures sonarlint.json
|
|
15
|
+
* at the repo root is found, not a nested workspace's package.json.
|
|
11
16
|
*/
|
|
12
17
|
export function findProjectRoot(startPath) {
|
|
13
18
|
let dir = startPath;
|
|
14
|
-
|
|
19
|
+
let firstPackageJson;
|
|
20
|
+
const vcsMarkers = ['.git', 'pom.xml', 'build.gradle', 'pyproject.toml', 'go.mod'];
|
|
15
21
|
while (dir !== dirname(dir)) {
|
|
16
|
-
//
|
|
17
|
-
for (const marker of
|
|
22
|
+
// VCS/build markers are authoritative — return immediately
|
|
23
|
+
for (const marker of vcsMarkers) {
|
|
18
24
|
if (existsSync(join(dir, marker))) {
|
|
19
25
|
return dir;
|
|
20
26
|
}
|
|
21
27
|
}
|
|
28
|
+
// Remember first package.json as fallback (may be a workspace, not the root)
|
|
29
|
+
if (!firstPackageJson && existsSync(join(dir, 'package.json'))) {
|
|
30
|
+
firstPackageJson = dir;
|
|
31
|
+
}
|
|
22
32
|
dir = dirname(dir);
|
|
23
33
|
}
|
|
24
|
-
//
|
|
25
|
-
return startPath;
|
|
34
|
+
// No VCS marker found — fall back to first package.json, then original dir
|
|
35
|
+
return firstPackageJson ?? startPath;
|
|
26
36
|
}
|
|
27
37
|
/**
|
|
28
38
|
* Get or create a SLOOP configuration scope for a project.
|
package/dist/utils/scope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/utils/scope.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/utils/scope.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,UAAU,eAA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