hatch-xclam 0.7.1.dev3__py3-none-any.whl → 0.8.0.dev1__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 (81) hide show
  1. hatch/__init__.py +1 -1
  2. hatch/cli/__init__.py +71 -0
  3. hatch/cli/__main__.py +1035 -0
  4. hatch/cli/cli_env.py +865 -0
  5. hatch/cli/cli_mcp.py +1965 -0
  6. hatch/cli/cli_package.py +566 -0
  7. hatch/cli/cli_system.py +136 -0
  8. hatch/cli/cli_utils.py +1289 -0
  9. hatch/cli_hatch.py +160 -2838
  10. hatch/mcp_host_config/__init__.py +10 -10
  11. hatch/mcp_host_config/adapters/__init__.py +34 -0
  12. hatch/mcp_host_config/adapters/base.py +170 -0
  13. hatch/mcp_host_config/adapters/claude.py +105 -0
  14. hatch/mcp_host_config/adapters/codex.py +104 -0
  15. hatch/mcp_host_config/adapters/cursor.py +83 -0
  16. hatch/mcp_host_config/adapters/gemini.py +75 -0
  17. hatch/mcp_host_config/adapters/kiro.py +78 -0
  18. hatch/mcp_host_config/adapters/lmstudio.py +79 -0
  19. hatch/mcp_host_config/adapters/registry.py +149 -0
  20. hatch/mcp_host_config/adapters/vscode.py +83 -0
  21. hatch/mcp_host_config/backup.py +5 -3
  22. hatch/mcp_host_config/fields.py +126 -0
  23. hatch/mcp_host_config/models.py +161 -456
  24. hatch/mcp_host_config/reporting.py +57 -16
  25. hatch/mcp_host_config/strategies.py +155 -87
  26. hatch/template_generator.py +1 -1
  27. {hatch_xclam-0.7.1.dev3.dist-info → hatch_xclam-0.8.0.dev1.dist-info}/METADATA +3 -2
  28. {hatch_xclam-0.7.1.dev3.dist-info → hatch_xclam-0.8.0.dev1.dist-info}/RECORD +52 -43
  29. {hatch_xclam-0.7.1.dev3.dist-info → hatch_xclam-0.8.0.dev1.dist-info}/WHEEL +1 -1
  30. hatch_xclam-0.8.0.dev1.dist-info/entry_points.txt +2 -0
  31. tests/cli_test_utils.py +280 -0
  32. tests/integration/cli/__init__.py +14 -0
  33. tests/integration/cli/test_cli_reporter_integration.py +2439 -0
  34. tests/integration/mcp/__init__.py +0 -0
  35. tests/integration/mcp/test_adapter_serialization.py +173 -0
  36. tests/regression/cli/__init__.py +16 -0
  37. tests/regression/cli/test_color_logic.py +268 -0
  38. tests/regression/cli/test_consequence_type.py +298 -0
  39. tests/regression/cli/test_error_formatting.py +328 -0
  40. tests/regression/cli/test_result_reporter.py +586 -0
  41. tests/regression/cli/test_table_formatter.py +211 -0
  42. tests/regression/mcp/__init__.py +0 -0
  43. tests/regression/mcp/test_field_filtering.py +162 -0
  44. tests/test_cli_version.py +7 -5
  45. tests/test_data/fixtures/cli_reporter_fixtures.py +184 -0
  46. tests/unit/__init__.py +0 -0
  47. tests/unit/mcp/__init__.py +0 -0
  48. tests/unit/mcp/test_adapter_protocol.py +138 -0
  49. tests/unit/mcp/test_adapter_registry.py +158 -0
  50. tests/unit/mcp/test_config_model.py +146 -0
  51. hatch_xclam-0.7.1.dev3.dist-info/entry_points.txt +0 -2
  52. tests/integration/test_mcp_kiro_integration.py +0 -153
  53. tests/regression/test_mcp_codex_backup_integration.py +0 -162
  54. tests/regression/test_mcp_codex_host_strategy.py +0 -163
  55. tests/regression/test_mcp_codex_model_validation.py +0 -117
  56. tests/regression/test_mcp_kiro_backup_integration.py +0 -241
  57. tests/regression/test_mcp_kiro_cli_integration.py +0 -141
  58. tests/regression/test_mcp_kiro_decorator_registration.py +0 -71
  59. tests/regression/test_mcp_kiro_host_strategy.py +0 -214
  60. tests/regression/test_mcp_kiro_model_validation.py +0 -116
  61. tests/regression/test_mcp_kiro_omni_conversion.py +0 -104
  62. tests/test_mcp_atomic_operations.py +0 -276
  63. tests/test_mcp_backup_integration.py +0 -308
  64. tests/test_mcp_cli_all_host_specific_args.py +0 -496
  65. tests/test_mcp_cli_backup_management.py +0 -295
  66. tests/test_mcp_cli_direct_management.py +0 -456
  67. tests/test_mcp_cli_discovery_listing.py +0 -582
  68. tests/test_mcp_cli_host_config_integration.py +0 -823
  69. tests/test_mcp_cli_package_management.py +0 -360
  70. tests/test_mcp_cli_partial_updates.py +0 -859
  71. tests/test_mcp_environment_integration.py +0 -520
  72. tests/test_mcp_host_config_backup.py +0 -257
  73. tests/test_mcp_host_configuration_manager.py +0 -331
  74. tests/test_mcp_host_registry_decorator.py +0 -348
  75. tests/test_mcp_pydantic_architecture_v4.py +0 -603
  76. tests/test_mcp_server_config_models.py +0 -242
  77. tests/test_mcp_server_config_type_field.py +0 -221
  78. tests/test_mcp_sync_functionality.py +0 -316
  79. tests/test_mcp_user_feedback_reporting.py +0 -359
  80. {hatch_xclam-0.7.1.dev3.dist-info → hatch_xclam-0.8.0.dev1.dist-info}/licenses/LICENSE +0 -0
  81. {hatch_xclam-0.7.1.dev3.dist-info → hatch_xclam-0.8.0.dev1.dist-info}/top_level.txt +0 -0
@@ -6,10 +6,11 @@ user-friendly reports about MCP configuration changes, including field-level
6
6
  operations and conversion summaries.
7
7
  """
8
8
 
9
- from typing import Literal, Optional, Any, List
9
+ from typing import Literal, Optional, Any, List, Union
10
10
  from pydantic import BaseModel, ConfigDict
11
11
 
12
- from .models import MCPServerConfigOmni, MCPHostType, HOST_MODEL_REGISTRY
12
+ from .models import MCPServerConfig, MCPHostType
13
+ from .adapters import get_adapter
13
14
 
14
15
 
15
16
  class FieldOperation(BaseModel):
@@ -57,41 +58,70 @@ class ConversionReport(BaseModel):
57
58
  dry_run: bool = False
58
59
 
59
60
 
61
+ def _get_adapter_host_name(host_type: MCPHostType) -> str:
62
+ """Map MCPHostType to adapter host name.
63
+
64
+ Claude has two variants (desktop/code) sharing the same adapter,
65
+ so we need explicit mapping.
66
+ """
67
+ mapping = {
68
+ MCPHostType.CLAUDE_DESKTOP: "claude-desktop",
69
+ MCPHostType.CLAUDE_CODE: "claude-code",
70
+ MCPHostType.VSCODE: "vscode",
71
+ MCPHostType.CURSOR: "cursor",
72
+ MCPHostType.LMSTUDIO: "lmstudio",
73
+ MCPHostType.GEMINI: "gemini",
74
+ MCPHostType.KIRO: "kiro",
75
+ MCPHostType.CODEX: "codex",
76
+ }
77
+ return mapping.get(host_type, host_type.value)
78
+
79
+
60
80
  def generate_conversion_report(
61
81
  operation: Literal["create", "update", "delete", "migrate"],
62
82
  server_name: str,
63
83
  target_host: MCPHostType,
64
- omni: MCPServerConfigOmni,
84
+ config: MCPServerConfig,
65
85
  source_host: Optional[MCPHostType] = None,
66
- old_config: Optional[MCPServerConfigOmni] = None,
86
+ old_config: Optional[MCPServerConfig] = None,
67
87
  dry_run: bool = False
68
88
  ) -> ConversionReport:
69
89
  """Generate conversion report for a configuration operation.
70
-
71
- Analyzes the conversion from Omni model to host-specific configuration,
90
+
91
+ Analyzes the configuration against the target host's adapter,
72
92
  identifying which fields were updated, which are unsupported, and which
73
93
  remained unchanged.
74
-
94
+
95
+ Fields in the adapter's excluded set (e.g., 'name' from EXCLUDED_ALWAYS)
96
+ are internal metadata and are completely omitted from field operations.
97
+ They will not appear as UPDATED, UNCHANGED, or UNSUPPORTED.
98
+
75
99
  Args:
76
100
  operation: Type of operation being performed
77
101
  server_name: Name of the server being configured
78
102
  target_host: Target host for the configuration (MCPHostType enum)
79
- omni: New/updated configuration (Omni model)
103
+ config: New/updated configuration (unified MCPServerConfig)
80
104
  source_host: Source host (for migrate operation, MCPHostType enum)
81
105
  old_config: Existing configuration (for update operation)
82
106
  dry_run: Whether this is a dry-run preview
83
-
107
+
84
108
  Returns:
85
109
  ConversionReport with field-level operations
86
110
  """
87
- # Derive supported fields dynamically from model class
88
- model_class = HOST_MODEL_REGISTRY[target_host]
89
- supported_fields = set(model_class.model_fields.keys())
90
-
111
+ # Get supported and excluded fields from adapter
112
+ adapter_host_name = _get_adapter_host_name(target_host)
113
+ adapter = get_adapter(adapter_host_name)
114
+ supported_fields = adapter.get_supported_fields()
115
+ excluded_fields = adapter.get_excluded_fields()
116
+
91
117
  field_operations = []
92
- set_fields = omni.model_dump(exclude_unset=True)
93
-
118
+ set_fields = config.model_dump(exclude_unset=True)
119
+
94
120
  for field_name, new_value in set_fields.items():
121
+ # Skip metadata fields (e.g., 'name') - they should never appear in reports
122
+ if field_name in excluded_fields:
123
+ continue
124
+
95
125
  if field_name in supported_fields:
96
126
  # Field is supported by target host
97
127
  if old_config:
@@ -137,7 +167,7 @@ def generate_conversion_report(
137
167
  operation="UNSUPPORTED",
138
168
  new_value=new_value
139
169
  ))
140
-
170
+
141
171
  return ConversionReport(
142
172
  operation=operation,
143
173
  server_name=server_name,
@@ -151,6 +181,10 @@ def generate_conversion_report(
151
181
  def display_report(report: ConversionReport) -> None:
152
182
  """Display conversion report to console.
153
183
 
184
+ .. deprecated::
185
+ Use ``ResultReporter.add_from_conversion_report()`` instead.
186
+ This function will be removed in a future version.
187
+
154
188
  Prints a formatted report showing the operation performed and all
155
189
  field-level changes. Uses FieldOperation.__str__() for consistent
156
190
  formatting.
@@ -158,6 +192,13 @@ def display_report(report: ConversionReport) -> None:
158
192
  Args:
159
193
  report: ConversionReport to display
160
194
  """
195
+ import warnings
196
+ warnings.warn(
197
+ "display_report() is deprecated. Use ResultReporter.add_from_conversion_report() instead.",
198
+ DeprecationWarning,
199
+ stacklevel=2
200
+ )
201
+
161
202
  # Header
162
203
  if report.dry_run:
163
204
  print(f"[DRY RUN] Preview of changes for server '{report.server_name}':")