Coverage for src / osiris_cli / status.py: 0%

78 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2025-12-27 17:41 +0200

1#!/usr/bin/env python3 

2""" 

3Status and Configuration Commands for Osiris CLI v4.0 

4Minimal, clean status display and configuration management 

5""" 

6 

7from rich.console import Console 

8from rich.table import Table 

9from rich.panel import Panel 

10from pathlib import Path 

11from typing import Optional 

12 

13console = Console() 

14 

15 

16def show_status(): 

17 """Display current system status""" 

18 from .config import settings 

19 from .session import session 

20 

21 console.print() 

22 console.print("[bold]System Status[/bold]\n") 

23 

24 # Create status table 

25 table = Table(show_header=False, box=None, padding=(0, 2)) 

26 table.add_column("Setting", style="dim") 

27 table.add_column("Value", style="") 

28 

29 # Core settings 

30 table.add_row("Provider", settings.provider) 

31 table.add_row("Model", settings.default_model) 

32 table.add_row("Temperature", str(settings.temperature)) 

33 table.add_row("Timeout", f"{settings.timeout}s") 

34 table.add_row("YOLO Mode", "enabled" if settings.yolo_mode else "disabled") 

35 table.add_row("Safety Profile", settings.safety_profile) 

36 

37 # Config file location 

38 config_file = Path.home() / ".osiris" / "config.toml" 

39 table.add_row("Config File", str(config_file)) 

40 

41 # Session stats 

42 try: 

43 sessions = session.list_sessions() 

44 table.add_row("Sessions", str(len(sessions))) 

45 except: 

46 table.add_row("Sessions", "0") 

47 

48 console.print(table) 

49 console.print() 

50 

51 

52def show_config(): 

53 """Display full configuration""" 

54 from .config import settings 

55 

56 console.print() 

57 console.print("[bold]Configuration[/bold]\n") 

58 

59 # Provider settings 

60 console.print("[bold]Provider Settings[/bold]") 

61 table1 = Table(show_header=False, box=None, padding=(0, 2)) 

62 table1.add_column("Setting", style="dim") 

63 table1.add_column("Value") 

64 

65 table1.add_row("Provider", settings.provider) 

66 table1.add_row("Model", settings.default_model) 

67 table1.add_row("Temperature", str(settings.temperature)) 

68 table1.add_row("Timeout", f"{settings.timeout}s") 

69 table1.add_row("Max Context", f"{settings.max_context_chars:,} chars") 

70 

71 console.print(table1) 

72 console.print() 

73 

74 # API Keys 

75 console.print("[bold]API Keys[/bold]") 

76 table2 = Table(show_header=False, box=None, padding=(0, 2)) 

77 table2.add_column("Provider", style="dim") 

78 table2.add_column("Status") 

79 

80 api_keys = { 

81 "OpenRouter": settings.openrouter_api_key, 

82 "OpenAI": settings.openai_api_key, 

83 "Gemini": settings.gemini_api_key, 

84 "DeepSeek": settings.deepseek_api_key, 

85 "Together": settings.together_api_key, 

86 "Mistral": settings.mistral_api_key, 

87 "Perplexity": settings.perplexity_api_key, 

88 "Fireworks": settings.fireworks_api_key, 

89 "Groq": settings.groq_api_key, 

90 } 

91 

92 for provider, key in api_keys.items(): 

93 status = "configured" if key else "not set" 

94 table2.add_row(provider, status) 

95 

96 console.print(table2) 

97 console.print() 

98 

99 # Mode settings 

100 console.print("[bold]Mode Settings[/bold]") 

101 table3 = Table(show_header=False, box=None, padding=(0, 2)) 

102 table3.add_column("Mode", style="dim") 

103 table3.add_column("Status") 

104 

105 table3.add_row("YOLO Mode", "enabled" if settings.yolo_mode else "disabled") 

106 table3.add_row("Reasoning Mode", "enabled" if settings.reasoning_mode else "disabled") 

107 table3.add_row("Safety Profile", settings.safety_profile) 

108 table3.add_row("Debug Mode", "enabled" if settings.debug else "disabled") 

109 

110 console.print(table3) 

111 console.print() 

112 

113 # File locations 

114 console.print("[bold]File Locations[/bold]") 

115 table4 = Table(show_header=False, box=None, padding=(0, 2)) 

116 table4.add_column("File", style="dim") 

117 table4.add_column("Path") 

118 

119 config_file = Path.home() / ".osiris" / "config.toml" 

120 history_dir = Path.home() / ".osiris" / "history" 

121 sessions_dir = Path.home() / ".osiris" / "sessions" 

122 

123 table4.add_row("Config", str(config_file)) 

124 table4.add_row("History", str(history_dir)) 

125 table4.add_row("Sessions", str(sessions_dir)) 

126 

127 console.print(table4) 

128 console.print() 

129 

130 console.print("[dim]Use /provider, /model, /yolo to change settings[/dim]") 

131 console.print()