Skip to content

Commit 7660b3a

Browse files
committed
refactor: Remove legacy health module and cleanup codebase
- Deleted cortex/health module\n- Deleted scripts/verify_ubuntu_compatibility.py\n- Deleted tests/test_health_monitor.py\n- Removed health command from CLI\n- Fixed SonarCloud issues in scripts and packages
1 parent 2ce6a4d commit 7660b3a

File tree

13 files changed

+22
-831
lines changed

13 files changed

+22
-831
lines changed

cortex/cli.py

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -172,55 +172,6 @@ def notify(self, args):
172172
self._print_error("Unknown notify command")
173173
return 1
174174

175-
# --- New Health Command ---
176-
def health(self, _):
177-
"""Run system health checks and show recommendations"""
178-
from cortex.health.monitor import HealthMonitor
179-
180-
self._print_status("🔍", "Running system health checks...")
181-
monitor = HealthMonitor()
182-
report = monitor.run_all()
183-
184-
# --- Display Results ---
185-
score = report['total_score']
186-
187-
# Color code the score
188-
score_color = "green"
189-
if score < 60: score_color = "red"
190-
elif score < 80: score_color = "yellow"
191-
192-
console.print()
193-
console.print(f"📊 [bold]System Health Score:[/bold] [{score_color}]{score}/100[/{score_color}]")
194-
console.print()
195-
196-
console.print("[bold]Factors:[/bold]")
197-
recommendations = []
198-
199-
for res in report['results']:
200-
status_icon = "✅"
201-
if res['status'] == 'WARNING': status_icon = "⚠️ "
202-
elif res['status'] == 'CRITICAL': status_icon = "❌"
203-
204-
console.print(f" {status_icon} {res['name']:<15}: {res['score']}/100 ({res['details']})")
205-
206-
if res['recommendation']:
207-
recommendations.append(res['recommendation'])
208-
209-
console.print()
210-
211-
if recommendations:
212-
console.print("[bold]Recommendations:[/bold]")
213-
for i, rec in enumerate(recommendations, 1):
214-
console.print(f" {i}. {rec}")
215-
216-
console.print()
217-
# Note: Auto-fix logic would go here, prompting user to apply specific commands.
218-
# For this iteration, we display actionable advice.
219-
console.print("[dim]Run suggested commands manually to improve your score.[/dim]")
220-
else:
221-
self._print_success("System is in excellent health! No actions needed.")
222-
223-
return 0
224175

225176
def cleanup(self, args):
226177
"""Run system cleanup optimization"""
@@ -682,7 +633,6 @@ def show_rich_help():
682633
table.add_row("history", "View history")
683634
table.add_row("rollback <id>", "Undo installation")
684635
table.add_row("notify", "Manage desktop notifications")
685-
table.add_row("health", "Check system health score") # Added this line
686636

687637
console.print(table)
688638
console.print()
@@ -755,8 +705,6 @@ def main():
755705
send_parser.add_argument('--level', choices=['low', 'normal', 'critical'], default='normal')
756706
send_parser.add_argument('--actions', nargs='*', help='Action buttons')
757707

758-
# --- New Health Command ---
759-
subparsers.add_parser('health', help='Check system health score')
760708

761709
# --- Cleanup Command ---
762710
cleanup_parser = subparsers.add_parser('cleanup', help='Optimize disk space')
@@ -799,8 +747,7 @@ def main():
799747
elif args.command == 'notify':
800748
return cli.notify(args)
801749
# Handle new command
802-
elif args.command == 'health':
803-
return cli.health(args)
750+
804751
elif args.command == 'cleanup':
805752
return cli.cleanup(args)
806753
else:

cortex/health/__init__.py

Whitespace-only changes.

cortex/health/checks/disk.py

Lines changed: 0 additions & 60 deletions
This file was deleted.

cortex/health/checks/performance.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

cortex/health/checks/security.py

Lines changed: 0 additions & 66 deletions
This file was deleted.

cortex/health/checks/updates.py

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)