hatch-xclam 0.7.0.dev13__py3-none-any.whl → 0.7.1.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.
@@ -0,0 +1,116 @@
1
+ """
2
+ Kiro MCP Model Validation Tests
3
+
4
+ Tests for MCPServerConfigKiro Pydantic model behavior, field validation,
5
+ and Kiro-specific field combinations.
6
+ """
7
+
8
+ import unittest
9
+ from typing import Optional, List
10
+
11
+ from wobble.decorators import regression_test
12
+
13
+ from hatch.mcp_host_config.models import (
14
+ MCPServerConfigKiro,
15
+ MCPServerConfigOmni,
16
+ MCPHostType
17
+ )
18
+
19
+
20
+ class TestMCPServerConfigKiro(unittest.TestCase):
21
+ """Test suite for MCPServerConfigKiro model validation."""
22
+
23
+ @regression_test
24
+ def test_kiro_model_with_disabled_field(self):
25
+ """Test Kiro model with disabled field."""
26
+ config = MCPServerConfigKiro(
27
+ name="kiro-server",
28
+ command="auggie",
29
+ args=["--mcp", "-m", "default"],
30
+ disabled=True
31
+ )
32
+
33
+ self.assertEqual(config.command, "auggie")
34
+ self.assertTrue(config.disabled)
35
+ self.assertEqual(config.type, "stdio") # Inferred
36
+
37
+ @regression_test
38
+ def test_kiro_model_with_auto_approve_tools(self):
39
+ """Test Kiro model with autoApprove field."""
40
+ config = MCPServerConfigKiro(
41
+ name="kiro-server",
42
+ command="auggie",
43
+ autoApprove=["codebase-retrieval", "fetch"]
44
+ )
45
+
46
+ self.assertEqual(config.command, "auggie")
47
+ self.assertEqual(len(config.autoApprove), 2)
48
+ self.assertIn("codebase-retrieval", config.autoApprove)
49
+ self.assertIn("fetch", config.autoApprove)
50
+
51
+ @regression_test
52
+ def test_kiro_model_with_disabled_tools(self):
53
+ """Test Kiro model with disabledTools field."""
54
+ config = MCPServerConfigKiro(
55
+ name="kiro-server",
56
+ command="python",
57
+ disabledTools=["dangerous-tool", "risky-tool"]
58
+ )
59
+
60
+ self.assertEqual(config.command, "python")
61
+ self.assertEqual(len(config.disabledTools), 2)
62
+ self.assertIn("dangerous-tool", config.disabledTools)
63
+
64
+ @regression_test
65
+ def test_kiro_model_all_fields_combined(self):
66
+ """Test Kiro model with all Kiro-specific fields."""
67
+ config = MCPServerConfigKiro(
68
+ name="kiro-server",
69
+ command="auggie",
70
+ args=["--mcp"],
71
+ env={"DEBUG": "true"},
72
+ disabled=False,
73
+ autoApprove=["codebase-retrieval"],
74
+ disabledTools=["dangerous-tool"]
75
+ )
76
+
77
+ # Verify all fields
78
+ self.assertEqual(config.command, "auggie")
79
+ self.assertFalse(config.disabled)
80
+ self.assertEqual(len(config.autoApprove), 1)
81
+ self.assertEqual(len(config.disabledTools), 1)
82
+ self.assertEqual(config.env["DEBUG"], "true")
83
+
84
+ @regression_test
85
+ def test_kiro_model_minimal_configuration(self):
86
+ """Test Kiro model with minimal configuration."""
87
+ config = MCPServerConfigKiro(
88
+ name="kiro-server",
89
+ command="auggie"
90
+ )
91
+
92
+ self.assertEqual(config.command, "auggie")
93
+ self.assertEqual(config.type, "stdio") # Inferred
94
+ self.assertIsNone(config.disabled)
95
+ self.assertIsNone(config.autoApprove)
96
+ self.assertIsNone(config.disabledTools)
97
+
98
+ @regression_test
99
+ def test_kiro_model_remote_server_with_kiro_fields(self):
100
+ """Test Kiro model with remote server and Kiro-specific fields."""
101
+ config = MCPServerConfigKiro(
102
+ name="kiro-remote",
103
+ url="https://api.example.com/mcp",
104
+ headers={"Authorization": "Bearer token"},
105
+ disabled=True,
106
+ autoApprove=["safe-tool"]
107
+ )
108
+
109
+ self.assertEqual(config.url, "https://api.example.com/mcp")
110
+ self.assertTrue(config.disabled)
111
+ self.assertEqual(len(config.autoApprove), 1)
112
+ self.assertEqual(config.type, "sse") # Inferred for remote
113
+
114
+
115
+ if __name__ == '__main__':
116
+ unittest.main()
@@ -0,0 +1,104 @@
1
+ """
2
+ Kiro MCP Omni Conversion Tests
3
+
4
+ Tests for conversion from MCPServerConfigOmni to MCPServerConfigKiro
5
+ using the from_omni() method.
6
+ """
7
+
8
+ import unittest
9
+
10
+ from wobble.decorators import regression_test
11
+
12
+ from hatch.mcp_host_config.models import (
13
+ MCPServerConfigKiro,
14
+ MCPServerConfigOmni
15
+ )
16
+
17
+
18
+ class TestKiroFromOmniConversion(unittest.TestCase):
19
+ """Test suite for Kiro from_omni() conversion method."""
20
+
21
+ @regression_test
22
+ def test_kiro_from_omni_with_supported_fields(self):
23
+ """Test Kiro from_omni with supported fields."""
24
+ omni = MCPServerConfigOmni(
25
+ name="kiro-server",
26
+ command="auggie",
27
+ args=["--mcp", "-m", "default"],
28
+ disabled=True,
29
+ autoApprove=["codebase-retrieval", "fetch"],
30
+ disabledTools=["dangerous-tool"]
31
+ )
32
+
33
+ # Convert to Kiro model
34
+ kiro = MCPServerConfigKiro.from_omni(omni)
35
+
36
+ # Verify all supported fields transferred
37
+ self.assertEqual(kiro.name, "kiro-server")
38
+ self.assertEqual(kiro.command, "auggie")
39
+ self.assertEqual(len(kiro.args), 3)
40
+ self.assertTrue(kiro.disabled)
41
+ self.assertEqual(len(kiro.autoApprove), 2)
42
+ self.assertEqual(len(kiro.disabledTools), 1)
43
+
44
+ @regression_test
45
+ def test_kiro_from_omni_with_unsupported_fields(self):
46
+ """Test Kiro from_omni excludes unsupported fields."""
47
+ omni = MCPServerConfigOmni(
48
+ name="kiro-server",
49
+ command="python",
50
+ disabled=True, # Kiro field
51
+ envFile=".env", # VS Code field (unsupported by Kiro)
52
+ timeout=30000 # Gemini field (unsupported by Kiro)
53
+ )
54
+
55
+ # Convert to Kiro model
56
+ kiro = MCPServerConfigKiro.from_omni(omni)
57
+
58
+ # Verify Kiro fields transferred
59
+ self.assertEqual(kiro.command, "python")
60
+ self.assertTrue(kiro.disabled)
61
+
62
+ # Verify unsupported fields NOT transferred
63
+ self.assertFalse(hasattr(kiro, 'envFile') and kiro.envFile is not None)
64
+ self.assertFalse(hasattr(kiro, 'timeout') and kiro.timeout is not None)
65
+
66
+ @regression_test
67
+ def test_kiro_from_omni_exclude_unset_behavior(self):
68
+ """Test that from_omni respects exclude_unset=True."""
69
+ omni = MCPServerConfigOmni(
70
+ name="kiro-server",
71
+ command="auggie"
72
+ # disabled, autoApprove, disabledTools not set
73
+ )
74
+
75
+ kiro = MCPServerConfigKiro.from_omni(omni)
76
+
77
+ # Verify unset fields remain None
78
+ self.assertIsNone(kiro.disabled)
79
+ self.assertIsNone(kiro.autoApprove)
80
+ self.assertIsNone(kiro.disabledTools)
81
+
82
+ @regression_test
83
+ def test_kiro_from_omni_remote_server_conversion(self):
84
+ """Test Kiro from_omni with remote server configuration."""
85
+ omni = MCPServerConfigOmni(
86
+ name="kiro-remote",
87
+ url="https://api.example.com/mcp",
88
+ headers={"Authorization": "Bearer token"},
89
+ disabled=False,
90
+ autoApprove=["safe-tool"]
91
+ )
92
+
93
+ kiro = MCPServerConfigKiro.from_omni(omni)
94
+
95
+ # Verify remote server fields
96
+ self.assertEqual(kiro.url, "https://api.example.com/mcp")
97
+ self.assertEqual(kiro.headers["Authorization"], "Bearer token")
98
+ self.assertFalse(kiro.disabled)
99
+ self.assertEqual(len(kiro.autoApprove), 1)
100
+ self.assertEqual(kiro.type, "sse") # Inferred for remote
101
+
102
+
103
+ if __name__ == '__main__':
104
+ unittest.main()
tests/test_data_utils.py CHANGED
@@ -292,6 +292,25 @@ class MCPHostConfigTestDataLoader(TestDataLoader):
292
292
  with open(config_path, 'r') as f:
293
293
  return json.load(f)
294
294
 
295
+ def load_kiro_mcp_config(self, config_type: str = "empty") -> Dict[str, Any]:
296
+ """Load Kiro-specific MCP configuration templates.
297
+
298
+ Args:
299
+ config_type: Type of Kiro configuration to load
300
+ - "empty": Empty mcpServers configuration
301
+ - "with_server": Single server with all Kiro fields
302
+ - "complex": Multi-server with mixed configurations
303
+
304
+ Returns:
305
+ Kiro MCP configuration dictionary
306
+ """
307
+ config_path = self.mcp_host_configs_dir / f"kiro_mcp_{config_type}.json"
308
+ if not config_path.exists():
309
+ self._create_kiro_mcp_config(config_type)
310
+
311
+ with open(config_path, 'r') as f:
312
+ return json.load(f)
313
+
295
314
  def _create_host_config_template(self, host_type: str, config_type: str):
296
315
  """Create host-specific configuration templates with inheritance patterns."""
297
316
  templates = {
@@ -364,6 +383,50 @@ class MCPHostConfigTestDataLoader(TestDataLoader):
364
383
  "args": ["server.py"]
365
384
  }
366
385
  }
386
+ },
387
+
388
+ # Kiro family templates
389
+ "kiro_simple": {
390
+ "mcpServers": {
391
+ "test_server": {
392
+ "command": "auggie",
393
+ "args": ["--mcp"],
394
+ "disabled": False,
395
+ "autoApprove": ["codebase-retrieval"]
396
+ }
397
+ }
398
+ },
399
+ "kiro_with_server": {
400
+ "mcpServers": {
401
+ "existing-server": {
402
+ "command": "auggie",
403
+ "args": ["--mcp", "-m", "default", "-w", "."],
404
+ "env": {"DEBUG": "true"},
405
+ "disabled": False,
406
+ "autoApprove": ["codebase-retrieval", "fetch"],
407
+ "disabledTools": ["dangerous-tool"]
408
+ }
409
+ }
410
+ },
411
+ "kiro_complex": {
412
+ "mcpServers": {
413
+ "local-server": {
414
+ "command": "auggie",
415
+ "args": ["--mcp"],
416
+ "disabled": False,
417
+ "autoApprove": ["codebase-retrieval"]
418
+ },
419
+ "remote-server": {
420
+ "url": "https://api.example.com/mcp",
421
+ "headers": {"Authorization": "Bearer token"},
422
+ "disabled": True,
423
+ "disabledTools": ["risky-tool"]
424
+ }
425
+ },
426
+ "otherSettings": {
427
+ "theme": "dark",
428
+ "fontSize": 14
429
+ }
367
430
  }
368
431
  }
369
432
 
@@ -470,3 +533,48 @@ class MCPHostConfigTestDataLoader(TestDataLoader):
470
533
  config_path = self.mcp_host_configs_dir / f"mcp_server_{server_type}.json"
471
534
  with open(config_path, 'w') as f:
472
535
  json.dump(config, f, indent=2)
536
+
537
+ def _create_kiro_mcp_config(self, config_type: str):
538
+ """Create Kiro-specific MCP configuration templates."""
539
+ templates = {
540
+ "empty": {
541
+ "mcpServers": {}
542
+ },
543
+ "with_server": {
544
+ "mcpServers": {
545
+ "existing-server": {
546
+ "command": "auggie",
547
+ "args": ["--mcp", "-m", "default", "-w", "."],
548
+ "env": {"DEBUG": "true"},
549
+ "disabled": False,
550
+ "autoApprove": ["codebase-retrieval", "fetch"],
551
+ "disabledTools": ["dangerous-tool"]
552
+ }
553
+ }
554
+ },
555
+ "complex": {
556
+ "mcpServers": {
557
+ "local-server": {
558
+ "command": "auggie",
559
+ "args": ["--mcp"],
560
+ "disabled": False,
561
+ "autoApprove": ["codebase-retrieval"]
562
+ },
563
+ "remote-server": {
564
+ "url": "https://api.example.com/mcp",
565
+ "headers": {"Authorization": "Bearer token"},
566
+ "disabled": True,
567
+ "disabledTools": ["risky-tool"]
568
+ }
569
+ },
570
+ "otherSettings": {
571
+ "theme": "dark",
572
+ "fontSize": 14
573
+ }
574
+ }
575
+ }
576
+
577
+ config = templates.get(config_type, {"mcpServers": {}})
578
+ config_path = self.mcp_host_configs_dir / f"kiro_mcp_{config_type}.json"
579
+ with open(config_path, 'w') as f:
580
+ json.dump(config, f, indent=2)