@anarchitects/governance-cli 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1568 +0,0 @@
1
- import { DEFAULT_HEALTH_STATUS_THRESHOLDS as D, buildGovernanceWorkspace as F, evaluateCoreBuiltInPolicyViolations as ie, normalizeGovernanceProfile as ce, buildGovernanceAssessment as q } from "@anarchitects/governance-core";
2
- import { readFileSync as Q } from "node:fs";
3
- import R from "node:path";
4
- import { parseDocument as se } from "yaml";
5
- import { createHash as de } from "node:crypto";
6
- function z(e, t = {}, r = D, o = {}) {
7
- const n = Math.round(ue(e, t)), a = me(r), i = fe(e), c = he(e), s = ge(
8
- o.topIssues ?? []
9
- ), d = ye(
10
- o.topIssues ?? [],
11
- o.projectHotspotLimit ?? 5
12
- ), u = pe(n, a);
13
- return {
14
- score: n,
15
- status: u,
16
- grade: le(n),
17
- hotspots: i.map((p) => p.name),
18
- metricHotspots: i,
19
- projectHotspots: d,
20
- explainability: {
21
- summary: Se(
22
- n,
23
- u,
24
- c,
25
- s
26
- ),
27
- statusReason: ve(n, u, a),
28
- weakestMetrics: c,
29
- dominantIssues: s
30
- }
31
- };
32
- }
33
- function ue(e, t) {
34
- if (e.length === 0)
35
- return 0;
36
- let r = 0, o = 0;
37
- for (const n of e) {
38
- const a = t[n.id] ?? 1, i = a > 0 ? a : 0;
39
- r += n.score * i, o += i;
40
- }
41
- return o === 0 ? e.reduce((n, a) => n + a.score, 0) / e.length : r / o;
42
- }
43
- function H(e, t) {
44
- const r = [];
45
- return e.some((o) => o.ruleId === "domain-boundary") && r.push({
46
- id: "reduce-cross-domain-dependencies",
47
- title: "Reduce cross-domain dependencies",
48
- priority: "high",
49
- reason: "Domain boundary violations indicate tight coupling across business domains."
50
- }), e.some((o) => o.ruleId === "ownership-presence") && r.push({
51
- id: "improve-ownership-coverage",
52
- title: "Improve ownership coverage",
53
- priority: "medium",
54
- reason: "Unowned projects slow down incident response and architectural decision making."
55
- }), (t.find(
56
- (o) => o.id === "dependency-complexity"
57
- )?.score ?? 100) < 60 && r.push({
58
- id: "reduce-dependency-complexity",
59
- title: "Reduce dependency complexity",
60
- priority: "medium",
61
- reason: "High dependency complexity increases blast radius and maintenance cost."
62
- }), r;
63
- }
64
- function le(e) {
65
- return e >= 90 ? "A" : e >= 80 ? "B" : e >= 70 ? "C" : e >= 60 ? "D" : "F";
66
- }
67
- function pe(e, t) {
68
- return e >= t.goodMinScore ? "good" : e >= t.warningMinScore ? "warning" : "critical";
69
- }
70
- function me(e) {
71
- const t = typeof e.goodMinScore == "number" && Number.isFinite(e.goodMinScore) ? e.goodMinScore : D.goodMinScore, r = typeof e.warningMinScore == "number" && Number.isFinite(e.warningMinScore) ? e.warningMinScore : D.warningMinScore;
72
- return t <= r ? D : {
73
- goodMinScore: t,
74
- warningMinScore: r
75
- };
76
- }
77
- function fe(e) {
78
- return [...e].filter((t) => t.score < 60).sort((t, r) => t.score - r.score || t.id.localeCompare(r.id)).map((t) => ({
79
- id: t.id,
80
- name: t.name,
81
- score: t.score
82
- }));
83
- }
84
- function he(e) {
85
- return [...e].sort((t, r) => t.score - r.score || t.id.localeCompare(r.id)).slice(0, 3).map((t) => ({
86
- id: t.id,
87
- name: t.name,
88
- score: t.score
89
- }));
90
- }
91
- function ge(e) {
92
- return e.slice(0, 3);
93
- }
94
- function ye(e, t) {
95
- const r = /* @__PURE__ */ new Map();
96
- for (const o of e)
97
- if (we(o))
98
- for (const n of o.projects) {
99
- const a = r.get(n) ?? {
100
- count: 0,
101
- typeCounts: /* @__PURE__ */ new Map()
102
- };
103
- a.count += o.count, a.typeCounts.set(
104
- o.type,
105
- (a.typeCounts.get(o.type) ?? 0) + o.count
106
- ), r.set(n, a);
107
- }
108
- return [...r.entries()].sort((o, n) => n[1].count - o[1].count || o[0].localeCompare(n[0])).slice(0, Math.max(1, t)).map(([o, n]) => ({
109
- project: o,
110
- count: n.count,
111
- dominantIssueTypes: [...n.typeCounts.entries()].sort((a, i) => i[1] - a[1] || a[0].localeCompare(i[0])).slice(0, 3).map(([a]) => a)
112
- }));
113
- }
114
- function we(e) {
115
- return e.type !== "structural-dependency";
116
- }
117
- function ve(e, t, r) {
118
- return t === "good" ? `Score ${e} meets the Good threshold (${r.goodMinScore}).` : t === "warning" ? `Score ${e} is below the Good threshold (${r.goodMinScore}) but meets the Warning threshold (${r.warningMinScore}).` : `Score ${e} is below the Warning threshold (${r.warningMinScore}), so status is Critical.`;
119
- }
120
- function Se(e, t, r, o) {
121
- const n = r.length > 0 ? r.map((i) => `${i.name} (${i.score})`).join(", ") : "none", a = o.length > 0 ? o.map((i) => `${i.type} x${i.count}`).join(", ") : "none";
122
- return `Overall health is ${$e(
123
- t
124
- )} at ${e}/100. Weakest metrics: ${n}. Dominant issues: ${a}.`;
125
- }
126
- function $e(e) {
127
- return `${e.charAt(0).toUpperCase()}${e.slice(1)}`;
128
- }
129
- function Pe(e) {
130
- return {
131
- id: "capability:manual-workspace",
132
- data: {
133
- format: e.format,
134
- schemaVersion: e.schemaVersion
135
- }
136
- };
137
- }
138
- const be = /* @__PURE__ */ new Set([
139
- "schemaVersion",
140
- "workspace",
141
- "projects",
142
- "dependencies"
143
- ]), je = /* @__PURE__ */ new Set(["name", "root"]), Ee = /* @__PURE__ */ new Set(["name", "root", "tags", "type", "metadata"]), _e = /* @__PURE__ */ new Set(["source", "target", "type"]), Ie = /* @__PURE__ */ new Set(["application", "library", "tool", "unknown"]), ke = /* @__PURE__ */ new Set(["static", "dynamic", "implicit", "unknown"]), De = /* @__PURE__ */ new Set(["name", "root", "tags", "type"]), Ce = ["domain", "scope", "layer"];
144
- class N extends Error {
145
- constructor(t, r, o) {
146
- super(t), this.code = r, this.filePath = o, this.name = "GenericWorkspaceLoadError";
147
- }
148
- }
149
- class x extends Error {
150
- constructor(t, r) {
151
- super(
152
- `Generic workspace validation failed for "${t}" with ${r.length} issue${r.length === 1 ? "" : "s"}.`
153
- ), this.filePath = t, this.issues = r, this.name = "GenericWorkspaceValidationError";
154
- }
155
- }
156
- function Ae(e) {
157
- const t = R.resolve(e), r = Me(t), o = Oe(t), n = Fe(o, t, r);
158
- let a;
159
- try {
160
- a = Te(n);
161
- } catch (c) {
162
- throw c instanceof x ? new x(t, c.issues) : c;
163
- }
164
- const i = Ue(a, r);
165
- return {
166
- filePath: t,
167
- format: r,
168
- adapterResult: i,
169
- workspace: F(i)
170
- };
171
- }
172
- function Re(e) {
173
- return Ae(e).adapterResult;
174
- }
175
- function Te(e) {
176
- const t = [], r = I(e);
177
- r || U("<memory>", [
178
- {
179
- code: "governance.workspace_schema.invalid_root",
180
- message: "Workspace document root must be an object.",
181
- path: "/"
182
- }
183
- ]), T(r, be, "/", t);
184
- const o = r.schemaVersion;
185
- let n;
186
- o === void 0 ? t.push(
187
- $("/schemaVersion", "schemaVersion is required.")
188
- ) : Number.isInteger(o) ? o !== 1 ? t.push({
189
- code: "governance.workspace_schema.unsupported_schema_version",
190
- message: "schemaVersion must equal 1.",
191
- path: "/schemaVersion"
192
- }) : n = 1 : t.push(
193
- f("/schemaVersion", "schemaVersion must be an integer.")
194
- );
195
- const a = xe(r.workspace, t), i = We(r.projects, t), c = Le(r.dependencies, t);
196
- return Ve(i, t), Ne(i, c, t), (t.length > 0 || !a || !n) && U("<memory>", t), {
197
- schemaVersion: n,
198
- workspace: a,
199
- projects: i.map(Xe),
200
- dependencies: c.map(Be)
201
- };
202
- }
203
- function Oe(e) {
204
- try {
205
- return Q(e, "utf8");
206
- } catch {
207
- throw new N(
208
- `Failed to read workspace file "${e}".`,
209
- "governance.workspace_loader.read_failed",
210
- e
211
- );
212
- }
213
- }
214
- function Me(e) {
215
- const t = R.extname(e).toLowerCase();
216
- if (t === ".json")
217
- return "json";
218
- if (t === ".yaml" || t === ".yml")
219
- return "yaml";
220
- throw new N(
221
- `Unsupported workspace file extension for "${e}". Expected .json, .yaml, or .yml.`,
222
- "governance.workspace_loader.unsupported_extension",
223
- e
224
- );
225
- }
226
- function Fe(e, t, r) {
227
- try {
228
- if (r === "json")
229
- return JSON.parse(e);
230
- const o = se(e, {
231
- merge: !1,
232
- strict: !0,
233
- uniqueKeys: !1
234
- });
235
- if (o.errors.length > 0)
236
- throw new Error(o.errors[0]?.message ?? "Invalid YAML.");
237
- return o.toJS();
238
- } catch {
239
- throw new N(
240
- `Failed to parse ${r.toUpperCase()} workspace file "${t}".`,
241
- "governance.workspace_loader.parse_error",
242
- t
243
- );
244
- }
245
- }
246
- function xe(e, t) {
247
- const r = "/workspace";
248
- if (e === void 0) {
249
- t.push($(r, "workspace is required."));
250
- return;
251
- }
252
- const o = I(e);
253
- if (!o) {
254
- t.push(f(r, "workspace must be an object."));
255
- return;
256
- }
257
- T(o, je, r, t);
258
- const n = j(o.name, `${r}/name`, t, "name"), a = o.root ?? ".", i = Je(a, `${r}/root`, t, "root");
259
- if (!(n === void 0 || i === void 0))
260
- return n.trim().length === 0 && t.push(
261
- C(`${r}/name`, "workspace.name must be non-empty.")
262
- ), re(i) || t.push(
263
- ee(
264
- `${r}/root`,
265
- "workspace.root must be a normalized relative path."
266
- )
267
- ), {
268
- name: n,
269
- root: i
270
- };
271
- }
272
- function We(e, t) {
273
- const r = "/projects";
274
- if (e === void 0)
275
- return t.push($(r, "projects is required.")), [];
276
- if (!Array.isArray(e))
277
- return t.push(f(r, "projects must be an array.")), [];
278
- e.length === 0 && t.push(
279
- C(r, "projects must contain at least one project.")
280
- );
281
- const o = [];
282
- return e.forEach((n, a) => {
283
- const i = `${r}/${a}`, c = I(n);
284
- if (!c) {
285
- t.push(
286
- f(i, "Each project must be an object.")
287
- );
288
- return;
289
- }
290
- T(c, Ee, i, t);
291
- const s = j(
292
- c.name,
293
- `${i}/name`,
294
- t,
295
- "name"
296
- ), d = j(
297
- c.root,
298
- `${i}/root`,
299
- t,
300
- "root"
301
- );
302
- d !== void 0 && !re(d) && t.push(
303
- ee(
304
- `${i}/root`,
305
- "Project root must be a normalized relative path."
306
- )
307
- );
308
- const u = Ge(c.tags, `${i}/tags`, t), p = qe(
309
- c.type,
310
- `${i}/type`,
311
- t
312
- ), h = He(
313
- c.metadata,
314
- `${i}/metadata`,
315
- t
316
- );
317
- s !== void 0 && s.trim().length === 0 && t.push(
318
- C(
319
- `${i}/name`,
320
- "Project name must be non-empty."
321
- )
322
- ), !(s === void 0 || d === void 0 || u === void 0 || p === void 0 || h === void 0) && o.push({
323
- index: a,
324
- name: s,
325
- root: d,
326
- tags: u,
327
- type: p,
328
- metadata: h
329
- });
330
- }), o;
331
- }
332
- function Le(e, t) {
333
- const r = "/dependencies";
334
- if (e === void 0)
335
- return t.push($(r, "dependencies is required.")), [];
336
- if (!Array.isArray(e))
337
- return t.push(f(r, "dependencies must be an array.")), [];
338
- const o = [];
339
- return e.forEach((n, a) => {
340
- const i = `${r}/${a}`, c = I(n);
341
- if (!c) {
342
- t.push(
343
- f(
344
- i,
345
- "Each dependency must be an object."
346
- )
347
- );
348
- return;
349
- }
350
- T(c, _e, i, t);
351
- const s = j(
352
- c.source,
353
- `${i}/source`,
354
- t,
355
- "source"
356
- ), d = j(
357
- c.target,
358
- `${i}/target`,
359
- t,
360
- "target"
361
- ), u = ze(
362
- c.type,
363
- `${i}/type`,
364
- t
365
- );
366
- s !== void 0 && d !== void 0 && s === d && t.push({
367
- code: "governance.workspace_schema.self_dependency",
368
- message: "Dependency source and target must differ.",
369
- path: i
370
- }), !(s === void 0 || d === void 0 || u === void 0) && o.push({
371
- index: a,
372
- source: s,
373
- target: d,
374
- type: u
375
- });
376
- }), o;
377
- }
378
- function Ve(e, t) {
379
- const r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
380
- e.forEach((n) => {
381
- const a = `/projects/${n.index}`;
382
- r.has(n.name) ? t.push({
383
- code: "governance.workspace_schema.duplicate_project_name",
384
- message: `Duplicate project name "${n.name}" is not allowed.`,
385
- path: `${a}/name`
386
- }) : r.add(n.name), o.has(n.root) ? t.push({
387
- code: "governance.workspace_schema.duplicate_project_root",
388
- message: `Duplicate project root "${n.root}" is not allowed.`,
389
- path: `${a}/root`
390
- }) : o.add(n.root);
391
- });
392
- }
393
- function Ne(e, t, r) {
394
- const o = new Set(e.map((a) => a.name)), n = /* @__PURE__ */ new Set();
395
- t.forEach((a) => {
396
- const i = `/dependencies/${a.index}`;
397
- o.has(a.source) || r.push({
398
- code: "governance.workspace_schema.unknown_dependency_source",
399
- message: `Dependency source "${a.source}" does not match a declared project.`,
400
- path: `${i}/source`
401
- }), o.has(a.target) || r.push({
402
- code: "governance.workspace_schema.unknown_dependency_target",
403
- message: `Dependency target "${a.target}" does not match a declared project.`,
404
- path: `${i}/target`
405
- });
406
- const c = `${a.source}\0${a.target}\0${a.type}`;
407
- n.has(c) ? r.push({
408
- code: "governance.workspace_schema.duplicate_dependency",
409
- message: `Duplicate dependency "${a.source}" -> "${a.target}" of type "${a.type}" is not allowed.`,
410
- path: i
411
- }) : n.add(c);
412
- });
413
- }
414
- function Ge(e, t, r) {
415
- if (e === void 0) {
416
- r.push($(t, "tags is required."));
417
- return;
418
- }
419
- if (!Array.isArray(e)) {
420
- r.push(f(t, "tags must be an array of strings."));
421
- return;
422
- }
423
- const o = [], n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
424
- return e.forEach((i, c) => {
425
- const s = `${t}/${c}`;
426
- if (typeof i != "string") {
427
- r.push(f(s, "Each tag must be a string."));
428
- return;
429
- }
430
- if (i.length === 0 || i.trim() !== i) {
431
- r.push(
432
- O(
433
- s,
434
- "Tags must be non-empty and may not contain leading or trailing whitespace."
435
- )
436
- );
437
- return;
438
- }
439
- if (n.has(i)) {
440
- r.push(
441
- O(s, `Duplicate tag "${i}" is not allowed.`)
442
- );
443
- return;
444
- }
445
- const d = Ke(i);
446
- if (d) {
447
- if (a.get(d)) {
448
- r.push(
449
- O(
450
- s,
451
- `Multiple "${d}:" tags are not allowed on the same project.`
452
- )
453
- );
454
- return;
455
- }
456
- a.set(d, i);
457
- }
458
- n.add(i), o.push(i);
459
- }), o;
460
- }
461
- function qe(e, t, r) {
462
- if (e === void 0)
463
- return "unknown";
464
- if (typeof e != "string") {
465
- r.push(f(t, "Project type must be a string."));
466
- return;
467
- }
468
- if (!Ie.has(e)) {
469
- r.push(
470
- te(
471
- t,
472
- "Project type must be one of application, library, tool, or unknown."
473
- )
474
- );
475
- return;
476
- }
477
- return e;
478
- }
479
- function ze(e, t, r) {
480
- if (typeof e != "string") {
481
- e === void 0 ? r.push(
482
- $(t, "Dependency type is required.")
483
- ) : r.push(
484
- f(t, "Dependency type must be a string.")
485
- );
486
- return;
487
- }
488
- if (!ke.has(e)) {
489
- r.push(
490
- te(
491
- t,
492
- "Dependency type must be one of static, dynamic, implicit, or unknown."
493
- )
494
- );
495
- return;
496
- }
497
- return e;
498
- }
499
- function He(e, t, r) {
500
- if (e === void 0)
501
- return {};
502
- const o = I(e);
503
- if (!o) {
504
- r.push(f(t, "metadata must be an object."));
505
- return;
506
- }
507
- return Object.keys(o).forEach((n) => {
508
- De.has(n) && r.push(
509
- C(
510
- `${t}/${W(n)}`,
511
- `metadata must not redefine first-class field "${n}".`
512
- )
513
- );
514
- }), o;
515
- }
516
- function Ue(e, t) {
517
- const r = [...e.projects].sort((n, a) => n.name.localeCompare(a.name)).map((n) => ({
518
- id: n.name,
519
- name: n.name,
520
- root: n.root,
521
- type: n.type,
522
- tags: [...n.tags].sort((a, i) => a.localeCompare(i)),
523
- metadata: { ...n.metadata }
524
- })), o = [...e.dependencies].sort(Ye).map((n) => ({
525
- sourceProjectId: n.source,
526
- targetProjectId: n.target,
527
- type: n.type
528
- }));
529
- return {
530
- workspaceId: e.workspace.name,
531
- workspaceName: e.workspace.name,
532
- workspaceRoot: e.workspace.root,
533
- projects: r,
534
- dependencies: o,
535
- capabilities: [
536
- Pe({
537
- format: t,
538
- schemaVersion: e.schemaVersion
539
- })
540
- ]
541
- };
542
- }
543
- function Ye(e, t) {
544
- return e.source.localeCompare(t.source) || e.target.localeCompare(t.target) || e.type.localeCompare(t.type);
545
- }
546
- function T(e, t, r, o) {
547
- Object.keys(e).forEach((n) => {
548
- t.has(n) || o.push({
549
- code: "governance.workspace_schema.unknown_field",
550
- message: `Unknown field "${n}" is not allowed.`,
551
- path: r === "/" ? `/${W(n)}` : `${r}/${W(n)}`
552
- });
553
- });
554
- }
555
- function j(e, t, r, o) {
556
- if (e === void 0) {
557
- r.push($(t, `${o} is required.`));
558
- return;
559
- }
560
- if (typeof e != "string") {
561
- r.push(f(t, `${o} must be a string.`));
562
- return;
563
- }
564
- return e;
565
- }
566
- function Je(e, t, r, o) {
567
- if (typeof e != "string") {
568
- r.push(f(t, `${o} must be a string.`));
569
- return;
570
- }
571
- return e;
572
- }
573
- function $(e, t) {
574
- return {
575
- code: "governance.workspace_schema.missing_required_field",
576
- message: t,
577
- path: e
578
- };
579
- }
580
- function f(e, t) {
581
- return {
582
- code: "governance.workspace_schema.invalid_field_type",
583
- message: t,
584
- path: e
585
- };
586
- }
587
- function C(e, t) {
588
- return {
589
- code: "governance.workspace_schema.invalid_value",
590
- message: t,
591
- path: e
592
- };
593
- }
594
- function ee(e, t) {
595
- return {
596
- code: "governance.workspace_schema.invalid_path",
597
- message: t,
598
- path: e
599
- };
600
- }
601
- function te(e, t) {
602
- return {
603
- code: "governance.workspace_schema.invalid_enum_value",
604
- message: t,
605
- path: e
606
- };
607
- }
608
- function O(e, t) {
609
- return {
610
- code: "governance.workspace_schema.invalid_tag",
611
- message: t,
612
- path: e
613
- };
614
- }
615
- function U(e, t) {
616
- throw new x(e, t);
617
- }
618
- function Ke(e) {
619
- return Ce.find(
620
- (t) => e.startsWith(`${t}:`)
621
- );
622
- }
623
- function Xe(e) {
624
- return {
625
- name: e.name,
626
- root: e.root,
627
- tags: e.tags,
628
- type: e.type,
629
- metadata: e.metadata
630
- };
631
- }
632
- function Be(e) {
633
- return {
634
- source: e.source,
635
- target: e.target,
636
- type: e.type
637
- };
638
- }
639
- function re(e) {
640
- return e.length === 0 || e.includes("\\") || e.startsWith("/") || e.startsWith("./") || e.endsWith("/") || /^[A-Za-z]:[\\/]/.test(e) || e.split("/").some((r) => r === ".." || r.length === 0) ? !1 : R.posix.normalize(e) === e;
641
- }
642
- function I(e) {
643
- return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
644
- }
645
- function W(e) {
646
- return e.replaceAll("~", "~0").replaceAll("/", "~1");
647
- }
648
- const Y = {
649
- graph: 0,
650
- conformance: 1,
651
- policy: 2,
652
- extension: 3
653
- }, J = {
654
- info: 0,
655
- warning: 1,
656
- error: 2
657
- }, Ze = {
658
- info: 0.25,
659
- warning: 0.6,
660
- error: 1
661
- }, Qe = {
662
- "structural-dependency": 1,
663
- "cross-domain-dependency": 0.7,
664
- "missing-domain-context": 0.85,
665
- "circular-dependency": 1,
666
- "conformance-violation": 1,
667
- "domain-boundary-violation": 1,
668
- "layer-boundary-violation": 0.75,
669
- "ownership-gap": 0.5
670
- };
671
- function et(e) {
672
- const t = /* @__PURE__ */ new Map();
673
- for (const r of e) {
674
- const o = ot(r), n = t.get(o), a = nt(r);
675
- if (n) {
676
- n.count += 1, n.totalWeight = A(n.count * n.unitWeight);
677
- continue;
678
- }
679
- t.set(o, {
680
- key: o,
681
- source: r.source,
682
- type: r.type,
683
- severity: r.severity,
684
- sourceProjectId: r.sourceProjectId,
685
- targetProjectId: r.targetProjectId,
686
- relatedProjectIds: [...r.relatedProjectIds],
687
- count: 1,
688
- unitWeight: a,
689
- totalWeight: A(a)
690
- });
691
- }
692
- return [...t.values()].sort(at);
693
- }
694
- function tt(e, t) {
695
- return e.filter(t).reduce((r, o) => r + o.count, 0);
696
- }
697
- function M(e, t) {
698
- const r = e.filter(t).reduce((o, n) => o + n.totalWeight, 0);
699
- return A(r);
700
- }
701
- function rt(e) {
702
- return e.type !== "structural-dependency";
703
- }
704
- function ot(e) {
705
- return [
706
- e.source,
707
- e.type,
708
- e.severity,
709
- e.sourceProjectId ?? "",
710
- e.targetProjectId ?? "",
711
- e.relatedProjectIds.join(",")
712
- ].join("|");
713
- }
714
- function nt(e) {
715
- return A(
716
- Qe[e.type] * Ze[e.severity]
717
- );
718
- }
719
- function at(e, t) {
720
- const r = Y[e.source] - Y[t.source];
721
- if (r !== 0)
722
- return r;
723
- const o = e.type.localeCompare(t.type);
724
- if (o !== 0)
725
- return o;
726
- const n = J[e.severity] - J[t.severity];
727
- if (n !== 0)
728
- return n;
729
- const a = (e.sourceProjectId ?? "").localeCompare(
730
- t.sourceProjectId ?? ""
731
- );
732
- if (a !== 0)
733
- return a;
734
- const i = (e.targetProjectId ?? "").localeCompare(
735
- t.targetProjectId ?? ""
736
- );
737
- return i !== 0 ? i : e.relatedProjectIds.join(",").localeCompare(t.relatedProjectIds.join(","));
738
- }
739
- function A(e) {
740
- return Number(e.toFixed(4));
741
- }
742
- function it(e) {
743
- const { workspace: t, signals: r } = e, o = t.dependencies.length, n = t.projects.length || 1, a = et(r), i = tt(
744
- a,
745
- (l) => l.type === "structural-dependency"
746
- ), c = i > 0 ? i : o, s = M(
747
- a,
748
- rt
749
- ), d = M(
750
- a,
751
- (l) => l.type === "layer-boundary-violation"
752
- ), u = M(
753
- a,
754
- (l) => l.type === "domain-boundary-violation"
755
- ), p = t.projects.filter(
756
- (l) => !!l.ownership?.team || (l.ownership?.contacts?.length ?? 0) > 0
757
- ).length, h = t.projects.filter((l) => {
758
- const k = l.metadata.documentation;
759
- return k === !0 || k === "true";
760
- }).length;
761
- return [
762
- b(
763
- "architectural-entropy",
764
- "Architectural Entropy",
765
- "architecture",
766
- s / Math.max(c, 1)
767
- ),
768
- b(
769
- "dependency-complexity",
770
- "Dependency Complexity",
771
- "architecture",
772
- c / n / 4
773
- ),
774
- b(
775
- "domain-integrity",
776
- "Domain Integrity",
777
- "boundaries",
778
- u / Math.max(c, 1)
779
- ),
780
- b(
781
- "ownership-coverage",
782
- "Ownership Coverage",
783
- "ownership",
784
- p / n,
785
- !0
786
- ),
787
- b(
788
- "documentation-completeness",
789
- "Documentation Completeness",
790
- "documentation",
791
- h / n,
792
- !0
793
- ),
794
- b(
795
- "layer-integrity",
796
- "Layer Integrity",
797
- "boundaries",
798
- d / Math.max(c, 1)
799
- )
800
- ];
801
- }
802
- function b(e, t, r, o, n = !1) {
803
- const a = Math.max(0, Math.min(1, o)), i = Number(a.toFixed(4)), c = Math.round(n ? i * 100 : (1 - i) * 100);
804
- return {
805
- id: e,
806
- name: t,
807
- family: r,
808
- value: i,
809
- score: c,
810
- maxScore: 100,
811
- unit: "ratio"
812
- };
813
- }
814
- function ct(e, t) {
815
- return ie({
816
- workspace: e,
817
- profile: t
818
- });
819
- }
820
- const st = /* @__PURE__ */ new Set([
821
- "name",
822
- "description",
823
- "boundaryPolicySource",
824
- "layers",
825
- "rules",
826
- "allowedLayerDependencies",
827
- "allowedDomainDependencies",
828
- "ownership",
829
- "health",
830
- "metrics"
831
- ]), dt = /* @__PURE__ */ new Set([
832
- "projectOverrides",
833
- "exceptions",
834
- "eslint"
835
- ]), ut = /* @__PURE__ */ new Set([
836
- "architecturalEntropyWeight",
837
- "dependencyComplexityWeight",
838
- "domainIntegrityWeight",
839
- "ownershipCoverageWeight",
840
- "documentationCompletenessWeight",
841
- "layerIntegrityWeight"
842
- ]), lt = /* @__PURE__ */ new Set(["required", "metadataField"]), pt = /* @__PURE__ */ new Set(["statusThresholds"]), mt = /* @__PURE__ */ new Set([
843
- "goodMinScore",
844
- "warningMinScore"
845
- ]), ft = /* @__PURE__ */ new Set(["enabled", "severity", "options"]), ht = /* @__PURE__ */ new Set(["error", "warning", "info"]);
846
- class oe extends Error {
847
- constructor(t, r, o) {
848
- super(t), this.code = r, this.filePath = o, this.name = "StandaloneGovernanceProfileLoadError";
849
- }
850
- }
851
- class L extends Error {
852
- constructor(t, r) {
853
- super(
854
- `Standalone governance profile validation failed for "${t}" with ${r.length} issue${r.length === 1 ? "" : "s"}.`
855
- ), this.filePath = t, this.issues = r, this.name = "StandaloneGovernanceProfileValidationError";
856
- }
857
- }
858
- function gt(e) {
859
- const t = R.resolve(e), r = vt(t), o = St(r, t);
860
- try {
861
- const n = yt(o);
862
- return {
863
- filePath: t,
864
- profile: n,
865
- normalizedProfile: ce(n)
866
- };
867
- } catch (n) {
868
- throw n instanceof L ? new L(
869
- t,
870
- n.issues
871
- ) : n;
872
- }
873
- }
874
- function yt(e) {
875
- const t = [], r = g(e);
876
- r || K("<memory>", [
877
- {
878
- code: "governance.profile.invalid_root",
879
- message: "Governance profile document root must be an object.",
880
- path: "/"
881
- }
882
- ]);
883
- const o = wt(r);
884
- o && t.push(o), E(r, st, "/", t);
885
- const n = y(
886
- r.name,
887
- "/name",
888
- t,
889
- "Profile name"
890
- ), a = Dt(
891
- r.description,
892
- "/description",
893
- t,
894
- "Profile description"
895
- ), i = $t(
896
- r.boundaryPolicySource,
897
- "/boundaryPolicySource",
898
- t
899
- ), c = Pt(r.layers, "/layers", t), s = bt(r.rules, "/rules", t), d = jt(
900
- r.allowedLayerDependencies,
901
- "/allowedLayerDependencies",
902
- c,
903
- t
904
- ), u = Et(
905
- r.allowedDomainDependencies,
906
- "/allowedDomainDependencies",
907
- t
908
- ), p = _t(r.ownership, "/ownership", t), h = It(r.health, "/health", t), l = kt(r.metrics, "/metrics", t);
909
- return (t.length > 0 || !n || !i || !c || !u || !p || !h || !l) && K("<memory>", t), {
910
- name: n,
911
- ...a ? { description: a } : {},
912
- boundaryPolicySource: i,
913
- layers: c,
914
- ...s ? { rules: s } : {},
915
- ...d ? { allowedLayerDependencies: d } : {},
916
- allowedDomainDependencies: u,
917
- ownership: p,
918
- health: h,
919
- metrics: l
920
- };
921
- }
922
- function wt(e) {
923
- const t = Object.keys(e).some(
924
- (n) => dt.has(n)
925
- ), r = g(e.metrics), o = Object.keys(r ?? {}).some(
926
- (n) => ut.has(n)
927
- );
928
- if (!(!t && !o))
929
- return {
930
- code: "governance.profile.unsupported_nx_runtime_profile",
931
- message: 'Nx Governance runtime profile files are not supported by the standalone CLI. Use a standalone profile with an explicit "name" field and without Nx-only override fields such as "projectOverrides", "exceptions", or legacy metric weight keys.',
932
- path: "/"
933
- };
934
- }
935
- function vt(e) {
936
- try {
937
- return Q(e, "utf8");
938
- } catch {
939
- throw new oe(
940
- `Failed to read governance profile file "${e}".`,
941
- "governance.profile_loader.read_failed",
942
- e
943
- );
944
- }
945
- }
946
- function St(e, t) {
947
- try {
948
- return JSON.parse(e);
949
- } catch {
950
- throw new oe(
951
- `Failed to parse JSON governance profile file "${t}".`,
952
- "governance.profile_loader.parse_error",
953
- t
954
- );
955
- }
956
- }
957
- function $t(e, t, r) {
958
- if (e === void 0) {
959
- r.push(
960
- w(t, "boundaryPolicySource is required.")
961
- );
962
- return;
963
- }
964
- if (e !== "profile" && e !== "eslint") {
965
- r.push(
966
- ne(
967
- t,
968
- 'boundaryPolicySource must be "profile" or "eslint".'
969
- )
970
- );
971
- return;
972
- }
973
- return e;
974
- }
975
- function Pt(e, t, r) {
976
- if (e === void 0) {
977
- r.push(w(t, "layers is required."));
978
- return;
979
- }
980
- if (!Array.isArray(e)) {
981
- r.push(
982
- m(t, "layers must be an array of strings.")
983
- );
984
- return;
985
- }
986
- e.length === 0 && r.push(
987
- v(t, "layers must contain at least one layer.")
988
- );
989
- const o = [], n = /* @__PURE__ */ new Set();
990
- return e.forEach((a, i) => {
991
- const c = y(
992
- a,
993
- `${t}/${i}`,
994
- r,
995
- "Layer"
996
- );
997
- if (c) {
998
- if (n.has(c)) {
999
- r.push(
1000
- v(
1001
- `${t}/${i}`,
1002
- `Duplicate layer "${c}" is not allowed.`
1003
- )
1004
- );
1005
- return;
1006
- }
1007
- n.add(c), o.push(c);
1008
- }
1009
- }), o;
1010
- }
1011
- function bt(e, t, r) {
1012
- if (e === void 0)
1013
- return;
1014
- const o = g(e);
1015
- if (!o) {
1016
- r.push(m(t, "rules must be an object."));
1017
- return;
1018
- }
1019
- const n = Object.keys(o).sort((a, i) => a.localeCompare(i)).flatMap((a) => {
1020
- const i = `${t}/${S(a)}`, c = y(
1021
- a,
1022
- i,
1023
- r,
1024
- "Rule id"
1025
- ), s = o[a], d = g(s);
1026
- if (!d)
1027
- return r.push(
1028
- m(i, "Rule config must be an object.")
1029
- ), [];
1030
- E(
1031
- d,
1032
- ft,
1033
- i,
1034
- r
1035
- );
1036
- const u = {};
1037
- return d.enabled !== void 0 && (typeof d.enabled != "boolean" ? r.push(
1038
- m(
1039
- `${i}/enabled`,
1040
- "Rule enabled must be a boolean."
1041
- )
1042
- ) : u.enabled = d.enabled), d.severity !== void 0 && (typeof d.severity != "string" || !ht.has(d.severity) ? r.push(
1043
- ne(
1044
- `${i}/severity`,
1045
- 'Rule severity must be "error", "warning", or "info".'
1046
- )
1047
- ) : u.severity = d.severity), d.options !== void 0 && (u.options = d.options), c ? [[c, u]] : [];
1048
- });
1049
- return n.length > 0 ? Object.fromEntries(n) : {};
1050
- }
1051
- function jt(e, t, r, o) {
1052
- if (e === void 0)
1053
- return;
1054
- const n = g(e);
1055
- if (!n) {
1056
- o.push(
1057
- m(t, "allowedLayerDependencies must be an object.")
1058
- );
1059
- return;
1060
- }
1061
- if (!r)
1062
- return;
1063
- const a = new Set(r);
1064
- Object.keys(n).forEach((s) => {
1065
- a.has(s) || o.push(
1066
- v(
1067
- `${t}/${S(s)}`,
1068
- `allowedLayerDependencies source layer "${s}" is not declared in layers.`
1069
- )
1070
- );
1071
- });
1072
- const c = {};
1073
- return r.forEach((s) => {
1074
- if (!Object.prototype.hasOwnProperty.call(n, s))
1075
- return;
1076
- const d = `${t}/${S(s)}`, u = n[s];
1077
- if (!Array.isArray(u)) {
1078
- o.push(
1079
- m(
1080
- d,
1081
- `allowedLayerDependencies target list for "${s}" must be an array of strings.`
1082
- )
1083
- );
1084
- return;
1085
- }
1086
- const p = /* @__PURE__ */ new Set(), h = [];
1087
- u.forEach((l, k) => {
1088
- const G = `${d}/${k}`, P = y(
1089
- l,
1090
- G,
1091
- o,
1092
- "Layer dependency target"
1093
- );
1094
- if (P) {
1095
- if (!a.has(P)) {
1096
- o.push(
1097
- v(
1098
- G,
1099
- `allowedLayerDependencies target layer "${P}" for source layer "${s}" is not declared in layers.`
1100
- )
1101
- );
1102
- return;
1103
- }
1104
- p.has(P) || (p.add(P), h.push(P));
1105
- }
1106
- }), c[s] = r.filter(
1107
- (l) => h.includes(l)
1108
- );
1109
- }), c;
1110
- }
1111
- function Et(e, t, r) {
1112
- if (e === void 0) {
1113
- r.push(
1114
- w(t, "allowedDomainDependencies is required.")
1115
- );
1116
- return;
1117
- }
1118
- const o = g(e);
1119
- if (!o) {
1120
- r.push(
1121
- m(t, "allowedDomainDependencies must be an object.")
1122
- );
1123
- return;
1124
- }
1125
- const n = Object.keys(o).sort((a, i) => a.localeCompare(i)).map((a) => {
1126
- const i = `${t}/${S(a)}`, c = y(
1127
- a,
1128
- i,
1129
- r,
1130
- "Domain key"
1131
- ), s = o[a];
1132
- if (!Array.isArray(s))
1133
- return r.push(
1134
- m(
1135
- i,
1136
- `allowedDomainDependencies entry for "${a}" must be an array of strings.`
1137
- )
1138
- ), null;
1139
- const d = [
1140
- ...new Set(
1141
- s.map(
1142
- (u, p) => y(
1143
- u,
1144
- `${i}/${p}`,
1145
- r,
1146
- "Allowed domain dependency"
1147
- )
1148
- ).filter((u) => !!u)
1149
- )
1150
- ].sort((u, p) => u.localeCompare(p));
1151
- return c ? [c, d] : null;
1152
- }).filter((a) => a !== null);
1153
- return Object.fromEntries(n);
1154
- }
1155
- function _t(e, t, r) {
1156
- if (e === void 0) {
1157
- r.push(w(t, "ownership is required."));
1158
- return;
1159
- }
1160
- const o = g(e);
1161
- if (!o) {
1162
- r.push(m(t, "ownership must be an object."));
1163
- return;
1164
- }
1165
- E(o, lt, t, r);
1166
- const n = o.required;
1167
- typeof n != "boolean" && r.push(
1168
- m(
1169
- `${t}/required`,
1170
- "ownership.required must be a boolean."
1171
- )
1172
- );
1173
- const a = y(
1174
- o.metadataField,
1175
- `${t}/metadataField`,
1176
- r,
1177
- "ownership.metadataField"
1178
- );
1179
- if (!(typeof n != "boolean" || !a))
1180
- return {
1181
- required: n,
1182
- metadataField: a
1183
- };
1184
- }
1185
- function It(e, t, r) {
1186
- if (e === void 0) {
1187
- r.push(w(t, "health is required."));
1188
- return;
1189
- }
1190
- const o = g(e);
1191
- if (!o) {
1192
- r.push(m(t, "health must be an object."));
1193
- return;
1194
- }
1195
- E(o, pt, t, r);
1196
- const n = g(o.statusThresholds), a = `${t}/statusThresholds`;
1197
- if (!n) {
1198
- r.push(
1199
- m(
1200
- a,
1201
- "health.statusThresholds must be an object."
1202
- )
1203
- );
1204
- return;
1205
- }
1206
- E(
1207
- n,
1208
- mt,
1209
- a,
1210
- r
1211
- );
1212
- const i = V(
1213
- n.goodMinScore,
1214
- `${a}/goodMinScore`,
1215
- r,
1216
- "goodMinScore"
1217
- ), c = V(
1218
- n.warningMinScore,
1219
- `${a}/warningMinScore`,
1220
- r,
1221
- "warningMinScore"
1222
- );
1223
- if (i !== void 0 && c !== void 0 && c > i && r.push(
1224
- v(
1225
- a,
1226
- "health.statusThresholds.warningMinScore must be less than or equal to goodMinScore."
1227
- )
1228
- ), !(i === void 0 || c === void 0))
1229
- return {
1230
- statusThresholds: {
1231
- goodMinScore: i,
1232
- warningMinScore: c
1233
- }
1234
- };
1235
- }
1236
- function kt(e, t, r) {
1237
- if (e === void 0) {
1238
- r.push(w(t, "metrics is required."));
1239
- return;
1240
- }
1241
- const o = g(e);
1242
- if (!o) {
1243
- r.push(m(t, "metrics must be an object."));
1244
- return;
1245
- }
1246
- const n = Object.keys(o).sort((a, i) => a.localeCompare(i)).map((a) => {
1247
- const i = `${t}/${S(a)}`, c = y(
1248
- a,
1249
- i,
1250
- r,
1251
- "Metric id"
1252
- ), s = V(
1253
- o[a],
1254
- i,
1255
- r,
1256
- `Metric "${a}"`
1257
- );
1258
- return c && s !== void 0 ? [c, s] : null;
1259
- }).filter((a) => a !== null);
1260
- return Object.fromEntries(n);
1261
- }
1262
- function y(e, t, r, o) {
1263
- if (typeof e != "string") {
1264
- e === void 0 ? r.push(w(t, `${o} is required.`)) : r.push(m(t, `${o} must be a string.`));
1265
- return;
1266
- }
1267
- const n = e.trim();
1268
- if (n.length === 0) {
1269
- r.push(v(t, `${o} must be non-empty.`));
1270
- return;
1271
- }
1272
- return n;
1273
- }
1274
- function Dt(e, t, r, o) {
1275
- if (e === void 0)
1276
- return;
1277
- if (typeof e != "string") {
1278
- r.push(m(t, `${o} must be a string.`));
1279
- return;
1280
- }
1281
- const n = e.trim();
1282
- if (n.length === 0) {
1283
- r.push(v(t, `${o} must be non-empty.`));
1284
- return;
1285
- }
1286
- return n;
1287
- }
1288
- function V(e, t, r, o) {
1289
- if (typeof e != "number" || !Number.isFinite(e)) {
1290
- e === void 0 ? r.push(w(t, `${o} is required.`)) : r.push(
1291
- m(t, `${o} must be a finite number.`)
1292
- );
1293
- return;
1294
- }
1295
- return e;
1296
- }
1297
- function E(e, t, r, o) {
1298
- Object.keys(e).forEach((n) => {
1299
- t.has(n) || o.push({
1300
- code: "governance.profile.unknown_field",
1301
- message: `Unknown field "${n}" is not allowed.`,
1302
- path: r === "/" ? `/${S(n)}` : `${r}/${S(n)}`
1303
- });
1304
- });
1305
- }
1306
- function w(e, t) {
1307
- return {
1308
- code: "governance.profile.missing_required_field",
1309
- message: t,
1310
- path: e
1311
- };
1312
- }
1313
- function m(e, t) {
1314
- return {
1315
- code: "governance.profile.invalid_field_type",
1316
- message: t,
1317
- path: e
1318
- };
1319
- }
1320
- function v(e, t) {
1321
- return {
1322
- code: "governance.profile.invalid_value",
1323
- message: t,
1324
- path: e
1325
- };
1326
- }
1327
- function ne(e, t) {
1328
- return {
1329
- code: "governance.profile.invalid_enum_value",
1330
- message: t,
1331
- path: e
1332
- };
1333
- }
1334
- function K(e, t) {
1335
- throw new L(e, t);
1336
- }
1337
- function g(e) {
1338
- return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
1339
- }
1340
- function S(e) {
1341
- return e.replaceAll("~", "~0").replaceAll("/", "~1");
1342
- }
1343
- const Ct = "signal-", X = {
1344
- graph: 0,
1345
- conformance: 1,
1346
- policy: 2,
1347
- extension: 3
1348
- }, B = {
1349
- info: 0,
1350
- warning: 1,
1351
- error: 2
1352
- };
1353
- function At(e, t = {}) {
1354
- const r = t.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
1355
- return e.flatMap((o) => Rt(o, r)).sort(Mt);
1356
- }
1357
- function Rt(e, t) {
1358
- const r = Ft(e.ruleId);
1359
- if (!r)
1360
- return [];
1361
- const o = xt(e.details), n = _(Wt(o?.targetProject)), a = _(e.project), i = ae([
1362
- a,
1363
- n
1364
- ]), c = {
1365
- ruleId: e.ruleId,
1366
- ...o ?? {},
1367
- ...e.recommendation ? { recommendation: e.recommendation } : {}
1368
- };
1369
- return [
1370
- Tt({
1371
- type: r.type,
1372
- sourceProjectId: a,
1373
- targetProjectId: n,
1374
- relatedProjectIds: i,
1375
- severity: e.severity,
1376
- category: r.category,
1377
- message: e.message,
1378
- metadata: c,
1379
- source: "policy",
1380
- sourcePluginId: e.sourcePluginId,
1381
- createdAt: t,
1382
- identityKey: [
1383
- "policy",
1384
- e.ruleId,
1385
- a ?? "",
1386
- n ?? "",
1387
- e.severity,
1388
- i.join(",")
1389
- ].join("|")
1390
- })
1391
- ];
1392
- }
1393
- function Tt(e) {
1394
- const t = _(e.sourceProjectId), r = _(e.targetProjectId), o = ae(
1395
- e.relatedProjectIds
1396
- ), n = e.metadata && Object.keys(e.metadata).length > 0 ? { ...e.metadata } : void 0;
1397
- return {
1398
- id: Ot({
1399
- source: e.source,
1400
- type: e.type,
1401
- category: e.category,
1402
- sourceProjectId: t,
1403
- targetProjectId: r,
1404
- message: e.message,
1405
- relatedProjectIds: o,
1406
- identityKey: e.identityKey
1407
- }),
1408
- type: e.type,
1409
- sourceProjectId: t,
1410
- targetProjectId: r,
1411
- relatedProjectIds: o,
1412
- severity: e.severity,
1413
- category: e.category,
1414
- message: e.message,
1415
- metadata: n,
1416
- source: e.source,
1417
- sourcePluginId: e.sourcePluginId,
1418
- createdAt: e.createdAt
1419
- };
1420
- }
1421
- function ae(e) {
1422
- return [
1423
- ...new Set(
1424
- e.map(_).filter((t) => !!t)
1425
- )
1426
- ].sort((t, r) => t.localeCompare(r));
1427
- }
1428
- function Ot(e) {
1429
- const t = e.identityKey ?? [
1430
- e.source,
1431
- e.type,
1432
- e.category,
1433
- e.sourceProjectId ?? "",
1434
- e.targetProjectId ?? "",
1435
- e.message,
1436
- e.relatedProjectIds.join(",")
1437
- ].join("|"), r = de("sha256").update(t).digest("hex").slice(0, 16);
1438
- return `${Ct}${r}`;
1439
- }
1440
- function Mt(e, t) {
1441
- const r = X[e.source] - X[t.source];
1442
- if (r !== 0)
1443
- return r;
1444
- const o = e.type.localeCompare(t.type);
1445
- if (o !== 0)
1446
- return o;
1447
- const n = B[e.severity] - B[t.severity];
1448
- if (n !== 0)
1449
- return n;
1450
- const a = (e.sourceProjectId ?? "").localeCompare(
1451
- t.sourceProjectId ?? ""
1452
- );
1453
- if (a !== 0)
1454
- return a;
1455
- const i = (e.targetProjectId ?? "").localeCompare(
1456
- t.targetProjectId ?? ""
1457
- );
1458
- return i !== 0 ? i : e.id.localeCompare(t.id);
1459
- }
1460
- function _(e) {
1461
- if (!e)
1462
- return;
1463
- const t = e.trim();
1464
- return t.length > 0 ? t : void 0;
1465
- }
1466
- function Ft(e) {
1467
- return e === "domain-boundary" ? {
1468
- type: "domain-boundary-violation",
1469
- category: "boundary"
1470
- } : e === "layer-boundary" ? {
1471
- type: "layer-boundary-violation",
1472
- category: "boundary"
1473
- } : e === "ownership-presence" ? {
1474
- type: "ownership-gap",
1475
- category: "ownership"
1476
- } : null;
1477
- }
1478
- function xt(e) {
1479
- return e && typeof e == "object" ? e : void 0;
1480
- }
1481
- function Wt(e) {
1482
- return typeof e == "string" ? e : void 0;
1483
- }
1484
- const Z = {
1485
- summary: {
1486
- declaredCount: 0,
1487
- matchedCount: 0,
1488
- suppressedPolicyViolationCount: 0,
1489
- suppressedConformanceFindingCount: 0,
1490
- unusedExceptionCount: 0,
1491
- activeExceptionCount: 0,
1492
- staleExceptionCount: 0,
1493
- expiredExceptionCount: 0,
1494
- reactivatedPolicyViolationCount: 0,
1495
- reactivatedConformanceFindingCount: 0
1496
- },
1497
- used: [],
1498
- unused: [],
1499
- suppressedFindings: [],
1500
- reactivatedFindings: []
1501
- }, Lt = {
1502
- id: "governance-cli:manual-workspace",
1503
- loadWorkspace(e) {
1504
- return Re(e);
1505
- }
1506
- };
1507
- function Yt(e) {
1508
- const t = Nt(e), r = gt(e.profilePath).profile, o = Vt({
1509
- workspace: t,
1510
- profile: r
1511
- });
1512
- return {
1513
- command: "check",
1514
- success: !o.violations.some(
1515
- (n) => n.severity === "error"
1516
- ),
1517
- assessment: o
1518
- };
1519
- }
1520
- function Vt(e) {
1521
- const t = ct(e.workspace, e.profile), r = At(t, {
1522
- createdAt: "1970-01-01T00:00:00.000Z"
1523
- }), o = it({
1524
- workspace: e.workspace,
1525
- signals: r
1526
- }), n = q({
1527
- workspace: e.workspace,
1528
- profile: e.profile.name,
1529
- exceptions: Z,
1530
- violations: t,
1531
- signals: r,
1532
- measurements: o,
1533
- health: z(o, e.profile.metrics),
1534
- recommendations: H(t, o)
1535
- }), a = z(
1536
- o,
1537
- e.profile.metrics,
1538
- e.profile.health.statusThresholds,
1539
- {
1540
- topIssues: n.topIssues
1541
- }
1542
- );
1543
- return q({
1544
- workspace: e.workspace,
1545
- profile: e.profile.name,
1546
- warnings: [],
1547
- exceptions: Z,
1548
- violations: t,
1549
- signals: r,
1550
- measurements: o,
1551
- health: a,
1552
- recommendations: H(t, o)
1553
- });
1554
- }
1555
- function Nt(e) {
1556
- return "workspaceAdapter" in e && e.workspaceAdapter ? F(
1557
- e.workspaceAdapter.loadWorkspace(e.workspaceAdapterInput)
1558
- ) : F(
1559
- Lt.loadWorkspace(e.workspacePath)
1560
- );
1561
- }
1562
- export {
1563
- N as G,
1564
- oe as S,
1565
- x as a,
1566
- L as b,
1567
- Yt as r
1568
- };