nulladrift 0.1.2 → 0.1.4
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 +22 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -13,8 +13,17 @@ var red = wrap(31);
|
|
|
13
13
|
var green = wrap(32);
|
|
14
14
|
var yellow = wrap(33);
|
|
15
15
|
var blue = wrap(34);
|
|
16
|
+
function visibleControls(text) {
|
|
17
|
+
return text.replace(
|
|
18
|
+
// C0 and C1 controls and DEL, plus the bidirectional overrides and zero-width characters
|
|
19
|
+
// that change what a line appears to say without changing what it is.
|
|
20
|
+
// eslint-disable-next-line no-control-regex
|
|
21
|
+
/[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B-\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g,
|
|
22
|
+
(character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
16
25
|
function truncate(text, limit = 160) {
|
|
17
|
-
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
26
|
+
const collapsed = visibleControls(text).replace(/\s+/g, " ").trim();
|
|
18
27
|
return collapsed.length <= limit ? collapsed : `${collapsed.slice(0, limit - 1)}\u2026`;
|
|
19
28
|
}
|
|
20
29
|
|
|
@@ -660,7 +669,7 @@ import { dirname, join as join2 } from "path";
|
|
|
660
669
|
import { ClientCredentialsProvider, UnauthorizedError } from "@modelcontextprotocol/client";
|
|
661
670
|
|
|
662
671
|
// src/lib/version.ts
|
|
663
|
-
var VERSION = "0.1.
|
|
672
|
+
var VERSION = "0.1.4";
|
|
664
673
|
var USER_AGENT = `nulladrift/${VERSION}`;
|
|
665
674
|
|
|
666
675
|
// src/mcp/oauth.ts
|
|
@@ -1892,6 +1901,7 @@ function renderJsonReport(report, exitCode) {
|
|
|
1892
1901
|
}
|
|
1893
1902
|
|
|
1894
1903
|
// src/report/sarif.ts
|
|
1904
|
+
import { isAbsolute as isAbsolute2, relative as relative2, sep as sep2 } from "path";
|
|
1895
1905
|
import { createHash as createHash3 } from "crypto";
|
|
1896
1906
|
|
|
1897
1907
|
// src/lib/meta.ts
|
|
@@ -1928,6 +1938,12 @@ var RULE_HELP = {
|
|
|
1928
1938
|
function fingerprint(change2) {
|
|
1929
1939
|
return createHash3("sha256").update(`${change2.kind}\0${change2.server}\0${change2.member ?? ""}`).digest("hex").slice(0, 32);
|
|
1930
1940
|
}
|
|
1941
|
+
function sarifUri(report) {
|
|
1942
|
+
if (report.projectRoot === void 0) return report.lockPath;
|
|
1943
|
+
const rel = relative2(report.projectRoot, report.lockPath);
|
|
1944
|
+
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return report.lockPath;
|
|
1945
|
+
return rel.split(sep2).join("/");
|
|
1946
|
+
}
|
|
1931
1947
|
function renderSarifReport(report) {
|
|
1932
1948
|
const used = [...new Set(report.changes.map((change2) => change2.kind))].sort();
|
|
1933
1949
|
const document = {
|
|
@@ -1956,7 +1972,7 @@ function renderSarifReport(report) {
|
|
|
1956
1972
|
message: { text: change2.member ? `${change2.server} \u203A ${change2.member}: ${change2.summary}` : `${change2.server}: ${change2.summary}` },
|
|
1957
1973
|
locations: [
|
|
1958
1974
|
{
|
|
1959
|
-
physicalLocation: { artifactLocation: { uri: report
|
|
1975
|
+
physicalLocation: { artifactLocation: { uri: sarifUri(report), uriBaseId: "%SRCROOT%" } },
|
|
1960
1976
|
logicalLocations: [{ name: change2.member ?? change2.server, fullyQualifiedName: change2.member ? `${change2.server}/${change2.member}` : change2.server, kind: "member" }]
|
|
1961
1977
|
}
|
|
1962
1978
|
],
|
|
@@ -1977,7 +1993,7 @@ var AUDIT_FAILURE_LABEL = {
|
|
|
1977
1993
|
};
|
|
1978
1994
|
var MARK2 = { high: "\u{1F534}", medium: "\u{1F7E0}", low: "\u26AA" };
|
|
1979
1995
|
function cell(text) {
|
|
1980
|
-
return text.replace(/\|/g, "\\|").replace(/`/g, "\\`").replace(/\r?\n/g, " ").trim();
|
|
1996
|
+
return visibleControls(text).replace(/\|/g, "\\|").replace(/`/g, "\\`").replace(/\r?\n/g, " ").trim();
|
|
1981
1997
|
}
|
|
1982
1998
|
function row(change2) {
|
|
1983
1999
|
const where = change2.member ? `${change2.server}/${change2.member}` : change2.server;
|
|
@@ -2179,7 +2195,8 @@ async function buildReport(options) {
|
|
|
2179
2195
|
changes,
|
|
2180
2196
|
unreachable: result.unreachable,
|
|
2181
2197
|
serversChecked: Object.keys(result.lock.subjects).length,
|
|
2182
|
-
lockPath: options.lockPath
|
|
2198
|
+
lockPath: options.lockPath,
|
|
2199
|
+
projectRoot: options.projectRoot
|
|
2183
2200
|
};
|
|
2184
2201
|
return {
|
|
2185
2202
|
report,
|