@cejel/cejel 0.6.0 → 0.6.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
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cejelCreateRequire } from 'node:module';
3
3
  const require = __cejelCreateRequire(import.meta.url);
4
+ import {
5
+ serveCejelMcpOverStdio
6
+ } from "./chunk-QDP7QWA7.js";
4
7
  import {
5
8
  CALLER_CONTEXT_PRODUCT_IDENTITY_NOTICE,
6
9
  CERTIFICATE_GLOSSARY,
@@ -9,13 +12,16 @@ import {
9
12
  WitanReportSchema,
10
13
  assertSelectableRubricVersion,
11
14
  buildRelyingPartySummary,
15
+ buildVerdictExplanation,
12
16
  computeApplicableMeasuredCoverage,
13
17
  createWitanAttestation,
14
18
  formatCertificateMetricAppliedWeightPercent,
15
19
  formatCertificateMetricLabel,
16
20
  formatCertificateMetricValue,
17
21
  formatCoverageSummary,
22
+ formatDimensionsMeasuredSentence,
18
23
  formatExternalSourceLine,
24
+ formatLowConfidenceSentence,
19
25
  isProspectiveRubricVersion,
20
26
  renderWitanBadgeEndpoint,
21
27
  renderWitanBadgeSvg,
@@ -23,7 +29,7 @@ import {
23
29
  runCejelScan,
24
30
  serializeWitanReport,
25
31
  verifyWitanAttestationBinding
26
- } from "./chunk-2453M7C2.js";
32
+ } from "./chunk-KG62JCJZ.js";
27
33
  import "./chunk-63XQDYQ5.js";
28
34
  import {
29
35
  external_exports
@@ -575,13 +581,15 @@ function renderTerminalCertificate(summary, report) {
575
581
  `Overall: ${formatScore(summary.overallScore)}/4.0 (${summary.verdict})`,
576
582
  ` Code trust: ${formatScore(summary.codeTrustScore)}/4.0`,
577
583
  ` Process trust: ${formatScore(summary.processTrustScore)}/4.0`,
584
+ ...report ? [` ${formatDimensionsMeasuredSentence(report)}`] : [],
585
+ ...report && formatLowConfidenceSentence(report) ? [` ${formatLowConfidenceSentence(report)}`] : [],
578
586
  ""
579
587
  ];
580
- lines.splice(1, 0, `Product identity: ${CALLER_CONTEXT_PRODUCT_IDENTITY_NOTICE}`);
588
+ lines.splice(lines.length - 1, 0, `About the name: ${CALLER_CONTEXT_PRODUCT_IDENTITY_NOTICE}`);
581
589
  if (report) {
582
590
  const relyingPartySummary = buildRelyingPartySummary(report);
583
591
  lines.splice(
584
- 3,
592
+ 2,
585
593
  0,
586
594
  `Scope: ${relyingPartySummary.scope}`,
587
595
  `What was examined: ${relyingPartySummary.examined}`,
@@ -598,6 +606,13 @@ function renderTerminalCertificate(summary, report) {
598
606
  ""
599
607
  );
600
608
  }
609
+ if (summary.historyLimitations?.length) {
610
+ lines.push(
611
+ "HISTORY LIMITATION \u2014 scored as usual, but some criteria read truncated history:",
612
+ ...summary.historyLimitations.map((limitation) => ` - ${limitation}`),
613
+ ""
614
+ );
615
+ }
601
616
  if (summary.contentReadSummary && summary.contentReadSummary.skipped > 0) {
602
617
  const reads = summary.contentReadSummary;
603
618
  const errnoCounts = Object.entries(reads.unreadableByErrno).map(([errno, count]) => `${errno}: ${count}`).join(", ");
@@ -653,6 +668,8 @@ function renderTerminalCertificate(summary, report) {
653
668
  lines.push(` ...and ${remaining} more \u2014 see the written report for the full list.`);
654
669
  }
655
670
  }
671
+ const verdictExplanation = !abstained && report ? buildVerdictExplanation(report) : void 0;
672
+ if (verdictExplanation) lines.push(verdictExplanation);
656
673
  if (!abstained && summary.externalFindingCount > 0) {
657
674
  lines.push(
658
675
  "",
@@ -805,6 +822,7 @@ Usage:
805
822
  npx ${NPX_PACKAGE_NAME} scan [path] [options]
806
823
  npx ${NPX_PACKAGE_NAME} verify <report.json> <attestation.json> [issuance.json issuance.json.sig]
807
824
  npx ${NPX_PACKAGE_NAME} export gitlab-codequality <report.json> [-o gl-code-quality-report.json]
825
+ npx ${NPX_PACKAGE_NAME} mcp
808
826
  npx ${NPX_PACKAGE_NAME} issue [path] --report <report.json> --attestation <attestation.json> --key <key.pub> --engagement-ref <ref>
809
827
 
810
828
  Commands:
@@ -812,6 +830,7 @@ Commands:
812
830
  verify verify the report/attestation binding; with an issuance pair, also check the issuer
813
831
  signature against docs/security/${ISSUER_SIGNERS_FILE} and docs/security/${ISSUER_REVOCATIONS_FILE}
814
832
  export write report.json's located findings as a GitLab Code Quality report (offline)
833
+ mcp serve the MCP server over stdio (the same server as the cejel-mcp bin)
815
834
  issue re-run this version at the certificate's revision and, only if report.json reproduces
816
835
  byte for byte, write an unsigned issuance.json for the issuer to sign through ssh-agent
817
836
 
@@ -850,6 +869,10 @@ async function runWitanV22CalibrationCli(args) {
850
869
  }
851
870
  async function runWitanCli(args, rubricVersion) {
852
871
  const invocation = parseCliInvocation(args);
872
+ if (invocation.command === "mcp") {
873
+ await serveCejelMcpOverStdio({ packageName: NPX_PACKAGE_NAME, version: cliVersion() });
874
+ return 0;
875
+ }
853
876
  if (invocation.command === "verify") {
854
877
  return runVerifyBinding(invocation);
855
878
  }
@@ -967,6 +990,19 @@ function parseCliInvocation(args) {
967
990
  }
968
991
  return parseExportArgs(exportArgs);
969
992
  }
993
+ if (command === "mcp") {
994
+ const mcpArgs = args.slice(1);
995
+ if (mcpArgs.some((arg) => arg === "-h" || arg === "--help")) {
996
+ return { command: "scan", options: parseArgs(["--help"]) };
997
+ }
998
+ if (mcpArgs.some((arg) => arg === "-v" || arg === "--version")) {
999
+ return { command: "scan", options: parseArgs(["--version"]) };
1000
+ }
1001
+ if (mcpArgs.length > 0) {
1002
+ throw new Error(`cejel mcp takes no arguments; got ${mcpArgs.join(" ")}`);
1003
+ }
1004
+ return { command: "mcp" };
1005
+ }
970
1006
  if (command === "issue") {
971
1007
  const issueArgs = args.slice(1);
972
1008
  if (issueArgs.some((arg) => arg === "-h" || arg === "--help")) {