@anarchitects/governance-core 0.0.2 → 0.0.3

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,41 +1,41 @@
1
- import { createHash as st } from "node:crypto";
2
- function U(e, t = { projectOverrides: {} }) {
3
- const n = ct(e), r = dt(e);
1
+ import { createHash as St } from "node:crypto";
2
+ function X(e, t = { projectOverrides: {} }) {
3
+ const n = Pt(e), o = jt(e);
4
4
  return {
5
5
  id: e.workspaceId ?? e.workspace?.id ?? "workspace",
6
6
  name: e.workspaceName ?? e.workspace?.name ?? "workspace",
7
7
  root: e.workspaceRoot ?? e.workspace?.root ?? "",
8
- projects: n.map((o) => {
9
- const i = ut(o), a = o.tags ?? [], s = o.metadata ?? {}, d = t.projectOverrides[i] ?? {}, c = d.domain ?? o.domain ?? Q(a, "domain") ?? Q(a, "scope"), u = d.layer ?? o.layer ?? Q(a, "layer"), l = mt(s);
8
+ projects: n.map((r) => {
9
+ const i = bt(r), s = r.tags ?? [], a = r.metadata ?? {}, d = t.projectOverrides[i] ?? {}, c = d.domain ?? r.domain ?? oe(s, "domain") ?? oe(s, "scope"), l = d.layer ?? r.layer ?? oe(s, "layer"), u = Dt(a);
10
10
  return {
11
- id: o.id,
11
+ id: r.id,
12
12
  name: i,
13
- root: o.root ?? "",
14
- type: lt(o.type),
15
- tags: a,
13
+ root: r.root ?? "",
14
+ type: Ct(r.type),
15
+ tags: s,
16
16
  domain: c,
17
- layer: u,
18
- ownership: ft(
19
- l,
17
+ layer: l,
18
+ ownership: kt(
19
+ u,
20
20
  d.ownershipTeam,
21
- o.ownership
21
+ r.ownership
22
22
  ),
23
23
  metadata: {
24
- ...s,
24
+ ...a,
25
25
  ...d.documentation !== void 0 ? { documentation: d.documentation } : {}
26
26
  }
27
27
  };
28
28
  }),
29
- dependencies: r.map((o) => ({
30
- source: o.sourceProjectId,
31
- target: o.targetProjectId,
32
- type: pt(o.type),
33
- sourceFile: o.sourceFile
29
+ dependencies: o.map((r) => ({
30
+ source: r.sourceProjectId,
31
+ target: r.targetProjectId,
32
+ type: xt(r.type),
33
+ sourceFile: r.sourceFile
34
34
  }))
35
35
  };
36
36
  }
37
- const Dr = U, Cr = U, kr = U;
38
- function ct(e) {
37
+ const Xo = X, Zo = X, Qo = X;
38
+ function Pt(e) {
39
39
  return e.projects ? e.projects : e.workspace ? e.workspace.projects.map((t) => ({
40
40
  id: t.id,
41
41
  name: t.name,
@@ -48,7 +48,7 @@ function ct(e) {
48
48
  metadata: t.metadata
49
49
  })) : [];
50
50
  }
51
- function dt(e) {
51
+ function jt(e) {
52
52
  return e.dependencies ? e.dependencies : e.workspace ? e.workspace.dependencies.map((t) => ({
53
53
  sourceProjectId: t.source,
54
54
  targetProjectId: t.target,
@@ -56,19 +56,19 @@ function dt(e) {
56
56
  sourceFile: t.sourceFile
57
57
  })) : [];
58
58
  }
59
- function ut(e) {
59
+ function bt(e) {
60
60
  return e.name ?? e.id;
61
61
  }
62
- function Q(e, t) {
63
- return e.find((r) => r.startsWith(`${t}:`))?.split(":").slice(1).join(":");
62
+ function oe(e, t) {
63
+ return e.find((o) => o.startsWith(`${t}:`))?.split(":").slice(1).join(":");
64
64
  }
65
- function lt(e) {
65
+ function Ct(e) {
66
66
  return e === "application" || e === "app" ? "application" : e === "library" || e === "lib" ? "library" : e === "tool" ? "tool" : "unknown";
67
67
  }
68
- function pt(e) {
68
+ function xt(e) {
69
69
  return e === "static" || e === "dynamic" || e === "implicit" ? e : "unknown";
70
70
  }
71
- function mt(e) {
71
+ function Dt(e) {
72
72
  const t = e.ownership;
73
73
  if (typeof t == "string" && t)
74
74
  return t;
@@ -78,27 +78,27 @@ function mt(e) {
78
78
  return n;
79
79
  }
80
80
  }
81
- function ft(e, t, n) {
82
- const r = n?.contacts ?? [], o = t ?? e ?? n?.team;
83
- return o && r.length ? {
84
- team: o,
85
- contacts: r,
81
+ function kt(e, t, n) {
82
+ const o = n?.contacts ?? [], r = t ?? e ?? n?.team;
83
+ return r && o.length ? {
84
+ team: r,
85
+ contacts: o,
86
86
  source: "merged"
87
- } : o ? {
88
- team: o,
87
+ } : r ? {
88
+ team: r,
89
89
  contacts: [],
90
- source: gt(n?.source)
91
- } : r.length ? {
92
- contacts: r,
90
+ source: $t(n?.source)
91
+ } : o.length ? {
92
+ contacts: o,
93
93
  source: "codeowners"
94
94
  } : {
95
95
  source: "none"
96
96
  };
97
97
  }
98
- function gt(e) {
98
+ function $t(e) {
99
99
  return e === "merged" || e === "project-metadata" ? e : e === "codeowners" ? "codeowners" : "project-metadata";
100
100
  }
101
- function $r(e) {
101
+ function er(e) {
102
102
  return {
103
103
  kind: "root-cause",
104
104
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -111,7 +111,7 @@ function $r(e) {
111
111
  }
112
112
  };
113
113
  }
114
- function Er(e) {
114
+ function tr(e) {
115
115
  return {
116
116
  kind: "pr-impact",
117
117
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -123,7 +123,7 @@ function Er(e) {
123
123
  }
124
124
  };
125
125
  }
126
- function Mr(e) {
126
+ function nr(e) {
127
127
  return {
128
128
  kind: "scorecard",
129
129
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -135,7 +135,7 @@ function Mr(e) {
135
135
  }
136
136
  };
137
137
  }
138
- function Rr(e) {
138
+ function or(e) {
139
139
  return {
140
140
  kind: "onboarding",
141
141
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -147,7 +147,7 @@ function Rr(e) {
147
147
  }
148
148
  };
149
149
  }
150
- function Or(e) {
150
+ function rr(e) {
151
151
  return {
152
152
  kind: "cognitive-load",
153
153
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -159,7 +159,7 @@ function Or(e) {
159
159
  }
160
160
  };
161
161
  }
162
- function Ar(e) {
162
+ function ir(e) {
163
163
  return {
164
164
  kind: "recommendations",
165
165
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -172,7 +172,7 @@ function Ar(e) {
172
172
  }
173
173
  };
174
174
  }
175
- function zr(e) {
175
+ function sr(e) {
176
176
  return {
177
177
  kind: "smell-clusters",
178
178
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -185,7 +185,7 @@ function zr(e) {
185
185
  }
186
186
  };
187
187
  }
188
- function Fr(e) {
188
+ function ar(e) {
189
189
  return {
190
190
  kind: "refactoring-suggestions",
191
191
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -198,7 +198,7 @@ function Fr(e) {
198
198
  }
199
199
  };
200
200
  }
201
- function Vr(e) {
201
+ function cr(e) {
202
202
  return {
203
203
  kind: "management-insights",
204
204
  generatedAt: e.generatedAt ?? e.deliveryImpact.generatedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
@@ -220,24 +220,24 @@ function Vr(e) {
220
220
  }
221
221
  };
222
222
  }
223
- function yt(e, t = 10) {
223
+ function Mt(e, t = 10) {
224
224
  const n = {
225
225
  error: 3,
226
226
  warning: 2,
227
227
  info: 1
228
228
  };
229
- return [...e].sort((r, o) => {
230
- const i = (n[o.severity ?? "info"] ?? 0) - (n[r.severity ?? "info"] ?? 0);
231
- return i !== 0 ? i : me(r).localeCompare(me(o));
229
+ return [...e].sort((o, r) => {
230
+ const i = (n[r.severity ?? "info"] ?? 0) - (n[o.severity ?? "info"] ?? 0);
231
+ return i !== 0 ? i : we(o).localeCompare(we(r));
232
232
  }).slice(0, Math.max(0, t));
233
233
  }
234
- function Tr(e) {
235
- const t = e.inputs.topViolations ?? [], n = pe(t, (a) => a.source), r = pe(t, (a) => a.type), o = Object.entries(n).sort((a, s) => s[1] - a[1] || a[0].localeCompare(s[0])).slice(0, 3), i = o.map(([a, s], d) => ({
234
+ function dr(e) {
235
+ const t = e.inputs.topViolations ?? [], n = ve(t, (s) => s.source), o = ve(t, (s) => s.type), r = Object.entries(n).sort((s, a) => a[1] - s[1] || s[0].localeCompare(a[0])).slice(0, 3), i = r.map(([s, a], d) => ({
236
236
  id: `hotspot-${d + 1}`,
237
- title: `Hotspot: ${a}`,
238
- detail: `${a} appears in ${s} of ${t.length} prioritized violations.`,
237
+ title: `Hotspot: ${s}`,
238
+ detail: `${s} appears in ${a} of ${t.length} prioritized violations.`,
239
239
  signals: ["top-violations", "frequency"],
240
- confidence: t.length > 0 ? s / t.length : 0
240
+ confidence: t.length > 0 ? a / t.length : 0
241
241
  }));
242
242
  return i.length === 0 && i.push({
243
243
  id: "no-prioritized-violations",
@@ -247,55 +247,55 @@ function Tr(e) {
247
247
  confidence: 1
248
248
  }), {
249
249
  kind: "root-cause",
250
- summary: t.length === 0 ? "No prioritized governance violations found for root-cause analysis." : `Analyzed ${t.length} prioritized violations across ${o.length} hotspot projects.`,
250
+ summary: t.length === 0 ? "No prioritized governance violations found for root-cause analysis." : `Analyzed ${t.length} prioritized violations across ${r.length} hotspot projects.`,
251
251
  findings: i,
252
- recommendations: ht(r),
252
+ recommendations: Et(o),
253
253
  metadata: {
254
- violationTypes: r,
254
+ violationTypes: o,
255
255
  analyzedViolationCount: t.length
256
256
  }
257
257
  };
258
258
  }
259
- function Gr(e) {
260
- const t = e.inputs.metadata ?? {}, n = G(t, "changedFilesCount"), r = e.inputs.affectedProjects?.length ?? G(t, "affectedProjectsCount"), o = G(
259
+ function lr(e) {
260
+ const t = e.inputs.metadata ?? {}, n = B(t, "changedFilesCount"), o = e.inputs.affectedProjects?.length ?? B(t, "affectedProjectsCount"), r = B(
261
261
  t,
262
262
  "affectedDomainCount"
263
- ), i = G(
263
+ ), i = B(
264
264
  t,
265
265
  "crossDomainDependencyEdges"
266
- ), a = [
266
+ ), s = [
267
267
  n * 5,
268
- r * 15,
269
- o * 20,
268
+ o * 15,
269
+ r * 20,
270
270
  i * 10
271
- ].reduce((c, u) => c + u, 0), s = Math.max(0, Math.min(100, a)), d = s >= 70 ? "high" : s >= 40 ? "medium" : "low";
271
+ ].reduce((c, l) => c + l, 0), a = Math.max(0, Math.min(100, s)), d = a >= 70 ? "high" : a >= 40 ? "medium" : "low";
272
272
  return {
273
273
  kind: "pr-impact",
274
- summary: `PR impact is ${d} risk at ${s}/100 across ${r} affected project(s).`,
274
+ summary: `PR impact is ${d} risk at ${a}/100 across ${o} affected project(s).`,
275
275
  findings: [
276
276
  {
277
277
  id: "affected-projects",
278
278
  title: "Affected project spread",
279
- detail: `${r} project(s), ${o} domain(s), and ${i} cross-domain dependency edge(s) are implicated.`,
279
+ detail: `${o} project(s), ${r} domain(s), and ${i} cross-domain dependency edge(s) are implicated.`,
280
280
  signals: ["affected-projects", "cross-domain-impact"],
281
281
  confidence: 1
282
282
  }
283
283
  ],
284
- recommendations: ze(d),
284
+ recommendations: Ne(d),
285
285
  metadata: {
286
286
  changedFilesCount: n,
287
- affectedProjectsCount: r,
288
- affectedDomainCount: o,
287
+ affectedProjectsCount: o,
288
+ affectedDomainCount: r,
289
289
  crossDomainDependencyEdges: i,
290
- risk: s
290
+ risk: a
291
291
  }
292
292
  };
293
293
  }
294
- function Br(e) {
295
- const t = e.inputs.snapshot, n = e.inputs.comparison, r = t?.health?.score ?? 0;
294
+ function ur(e) {
295
+ const t = e.inputs.snapshot, n = e.inputs.comparison, o = t?.health?.score ?? 0;
296
296
  return {
297
297
  kind: "scorecard",
298
- summary: n?.healthDelta ? `Current health is ${r}/100 with a ${n.healthDelta.scoreDelta} point delta from the baseline.` : `Current health is ${r}/100.`,
298
+ summary: n?.healthDelta ? `Current health is ${o}/100 with a ${n.healthDelta.scoreDelta} point delta from the baseline.` : `Current health is ${o}/100.`,
299
299
  findings: [
300
300
  {
301
301
  id: "workspace-health",
@@ -318,7 +318,7 @@ function Br(e) {
318
318
  }
319
319
  };
320
320
  }
321
- function Lr(e) {
321
+ function pr(e) {
322
322
  const t = e.inputs.dependencies?.length ?? 0, n = e.inputs.topViolations?.length ?? 0;
323
323
  return {
324
324
  kind: "onboarding",
@@ -346,8 +346,8 @@ function Lr(e) {
346
346
  }
347
347
  };
348
348
  }
349
- function Nr(e) {
350
- const t = fe(e.inputs.metadata), n = fe(t?.deliveryImpact);
349
+ function mr(e) {
350
+ const t = Ie(e.inputs.metadata), n = Ie(t?.deliveryImpact);
351
351
  if (!n || n.indices.length === 0)
352
352
  return {
353
353
  kind: "management-insights",
@@ -366,27 +366,27 @@ function Nr(e) {
366
366
  indexCount: 0
367
367
  }
368
368
  };
369
- const r = [...n.indices].sort(
370
- (i, a) => a.score - i.score || i.id.localeCompare(a.id)
371
- )[0], o = n.drivers[0];
369
+ const o = [...n.indices].sort(
370
+ (i, s) => s.score - i.score || i.id.localeCompare(s.id)
371
+ )[0], r = n.drivers[0];
372
372
  return {
373
373
  kind: "management-insights",
374
- summary: `Prepared AI handoff input for ${n.indices.length} delivery-impact indices. Highest current pressure: ${r.name} (${r.risk}, score ${r.score}).`,
374
+ summary: `Prepared AI handoff input for ${n.indices.length} delivery-impact indices. Highest current pressure: ${o.name} (${o.risk}, score ${o.score}).`,
375
375
  findings: [
376
376
  {
377
- id: `index-${r.id}`,
378
- title: `${r.name} is the highest current delivery pressure`,
379
- detail: `${r.name} is ${r.score}/100 with ${r.risk} risk.`,
380
- signals: r.drivers.map((i) => i.id),
377
+ id: `index-${o.id}`,
378
+ title: `${o.name} is the highest current delivery pressure`,
379
+ detail: `${o.name} is ${o.score}/100 with ${o.risk} risk.`,
380
+ signals: o.drivers.map((i) => i.id),
381
381
  confidence: 1
382
382
  },
383
- ...o ? [
383
+ ...r ? [
384
384
  {
385
- id: `driver-${o.id}`,
386
- title: `Primary investment driver: ${o.label}`,
387
- detail: o.explanation ?? `${o.label} is the strongest current delivery-impact driver.`,
388
- signals: [o.id],
389
- confidence: o.score ? o.score / 100 : 0.6
385
+ id: `driver-${r.id}`,
386
+ title: `Primary investment driver: ${r.label}`,
387
+ detail: r.explanation ?? `${r.label} is the strongest current delivery-impact driver.`,
388
+ signals: [r.id],
389
+ confidence: r.score ? r.score / 100 : 0.6
390
390
  }
391
391
  ] : []
392
392
  ],
@@ -394,7 +394,7 @@ function Nr(e) {
394
394
  {
395
395
  id: "trace-delivery-pressure",
396
396
  title: "Trace delivery pressure to concrete architecture work",
397
- priority: r.risk === "high" ? "high" : "medium",
397
+ priority: o.risk === "high" ? "high" : "medium",
398
398
  reason: "Management-facing delivery-impact signals are strongest when they stay tied to the concrete governance evidence already present in the payload."
399
399
  }
400
400
  ],
@@ -404,22 +404,22 @@ function Nr(e) {
404
404
  }
405
405
  };
406
406
  }
407
- function _r(e) {
408
- return ce(
407
+ function fr(e) {
408
+ return pe(
409
409
  e,
410
410
  "recommendations",
411
411
  "Architecture recommendations",
412
412
  "Generate architecture work items from the strongest governance hotspots."
413
413
  );
414
414
  }
415
- function qr(e) {
416
- const t = e.inputs.affectedProjects ?? [], n = e.inputs.dependencies ?? [], r = Math.max(
415
+ function gr(e) {
416
+ const t = e.inputs.affectedProjects ?? [], n = e.inputs.dependencies ?? [], o = Math.max(
417
417
  0,
418
418
  Math.min(100, t.length * 15 + n.length * 2)
419
- ), o = r >= 70 ? "high" : r >= 40 ? "medium" : "low";
419
+ ), r = o >= 70 ? "high" : o >= 40 ? "medium" : "low";
420
420
  return {
421
421
  kind: "cognitive-load",
422
- summary: `Estimated cognitive load is ${o} risk at ${r}/100.`,
422
+ summary: `Estimated cognitive load is ${r} risk at ${o}/100.`,
423
423
  findings: [
424
424
  {
425
425
  id: "cognitive-load-surface",
@@ -429,40 +429,40 @@ function qr(e) {
429
429
  confidence: 0.8
430
430
  }
431
431
  ],
432
- recommendations: ze(o),
432
+ recommendations: Ne(r),
433
433
  metadata: {
434
- score: r,
434
+ score: o,
435
435
  affectedProjectsCount: t.length,
436
436
  dependencyCount: n.length
437
437
  }
438
438
  };
439
439
  }
440
- function Wr(e) {
441
- return ce(
440
+ function yr(e) {
441
+ return pe(
442
442
  e,
443
443
  "smell-clusters",
444
444
  "Smell clusters",
445
445
  "Group recurring hotspots before choosing remediation sequencing."
446
446
  );
447
447
  }
448
- function Hr(e) {
449
- return ce(
448
+ function hr(e) {
449
+ return pe(
450
450
  e,
451
451
  "refactoring-suggestions",
452
452
  "Refactoring suggestions",
453
453
  "Start with the most repeated hotspot patterns before broad cleanup."
454
454
  );
455
455
  }
456
- function ce(e, t, n, r) {
457
- const o = e.inputs.topViolations ?? [], i = yt(o, 5);
456
+ function pe(e, t, n, o) {
457
+ const r = e.inputs.topViolations ?? [], i = Mt(r, 5);
458
458
  return {
459
459
  kind: t,
460
460
  summary: i.length === 0 ? `No prioritized violations were available for ${n.toLowerCase()}.` : `Prepared ${n.toLowerCase()} from ${i.length} prioritized violation(s).`,
461
- findings: i.map((a, s) => ({
462
- id: `violation-${s + 1}`,
463
- title: a.ruleId ?? a.type,
464
- detail: a.message ?? `${a.type} at ${a.source}.`,
465
- signals: [a.type, a.ruleId ?? "violation"],
461
+ findings: i.map((s, a) => ({
462
+ id: `violation-${a + 1}`,
463
+ title: s.ruleId ?? s.type,
464
+ detail: s.message ?? `${s.type} at ${s.source}.`,
465
+ signals: [s.type, s.ruleId ?? "violation"],
466
466
  confidence: 1
467
467
  })),
468
468
  recommendations: i.length > 0 ? [
@@ -470,12 +470,12 @@ function ce(e, t, n, r) {
470
470
  id: `${t}-focus`,
471
471
  title: n,
472
472
  priority: "medium",
473
- reason: r
473
+ reason: o
474
474
  }
475
475
  ] : []
476
476
  };
477
477
  }
478
- function ht(e) {
478
+ function Et(e) {
479
479
  return Object.entries(e).sort((t, n) => n[1] - t[1] || t[0].localeCompare(n[0])).slice(0, 3).map(([t]) => ({
480
480
  id: `address-${t}`,
481
481
  title: `Address ${t}`,
@@ -483,7 +483,7 @@ function ht(e) {
483
483
  reason: `${t} is recurring in the prioritized violation set.`
484
484
  }));
485
485
  }
486
- function ze(e) {
486
+ function Ne(e) {
487
487
  return e === "low" ? [] : [
488
488
  {
489
489
  id: "reduce-change-risk",
@@ -493,17 +493,17 @@ function ze(e) {
493
493
  }
494
494
  ];
495
495
  }
496
- function pe(e, t) {
497
- return e.reduce((n, r) => {
498
- const o = t(r);
499
- return n[o] = (n[o] ?? 0) + 1, n;
496
+ function ve(e, t) {
497
+ return e.reduce((n, o) => {
498
+ const r = t(o);
499
+ return n[r] = (n[r] ?? 0) + 1, n;
500
500
  }, {});
501
501
  }
502
- function G(e, t) {
502
+ function B(e, t) {
503
503
  const n = e[t];
504
504
  return typeof n == "number" && Number.isFinite(n) ? n : 0;
505
505
  }
506
- function me(e) {
506
+ function we(e) {
507
507
  return [
508
508
  e.ruleId ?? "",
509
509
  e.type,
@@ -512,19 +512,14 @@ function me(e) {
512
512
  e.message ?? ""
513
513
  ].join("|");
514
514
  }
515
- function fe(e) {
515
+ function Ie(e) {
516
516
  return typeof e == "object" && e !== null && !Array.isArray(e) ? e : void 0;
517
517
  }
518
- const ee = [
518
+ const Rt = [
519
519
  "graph",
520
520
  "conformance",
521
- "policy",
522
- "extension"
523
- ], vt = [
524
- "info",
525
- "warning",
526
- "error"
527
- ], It = [
521
+ "policy"
522
+ ], Ot = ["info", "warning", "error"], Vt = [
528
523
  "structural-dependency",
529
524
  "cross-domain-dependency",
530
525
  "missing-domain-context",
@@ -533,276 +528,1145 @@ const ee = [
533
528
  "domain-boundary-violation",
534
529
  "layer-boundary-violation",
535
530
  "ownership-gap"
536
- ], wt = [
531
+ ], At = [
537
532
  "architecture",
538
533
  "boundaries",
539
534
  "ownership",
540
535
  "documentation"
541
- ], ge = {
542
- graph: 0,
543
- conformance: 1,
544
- policy: 2,
545
- extension: 3
546
- }, B = {
547
- "structural-dependency": 0,
548
- "cross-domain-dependency": 1,
549
- "missing-domain-context": 2,
550
- "circular-dependency": 3,
551
- "conformance-violation": 4,
552
- "domain-boundary-violation": 5,
553
- "layer-boundary-violation": 6,
554
- "ownership-gap": 7
555
- }, ye = {
556
- error: 0,
557
- warning: 1,
558
- info: 2
559
- };
560
- function Pt(e) {
561
- const t = St(
562
- e.violations,
563
- e.reportType
564
- ), n = jt(
565
- e.signals,
566
- e.reportType
567
- ), r = bt(
568
- e.measurements,
569
- e.reportType
570
- );
536
+ ];
537
+ function vr(e, t) {
571
538
  return {
572
- workspace: e.workspace,
573
- profile: e.profile,
574
- warnings: [...e.warnings ?? []],
575
- exceptions: e.exceptions,
576
- violations: t,
577
- measurements: r,
578
- signalBreakdown: xt(n),
579
- metricBreakdown: Dt(r),
580
- topIssues: Fe(n),
581
- health: e.health,
582
- recommendations: [...e.recommendations ?? []]
539
+ baseline: e,
540
+ current: t,
541
+ metricDeltas: Se(e.metrics, t.metrics),
542
+ scoreDeltas: Se(e.scores, t.scores),
543
+ newViolations: t.violations.filter(
544
+ (n) => !xe(e.violations, n)
545
+ ),
546
+ resolvedViolations: e.violations.filter(
547
+ (n) => !xe(t.violations, n)
548
+ ),
549
+ healthDelta: zt(e, t),
550
+ signalDeltas: Tt(e, t),
551
+ metricFamilyDeltas: Lt(e, t),
552
+ topIssueDeltas: Bt(e, t),
553
+ deliveryImpactIndexDeltas: Gt(e, t)
583
554
  };
584
555
  }
585
- function St(e, t) {
586
- return t === "boundaries" ? e.filter((n) => n.category === "boundary") : t === "ownership" ? e.filter((n) => n.category === "ownership") : t === "architecture" ? e.filter((n) => n.category !== "ownership") : e;
587
- }
588
- function bt(e, t) {
589
- return t === "boundaries" ? e.filter(
590
- (n) => n.family === "boundaries"
591
- ) : t === "ownership" ? e.filter(
592
- (n) => n.family === "ownership"
593
- ) : t === "architecture" ? e.filter(
594
- (n) => n.family !== "ownership" && n.family !== "documentation"
595
- ) : e;
596
- }
597
- function jt(e, t) {
598
- return t === "boundaries" ? e.filter((n) => n.category === "boundary") : t === "ownership" ? e.filter((n) => n.category === "ownership") : t === "architecture" ? e.filter((n) => n.category !== "ownership") : e;
599
- }
600
- function xt(e) {
601
- const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
602
- for (const o of e)
603
- t.set(o.source, (t.get(o.source) ?? 0) + 1), n.set(o.type, (n.get(o.type) ?? 0) + 1), r.set(
604
- o.severity,
605
- (r.get(o.severity) ?? 0) + 1
556
+ function wr(e, t = 0.02) {
557
+ const n = [], o = e.scoreDeltas.find(
558
+ (r) => r.id === "workspaceHealth"
559
+ );
560
+ o && n.push(
561
+ re(
562
+ "workspaceHealth",
563
+ "workspace-health",
564
+ "Workspace Health",
565
+ o,
566
+ t,
567
+ e.healthDelta ? {
568
+ baselineStatus: e.healthDelta.baselineStatus,
569
+ currentStatus: e.healthDelta.currentStatus,
570
+ baselineGrade: e.healthDelta.baselineGrade,
571
+ currentGrade: e.healthDelta.currentGrade
572
+ } : void 0
573
+ )
574
+ );
575
+ for (const r of e.scoreDeltas)
576
+ r.id !== "workspaceHealth" && n.push(
577
+ re(
578
+ r.id,
579
+ "metric-score",
580
+ Ut(r.id),
581
+ r,
582
+ t
583
+ )
606
584
  );
607
- return {
608
- total: e.length,
609
- bySource: [
610
- ...ee.map((o) => ({
611
- source: o,
612
- count: t.get(o) ?? 0
613
- })),
614
- ...ie(
615
- [...t.keys()],
616
- ee
617
- ).filter((o) => !ee.includes(o)).map((o) => ({
618
- source: o,
619
- count: t.get(o) ?? 0
620
- }))
621
- ],
622
- byType: ie(
623
- [...n.keys()],
624
- It
625
- ).flatMap((o) => {
626
- const i = n.get(o) ?? 0;
627
- return i > 0 ? [{ type: o, count: i }] : [];
628
- }),
629
- bySeverity: vt.map((o) => ({
630
- severity: o,
631
- count: r.get(o) ?? 0
632
- }))
633
- };
634
- }
635
- function Dt(e) {
636
- const t = /* @__PURE__ */ new Map();
637
- for (const r of e) {
638
- const o = t.get(r.family) ?? [];
639
- o.push(r), t.set(r.family, o);
640
- }
641
- return {
642
- families: ie(
643
- [...t.keys()],
644
- wt
645
- ).flatMap((r) => {
646
- const o = (t.get(r) ?? []).slice().sort((a, s) => a.id.localeCompare(s.id)).map((a) => ({
647
- id: a.id,
648
- name: a.name,
649
- score: a.score
650
- }));
651
- if (o.length === 0)
652
- return [];
653
- const i = o.reduce(
654
- (a, s) => a + s.score,
655
- 0
656
- ) / o.length;
657
- return [
585
+ for (const r of e.metricFamilyDeltas ?? [])
586
+ n.push(
587
+ re(
588
+ `metric-family:${r.family}`,
589
+ "metric-family",
590
+ `Metric Family: ${Kt(r.family)}`,
591
+ r,
592
+ t
593
+ )
594
+ );
595
+ for (const r of e.signalDeltas?.bySource ?? [])
596
+ n.push(
597
+ G(
598
+ `signal-source:${r.source}`,
599
+ "signal-source",
600
+ `Signal Source: ${r.source}`,
601
+ r
602
+ )
603
+ );
604
+ for (const r of e.signalDeltas?.byType ?? [])
605
+ n.push(
606
+ G(
607
+ `signal-type:${r.type}`,
608
+ "signal-type",
609
+ `Signal Type: ${Yt(r.type)}`,
610
+ r
611
+ )
612
+ );
613
+ for (const r of e.signalDeltas?.bySeverity ?? [])
614
+ n.push(
615
+ G(
616
+ `signal-severity:${r.severity}`,
617
+ "signal-severity",
618
+ `Signal Severity: ${r.severity}`,
619
+ r
620
+ )
621
+ );
622
+ for (const r of e.topIssueDeltas ?? [])
623
+ n.push(
624
+ G(
625
+ _t(r),
626
+ "top-issue",
627
+ `Top Issue: ${r.message}`,
658
628
  {
659
- family: r,
660
- score: Math.round(i),
661
- measurements: o
629
+ baseline: r.baselineCount,
630
+ current: r.currentCount,
631
+ delta: r.delta
632
+ },
633
+ {
634
+ type: r.type,
635
+ source: r.source,
636
+ severity: r.severity,
637
+ ruleId: r.ruleId,
638
+ projects: r.projects
662
639
  }
663
- ];
664
- })
665
- };
666
- }
667
- function Fe(e) {
668
- const t = /* @__PURE__ */ new Map();
669
- for (const n of e) {
670
- const r = Ct(n), o = t.get(r);
671
- if (o) {
672
- o.issue.count += 1, o.issue.projects = kt(o.issue.projects, n), o.issue.ruleId || (o.issue.ruleId = he(n)), o.issue.sourcePluginId || (o.issue.sourcePluginId = n.sourcePluginId);
673
- continue;
640
+ )
641
+ );
642
+ return n.push({
643
+ id: "violation-footprint",
644
+ kind: "violation-footprint",
645
+ label: "Violation Footprint",
646
+ status: qe(
647
+ e.newViolations.length - e.resolvedViolations.length
648
+ ),
649
+ magnitude: Math.abs(
650
+ e.newViolations.length - e.resolvedViolations.length
651
+ ),
652
+ baseline: e.baseline.violations.length,
653
+ current: e.current.violations.length,
654
+ delta: I(
655
+ e.current.violations.length - e.baseline.violations.length
656
+ ),
657
+ details: {
658
+ newViolations: e.newViolations.length,
659
+ resolvedViolations: e.resolvedViolations.length
674
660
  }
675
- t.set(r, {
676
- issue: {
677
- type: n.type,
678
- source: n.source,
679
- severity: n.severity,
680
- count: 1,
681
- projects: Ve(n),
682
- ruleId: he(n),
683
- message: n.message,
684
- sourcePluginId: n.sourcePluginId
685
- }
686
- });
687
- }
688
- return [...t.values()].map((n) => n.issue).sort($t);
689
- }
690
- function Ct(e) {
691
- return [
692
- e.type,
693
- e.source,
694
- e.severity,
695
- e.sourceProjectId ?? "",
696
- e.targetProjectId ?? "",
697
- e.relatedProjectIds.join(",")
698
- ].join("|");
699
- }
700
- function Ve(e) {
701
- return [
702
- ...new Set(
703
- [
704
- e.sourceProjectId,
705
- e.targetProjectId,
706
- ...e.relatedProjectIds
707
- ].filter((t) => !!t)
708
- )
709
- ].sort((t, n) => t.localeCompare(n));
710
- }
711
- function kt(e, t) {
712
- return [
713
- .../* @__PURE__ */ new Set([...e, ...Ve(t)])
714
- ].sort((n, r) => n.localeCompare(r));
715
- }
716
- function he(e) {
717
- const t = e.metadata?.ruleId;
718
- return typeof t == "string" && t.length > 0 ? t : void 0;
719
- }
720
- function $t(e, t) {
721
- const n = ye[e.severity] - ye[t.severity];
722
- if (n !== 0)
723
- return n;
724
- const r = t.count - e.count;
725
- if (r !== 0)
726
- return r;
727
- const o = B[e.type], i = B[t.type], a = o - i;
728
- if (o !== void 0 && i !== void 0 && a !== 0)
729
- return a;
730
- if (!(e.type in B) || !(t.type in B)) {
731
- const c = e.type.localeCompare(t.type);
732
- if (c !== 0)
733
- return c;
734
- }
735
- const s = ge[e.source] - ge[t.source];
736
- if (s !== 0)
737
- return s;
738
- const d = e.projects.join(",").localeCompare(t.projects.join(","));
739
- return d !== 0 ? d : e.message.localeCompare(t.message);
661
+ }), n.sort(Wt);
740
662
  }
741
- function ie(e, t) {
742
- const n = new Set(e), r = t.filter((i) => n.has(i)), o = e.filter((i) => !t.includes(i)).sort((i, a) => i.localeCompare(a));
743
- return [...r, ...o];
744
- }
745
- function Ur(e) {
746
- const t = $(e.id, "Exception id"), n = Rt(e.source), r = $(e.reason, "Exception reason"), o = $(e.owner, "Exception owner"), i = Mt(e.review), a = Be(e.scope);
747
- if (a.source !== n)
748
- throw new Error(
749
- `Exception "${t}" has source "${n}" but scope source "${a.source}".`
750
- );
663
+ function Ft(e) {
664
+ const t = e.filter((r) => r.status === "worsening").sort(Ce), n = e.filter((r) => r.status === "improving").sort(Ce), o = e.filter(
665
+ (r) => r.status === "stable"
666
+ ).length;
751
667
  return {
752
- id: t,
753
- source: n,
754
- scope: a,
755
- reason: r,
756
- owner: o,
757
- review: i
668
+ overallTrend: t.length > n.length ? "worsening" : n.length > t.length ? "improving" : "stable",
669
+ worseningCount: t.length,
670
+ improvingCount: n.length,
671
+ stableCount: o,
672
+ topWorsening: t.slice(0, 5),
673
+ topImproving: n.slice(0, 5)
758
674
  };
759
675
  }
760
- function Te(e) {
761
- const t = Be(e);
762
- return Ge(t) ? [
763
- t.source,
764
- t.ruleId,
765
- t.projectId,
766
- t.targetProjectId ?? ""
767
- ].join("|") : [
768
- t.source,
769
- t.ruleId ?? "",
770
- t.category ?? "",
771
- t.projectId ?? "",
772
- (t.relatedProjectIds ?? []).join(",")
773
- ].join("|");
774
- }
775
- function Ge(e) {
776
- return e.source === "policy";
676
+ function Se(e, t) {
677
+ return [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].sort((o, r) => o.localeCompare(r)).map((o) => {
678
+ const r = e[o] ?? 0, i = t[o] ?? 0;
679
+ return {
680
+ id: o,
681
+ baseline: r,
682
+ current: i,
683
+ delta: I(i - r)
684
+ };
685
+ });
777
686
  }
778
- function Et(e) {
687
+ function zt(e, t) {
688
+ if (!(!e.health || !t.health))
689
+ return {
690
+ baselineScore: e.health.score,
691
+ currentScore: t.health.score,
692
+ scoreDelta: I(t.health.score - e.health.score),
693
+ baselineStatus: e.health.status,
694
+ currentStatus: t.health.status,
695
+ baselineGrade: e.health.grade,
696
+ currentGrade: t.health.grade
697
+ };
698
+ }
699
+ function Tt(e, t) {
700
+ if (!(!e.signalBreakdown || !t.signalBreakdown))
701
+ return {
702
+ bySource: Rt.map(
703
+ (n) => Nt(
704
+ n,
705
+ Pe(e, n),
706
+ Pe(t, n)
707
+ )
708
+ ),
709
+ byType: Vt.flatMap((n) => {
710
+ const o = je(e, n), r = je(t, n);
711
+ return o === 0 && r === 0 ? [] : [
712
+ {
713
+ type: n,
714
+ baseline: o,
715
+ current: r,
716
+ delta: I(r - o)
717
+ }
718
+ ];
719
+ }),
720
+ bySeverity: Ot.map(
721
+ (n) => qt(
722
+ n,
723
+ be(e, n),
724
+ be(t, n)
725
+ )
726
+ )
727
+ };
728
+ }
729
+ function Lt(e, t) {
730
+ if (!e.metricBreakdown || !t.metricBreakdown)
731
+ return;
732
+ const n = new Map(
733
+ e.metricBreakdown.families.map((r) => [
734
+ r.family,
735
+ r.score
736
+ ])
737
+ ), o = new Map(
738
+ t.metricBreakdown.families.map((r) => [
739
+ r.family,
740
+ r.score
741
+ ])
742
+ );
743
+ return At.flatMap((r) => {
744
+ const i = n.get(r), s = o.get(r);
745
+ return i === void 0 || s === void 0 ? [] : [
746
+ {
747
+ family: r,
748
+ baseline: i,
749
+ current: s,
750
+ delta: I(s - i)
751
+ }
752
+ ];
753
+ });
754
+ }
755
+ function Bt(e, t) {
756
+ if (!e.topIssues || !t.topIssues)
757
+ return;
758
+ const n = new Map(
759
+ e.topIssues.map((i) => [de(i), i])
760
+ ), o = new Map(
761
+ t.topIssues.map((i) => [de(i), i])
762
+ );
763
+ return [.../* @__PURE__ */ new Set([...n.keys(), ...o.keys()])].sort((i, s) => i.localeCompare(s)).map((i) => {
764
+ const s = n.get(i), a = o.get(i), d = a ?? s;
765
+ if (!d)
766
+ throw new Error(`Unable to resolve top issue delta for key "${i}".`);
767
+ const c = [
768
+ .../* @__PURE__ */ new Set([...s?.projects ?? [], ...a?.projects ?? []])
769
+ ].sort((l, u) => l.localeCompare(u));
770
+ return {
771
+ type: d.type,
772
+ source: d.source,
773
+ severity: d.severity,
774
+ ruleId: d.ruleId,
775
+ message: d.message,
776
+ baselineCount: s?.count ?? 0,
777
+ currentCount: a?.count ?? 0,
778
+ delta: I((a?.count ?? 0) - (s?.count ?? 0)),
779
+ projects: c
780
+ };
781
+ });
782
+ }
783
+ function Gt(e, t) {
784
+ const n = new Map(
785
+ (e.deliveryImpact?.indices ?? []).map((i) => [i.id, i])
786
+ ), o = new Map(
787
+ (t.deliveryImpact?.indices ?? []).map((i) => [i.id, i])
788
+ ), r = [...n.keys()].filter((i) => o.has(i)).sort((i, s) => i.localeCompare(s));
789
+ if (r.length !== 0)
790
+ return r.map((i) => {
791
+ const s = n.get(i), a = o.get(i);
792
+ return {
793
+ id: i,
794
+ baselineScore: s.score,
795
+ currentScore: a.score,
796
+ scoreDelta: I(a.score - s.score),
797
+ baselineRisk: s.risk,
798
+ currentRisk: a.risk
799
+ };
800
+ });
801
+ }
802
+ function re(e, t, n, o, r, i) {
803
+ return {
804
+ id: e,
805
+ kind: t,
806
+ label: n,
807
+ status: Ht(o.delta, r),
808
+ magnitude: Math.abs(o.delta),
809
+ baseline: o.baseline,
810
+ current: o.current,
811
+ delta: o.delta,
812
+ details: i
813
+ };
814
+ }
815
+ function G(e, t, n, o, r) {
816
+ return {
817
+ id: e,
818
+ kind: t,
819
+ label: n,
820
+ status: qe(o.delta),
821
+ magnitude: Math.abs(o.delta),
822
+ baseline: o.baseline,
823
+ current: o.current,
824
+ delta: o.delta,
825
+ details: r
826
+ };
827
+ }
828
+ function Nt(e, t, n) {
829
+ return {
830
+ source: e,
831
+ baseline: t,
832
+ current: n,
833
+ delta: I(n - t)
834
+ };
835
+ }
836
+ function qt(e, t, n) {
837
+ return {
838
+ severity: e,
839
+ baseline: t,
840
+ current: n,
841
+ delta: I(n - t)
842
+ };
843
+ }
844
+ function Pe(e, t) {
845
+ return e.signalBreakdown?.bySource.find((n) => n.source === t)?.count ?? 0;
846
+ }
847
+ function je(e, t) {
848
+ return e.signalBreakdown?.byType.find((n) => n.type === t)?.count ?? 0;
849
+ }
850
+ function be(e, t) {
851
+ return e.signalBreakdown?.bySeverity.find(
852
+ (n) => n.severity === t
853
+ )?.count ?? 0;
854
+ }
855
+ function de(e) {
856
+ return [
857
+ e.type,
858
+ e.source,
859
+ e.severity,
860
+ e.ruleId ?? "",
861
+ e.message
862
+ ].join("|");
863
+ }
864
+ function _t(e) {
865
+ return `top-issue:${de(e)}`;
866
+ }
867
+ function Wt(e, t) {
868
+ return e.id.localeCompare(t.id);
869
+ }
870
+ function Ce(e, t) {
871
+ return t.magnitude - e.magnitude || e.id.localeCompare(t.id);
872
+ }
873
+ function Ht(e, t) {
874
+ return Math.abs(e) < t ? "stable" : e > 0 ? "improving" : "worsening";
875
+ }
876
+ function qe(e) {
877
+ return e === 0 ? "stable" : e < 0 ? "improving" : "worsening";
878
+ }
879
+ function Ut(e) {
880
+ return e.split("-").map((t) => t[0]?.toUpperCase() + t.slice(1)).join(" ");
881
+ }
882
+ function Kt(e) {
883
+ return e[0].toUpperCase() + e.slice(1);
884
+ }
885
+ function Yt(e) {
886
+ return e.split("-").map((t) => t[0]?.toUpperCase() + t.slice(1)).join(" ");
887
+ }
888
+ function I(e) {
889
+ return Math.round(e * 1e3) / 1e3;
890
+ }
891
+ function xe(e, t) {
892
+ return e.some(
893
+ (n) => n.type === t.type && n.source === t.source && n.target === t.target
894
+ );
895
+ }
896
+ function _e(e, t, n) {
897
+ return {
898
+ totalCount: e,
899
+ selectedCount: t,
900
+ limit: n,
901
+ truncated: t < e
902
+ };
903
+ }
904
+ function h(e, t, n) {
905
+ const o = We(t, e.length), r = [...e].sort(n), i = r.slice(0, o);
906
+ return {
907
+ items: i,
908
+ truncation: _e(
909
+ r.length,
910
+ i.length,
911
+ o
912
+ )
913
+ };
914
+ }
915
+ function Jt(e, t, n) {
916
+ const o = new Set(t), r = e.filter(
917
+ (i) => o.has(i.source) || o.has(i.target)
918
+ );
919
+ return h(
920
+ r,
921
+ n,
922
+ Xt
923
+ );
924
+ }
925
+ function _(e, t) {
926
+ return De(t.severity) - De(e.severity) || (e.source ?? "").localeCompare(t.source ?? "") || (e.type ?? "").localeCompare(t.type ?? "") || (e.target ?? "").localeCompare(t.target ?? "");
927
+ }
928
+ function Ir(e) {
929
+ me(e.request, "root-cause");
930
+ const t = e.dependencies ?? e.request.inputs.dependencies ?? [], n = e.topViolations ?? e.request.inputs.topViolations ?? [], o = e.projectScope ? new Set(e.projectScope) : Qt(n), r = Jt(
931
+ t,
932
+ o,
933
+ e.dependencyLimit
934
+ ), i = e.request.inputs.snapshot?.violations.length ?? n.length, s = We(
935
+ e.topViolationsLimit,
936
+ n.length
937
+ ), a = {
938
+ projectScopeCount: o.size,
939
+ dependencies: r.truncation,
940
+ violations: _e(
941
+ i,
942
+ n.length,
943
+ s
944
+ )
945
+ };
946
+ return {
947
+ request: {
948
+ ...e.request,
949
+ inputs: {
950
+ ...e.request.inputs,
951
+ topViolations: n,
952
+ dependencies: r.items,
953
+ metadata: He(
954
+ e.request.inputs.metadata,
955
+ a
956
+ )
957
+ }
958
+ },
959
+ payloadScope: a
960
+ };
961
+ }
962
+ function Sr(e) {
963
+ me(e.request, "drift");
964
+ const t = e.comparison ?? e.request.inputs.comparison, n = e.signals ?? [], o = e.summary, r = h(
965
+ n,
966
+ e.signalLimit,
967
+ Zt
968
+ ), i = h(
969
+ t?.metricDeltas ?? [],
970
+ e.deltaLimit,
971
+ W
972
+ ), s = h(
973
+ t?.scoreDeltas ?? [],
974
+ e.deltaLimit,
975
+ W
976
+ ), a = h(
977
+ t?.newViolations ?? [],
978
+ e.violationLimit,
979
+ _
980
+ ), d = h(
981
+ t?.resolvedViolations ?? [],
982
+ e.violationLimit,
983
+ _
984
+ ), c = {
985
+ signals: r.truncation,
986
+ metricDeltas: i.truncation,
987
+ scoreDeltas: s.truncation,
988
+ newViolations: a.truncation,
989
+ resolvedViolations: d.truncation
990
+ };
991
+ return {
992
+ request: {
993
+ ...e.request,
994
+ inputs: {
995
+ ...e.request.inputs,
996
+ comparison: t ? {
997
+ ...t,
998
+ baseline: H(t.baseline),
999
+ current: H(t.current),
1000
+ metricDeltas: i.items,
1001
+ scoreDeltas: s.items,
1002
+ newViolations: a.items,
1003
+ resolvedViolations: d.items
1004
+ } : void 0,
1005
+ metadata: {
1006
+ ...e.request.inputs.metadata ?? {},
1007
+ signals: r.items,
1008
+ ...o ? { driftSummary: o } : {},
1009
+ payloadScope: Ke(
1010
+ Ue(e.request.inputs.metadata),
1011
+ c
1012
+ )
1013
+ }
1014
+ }
1015
+ },
1016
+ payloadScope: c
1017
+ };
1018
+ }
1019
+ function Pr(e) {
1020
+ me(e.request, "scorecard");
1021
+ const t = e.snapshot ?? e.request.inputs.snapshot, n = e.comparison ?? e.request.inputs.comparison, o = h(
1022
+ t?.violations ?? [],
1023
+ e.violationLimit,
1024
+ _
1025
+ ), r = h(
1026
+ n?.metricDeltas ?? [],
1027
+ e.deltaLimit,
1028
+ W
1029
+ ), i = h(
1030
+ n?.scoreDeltas ?? [],
1031
+ e.deltaLimit,
1032
+ W
1033
+ ), s = {
1034
+ snapshotViolations: o.truncation,
1035
+ metricDeltas: r.truncation,
1036
+ scoreDeltas: i.truncation
1037
+ };
1038
+ return {
1039
+ request: {
1040
+ ...e.request,
1041
+ inputs: {
1042
+ ...e.request.inputs,
1043
+ snapshot: t ? {
1044
+ ...t,
1045
+ violations: o.items
1046
+ } : void 0,
1047
+ comparison: n ? {
1048
+ ...n,
1049
+ baseline: {
1050
+ ...H(n.baseline),
1051
+ violations: []
1052
+ },
1053
+ current: {
1054
+ ...H(n.current),
1055
+ violations: []
1056
+ },
1057
+ metricDeltas: r.items,
1058
+ scoreDeltas: i.items,
1059
+ newViolations: [],
1060
+ resolvedViolations: []
1061
+ } : void 0,
1062
+ metadata: He(
1063
+ e.request.inputs.metadata,
1064
+ s
1065
+ )
1066
+ }
1067
+ },
1068
+ payloadScope: s
1069
+ };
1070
+ }
1071
+ function Xt(e, t) {
1072
+ return e.source.localeCompare(t.source) || e.target.localeCompare(t.target) || e.type.localeCompare(t.type) || (e.sourceFile ?? "").localeCompare(t.sourceFile ?? "");
1073
+ }
1074
+ function Zt(e, t) {
1075
+ return t.magnitude - e.magnitude || e.id.localeCompare(t.id);
1076
+ }
1077
+ function W(e, t) {
1078
+ return Math.abs(t.delta) - Math.abs(e.delta) || e.id.localeCompare(t.id);
1079
+ }
1080
+ function De(e) {
1081
+ return e === "error" ? 3 : e === "warning" ? 2 : e === "info" ? 1 : 0;
1082
+ }
1083
+ function Qt(e) {
1084
+ const t = /* @__PURE__ */ new Set();
1085
+ for (const n of e)
1086
+ t.add(n.source), n.target && t.add(n.target);
1087
+ return t;
1088
+ }
1089
+ function me(e, t) {
1090
+ if (e.kind !== t)
1091
+ throw new Error(
1092
+ `Expected an AI analysis request of kind "${t}", received "${e.kind}".`
1093
+ );
1094
+ }
1095
+ function We(e, t) {
1096
+ return typeof e != "number" || Number.isNaN(e) ? t : Math.max(0, Math.trunc(e));
1097
+ }
1098
+ function H(e) {
1099
+ return {
1100
+ timestamp: e.timestamp,
1101
+ repo: e.repo,
1102
+ branch: e.branch,
1103
+ commitSha: e.commitSha,
1104
+ pluginVersion: e.pluginVersion,
1105
+ metricSchemaVersion: e.metricSchemaVersion,
1106
+ metrics: {},
1107
+ scores: {},
1108
+ violations: []
1109
+ };
1110
+ }
1111
+ function He(e, t) {
1112
+ return {
1113
+ ...e,
1114
+ payloadScope: Ke(Ue(e), t)
1115
+ };
1116
+ }
1117
+ function Ue(e) {
1118
+ const t = e?.payloadScope;
1119
+ if (!(typeof t != "object" || t === null || Array.isArray(t)))
1120
+ return t;
1121
+ }
1122
+ function Ke(e, t) {
1123
+ return {
1124
+ ...e ?? {},
1125
+ ...t
1126
+ };
1127
+ }
1128
+ function en(e, t, n) {
1129
+ const o = t.map((r) => ({
1130
+ id: `drift-${r.id}`,
1131
+ title: r.label,
1132
+ detail: `Status is ${r.status} with delta ${rn(
1133
+ r.delta
1134
+ )} and magnitude ${r.magnitude.toFixed(3)}.`,
1135
+ signals: ["drift-analysis", "snapshot-comparison"],
1136
+ confidence: 1
1137
+ }));
1138
+ return {
1139
+ kind: "drift",
1140
+ summary: `Deterministic drift interpretation indicates a ${n.overallTrend} trend (${n.worseningCount} worsening, ${n.improvingCount} improving, ${n.stableCount} stable).`,
1141
+ findings: o,
1142
+ recommendations: [
1143
+ {
1144
+ id: "drift-review-regressing-signals",
1145
+ title: "Review Regressing Signals First",
1146
+ priority: n.worseningCount > 0 ? "high" : "low",
1147
+ reason: n.worseningCount > 0 ? `There are ${n.worseningCount} worsening drift signals. Prioritize investigation of those signals before broader refactoring.` : "No worsening drift signals were detected in this comparison window."
1148
+ },
1149
+ {
1150
+ id: "drift-validate-trend-window",
1151
+ title: "Validate Trend Window Confidence",
1152
+ priority: "medium",
1153
+ reason: on(e) ? "Fewer than four snapshots were available. Treat conclusions as provisional and continue collecting trend data." : "Trend window is sufficient for directional interpretation. Continue monitoring for persistence across future snapshots."
1154
+ }
1155
+ ],
1156
+ metadata: {
1157
+ trend: n.overallTrend,
1158
+ worseningCount: n.worseningCount,
1159
+ improvingCount: n.improvingCount,
1160
+ stableCount: n.stableCount,
1161
+ signalCount: t.length,
1162
+ topWorsening: n.topWorsening,
1163
+ topImproving: n.topImproving,
1164
+ ...e.inputs.metadata
1165
+ }
1166
+ };
1167
+ }
1168
+ const jr = en;
1169
+ function br(e) {
1170
+ const t = Ye(
1171
+ e.affectedProjects,
1172
+ e.projects
1173
+ ), n = e.dependencies.filter(
1174
+ (r) => t.projectNames.has(r.source) || t.projectNames.has(r.target)
1175
+ ), o = fe(
1176
+ t.projects.map((r) => r.domain).filter((r) => !!r)
1177
+ );
1178
+ return {
1179
+ changedFilesCount: e.changedFilesCount ?? e.changedFiles?.length ?? 0,
1180
+ affectedProjects: [...t.projectNames].sort(
1181
+ (r, i) => r.localeCompare(i)
1182
+ ),
1183
+ affectedProjectsCount: t.projectNames.size,
1184
+ affectedDomains: o,
1185
+ affectedDomainCount: o.length,
1186
+ scopedDependencyCount: n.length,
1187
+ crossDomainDependencyEdges: Je(
1188
+ n,
1189
+ t.projectsByName
1190
+ )
1191
+ };
1192
+ }
1193
+ function Cr(e) {
1194
+ const t = Ye(
1195
+ e.selectedProjects,
1196
+ e.projects
1197
+ ), n = e.dependencies.filter(
1198
+ (c) => t.projectNames.has(c.source) || t.projectNames.has(c.target)
1199
+ ), o = /* @__PURE__ */ new Map();
1200
+ for (const c of n)
1201
+ t.projectNames.has(c.source) && o.set(
1202
+ c.source,
1203
+ (o.get(c.source) ?? 0) + 1
1204
+ );
1205
+ const r = [...o.values()], i = r.length > 0 ? Number(
1206
+ (r.reduce((c, l) => c + l, 0) / r.length).toFixed(2)
1207
+ ) : 0, s = r.length > 0 ? Math.max(...r) : 0, a = fe(
1208
+ t.projects.map((c) => c.domain).filter((c) => !!c)
1209
+ ), d = [...o.entries()].sort(
1210
+ (c, l) => l[1] - c[1] || c[0].localeCompare(l[0])
1211
+ ).slice(0, Math.max(1, e.topProjectsLimit ?? 10)).map(([c, l]) => ({ project: c, fanout: l }));
1212
+ return {
1213
+ scope: e.scope ?? "workspace",
1214
+ ...e.project ? { project: e.project } : {},
1215
+ ...e.domain ? { domain: e.domain } : {},
1216
+ selectedProjects: [...t.projectNames].sort(
1217
+ (c, l) => c.localeCompare(l)
1218
+ ),
1219
+ selectedProjectsCount: t.projectNames.size,
1220
+ affectedDomains: a,
1221
+ affectedDomainCount: a.length,
1222
+ scopedDependencyCount: n.length,
1223
+ crossDomainDependencyEdges: Je(
1224
+ n,
1225
+ t.projectsByName
1226
+ ),
1227
+ averageFanout: i,
1228
+ maxFanout: s,
1229
+ topFanoutProjects: d
1230
+ };
1231
+ }
1232
+ function xr(e) {
1233
+ return e.filter((t) => t.status === "worsening").length;
1234
+ }
1235
+ function Dr(e) {
1236
+ const t = e.summary ?? Ft([...e.signals]), n = e.snapshotCount ?? 0;
1237
+ return {
1238
+ overallTrend: t.overallTrend,
1239
+ worseningSignalCount: t.worseningCount,
1240
+ improvingSignalCount: t.improvingCount,
1241
+ stableSignalCount: t.stableCount,
1242
+ signalCount: e.signals.length,
1243
+ snapshotCount: n,
1244
+ trendWindowInsufficient: n > 0 && n < 4
1245
+ };
1246
+ }
1247
+ function tn(e) {
1248
+ const t = Math.max(1, e.minimumOccurrences ?? 2), n = /* @__PURE__ */ new Map();
1249
+ for (const o of e.recentSnapshots) {
1250
+ const r = new Set(
1251
+ o.violations.map(
1252
+ (i) => nn(i)
1253
+ )
1254
+ );
1255
+ for (const i of r)
1256
+ n.set(i, (n.get(i) ?? 0) + 1);
1257
+ }
1258
+ return [...n.entries()].filter(([, o]) => o >= t).map(([o, r]) => {
1259
+ const [i, s] = o.split("|");
1260
+ return {
1261
+ type: i ?? "unknown",
1262
+ source: s ?? "unknown",
1263
+ count: r
1264
+ };
1265
+ }).sort(
1266
+ (o, r) => r.count - o.count || o.type.localeCompare(r.type) || o.source.localeCompare(r.source)
1267
+ );
1268
+ }
1269
+ function kr(e) {
1270
+ const t = h(
1271
+ e.violations,
1272
+ e.analyzedViolationsLimit ?? 10,
1273
+ _
1274
+ ).items, n = /* @__PURE__ */ new Map();
1275
+ for (const l of t)
1276
+ n.set(
1277
+ l.source,
1278
+ (n.get(l.source) ?? 0) + 1
1279
+ );
1280
+ const o = /* @__PURE__ */ new Map();
1281
+ for (const l of e.dependencies)
1282
+ o.set(
1283
+ l.source,
1284
+ (o.get(l.source) ?? 0) + 1
1285
+ );
1286
+ const r = Math.max(1, e.topProjectsLimit ?? 5), i = [...n.entries()].sort(
1287
+ (l, u) => u[1] - l[1] || l[0].localeCompare(u[0])
1288
+ ).slice(0, r).map(([l, u]) => ({ project: l, count: u })), s = [...o.entries()].sort(
1289
+ (l, u) => u[1] - l[1] || l[0].localeCompare(u[0])
1290
+ ).slice(0, r).map(([l, u]) => ({ project: l, count: u })), a = new Map(
1291
+ e.projects.map((l) => [l.name, l])
1292
+ ), d = fe(
1293
+ i.map((l) => a.get(l.project)?.domain).filter((l) => !!l)
1294
+ ), c = e.recentSnapshots ?? [];
1295
+ return {
1296
+ analyzedViolations: t.length,
1297
+ totalViolations: e.violations.length,
1298
+ hotspotProjects: i,
1299
+ highFanoutProjects: s,
1300
+ hotspotDomains: d,
1301
+ persistentSmellSignals: tn({
1302
+ recentSnapshots: c,
1303
+ minimumOccurrences: e.minimumPersistentOccurrences
1304
+ }),
1305
+ snapshotCount: c.length,
1306
+ sampledSnapshotCount: c.length
1307
+ };
1308
+ }
1309
+ function $r(e) {
1310
+ const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1311
+ for (const a of e.projects)
1312
+ a.domain && t.set(
1313
+ a.domain,
1314
+ (t.get(a.domain) ?? 0) + 1
1315
+ ), a.layer && n.set(a.layer, (n.get(a.layer) ?? 0) + 1);
1316
+ for (const a of e.dependencies)
1317
+ o.set(
1318
+ a.source,
1319
+ (o.get(a.source) ?? 0) + 1
1320
+ );
1321
+ const r = Math.max(1, e.topProjectsLimit ?? 5), i = e.projects.filter(
1322
+ (a) => !!a.ownership?.team
1323
+ ).length, s = e.topViolations?.length ?? 0;
1324
+ return {
1325
+ projectCount: e.projects.length,
1326
+ dependencyCount: e.dependencies.length,
1327
+ ownershipCoverage: e.projects.length > 0 ? Number((i / e.projects.length).toFixed(3)) : 0,
1328
+ domainSummary: [...t.entries()].sort(
1329
+ (a, d) => d[1] - a[1] || a[0].localeCompare(d[0])
1330
+ ).map(([a, d]) => ({ domain: a, count: d })),
1331
+ layerSummary: [...n.entries()].sort(
1332
+ (a, d) => d[1] - a[1] || a[0].localeCompare(d[0])
1333
+ ).map(([a, d]) => ({ layer: a, count: d })),
1334
+ topFanoutProjects: [...o.entries()].sort(
1335
+ (a, d) => d[1] - a[1] || a[0].localeCompare(d[0])
1336
+ ).slice(0, r).map(([a, d]) => ({ project: a, count: d })),
1337
+ analyzedViolations: s,
1338
+ totalViolations: e.totalViolationsCount ?? s
1339
+ };
1340
+ }
1341
+ function Ye(e, t) {
1342
+ const n = /* @__PURE__ */ new Set(), o = [], r = /* @__PURE__ */ new Map();
1343
+ if (e.length > 0 && typeof e[0] == "object" && e[0] !== null)
1344
+ for (const i of e)
1345
+ n.add(i.name), o.push(i), r.set(i.name, i);
1346
+ else {
1347
+ const i = new Map(
1348
+ (t ?? []).map((s) => [s.name, s])
1349
+ );
1350
+ for (const s of e) {
1351
+ n.add(s);
1352
+ const a = i.get(s);
1353
+ a && (o.push(a), r.set(a.name, a));
1354
+ }
1355
+ }
1356
+ return {
1357
+ projectNames: n,
1358
+ projects: o.sort(
1359
+ (i, s) => i.name.localeCompare(s.name)
1360
+ ),
1361
+ projectsByName: r
1362
+ };
1363
+ }
1364
+ function Je(e, t) {
1365
+ return e.filter((n) => {
1366
+ const o = t.get(n.source)?.domain, r = t.get(n.target)?.domain;
1367
+ return !!(o && r && o !== r);
1368
+ }).length;
1369
+ }
1370
+ function nn(e) {
1371
+ return `${e.type}|${e.source}`;
1372
+ }
1373
+ function fe(e) {
1374
+ return [...new Set(e)].sort((t, n) => t.localeCompare(n));
1375
+ }
1376
+ function on(e) {
1377
+ return e.inputs.metadata?.trendWindowInsufficient === !0;
1378
+ }
1379
+ function rn(e) {
1380
+ return `${e > 0 ? "+" : ""}${e.toFixed(3)}`;
1381
+ }
1382
+ const ie = [
1383
+ "graph",
1384
+ "conformance",
1385
+ "policy",
1386
+ "extension"
1387
+ ], sn = [
1388
+ "info",
1389
+ "warning",
1390
+ "error"
1391
+ ], an = [
1392
+ "structural-dependency",
1393
+ "cross-domain-dependency",
1394
+ "missing-domain-context",
1395
+ "circular-dependency",
1396
+ "conformance-violation",
1397
+ "domain-boundary-violation",
1398
+ "layer-boundary-violation",
1399
+ "ownership-gap"
1400
+ ], cn = [
1401
+ "architecture",
1402
+ "boundaries",
1403
+ "ownership",
1404
+ "documentation"
1405
+ ], ke = {
1406
+ graph: 0,
1407
+ conformance: 1,
1408
+ policy: 2,
1409
+ extension: 3
1410
+ }, N = {
1411
+ "structural-dependency": 0,
1412
+ "cross-domain-dependency": 1,
1413
+ "missing-domain-context": 2,
1414
+ "circular-dependency": 3,
1415
+ "conformance-violation": 4,
1416
+ "domain-boundary-violation": 5,
1417
+ "layer-boundary-violation": 6,
1418
+ "ownership-gap": 7
1419
+ }, $e = {
1420
+ error: 0,
1421
+ warning: 1,
1422
+ info: 2
1423
+ };
1424
+ function dn(e) {
1425
+ const t = ln(
1426
+ e.violations,
1427
+ e.reportType
1428
+ ), n = pn(
1429
+ e.signals,
1430
+ e.reportType
1431
+ ), o = un(
1432
+ e.measurements,
1433
+ e.reportType
1434
+ );
1435
+ return {
1436
+ workspace: e.workspace,
1437
+ profile: e.profile,
1438
+ warnings: [...e.warnings ?? []],
1439
+ exceptions: e.exceptions,
1440
+ violations: t,
1441
+ measurements: o,
1442
+ signalBreakdown: mn(n),
1443
+ metricBreakdown: fn(o),
1444
+ topIssues: Xe(n),
1445
+ health: e.health,
1446
+ recommendations: [...e.recommendations ?? []]
1447
+ };
1448
+ }
1449
+ function ln(e, t) {
1450
+ return t === "boundaries" ? e.filter((n) => n.category === "boundary") : t === "ownership" ? e.filter((n) => n.category === "ownership") : t === "architecture" ? e.filter((n) => n.category !== "ownership") : e;
1451
+ }
1452
+ function un(e, t) {
1453
+ return t === "boundaries" ? e.filter(
1454
+ (n) => n.family === "boundaries"
1455
+ ) : t === "ownership" ? e.filter(
1456
+ (n) => n.family === "ownership"
1457
+ ) : t === "architecture" ? e.filter(
1458
+ (n) => n.family !== "ownership" && n.family !== "documentation"
1459
+ ) : e;
1460
+ }
1461
+ function pn(e, t) {
1462
+ return t === "boundaries" ? e.filter((n) => n.category === "boundary") : t === "ownership" ? e.filter((n) => n.category === "ownership") : t === "architecture" ? e.filter((n) => n.category !== "ownership") : e;
1463
+ }
1464
+ function mn(e) {
1465
+ const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1466
+ for (const r of e)
1467
+ t.set(r.source, (t.get(r.source) ?? 0) + 1), n.set(r.type, (n.get(r.type) ?? 0) + 1), o.set(
1468
+ r.severity,
1469
+ (o.get(r.severity) ?? 0) + 1
1470
+ );
1471
+ return {
1472
+ total: e.length,
1473
+ bySource: [
1474
+ ...ie.map((r) => ({
1475
+ source: r,
1476
+ count: t.get(r) ?? 0
1477
+ })),
1478
+ ...le(
1479
+ [...t.keys()],
1480
+ ie
1481
+ ).filter((r) => !ie.includes(r)).map((r) => ({
1482
+ source: r,
1483
+ count: t.get(r) ?? 0
1484
+ }))
1485
+ ],
1486
+ byType: le(
1487
+ [...n.keys()],
1488
+ an
1489
+ ).flatMap((r) => {
1490
+ const i = n.get(r) ?? 0;
1491
+ return i > 0 ? [{ type: r, count: i }] : [];
1492
+ }),
1493
+ bySeverity: sn.map((r) => ({
1494
+ severity: r,
1495
+ count: o.get(r) ?? 0
1496
+ }))
1497
+ };
1498
+ }
1499
+ function fn(e) {
1500
+ const t = /* @__PURE__ */ new Map();
1501
+ for (const o of e) {
1502
+ const r = t.get(o.family) ?? [];
1503
+ r.push(o), t.set(o.family, r);
1504
+ }
1505
+ return {
1506
+ families: le(
1507
+ [...t.keys()],
1508
+ cn
1509
+ ).flatMap((o) => {
1510
+ const r = (t.get(o) ?? []).slice().sort((s, a) => s.id.localeCompare(a.id)).map((s) => ({
1511
+ id: s.id,
1512
+ name: s.name,
1513
+ score: s.score
1514
+ }));
1515
+ if (r.length === 0)
1516
+ return [];
1517
+ const i = r.reduce(
1518
+ (s, a) => s + a.score,
1519
+ 0
1520
+ ) / r.length;
1521
+ return [
1522
+ {
1523
+ family: o,
1524
+ score: Math.round(i),
1525
+ measurements: r
1526
+ }
1527
+ ];
1528
+ })
1529
+ };
1530
+ }
1531
+ function Xe(e) {
1532
+ const t = /* @__PURE__ */ new Map();
1533
+ for (const n of e) {
1534
+ const o = gn(n), r = t.get(o);
1535
+ if (r) {
1536
+ r.issue.count += 1, r.issue.projects = yn(r.issue.projects, n), r.issue.ruleId || (r.issue.ruleId = Me(n)), r.issue.sourcePluginId || (r.issue.sourcePluginId = n.sourcePluginId);
1537
+ continue;
1538
+ }
1539
+ t.set(o, {
1540
+ issue: {
1541
+ type: n.type,
1542
+ source: n.source,
1543
+ severity: n.severity,
1544
+ count: 1,
1545
+ projects: Ze(n),
1546
+ ruleId: Me(n),
1547
+ message: n.message,
1548
+ sourcePluginId: n.sourcePluginId
1549
+ }
1550
+ });
1551
+ }
1552
+ return [...t.values()].map((n) => n.issue).sort(hn);
1553
+ }
1554
+ function gn(e) {
1555
+ return [
1556
+ e.type,
1557
+ e.source,
1558
+ e.severity,
1559
+ e.sourceProjectId ?? "",
1560
+ e.targetProjectId ?? "",
1561
+ e.relatedProjectIds.join(",")
1562
+ ].join("|");
1563
+ }
1564
+ function Ze(e) {
1565
+ return [
1566
+ ...new Set(
1567
+ [
1568
+ e.sourceProjectId,
1569
+ e.targetProjectId,
1570
+ ...e.relatedProjectIds
1571
+ ].filter((t) => !!t)
1572
+ )
1573
+ ].sort((t, n) => t.localeCompare(n));
1574
+ }
1575
+ function yn(e, t) {
1576
+ return [
1577
+ .../* @__PURE__ */ new Set([...e, ...Ze(t)])
1578
+ ].sort((n, o) => n.localeCompare(o));
1579
+ }
1580
+ function Me(e) {
1581
+ const t = e.metadata?.ruleId;
1582
+ return typeof t == "string" && t.length > 0 ? t : void 0;
1583
+ }
1584
+ function hn(e, t) {
1585
+ const n = $e[e.severity] - $e[t.severity];
1586
+ if (n !== 0)
1587
+ return n;
1588
+ const o = t.count - e.count;
1589
+ if (o !== 0)
1590
+ return o;
1591
+ const r = N[e.type], i = N[t.type], s = r - i;
1592
+ if (r !== void 0 && i !== void 0 && s !== 0)
1593
+ return s;
1594
+ if (!(e.type in N) || !(t.type in N)) {
1595
+ const c = e.type.localeCompare(t.type);
1596
+ if (c !== 0)
1597
+ return c;
1598
+ }
1599
+ const a = ke[e.source] - ke[t.source];
1600
+ if (a !== 0)
1601
+ return a;
1602
+ const d = e.projects.join(",").localeCompare(t.projects.join(","));
1603
+ return d !== 0 ? d : e.message.localeCompare(t.message);
1604
+ }
1605
+ function le(e, t) {
1606
+ const n = new Set(e), o = t.filter((i) => n.has(i)), r = e.filter((i) => !t.includes(i)).sort((i, s) => i.localeCompare(s));
1607
+ return [...o, ...r];
1608
+ }
1609
+ function Mr(e) {
1610
+ const t = M(e.id, "Exception id"), n = In(e.source), o = M(e.reason, "Exception reason"), r = M(e.owner, "Exception owner"), i = wn(e.review), s = tt(e.scope);
1611
+ if (s.source !== n)
1612
+ throw new Error(
1613
+ `Exception "${t}" has source "${n}" but scope source "${s.source}".`
1614
+ );
1615
+ return {
1616
+ id: t,
1617
+ source: n,
1618
+ scope: s,
1619
+ reason: o,
1620
+ owner: r,
1621
+ review: i
1622
+ };
1623
+ }
1624
+ function Qe(e) {
1625
+ const t = tt(e);
1626
+ return et(t) ? [
1627
+ t.source,
1628
+ t.ruleId,
1629
+ t.projectId,
1630
+ t.targetProjectId ?? ""
1631
+ ].join("|") : [
1632
+ t.source,
1633
+ t.ruleId ?? "",
1634
+ t.category ?? "",
1635
+ t.projectId ?? "",
1636
+ (t.relatedProjectIds ?? []).join(",")
1637
+ ].join("|");
1638
+ }
1639
+ function et(e) {
1640
+ return e.source === "policy";
1641
+ }
1642
+ function vn(e) {
779
1643
  return e.source === "conformance";
780
1644
  }
781
- function Mt(e) {
782
- const t = h(e.createdAt), n = h(e.reviewBy), r = h(e.expiresAt);
783
- if (!n && !r)
1645
+ function wn(e) {
1646
+ const t = v(e.createdAt), n = v(e.reviewBy), o = v(e.expiresAt);
1647
+ if (!n && !o)
784
1648
  throw new Error(
785
1649
  "Governance exception review must define reviewBy or expiresAt."
786
1650
  );
787
1651
  return {
788
1652
  ...t ? { createdAt: t } : {},
789
1653
  ...n ? { reviewBy: n } : {},
790
- ...r ? { expiresAt: r } : {}
1654
+ ...o ? { expiresAt: o } : {}
791
1655
  };
792
1656
  }
793
- function Be(e) {
1657
+ function tt(e) {
794
1658
  if (e.source === "policy")
795
1659
  return {
796
1660
  source: "policy",
797
- ruleId: $(e.ruleId, "Policy exception ruleId"),
798
- projectId: $(
1661
+ ruleId: M(e.ruleId, "Policy exception ruleId"),
1662
+ projectId: M(
799
1663
  e.projectId,
800
1664
  "Policy exception projectId"
801
1665
  ),
802
- ...h(e.targetProjectId) ? { targetProjectId: h(e.targetProjectId) } : {}
1666
+ ...v(e.targetProjectId) ? { targetProjectId: v(e.targetProjectId) } : {}
803
1667
  };
804
- const t = h(e.ruleId), n = At(e.category), r = h(e.projectId), o = Ot(e.relatedProjectIds);
805
- if (!t && !n && !r && o.length === 0)
1668
+ const t = v(e.ruleId), n = Pn(e.category), o = v(e.projectId), r = Sn(e.relatedProjectIds);
1669
+ if (!t && !n && !o && r.length === 0)
806
1670
  throw new Error(
807
1671
  "Conformance exception scope must define ruleId, category, projectId, or relatedProjectIds."
808
1672
  );
@@ -810,54 +1674,54 @@ function Be(e) {
810
1674
  source: "conformance",
811
1675
  ...t ? { ruleId: t } : {},
812
1676
  ...n ? { category: n } : {},
813
- ...r ? { projectId: r } : {},
814
- ...o.length > 0 ? { relatedProjectIds: o } : {}
1677
+ ...o ? { projectId: o } : {},
1678
+ ...r.length > 0 ? { relatedProjectIds: r } : {}
815
1679
  };
816
1680
  }
817
- function Rt(e) {
1681
+ function In(e) {
818
1682
  if (e === "policy" || e === "conformance")
819
1683
  return e;
820
1684
  throw new Error(`Unsupported governance exception source "${e}".`);
821
1685
  }
822
- function $(e, t) {
823
- const n = h(e);
1686
+ function M(e, t) {
1687
+ const n = v(e);
824
1688
  if (!n)
825
1689
  throw new Error(`${t} is required.`);
826
1690
  return n;
827
1691
  }
828
- function h(e) {
1692
+ function v(e) {
829
1693
  if (typeof e != "string")
830
1694
  return;
831
1695
  const t = e.trim();
832
1696
  return t.length > 0 ? t : void 0;
833
1697
  }
834
- function Ot(e) {
1698
+ function Sn(e) {
835
1699
  return Array.isArray(e) ? [
836
1700
  ...new Set(
837
- e.map(h).filter((t) => !!t)
1701
+ e.map(v).filter((t) => !!t)
838
1702
  )
839
1703
  ].sort((t, n) => t.localeCompare(n)) : [];
840
1704
  }
841
- function At(e) {
842
- return h(e);
1705
+ function Pn(e) {
1706
+ return v(e);
843
1707
  }
844
- const ve = {
1708
+ const Ee = {
845
1709
  policy: 0,
846
1710
  conformance: 1
847
- }, Ie = {
1711
+ }, Re = {
848
1712
  error: 0,
849
1713
  warning: 1,
850
1714
  info: 2
851
1715
  };
852
- function zt(e, t) {
853
- const n = t.getTime(), r = Se(e.review.expiresAt);
854
- if (r !== void 0 && r < n)
1716
+ function jn(e, t) {
1717
+ const n = t.getTime(), o = Ae(e.review.expiresAt);
1718
+ if (o !== void 0 && o < n)
855
1719
  return {
856
1720
  exception: e,
857
1721
  status: "expired"
858
1722
  };
859
- const o = Se(e.review.reviewBy);
860
- return o !== void 0 && o < n ? {
1723
+ const r = Ae(e.review.reviewBy);
1724
+ return r !== void 0 && r < n ? {
861
1725
  exception: e,
862
1726
  status: "stale"
863
1727
  } : {
@@ -865,93 +1729,93 @@ function zt(e, t) {
865
1729
  status: "active"
866
1730
  };
867
1731
  }
868
- function Le(e) {
1732
+ function nt(e) {
869
1733
  const t = e.exceptions.map(
870
- (c) => zt(c, e.asOf)
1734
+ (c) => jn(c, e.asOf)
871
1735
  ), n = Object.fromEntries(
872
1736
  t.map((c) => [c.exception.id, c.status])
873
- ), r = t.filter((c) => c.status === "active").map((c) => c.exception), o = t.filter(
1737
+ ), o = t.filter((c) => c.status === "active").map((c) => c.exception), r = t.filter(
874
1738
  (c) => c.status !== "active"
875
1739
  ), i = e.policyViolations.map(
876
- (c) => Vt(c, r)
877
- ), a = e.conformanceFindings.map(
878
- (c) => Tt(c, r)
879
- ), s = e.policyViolations.map(
880
- (c) => Gt(c, o)
881
- ).filter(M), d = e.conformanceFindings.map(
882
- (c) => Bt(c, o)
883
- ).filter(M);
1740
+ (c) => Cn(c, o)
1741
+ ), s = e.conformanceFindings.map(
1742
+ (c) => xn(c, o)
1743
+ ), a = e.policyViolations.map(
1744
+ (c) => Dn(c, r)
1745
+ ).filter(R), d = e.conformanceFindings.map(
1746
+ (c) => kn(c, r)
1747
+ ).filter(R);
884
1748
  return {
885
1749
  declaredExceptions: [...e.exceptions],
886
1750
  exceptionStatuses: n,
887
1751
  policyViolations: i,
888
- conformanceFindings: a,
1752
+ conformanceFindings: s,
889
1753
  activePolicyViolations: i.filter((c) => c.outcome === "active").map((c) => c.finding),
890
- suppressedPolicyViolations: i.filter(be),
891
- reactivatedPolicyViolations: s,
892
- activeConformanceFindings: a.filter((c) => c.outcome === "active").map((c) => c.finding),
893
- suppressedConformanceFindings: a.filter(be),
1754
+ suppressedPolicyViolations: i.filter(Fe),
1755
+ reactivatedPolicyViolations: a,
1756
+ activeConformanceFindings: s.filter((c) => c.outcome === "active").map((c) => c.finding),
1757
+ suppressedConformanceFindings: s.filter(Fe),
894
1758
  reactivatedConformanceFindings: d
895
1759
  };
896
1760
  }
897
- function Ne(e) {
898
- const t = Wt(e), n = Object.values(
1761
+ function ot(e) {
1762
+ const t = On(e), n = Object.values(
899
1763
  e.exceptionStatuses
900
- ).filter((c) => c === "active").length, r = Object.values(
1764
+ ).filter((c) => c === "active").length, o = Object.values(
901
1765
  e.exceptionStatuses
902
- ).filter((c) => c === "stale").length, o = Object.values(
1766
+ ).filter((c) => c === "stale").length, r = Object.values(
903
1767
  e.exceptionStatuses
904
1768
  ).filter((c) => c === "expired").length, i = [
905
1769
  ...e.suppressedPolicyViolations.map(
906
- (c) => Ht(c)
1770
+ (c) => Vn(c)
907
1771
  ),
908
1772
  ...e.suppressedConformanceFindings.map(
909
- (c) => Ut(c)
1773
+ (c) => An(c)
910
1774
  )
911
- ].sort(Pe), a = [
1775
+ ].sort(Ve), s = [
912
1776
  ...e.reactivatedPolicyViolations.map(
913
- (c) => Kt(c)
1777
+ (c) => Fn(c)
914
1778
  ),
915
1779
  ...e.reactivatedConformanceFindings.map(
916
- (c) => Yt(c)
1780
+ (c) => zn(c)
917
1781
  )
918
- ].sort(Pe), s = [], d = [];
1782
+ ].sort(Ve), a = [], d = [];
919
1783
  for (const c of [...e.declaredExceptions].sort(
920
- (u, l) => u.id.localeCompare(l.id)
1784
+ (l, u) => l.id.localeCompare(u.id)
921
1785
  )) {
922
- const u = t.get(c.id) ?? 0, l = {
1786
+ const l = t.get(c.id) ?? 0, u = {
923
1787
  id: c.id,
924
1788
  source: c.source,
925
1789
  status: e.exceptionStatuses[c.id],
926
1790
  reason: c.reason,
927
1791
  owner: c.owner,
928
1792
  review: { ...c.review },
929
- matchCount: u
1793
+ matchCount: l
930
1794
  };
931
- u > 0 ? s.push(l) : d.push(l);
1795
+ l > 0 ? a.push(u) : d.push(u);
932
1796
  }
933
1797
  return {
934
1798
  summary: {
935
1799
  declaredCount: e.declaredExceptions.length,
936
- matchedCount: s.length,
1800
+ matchedCount: a.length,
937
1801
  suppressedPolicyViolationCount: e.suppressedPolicyViolations.length,
938
1802
  suppressedConformanceFindingCount: e.suppressedConformanceFindings.length,
939
1803
  unusedExceptionCount: d.length,
940
1804
  activeExceptionCount: n,
941
- staleExceptionCount: r,
942
- expiredExceptionCount: o,
1805
+ staleExceptionCount: o,
1806
+ expiredExceptionCount: r,
943
1807
  reactivatedPolicyViolationCount: e.reactivatedPolicyViolations.length,
944
1808
  reactivatedConformanceFindingCount: e.reactivatedConformanceFindings.length
945
1809
  },
946
- used: s,
1810
+ used: a,
947
1811
  unused: d,
948
1812
  suppressedFindings: i,
949
- reactivatedFindings: a
1813
+ reactivatedFindings: s
950
1814
  };
951
1815
  }
952
- function Ft() {
953
- return Ne(
954
- Le({
1816
+ function bn() {
1817
+ return ot(
1818
+ nt({
955
1819
  exceptions: [],
956
1820
  policyViolations: [],
957
1821
  conformanceFindings: [],
@@ -959,11 +1823,11 @@ function Ft() {
959
1823
  })
960
1824
  );
961
1825
  }
962
- function Vt(e, t) {
963
- const n = K(
964
- t.filter((r) => r.source === "policy").flatMap((r) => {
965
- const o = _e(r.scope, e);
966
- return o ? [{ ...o, exceptionId: r.id }] : [];
1826
+ function Cn(e, t) {
1827
+ const n = Z(
1828
+ t.filter((o) => o.source === "policy").flatMap((o) => {
1829
+ const r = rt(o.scope, e);
1830
+ return r ? [{ ...r, exceptionId: o.id }] : [];
967
1831
  })
968
1832
  );
969
1833
  return n ? {
@@ -976,11 +1840,11 @@ function Vt(e, t) {
976
1840
  outcome: "active"
977
1841
  };
978
1842
  }
979
- function Tt(e, t) {
980
- const n = K(
981
- t.filter((r) => r.source === "conformance").flatMap((r) => {
982
- const o = qe(r.scope, e);
983
- return o ? [{ ...o, exceptionId: r.id }] : [];
1843
+ function xn(e, t) {
1844
+ const n = Z(
1845
+ t.filter((o) => o.source === "conformance").flatMap((o) => {
1846
+ const r = it(o.scope, e);
1847
+ return r ? [{ ...r, exceptionId: o.id }] : [];
984
1848
  })
985
1849
  );
986
1850
  return n ? {
@@ -993,15 +1857,15 @@ function Tt(e, t) {
993
1857
  outcome: "active"
994
1858
  };
995
1859
  }
996
- function Gt(e, t) {
997
- const n = K(
998
- t.filter((r) => r.exception.source === "policy").flatMap((r) => {
999
- const o = _e(r.exception.scope, e);
1000
- return o ? [
1860
+ function Dn(e, t) {
1861
+ const n = Z(
1862
+ t.filter((o) => o.exception.source === "policy").flatMap((o) => {
1863
+ const r = rt(o.exception.scope, e);
1864
+ return r ? [
1001
1865
  {
1002
- ...o,
1003
- exceptionId: r.exception.id,
1004
- status: r.status
1866
+ ...r,
1867
+ exceptionId: o.exception.id,
1868
+ status: o.status
1005
1869
  }
1006
1870
  ] : [];
1007
1871
  })
@@ -1014,15 +1878,15 @@ function Gt(e, t) {
1014
1878
  matchedExceptionStatus: n.status
1015
1879
  };
1016
1880
  }
1017
- function Bt(e, t) {
1018
- const n = K(
1019
- t.filter((r) => r.exception.source === "conformance").flatMap((r) => {
1020
- const o = qe(r.exception.scope, e);
1021
- return o ? [
1881
+ function kn(e, t) {
1882
+ const n = Z(
1883
+ t.filter((o) => o.exception.source === "conformance").flatMap((o) => {
1884
+ const r = it(o.exception.scope, e);
1885
+ return r ? [
1022
1886
  {
1023
- ...o,
1024
- exceptionId: r.exception.id,
1025
- status: r.status
1887
+ ...r,
1888
+ exceptionId: o.exception.id,
1889
+ status: o.status
1026
1890
  }
1027
1891
  ] : [];
1028
1892
  })
@@ -1035,39 +1899,39 @@ function Bt(e, t) {
1035
1899
  matchedExceptionStatus: n.status
1036
1900
  };
1037
1901
  }
1038
- function _e(e, t) {
1039
- if (!Ge(e))
1902
+ function rt(e, t) {
1903
+ if (!et(e))
1040
1904
  return null;
1041
1905
  const n = g(
1042
1906
  t.details?.targetProject ?? t.details?.target
1043
1907
  );
1044
1908
  return e.ruleId !== t.ruleId || e.projectId !== g(t.project) || e.targetProjectId && e.targetProjectId !== n ? null : {
1045
- scopeKey: Te(e),
1046
- specificity: Nt(e)
1909
+ scopeKey: Qe(e),
1910
+ specificity: Mn(e)
1047
1911
  };
1048
1912
  }
1049
- function qe(e, t) {
1050
- return !Et(e) || e.ruleId && e.ruleId !== t.ruleId || e.category && e.category !== t.category || e.projectId && e.projectId !== t.projectId || e.relatedProjectIds && !qt(
1913
+ function it(e, t) {
1914
+ return !vn(e) || e.ruleId && e.ruleId !== t.ruleId || e.category && e.category !== t.category || e.projectId && e.projectId !== t.projectId || e.relatedProjectIds && !Rn(
1051
1915
  e.relatedProjectIds,
1052
1916
  t.relatedProjectIds
1053
1917
  ) ? null : {
1054
- scopeKey: Te(e),
1055
- specificity: _t(e)
1918
+ scopeKey: Qe(e),
1919
+ specificity: En(e)
1056
1920
  };
1057
1921
  }
1058
- function K(e) {
1059
- return e.length === 0 ? null : [...e].sort(Lt)[0] ?? null;
1922
+ function Z(e) {
1923
+ return e.length === 0 ? null : [...e].sort($n)[0] ?? null;
1060
1924
  }
1061
- function Lt(e, t) {
1925
+ function $n(e, t) {
1062
1926
  if (e.specificity !== t.specificity)
1063
1927
  return t.specificity - e.specificity;
1064
1928
  const n = e.scopeKey.localeCompare(t.scopeKey);
1065
1929
  return n !== 0 ? n : e.exceptionId.localeCompare(t.exceptionId);
1066
1930
  }
1067
- function Nt(e) {
1931
+ function Mn(e) {
1068
1932
  return e.targetProjectId ? 2 : 1;
1069
1933
  }
1070
- function _t(e) {
1934
+ function En(e) {
1071
1935
  return [
1072
1936
  e.ruleId,
1073
1937
  e.category,
@@ -1075,27 +1939,27 @@ function _t(e) {
1075
1939
  e.relatedProjectIds?.length ? "relatedProjectIds" : void 0
1076
1940
  ].filter(Boolean).length;
1077
1941
  }
1078
- function qt(e, t) {
1079
- const n = we(e), r = we(t);
1080
- return n.length !== r.length ? !1 : n.every(
1081
- (o, i) => o === r[i]
1942
+ function Rn(e, t) {
1943
+ const n = Oe(e), o = Oe(t);
1944
+ return n.length !== o.length ? !1 : n.every(
1945
+ (r, i) => r === o[i]
1082
1946
  );
1083
1947
  }
1084
- function we(e) {
1085
- return [...new Set(e.map(g).filter(M))].sort(
1948
+ function Oe(e) {
1949
+ return [...new Set(e.map(g).filter(R))].sort(
1086
1950
  (t, n) => t.localeCompare(n)
1087
1951
  );
1088
1952
  }
1089
- function Wt(e) {
1953
+ function On(e) {
1090
1954
  const t = /* @__PURE__ */ new Map();
1091
1955
  for (const n of [
1092
1956
  ...e.suppressedPolicyViolations,
1093
1957
  ...e.suppressedConformanceFindings,
1094
1958
  ...e.reactivatedPolicyViolations.filter(
1095
- (r) => typeof r.matchedExceptionId == "string"
1959
+ (o) => typeof o.matchedExceptionId == "string"
1096
1960
  ),
1097
1961
  ...e.reactivatedConformanceFindings.filter(
1098
- (r) => typeof r.matchedExceptionId == "string"
1962
+ (o) => typeof o.matchedExceptionId == "string"
1099
1963
  )
1100
1964
  ])
1101
1965
  n.matchedExceptionId && t.set(
@@ -1104,7 +1968,7 @@ function Wt(e) {
1104
1968
  );
1105
1969
  return t;
1106
1970
  }
1107
- function Ht(e) {
1971
+ function Vn(e) {
1108
1972
  const t = g(
1109
1973
  e.finding.details?.targetProject ?? e.finding.details?.target
1110
1974
  ), n = g(e.finding.project);
@@ -1118,12 +1982,12 @@ function Ht(e) {
1118
1982
  status: "active",
1119
1983
  ...n ? { projectId: n } : {},
1120
1984
  ...t ? { targetProjectId: t } : {},
1121
- relatedProjectIds: [n, t].filter(M),
1985
+ relatedProjectIds: [n, t].filter(R),
1122
1986
  message: e.finding.message,
1123
1987
  ...e.finding.sourcePluginId ? { sourcePluginId: e.finding.sourcePluginId } : {}
1124
1988
  };
1125
1989
  }
1126
- function Ut(e) {
1990
+ function An(e) {
1127
1991
  return {
1128
1992
  kind: "conformance-finding",
1129
1993
  exceptionId: e.matchedExceptionId,
@@ -1142,7 +2006,7 @@ function Ut(e) {
1142
2006
  } : {}
1143
2007
  };
1144
2008
  }
1145
- function Kt(e) {
2009
+ function Fn(e) {
1146
2010
  const t = g(
1147
2011
  e.finding.details?.targetProject ?? e.finding.details?.target
1148
2012
  ), n = g(e.finding.project);
@@ -1156,12 +2020,12 @@ function Kt(e) {
1156
2020
  severity: e.finding.severity,
1157
2021
  ...n ? { projectId: n } : {},
1158
2022
  ...t ? { targetProjectId: t } : {},
1159
- relatedProjectIds: [n, t].filter(M),
2023
+ relatedProjectIds: [n, t].filter(R),
1160
2024
  message: e.finding.message,
1161
2025
  ...e.finding.sourcePluginId ? { sourcePluginId: e.finding.sourcePluginId } : {}
1162
2026
  };
1163
2027
  }
1164
- function Yt(e) {
2028
+ function zn(e) {
1165
2029
  return {
1166
2030
  kind: "conformance-finding",
1167
2031
  exceptionId: e.matchedExceptionId ?? "unknown-exception",
@@ -1180,16 +2044,16 @@ function Yt(e) {
1180
2044
  } : {}
1181
2045
  };
1182
2046
  }
1183
- function Pe(e, t) {
1184
- const n = ve[e.source] - ve[t.source];
2047
+ function Ve(e, t) {
2048
+ const n = Ee[e.source] - Ee[t.source];
1185
2049
  if (n !== 0)
1186
2050
  return n;
1187
- const r = Ie[e.severity] - Ie[t.severity];
1188
- if (r !== 0)
1189
- return r;
1190
- const o = (e.ruleId ?? "").localeCompare(t.ruleId ?? "");
2051
+ const o = Re[e.severity] - Re[t.severity];
1191
2052
  if (o !== 0)
1192
2053
  return o;
2054
+ const r = (e.ruleId ?? "").localeCompare(t.ruleId ?? "");
2055
+ if (r !== 0)
2056
+ return r;
1193
2057
  const i = [
1194
2058
  e.projectId ?? "",
1195
2059
  e.targetProjectId ?? "",
@@ -1203,7 +2067,7 @@ function Pe(e, t) {
1203
2067
  );
1204
2068
  return i !== 0 ? i : e.message.localeCompare(t.message);
1205
2069
  }
1206
- function Se(e) {
2070
+ function Ae(e) {
1207
2071
  if (!e)
1208
2072
  return;
1209
2073
  const t = e.includes("T") ? e : `${e}T00:00:00.000Z`, n = Date.parse(t);
@@ -1217,25 +2081,25 @@ function g(e) {
1217
2081
  const t = e.trim();
1218
2082
  return t.length > 0 ? t : void 0;
1219
2083
  }
1220
- function M(e) {
2084
+ function R(e) {
1221
2085
  return e !== void 0;
1222
2086
  }
1223
- function be(e) {
2087
+ function Fe(e) {
1224
2088
  return e.outcome === "suppressed" && typeof e.matchedExceptionId == "string";
1225
2089
  }
1226
- class Kr {
2090
+ class Er {
1227
2091
  capabilitiesById = /* @__PURE__ */ new Map();
1228
2092
  capabilities;
1229
2093
  constructor(t) {
1230
2094
  const n = t.map(
1231
- (r) => Object.freeze({ ...r })
2095
+ (o) => Object.freeze({ ...o })
1232
2096
  );
1233
- for (const r of n) {
1234
- if (this.capabilitiesById.has(r.id))
2097
+ for (const o of n) {
2098
+ if (this.capabilitiesById.has(o.id))
1235
2099
  throw new Error(
1236
- `Duplicate governance capability id "${r.id}" is not allowed.`
2100
+ `Duplicate governance capability id "${o.id}" is not allowed.`
1237
2101
  );
1238
- this.capabilitiesById.set(r.id, r);
2102
+ this.capabilitiesById.set(o.id, o);
1239
2103
  }
1240
2104
  this.capabilities = Object.freeze([...n]);
1241
2105
  }
@@ -1249,13 +2113,13 @@ class Kr {
1249
2113
  return [...this.capabilities];
1250
2114
  }
1251
2115
  }
1252
- class te extends Error {
2116
+ class se extends Error {
1253
2117
  diagnostics;
1254
2118
  constructor(t, n) {
1255
2119
  super(t), this.name = "GovernanceExtensionRegistrationError", this.diagnostics = n;
1256
2120
  }
1257
2121
  }
1258
- class Jt {
2122
+ class Tn {
1259
2123
  context;
1260
2124
  registry = {
1261
2125
  metricProviders: [],
@@ -1303,130 +2167,130 @@ class Jt {
1303
2167
  };
1304
2168
  }
1305
2169
  }
1306
- async function Yr(e, t) {
1307
- return (await Xt(
2170
+ async function Rr(e, t) {
2171
+ return (await Ln(
1308
2172
  e,
1309
2173
  t
1310
2174
  )).registry;
1311
2175
  }
1312
- async function Xt(e, t, n = {}) {
1313
- const r = {
2176
+ async function Ln(e, t, n = {}) {
2177
+ const o = {
1314
2178
  metricProviders: [],
1315
2179
  signalProviders: [],
1316
2180
  rulePacks: [],
1317
2181
  enrichers: []
1318
- }, o = [...n.diagnostics ?? []], i = /* @__PURE__ */ new Map();
1319
- for (const a of t) {
2182
+ }, r = [...n.diagnostics ?? []], i = /* @__PURE__ */ new Map();
2183
+ for (const s of t) {
1320
2184
  try {
1321
- rn(a);
2185
+ Wn(s);
1322
2186
  } catch (d) {
1323
- throw o.push({
2187
+ throw r.push({
1324
2188
  code: "governance.extension.invalid_definition",
1325
2189
  severity: "error",
1326
- message: ne(d),
1327
- packageName: a.sourceSpecifier,
1328
- moduleSpecifier: a.moduleSpecifier,
1329
- legacy: a.legacy
1330
- }), new te(
1331
- ne(d),
1332
- o
2190
+ message: ae(d),
2191
+ packageName: s.sourceSpecifier,
2192
+ moduleSpecifier: s.moduleSpecifier,
2193
+ legacy: s.legacy
2194
+ }), new se(
2195
+ ae(d),
2196
+ r
1333
2197
  );
1334
2198
  }
1335
- const s = i.get(a.definition.id);
1336
- if (s) {
1337
- const d = `Duplicate governance extension id "${a.definition.id}" was found in "${s}" and "${a.moduleSpecifier}".`;
1338
- throw o.push({
2199
+ const a = i.get(s.definition.id);
2200
+ if (a) {
2201
+ const d = `Duplicate governance extension id "${s.definition.id}" was found in "${a}" and "${s.moduleSpecifier}".`;
2202
+ throw r.push({
1339
2203
  code: "governance.extension.duplicate_id",
1340
2204
  severity: "error",
1341
2205
  message: d,
1342
- packageName: a.sourceSpecifier,
1343
- moduleSpecifier: a.moduleSpecifier,
1344
- extensionId: a.definition.id,
1345
- legacy: a.legacy
1346
- }), new te(d, o);
2206
+ packageName: s.sourceSpecifier,
2207
+ moduleSpecifier: s.moduleSpecifier,
2208
+ extensionId: s.definition.id,
2209
+ legacy: s.legacy
2210
+ }), new se(d, r);
1347
2211
  }
1348
- i.set(a.definition.id, a.moduleSpecifier);
2212
+ i.set(s.definition.id, s.moduleSpecifier);
1349
2213
  try {
1350
- const d = new Jt(
2214
+ const d = new Tn(
1351
2215
  e,
1352
- a.definition.id
2216
+ s.definition.id
1353
2217
  );
1354
- await a.definition.register(d), nn(r, d.toRegistry());
2218
+ await s.definition.register(d), _n(o, d.toRegistry());
1355
2219
  } catch (d) {
1356
- const c = `Governance extension "${a.definition.id}" from "${a.moduleSpecifier}" failed during registration: ${ne(d)}`;
1357
- throw o.push({
2220
+ const c = `Governance extension "${s.definition.id}" from "${s.moduleSpecifier}" failed during registration: ${ae(d)}`;
2221
+ throw r.push({
1358
2222
  code: "governance.extension.registration_failed",
1359
2223
  severity: "error",
1360
2224
  message: c,
1361
- packageName: a.sourceSpecifier,
1362
- moduleSpecifier: a.moduleSpecifier,
1363
- extensionId: a.definition.id,
1364
- legacy: a.legacy
1365
- }), new te(c, o);
2225
+ packageName: s.sourceSpecifier,
2226
+ moduleSpecifier: s.moduleSpecifier,
2227
+ extensionId: s.definition.id,
2228
+ legacy: s.legacy
2229
+ }), new se(c, r);
1366
2230
  }
1367
2231
  }
1368
2232
  return {
1369
- registry: r,
1370
- diagnostics: o
2233
+ registry: o,
2234
+ diagnostics: r
1371
2235
  };
1372
2236
  }
1373
- async function Zt(e, t) {
2237
+ async function Bn(e, t) {
1374
2238
  let n = t.workspace;
1375
- for (const r of e.enrichers)
1376
- n = await r.contribution.enrichWorkspace({
2239
+ for (const o of e.enrichers)
2240
+ n = await o.contribution.enrichWorkspace({
1377
2241
  ...t,
1378
2242
  workspace: n
1379
2243
  });
1380
2244
  return n;
1381
2245
  }
1382
- async function Qt(e, t) {
2246
+ async function Gn(e, t) {
1383
2247
  return (await Promise.all(
1384
- e.rulePacks.map(async (r) => (await r.contribution.evaluate(t)).map((i) => ({
2248
+ e.rulePacks.map(async (o) => (await o.contribution.evaluate(t)).map((i) => ({
1385
2249
  ...i,
1386
- sourcePluginId: i.sourcePluginId ?? r.pluginId
2250
+ sourcePluginId: i.sourcePluginId ?? o.pluginId
1387
2251
  })))
1388
2252
  )).flat();
1389
2253
  }
1390
- async function en(e, t) {
2254
+ async function Nn(e, t) {
1391
2255
  return (await Promise.all(
1392
- e.signalProviders.map(async (r) => (await r.contribution.provideSignals(t)).map((i) => ({
2256
+ e.signalProviders.map(async (o) => (await o.contribution.provideSignals(t)).map((i) => ({
1393
2257
  ...i,
1394
2258
  source: "extension",
1395
- sourcePluginId: i.sourcePluginId ?? r.pluginId
2259
+ sourcePluginId: i.sourcePluginId ?? o.pluginId
1396
2260
  })))
1397
2261
  )).flat();
1398
2262
  }
1399
- async function tn(e, t) {
2263
+ async function qn(e, t) {
1400
2264
  return (await Promise.all(
1401
- e.metricProviders.map(async (r) => (await r.contribution.provideMetrics(t)).map((i) => ({
2265
+ e.metricProviders.map(async (o) => (await o.contribution.provideMetrics(t)).map((i) => ({
1402
2266
  ...i,
1403
- sourcePluginId: i.sourcePluginId ?? r.pluginId
2267
+ sourcePluginId: i.sourcePluginId ?? o.pluginId
1404
2268
  })))
1405
2269
  )).flat();
1406
2270
  }
1407
- function nn(e, t) {
2271
+ function _n(e, t) {
1408
2272
  e.metricProviders.push(...t.metricProviders), e.signalProviders.push(...t.signalProviders), e.rulePacks.push(...t.rulePacks), e.enrichers.push(...t.enrichers);
1409
2273
  }
1410
- function rn(e) {
2274
+ function Wn(e) {
1411
2275
  if (typeof e.definition.id != "string" || e.definition.id.trim().length === 0)
1412
2276
  throw new Error(
1413
2277
  `Governance extension module "${e.moduleSpecifier}" must declare a non-empty "id".`
1414
2278
  );
1415
2279
  }
1416
- function ne(e) {
2280
+ function ae(e) {
1417
2281
  return e instanceof Error ? e.message : String(e);
1418
2282
  }
1419
- const N = {
2283
+ const q = {
1420
2284
  goodMinScore: 85,
1421
2285
  warningMinScore: 70
1422
2286
  };
1423
- function de(e) {
2287
+ function ge(e) {
1424
2288
  return Object.fromEntries(
1425
2289
  e.map((t, n) => [t, e.slice(n)])
1426
2290
  );
1427
2291
  }
1428
- function S(e, t = {}) {
1429
- const n = e.allowedLayerDependencies ?? de(e.layers), r = {
2292
+ function j(e, t = {}) {
2293
+ const n = e.allowedLayerDependencies ?? ge(e.layers), o = {
1430
2294
  "domain-boundary": {
1431
2295
  enabled: !0,
1432
2296
  severity: "error",
@@ -1451,13 +2315,13 @@ function S(e, t = {}) {
1451
2315
  metadataField: e.ownership.metadataField
1452
2316
  }
1453
2317
  }
1454
- }, o = Object.fromEntries(
1455
- Object.entries(e.rules ?? {}).map(([i, a]) => [
2318
+ }, r = Object.fromEntries(
2319
+ Object.entries(e.rules ?? {}).map(([i, s]) => [
1456
2320
  i,
1457
2321
  {
1458
- ...r[i] ?? {},
1459
- ...a,
1460
- ...a.options !== void 0 ? { options: a.options } : r[i]?.options !== void 0 ? { options: r[i]?.options } : {}
2322
+ ...o[i] ?? {},
2323
+ ...s,
2324
+ ...s.options !== void 0 ? { options: s.options } : o[i]?.options !== void 0 ? { options: o[i]?.options } : {}
1461
2325
  }
1462
2326
  ])
1463
2327
  );
@@ -1465,8 +2329,8 @@ function S(e, t = {}) {
1465
2329
  name: e.name,
1466
2330
  description: e.description,
1467
2331
  rules: {
1468
- ...r,
1469
- ...o
2332
+ ...o,
2333
+ ...r
1470
2334
  },
1471
2335
  scoring: {
1472
2336
  statusThresholds: e.health.statusThresholds,
@@ -1479,48 +2343,48 @@ function S(e, t = {}) {
1479
2343
  }
1480
2344
  };
1481
2345
  }
1482
- function We(e, t = {}, n = N, r = {}) {
1483
- const o = Math.round(on(e, t)), i = cn(n), a = dn(e), s = un(e), d = ln(
1484
- r.topIssues ?? []
1485
- ), c = pn(
1486
- r.topIssues ?? [],
1487
- r.projectHotspotLimit ?? 5
1488
- ), u = sn(o, i);
2346
+ function st(e, t = {}, n = q, o = {}) {
2347
+ const r = Math.round(Hn(e, t)), i = Yn(n), s = Jn(e), a = Xn(e), d = Zn(
2348
+ o.topIssues ?? []
2349
+ ), c = Qn(
2350
+ o.topIssues ?? [],
2351
+ o.projectHotspotLimit ?? 5
2352
+ ), l = Kn(r, i);
1489
2353
  return {
1490
- score: o,
1491
- status: u,
1492
- grade: an(o),
1493
- hotspots: a.map((l) => l.name),
1494
- metricHotspots: a,
2354
+ score: r,
2355
+ status: l,
2356
+ grade: Un(r),
2357
+ hotspots: s.map((u) => u.name),
2358
+ metricHotspots: s,
1495
2359
  projectHotspots: c,
1496
2360
  explainability: {
1497
- summary: gn(
1498
- o,
1499
- u,
1500
- s,
2361
+ summary: no(
2362
+ r,
2363
+ l,
2364
+ a,
1501
2365
  d
1502
2366
  ),
1503
- statusReason: fn(o, u, i),
1504
- weakestMetrics: s,
2367
+ statusReason: to(r, l, i),
2368
+ weakestMetrics: a,
1505
2369
  dominantIssues: d
1506
2370
  }
1507
2371
  };
1508
2372
  }
1509
- const Jr = We;
1510
- function He(e, t) {
2373
+ const Or = st;
2374
+ function at(e, t) {
1511
2375
  const n = [];
1512
- return e.some((r) => r.ruleId === "domain-boundary") && n.push({
2376
+ return e.some((o) => o.ruleId === "domain-boundary") && n.push({
1513
2377
  id: "reduce-cross-domain-dependencies",
1514
2378
  title: "Reduce cross-domain dependencies",
1515
2379
  priority: "high",
1516
2380
  reason: "Domain boundary violations indicate tight coupling across business domains."
1517
- }), e.some((r) => r.ruleId === "ownership-presence") && n.push({
2381
+ }), e.some((o) => o.ruleId === "ownership-presence") && n.push({
1518
2382
  id: "improve-ownership-coverage",
1519
2383
  title: "Improve ownership coverage",
1520
2384
  priority: "medium",
1521
2385
  reason: "Unowned projects slow down incident response and architectural decision making."
1522
2386
  }), (t.find(
1523
- (r) => r.id === "dependency-complexity"
2387
+ (o) => o.id === "dependency-complexity"
1524
2388
  )?.score ?? 100) < 60 && n.push({
1525
2389
  id: "reduce-dependency-complexity",
1526
2390
  title: "Reduce dependency complexity",
@@ -1528,96 +2392,96 @@ function He(e, t) {
1528
2392
  reason: "High dependency complexity increases blast radius and maintenance cost."
1529
2393
  }), n;
1530
2394
  }
1531
- const Xr = He;
1532
- function on(e, t) {
2395
+ const Vr = at;
2396
+ function Hn(e, t) {
1533
2397
  if (e.length === 0)
1534
2398
  return 0;
1535
- let n = 0, r = 0;
1536
- for (const o of e) {
1537
- const i = t[o.id] ?? 1, a = i > 0 ? i : 0;
1538
- n += o.score * a, r += a;
2399
+ let n = 0, o = 0;
2400
+ for (const r of e) {
2401
+ const i = t[r.id] ?? 1, s = i > 0 ? i : 0;
2402
+ n += r.score * s, o += s;
1539
2403
  }
1540
- return r === 0 ? e.reduce((o, i) => o + i.score, 0) / e.length : n / r;
2404
+ return o === 0 ? e.reduce((r, i) => r + i.score, 0) / e.length : n / o;
1541
2405
  }
1542
- function an(e) {
2406
+ function Un(e) {
1543
2407
  return e >= 90 ? "A" : e >= 80 ? "B" : e >= 70 ? "C" : e >= 60 ? "D" : "F";
1544
2408
  }
1545
- function sn(e, t) {
2409
+ function Kn(e, t) {
1546
2410
  return e >= t.goodMinScore ? "good" : e >= t.warningMinScore ? "warning" : "critical";
1547
2411
  }
1548
- function cn(e) {
1549
- const t = typeof e.goodMinScore == "number" && Number.isFinite(e.goodMinScore) ? e.goodMinScore : N.goodMinScore, n = typeof e.warningMinScore == "number" && Number.isFinite(e.warningMinScore) ? e.warningMinScore : N.warningMinScore;
1550
- return t <= n ? N : {
2412
+ function Yn(e) {
2413
+ const t = typeof e.goodMinScore == "number" && Number.isFinite(e.goodMinScore) ? e.goodMinScore : q.goodMinScore, n = typeof e.warningMinScore == "number" && Number.isFinite(e.warningMinScore) ? e.warningMinScore : q.warningMinScore;
2414
+ return t <= n ? q : {
1551
2415
  goodMinScore: t,
1552
2416
  warningMinScore: n
1553
2417
  };
1554
2418
  }
1555
- function dn(e) {
2419
+ function Jn(e) {
1556
2420
  return [...e].filter((t) => t.score < 60).sort((t, n) => t.score - n.score || t.id.localeCompare(n.id)).map((t) => ({
1557
2421
  id: t.id,
1558
2422
  name: t.name,
1559
2423
  score: t.score
1560
2424
  }));
1561
2425
  }
1562
- function un(e) {
2426
+ function Xn(e) {
1563
2427
  return [...e].sort((t, n) => t.score - n.score || t.id.localeCompare(n.id)).slice(0, 3).map((t) => ({
1564
2428
  id: t.id,
1565
2429
  name: t.name,
1566
2430
  score: t.score
1567
2431
  }));
1568
2432
  }
1569
- function ln(e) {
2433
+ function Zn(e) {
1570
2434
  return e.slice(0, 3);
1571
2435
  }
1572
- function pn(e, t) {
2436
+ function Qn(e, t) {
1573
2437
  const n = /* @__PURE__ */ new Map();
1574
- for (const r of e)
1575
- if (mn(r))
1576
- for (const o of r.projects) {
1577
- const i = n.get(o) ?? {
2438
+ for (const o of e)
2439
+ if (eo(o))
2440
+ for (const r of o.projects) {
2441
+ const i = n.get(r) ?? {
1578
2442
  count: 0,
1579
2443
  typeCounts: /* @__PURE__ */ new Map()
1580
2444
  };
1581
- i.count += r.count, i.typeCounts.set(
1582
- r.type,
1583
- (i.typeCounts.get(r.type) ?? 0) + r.count
1584
- ), n.set(o, i);
2445
+ i.count += o.count, i.typeCounts.set(
2446
+ o.type,
2447
+ (i.typeCounts.get(o.type) ?? 0) + o.count
2448
+ ), n.set(r, i);
1585
2449
  }
1586
- return [...n.entries()].sort((r, o) => o[1].count - r[1].count || r[0].localeCompare(o[0])).slice(0, Math.max(1, t)).map(([r, o]) => ({
1587
- project: r,
1588
- count: o.count,
1589
- dominantIssueTypes: [...o.typeCounts.entries()].sort((i, a) => a[1] - i[1] || i[0].localeCompare(a[0])).slice(0, 3).map(([i]) => i)
2450
+ return [...n.entries()].sort((o, r) => r[1].count - o[1].count || o[0].localeCompare(r[0])).slice(0, Math.max(1, t)).map(([o, r]) => ({
2451
+ project: o,
2452
+ count: r.count,
2453
+ dominantIssueTypes: [...r.typeCounts.entries()].sort((i, s) => s[1] - i[1] || i[0].localeCompare(s[0])).slice(0, 3).map(([i]) => i)
1590
2454
  }));
1591
2455
  }
1592
- function mn(e) {
2456
+ function eo(e) {
1593
2457
  return e.type !== "structural-dependency";
1594
2458
  }
1595
- function fn(e, t, n) {
2459
+ function to(e, t, n) {
1596
2460
  return t === "good" ? `Score ${e} is at or above the good threshold (${n.goodMinScore}).` : t === "warning" ? `Score ${e} is below the good threshold (${n.goodMinScore}) but at or above the warning threshold (${n.warningMinScore}).` : `Score ${e} is below the warning threshold (${n.warningMinScore}).`;
1597
2461
  }
1598
- function gn(e, t, n, r) {
1599
- const o = n.length > 0 ? `Weakest metrics are ${n.map((a) => a.name).join(", ")}.` : "No weak metrics were detected.", i = r.length > 0 ? `Dominant issue types are ${r.map((a) => a.type).join(", ")}.` : "No dominant issue types were detected.";
1600
- return `${yn(t)} health at ${e}. ${o} ${i}`;
2462
+ function no(e, t, n, o) {
2463
+ const r = n.length > 0 ? `Weakest metrics are ${n.map((s) => s.name).join(", ")}.` : "No weak metrics were detected.", i = o.length > 0 ? `Dominant issue types are ${o.map((s) => s.type).join(", ")}.` : "No dominant issue types were detected.";
2464
+ return `${oo(t)} health at ${e}. ${r} ${i}`;
1601
2465
  }
1602
- function yn(e) {
2466
+ function oo(e) {
1603
2467
  return e.length > 0 ? `${e[0].toUpperCase()}${e.slice(1)}` : e;
1604
2468
  }
1605
- function Ue(e) {
1606
- const { workspace: t, signals: n } = e, r = t.dependencies.length, o = t.projects.length || 1, i = hn(n), a = vn(
2469
+ function ct(e) {
2470
+ const { workspace: t, signals: n } = e, o = t.dependencies.length, r = t.projects.length || 1, i = ro(n), s = io(
1607
2471
  i,
1608
2472
  (m) => m.type === "structural-dependency"
1609
- ), s = a > 0 ? a : r, d = re(
2473
+ ), a = s > 0 ? s : o, d = ce(
1610
2474
  i,
1611
- In
1612
- ), c = re(
2475
+ so
2476
+ ), c = ce(
1613
2477
  i,
1614
2478
  (m) => m.type === "layer-boundary-violation"
1615
- ), u = re(
2479
+ ), l = ce(
1616
2480
  i,
1617
2481
  (m) => m.type === "domain-boundary-violation"
1618
- ), l = t.projects.filter(
2482
+ ), u = t.projects.filter(
1619
2483
  (m) => !!m.ownership?.team || (m.ownership?.contacts?.length ?? 0) > 0
1620
- ).length, v = t.projects.filter((m) => {
2484
+ ).length, w = t.projects.filter((m) => {
1621
2485
  const x = m.metadata.documentation;
1622
2486
  return x === !0 || x === "true";
1623
2487
  }).length;
@@ -1626,77 +2490,77 @@ function Ue(e) {
1626
2490
  "architectural-entropy",
1627
2491
  "Architectural Entropy",
1628
2492
  "architecture",
1629
- d / Math.max(s, 1)
2493
+ d / Math.max(a, 1)
1630
2494
  ),
1631
2495
  D(
1632
2496
  "dependency-complexity",
1633
2497
  "Dependency Complexity",
1634
2498
  "architecture",
1635
- s / o / 4
2499
+ a / r / 4
1636
2500
  ),
1637
2501
  D(
1638
2502
  "domain-integrity",
1639
2503
  "Domain Integrity",
1640
2504
  "boundaries",
1641
- u / Math.max(s, 1)
2505
+ l / Math.max(a, 1)
1642
2506
  ),
1643
2507
  D(
1644
2508
  "ownership-coverage",
1645
2509
  "Ownership Coverage",
1646
2510
  "ownership",
1647
- l / o,
2511
+ u / r,
1648
2512
  !0
1649
2513
  ),
1650
2514
  D(
1651
2515
  "documentation-completeness",
1652
2516
  "Documentation Completeness",
1653
2517
  "documentation",
1654
- v / o,
2518
+ w / r,
1655
2519
  !0
1656
2520
  ),
1657
2521
  D(
1658
2522
  "layer-integrity",
1659
2523
  "Layer Integrity",
1660
2524
  "boundaries",
1661
- c / Math.max(s, 1)
2525
+ c / Math.max(a, 1)
1662
2526
  )
1663
2527
  ];
1664
2528
  }
1665
- const Zr = Ue;
1666
- function D(e, t, n, r, o = !1) {
1667
- const i = Math.max(0, Math.min(1, r)), a = Number(i.toFixed(4)), s = Math.round(o ? a * 100 : (1 - a) * 100);
2529
+ const Ar = ct;
2530
+ function D(e, t, n, o, r = !1) {
2531
+ const i = Math.max(0, Math.min(1, o)), s = Number(i.toFixed(4)), a = Math.round(r ? s * 100 : (1 - s) * 100);
1668
2532
  return {
1669
2533
  id: e,
1670
2534
  name: t,
1671
2535
  family: n,
1672
- value: a,
1673
- score: s,
2536
+ value: s,
2537
+ score: a,
1674
2538
  maxScore: 100,
1675
2539
  unit: "ratio"
1676
2540
  };
1677
2541
  }
1678
- function hn(e) {
2542
+ function ro(e) {
1679
2543
  const t = /* @__PURE__ */ new Map();
1680
2544
  for (const n of e) {
1681
- const r = t.get(n.type) ?? {
2545
+ const o = t.get(n.type) ?? {
1682
2546
  type: n.type,
1683
2547
  count: 0,
1684
2548
  weight: 0
1685
2549
  };
1686
- r.count += 1, r.weight += wn(n.severity), t.set(n.type, r);
2550
+ o.count += 1, o.weight += ao(n.severity), t.set(n.type, o);
1687
2551
  }
1688
2552
  return [...t.values()];
1689
2553
  }
1690
- function vn(e, t) {
1691
- return e.filter(t).reduce((n, r) => n + r.count, 0);
2554
+ function io(e, t) {
2555
+ return e.filter(t).reduce((n, o) => n + o.count, 0);
1692
2556
  }
1693
- function re(e, t) {
1694
- return e.filter(t).reduce((n, r) => n + r.weight, 0);
2557
+ function ce(e, t) {
2558
+ return e.filter(t).reduce((n, o) => n + o.weight, 0);
1695
2559
  }
1696
- function In(e) {
2560
+ function so(e) {
1697
2561
  return e.type === "cross-domain-dependency" || e.type === "missing-domain-context" || e.type === "circular-dependency";
1698
2562
  }
1699
- function wn(e) {
2563
+ function ao(e) {
1700
2564
  switch (e) {
1701
2565
  case "error":
1702
2566
  return 1;
@@ -1706,7 +2570,7 @@ function wn(e) {
1706
2570
  return 0.25;
1707
2571
  }
1708
2572
  }
1709
- const R = {
2573
+ const O = {
1710
2574
  id: "domain-boundary",
1711
2575
  name: "Domain Boundary",
1712
2576
  description: "Enforces allowed dependencies between projects in different domains.",
@@ -1715,24 +2579,24 @@ const R = {
1715
2579
  evaluate({ workspace: e, profile: t }) {
1716
2580
  if (!t)
1717
2581
  return {};
1718
- const r = S(t).rules[R.id];
1719
- if (r?.enabled === !1)
2582
+ const o = j(t).rules[O.id];
2583
+ if (o?.enabled === !1)
1720
2584
  return {};
1721
- const o = r?.options, i = r?.severity ?? R.defaultSeverity, a = ue(e.projects);
2585
+ const r = o?.options, i = o?.severity ?? O.defaultSeverity, s = ye(e.projects);
1722
2586
  return { violations: e.dependencies.flatMap((d) => {
1723
- const c = a.get(d.source), u = a.get(d.target);
1724
- return Ye(
2587
+ const c = s.get(d.source), l = s.get(d.target);
2588
+ return lt(
1725
2589
  c,
1726
- u,
2590
+ l,
1727
2591
  d,
1728
- o ?? {
2592
+ r ?? {
1729
2593
  allowedDependencies: t.allowedDomainDependencies
1730
2594
  },
1731
2595
  i
1732
2596
  );
1733
2597
  }) };
1734
2598
  }
1735
- }, O = {
2599
+ }, V = {
1736
2600
  id: "layer-boundary",
1737
2601
  name: "Layer Boundary",
1738
2602
  description: "Enforces allowed dependencies between declared architectural layers.",
@@ -1741,23 +2605,23 @@ const R = {
1741
2605
  evaluate({ workspace: e, profile: t }) {
1742
2606
  if (!t)
1743
2607
  return {};
1744
- const r = S(t).rules[O.id];
1745
- if (r?.enabled === !1)
2608
+ const o = j(t).rules[V.id];
2609
+ if (o?.enabled === !1)
1746
2610
  return {};
1747
- const i = r?.options ?? {
1748
- allowedDependencies: t.allowedLayerDependencies ?? de(t.layers),
2611
+ const i = o?.options ?? {
2612
+ allowedDependencies: t.allowedLayerDependencies ?? ge(t.layers),
1749
2613
  layers: [...t.layers],
1750
2614
  usesExplicitDependencies: t.allowedLayerDependencies !== void 0
1751
- }, a = r?.severity ?? O.defaultSeverity, s = ue(e.projects), d = new Set(i.layers);
1752
- return { violations: e.dependencies.flatMap((u) => {
1753
- const l = s.get(u.source), v = s.get(u.target);
1754
- return Je(
1755
- l,
1756
- v,
2615
+ }, s = o?.severity ?? V.defaultSeverity, a = ye(e.projects), d = new Set(i.layers);
2616
+ return { violations: e.dependencies.flatMap((l) => {
2617
+ const u = a.get(l.source), w = a.get(l.target);
2618
+ return ut(
1757
2619
  u,
2620
+ w,
2621
+ l,
1758
2622
  d,
1759
2623
  i,
1760
- a
2624
+ s
1761
2625
  );
1762
2626
  }) };
1763
2627
  }
@@ -1770,18 +2634,18 @@ const R = {
1770
2634
  evaluate({ workspace: e, profile: t }) {
1771
2635
  if (!t)
1772
2636
  return {};
1773
- const r = S(t).rules[A.id];
1774
- if (r?.enabled === !1)
2637
+ const o = j(t).rules[A.id];
2638
+ if (o?.enabled === !1)
1775
2639
  return {};
1776
- const i = r?.options ?? {
2640
+ const i = o?.options ?? {
1777
2641
  required: t.ownership.required,
1778
2642
  metadataField: t.ownership.metadataField
1779
- }, a = r?.severity ?? A.defaultSeverity;
2643
+ }, s = o?.severity ?? A.defaultSeverity;
1780
2644
  return i.required ? { violations: e.projects.flatMap(
1781
- (d) => Xe(d, a)
2645
+ (d) => pt(d, s)
1782
2646
  ) } : {};
1783
2647
  }
1784
- }, _ = {
2648
+ }, U = {
1785
2649
  id: "project-name-convention",
1786
2650
  name: "Project Name Convention",
1787
2651
  description: "Validates project names against an explicitly configured regular expression.",
@@ -1790,17 +2654,17 @@ const R = {
1790
2654
  evaluate({ workspace: e, profile: t }) {
1791
2655
  if (!t)
1792
2656
  return {};
1793
- const r = S(t).rules[_.id], o = r?.options;
1794
- if (!r?.enabled || !o?.pattern)
2657
+ const o = j(t).rules[U.id], r = o?.options;
2658
+ if (!o?.enabled || !r?.pattern)
1795
2659
  return {};
1796
- const i = new RegExp(o.pattern), a = r.severity ?? _.defaultSeverity;
2660
+ const i = new RegExp(r.pattern), s = o.severity ?? U.defaultSeverity;
1797
2661
  return {
1798
2662
  violations: e.projects.flatMap(
1799
- (s) => bn(s, o, i, a)
2663
+ (a) => uo(a, r, i, s)
1800
2664
  )
1801
2665
  };
1802
2666
  }
1803
- }, q = {
2667
+ }, K = {
1804
2668
  id: "tag-convention",
1805
2669
  name: "Tag Convention",
1806
2670
  description: "Validates required and allowed generic tag prefixes and tag value patterns.",
@@ -1809,17 +2673,17 @@ const R = {
1809
2673
  evaluate({ workspace: e, profile: t }) {
1810
2674
  if (!t)
1811
2675
  return {};
1812
- const r = S(t).rules[q.id], o = r?.options;
1813
- if (!r?.enabled || !o || !En(o))
2676
+ const o = j(t).rules[K.id], r = o?.options;
2677
+ if (!o?.enabled || !r || !vo(r))
1814
2678
  return {};
1815
- const i = r.severity ?? q.defaultSeverity, a = o.valuePattern ? new RegExp(o.valuePattern) : void 0;
2679
+ const i = o.severity ?? K.defaultSeverity, s = r.valuePattern ? new RegExp(r.valuePattern) : void 0;
1816
2680
  return {
1817
2681
  violations: e.projects.flatMap(
1818
- (s) => jn(s, o, a, i)
2682
+ (a) => po(a, r, s, i)
1819
2683
  )
1820
2684
  };
1821
2685
  }
1822
- }, W = {
2686
+ }, Y = {
1823
2687
  id: "missing-domain",
1824
2688
  name: "Missing Domain",
1825
2689
  description: "Requires a domain on projects when explicitly configured.",
@@ -1828,17 +2692,17 @@ const R = {
1828
2692
  evaluate({ workspace: e, profile: t }) {
1829
2693
  if (!t)
1830
2694
  return {};
1831
- const r = S(t).rules[W.id], o = r?.options;
1832
- if (!r?.enabled || !o?.required)
2695
+ const o = j(t).rules[Y.id], r = o?.options;
2696
+ if (!o?.enabled || !r?.required)
1833
2697
  return {};
1834
- const i = r.severity ?? W.defaultSeverity;
2698
+ const i = o.severity ?? Y.defaultSeverity;
1835
2699
  return {
1836
2700
  violations: e.projects.flatMap(
1837
- (a) => xn(a, i)
2701
+ (s) => mo(s, i)
1838
2702
  )
1839
2703
  };
1840
2704
  }
1841
- }, H = {
2705
+ }, J = {
1842
2706
  id: "missing-layer",
1843
2707
  name: "Missing Layer",
1844
2708
  description: "Requires a layer on projects when explicitly configured.",
@@ -1847,84 +2711,84 @@ const R = {
1847
2711
  evaluate({ workspace: e, profile: t }) {
1848
2712
  if (!t)
1849
2713
  return {};
1850
- const r = S(t).rules[H.id], o = r?.options;
1851
- if (!r?.enabled || !o?.required)
2714
+ const o = j(t).rules[J.id], r = o?.options;
2715
+ if (!o?.enabled || !r?.required)
1852
2716
  return {};
1853
- const i = r.severity ?? H.defaultSeverity;
2717
+ const i = o.severity ?? J.defaultSeverity;
1854
2718
  return {
1855
2719
  violations: e.projects.flatMap(
1856
- (a) => Dn(a, i)
2720
+ (s) => fo(s, i)
1857
2721
  )
1858
2722
  };
1859
2723
  }
1860
- }, Pn = [
1861
- R,
2724
+ }, co = [
1862
2725
  O,
2726
+ V,
1863
2727
  A,
1864
- _,
1865
- q,
1866
- W,
1867
- H
2728
+ U,
2729
+ K,
2730
+ Y,
2731
+ J
1868
2732
  ];
1869
- function je(e) {
2733
+ function ze(e) {
1870
2734
  if (!e.profile)
1871
2735
  return [];
1872
- const { workspace: t, profile: n } = e, r = S(n), o = r.rules[R.id], i = o?.enabled !== !1, a = o?.options ?? {
2736
+ const { workspace: t, profile: n } = e, o = j(n), r = o.rules[O.id], i = r?.enabled !== !1, s = r?.options ?? {
1873
2737
  allowedDependencies: n.allowedDomainDependencies
1874
- }, s = o?.severity ?? R.defaultSeverity, d = r.rules[O.id], c = d?.enabled !== !1, u = d?.options ?? {
1875
- allowedDependencies: n.allowedLayerDependencies ?? de(n.layers),
2738
+ }, a = r?.severity ?? O.defaultSeverity, d = o.rules[V.id], c = d?.enabled !== !1, l = d?.options ?? {
2739
+ allowedDependencies: n.allowedLayerDependencies ?? ge(n.layers),
1876
2740
  layers: [...n.layers],
1877
2741
  usesExplicitDependencies: n.allowedLayerDependencies !== void 0
1878
- }, l = d?.severity ?? O.defaultSeverity, v = r.rules[A.id], m = v?.enabled !== !1, x = v?.options ?? {
2742
+ }, u = d?.severity ?? V.defaultSeverity, w = o.rules[A.id], m = w?.enabled !== !1, x = w?.options ?? {
1879
2743
  required: n.ownership.required,
1880
2744
  metadataField: n.ownership.metadataField
1881
- }, F = v?.severity ?? A.defaultSeverity, V = ue(t.projects), b = new Set(u.layers), w = [];
2745
+ }, z = w?.severity ?? A.defaultSeverity, T = ye(t.projects), b = new Set(l.layers), S = [];
1882
2746
  for (const y of t.dependencies) {
1883
- const j = V.get(y.source), T = V.get(y.target);
1884
- i && w.push(
1885
- ...Ye(
1886
- j,
1887
- T,
2747
+ const C = T.get(y.source), L = T.get(y.target);
2748
+ i && S.push(
2749
+ ...lt(
2750
+ C,
2751
+ L,
1888
2752
  y,
1889
- a,
1890
- s
2753
+ s,
2754
+ a
1891
2755
  )
1892
- ), c && w.push(
1893
- ...Je(
1894
- j,
1895
- T,
2756
+ ), c && S.push(
2757
+ ...ut(
2758
+ C,
2759
+ L,
1896
2760
  y,
1897
2761
  b,
1898
- u,
1899
- l
2762
+ l,
2763
+ u
1900
2764
  )
1901
2765
  );
1902
2766
  }
1903
2767
  if (m && x.required)
1904
2768
  for (const y of t.projects)
1905
- w.push(...Xe(y, F));
2769
+ S.push(...pt(y, z));
1906
2770
  for (const y of [
1907
- _,
1908
- q,
1909
- W,
1910
- H
2771
+ U,
2772
+ K,
2773
+ Y,
2774
+ J
1911
2775
  ])
1912
- w.push(...Cn(y, e));
1913
- return w;
2776
+ S.push(...go(y, e));
2777
+ return S;
1914
2778
  }
1915
- function Ke(e, t) {
1916
- return Sn(e) ? je(e) : je({
2779
+ function dt(e, t) {
2780
+ return lo(e) ? ze(e) : ze({
1917
2781
  workspace: e,
1918
2782
  profile: t
1919
2783
  });
1920
2784
  }
1921
- const Qr = Ke;
1922
- function Sn(e) {
2785
+ const Fr = dt;
2786
+ function lo(e) {
1923
2787
  return "workspace" in e;
1924
2788
  }
1925
- function Ye(e, t, n, r, o) {
1926
- return !e || !t ? [] : !e.domain || !t.domain || e.domain === t.domain || kn(
1927
- r.allowedDependencies,
2789
+ function lt(e, t, n, o, r) {
2790
+ return !e || !t ? [] : !e.domain || !t.domain || e.domain === t.domain || yo(
2791
+ o.allowedDependencies,
1928
2792
  e.domain,
1929
2793
  t.domain
1930
2794
  ) ? [] : [
@@ -1932,7 +2796,7 @@ function Ye(e, t, n, r, o) {
1932
2796
  id: `${e.name}-${t.name}-domain`,
1933
2797
  ruleId: "domain-boundary",
1934
2798
  project: e.name,
1935
- severity: o,
2799
+ severity: r,
1936
2800
  category: "boundary",
1937
2801
  message: `Project ${e.name} in domain ${e.domain} depends on ${t.name} in domain ${t.domain}.`,
1938
2802
  details: {
@@ -1945,9 +2809,9 @@ function Ye(e, t, n, r, o) {
1945
2809
  }
1946
2810
  ];
1947
2811
  }
1948
- function Je(e, t, n, r, o, i) {
1949
- return !e || !t ? [] : !e.layer || !t.layer || !r.has(e.layer) || !r.has(t.layer) || $n(
1950
- o.allowedDependencies,
2812
+ function ut(e, t, n, o, r, i) {
2813
+ return !e || !t ? [] : !e.layer || !t.layer || !o.has(e.layer) || !o.has(t.layer) || ho(
2814
+ r.allowedDependencies,
1951
2815
  e.layer,
1952
2816
  t.layer
1953
2817
  ) ? [] : [
@@ -1962,17 +2826,17 @@ function Je(e, t, n, r, o, i) {
1962
2826
  targetProject: t.name,
1963
2827
  sourceLayer: e.layer,
1964
2828
  targetLayer: t.layer,
1965
- ...o.usesExplicitDependencies ? {
1966
- allowedTargets: o.allowedDependencies[e.layer] ?? []
2829
+ ...r.usesExplicitDependencies ? {
2830
+ allowedTargets: r.allowedDependencies[e.layer] ?? []
1967
2831
  } : {
1968
- order: o.layers
2832
+ order: r.layers
1969
2833
  }
1970
2834
  },
1971
- recommendation: o.usesExplicitDependencies ? "Refactor the dependency or update allowedLayerDependencies in the governance profile when the dependency is intentional." : "Refactor dependency direction so higher-level layers depend on same or lower-level layers only."
2835
+ recommendation: r.usesExplicitDependencies ? "Refactor the dependency or update allowedLayerDependencies in the governance profile when the dependency is intentional." : "Refactor dependency direction so higher-level layers depend on same or lower-level layers only."
1972
2836
  }
1973
2837
  ];
1974
2838
  }
1975
- function Xe(e, t) {
2839
+ function pt(e, t) {
1976
2840
  return e.ownership?.team || (e.ownership?.contacts?.length ?? 0) > 0 ? [] : [
1977
2841
  {
1978
2842
  id: `${e.name}-ownership`,
@@ -1985,13 +2849,13 @@ function Xe(e, t) {
1985
2849
  }
1986
2850
  ];
1987
2851
  }
1988
- function bn(e, t, n, r) {
2852
+ function uo(e, t, n, o) {
1989
2853
  return n.test(e.name) ? [] : [
1990
2854
  {
1991
2855
  id: `${e.name}-project-name-convention`,
1992
2856
  ruleId: "project-name-convention",
1993
2857
  project: e.name,
1994
- severity: r,
2858
+ severity: o,
1995
2859
  category: "convention",
1996
2860
  message: t.message ?? `Project ${e.name} does not match the configured naming convention.`,
1997
2861
  details: {
@@ -2002,57 +2866,57 @@ function bn(e, t, n, r) {
2002
2866
  }
2003
2867
  ];
2004
2868
  }
2005
- function jn(e, t, n, r) {
2006
- const o = [], i = t.prefixSeparator ?? ":";
2007
- for (const a of t.requiredPrefixes ?? [])
2869
+ function po(e, t, n, o) {
2870
+ const r = [], i = t.prefixSeparator ?? ":";
2871
+ for (const s of t.requiredPrefixes ?? [])
2008
2872
  e.tags.some(
2009
- (s) => s.startsWith(`${a}${i}`)
2010
- ) || o.push({
2011
- id: `${e.name}-tag-convention-required-${a}`,
2873
+ (a) => a.startsWith(`${s}${i}`)
2874
+ ) || r.push({
2875
+ id: `${e.name}-tag-convention-required-${s}`,
2012
2876
  ruleId: "tag-convention",
2013
2877
  project: e.name,
2014
- severity: r,
2878
+ severity: o,
2015
2879
  category: "metadata",
2016
- message: `Project ${e.name} is missing a tag with required prefix ${a}.`,
2880
+ message: `Project ${e.name} is missing a tag with required prefix ${s}.`,
2017
2881
  details: {
2018
- requiredPrefix: a,
2882
+ requiredPrefix: s,
2019
2883
  tags: e.tags
2020
2884
  },
2021
2885
  recommendation: "Add a tag with the required prefix or relax the configured requiredPrefixes list."
2022
2886
  });
2023
- for (const a of e.tags) {
2024
- const { prefix: s, value: d } = Mn(a, i);
2025
- t.allowedPrefixes && t.allowedPrefixes.length > 0 && !t.allowedPrefixes.includes(s) && o.push({
2026
- id: `${e.name}-tag-convention-allowed-${a}`,
2887
+ for (const s of e.tags) {
2888
+ const { prefix: a, value: d } = wo(s, i);
2889
+ t.allowedPrefixes && t.allowedPrefixes.length > 0 && !t.allowedPrefixes.includes(a) && r.push({
2890
+ id: `${e.name}-tag-convention-allowed-${s}`,
2027
2891
  ruleId: "tag-convention",
2028
2892
  project: e.name,
2029
- severity: r,
2893
+ severity: o,
2030
2894
  category: "metadata",
2031
- message: `Project ${e.name} uses tag ${a} with disallowed prefix ${s}.`,
2895
+ message: `Project ${e.name} uses tag ${s} with disallowed prefix ${a}.`,
2032
2896
  details: {
2033
- tag: a,
2034
- prefix: s,
2897
+ tag: s,
2898
+ prefix: a,
2035
2899
  allowedPrefixes: t.allowedPrefixes
2036
2900
  },
2037
2901
  recommendation: "Rename the tag to use an allowed prefix or expand the allowedPrefixes rule configuration."
2038
- }), n && !n.test(d) && o.push({
2039
- id: `${e.name}-tag-convention-value-${a}`,
2902
+ }), n && !n.test(d) && r.push({
2903
+ id: `${e.name}-tag-convention-value-${s}`,
2040
2904
  ruleId: "tag-convention",
2041
2905
  project: e.name,
2042
- severity: r,
2906
+ severity: o,
2043
2907
  category: "metadata",
2044
- message: `Project ${e.name} has tag ${a} with a value that does not match the configured pattern.`,
2908
+ message: `Project ${e.name} has tag ${s} with a value that does not match the configured pattern.`,
2045
2909
  details: {
2046
- tag: a,
2910
+ tag: s,
2047
2911
  value: d,
2048
2912
  valuePattern: t.valuePattern
2049
2913
  },
2050
2914
  recommendation: "Normalize the tag value or update the configured valuePattern when the convention is intentional."
2051
2915
  });
2052
2916
  }
2053
- return o;
2917
+ return r;
2054
2918
  }
2055
- function xn(e, t) {
2919
+ function mo(e, t) {
2056
2920
  return e.domain ? [] : [
2057
2921
  {
2058
2922
  id: `${e.name}-missing-domain`,
@@ -2065,7 +2929,7 @@ function xn(e, t) {
2065
2929
  }
2066
2930
  ];
2067
2931
  }
2068
- function Dn(e, t) {
2932
+ function fo(e, t) {
2069
2933
  return e.layer ? [] : [
2070
2934
  {
2071
2935
  id: `${e.name}-missing-layer`,
@@ -2078,26 +2942,26 @@ function Dn(e, t) {
2078
2942
  }
2079
2943
  ];
2080
2944
  }
2081
- function Cn(e, t) {
2945
+ function go(e, t) {
2082
2946
  return e.evaluate(t).violations ?? [];
2083
2947
  }
2084
- function ue(e) {
2948
+ function ye(e) {
2085
2949
  return new Map(e.map((t) => [t.name, t]));
2086
2950
  }
2087
- function kn(e, t, n) {
2088
- const r = e[t];
2089
- if (r && (r.includes(n) || r.includes("*")))
2951
+ function yo(e, t, n) {
2952
+ const o = e[t];
2953
+ if (o && (o.includes(n) || o.includes("*")))
2090
2954
  return !0;
2091
- const o = e["*"];
2092
- return !!(o && (o.includes(n) || o.includes("*")));
2955
+ const r = e["*"];
2956
+ return !!(r && (r.includes(n) || r.includes("*")));
2093
2957
  }
2094
- function $n(e, t, n) {
2958
+ function ho(e, t, n) {
2095
2959
  return (e[t] ?? []).includes(n);
2096
2960
  }
2097
- function En(e) {
2961
+ function vo(e) {
2098
2962
  return (e.requiredPrefixes?.length ?? 0) > 0 || (e.allowedPrefixes?.length ?? 0) > 0 || typeof e.valuePattern == "string";
2099
2963
  }
2100
- function Mn(e, t) {
2964
+ function wo(e, t) {
2101
2965
  const n = e.indexOf(t);
2102
2966
  return n === -1 ? {
2103
2967
  prefix: e,
@@ -2107,110 +2971,110 @@ function Mn(e, t) {
2107
2971
  value: e.slice(n + t.length)
2108
2972
  };
2109
2973
  }
2110
- const Rn = "signal-", xe = {
2974
+ const Io = "signal-", Te = {
2111
2975
  graph: 0,
2112
2976
  conformance: 1,
2113
2977
  policy: 2,
2114
2978
  extension: 3
2115
- }, De = {
2979
+ }, Le = {
2116
2980
  info: 0,
2117
2981
  warning: 1,
2118
2982
  error: 2
2119
2983
  };
2120
- function Ze(e) {
2984
+ function mt(e) {
2121
2985
  const t = new Map(
2122
- e.projects.map((r) => [r.id, r])
2986
+ e.projects.map((o) => [o.id, o])
2123
2987
  ), n = [];
2124
- for (const r of e.dependencies) {
2125
- const o = t.get(r.sourceProjectId), i = t.get(r.targetProjectId), a = P(o?.domain), s = P(i?.domain), d = Y([
2126
- r.sourceProjectId,
2127
- r.targetProjectId
2988
+ for (const o of e.dependencies) {
2989
+ const r = t.get(o.sourceProjectId), i = t.get(o.targetProjectId), s = P(r?.domain), a = P(i?.domain), d = Q([
2990
+ o.sourceProjectId,
2991
+ o.targetProjectId
2128
2992
  ]);
2129
2993
  n.push(
2130
2994
  E({
2131
2995
  type: "structural-dependency",
2132
- sourceProjectId: r.sourceProjectId,
2133
- targetProjectId: r.targetProjectId,
2996
+ sourceProjectId: o.sourceProjectId,
2997
+ targetProjectId: o.targetProjectId,
2134
2998
  relatedProjectIds: d,
2135
2999
  severity: "info",
2136
3000
  category: "dependency",
2137
- message: `Dependency: ${r.sourceProjectId} -> ${r.targetProjectId}.`,
3001
+ message: `Dependency: ${o.sourceProjectId} -> ${o.targetProjectId}.`,
2138
3002
  metadata: {
2139
- dependencyType: r.type
3003
+ dependencyType: o.type
2140
3004
  },
2141
3005
  source: "graph",
2142
3006
  createdAt: e.extractedAt
2143
3007
  })
2144
- ), a && s && a !== s ? n.push(
3008
+ ), s && a && s !== a ? n.push(
2145
3009
  E({
2146
3010
  type: "cross-domain-dependency",
2147
- sourceProjectId: r.sourceProjectId,
2148
- targetProjectId: r.targetProjectId,
3011
+ sourceProjectId: o.sourceProjectId,
3012
+ targetProjectId: o.targetProjectId,
2149
3013
  relatedProjectIds: d,
2150
3014
  severity: "warning",
2151
3015
  category: "boundary",
2152
- message: `Cross-domain dependency: ${r.sourceProjectId} (${a}) -> ${r.targetProjectId} (${s}).`,
3016
+ message: `Cross-domain dependency: ${o.sourceProjectId} (${s}) -> ${o.targetProjectId} (${a}).`,
2153
3017
  metadata: {
2154
- sourceDomain: a,
2155
- targetDomain: s
3018
+ sourceDomain: s,
3019
+ targetDomain: a
2156
3020
  },
2157
3021
  source: "graph",
2158
3022
  createdAt: e.extractedAt
2159
3023
  })
2160
- ) : (!a || !s) && n.push(
3024
+ ) : (!s || !a) && n.push(
2161
3025
  E({
2162
3026
  type: "missing-domain-context",
2163
- sourceProjectId: r.sourceProjectId,
2164
- targetProjectId: r.targetProjectId,
3027
+ sourceProjectId: o.sourceProjectId,
3028
+ targetProjectId: o.targetProjectId,
2165
3029
  relatedProjectIds: d,
2166
3030
  severity: "warning",
2167
3031
  category: "boundary",
2168
- message: `Missing domain context for dependency: ${r.sourceProjectId} -> ${r.targetProjectId}.`,
3032
+ message: `Missing domain context for dependency: ${o.sourceProjectId} -> ${o.targetProjectId}.`,
2169
3033
  metadata: {
2170
- sourceDomain: a,
2171
- targetDomain: s,
2172
- missingSourceDomain: !a,
2173
- missingTargetDomain: !s
3034
+ sourceDomain: s,
3035
+ targetDomain: a,
3036
+ missingSourceDomain: !s,
3037
+ missingTargetDomain: !a
2174
3038
  },
2175
3039
  source: "graph",
2176
3040
  createdAt: e.extractedAt
2177
3041
  })
2178
3042
  );
2179
3043
  }
2180
- return n.sort(J);
3044
+ return n.sort(ee);
2181
3045
  }
2182
- function Qe(e) {
3046
+ function ft(e) {
2183
3047
  return e.findings.map(
2184
- (t) => On(t, e.extractedAt)
2185
- ).sort(J);
3048
+ (t) => So(t, e.extractedAt)
3049
+ ).sort(ee);
2186
3050
  }
2187
- function et(e, t = {}) {
3051
+ function gt(e, t = {}) {
2188
3052
  const n = t.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
2189
- return e.flatMap((r) => An(r, n)).sort(J);
3053
+ return e.flatMap((o) => Po(o, n)).sort(ee);
2190
3054
  }
2191
- function eo(e) {
2192
- return ae(
2193
- Ze(e.graphSnapshot),
2194
- e.conformanceSnapshot ? Qe(e.conformanceSnapshot) : [],
2195
- e.policyViolations ? et(e.policyViolations, {
3055
+ function zr(e) {
3056
+ return ue(
3057
+ mt(e.graphSnapshot),
3058
+ e.conformanceSnapshot ? ft(e.conformanceSnapshot) : [],
3059
+ e.policyViolations ? gt(e.policyViolations, {
2196
3060
  createdAt: e.graphSnapshot.extractedAt
2197
3061
  }) : []
2198
3062
  );
2199
3063
  }
2200
- function ae(...e) {
3064
+ function ue(...e) {
2201
3065
  const t = /* @__PURE__ */ new Map();
2202
3066
  for (const n of e.flat())
2203
3067
  t.has(n.id) || t.set(n.id, n);
2204
- return [...t.values()].sort(J);
3068
+ return [...t.values()].sort(ee);
2205
3069
  }
2206
- function On(e, t) {
2207
- const n = Y(
3070
+ function So(e, t) {
3071
+ const n = Q(
2208
3072
  e.relatedProjectIds
2209
- ), r = n.length === 1 ? n[0] : void 0;
3073
+ ), o = n.length === 1 ? n[0] : void 0;
2210
3074
  return E({
2211
3075
  type: "conformance-violation",
2212
3076
  sourceProjectId: e.projectId,
2213
- targetProjectId: r,
3077
+ targetProjectId: o,
2214
3078
  relatedProjectIds: n,
2215
3079
  severity: e.severity,
2216
3080
  category: e.category,
@@ -2223,28 +3087,28 @@ function On(e, t) {
2223
3087
  createdAt: t
2224
3088
  });
2225
3089
  }
2226
- function An(e, t) {
2227
- const n = zn(e.ruleId);
3090
+ function Po(e, t) {
3091
+ const n = jo(e.ruleId);
2228
3092
  if (!n)
2229
3093
  return [];
2230
- const r = Gn(e.details), o = P(
2231
- Bn(r?.targetProject ?? r?.target)
2232
- ), i = P(e.project), a = Y([
3094
+ const o = Do(e.details), r = P(
3095
+ ko(o?.targetProject ?? o?.target)
3096
+ ), i = P(e.project), s = Q([
2233
3097
  i,
2234
- o
3098
+ r
2235
3099
  ]);
2236
3100
  return [
2237
3101
  E({
2238
3102
  type: n.type,
2239
3103
  sourceProjectId: i,
2240
- targetProjectId: o,
2241
- relatedProjectIds: a,
3104
+ targetProjectId: r,
3105
+ relatedProjectIds: s,
2242
3106
  severity: e.severity,
2243
3107
  category: n.category,
2244
3108
  message: e.message,
2245
3109
  metadata: {
2246
3110
  ruleId: e.ruleId,
2247
- ...r ?? {},
3111
+ ...o ?? {},
2248
3112
  ...e.recommendation ? { recommendation: e.recommendation } : {}
2249
3113
  },
2250
3114
  source: "policy",
@@ -2253,13 +3117,13 @@ function An(e, t) {
2253
3117
  identityKey: [
2254
3118
  e.ruleId,
2255
3119
  i ?? "",
2256
- o ?? "",
3120
+ r ?? "",
2257
3121
  e.message
2258
3122
  ].join("|")
2259
3123
  })
2260
3124
  ];
2261
3125
  }
2262
- function zn(e) {
3126
+ function jo(e) {
2263
3127
  switch (e) {
2264
3128
  case "domain-boundary":
2265
3129
  return {
@@ -2281,7 +3145,7 @@ function zn(e) {
2281
3145
  }
2282
3146
  }
2283
3147
  function E(e) {
2284
- const t = Y(e.relatedProjectIds), n = {
3148
+ const t = Q(e.relatedProjectIds), n = {
2285
3149
  type: e.type,
2286
3150
  sourceProjectId: P(e.sourceProjectId),
2287
3151
  targetProjectId: P(e.targetProjectId),
@@ -2289,13 +3153,13 @@ function E(e) {
2289
3153
  severity: e.severity,
2290
3154
  category: e.category,
2291
3155
  message: e.message,
2292
- metadata: Tn(e.metadata),
3156
+ metadata: xo(e.metadata),
2293
3157
  source: e.source,
2294
3158
  sourcePluginId: P(e.sourcePluginId),
2295
- createdAt: Vn(e.createdAt)
3159
+ createdAt: Co(e.createdAt)
2296
3160
  };
2297
3161
  return {
2298
- id: `${Rn}${Fn(e.identityKey ?? n)}`,
3162
+ id: `${Io}${bo(e.identityKey ?? n)}`,
2299
3163
  type: n.type,
2300
3164
  ...n.sourceProjectId ? { sourceProjectId: n.sourceProjectId } : {},
2301
3165
  ...n.targetProjectId ? { targetProjectId: n.targetProjectId } : {},
@@ -2309,21 +3173,21 @@ function E(e) {
2309
3173
  createdAt: n.createdAt
2310
3174
  };
2311
3175
  }
2312
- function Fn(e) {
2313
- return st("sha256").update(JSON.stringify(e)).digest("hex").slice(0, 12);
3176
+ function bo(e) {
3177
+ return St("sha256").update(JSON.stringify(e)).digest("hex").slice(0, 12);
2314
3178
  }
2315
- function Vn(e) {
3179
+ function Co(e) {
2316
3180
  const t = Date.parse(e);
2317
3181
  return Number.isFinite(t) ? new Date(t).toISOString() : (/* @__PURE__ */ new Date(0)).toISOString();
2318
3182
  }
2319
- function Tn(e) {
3183
+ function xo(e) {
2320
3184
  if (!e)
2321
3185
  return;
2322
- const t = Object.entries(e).filter(([, n]) => n !== void 0).sort(([n], [r]) => n.localeCompare(r));
3186
+ const t = Object.entries(e).filter(([, n]) => n !== void 0).sort(([n], [o]) => n.localeCompare(o));
2323
3187
  return t.length > 0 ? Object.fromEntries(t) : void 0;
2324
3188
  }
2325
- function Y(e) {
2326
- return [...new Set(e.map(P).filter(Ln))].sort(
3189
+ function Q(e) {
3190
+ return [...new Set(e.map(P).filter($o))].sort(
2327
3191
  (t, n) => t.localeCompare(n)
2328
3192
  );
2329
3193
  }
@@ -2333,16 +3197,16 @@ function P(e) {
2333
3197
  const t = e.trim();
2334
3198
  return t.length > 0 ? t : void 0;
2335
3199
  }
2336
- function J(e, t) {
2337
- const n = xe[e.source] - xe[t.source];
3200
+ function ee(e, t) {
3201
+ const n = Te[e.source] - Te[t.source];
2338
3202
  if (n !== 0)
2339
3203
  return n;
2340
- const r = De[e.severity] - De[t.severity];
2341
- if (r !== 0)
2342
- return r;
2343
- const o = e.type.localeCompare(t.type);
3204
+ const o = Le[e.severity] - Le[t.severity];
2344
3205
  if (o !== 0)
2345
3206
  return o;
3207
+ const r = e.type.localeCompare(t.type);
3208
+ if (r !== 0)
3209
+ return r;
2346
3210
  const i = [
2347
3211
  e.sourceProjectId ?? "",
2348
3212
  e.targetProjectId ?? "",
@@ -2356,109 +3220,109 @@ function J(e, t) {
2356
3220
  );
2357
3221
  return i !== 0 ? i : e.id.localeCompare(t.id);
2358
3222
  }
2359
- function Gn(e) {
3223
+ function Do(e) {
2360
3224
  return typeof e == "object" && e !== null && !Array.isArray(e) ? e : void 0;
2361
3225
  }
2362
- function Bn(e) {
3226
+ function ko(e) {
2363
3227
  return typeof e == "string" ? e : void 0;
2364
3228
  }
2365
- function Ln(e) {
3229
+ function $o(e) {
2366
3230
  return e !== void 0;
2367
3231
  }
2368
- async function to(e) {
2369
- const t = Nn(e), n = [...e.extensionDiagnostics ?? []], r = [...e.diagnostics ?? []], o = [...e.capabilities ?? []], i = e.extensionRegistry, a = e.extensionContext, s = i && a ? await Zt(i, {
3232
+ async function Tr(e) {
3233
+ const t = Mo(e), n = [...e.extensionDiagnostics ?? []], o = [...e.diagnostics ?? []], r = [...e.capabilities ?? []], i = e.extensionRegistry, s = e.extensionContext, a = i && s ? await Bn(i, {
2370
3234
  workspace: t,
2371
3235
  profile: e.profile,
2372
- context: a
2373
- }) : t, d = Ke({
2374
- workspace: s,
3236
+ context: s
3237
+ }) : t, d = dt({
3238
+ workspace: a,
2375
3239
  profile: e.profile
2376
- }), c = Le({
3240
+ }), c = nt({
2377
3241
  exceptions: e.exceptions ?? [],
2378
3242
  policyViolations: d,
2379
3243
  conformanceFindings: e.conformanceFindings ?? [],
2380
3244
  asOf: e.asOf ?? /* @__PURE__ */ new Date()
2381
- }), u = i && a ? await Qt(i, {
2382
- workspace: s,
3245
+ }), l = i && s ? await Gn(i, {
3246
+ workspace: a,
2383
3247
  profile: e.profile,
2384
- context: a
2385
- }) : [], l = [
3248
+ context: s
3249
+ }) : [], u = [
2386
3250
  ...c.activePolicyViolations,
2387
- ...u
2388
- ], v = Ze(
2389
- e.graphSnapshot ?? _n(s)
2390
- ), m = et(
3251
+ ...l
3252
+ ], w = mt(
3253
+ e.graphSnapshot ?? Eo(a)
3254
+ ), m = gt(
2391
3255
  c.activePolicyViolations,
2392
3256
  {
2393
3257
  createdAt: e.graphSnapshot?.extractedAt ?? (/* @__PURE__ */ new Date()).toISOString()
2394
3258
  }
2395
- ), x = c.activeConformanceFindings.length > 0 ? Qe({
3259
+ ), x = c.activeConformanceFindings.length > 0 ? ft({
2396
3260
  extractedAt: e.graphSnapshot?.extractedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
2397
3261
  findings: c.activeConformanceFindings
2398
- }) : [], F = ae(
2399
- v,
3262
+ }) : [], z = ue(
3263
+ w,
2400
3264
  x,
2401
3265
  m
2402
- ), V = i && a ? await en(i, {
2403
- workspace: s,
3266
+ ), T = i && s ? await Nn(i, {
3267
+ workspace: a,
2404
3268
  profile: e.profile,
2405
- violations: l,
2406
- signals: F,
2407
- context: a
2408
- }) : [], b = ae(F, V), w = Ue({
2409
- workspace: s,
3269
+ violations: u,
3270
+ signals: z,
3271
+ context: s
3272
+ }) : [], b = ue(z, T), S = ct({
3273
+ workspace: a,
2410
3274
  signals: b
2411
- }), y = i && a ? await tn(i, {
2412
- workspace: s,
3275
+ }), y = i && s ? await qn(i, {
3276
+ workspace: a,
2413
3277
  profile: e.profile,
2414
3278
  signals: b,
2415
- measurements: w,
2416
- violations: l,
2417
- context: a
2418
- }) : [], j = [...w, ...y], T = Fe(b), le = He(
2419
- l,
2420
- j
2421
- ), it = We(
2422
- j,
3279
+ measurements: S,
3280
+ violations: u,
3281
+ context: s
3282
+ }) : [], C = [...S, ...y], L = Xe(b), he = at(
3283
+ u,
3284
+ C
3285
+ ), wt = st(
3286
+ C,
2423
3287
  e.profile.metrics,
2424
3288
  e.profile.health.statusThresholds,
2425
3289
  {
2426
- topIssues: T
3290
+ topIssues: L
2427
3291
  }
2428
- ), at = Pt({
2429
- workspace: s,
3292
+ ), It = dn({
3293
+ workspace: a,
2430
3294
  profile: e.profile.name,
2431
3295
  warnings: e.warnings ?? [],
2432
- exceptions: e.exceptions && e.exceptions.length > 0 ? Ne(c) : Ft(),
2433
- violations: l,
3296
+ exceptions: e.exceptions && e.exceptions.length > 0 ? ot(c) : bn(),
3297
+ violations: u,
2434
3298
  signals: b,
2435
- measurements: j,
2436
- health: it,
2437
- recommendations: le
3299
+ measurements: C,
3300
+ health: wt,
3301
+ recommendations: he
2438
3302
  });
2439
3303
  return {
2440
- workspace: s,
2441
- assessment: at,
2442
- violations: l,
3304
+ workspace: a,
3305
+ assessment: It,
3306
+ violations: u,
2443
3307
  signals: b,
2444
- measurements: j,
2445
- recommendations: le,
3308
+ measurements: C,
3309
+ recommendations: he,
2446
3310
  exceptionApplication: c,
2447
3311
  extensionDiagnostics: n,
2448
- capabilities: o,
2449
- diagnostics: r
3312
+ capabilities: r,
3313
+ diagnostics: o
2450
3314
  };
2451
3315
  }
2452
- function Nn(e) {
3316
+ function Mo(e) {
2453
3317
  if (e.workspace)
2454
3318
  return e.workspace;
2455
3319
  if (e.workspaceAdapterResult)
2456
- return U(e.workspaceAdapterResult);
3320
+ return X(e.workspaceAdapterResult);
2457
3321
  throw new Error(
2458
3322
  "buildGovernanceAssessmentArtifacts requires either workspace or workspaceAdapterResult."
2459
3323
  );
2460
3324
  }
2461
- function _n(e) {
3325
+ function Eo(e) {
2462
3326
  return {
2463
3327
  extractedAt: (/* @__PURE__ */ new Date()).toISOString(),
2464
3328
  projects: e.projects.map((t) => ({
@@ -2472,7 +3336,7 @@ function _n(e) {
2472
3336
  }))
2473
3337
  };
2474
3338
  }
2475
- function z(e, t) {
3339
+ function F(e, t) {
2476
3340
  return {
2477
3341
  useCase: e,
2478
3342
  request: t.request,
@@ -2481,26 +3345,26 @@ function z(e, t) {
2481
3345
  ...t.metadata ? { metadata: t.metadata } : {}
2482
3346
  };
2483
3347
  }
2484
- function no(e) {
2485
- return z("root-cause", e);
3348
+ function Lr(e) {
3349
+ return F("root-cause", e);
2486
3350
  }
2487
- function ro(e) {
2488
- return z("pr-impact", e);
3351
+ function Br(e) {
3352
+ return F("pr-impact", e);
2489
3353
  }
2490
- function oo(e) {
2491
- return z("drift", e);
3354
+ function Gr(e) {
3355
+ return F("drift", e);
2492
3356
  }
2493
- function io(e) {
2494
- return z("scorecard", e);
3357
+ function Nr(e) {
3358
+ return F("scorecard", e);
2495
3359
  }
2496
- function ao(e) {
2497
- return z("management-insights", e);
3360
+ function qr(e) {
3361
+ return F("management-insights", e);
2498
3362
  }
2499
- const qn = "core", Wn = {
2500
- id: qn,
3363
+ const Ro = "core", Oo = {
3364
+ id: Ro,
2501
3365
  name: "Governance Core Built-in Rules",
2502
- rules: Pn
2503
- }, so = [Wn], Ce = [
3366
+ rules: co
3367
+ }, _r = [Oo], Be = [
2504
3368
  "cross-domain-coordination-friction",
2505
3369
  "architectural-erosion-risk",
2506
3370
  "ownership-ambiguity",
@@ -2509,84 +3373,84 @@ const qn = "core", Wn = {
2509
3373
  "onboarding-friction",
2510
3374
  "delivery-predictability-pressure"
2511
3375
  ];
2512
- function Hn(e) {
2513
- const { assessment: t, comparison: n } = e, r = Un(t, n), o = Kn(t, n, r), i = Yn(
3376
+ function Vo(e) {
3377
+ const { assessment: t, comparison: n } = e, o = Ao(t, n), r = Fo(t, n, o), i = zo(
2514
3378
  t,
2515
3379
  n,
2516
- r
2517
- ), a = [o, i].sort(
2518
- (s, d) => d.score - s.score || s.id.localeCompare(d.id)
3380
+ o
3381
+ ), s = [r, i].sort(
3382
+ (a, d) => d.score - a.score || a.id.localeCompare(d.id)
2519
3383
  );
2520
3384
  return {
2521
3385
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
2522
3386
  profile: t.profile,
2523
- indices: a,
2524
- insights: Jn(t, a, r),
2525
- drivers: r
3387
+ indices: s,
3388
+ insights: To(t, s, o),
3389
+ drivers: o
2526
3390
  };
2527
3391
  }
2528
- const co = Hn;
2529
- function uo(e) {
3392
+ const Wr = Vo;
3393
+ function Hr(e) {
2530
3394
  const t = [...e.indices].sort(
2531
- (o, i) => i.score - o.score || o.id.localeCompare(i.id)
3395
+ (r, i) => i.score - r.score || r.id.localeCompare(i.id)
2532
3396
  )[0];
2533
3397
  if (!t)
2534
3398
  return "No delivery-impact indices were produced.";
2535
- const n = e.drivers.slice(0, 3).map((o) => o.label), r = n.length > 0 ? ` Top drivers: ${n.join(", ")}.` : "";
2536
- return `${t.name} is currently ${t.risk} risk at ${t.score}/100.${r}`;
3399
+ const n = e.drivers.slice(0, 3).map((r) => r.label), o = n.length > 0 ? ` Top drivers: ${n.join(", ")}.` : "";
3400
+ return `${t.name} is currently ${t.risk} risk at ${t.score}/100.${o}`;
2537
3401
  }
2538
- function Un(e, t) {
3402
+ function Ao(e, t) {
2539
3403
  return [
2540
- C({
3404
+ k({
2541
3405
  id: "cross-domain-coordination-friction",
2542
3406
  label: "Cross-domain coordination friction",
2543
3407
  measurement: p(e.measurements, "domain-integrity"),
2544
- issues: e.topIssues.filter(Zn),
2545
- violations: e.violations.filter(tr),
2546
- familyDelta: k(t, "boundaries")
3408
+ issues: e.topIssues.filter(Bo),
3409
+ violations: e.violations.filter(qo),
3410
+ familyDelta: $(t, "boundaries")
2547
3411
  }),
2548
- C({
3412
+ k({
2549
3413
  id: "architectural-erosion-risk",
2550
3414
  label: "Architectural erosion risk",
2551
3415
  measurement: p(e.measurements, "layer-integrity"),
2552
- issues: e.topIssues.filter(Qn),
2553
- violations: e.violations.filter(nr),
2554
- familyDelta: k(t, "boundaries")
3416
+ issues: e.topIssues.filter(Go),
3417
+ violations: e.violations.filter(_o),
3418
+ familyDelta: $(t, "boundaries")
2555
3419
  }),
2556
- C({
3420
+ k({
2557
3421
  id: "ownership-ambiguity",
2558
3422
  label: "Ownership ambiguity",
2559
3423
  measurement: p(
2560
3424
  e.measurements,
2561
3425
  "ownership-coverage"
2562
3426
  ),
2563
- issues: e.topIssues.filter(er),
2564
- violations: e.violations.filter(rr),
2565
- familyDelta: k(t, "ownership")
3427
+ issues: e.topIssues.filter(No),
3428
+ violations: e.violations.filter(Wo),
3429
+ familyDelta: $(t, "ownership")
2566
3430
  }),
2567
- C({
3431
+ k({
2568
3432
  id: "change-impact-radius-pressure",
2569
3433
  label: "Impact radius pressure",
2570
3434
  measurement: p(
2571
3435
  e.measurements,
2572
3436
  "dependency-complexity"
2573
3437
  ),
2574
- issues: e.topIssues.filter(ke),
3438
+ issues: e.topIssues.filter(Ge),
2575
3439
  violations: [],
2576
- familyDelta: k(t, "architecture")
3440
+ familyDelta: $(t, "architecture")
2577
3441
  }),
2578
- C({
3442
+ k({
2579
3443
  id: "cost-of-change-pressure",
2580
3444
  label: "Cost of change pressure",
2581
3445
  measurement: p(
2582
3446
  e.measurements,
2583
3447
  "architectural-entropy"
2584
3448
  ),
2585
- issues: e.topIssues.filter(ke),
3449
+ issues: e.topIssues.filter(Ge),
2586
3450
  violations: [],
2587
- familyDelta: k(t, "architecture")
3451
+ familyDelta: $(t, "architecture")
2588
3452
  }),
2589
- C({
3453
+ k({
2590
3454
  id: "onboarding-friction",
2591
3455
  label: "Onboarding friction",
2592
3456
  measurement: p(
@@ -2595,15 +3459,15 @@ function Un(e, t) {
2595
3459
  ),
2596
3460
  issues: [],
2597
3461
  violations: [],
2598
- familyDelta: k(t, "documentation")
3462
+ familyDelta: $(t, "documentation")
2599
3463
  }),
2600
- Xn(e, t)
2601
- ].filter(or).sort(
2602
- (r, o) => Ce.indexOf(r.id) - Ce.indexOf(o.id)
3464
+ Lo(e, t)
3465
+ ].filter(Ho).sort(
3466
+ (o, r) => Be.indexOf(o.id) - Be.indexOf(r.id)
2603
3467
  );
2604
3468
  }
2605
- function Kn(e, t, n) {
2606
- const r = nt([
3469
+ function Fo(e, t, n) {
3470
+ const o = ht([
2607
3471
  f(
2608
3472
  p(e.measurements, "dependency-complexity")
2609
3473
  ),
@@ -2627,10 +3491,10 @@ function Kn(e, t, n) {
2627
3491
  return {
2628
3492
  id: "cost-of-change",
2629
3493
  name: "Cost of Change Index",
2630
- score: r,
2631
- risk: rt(r),
2632
- trend: X(t?.healthDelta?.scoreDelta),
2633
- drivers: tt(n, [
3494
+ score: o,
3495
+ risk: vt(o),
3496
+ trend: te(t?.healthDelta?.scoreDelta),
3497
+ drivers: yt(n, [
2634
3498
  "change-impact-radius-pressure",
2635
3499
  "cost-of-change-pressure",
2636
3500
  "architectural-erosion-risk",
@@ -2640,10 +3504,10 @@ function Kn(e, t, n) {
2640
3504
  ])
2641
3505
  };
2642
3506
  }
2643
- function Yn(e, t, n) {
2644
- const r = Z(
2645
- e.topIssues.filter((i) => i.type === "conformance-violation").reduce((i, a) => i + a.count * 10, 0)
2646
- ), o = nt([
3507
+ function zo(e, t, n) {
3508
+ const o = ne(
3509
+ e.topIssues.filter((i) => i.type === "conformance-violation").reduce((i, s) => i + s.count * 10, 0)
3510
+ ), r = ht([
2647
3511
  f(
2648
3512
  p(e.measurements, "domain-integrity")
2649
3513
  ),
@@ -2660,16 +3524,16 @@ function Yn(e, t, n) {
2660
3524
  p(e.measurements, "documentation-completeness")
2661
3525
  ),
2662
3526
  100 - e.health.score,
2663
- r,
3527
+ o,
2664
3528
  t?.healthDelta ? Math.max(0, -t.healthDelta.scoreDelta) : void 0
2665
3529
  ]);
2666
3530
  return {
2667
3531
  id: "time-to-market-risk",
2668
3532
  name: "Time-to-Market Risk Index",
2669
- score: o,
2670
- risk: rt(o),
2671
- trend: X(t?.healthDelta?.scoreDelta),
2672
- drivers: tt(n, [
3533
+ score: r,
3534
+ risk: vt(r),
3535
+ trend: te(t?.healthDelta?.scoreDelta),
3536
+ drivers: yt(n, [
2673
3537
  "cross-domain-coordination-friction",
2674
3538
  "ownership-ambiguity",
2675
3539
  "change-impact-radius-pressure",
@@ -2679,68 +3543,68 @@ function Yn(e, t, n) {
2679
3543
  ])
2680
3544
  };
2681
3545
  }
2682
- function Jn(e, t, n) {
2683
- const r = [...t].sort(
2684
- (a, s) => s.score - a.score || a.id.localeCompare(s.id)
2685
- )[0], o = n.slice(0, 3), i = [];
2686
- for (const a of t)
2687
- a.risk !== "low" && i.push({
2688
- id: a.id,
3546
+ function To(e, t, n) {
3547
+ const o = [...t].sort(
3548
+ (s, a) => a.score - s.score || s.id.localeCompare(a.id)
3549
+ )[0], r = n.slice(0, 3), i = [];
3550
+ for (const s of t)
3551
+ s.risk !== "low" && i.push({
3552
+ id: s.id,
2689
3553
  audience: "management",
2690
- category: a.id === "cost-of-change" ? "cost-of-change" : "time-to-market",
2691
- severity: a.risk,
2692
- title: a.name,
2693
- summary: `${a.name} is ${a.score}/100 with ${a.risk} risk.`,
2694
- drivers: a.drivers.slice(0, 3),
2695
- relatedMeasurements: a.drivers.map((s) => s.id),
2696
- relatedSignals: e.topIssues.slice(0, 5).map((s) => s.type),
2697
- relatedViolations: e.violations.slice(0, 5).map((s) => s.ruleId)
3554
+ category: s.id === "cost-of-change" ? "cost-of-change" : "time-to-market",
3555
+ severity: s.risk,
3556
+ title: s.name,
3557
+ summary: `${s.name} is ${s.score}/100 with ${s.risk} risk.`,
3558
+ drivers: s.drivers.slice(0, 3),
3559
+ relatedMeasurements: s.drivers.map((a) => a.id),
3560
+ relatedSignals: e.topIssues.slice(0, 5).map((a) => a.type),
3561
+ relatedViolations: e.violations.slice(0, 5).map((a) => a.ruleId)
2698
3562
  });
2699
- return (r || o.length > 0) && i.push({
3563
+ return (o || r.length > 0) && i.push({
2700
3564
  id: "architecture-investment-drivers",
2701
3565
  audience: "technical-lead",
2702
3566
  category: "delivery-risk",
2703
- severity: r?.risk ?? "low",
3567
+ severity: o?.risk ?? "low",
2704
3568
  title: "Architecture Investment Drivers",
2705
- summary: o.length > 0 ? `Top delivery-impact drivers are ${o.map((a) => a.label).join(", ")}.` : "No dominant delivery-impact drivers were detected.",
2706
- drivers: o,
2707
- relatedMeasurements: e.measurements.slice(0, 6).map((a) => a.id),
2708
- relatedSignals: e.topIssues.slice(0, 6).map((a) => a.type),
2709
- relatedViolations: e.violations.slice(0, 6).map((a) => a.ruleId)
2710
- }), i.sort((a, s) => a.id.localeCompare(s.id));
2711
- }
2712
- function C(e) {
2713
- const t = e.measurement ? 100 - e.measurement.score : void 0, n = e.issues.reduce((i, a) => i + a.count, 0), r = e.violations.length, o = Z(
2714
- Math.max(t ?? 0, n * 15, r * 20)
3569
+ summary: r.length > 0 ? `Top delivery-impact drivers are ${r.map((s) => s.label).join(", ")}.` : "No dominant delivery-impact drivers were detected.",
3570
+ drivers: r,
3571
+ relatedMeasurements: e.measurements.slice(0, 6).map((s) => s.id),
3572
+ relatedSignals: e.topIssues.slice(0, 6).map((s) => s.type),
3573
+ relatedViolations: e.violations.slice(0, 6).map((s) => s.ruleId)
3574
+ }), i.sort((s, a) => s.id.localeCompare(a.id));
3575
+ }
3576
+ function k(e) {
3577
+ const t = e.measurement ? 100 - e.measurement.score : void 0, n = e.issues.reduce((i, s) => i + s.count, 0), o = e.violations.length, r = ne(
3578
+ Math.max(t ?? 0, n * 15, o * 20)
2715
3579
  );
2716
- if (!(o <= 0))
3580
+ if (!(r <= 0))
2717
3581
  return {
2718
3582
  id: e.id,
2719
3583
  label: e.label,
2720
- score: o,
3584
+ score: r,
2721
3585
  unit: "score",
2722
- trend: X(e.familyDelta),
2723
- explanation: e.measurement ? `${e.measurement.name} is ${e.measurement.score}/100 with ${n} top issue(s) and ${r} violation(s).` : `${n} top issue(s) and ${r} violation(s) contribute to this driver.`
3586
+ trend: te(e.familyDelta),
3587
+ explanation: e.measurement ? `${e.measurement.name} is ${e.measurement.score}/100 with ${n} top issue(s) and ${o} violation(s).` : `${n} top issue(s) and ${o} violation(s) contribute to this driver.`
2724
3588
  };
2725
3589
  }
2726
- function Xn(e, t) {
3590
+ function Lo(e, t) {
2727
3591
  return {
2728
3592
  id: "delivery-predictability-pressure",
2729
3593
  label: "Delivery predictability pressure",
2730
- score: Z(100 - e.health.score),
3594
+ score: ne(100 - e.health.score),
2731
3595
  unit: "score",
2732
- trend: X(t?.healthDelta?.scoreDelta),
3596
+ trend: te(t?.healthDelta?.scoreDelta),
2733
3597
  explanation: `Workspace health is ${e.health.score}/100 (${e.health.status}).`
2734
3598
  };
2735
3599
  }
2736
- function tt(e, t) {
3600
+ function yt(e, t) {
2737
3601
  const n = new Set(t);
2738
- return e.filter((r) => n.has(r.id));
3602
+ return e.filter((o) => n.has(o.id));
2739
3603
  }
2740
3604
  function p(e, t) {
2741
3605
  return e.find((n) => n.id === t);
2742
3606
  }
2743
- function k(e, t) {
3607
+ function $(e, t) {
2744
3608
  return e?.metricFamilyDeltas?.find(
2745
3609
  (n) => n.family === t
2746
3610
  )?.delta;
@@ -2748,450 +3612,72 @@ function k(e, t) {
2748
3612
  function f(e) {
2749
3613
  return e ? 100 - e.score : void 0;
2750
3614
  }
2751
- function nt(e) {
3615
+ function ht(e) {
2752
3616
  const t = e.filter(
2753
3617
  (n) => n !== void 0
2754
3618
  );
2755
- return t.length === 0 ? 0 : Z(
2756
- Math.round(t.reduce((n, r) => n + r, 0) / t.length)
3619
+ return t.length === 0 ? 0 : ne(
3620
+ Math.round(t.reduce((n, o) => n + o, 0) / t.length)
2757
3621
  );
2758
3622
  }
2759
- function X(e) {
3623
+ function te(e) {
2760
3624
  return e === void 0 || e === 0 ? "stable" : e > 0 ? "improving" : "worsening";
2761
3625
  }
2762
- function rt(e) {
3626
+ function vt(e) {
2763
3627
  return e >= 70 ? "high" : e >= 40 ? "medium" : "low";
2764
3628
  }
2765
- function Z(e) {
3629
+ function ne(e) {
2766
3630
  return Math.max(0, Math.min(100, Math.round(e)));
2767
3631
  }
2768
- function Zn(e) {
3632
+ function Bo(e) {
2769
3633
  return e.type === "cross-domain-dependency";
2770
3634
  }
2771
- function Qn(e) {
3635
+ function Go(e) {
2772
3636
  return e.type === "layer-boundary-violation";
2773
3637
  }
2774
- function er(e) {
3638
+ function No(e) {
2775
3639
  return e.type === "ownership-gap";
2776
3640
  }
2777
- function ke(e) {
3641
+ function Ge(e) {
2778
3642
  return e.type === "structural-dependency" || e.type === "circular-dependency";
2779
3643
  }
2780
- function tr(e) {
3644
+ function qo(e) {
2781
3645
  return e.ruleId === "domain-boundary";
2782
3646
  }
2783
- function nr(e) {
3647
+ function _o(e) {
2784
3648
  return e.ruleId === "layer-boundary";
2785
3649
  }
2786
- function rr(e) {
3650
+ function Wo(e) {
2787
3651
  return e.ruleId === "ownership-presence";
2788
3652
  }
2789
- function or(e) {
3653
+ function Ho(e) {
2790
3654
  return e !== void 0;
2791
3655
  }
2792
- const ir = [
2793
- "graph",
2794
- "conformance",
2795
- "policy"
2796
- ], ar = ["info", "warning", "error"], sr = [
2797
- "structural-dependency",
2798
- "cross-domain-dependency",
2799
- "missing-domain-context",
2800
- "circular-dependency",
2801
- "conformance-violation",
2802
- "domain-boundary-violation",
2803
- "layer-boundary-violation",
2804
- "ownership-gap"
2805
- ], cr = [
2806
- "architecture",
2807
- "boundaries",
2808
- "ownership",
2809
- "documentation"
2810
- ];
2811
- function lo(e, t) {
2812
- return {
2813
- baseline: e,
2814
- current: t,
2815
- metricDeltas: $e(e.metrics, t.metrics),
2816
- scoreDeltas: $e(e.scores, t.scores),
2817
- newViolations: t.violations.filter(
2818
- (n) => !Ae(e.violations, n)
2819
- ),
2820
- resolvedViolations: e.violations.filter(
2821
- (n) => !Ae(t.violations, n)
2822
- ),
2823
- healthDelta: dr(e, t),
2824
- signalDeltas: ur(e, t),
2825
- metricFamilyDeltas: lr(e, t),
2826
- topIssueDeltas: pr(e, t),
2827
- deliveryImpactIndexDeltas: mr(e, t)
2828
- };
2829
- }
2830
- function po(e, t = 0.02) {
2831
- const n = [], r = e.scoreDeltas.find(
2832
- (o) => o.id === "workspaceHealth"
2833
- );
2834
- r && n.push(
2835
- oe(
2836
- "workspaceHealth",
2837
- "workspace-health",
2838
- "Workspace Health",
2839
- r,
2840
- t,
2841
- e.healthDelta ? {
2842
- baselineStatus: e.healthDelta.baselineStatus,
2843
- currentStatus: e.healthDelta.currentStatus,
2844
- baselineGrade: e.healthDelta.baselineGrade,
2845
- currentGrade: e.healthDelta.currentGrade
2846
- } : void 0
2847
- )
2848
- );
2849
- for (const o of e.scoreDeltas)
2850
- o.id !== "workspaceHealth" && n.push(
2851
- oe(
2852
- o.id,
2853
- "metric-score",
2854
- Ir(o.id),
2855
- o,
2856
- t
2857
- )
2858
- );
2859
- for (const o of e.metricFamilyDeltas ?? [])
2860
- n.push(
2861
- oe(
2862
- `metric-family:${o.family}`,
2863
- "metric-family",
2864
- `Metric Family: ${wr(o.family)}`,
2865
- o,
2866
- t
2867
- )
2868
- );
2869
- for (const o of e.signalDeltas?.bySource ?? [])
2870
- n.push(
2871
- L(
2872
- `signal-source:${o.source}`,
2873
- "signal-source",
2874
- `Signal Source: ${o.source}`,
2875
- o
2876
- )
2877
- );
2878
- for (const o of e.signalDeltas?.byType ?? [])
2879
- n.push(
2880
- L(
2881
- `signal-type:${o.type}`,
2882
- "signal-type",
2883
- `Signal Type: ${Pr(o.type)}`,
2884
- o
2885
- )
2886
- );
2887
- for (const o of e.signalDeltas?.bySeverity ?? [])
2888
- n.push(
2889
- L(
2890
- `signal-severity:${o.severity}`,
2891
- "signal-severity",
2892
- `Signal Severity: ${o.severity}`,
2893
- o
2894
- )
2895
- );
2896
- for (const o of e.topIssueDeltas ?? [])
2897
- n.push(
2898
- L(
2899
- yr(o),
2900
- "top-issue",
2901
- `Top Issue: ${o.message}`,
2902
- {
2903
- baseline: o.baselineCount,
2904
- current: o.currentCount,
2905
- delta: o.delta
2906
- },
2907
- {
2908
- type: o.type,
2909
- source: o.source,
2910
- severity: o.severity,
2911
- ruleId: o.ruleId,
2912
- projects: o.projects
2913
- }
2914
- )
2915
- );
2916
- return n.push({
2917
- id: "violation-footprint",
2918
- kind: "violation-footprint",
2919
- label: "Violation Footprint",
2920
- status: ot(
2921
- e.newViolations.length - e.resolvedViolations.length
2922
- ),
2923
- magnitude: Math.abs(
2924
- e.newViolations.length - e.resolvedViolations.length
2925
- ),
2926
- baseline: e.baseline.violations.length,
2927
- current: e.current.violations.length,
2928
- delta: I(
2929
- e.current.violations.length - e.baseline.violations.length
2930
- ),
2931
- details: {
2932
- newViolations: e.newViolations.length,
2933
- resolvedViolations: e.resolvedViolations.length
2934
- }
2935
- }), n.sort(hr);
2936
- }
2937
- function mo(e) {
2938
- const t = e.filter((o) => o.status === "worsening").sort(Oe), n = e.filter((o) => o.status === "improving").sort(Oe), r = e.filter(
2939
- (o) => o.status === "stable"
2940
- ).length;
2941
- return {
2942
- overallTrend: t.length > n.length ? "worsening" : n.length > t.length ? "improving" : "stable",
2943
- worseningCount: t.length,
2944
- improvingCount: n.length,
2945
- stableCount: r,
2946
- topWorsening: t.slice(0, 5),
2947
- topImproving: n.slice(0, 5)
2948
- };
2949
- }
2950
- function $e(e, t) {
2951
- return [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].sort((r, o) => r.localeCompare(o)).map((r) => {
2952
- const o = e[r] ?? 0, i = t[r] ?? 0;
2953
- return {
2954
- id: r,
2955
- baseline: o,
2956
- current: i,
2957
- delta: I(i - o)
2958
- };
2959
- });
2960
- }
2961
- function dr(e, t) {
2962
- if (!(!e.health || !t.health))
2963
- return {
2964
- baselineScore: e.health.score,
2965
- currentScore: t.health.score,
2966
- scoreDelta: I(t.health.score - e.health.score),
2967
- baselineStatus: e.health.status,
2968
- currentStatus: t.health.status,
2969
- baselineGrade: e.health.grade,
2970
- currentGrade: t.health.grade
2971
- };
2972
- }
2973
- function ur(e, t) {
2974
- if (!(!e.signalBreakdown || !t.signalBreakdown))
2975
- return {
2976
- bySource: ir.map(
2977
- (n) => fr(
2978
- n,
2979
- Ee(e, n),
2980
- Ee(t, n)
2981
- )
2982
- ),
2983
- byType: sr.flatMap((n) => {
2984
- const r = Me(e, n), o = Me(t, n);
2985
- return r === 0 && o === 0 ? [] : [
2986
- {
2987
- type: n,
2988
- baseline: r,
2989
- current: o,
2990
- delta: I(o - r)
2991
- }
2992
- ];
2993
- }),
2994
- bySeverity: ar.map(
2995
- (n) => gr(
2996
- n,
2997
- Re(e, n),
2998
- Re(t, n)
2999
- )
3000
- )
3001
- };
3002
- }
3003
- function lr(e, t) {
3004
- if (!e.metricBreakdown || !t.metricBreakdown)
3005
- return;
3006
- const n = new Map(
3007
- e.metricBreakdown.families.map((o) => [
3008
- o.family,
3009
- o.score
3010
- ])
3011
- ), r = new Map(
3012
- t.metricBreakdown.families.map((o) => [
3013
- o.family,
3014
- o.score
3015
- ])
3016
- );
3017
- return cr.flatMap((o) => {
3018
- const i = n.get(o), a = r.get(o);
3019
- return i === void 0 || a === void 0 ? [] : [
3020
- {
3021
- family: o,
3022
- baseline: i,
3023
- current: a,
3024
- delta: I(a - i)
3025
- }
3026
- ];
3027
- });
3028
- }
3029
- function pr(e, t) {
3030
- if (!e.topIssues || !t.topIssues)
3031
- return;
3032
- const n = new Map(
3033
- e.topIssues.map((i) => [se(i), i])
3034
- ), r = new Map(
3035
- t.topIssues.map((i) => [se(i), i])
3036
- );
3037
- return [.../* @__PURE__ */ new Set([...n.keys(), ...r.keys()])].sort((i, a) => i.localeCompare(a)).map((i) => {
3038
- const a = n.get(i), s = r.get(i), d = s ?? a;
3039
- if (!d)
3040
- throw new Error(`Unable to resolve top issue delta for key "${i}".`);
3041
- const c = [
3042
- .../* @__PURE__ */ new Set([...a?.projects ?? [], ...s?.projects ?? []])
3043
- ].sort((u, l) => u.localeCompare(l));
3044
- return {
3045
- type: d.type,
3046
- source: d.source,
3047
- severity: d.severity,
3048
- ruleId: d.ruleId,
3049
- message: d.message,
3050
- baselineCount: a?.count ?? 0,
3051
- currentCount: s?.count ?? 0,
3052
- delta: I((s?.count ?? 0) - (a?.count ?? 0)),
3053
- projects: c
3054
- };
3055
- });
3056
- }
3057
- function mr(e, t) {
3058
- const n = new Map(
3059
- (e.deliveryImpact?.indices ?? []).map((i) => [i.id, i])
3060
- ), r = new Map(
3061
- (t.deliveryImpact?.indices ?? []).map((i) => [i.id, i])
3062
- ), o = [...n.keys()].filter((i) => r.has(i)).sort((i, a) => i.localeCompare(a));
3063
- if (o.length !== 0)
3064
- return o.map((i) => {
3065
- const a = n.get(i), s = r.get(i);
3066
- return {
3067
- id: i,
3068
- baselineScore: a.score,
3069
- currentScore: s.score,
3070
- scoreDelta: I(s.score - a.score),
3071
- baselineRisk: a.risk,
3072
- currentRisk: s.risk
3073
- };
3074
- });
3075
- }
3076
- function oe(e, t, n, r, o, i) {
3077
- return {
3078
- id: e,
3079
- kind: t,
3080
- label: n,
3081
- status: vr(r.delta, o),
3082
- magnitude: Math.abs(r.delta),
3083
- baseline: r.baseline,
3084
- current: r.current,
3085
- delta: r.delta,
3086
- details: i
3087
- };
3088
- }
3089
- function L(e, t, n, r, o) {
3090
- return {
3091
- id: e,
3092
- kind: t,
3093
- label: n,
3094
- status: ot(r.delta),
3095
- magnitude: Math.abs(r.delta),
3096
- baseline: r.baseline,
3097
- current: r.current,
3098
- delta: r.delta,
3099
- details: o
3100
- };
3101
- }
3102
- function fr(e, t, n) {
3103
- return {
3104
- source: e,
3105
- baseline: t,
3106
- current: n,
3107
- delta: I(n - t)
3108
- };
3109
- }
3110
- function gr(e, t, n) {
3111
- return {
3112
- severity: e,
3113
- baseline: t,
3114
- current: n,
3115
- delta: I(n - t)
3116
- };
3117
- }
3118
- function Ee(e, t) {
3119
- return e.signalBreakdown?.bySource.find((n) => n.source === t)?.count ?? 0;
3120
- }
3121
- function Me(e, t) {
3122
- return e.signalBreakdown?.byType.find((n) => n.type === t)?.count ?? 0;
3123
- }
3124
- function Re(e, t) {
3125
- return e.signalBreakdown?.bySeverity.find(
3126
- (n) => n.severity === t
3127
- )?.count ?? 0;
3128
- }
3129
- function se(e) {
3130
- return [
3131
- e.type,
3132
- e.source,
3133
- e.severity,
3134
- e.ruleId ?? "",
3135
- e.message
3136
- ].join("|");
3137
- }
3138
- function yr(e) {
3139
- return `top-issue:${se(e)}`;
3140
- }
3141
- function hr(e, t) {
3142
- return e.id.localeCompare(t.id);
3143
- }
3144
- function Oe(e, t) {
3145
- return t.magnitude - e.magnitude || e.id.localeCompare(t.id);
3146
- }
3147
- function vr(e, t) {
3148
- return Math.abs(e) < t ? "stable" : e > 0 ? "improving" : "worsening";
3149
- }
3150
- function ot(e) {
3151
- return e === 0 ? "stable" : e < 0 ? "improving" : "worsening";
3152
- }
3153
- function Ir(e) {
3154
- return e.split("-").map((t) => t[0]?.toUpperCase() + t.slice(1)).join(" ");
3155
- }
3156
- function wr(e) {
3157
- return e[0].toUpperCase() + e.slice(1);
3158
- }
3159
- function Pr(e) {
3160
- return e.split("-").map((t) => t[0]?.toUpperCase() + t.slice(1)).join(" ");
3161
- }
3162
- function I(e) {
3163
- return Math.round(e * 1e3) / 1e3;
3164
- }
3165
- function Ae(e, t) {
3166
- return e.some(
3167
- (n) => n.type === t.type && n.source === t.source && n.target === t.target
3168
- );
3169
- }
3170
- async function Sr(e, t) {
3171
- const n = br();
3172
- for (const r of e) {
3173
- const o = await r.evaluate(t);
3174
- n.violations.push(...o.violations ?? []), n.signals.push(...o.signals ?? []), n.measurements.push(...o.measurements ?? []);
3656
+ async function Uo(e, t) {
3657
+ const n = Ko();
3658
+ for (const o of e) {
3659
+ const r = await o.evaluate(t);
3660
+ n.violations.push(...r.violations ?? []), n.signals.push(...r.signals ?? []), n.measurements.push(...r.measurements ?? []);
3175
3661
  }
3176
3662
  return n;
3177
3663
  }
3178
- async function fo(e, t) {
3179
- return Sr(e.rules, t);
3664
+ async function Ur(e, t) {
3665
+ return Uo(e.rules, t);
3180
3666
  }
3181
- function br() {
3667
+ function Ko() {
3182
3668
  return {
3183
3669
  violations: [],
3184
3670
  signals: [],
3185
3671
  measurements: []
3186
3672
  };
3187
3673
  }
3188
- function go(e, t) {
3674
+ function Kr(e, t) {
3189
3675
  const n = Object.fromEntries(
3190
3676
  e.measurements.map((i) => [
3191
3677
  i.id,
3192
3678
  i.value
3193
3679
  ])
3194
- ), r = {
3680
+ ), o = {
3195
3681
  workspaceHealth: e.health.score,
3196
3682
  ...Object.fromEntries(
3197
3683
  e.measurements.map((i) => [
@@ -3199,11 +3685,11 @@ function go(e, t) {
3199
3685
  i.score
3200
3686
  ])
3201
3687
  )
3202
- }, o = e.violations.map(
3688
+ }, r = e.violations.map(
3203
3689
  (i) => ({
3204
3690
  type: i.ruleId,
3205
3691
  source: i.project,
3206
- target: jr(i.details?.target),
3692
+ target: Yo(i.details?.target),
3207
3693
  ruleId: i.ruleId,
3208
3694
  severity: i.severity,
3209
3695
  message: i.message
@@ -3212,8 +3698,8 @@ function go(e, t) {
3212
3698
  return {
3213
3699
  ...t,
3214
3700
  metrics: n,
3215
- scores: r,
3216
- violations: o,
3701
+ scores: o,
3702
+ violations: r,
3217
3703
  health: {
3218
3704
  score: e.health.score,
3219
3705
  status: e.health.status,
@@ -3225,98 +3711,114 @@ function go(e, t) {
3225
3711
  deliveryImpact: t.deliveryImpact
3226
3712
  };
3227
3713
  }
3228
- function jr(e) {
3714
+ function Yo(e) {
3229
3715
  return typeof e == "string" ? e : void 0;
3230
3716
  }
3231
3717
  export {
3232
- qn as CORE_BUILT_IN_RULE_PACK_ID,
3233
- N as DEFAULT_HEALTH_STATUS_THRESHOLDS,
3234
- Kr as DefaultGovernanceCapabilityRegistry,
3235
- te as GovernanceExtensionRegistrationError,
3236
- Zt as applyGovernanceEnrichers,
3237
- Le as applyGovernanceExceptions,
3238
- oo as buildAiDriftHandoffPayload,
3239
- z as buildAiHandoffPayload,
3240
- ao as buildAiManagementInsightsHandoffPayload,
3241
- ro as buildAiPrImpactHandoffPayload,
3242
- no as buildAiRootCauseHandoffPayload,
3243
- io as buildAiScorecardHandoffPayload,
3244
- Ar as buildArchitectureRecommendationsRequest,
3245
- Or as buildCognitiveLoadRequest,
3246
- Hn as buildDeliveryImpactAssessment,
3247
- mo as buildDriftSummary,
3248
- Pt as buildGovernanceAssessment,
3249
- to as buildGovernanceAssessmentArtifacts,
3250
- Qe as buildGovernanceConformanceSignals,
3251
- Ne as buildGovernanceExceptionReport,
3252
- Te as buildGovernanceExceptionScopeKey,
3253
- Ze as buildGovernanceGraphSignals,
3254
- Dr as buildGovernanceInventory,
3255
- et as buildGovernancePolicySignals,
3256
- He as buildGovernanceRecommendations,
3257
- eo as buildGovernanceSignals,
3258
- U as buildGovernanceWorkspace,
3259
- kr as buildGovernanceWorkspaceFromAdapterResult,
3260
- Vr as buildManagementInsightsAiRequest,
3261
- Dt as buildMetricBreakdown,
3262
- go as buildMetricSnapshot,
3263
- Rr as buildOnboardingRequest,
3264
- Er as buildPrImpactRequest,
3265
- Xr as buildRecommendations,
3266
- Fr as buildRefactoringSuggestionsRequest,
3267
- $r as buildRootCauseRequest,
3268
- Mr as buildScorecardRequest,
3269
- xt as buildSignalBreakdown,
3270
- zr as buildSmellClustersRequest,
3271
- Fe as buildTopIssues,
3272
- co as calculateDeliveryImpact,
3273
- We as calculateGovernanceHealth,
3274
- Ue as calculateGovernanceMetrics,
3275
- Jr as calculateHealthScore,
3276
- Zr as calculateMetrics,
3277
- tn as collectGovernanceMeasurements,
3278
- en as collectGovernanceSignals,
3279
- lo as compareSnapshots,
3280
- Pn as coreBuiltInPolicyRules,
3281
- Wn as coreBuiltInRulePack,
3282
- so as coreBuiltInRulePacks,
3283
- Ft as createEmptyGovernanceExceptionReport,
3284
- de as deriveAllowedLayerDependenciesFromLayerOrder,
3285
- R as domainBoundaryRule,
3286
- Qr as evaluateBuiltInGovernancePolicies,
3287
- je as evaluateCoreBuiltInPolicyViolations,
3288
- zt as evaluateGovernanceExceptionLifecycle,
3289
- Ke as evaluateGovernancePolicies,
3290
- Qt as evaluateGovernanceRulePacks,
3291
- fo as evaluateRulePack,
3292
- Sr as evaluateRules,
3293
- bt as filterMeasurementsForReportType,
3294
- jt as filterSignalsForReportType,
3295
- St as filterViolationsForReportType,
3296
- Et as isConformanceExceptionScope,
3297
- Ge as isPolicyExceptionScope,
3298
- O as layerBoundaryRule,
3299
- ae as mergeGovernanceSignals,
3300
- W as missingDomainRule,
3301
- H as missingLayerRule,
3302
- Ur as normalizeGovernanceException,
3303
- S as normalizeGovernanceProfile,
3304
- Cr as normalizeGovernanceWorkspace,
3718
+ Ro as CORE_BUILT_IN_RULE_PACK_ID,
3719
+ q as DEFAULT_HEALTH_STATUS_THRESHOLDS,
3720
+ Er as DefaultGovernanceCapabilityRegistry,
3721
+ se as GovernanceExtensionRegistrationError,
3722
+ Bn as applyGovernanceEnrichers,
3723
+ nt as applyGovernanceExceptions,
3724
+ Gr as buildAiDriftHandoffPayload,
3725
+ F as buildAiHandoffPayload,
3726
+ qr as buildAiManagementInsightsHandoffPayload,
3727
+ Br as buildAiPrImpactHandoffPayload,
3728
+ Lr as buildAiRootCauseHandoffPayload,
3729
+ Nr as buildAiScorecardHandoffPayload,
3730
+ ir as buildArchitectureRecommendationsRequest,
3731
+ Cr as buildCognitiveLoadContext,
3732
+ rr as buildCognitiveLoadRequest,
3733
+ Vo as buildDeliveryImpactAssessment,
3734
+ jr as buildDriftInterpretationAnalysis,
3735
+ Ft as buildDriftSummary,
3736
+ dn as buildGovernanceAssessment,
3737
+ Tr as buildGovernanceAssessmentArtifacts,
3738
+ ft as buildGovernanceConformanceSignals,
3739
+ ot as buildGovernanceExceptionReport,
3740
+ Qe as buildGovernanceExceptionScopeKey,
3741
+ mt as buildGovernanceGraphSignals,
3742
+ Xo as buildGovernanceInventory,
3743
+ _e as buildGovernancePayloadTruncationMetadata,
3744
+ gt as buildGovernancePolicySignals,
3745
+ at as buildGovernanceRecommendations,
3746
+ zr as buildGovernanceSignals,
3747
+ X as buildGovernanceWorkspace,
3748
+ Qo as buildGovernanceWorkspaceFromAdapterResult,
3749
+ cr as buildManagementInsightsAiRequest,
3750
+ fn as buildMetricBreakdown,
3751
+ Kr as buildMetricSnapshot,
3752
+ $r as buildOnboardingContext,
3753
+ or as buildOnboardingRequest,
3754
+ tn as buildPersistentSmellSignals,
3755
+ br as buildPrImpactContext,
3756
+ tr as buildPrImpactRequest,
3757
+ Vr as buildRecommendations,
3758
+ Dr as buildRecommendationsTrendContext,
3759
+ kr as buildRefactoringSuggestionsContext,
3760
+ ar as buildRefactoringSuggestionsRequest,
3761
+ er as buildRootCauseRequest,
3762
+ Sr as buildScopedDriftRequest,
3763
+ Ir as buildScopedRootCauseRequest,
3764
+ Pr as buildScopedScorecardRequest,
3765
+ nr as buildScorecardRequest,
3766
+ mn as buildSignalBreakdown,
3767
+ sr as buildSmellClustersRequest,
3768
+ Xe as buildTopIssues,
3769
+ Wr as calculateDeliveryImpact,
3770
+ st as calculateGovernanceHealth,
3771
+ ct as calculateGovernanceMetrics,
3772
+ Or as calculateHealthScore,
3773
+ Ar as calculateMetrics,
3774
+ qn as collectGovernanceMeasurements,
3775
+ Nn as collectGovernanceSignals,
3776
+ _ as compareGovernanceViolationsForPriority,
3777
+ vr as compareSnapshots,
3778
+ co as coreBuiltInPolicyRules,
3779
+ Oo as coreBuiltInRulePack,
3780
+ _r as coreBuiltInRulePacks,
3781
+ xr as countWorseningDriftSignals,
3782
+ bn as createEmptyGovernanceExceptionReport,
3783
+ ge as deriveAllowedLayerDependenciesFromLayerOrder,
3784
+ O as domainBoundaryRule,
3785
+ Fr as evaluateBuiltInGovernancePolicies,
3786
+ ze as evaluateCoreBuiltInPolicyViolations,
3787
+ jn as evaluateGovernanceExceptionLifecycle,
3788
+ dt as evaluateGovernancePolicies,
3789
+ Gn as evaluateGovernanceRulePacks,
3790
+ Ur as evaluateRulePack,
3791
+ Uo as evaluateRules,
3792
+ un as filterMeasurementsForReportType,
3793
+ pn as filterSignalsForReportType,
3794
+ ln as filterViolationsForReportType,
3795
+ vn as isConformanceExceptionScope,
3796
+ et as isPolicyExceptionScope,
3797
+ V as layerBoundaryRule,
3798
+ ue as mergeGovernanceSignals,
3799
+ Y as missingDomainRule,
3800
+ J as missingLayerRule,
3801
+ Mr as normalizeGovernanceException,
3802
+ j as normalizeGovernanceProfile,
3803
+ Zo as normalizeGovernanceWorkspace,
3305
3804
  A as ownershipPresenceRule,
3306
- _ as projectNameConventionRule,
3307
- yt as rankTopViolations,
3308
- Yr as registerLoadedGovernanceExtensions,
3309
- Xt as registerLoadedGovernanceExtensionsWithDiagnostics,
3310
- _r as summarizeArchitectureRecommendations,
3311
- qr as summarizeCognitiveLoad,
3312
- uo as summarizeDeliveryImpact,
3313
- po as summarizeDrift,
3314
- Nr as summarizeManagementInsights,
3315
- Lr as summarizeOnboarding,
3316
- Gr as summarizePrImpact,
3317
- Hr as summarizeRefactoringSuggestions,
3318
- Tr as summarizeRootCause,
3319
- Br as summarizeScorecard,
3320
- Wr as summarizeSmellClusters,
3321
- q as tagConventionRule
3805
+ U as projectNameConventionRule,
3806
+ Mt as rankTopViolations,
3807
+ Rr as registerLoadedGovernanceExtensions,
3808
+ Ln as registerLoadedGovernanceExtensionsWithDiagnostics,
3809
+ Jt as scopeGovernanceDependencies,
3810
+ h as sliceGovernancePayloadItems,
3811
+ fr as summarizeArchitectureRecommendations,
3812
+ gr as summarizeCognitiveLoad,
3813
+ Hr as summarizeDeliveryImpact,
3814
+ wr as summarizeDrift,
3815
+ en as summarizeDriftInterpretation,
3816
+ mr as summarizeManagementInsights,
3817
+ pr as summarizeOnboarding,
3818
+ lr as summarizePrImpact,
3819
+ hr as summarizeRefactoringSuggestions,
3820
+ dr as summarizeRootCause,
3821
+ ur as summarizeScorecard,
3822
+ yr as summarizeSmellClusters,
3823
+ K as tagConventionRule
3322
3824
  };