@anhcodo13/lattice 0.1.0 → 0.3.0
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 +36 -17
- package/dist/cli.js +933 -146
- package/dist/index.d.ts +119 -2
- package/dist/index.js +974 -58
- package/governance/policy.json +26 -13
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
|
+
interface BoundaryPolicy {
|
|
2
|
+
id: string;
|
|
3
|
+
description: string;
|
|
4
|
+
from: string[];
|
|
5
|
+
allow?: string[];
|
|
6
|
+
disallow?: string[];
|
|
7
|
+
severity: "info" | "warning" | "error";
|
|
8
|
+
recommendation?: string;
|
|
9
|
+
}
|
|
10
|
+
interface AnalysisConfig {
|
|
11
|
+
weights: Record<"architecture" | "imports" | "components" | "complexity", number>;
|
|
12
|
+
thresholds: {
|
|
13
|
+
maxFanIn: number;
|
|
14
|
+
maxFanOut: number;
|
|
15
|
+
maxChainDepth: number;
|
|
16
|
+
maxComponentLines: number;
|
|
17
|
+
maxJsxDepth: number;
|
|
18
|
+
maxComplexity: number;
|
|
19
|
+
};
|
|
20
|
+
policies: BoundaryPolicy[];
|
|
21
|
+
aliases: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
|
|
1
24
|
type ProfileName = "next" | "vite-react" | "react";
|
|
25
|
+
|
|
26
|
+
interface AssessmentPolicy {
|
|
27
|
+
architecture: {
|
|
28
|
+
minimumScore: number;
|
|
29
|
+
maximumErrors: number;
|
|
30
|
+
blockedRuleIds: string[];
|
|
31
|
+
analysis: AnalysisConfig;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
2
34
|
interface VersionPolicy {
|
|
3
|
-
schemaVersion:
|
|
35
|
+
schemaVersion: 2;
|
|
4
36
|
policyVersion: string;
|
|
5
37
|
profiles: Record<string, Record<string, string>>;
|
|
38
|
+
assessment?: AssessmentPolicy;
|
|
6
39
|
source: string;
|
|
7
40
|
sha256: string;
|
|
8
41
|
}
|
|
@@ -11,6 +44,7 @@ interface GovernanceFinding {
|
|
|
11
44
|
packageName: string;
|
|
12
45
|
expected: string;
|
|
13
46
|
declared?: string;
|
|
47
|
+
lockfileSpecifier?: string;
|
|
14
48
|
locked?: string;
|
|
15
49
|
reason: string;
|
|
16
50
|
}
|
|
@@ -31,4 +65,87 @@ declare function loadPolicy(source: string): Promise<VersionPolicy>;
|
|
|
31
65
|
|
|
32
66
|
declare function checkGovernance(options: CheckOptions): Promise<GovernanceResult>;
|
|
33
67
|
|
|
34
|
-
|
|
68
|
+
interface Finding {
|
|
69
|
+
ruleId: string;
|
|
70
|
+
category: "architecture" | "imports" | "components" | "complexity" | "routes";
|
|
71
|
+
severity: "info" | "warning" | "error";
|
|
72
|
+
file: string;
|
|
73
|
+
line: number;
|
|
74
|
+
evidence: string;
|
|
75
|
+
recommendation: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface ScoreBreakdown {
|
|
79
|
+
score: number;
|
|
80
|
+
grade: string;
|
|
81
|
+
weightedDeduction: number;
|
|
82
|
+
maintenanceAdjustment: number;
|
|
83
|
+
criticalAdjustment: number;
|
|
84
|
+
categories: Array<{
|
|
85
|
+
id: string;
|
|
86
|
+
weight: number;
|
|
87
|
+
score: number;
|
|
88
|
+
deduction: number;
|
|
89
|
+
findingCount: number;
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
type Status = "pass" | "fail" | "incomplete";
|
|
94
|
+
interface Domain {
|
|
95
|
+
status: Status;
|
|
96
|
+
issues: string[];
|
|
97
|
+
}
|
|
98
|
+
interface AssessmentReport {
|
|
99
|
+
schema: "urn:nklattice:governance-assessment:1";
|
|
100
|
+
generatedAt: string;
|
|
101
|
+
status: Status;
|
|
102
|
+
policy: {
|
|
103
|
+
version: string;
|
|
104
|
+
source: string;
|
|
105
|
+
sha256: string;
|
|
106
|
+
};
|
|
107
|
+
inventory: {
|
|
108
|
+
source: string;
|
|
109
|
+
sha256?: string;
|
|
110
|
+
expectedApps: number;
|
|
111
|
+
discoveredApps: number;
|
|
112
|
+
};
|
|
113
|
+
scope: {
|
|
114
|
+
domains: string[];
|
|
115
|
+
notEvaluated: string[];
|
|
116
|
+
};
|
|
117
|
+
issues: string[];
|
|
118
|
+
apps: Array<{
|
|
119
|
+
path: string;
|
|
120
|
+
profile: string;
|
|
121
|
+
status: Status;
|
|
122
|
+
domains: {
|
|
123
|
+
inventory: Domain;
|
|
124
|
+
dependencies: Domain & {
|
|
125
|
+
findings: GovernanceFinding[];
|
|
126
|
+
};
|
|
127
|
+
architecture: Domain & {
|
|
128
|
+
filesScanned: number;
|
|
129
|
+
localEdges: number;
|
|
130
|
+
score?: number;
|
|
131
|
+
grade?: string;
|
|
132
|
+
scoreBreakdown?: ScoreBreakdown;
|
|
133
|
+
errors: number;
|
|
134
|
+
findings: Finding[];
|
|
135
|
+
diagnostics: string[];
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
}>;
|
|
139
|
+
}
|
|
140
|
+
interface AssessOptions {
|
|
141
|
+
scanRoot: string;
|
|
142
|
+
workspaceRoot?: string;
|
|
143
|
+
inventory?: string;
|
|
144
|
+
expectedApps?: number;
|
|
145
|
+
outputDirectory?: string;
|
|
146
|
+
policy: VersionPolicy;
|
|
147
|
+
}
|
|
148
|
+
declare function renderAssessmentHtml(report: AssessmentReport): string;
|
|
149
|
+
declare function assessGovernance(options: AssessOptions): Promise<AssessmentReport>;
|
|
150
|
+
|
|
151
|
+
export { type AssessOptions, type AssessmentReport, type CheckOptions, type GovernanceFinding, type GovernanceResult, type ProfileName, type VersionPolicy, assessGovernance, checkGovernance, loadPolicy, renderAssessmentHtml };
|