nulladrift 0.1.2 → 0.1.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/dist/index.js CHANGED
@@ -660,7 +660,7 @@ import { dirname, join as join2 } from "path";
660
660
  import { ClientCredentialsProvider, UnauthorizedError } from "@modelcontextprotocol/client";
661
661
 
662
662
  // src/lib/version.ts
663
- var VERSION = "0.1.2";
663
+ var VERSION = "0.1.3";
664
664
  var USER_AGENT = `nulladrift/${VERSION}`;
665
665
 
666
666
  // src/mcp/oauth.ts
@@ -1892,6 +1892,7 @@ function renderJsonReport(report, exitCode) {
1892
1892
  }
1893
1893
 
1894
1894
  // src/report/sarif.ts
1895
+ import { isAbsolute as isAbsolute2, relative as relative2, sep as sep2 } from "path";
1895
1896
  import { createHash as createHash3 } from "crypto";
1896
1897
 
1897
1898
  // src/lib/meta.ts
@@ -1928,6 +1929,12 @@ var RULE_HELP = {
1928
1929
  function fingerprint(change2) {
1929
1930
  return createHash3("sha256").update(`${change2.kind}\0${change2.server}\0${change2.member ?? ""}`).digest("hex").slice(0, 32);
1930
1931
  }
1932
+ function sarifUri(report) {
1933
+ if (report.projectRoot === void 0) return report.lockPath;
1934
+ const rel = relative2(report.projectRoot, report.lockPath);
1935
+ if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return report.lockPath;
1936
+ return rel.split(sep2).join("/");
1937
+ }
1931
1938
  function renderSarifReport(report) {
1932
1939
  const used = [...new Set(report.changes.map((change2) => change2.kind))].sort();
1933
1940
  const document = {
@@ -1956,7 +1963,7 @@ function renderSarifReport(report) {
1956
1963
  message: { text: change2.member ? `${change2.server} \u203A ${change2.member}: ${change2.summary}` : `${change2.server}: ${change2.summary}` },
1957
1964
  locations: [
1958
1965
  {
1959
- physicalLocation: { artifactLocation: { uri: report.lockPath } },
1966
+ physicalLocation: { artifactLocation: { uri: sarifUri(report), uriBaseId: "%SRCROOT%" } },
1960
1967
  logicalLocations: [{ name: change2.member ?? change2.server, fullyQualifiedName: change2.member ? `${change2.server}/${change2.member}` : change2.server, kind: "member" }]
1961
1968
  }
1962
1969
  ],
@@ -2179,7 +2186,8 @@ async function buildReport(options) {
2179
2186
  changes,
2180
2187
  unreachable: result.unreachable,
2181
2188
  serversChecked: Object.keys(result.lock.subjects).length,
2182
- lockPath: options.lockPath
2189
+ lockPath: options.lockPath,
2190
+ projectRoot: options.projectRoot
2183
2191
  };
2184
2192
  return {
2185
2193
  report,