1"""Quality recommendations generator.

2

3 This module provides functions for generating quality improvement recommendations

4 based on session metrics, project context, and development patterns.

5"""

6

7 from __future__ import annotations

8

9 from typing import Any

10

11

12 def generate_quality_recommendations(

13 score: int,

14 project_context: dict[str, Any],

15 permissions_count: int,

16 uv_available: bool,

17) -> list[str]:

18 """Generate quality improvement recommendations based on score factors."""

19 recommendations = []

20

21 if score < 50:

22 recommendations.append(

23 "Session needs attention - multiple areas for improvement",

24 )

25 elif score < 75:

26 recommendations.append("Good session health - minor optimizations available")

27 else:

28 recommendations.append("Excellent session quality - maintain current practices")

29

30 # Project-specific recommendations

31 if not project_context.get("has_tests"):

32 recommendations.append("Consider adding tests to improve project structure")

33 if not project_context.get("has_docs"):

34 recommendations.append("Documentation would enhance project maturity")

35

36 # Permissions recommendations

37 if permissions_count == 0:

38 recommendations.append(

39 "No trusted operations yet - permissions will be granted on first use",

40 )

41 elif permissions_count > 5:

42 recommendations.append(

43 "Many trusted operations - consider reviewing for security",

44 )

45

46 # Tools recommendations

47 if not uv_available:

48 recommendations.append(

49 "Install UV package manager for better dependency management",

50 )

51

52 return recommendations