omnimancer-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.
Files changed (126) hide show
  1. omnimancer/__init__.py +42 -0
  2. omnimancer/__main__.py +9 -0
  3. omnimancer/cli/__init__.py +8 -0
  4. omnimancer/cli/agent_manager.py +826 -0
  5. omnimancer/cli/agent_wizard.py +944 -0
  6. omnimancer/cli/approval_formatter.py +734 -0
  7. omnimancer/cli/approval_integration.py +734 -0
  8. omnimancer/cli/approval_prompt.py +1286 -0
  9. omnimancer/cli/batch_approval_display.py +617 -0
  10. omnimancer/cli/batch_approval_filters.py +729 -0
  11. omnimancer/cli/batch_operation_monitor.py +775 -0
  12. omnimancer/cli/commands/performance_cmd.py +624 -0
  13. omnimancer/cli/commands.py +757 -0
  14. omnimancer/cli/completion_handler.py +281 -0
  15. omnimancer/cli/config_setup_wizard.py +783 -0
  16. omnimancer/cli/dynamic_commands.py +371 -0
  17. omnimancer/cli/handlers/__init__.py +18 -0
  18. omnimancer/cli/handlers/agent_handler.py +865 -0
  19. omnimancer/cli/handlers/agent_persona_handler.py +1048 -0
  20. omnimancer/cli/handlers/custom_agent_handler.py +352 -0
  21. omnimancer/cli/handlers/permissions_handler.py +1609 -0
  22. omnimancer/cli/interface.py +6695 -0
  23. omnimancer/cli/performance_dashboard.py +612 -0
  24. omnimancer/core/__init__.py +34 -0
  25. omnimancer/core/agent/__init__.py +256 -0
  26. omnimancer/core/agent/agent_config.py +715 -0
  27. omnimancer/core/agent/agent_switcher.py +668 -0
  28. omnimancer/core/agent/approval_context.py +460 -0
  29. omnimancer/core/agent/approval_dialog.py +902 -0
  30. omnimancer/core/agent/approval_interface.py +628 -0
  31. omnimancer/core/agent/approval_manager.py +760 -0
  32. omnimancer/core/agent/cli_integration.py +470 -0
  33. omnimancer/core/agent/config.py +845 -0
  34. omnimancer/core/agent/custom_agent_integration.py +654 -0
  35. omnimancer/core/agent/diff_renderer.py +706 -0
  36. omnimancer/core/agent/file_content_display.py +503 -0
  37. omnimancer/core/agent/file_modification_workflow.py +658 -0
  38. omnimancer/core/agent/file_system_manager.py +1790 -0
  39. omnimancer/core/agent/input_handler.py +614 -0
  40. omnimancer/core/agent/metrics_collector.py +771 -0
  41. omnimancer/core/agent/optimization_engine.py +729 -0
  42. omnimancer/core/agent/performance_monitor.py +717 -0
  43. omnimancer/core/agent/persona.py +870 -0
  44. omnimancer/core/agent/persona_validator.py +672 -0
  45. omnimancer/core/agent/program_executor.py +748 -0
  46. omnimancer/core/agent/proposed_changes_integration.py +663 -0
  47. omnimancer/core/agent/read_before_write_errors.py +492 -0
  48. omnimancer/core/agent/read_before_write_ui.py +647 -0
  49. omnimancer/core/agent/rich_renderer.py +763 -0
  50. omnimancer/core/agent/status_config.py +238 -0
  51. omnimancer/core/agent/status_core.py +446 -0
  52. omnimancer/core/agent/status_integrated_engine.py +540 -0
  53. omnimancer/core/agent/status_manager.py +878 -0
  54. omnimancer/core/agent/status_ui_components.py +535 -0
  55. omnimancer/core/agent/template_applicator.py +548 -0
  56. omnimancer/core/agent/terminal_status_listener.py +394 -0
  57. omnimancer/core/agent/token_tracker.py +679 -0
  58. omnimancer/core/agent/types.py +60 -0
  59. omnimancer/core/agent/web_client.py +745 -0
  60. omnimancer/core/agent/workflow_orchestrator.py +826 -0
  61. omnimancer/core/agent_engine.py +1625 -0
  62. omnimancer/core/agent_mode_manager.py +706 -0
  63. omnimancer/core/agent_progress_ui.py +545 -0
  64. omnimancer/core/chat_manager.py +141 -0
  65. omnimancer/core/config_manager.py +2199 -0
  66. omnimancer/core/config_migration.py +772 -0
  67. omnimancer/core/config_provider.py +1974 -0
  68. omnimancer/core/config_security_validator.py +393 -0
  69. omnimancer/core/config_validator.py +768 -0
  70. omnimancer/core/conversation_manager.py +352 -0
  71. omnimancer/core/engine.py +787 -0
  72. omnimancer/core/enhanced_input.py +523 -0
  73. omnimancer/core/env_loader.py +83 -0
  74. omnimancer/core/fallback_manager.py +568 -0
  75. omnimancer/core/health_monitor.py +462 -0
  76. omnimancer/core/history_manager.py +462 -0
  77. omnimancer/core/mcp_integration_layer.py +878 -0
  78. omnimancer/core/models.py +1889 -0
  79. omnimancer/core/provider_capabilities.py +403 -0
  80. omnimancer/core/provider_initializer.py +450 -0
  81. omnimancer/core/provider_registry.py +432 -0
  82. omnimancer/core/security/__init__.py +16 -0
  83. omnimancer/core/security/approval_workflow.py +406 -0
  84. omnimancer/core/security/audit_logger.py +511 -0
  85. omnimancer/core/security/permission_controller.py +511 -0
  86. omnimancer/core/security/sandbox_manager.py +379 -0
  87. omnimancer/core/security/security_manager.py +530 -0
  88. omnimancer/core/setup_wizard.py +345 -0
  89. omnimancer/core/setup_wizard_core.py +449 -0
  90. omnimancer/core/setup_wizard_guide_generator.py +376 -0
  91. omnimancer/core/setup_wizard_provider_setup.py +454 -0
  92. omnimancer/core/setup_wizard_ui.py +317 -0
  93. omnimancer/core/setup_wizard_validation.py +371 -0
  94. omnimancer/core/signal_handler.py +174 -0
  95. omnimancer/mcp/__init__.py +11 -0
  96. omnimancer/mcp/client.py +725 -0
  97. omnimancer/mcp/manager.py +649 -0
  98. omnimancer/providers/__init__.py +24 -0
  99. omnimancer/providers/azure.py +608 -0
  100. omnimancer/providers/base.py +262 -0
  101. omnimancer/providers/bedrock.py +711 -0
  102. omnimancer/providers/claude.py +426 -0
  103. omnimancer/providers/claude_code.py +406 -0
  104. omnimancer/providers/cohere.py +412 -0
  105. omnimancer/providers/factory.py +988 -0
  106. omnimancer/providers/gemini.py +708 -0
  107. omnimancer/providers/mistral.py +554 -0
  108. omnimancer/providers/ollama.py +510 -0
  109. omnimancer/providers/openai.py +362 -0
  110. omnimancer/providers/openrouter.py +709 -0
  111. omnimancer/providers/perplexity.py +476 -0
  112. omnimancer/providers/vertex.py +617 -0
  113. omnimancer/providers/xai.py +484 -0
  114. omnimancer/ui/__init__.py +6 -0
  115. omnimancer/ui/cancellation_handler.py +235 -0
  116. omnimancer/ui/progress_indicator.py +318 -0
  117. omnimancer/utils/__init__.py +22 -0
  118. omnimancer/utils/error_handler.py +589 -0
  119. omnimancer/utils/errors.py +667 -0
  120. omnimancer/utils/retry.py +238 -0
  121. omnimancer_cli-0.1.0.dist-info/METADATA +413 -0
  122. omnimancer_cli-0.1.0.dist-info/RECORD +126 -0
  123. omnimancer_cli-0.1.0.dist-info/WHEEL +5 -0
  124. omnimancer_cli-0.1.0.dist-info/entry_points.txt +4 -0
  125. omnimancer_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
  126. omnimancer_cli-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,345 @@
1
+ """
2
+ Interactive setup wizard for first-time configuration.
3
+
4
+ This module provides an interactive wizard to guide users through
5
+ the initial configuration of Omnimancer with provider selection,
6
+ API key setup, and validation.
7
+
8
+ This is now a simplified facade that delegates to specialized modules.
9
+ """
10
+
11
+ from typing import Any, Dict, List, Optional
12
+
13
+
14
+ from .config_manager import ConfigManager
15
+ from .models import ProviderConfig
16
+ from .provider_registry import ProviderRegistry
17
+ from .setup_wizard_core import SetupWizardCore
18
+ from .setup_wizard_guide_generator import SetupWizardGuideGenerator
19
+ from .setup_wizard_provider_setup import SetupWizardProviderSetup
20
+ from .setup_wizard_ui import SetupWizardUI
21
+ from .setup_wizard_validation import SetupWizardValidation
22
+
23
+
24
+ class SetupWizard(SetupWizardCore):
25
+ """
26
+ Interactive setup wizard for first-time configuration.
27
+
28
+ This class inherits from SetupWizardCore and adds additional
29
+ convenience methods for documentation generation and provider help.
30
+ """
31
+
32
+ def __init__(
33
+ self,
34
+ config_manager: ConfigManager,
35
+ provider_registry: ProviderRegistry,
36
+ ):
37
+ """
38
+ Initialize the setup wizard.
39
+
40
+ Args:
41
+ config_manager: Configuration manager instance
42
+ provider_registry: Provider registry instance
43
+ """
44
+ super().__init__(config_manager, provider_registry)
45
+ self.ui = SetupWizardUI(self.console, self.provider_info)
46
+ self.provider_setup = SetupWizardProviderSetup(self.console, self.provider_info)
47
+ self.validation = SetupWizardValidation(
48
+ self.console,
49
+ self.provider_info,
50
+ self.provider_factory,
51
+ self.cancellation_handler,
52
+ self.signal_handler,
53
+ )
54
+ self.guide_generator = SetupWizardGuideGenerator(
55
+ self.console, self.provider_info
56
+ )
57
+
58
+ async def start_wizard(self) -> bool:
59
+ """
60
+ Start the interactive setup process using pre-initialized components.
61
+
62
+ Returns:
63
+ True if setup completed successfully, False otherwise
64
+ """
65
+ try:
66
+ self.ui.show_welcome()
67
+
68
+ # Check if this is first run
69
+ if not self.config_manager.is_first_run():
70
+ if not self._confirm_overwrite():
71
+ return False
72
+
73
+ # Select provider
74
+ provider_name = self.provider_setup.select_provider()
75
+ if not provider_name:
76
+ return False
77
+
78
+ # Configure the selected provider
79
+ provider_config = await self.provider_setup.configure_provider(
80
+ provider_name
81
+ )
82
+ if not provider_config:
83
+ return False
84
+
85
+ # Test the configuration
86
+ if not await self.validation.test_configuration(
87
+ provider_name, provider_config
88
+ ):
89
+ return False
90
+
91
+ # Save configuration
92
+ self.provider_setup.save_configuration(
93
+ provider_name, provider_config, self.config_manager
94
+ )
95
+
96
+ # Show completion message
97
+ self.ui.show_completion(provider_name)
98
+
99
+ return True
100
+
101
+ except KeyboardInterrupt:
102
+ self.console.print("\n[yellow]Setup cancelled by user[/yellow]")
103
+ return False
104
+ except Exception as e:
105
+ self.console.print(f"\n[red]Setup failed: {e}[/red]")
106
+ return False
107
+
108
+ def show_provider_help(self, provider_name: str) -> None:
109
+ """
110
+ Show provider-specific setup help.
111
+
112
+ Args:
113
+ provider_name: Name of the provider
114
+ """
115
+ self.ui.show_provider_help(provider_name)
116
+
117
+ async def validate_existing_configuration(
118
+ self, provider_name: str
119
+ ) -> Dict[str, Any]:
120
+ """
121
+ Validate an existing provider configuration.
122
+
123
+ Args:
124
+ provider_name: Name of the provider to validate
125
+
126
+ Returns:
127
+ Dictionary with validation results
128
+ """
129
+ from .setup_wizard_validation import SetupWizardValidation
130
+
131
+ validation = SetupWizardValidation(
132
+ self.console,
133
+ self.provider_info,
134
+ self.provider_factory,
135
+ self.cancellation_handler,
136
+ self.signal_handler,
137
+ )
138
+
139
+ return await validation.validate_existing_configuration(
140
+ provider_name, self.config_manager
141
+ )
142
+
143
+ def create_setup_guide(
144
+ self, provider_name: str, output_path: Optional[str] = None
145
+ ) -> str:
146
+ """
147
+ Create a detailed setup guide for a specific provider.
148
+
149
+ Args:
150
+ provider_name: Name of the provider
151
+ output_path: Optional path to save the guide
152
+
153
+ Returns:
154
+ Setup guide content as markdown string
155
+ """
156
+ return self.guide_generator.create_setup_guide(provider_name, output_path)
157
+
158
+ def generate_all_setup_guides(self, output_dir: str) -> List[str]:
159
+ """
160
+ Generate setup guides for all supported providers.
161
+
162
+ Args:
163
+ output_dir: Directory to save the guides
164
+
165
+ Returns:
166
+ List of generated file paths
167
+ """
168
+ return self.guide_generator.generate_all_setup_guides(output_dir)
169
+
170
+ # Delegation methods for backward compatibility with tests
171
+
172
+ def _get_api_key(self, provider_name: str, info: Dict[str, Any]) -> Optional[str]:
173
+ """
174
+ Get and validate API key from user.
175
+
176
+ Args:
177
+ provider_name: Name of the provider
178
+ info: Provider information dictionary
179
+
180
+ Returns:
181
+ Valid API key or None if cancelled
182
+ """
183
+ return self.provider_setup._get_api_key(provider_name, info)
184
+
185
+ def _validate_api_key_format(
186
+ self, provider_name: str, api_key: Optional[str]
187
+ ) -> bool:
188
+ """
189
+ Validate API key format for a specific provider.
190
+
191
+ Args:
192
+ provider_name: Name of the provider
193
+ api_key: API key to validate
194
+
195
+ Returns:
196
+ True if format is valid, False otherwise
197
+ """
198
+ return self.validation._validate_api_key_format(provider_name, api_key)
199
+
200
+ def _select_model(self, provider_name: str, info: Dict[str, Any]) -> Optional[str]:
201
+ """
202
+ Select model for the provider.
203
+
204
+ Args:
205
+ provider_name: Name of the provider
206
+ info: Provider information dictionary
207
+
208
+ Returns:
209
+ Selected model name or None if cancelled
210
+ """
211
+ return self.provider_setup._select_model(provider_name, info)
212
+
213
+ def _get_additional_settings(self, provider_name: str) -> Dict[str, Any]:
214
+ """
215
+ Get additional provider-specific settings.
216
+
217
+ Args:
218
+ provider_name: Name of the provider
219
+
220
+ Returns:
221
+ Dictionary of additional settings
222
+ """
223
+ return self.provider_setup._get_additional_settings(provider_name)
224
+
225
+ def _save_configuration(
226
+ self, provider_name: str, provider_config: ProviderConfig
227
+ ) -> None:
228
+ """
229
+ Save the configuration, adding the provider without overwriting existing ones.
230
+
231
+ Args:
232
+ provider_name: Name of the provider
233
+ provider_config: Provider configuration to save
234
+ """
235
+ return self.provider_setup.save_configuration(
236
+ provider_name, provider_config, self.config_manager
237
+ )
238
+
239
+ async def _test_configuration(
240
+ self, provider_name: str, provider_config: ProviderConfig
241
+ ) -> bool:
242
+ """
243
+ Test the configuration and provide feedback.
244
+
245
+ Args:
246
+ provider_name: Name of the provider
247
+ provider_config: Provider configuration to test
248
+
249
+ Returns:
250
+ True if configuration is valid, False otherwise
251
+ """
252
+ return await self.validation.test_configuration(provider_name, provider_config)
253
+
254
+ async def _configure_provider(self, provider_name: str) -> Optional[ProviderConfig]:
255
+ """
256
+ Configure a specific provider with validation.
257
+
258
+ Args:
259
+ provider_name: Name of the provider to configure
260
+
261
+ Returns:
262
+ Configured ProviderConfig or None if failed
263
+ """
264
+ return await self.provider_setup.configure_provider(provider_name)
265
+
266
+ def _select_provider(self) -> Optional[str]:
267
+ """
268
+ Interactive provider selection with descriptions.
269
+
270
+ Returns:
271
+ Selected provider name or None if cancelled
272
+ """
273
+ return self.provider_setup.select_provider()
274
+
275
+ def _show_welcome(self) -> None:
276
+ """Show welcome message and setup introduction."""
277
+ return self.ui.show_welcome()
278
+
279
+ def _show_provider_details(self, provider_name: str) -> None:
280
+ """
281
+ Show detailed information about a provider.
282
+
283
+ Args:
284
+ provider_name: Name of the provider
285
+ """
286
+ return self.ui.show_provider_details(provider_name)
287
+
288
+ def _show_completion(self, provider_name: str) -> None:
289
+ """
290
+ Show setup completion message with next steps.
291
+
292
+ Args:
293
+ provider_name: Name of the configured provider
294
+ """
295
+ return self.ui.show_completion(provider_name)
296
+
297
+ def _show_troubleshooting_guidance(self, provider_name: str, error: str) -> None:
298
+ """
299
+ Show provider-specific troubleshooting guidance.
300
+
301
+ Args:
302
+ provider_name: Name of the provider
303
+ error: Error message
304
+ """
305
+ return self.ui.show_troubleshooting_guidance(provider_name, error)
306
+
307
+ # Methods expected by tests but delegated to specialized components
308
+ async def _validate_provider_credentials(
309
+ self, provider_name: str, config: Dict[str, Any]
310
+ ) -> bool:
311
+ """Validate provider credentials (delegated to validation component)."""
312
+ from .models import ProviderConfig
313
+
314
+ provider_config = ProviderConfig(**config)
315
+ return await self._test_configuration(provider_name, provider_config)
316
+
317
+ async def _check_model_availability(self, provider_name: str, model: str) -> bool:
318
+ """Check if model is available for provider."""
319
+ return True # Stub implementation
320
+
321
+ def _generate_model_table(self, provider_name: str) -> str:
322
+ """Generate model table for documentation (delegated to UI component)."""
323
+ return (
324
+ self.ui._generate_model_table(provider_name)
325
+ if hasattr(self.ui, "_generate_model_table")
326
+ else ""
327
+ )
328
+
329
+ def _generate_provider_specific_config(self, provider_name: str) -> str:
330
+ """Generate provider-specific configuration documentation."""
331
+ return f"# {provider_name.title()} Configuration\n\n"
332
+
333
+ def _generate_troubleshooting_section(self, provider_name: str) -> str:
334
+ """Generate troubleshooting section for documentation."""
335
+ return f"# Troubleshooting {provider_name.title()}\n\n"
336
+
337
+ def _generate_best_practices(self, provider_name: str) -> str:
338
+ """Generate best practices section."""
339
+ return f"# Best Practices for {provider_name.title()}\n\n"
340
+
341
+ def _generate_support_links(self, provider_name: str) -> str:
342
+ """Generate support links section."""
343
+ return f"# Support Links for {provider_name.title()}\n\n"
344
+
345
+ # Note: create_setup_guide method already defined above at line 85