@cejel/cejel 0.4.6 → 0.4.7

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.
@@ -4,7 +4,7 @@ const require = __cejelCreateRequire(import.meta.url);
4
4
  import {
5
5
  __export,
6
6
  init_esm_shims
7
- } from "./chunk-H55KECVT.js";
7
+ } from "./chunk-ZNVILRHK.js";
8
8
 
9
9
  // node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
10
10
  var external_exports = {};
@@ -7,7 +7,7 @@ import {
7
7
  __filename,
8
8
  __require,
9
9
  init_esm_shims
10
- } from "./chunk-H55KECVT.js";
10
+ } from "./chunk-ZNVILRHK.js";
11
11
 
12
12
  // node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/typescript.js
13
13
  var require_typescript = __commonJS({
@@ -62,6 +62,9 @@ var MAX_REPOSITORY_CONTENT_BYTES = 512e3;
62
62
  init_esm_shims();
63
63
  import { closeSync, lstatSync, openSync, readFileSync, readSync } from "fs";
64
64
  import { resolve } from "path";
65
+ function contentReadSignalKey(criterionId, signalId) {
66
+ return [criterionId, signalId].join(":");
67
+ }
65
68
  var activeSession;
66
69
  function errnoClass(error) {
67
70
  if (typeof error !== "object" || error === null || !("code" in error)) return null;
@@ -73,6 +76,14 @@ function recordSkip(path2, reason, errno, affectsCurrentCriterion = false, dedup
73
76
  if (!session) return;
74
77
  if (affectsCurrentCriterion && session.criterion) {
75
78
  session.affectedCriteria.add(session.criterion);
79
+ const signals = session.signals;
80
+ if (signals && signals.length > 0) {
81
+ for (const signal of signals) {
82
+ session.affectedSignals.add(contentReadSignalKey(session.criterion, signal));
83
+ }
84
+ } else {
85
+ session.unattributedCriteria.add(session.criterion);
86
+ }
76
87
  }
77
88
  if (deduplicate) {
78
89
  const key = `${resolve(path2)}\0${reason}\0${errno ?? ""}`;
@@ -108,7 +119,9 @@ function trackContentReads(_repoPath, collect) {
108
119
  return {
109
120
  value: collect(),
110
121
  summary: summaryFor(existing),
111
- affectedCriteria: existing.affectedCriteria
122
+ affectedCriteria: existing.affectedCriteria,
123
+ affectedSignals: existing.affectedSignals,
124
+ unattributedCriteria: existing.unattributedCriteria
112
125
  };
113
126
  }
114
127
  const session = {
@@ -121,7 +134,9 @@ function trackContentReads(_repoPath, collect) {
121
134
  },
122
135
  unreadableByErrno: /* @__PURE__ */ new Map(),
123
136
  deduplicatedSkips: /* @__PURE__ */ new Set(),
124
- affectedCriteria: /* @__PURE__ */ new Set()
137
+ affectedCriteria: /* @__PURE__ */ new Set(),
138
+ affectedSignals: /* @__PURE__ */ new Set(),
139
+ unattributedCriteria: /* @__PURE__ */ new Set()
125
140
  };
126
141
  activeSession = session;
127
142
  try {
@@ -129,7 +144,9 @@ function trackContentReads(_repoPath, collect) {
129
144
  return {
130
145
  value,
131
146
  summary: summaryFor(session),
132
- affectedCriteria: session.affectedCriteria
147
+ affectedCriteria: session.affectedCriteria,
148
+ affectedSignals: session.affectedSignals,
149
+ unattributedCriteria: session.unattributedCriteria
133
150
  };
134
151
  } finally {
135
152
  activeSession = void 0;
@@ -146,13 +163,33 @@ function withContentReadCriterion(criterion, collect) {
146
163
  session.criterion = previous;
147
164
  }
148
165
  }
166
+ function withContentReadSignal(criterionId, signalId, collect) {
167
+ return withContentReadSignals(criterionId, [signalId], collect);
168
+ }
169
+ function withContentReadSignals(criterionId, signalIds, collect) {
170
+ if (signalIds.length === 0) {
171
+ throw new Error("Cejel invariant: withContentReadSignals requires at least one signal id");
172
+ }
173
+ const session = activeSession;
174
+ if (!session || session.criterion !== criterionId) return collect();
175
+ const previous = session.signals;
176
+ session.signals = signalIds;
177
+ try {
178
+ return collect();
179
+ } finally {
180
+ session.signals = previous;
181
+ }
182
+ }
149
183
  function recordContentSkip(path2, reason, deduplicate = false) {
150
184
  recordSkip(path2, reason, void 0, false, deduplicate);
151
185
  }
152
186
  function recordContentSkipForCriteria(path2, reason, criteria, deduplicate = false) {
153
187
  const session = activeSession;
154
188
  if (session) {
155
- for (const criterion of criteria) session.affectedCriteria.add(criterion);
189
+ for (const criterion of criteria) {
190
+ session.affectedCriteria.add(criterion);
191
+ session.unattributedCriteria.add(criterion);
192
+ }
156
193
  }
157
194
  recordSkip(path2, reason, void 0, false, deduplicate);
158
195
  }
@@ -227,8 +264,11 @@ export {
227
264
  __filename,
228
265
  init_esm_shims,
229
266
  MAX_REPOSITORY_CONTENT_BYTES,
267
+ contentReadSignalKey,
230
268
  trackContentReads,
231
269
  withContentReadCriterion,
270
+ withContentReadSignal,
271
+ withContentReadSignals,
232
272
  recordContentSkip,
233
273
  recordContentSkipForCriteria,
234
274
  recordFilesystemSkip,
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  assertSelectableRubricVersion,
11
11
  buildRelyingPartySummary,
12
12
  createWitanAttestation,
13
+ formatCertificateMetricAppliedWeightPercent,
13
14
  formatCertificateMetricLabel,
14
15
  formatCertificateMetricValue,
15
16
  formatExternalSourceLine,
@@ -20,12 +21,12 @@ import {
20
21
  runCejelScan,
21
22
  serializeWitanReport,
22
23
  verifyWitanAttestationBinding
23
- } from "./chunk-VEJLHO5F.js";
24
- import "./chunk-BZXBLDCJ.js";
25
- import "./chunk-Y6NO5HAI.js";
24
+ } from "./chunk-QTLLASOO.js";
25
+ import "./chunk-OIGCYULH.js";
26
+ import "./chunk-UYJBSQCV.js";
26
27
  import {
27
28
  init_esm_shims
28
- } from "./chunk-H55KECVT.js";
29
+ } from "./chunk-ZNVILRHK.js";
29
30
 
30
31
  // src/index.ts
31
32
  init_esm_shims();
@@ -113,13 +114,16 @@ function renderTerminalCertificate(summary, report) {
113
114
  (criterion) => criterion.metrics.map((metric) => ({
114
115
  criterionId: criterion.id,
115
116
  label: formatCertificateMetricLabel(metric),
116
- value: formatCertificateMetricValue(criterion, metric)
117
+ value: formatCertificateMetricValue(criterion, metric),
118
+ weightPercent: formatCertificateMetricAppliedWeightPercent(criterion, metric)
117
119
  }))
118
120
  );
119
121
  if (!abstained && (measurements?.length ?? 0) > 0) {
120
122
  lines.push("Measurements:");
121
123
  for (const measurement of measurements ?? []) {
122
- lines.push(` ${measurement.criterionId} \u2014 ${measurement.label}: ${measurement.value}`);
124
+ lines.push(
125
+ ` ${measurement.criterionId} \u2014 ${measurement.label}: ${measurement.value} (weight ${measurement.weightPercent}% of ${measurement.criterionId})`
126
+ );
123
127
  }
124
128
  lines.push("");
125
129
  }
@@ -210,6 +214,12 @@ var CLI_FLAG_SPECS = [
210
214
  description: "EXPLICIT OPT-IN: pin a rubric other than the calibrated default (see docs); prospective rubrics carry no calibration claim",
211
215
  kind: "rubricPin"
212
216
  },
217
+ {
218
+ tokens: ["--run-attempt"],
219
+ value: "<n>",
220
+ description: "record which CI run attempt produced this certificate (set by the GitHub Action; omit otherwise)",
221
+ kind: "runAttempt"
222
+ },
213
223
  {
214
224
  tokens: ["--quiet"],
215
225
  description: "suppress the terminal summary",
@@ -316,7 +326,11 @@ async function runWitanCli(args, rubricVersion) {
316
326
  ingestPatterns: options.ingestPatterns,
317
327
  warnOnEmptyIngestMatch: !options.quiet
318
328
  });
319
- const attestation = createWitanAttestation(report, { toolVersion: cliVersion(), generatedAt });
329
+ const attestation = createWitanAttestation(report, {
330
+ toolVersion: cliVersion(),
331
+ generatedAt,
332
+ ...options.runAttempt ? { githubRunAttempt: options.runAttempt } : {}
333
+ });
320
334
  mkdirSync(options.outDir, { recursive: true });
321
335
  writeFileSync(join(options.outDir, "report.json"), serializeWitanReport(report), "utf8");
322
336
  writeFileSync(
@@ -326,7 +340,11 @@ async function runWitanCli(args, rubricVersion) {
326
340
  );
327
341
  writeFileSync(
328
342
  join(options.outDir, "certificate.html"),
329
- renderWitanHtmlReport(report, { cliVersion: cliVersion(), generatedAt }),
343
+ renderWitanHtmlReport(report, {
344
+ cliVersion: cliVersion(),
345
+ generatedAt,
346
+ ...options.runAttempt ? { runAttempt: options.runAttempt } : {}
347
+ }),
330
348
  "utf8"
331
349
  );
332
350
  writeFileSync(
@@ -453,6 +471,7 @@ function parseArgs(args) {
453
471
  let showHelp = false;
454
472
  let showVersion = false;
455
473
  let rubricPin;
474
+ let runAttempt;
456
475
  const ingestPatterns = [];
457
476
  for (let index = 0; index < args.length; index += 1) {
458
477
  const arg = args[index];
@@ -531,6 +550,16 @@ function parseArgs(args) {
531
550
  index += 1;
532
551
  break;
533
552
  }
553
+ case "runAttempt": {
554
+ const value = args[index + 1];
555
+ if (!value) throw new Error("Missing value for --run-attempt");
556
+ if (!/^[1-9][0-9]*$/.test(value)) {
557
+ throw new Error(`--run-attempt must be a positive integer, got: ${value}`);
558
+ }
559
+ runAttempt = value;
560
+ index += 1;
561
+ break;
562
+ }
534
563
  }
535
564
  continue;
536
565
  }
@@ -553,7 +582,8 @@ function parseArgs(args) {
553
582
  showHelp,
554
583
  showVersion,
555
584
  ingestPatterns,
556
- ...rubricPin ? { rubricPin } : {}
585
+ ...rubricPin ? { rubricPin } : {},
586
+ ...runAttempt ? { runAttempt } : {}
557
587
  };
558
588
  }
559
589
  function hasUnsafeDisplayNameCharacter(value) {
package/dist/mcp/index.js CHANGED
@@ -5,20 +5,20 @@ import {
5
5
  renderWitanBadgeSvg,
6
6
  renderWitanHtmlReport,
7
7
  runCejelScan
8
- } from "../chunk-VEJLHO5F.js";
9
- import "../chunk-BZXBLDCJ.js";
8
+ } from "../chunk-QTLLASOO.js";
9
+ import "../chunk-OIGCYULH.js";
10
10
  import {
11
11
  ZodFirstPartyTypeKind,
12
12
  ZodOptional,
13
13
  external_exports,
14
14
  objectType
15
- } from "../chunk-Y6NO5HAI.js";
15
+ } from "../chunk-UYJBSQCV.js";
16
16
  import {
17
17
  __commonJS,
18
18
  __export,
19
19
  __toESM,
20
20
  init_esm_shims
21
- } from "../chunk-H55KECVT.js";
21
+ } from "../chunk-ZNVILRHK.js";
22
22
 
23
23
  // node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js
24
24
  var require_code = __commonJS({
@@ -3,18 +3,18 @@ import { createRequire as __cejelCreateRequire } from 'node:module';
3
3
  const require = __cejelCreateRequire(import.meta.url);
4
4
  import {
5
5
  listCejelLlmPackFiles
6
- } from "../../chunk-QRWLHTGR.js";
6
+ } from "../../chunk-EP7YYWEP.js";
7
7
  import {
8
8
  execGit
9
- } from "../../chunk-BZXBLDCJ.js";
9
+ } from "../../chunk-OIGCYULH.js";
10
10
  import {
11
11
  require_typescript
12
- } from "../../chunk-2IBG5OBF.js";
12
+ } from "../../chunk-XHAETB7N.js";
13
13
  import {
14
14
  __toESM,
15
15
  init_esm_shims,
16
16
  readRepoText
17
- } from "../../chunk-H55KECVT.js";
17
+ } from "../../chunk-ZNVILRHK.js";
18
18
 
19
19
  // src/packs/d-series/index.ts
20
20
  init_esm_shims();
@@ -3,15 +3,15 @@ import { createRequire as __cejelCreateRequire } from 'node:module';
3
3
  const require = __cejelCreateRequire(import.meta.url);
4
4
  import {
5
5
  external_exports
6
- } from "../../chunk-Y6NO5HAI.js";
6
+ } from "../../chunk-UYJBSQCV.js";
7
7
  import {
8
8
  require_typescript
9
- } from "../../chunk-2IBG5OBF.js";
9
+ } from "../../chunk-XHAETB7N.js";
10
10
  import {
11
11
  __toESM,
12
12
  init_esm_shims,
13
13
  readRepoText
14
- } from "../../chunk-H55KECVT.js";
14
+ } from "../../chunk-ZNVILRHK.js";
15
15
 
16
16
  // src/packs/decision-contracts/index.ts
17
17
  init_esm_shims();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cejel/cejel",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "mcpName": "io.github.BargLabs/cejel",
5
5
  "private": false,
6
6
  "publishConfig": {