mcp-souschef 3.0.0__py3-none-any.whl → 3.5.1__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.
@@ -1,34 +1,40 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-souschef
3
- Version: 3.0.0
3
+ Version: 3.5.1
4
4
  Summary: AI-powered MCP server for Chef to Ansible conversion
5
5
  License: MIT
6
6
  License-File: LICENSE
7
7
  Keywords: chef,ansible,migration,infrastructure,automation,mcp,ai,conversion
8
8
  Author: SousChef Contributors
9
- Requires-Python: >=3.13,<4.0
9
+ Requires-Python: >=3.10,<4.0
10
10
  Classifier: Development Status :: 4 - Beta
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Intended Audience :: System Administrators
13
13
  Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Operating System :: OS Independent
15
15
  Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
16
19
  Classifier: Programming Language :: Python :: 3.13
17
20
  Classifier: Programming Language :: Python :: 3.14
18
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
22
  Classifier: Topic :: System :: Systems Administration
20
23
  Classifier: Topic :: Utilities
24
+ Provides-Extra: ai
25
+ Provides-Extra: all
21
26
  Provides-Extra: ui
22
- Requires-Dist: anthropic (>=0.75.0)
27
+ Requires-Dist: anthropic (>=0.75.0) ; extra == "ai" or extra == "all"
23
28
  Requires-Dist: click (>=8.1.0)
24
29
  Requires-Dist: mcp (>=1.25.0)
25
- Requires-Dist: openai (>=1.0.0)
26
- Requires-Dist: pandas (>=2.0.0) ; extra == "ui"
27
- Requires-Dist: plotly (>=5.0.0)
30
+ Requires-Dist: openai (>=1.0.0) ; extra == "ai" or extra == "all"
31
+ Requires-Dist: pandas (>=2.0.0) ; extra == "ui" or extra == "all"
32
+ Requires-Dist: plotly (>=5.17.0,<7.0) ; extra == "ui" or extra == "all"
33
+ Requires-Dist: pydantic (>=2.0.0)
28
34
  Requires-Dist: python-dotenv (>=1.2.1)
29
35
  Requires-Dist: pyyaml (>=6.0.0)
30
- Requires-Dist: streamlit (>=1.28.0)
31
- Requires-Dist: zod (>=0.8.0)
36
+ Requires-Dist: requests (>=2.31.0)
37
+ Requires-Dist: streamlit (>=1.28.0) ; extra == "ui" or extra == "all"
32
38
  Project-URL: Documentation, https://kpeacocke.github.io/souschef/
33
39
  Project-URL: Homepage, https://github.com/kpeacocke/souschef
34
40
  Project-URL: Repository, https://github.com/kpeacocke/souschef
@@ -41,7 +47,7 @@ An AI-powered MCP (Model Context Protocol) server that provides comprehensive Ch
41
47
  [![GitHub release](https://img.shields.io/github/v/release/kpeacocke/souschef)](https://github.com/kpeacocke/souschef/releases)
42
48
  [![Python Version](https://img.shields.io/badge/python-3.14%2B-blue.svg)](https://www.python.org/downloads/)
43
49
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
44
- [![Test Coverage](https://img.shields.io/badge/coverage-91%25-brightgreen.svg)](htmlcov/index.html)
50
+ [![Test Coverage](https://img.shields.io/badge/coverage-83%25-green.svg)](htmlcov/index.html)
45
51
  [![Code style: Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
46
52
  [![Type Checked: mypy](https://img.shields.io/badge/type%20checked-mypy-blue.svg)](http://mypy-lang.org/)
47
53
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=kpeacocke_souschef&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=kpeacocke_souschef)
@@ -50,17 +56,17 @@ An AI-powered MCP (Model Context Protocol) server that provides comprehensive Ch
50
56
 
51
57
  ## Overview - Chef to Ansible features
52
58
 
53
- SousChef is a complete enterprise-grade migration platform with **32 primary MCP tools** organised across **10 major capability areas** to facilitate Chef-to-Ansible AWX/AAP migrations. From cookbook analysis to deployment pattern conversion, including Chef Habitat to containerised deployments and CI/CD pipeline generation, SousChef provides everything needed for a successful infrastructure automation migration.
59
+ SousChef is a complete enterprise-grade migration platform with **35 primary MCP tools** organised across **11 major capability areas** to facilitate Chef-to-Ansible AWX/AAP migrations. From cookbook analysis to deployment pattern conversion, including Chef Habitat to containerised deployments, Chef Server integration, and CI/CD pipeline generation, SousChef provides everything needed for a successful infrastructure automation migration.
54
60
 
55
61
  ### About Tool Counts
56
62
 
57
- **Why 32 tools in the documentation but more in the server?**
63
+ **Why 35 tools in the documentation but more in the server?**
58
64
 
59
- The MCP server provides **37 total tools** (35 public + 2 internal). This documentation focuses on the **32 primary user-facing tools** that cover the main migration capabilities. The remaining 3 tools are low-level filesystem operations and helper utilities used internally by the main tools.
65
+ The MCP server provides **38 total tools**. This documentation focuses on the **35 primary user-facing tools** that cover the main migration capabilities. The remaining 3 tools are low-level filesystem operations used internally by the main tools.
60
66
 
61
- As a user, you'll primarily interact with the 27 documented tools. Your AI assistant may use the additional tools automatically when needed, but you don't need to know about them for successful migrations.
67
+ As a user, you'll primarily interact with the documented tools. Your AI assistant may use the additional tools automatically when needed, but you don't need to know about them for successful migrations.
62
68
 
63
- > **For developers:** See `souschef/server.py` for the complete list of all 37 registered tools.
69
+ > **For developers:** See `souschef/server.py` for the complete list of all 38 registered tools.
64
70
 
65
71
  ## Model Agnostic - Works with Any AI Model
66
72
 
@@ -73,7 +79,7 @@ As a user, you'll primarily interact with the 27 documented tools. Your AI assis
73
79
  - **Local Models** (Ollama, llama.cpp, etc.)
74
80
  - **Custom Enterprise Models**
75
81
 
76
- **How it works:** You choose your AI model provider in your MCP client. SousChef provides the Chef/Ansible expertise through 27 specialized tools. The model calls these tools to help with your migration.
82
+ **How it works:** You choose your AI model provider in your MCP client. SousChef provides the Chef/Ansible expertise through 35 specialized tools. The model calls these tools to help with your migration.
77
83
 
78
84
  > See [config/CONFIGURATION.md](config/CONFIGURATION.md) for configuration examples with different model providers.
79
85
 
@@ -84,6 +90,28 @@ As a user, you'll primarily interact with the 27 documented tools. Your AI assis
84
90
  - **[API Reference](docs/api-reference/)** - Detailed tool documentation
85
91
  - **[Migration Guide](docs/migration-guide/)** - Step-by-step migration process
86
92
 
93
+ ## What's New in v3.4.0-beta
94
+
95
+ **Chef Server Integration & AI-Enhanced Template Conversion** - New tools for dynamic inventory and intelligent template conversion:
96
+
97
+ - **Chef Server Connectivity**: Validate Chef Server connections and query nodes with `validate_chef_server_connection` and `get_chef_nodes`
98
+ - **AI-Enhanced Templates**: Convert ERB to Jinja2 with AI validation using `convert_template_with_ai` for complex Ruby logic
99
+ - **CLI Commands**: New commands `validate-chef-server`, `query-chef-nodes`, and `convert-template-ai` for command-line access
100
+ - **Streamlit UI**: Chef Server Settings page for managing server configuration and validation
101
+
102
+ ## What's New in v3.3.0
103
+
104
+ **AI-Assisted Effort Estimation** - SousChef now displays realistic migration effort comparisons directly in the Streamlit UI:
105
+
106
+ - **Manual Migration Estimates**: Full effort without AI assistance
107
+ - **SousChef-Assisted Estimates**: 50% time reduction through automated boilerplate conversion
108
+ - **Time Savings Display**: Instant visual comparison showing hours saved and efficiency gains
109
+ - **Interactive Metrics**: Summary and per-cookbook effort comparisons with clear deltas
110
+
111
+ Example: A cookbook estimated at 40 hours of manual work shows SousChef-assisted time as 20 hours, saving 20 hours (50%) and reducing team needs from 2 developers to 1.
112
+
113
+ See the [Assessment Guide](docs/migration-guide/assessment.md#effort-estimation-model) for details on the effort estimation model.
114
+
87
115
  ## Installation
88
116
 
89
117
  ```bash
@@ -101,6 +129,7 @@ poetry install
101
129
  ## Core Capabilities
102
130
 
103
131
  ### 1. Chef Cookbook Analysis & Parsing
132
+
104
133
  Complete cookbook introspection and analysis tools:
105
134
 
106
135
  - **parse_template** - Parse ERB templates with Jinja2 conversion and variable extraction
@@ -113,6 +142,7 @@ Complete cookbook introspection and analysis tools:
113
142
  - **list_cookbook_structure** - Display complete cookbook directory hierarchy
114
143
 
115
144
  ### 2. Chef-to-Ansible Conversion Engine
145
+
116
146
  Advanced resource-to-task conversion with intelligent module selection:
117
147
 
118
148
  - **convert_resource_to_task** - Transform individual Chef resources to Ansible tasks
@@ -125,6 +155,7 @@ Advanced resource-to-task conversion with intelligent module selection:
125
155
  - Platform checks, node attributes, file/directory existence, and command execution
126
156
 
127
157
  ### 3. Chef Search & Inventory Integration
158
+
128
159
  Convert Chef search patterns to dynamic Ansible inventory:
129
160
 
130
161
  - **convert_chef_search_to_inventory** - Transform Chef search queries to Ansible inventory groups
@@ -132,6 +163,7 @@ Convert Chef search patterns to dynamic Ansible inventory:
132
163
  - **analyse_chef_search_patterns** - Discover and analyse search usage in cookbooks
133
164
 
134
165
  ### 4. InSpec Integration & Validation
166
+
135
167
  Complete InSpec-to-Ansible testing pipeline:
136
168
 
137
169
  - **parse_inspec_profile** - Parse InSpec profiles and extract controls
@@ -139,6 +171,7 @@ Complete InSpec-to-Ansible testing pipeline:
139
171
  - **generate_inspec_from_recipe** - Auto-generate InSpec validation from Chef recipes
140
172
 
141
173
  ### 5. Data Bags & Secrets Management
174
+
142
175
  Chef data bags to Ansible vars/vault conversion:
143
176
 
144
177
  - **convert_chef_databag_to_vars** - Transform data bags to Ansible variable files
@@ -146,6 +179,7 @@ Chef data bags to Ansible vars/vault conversion:
146
179
  - **analyse_chef_databag_usage** - Analyse data bag usage patterns in cookbooks
147
180
 
148
181
  ### 6. Environment & Configuration Management
182
+
149
183
  Chef environments to Ansible inventory groups:
150
184
 
151
185
  - **convert_chef_environment_to_inventory_group** - Transform Chef environments to inventory
@@ -153,6 +187,7 @@ Chef environments to Ansible inventory groups:
153
187
  - **analyse_chef_environment_usage** - Analyse environment usage in cookbooks
154
188
 
155
189
  ### 7. AWX/Ansible Automation Platform Integration
190
+
156
191
  Enterprise AWX/AAP configuration generation:
157
192
 
158
193
  - **generate_awx_job_template_from_cookbook** - Create AWX job templates from cookbooks
@@ -161,6 +196,7 @@ Enterprise AWX/AAP configuration generation:
161
196
  - **generate_awx_inventory_source_from_chef** - Create dynamic inventory sources from Chef server
162
197
 
163
198
  ### 8. Chef Habitat to Container Conversion
199
+
164
200
  Modernize Habitat applications to containerized deployments:
165
201
 
166
202
  - **parse_habitat_plan** - Parse Chef Habitat plan files (plan.sh) and extract package metadata, dependencies, build/install hooks, and service configuration
@@ -168,6 +204,7 @@ Modernize Habitat applications to containerized deployments:
168
204
  - **generate_compose_from_habitat** - Generate docker-compose.yml from multiple Habitat plans for multi-service deployments
169
205
 
170
206
  ### 9. Advanced Deployment Patterns & Migration Assessment
207
+
171
208
  Modern deployment strategies and migration planning:
172
209
 
173
210
  - **convert_chef_deployment_to_ansible_strategy** - Convert deployment recipes to Ansible strategies
@@ -175,6 +212,7 @@ Modern deployment strategies and migration planning:
175
212
  - **generate_canary_deployment_strategy** - Generate canary deployment configurations
176
213
 
177
214
  ### 10. CI/CD Pipeline Generation
215
+
178
216
  Generate Jenkins, GitLab CI, and GitHub Actions workflows from Chef cookbook CI patterns:
179
217
 
180
218
  - **generate_jenkinsfile_from_chef** - Generate Jenkinsfile (Declarative or Scripted) from Chef cookbook CI/CD patterns
@@ -182,6 +220,7 @@ Generate Jenkins, GitLab CI, and GitHub Actions workflows from Chef cookbook CI
182
220
  - **generate_github_workflow_from_chef** - Generate GitHub Actions workflow from Chef cookbook CI/CD patterns
183
221
 
184
222
  Automatically detects and converts:
223
+
185
224
  - **Test Kitchen** configurations (.kitchen.yml) → Integration test stages
186
225
  - **ChefSpec** tests (spec/) → Unit test stages
187
226
  - **Cookstyle/Foodcritic** → Lint stages
@@ -207,7 +246,10 @@ souschef generate-gitlab-ci ./mycookbook --no-cache --no-artifacts
207
246
  souschef generate-github-workflow ./mycookbook --workflow-name "My CI" --no-cache
208
247
  ```
209
248
 
249
+ #### Command Line Usage
250
+
210
251
  **MCP Tool Usage:**
252
+
211
253
  ```python
212
254
  # From an AI assistant with SousChef MCP
213
255
 
@@ -235,6 +277,7 @@ generate_github_workflow_from_chef(
235
277
  ```
236
278
 
237
279
  ### 11. Conversion Validation Framework
280
+
238
281
  Comprehensive validation of Chef-to-Ansible conversions:
239
282
 
240
283
  - **validate_conversion** - Validate conversions across multiple dimensions
@@ -245,18 +288,20 @@ Comprehensive validation of Chef-to-Ansible conversions:
245
288
  - **Performance Recommendations**: Efficiency suggestions and optimizations
246
289
 
247
290
  #### Validation Levels
291
+
248
292
  - **ERROR**: Critical issues that will prevent execution
249
293
  - **WARNING**: Potential problems or anti-patterns that may cause issues
250
294
  - **INFO**: Suggestions for improvements and best practices
251
295
 
252
296
  #### Validation Categories
297
+
253
298
  - **Syntax**: Code structure and syntax correctness
254
299
  - **Semantic**: Logical equivalence and meaning preservation
255
300
  - **Best Practice**: Ansible community standards and patterns
256
301
  - **Security**: Security considerations and recommendations
257
302
  - **Performance**: Efficiency and optimization suggestions
258
303
 
259
- #### Example Usage
304
+ #### Validation Examples
260
305
 
261
306
  ```python
262
307
  # Validate a resource conversion
@@ -272,6 +317,7 @@ validate_conversion(
272
317
  ```
273
318
 
274
319
  Output formats:
320
+
275
321
  - **text**: Detailed report with all findings grouped by severity
276
322
  - **json**: Structured JSON for programmatic processing
277
323
  - **summary**: Quick overview with counts only
@@ -282,9 +328,58 @@ Output formats:
282
328
  - **analyse_cookbook_dependencies** - Analyse dependencies and migration order
283
329
  - **generate_migration_report** - Generate executive and technical migration reports
284
330
 
331
+ ### 12. Chef Server Integration & Dynamic Inventory
332
+
333
+ Dynamic inventory generation and Chef Server connectivity for hybrid environments:
334
+
335
+ - **validate_chef_server_connection** - Test Chef Server REST API connectivity and authentication
336
+ - **get_chef_nodes** - Query Chef Server for nodes matching search criteria, extracting roles, environment, platform, and IP information
337
+ - **convert_template_with_ai** - Convert ERB templates to Jinja2 with AI-based validation for complex Ruby logic
338
+
339
+ #### Chef Server Features
340
+
341
+ - **Connection Validation**: Test Chef Server connectivity before migrations
342
+ - **Dynamic Node Queries**: Search Chef Server by role, environment, or custom attributes
343
+ - **Node Metadata Extraction**: Retrieve IP addresses, FQDNs, platforms, and roles for inventory
344
+ - **AI-Enhanced Conversion**: Intelligent ERB→Jinja2 conversion with validation for complex Ruby constructs
345
+ - **Fallback Handling**: Graceful degradation when Chef Server is unavailable
346
+
347
+ #### Usage Examples
348
+
349
+ ```bash
350
+ # Validate Chef Server connection
351
+ souschef validate-chef-server --server-url https://chef.example.com --node-name admin
352
+
353
+ # Query Chef Server for nodes
354
+ souschef query-chef-nodes --search-query "role:web_server" --json
355
+
356
+ # Convert template with AI assistance
357
+ souschef convert-template-ai /path/to/template.erb --ai --output /path/to/output.j2
358
+ ```
359
+
360
+ #### MCP Tool Usage
361
+
362
+ ```python
363
+ # Validate Chef Server from AI assistant
364
+ validate_chef_server_connection(
365
+ server_url="https://chef.example.com",
366
+ node_name="admin"
367
+ )
368
+
369
+ # Query nodes for dynamic inventory
370
+ get_chef_nodes(search_query="role:web_server AND environment:production")
371
+
372
+ # Convert template with AI validation
373
+ convert_template_with_ai(
374
+ erb_path="/path/to/template.erb",
375
+ use_ai_enhancement=True
376
+ )
377
+ ```
378
+
285
379
  ## Migration Workflow
286
380
 
287
381
  ### Phase 1: Discovery & Assessment
382
+
288
383
  ```bash
289
384
  # Assess migration complexity
290
385
  assess_chef_migration_complexity /path/to/cookbooks
@@ -297,6 +392,7 @@ generate_migration_plan '{\"cookbooks\": [\"/path/to/cookbook1\", \"/path/to/coo
297
392
  ```
298
393
 
299
394
  ### Phase 2: Content Conversion
395
+
300
396
  ```bash
301
397
  # Convert recipes to playbooks
302
398
  generate_playbook_from_recipe /path/to/recipe.rb
@@ -309,6 +405,7 @@ generate_inventory_from_chef_environments /path/to/environments
309
405
  ```
310
406
 
311
407
  ### Phase 3: AWX/AAP Integration
408
+
312
409
  ```bash
313
410
  # Generate AWX job templates
314
411
  generate_awx_job_template_from_cookbook /path/to/cookbook cookbook_name
@@ -321,6 +418,7 @@ generate_awx_inventory_source_from_chef https://chef.example.com production web_
321
418
  ```
322
419
 
323
420
  ### Phase 4: Habitat to Container Migration
421
+
324
422
  ```bash
325
423
  # Parse Habitat plan
326
424
  parse_habitat_plan /path/to/plan.sh
@@ -333,6 +431,7 @@ generate_compose_from_habitat "/path/to/plan1.sh,/path/to/plan2.sh" my_network
333
431
  ```
334
432
 
335
433
  ### Phase 5: Validation & Testing
434
+
336
435
  ```bash
337
436
  # Generate InSpec validation
338
437
  generate_inspec_from_recipe /path/to/recipe.rb
@@ -342,6 +441,7 @@ convert_inspec_to_test /path/to/inspec_profile testinfra
342
441
  ```
343
442
 
344
443
  ### Performance Profiling & Optimization
444
+
345
445
  Profile cookbook parsing performance to identify bottlenecks and optimize large-scale migrations:
346
446
 
347
447
  ```bash
@@ -362,15 +462,22 @@ profile_parsing_operation recipe /path/to/recipe.rb --detailed
362
462
  ```
363
463
 
364
464
  ### 10. Visual Migration Planning Interface
465
+
365
466
  Interactive web-based interface for Chef-to-Ansible migration planning and visualization:
366
467
 
367
468
  - **Cookbook Analysis Dashboard**: Interactive directory scanning with metadata parsing and complexity assessment
368
- - **Migration Planning Wizard**: Step-by-step migration planning with effort estimation and risk analysis
469
+ - **AI-Assisted Effort Estimation** (v3.3.0+):
470
+ - **Manual Migration Estimate**: Full effort without AI assistance
471
+ - **SousChef-Assisted Estimate**: 50% time reduction through automated boilerplate conversion
472
+ - **Time Savings Display**: Clear comparison showing hours saved and efficiency percentage
473
+ - **Visual Metrics**: Side-by-side metric cards for instant visual comparison
474
+ - **Migration Planning Wizard**: Step-by-step migration planning with dual effort scenarios and risk analysis
369
475
  - **Dependency Mapping**: Visual dependency graphs showing cookbook relationships and migration ordering
370
476
  - **Validation Reports**: Conversion validation results with syntax checking and best practice compliance
371
477
  - **Progress Tracking**: Real-time migration progress with completion metrics and bottleneck identification
372
478
 
373
479
  **Launch the UI:**
480
+
374
481
  ```bash
375
482
  # Using Poetry (development)
376
483
  poetry run souschef ui
@@ -383,6 +490,7 @@ souschef ui --port 8080
383
490
  ```
384
491
 
385
492
  **Run in Docker:**
493
+
386
494
  ```bash
387
495
  # Build the image
388
496
  docker build -t souschef-ui .
@@ -394,6 +502,51 @@ docker run -p 9999:9999 souschef-ui
394
502
  docker-compose up
395
503
  ```
396
504
 
505
+ **Run Published Image from GitHub Container Registry:**
506
+
507
+ SousChef images are automatically published to GitHub Container Registry (GHCR) on each release:
508
+
509
+ ```bash
510
+ # Pull the latest released image
511
+ docker pull ghcr.io/mcp-souschef:latest
512
+
513
+ # Or pull a specific version
514
+ docker pull ghcr.io/mcp-souschef:3.2.0
515
+
516
+ # Run the image with your .env file
517
+ docker run -p 9999:9999 \
518
+ --env-file .env \
519
+ ghcr.io/mcp-souschef:latest
520
+
521
+ # Or with docker-compose
522
+ cat > docker-compose.override.yml << 'EOF'
523
+ version: '3.8'
524
+ services:
525
+ souschef-ui:
526
+ image: ghcr.io/mcp-souschef:latest
527
+ build: ~
528
+ EOF
529
+ docker-compose up
530
+ ```
531
+
532
+ **Container Images:**
533
+
534
+ - **Registry**: GitHub Container Registry (GHCR)
535
+ - **Image Name**: `mcp-souschef`
536
+ - **Full URL**: `ghcr.io/mcp-souschef`
537
+ - **Available Tags**:
538
+ - `latest` - Most recent release
539
+ - `3.2.0` - Specific version (semver)
540
+ - `3.2` - Latest patch of a minor version
541
+ - `3` - Latest patch of a major version
542
+
543
+ **Why use GHCR?**
544
+
545
+ - Integrated with GitHub releases and CI/CD
546
+ - Faster pulls for users in GitHub ecosystem
547
+ - Security scanning and SBOM included
548
+ - Multi-platform support (amd64, arm64)
549
+
397
550
  **Docker Environment Configuration:**
398
551
 
399
552
  SousChef supports AI configuration via environment variables in Docker containers. Create a `.env` file in your project root:
@@ -407,6 +560,7 @@ nano .env
407
560
  ```
408
561
 
409
562
  **Example .env file:**
563
+
410
564
  ```dotenv
411
565
  # AI Configuration
412
566
  SOUSCHEF_AI_PROVIDER=Anthropic (Claude)
@@ -416,6 +570,7 @@ SOUSCHEF_AI_BASE_URL=
416
570
  SOUSCHEF_AI_PROJECT_ID=
417
571
  SOUSCHEF_AI_TEMPERATURE=0.7
418
572
  SOUSCHEF_AI_MAX_TOKENS=4000
573
+ SOUSCHEF_ALLOWED_HOSTNAMES=api.example.com,*.example.org
419
574
 
420
575
  # Streamlit Configuration (optional)
421
576
  STREAMLIT_SERVER_PORT=9999
@@ -423,12 +578,14 @@ STREAMLIT_SERVER_HEADLESS=true
423
578
  ```
424
579
 
425
580
  **Supported AI Providers:**
581
+
426
582
  - `Anthropic (Claude)` - Anthropic Claude models
427
583
  - `OpenAI (GPT)` - OpenAI GPT models
428
584
  - `IBM Watsonx` - IBM Watsonx AI models
429
585
  - `Red Hat Lightspeed` - Red Hat Lightspeed models
430
586
 
431
587
  **Environment Variables:**
588
+
432
589
  - `SOUSCHEF_AI_PROVIDER` - AI provider name (required)
433
590
  - `SOUSCHEF_AI_MODEL` - Model name (required)
434
591
  - `SOUSCHEF_AI_API_KEY` - API key for authentication (required)
@@ -436,8 +593,10 @@ STREAMLIT_SERVER_HEADLESS=true
436
593
  - `SOUSCHEF_AI_PROJECT_ID` - Project ID for Watsonx (optional)
437
594
  - `SOUSCHEF_AI_TEMPERATURE` - Model temperature 0.0-2.0 (optional, default: 0.7)
438
595
  - `SOUSCHEF_AI_MAX_TOKENS` - Maximum tokens to generate (optional, default: 4000)
596
+ - `SOUSCHEF_ALLOWED_HOSTNAMES` - Comma-separated list of allowed hostnames for outbound API requests (optional)
439
597
 
440
598
  **Docker Compose (recommended for development):**
599
+
441
600
  ```yaml
442
601
  version: '3.8'
443
602
  services:
@@ -456,6 +615,7 @@ services:
456
615
  ```
457
616
 
458
617
  **Features:**
618
+
459
619
  - Clean, professional design matching documentation standards
460
620
  - Real-time cookbook analysis with progress indicators
461
621
  - **Interactive dependency visualization** with Plotly graphs and NetworkX analysis
@@ -468,15 +628,17 @@ services:
468
628
  ### Advanced UI Features
469
629
 
470
630
  #### Interactive Dependency Visualization
631
+
471
632
  The UI includes sophisticated dependency graph visualization powered by NetworkX and Plotly:
472
633
 
473
634
  - **Graph Analysis**: Automatic detection of cookbook dependencies, circular references, and migration ordering
474
635
  - **Interactive Exploration**: Zoom, pan, and hover over nodes to explore complex dependency relationships
475
636
  - **Color Coding**: Visual distinction between cookbooks, dependencies, community cookbooks, and circular dependencies
476
637
  - **Static Export**: Matplotlib-based static graphs for reports and documentation
477
- - **Large Graph Support**: Optimized layouts for complex cookbook ecosystems
638
+ - **Large Graph Support**: Optimised layouts for complex cookbook ecosystems
478
639
 
479
640
  #### Real-Time Progress Tracking
641
+
480
642
  All analysis operations include comprehensive progress feedback:
481
643
 
482
644
  - **Progress Bars**: Visual progress indicators for long-running operations
@@ -485,18 +647,21 @@ All analysis operations include comprehensive progress feedback:
485
647
  - **Error Handling**: Graceful error display with recovery suggestions
486
648
 
487
649
  #### Enhanced User Experience
650
+
488
651
  - **Responsive Design**: Clean, professional interface that works across different screen sizes
489
652
  - **Export Options**: Download analysis results, graphs, and migration plans
490
653
  - **Session Persistence**: Maintain analysis state across page refreshes
491
654
  - **Quick Actions**: One-click access to common migration tasks
492
655
 
493
656
  ### Migration Assessment & Reporting
657
+
494
658
  - **Complexity Analysis**: Automated assessment of migration effort and risk factors
495
659
  - **Dependency Mapping**: Complete cookbook dependency analysis with migration ordering
496
660
  - **Impact Analysis**: Resource usage patterns and conversion recommendations
497
661
  - **Executive Reports**: Stakeholder-ready migration reports with timelines and costs
498
662
 
499
663
  ### Modern Deployment Patterns
664
+
500
665
  - **Blue/Green Deployments**: Zero-downtime deployment strategies
501
666
  - **Canary Releases**: Gradual rollout configurations
502
667
  - **Application Patterns**: Modern containerized and cloud-native deployment patterns
@@ -504,6 +669,7 @@ All analysis operations include comprehensive progress feedback:
504
669
  - **Habitat to Container**: Convert Chef Habitat plans to Docker and Docker Compose configurations
505
670
 
506
671
  ### Enterprise Integration
672
+
507
673
  - **AWX/AAP Ready**: Native Ansible Automation Platform integration
508
674
  - **Dynamic Inventory**: Chef server integration for hybrid environments
509
675
  - **Secrets Management**: Secure data bag to Vault conversion
@@ -512,6 +678,7 @@ All analysis operations include comprehensive progress feedback:
512
678
  ## Installation & Setup
513
679
 
514
680
  ### Prerequisites
681
+
515
682
  - Python 3.14+
516
683
  - [Poetry](https://python-poetry.org/) for dependency management
517
684
  - MCP-compatible client (Claude Desktop, VS Code 1.102+ with GitHub Copilot, etc.)
@@ -519,6 +686,7 @@ All analysis operations include comprehensive progress feedback:
519
686
  ### Quick Start
520
687
 
521
688
  1. **Install SousChef**:
689
+
522
690
  ```bash
523
691
  pip install mcp-souschef
524
692
  ```
@@ -528,12 +696,14 @@ All analysis operations include comprehensive progress feedback:
528
696
  Use the pre-configured files in the `config/` directory for quick setup with Claude Desktop, VS Code Copilot, or other MCP clients.
529
697
 
530
698
  **Claude Desktop** (macOS):
699
+
531
700
  ```bash
532
701
  cp config/claude-desktop.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
533
702
  # Restart Claude Desktop
534
703
  ```
535
704
 
536
705
  **VS Code + GitHub Copilot** (requires VS Code 1.102+):
706
+
537
707
  ```bash
538
708
  # macOS/Linux
539
709
  cp config/vscode-copilot.json ~/.config/Code/User/mcp.json
@@ -544,7 +714,7 @@ All analysis operations include comprehensive progress feedback:
544
714
  # Reload VS Code window, then trust the server when prompted
545
715
  ```
546
716
 
547
- ** See [config/CONFIGURATION.md](config/CONFIGURATION.md) for:**
717
+ **See [config/CONFIGURATION.md](config/CONFIGURATION.md) for:**
548
718
  - Platform-specific setup (macOS/Linux/Windows)
549
719
  - Model provider configurations (Red Hat AI, OpenAI, local models)
550
720
  - Development setup
@@ -574,6 +744,7 @@ souschef-cli inspec-convert controls.rb --format testinfra
574
744
  ```
575
745
 
576
746
  **Available Commands:**
747
+
577
748
  - `recipe` - Parse Chef recipe files and extract resources
578
749
  - `template` - Convert ERB templates to Jinja2 with variable extraction
579
750
  - `resource` - Parse custom resources and LWRPs
@@ -629,15 +800,17 @@ poetry update # All packages
629
800
  ```
630
801
 
631
802
  **Automated Systems:**
632
- - Pre-commit hooks auto-update `poetry.lock` when `pyproject.toml` changes
633
- - CI validates lock file on every PR
634
- - Dependabot sends weekly dependency updates
803
+
804
+ - Pre-commit hooks auto-update `poetry.lock` when `pyproject.toml` changes
805
+ - CI validates lock file on every PR
806
+ - Dependabot sends weekly dependency updates
635
807
 
636
808
  See [CONTRIBUTING.md](CONTRIBUTING.md#-managing-dependencies) for detailed dependency management guide.
637
809
 
638
810
  ## Architecture & Design
639
811
 
640
812
  ### MCP Protocol Integration
813
+
641
814
  SousChef leverages the Model Context Protocol (MCP) to provide seamless integration with AI assistants and development environments:
642
815
 
643
816
  - **38 Specialized Tools**: Each migration capability exposed as dedicated MCP tool
@@ -646,6 +819,7 @@ SousChef leverages the Model Context Protocol (MCP) to provide seamless integrat
646
819
  - **Streaming Support**: Efficient handling of large cookbook conversions
647
820
 
648
821
  ### Testing Strategy
822
+
649
823
  Following enterprise-grade testing standards with comprehensive test coverage:
650
824
 
651
825
  - **Unit Tests**: Mock-based testing for individual functions (test_server.py, test_cli.py, test_mcp.py)
@@ -654,9 +828,10 @@ Following enterprise-grade testing standards with comprehensive test coverage:
654
828
  - **Specialized Tests**: Enhanced guards (test_enhanced_guards.py), error handling (test_error_paths.py, test_error_recovery.py), real-world fixtures (test_real_world_fixtures.py)
655
829
  - **Performance Tests**: Benchmarking and optimization validation (test_performance.py)
656
830
  - **Snapshot Tests**: Regression testing for output stability (test_snapshots.py)
657
- - **92% Coverage**: Comprehensive test coverage exceeding the 90% target for production readiness
831
+ - **83% Coverage**: Comprehensive test coverage approaching the 90% target for production readiness
658
832
 
659
833
  ### Quality Assurance
834
+
660
835
  - **Zero Warnings Policy**: All code passes linting without disabling checks
661
836
  - **Type Safety**: Complete type annotations throughout the codebase
662
837
  - **Automated Testing**: CI/CD pipeline with comprehensive test suites
@@ -665,7 +840,9 @@ Following enterprise-grade testing standards with comprehensive test coverage:
665
840
  ## Documentation
666
841
 
667
842
  ### Tool Reference
843
+
668
844
  Each MCP tool includes comprehensive documentation:
845
+
669
846
  - Purpose and use cases
670
847
  - Parameter descriptions and types
671
848
  - Return value specifications
@@ -673,73 +850,12 @@ Each MCP tool includes comprehensive documentation:
673
850
  - Error handling behaviors
674
851
 
675
852
  ### Migration Guides
853
+
676
854
  - **[Enterprise Migration Guide](docs/enterprise-migration.md)** - Complete methodology for large-scale migrations
677
855
  - **[AWX Integration Guide](docs/awx-integration.md)** - Step-by-step AWX/AAP setup and configuration
678
856
  - **[Testing Strategy Guide](docs/testing-strategy.md)** - Validation and testing approaches
679
857
  - **[Best Practices](docs/best-practices.md)** - Recommended patterns and approaches
680
858
 
681
- ## Contributing
682
-
683
- We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for:
684
- - Development setup and workflow
685
- - Code style and testing requirements
686
- - Pull request process
687
- - Issue reporting guidelines
688
-
689
- ## License
690
-
691
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
692
-
693
- ## Roadmap
694
-
695
- ### Completed
696
- - Complete Chef cookbook parsing (recipes, attributes, metadata, templates)
697
- - InSpec profile parsing and conversion to Testinfra/Ansible tests
698
- - Chef resource to Ansible task conversion with module mapping
699
- - Data bags to Ansible Vault conversion
700
- - Chef environments to Ansible inventory conversion
701
- - Chef search patterns to dynamic inventory conversion
702
- - AWX/AAP job templates, workflows, and project generation
703
- - Blue/green and canary deployment pattern generation
704
- - Migration complexity assessment and planning tools
705
- - Comprehensive testing suite (unit, integration, property-based)
706
- - Command-line interface (CLI) for standalone usage
707
- - Enhanced Chef guard handling (arrays, lambda syntax, complex nested conditions)
708
- - Advanced attribute precedence resolution (6 levels with conflict detection)
709
- - Automated release management with Release Please
710
- - Automated branch cleanup for release PRs
711
- - Automated conversion validation and testing framework
712
- - Chef Habitat to containerized deployment conversion (parse_habitat_plan, convert_habitat_to_dockerfile, generate_compose_from_habitat)
713
- - Enhanced error handling with custom exceptions and actionable recovery suggestions
714
- - Technical debt reduction - ALL PHASES COMPLETE: 16 functions refactored (15 C-grade eliminated, 70+ helpers extracted, average 77% complexity reduction, zero C-grade functions remaining)
715
- - Performance profiling and optimization for large cookbooks (profiling module, CLI commands, MCP tools)
716
- - Code duplication elimination (InSpec functions refactored: 55 duplicate lines removed, improved architecture)
717
- - Documentation website with MkDocs + Material theme (charcoal + teal colour scheme, 16 pages)
718
- - Comprehensive documentation content (Getting Started, Tool Reference, Migration Guide, API docs, Examples)
719
- - Integration with additional test frameworks (ServerSpec, Goss) - InSpec conversion now supports 4 output formats
720
- - Jenkins/GitLab CI pipeline generation from Chef cookbook CI patterns (Test Kitchen, ChefSpec, Cookstyle)
721
- - Visual migration planning interface with Streamlit-based web UI for interactive cookbook analysis and migration planning
722
- - **Interactive dependency mapping and visualization** with Plotly graphs and NetworkX analysis
723
- - **Real-time progress tracking** for all analysis operations with Streamlit progress bars
724
- - **Static graph visualization** with matplotlib for reports and documentation
725
- - **Automated ERB to Jinja2 template conversion** - Converts Chef ERB templates to Ansible Jinja2 templates during cookbook conversion
726
- - Converts ERB syntax to Jinja2: `<%= var %>` → `{{ var }}`, `<% if %>` → `{% if %}`
727
- - Extracts template variables for validation and documentation
728
- - Includes converted templates in downloadable playbook archives
729
- - UI displays converted templates with variable lists and preview
730
-
731
- ### Planned
732
- - 📅 Enhanced graph layout algorithms for large dependency networks (force-directed, hierarchical)
733
- - 📅 Export functionality for graphs (PNG, SVG, PDF formats)
734
- - 📅 UI configuration options and themes
735
- - 📅 Performance caching for expensive analysis operations
736
- - 📅 Mobile-responsive design improvements
737
- - 📅 Accessibility enhancements (ARIA labels, keyboard navigation)
738
- - 📅 Integration testing for UI components
739
- - 📅 Advanced filtering and search in dependency graphs
740
- - 📅 Migration templates and presets
741
- - 📅 Terraform provider for infrastructure state management
742
-
743
859
  ## Support & Community
744
860
 
745
861
  - **Issues**: [GitHub Issues](https://github.com/kpeacocke/souschef/issues)
@@ -748,326 +864,23 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
748
864
 
749
865
  ---
750
866
 
751
- **SousChef** - *Transforming infrastructure automation, one recipe at a time.*
752
- desc 'Ensure package nginx is properly configured'
753
- impact 1.0
754
-
755
- describe package('nginx') do
756
- it { should be_installed }
757
- end
758
- end
759
-
760
- control 'service-nginx' do
761
- title 'Verify service nginx'
762
- desc 'Ensure service nginx is properly configured'
763
- impact 1.0
764
-
765
- describe service('nginx') do
766
- it { should be_running }
767
- it { should be_enabled }
768
- end
769
- end
770
-
771
- control 'template--etc-nginx-nginx.conf' do
772
- title 'Verify template /etc/nginx/nginx.conf'
773
- desc 'Ensure template /etc/nginx/nginx.conf is properly configured'
774
- impact 1.0
775
-
776
- describe file('/etc/nginx/nginx.conf') do
777
- it { should exist }
778
- its('mode') { should cmp '0644' }
779
- its('owner') { should eq 'root' }
780
- its('group') { should eq 'root' }
781
- end
782
- end
783
- ```
784
-
785
- #### Testinfra Integration
786
-
787
- Convert to Python tests for CI/CD pipelines:
788
-
789
- ```bash
790
- souschef-cli inspec-convert validation-controls.rb --format testinfra
791
- ```
792
-
793
- ```python
794
- import pytest
795
-
796
- def test_package_nginx(host):
797
- """Ensure package nginx is properly configured"""
798
- pkg = host.package("nginx")
799
- assert pkg.is_installed
800
-
801
- def test_service_nginx(host):
802
- """Ensure service nginx is properly configured"""
803
- svc = host.service("nginx")
804
- assert svc.is_running
805
- assert svc.is_enabled
806
-
807
- def test_template_etc_nginx_nginx_conf(host):
808
- """Ensure template /etc/nginx/nginx.conf is properly configured"""
809
- f = host.file("/etc/nginx/nginx.conf")
810
- assert f.exists
811
- assert oct(f.mode) == "0644"
812
- assert f.user == "root"
813
- assert f.group == "root"
814
- ```
867
+ ## SousChef
815
868
 
816
- #### Ansible Assert Integration
817
-
818
- For Ansible playbook validation:
819
-
820
- ```bash
821
- souschef-cli inspec-convert validation-controls.rb --format ansible_assert
822
- ```
823
-
824
- ```yaml
825
- ---
826
- # Validation tasks converted from InSpec
827
-
828
- - name: Verify package nginx
829
- ansible.builtin.assert:
830
- that:
831
- - ansible_facts.packages['nginx'] is defined
832
- fail_msg: "Ensure package nginx is properly configured validation failed"
833
-
834
- - name: Verify service nginx
835
- ansible.builtin.assert:
836
- that:
837
- - services['nginx'].state == 'running'
838
- - services['nginx'].status == 'enabled'
839
- fail_msg: "Ensure service nginx is properly configured validation failed"
840
- ```
841
-
842
- #### Benefits
843
-
844
- - **Consistency Validation** - Ensure Chef and Ansible produce identical infrastructure state
845
- - **AI Context Enhancement** - InSpec profiles help AI understand infrastructure intent
846
- - **Automated Testing** - Generate tests automatically from Chef recipes
847
- - **Multiple Test Formats** - Support for InSpec, Testinfra, and Ansible assert
848
- - **CI/CD Integration** - Easy integration with existing test pipelines
849
-
850
- ### As an MCP Server
851
-
852
- SousChef is designed to be used as an MCP server with AI assistants that support the Model Context Protocol.
853
-
854
- #### Configure with Claude Desktop
855
-
856
- Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
857
-
858
- ```json
859
- {
860
- "mcpServers": {
861
- "souschef": {
862
- "command": "poetry",
863
- "args": [
864
- "-C",
865
- "/path/to/souschef",
866
- "run",
867
- "souschef"
868
- ]
869
- }
870
- }
871
- }
872
- ```
873
-
874
- ### Available Tools
875
-
876
- #### `list_directory(path: str)`
877
- List the contents of a directory.
878
-
879
- **Example:**
880
- ```python
881
- list_directory("/path/to/cookbooks")
882
- # Returns: ['nginx', 'apache2', 'mysql']
883
- ```
884
-
885
- #### `read_file(path: str)`
886
- Read the contents of a file.
887
-
888
- **Example:**
889
- ```python
890
- read_file("/path/to/cookbook/recipes/default.rb")
891
- # Returns: file contents as string
892
- ```
893
-
894
- #### `read_cookbook_metadata(path: str)`
895
- Parse Chef cookbook metadata.rb file.
896
-
897
- **Example:**
898
- ```python
899
- read_cookbook_metadata("/path/to/cookbook/metadata.rb")
900
- # Returns:
901
- # name: nginx
902
- # maintainer: Chef Software, Inc.
903
- # version: 8.0.0
904
- # depends: logrotate, iptables
905
- ```
906
-
907
- #### `parse_recipe(path: str)`
908
- Parse a Chef recipe file and extract resources.
909
-
910
- **Example:**
911
- ```python
912
- parse_recipe("/path/to/cookbook/recipes/default.rb")
913
- # Returns:
914
- # Resource 1:
915
- # Type: package
916
- # Name: nginx
917
- # Action: install
918
- ```
919
-
920
- #### `parse_attributes(path: str, resolve_precedence: bool = True)`
921
- Parse a Chef attributes file and extract attribute definitions with precedence analysis.
922
-
923
- **Chef Attribute Precedence** (lowest to highest):
924
- 1. `default` - Normal default value
925
- 2. `force_default` - Forced default, higher than regular default
926
- 3. `normal` - Normal attribute set by cookbook
927
- 4. `override` - Override values
928
- 5. `force_override` - Forced override, cannot be overridden
929
- 6. `automatic` - Automatically detected by Ohai (highest precedence)
930
-
931
- When multiple attributes with the same path exist at different precedence levels, the highest precedence wins. The tool automatically resolves conflicts and reports which values were overridden.
932
-
933
- **Parameters:**
934
- - `path`: Path to the attributes (.rb) file
935
- - `resolve_precedence`: If True (default), resolves conflicts and shows only winning values. If False, shows all attributes.
936
-
937
- **Example:**
938
- ```python
939
- # With precedence resolution (default)
940
- parse_attributes("/path/to/cookbook/attributes/default.rb")
941
- # Returns:
942
- # Resolved Attributes (with precedence):
943
- # ==================================================
944
- #
945
- # Attribute: nginx.port
946
- # Value: 443
947
- # Precedence: force_override (level 5)
948
- # Overridden values: default=80, normal=8080
949
- #
950
- # Attribute: nginx.ssl_port
951
- # Value: 443
952
- # Precedence: default (level 1)
953
- #
954
- # ==================================================
955
- # Total attributes: 2
956
- # Attributes with precedence conflicts: 1
957
-
958
- # Without precedence resolution (show all)
959
- parse_attributes("/path/to/cookbook/attributes/default.rb", resolve_precedence=False)
960
- # Returns:
961
- # default[nginx.port] = 80
962
- # normal[nginx.port] = 8080
963
- # force_override[nginx.port] = 443
964
- # default[nginx.ssl_port] = 443
965
- ```
966
-
967
- **Use Cases:**
968
- - Understanding attribute conflicts in complex cookbooks
969
- - Debugging which attributes will actually be applied
970
- - Planning attribute migrations to Ansible variables
971
- - Identifying force_override attributes that need special handling
972
-
973
- #### `list_cookbook_structure(path: str)`
974
- List the structure of a Chef cookbook directory.
975
-
976
- **Example:**
977
- ```python
978
- list_cookbook_structure("/path/to/cookbook")
979
- # Returns:
980
- # recipes/
981
- # default.rb
982
- # install.rb
983
- # attributes/
984
- # default.rb
985
- # metadata/
986
- # metadata.rb
987
- ```
988
-
989
- #### `parse_template(path: str)`
990
- Parse a Chef ERB template file and convert it to Jinja2 format.
991
-
992
- **Example:**
993
- ```python
994
- parse_template("/path/to/cookbook/templates/default/nginx.conf.erb")
995
- # Returns JSON with:
996
- # {
997
- # "original_file": "/path/to/cookbook/templates/default/nginx.conf.erb",
998
- # "variables": [
999
- # "nginx']['port",
1000
- # "nginx']['server_name",
1001
- # "nginx']['ssl_enabled"
1002
- # ],
1003
- # "jinja2_template": "server {\n listen {{ nginx']['port }};\n {% if nginx']['ssl_enabled %}\n ssl on;\n {% endif %}\n}"
1004
- # }
1005
- ```
1006
-
1007
- **ERB to Jinja2 Conversion:**
1008
- - Variable output: `<%= var %>` → `{{ var }}`
1009
- - Instance variables: `<%= @var %>` → `{{ var }}`
1010
- - Node attributes: `<%= node['attr'] %>` → `{{ attr }}`
1011
- - Conditionals: `<% if cond %>` → `{% if cond %}`
1012
- - Unless: `<% unless cond %>` → `{% if not cond %}`
1013
- - Elsif: `<% elsif cond %>` → `{% elif cond %}`
1014
- - Else: `<% else %>` → `{% else %}`
1015
- - Loops: `<% arr.each do |item| %>` → `{% for item in arr %}`
1016
- - End blocks: `<% end %>` → `{% endif %}` or `{% endfor %}`
1017
-
1018
- #### `parse_custom_resource(path: str)`
1019
- Parse a Chef custom resource or LWRP file and extract properties, attributes, and actions.
1020
-
1021
- **Example:**
1022
- ```python
1023
- parse_custom_resource("/path/to/cookbook/resources/app_config.rb")
1024
- # Returns JSON with:
1025
- # {
1026
- # "resource_file": "/path/to/cookbook/resources/app_config.rb",
1027
- # "resource_name": "app_config",
1028
- # "resource_type": "custom_resource", # or "lwrp"
1029
- # "properties": [
1030
- # {
1031
- # "name": "config_name",
1032
- # "type": "String",
1033
- # "name_property": true
1034
- # },
1035
- # {
1036
- # "name": "port",
1037
- # "type": "Integer",
1038
- # "default": "8080"
1039
- # },
1040
- # {
1041
- # "name": "ssl_enabled",
1042
- # "type": "[true, false]",
1043
- # "default": "false"
1044
- # }
1045
- # ],
1046
- # "actions": ["create", "delete"],
1047
- # "default_action": "create"
1048
- # }
1049
- ```
1050
-
1051
- **Detected Resource Types:**
1052
- - **Custom Resource** (modern) - Uses `property` keyword
1053
- - **LWRP** (legacy) - Uses `attribute` keyword with `kind_of:`
1054
-
1055
- **Property/Attribute Fields:**
1056
- - `name` - Property/attribute name
1057
- - `type` - Type constraint (String, Integer, Boolean, Array, Hash, etc.)
1058
- - `name_property` - Whether this is the resource's name property (true/false)
1059
869
  - `default` - Default value if specified
1060
870
  - `required` - Whether the property is required (true/false)
1061
871
 
1062
872
  **Action Extraction:**
873
+
1063
874
  - Modern format: `action :name do ... end`
1064
875
  - LWRP format: `actions :create, :delete, :update`
1065
876
  - Supports both formats and mixed declarations
1066
877
 
1067
- #### `convert_resource_to_task(resource_type: str, resource_name: str, action: str = "create", properties: str = "")`
878
+ ### `convert_resource_to_task(resource_type: str, resource_name: str, action: str = "create", properties: str = "")`
879
+
1068
880
  Convert a Chef resource to an Ansible task.
1069
881
 
1070
882
  **Example:**
883
+
1071
884
  ```python
1072
885
  convert_resource_to_task("package", "nginx", "install")
1073
886
  # Returns:
@@ -1094,6 +907,7 @@ convert_resource_to_task("template", "/etc/nginx/nginx.conf.erb", "create")
1094
907
  ```
1095
908
 
1096
909
  **Supported Resource Types:**
910
+
1097
911
  - `package` → `ansible.builtin.package`
1098
912
  - `service` → `ansible.builtin.service`
1099
913
  - `template` → `ansible.builtin.template`
@@ -1106,9 +920,11 @@ convert_resource_to_task("template", "/etc/nginx/nginx.conf.erb", "create")
1106
920
  - And more...
1107
921
 
1108
922
  #### `parse_habitat_plan(plan_path: str)`
923
+
1109
924
  Parse a Chef Habitat plan file (plan.sh) and extract package metadata, dependencies, build/install hooks, and service configuration.
1110
925
 
1111
926
  **Example:**
927
+
1112
928
  ```python
1113
929
  parse_habitat_plan("/path/to/habitat/plan.sh")
1114
930
  # Returns JSON with:
@@ -1144,6 +960,7 @@ parse_habitat_plan("/path/to/habitat/plan.sh")
1144
960
  ```
1145
961
 
1146
962
  **Extracted Information:**
963
+
1147
964
  - **Package metadata**: name, origin, version, maintainer, description
1148
965
  - **Dependencies**: Build-time and runtime package dependencies
1149
966
  - **Ports**: Exported port configurations for service discovery
@@ -1152,15 +969,18 @@ parse_habitat_plan("/path/to/habitat/plan.sh")
1152
969
  - **Build callbacks**: do_build, do_install, do_init, and other lifecycle hooks
1153
970
 
1154
971
  **Use Cases:**
972
+
1155
973
  - Understanding Habitat application structure before containerization
1156
974
  - Extracting dependencies for Docker base image selection
1157
975
  - Planning port mappings for docker-compose configurations
1158
976
  - Analyzing service dependencies and orchestration needs
1159
977
 
1160
978
  #### `convert_habitat_to_dockerfile(plan_path: str, base_image: str = "ubuntu:22.04")`
979
+
1161
980
  Convert a Chef Habitat plan to a production-ready Dockerfile with security validation.
1162
981
 
1163
982
  **Example:**
983
+
1164
984
  ```python
1165
985
  convert_habitat_to_dockerfile("/path/to/habitat/plan.sh", "ubuntu:22.04")
1166
986
  # Returns:
@@ -1202,10 +1022,12 @@ convert_habitat_to_dockerfile("/path/to/habitat/plan.sh", "ubuntu:22.04")
1202
1022
  ```
1203
1023
 
1204
1024
  **Parameters:**
1025
+
1205
1026
  - `plan_path`: Path to the Habitat plan.sh file
1206
1027
  - `base_image`: Docker base image (default: ubuntu:22.04). Validated for security
1207
1028
 
1208
1029
  **Features:**
1030
+
1209
1031
  - **Dependency mapping**: Converts Habitat dependencies to apt packages
1210
1032
  - **Build optimization**: Multi-stage builds when applicable
1211
1033
  - **Security scanning**: Detects dangerous patterns (curl|sh, eval, etc.)
@@ -1217,9 +1039,11 @@ convert_habitat_to_dockerfile("/path/to/habitat/plan.sh", "ubuntu:22.04")
1217
1039
  The tool processes shell commands from Habitat plans and includes them in the Dockerfile. Only use with trusted Habitat plans from known sources. Review generated Dockerfiles before building images.
1218
1040
 
1219
1041
  #### `generate_compose_from_habitat(plan_paths: str, network_name: str = "habitat_net")`
1042
+
1220
1043
  Generate docker-compose.yml from multiple Habitat plans for multi-service deployments.
1221
1044
 
1222
1045
  **Example:**
1046
+
1223
1047
  ```python
1224
1048
  # Single service
1225
1049
  generate_compose_from_habitat("/path/to/nginx/plan.sh", "myapp_network")
@@ -1289,10 +1113,12 @@ generate_compose_from_habitat(
1289
1113
  ```
1290
1114
 
1291
1115
  **Parameters:**
1116
+
1292
1117
  - `plan_paths`: Comma-separated paths to plan.sh files for multiple services
1293
1118
  - `network_name`: Docker network name for service communication (default: habitat_net)
1294
1119
 
1295
1120
  **Features:**
1121
+
1296
1122
  - **Multi-service orchestration**: Combines multiple Habitat plans into one compose file
1297
1123
  - **Automatic dependencies**: Creates depends_on from Habitat service binds
1298
1124
  - **Volume detection**: Identifies services needing persistent storage from do_init callbacks
@@ -1301,6 +1127,7 @@ generate_compose_from_habitat(
1301
1127
  - **Environment variables**: Generates environment configuration from port definitions
1302
1128
 
1303
1129
  **Use Cases:**
1130
+
1304
1131
  - Converting multi-service Habitat applications to Docker Compose
1305
1132
  - Creating development environments from production Habitat plans
1306
1133
  - Simplifying container orchestration for local testing
@@ -1310,7 +1137,7 @@ generate_compose_from_habitat(
1310
1137
 
1311
1138
  ### Project Structure
1312
1139
 
1313
- ```
1140
+ ```text
1314
1141
  souschef/
1315
1142
  ├── souschef/
1316
1143
  │ ├── __init__.py
@@ -1330,12 +1157,14 @@ souschef/
1330
1157
  SousChef uses a modern Python toolchain for code quality:
1331
1158
 
1332
1159
  - **Ruff**: Primary linter and formatter (replaces Black, isort, flake8)
1160
+
1333
1161
  ```bash
1334
1162
  poetry run ruff check . # Lint code
1335
1163
  poetry run ruff format . # Format code
1336
1164
  ```
1337
1165
 
1338
1166
  - **mypy**: Static type checking for CI/CD
1167
+
1339
1168
  ```bash
1340
1169
  poetry run mypy souschef # Type check source code
1341
1170
  ```
@@ -1345,11 +1174,13 @@ SousChef uses a modern Python toolchain for code quality:
1345
1174
  - Provides immediate feedback during development
1346
1175
 
1347
1176
  - **pytest**: Testing framework with coverage reporting
1177
+
1348
1178
  ```bash
1349
1179
  poetry run pytest --cov=souschef --cov-report=term-missing
1350
1180
  ```
1351
1181
 
1352
1182
  **Quality Requirements:**
1183
+
1353
1184
  - Zero warnings from all tools (Ruff, mypy, Pylance)
1354
1185
  - Type hints required for all functions
1355
1186
  - Google-style docstrings
@@ -1367,18 +1198,18 @@ poetry run pytest
1367
1198
  poetry run pytest --cov=souschef --cov-report=term-missing --cov-report=html
1368
1199
 
1369
1200
  # Run specific test suites
1370
- poetry run pytest tests/test_server.py # Core unit tests
1371
- poetry run pytest tests/test_cli.py # CLI tests
1372
- poetry run pytest tests/test_mcp.py # MCP protocol tests
1373
- poetry run pytest tests/test_integration.py # Integration tests
1374
- poetry run pytest tests/test_integration_accuracy.py # Accuracy validation
1375
- poetry run pytest tests/test_enhanced_guards.py # Guard conversion tests
1376
- poetry run pytest tests/test_error_paths.py # Error handling
1377
- poetry run pytest tests/test_error_recovery.py # Error recovery
1378
- poetry run pytest tests/test_real_world_fixtures.py # Real-world cookbooks
1379
- poetry run pytest tests/test_property_based.py # Hypothesis fuzz tests
1380
- poetry run pytest tests/test_performance.py # Performance benchmarks
1381
- poetry run pytest tests/test_snapshots.py # Snapshot regression tests
1201
+ poetry run pytest tests/unit/test_server.py # Core unit tests
1202
+ poetry run pytest tests/unit/test_cli.py # CLI tests
1203
+ poetry run pytest tests/e2e/test_mcp.py # MCP protocol tests
1204
+ poetry run pytest tests/integration/test_integration.py # Integration tests
1205
+ poetry run pytest tests/integration/test_integration_accuracy.py # Accuracy validation
1206
+ poetry run pytest tests/unit/test_enhanced_guards.py # Guard conversion tests
1207
+ poetry run pytest tests/unit/test_error_paths.py # Error handling
1208
+ poetry run pytest tests/unit/test_error_recovery.py # Error recovery
1209
+ poetry run pytest tests/integration/test_real_world_fixtures.py # Real-world cookbooks
1210
+ poetry run pytest tests/unit/test_property_based.py # Hypothesis fuzz tests
1211
+ poetry run pytest tests/integration/test_performance.py # Performance benchmarks
1212
+ poetry run pytest tests/unit/test_snapshots.py # Snapshot regression tests
1382
1213
 
1383
1214
  # Run with benchmarks
1384
1215
  poetry run pytest --benchmark-only
@@ -1418,7 +1249,7 @@ The project includes comprehensive test coverage across multiple dimensions:
1418
1249
  - **Snapshots** (`test_snapshots.py`): Regression testing for output stability
1419
1250
 
1420
1251
  5. **Test Fixtures**
1421
- - Sample Chef cookbooks in `tests/fixtures/`
1252
+ - Sample Chef cookbooks in `tests/integration/fixtures/`
1422
1253
  - Multiple cookbook types: apache2, docker, mysql, nodejs, legacy Chef 12, Habitat plans
1423
1254
  - Real-world metadata, recipes, attributes, and resources
1424
1255
  - Used across integration and accuracy testing
@@ -1444,6 +1275,7 @@ poetry run mutmut results
1444
1275
  ### VS Code Tasks
1445
1276
 
1446
1277
  The project includes several VS Code tasks:
1278
+
1447
1279
  - **Run Tests** - Execute test suite
1448
1280
  - **Run Tests with Coverage** - Generate coverage reports
1449
1281
  - **Lint (Ruff)** - Check code quality
@@ -1457,6 +1289,7 @@ Thank you for your interest in contributing to SousChef!
1457
1289
  **Before you start**, please read the [**Architecture Guide**](docs/ARCHITECTURE.md) to understand where different code belongs and why. This is essential for understanding how to structure your contributions.
1458
1290
 
1459
1291
  For complete contributing guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md), which includes:
1292
+
1460
1293
  - Development setup instructions
1461
1294
  - Code standards and quality tools
1462
1295
  - Testing requirements and patterns
@@ -1464,6 +1297,7 @@ For complete contributing guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md), wh
1464
1297
  - Release procedures
1465
1298
 
1466
1299
  **Quick Checklist for Contributions:**
1300
+
1467
1301
  1. Read [**docs/ARCHITECTURE.md**](docs/ARCHITECTURE.md) to understand module structure
1468
1302
  2. Ensure all tests pass: `poetry run pytest`
1469
1303
  3. Code passes linting: `poetry run ruff check .`
@@ -1481,5 +1315,3 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
1481
1315
 
1482
1316
  ---
1483
1317
 
1484
- **SousChef** - *Ansible automation, one recipe at a time.*
1485
-