adre-cli 0.1.0__py3-none-any.whl
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.
- adre/__init__.py +5 -0
- adre/analyzers/__init__.py +1 -0
- adre/analyzers/architecture.py +253 -0
- adre/analyzers/findings.py +457 -0
- adre/analyzers/inference.py +163 -0
- adre/cli.py +923 -0
- adre/core/__init__.py +1 -0
- adre/core/accepted.py +225 -0
- adre/core/adaptive.py +221 -0
- adre/core/baseline.py +1165 -0
- adre/core/config.py +60 -0
- adre/core/decision_engine.py +361 -0
- adre/core/declared.py +313 -0
- adre/core/evolution_intelligence.py +390 -0
- adre/core/explainer.py +413 -0
- adre/core/git_intelligence.py +392 -0
- adre/core/github_check.py +212 -0
- adre/core/incremental.py +288 -0
- adre/core/layers.py +306 -0
- adre/core/pr_intelligence.py +261 -0
- adre/core/pr_review.py +454 -0
- adre/core/prioritization.py +196 -0
- adre/core/project.py +41 -0
- adre/core/refactor_intelligence.py +201 -0
- adre/core/repositories.py +312 -0
- adre/core/review.py +96 -0
- adre/core/rules_shared.py +75 -0
- adre/core/sarif.py +141 -0
- adre/core/scope.py +141 -0
- adre/core/snapshots.py +242 -0
- adre/core/stability_intelligence.py +361 -0
- adre/graph/__init__.py +0 -0
- adre/graph/dependencies.py +379 -0
- adre/parsers/__init__.py +87 -0
- adre/parsers/go.py +140 -0
- adre/parsers/javascript.py +364 -0
- adre/parsers/jvm.py +127 -0
- adre/parsers/python.py +153 -0
- adre/reports/__init__.py +1 -0
- adre/reports/architecture.py +349 -0
- adre/rules.py +12 -0
- adre/web.py +3731 -0
- adre_cli-0.1.0.dist-info/METADATA +343 -0
- adre_cli-0.1.0.dist-info/RECORD +48 -0
- adre_cli-0.1.0.dist-info/WHEEL +5 -0
- adre_cli-0.1.0.dist-info/entry_points.txt +2 -0
- adre_cli-0.1.0.dist-info/licenses/LICENSE +202 -0
- adre_cli-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
from collections import defaultdict
|
|
2
|
+
|
|
3
|
+
from adre.rules import RULES
|
|
4
|
+
from adre.core.config import SEVERITY_WEIGHTS
|
|
5
|
+
from adre.core.rules_shared import (
|
|
6
|
+
SEVERITY_ORDER,
|
|
7
|
+
layer_violation_weight,
|
|
8
|
+
)
|
|
9
|
+
from adre.graph.dependencies import dependency_graph_edges, get_layer
|
|
10
|
+
from adre.analyzers.architecture import count_severities
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_rating_label(score):
|
|
14
|
+
if score >= 90:
|
|
15
|
+
return "excellent"
|
|
16
|
+
if score >= 75:
|
|
17
|
+
return "healthy"
|
|
18
|
+
if score >= 60:
|
|
19
|
+
return "needs attention"
|
|
20
|
+
if score >= 40:
|
|
21
|
+
return "high risk"
|
|
22
|
+
return "critical risk"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def build_executive_summary(score, issues, cycles, indirect_dependencies, hotspot_files):
|
|
26
|
+
severity_counts = count_severities(issues)
|
|
27
|
+
rating_label = get_rating_label(score)
|
|
28
|
+
if not issues and not cycles:
|
|
29
|
+
status = "No major architectural drift was detected."
|
|
30
|
+
elif severity_counts["critical"]:
|
|
31
|
+
status = "Critical architectural drift is present and should be addressed before expanding the system."
|
|
32
|
+
elif severity_counts["high"]:
|
|
33
|
+
status = "The system is functional but has high-priority dependency boundaries to tighten."
|
|
34
|
+
else:
|
|
35
|
+
status = "The system has manageable architecture drift that can be improved incrementally."
|
|
36
|
+
return {
|
|
37
|
+
"status": status,
|
|
38
|
+
"rating_label": rating_label,
|
|
39
|
+
"overall_architecture_rating": score,
|
|
40
|
+
"total_issues": len(issues),
|
|
41
|
+
"critical_issues": severity_counts["critical"],
|
|
42
|
+
"high_issues": severity_counts["high"],
|
|
43
|
+
"medium_issues": severity_counts["medium"],
|
|
44
|
+
"low_issues": severity_counts["low"],
|
|
45
|
+
"cycle_count": len(cycles),
|
|
46
|
+
"indirect_dependency_count": len(indirect_dependencies),
|
|
47
|
+
"hotspot_count": len(hotspot_files)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def build_prioritized_refactor_plan(issues, cycles, hotspot_files, architecture_type=None):
|
|
52
|
+
plan = []
|
|
53
|
+
if cycles:
|
|
54
|
+
plan.append({
|
|
55
|
+
"priority": 1,
|
|
56
|
+
"title": "Break circular dependencies",
|
|
57
|
+
"reason": "Cycles are the highest-risk architecture smell because they make imports fragile and blur ownership.",
|
|
58
|
+
"action": "Extract shared contracts or helper functions into lower-level modules, then point both sides at the extracted module.",
|
|
59
|
+
"affected_items": cycles[:5]
|
|
60
|
+
})
|
|
61
|
+
critical_or_high = [issue for issue in issues if issue["severity"] in {"critical", "high"} and issue["issue_type"] != "cycle"]
|
|
62
|
+
if critical_or_high:
|
|
63
|
+
plan.append({
|
|
64
|
+
"priority": len(plan) + 1,
|
|
65
|
+
"title": "Restore layer boundaries",
|
|
66
|
+
"reason": f"Critical and high severity imports violate the intended dependency direction for {architecture_type or 'the detected architecture'}.",
|
|
67
|
+
"action": "Move behavior behind the allowed layer boundary and keep lower-level modules free of higher-level application imports.",
|
|
68
|
+
"affected_items": critical_or_high[:10]
|
|
69
|
+
})
|
|
70
|
+
if hotspot_files:
|
|
71
|
+
plan.append({
|
|
72
|
+
"priority": len(plan) + 1,
|
|
73
|
+
"title": "Reduce hotspot module pressure",
|
|
74
|
+
"reason": "Highly depended-on files increase blast radius and make unrelated changes more risky.",
|
|
75
|
+
"action": "Split broad modules by responsibility and expose small, stable APIs for common behavior.",
|
|
76
|
+
"affected_items": hotspot_files[:5]
|
|
77
|
+
})
|
|
78
|
+
medium_or_low = [issue for issue in issues if issue["severity"] in {"medium", "low"} and issue["issue_type"] != "cycle"]
|
|
79
|
+
if medium_or_low:
|
|
80
|
+
plan.append({
|
|
81
|
+
"priority": len(plan) + 1,
|
|
82
|
+
"title": "Clean up remaining drift",
|
|
83
|
+
"reason": "Lower-priority drift compounds over time if it is allowed to become the default pattern.",
|
|
84
|
+
"action": "Review each dependency and either move it behind an explicit boundary or document why it is acceptable.",
|
|
85
|
+
"affected_items": medium_or_low[:10]
|
|
86
|
+
})
|
|
87
|
+
return plan
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def build_risk_breakdown_by_layer(issues, dependency_graph, rules=None):
|
|
91
|
+
active_rules = rules or RULES
|
|
92
|
+
layers = sorted(
|
|
93
|
+
set(data.get("layer") for data in dependency_graph.values() if isinstance(data, dict))
|
|
94
|
+
| set(active_rules.get("layer_rules", {}).keys())
|
|
95
|
+
| {"root"}
|
|
96
|
+
)
|
|
97
|
+
breakdown = {}
|
|
98
|
+
for layer in layers:
|
|
99
|
+
layer_files = [file for file, data in dependency_graph.items() if data["layer"] == layer]
|
|
100
|
+
layer_issues = [issue for issue in issues if issue["layer"] == layer]
|
|
101
|
+
severity_counts = count_severities(layer_issues)
|
|
102
|
+
risk_score = sum(SEVERITY_WEIGHTS.get(issue["severity"], 5) for issue in layer_issues)
|
|
103
|
+
if risk_score >= 50:
|
|
104
|
+
risk_level = "critical"
|
|
105
|
+
elif risk_score >= 25:
|
|
106
|
+
risk_level = "high"
|
|
107
|
+
elif risk_score >= 10:
|
|
108
|
+
risk_level = "medium"
|
|
109
|
+
elif risk_score > 0:
|
|
110
|
+
risk_level = "low"
|
|
111
|
+
else:
|
|
112
|
+
risk_level = "none"
|
|
113
|
+
breakdown[layer] = {
|
|
114
|
+
"file_count": len(layer_files),
|
|
115
|
+
"issue_count": len(layer_issues),
|
|
116
|
+
"risk_score": risk_score,
|
|
117
|
+
"risk_level": risk_level,
|
|
118
|
+
"severity_counts": severity_counts
|
|
119
|
+
}
|
|
120
|
+
return breakdown
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def prioritize_issues(issues):
|
|
124
|
+
return sorted(issues, key=lambda issue: (SEVERITY_ORDER.get(issue["severity"], 4), issue["file"], issue["imported"]))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def build_architecture_report(analysis):
|
|
128
|
+
issues = analysis["issues"]
|
|
129
|
+
return {
|
|
130
|
+
"overall_architecture_rating": analysis["score"],
|
|
131
|
+
"architecture_type": analysis.get("architecture_type"),
|
|
132
|
+
"architecture_confidence": analysis.get("architecture_confidence"),
|
|
133
|
+
"low_confidence": analysis.get("low_confidence", False),
|
|
134
|
+
"executive_summary": build_executive_summary(
|
|
135
|
+
analysis["score"],
|
|
136
|
+
issues,
|
|
137
|
+
analysis["cycles"],
|
|
138
|
+
analysis["indirect_dependencies"],
|
|
139
|
+
analysis["hotspot_files"]
|
|
140
|
+
),
|
|
141
|
+
"prioritized_refactor_plan": build_prioritized_refactor_plan(
|
|
142
|
+
issues,
|
|
143
|
+
analysis["cycles"],
|
|
144
|
+
analysis["hotspot_files"],
|
|
145
|
+
analysis.get("architecture_type")
|
|
146
|
+
),
|
|
147
|
+
"risk_breakdown_by_layer": build_risk_breakdown_by_layer(
|
|
148
|
+
issues,
|
|
149
|
+
analysis["dependency_graph"],
|
|
150
|
+
analysis.get("architecture_rules")
|
|
151
|
+
),
|
|
152
|
+
"top_10_issues": prioritize_issues(issues)[:10],
|
|
153
|
+
"architecture_risk_model": analysis["risk_scores"],
|
|
154
|
+
"dependency_intelligence": {
|
|
155
|
+
"indirect_dependencies": analysis["indirect_dependencies"],
|
|
156
|
+
"hotspot_files": analysis["hotspot_files"]
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def compare_dependency_graphs(before_graph, after_graph):
|
|
162
|
+
before_files = set(before_graph.keys())
|
|
163
|
+
after_files = set(after_graph.keys())
|
|
164
|
+
before_edges = dependency_graph_edges(before_graph)
|
|
165
|
+
after_edges = dependency_graph_edges(after_graph)
|
|
166
|
+
return {
|
|
167
|
+
"files_added": sorted(after_files - before_files),
|
|
168
|
+
"files_removed": sorted(before_files - after_files),
|
|
169
|
+
"imports_added": [{"file": file, "imported": imported} for file, imported in sorted(after_edges - before_edges)],
|
|
170
|
+
"imports_removed": [{"file": file, "imported": imported} for file, imported in sorted(before_edges - after_edges)]
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def calculate_change_impact_scores(added_edges, new_cycles, dependency_growth_per_file, new_issues, fixed_issues, after_graph):
|
|
175
|
+
impact_scores = defaultdict(int)
|
|
176
|
+
reasons = defaultdict(list)
|
|
177
|
+
project_files = set(after_graph.keys())
|
|
178
|
+
for source, target in added_edges:
|
|
179
|
+
if source in project_files:
|
|
180
|
+
impact_scores[source] += 2
|
|
181
|
+
reasons[source].append(f"introduced dependency on {target}")
|
|
182
|
+
for cycle in new_cycles:
|
|
183
|
+
for file in sorted(set(cycle)):
|
|
184
|
+
if file in project_files:
|
|
185
|
+
impact_scores[file] += 18
|
|
186
|
+
reasons[file].append("participates in a newly introduced cycle")
|
|
187
|
+
for growth in dependency_growth_per_file:
|
|
188
|
+
file = growth["file"]
|
|
189
|
+
if file not in project_files:
|
|
190
|
+
continue
|
|
191
|
+
if growth["inbound_dependency_delta"] > 0:
|
|
192
|
+
impact_scores[file] += growth["inbound_dependency_delta"] * 6
|
|
193
|
+
reasons[file].append("increased inbound dependency pressure")
|
|
194
|
+
if growth["outbound_dependency_delta"] > 0:
|
|
195
|
+
impact_scores[file] += growth["outbound_dependency_delta"] * 2
|
|
196
|
+
reasons[file].append("increased outbound coupling")
|
|
197
|
+
for issue in new_issues:
|
|
198
|
+
file = issue.get("file", "")
|
|
199
|
+
if file in project_files:
|
|
200
|
+
impact_scores[file] += max(2, layer_violation_weight(issue))
|
|
201
|
+
reasons[file].append("introduced or exposed a layer violation")
|
|
202
|
+
for issue in fixed_issues:
|
|
203
|
+
file = issue.get("file", "")
|
|
204
|
+
if file in project_files:
|
|
205
|
+
impact_scores[file] -= max(1, SEVERITY_WEIGHTS.get(issue.get("severity", "low"), 3) // 4)
|
|
206
|
+
reasons[file].append("resolved an architecture issue")
|
|
207
|
+
return sorted(
|
|
208
|
+
[{"file": file, "impact_score": max(0, impact_scores[file]), "reasons": sorted(set(reasons[file]))} for file in sorted(impact_scores)],
|
|
209
|
+
key=lambda item: (-item["impact_score"], item["file"])
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def identify_primary_cause_files(change_impact_scores, limit=5):
|
|
214
|
+
return [item["file"] for item in change_impact_scores if item["impact_score"] >= 4][:limit]
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def generate_refactor_plan(change_impact_scores, new_cycles, new_issues, dependency_growth_per_file, added_edges):
|
|
218
|
+
plan_by_file = {}
|
|
219
|
+
for cycle in new_cycles:
|
|
220
|
+
cycle_path = " -> ".join(cycle)
|
|
221
|
+
for file in sorted(set(cycle)):
|
|
222
|
+
item = plan_by_file.setdefault(file, {"file": file, "reasons": set(), "expected_impacts": set(), "actions": set(), "priority_score": 1})
|
|
223
|
+
item["reasons"].add(f"File participates in newly introduced cycle: {cycle_path}.")
|
|
224
|
+
item["expected_impacts"].add("cycle reduction")
|
|
225
|
+
item["actions"].add("Break the cycle by extracting the shared dependency into a lower-level module or moving orchestration into a service.")
|
|
226
|
+
item["priority_score"] = max(item["priority_score"], 10)
|
|
227
|
+
for issue in new_issues:
|
|
228
|
+
file = issue.get("file", "")
|
|
229
|
+
item = plan_by_file.setdefault(file, {"file": file, "reasons": set(), "expected_impacts": set(), "actions": set(), "priority_score": 1})
|
|
230
|
+
imported = issue.get("imported", "unknown dependency")
|
|
231
|
+
layer = issue.get("layer", "unknown")
|
|
232
|
+
imported_layer = issue.get("imported_layer", "unknown")
|
|
233
|
+
item["reasons"].add(f"{layer} layer now depends on {imported_layer} via {imported}.")
|
|
234
|
+
item["expected_impacts"].add("layer fix")
|
|
235
|
+
item["actions"].add(f"Replace the direct import of {imported} with an allowed service boundary or move the shared behavior into the lower layer.")
|
|
236
|
+
item["priority_score"] = max(item["priority_score"], min(10, max(5, layer_violation_weight(issue) // 2)))
|
|
237
|
+
for growth in dependency_growth_per_file:
|
|
238
|
+
if growth["net_dependency_delta"] <= 0:
|
|
239
|
+
continue
|
|
240
|
+
file = growth["file"]
|
|
241
|
+
item = plan_by_file.setdefault(file, {"file": file, "reasons": set(), "expected_impacts": set(), "actions": set(), "priority_score": 1})
|
|
242
|
+
item["reasons"].add(
|
|
243
|
+
f"Dependency pressure increased by {growth['net_dependency_delta']} "
|
|
244
|
+
f"(inbound {growth['inbound_dependency_delta']}, outbound {growth['outbound_dependency_delta']})."
|
|
245
|
+
)
|
|
246
|
+
item["expected_impacts"].add("coupling reduction")
|
|
247
|
+
item["actions"].add("Split broad responsibilities or introduce a narrow facade so callers depend on a smaller API.")
|
|
248
|
+
item["priority_score"] = max(item["priority_score"], min(10, 3 + abs(growth["net_dependency_delta"])))
|
|
249
|
+
added_by_source = defaultdict(list)
|
|
250
|
+
for source, target in added_edges:
|
|
251
|
+
added_by_source[source].append(target)
|
|
252
|
+
for source, targets in added_by_source.items():
|
|
253
|
+
item = plan_by_file.get(source)
|
|
254
|
+
if item:
|
|
255
|
+
item["actions"].add("Review newly added imports: " + ", ".join(sorted(targets)) + ".")
|
|
256
|
+
impact_by_file = {item["file"]: item["impact_score"] for item in change_impact_scores}
|
|
257
|
+
plan = []
|
|
258
|
+
for file, item in plan_by_file.items():
|
|
259
|
+
priority_score = min(10, max(item["priority_score"], 1 + impact_by_file.get(file, 0) // 3))
|
|
260
|
+
plan.append({
|
|
261
|
+
"file": file,
|
|
262
|
+
"reason": " ".join(sorted(item["reasons"])),
|
|
263
|
+
"action": " ".join(sorted(item["actions"])),
|
|
264
|
+
"expected_impact": sorted(item["expected_impacts"]),
|
|
265
|
+
"priority_score": priority_score
|
|
266
|
+
})
|
|
267
|
+
return sorted(plan, key=lambda item: (-item["priority_score"], item["file"]))
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def summarize_drift_intelligence(added_edges, removed_edges, new_cycles, resolved_cycles, new_issues, fixed_issues, primary_cause_files, refactor_plan, score_difference):
|
|
271
|
+
if added_edges or removed_edges or new_cycles or resolved_cycles or new_issues or fixed_issues:
|
|
272
|
+
what_changed = (
|
|
273
|
+
f"{len(added_edges)} dependencies added, {len(removed_edges)} dependencies removed, "
|
|
274
|
+
f"{len(new_cycles)} cycles introduced, {len(resolved_cycles)} cycles resolved, "
|
|
275
|
+
f"{len(new_issues)} issues introduced, and {len(fixed_issues)} issues fixed."
|
|
276
|
+
)
|
|
277
|
+
else:
|
|
278
|
+
what_changed = "No structural architecture changes were detected between the snapshots."
|
|
279
|
+
why_it_changed = "Primary change drivers are: " + ", ".join(primary_cause_files) + "." if primary_cause_files else "No single primary cause file was identified."
|
|
280
|
+
if new_cycles:
|
|
281
|
+
what_is_risky = "New cycles are the highest risk because they make module ownership and import order fragile."
|
|
282
|
+
elif new_issues:
|
|
283
|
+
what_is_risky = "New layer violations are risky because they weaken the intended dependency direction."
|
|
284
|
+
elif score_difference < 0:
|
|
285
|
+
what_is_risky = "The architecture score decreased, indicating higher coupling or structural drift."
|
|
286
|
+
else:
|
|
287
|
+
what_is_risky = "No new high-risk drift was detected."
|
|
288
|
+
if refactor_plan:
|
|
289
|
+
first = refactor_plan[0]
|
|
290
|
+
what_should_be_fixed_first = f"Fix {first['file']} first to target {', '.join(first['expected_impact'])}."
|
|
291
|
+
else:
|
|
292
|
+
what_should_be_fixed_first = "No immediate refactor action is required from this comparison."
|
|
293
|
+
return {
|
|
294
|
+
"what_changed": what_changed,
|
|
295
|
+
"why_it_changed": why_it_changed,
|
|
296
|
+
"what_is_risky": what_is_risky,
|
|
297
|
+
"what_should_be_fixed_first": what_should_be_fixed_first
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def dominant_impacted_layer(new_issues, dependency_growth_per_file):
|
|
302
|
+
layer_scores = defaultdict(int)
|
|
303
|
+
for issue in new_issues:
|
|
304
|
+
layer_scores[issue.get("layer", "unknown")] += layer_violation_weight(issue)
|
|
305
|
+
for growth in dependency_growth_per_file:
|
|
306
|
+
file = growth.get("file", "")
|
|
307
|
+
layer_scores[get_layer(file)] += max(0, growth.get("inbound_dependency_delta", 0)) * 3
|
|
308
|
+
layer_scores[get_layer(file)] += max(0, growth.get("outbound_dependency_delta", 0))
|
|
309
|
+
if not layer_scores:
|
|
310
|
+
return "none"
|
|
311
|
+
return sorted(layer_scores.items(), key=lambda item: (-item[1], item[0]))[0][0]
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
def detect_structural_pattern(new_cycles, new_issues, dependency_growth_per_file, added_edges):
|
|
315
|
+
inbound_growth = [growth for growth in dependency_growth_per_file if growth.get("inbound_dependency_delta", 0) > 0]
|
|
316
|
+
if new_cycles:
|
|
317
|
+
return "cyclic coupling is forming between modules"
|
|
318
|
+
if new_issues:
|
|
319
|
+
return "cross-layer dependency drift is forming"
|
|
320
|
+
if inbound_growth:
|
|
321
|
+
return "hotspot centralization is forming around highly reused files"
|
|
322
|
+
if added_edges:
|
|
323
|
+
return "incremental coupling is increasing through new imports"
|
|
324
|
+
return "no significant degradation pattern is forming"
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def build_architecture_narrative(structural_drift_score, score_difference, new_cycles, resolved_cycles, new_issues, fixed_issues, dependency_growth_per_file, added_edges, primary_cause_files):
|
|
328
|
+
impacted_layer = dominant_impacted_layer(new_issues, dependency_growth_per_file)
|
|
329
|
+
pattern = detect_structural_pattern(new_cycles, new_issues, dependency_growth_per_file, added_edges)
|
|
330
|
+
if structural_drift_score >= 70:
|
|
331
|
+
direction = "degrading sharply"
|
|
332
|
+
elif structural_drift_score >= 35 or score_difference < 0:
|
|
333
|
+
direction = "degrading"
|
|
334
|
+
elif resolved_cycles or fixed_issues or score_difference > 0:
|
|
335
|
+
direction = "improving"
|
|
336
|
+
else:
|
|
337
|
+
direction = "stable"
|
|
338
|
+
causes = ", ".join(primary_cause_files) if primary_cause_files else "no dominant cause file"
|
|
339
|
+
return {
|
|
340
|
+
"trend_direction": direction,
|
|
341
|
+
"degrading_subsystem": impacted_layer,
|
|
342
|
+
"structural_pattern": pattern,
|
|
343
|
+
"explanation": (
|
|
344
|
+
f"Architecture is {direction} because this comparison shows {len(new_cycles)} new cycles, "
|
|
345
|
+
f"{len(new_issues)} new layer issues, and a structural drift score of {structural_drift_score}. "
|
|
346
|
+
f"The most affected subsystem is {impacted_layer}, with primary drivers: {causes}. "
|
|
347
|
+
f"The emerging pattern is that {pattern}."
|
|
348
|
+
)
|
|
349
|
+
}
|
adre/rules.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Fallback templates only. Runtime analysis infers architecture from the
|
|
2
|
+
# observed dependency graph and folder/filename roles, not from these names.
|
|
3
|
+
|
|
4
|
+
RULES = {
|
|
5
|
+
"layer_rules": {
|
|
6
|
+
"presentation": ["application", "domain", "shared"],
|
|
7
|
+
"application": ["domain", "data", "shared"],
|
|
8
|
+
"domain": ["shared"],
|
|
9
|
+
"data": ["domain", "shared"],
|
|
10
|
+
"shared": ["shared"],
|
|
11
|
+
}
|
|
12
|
+
}
|