@anarchitects/governance-core 0.0.3 → 0.0.4

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,21 +1,21 @@
1
- import { createHash as St } from "node:crypto";
1
+ import { createHash as Pt } from "node:crypto";
2
2
  function X(e, t = { projectOverrides: {} }) {
3
- const n = Pt(e), o = jt(e);
3
+ const n = jt(e), o = bt(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
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);
9
+ const i = Ct(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 = kt(a);
10
10
  return {
11
11
  id: r.id,
12
12
  name: i,
13
13
  root: r.root ?? "",
14
- type: Ct(r.type),
14
+ type: Dt(r.type),
15
15
  tags: s,
16
16
  domain: c,
17
17
  layer: l,
18
- ownership: kt(
18
+ ownership: $t(
19
19
  u,
20
20
  d.ownershipTeam,
21
21
  r.ownership
@@ -34,8 +34,8 @@ function X(e, t = { projectOverrides: {} }) {
34
34
  }))
35
35
  };
36
36
  }
37
- const Xo = X, Zo = X, Qo = X;
38
- function Pt(e) {
37
+ const tr = X, nr = X, or = X;
38
+ function jt(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 Pt(e) {
48
48
  metadata: t.metadata
49
49
  })) : [];
50
50
  }
51
- function jt(e) {
51
+ function bt(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 jt(e) {
56
56
  sourceFile: t.sourceFile
57
57
  })) : [];
58
58
  }
59
- function bt(e) {
59
+ function Ct(e) {
60
60
  return e.name ?? e.id;
61
61
  }
62
62
  function oe(e, t) {
63
63
  return e.find((o) => o.startsWith(`${t}:`))?.split(":").slice(1).join(":");
64
64
  }
65
- function Ct(e) {
65
+ function Dt(e) {
66
66
  return e === "application" || e === "app" ? "application" : e === "library" || e === "lib" ? "library" : e === "tool" ? "tool" : "unknown";
67
67
  }
68
68
  function xt(e) {
69
69
  return e === "static" || e === "dynamic" || e === "implicit" ? e : "unknown";
70
70
  }
71
- function Dt(e) {
71
+ function kt(e) {
72
72
  const t = e.ownership;
73
73
  if (typeof t == "string" && t)
74
74
  return t;
@@ -78,7 +78,7 @@ function Dt(e) {
78
78
  return n;
79
79
  }
80
80
  }
81
- function kt(e, t, n) {
81
+ function $t(e, t, n) {
82
82
  const o = n?.contacts ?? [], r = t ?? e ?? n?.team;
83
83
  return r && o.length ? {
84
84
  team: r,
@@ -87,7 +87,7 @@ function kt(e, t, n) {
87
87
  } : r ? {
88
88
  team: r,
89
89
  contacts: [],
90
- source: $t(n?.source)
90
+ source: Mt(n?.source)
91
91
  } : o.length ? {
92
92
  contacts: o,
93
93
  source: "codeowners"
@@ -95,10 +95,10 @@ function kt(e, t, n) {
95
95
  source: "none"
96
96
  };
97
97
  }
98
- function $t(e) {
98
+ function Mt(e) {
99
99
  return e === "merged" || e === "project-metadata" ? e : e === "codeowners" ? "codeowners" : "project-metadata";
100
100
  }
101
- function er(e) {
101
+ function rr(e) {
102
102
  return {
103
103
  kind: "root-cause",
104
104
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -111,7 +111,7 @@ function er(e) {
111
111
  }
112
112
  };
113
113
  }
114
- function tr(e) {
114
+ function ir(e) {
115
115
  return {
116
116
  kind: "pr-impact",
117
117
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -123,7 +123,7 @@ function tr(e) {
123
123
  }
124
124
  };
125
125
  }
126
- function nr(e) {
126
+ function sr(e) {
127
127
  return {
128
128
  kind: "scorecard",
129
129
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -135,7 +135,7 @@ function nr(e) {
135
135
  }
136
136
  };
137
137
  }
138
- function or(e) {
138
+ function ar(e) {
139
139
  return {
140
140
  kind: "onboarding",
141
141
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -147,7 +147,7 @@ function or(e) {
147
147
  }
148
148
  };
149
149
  }
150
- function rr(e) {
150
+ function cr(e) {
151
151
  return {
152
152
  kind: "cognitive-load",
153
153
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -159,7 +159,7 @@ function rr(e) {
159
159
  }
160
160
  };
161
161
  }
162
- function ir(e) {
162
+ function dr(e) {
163
163
  return {
164
164
  kind: "recommendations",
165
165
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -172,7 +172,7 @@ function ir(e) {
172
172
  }
173
173
  };
174
174
  }
175
- function sr(e) {
175
+ function lr(e) {
176
176
  return {
177
177
  kind: "smell-clusters",
178
178
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -185,7 +185,7 @@ function sr(e) {
185
185
  }
186
186
  };
187
187
  }
188
- function ar(e) {
188
+ function ur(e) {
189
189
  return {
190
190
  kind: "refactoring-suggestions",
191
191
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -198,7 +198,7 @@ function ar(e) {
198
198
  }
199
199
  };
200
200
  }
201
- function cr(e) {
201
+ function pr(e) {
202
202
  return {
203
203
  kind: "management-insights",
204
204
  generatedAt: e.generatedAt ?? e.deliveryImpact.generatedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
@@ -220,7 +220,7 @@ function cr(e) {
220
220
  }
221
221
  };
222
222
  }
223
- function Mt(e, t = 10) {
223
+ function Et(e, t = 10) {
224
224
  const n = {
225
225
  error: 3,
226
226
  warning: 2,
@@ -231,7 +231,7 @@ function Mt(e, t = 10) {
231
231
  return i !== 0 ? i : we(o).localeCompare(we(r));
232
232
  }).slice(0, Math.max(0, t));
233
233
  }
234
- function dr(e) {
234
+ function mr(e) {
235
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
237
  title: `Hotspot: ${s}`,
@@ -249,14 +249,14 @@ function dr(e) {
249
249
  kind: "root-cause",
250
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: Et(o),
252
+ recommendations: Rt(o),
253
253
  metadata: {
254
254
  violationTypes: o,
255
255
  analyzedViolationCount: t.length
256
256
  }
257
257
  };
258
258
  }
259
- function lr(e) {
259
+ function fr(e) {
260
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"
@@ -281,7 +281,7 @@ function lr(e) {
281
281
  confidence: 1
282
282
  }
283
283
  ],
284
- recommendations: Ne(d),
284
+ recommendations: qe(d),
285
285
  metadata: {
286
286
  changedFilesCount: n,
287
287
  affectedProjectsCount: o,
@@ -291,7 +291,7 @@ function lr(e) {
291
291
  }
292
292
  };
293
293
  }
294
- function ur(e) {
294
+ function gr(e) {
295
295
  const t = e.inputs.snapshot, n = e.inputs.comparison, o = t?.health?.score ?? 0;
296
296
  return {
297
297
  kind: "scorecard",
@@ -318,7 +318,7 @@ function ur(e) {
318
318
  }
319
319
  };
320
320
  }
321
- function pr(e) {
321
+ function yr(e) {
322
322
  const t = e.inputs.dependencies?.length ?? 0, n = e.inputs.topViolations?.length ?? 0;
323
323
  return {
324
324
  kind: "onboarding",
@@ -346,7 +346,7 @@ function pr(e) {
346
346
  }
347
347
  };
348
348
  }
349
- function mr(e) {
349
+ function hr(e) {
350
350
  const t = Ie(e.inputs.metadata), n = Ie(t?.deliveryImpact);
351
351
  if (!n || n.indices.length === 0)
352
352
  return {
@@ -404,7 +404,7 @@ function mr(e) {
404
404
  }
405
405
  };
406
406
  }
407
- function fr(e) {
407
+ function vr(e) {
408
408
  return pe(
409
409
  e,
410
410
  "recommendations",
@@ -412,7 +412,7 @@ function fr(e) {
412
412
  "Generate architecture work items from the strongest governance hotspots."
413
413
  );
414
414
  }
415
- function gr(e) {
415
+ function wr(e) {
416
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)
@@ -429,7 +429,7 @@ function gr(e) {
429
429
  confidence: 0.8
430
430
  }
431
431
  ],
432
- recommendations: Ne(r),
432
+ recommendations: qe(r),
433
433
  metadata: {
434
434
  score: o,
435
435
  affectedProjectsCount: t.length,
@@ -437,7 +437,7 @@ function gr(e) {
437
437
  }
438
438
  };
439
439
  }
440
- function yr(e) {
440
+ function Ir(e) {
441
441
  return pe(
442
442
  e,
443
443
  "smell-clusters",
@@ -445,7 +445,7 @@ function yr(e) {
445
445
  "Group recurring hotspots before choosing remediation sequencing."
446
446
  );
447
447
  }
448
- function hr(e) {
448
+ function Sr(e) {
449
449
  return pe(
450
450
  e,
451
451
  "refactoring-suggestions",
@@ -454,7 +454,7 @@ function hr(e) {
454
454
  );
455
455
  }
456
456
  function pe(e, t, n, o) {
457
- const r = e.inputs.topViolations ?? [], i = Mt(r, 5);
457
+ const r = e.inputs.topViolations ?? [], i = Et(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).`,
@@ -475,7 +475,7 @@ function pe(e, t, n, o) {
475
475
  ] : []
476
476
  };
477
477
  }
478
- function Et(e) {
478
+ function Rt(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 Et(e) {
483
483
  reason: `${t} is recurring in the prioritized violation set.`
484
484
  }));
485
485
  }
486
- function Ne(e) {
486
+ function qe(e) {
487
487
  return e === "low" ? [] : [
488
488
  {
489
489
  id: "reduce-change-risk",
@@ -515,11 +515,11 @@ function we(e) {
515
515
  function Ie(e) {
516
516
  return typeof e == "object" && e !== null && !Array.isArray(e) ? e : void 0;
517
517
  }
518
- const Rt = [
518
+ const Ot = [
519
519
  "graph",
520
520
  "conformance",
521
521
  "policy"
522
- ], Ot = ["info", "warning", "error"], Vt = [
522
+ ], Vt = ["info", "warning", "error"], At = [
523
523
  "structural-dependency",
524
524
  "cross-domain-dependency",
525
525
  "missing-domain-context",
@@ -528,32 +528,32 @@ const Rt = [
528
528
  "domain-boundary-violation",
529
529
  "layer-boundary-violation",
530
530
  "ownership-gap"
531
- ], At = [
531
+ ], Ft = [
532
532
  "architecture",
533
533
  "boundaries",
534
534
  "ownership",
535
535
  "documentation"
536
536
  ];
537
- function vr(e, t) {
537
+ function Pr(e, t) {
538
538
  return {
539
539
  baseline: e,
540
540
  current: t,
541
541
  metricDeltas: Se(e.metrics, t.metrics),
542
542
  scoreDeltas: Se(e.scores, t.scores),
543
543
  newViolations: t.violations.filter(
544
- (n) => !xe(e.violations, n)
544
+ (n) => !De(e.violations, n)
545
545
  ),
546
546
  resolvedViolations: e.violations.filter(
547
- (n) => !xe(t.violations, n)
547
+ (n) => !De(t.violations, n)
548
548
  ),
549
- healthDelta: zt(e, t),
550
- signalDeltas: Tt(e, t),
551
- metricFamilyDeltas: Lt(e, t),
552
- topIssueDeltas: Bt(e, t),
549
+ healthDelta: Tt(e, t),
550
+ signalDeltas: Lt(e, t),
551
+ metricFamilyDeltas: Bt(e, t),
552
+ topIssueDeltas: Nt(e, t),
553
553
  deliveryImpactIndexDeltas: Gt(e, t)
554
554
  };
555
555
  }
556
- function wr(e, t = 0.02) {
556
+ function jr(e, t = 0.02) {
557
557
  const n = [], o = e.scoreDeltas.find(
558
558
  (r) => r.id === "workspaceHealth"
559
559
  );
@@ -577,7 +577,7 @@ function wr(e, t = 0.02) {
577
577
  re(
578
578
  r.id,
579
579
  "metric-score",
580
- Ut(r.id),
580
+ Kt(r.id),
581
581
  r,
582
582
  t
583
583
  )
@@ -587,14 +587,14 @@ function wr(e, t = 0.02) {
587
587
  re(
588
588
  `metric-family:${r.family}`,
589
589
  "metric-family",
590
- `Metric Family: ${Kt(r.family)}`,
590
+ `Metric Family: ${Yt(r.family)}`,
591
591
  r,
592
592
  t
593
593
  )
594
594
  );
595
595
  for (const r of e.signalDeltas?.bySource ?? [])
596
596
  n.push(
597
- G(
597
+ N(
598
598
  `signal-source:${r.source}`,
599
599
  "signal-source",
600
600
  `Signal Source: ${r.source}`,
@@ -603,16 +603,16 @@ function wr(e, t = 0.02) {
603
603
  );
604
604
  for (const r of e.signalDeltas?.byType ?? [])
605
605
  n.push(
606
- G(
606
+ N(
607
607
  `signal-type:${r.type}`,
608
608
  "signal-type",
609
- `Signal Type: ${Yt(r.type)}`,
609
+ `Signal Type: ${Jt(r.type)}`,
610
610
  r
611
611
  )
612
612
  );
613
613
  for (const r of e.signalDeltas?.bySeverity ?? [])
614
614
  n.push(
615
- G(
615
+ N(
616
616
  `signal-severity:${r.severity}`,
617
617
  "signal-severity",
618
618
  `Signal Severity: ${r.severity}`,
@@ -621,8 +621,8 @@ function wr(e, t = 0.02) {
621
621
  );
622
622
  for (const r of e.topIssueDeltas ?? [])
623
623
  n.push(
624
- G(
625
- _t(r),
624
+ N(
625
+ Wt(r),
626
626
  "top-issue",
627
627
  `Top Issue: ${r.message}`,
628
628
  {
@@ -643,7 +643,7 @@ function wr(e, t = 0.02) {
643
643
  id: "violation-footprint",
644
644
  kind: "violation-footprint",
645
645
  label: "Violation Footprint",
646
- status: qe(
646
+ status: _e(
647
647
  e.newViolations.length - e.resolvedViolations.length
648
648
  ),
649
649
  magnitude: Math.abs(
@@ -658,9 +658,9 @@ function wr(e, t = 0.02) {
658
658
  newViolations: e.newViolations.length,
659
659
  resolvedViolations: e.resolvedViolations.length
660
660
  }
661
- }), n.sort(Wt);
661
+ }), n.sort(Ht);
662
662
  }
663
- function Ft(e) {
663
+ function zt(e) {
664
664
  const t = e.filter((r) => r.status === "worsening").sort(Ce), n = e.filter((r) => r.status === "improving").sort(Ce), o = e.filter(
665
665
  (r) => r.status === "stable"
666
666
  ).length;
@@ -684,7 +684,7 @@ function Se(e, t) {
684
684
  };
685
685
  });
686
686
  }
687
- function zt(e, t) {
687
+ function Tt(e, t) {
688
688
  if (!(!e.health || !t.health))
689
689
  return {
690
690
  baselineScore: e.health.score,
@@ -696,17 +696,17 @@ function zt(e, t) {
696
696
  currentGrade: t.health.grade
697
697
  };
698
698
  }
699
- function Tt(e, t) {
699
+ function Lt(e, t) {
700
700
  if (!(!e.signalBreakdown || !t.signalBreakdown))
701
701
  return {
702
- bySource: Rt.map(
703
- (n) => Nt(
702
+ bySource: Ot.map(
703
+ (n) => qt(
704
704
  n,
705
705
  Pe(e, n),
706
706
  Pe(t, n)
707
707
  )
708
708
  ),
709
- byType: Vt.flatMap((n) => {
709
+ byType: At.flatMap((n) => {
710
710
  const o = je(e, n), r = je(t, n);
711
711
  return o === 0 && r === 0 ? [] : [
712
712
  {
@@ -717,8 +717,8 @@ function Tt(e, t) {
717
717
  }
718
718
  ];
719
719
  }),
720
- bySeverity: Ot.map(
721
- (n) => qt(
720
+ bySeverity: Vt.map(
721
+ (n) => _t(
722
722
  n,
723
723
  be(e, n),
724
724
  be(t, n)
@@ -726,7 +726,7 @@ function Tt(e, t) {
726
726
  )
727
727
  };
728
728
  }
729
- function Lt(e, t) {
729
+ function Bt(e, t) {
730
730
  if (!e.metricBreakdown || !t.metricBreakdown)
731
731
  return;
732
732
  const n = new Map(
@@ -740,7 +740,7 @@ function Lt(e, t) {
740
740
  r.score
741
741
  ])
742
742
  );
743
- return At.flatMap((r) => {
743
+ return Ft.flatMap((r) => {
744
744
  const i = n.get(r), s = o.get(r);
745
745
  return i === void 0 || s === void 0 ? [] : [
746
746
  {
@@ -752,7 +752,7 @@ function Lt(e, t) {
752
752
  ];
753
753
  });
754
754
  }
755
- function Bt(e, t) {
755
+ function Nt(e, t) {
756
756
  if (!e.topIssues || !t.topIssues)
757
757
  return;
758
758
  const n = new Map(
@@ -804,7 +804,7 @@ function re(e, t, n, o, r, i) {
804
804
  id: e,
805
805
  kind: t,
806
806
  label: n,
807
- status: Ht(o.delta, r),
807
+ status: Ut(o.delta, r),
808
808
  magnitude: Math.abs(o.delta),
809
809
  baseline: o.baseline,
810
810
  current: o.current,
@@ -812,12 +812,12 @@ function re(e, t, n, o, r, i) {
812
812
  details: i
813
813
  };
814
814
  }
815
- function G(e, t, n, o, r) {
815
+ function N(e, t, n, o, r) {
816
816
  return {
817
817
  id: e,
818
818
  kind: t,
819
819
  label: n,
820
- status: qe(o.delta),
820
+ status: _e(o.delta),
821
821
  magnitude: Math.abs(o.delta),
822
822
  baseline: o.baseline,
823
823
  current: o.current,
@@ -825,7 +825,7 @@ function G(e, t, n, o, r) {
825
825
  details: r
826
826
  };
827
827
  }
828
- function Nt(e, t, n) {
828
+ function qt(e, t, n) {
829
829
  return {
830
830
  source: e,
831
831
  baseline: t,
@@ -833,7 +833,7 @@ function Nt(e, t, n) {
833
833
  delta: I(n - t)
834
834
  };
835
835
  }
836
- function qt(e, t, n) {
836
+ function _t(e, t, n) {
837
837
  return {
838
838
  severity: e,
839
839
  baseline: t,
@@ -861,39 +861,39 @@ function de(e) {
861
861
  e.message
862
862
  ].join("|");
863
863
  }
864
- function _t(e) {
864
+ function Wt(e) {
865
865
  return `top-issue:${de(e)}`;
866
866
  }
867
- function Wt(e, t) {
867
+ function Ht(e, t) {
868
868
  return e.id.localeCompare(t.id);
869
869
  }
870
870
  function Ce(e, t) {
871
871
  return t.magnitude - e.magnitude || e.id.localeCompare(t.id);
872
872
  }
873
- function Ht(e, t) {
873
+ function Ut(e, t) {
874
874
  return Math.abs(e) < t ? "stable" : e > 0 ? "improving" : "worsening";
875
875
  }
876
- function qe(e) {
876
+ function _e(e) {
877
877
  return e === 0 ? "stable" : e < 0 ? "improving" : "worsening";
878
878
  }
879
- function Ut(e) {
879
+ function Kt(e) {
880
880
  return e.split("-").map((t) => t[0]?.toUpperCase() + t.slice(1)).join(" ");
881
881
  }
882
- function Kt(e) {
882
+ function Yt(e) {
883
883
  return e[0].toUpperCase() + e.slice(1);
884
884
  }
885
- function Yt(e) {
885
+ function Jt(e) {
886
886
  return e.split("-").map((t) => t[0]?.toUpperCase() + t.slice(1)).join(" ");
887
887
  }
888
888
  function I(e) {
889
889
  return Math.round(e * 1e3) / 1e3;
890
890
  }
891
- function xe(e, t) {
891
+ function De(e, t) {
892
892
  return e.some(
893
893
  (n) => n.type === t.type && n.source === t.source && n.target === t.target
894
894
  );
895
895
  }
896
- function _e(e, t, n) {
896
+ function We(e, t, n) {
897
897
  return {
898
898
  totalCount: e,
899
899
  selectedCount: t,
@@ -902,42 +902,42 @@ function _e(e, t, n) {
902
902
  };
903
903
  }
904
904
  function h(e, t, n) {
905
- const o = We(t, e.length), r = [...e].sort(n), i = r.slice(0, o);
905
+ const o = He(t, e.length), r = [...e].sort(n), i = r.slice(0, o);
906
906
  return {
907
907
  items: i,
908
- truncation: _e(
908
+ truncation: We(
909
909
  r.length,
910
910
  i.length,
911
911
  o
912
912
  )
913
913
  };
914
914
  }
915
- function Jt(e, t, n) {
915
+ function Xt(e, t, n) {
916
916
  const o = new Set(t), r = e.filter(
917
917
  (i) => o.has(i.source) || o.has(i.target)
918
918
  );
919
919
  return h(
920
920
  r,
921
921
  n,
922
- Xt
922
+ Zt
923
923
  );
924
924
  }
925
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 ?? "");
926
+ return xe(t.severity) - xe(e.severity) || (e.source ?? "").localeCompare(t.source ?? "") || (e.type ?? "").localeCompare(t.type ?? "") || (e.target ?? "").localeCompare(t.target ?? "");
927
927
  }
928
- function Ir(e) {
928
+ function br(e) {
929
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(
930
+ const t = e.dependencies ?? e.request.inputs.dependencies ?? [], n = e.topViolations ?? e.request.inputs.topViolations ?? [], o = e.projectScope ? new Set(e.projectScope) : en(n), r = Xt(
931
931
  t,
932
932
  o,
933
933
  e.dependencyLimit
934
- ), i = e.request.inputs.snapshot?.violations.length ?? n.length, s = We(
934
+ ), i = e.request.inputs.snapshot?.violations.length ?? n.length, s = He(
935
935
  e.topViolationsLimit,
936
936
  n.length
937
937
  ), a = {
938
938
  projectScopeCount: o.size,
939
939
  dependencies: r.truncation,
940
- violations: _e(
940
+ violations: We(
941
941
  i,
942
942
  n.length,
943
943
  s
@@ -950,7 +950,7 @@ function Ir(e) {
950
950
  ...e.request.inputs,
951
951
  topViolations: n,
952
952
  dependencies: r.items,
953
- metadata: He(
953
+ metadata: Ue(
954
954
  e.request.inputs.metadata,
955
955
  a
956
956
  )
@@ -959,12 +959,12 @@ function Ir(e) {
959
959
  payloadScope: a
960
960
  };
961
961
  }
962
- function Sr(e) {
962
+ function Cr(e) {
963
963
  me(e.request, "drift");
964
964
  const t = e.comparison ?? e.request.inputs.comparison, n = e.signals ?? [], o = e.summary, r = h(
965
965
  n,
966
966
  e.signalLimit,
967
- Zt
967
+ Qt
968
968
  ), i = h(
969
969
  t?.metricDeltas ?? [],
970
970
  e.deltaLimit,
@@ -1006,8 +1006,8 @@ function Sr(e) {
1006
1006
  ...e.request.inputs.metadata ?? {},
1007
1007
  signals: r.items,
1008
1008
  ...o ? { driftSummary: o } : {},
1009
- payloadScope: Ke(
1010
- Ue(e.request.inputs.metadata),
1009
+ payloadScope: Ye(
1010
+ Ke(e.request.inputs.metadata),
1011
1011
  c
1012
1012
  )
1013
1013
  }
@@ -1016,7 +1016,7 @@ function Sr(e) {
1016
1016
  payloadScope: c
1017
1017
  };
1018
1018
  }
1019
- function Pr(e) {
1019
+ function Dr(e) {
1020
1020
  me(e.request, "scorecard");
1021
1021
  const t = e.snapshot ?? e.request.inputs.snapshot, n = e.comparison ?? e.request.inputs.comparison, o = h(
1022
1022
  t?.violations ?? [],
@@ -1059,7 +1059,7 @@ function Pr(e) {
1059
1059
  newViolations: [],
1060
1060
  resolvedViolations: []
1061
1061
  } : void 0,
1062
- metadata: He(
1062
+ metadata: Ue(
1063
1063
  e.request.inputs.metadata,
1064
1064
  s
1065
1065
  )
@@ -1068,19 +1068,19 @@ function Pr(e) {
1068
1068
  payloadScope: s
1069
1069
  };
1070
1070
  }
1071
- function Xt(e, t) {
1071
+ function Zt(e, t) {
1072
1072
  return e.source.localeCompare(t.source) || e.target.localeCompare(t.target) || e.type.localeCompare(t.type) || (e.sourceFile ?? "").localeCompare(t.sourceFile ?? "");
1073
1073
  }
1074
- function Zt(e, t) {
1074
+ function Qt(e, t) {
1075
1075
  return t.magnitude - e.magnitude || e.id.localeCompare(t.id);
1076
1076
  }
1077
1077
  function W(e, t) {
1078
1078
  return Math.abs(t.delta) - Math.abs(e.delta) || e.id.localeCompare(t.id);
1079
1079
  }
1080
- function De(e) {
1080
+ function xe(e) {
1081
1081
  return e === "error" ? 3 : e === "warning" ? 2 : e === "info" ? 1 : 0;
1082
1082
  }
1083
- function Qt(e) {
1083
+ function en(e) {
1084
1084
  const t = /* @__PURE__ */ new Set();
1085
1085
  for (const n of e)
1086
1086
  t.add(n.source), n.target && t.add(n.target);
@@ -1092,7 +1092,7 @@ function me(e, t) {
1092
1092
  `Expected an AI analysis request of kind "${t}", received "${e.kind}".`
1093
1093
  );
1094
1094
  }
1095
- function We(e, t) {
1095
+ function He(e, t) {
1096
1096
  return typeof e != "number" || Number.isNaN(e) ? t : Math.max(0, Math.trunc(e));
1097
1097
  }
1098
1098
  function H(e) {
@@ -1108,28 +1108,28 @@ function H(e) {
1108
1108
  violations: []
1109
1109
  };
1110
1110
  }
1111
- function He(e, t) {
1111
+ function Ue(e, t) {
1112
1112
  return {
1113
1113
  ...e,
1114
- payloadScope: Ke(Ue(e), t)
1114
+ payloadScope: Ye(Ke(e), t)
1115
1115
  };
1116
1116
  }
1117
- function Ue(e) {
1117
+ function Ke(e) {
1118
1118
  const t = e?.payloadScope;
1119
1119
  if (!(typeof t != "object" || t === null || Array.isArray(t)))
1120
1120
  return t;
1121
1121
  }
1122
- function Ke(e, t) {
1122
+ function Ye(e, t) {
1123
1123
  return {
1124
1124
  ...e ?? {},
1125
1125
  ...t
1126
1126
  };
1127
1127
  }
1128
- function en(e, t, n) {
1128
+ function tn(e, t, n) {
1129
1129
  const o = t.map((r) => ({
1130
1130
  id: `drift-${r.id}`,
1131
1131
  title: r.label,
1132
- detail: `Status is ${r.status} with delta ${rn(
1132
+ detail: `Status is ${r.status} with delta ${sn(
1133
1133
  r.delta
1134
1134
  )} and magnitude ${r.magnitude.toFixed(3)}.`,
1135
1135
  signals: ["drift-analysis", "snapshot-comparison"],
@@ -1150,7 +1150,7 @@ function en(e, t, n) {
1150
1150
  id: "drift-validate-trend-window",
1151
1151
  title: "Validate Trend Window Confidence",
1152
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."
1153
+ reason: rn(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
1154
  }
1155
1155
  ],
1156
1156
  metadata: {
@@ -1165,9 +1165,9 @@ function en(e, t, n) {
1165
1165
  }
1166
1166
  };
1167
1167
  }
1168
- const jr = en;
1169
- function br(e) {
1170
- const t = Ye(
1168
+ const xr = tn;
1169
+ function kr(e) {
1170
+ const t = Je(
1171
1171
  e.affectedProjects,
1172
1172
  e.projects
1173
1173
  ), n = e.dependencies.filter(
@@ -1184,14 +1184,14 @@ function br(e) {
1184
1184
  affectedDomains: o,
1185
1185
  affectedDomainCount: o.length,
1186
1186
  scopedDependencyCount: n.length,
1187
- crossDomainDependencyEdges: Je(
1187
+ crossDomainDependencyEdges: Xe(
1188
1188
  n,
1189
1189
  t.projectsByName
1190
1190
  )
1191
1191
  };
1192
1192
  }
1193
- function Cr(e) {
1194
- const t = Ye(
1193
+ function $r(e) {
1194
+ const t = Je(
1195
1195
  e.selectedProjects,
1196
1196
  e.projects
1197
1197
  ), n = e.dependencies.filter(
@@ -1220,7 +1220,7 @@ function Cr(e) {
1220
1220
  affectedDomains: a,
1221
1221
  affectedDomainCount: a.length,
1222
1222
  scopedDependencyCount: n.length,
1223
- crossDomainDependencyEdges: Je(
1223
+ crossDomainDependencyEdges: Xe(
1224
1224
  n,
1225
1225
  t.projectsByName
1226
1226
  ),
@@ -1229,11 +1229,11 @@ function Cr(e) {
1229
1229
  topFanoutProjects: d
1230
1230
  };
1231
1231
  }
1232
- function xr(e) {
1232
+ function Mr(e) {
1233
1233
  return e.filter((t) => t.status === "worsening").length;
1234
1234
  }
1235
- function Dr(e) {
1236
- const t = e.summary ?? Ft([...e.signals]), n = e.snapshotCount ?? 0;
1235
+ function Er(e) {
1236
+ const t = e.summary ?? zt([...e.signals]), n = e.snapshotCount ?? 0;
1237
1237
  return {
1238
1238
  overallTrend: t.overallTrend,
1239
1239
  worseningSignalCount: t.worseningCount,
@@ -1244,12 +1244,12 @@ function Dr(e) {
1244
1244
  trendWindowInsufficient: n > 0 && n < 4
1245
1245
  };
1246
1246
  }
1247
- function tn(e) {
1247
+ function nn(e) {
1248
1248
  const t = Math.max(1, e.minimumOccurrences ?? 2), n = /* @__PURE__ */ new Map();
1249
1249
  for (const o of e.recentSnapshots) {
1250
1250
  const r = new Set(
1251
1251
  o.violations.map(
1252
- (i) => nn(i)
1252
+ (i) => on(i)
1253
1253
  )
1254
1254
  );
1255
1255
  for (const i of r)
@@ -1266,7 +1266,7 @@ function tn(e) {
1266
1266
  (o, r) => r.count - o.count || o.type.localeCompare(r.type) || o.source.localeCompare(r.source)
1267
1267
  );
1268
1268
  }
1269
- function kr(e) {
1269
+ function Rr(e) {
1270
1270
  const t = h(
1271
1271
  e.violations,
1272
1272
  e.analyzedViolationsLimit ?? 10,
@@ -1298,7 +1298,7 @@ function kr(e) {
1298
1298
  hotspotProjects: i,
1299
1299
  highFanoutProjects: s,
1300
1300
  hotspotDomains: d,
1301
- persistentSmellSignals: tn({
1301
+ persistentSmellSignals: nn({
1302
1302
  recentSnapshots: c,
1303
1303
  minimumOccurrences: e.minimumPersistentOccurrences
1304
1304
  }),
@@ -1306,7 +1306,7 @@ function kr(e) {
1306
1306
  sampledSnapshotCount: c.length
1307
1307
  };
1308
1308
  }
1309
- function $r(e) {
1309
+ function Or(e) {
1310
1310
  const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1311
1311
  for (const a of e.projects)
1312
1312
  a.domain && t.set(
@@ -1338,7 +1338,7 @@ function $r(e) {
1338
1338
  totalViolations: e.totalViolationsCount ?? s
1339
1339
  };
1340
1340
  }
1341
- function Ye(e, t) {
1341
+ function Je(e, t) {
1342
1342
  const n = /* @__PURE__ */ new Set(), o = [], r = /* @__PURE__ */ new Map();
1343
1343
  if (e.length > 0 && typeof e[0] == "object" && e[0] !== null)
1344
1344
  for (const i of e)
@@ -1361,22 +1361,22 @@ function Ye(e, t) {
1361
1361
  projectsByName: r
1362
1362
  };
1363
1363
  }
1364
- function Je(e, t) {
1364
+ function Xe(e, t) {
1365
1365
  return e.filter((n) => {
1366
1366
  const o = t.get(n.source)?.domain, r = t.get(n.target)?.domain;
1367
1367
  return !!(o && r && o !== r);
1368
1368
  }).length;
1369
1369
  }
1370
- function nn(e) {
1370
+ function on(e) {
1371
1371
  return `${e.type}|${e.source}`;
1372
1372
  }
1373
1373
  function fe(e) {
1374
1374
  return [...new Set(e)].sort((t, n) => t.localeCompare(n));
1375
1375
  }
1376
- function on(e) {
1376
+ function rn(e) {
1377
1377
  return e.inputs.metadata?.trendWindowInsufficient === !0;
1378
1378
  }
1379
- function rn(e) {
1379
+ function sn(e) {
1380
1380
  return `${e > 0 ? "+" : ""}${e.toFixed(3)}`;
1381
1381
  }
1382
1382
  const ie = [
@@ -1384,11 +1384,11 @@ const ie = [
1384
1384
  "conformance",
1385
1385
  "policy",
1386
1386
  "extension"
1387
- ], sn = [
1387
+ ], an = [
1388
1388
  "info",
1389
1389
  "warning",
1390
1390
  "error"
1391
- ], an = [
1391
+ ], cn = [
1392
1392
  "structural-dependency",
1393
1393
  "cross-domain-dependency",
1394
1394
  "missing-domain-context",
@@ -1397,7 +1397,7 @@ const ie = [
1397
1397
  "domain-boundary-violation",
1398
1398
  "layer-boundary-violation",
1399
1399
  "ownership-gap"
1400
- ], cn = [
1400
+ ], dn = [
1401
1401
  "architecture",
1402
1402
  "boundaries",
1403
1403
  "ownership",
@@ -1407,7 +1407,7 @@ const ie = [
1407
1407
  conformance: 1,
1408
1408
  policy: 2,
1409
1409
  extension: 3
1410
- }, N = {
1410
+ }, G = {
1411
1411
  "structural-dependency": 0,
1412
1412
  "cross-domain-dependency": 1,
1413
1413
  "missing-domain-context": 2,
@@ -1421,14 +1421,14 @@ const ie = [
1421
1421
  warning: 1,
1422
1422
  info: 2
1423
1423
  };
1424
- function dn(e) {
1425
- const t = ln(
1424
+ function ln(e) {
1425
+ const t = un(
1426
1426
  e.violations,
1427
1427
  e.reportType
1428
- ), n = pn(
1428
+ ), n = mn(
1429
1429
  e.signals,
1430
1430
  e.reportType
1431
- ), o = un(
1431
+ ), o = pn(
1432
1432
  e.measurements,
1433
1433
  e.reportType
1434
1434
  );
@@ -1439,17 +1439,17 @@ function dn(e) {
1439
1439
  exceptions: e.exceptions,
1440
1440
  violations: t,
1441
1441
  measurements: o,
1442
- signalBreakdown: mn(n),
1443
- metricBreakdown: fn(o),
1444
- topIssues: Xe(n),
1442
+ signalBreakdown: fn(n),
1443
+ metricBreakdown: gn(o),
1444
+ topIssues: Ze(n),
1445
1445
  health: e.health,
1446
1446
  recommendations: [...e.recommendations ?? []]
1447
1447
  };
1448
1448
  }
1449
- function ln(e, t) {
1449
+ function un(e, t) {
1450
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
1451
  }
1452
- function un(e, t) {
1452
+ function pn(e, t) {
1453
1453
  return t === "boundaries" ? e.filter(
1454
1454
  (n) => n.family === "boundaries"
1455
1455
  ) : t === "ownership" ? e.filter(
@@ -1458,10 +1458,10 @@ function un(e, t) {
1458
1458
  (n) => n.family !== "ownership" && n.family !== "documentation"
1459
1459
  ) : e;
1460
1460
  }
1461
- function pn(e, t) {
1461
+ function mn(e, t) {
1462
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
1463
  }
1464
- function mn(e) {
1464
+ function fn(e) {
1465
1465
  const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1466
1466
  for (const r of e)
1467
1467
  t.set(r.source, (t.get(r.source) ?? 0) + 1), n.set(r.type, (n.get(r.type) ?? 0) + 1), o.set(
@@ -1485,18 +1485,18 @@ function mn(e) {
1485
1485
  ],
1486
1486
  byType: le(
1487
1487
  [...n.keys()],
1488
- an
1488
+ cn
1489
1489
  ).flatMap((r) => {
1490
1490
  const i = n.get(r) ?? 0;
1491
1491
  return i > 0 ? [{ type: r, count: i }] : [];
1492
1492
  }),
1493
- bySeverity: sn.map((r) => ({
1493
+ bySeverity: an.map((r) => ({
1494
1494
  severity: r,
1495
1495
  count: o.get(r) ?? 0
1496
1496
  }))
1497
1497
  };
1498
1498
  }
1499
- function fn(e) {
1499
+ function gn(e) {
1500
1500
  const t = /* @__PURE__ */ new Map();
1501
1501
  for (const o of e) {
1502
1502
  const r = t.get(o.family) ?? [];
@@ -1505,7 +1505,7 @@ function fn(e) {
1505
1505
  return {
1506
1506
  families: le(
1507
1507
  [...t.keys()],
1508
- cn
1508
+ dn
1509
1509
  ).flatMap((o) => {
1510
1510
  const r = (t.get(o) ?? []).slice().sort((s, a) => s.id.localeCompare(a.id)).map((s) => ({
1511
1511
  id: s.id,
@@ -1528,12 +1528,12 @@ function fn(e) {
1528
1528
  })
1529
1529
  };
1530
1530
  }
1531
- function Xe(e) {
1531
+ function Ze(e) {
1532
1532
  const t = /* @__PURE__ */ new Map();
1533
1533
  for (const n of e) {
1534
- const o = gn(n), r = t.get(o);
1534
+ const o = yn(n), r = t.get(o);
1535
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);
1536
+ r.issue.count += 1, r.issue.projects = hn(r.issue.projects, n), r.issue.ruleId || (r.issue.ruleId = Me(n)), r.issue.sourcePluginId || (r.issue.sourcePluginId = n.sourcePluginId);
1537
1537
  continue;
1538
1538
  }
1539
1539
  t.set(o, {
@@ -1542,16 +1542,16 @@ function Xe(e) {
1542
1542
  source: n.source,
1543
1543
  severity: n.severity,
1544
1544
  count: 1,
1545
- projects: Ze(n),
1545
+ projects: Qe(n),
1546
1546
  ruleId: Me(n),
1547
1547
  message: n.message,
1548
1548
  sourcePluginId: n.sourcePluginId
1549
1549
  }
1550
1550
  });
1551
1551
  }
1552
- return [...t.values()].map((n) => n.issue).sort(hn);
1552
+ return [...t.values()].map((n) => n.issue).sort(vn);
1553
1553
  }
1554
- function gn(e) {
1554
+ function yn(e) {
1555
1555
  return [
1556
1556
  e.type,
1557
1557
  e.source,
@@ -1561,7 +1561,7 @@ function gn(e) {
1561
1561
  e.relatedProjectIds.join(",")
1562
1562
  ].join("|");
1563
1563
  }
1564
- function Ze(e) {
1564
+ function Qe(e) {
1565
1565
  return [
1566
1566
  ...new Set(
1567
1567
  [
@@ -1572,26 +1572,26 @@ function Ze(e) {
1572
1572
  )
1573
1573
  ].sort((t, n) => t.localeCompare(n));
1574
1574
  }
1575
- function yn(e, t) {
1575
+ function hn(e, t) {
1576
1576
  return [
1577
- .../* @__PURE__ */ new Set([...e, ...Ze(t)])
1577
+ .../* @__PURE__ */ new Set([...e, ...Qe(t)])
1578
1578
  ].sort((n, o) => n.localeCompare(o));
1579
1579
  }
1580
1580
  function Me(e) {
1581
1581
  const t = e.metadata?.ruleId;
1582
1582
  return typeof t == "string" && t.length > 0 ? t : void 0;
1583
1583
  }
1584
- function hn(e, t) {
1584
+ function vn(e, t) {
1585
1585
  const n = $e[e.severity] - $e[t.severity];
1586
1586
  if (n !== 0)
1587
1587
  return n;
1588
1588
  const o = t.count - e.count;
1589
1589
  if (o !== 0)
1590
1590
  return o;
1591
- const r = N[e.type], i = N[t.type], s = r - i;
1591
+ const r = G[e.type], i = G[t.type], s = r - i;
1592
1592
  if (r !== void 0 && i !== void 0 && s !== 0)
1593
1593
  return s;
1594
- if (!(e.type in N) || !(t.type in N)) {
1594
+ if (!(e.type in G) || !(t.type in G)) {
1595
1595
  const c = e.type.localeCompare(t.type);
1596
1596
  if (c !== 0)
1597
1597
  return c;
@@ -1606,8 +1606,8 @@ function le(e, t) {
1606
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
1607
  return [...o, ...r];
1608
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);
1609
+ function Vr(e) {
1610
+ const t = M(e.id, "Exception id"), n = Sn(e.source), o = M(e.reason, "Exception reason"), r = M(e.owner, "Exception owner"), i = In(e.review), s = nt(e.scope);
1611
1611
  if (s.source !== n)
1612
1612
  throw new Error(
1613
1613
  `Exception "${t}" has source "${n}" but scope source "${s.source}".`
@@ -1621,9 +1621,9 @@ function Mr(e) {
1621
1621
  review: i
1622
1622
  };
1623
1623
  }
1624
- function Qe(e) {
1625
- const t = tt(e);
1626
- return et(t) ? [
1624
+ function et(e) {
1625
+ const t = nt(e);
1626
+ return tt(t) ? [
1627
1627
  t.source,
1628
1628
  t.ruleId,
1629
1629
  t.projectId,
@@ -1636,13 +1636,13 @@ function Qe(e) {
1636
1636
  (t.relatedProjectIds ?? []).join(",")
1637
1637
  ].join("|");
1638
1638
  }
1639
- function et(e) {
1639
+ function tt(e) {
1640
1640
  return e.source === "policy";
1641
1641
  }
1642
- function vn(e) {
1642
+ function wn(e) {
1643
1643
  return e.source === "conformance";
1644
1644
  }
1645
- function wn(e) {
1645
+ function In(e) {
1646
1646
  const t = v(e.createdAt), n = v(e.reviewBy), o = v(e.expiresAt);
1647
1647
  if (!n && !o)
1648
1648
  throw new Error(
@@ -1654,7 +1654,7 @@ function wn(e) {
1654
1654
  ...o ? { expiresAt: o } : {}
1655
1655
  };
1656
1656
  }
1657
- function tt(e) {
1657
+ function nt(e) {
1658
1658
  if (e.source === "policy")
1659
1659
  return {
1660
1660
  source: "policy",
@@ -1665,7 +1665,7 @@ function tt(e) {
1665
1665
  ),
1666
1666
  ...v(e.targetProjectId) ? { targetProjectId: v(e.targetProjectId) } : {}
1667
1667
  };
1668
- const t = v(e.ruleId), n = Pn(e.category), o = v(e.projectId), r = Sn(e.relatedProjectIds);
1668
+ const t = v(e.ruleId), n = jn(e.category), o = v(e.projectId), r = Pn(e.relatedProjectIds);
1669
1669
  if (!t && !n && !o && r.length === 0)
1670
1670
  throw new Error(
1671
1671
  "Conformance exception scope must define ruleId, category, projectId, or relatedProjectIds."
@@ -1678,7 +1678,7 @@ function tt(e) {
1678
1678
  ...r.length > 0 ? { relatedProjectIds: r } : {}
1679
1679
  };
1680
1680
  }
1681
- function In(e) {
1681
+ function Sn(e) {
1682
1682
  if (e === "policy" || e === "conformance")
1683
1683
  return e;
1684
1684
  throw new Error(`Unsupported governance exception source "${e}".`);
@@ -1695,14 +1695,14 @@ function v(e) {
1695
1695
  const t = e.trim();
1696
1696
  return t.length > 0 ? t : void 0;
1697
1697
  }
1698
- function Sn(e) {
1698
+ function Pn(e) {
1699
1699
  return Array.isArray(e) ? [
1700
1700
  ...new Set(
1701
1701
  e.map(v).filter((t) => !!t)
1702
1702
  )
1703
1703
  ].sort((t, n) => t.localeCompare(n)) : [];
1704
1704
  }
1705
- function Pn(e) {
1705
+ function jn(e) {
1706
1706
  return v(e);
1707
1707
  }
1708
1708
  const Ee = {
@@ -1713,7 +1713,7 @@ const Ee = {
1713
1713
  warning: 1,
1714
1714
  info: 2
1715
1715
  };
1716
- function jn(e, t) {
1716
+ function bn(e, t) {
1717
1717
  const n = t.getTime(), o = Ae(e.review.expiresAt);
1718
1718
  if (o !== void 0 && o < n)
1719
1719
  return {
@@ -1729,21 +1729,21 @@ function jn(e, t) {
1729
1729
  status: "active"
1730
1730
  };
1731
1731
  }
1732
- function nt(e) {
1732
+ function ot(e) {
1733
1733
  const t = e.exceptions.map(
1734
- (c) => jn(c, e.asOf)
1734
+ (c) => bn(c, e.asOf)
1735
1735
  ), n = Object.fromEntries(
1736
1736
  t.map((c) => [c.exception.id, c.status])
1737
1737
  ), o = t.filter((c) => c.status === "active").map((c) => c.exception), r = t.filter(
1738
1738
  (c) => c.status !== "active"
1739
1739
  ), i = e.policyViolations.map(
1740
- (c) => Cn(c, o)
1740
+ (c) => Dn(c, o)
1741
1741
  ), s = e.conformanceFindings.map(
1742
1742
  (c) => xn(c, o)
1743
1743
  ), a = e.policyViolations.map(
1744
- (c) => Dn(c, r)
1745
- ).filter(R), d = e.conformanceFindings.map(
1746
1744
  (c) => kn(c, r)
1745
+ ).filter(R), d = e.conformanceFindings.map(
1746
+ (c) => $n(c, r)
1747
1747
  ).filter(R);
1748
1748
  return {
1749
1749
  declaredExceptions: [...e.exceptions],
@@ -1758,8 +1758,8 @@ function nt(e) {
1758
1758
  reactivatedConformanceFindings: d
1759
1759
  };
1760
1760
  }
1761
- function ot(e) {
1762
- const t = On(e), n = Object.values(
1761
+ function rt(e) {
1762
+ const t = Vn(e), n = Object.values(
1763
1763
  e.exceptionStatuses
1764
1764
  ).filter((c) => c === "active").length, o = Object.values(
1765
1765
  e.exceptionStatuses
@@ -1767,17 +1767,17 @@ function ot(e) {
1767
1767
  e.exceptionStatuses
1768
1768
  ).filter((c) => c === "expired").length, i = [
1769
1769
  ...e.suppressedPolicyViolations.map(
1770
- (c) => Vn(c)
1770
+ (c) => An(c)
1771
1771
  ),
1772
1772
  ...e.suppressedConformanceFindings.map(
1773
- (c) => An(c)
1773
+ (c) => Fn(c)
1774
1774
  )
1775
1775
  ].sort(Ve), s = [
1776
1776
  ...e.reactivatedPolicyViolations.map(
1777
- (c) => Fn(c)
1777
+ (c) => zn(c)
1778
1778
  ),
1779
1779
  ...e.reactivatedConformanceFindings.map(
1780
- (c) => zn(c)
1780
+ (c) => Tn(c)
1781
1781
  )
1782
1782
  ].sort(Ve), a = [], d = [];
1783
1783
  for (const c of [...e.declaredExceptions].sort(
@@ -1813,9 +1813,9 @@ function ot(e) {
1813
1813
  reactivatedFindings: s
1814
1814
  };
1815
1815
  }
1816
- function bn() {
1817
- return ot(
1818
- nt({
1816
+ function Cn() {
1817
+ return rt(
1818
+ ot({
1819
1819
  exceptions: [],
1820
1820
  policyViolations: [],
1821
1821
  conformanceFindings: [],
@@ -1823,10 +1823,10 @@ function bn() {
1823
1823
  })
1824
1824
  );
1825
1825
  }
1826
- function Cn(e, t) {
1826
+ function Dn(e, t) {
1827
1827
  const n = Z(
1828
1828
  t.filter((o) => o.source === "policy").flatMap((o) => {
1829
- const r = rt(o.scope, e);
1829
+ const r = it(o.scope, e);
1830
1830
  return r ? [{ ...r, exceptionId: o.id }] : [];
1831
1831
  })
1832
1832
  );
@@ -1843,7 +1843,7 @@ function Cn(e, t) {
1843
1843
  function xn(e, t) {
1844
1844
  const n = Z(
1845
1845
  t.filter((o) => o.source === "conformance").flatMap((o) => {
1846
- const r = it(o.scope, e);
1846
+ const r = st(o.scope, e);
1847
1847
  return r ? [{ ...r, exceptionId: o.id }] : [];
1848
1848
  })
1849
1849
  );
@@ -1857,10 +1857,10 @@ function xn(e, t) {
1857
1857
  outcome: "active"
1858
1858
  };
1859
1859
  }
1860
- function Dn(e, t) {
1860
+ function kn(e, t) {
1861
1861
  const n = Z(
1862
1862
  t.filter((o) => o.exception.source === "policy").flatMap((o) => {
1863
- const r = rt(o.exception.scope, e);
1863
+ const r = it(o.exception.scope, e);
1864
1864
  return r ? [
1865
1865
  {
1866
1866
  ...r,
@@ -1878,10 +1878,10 @@ function Dn(e, t) {
1878
1878
  matchedExceptionStatus: n.status
1879
1879
  };
1880
1880
  }
1881
- function kn(e, t) {
1881
+ function $n(e, t) {
1882
1882
  const n = Z(
1883
1883
  t.filter((o) => o.exception.source === "conformance").flatMap((o) => {
1884
- const r = it(o.exception.scope, e);
1884
+ const r = st(o.exception.scope, e);
1885
1885
  return r ? [
1886
1886
  {
1887
1887
  ...r,
@@ -1899,39 +1899,39 @@ function kn(e, t) {
1899
1899
  matchedExceptionStatus: n.status
1900
1900
  };
1901
1901
  }
1902
- function rt(e, t) {
1903
- if (!et(e))
1902
+ function it(e, t) {
1903
+ if (!tt(e))
1904
1904
  return null;
1905
1905
  const n = g(
1906
1906
  t.details?.targetProject ?? t.details?.target
1907
1907
  );
1908
1908
  return e.ruleId !== t.ruleId || e.projectId !== g(t.project) || e.targetProjectId && e.targetProjectId !== n ? null : {
1909
- scopeKey: Qe(e),
1910
- specificity: Mn(e)
1909
+ scopeKey: et(e),
1910
+ specificity: En(e)
1911
1911
  };
1912
1912
  }
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(
1913
+ function st(e, t) {
1914
+ return !wn(e) || e.ruleId && e.ruleId !== t.ruleId || e.category && e.category !== t.category || e.projectId && e.projectId !== t.projectId || e.relatedProjectIds && !On(
1915
1915
  e.relatedProjectIds,
1916
1916
  t.relatedProjectIds
1917
1917
  ) ? null : {
1918
- scopeKey: Qe(e),
1919
- specificity: En(e)
1918
+ scopeKey: et(e),
1919
+ specificity: Rn(e)
1920
1920
  };
1921
1921
  }
1922
1922
  function Z(e) {
1923
- return e.length === 0 ? null : [...e].sort($n)[0] ?? null;
1923
+ return e.length === 0 ? null : [...e].sort(Mn)[0] ?? null;
1924
1924
  }
1925
- function $n(e, t) {
1925
+ function Mn(e, t) {
1926
1926
  if (e.specificity !== t.specificity)
1927
1927
  return t.specificity - e.specificity;
1928
1928
  const n = e.scopeKey.localeCompare(t.scopeKey);
1929
1929
  return n !== 0 ? n : e.exceptionId.localeCompare(t.exceptionId);
1930
1930
  }
1931
- function Mn(e) {
1931
+ function En(e) {
1932
1932
  return e.targetProjectId ? 2 : 1;
1933
1933
  }
1934
- function En(e) {
1934
+ function Rn(e) {
1935
1935
  return [
1936
1936
  e.ruleId,
1937
1937
  e.category,
@@ -1939,7 +1939,7 @@ function En(e) {
1939
1939
  e.relatedProjectIds?.length ? "relatedProjectIds" : void 0
1940
1940
  ].filter(Boolean).length;
1941
1941
  }
1942
- function Rn(e, t) {
1942
+ function On(e, t) {
1943
1943
  const n = Oe(e), o = Oe(t);
1944
1944
  return n.length !== o.length ? !1 : n.every(
1945
1945
  (r, i) => r === o[i]
@@ -1950,7 +1950,7 @@ function Oe(e) {
1950
1950
  (t, n) => t.localeCompare(n)
1951
1951
  );
1952
1952
  }
1953
- function On(e) {
1953
+ function Vn(e) {
1954
1954
  const t = /* @__PURE__ */ new Map();
1955
1955
  for (const n of [
1956
1956
  ...e.suppressedPolicyViolations,
@@ -1968,7 +1968,7 @@ function On(e) {
1968
1968
  );
1969
1969
  return t;
1970
1970
  }
1971
- function Vn(e) {
1971
+ function An(e) {
1972
1972
  const t = g(
1973
1973
  e.finding.details?.targetProject ?? e.finding.details?.target
1974
1974
  ), n = g(e.finding.project);
@@ -1987,7 +1987,7 @@ function Vn(e) {
1987
1987
  ...e.finding.sourcePluginId ? { sourcePluginId: e.finding.sourcePluginId } : {}
1988
1988
  };
1989
1989
  }
1990
- function An(e) {
1990
+ function Fn(e) {
1991
1991
  return {
1992
1992
  kind: "conformance-finding",
1993
1993
  exceptionId: e.matchedExceptionId,
@@ -2006,7 +2006,7 @@ function An(e) {
2006
2006
  } : {}
2007
2007
  };
2008
2008
  }
2009
- function Fn(e) {
2009
+ function zn(e) {
2010
2010
  const t = g(
2011
2011
  e.finding.details?.targetProject ?? e.finding.details?.target
2012
2012
  ), n = g(e.finding.project);
@@ -2025,7 +2025,7 @@ function Fn(e) {
2025
2025
  ...e.finding.sourcePluginId ? { sourcePluginId: e.finding.sourcePluginId } : {}
2026
2026
  };
2027
2027
  }
2028
- function zn(e) {
2028
+ function Tn(e) {
2029
2029
  return {
2030
2030
  kind: "conformance-finding",
2031
2031
  exceptionId: e.matchedExceptionId ?? "unknown-exception",
@@ -2087,7 +2087,7 @@ function R(e) {
2087
2087
  function Fe(e) {
2088
2088
  return e.outcome === "suppressed" && typeof e.matchedExceptionId == "string";
2089
2089
  }
2090
- class Er {
2090
+ class Ar {
2091
2091
  capabilitiesById = /* @__PURE__ */ new Map();
2092
2092
  capabilities;
2093
2093
  constructor(t) {
@@ -2119,7 +2119,7 @@ class se extends Error {
2119
2119
  super(t), this.name = "GovernanceExtensionRegistrationError", this.diagnostics = n;
2120
2120
  }
2121
2121
  }
2122
- class Tn {
2122
+ class Ln {
2123
2123
  context;
2124
2124
  registry = {
2125
2125
  metricProviders: [],
@@ -2167,13 +2167,13 @@ class Tn {
2167
2167
  };
2168
2168
  }
2169
2169
  }
2170
- async function Rr(e, t) {
2171
- return (await Ln(
2170
+ async function Fr(e, t) {
2171
+ return (await Bn(
2172
2172
  e,
2173
2173
  t
2174
2174
  )).registry;
2175
2175
  }
2176
- async function Ln(e, t, n = {}) {
2176
+ async function Bn(e, t, n = {}) {
2177
2177
  const o = {
2178
2178
  metricProviders: [],
2179
2179
  signalProviders: [],
@@ -2182,7 +2182,7 @@ async function Ln(e, t, n = {}) {
2182
2182
  }, r = [...n.diagnostics ?? []], i = /* @__PURE__ */ new Map();
2183
2183
  for (const s of t) {
2184
2184
  try {
2185
- Wn(s);
2185
+ Hn(s);
2186
2186
  } catch (d) {
2187
2187
  throw r.push({
2188
2188
  code: "governance.extension.invalid_definition",
@@ -2211,11 +2211,11 @@ async function Ln(e, t, n = {}) {
2211
2211
  }
2212
2212
  i.set(s.definition.id, s.moduleSpecifier);
2213
2213
  try {
2214
- const d = new Tn(
2214
+ const d = new Ln(
2215
2215
  e,
2216
2216
  s.definition.id
2217
2217
  );
2218
- await s.definition.register(d), _n(o, d.toRegistry());
2218
+ await s.definition.register(d), Wn(o, d.toRegistry());
2219
2219
  } catch (d) {
2220
2220
  const c = `Governance extension "${s.definition.id}" from "${s.moduleSpecifier}" failed during registration: ${ae(d)}`;
2221
2221
  throw r.push({
@@ -2234,7 +2234,7 @@ async function Ln(e, t, n = {}) {
2234
2234
  diagnostics: r
2235
2235
  };
2236
2236
  }
2237
- async function Bn(e, t) {
2237
+ async function Nn(e, t) {
2238
2238
  let n = t.workspace;
2239
2239
  for (const o of e.enrichers)
2240
2240
  n = await o.contribution.enrichWorkspace({
@@ -2251,7 +2251,7 @@ async function Gn(e, t) {
2251
2251
  })))
2252
2252
  )).flat();
2253
2253
  }
2254
- async function Nn(e, t) {
2254
+ async function qn(e, t) {
2255
2255
  return (await Promise.all(
2256
2256
  e.signalProviders.map(async (o) => (await o.contribution.provideSignals(t)).map((i) => ({
2257
2257
  ...i,
@@ -2260,7 +2260,7 @@ async function Nn(e, t) {
2260
2260
  })))
2261
2261
  )).flat();
2262
2262
  }
2263
- async function qn(e, t) {
2263
+ async function _n(e, t) {
2264
2264
  return (await Promise.all(
2265
2265
  e.metricProviders.map(async (o) => (await o.contribution.provideMetrics(t)).map((i) => ({
2266
2266
  ...i,
@@ -2268,10 +2268,10 @@ async function qn(e, t) {
2268
2268
  })))
2269
2269
  )).flat();
2270
2270
  }
2271
- function _n(e, t) {
2271
+ function Wn(e, t) {
2272
2272
  e.metricProviders.push(...t.metricProviders), e.signalProviders.push(...t.signalProviders), e.rulePacks.push(...t.rulePacks), e.enrichers.push(...t.enrichers);
2273
2273
  }
2274
- function Wn(e) {
2274
+ function Hn(e) {
2275
2275
  if (typeof e.definition.id != "string" || e.definition.id.trim().length === 0)
2276
2276
  throw new Error(
2277
2277
  `Governance extension module "${e.moduleSpecifier}" must declare a non-empty "id".`
@@ -2343,35 +2343,35 @@ function j(e, t = {}) {
2343
2343
  }
2344
2344
  };
2345
2345
  }
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(
2346
+ function at(e, t = {}, n = q, o = {}) {
2347
+ const r = Math.round(Un(e, t)), i = Jn(n), s = Xn(e), a = Zn(e), d = Qn(
2348
2348
  o.topIssues ?? []
2349
- ), c = Qn(
2349
+ ), c = eo(
2350
2350
  o.topIssues ?? [],
2351
2351
  o.projectHotspotLimit ?? 5
2352
- ), l = Kn(r, i);
2352
+ ), l = Yn(r, i);
2353
2353
  return {
2354
2354
  score: r,
2355
2355
  status: l,
2356
- grade: Un(r),
2356
+ grade: Kn(r),
2357
2357
  hotspots: s.map((u) => u.name),
2358
2358
  metricHotspots: s,
2359
2359
  projectHotspots: c,
2360
2360
  explainability: {
2361
- summary: no(
2361
+ summary: oo(
2362
2362
  r,
2363
2363
  l,
2364
2364
  a,
2365
2365
  d
2366
2366
  ),
2367
- statusReason: to(r, l, i),
2367
+ statusReason: no(r, l, i),
2368
2368
  weakestMetrics: a,
2369
2369
  dominantIssues: d
2370
2370
  }
2371
2371
  };
2372
2372
  }
2373
- const Or = st;
2374
- function at(e, t) {
2373
+ const zr = at;
2374
+ function ct(e, t) {
2375
2375
  const n = [];
2376
2376
  return e.some((o) => o.ruleId === "domain-boundary") && n.push({
2377
2377
  id: "reduce-cross-domain-dependencies",
@@ -2392,8 +2392,8 @@ function at(e, t) {
2392
2392
  reason: "High dependency complexity increases blast radius and maintenance cost."
2393
2393
  }), n;
2394
2394
  }
2395
- const Vr = at;
2396
- function Hn(e, t) {
2395
+ const Tr = ct;
2396
+ function Un(e, t) {
2397
2397
  if (e.length === 0)
2398
2398
  return 0;
2399
2399
  let n = 0, o = 0;
@@ -2403,40 +2403,40 @@ function Hn(e, t) {
2403
2403
  }
2404
2404
  return o === 0 ? e.reduce((r, i) => r + i.score, 0) / e.length : n / o;
2405
2405
  }
2406
- function Un(e) {
2406
+ function Kn(e) {
2407
2407
  return e >= 90 ? "A" : e >= 80 ? "B" : e >= 70 ? "C" : e >= 60 ? "D" : "F";
2408
2408
  }
2409
- function Kn(e, t) {
2409
+ function Yn(e, t) {
2410
2410
  return e >= t.goodMinScore ? "good" : e >= t.warningMinScore ? "warning" : "critical";
2411
2411
  }
2412
- function Yn(e) {
2412
+ function Jn(e) {
2413
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
2414
  return t <= n ? q : {
2415
2415
  goodMinScore: t,
2416
2416
  warningMinScore: n
2417
2417
  };
2418
2418
  }
2419
- function Jn(e) {
2419
+ function Xn(e) {
2420
2420
  return [...e].filter((t) => t.score < 60).sort((t, n) => t.score - n.score || t.id.localeCompare(n.id)).map((t) => ({
2421
2421
  id: t.id,
2422
2422
  name: t.name,
2423
2423
  score: t.score
2424
2424
  }));
2425
2425
  }
2426
- function Xn(e) {
2426
+ function Zn(e) {
2427
2427
  return [...e].sort((t, n) => t.score - n.score || t.id.localeCompare(n.id)).slice(0, 3).map((t) => ({
2428
2428
  id: t.id,
2429
2429
  name: t.name,
2430
2430
  score: t.score
2431
2431
  }));
2432
2432
  }
2433
- function Zn(e) {
2433
+ function Qn(e) {
2434
2434
  return e.slice(0, 3);
2435
2435
  }
2436
- function Qn(e, t) {
2436
+ function eo(e, t) {
2437
2437
  const n = /* @__PURE__ */ new Map();
2438
2438
  for (const o of e)
2439
- if (eo(o))
2439
+ if (to(o))
2440
2440
  for (const r of o.projects) {
2441
2441
  const i = n.get(r) ?? {
2442
2442
  count: 0,
@@ -2453,26 +2453,26 @@ function Qn(e, t) {
2453
2453
  dominantIssueTypes: [...r.typeCounts.entries()].sort((i, s) => s[1] - i[1] || i[0].localeCompare(s[0])).slice(0, 3).map(([i]) => i)
2454
2454
  }));
2455
2455
  }
2456
- function eo(e) {
2456
+ function to(e) {
2457
2457
  return e.type !== "structural-dependency";
2458
2458
  }
2459
- function to(e, t, n) {
2459
+ function no(e, t, n) {
2460
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}).`;
2461
2461
  }
2462
- function no(e, t, n, o) {
2462
+ function oo(e, t, n, o) {
2463
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}`;
2464
+ return `${ro(t)} health at ${e}. ${r} ${i}`;
2465
2465
  }
2466
- function oo(e) {
2466
+ function ro(e) {
2467
2467
  return e.length > 0 ? `${e[0].toUpperCase()}${e.slice(1)}` : e;
2468
2468
  }
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(
2469
+ function dt(e) {
2470
+ const { workspace: t, signals: n } = e, o = t.dependencies.length, r = t.projects.length || 1, i = io(n), s = so(
2471
2471
  i,
2472
2472
  (m) => m.type === "structural-dependency"
2473
2473
  ), a = s > 0 ? s : o, d = ce(
2474
2474
  i,
2475
- so
2475
+ ao
2476
2476
  ), c = ce(
2477
2477
  i,
2478
2478
  (m) => m.type === "layer-boundary-violation"
@@ -2482,43 +2482,43 @@ function ct(e) {
2482
2482
  ), u = t.projects.filter(
2483
2483
  (m) => !!m.ownership?.team || (m.ownership?.contacts?.length ?? 0) > 0
2484
2484
  ).length, w = t.projects.filter((m) => {
2485
- const x = m.metadata.documentation;
2486
- return x === !0 || x === "true";
2485
+ const D = m.metadata.documentation;
2486
+ return D === !0 || D === "true";
2487
2487
  }).length;
2488
2488
  return [
2489
- D(
2489
+ x(
2490
2490
  "architectural-entropy",
2491
2491
  "Architectural Entropy",
2492
2492
  "architecture",
2493
2493
  d / Math.max(a, 1)
2494
2494
  ),
2495
- D(
2495
+ x(
2496
2496
  "dependency-complexity",
2497
2497
  "Dependency Complexity",
2498
2498
  "architecture",
2499
2499
  a / r / 4
2500
2500
  ),
2501
- D(
2501
+ x(
2502
2502
  "domain-integrity",
2503
2503
  "Domain Integrity",
2504
2504
  "boundaries",
2505
2505
  l / Math.max(a, 1)
2506
2506
  ),
2507
- D(
2507
+ x(
2508
2508
  "ownership-coverage",
2509
2509
  "Ownership Coverage",
2510
2510
  "ownership",
2511
2511
  u / r,
2512
2512
  !0
2513
2513
  ),
2514
- D(
2514
+ x(
2515
2515
  "documentation-completeness",
2516
2516
  "Documentation Completeness",
2517
2517
  "documentation",
2518
2518
  w / r,
2519
2519
  !0
2520
2520
  ),
2521
- D(
2521
+ x(
2522
2522
  "layer-integrity",
2523
2523
  "Layer Integrity",
2524
2524
  "boundaries",
@@ -2526,8 +2526,8 @@ function ct(e) {
2526
2526
  )
2527
2527
  ];
2528
2528
  }
2529
- const Ar = ct;
2530
- function D(e, t, n, o, r = !1) {
2529
+ const Lr = dt;
2530
+ function x(e, t, n, o, r = !1) {
2531
2531
  const i = Math.max(0, Math.min(1, o)), s = Number(i.toFixed(4)), a = Math.round(r ? s * 100 : (1 - s) * 100);
2532
2532
  return {
2533
2533
  id: e,
@@ -2539,7 +2539,7 @@ function D(e, t, n, o, r = !1) {
2539
2539
  unit: "ratio"
2540
2540
  };
2541
2541
  }
2542
- function ro(e) {
2542
+ function io(e) {
2543
2543
  const t = /* @__PURE__ */ new Map();
2544
2544
  for (const n of e) {
2545
2545
  const o = t.get(n.type) ?? {
@@ -2547,20 +2547,20 @@ function ro(e) {
2547
2547
  count: 0,
2548
2548
  weight: 0
2549
2549
  };
2550
- o.count += 1, o.weight += ao(n.severity), t.set(n.type, o);
2550
+ o.count += 1, o.weight += co(n.severity), t.set(n.type, o);
2551
2551
  }
2552
2552
  return [...t.values()];
2553
2553
  }
2554
- function io(e, t) {
2554
+ function so(e, t) {
2555
2555
  return e.filter(t).reduce((n, o) => n + o.count, 0);
2556
2556
  }
2557
2557
  function ce(e, t) {
2558
2558
  return e.filter(t).reduce((n, o) => n + o.weight, 0);
2559
2559
  }
2560
- function so(e) {
2560
+ function ao(e) {
2561
2561
  return e.type === "cross-domain-dependency" || e.type === "missing-domain-context" || e.type === "circular-dependency";
2562
2562
  }
2563
- function ao(e) {
2563
+ function co(e) {
2564
2564
  switch (e) {
2565
2565
  case "error":
2566
2566
  return 1;
@@ -2585,7 +2585,7 @@ const O = {
2585
2585
  const r = o?.options, i = o?.severity ?? O.defaultSeverity, s = ye(e.projects);
2586
2586
  return { violations: e.dependencies.flatMap((d) => {
2587
2587
  const c = s.get(d.source), l = s.get(d.target);
2588
- return lt(
2588
+ return ut(
2589
2589
  c,
2590
2590
  l,
2591
2591
  d,
@@ -2615,7 +2615,7 @@ const O = {
2615
2615
  }, s = o?.severity ?? V.defaultSeverity, a = ye(e.projects), d = new Set(i.layers);
2616
2616
  return { violations: e.dependencies.flatMap((l) => {
2617
2617
  const u = a.get(l.source), w = a.get(l.target);
2618
- return ut(
2618
+ return pt(
2619
2619
  u,
2620
2620
  w,
2621
2621
  l,
@@ -2642,7 +2642,7 @@ const O = {
2642
2642
  metadataField: t.ownership.metadataField
2643
2643
  }, s = o?.severity ?? A.defaultSeverity;
2644
2644
  return i.required ? { violations: e.projects.flatMap(
2645
- (d) => pt(d, s)
2645
+ (d) => mt(d, s)
2646
2646
  ) } : {};
2647
2647
  }
2648
2648
  }, U = {
@@ -2660,7 +2660,7 @@ const O = {
2660
2660
  const i = new RegExp(r.pattern), s = o.severity ?? U.defaultSeverity;
2661
2661
  return {
2662
2662
  violations: e.projects.flatMap(
2663
- (a) => uo(a, r, i, s)
2663
+ (a) => po(a, r, i, s)
2664
2664
  )
2665
2665
  };
2666
2666
  }
@@ -2674,12 +2674,12 @@ const O = {
2674
2674
  if (!t)
2675
2675
  return {};
2676
2676
  const o = j(t).rules[K.id], r = o?.options;
2677
- if (!o?.enabled || !r || !vo(r))
2677
+ if (!o?.enabled || !r || !wo(r))
2678
2678
  return {};
2679
2679
  const i = o.severity ?? K.defaultSeverity, s = r.valuePattern ? new RegExp(r.valuePattern) : void 0;
2680
2680
  return {
2681
2681
  violations: e.projects.flatMap(
2682
- (a) => po(a, r, s, i)
2682
+ (a) => mo(a, r, s, i)
2683
2683
  )
2684
2684
  };
2685
2685
  }
@@ -2698,7 +2698,7 @@ const O = {
2698
2698
  const i = o.severity ?? Y.defaultSeverity;
2699
2699
  return {
2700
2700
  violations: e.projects.flatMap(
2701
- (s) => mo(s, i)
2701
+ (s) => fo(s, i)
2702
2702
  )
2703
2703
  };
2704
2704
  }
@@ -2717,11 +2717,11 @@ const O = {
2717
2717
  const i = o.severity ?? J.defaultSeverity;
2718
2718
  return {
2719
2719
  violations: e.projects.flatMap(
2720
- (s) => fo(s, i)
2720
+ (s) => go(s, i)
2721
2721
  )
2722
2722
  };
2723
2723
  }
2724
- }, co = [
2724
+ }, lo = [
2725
2725
  O,
2726
2726
  V,
2727
2727
  A,
@@ -2739,14 +2739,14 @@ function ze(e) {
2739
2739
  allowedDependencies: n.allowedLayerDependencies ?? ge(n.layers),
2740
2740
  layers: [...n.layers],
2741
2741
  usesExplicitDependencies: n.allowedLayerDependencies !== void 0
2742
- }, u = d?.severity ?? V.defaultSeverity, w = o.rules[A.id], m = w?.enabled !== !1, x = w?.options ?? {
2742
+ }, u = d?.severity ?? V.defaultSeverity, w = o.rules[A.id], m = w?.enabled !== !1, D = w?.options ?? {
2743
2743
  required: n.ownership.required,
2744
2744
  metadataField: n.ownership.metadataField
2745
2745
  }, z = w?.severity ?? A.defaultSeverity, T = ye(t.projects), b = new Set(l.layers), S = [];
2746
2746
  for (const y of t.dependencies) {
2747
2747
  const C = T.get(y.source), L = T.get(y.target);
2748
2748
  i && S.push(
2749
- ...lt(
2749
+ ...ut(
2750
2750
  C,
2751
2751
  L,
2752
2752
  y,
@@ -2754,7 +2754,7 @@ function ze(e) {
2754
2754
  a
2755
2755
  )
2756
2756
  ), c && S.push(
2757
- ...ut(
2757
+ ...pt(
2758
2758
  C,
2759
2759
  L,
2760
2760
  y,
@@ -2764,30 +2764,30 @@ function ze(e) {
2764
2764
  )
2765
2765
  );
2766
2766
  }
2767
- if (m && x.required)
2767
+ if (m && D.required)
2768
2768
  for (const y of t.projects)
2769
- S.push(...pt(y, z));
2769
+ S.push(...mt(y, z));
2770
2770
  for (const y of [
2771
2771
  U,
2772
2772
  K,
2773
2773
  Y,
2774
2774
  J
2775
2775
  ])
2776
- S.push(...go(y, e));
2776
+ S.push(...yo(y, e));
2777
2777
  return S;
2778
2778
  }
2779
- function dt(e, t) {
2780
- return lo(e) ? ze(e) : ze({
2779
+ function lt(e, t) {
2780
+ return uo(e) ? ze(e) : ze({
2781
2781
  workspace: e,
2782
2782
  profile: t
2783
2783
  });
2784
2784
  }
2785
- const Fr = dt;
2786
- function lo(e) {
2785
+ const Br = lt;
2786
+ function uo(e) {
2787
2787
  return "workspace" in e;
2788
2788
  }
2789
- function lt(e, t, n, o, r) {
2790
- return !e || !t ? [] : !e.domain || !t.domain || e.domain === t.domain || yo(
2789
+ function ut(e, t, n, o, r) {
2790
+ return !e || !t ? [] : !e.domain || !t.domain || e.domain === t.domain || ho(
2791
2791
  o.allowedDependencies,
2792
2792
  e.domain,
2793
2793
  t.domain
@@ -2809,8 +2809,8 @@ function lt(e, t, n, o, r) {
2809
2809
  }
2810
2810
  ];
2811
2811
  }
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(
2812
+ function pt(e, t, n, o, r, i) {
2813
+ return !e || !t ? [] : !e.layer || !t.layer || !o.has(e.layer) || !o.has(t.layer) || vo(
2814
2814
  r.allowedDependencies,
2815
2815
  e.layer,
2816
2816
  t.layer
@@ -2836,7 +2836,7 @@ function ut(e, t, n, o, r, i) {
2836
2836
  }
2837
2837
  ];
2838
2838
  }
2839
- function pt(e, t) {
2839
+ function mt(e, t) {
2840
2840
  return e.ownership?.team || (e.ownership?.contacts?.length ?? 0) > 0 ? [] : [
2841
2841
  {
2842
2842
  id: `${e.name}-ownership`,
@@ -2849,7 +2849,7 @@ function pt(e, t) {
2849
2849
  }
2850
2850
  ];
2851
2851
  }
2852
- function uo(e, t, n, o) {
2852
+ function po(e, t, n, o) {
2853
2853
  return n.test(e.name) ? [] : [
2854
2854
  {
2855
2855
  id: `${e.name}-project-name-convention`,
@@ -2866,7 +2866,7 @@ function uo(e, t, n, o) {
2866
2866
  }
2867
2867
  ];
2868
2868
  }
2869
- function po(e, t, n, o) {
2869
+ function mo(e, t, n, o) {
2870
2870
  const r = [], i = t.prefixSeparator ?? ":";
2871
2871
  for (const s of t.requiredPrefixes ?? [])
2872
2872
  e.tags.some(
@@ -2885,7 +2885,7 @@ function po(e, t, n, o) {
2885
2885
  recommendation: "Add a tag with the required prefix or relax the configured requiredPrefixes list."
2886
2886
  });
2887
2887
  for (const s of e.tags) {
2888
- const { prefix: a, value: d } = wo(s, i);
2888
+ const { prefix: a, value: d } = Io(s, i);
2889
2889
  t.allowedPrefixes && t.allowedPrefixes.length > 0 && !t.allowedPrefixes.includes(a) && r.push({
2890
2890
  id: `${e.name}-tag-convention-allowed-${s}`,
2891
2891
  ruleId: "tag-convention",
@@ -2916,7 +2916,7 @@ function po(e, t, n, o) {
2916
2916
  }
2917
2917
  return r;
2918
2918
  }
2919
- function mo(e, t) {
2919
+ function fo(e, t) {
2920
2920
  return e.domain ? [] : [
2921
2921
  {
2922
2922
  id: `${e.name}-missing-domain`,
@@ -2929,7 +2929,7 @@ function mo(e, t) {
2929
2929
  }
2930
2930
  ];
2931
2931
  }
2932
- function fo(e, t) {
2932
+ function go(e, t) {
2933
2933
  return e.layer ? [] : [
2934
2934
  {
2935
2935
  id: `${e.name}-missing-layer`,
@@ -2942,26 +2942,26 @@ function fo(e, t) {
2942
2942
  }
2943
2943
  ];
2944
2944
  }
2945
- function go(e, t) {
2945
+ function yo(e, t) {
2946
2946
  return e.evaluate(t).violations ?? [];
2947
2947
  }
2948
2948
  function ye(e) {
2949
2949
  return new Map(e.map((t) => [t.name, t]));
2950
2950
  }
2951
- function yo(e, t, n) {
2951
+ function ho(e, t, n) {
2952
2952
  const o = e[t];
2953
2953
  if (o && (o.includes(n) || o.includes("*")))
2954
2954
  return !0;
2955
2955
  const r = e["*"];
2956
2956
  return !!(r && (r.includes(n) || r.includes("*")));
2957
2957
  }
2958
- function ho(e, t, n) {
2958
+ function vo(e, t, n) {
2959
2959
  return (e[t] ?? []).includes(n);
2960
2960
  }
2961
- function vo(e) {
2961
+ function wo(e) {
2962
2962
  return (e.requiredPrefixes?.length ?? 0) > 0 || (e.allowedPrefixes?.length ?? 0) > 0 || typeof e.valuePattern == "string";
2963
2963
  }
2964
- function wo(e, t) {
2964
+ function Io(e, t) {
2965
2965
  const n = e.indexOf(t);
2966
2966
  return n === -1 ? {
2967
2967
  prefix: e,
@@ -2971,7 +2971,7 @@ function wo(e, t) {
2971
2971
  value: e.slice(n + t.length)
2972
2972
  };
2973
2973
  }
2974
- const Io = "signal-", Te = {
2974
+ const So = "signal-", Te = {
2975
2975
  graph: 0,
2976
2976
  conformance: 1,
2977
2977
  policy: 2,
@@ -2981,7 +2981,7 @@ const Io = "signal-", Te = {
2981
2981
  warning: 1,
2982
2982
  error: 2
2983
2983
  };
2984
- function mt(e) {
2984
+ function ft(e) {
2985
2985
  const t = new Map(
2986
2986
  e.projects.map((o) => [o.id, o])
2987
2987
  ), n = [];
@@ -3043,20 +3043,20 @@ function mt(e) {
3043
3043
  }
3044
3044
  return n.sort(ee);
3045
3045
  }
3046
- function ft(e) {
3046
+ function gt(e) {
3047
3047
  return e.findings.map(
3048
- (t) => So(t, e.extractedAt)
3048
+ (t) => Po(t, e.extractedAt)
3049
3049
  ).sort(ee);
3050
3050
  }
3051
- function gt(e, t = {}) {
3051
+ function yt(e, t = {}) {
3052
3052
  const n = t.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
3053
- return e.flatMap((o) => Po(o, n)).sort(ee);
3053
+ return e.flatMap((o) => jo(o, n)).sort(ee);
3054
3054
  }
3055
- function zr(e) {
3055
+ function Nr(e) {
3056
3056
  return ue(
3057
- mt(e.graphSnapshot),
3058
- e.conformanceSnapshot ? ft(e.conformanceSnapshot) : [],
3059
- e.policyViolations ? gt(e.policyViolations, {
3057
+ ft(e.graphSnapshot),
3058
+ e.conformanceSnapshot ? gt(e.conformanceSnapshot) : [],
3059
+ e.policyViolations ? yt(e.policyViolations, {
3060
3060
  createdAt: e.graphSnapshot.extractedAt
3061
3061
  }) : []
3062
3062
  );
@@ -3067,7 +3067,7 @@ function ue(...e) {
3067
3067
  t.has(n.id) || t.set(n.id, n);
3068
3068
  return [...t.values()].sort(ee);
3069
3069
  }
3070
- function So(e, t) {
3070
+ function Po(e, t) {
3071
3071
  const n = Q(
3072
3072
  e.relatedProjectIds
3073
3073
  ), o = n.length === 1 ? n[0] : void 0;
@@ -3087,12 +3087,12 @@ function So(e, t) {
3087
3087
  createdAt: t
3088
3088
  });
3089
3089
  }
3090
- function Po(e, t) {
3091
- const n = jo(e.ruleId);
3090
+ function jo(e, t) {
3091
+ const n = bo(e.ruleId);
3092
3092
  if (!n)
3093
3093
  return [];
3094
- const o = Do(e.details), r = P(
3095
- ko(o?.targetProject ?? o?.target)
3094
+ const o = ko(e.details), r = P(
3095
+ $o(o?.targetProject ?? o?.target)
3096
3096
  ), i = P(e.project), s = Q([
3097
3097
  i,
3098
3098
  r
@@ -3123,7 +3123,7 @@ function Po(e, t) {
3123
3123
  })
3124
3124
  ];
3125
3125
  }
3126
- function jo(e) {
3126
+ function bo(e) {
3127
3127
  switch (e) {
3128
3128
  case "domain-boundary":
3129
3129
  return {
@@ -3156,10 +3156,10 @@ function E(e) {
3156
3156
  metadata: xo(e.metadata),
3157
3157
  source: e.source,
3158
3158
  sourcePluginId: P(e.sourcePluginId),
3159
- createdAt: Co(e.createdAt)
3159
+ createdAt: Do(e.createdAt)
3160
3160
  };
3161
3161
  return {
3162
- id: `${Io}${bo(e.identityKey ?? n)}`,
3162
+ id: `${So}${Co(e.identityKey ?? n)}`,
3163
3163
  type: n.type,
3164
3164
  ...n.sourceProjectId ? { sourceProjectId: n.sourceProjectId } : {},
3165
3165
  ...n.targetProjectId ? { targetProjectId: n.targetProjectId } : {},
@@ -3173,10 +3173,10 @@ function E(e) {
3173
3173
  createdAt: n.createdAt
3174
3174
  };
3175
3175
  }
3176
- function bo(e) {
3177
- return St("sha256").update(JSON.stringify(e)).digest("hex").slice(0, 12);
3178
- }
3179
3176
  function Co(e) {
3177
+ return Pt("sha256").update(JSON.stringify(e)).digest("hex").slice(0, 12);
3178
+ }
3179
+ function Do(e) {
3180
3180
  const t = Date.parse(e);
3181
3181
  return Number.isFinite(t) ? new Date(t).toISOString() : (/* @__PURE__ */ new Date(0)).toISOString();
3182
3182
  }
@@ -3187,7 +3187,7 @@ function xo(e) {
3187
3187
  return t.length > 0 ? Object.fromEntries(t) : void 0;
3188
3188
  }
3189
3189
  function Q(e) {
3190
- return [...new Set(e.map(P).filter($o))].sort(
3190
+ return [...new Set(e.map(P).filter(Mo))].sort(
3191
3191
  (t, n) => t.localeCompare(n)
3192
3192
  );
3193
3193
  }
@@ -3220,24 +3220,24 @@ function ee(e, t) {
3220
3220
  );
3221
3221
  return i !== 0 ? i : e.id.localeCompare(t.id);
3222
3222
  }
3223
- function Do(e) {
3223
+ function ko(e) {
3224
3224
  return typeof e == "object" && e !== null && !Array.isArray(e) ? e : void 0;
3225
3225
  }
3226
- function ko(e) {
3226
+ function $o(e) {
3227
3227
  return typeof e == "string" ? e : void 0;
3228
3228
  }
3229
- function $o(e) {
3229
+ function Mo(e) {
3230
3230
  return e !== void 0;
3231
3231
  }
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, {
3232
+ async function Gr(e) {
3233
+ const t = Eo(e), n = [...e.extensionDiagnostics ?? []], o = [...e.diagnostics ?? []], r = [...e.capabilities ?? []], i = e.extensionRegistry, s = e.extensionContext, a = i && s ? await Nn(i, {
3234
3234
  workspace: t,
3235
3235
  profile: e.profile,
3236
3236
  context: s
3237
- }) : t, d = dt({
3237
+ }) : t, d = lt({
3238
3238
  workspace: a,
3239
3239
  profile: e.profile
3240
- }), c = nt({
3240
+ }), c = ot({
3241
3241
  exceptions: e.exceptions ?? [],
3242
3242
  policyViolations: d,
3243
3243
  conformanceFindings: e.conformanceFindings ?? [],
@@ -3249,60 +3249,60 @@ async function Tr(e) {
3249
3249
  }) : [], u = [
3250
3250
  ...c.activePolicyViolations,
3251
3251
  ...l
3252
- ], w = mt(
3253
- e.graphSnapshot ?? Eo(a)
3254
- ), m = gt(
3252
+ ], w = ft(
3253
+ e.graphSnapshot ?? Ro(a)
3254
+ ), m = yt(
3255
3255
  c.activePolicyViolations,
3256
3256
  {
3257
3257
  createdAt: e.graphSnapshot?.extractedAt ?? (/* @__PURE__ */ new Date()).toISOString()
3258
3258
  }
3259
- ), x = c.activeConformanceFindings.length > 0 ? ft({
3259
+ ), D = c.activeConformanceFindings.length > 0 ? gt({
3260
3260
  extractedAt: e.graphSnapshot?.extractedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
3261
3261
  findings: c.activeConformanceFindings
3262
3262
  }) : [], z = ue(
3263
3263
  w,
3264
- x,
3264
+ D,
3265
3265
  m
3266
- ), T = i && s ? await Nn(i, {
3266
+ ), T = i && s ? await qn(i, {
3267
3267
  workspace: a,
3268
3268
  profile: e.profile,
3269
3269
  violations: u,
3270
3270
  signals: z,
3271
3271
  context: s
3272
- }) : [], b = ue(z, T), S = ct({
3272
+ }) : [], b = ue(z, T), S = dt({
3273
3273
  workspace: a,
3274
3274
  signals: b
3275
- }), y = i && s ? await qn(i, {
3275
+ }), y = i && s ? await _n(i, {
3276
3276
  workspace: a,
3277
3277
  profile: e.profile,
3278
3278
  signals: b,
3279
3279
  measurements: S,
3280
3280
  violations: u,
3281
3281
  context: s
3282
- }) : [], C = [...S, ...y], L = Xe(b), he = at(
3282
+ }) : [], C = [...S, ...y], L = Ze(b), he = ct(
3283
3283
  u,
3284
3284
  C
3285
- ), wt = st(
3285
+ ), It = at(
3286
3286
  C,
3287
3287
  e.profile.metrics,
3288
3288
  e.profile.health.statusThresholds,
3289
3289
  {
3290
3290
  topIssues: L
3291
3291
  }
3292
- ), It = dn({
3292
+ ), St = ln({
3293
3293
  workspace: a,
3294
3294
  profile: e.profile.name,
3295
3295
  warnings: e.warnings ?? [],
3296
- exceptions: e.exceptions && e.exceptions.length > 0 ? ot(c) : bn(),
3296
+ exceptions: e.exceptions && e.exceptions.length > 0 ? rt(c) : Cn(),
3297
3297
  violations: u,
3298
3298
  signals: b,
3299
3299
  measurements: C,
3300
- health: wt,
3300
+ health: It,
3301
3301
  recommendations: he
3302
3302
  });
3303
3303
  return {
3304
3304
  workspace: a,
3305
- assessment: It,
3305
+ assessment: St,
3306
3306
  violations: u,
3307
3307
  signals: b,
3308
3308
  measurements: C,
@@ -3313,7 +3313,7 @@ async function Tr(e) {
3313
3313
  diagnostics: o
3314
3314
  };
3315
3315
  }
3316
- function Mo(e) {
3316
+ function Eo(e) {
3317
3317
  if (e.workspace)
3318
3318
  return e.workspace;
3319
3319
  if (e.workspaceAdapterResult)
@@ -3322,7 +3322,7 @@ function Mo(e) {
3322
3322
  "buildGovernanceAssessmentArtifacts requires either workspace or workspaceAdapterResult."
3323
3323
  );
3324
3324
  }
3325
- function Eo(e) {
3325
+ function Ro(e) {
3326
3326
  return {
3327
3327
  extractedAt: (/* @__PURE__ */ new Date()).toISOString(),
3328
3328
  projects: e.projects.map((t) => ({
@@ -3345,26 +3345,26 @@ function F(e, t) {
3345
3345
  ...t.metadata ? { metadata: t.metadata } : {}
3346
3346
  };
3347
3347
  }
3348
- function Lr(e) {
3348
+ function qr(e) {
3349
3349
  return F("root-cause", e);
3350
3350
  }
3351
- function Br(e) {
3351
+ function _r(e) {
3352
3352
  return F("pr-impact", e);
3353
3353
  }
3354
- function Gr(e) {
3354
+ function Wr(e) {
3355
3355
  return F("drift", e);
3356
3356
  }
3357
- function Nr(e) {
3357
+ function Hr(e) {
3358
3358
  return F("scorecard", e);
3359
3359
  }
3360
- function qr(e) {
3360
+ function Ur(e) {
3361
3361
  return F("management-insights", e);
3362
3362
  }
3363
- const Ro = "core", Oo = {
3364
- id: Ro,
3363
+ const Oo = "core", Vo = {
3364
+ id: Oo,
3365
3365
  name: "Governance Core Built-in Rules",
3366
- rules: co
3367
- }, _r = [Oo], Be = [
3366
+ rules: lo
3367
+ }, Kr = [Vo], Be = [
3368
3368
  "cross-domain-coordination-friction",
3369
3369
  "architectural-erosion-risk",
3370
3370
  "ownership-ambiguity",
@@ -3373,8 +3373,8 @@ const Ro = "core", Oo = {
3373
3373
  "onboarding-friction",
3374
3374
  "delivery-predictability-pressure"
3375
3375
  ];
3376
- function Vo(e) {
3377
- const { assessment: t, comparison: n } = e, o = Ao(t, n), r = Fo(t, n, o), i = zo(
3376
+ function Ao(e) {
3377
+ const { assessment: t, comparison: n } = e, o = Fo(t, n), r = zo(t, n, o), i = To(
3378
3378
  t,
3379
3379
  n,
3380
3380
  o
@@ -3385,12 +3385,12 @@ function Vo(e) {
3385
3385
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
3386
3386
  profile: t.profile,
3387
3387
  indices: s,
3388
- insights: To(t, s, o),
3388
+ insights: Lo(t, s, o),
3389
3389
  drivers: o
3390
3390
  };
3391
3391
  }
3392
- const Wr = Vo;
3393
- function Hr(e) {
3392
+ const Yr = Ao;
3393
+ function Jr(e) {
3394
3394
  const t = [...e.indices].sort(
3395
3395
  (r, i) => i.score - r.score || r.id.localeCompare(i.id)
3396
3396
  )[0];
@@ -3399,14 +3399,14 @@ function Hr(e) {
3399
3399
  const n = e.drivers.slice(0, 3).map((r) => r.label), o = n.length > 0 ? ` Top drivers: ${n.join(", ")}.` : "";
3400
3400
  return `${t.name} is currently ${t.risk} risk at ${t.score}/100.${o}`;
3401
3401
  }
3402
- function Ao(e, t) {
3402
+ function Fo(e, t) {
3403
3403
  return [
3404
3404
  k({
3405
3405
  id: "cross-domain-coordination-friction",
3406
3406
  label: "Cross-domain coordination friction",
3407
3407
  measurement: p(e.measurements, "domain-integrity"),
3408
- issues: e.topIssues.filter(Bo),
3409
- violations: e.violations.filter(qo),
3408
+ issues: e.topIssues.filter(No),
3409
+ violations: e.violations.filter(_o),
3410
3410
  familyDelta: $(t, "boundaries")
3411
3411
  }),
3412
3412
  k({
@@ -3414,7 +3414,7 @@ function Ao(e, t) {
3414
3414
  label: "Architectural erosion risk",
3415
3415
  measurement: p(e.measurements, "layer-integrity"),
3416
3416
  issues: e.topIssues.filter(Go),
3417
- violations: e.violations.filter(_o),
3417
+ violations: e.violations.filter(Wo),
3418
3418
  familyDelta: $(t, "boundaries")
3419
3419
  }),
3420
3420
  k({
@@ -3424,8 +3424,8 @@ function Ao(e, t) {
3424
3424
  e.measurements,
3425
3425
  "ownership-coverage"
3426
3426
  ),
3427
- issues: e.topIssues.filter(No),
3428
- violations: e.violations.filter(Wo),
3427
+ issues: e.topIssues.filter(qo),
3428
+ violations: e.violations.filter(Ho),
3429
3429
  familyDelta: $(t, "ownership")
3430
3430
  }),
3431
3431
  k({
@@ -3435,7 +3435,7 @@ function Ao(e, t) {
3435
3435
  e.measurements,
3436
3436
  "dependency-complexity"
3437
3437
  ),
3438
- issues: e.topIssues.filter(Ge),
3438
+ issues: e.topIssues.filter(Ne),
3439
3439
  violations: [],
3440
3440
  familyDelta: $(t, "architecture")
3441
3441
  }),
@@ -3446,7 +3446,7 @@ function Ao(e, t) {
3446
3446
  e.measurements,
3447
3447
  "architectural-entropy"
3448
3448
  ),
3449
- issues: e.topIssues.filter(Ge),
3449
+ issues: e.topIssues.filter(Ne),
3450
3450
  violations: [],
3451
3451
  familyDelta: $(t, "architecture")
3452
3452
  }),
@@ -3461,13 +3461,13 @@ function Ao(e, t) {
3461
3461
  violations: [],
3462
3462
  familyDelta: $(t, "documentation")
3463
3463
  }),
3464
- Lo(e, t)
3465
- ].filter(Ho).sort(
3464
+ Bo(e, t)
3465
+ ].filter(Uo).sort(
3466
3466
  (o, r) => Be.indexOf(o.id) - Be.indexOf(r.id)
3467
3467
  );
3468
3468
  }
3469
- function Fo(e, t, n) {
3470
- const o = ht([
3469
+ function zo(e, t, n) {
3470
+ const o = vt([
3471
3471
  f(
3472
3472
  p(e.measurements, "dependency-complexity")
3473
3473
  ),
@@ -3492,9 +3492,9 @@ function Fo(e, t, n) {
3492
3492
  id: "cost-of-change",
3493
3493
  name: "Cost of Change Index",
3494
3494
  score: o,
3495
- risk: vt(o),
3495
+ risk: wt(o),
3496
3496
  trend: te(t?.healthDelta?.scoreDelta),
3497
- drivers: yt(n, [
3497
+ drivers: ht(n, [
3498
3498
  "change-impact-radius-pressure",
3499
3499
  "cost-of-change-pressure",
3500
3500
  "architectural-erosion-risk",
@@ -3504,10 +3504,10 @@ function Fo(e, t, n) {
3504
3504
  ])
3505
3505
  };
3506
3506
  }
3507
- function zo(e, t, n) {
3507
+ function To(e, t, n) {
3508
3508
  const o = ne(
3509
3509
  e.topIssues.filter((i) => i.type === "conformance-violation").reduce((i, s) => i + s.count * 10, 0)
3510
- ), r = ht([
3510
+ ), r = vt([
3511
3511
  f(
3512
3512
  p(e.measurements, "domain-integrity")
3513
3513
  ),
@@ -3531,9 +3531,9 @@ function zo(e, t, n) {
3531
3531
  id: "time-to-market-risk",
3532
3532
  name: "Time-to-Market Risk Index",
3533
3533
  score: r,
3534
- risk: vt(r),
3534
+ risk: wt(r),
3535
3535
  trend: te(t?.healthDelta?.scoreDelta),
3536
- drivers: yt(n, [
3536
+ drivers: ht(n, [
3537
3537
  "cross-domain-coordination-friction",
3538
3538
  "ownership-ambiguity",
3539
3539
  "change-impact-radius-pressure",
@@ -3543,7 +3543,7 @@ function zo(e, t, n) {
3543
3543
  ])
3544
3544
  };
3545
3545
  }
3546
- function To(e, t, n) {
3546
+ function Lo(e, t, n) {
3547
3547
  const o = [...t].sort(
3548
3548
  (s, a) => a.score - s.score || s.id.localeCompare(a.id)
3549
3549
  )[0], r = n.slice(0, 3), i = [];
@@ -3587,7 +3587,7 @@ function k(e) {
3587
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.`
3588
3588
  };
3589
3589
  }
3590
- function Lo(e, t) {
3590
+ function Bo(e, t) {
3591
3591
  return {
3592
3592
  id: "delivery-predictability-pressure",
3593
3593
  label: "Delivery predictability pressure",
@@ -3597,7 +3597,7 @@ function Lo(e, t) {
3597
3597
  explanation: `Workspace health is ${e.health.score}/100 (${e.health.status}).`
3598
3598
  };
3599
3599
  }
3600
- function yt(e, t) {
3600
+ function ht(e, t) {
3601
3601
  const n = new Set(t);
3602
3602
  return e.filter((o) => n.has(o.id));
3603
3603
  }
@@ -3612,7 +3612,7 @@ function $(e, t) {
3612
3612
  function f(e) {
3613
3613
  return e ? 100 - e.score : void 0;
3614
3614
  }
3615
- function ht(e) {
3615
+ function vt(e) {
3616
3616
  const t = e.filter(
3617
3617
  (n) => n !== void 0
3618
3618
  );
@@ -3623,55 +3623,79 @@ function ht(e) {
3623
3623
  function te(e) {
3624
3624
  return e === void 0 || e === 0 ? "stable" : e > 0 ? "improving" : "worsening";
3625
3625
  }
3626
- function vt(e) {
3626
+ function wt(e) {
3627
3627
  return e >= 70 ? "high" : e >= 40 ? "medium" : "low";
3628
3628
  }
3629
3629
  function ne(e) {
3630
3630
  return Math.max(0, Math.min(100, Math.round(e)));
3631
3631
  }
3632
- function Bo(e) {
3632
+ function No(e) {
3633
3633
  return e.type === "cross-domain-dependency";
3634
3634
  }
3635
3635
  function Go(e) {
3636
3636
  return e.type === "layer-boundary-violation";
3637
3637
  }
3638
- function No(e) {
3638
+ function qo(e) {
3639
3639
  return e.type === "ownership-gap";
3640
3640
  }
3641
- function Ge(e) {
3641
+ function Ne(e) {
3642
3642
  return e.type === "structural-dependency" || e.type === "circular-dependency";
3643
3643
  }
3644
- function qo(e) {
3644
+ function _o(e) {
3645
3645
  return e.ruleId === "domain-boundary";
3646
3646
  }
3647
- function _o(e) {
3647
+ function Wo(e) {
3648
3648
  return e.ruleId === "layer-boundary";
3649
3649
  }
3650
- function Wo(e) {
3650
+ function Ho(e) {
3651
3651
  return e.ruleId === "ownership-presence";
3652
3652
  }
3653
- function Ho(e) {
3653
+ function Uo(e) {
3654
3654
  return e !== void 0;
3655
3655
  }
3656
- async function Uo(e, t) {
3657
- const n = Ko();
3656
+ function Xr(e) {
3657
+ const t = e.changedFiles.map(Ge).filter((n) => n.length > 0);
3658
+ return t.length === 0 ? [] : e.projects.filter(
3659
+ (n) => Ko(
3660
+ Ge(n.root),
3661
+ t
3662
+ )
3663
+ ).sort(Yo);
3664
+ }
3665
+ function Ko(e, t) {
3666
+ return e.length === 0 ? t.length > 0 : t.some(
3667
+ (n) => n === e || n.startsWith(`${e}/`)
3668
+ );
3669
+ }
3670
+ function Ge(e) {
3671
+ let t = e.trim().replaceAll("\\", "/");
3672
+ for (; t.startsWith("./"); )
3673
+ t = t.slice(2);
3674
+ return t = t.replace(/\/+/g, "/").replace(/\/+$/g, ""), t === "." ? "" : t;
3675
+ }
3676
+ function Yo(e, t) {
3677
+ return e.name.localeCompare(t.name) || e.root.localeCompare(t.root) || e.id.localeCompare(t.id);
3678
+ }
3679
+ async function Jo(e, t) {
3680
+ const n = Xo();
3658
3681
  for (const o of e) {
3659
3682
  const r = await o.evaluate(t);
3660
3683
  n.violations.push(...r.violations ?? []), n.signals.push(...r.signals ?? []), n.measurements.push(...r.measurements ?? []);
3661
3684
  }
3662
3685
  return n;
3663
3686
  }
3664
- async function Ur(e, t) {
3665
- return Uo(e.rules, t);
3687
+ async function Zr(e, t) {
3688
+ return Jo(e.rules, t);
3666
3689
  }
3667
- function Ko() {
3690
+ function Xo() {
3668
3691
  return {
3669
3692
  violations: [],
3670
3693
  signals: [],
3671
3694
  measurements: []
3672
3695
  };
3673
3696
  }
3674
- function Kr(e, t) {
3697
+ const Zo = 5;
3698
+ function Qr(e, t) {
3675
3699
  const n = Object.fromEntries(
3676
3700
  e.measurements.map((i) => [
3677
3701
  i.id,
@@ -3689,7 +3713,7 @@ function Kr(e, t) {
3689
3713
  (i) => ({
3690
3714
  type: i.ruleId,
3691
3715
  source: i.project,
3692
- target: Yo(i.details?.target),
3716
+ target: Qo(i.details?.target),
3693
3717
  ruleId: i.ruleId,
3694
3718
  severity: i.severity,
3695
3719
  message: i.message
@@ -3711,114 +3735,133 @@ function Kr(e, t) {
3711
3735
  deliveryImpact: t.deliveryImpact
3712
3736
  };
3713
3737
  }
3714
- function Yo(e) {
3738
+ function ei(e) {
3739
+ return {
3740
+ indices: [...e.indices].sort((t, n) => t.id.localeCompare(n.id)).map((t) => ({
3741
+ id: t.id,
3742
+ score: t.score,
3743
+ risk: t.risk
3744
+ })),
3745
+ topDrivers: e.drivers.slice(0, Zo).map((t) => ({
3746
+ id: t.id,
3747
+ label: t.label,
3748
+ value: t.value,
3749
+ score: t.score,
3750
+ unit: t.unit,
3751
+ trend: t.trend
3752
+ }))
3753
+ };
3754
+ }
3755
+ function Qo(e) {
3715
3756
  return typeof e == "string" ? e : void 0;
3716
3757
  }
3717
3758
  export {
3718
- Ro as CORE_BUILT_IN_RULE_PACK_ID,
3759
+ Oo as CORE_BUILT_IN_RULE_PACK_ID,
3719
3760
  q as DEFAULT_HEALTH_STATUS_THRESHOLDS,
3720
- Er as DefaultGovernanceCapabilityRegistry,
3761
+ Ar as DefaultGovernanceCapabilityRegistry,
3721
3762
  se as GovernanceExtensionRegistrationError,
3722
- Bn as applyGovernanceEnrichers,
3723
- nt as applyGovernanceExceptions,
3724
- Gr as buildAiDriftHandoffPayload,
3763
+ Nn as applyGovernanceEnrichers,
3764
+ ot as applyGovernanceExceptions,
3765
+ Wr as buildAiDriftHandoffPayload,
3725
3766
  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,
3767
+ Ur as buildAiManagementInsightsHandoffPayload,
3768
+ _r as buildAiPrImpactHandoffPayload,
3769
+ qr as buildAiRootCauseHandoffPayload,
3770
+ Hr as buildAiScorecardHandoffPayload,
3771
+ dr as buildArchitectureRecommendationsRequest,
3772
+ $r as buildCognitiveLoadContext,
3773
+ cr as buildCognitiveLoadRequest,
3774
+ Ao as buildDeliveryImpactAssessment,
3775
+ xr as buildDriftInterpretationAnalysis,
3776
+ zt as buildDriftSummary,
3777
+ ln as buildGovernanceAssessment,
3778
+ Gr as buildGovernanceAssessmentArtifacts,
3779
+ gt as buildGovernanceConformanceSignals,
3780
+ rt as buildGovernanceExceptionReport,
3781
+ et as buildGovernanceExceptionScopeKey,
3782
+ ft as buildGovernanceGraphSignals,
3783
+ tr as buildGovernanceInventory,
3784
+ We as buildGovernancePayloadTruncationMetadata,
3785
+ yt as buildGovernancePolicySignals,
3786
+ ct as buildGovernanceRecommendations,
3787
+ Nr as buildGovernanceSignals,
3747
3788
  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,
3789
+ or as buildGovernanceWorkspaceFromAdapterResult,
3790
+ pr as buildManagementInsightsAiRequest,
3791
+ gn as buildMetricBreakdown,
3792
+ Qr as buildMetricSnapshot,
3793
+ Or as buildOnboardingContext,
3794
+ ar as buildOnboardingRequest,
3795
+ nn as buildPersistentSmellSignals,
3796
+ kr as buildPrImpactContext,
3797
+ ir as buildPrImpactRequest,
3798
+ Tr as buildRecommendations,
3799
+ Er as buildRecommendationsTrendContext,
3800
+ Rr as buildRefactoringSuggestionsContext,
3801
+ ur as buildRefactoringSuggestionsRequest,
3802
+ rr as buildRootCauseRequest,
3803
+ Cr as buildScopedDriftRequest,
3804
+ br as buildScopedRootCauseRequest,
3805
+ Dr as buildScopedScorecardRequest,
3806
+ sr as buildScorecardRequest,
3807
+ fn as buildSignalBreakdown,
3808
+ lr as buildSmellClustersRequest,
3809
+ ei as buildSnapshotDeliveryImpactSummary,
3810
+ Ze as buildTopIssues,
3811
+ Yr as calculateDeliveryImpact,
3812
+ at as calculateGovernanceHealth,
3813
+ dt as calculateGovernanceMetrics,
3814
+ zr as calculateHealthScore,
3815
+ Lr as calculateMetrics,
3816
+ _n as collectGovernanceMeasurements,
3817
+ qn as collectGovernanceSignals,
3776
3818
  _ 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,
3819
+ Pr as compareSnapshots,
3820
+ lo as coreBuiltInPolicyRules,
3821
+ Vo as coreBuiltInRulePack,
3822
+ Kr as coreBuiltInRulePacks,
3823
+ Mr as countWorseningDriftSignals,
3824
+ Cn as createEmptyGovernanceExceptionReport,
3783
3825
  ge as deriveAllowedLayerDependenciesFromLayerOrder,
3784
3826
  O as domainBoundaryRule,
3785
- Fr as evaluateBuiltInGovernancePolicies,
3827
+ Br as evaluateBuiltInGovernancePolicies,
3786
3828
  ze as evaluateCoreBuiltInPolicyViolations,
3787
- jn as evaluateGovernanceExceptionLifecycle,
3788
- dt as evaluateGovernancePolicies,
3829
+ bn as evaluateGovernanceExceptionLifecycle,
3830
+ lt as evaluateGovernancePolicies,
3789
3831
  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,
3832
+ Zr as evaluateRulePack,
3833
+ Jo as evaluateRules,
3834
+ pn as filterMeasurementsForReportType,
3835
+ mn as filterSignalsForReportType,
3836
+ un as filterViolationsForReportType,
3837
+ wn as isConformanceExceptionScope,
3838
+ tt as isPolicyExceptionScope,
3797
3839
  V as layerBoundaryRule,
3798
3840
  ue as mergeGovernanceSignals,
3799
3841
  Y as missingDomainRule,
3800
3842
  J as missingLayerRule,
3801
- Mr as normalizeGovernanceException,
3843
+ Vr as normalizeGovernanceException,
3802
3844
  j as normalizeGovernanceProfile,
3803
- Zo as normalizeGovernanceWorkspace,
3845
+ nr as normalizeGovernanceWorkspace,
3804
3846
  A as ownershipPresenceRule,
3805
3847
  U as projectNameConventionRule,
3806
- Mt as rankTopViolations,
3807
- Rr as registerLoadedGovernanceExtensions,
3808
- Ln as registerLoadedGovernanceExtensionsWithDiagnostics,
3809
- Jt as scopeGovernanceDependencies,
3848
+ Et as rankTopViolations,
3849
+ Fr as registerLoadedGovernanceExtensions,
3850
+ Bn as registerLoadedGovernanceExtensionsWithDiagnostics,
3851
+ Xr as resolveAffectedGovernanceProjects,
3852
+ Xt as scopeGovernanceDependencies,
3810
3853
  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,
3854
+ vr as summarizeArchitectureRecommendations,
3855
+ wr as summarizeCognitiveLoad,
3856
+ Jr as summarizeDeliveryImpact,
3857
+ jr as summarizeDrift,
3858
+ tn as summarizeDriftInterpretation,
3859
+ hr as summarizeManagementInsights,
3860
+ yr as summarizeOnboarding,
3861
+ fr as summarizePrImpact,
3862
+ Sr as summarizeRefactoringSuggestions,
3863
+ mr as summarizeRootCause,
3864
+ gr as summarizeScorecard,
3865
+ Ir as summarizeSmellClusters,
3823
3866
  K as tagConventionRule
3824
3867
  };