@cejel/cejel 0.6.3 → 0.6.5

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-KAMWXGY7.js";
6
+ } from "./chunk-35TRRAEC.js";
7
7
  import {
8
8
  CALLER_CONTEXT_PRODUCT_IDENTITY_NOTICE,
9
9
  CERTIFICATE_GLOSSARY,
@@ -29,7 +29,7 @@ import {
29
29
  runCejelScan,
30
30
  serializeWitanReport,
31
31
  verifyWitanAttestationBinding
32
- } from "./chunk-FA72HEWJ.js";
32
+ } from "./chunk-7XQVE76B.js";
33
33
  import "./chunk-63XQDYQ5.js";
34
34
  import {
35
35
  external_exports
@@ -42,7 +42,7 @@ import {
42
42
  init_esm_shims();
43
43
  import { createHash as createHash3 } from "crypto";
44
44
  import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "fs";
45
- import { dirname, join, resolve } from "path";
45
+ import { dirname, join, resolve as resolve2 } from "path";
46
46
  import { fileURLToPath, pathToFileURL } from "url";
47
47
 
48
48
  // src/issuance/index.ts
@@ -541,6 +541,43 @@ function renderGitLabCodeQualityFooter(result) {
541
541
  `;
542
542
  }
543
543
 
544
+ // src/npx-version-guard.ts
545
+ init_esm_shims();
546
+ import { delimiter, resolve } from "path";
547
+ var EXACT_VERSION_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
548
+ function npxVersionMismatchWarning(context) {
549
+ const { env, packageName, runningVersion, runningPath } = context;
550
+ if (env.npm_lifecycle_event !== "npx") return void 0;
551
+ if (env.npm_config_call) return void 0;
552
+ const pinned = exactPackageSpecVersion(env.npm_config_package, packageName);
553
+ if (pinned !== void 0) {
554
+ if (pinned === runningVersion) return void 0;
555
+ return `warning: npx was asked for ${packageName}@${pinned}, but cejel ${runningVersion} is running from ${runningPath}. Inside a ${packageName} checkout, npx can run the cejel on PATH; run it from another directory (#436).`;
556
+ }
557
+ const requested = env.npm_package_version;
558
+ if (env.npm_package_name !== packageName || !requested) return void 0;
559
+ if (!resolvedToLocalTree(env, context.cwd)) return void 0;
560
+ if (requested === runningVersion) return void 0;
561
+ const checkout = env.npm_config_local_prefix || context.cwd;
562
+ return `warning: npx resolved ${packageName} to the ${requested} checkout at ${checkout} and ran the cejel on PATH instead: cejel ${runningVersion} from ${runningPath}. Run npx from another directory to get the version you asked for (#436).`;
563
+ }
564
+ function exactPackageSpecVersion(packageSpecs, packageName) {
565
+ if (!packageSpecs) return void 0;
566
+ const prefix = `${packageName}@`;
567
+ for (const spec of packageSpecs.split(/\n+/)) {
568
+ const trimmed = spec.trim();
569
+ if (!trimmed.startsWith(prefix)) continue;
570
+ const version = trimmed.slice(prefix.length);
571
+ if (EXACT_VERSION_PATTERN.test(version)) return version;
572
+ }
573
+ return void 0;
574
+ }
575
+ function resolvedToLocalTree(env, cwd) {
576
+ const pathKey = Object.keys(env).find((key) => /^path$/i.test(key) && env[key]);
577
+ const first = pathKey ? env[pathKey]?.split(delimiter)[0] : void 0;
578
+ return first !== void 0 && first === resolve(cwd, "node_modules", ".bin");
579
+ }
580
+
544
581
  // src/terminal.ts
545
582
  init_esm_shims();
546
583
  function renderMinScoreAbstentionFailure(summary, minScore) {
@@ -862,8 +899,29 @@ async function main() {
862
899
  process.exitCode = exitCode;
863
900
  }
864
901
  async function runWitanFreeCli(args) {
902
+ warnIfNpxRanAnotherVersion();
865
903
  return runWitanCli(args);
866
904
  }
905
+ function warnIfNpxRanAnotherVersion() {
906
+ const warning = npxVersionMismatchWarning({
907
+ env: process.env,
908
+ cwd: process.cwd(),
909
+ packageName: NPX_PACKAGE_NAME,
910
+ runningVersion: cliVersion(),
911
+ runningPath: runningEntryPath()
912
+ });
913
+ if (warning) process.stderr.write(`${warning}
914
+ `);
915
+ }
916
+ function runningEntryPath() {
917
+ const invokedPath = process.argv[1];
918
+ if (!invokedPath) return process.execPath;
919
+ try {
920
+ return realpathSync(invokedPath);
921
+ } catch {
922
+ return invokedPath;
923
+ }
924
+ }
867
925
  async function runWitanV22CalibrationCli(args) {
868
926
  return runWitanCli(args, WITAN_RUBRIC_VERSION_V22);
869
927
  }
@@ -1039,8 +1097,8 @@ function parseExportArgs(args) {
1039
1097
  return {
1040
1098
  command: "export",
1041
1099
  format,
1042
- reportPath: resolve(reportPath),
1043
- outPath: resolve(outPath)
1100
+ reportPath: resolve2(reportPath),
1101
+ outPath: resolve2(outPath)
1044
1102
  };
1045
1103
  }
1046
1104
  function runExport(invocation) {
@@ -1074,8 +1132,8 @@ function parseVerifyArgs(args) {
1074
1132
  if (arg === "--signers" || arg === "--revocations") {
1075
1133
  const value = args[index + 1];
1076
1134
  if (!value) throw new Error(`Missing value for ${arg}`);
1077
- if (arg === "--signers") signersPath = resolve(value);
1078
- else revocationsPath = resolve(value);
1135
+ if (arg === "--signers") signersPath = resolve2(value);
1136
+ else revocationsPath = resolve2(value);
1079
1137
  index += 1;
1080
1138
  continue;
1081
1139
  }
@@ -1087,10 +1145,10 @@ function parseVerifyArgs(args) {
1087
1145
  if (!reportPath || !attestationPath) throw new Error(VERIFY_USAGE());
1088
1146
  return {
1089
1147
  command: "verify",
1090
- reportPath: resolve(reportPath),
1091
- attestationPath: resolve(attestationPath),
1092
- ...issuancePath ? { issuancePath: resolve(issuancePath) } : {},
1093
- ...issuanceSignaturePath ? { issuanceSignaturePath: resolve(issuanceSignaturePath) } : {},
1148
+ reportPath: resolve2(reportPath),
1149
+ attestationPath: resolve2(attestationPath),
1150
+ ...issuancePath ? { issuancePath: resolve2(issuancePath) } : {},
1151
+ ...issuanceSignaturePath ? { issuanceSignaturePath: resolve2(issuanceSignaturePath) } : {},
1094
1152
  ...signersPath ? { signersPath } : {},
1095
1153
  ...revocationsPath ? { revocationsPath } : {}
1096
1154
  };
@@ -1116,15 +1174,15 @@ function parseIssueArgs(args) {
1116
1174
  if (arg === void 0) continue;
1117
1175
  switch (arg) {
1118
1176
  case "--report":
1119
- reportPath = resolve(takeValue(arg, index + 1));
1177
+ reportPath = resolve2(takeValue(arg, index + 1));
1120
1178
  index += 1;
1121
1179
  continue;
1122
1180
  case "--attestation":
1123
- attestationPath = resolve(takeValue(arg, index + 1));
1181
+ attestationPath = resolve2(takeValue(arg, index + 1));
1124
1182
  index += 1;
1125
1183
  continue;
1126
1184
  case "--key":
1127
- keyPath = resolve(takeValue(arg, index + 1));
1185
+ keyPath = resolve2(takeValue(arg, index + 1));
1128
1186
  index += 1;
1129
1187
  continue;
1130
1188
  case "--engagement-ref":
@@ -1133,7 +1191,7 @@ function parseIssueArgs(args) {
1133
1191
  continue;
1134
1192
  case "--out":
1135
1193
  case "--out-dir":
1136
- outDir = resolve(takeValue(arg, index + 1));
1194
+ outDir = resolve2(takeValue(arg, index + 1));
1137
1195
  index += 1;
1138
1196
  continue;
1139
1197
  case "--product-name":
@@ -1177,7 +1235,7 @@ function parseIssueArgs(args) {
1177
1235
  throw new Error("--product-name and --name cannot be used together");
1178
1236
  }
1179
1237
  return {
1180
- repoPath: resolve(repoPath ?? "."),
1238
+ repoPath: resolve2(repoPath ?? "."),
1181
1239
  reportPath,
1182
1240
  attestationPath,
1183
1241
  keyPath,
@@ -1530,7 +1588,7 @@ function parseArgs(args) {
1530
1588
  throw new Error("--product-name and --name cannot be used together");
1531
1589
  }
1532
1590
  return {
1533
- repoPath: resolve(repoPath ?? "."),
1591
+ repoPath: resolve2(repoPath ?? "."),
1534
1592
  outDir,
1535
1593
  ...minScore != null ? { minScore } : {},
1536
1594
  ...productName ? { productName } : {},
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-KAMWXGY7.js";
7
- import "../chunk-FA72HEWJ.js";
6
+ } from "../chunk-35TRRAEC.js";
7
+ import "../chunk-7XQVE76B.js";
8
8
  import "../chunk-63XQDYQ5.js";
9
9
  import "../chunk-FSMZV3Y6.js";
10
10
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cejel/cejel",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "mcpName": "io.github.BargLabs/cejel",
5
5
  "private": false,
6
6
  "publishConfig": {