@cejel/cejel 0.6.11 → 0.7.0-rc.2
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
|
@@ -3,7 +3,7 @@ import { createRequire as __cejelCreateRequire } from 'node:module';
|
|
|
3
3
|
const require = __cejelCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
serveCejelMcpOverStdio
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IJYGVKYU.js";
|
|
7
7
|
import {
|
|
8
8
|
CALLER_CONTEXT_PRODUCT_IDENTITY_NOTICE,
|
|
9
9
|
CERTIFICATE_GLOSSARY,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
verifyRecordedInputDigests,
|
|
46
46
|
verifyWitanAttestationBinding,
|
|
47
47
|
witanHistoryAbstentionInstruction
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-G6AN4EDL.js";
|
|
49
49
|
import "./chunk-2UMHJ23V.js";
|
|
50
50
|
import {
|
|
51
51
|
external_exports
|
|
@@ -608,6 +608,64 @@ function renderGitLabCodeQualityFooter(result) {
|
|
|
608
608
|
`;
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
+
// src/export/gitlab-metrics.ts
|
|
612
|
+
init_esm_shims();
|
|
613
|
+
var UNMEASURED_STATUSES = /* @__PURE__ */ new Set([
|
|
614
|
+
"insufficient_data",
|
|
615
|
+
"not_applicable"
|
|
616
|
+
]);
|
|
617
|
+
function formatGitLabMetricScore(score) {
|
|
618
|
+
return score.toFixed(1);
|
|
619
|
+
}
|
|
620
|
+
function gitLabCriterionMetricName(id) {
|
|
621
|
+
return `cejel_criterion_${id.toLowerCase().replaceAll("-", "_")}_score`;
|
|
622
|
+
}
|
|
623
|
+
function isMeasured(criterion) {
|
|
624
|
+
return !UNMEASURED_STATUSES.has(criterion.status);
|
|
625
|
+
}
|
|
626
|
+
function exportGitLabMetrics(report) {
|
|
627
|
+
if (report.verdict === "insufficient_source") {
|
|
628
|
+
return { lines: [], leftOut: [], abstainedReason: report.insufficientSourceReason };
|
|
629
|
+
}
|
|
630
|
+
const lines = [];
|
|
631
|
+
const leftOut = [];
|
|
632
|
+
const add = (name, score, measured) => {
|
|
633
|
+
if (score === null || !measured) {
|
|
634
|
+
leftOut.push(name);
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
lines.push(`${name} ${formatGitLabMetricScore(score)}`);
|
|
638
|
+
};
|
|
639
|
+
const criteria = report.criteria;
|
|
640
|
+
add("cejel_overall_score", report.overallScore, criteria.some(isMeasured));
|
|
641
|
+
const trust = [
|
|
642
|
+
["cejel_process_trust_score", report.processTrustScore, "process_trust"],
|
|
643
|
+
["cejel_code_trust_score", report.codeTrustScore, "code_trust"]
|
|
644
|
+
];
|
|
645
|
+
for (const [name, score, category] of trust) {
|
|
646
|
+
const inCategory = criteria.filter((criterion) => criterion.category === category);
|
|
647
|
+
if (inCategory.length === 0) continue;
|
|
648
|
+
add(name, score, inCategory.some(isMeasured));
|
|
649
|
+
}
|
|
650
|
+
for (const criterion of criteria) {
|
|
651
|
+
add(gitLabCriterionMetricName(criterion.id), criterion.score, isMeasured(criterion));
|
|
652
|
+
}
|
|
653
|
+
return { lines, leftOut };
|
|
654
|
+
}
|
|
655
|
+
function renderGitLabMetricsFile(result) {
|
|
656
|
+
return result.lines.length === 0 ? "" : `${result.lines.join("\n")}
|
|
657
|
+
`;
|
|
658
|
+
}
|
|
659
|
+
function renderGitLabMetricsFooter(result) {
|
|
660
|
+
if (result.abstainedReason !== void 0) {
|
|
661
|
+
return `Cejel: abstained report (insufficient_source): wrote 0 metrics. ${result.abstainedReason}
|
|
662
|
+
`;
|
|
663
|
+
}
|
|
664
|
+
const named = result.leftOut.length === 0 ? "" : ` (${result.leftOut.join(", ")})`;
|
|
665
|
+
return `Cejel: wrote ${result.lines.length} metric(s); ${result.leftOut.length} value(s) left out because Cejel did not measure them${named}.
|
|
666
|
+
`;
|
|
667
|
+
}
|
|
668
|
+
|
|
611
669
|
// src/npx-version-guard.ts
|
|
612
670
|
init_esm_shims();
|
|
613
671
|
import { delimiter, resolve } from "path";
|
|
@@ -1070,6 +1128,7 @@ Usage:
|
|
|
1070
1128
|
npx ${NPX_PACKAGE_NAME} scan [path] [options]
|
|
1071
1129
|
npx ${NPX_PACKAGE_NAME} verify <report.json> <attestation.json> [issuance.json issuance.json.sig]
|
|
1072
1130
|
npx ${NPX_PACKAGE_NAME} export gitlab-codequality <report.json> [-o gl-code-quality-report.json]
|
|
1131
|
+
npx ${NPX_PACKAGE_NAME} export gitlab-metrics <report.json> [-o metrics.txt]
|
|
1073
1132
|
npx ${NPX_PACKAGE_NAME} mcp
|
|
1074
1133
|
npx ${NPX_PACKAGE_NAME} issue [path] --report <report.json> --attestation <attestation.json> --key <key.pub> --engagement-ref <ref>
|
|
1075
1134
|
|
|
@@ -1077,7 +1136,8 @@ Commands:
|
|
|
1077
1136
|
scan score a repository (default when the command is omitted)
|
|
1078
1137
|
verify verify the report/attestation binding; with an issuance pair, also check the issuer
|
|
1079
1138
|
signature against docs/security/${ISSUER_SIGNERS_FILE} and docs/security/${ISSUER_REVOCATIONS_FILE}
|
|
1080
|
-
export write report.json's located findings as a GitLab Code Quality report
|
|
1139
|
+
export write report.json's located findings as a GitLab Code Quality report, or its scores
|
|
1140
|
+
as a GitLab metrics report (offline)
|
|
1081
1141
|
mcp serve the MCP server over stdio (the same server as the cejel-mcp bin)
|
|
1082
1142
|
issue re-run this version at the certificate's revision and, only if report.json reproduces
|
|
1083
1143
|
byte for byte, write an unsigned issuance.json for the issuer to sign through ssh-agent
|
|
@@ -1292,12 +1352,22 @@ function parseCliInvocation(args) {
|
|
|
1292
1352
|
}
|
|
1293
1353
|
return { command: "scan", options: parseArgs(args) };
|
|
1294
1354
|
}
|
|
1295
|
-
var
|
|
1355
|
+
var EXPORT_DEFAULT_OUT = {
|
|
1356
|
+
"gitlab-codequality": "gl-code-quality-report.json",
|
|
1357
|
+
"gitlab-metrics": "metrics.txt"
|
|
1358
|
+
};
|
|
1359
|
+
function isExportFormat(value) {
|
|
1360
|
+
return value !== void 0 && Object.hasOwn(EXPORT_DEFAULT_OUT, value);
|
|
1361
|
+
}
|
|
1362
|
+
var EXPORT_USAGE = () => [
|
|
1363
|
+
`Usage: npx ${NPX_PACKAGE_NAME} export gitlab-codequality <report.json> [-o gl-code-quality-report.json]`,
|
|
1364
|
+
` npx ${NPX_PACKAGE_NAME} export gitlab-metrics <report.json> [-o metrics.txt]`
|
|
1365
|
+
].join("\n");
|
|
1296
1366
|
function parseExportArgs(args) {
|
|
1297
1367
|
const [format, ...rest] = args;
|
|
1298
|
-
if (format
|
|
1368
|
+
if (!isExportFormat(format)) throw new Error(EXPORT_USAGE());
|
|
1299
1369
|
const positionals = [];
|
|
1300
|
-
let outPath =
|
|
1370
|
+
let outPath = EXPORT_DEFAULT_OUT[format];
|
|
1301
1371
|
for (let index = 0; index < rest.length; index += 1) {
|
|
1302
1372
|
const arg = rest[index];
|
|
1303
1373
|
if (arg === void 0) continue;
|
|
@@ -1334,6 +1404,12 @@ ${members.map((member) => ` - ${member}`).join("\n")}
|
|
|
1334
1404
|
);
|
|
1335
1405
|
return 1;
|
|
1336
1406
|
}
|
|
1407
|
+
if (invocation.format === "gitlab-metrics") {
|
|
1408
|
+
const metrics = exportGitLabMetrics(reportResult.data);
|
|
1409
|
+
writeOutputFile(invocation.outPath, renderGitLabMetricsFile(metrics), "export output");
|
|
1410
|
+
process.stderr.write(renderGitLabMetricsFooter(metrics));
|
|
1411
|
+
return 0;
|
|
1412
|
+
}
|
|
1337
1413
|
const result = exportGitLabCodeQuality(reportResult.data);
|
|
1338
1414
|
writeOutputFile(
|
|
1339
1415
|
invocation.outPath,
|
package/dist/mcp/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import { createRequire as __cejelCreateRequire } from 'node:module';
|
|
|
3
3
|
const require = __cejelCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
serveCejelMcpOverStdio
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-IJYGVKYU.js";
|
|
7
|
+
import "../chunk-G6AN4EDL.js";
|
|
8
8
|
import "../chunk-2UMHJ23V.js";
|
|
9
9
|
import "../chunk-AMVP7L26.js";
|
|
10
10
|
import {
|