@anarchitects/governance-cli 0.0.2 → 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/README.md +32 -2
- package/dist/agov-CxD8iAC2.js +1936 -0
- package/dist/agov.d.ts +12 -3
- package/dist/agov.d.ts.map +1 -1
- package/dist/bin/agov.js +2 -791
- package/dist/check.d.ts +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -2
- package/dist/internal/manual-workspace/capability.d.ts +1 -1
- package/dist/internal/manual-workspace/load-workspace.d.ts +1 -1
- package/dist/internal/metric-engine/aggregate-signals.d.ts +1 -1
- package/dist/internal/metric-engine/calculate-metrics.d.ts +1 -1
- package/dist/internal/profile/load-standalone-profile.d.ts +1 -1
- package/dist/internal/reporting/render-cli.d.ts +1 -1
- package/dist/internal/reporting/render-json.d.ts +1 -1
- package/dist/internal/signal-engine/builders.d.ts +2 -2
- package/dist/render-report.d.ts +1 -1
- package/package.json +3 -3
- package/dist/check-CZDqjUys.js +0 -1122
package/dist/check-CZDqjUys.js
DELETED
|
@@ -1,1122 +0,0 @@
|
|
|
1
|
-
import { buildGovernanceWorkspace as T, normalizeGovernanceProfile as H, evaluateGovernancePolicies as J, buildGovernancePolicySignals as Y, calculateGovernanceMetrics as X, calculateGovernanceHealth as K, buildTopIssues as Z, buildGovernanceAssessment as B, buildGovernanceRecommendations as Q } from "@anarchitects/governance-core";
|
|
2
|
-
import { readFileSync as x } from "node:fs";
|
|
3
|
-
import D from "node:path";
|
|
4
|
-
import { parseDocument as ee } from "yaml";
|
|
5
|
-
function ne(e) {
|
|
6
|
-
return {
|
|
7
|
-
id: "capability:manual-workspace",
|
|
8
|
-
data: {
|
|
9
|
-
format: e.format,
|
|
10
|
-
schemaVersion: e.schemaVersion
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
const re = /* @__PURE__ */ new Set([
|
|
15
|
-
"schemaVersion",
|
|
16
|
-
"workspace",
|
|
17
|
-
"projects",
|
|
18
|
-
"dependencies"
|
|
19
|
-
]), te = /* @__PURE__ */ new Set(["name", "root"]), oe = /* @__PURE__ */ new Set(["name", "root", "tags", "type", "metadata"]), ae = /* @__PURE__ */ new Set(["source", "target", "type"]), ie = /* @__PURE__ */ new Set(["application", "library", "tool", "unknown"]), se = /* @__PURE__ */ new Set(["static", "dynamic", "implicit", "unknown"]), ce = /* @__PURE__ */ new Set(["name", "root", "tags", "type"]), de = ["domain", "scope", "layer"];
|
|
20
|
-
class I extends Error {
|
|
21
|
-
constructor(n, r, t) {
|
|
22
|
-
super(n), this.code = r, this.filePath = t, this.name = "GenericWorkspaceLoadError";
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
class C extends Error {
|
|
26
|
-
constructor(n, r) {
|
|
27
|
-
super(
|
|
28
|
-
`Generic workspace validation failed for "${n}" with ${r.length} issue${r.length === 1 ? "" : "s"}.`
|
|
29
|
-
), this.filePath = n, this.issues = r, this.name = "GenericWorkspaceValidationError";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function le(e) {
|
|
33
|
-
const n = D.resolve(e), r = me(n), t = fe(n), o = he(t, n, r);
|
|
34
|
-
let a;
|
|
35
|
-
try {
|
|
36
|
-
a = ue(o);
|
|
37
|
-
} catch (s) {
|
|
38
|
-
throw s instanceof C ? new C(n, s.issues) : s;
|
|
39
|
-
}
|
|
40
|
-
const i = ke(a, r);
|
|
41
|
-
return {
|
|
42
|
-
filePath: n,
|
|
43
|
-
format: r,
|
|
44
|
-
adapterResult: i,
|
|
45
|
-
workspace: T(i)
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function pe(e) {
|
|
49
|
-
return le(e).adapterResult;
|
|
50
|
-
}
|
|
51
|
-
function ue(e) {
|
|
52
|
-
const n = [], r = k(e);
|
|
53
|
-
r || V("<memory>", [
|
|
54
|
-
{
|
|
55
|
-
code: "governance.workspace_schema.invalid_root",
|
|
56
|
-
message: "Workspace document root must be an object.",
|
|
57
|
-
path: "/"
|
|
58
|
-
}
|
|
59
|
-
]), j(r, re, "/", n);
|
|
60
|
-
const t = r.schemaVersion;
|
|
61
|
-
let o;
|
|
62
|
-
t === void 0 ? n.push(
|
|
63
|
-
$("/schemaVersion", "schemaVersion is required.")
|
|
64
|
-
) : Number.isInteger(t) ? t !== 1 ? n.push({
|
|
65
|
-
code: "governance.workspace_schema.unsupported_schema_version",
|
|
66
|
-
message: "schemaVersion must equal 1.",
|
|
67
|
-
path: "/schemaVersion"
|
|
68
|
-
}) : o = 1 : n.push(
|
|
69
|
-
u("/schemaVersion", "schemaVersion must be an integer.")
|
|
70
|
-
);
|
|
71
|
-
const a = ge(r.workspace, n), i = we(r.projects, n), s = ye(r.dependencies, n);
|
|
72
|
-
return ve(i, n), $e(i, s, n), (n.length > 0 || !a || !o) && V("<memory>", n), {
|
|
73
|
-
schemaVersion: o,
|
|
74
|
-
workspace: a,
|
|
75
|
-
projects: i.map(Ae),
|
|
76
|
-
dependencies: s.map(Te)
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function fe(e) {
|
|
80
|
-
try {
|
|
81
|
-
return x(e, "utf8");
|
|
82
|
-
} catch {
|
|
83
|
-
throw new I(
|
|
84
|
-
`Failed to read workspace file "${e}".`,
|
|
85
|
-
"governance.workspace_loader.read_failed",
|
|
86
|
-
e
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function me(e) {
|
|
91
|
-
const n = D.extname(e).toLowerCase();
|
|
92
|
-
if (n === ".json")
|
|
93
|
-
return "json";
|
|
94
|
-
if (n === ".yaml" || n === ".yml")
|
|
95
|
-
return "yaml";
|
|
96
|
-
throw new I(
|
|
97
|
-
`Unsupported workspace file extension for "${e}". Expected .json, .yaml, or .yml.`,
|
|
98
|
-
"governance.workspace_loader.unsupported_extension",
|
|
99
|
-
e
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
function he(e, n, r) {
|
|
103
|
-
try {
|
|
104
|
-
if (r === "json")
|
|
105
|
-
return JSON.parse(e);
|
|
106
|
-
const t = ee(e, {
|
|
107
|
-
merge: !1,
|
|
108
|
-
strict: !0,
|
|
109
|
-
uniqueKeys: !1
|
|
110
|
-
});
|
|
111
|
-
if (t.errors.length > 0)
|
|
112
|
-
throw new Error(t.errors[0]?.message ?? "Invalid YAML.");
|
|
113
|
-
return t.toJS();
|
|
114
|
-
} catch {
|
|
115
|
-
throw new I(
|
|
116
|
-
`Failed to parse ${r.toUpperCase()} workspace file "${n}".`,
|
|
117
|
-
"governance.workspace_loader.parse_error",
|
|
118
|
-
n
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function ge(e, n) {
|
|
123
|
-
const r = "/workspace";
|
|
124
|
-
if (e === void 0) {
|
|
125
|
-
n.push($(r, "workspace is required."));
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const t = k(e);
|
|
129
|
-
if (!t) {
|
|
130
|
-
n.push(u(r, "workspace must be an object."));
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
j(t, te, r, n);
|
|
134
|
-
const o = S(t.name, `${r}/name`, n, "name"), a = t.root ?? ".", i = De(a, `${r}/root`, n, "root");
|
|
135
|
-
if (!(o === void 0 || i === void 0))
|
|
136
|
-
return o.trim().length === 0 && n.push(
|
|
137
|
-
P(`${r}/name`, "workspace.name must be non-empty.")
|
|
138
|
-
), q(i) || n.push(
|
|
139
|
-
G(
|
|
140
|
-
`${r}/root`,
|
|
141
|
-
"workspace.root must be a normalized relative path."
|
|
142
|
-
)
|
|
143
|
-
), {
|
|
144
|
-
name: o,
|
|
145
|
-
root: i
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
function we(e, n) {
|
|
149
|
-
const r = "/projects";
|
|
150
|
-
if (e === void 0)
|
|
151
|
-
return n.push($(r, "projects is required.")), [];
|
|
152
|
-
if (!Array.isArray(e))
|
|
153
|
-
return n.push(u(r, "projects must be an array.")), [];
|
|
154
|
-
e.length === 0 && n.push(
|
|
155
|
-
P(r, "projects must contain at least one project.")
|
|
156
|
-
);
|
|
157
|
-
const t = [];
|
|
158
|
-
return e.forEach((o, a) => {
|
|
159
|
-
const i = `${r}/${a}`, s = k(o);
|
|
160
|
-
if (!s) {
|
|
161
|
-
n.push(
|
|
162
|
-
u(i, "Each project must be an object.")
|
|
163
|
-
);
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
j(s, oe, i, n);
|
|
167
|
-
const c = S(
|
|
168
|
-
s.name,
|
|
169
|
-
`${i}/name`,
|
|
170
|
-
n,
|
|
171
|
-
"name"
|
|
172
|
-
), d = S(
|
|
173
|
-
s.root,
|
|
174
|
-
`${i}/root`,
|
|
175
|
-
n,
|
|
176
|
-
"root"
|
|
177
|
-
);
|
|
178
|
-
d !== void 0 && !q(d) && n.push(
|
|
179
|
-
G(
|
|
180
|
-
`${i}/root`,
|
|
181
|
-
"Project root must be a normalized relative path."
|
|
182
|
-
)
|
|
183
|
-
);
|
|
184
|
-
const l = be(s.tags, `${i}/tags`, n), f = Ee(
|
|
185
|
-
s.type,
|
|
186
|
-
`${i}/type`,
|
|
187
|
-
n
|
|
188
|
-
), h = _e(
|
|
189
|
-
s.metadata,
|
|
190
|
-
`${i}/metadata`,
|
|
191
|
-
n
|
|
192
|
-
);
|
|
193
|
-
c !== void 0 && c.trim().length === 0 && n.push(
|
|
194
|
-
P(
|
|
195
|
-
`${i}/name`,
|
|
196
|
-
"Project name must be non-empty."
|
|
197
|
-
)
|
|
198
|
-
), !(c === void 0 || d === void 0 || l === void 0 || f === void 0 || h === void 0) && t.push({
|
|
199
|
-
index: a,
|
|
200
|
-
name: c,
|
|
201
|
-
root: d,
|
|
202
|
-
tags: l,
|
|
203
|
-
type: f,
|
|
204
|
-
metadata: h
|
|
205
|
-
});
|
|
206
|
-
}), t;
|
|
207
|
-
}
|
|
208
|
-
function ye(e, n) {
|
|
209
|
-
const r = "/dependencies";
|
|
210
|
-
if (e === void 0)
|
|
211
|
-
return n.push($(r, "dependencies is required.")), [];
|
|
212
|
-
if (!Array.isArray(e))
|
|
213
|
-
return n.push(u(r, "dependencies must be an array.")), [];
|
|
214
|
-
const t = [];
|
|
215
|
-
return e.forEach((o, a) => {
|
|
216
|
-
const i = `${r}/${a}`, s = k(o);
|
|
217
|
-
if (!s) {
|
|
218
|
-
n.push(
|
|
219
|
-
u(
|
|
220
|
-
i,
|
|
221
|
-
"Each dependency must be an object."
|
|
222
|
-
)
|
|
223
|
-
);
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
j(s, ae, i, n);
|
|
227
|
-
const c = S(
|
|
228
|
-
s.source,
|
|
229
|
-
`${i}/source`,
|
|
230
|
-
n,
|
|
231
|
-
"source"
|
|
232
|
-
), d = S(
|
|
233
|
-
s.target,
|
|
234
|
-
`${i}/target`,
|
|
235
|
-
n,
|
|
236
|
-
"target"
|
|
237
|
-
), l = Se(
|
|
238
|
-
s.type,
|
|
239
|
-
`${i}/type`,
|
|
240
|
-
n
|
|
241
|
-
);
|
|
242
|
-
c !== void 0 && d !== void 0 && c === d && n.push({
|
|
243
|
-
code: "governance.workspace_schema.self_dependency",
|
|
244
|
-
message: "Dependency source and target must differ.",
|
|
245
|
-
path: i
|
|
246
|
-
}), !(c === void 0 || d === void 0 || l === void 0) && t.push({
|
|
247
|
-
index: a,
|
|
248
|
-
source: c,
|
|
249
|
-
target: d,
|
|
250
|
-
type: l
|
|
251
|
-
});
|
|
252
|
-
}), t;
|
|
253
|
-
}
|
|
254
|
-
function ve(e, n) {
|
|
255
|
-
const r = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
|
|
256
|
-
e.forEach((o) => {
|
|
257
|
-
const a = `/projects/${o.index}`;
|
|
258
|
-
r.has(o.name) ? n.push({
|
|
259
|
-
code: "governance.workspace_schema.duplicate_project_name",
|
|
260
|
-
message: `Duplicate project name "${o.name}" is not allowed.`,
|
|
261
|
-
path: `${a}/name`
|
|
262
|
-
}) : r.add(o.name), t.has(o.root) ? n.push({
|
|
263
|
-
code: "governance.workspace_schema.duplicate_project_root",
|
|
264
|
-
message: `Duplicate project root "${o.root}" is not allowed.`,
|
|
265
|
-
path: `${a}/root`
|
|
266
|
-
}) : t.add(o.root);
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
function $e(e, n, r) {
|
|
270
|
-
const t = new Set(e.map((a) => a.name)), o = /* @__PURE__ */ new Set();
|
|
271
|
-
n.forEach((a) => {
|
|
272
|
-
const i = `/dependencies/${a.index}`;
|
|
273
|
-
t.has(a.source) || r.push({
|
|
274
|
-
code: "governance.workspace_schema.unknown_dependency_source",
|
|
275
|
-
message: `Dependency source "${a.source}" does not match a declared project.`,
|
|
276
|
-
path: `${i}/source`
|
|
277
|
-
}), t.has(a.target) || r.push({
|
|
278
|
-
code: "governance.workspace_schema.unknown_dependency_target",
|
|
279
|
-
message: `Dependency target "${a.target}" does not match a declared project.`,
|
|
280
|
-
path: `${i}/target`
|
|
281
|
-
});
|
|
282
|
-
const s = `${a.source}\0${a.target}\0${a.type}`;
|
|
283
|
-
o.has(s) ? r.push({
|
|
284
|
-
code: "governance.workspace_schema.duplicate_dependency",
|
|
285
|
-
message: `Duplicate dependency "${a.source}" -> "${a.target}" of type "${a.type}" is not allowed.`,
|
|
286
|
-
path: i
|
|
287
|
-
}) : o.add(s);
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
function be(e, n, r) {
|
|
291
|
-
if (e === void 0) {
|
|
292
|
-
r.push($(n, "tags is required."));
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
if (!Array.isArray(e)) {
|
|
296
|
-
r.push(u(n, "tags must be an array of strings."));
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
const t = [], o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
300
|
-
return e.forEach((i, s) => {
|
|
301
|
-
const c = `${n}/${s}`;
|
|
302
|
-
if (typeof i != "string") {
|
|
303
|
-
r.push(u(c, "Each tag must be a string."));
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
if (i.length === 0 || i.trim() !== i) {
|
|
307
|
-
r.push(
|
|
308
|
-
A(
|
|
309
|
-
c,
|
|
310
|
-
"Tags must be non-empty and may not contain leading or trailing whitespace."
|
|
311
|
-
)
|
|
312
|
-
);
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
if (o.has(i)) {
|
|
316
|
-
r.push(
|
|
317
|
-
A(c, `Duplicate tag "${i}" is not allowed.`)
|
|
318
|
-
);
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
const d = je(i);
|
|
322
|
-
if (d) {
|
|
323
|
-
if (a.get(d)) {
|
|
324
|
-
r.push(
|
|
325
|
-
A(
|
|
326
|
-
c,
|
|
327
|
-
`Multiple "${d}:" tags are not allowed on the same project.`
|
|
328
|
-
)
|
|
329
|
-
);
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
a.set(d, i);
|
|
333
|
-
}
|
|
334
|
-
o.add(i), t.push(i);
|
|
335
|
-
}), t;
|
|
336
|
-
}
|
|
337
|
-
function Ee(e, n, r) {
|
|
338
|
-
if (e === void 0)
|
|
339
|
-
return "unknown";
|
|
340
|
-
if (typeof e != "string") {
|
|
341
|
-
r.push(u(n, "Project type must be a string."));
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
if (!ie.has(e)) {
|
|
345
|
-
r.push(
|
|
346
|
-
M(
|
|
347
|
-
n,
|
|
348
|
-
"Project type must be one of application, library, tool, or unknown."
|
|
349
|
-
)
|
|
350
|
-
);
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
return e;
|
|
354
|
-
}
|
|
355
|
-
function Se(e, n, r) {
|
|
356
|
-
if (typeof e != "string") {
|
|
357
|
-
e === void 0 ? r.push(
|
|
358
|
-
$(n, "Dependency type is required.")
|
|
359
|
-
) : r.push(
|
|
360
|
-
u(n, "Dependency type must be a string.")
|
|
361
|
-
);
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
if (!se.has(e)) {
|
|
365
|
-
r.push(
|
|
366
|
-
M(
|
|
367
|
-
n,
|
|
368
|
-
"Dependency type must be one of static, dynamic, implicit, or unknown."
|
|
369
|
-
)
|
|
370
|
-
);
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
return e;
|
|
374
|
-
}
|
|
375
|
-
function _e(e, n, r) {
|
|
376
|
-
if (e === void 0)
|
|
377
|
-
return {};
|
|
378
|
-
const t = k(e);
|
|
379
|
-
if (!t) {
|
|
380
|
-
r.push(u(n, "metadata must be an object."));
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
return Object.keys(t).forEach((o) => {
|
|
384
|
-
ce.has(o) && r.push(
|
|
385
|
-
P(
|
|
386
|
-
`${n}/${F(o)}`,
|
|
387
|
-
`metadata must not redefine first-class field "${o}".`
|
|
388
|
-
)
|
|
389
|
-
);
|
|
390
|
-
}), t;
|
|
391
|
-
}
|
|
392
|
-
function ke(e, n) {
|
|
393
|
-
const r = [...e.projects].sort((o, a) => o.name.localeCompare(a.name)).map((o) => ({
|
|
394
|
-
id: o.name,
|
|
395
|
-
name: o.name,
|
|
396
|
-
root: o.root,
|
|
397
|
-
type: o.type,
|
|
398
|
-
tags: [...o.tags].sort((a, i) => a.localeCompare(i)),
|
|
399
|
-
metadata: { ...o.metadata }
|
|
400
|
-
})), t = [...e.dependencies].sort(Pe).map((o) => ({
|
|
401
|
-
sourceProjectId: o.source,
|
|
402
|
-
targetProjectId: o.target,
|
|
403
|
-
type: o.type
|
|
404
|
-
}));
|
|
405
|
-
return {
|
|
406
|
-
workspaceId: e.workspace.name,
|
|
407
|
-
workspaceName: e.workspace.name,
|
|
408
|
-
workspaceRoot: e.workspace.root,
|
|
409
|
-
projects: r,
|
|
410
|
-
dependencies: t,
|
|
411
|
-
capabilities: [
|
|
412
|
-
ne({
|
|
413
|
-
format: n,
|
|
414
|
-
schemaVersion: e.schemaVersion
|
|
415
|
-
})
|
|
416
|
-
]
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
function Pe(e, n) {
|
|
420
|
-
return e.source.localeCompare(n.source) || e.target.localeCompare(n.target) || e.type.localeCompare(n.type);
|
|
421
|
-
}
|
|
422
|
-
function j(e, n, r, t) {
|
|
423
|
-
Object.keys(e).forEach((o) => {
|
|
424
|
-
n.has(o) || t.push({
|
|
425
|
-
code: "governance.workspace_schema.unknown_field",
|
|
426
|
-
message: `Unknown field "${o}" is not allowed.`,
|
|
427
|
-
path: r === "/" ? `/${F(o)}` : `${r}/${F(o)}`
|
|
428
|
-
});
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
function S(e, n, r, t) {
|
|
432
|
-
if (e === void 0) {
|
|
433
|
-
r.push($(n, `${t} is required.`));
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
if (typeof e != "string") {
|
|
437
|
-
r.push(u(n, `${t} must be a string.`));
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
return e;
|
|
441
|
-
}
|
|
442
|
-
function De(e, n, r, t) {
|
|
443
|
-
if (typeof e != "string") {
|
|
444
|
-
r.push(u(n, `${t} must be a string.`));
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
return e;
|
|
448
|
-
}
|
|
449
|
-
function $(e, n) {
|
|
450
|
-
return {
|
|
451
|
-
code: "governance.workspace_schema.missing_required_field",
|
|
452
|
-
message: n,
|
|
453
|
-
path: e
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
function u(e, n) {
|
|
457
|
-
return {
|
|
458
|
-
code: "governance.workspace_schema.invalid_field_type",
|
|
459
|
-
message: n,
|
|
460
|
-
path: e
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
function P(e, n) {
|
|
464
|
-
return {
|
|
465
|
-
code: "governance.workspace_schema.invalid_value",
|
|
466
|
-
message: n,
|
|
467
|
-
path: e
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
function G(e, n) {
|
|
471
|
-
return {
|
|
472
|
-
code: "governance.workspace_schema.invalid_path",
|
|
473
|
-
message: n,
|
|
474
|
-
path: e
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
function M(e, n) {
|
|
478
|
-
return {
|
|
479
|
-
code: "governance.workspace_schema.invalid_enum_value",
|
|
480
|
-
message: n,
|
|
481
|
-
path: e
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
function A(e, n) {
|
|
485
|
-
return {
|
|
486
|
-
code: "governance.workspace_schema.invalid_tag",
|
|
487
|
-
message: n,
|
|
488
|
-
path: e
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
function V(e, n) {
|
|
492
|
-
throw new C(e, n);
|
|
493
|
-
}
|
|
494
|
-
function je(e) {
|
|
495
|
-
return de.find(
|
|
496
|
-
(n) => e.startsWith(`${n}:`)
|
|
497
|
-
);
|
|
498
|
-
}
|
|
499
|
-
function Ae(e) {
|
|
500
|
-
return {
|
|
501
|
-
name: e.name,
|
|
502
|
-
root: e.root,
|
|
503
|
-
tags: e.tags,
|
|
504
|
-
type: e.type,
|
|
505
|
-
metadata: e.metadata
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
function Te(e) {
|
|
509
|
-
return {
|
|
510
|
-
source: e.source,
|
|
511
|
-
target: e.target,
|
|
512
|
-
type: e.type
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
function q(e) {
|
|
516
|
-
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 : D.posix.normalize(e) === e;
|
|
517
|
-
}
|
|
518
|
-
function k(e) {
|
|
519
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
520
|
-
}
|
|
521
|
-
function F(e) {
|
|
522
|
-
return e.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
523
|
-
}
|
|
524
|
-
const Ce = /* @__PURE__ */ new Set([
|
|
525
|
-
"name",
|
|
526
|
-
"description",
|
|
527
|
-
"boundaryPolicySource",
|
|
528
|
-
"layers",
|
|
529
|
-
"rules",
|
|
530
|
-
"allowedLayerDependencies",
|
|
531
|
-
"allowedDomainDependencies",
|
|
532
|
-
"ownership",
|
|
533
|
-
"health",
|
|
534
|
-
"metrics"
|
|
535
|
-
]), Fe = /* @__PURE__ */ new Set([
|
|
536
|
-
"projectOverrides",
|
|
537
|
-
"exceptions",
|
|
538
|
-
"eslint"
|
|
539
|
-
]), Re = /* @__PURE__ */ new Set([
|
|
540
|
-
"architecturalEntropyWeight",
|
|
541
|
-
"dependencyComplexityWeight",
|
|
542
|
-
"domainIntegrityWeight",
|
|
543
|
-
"ownershipCoverageWeight",
|
|
544
|
-
"documentationCompletenessWeight",
|
|
545
|
-
"layerIntegrityWeight"
|
|
546
|
-
]), Le = /* @__PURE__ */ new Set(["required", "metadataField"]), Ie = /* @__PURE__ */ new Set(["statusThresholds"]), Oe = /* @__PURE__ */ new Set([
|
|
547
|
-
"goodMinScore",
|
|
548
|
-
"warningMinScore"
|
|
549
|
-
]), Ve = /* @__PURE__ */ new Set(["enabled", "severity", "options"]), We = /* @__PURE__ */ new Set(["error", "warning", "info"]);
|
|
550
|
-
class N extends Error {
|
|
551
|
-
constructor(n, r, t) {
|
|
552
|
-
super(n), this.code = r, this.filePath = t, this.name = "StandaloneGovernanceProfileLoadError";
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
class R extends Error {
|
|
556
|
-
constructor(n, r) {
|
|
557
|
-
super(
|
|
558
|
-
`Standalone governance profile validation failed for "${n}" with ${r.length} issue${r.length === 1 ? "" : "s"}.`
|
|
559
|
-
), this.filePath = n, this.issues = r, this.name = "StandaloneGovernanceProfileValidationError";
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
function xe(e) {
|
|
563
|
-
const n = D.resolve(e), r = qe(n), t = Ne(r, n);
|
|
564
|
-
try {
|
|
565
|
-
const o = Ge(t);
|
|
566
|
-
return {
|
|
567
|
-
filePath: n,
|
|
568
|
-
profile: o,
|
|
569
|
-
normalizedProfile: H(o)
|
|
570
|
-
};
|
|
571
|
-
} catch (o) {
|
|
572
|
-
throw o instanceof R ? new R(
|
|
573
|
-
n,
|
|
574
|
-
o.issues
|
|
575
|
-
) : o;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
function Ge(e) {
|
|
579
|
-
const n = [], r = m(e);
|
|
580
|
-
r || W("<memory>", [
|
|
581
|
-
{
|
|
582
|
-
code: "governance.profile.invalid_root",
|
|
583
|
-
message: "Governance profile document root must be an object.",
|
|
584
|
-
path: "/"
|
|
585
|
-
}
|
|
586
|
-
]);
|
|
587
|
-
const t = Me(r);
|
|
588
|
-
t && n.push(t), _(r, Ce, "/", n);
|
|
589
|
-
const o = g(
|
|
590
|
-
r.name,
|
|
591
|
-
"/name",
|
|
592
|
-
n,
|
|
593
|
-
"Profile name"
|
|
594
|
-
), a = Be(
|
|
595
|
-
r.description,
|
|
596
|
-
"/description",
|
|
597
|
-
n,
|
|
598
|
-
"Profile description"
|
|
599
|
-
), i = ze(
|
|
600
|
-
r.boundaryPolicySource,
|
|
601
|
-
"/boundaryPolicySource",
|
|
602
|
-
n
|
|
603
|
-
), s = Ue(r.layers, "/layers", n), c = He(r.rules, "/rules", n), d = Je(
|
|
604
|
-
r.allowedLayerDependencies,
|
|
605
|
-
"/allowedLayerDependencies",
|
|
606
|
-
s,
|
|
607
|
-
n
|
|
608
|
-
), l = Ye(
|
|
609
|
-
r.allowedDomainDependencies,
|
|
610
|
-
"/allowedDomainDependencies",
|
|
611
|
-
n
|
|
612
|
-
), f = Xe(r.ownership, "/ownership", n), h = Ke(r.health, "/health", n), b = Ze(r.metrics, "/metrics", n);
|
|
613
|
-
return (n.length > 0 || !o || !i || !s || !l || !f || !h || !b) && W("<memory>", n), {
|
|
614
|
-
name: o,
|
|
615
|
-
...a ? { description: a } : {},
|
|
616
|
-
boundaryPolicySource: i,
|
|
617
|
-
layers: s,
|
|
618
|
-
...c ? { rules: c } : {},
|
|
619
|
-
...d ? { allowedLayerDependencies: d } : {},
|
|
620
|
-
allowedDomainDependencies: l,
|
|
621
|
-
ownership: f,
|
|
622
|
-
health: h,
|
|
623
|
-
metrics: b
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
function Me(e) {
|
|
627
|
-
const n = Object.keys(e).some(
|
|
628
|
-
(o) => Fe.has(o)
|
|
629
|
-
), r = m(e.metrics), t = Object.keys(r ?? {}).some(
|
|
630
|
-
(o) => Re.has(o)
|
|
631
|
-
);
|
|
632
|
-
if (!(!n && !t))
|
|
633
|
-
return {
|
|
634
|
-
code: "governance.profile.unsupported_nx_runtime_profile",
|
|
635
|
-
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.',
|
|
636
|
-
path: "/"
|
|
637
|
-
};
|
|
638
|
-
}
|
|
639
|
-
function qe(e) {
|
|
640
|
-
try {
|
|
641
|
-
return x(e, "utf8");
|
|
642
|
-
} catch {
|
|
643
|
-
throw new N(
|
|
644
|
-
`Failed to read governance profile file "${e}".`,
|
|
645
|
-
"governance.profile_loader.read_failed",
|
|
646
|
-
e
|
|
647
|
-
);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
function Ne(e, n) {
|
|
651
|
-
try {
|
|
652
|
-
return JSON.parse(e);
|
|
653
|
-
} catch {
|
|
654
|
-
throw new N(
|
|
655
|
-
`Failed to parse JSON governance profile file "${n}".`,
|
|
656
|
-
"governance.profile_loader.parse_error",
|
|
657
|
-
n
|
|
658
|
-
);
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
function ze(e, n, r) {
|
|
662
|
-
if (e === void 0) {
|
|
663
|
-
r.push(
|
|
664
|
-
w(n, "boundaryPolicySource is required.")
|
|
665
|
-
);
|
|
666
|
-
return;
|
|
667
|
-
}
|
|
668
|
-
if (e !== "profile" && e !== "eslint") {
|
|
669
|
-
r.push(
|
|
670
|
-
z(
|
|
671
|
-
n,
|
|
672
|
-
'boundaryPolicySource must be "profile" or "eslint".'
|
|
673
|
-
)
|
|
674
|
-
);
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
return e;
|
|
678
|
-
}
|
|
679
|
-
function Ue(e, n, r) {
|
|
680
|
-
if (e === void 0) {
|
|
681
|
-
r.push(w(n, "layers is required."));
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
if (!Array.isArray(e)) {
|
|
685
|
-
r.push(
|
|
686
|
-
p(n, "layers must be an array of strings.")
|
|
687
|
-
);
|
|
688
|
-
return;
|
|
689
|
-
}
|
|
690
|
-
e.length === 0 && r.push(
|
|
691
|
-
y(n, "layers must contain at least one layer.")
|
|
692
|
-
);
|
|
693
|
-
const t = [], o = /* @__PURE__ */ new Set();
|
|
694
|
-
return e.forEach((a, i) => {
|
|
695
|
-
const s = g(
|
|
696
|
-
a,
|
|
697
|
-
`${n}/${i}`,
|
|
698
|
-
r,
|
|
699
|
-
"Layer"
|
|
700
|
-
);
|
|
701
|
-
if (s) {
|
|
702
|
-
if (o.has(s)) {
|
|
703
|
-
r.push(
|
|
704
|
-
y(
|
|
705
|
-
`${n}/${i}`,
|
|
706
|
-
`Duplicate layer "${s}" is not allowed.`
|
|
707
|
-
)
|
|
708
|
-
);
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
o.add(s), t.push(s);
|
|
712
|
-
}
|
|
713
|
-
}), t;
|
|
714
|
-
}
|
|
715
|
-
function He(e, n, r) {
|
|
716
|
-
if (e === void 0)
|
|
717
|
-
return;
|
|
718
|
-
const t = m(e);
|
|
719
|
-
if (!t) {
|
|
720
|
-
r.push(p(n, "rules must be an object."));
|
|
721
|
-
return;
|
|
722
|
-
}
|
|
723
|
-
const o = Object.keys(t).sort((a, i) => a.localeCompare(i)).flatMap((a) => {
|
|
724
|
-
const i = `${n}/${v(a)}`, s = g(
|
|
725
|
-
a,
|
|
726
|
-
i,
|
|
727
|
-
r,
|
|
728
|
-
"Rule id"
|
|
729
|
-
), c = t[a], d = m(c);
|
|
730
|
-
if (!d)
|
|
731
|
-
return r.push(
|
|
732
|
-
p(i, "Rule config must be an object.")
|
|
733
|
-
), [];
|
|
734
|
-
_(
|
|
735
|
-
d,
|
|
736
|
-
Ve,
|
|
737
|
-
i,
|
|
738
|
-
r
|
|
739
|
-
);
|
|
740
|
-
const l = {};
|
|
741
|
-
return d.enabled !== void 0 && (typeof d.enabled != "boolean" ? r.push(
|
|
742
|
-
p(
|
|
743
|
-
`${i}/enabled`,
|
|
744
|
-
"Rule enabled must be a boolean."
|
|
745
|
-
)
|
|
746
|
-
) : l.enabled = d.enabled), d.severity !== void 0 && (typeof d.severity != "string" || !We.has(d.severity) ? r.push(
|
|
747
|
-
z(
|
|
748
|
-
`${i}/severity`,
|
|
749
|
-
'Rule severity must be "error", "warning", or "info".'
|
|
750
|
-
)
|
|
751
|
-
) : l.severity = d.severity), d.options !== void 0 && (l.options = d.options), s ? [[s, l]] : [];
|
|
752
|
-
});
|
|
753
|
-
return o.length > 0 ? Object.fromEntries(o) : {};
|
|
754
|
-
}
|
|
755
|
-
function Je(e, n, r, t) {
|
|
756
|
-
if (e === void 0)
|
|
757
|
-
return;
|
|
758
|
-
const o = m(e);
|
|
759
|
-
if (!o) {
|
|
760
|
-
t.push(
|
|
761
|
-
p(n, "allowedLayerDependencies must be an object.")
|
|
762
|
-
);
|
|
763
|
-
return;
|
|
764
|
-
}
|
|
765
|
-
if (!r)
|
|
766
|
-
return;
|
|
767
|
-
const a = new Set(r);
|
|
768
|
-
Object.keys(o).forEach((c) => {
|
|
769
|
-
a.has(c) || t.push(
|
|
770
|
-
y(
|
|
771
|
-
`${n}/${v(c)}`,
|
|
772
|
-
`allowedLayerDependencies source layer "${c}" is not declared in layers.`
|
|
773
|
-
)
|
|
774
|
-
);
|
|
775
|
-
});
|
|
776
|
-
const s = {};
|
|
777
|
-
return r.forEach((c) => {
|
|
778
|
-
if (!Object.prototype.hasOwnProperty.call(o, c))
|
|
779
|
-
return;
|
|
780
|
-
const d = `${n}/${v(c)}`, l = o[c];
|
|
781
|
-
if (!Array.isArray(l)) {
|
|
782
|
-
t.push(
|
|
783
|
-
p(
|
|
784
|
-
d,
|
|
785
|
-
`allowedLayerDependencies target list for "${c}" must be an array of strings.`
|
|
786
|
-
)
|
|
787
|
-
);
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
const f = /* @__PURE__ */ new Set(), h = [];
|
|
791
|
-
l.forEach((b, U) => {
|
|
792
|
-
const O = `${d}/${U}`, E = g(
|
|
793
|
-
b,
|
|
794
|
-
O,
|
|
795
|
-
t,
|
|
796
|
-
"Layer dependency target"
|
|
797
|
-
);
|
|
798
|
-
if (E) {
|
|
799
|
-
if (!a.has(E)) {
|
|
800
|
-
t.push(
|
|
801
|
-
y(
|
|
802
|
-
O,
|
|
803
|
-
`allowedLayerDependencies target layer "${E}" for source layer "${c}" is not declared in layers.`
|
|
804
|
-
)
|
|
805
|
-
);
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
f.has(E) || (f.add(E), h.push(E));
|
|
809
|
-
}
|
|
810
|
-
}), s[c] = r.filter(
|
|
811
|
-
(b) => h.includes(b)
|
|
812
|
-
);
|
|
813
|
-
}), s;
|
|
814
|
-
}
|
|
815
|
-
function Ye(e, n, r) {
|
|
816
|
-
if (e === void 0) {
|
|
817
|
-
r.push(
|
|
818
|
-
w(n, "allowedDomainDependencies is required.")
|
|
819
|
-
);
|
|
820
|
-
return;
|
|
821
|
-
}
|
|
822
|
-
const t = m(e);
|
|
823
|
-
if (!t) {
|
|
824
|
-
r.push(
|
|
825
|
-
p(n, "allowedDomainDependencies must be an object.")
|
|
826
|
-
);
|
|
827
|
-
return;
|
|
828
|
-
}
|
|
829
|
-
const o = Object.keys(t).sort((a, i) => a.localeCompare(i)).map((a) => {
|
|
830
|
-
const i = `${n}/${v(a)}`, s = g(
|
|
831
|
-
a,
|
|
832
|
-
i,
|
|
833
|
-
r,
|
|
834
|
-
"Domain key"
|
|
835
|
-
), c = t[a];
|
|
836
|
-
if (!Array.isArray(c))
|
|
837
|
-
return r.push(
|
|
838
|
-
p(
|
|
839
|
-
i,
|
|
840
|
-
`allowedDomainDependencies entry for "${a}" must be an array of strings.`
|
|
841
|
-
)
|
|
842
|
-
), null;
|
|
843
|
-
const d = [
|
|
844
|
-
...new Set(
|
|
845
|
-
c.map(
|
|
846
|
-
(l, f) => g(
|
|
847
|
-
l,
|
|
848
|
-
`${i}/${f}`,
|
|
849
|
-
r,
|
|
850
|
-
"Allowed domain dependency"
|
|
851
|
-
)
|
|
852
|
-
).filter((l) => !!l)
|
|
853
|
-
)
|
|
854
|
-
].sort((l, f) => l.localeCompare(f));
|
|
855
|
-
return s ? [s, d] : null;
|
|
856
|
-
}).filter((a) => a !== null);
|
|
857
|
-
return Object.fromEntries(o);
|
|
858
|
-
}
|
|
859
|
-
function Xe(e, n, r) {
|
|
860
|
-
if (e === void 0) {
|
|
861
|
-
r.push(w(n, "ownership is required."));
|
|
862
|
-
return;
|
|
863
|
-
}
|
|
864
|
-
const t = m(e);
|
|
865
|
-
if (!t) {
|
|
866
|
-
r.push(p(n, "ownership must be an object."));
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
_(t, Le, n, r);
|
|
870
|
-
const o = t.required;
|
|
871
|
-
typeof o != "boolean" && r.push(
|
|
872
|
-
p(
|
|
873
|
-
`${n}/required`,
|
|
874
|
-
"ownership.required must be a boolean."
|
|
875
|
-
)
|
|
876
|
-
);
|
|
877
|
-
const a = g(
|
|
878
|
-
t.metadataField,
|
|
879
|
-
`${n}/metadataField`,
|
|
880
|
-
r,
|
|
881
|
-
"ownership.metadataField"
|
|
882
|
-
);
|
|
883
|
-
if (!(typeof o != "boolean" || !a))
|
|
884
|
-
return {
|
|
885
|
-
required: o,
|
|
886
|
-
metadataField: a
|
|
887
|
-
};
|
|
888
|
-
}
|
|
889
|
-
function Ke(e, n, r) {
|
|
890
|
-
if (e === void 0) {
|
|
891
|
-
r.push(w(n, "health is required."));
|
|
892
|
-
return;
|
|
893
|
-
}
|
|
894
|
-
const t = m(e);
|
|
895
|
-
if (!t) {
|
|
896
|
-
r.push(p(n, "health must be an object."));
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
_(t, Ie, n, r);
|
|
900
|
-
const o = m(t.statusThresholds), a = `${n}/statusThresholds`;
|
|
901
|
-
if (!o) {
|
|
902
|
-
r.push(
|
|
903
|
-
p(
|
|
904
|
-
a,
|
|
905
|
-
"health.statusThresholds must be an object."
|
|
906
|
-
)
|
|
907
|
-
);
|
|
908
|
-
return;
|
|
909
|
-
}
|
|
910
|
-
_(
|
|
911
|
-
o,
|
|
912
|
-
Oe,
|
|
913
|
-
a,
|
|
914
|
-
r
|
|
915
|
-
);
|
|
916
|
-
const i = L(
|
|
917
|
-
o.goodMinScore,
|
|
918
|
-
`${a}/goodMinScore`,
|
|
919
|
-
r,
|
|
920
|
-
"goodMinScore"
|
|
921
|
-
), s = L(
|
|
922
|
-
o.warningMinScore,
|
|
923
|
-
`${a}/warningMinScore`,
|
|
924
|
-
r,
|
|
925
|
-
"warningMinScore"
|
|
926
|
-
);
|
|
927
|
-
if (i !== void 0 && s !== void 0 && s > i && r.push(
|
|
928
|
-
y(
|
|
929
|
-
a,
|
|
930
|
-
"health.statusThresholds.warningMinScore must be less than or equal to goodMinScore."
|
|
931
|
-
)
|
|
932
|
-
), !(i === void 0 || s === void 0))
|
|
933
|
-
return {
|
|
934
|
-
statusThresholds: {
|
|
935
|
-
goodMinScore: i,
|
|
936
|
-
warningMinScore: s
|
|
937
|
-
}
|
|
938
|
-
};
|
|
939
|
-
}
|
|
940
|
-
function Ze(e, n, r) {
|
|
941
|
-
if (e === void 0) {
|
|
942
|
-
r.push(w(n, "metrics is required."));
|
|
943
|
-
return;
|
|
944
|
-
}
|
|
945
|
-
const t = m(e);
|
|
946
|
-
if (!t) {
|
|
947
|
-
r.push(p(n, "metrics must be an object."));
|
|
948
|
-
return;
|
|
949
|
-
}
|
|
950
|
-
const o = Object.keys(t).sort((a, i) => a.localeCompare(i)).map((a) => {
|
|
951
|
-
const i = `${n}/${v(a)}`, s = g(
|
|
952
|
-
a,
|
|
953
|
-
i,
|
|
954
|
-
r,
|
|
955
|
-
"Metric id"
|
|
956
|
-
), c = L(
|
|
957
|
-
t[a],
|
|
958
|
-
i,
|
|
959
|
-
r,
|
|
960
|
-
`Metric "${a}"`
|
|
961
|
-
);
|
|
962
|
-
return s && c !== void 0 ? [s, c] : null;
|
|
963
|
-
}).filter((a) => a !== null);
|
|
964
|
-
return Object.fromEntries(o);
|
|
965
|
-
}
|
|
966
|
-
function g(e, n, r, t) {
|
|
967
|
-
if (typeof e != "string") {
|
|
968
|
-
e === void 0 ? r.push(w(n, `${t} is required.`)) : r.push(p(n, `${t} must be a string.`));
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
const o = e.trim();
|
|
972
|
-
if (o.length === 0) {
|
|
973
|
-
r.push(y(n, `${t} must be non-empty.`));
|
|
974
|
-
return;
|
|
975
|
-
}
|
|
976
|
-
return o;
|
|
977
|
-
}
|
|
978
|
-
function Be(e, n, r, t) {
|
|
979
|
-
if (e === void 0)
|
|
980
|
-
return;
|
|
981
|
-
if (typeof e != "string") {
|
|
982
|
-
r.push(p(n, `${t} must be a string.`));
|
|
983
|
-
return;
|
|
984
|
-
}
|
|
985
|
-
const o = e.trim();
|
|
986
|
-
if (o.length === 0) {
|
|
987
|
-
r.push(y(n, `${t} must be non-empty.`));
|
|
988
|
-
return;
|
|
989
|
-
}
|
|
990
|
-
return o;
|
|
991
|
-
}
|
|
992
|
-
function L(e, n, r, t) {
|
|
993
|
-
if (typeof e != "number" || !Number.isFinite(e)) {
|
|
994
|
-
e === void 0 ? r.push(w(n, `${t} is required.`)) : r.push(
|
|
995
|
-
p(n, `${t} must be a finite number.`)
|
|
996
|
-
);
|
|
997
|
-
return;
|
|
998
|
-
}
|
|
999
|
-
return e;
|
|
1000
|
-
}
|
|
1001
|
-
function _(e, n, r, t) {
|
|
1002
|
-
Object.keys(e).forEach((o) => {
|
|
1003
|
-
n.has(o) || t.push({
|
|
1004
|
-
code: "governance.profile.unknown_field",
|
|
1005
|
-
message: `Unknown field "${o}" is not allowed.`,
|
|
1006
|
-
path: r === "/" ? `/${v(o)}` : `${r}/${v(o)}`
|
|
1007
|
-
});
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
function w(e, n) {
|
|
1011
|
-
return {
|
|
1012
|
-
code: "governance.profile.missing_required_field",
|
|
1013
|
-
message: n,
|
|
1014
|
-
path: e
|
|
1015
|
-
};
|
|
1016
|
-
}
|
|
1017
|
-
function p(e, n) {
|
|
1018
|
-
return {
|
|
1019
|
-
code: "governance.profile.invalid_field_type",
|
|
1020
|
-
message: n,
|
|
1021
|
-
path: e
|
|
1022
|
-
};
|
|
1023
|
-
}
|
|
1024
|
-
function y(e, n) {
|
|
1025
|
-
return {
|
|
1026
|
-
code: "governance.profile.invalid_value",
|
|
1027
|
-
message: n,
|
|
1028
|
-
path: e
|
|
1029
|
-
};
|
|
1030
|
-
}
|
|
1031
|
-
function z(e, n) {
|
|
1032
|
-
return {
|
|
1033
|
-
code: "governance.profile.invalid_enum_value",
|
|
1034
|
-
message: n,
|
|
1035
|
-
path: e
|
|
1036
|
-
};
|
|
1037
|
-
}
|
|
1038
|
-
function W(e, n) {
|
|
1039
|
-
throw new R(e, n);
|
|
1040
|
-
}
|
|
1041
|
-
function m(e) {
|
|
1042
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
1043
|
-
}
|
|
1044
|
-
function v(e) {
|
|
1045
|
-
return e.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
1046
|
-
}
|
|
1047
|
-
const Qe = {
|
|
1048
|
-
summary: {
|
|
1049
|
-
declaredCount: 0,
|
|
1050
|
-
matchedCount: 0,
|
|
1051
|
-
suppressedPolicyViolationCount: 0,
|
|
1052
|
-
suppressedConformanceFindingCount: 0,
|
|
1053
|
-
unusedExceptionCount: 0,
|
|
1054
|
-
activeExceptionCount: 0,
|
|
1055
|
-
staleExceptionCount: 0,
|
|
1056
|
-
expiredExceptionCount: 0,
|
|
1057
|
-
reactivatedPolicyViolationCount: 0,
|
|
1058
|
-
reactivatedConformanceFindingCount: 0
|
|
1059
|
-
},
|
|
1060
|
-
used: [],
|
|
1061
|
-
unused: [],
|
|
1062
|
-
suppressedFindings: [],
|
|
1063
|
-
reactivatedFindings: []
|
|
1064
|
-
}, en = {
|
|
1065
|
-
id: "governance-cli:manual-workspace",
|
|
1066
|
-
loadWorkspace(e) {
|
|
1067
|
-
return pe(e);
|
|
1068
|
-
}
|
|
1069
|
-
};
|
|
1070
|
-
function cn(e) {
|
|
1071
|
-
const n = rn(e), r = xe(e.profilePath).profile, t = nn({
|
|
1072
|
-
workspace: n,
|
|
1073
|
-
profile: r
|
|
1074
|
-
});
|
|
1075
|
-
return {
|
|
1076
|
-
command: "check",
|
|
1077
|
-
success: !t.violations.some(
|
|
1078
|
-
(o) => o.severity === "error"
|
|
1079
|
-
),
|
|
1080
|
-
assessment: t
|
|
1081
|
-
};
|
|
1082
|
-
}
|
|
1083
|
-
function nn(e) {
|
|
1084
|
-
const n = J(e.workspace, e.profile), r = Y(n, {
|
|
1085
|
-
createdAt: "1970-01-01T00:00:00.000Z"
|
|
1086
|
-
}), t = X({
|
|
1087
|
-
workspace: e.workspace,
|
|
1088
|
-
signals: r
|
|
1089
|
-
}), o = K(
|
|
1090
|
-
t,
|
|
1091
|
-
e.profile.metrics,
|
|
1092
|
-
e.profile.health.statusThresholds,
|
|
1093
|
-
{
|
|
1094
|
-
topIssues: Z(r)
|
|
1095
|
-
}
|
|
1096
|
-
);
|
|
1097
|
-
return B({
|
|
1098
|
-
workspace: e.workspace,
|
|
1099
|
-
profile: e.profile.name,
|
|
1100
|
-
warnings: [],
|
|
1101
|
-
exceptions: Qe,
|
|
1102
|
-
violations: n,
|
|
1103
|
-
signals: r,
|
|
1104
|
-
measurements: t,
|
|
1105
|
-
health: o,
|
|
1106
|
-
recommendations: Q(n, t)
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1109
|
-
function rn(e) {
|
|
1110
|
-
return "workspaceAdapter" in e && e.workspaceAdapter ? T(
|
|
1111
|
-
e.workspaceAdapter.loadWorkspace(e.workspaceAdapterInput)
|
|
1112
|
-
) : T(
|
|
1113
|
-
en.loadWorkspace(e.workspacePath)
|
|
1114
|
-
);
|
|
1115
|
-
}
|
|
1116
|
-
export {
|
|
1117
|
-
I as G,
|
|
1118
|
-
N as S,
|
|
1119
|
-
C as a,
|
|
1120
|
-
R as b,
|
|
1121
|
-
cn as r
|
|
1122
|
-
};
|